{
  "version": 3,
  "sources": ["../../../../../node_modules/core-js/modules/_is-object.js", "../../../../../node_modules/core-js/modules/_an-object.js", "../../../../../node_modules/core-js/modules/_defined.js", "../../../../../node_modules/core-js/modules/_to-object.js", "../../../../../node_modules/core-js/modules/_to-integer.js", "../../../../../node_modules/core-js/modules/_to-length.js", "../../../../../node_modules/core-js/modules/_string-at.js", "../../../../../node_modules/core-js/modules/_advance-string-index.js", "../../../../../node_modules/core-js/modules/_cof.js", "../../../../../node_modules/core-js/modules/_core.js", "../../../../../node_modules/core-js/modules/_global.js", "../../../../../node_modules/core-js/modules/_library.js", "../../../../../node_modules/core-js/modules/_shared.js", "../../../../../node_modules/core-js/modules/_uid.js", "../../../../../node_modules/core-js/modules/_wks.js", "../../../../../node_modules/core-js/modules/_classof.js", "../../../../../node_modules/core-js/modules/_regexp-exec-abstract.js", "../../../../../node_modules/core-js/modules/_flags.js", "../../../../../node_modules/core-js/modules/_regexp-exec.js", "../../../../../node_modules/core-js/modules/_fails.js", "../../../../../node_modules/core-js/modules/_descriptors.js", "../../../../../node_modules/core-js/modules/_dom-create.js", "../../../../../node_modules/core-js/modules/_ie8-dom-define.js", "../../../../../node_modules/core-js/modules/_to-primitive.js", "../../../../../node_modules/core-js/modules/_object-dp.js", "../../../../../node_modules/core-js/modules/_property-desc.js", "../../../../../node_modules/core-js/modules/_hide.js", "../../../../../node_modules/core-js/modules/_has.js", "../../../../../node_modules/core-js/modules/_function-to-string.js", "../../../../../node_modules/core-js/modules/_redefine.js", "../../../../../node_modules/core-js/modules/_a-function.js", "../../../../../node_modules/core-js/modules/_ctx.js", "../../../../../node_modules/core-js/modules/_export.js", "../../../../../node_modules/core-js/modules/es6.regexp.exec.js", "../../../../../node_modules/core-js/modules/_fix-re-wks.js", "../../../../../node_modules/core-js/modules/_iobject.js", "../../../../../node_modules/core-js/modules/_to-iobject.js", "../../../../../node_modules/core-js/modules/_to-absolute-index.js", "../../../../../node_modules/core-js/modules/_array-includes.js", "../../../../../node_modules/core-js/modules/_strict-method.js", "../../../../../node_modules/core-js/modules/_object-pie.js", "../../../../../node_modules/core-js/modules/_object-gopd.js", "../../../../../node_modules/core-js/modules/_set-proto.js", "../../../../../node_modules/core-js/modules/_inherit-if-required.js", "../../../../../node_modules/core-js/modules/_shared-key.js", "../../../../../node_modules/core-js/modules/_object-keys-internal.js", "../../../../../node_modules/core-js/modules/_enum-bug-keys.js", "../../../../../node_modules/core-js/modules/_object-gopn.js", "../../../../../node_modules/core-js/modules/_is-regexp.js", "../../../../../node_modules/core-js/modules/_set-species.js", "../../../../../node_modules/core-js/modules/_species-constructor.js", "../../../../../node_modules/twitter-text/node_modules/punycode/punycode.js", "../../../../../node_modules/core-js/modules/es6.regexp.flags.js", "../../../../../node_modules/core-js/modules/_is-array.js", "../../../../../node_modules/core-js/modules/_array-reduce.js", "../../../../../node_modules/core-js/modules/_add-to-unscopables.js", "../../../../../node_modules/core-js/modules/_iter-step.js", "../../../../../node_modules/core-js/modules/_iterators.js", "../../../../../node_modules/core-js/modules/_object-keys.js", "../../../../../node_modules/core-js/modules/_object-dps.js", "../../../../../node_modules/core-js/modules/_html.js", "../../../../../node_modules/core-js/modules/_object-create.js", "../../../../../node_modules/core-js/modules/_set-to-string-tag.js", "../../../../../node_modules/core-js/modules/_iter-create.js", "../../../../../node_modules/core-js/modules/_object-gpo.js", "../../../../../node_modules/core-js/modules/_iter-define.js", "../../../../../node_modules/core-js/modules/es6.array.iterator.js", "../../../../../node_modules/core-js/modules/_object-sap.js", "../../../../../node_modules/twemoji-parser/dist/lib/regex.js", "../../../../../node_modules/twemoji-parser/dist/index.js", "../../../../../node_modules/core-js/modules/_object-gops.js", "../../../../../node_modules/core-js/modules/_own-keys.js", "../../../../../node_modules/core-js/modules/_create-property.js", "../../../../../node_modules/core-js/modules/_array-species-constructor.js", "../../../../../node_modules/core-js/modules/_array-species-create.js", "../../../../../node_modules/core-js/modules/_array-methods.js", "../../../../../node_modules/core-js/modules/_meta.js", "../../../../../node_modules/core-js/modules/_wks-ext.js", "../../../../../node_modules/core-js/modules/_wks-define.js", "../../../../../node_modules/core-js/modules/_enum-keys.js", "../../../../../node_modules/core-js/modules/_object-gopn-ext.js", "../../../../../node_modules/core-js/modules/_iter-call.js", "../../../../../node_modules/core-js/modules/_is-array-iter.js", "../../../../../node_modules/core-js/modules/core.get-iterator-method.js", "../../../../../node_modules/core-js/modules/_iter-detect.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/AppLaunch.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/CommentCreate.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/CommentDelete.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/CommentUpdate.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ComponentCodeOverrideSet.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ExportBitmap.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/GridsDelete.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ThreadArchive.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ToggleGrids.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ToggleRulers.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/TutorialVideoStarted.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/TutorialVideoStep.js", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/VariableDelete.js", "../../src/document/installFramerEventEditReasonTracking.ts", "../../../../services/src/generated/typescript/service-runtime/EditorAppHelper.ts", "../../../../services/src/generated/typescript/EditorApp.ts", "../../../../services/src/generated/typescript/service-runtime/ElectronProjectHelper.ts", "../../../../services/src/generated/typescript/ElectronProject.ts", "../../../../services/src/generated/typescript/service-runtime/ElectronProjectV2Helper.ts", "../../../../services/src/generated/typescript/ElectronProjectV2.ts", "../../../../services/src/generated/typescript/service-runtime/ElectronWebRenderingHelper.ts", "../../../../services/src/generated/typescript/ElectronWebRendering.ts", "../../../../services/src/generated/typescript/service-runtime/ElectronWebRenderingV2Helper.ts", "../../../../services/src/generated/typescript/ElectronWebRenderingV2.ts", "../../../../services/src/generated/typescript/service-runtime/SnapshotViewportHelper.ts", "../../../../services/src/generated/typescript/SnapshotViewport.ts", "../../../../services/src/generated/typescript/service-runtime/MenuActionTargetHelper.ts", "../../../../services/src/generated/typescript/MenuActionTarget.ts", "../../src/document/components/Layout.tsx", "../../src/document/document.tsx", "../../src/tutorial-next/Tutorial.tsx", "../../src/web/pages/projects/components/learn/utils/tutorials.ts", "../../src/tutorial-next/Player.tsx", "../../src/tutorial-next/Player.styles.ts", "../../src/tutorial-next/PlayerControls.styles.ts", "../../src/tutorial-next/PlayerControls.tsx", "../../src/tutorial-next/Steps.tsx", "../../src/tutorial-next/YouTube.tsx", "../../src/tutorial-next/tutorialToastKey.ts", "../../src/document/components/Document.tsx", "../../src/app/agent/canViewAgent.ts", "../../src/app/ai/utils/kitProject.ts", "../../src/document/ipc/menu.ts", "../../src/history/persistTimelinePanelState.ts", "../../src/history/resetVersionHistoryState.ts", "../../src/document/components/utils/useChromeOverlay.tsx", "../../src/web/pages/project/lib/useHistory.tsx", "../../src/web/pages/project/lib/HistoryController.tsx", "../../src/document/components/chrome/Pages/utils/createFolder.ts", "../../src/document/components/chrome/Pages/utils/sortRouteSegments.ts", "../../src/document/components/chrome/projectbar/insertButtonTooltipKey.ts", "../../src/document/components/chrome/projectbar/InsertButtonTooltip.tsx", "../../src/document/components/utils/pageLinkHelpers.ts", "../../src/document/components/chrome/properties/panels/LinkPanel.tsx", "../../src/document/components/chrome/links.ts", "../../src/document/components/chrome/properties/panels/LinkOptionRows.tsx", "../../src/document/components/chrome/properties/panels/LinkStylePresetRow.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeLinkStylePresetRow.tsx", "../../src/document/components/chrome/properties/panels/utils/useLinkStylePresets.tsx", "../../src/document/components/chrome/shared/FontPopout/FontPopoutControls.ts", "../../src/document/components/utils/canAddPageLink.ts", "../../src/document/models/CanvasTree/utils/getStyleSourceNodeFromVectorNodes.ts", "../../src/document/components/utils/performShapeBooleanAction.ts", "../../src/document/components/DocumentActionTarget.tsx", "../../src/document/components/canvas-hud/Grid.tsx", "../../src/document/components/canvas-hud/OverlayGrids.tsx", "../../src/document/components/canvas-hud/OverlayGrids.styles.ts", "../../src/document/components/canvas-hud/RulerWrapper.tsx", "../../src/document/components/canvas-hud/Guide.tsx", "../../src/document/components/canvas-hud/Guide.styles.ts", "../../src/document/components/canvas-hud/Ruler.tsx", "../../src/document/components/canvas/CanvasEventTarget.tsx", "../../src/app/agent/components/Feedback/FeedbackThreadPopover.tsx", "../../src/app/agent/components/Feedback/FeedbackThreadPopover.styles.ts", "../../src/document/components/chrome/feedback/dispatcher.ts", "../../src/feedback/useCommentContextMenu.ts", "../../src/app/agent/components/Feedback/InlineFeedbackThread.tsx", "../../src/feedback/mentionPlugin.ts", "../../src/feedback/useFeedbackCommentEditorView.ts", "../../src/app/agent/components/Feedback/InlineFeedbackComment.tsx", "../../src/app/agent/components/Feedback/FeedbackThreadActions.tsx", "../../src/app/agent/components/Feedback/FeedbackThreadActions.styles.ts", "../../src/app/agent/components/Feedback/agentFeedbackComment.styles.ts", "../../src/app/agent/components/Feedback/InlineFeedbackComment.styles.ts", "../../src/feedback/FeedbackCommentForm.tsx", "../../src/web/pages/project/lib/useRemoteDispatch.ts", "../../src/feedback/FeedbackCommentForm.styles.ts", "../../src/feedback/MentionSuggestionList.tsx", "../../src/users/initials.ts", "../../src/feedback/CommentAvatar.styles.ts", "../../src/feedback/MagicColorContext.tsx", "../../src/feedback/CommentAvatar.tsx", "../../src/feedback/MentionSuggestionList.styles.ts", "../../src/app/agent/components/Feedback/InlineFeedbackComposer.styles.ts", "../../src/app/agent/components/Feedback/InlineFeedbackComposer.tsx", "../../src/app/agent/components/Feedback/InlineFeedbackThread.styles.ts", "../../src/document/components/canvas/FeedbackSurface.tsx", "../../src/feedback/FeedbackPin.tsx", "../../src/feedback/FeedbackPin.styles.ts", "../../src/document/components/canvas/FeedbackSurface.styles.ts", "../../src/document/components/canvas/HUD.tsx", "../../src/document/components/canvas-hud/NodeLinksContainer.tsx", "../../src/document/components/canvas-hud/Arrow.tsx", "../../src/document/components/canvas-hud/Outlet.tsx", "../../src/document/components/canvas-hud/NodeLinks.tsx", "../../src/document/components/tools/linkTool/Link.tsx", "../../src/document/components/tools/linkTool/LinkPopover.tsx", "../../src/document/components/tools/shared/CanvasPopover.tsx", "../../src/document/components/tools/utils/popoverAnimations.ts", "../../src/document/components/tools/shared/CanvasPopover.styles.ts", "../../src/document/components/chrome/properties/panels/EventActionProperties.tsx", "../../src/document/components/utils/gamepad.ts", "../../src/document/components/chrome/properties/codeComponentRows/KeyInputRow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/KeyInputRow.styles.ts", "../../src/document/components/chrome/properties/codeComponentRows/NavigationTargetRow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/TransitionControlPropRow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/VariantSelector.tsx", "../../src/document/components/chrome/properties/panels/EventActionDelayRow.tsx", "../../src/document/components/chrome/properties/panels/EventActionInputValueRow.tsx", "../../src/document/components/chrome/properties/panels/EventActionPauseOffscreenRow.tsx", "../../src/document/components/chrome/properties/panels/EventActionSetVariableValueRows.tsx", "../../src/document/components/chrome/properties/panels/utils/displayActionsMenu.ts", "../../src/document/components/chrome/properties/panels/EventActionTriggerRow.tsx", "../../src/document/components/chrome/properties/panels/EventActionVariableRow.tsx", "../../src/document/components/chrome/properties/panels/PageLinkingRowsForAction.tsx", "../../src/document/components/tools/linkTool/InteractionConfig.tsx", "../../src/document/components/tools/linkTool/LinkPopover.styles.ts", "../../src/document/components/canvas-hud/ActionOutlet.styles.ts", "../../src/document/components/canvas-hud/ActionOutlet.tsx", "../../src/document/components/canvas-hud/Arrows.tsx", "../../src/document/components/canvas-hud/Screens.tsx", "../../src/document/components/canvas-hud/ScreenTitle.tsx", "../../src/document/components/AutoSizeEditableText.tsx", "../../src/document/components/AutoSizeEditableText.styles.ts", "../../src/document/components/canvas-hud/ScreenTitle.styles.ts", "../../src/document/components/chrome/localization/useActiveScopeVisibleInLocale.tsx", "../../src/document/components/tools/utils/agentToolHelpers.ts", "../../src/document/components/utils/chat.styles.ts", "../../src/document/components/canvas-hud/AIGeneratingIcon.styles.ts", "../../src/document/components/canvas-hud/AgentBreakpointBar.styles.ts", "../../src/document/components/canvas-hud/AIGeneratingIcon.tsx", "../../src/document/components/canvas-hud/BreakpointCreationButton.styles.ts", "../../src/document/components/canvas-hud/BreakpointCreationButton.tsx", "../../src/document/components/canvas-hud/PlayButton.styles.ts", "../../src/document/components/canvas-hud/PlayButton.tsx", "../../src/document/components/canvas-hud/ScreenTitleAgentAnimation.tsx", "../../src/document/components/canvas-hud/ScreenTitleAgentAnimation.styles.ts", "../../src/document/components/tools/index.tsx", "../../src/document/components/canvas-hud/CanvasFramePreset.tsx", "../../src/document/components/canvas-hud/CanvasFramePreset.styles.ts", "../../src/document/components/canvas-hud/CanvasFramePresets.tsx", "../../src/document/components/tools/pathEdit/controls/ShapeHighlight.tsx", "../../src/document/components/canvas-hud/ResizeHandle.tsx", "../../src/document/components/canvas-hud/SelectedLine.tsx", "../../src/document/components/canvas-hud/BorderRadiusHandle.tsx", "../../src/document/components/canvas-hud/SelectionBox.tsx", "../../src/document/components/utils/isClippedOnCanvasByGroundNode.ts", "../../src/document/components/canvas-hud/PaddingOverlay.styles.ts", "../../src/document/components/canvas-hud/SpacerHandle.tsx", "../../src/document/components/canvas-hud/SpacerHandle.styles.ts", "../../src/document/components/canvas-hud/PaddingHandles.tsx", "../../src/document/components/canvas-hud/RotationHandle.tsx", "../../src/document/components/canvas-hud/SelectionHandles.tsx", "../../src/document/components/canvas-hud/StackGapHandles.tsx", "../../src/document/components/utils/stackLayoutHelpers.ts", "../../src/document/components/tools/ToolManager.tsx", "../../src/document/components/canvas-hud/CMSBadge.tsx", "../../src/document/components/canvas-hud/CMSBadge.styles.ts", "../../src/document/components/canvas-hud/CodeComponentInProgressInsertionOverlay.tsx", "../../src/document/components/utils/displayRepeaterContextMenu.ts", "../../src/document/components/canvas-hud/ElementButton.tsx", "../../src/document/components/canvas-hud/ElementButton.styles.ts", "../../src/document/components/canvas-hud/CollectionRepeaterButton.tsx", "../../src/document/components/canvas-hud/FormElementButton.tsx", "../../src/document/components/canvas-hud/InsertionIndicator.tsx", "../../src/document/components/canvas-hud/InsertionIndicator.styles.ts", "../../src/document/components/canvas-hud/OverlayInsertionIndicator.tsx", "../../src/document/components/canvas-hud/ParentHighlight.tsx", "../../src/document/components/canvas-hud/DashedLine.styles.ts", "../../src/document/components/canvas-hud/DashedLine.tsx", "../../src/document/components/canvas-hud/PinningCanvasVisualization.tsx", "../../src/document/components/canvas-hud/RepeatedItemButton.tsx", "../../src/document/components/canvas-hud/SiblingOutline.tsx", "../../src/document/components/canvas-hud/TilingBackgroundImageUploadingIndicator.tsx", "../../src/document/components/canvas-hud/ViewportHighlight.tsx", "../../src/utils/useTimeout.tsx", "../../src/document/components/canvas-hud/ViewportHighlight.styles.ts", "../../src/document/components/chrome/properties/rows/MasksRow.tsx", "../../src/document/components/chrome/properties/rows/MaskPopout.tsx", "../../src/document/components/chrome/properties/rows/MaskCompositeRow.tsx", "../../src/document/components/chrome/properties/rows/MaskImageResizeRow.tsx", "../../src/document/components/chrome/properties/rows/MaskModeRow.tsx", "../../src/document/components/chrome/properties/rows/MaskPopout.styles.ts", "../../src/document/components/chrome/properties/rows/MaskPositionRow.tsx", "../../src/document/components/chrome/properties/rows/MaskPositionRow.styles.ts", "../../src/document/components/chrome/properties/panels/utils/addMaskForNodes.ts", "../../src/document/components/chrome/properties/panels/utils/useCopyPasteArrayProperty.ts", "../../src/document/components/chrome/properties/rows/MaskRow.styles.ts", "../../src/document/components/chrome/localization/IconAgentLocalizationMagic.tsx", "../../src/document/components/chrome/localization/sharedLocalization.styles.ts", "../../src/document/components/chrome/localization/IconMagic.tsx", "../../src/document/components/tools/ComponentInstancePlaceholder.styles.ts", "../../src/document/components/tools/ComponentInstancePlaceholder.tsx", "../../src/document/components/tools/CreateCodeComponent.tsx", "../../src/document/components/tools/Create.tsx", "../../src/document/components/tools/pathEdit/controls/ShapeOutline.tsx", "../../src/document/components/canvas-hud/EqualDistanceFrames.tsx", "../../src/document/components/canvas-hud/EqualDistanceFrames.styles.ts", "../../src/document/components/canvas-hud/SnapConstraint.tsx", "../../src/document/components/canvas-hud/SnapLine.styles.ts", "../../src/document/components/canvas-hud/SnapLine.tsx", "../../src/document/components/tools/utils/withSnapping.tsx", "../../src/document/components/tools/CreateFrame.tsx", "../../src/document/components/tools/CreateShape.tsx", "../../src/document/components/tools/CreateText.tsx", "../../src/document/components/tools/GuideMove.tsx", "../../src/document/components/canvas-hud/Distances.tsx", "../../src/document/components/canvas-hud/DistanceLine.tsx", "../../src/document/components/tools/Highlight.tsx", "../../src/document/components/tools/Move.tsx", "../../src/document/components/canvas-hud/ReorderHandles.styles.ts", "../../src/document/components/canvas-hud/ReorderHandles.tsx", "../../src/document/components/tools/Radius.tsx", "../../src/document/components/tools/Resize.tsx", "../../src/document/components/tools/SlotConnect.tsx", "../../src/document/components/tools/ToolManager.styles.ts", "../../src/document/components/tools/gradient/GradientToolManager.tsx", "../../src/document/components/tools/gradient/types.ts", "../../src/document/components/tools/gradient/GradientAngleTool.tsx", "../../src/document/components/tools/gradient/GradientCenterMoveTool.tsx", "../../src/document/components/tools/gradient/GradientStopMoveTool.tsx", "../../src/document/components/tools/gradient/RadialGradientResizeTool.tsx", "../../src/document/components/tools/gradient/controls/GradientHandles.tsx", "../../src/document/components/tools/gradient/controls/GradientHandles.styles.ts", "../../src/document/components/tools/pathEdit/index.tsx", "../../src/document/components/tools/utils/CanvasControlSpatialStore.ts", "../../src/document/components/tools/utils/singleSelectedStraightPath.ts", "../../src/document/components/canvas-hud/ControlsContainer.tsx", "../../src/document/components/canvas-hud/VariantSuggestion.tsx", "../../src/document/components/canvas-hud/CanvasSuggestion.styles.ts", "../../src/document/components/canvas-hud/CanvasSuggestion.tsx", "../../src/document/components/canvas/Canvas.tsx", "../../src/document/components/canvas/EditorNodeTransform.tsx", "../../src/document/components/VekterCollectionReferenceVariableEditor.tsx", "../../src/document/components/VekterDateVariableEditor.tsx", "../../src/document/components/VekterEnumVariableEditor.tsx", "../../src/document/components/chrome/CanvasLoadingShield.tsx", "../../src/document/components/chrome/CanvasLoadingShield.styles.ts", "../../src/document/components/canvas/AgentUpdateHighlightContainer.tsx", "../../src/document/components/canvas/BorderSweepOverlay.tsx", "../../src/document/components/canvas/BorderSweepOverlay.styles.ts", "../../src/document/components/canvas/MultiplayerHUD.tsx", "../../src/document/components/canvas/VekterCollectionRichTextVariableEditor.tsx", "../../src/document/components/canvas/VekterRichTextEditor.tsx", "../../src/document/components/canvas/VekterStringVariableEditor.tsx", "../../src/document/components/canvas-hud/Tooltip.tsx", "../../src/document/components/chrome/preview/WindowResize.tsx", "../../src/plugins/PluginUI.tsx", "../../src/plugins/Plugin.tsx", "../../src/plugins/Plugin.styles.ts", "../../src/document/components/chrome/contentManagement/assets/IconChevronDown.tsx", "../../src/plugins/PluginHeader.tsx", "../../src/plugins/PluginHeader.styles.ts", "../../src/plugins/PluginUI.styles.ts", "../../src/document/components/chrome/Chrome.tsx", "../../src/document/components/chrome/ChromeWrapper.tsx", "../../src/document/components/chrome/shared/DeleteFileModal.tsx", "../../src/document/components/chrome/utils/codeFileUsageChecker.ts", "../../src/code-editor/DeleteCodeFileModal.tsx", "../../src/plugins/CreateManagedCollectionModal.tsx", "../../src/plugins/CreateManagedCollectionModal.styles.ts", "../../src/plugins/PluginFromURLModal.tsx", "../../src/plugins/PluginPicker.tsx", "../../src/plugins/PluginPicker.styles.ts", "../../src/plugins/PluginRow.styles.ts", "../../src/plugins/PluginRow.tsx", "../../src/plugins/useEligiblePluginManifests.ts", "../../src/plugins/PluginWithModePickerModal.styles.ts", "../../src/plugins/PluginWithModePickerModal.tsx", "../../src/document/components/chrome/Modals.tsx", "../../src/web/pages/project/components/TemplatesModal/TemplatesModal.tsx", "../../src/web/pages/project/components/TemplatesModal/PreviewButton.tsx", "../../src/web/pages/project/components/TemplatesModal/PreviewButton.styles.ts", "../../src/web/pages/project/components/TemplatesModal/TemplatesModal.styles.ts", "../../src/web/pages/project/components/TemplatesModal/templates.ts", "../../src/web/pages/project/components/TransferProjectModal.tsx", "../../src/web/pages/project/components/TransferProjectModal.styles.ts", "../../src/web/pages/project/components/KitRemixModal/KitRemixModal.tsx", "../../src/web/pages/project/components/KitRemixModal/KitRemixModal.styles.ts", "../../src/document/components/chrome/analytics/modals/CreateAbTestModal.tsx", "../../src/document/components/chrome/analytics/modals/StopAbTestModal.tsx", "../../src/document/components/chrome/analytics/utils/getFunnelQuery.ts", "../../src/document/components/chrome/analytics/utils/getAbTestQuery.ts", "../../src/document/components/chrome/analytics/utils/getAbTestStats.ts", "../../src/document/components/chrome/analytics/utils/useAbTestVariantsWithMetrics.ts", "../../src/document/components/chrome/analytics/utils/getVariantNameById.ts", "../../src/document/components/chrome/analytics/modals/StopAbTestModal.styles.ts", "../../src/document/components/chrome/cheatsheet/ShortcutsModal.tsx", "../../src/document/components/chrome/cheatsheet/ShortcutsModal.styles.ts", "../../src/document/components/chrome/cheatsheet/ShortcutsList.tsx", "../../src/document/components/chrome/cheatsheet/config.ts", "../../src/document/components/chrome/codePanel/CodeFileCreationModal.tsx", "../../src/document/components/chrome/codePanel/CodeFileCreationModal.styles.ts", "../../src/document/components/chrome/feedback/ConfirmDestructiveFeedbackActionModal.tsx", "../../src/document/components/chrome/figma/FigmaModals.styles.ts", "../../src/document/components/chrome/figma/FigmaImportModal.tsx", "../../src/document/components/chrome/figma/FigmaImportTutorialModal.tsx", "../../src/document/components/chrome/localization/LocaleReadyModal.tsx", "../../src/document/components/chrome/localization/LocaleReadyModal.styles.ts", "../../src/document/components/chrome/localization/LocalizationGlossaryModal.tsx", "../../src/document/components/chrome/projectbar/icons/IconGlossaryFill.tsx", "../../src/document/components/chrome/shared/ModalWithSidebar.tsx", "../../src/document/components/chrome/shared/ModalWithSidebar.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/ModalToolbarButton.tsx", "../../src/document/components/chrome/localization/LocalizationGlossaryModal.styles.ts", "../../src/document/components/chrome/localization/useLocales.ts", "../../src/document/components/chrome/nudgePreferences/NudgePreferencesModal.tsx", "../../src/document/components/chrome/nudgePreferences/NudgePreferencesModal.styles.ts", "../../src/document/components/chrome/shared/BatchTranslateModal.tsx", "../../src/document/components/chrome/shared/BatchTranslateModal.styles.ts", "../../src/document/components/chrome/shared/ProgressModal.styles.ts", "../../src/document/components/chrome/shared/ProgressModal.tsx", "../../src/document/components/chrome/shared/BuyAiCredits/BuyAiCreditsModal.tsx", "../../src/document/components/chrome/shared/BuyAiCredits/BuyAiCreditsModal.styles.ts", "../../src/document/components/chrome/shared/BuyAiCredits/api/previewTeamAddOn.ts", "../../src/document/components/chrome/shared/BuyAiCredits/useBuyAiCredits.ts", "../../src/document/components/chrome/shared/BuyAiCredits/api/getTeamAddOnPlan.ts", "../../src/document/components/chrome/shared/BuyAiCredits/api/putTeamAddOn.ts", "../../src/document/components/chrome/shared/ComponentCreationModal.tsx", "../../src/document/components/chrome/shared/ConfirmBatchTranslateAllModal.tsx", "../../src/document/components/chrome/shared/ConfirmBatchTranslateAllModal.styles.ts", "../../src/document/components/chrome/shared/ConfirmDefaultLanguageModal.tsx", "../../src/document/components/utils/getNaturalLanguageTitleForValue.ts", "../../src/document/components/chrome/shared/ConvertToCMSPageModal.tsx", "../../src/document/components/chrome/shared/ConvertToCMSPageModal.styles.ts", "../../src/document/components/chrome/shared/ConvertToKitPageModal.tsx", "../../src/document/components/chrome/shared/CreateLayoutTemplateModal.tsx", "../../src/document/components/chrome/shared/CustomBreakpointModal.tsx", "../../src/document/components/chrome/shared/DeleteEntityFolderModal.tsx", "../../src/document/components/chrome/shared/DeleteMultipleCodeFilesModal.tsx", "../../src/document/components/chrome/shared/DeleteMultipleEntityFoldersModal.tsx", "../../src/document/components/chrome/shared/DuplicateProjectWithVersionModal.tsx", "../../src/document/components/chrome/shared/DuplicateWebPageModal.tsx", "../../src/document/components/chrome/shared/DuplicateWebPageModal.styles.ts", "../../src/document/components/chrome/shared/UnlinkComponentModal.styles.ts", "../../src/document/components/chrome/shared/EditVectorModal.tsx", "../../src/document/components/chrome/shared/FontPopout/DeleteCustomFontModal.tsx", "../../src/document/components/chrome/shared/LayoutTemplateFlowEffectRegenerationModal.tsx", "../../src/document/components/chrome/shared/LoadingFullDocumentModal.tsx", "../../src/document/models/CanvasTree/traits/utils/getFallbackOptionsForLocale.ts", "../../src/document/components/chrome/shared/LocaleSettingsModal.tsx", "../../src/document/components/chrome/localization/useNameForDefaultLocale.ts", "../../src/document/components/chrome/siteSettings/useMetadataUpdateHandler.ts", "../../src/document/components/chrome/shared/LocaleSettingsModal.styles.ts", "../../src/document/components/chrome/shared/ModulePublishingModal/ModulePublishingModal.tsx", "../../src/document/components/chrome/shared/ModulePublishingModal/ModulePublishingModal.styles.ts", "../../src/document/components/chrome/utils/useLoadScope.ts", "../../src/document/components/chrome/shared/RedirectsImportModal.tsx", "../../src/document/components/chrome/shared/RemoveFromLibraryModal.tsx", "../../src/document/components/chrome/shared/ReplaceTextStylePresetModal.tsx", "../../src/document/components/chrome/properties/panels/utils/useTextStylePresets.tsx", "../../src/document/components/chrome/shared/ReplaceWebPageModal.tsx", "../../src/document/components/chrome/shared/ReplaceWebPageModal.styles.ts", "../../src/document/components/chrome/shared/RequestControlModal.tsx", "../../src/document/components/chrome/shared/SubscriptionNotInOrder/SubscriptionNotInOrderModal.tsx", "../../src/document/components/chrome/shared/SubscriptionNotInOrder/components/SubscriptionNotInOrderInitialModal.tsx", "../../src/document/components/chrome/shared/SubscriptionNotInOrder/components/SubscriptionNotInOrderInitialModal.styles.ts", "../../src/document/components/chrome/shared/SubscriptionNotInOrder/useSubscriptionSync.ts", "../../src/document/components/chrome/shared/SubscriptionNotInOrder/api/syncPreview.ts", "../../src/document/components/chrome/shared/UnlinkComponentModal.tsx", "../../src/document/components/chrome/shared/UnsavedChangesModal.tsx", "../../src/document/components/chrome/shared/UpgradeDocumentModal.tsx", "../../src/document/components/chrome/shared/UpgradeDocumentModal.styles.ts", "../../src/document/components/chrome/shared/UpsellModal/UpsellEnterpriseModal.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariablesModal.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconEdit.tsx", "../../src/document/components/chrome/shared/VariablesModal/DeleteFieldPrevention.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariablesModal.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetail.tsx", "../../src/document/components/chrome/shared/VariablesModal/EventHandlerHint.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/EventHandlerHint.tsx", "../../src/document/components/chrome/shared/VariablesModal/QueryParamRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/QueryParamRow.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetail.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailArray.tsx", "../../src/document/components/chrome/properties/codeComponentRows/ArrayControlPropRow.tsx", "../../src/document/components/chrome/shared/GalleryPopoutContent.tsx", "../../src/document/components/chrome/shared/GalleryPopoutContent.styles.ts", "../../src/document/components/chrome/properties/codeComponentRows/ArrayControlPropRow.styles.ts", "../../src/document/components/chrome/properties/codeComponentRows/ObjectControlPropRow.styles.ts", "../../src/document/components/chrome/properties/codeComponentRows/utils/controlPropRowNeedsHiddenState.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableModalContext.ts", "../../src/document/components/chrome/shared/VariablesModal/useUpdateVariableOfType.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailBoolean.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailBorder.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailBorderRadius.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailBoxShadow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/BoxShadowControlPropRow.tsx", "../../src/document/utils/toastIncompatibleStrokeWidthAndShadows.ts", "../../src/document/components/chrome/properties/panels/ShadowPanel.tsx", "../../src/document/components/chrome/properties/panels/ShadowPopout.tsx", "../../src/document/components/chrome/properties/panels/sortablePanelRows.styles.ts", "../../src/document/components/chrome/properties/panels/utils/addShadowForNodes.ts", "../../src/document/components/chrome/properties/codeComponentRows/BoxShadowControlPropRow.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailCollectionReference.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailColor.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailControlReference.tsx", "../../src/document/components/chrome/properties/rows/CursorPopout.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/AliasCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/CellCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ColResizeCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ContextMenuCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/CopyCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/CrosshairCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/DefaultCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/GrabCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/GrabbingCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/HelpCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/MoveCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/NoDropCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/NoneCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/NotAllowedCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/PointerCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ProgressCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeEastCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeEastWestCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthEastCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthEastSouthWestCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthSouthCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthWestCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeNorthWestSouthEastCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeRowCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeSouthCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeSouthEastCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeSouthWestCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ResizeWestCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/TextCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/VerticalTextCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ZoomInCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/ZoomOutCursor.tsx", "../../src/document/components/chrome/properties/panels/cursorIcons/CursorIcon.tsx", "../../src/document/components/chrome/properties/rows/CursorPopout.styles.ts", "../../src/document/components/chrome/properties/rows/CursorRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailCursor.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailDate.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailEnum.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailEnum.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailLocalizationRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailFile.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailFile.tsx", "../../src/document/components/chrome/properties/inputs/GapInput.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailGap.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailImage.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailLinkRelValues.tsx", "../../src/document/components/chrome/properties/codeComponentRows/LocationControlPropRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailLocation.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailMultiCollectionReference.tsx", "../../src/document/components/chrome/properties/codeComponentRows/NumberControlPropRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailNumber.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailPadding.tsx", "../../src/document/components/chrome/shared/VariablesModal/MaxLengthRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailRichText.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailSlug.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailString.tsx", "../../src/document/components/chrome/properties/rows/TransitionRow.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailTransition.tsx", "../../src/document/components/chrome/shared/VariablesModal/VariableDetailVectorSetItem.tsx", "../../src/document/components/chrome/shared/VariablesModal/createFinalName.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableRow.styles.ts", "../../src/document/components/chrome/shared/VariablesModal/VariableRow.tsx", "../../src/document/utils/useSelectedCollectionId.ts", "../../src/document/components/chrome/shared/VariablesModal/useDeleteVariable.ts", "../../src/document/components/chrome/properties/utils/deleteVariable.ts", "../../src/document/components/chrome/shared/VariablesModal/useSyncSelectedVariablePath.ts", "../../src/document/components/chrome/shared/VariablesModal/duplicateVariable.ts", "../../src/document/components/chrome/shared/VariablesModal/useVariableActions.ts", "../../src/document/components/utils/spaceOutShapeContainers.ts", "../../src/document/components/chrome/shared/VectorImportModal.tsx", "../../src/document/components/chrome/shared/VectorSetCreationModal.tsx", "../../src/document/components/chrome/shared/VectorSetUnlinkModal.tsx", "../../src/document/components/unlinking/VectorSetUnlink.ts", "../../../../html-validation/src/browser.ts", "../../src/code-editor/CodeEditorMinimal.tsx", "../../src/code-editor/CodeEditorMinimalFallback.styles.ts", "../../src/code-editor/CodeEditorMinimalFallback.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/EditCustomCodeModal.tsx", "../../src/document/components/chrome/siteSettings/ClickableVariables.tsx", "../../src/document/components/chrome/siteSettings/ClickableVariable.styles.ts", "../../src/document/components/chrome/siteSettings/SettingInput.tsx", "../../src/document/components/chrome/siteSettings/SettingInput.styles.ts", "../../src/document/components/chrome/siteSettings/useReplaceTextAtSelectionImperativeHandle.ts", "../../src/document/components/chrome/siteSettings/CustomCode/EditCustomCodeModal.styles.ts", "../../src/document/components/chrome/siteSettings/CustomCode/PagesSelectionComboBox.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/PagesSelectionComboBox.styles.ts", "../../src/document/components/chrome/siteSettings/CustomCode/useCustomCodeNameSuggestion.ts", "../../src/document/components/chrome/siteSettings/CustomCode/utils/convertTemplateVariables.ts", "../../src/document/components/chrome/siteSettings/CustomCode/utils/labels.ts", "../../src/document/components/chrome/siteSettings/CustomCode/ViewCustomCodeModal.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/CustomCodeIcon.styles.ts", "../../src/document/components/chrome/siteSettings/CustomCode/CustomCodeIcon.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/ViewCustomCodeModal.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/addOns/AcquireAddOnModal.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/hooks/useIsBillingV3.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/addOns/ConfirmAcquireAddOnModal.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/UpsellFeatureModal.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/modals/PlanCancellationModal.tsx", "../../src/web/lib/useTrackPurchaseSuccess.tsx", "../../src/document/components/chrome/siteSettings/Plans/utils/isPlanCancelled.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/api/cancelProjectSubscription.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/modals/PlanModals.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/modals/PlanModalsFeatureList.tsx", "../../src/document/components/chrome/siteSettings/Project/FileModals.tsx", "../../src/document/components/chrome/PopoutWindowManager.tsx", "../../src/utils/usePreviousValue.ts", "../../src/document/components/chrome/contentManagement/CmsAgentChatPanel.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.styles.ts", "../../src/app/agent/hooks/useAgentSnapshot.ts", "../../src/app/agent/hooks/useCanViewAgent.ts", "../../src/document/components/chrome/contentManagement/useIsCollapsedContentManagementView.ts", "../../src/document/components/chrome/contentManagement/useShouldShowCmsAgentChatPanel.ts", "../../src/document/components/chrome/shared/EditorOverlay.styles.ts", "../../src/document/components/chrome/agentPanel/CodeEditorAgentPanel.tsx", "../../src/document/components/chrome/agentPanel/CodeEditorAgentPanel.styles.ts", "../../src/document/components/chrome/agentPanel/useShouldShowCodeAgentPanel.ts", "../../src/document/components/chrome/aiSidebar/AiSidebar.tsx", "../../src/document/components/chrome/contentManagement/utils/useOnEscape.ts", "../../src/document/components/chrome/leftPanel/LeftPanel.styles.ts", "../../src/document/components/chrome/leftPanel/LeftPanel.tsx", "../../src/document/components/chrome/aiSidebar/styles/shared.styles.ts", "../../src/document/components/chrome/aiSidebar/AiSidebar.styles.ts", "../../src/document/components/chrome/aiSidebar/components/AssistantMessage.tsx", "../../src/document/components/chrome/aiSidebar/hooks/useTypewriter.ts", "../../src/document/components/chrome/aiSidebar/components/AssistantMessage.styles.ts", "../../src/document/components/chrome/aiSidebar/components/KitIcon.styles.ts", "../../src/document/components/chrome/aiSidebar/components/KitIcon.tsx", "../../src/document/components/chrome/aiSidebar/components/PendingMessage.tsx", "../../src/document/components/chrome/aiSidebar/components/PendingMessage.styles.ts", "../../src/document/components/chrome/aiSidebar/components/StepsList.tsx", "../../src/document/components/chrome/aiSidebar/components/StepStatusIcon.tsx", "../../src/document/components/chrome/aiSidebar/components/StepsList.styles.ts", "../../src/document/components/chrome/aiSidebar/components/SuggestionButton.tsx", "../../src/document/components/chrome/insertSidebar/dataSources/icons/WireframerResourceIcon.tsx", "../../src/document/components/chrome/aiSidebar/components/SuggestionButton.styles.ts", "../../src/document/components/chrome/aiSidebar/components/KitPicker.tsx", "../../src/document/components/chrome/aiSidebar/components/KitPicker.styles.ts", "../../src/document/components/chrome/aiSidebar/components/PromptPresetButton.tsx", "../../src/document/components/chrome/aiSidebar/components/PromptPresetButton.styles.ts", "../../src/document/components/chrome/aiSidebar/components/UserMessage.tsx", "../../src/document/components/chrome/aiSidebar/components/UserMessage.styles.ts", "../../src/document/components/chrome/aiSidebar/constants/promptPresets.ts", "../../src/document/components/chrome/aiSidebar/hooks/useChat.ts", "../../src/document/components/chrome/siteSettings/useIsFirstPublish.ts", "../../src/document/components/chrome/analytics/Analytics.tsx", "../../src/document/components/chrome/analytics/Analytics.styles.ts", "../../src/document/components/chrome/analytics/components/UnpublishedState.styles.ts", "../../src/document/components/chrome/analytics/components/UnpublishedState.tsx", "../../src/document/components/chrome/analytics/tabs/AbTestOverview.tsx", "../../src/document/components/chrome/analytics/components/AbTestHeader.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsTitle.styles.ts", "../../src/document/components/chrome/analytics/components/AnalyticsTitle.tsx", "../../src/document/components/chrome/analytics/utils/deleteFunnel.ts", "../../src/document/components/chrome/analytics/utils/promptDeleteAbTest.ts", "../../src/document/components/chrome/analytics/utils/promptStartAbTest.ts", "../../src/document/components/chrome/analytics/utils/promptStopAbTest.ts", "../../src/document/components/chrome/analytics/components/AbTestHeader.styles.ts", "../../src/document/components/chrome/analytics/components/ScreenshotDiff.tsx", "../../src/document/components/chrome/analytics/components/ScreenshotDiff.styles.ts", "../../src/document/components/chrome/analytics/components/AbTestTable.tsx", "../../src/document/components/chrome/analytics/components/AbTestTable.styles.ts", "../../src/document/components/chrome/analytics/components/AnalyticsStateMessages.tsx", "../../src/document/components/chrome/analytics/utils/createFunnelStep.ts", "../../src/document/components/chrome/analytics/components/AnalyticsStateMessages.styles.ts", "../../src/document/components/chrome/analytics/components/FunnelDropOffBars.tsx", "../../src/document/components/chrome/analytics/section/AnalyticsSummaryValue.styles.ts", "../../src/document/components/chrome/analytics/section/AnalyticsSummaryValue.tsx", "../../src/document/components/chrome/analytics/components/FunnelDropOffBars.styles.ts", "../../src/document/components/chrome/analytics/tabs/AnalyticsOverview.tsx", "../../src/web/lib/useInterval.ts", "../../src/document/components/chrome/analytics/components/DateRangePicker.tsx", "../../src/document/components/chrome/analytics/components/DateRangePicker.styles.ts", "../../src/document/components/chrome/analytics/components/DateRangePresets.tsx", "../../src/document/components/chrome/analytics/components/DateRangePresets.styles.ts", "../../src/document/components/chrome/analytics/section/AnalyticsDevicesSection.tsx", "../../src/document/components/chrome/analytics/components/SectionPicker.tsx", "../../src/document/components/chrome/analytics/section/AnalyticsGeographySection.tsx", "../../src/document/components/chrome/analytics/components/CreateLocaleButton.tsx", "../../src/document/components/chrome/analytics/components/Buttons.styles.ts", "../../src/document/components/chrome/analytics/components/ViewLocaleButton.tsx", "../../src/document/components/chrome/analytics/section/AnalyticsPagesSection.tsx", "../../src/document/components/chrome/analytics/components/CreateRedirectButton.tsx", "../../src/document/components/chrome/analytics/components/SearchRedirectsButton.tsx", "../../src/document/components/chrome/analytics/section/AnalyticsSourcesSection.tsx", "../../src/document/components/chrome/analytics/section/AnalyticsTrackingIdsSection.tsx", "../../src/document/components/chrome/analytics/utils/trackingEventTypes.tsx", "../../src/document/components/chrome/analytics/utils/filters.ts", "../../src/document/components/chrome/analytics/tabs/FunnelOverview.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsSidebar.tsx", "../../src/document/components/chrome/contentPanel/ContentPanelHeader.tsx", "../../src/document/components/chrome/contentPanel/ContentPanelHeader.styles.ts", "../../src/document/components/chrome/analytics/components/AnalyticsSidebarEntityLists.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentFolder.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsSidebarRow.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsSidebarUsage.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsSidebarUsage.styles.ts", "../../src/document/components/chrome/contentManagement/CollectionItemOverlay.tsx", "../../src/document/components/chrome/shared/EditorOverlay.tsx", "../../src/document/components/chrome/shared/utils/flashPanelRow.ts", "../../src/document/components/chrome/contentManagement/CollectionItemFixedToolbarTopRight.tsx", "../../src/publishing/confirmUndraftActiveCollectionItem.ts", "../../src/publishing/confirmUndraftActiveLocale.ts", "../../src/document/components/chrome/Pages/utils/setPageDraftStatus.ts", "../../src/publishing/confirmUndraftActivePage.ts", "../../src/document/components/chrome/projectbar/PublishToolbarItem.tsx", "../../src/utils/projectToolbarHooks.tsx", "../../src/web/pages/project/components/PublishPopover/utils/usePublishableCollectionItemId.ts", "../../src/web/pages/project/permissions/useProjectPermissions.ts", "../../src/document/components/chrome/contentManagement/utils/useActiveCollection.ts", "../../src/document/components/chrome/projectbar/ProjectBar.styles.ts", "../../src/document/components/chrome/projectbar/PublishLimitsTooltip.tsx", "../../src/web/pages/project/components/PublishPopover/PublishPopover.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/addOns/bandwidthAddonUtils.ts", "../../src/document/components/chrome/projectbar/icons/NewIconProjectBarPreview.tsx", "../../src/document/components/chrome/contentManagement/CollectionItemOverlay.styles.ts", "../../src/document/components/chrome/contentManagement/CollectionItemSharedLinkDataProvider.tsx", "../../src/document/components/chrome/contentManagement/CollectionItemStatusRow.tsx", "../../src/document/components/chrome/contentManagement/OverlayFieldTitlePopout.tsx", "../../src/document/components/chrome/contentManagement/CollectionFieldsPanel.styles.ts", "../../src/document/components/chrome/contentManagement/FieldSettingsPopout.tsx", "../../src/document/components/chrome/contentManagement/utils/useShowErrorsOnActiveCollectionItem.tsx", "../../src/document/components/chrome/contentManagement/LargePanelRow.tsx", "../../src/document/components/chrome/contentManagement/LargeControlRow.tsx", "../../src/document/components/chrome/contentManagement/LargeArrayInputRow.tsx", "../../src/document/components/chrome/contentManagement/ArrayItemsTable.tsx", "../../src/document/components/chrome/contentManagement/ArrayItemsTable.styles.ts", "../../src/document/components/chrome/contentManagement/TableCellPreviews.tsx", "../../src/document/components/chrome/shared/ImagePreviewThumbnail.styles.ts", "../../src/document/components/chrome/shared/ImagePreviewThumbnail.tsx", "../../src/document/components/chrome/contentManagement/TableCellPreviews.styles.ts", "../../src/document/components/chrome/contentManagement/fileCellDisplayInfo.ts", "../../src/document/components/chrome/contentManagement/utils/dateInputValue.ts", "../../src/document/components/chrome/contentManagement/LargeBooleanInputRows.tsx", "../../src/document/components/chrome/contentManagement/CollectionReferencePillInput.tsx", "../../src/document/components/chrome/contentManagement/CollectionReferencePillInput.styles.ts", "../../src/document/components/chrome/contentManagement/ReferenceCellPills.tsx", "../../src/document/components/chrome/contentManagement/ComboBoxCellPills.tsx", "../../src/document/components/chrome/contentManagement/ReferenceCellPills.styles.ts", "../../src/document/components/chrome/contentManagement/utils/createNewItemInReferencedCollection.ts", "../../src/document/components/chrome/contentManagement/utils/useCollectionIsViewOnly.ts", "../../src/document/components/chrome/contentManagement/CollectionReferenceInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeCollectionReferenceInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeColorInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeDateInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeEnumInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeFileInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeImageInputRow.tsx", "../../src/document/components/chrome/contentManagement/CollectionItemPageLinkingRows.tsx", "../../src/document/components/chrome/contentManagement/LargeLinkInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeMultiCollectionReferenceInputRow.styles.ts", "../../src/document/components/chrome/contentManagement/utils/handleEditCollectionItem.ts", "../../src/document/components/chrome/contentManagement/LargeMultiCollectionReferenceInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeNumberInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeRichTextInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeVectorSetItemInputRow.tsx", "../../src/document/components/chrome/contentManagement/LargeDividerRow.tsx", "../../src/document/components/chrome/contentManagement/LargeSlugInputRow.tsx", "../../src/document/components/chrome/contentManagement/utils/updateEffectsWithSlug.ts", "../../src/document/components/chrome/contentManagement/utils/updatePageLinksWithSlug.ts", "../../src/document/components/chrome/contentManagement/LargeStringInputRow.tsx", "../../src/document/components/chrome/contentManagement/ManagedCollectionItemHeader.tsx", "../../src/document/components/chrome/contentManagement/ManagedCollectionItemHeader.styles.ts", "../../src/document/components/chrome/contentManagement/RevampedCmsPopoutThemeOverride.tsx", "../../src/document/components/chrome/contentManagement/utils/useInvalidFieldIds.ts", "../../src/document/components/chrome/contentManagement/CollectionItemTable.tsx", "../../src/document/components/chrome/contentManagement/CollectionItemTable.styles.ts", "../../src/document/components/chrome/contentManagement/NoCollectionsEmptyState.styles.ts", "../../src/document/components/chrome/contentManagement/utils/createSampleCollectionWithPages.ts", "../../src/document/components/chrome/contentManagement/NoCollectionsEmptyState.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.tsx", "../../src/plugins/editCollectionUsingPlugin.ts", "../../src/document/components/chrome/contentManagement/NoItemsEmptyState.styles.ts", "../../src/document/components/chrome/contentManagement/NoItemsEmptyState.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.cellLookup.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.cellVisibility.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.cellTextValue.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.openCollectionItemOverlay.ts", "../../src/document/components/chrome/contentManagement/utils/collectionItemTableColumns.ts", "../../src/document/components/chrome/contentManagement/utils/getUniqueCollectionItemSlug.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.editingAdapters.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.selection.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.clipboard.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.columnLayout.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.columnReorderController.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.columnReorderPreview.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.reorderIndicatorVisibility.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.reorderIndicators.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridColumnReorder.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.autoScrollTimeScale.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.columnWidthController.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.editing.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.editingTypes.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.spreadsheetCellAction.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.hitTargets.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.focusNavigation.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.keyboardNavigation.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.rowReorderController.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.rowReorderPreview.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridRowReorder.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.rowSelectionState.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.selectionClearing.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.selectionOverlay.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.stableRowIds.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.viewport.ts", "../../src/document/components/chrome/contentManagement/useElementScrollCallbackRef.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableBodyCell.tsx", "../../src/document/components/chrome/contentManagement/CollectionItemOverlayButton.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableBodyCellEditor.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.enumOptions.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableBodyCellFrame.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableBooleanBodyCell.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTable.dragThreshold.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableComboBoxBodyCell.tsx", "../../src/document/components/chrome/contentManagement/useVirtualCollectionItemTableClickToEditCell.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTablePopoutBodyCell.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableColumnHeaderCell.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableInteractiveColumnHeaderCell.tsx", "../../src/document/components/chrome/contentManagement/utils/collectionItemTableSorting.ts", "../../src/document/components/chrome/contentManagement/utils/useCollectionFieldVisibility.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableRowHeaderCell.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableToolbar.tsx", "../../src/document/components/chrome/projectbar/icons/toolbarIconSet.ts", "../../src/document/components/chrome/localization/IconMagicContained.tsx", "../../src/document/components/chrome/projectbar/icons/IconAgentToolbarMagic.tsx", "../../src/document/components/chrome/projectbar/icons/IconColumns.tsx", "../../src/document/components/chrome/projectbar/icons/IconFilter.tsx", "../../src/document/components/chrome/projectbar/icons/IconFrame.tsx", "../../src/document/components/chrome/projectbar/icons/IconFullscreen.tsx", "../../src/document/components/chrome/projectbar/icons/IconGlossary.tsx", "../../src/document/components/chrome/projectbar/icons/IconGrid.tsx", "../../src/document/components/chrome/projectbar/icons/IconImage.tsx", "../../src/document/components/chrome/projectbar/icons/IconImport.tsx", "../../src/document/components/chrome/projectbar/icons/IconInsert.tsx", "../../src/document/components/chrome/projectbar/icons/IconLayout.tsx", "../../src/document/components/chrome/projectbar/icons/IconMasonryGrid.tsx", "../../src/document/components/chrome/projectbar/icons/IconOptions.tsx", "../../src/document/components/chrome/projectbar/icons/IconOval.tsx", "../../src/document/components/chrome/projectbar/icons/IconPlugins.tsx", "../../src/document/components/chrome/projectbar/icons/IconRows.tsx", "../../src/document/components/chrome/projectbar/icons/IconText.tsx", "../../src/document/components/chrome/projectbar/icons/IconToolPath.tsx", "../../src/document/components/chrome/projectbar/icons/IconVariables.tsx", "../../src/document/components/chrome/projectbar/icons/IconVideo.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconClock.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconColumns.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconFilter.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconFrame.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconFullscreen.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconGlossary.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconGrid.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconImage.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconImpor.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconInsert.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconMasonryGrid.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconOptions.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconOval.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconPath.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconPlugins.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconPolygon.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconPublish.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconRect.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconReload.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconRows.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconStar.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconText.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconToolPath.tsx", "../../src/document/components/chrome/projectbar/icons/NewIconVideo.tsx", "../../src/document/components/chrome/projectbar/icons/iconColumnsString.ts", "../../src/document/components/chrome/projectbar/icons/iconFrameString.ts", "../../src/document/components/chrome/projectbar/icons/iconGridString.ts", "../../src/document/components/chrome/projectbar/icons/iconImageString.ts", "../../src/document/components/chrome/projectbar/icons/iconMasonryGridString.ts", "../../src/document/components/chrome/projectbar/icons/iconOvalString.ts", "../../src/document/components/chrome/projectbar/icons/iconPathString.ts", "../../src/document/components/chrome/projectbar/icons/iconPolygonString.ts", "../../src/document/components/chrome/projectbar/icons/iconRectString.ts", "../../src/document/components/chrome/projectbar/icons/iconRowsString.ts", "../../src/document/components/chrome/projectbar/icons/iconStarString.ts", "../../src/document/components/chrome/projectbar/icons/iconVideoString.ts", "../../src/document/components/chrome/projectbar/icons/newIconColumnsString.ts", "../../src/document/components/chrome/projectbar/icons/newIconFrameString.ts", "../../src/document/components/chrome/projectbar/icons/newIconGridString.ts", "../../src/document/components/chrome/projectbar/icons/newIconImageString.ts", "../../src/document/components/chrome/projectbar/icons/newIconMasonryGridString.ts", "../../src/document/components/chrome/projectbar/icons/newIconOvalString.ts", "../../src/document/components/chrome/projectbar/icons/newIconPathString.ts", "../../src/document/components/chrome/projectbar/icons/newIconPolygonString.ts", "../../src/document/components/chrome/projectbar/icons/newIconRectString.ts", "../../src/document/components/chrome/projectbar/icons/newIconRowsString.ts", "../../src/document/components/chrome/projectbar/icons/newIconStarString.ts", "../../src/document/components/chrome/projectbar/icons/newIconVideoString.ts", "../../src/document/components/chrome/contentManagement/IconCmsTableSorting.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableSortingPopover.tsx", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableSortingPopover.styles.ts", "../../src/document/components/chrome/contentManagement/VirtualCollectionItemTableToolbar.styles.ts", "../../src/document/components/chrome/contentManagement/useVirtualCollectionItemTableFocusNavigation.ts", "../../src/document/components/chrome/contentManagement/useVirtualCollectionItemTableFocusRestoration.ts", "../../src/document/components/chrome/contentManagement/useVirtualCollectionItemTableKeyboardEntry.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridCellDragSelectionAutoScroll.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridCellSelection.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridInteractionMachine.ts", "../../src/document/components/chrome/contentManagement/useVirtualGridRowSelection.ts", "../../src/utils/getItemsFromStartToEndInclusive.ts", "../../src/utils/getLastItemFromIterable.ts", "../../src/document/components/chrome/contentManagement/utils/duplicateCollectionItem.ts", "../../src/document/components/chrome/contentManagement/utils/getCollectionItemRowContextMenuOptions.ts", "../../src/document/components/chrome/contentManagement/utils/handleMoveCollectionItem.ts", "../../src/document/components/chrome/contentManagement/utils/useFilteredCollectionItems.ts", "../../src/document/components/chrome/contentManagement/CollectionLeftPanel.tsx", "../../src/document/components/chrome/contentManagement/CollectionFieldsPanel.tsx", "../../src/document/components/utils/getAvailableCollections.ts", "../../src/document/components/chrome/contentPanel/ContentPanelPagesTab.tsx", "../../src/document/components/chrome/Pages/CanvasPages.tsx", "../../src/document/components/chrome/contentPanel/ActiveContentPanelPageProvider.tsx", "../../src/document/components/chrome/Pages/DraggablePageRow.tsx", "../../src/document/components/chrome/Pages/DraggablePageRow.styles.ts", "../../src/document/components/chrome/Pages/usePagesDragDrop.tsx", "../../src/document/components/chrome/Pages/utils/getPageRowIcon.tsx", "../../src/document/components/chrome/Pages/utils/promptAndDeletePage.ts", "../../src/document/components/chrome/Pages/usePagesMultiSelect.ts", "../../src/document/components/chrome/Pages/DesignPages.tsx", "../../src/document/components/chrome/Pages/KitPages.tsx", "../../src/document/components/chrome/Pages/RouteSegments.tsx", "../../src/document/components/chrome/Pages/RouteSegmentRow.tsx", "../../src/document/components/chrome/analytics/utils/addFirstAbVariantIfNeeded.ts", "../../src/document/components/chrome/shared/showPageExistsToast.ts", "../../src/document/components/chrome/shared/utils/getNodeData.ts", "../../src/document/components/chrome/Pages/RouteSegmentRow.styles.ts", "../../src/document/components/chrome/Pages/useRouteSegmentList.types.ts", "../../src/document/components/chrome/Pages/utils/moveRouteSegment.ts", "../../src/document/components/chrome/Pages/utils/createFolderFromSelection.ts", "../../src/document/components/chrome/analytics/utils/promptDeleteAbVariant.ts", "../../src/document/components/chrome/Pages/utils/promptAndDeleteRouteSegmentRows.ts", "../../src/document/components/chrome/Pages/getRouteSegmentMultiSelectMenu.ts", "../../src/document/components/chrome/Pages/useRouteSegmentRowDragDrop.tsx", "../../src/document/components/chrome/Pages/useRouteSegmentChildrenRows.ts", "../../src/document/components/chrome/Pages/utils/getRouteSegmentIcon.tsx", "../../src/document/components/chrome/Pages/utils/convertSegmentRoute.ts", "../../src/document/components/chrome/shared/utils/buildSubLabel.ts", "../../src/document/components/chrome/Pages/utils/formatCollectionItemCount.ts", "../../src/document/components/chrome/Pages/utils/getRouteSegmentRowLabels.ts", "../../src/document/components/chrome/Pages/utils/getTranslateContentMenuItem.ts", "../../src/document/components/chrome/Pages/utils/promptAndDeleteSegmentWithReferenceCheck.tsx", "../../src/document/components/chrome/Pages/utils/findCmsItemsLinkingToPage.ts", "../../src/document/components/chrome/Pages/utils/findWebPagesLinkingToPage.ts", "../../src/document/components/chrome/Pages/utils/setHomePage.ts", "../../../../library/src/utils/sanitizePagePathSegment.ts", "../../src/document/components/chrome/Pages/utils/useLocalizedPathRenameHandler.ts", "../../src/document/components/chrome/Pages/RouteSegmentVariantRow.tsx", "../../src/document/components/chrome/Pages/RouteSegments.styles.ts", "../../src/document/components/chrome/Pages/useRouteSegmentList.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentPageVariantA.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentPageVariantB.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentPageVariantC.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentPageVariantD.tsx", "../../src/document/components/chrome/Pages/icons/IconAgentPageVariantE.tsx", "../../src/document/components/chrome/Pages/utils/getAbTestingVariants.ts", "../../src/document/components/chrome/Pages/utils/routeSegmentMatch.ts", "../../src/document/components/chrome/Pages/utils/useHomePageState.ts", "../../src/document/components/chrome/contentPanel/ContentPanelLocaleSelector.tsx", "../../src/document/components/chrome/contentPanel/ContentPanelLocaleSelector.styles.ts", "../../src/document/components/chrome/contentPanel/ContentPanelPagesTab.styles.ts", "../../src/document/components/chrome/contentManagement/CollectionLeftPanel.styles.ts", "../../src/document/components/chrome/contentManagement/CollectionPanel.tsx", "../../src/document/components/chrome/SidebarAdditionRow.styles.ts", "../../src/document/components/chrome/SidebarAdditionRow.tsx", "../../src/document/components/chrome/contentManagement/CollectionPanel.styles.ts", "../../src/document/components/chrome/contentManagement/utils/handleCreateCollectionAction.ts", "../../src/document/components/chrome/shared/PluginsPanel.tsx", "../../src/document/components/chrome/shared/PluginsPanel.styles.ts", "../../src/document/components/chrome/contentManagement/CollectionPluginsPanel.tsx", "../../src/document/components/chrome/contentPanel/ContentPanel.tsx", "../../src/document/components/chrome/contentPanel/TabbedContentPanel.tsx", "../../src/document/components/chrome/assets/Assets.tsx", "../../src/document/components/chrome/assets/Assets.styles.ts", "../../src/document/components/chrome/assets/EntityCodeFilesAssetSection.tsx", "../../src/document/components/chrome/properties/utils/getCodeFileRowProps.ts", "../../src/document/components/chrome/assets/EntitySection.styles.ts", "../../src/document/components/chrome/assets/ImportMap.tsx", "../../src/document/components/chrome/assets/ShaderModules.tsx", "../../src/document/components/chrome/assets/utils/createMultiSelectContextMenu.ts", "../../src/document/components/chrome/assets/utils/resolveContextMenuHandler.ts", "../../src/document/components/chrome/assets/EntityComponentsAssetSection.tsx", "../../src/document/components/chrome/properties/utils/getComponentRowProps.ts", "../../src/document/components/chrome/assets/ExternalComponents.tsx", "../../src/document/components/chrome/assets/ExternalAssetRow.tsx", "../../src/document/components/chrome/assets/ExternalComponents.styles.ts", "../../src/document/components/chrome/assets/utils/externalModuleFolderUtils.ts", "../../src/document/components/chrome/assets/EntityLayoutTemplatesAssetSection.tsx", "../../src/document/components/chrome/assets/EntityStylesAssetSection.tsx", "../../src/document/components/chrome/properties/panels/EditComponentPresetPopout.tsx", "../../src/document/components/chrome/properties/panels/utils/getControlIcons.ts", "../../src/document/components/chrome/properties/panels/EditImageStylePresetPopout.tsx", "../../src/document/components/chrome/properties/utils/getComponentPresetRowProps.tsx", "../../src/document/components/chrome/properties/utils/getImageStylePresetRowProps.tsx", "../../src/document/components/chrome/properties/panels/EditInlineCodeStylePresetPopout.tsx", "../../src/document/components/chrome/properties/utils/getInlineCodeStylePresetRowProps.tsx", "../../src/document/components/chrome/assets/utils/getComponentType.ts", "../../src/document/components/chrome/assets/EntityVectorSetsAssetSection.tsx", "../../src/document/components/chrome/contentPanel/TabbedContentPanel.styles.ts", "../../src/document/components/chrome/insertSidebar/InsertSidebar.tsx", "../../src/document/components/chrome/insertSidebar/GroupTitle.styles.ts", "../../src/document/components/chrome/insertSidebar/GroupTitle.tsx", "../../src/document/components/chrome/insertSidebar/InsertSidebarItem.tsx", "../../src/document/components/chrome/insertSidebar/InsertSidebarItems.tsx", "../../src/document/components/chrome/insertSidebar/InsertSidebarKitSections.tsx", "../../src/document/components/chrome/insertSidebar/InsertSidebarSection.tsx", "../../src/document/components/chrome/insertSidebar/hooks/useRestoreScrollOffset.ts", "../../src/document/components/utils/useAvailableCollections.ts", "../../src/document/components/chrome/insertSidebar/collectionSections.ts", "../../src/document/components/chrome/localization/LocaleCanvasPreviewToast.tsx", "../../src/document/components/chrome/localization/getProgressForLocale.ts", "../../src/document/components/chrome/localization/localeCanvasPreviewToast.styles.ts", "../../src/document/components/chrome/localization/LocalizationSidebar.tsx", "../../src/document/components/chrome/localization/LocalizationPluginsPanel.tsx", "../../src/document/components/chrome/localization/LocalizationSidebar.styles.ts", "../../src/document/components/chrome/localization/LocalizationSidebarFooterUpsell.tsx", "../../src/document/components/chrome/localization/LocalizationSidebarFooterUpsell.styles.ts", "../../src/document/components/chrome/localization/LocalizationTable.tsx", "../../src/document/components/chrome/localization/LocalizationTable.styles.ts", "../../src/document/components/chrome/localization/LocalizationTableEmptyState.tsx", "../../src/document/components/chrome/localization/LocalizationTableEmptyState.styles.ts", "../../src/document/components/chrome/localization/useLocalizedValueEditingState.ts", "../../src/document/components/chrome/localization/useTranslate.ts", "../../src/document/components/chrome/localization/LocalizationTextEditorOverlay.tsx", "../../src/document/components/chrome/shared/PaginationArrows.styles.ts", "../../src/document/components/chrome/shared/PaginationArrows.tsx", "../../src/document/components/chrome/localization/LocalizationTextEditorOverlay.styles.ts", "../../src/document/components/chrome/localization/plainTextEditor.styles.ts", "../../src/document/components/chrome/localization/PlainTextEditor.tsx", "../../src/document/components/chrome/preview/CodeEditorPreview.tsx", "../../src/document/components/chrome/preview/CodeEditorModulePreview.tsx", "../../src/document/components/chrome/preview/CodeEditorModulePreview.styles.ts", "../../src/document/components/chrome/preview/CodeEditorPreviewToolbar.tsx", "../../src/document/components/chrome/preview/CodeEditorPreviewToolbar.styles.ts", "../../src/document/components/chrome/preview/PreviewItemsButton.tsx", "../../src/document/components/chrome/preview/PreviewItemsButton.styles.ts", "../../src/document/components/chrome/preview/CodeEditorPreviewWindow.tsx", "../../src/document/components/chrome/preview/CodeEditorPreviewWindow.styles.ts", "../../src/document/components/chrome/preview/sessionDataForIdentifier.ts", "../../src/document/components/chrome/preview/OverCanvasPreview.tsx", "../../src/preview-module/components/PreviewContainer.tsx", "../../src/document/components/chrome/preview/FullsizePreview.tsx", "../../src/document/components/chrome/preview/EmptyDocumentPreview.styles.ts", "../../src/document/components/chrome/preview/EmptyDocumentPreview.tsx", "../../src/document/components/chrome/preview/FullsizePreview.styles.ts", "../../src/document/components/chrome/preview/fullsizePreviewLayoutHelpers.ts", "../../src/document/components/chrome/projectbar/ProjectBar.tsx", "../../src/document/components/chrome/projectbar/Collaborators.tsx", "../../src/document/components/chrome/projectbar/Collaborators.styles.ts", "../../src/document/components/chrome/projectbar/useHoverPopover.ts", "../../src/document/components/chrome/projectbar/useHoverTimers.ts", "../../src/document/components/chrome/projectbar/LocalizationToolbarItem.tsx", "../../src/document/components/chrome/projectbar/PreviewToolbar.tsx", "../../src/document/components/chrome/projectbar/ModeToggle.tsx", "../../src/document/components/chrome/projectbar/ModeToggle.styles.ts", "../../src/document/utils/breakpointPreview.ts", "../../src/document/components/chrome/projectbar/ToolbarResizeInputs.tsx", "../../src/document/components/chrome/projectbar/ToolbarResizeInputs.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarTitle.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/KitProjectBarTitle.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/KitProjectBarTitle.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/KitProjectPopover.tsx", "../../src/document/components/chrome/shared/TextInputWithEmoji.tsx", "../../src/document/components/chrome/shared/TextInputWithEmoji.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/KitProjectPopover.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/useKitIconUpload.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/useKitManifest.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/useKitPublishing.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarTitleLayout.tsx", "../../src/web/pages/project/components/ProjectBar.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/shared.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarPopover.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarTitle.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/RegularProjectBarTitle.tsx", "../../src/document/components/utils/prettifyBranchHostname.ts", "../../src/document/components/utils/useDisplayUrlWithLink.ts", "../../src/document/components/chrome/siteSettings/Project/ProjectLocationButton.tsx", "../../src/document/components/chrome/siteSettings/Project/ProjectLocationButton.styles.ts", "../../src/document/components/chrome/siteSettings/Project/ProjectTitleInput.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarBadge.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarBadge.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarBranch.tsx", "../../src/document/components/chrome/projectbar/icons/IconBranch.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/BranchesPopoutContent.tsx", "../../src/document/components/chrome/projectbar/ProjectBarTitle/BranchesPopoutContent.styles.ts", "../../src/document/components/chrome/projectbar/ProjectBarTitle/ProjectBarBranch.styles.ts", "../../src/document/components/chrome/projectbar/ProjectMenuButton.styles.ts", "../../src/document/components/chrome/projectbar/ProjectMenu.tsx", "../../src/document/components/chrome/projectbar/ProjectMenu.styles.ts", "../../src/document/components/chrome/projectbar/projectBarMenuOffset.ts", "../../src/document/components/chrome/projectbar/icons/IconFramerLogo.tsx", "../../src/document/components/chrome/projectbar/ProjectMenuButton.tsx", "../../src/document/components/chrome/projectbar/Toolbar.tsx", "../../src/document/components/chrome/shared/utils/toolbarHelpers.ts", "../../src/document/components/chrome/projectbar/AnalyticsToolbarItems.tsx", "../../src/document/components/chrome/projectbar/LocalizationToolbarItems.tsx", "../../src/document/components/chrome/projectbar/Toolbar.styles.ts", "../../src/document/components/chrome/projectbar/icons/IconAi.tsx", "../../src/document/components/chrome/projectbar/icons/IconCMS.tsx", "../../src/document/components/chrome/projectbar/icons/IconCMSFill.tsx", "../../src/document/components/chrome/projectbar/usePluginsFromToolbar.ts", "../../src/document/components/chrome/projectbar/icons/IconSyncFill.tsx", "../../src/document/components/chrome/projectbar/ProjectToolbar.tsx", "../../src/document/components/chrome/projectbar/ViewingBranchFromOtherUserToast.tsx", "../../src/app/agent/components/Feedback/AgentFeedbackSidebar.tsx", "../../src/app/agent/components/Feedback/AgentFeedbackSidebar.styles.ts", "../../src/app/agent/components/Feedback/AgentFeedbackThreadCard.tsx", "../../src/app/agent/components/Feedback/AgentFeedbackThreadCard.styles.ts", "../../src/history/DocumentTimelinePanel.tsx", "../../src/history/DocumentTimelineEvent.styles.ts", "../../src/history/ChangeRow.styles.ts", "../../src/history/ChangeRow.tsx", "../../src/history/DocumentTimelineEvent.tsx", "../../src/history/DocumentTimelinePanel.styles.ts", "../../src/document/components/chrome/rightPanel/rightPanel.tsx", "../../src/document/components/chrome/agentPanel/CanvasAgentChatPanel.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsFunnelSidebar.tsx", "../../src/document/components/chrome/analytics/utils/groupBy.ts", "../../src/document/components/chrome/analytics/components/AnalyticsFunnelSidebar.styles.ts", "../../src/document/components/chrome/analytics/components/AnalyticsFunnelSidebarOptionsPanel.tsx", "../../src/document/components/chrome/analytics/components/AnalyticsFunnelSidebarOptionsPanel.styles.ts", "../../src/document/components/chrome/analytics/components/DistributionSlider/DistributionSlider.tsx", "../../src/document/components/chrome/analytics/components/DistributionSlider/DistributionSlider.styles.ts", "../../src/document/components/chrome/analytics/components/DistributionSlider/SliderBar.tsx", "../../src/document/components/chrome/analytics/components/DistributionSlider/Distribution.ts", "../../src/document/components/chrome/analytics/components/DistributionSlider/getButtonLeftPosition.ts", "../../src/document/components/chrome/analytics/components/DistributionSlider/useSliderDragConstraints.ts", "../../src/document/components/chrome/analytics/components/DistributionSlider/useSyncSliderButtonPosition.ts", "../../src/document/components/chrome/analytics/components/FunnelFilterInput.tsx", "../../src/document/components/chrome/analytics/components/FunnelGroupByInput.tsx", "../../src/document/components/chrome/analytics/components/FunnelStepPopout.tsx", "../../src/document/components/chrome/analytics/components/CustomEventStepForm.tsx", "../../src/document/components/chrome/analytics/utils/useMatchingStepActions.ts", "../../src/document/components/chrome/analytics/components/CustomTrackingIdInput.tsx", "../../src/document/components/chrome/analytics/components/FunnelStepPopout.styles.ts", "../../src/document/components/chrome/analytics/components/PageviewStepForm.tsx", "../../src/document/components/chrome/analytics/components/RoutePathComboBox.tsx", "../../src/document/components/chrome/analytics/components/RoutePathComboBox.styles.ts", "../../src/document/components/chrome/analytics/components/TrackingIdStepForm.tsx", "../../src/document/components/chrome/analytics/utils/getTrackingIdNodeForSnapshot.ts", "../../src/document/components/chrome/analytics/components/TrackingIdComboBox.tsx", "../../src/document/components/chrome/analytics/components/TrackingIdComboBox.styles.ts", "../../src/document/components/chrome/analytics/components/TrackingTypeDropdown.tsx", "../../src/document/components/chrome/feedback/FeedbackHUDContainer.tsx", "../../src/document/components/chrome/feedback/FeedbackHUD.tsx", "../../src/feedback/FeedbackSidebar.tsx", "../../src/feedback/FeedbackSidebar.styles.ts", "../../src/feedback/FeedbackThread.tsx", "../../src/feedback/FeedbackComment.tsx", "../../src/feedback/FeedbackComment.styles.ts", "../../src/feedback/FeedbackItem.tsx", "../../src/feedback/FeedbackItem.styles.ts", "../../../../../node_modules/core-js/modules/es6.regexp.replace.js", "../../../../../node_modules/core-js/modules/es6.array.index-of.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/cashtag.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/punct.js", "../../../../../node_modules/core-js/modules/es6.regexp.constructor.js", "../../../../../node_modules/twitter-text/dist/esm/lib/regexSupplant.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/spacesGroup.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/spaces.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validCashtag.js", "../../../../../node_modules/core-js/modules/es6.regexp.match.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/hashSigns.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/endHashtagMatch.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validCCTLD.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/directionalMarkersGroup.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js", "../../../../../node_modules/twitter-text/dist/esm/lib/stringSupplant.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/invalidDomainChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validDomainChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validDomainName.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validGTLD.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validPunycode.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validSubdomain.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validDomain.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validPortNumber.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlPathEndingChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlPath.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlPrecedingChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/extractUrl.js", "../../../../../node_modules/core-js/modules/es6.regexp.split.js", "../../../../../node_modules/twitter-text/dist/esm/lib/idna.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validTcoUrl.js", "../../../../../node_modules/core-js/modules/es6.array.sort.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/hashtagAlpha.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/astralNumerals.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/bmpNumerals.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/hashtagSpecialChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/codePoint.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/hashtagBoundary.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validHashtag.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/atSigns.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validMentionPrecedingChars.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js", "../../../../../node_modules/core-js/modules/es6.regexp.to-string.js", "../../../../../node_modules/core-js/modules/es6.date.to-string.js", "../../../../../node_modules/core-js/modules/es6.object.to-string.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validReply.js", "../../../../../node_modules/core-js/modules/es6.array.is-array.js", "../../../../../node_modules/core-js/modules/es6.array.reduce.js", "../../../../../node_modules/core-js/modules/web.dom.iterable.js", "../../../../../node_modules/twitter-text/dist/esm/parseTweet.js", "../../../../../node_modules/core-js/modules/es6.object.keys.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/invalidChars.js", "../../../../../node_modules/core-js/modules/es6.object.define-property.js", "../../../../../node_modules/core-js/modules/es6.object.define-properties.js", "../../../../../node_modules/core-js/modules/es7.object.get-own-property-descriptors.js", "../../../../../node_modules/core-js/modules/es6.array.for-each.js", "../../../../../node_modules/core-js/modules/es6.array.filter.js", "../../../../../node_modules/core-js/modules/es6.symbol.js", "../../../../../node_modules/twitter-text/dist/esm/isInvalidTweet.js", "../../../../../node_modules/twitter-text/dist/esm/isValidList.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlDomainSegment.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlDomainTld.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlSubDomainSegment.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlDomain.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlDecOctet.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlIpv4.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlIpv6.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlHost.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlAuthority.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlFragment.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlPath.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlQuery.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnencoded.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeSubDomainSegment.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainSegment.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainTld.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomain.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeHost.js", "../../../../../node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeAuthority.js", "../../../../../node_modules/core-js/modules/es6.string.iterator.js", "../../../../../node_modules/core-js/modules/es6.array.from.js", "../../src/feedback/markup.ts", "../../src/feedback/FeedbackThread.styles.ts", "../../src/feedback/useScrollLock.ts", "../../src/feedback/FeedbackThreadSummary.tsx", "../../src/feedback/FeedbackThreadSummary.styles.ts", "../../src/document/components/chrome/feedback/FeedbackHUD.styles.ts", "../../src/document/components/chrome/properties/LocalizedValuePanel.tsx", "../../src/document/components/chrome/properties/LocalizedValuePanel.styles.ts", "../../src/document/components/chrome/properties/panels/icons/IconSectionHeaderMinus.tsx", "../../src/document/components/chrome/properties/rows/SizePresetRow.tsx", "../../src/document/components/chrome/contentPanel/ContentPanelSectionHeader.styles.ts", "../../src/document/components/chrome/contentPanel/ContentPanelSectionHeader.tsx", "../../src/document/components/chrome/properties/rows/SizePresetRow.styles.ts", "../../src/document/components/chrome/properties/FramePresetsPanel.tsx", "../../src/document/components/chrome/properties/panels/PolygonSidesPanel.tsx", "../../src/document/components/chrome/properties/panels/ShapeSizeToFitContentPanel.tsx", "../../src/document/components/chrome/properties/panels/StarSpikesPanel.tsx", "../../src/electron-features/CustomWindow.ts", "../../src/canvas-sandbox-renderer/WindowSandbox.ts", "../../src/export/ExportMetrics.tsx", "../../src/export/exporterToast.ts", "../../src/export/ImageExporter.ts", "../../src/document/components/chrome/properties/NodeProperties.tsx", "../../src/document/components/chrome/properties/LayoutTemplatePropsPanel.tsx", "../../src/document/components/chrome/properties/LayoutTemplateSelector.tsx", "../../src/document/components/chrome/properties/panels/CodeComponentControlPropsPanel.tsx", "../../src/document/components/chrome/shared/UpsellModal/utils/triggerUpsellModals.ts", "../../src/document/components/chrome/properties/rows/CodeComponentEditRow.tsx", "../../src/document/components/chrome/properties/utils/FormContainerPanel.styles.ts", "../../src/document/components/chrome/properties/rows/EffectRows/shared/useSelectedNodeVariants.ts", "../../src/document/components/chrome/properties/panels/PanelSectionHeaderSubtitle.styles.ts", "../../src/document/components/chrome/properties/panels/PanelSectionHeaderSubtitle.tsx", "../../src/document/components/chrome/properties/panels/TriggerActionsPanel.tsx", "../../src/document/components/chrome/properties/panels/OverlayTriggerRow.tsx", "../../src/document/components/chrome/properties/panels/TriggerActionsPanel.styles.ts", "../../src/document/components/chrome/properties/panels/TriggerConditionEventHistoryRows.tsx", "../../src/document/components/chrome/properties/panels/TriggerConditionKeyValueRows.tsx", "../../src/document/components/chrome/properties/panels/TriggerConditionPageCountRow.tsx", "../../src/document/components/chrome/properties/panels/TriggerConditionRouteRows.tsx", "../../src/document/components/chrome/properties/panels/TriggerConditionScheduleRows.tsx", "../../src/document/components/chrome/properties/panels/TriggerConditionsPanel.tsx", "../../src/document/components/chrome/properties/panels/TriggerInteractionsPanel.tsx", "../../src/document/components/chrome/properties/panels/utils/useCopyPasteTriggerActions.ts", "../../src/document/components/chrome/properties/panels/utils/useControlUploadHandler.ts", "../../src/document/components/chrome/properties/panels/PathAlignmentHeader.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/AlignmentRow.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/AlignmentRow.styles.ts", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignBottom.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignCenter.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignLeft.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignMiddle.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignRight.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconAlignTop.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconDistributeHorizontal.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/IconDistributeVertical.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignBottom.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignCenter.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignLeft.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignMiddle.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignRight.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconAlignTop.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconDistributeHorizontal.tsx", "../../src/document/components/chrome/properties/rows/AlignmentRow/icons/NewIconDistributeVertical.tsx", "../../src/document/components/chrome/properties/rows/PathPointPositionRow.tsx", "../../src/document/components/chrome/properties/rows/PathSegmentRadiusRow.tsx", "../../src/document/components/chrome/properties/panels/PathPanel.tsx", "../../src/document/components/chrome/properties/panels/PathCurvePanel.tsx", "../../src/document/components/chrome/properties/panels/icons/IconPathCurveDisconnected.tsx", "../../src/document/components/chrome/properties/panels/icons/IconPathCurveMirrored.tsx", "../../src/document/components/chrome/properties/panels/icons/IconPathCurveStraight.tsx", "../../src/document/components/chrome/properties/PathProperties.tsx", "../../src/document/components/chrome/properties/panels/StrokePanel.tsx", "../../src/utils/evalMath.ts", "../../src/document/components/chrome/properties/panels/PanelSectionHeaderWithTraits.tsx", "../../src/document/components/chrome/properties/panels/utils/addStrokeForNodes.ts", "../../src/document/models/CanvasTree/traits/utils/filterHelpers.ts", "../../src/document/components/chrome/properties/panels/StyleHeader.tsx", "../../src/document/components/chrome/properties/rows/TextSelectionRow.tsx", "../../src/document/components/chrome/properties/panels/TextSelectionValueRows.tsx", "../../src/document/components/chrome/properties/utils/getResolvedVariableValues.ts", "../../src/document/components/chrome/properties/panels/utils/addZIndexForNodes.ts", "../../src/document/components/chrome/properties/panels/AccessibilityPanel.tsx", "../../src/utils/useExpandedStateUntilInputHashChanges.ts", "../../src/document/components/chrome/properties/rows/AccessibilityRows/AriaLabelRow.tsx", "../../src/document/components/chrome/properties/rows/AccessibilityRows/DataNosnippetRow.tsx", "../../src/utils/getOriginalNodes.ts", "../../src/document/components/chrome/properties/rows/AccessibilityRows/HtmlTagRow.tsx", "../../src/document/components/chrome/properties/rows/AccessibilityRows/HtmlTextTagRow.tsx", "../../src/document/components/chrome/properties/rows/AccessibilityRows/HtmlTextTagRow.styles.ts", "../../src/document/components/chrome/properties/rows/AccessibilityRows/TabIndexRow.tsx", "../../src/document/components/chrome/properties/rows/AccessibilityRows/TitleAndDescriptionRow.tsx", "../../src/document/components/chrome/properties/panels/AlignmentHeader.tsx", "../../src/document/components/chrome/properties/panels/BackdropPanel.tsx", "../../src/document/components/chrome/properties/inputs/Padlock.tsx", "../../src/document/components/chrome/properties/inputs/Padlock.styles.ts", "../../src/document/components/chrome/properties/rows/ZIndexRow.tsx", "../../src/document/components/chrome/properties/panels/BackdropPanel.styles.ts", "../../src/document/components/chrome/properties/panels/BackdropPresetRow.tsx", "../../src/document/components/chrome/properties/panels/BreakpointEffectsPanel.tsx", "../../src/document/components/chrome/shared/MaskPopout/MaskPopout.tsx", "../../src/document/components/chrome/shared/MaskPopout/MaskPreview.tsx", "../../src/document/components/chrome/shared/MaskPopout/MaskPreview.styles.ts", "../../src/document/components/chrome/shared/MaskPopout/UnitNumberInputRow.tsx", "../../src/document/components/chrome/shared/PageEffects/tracking.ts", "../../src/document/components/chrome/properties/rows/EffectRows/EffectPreviewIcon.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/FlowEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/useEffectTitle.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/utils.ts", "../../src/document/components/chrome/properties/utils/rotate.ts", "../../src/document/components/chrome/properties/panels/PageEffectsPresetRow.tsx", "../../src/document/components/chrome/properties/panels/PageEffectsRouteSelector.tsx", "../../src/document/components/chrome/properties/panels/CodeExportPanelContainer.tsx", "../../src/document/components/chrome/properties/panels/CodeExportPanel.tsx", "../../src/utils/clearSelectionIfInsideElement.ts", "../../src/document/components/chrome/properties/panels/CSSCode.tsx", "../../src/document/components/chrome/properties/panels/CodeExportPanelEmptyState.tsx", "../../src/document/components/chrome/properties/panels/ComponentCode.tsx", "../../src/document/components/chrome/properties/panels/FoldablePropertyRow.tsx", "../../src/document/components/chrome/properties/panels/FoldablePropertyRow.styles.ts", "../../src/document/components/chrome/properties/panels/SVGCode.tsx", "../../src/document/components/chrome/properties/panels/CodeOverridesPanel.tsx", "../../src/document/components/chrome/properties/panels/CursorPanel.tsx", "../../../../../node_modules/@sentry/src/is.ts", "../../src/document/components/chrome/properties/rows/CustomCursorRow.tsx", "../../src/document/components/chrome/properties/rows/FloatingAlignmentRow.tsx", "../../src/document/components/chrome/properties/rows/FloatingPlacementRow.tsx", "../../src/document/components/chrome/properties/rows/utils/useCopyPasteCustomCursor.ts", "../../src/document/components/chrome/properties/rows/CustomCursorVariantRow.tsx", "../../src/document/components/chrome/properties/panels/utils/buildCursorPanelMenu.ts", "../../src/document/components/chrome/properties/panels/CustomizationsPanel.tsx", "../../src/document/components/chrome/properties/panels/DOMLayoutDebugPanel.tsx", "../../src/document/components/chrome/properties/panels/DataLoaderVariantsPanel.tsx", "../../src/document/components/chrome/properties/panels/DataRepeaterPanel.tsx", "../../src/utils/swapDataSource.ts", "../../src/document/components/chrome/properties/inputs/RepeaterSourcePopupButton.tsx", "../../src/document/components/chrome/properties/rows/dynamicFilterPresets.ts", "../../src/document/components/chrome/properties/rows/CollectionFiltersRow.tsx", "../../src/document/components/utils/useDataSourceVariablesFromDataDefinition.ts", "../../src/document/components/chrome/properties/rows/CollectionOrderRow.tsx", "../../src/document/components/chrome/properties/rows/CollectionOrderRow.styles.ts", "../../src/document/components/chrome/properties/rows/RepeaterCanvasEmptyStateRow.tsx", "../../src/document/components/chrome/properties/rows/RepeaterPaginationRow.tsx", "../../src/document/components/chrome/properties/panels/EmbedPresetPanel.tsx", "../../src/document/components/chrome/properties/rows/SelectEmbedPresetRow.tsx", "../../src/document/components/chrome/properties/panels/SelectComponentStyleEntityAssetPopout.tsx", "../../src/document/components/chrome/properties/panels/SelectImageStyleEntityAssetPopout.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeImageStylePresetRow.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeTableStylePresetRow.styles.ts", "../../src/document/components/chrome/properties/rows/SelectNodeTableStylePresetRow.tsx", "../../src/document/components/chrome/properties/panels/EventsPanel.tsx", "../../src/document/components/chrome/properties/panels/EventActionPopoutButton.tsx", "../../src/code-editor/icons/IconFile.tsx", "../../src/document/components/chrome/properties/panels/EventActionPopout.styles.ts", "../../src/document/components/chrome/properties/panels/EventActionPopout.tsx", "../../src/document/components/chrome/properties/panels/icons/IconActionConsoleLog.tsx", "../../src/document/components/chrome/properties/panels/icons/IconActionGeneric.tsx", "../../src/document/components/chrome/properties/panels/icons/IconActionOpenURL.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionFadeSmall.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionFlipSmall.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionMagicMotionSmall.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionModalSmall.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionOverlaySmall.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionPrevious.tsx", "../../src/document/components/chrome/properties/panels/icons/IconTransitionPushSmall.tsx", "../../src/document/components/chrome/properties/panels/utils/iconForNavigationTransition.tsx", "../../src/document/components/chrome/properties/panels/EventsPanel.styles.ts", "../../src/document/components/chrome/properties/panels/utils/relinkActionDataToAction.ts", "../../src/document/components/chrome/properties/inputs/TypedInputField.tsx", "../../src/document/components/chrome/properties/inputs/TypedInputField.styles.ts", "../../src/document/models/CanvasTree/traits/utils/export.ts", "../../src/document/components/chrome/properties/rows/ExportRow.tsx", "../../src/document/models/CanvasTree/traits/utils/reduceExport.ts", "../../src/document/models/CanvasTree/traits/utils/reduceExportIncludesBackground.ts", "../../src/document/components/chrome/properties/panels/ExportPanel.tsx", "../../src/document/components/chrome/properties/inputs/ExportButton.tsx", "../../src/document/components/chrome/properties/rows/ExportIncludesBackgroundRow.tsx", "../../src/document/components/chrome/properties/panels/ExportPanel.styles.ts", "../../src/document/components/chrome/properties/panels/FiltersPanel.tsx", "../../src/document/components/chrome/properties/panels/FloatingPositionPanel.tsx", "../../src/document/models/CanvasTree/nodes/forms/useFormConfig.ts", "../../src/document/components/chrome/properties/panels/FormContainerPanel.tsx", "../../src/document/components/chrome/shared/PopoutButtonWithLoadingState.styles.ts", "../../src/document/components/chrome/shared/PopoutButtonWithLoadingState.tsx", "../../src/document/components/chrome/properties/panels/FormAntispamPopout.tsx", "../../src/document/components/chrome/properties/panels/FormDestinationPopout.styles.ts", "../../src/document/components/chrome/properties/panels/FormDestinationPopout.tsx", "../../src/document/components/utils/useGoogleAuth.ts", "../../src/document/components/chrome/properties/panels/FormGoogleSheetButton.tsx", "../../src/document/components/chrome/properties/panels/FormCreateGoogleSheetPopout.tsx", "../../src/document/components/chrome/properties/panels/FormCreateGoogleSheetPopout.styles.ts", "../../src/document/components/chrome/properties/panels/FormSuccessRedirectPopoutButton.tsx", "../../src/document/components/chrome/properties/panels/FormInputPanel.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/AllItemsLabelRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/BooleanLabelRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/FormInputBooleanRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/utils.ts", "../../src/document/components/chrome/properties/rows/FormInputRows/FormInputNumberRow.tsx", "../../src/document/utils/getComputedValueStartValue.ts", "../../src/document/components/chrome/properties/rows/FormInputRows/InputAutoFocusRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputAutofillEnabledRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputHiddenRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputNameRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputPlaceholderRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputRequiredRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputValueRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/SelectOptionsRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/SelectOptionPopout.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/TextAreaResizableRow.tsx", "../../src/document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts", "../../src/document/components/chrome/properties/rows/FormInputRows/TextInputTypeRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/VariableBindingRow.tsx", "../../src/document/components/chrome/properties/panels/FormInputsHeader.tsx", "../../src/document/components/chrome/properties/panels/FormInputStyleRows.tsx", "../../src/document/components/chrome/properties/codeComponentRows/ColorControlPropRow.tsx", "../../src/document/components/chrome/properties/panels/FormFontRow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/FontControlPropRow.tsx", "../../src/document/components/chrome/properties/codeComponentRows/FontPopout.tsx", "../../src/document/components/chrome/properties/panels/FormVariantsPanel.tsx", "../../src/document/components/chrome/properties/panels/GridItemPositionPanel.tsx", "../../src/document/components/chrome/properties/inputs/AlignmentGridInput.styles.ts", "../../src/document/components/chrome/properties/inputs/AlignmentGridInput.tsx", "../../src/document/components/chrome/properties/panels/GridItemLayoutPanel.styles.ts", "../../src/document/components/chrome/properties/panels/GridItemSpanRows.tsx", "../../src/document/components/chrome/properties/panels/KitsCustomizationsPanel.tsx", "../../src/document/components/chrome/properties/panels/KitsCustomizationsPanel.styles.ts", "../../src/document/components/chrome/properties/panels/OverflowPanel.tsx", "../../src/document/components/chrome/properties/panels/OverlayGridPanel.tsx", "../../src/document/components/chrome/properties/panels/OverlayGridPopoutButton.tsx", "../../src/document/components/chrome/properties/panels/OverlayGridPopout.tsx", "../../src/document/components/chrome/properties/panels/OverlayGridPopoutButton.styles.ts", "../../src/document/components/chrome/properties/panels/OverlaysPanel.tsx", "../../src/document/components/chrome/properties/rows/FileRow.tsx", "../../src/document/components/chrome/properties/rows/OverrideRow.tsx", "../../src/document/components/chrome/properties/panels/OverridePanel.tsx", "../../src/document/components/chrome/properties/panels/OverscrollBehaviorPanel.tsx", "../../src/document/components/chrome/properties/inputs/ConstraintsSimulation.styles.ts", "../../src/document/components/chrome/properties/inputs/ConstraintsSimulation.tsx", "../../src/document/components/chrome/properties/panels/PositionPanel.tsx", "../../src/document/components/chrome/properties/inputs/ConstraintsInput.tsx", "../../src/document/components/chrome/properties/inputs/ConstraintsInput.styles.ts", "../../src/document/components/chrome/properties/inputs/icons/IconPinHorizontal.tsx", "../../src/document/components/chrome/properties/inputs/icons/IconPinVertical.tsx", "../../src/document/components/chrome/properties/rows/PositionRow.tsx", "../../src/document/components/chrome/properties/panels/utils/getPinnedNodes.ts", "../../src/document/components/chrome/properties/panels/utils/togglePinForNodes.ts", "../../src/document/components/chrome/properties/rows/PositionRow.styles.ts", "../../src/document/components/chrome/properties/panels/PositionStickyRows.tsx", "../../src/document/components/chrome/properties/panels/PresetAndOrientationPanel.tsx", "../../src/document/components/chrome/properties/rows/FrameOrientationRow.tsx", "../../src/document/components/chrome/properties/rows/FramePresetPickerRow.tsx", "../../src/document/components/chrome/properties/panels/RepeatPanel.tsx", "../../src/document/components/chrome/properties/panels/utils/repeatPanelVariableDefaults.ts", "../../src/document/components/chrome/properties/panels/ResizeToFitContentPanel.tsx", "../../src/document/components/chrome/properties/panels/ScrollTargetPanel.styles.ts", "../../src/document/components/chrome/properties/panels/ScrollTargetPanel.tsx", "../../src/document/components/chrome/properties/panels/SelectionPropertiesPanel.tsx", "../../src/document/components/chrome/properties/inputs/SelectionPropertiesColorPicker.tsx", "../../src/document/components/chrome/properties/panels/SelectionPropertiesPanel.styles.ts", "../../src/document/components/chrome/properties/panels/ShaderControlPropsPanel.tsx", "../../src/document/components/chrome/properties/panels/ShapeBooleanPanel.styles.ts", "../../src/document/components/chrome/properties/panels/icons/IconBooleanExclude.tsx", "../../src/document/components/chrome/properties/panels/icons/IconBooleanIntersect.tsx", "../../src/document/components/chrome/properties/panels/icons/IconBooleanJoin.tsx", "../../src/document/components/chrome/properties/panels/icons/IconBooleanSubtract.tsx", "../../src/document/components/chrome/properties/panels/icons/IconBooleanUnite.tsx", "../../src/document/components/chrome/properties/panels/ShapeBooleanPanel.tsx", "../../src/document/components/chrome/properties/inputs/DimensionInput.styles.ts", "../../src/document/components/chrome/properties/inputs/DimensionInput.tsx", "../../src/document/models/CanvasTree/nodes/utils/adjustedRectForConversionToFixedSize.ts", "../../src/document/models/CanvasTree/nodes/utils/convertCollapsibleGridChildrenToFixedSize.ts", "../../src/document/models/CanvasTree/nodes/utils/sizeHelpers.ts", "../../src/document/components/chrome/properties/panels/SizePanel.tsx", "../../src/document/components/chrome/properties/rows/SizeRow/SizeRow.tsx", "../../src/document/components/chrome/properties/panels/icons/IconAgentStackDirectionHorizontal.tsx", "../../src/document/components/chrome/properties/panels/icons/IconAgentStackDirectionVertical.tsx", "../../src/document/components/chrome/properties/panels/icons/IconGrowFixed.tsx", "../../src/document/components/chrome/properties/panels/icons/IconGrowHorizontal.tsx", "../../src/document/components/chrome/properties/panels/icons/IconGrowVertical.tsx", "../../src/document/components/chrome/properties/panels/TextSizePresetsPanel.tsx", "../../src/document/components/chrome/properties/panels/StackAndGridLayoutPanel.tsx", "../../src/document/components/chrome/properties/panels/utils/useLayoutUpdate.ts", "../../src/document/components/chrome/properties/panels/GapRow.tsx", "../../src/document/components/chrome/properties/panels/GridLayoutRows.tsx", "../../src/document/components/chrome/properties/panels/StackLayoutRows.tsx", "../../src/document/components/chrome/properties/panels/utils/addTextTruncationForNodes.ts", "../../src/document/components/chrome/properties/rows/TextTruncationRow.tsx", "../../src/document/components/chrome/properties/panels/TextPanel.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeAnchorLinkStylePresetRow.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeBlockquoteStylePresetRow.tsx", "../../src/document/components/chrome/properties/panels/utils/useBlockquoteStylePresets.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeInlineCodeStylePresetRow.tsx", "../../src/document/components/chrome/properties/panels/SelectInlineCodeStyleEntityAssetPopout.tsx", "../../src/document/components/chrome/properties/panels/utils/useInlineCodeStylePresets.tsx", "../../src/document/components/chrome/properties/rows/SelectNodeTextStylePresetRow.tsx", "../../src/document/components/chrome/properties/panels/TextPanel.styles.ts", "../../src/document/components/chrome/properties/panels/utils/addTextWrapBalanceForNodes.ts", "../../src/document/components/chrome/properties/panels/TransformsPanel.tsx", "../../src/document/components/chrome/properties/rows/PerspectiveRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/BackfaceVisibilityRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/DepthRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/OriginRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/RotationRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/ScaleRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/SkewRow.tsx", "../../src/document/components/chrome/properties/rows/TransformRows/TransformStyleRow.tsx", "../../src/document/components/chrome/properties/panels/TypographyPanel.tsx", "../../src/document/components/chrome/properties/rows/BlendModeRow.tsx", "../../src/document/components/chrome/properties/rows/DraggableRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/DragEffectRow.tsx", "../../src/document/models/CanvasTree/nodes/utils/tickerEffectHelpers.ts", "../../src/document/components/chrome/properties/rows/EffectRows/EffectsHeader.tsx", "../../src/document/components/chrome/properties/rows/ParallaxRow.tsx", "../../src/document/models/CanvasTree/traits/utils/StyleEffect.ts", "../../src/document/components/chrome/properties/rows/EffectRows/GestureEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectStylePopout.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/LightboxEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/LoopEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/StrokeEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/StyleAppearEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/EffectPresetRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectDirectionRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectStartRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectTriggerRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/shared/EffectViewportRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/StyleTransformEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/VariantAppearEffectRow.styles.ts", "../../src/document/components/chrome/properties/rows/EffectRows/TextEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/TextEffectPresetRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/TextEffectPreview.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/TextEffectPreview.styles.ts", "../../src/document/components/chrome/properties/rows/EffectRows/TickerEffectRow.tsx", "../../src/document/components/chrome/properties/rows/EffectRows/VariantAppearEffectRow.tsx", "../../src/document/components/chrome/properties/rows/FillOpacityRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputFocusedStyleRow.tsx", "../../src/document/components/chrome/properties/panels/FormInputFocusedStylePopoutContent.tsx", "../../src/document/components/chrome/properties/codeComponentRows/BorderControlPropRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/FormBooleanCheckedEffectRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputIconRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputInvalidTextColorRow.tsx", "../../src/document/components/chrome/properties/rows/FormInputRows/InputPlaceholderColorRow.tsx", "../../src/document/components/chrome/properties/rows/ImageRenderingRow.tsx", "../../src/document/components/chrome/properties/rows/OpacityRow.tsx", "../../src/document/components/chrome/properties/rows/PointerEventsRow.tsx", "../../src/document/components/chrome/properties/rows/PositionTypeRow.tsx", "../../src/document/components/chrome/properties/rows/ScrollbarsRow.tsx", "../../src/document/components/chrome/properties/rows/SizeConstraintsRow.tsx", "../../src/document/components/chrome/properties/inputs/ConstraintInput.tsx", "../../src/document/components/chrome/properties/rows/TapHighlightRow.tsx", "../../src/document/components/chrome/properties/rows/UserSelectRow.tsx", "../../src/document/components/chrome/properties/rows/ViewTransitionNoneRow.tsx", "../../src/document/components/chrome/properties/rows/VisibilityRow.tsx", "../../src/document/components/chrome/properties/index.tsx", "../../src/document/components/chrome/properties/LayoutTemplateEmptyStatePanel.tsx", "../../src/document/components/chrome/properties/OnboardingPanel.tsx", "../../src/document/components/chrome/properties/NuxPanel.tsx", "../../src/web/lib/achievements.ts", "../../src/document/components/chrome/properties/SharedPanelStyles.styles.ts", "../../src/document/components/chrome/properties/SharedPanelComponents.tsx", "../../src/document/components/chrome/properties/OwnershipTransferPanel.tsx", "../../src/document/components/chrome/properties/PagePropertiesPanel.tsx", "../../src/document/components/chrome/properties/PagePropertiesPanel.styles.ts", "../../src/document/components/chrome/properties/panels/ScalePanel.tsx", "../../src/document/components/chrome/properties/panels/ScalePanel.styles.ts", "agent-evals-browser-entry:/Users/alex/Projects/FramerStudio/src/app/vekter/src/document/components/chrome/rightPanel/evaluationsPanelEntry.tsx", "../../src/document/components/chrome/rightPanel/rightPanel.styles.ts", "../../src/document/components/chrome/rightPanel/rightPanelState.ts", "../../src/document/components/chrome/shared/BreadcrumbBar.tsx", "../../src/document/components/chrome/shared/VersionHistoryControls/VersionHistoryControls.tsx", "../../src/document/components/chrome/shared/VersionHistoryControls/VersionHistoryControls.styles.ts", "../../src/document/components/chrome/shared/utils/renameComponent.ts", "../../src/document/components/chrome/shared/Crash.tsx", "../../src/document/components/chrome/shared/Crash.styles.ts", "../../src/document/components/chrome/siteSettings/OptimizationIssuesLogWindow.tsx", "../../src/document/components/chrome/siteSettings/OptimizationIssuesLog/index.tsx", "../../../../../node_modules/react-markdown/lib/index.js", "../../node_modules/ansi-regex/index.js", "../../node_modules/strip-ansi/index.js", "../../src/document/components/chrome/siteSettings/generateDeploymentError.ts", "../../src/document/components/chrome/siteSettings/OptimizationIssuesLog/Link.tsx", "../../src/document/components/chrome/siteSettings/OptimizationIssuesLog/index.styles.ts", "../../src/document/components/chrome/siteSettings/OptimizationIssuesLogWindow.styles.ts", "../../src/document/components/chrome/siteSettings/SiteSettings.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/CustomCode.tsx", "../../src/document/components/chrome/siteSettings/CustomCode/CustomCode.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/Domains.tsx", "../../src/document/components/chrome/siteSettings/Domains/CanonicalURL/CanonicalURL.tsx", "../../src/web/pages/projects/components/Domains/Rewrites/ProxiedProject.ts", "../../src/document/components/chrome/shared/UpsellModal/utils/customProxyUpsellModals.ts", "../../src/document/components/chrome/siteSettings/Project/updateWebMetadata.ts", "../../src/document/components/chrome/siteSettings/Domains/DomainCheckmarkIcon.tsx", "../../src/document/components/chrome/siteSettings/Domains/Domains.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/CanonicalURL/CanonicalURL.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/AddCustomDomain/AddCustomDomain.tsx", "../../src/document/components/chrome/shared/UpsellModal/utils/customDomainUpsellModal.ts", "../../src/document/components/chrome/shared/UpsellModal/utils/domainToBuyUpsellModal.ts", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/AddCustomDomain/redeemDomainVoucher.ts", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomainDetails/CustomDomainDetails.tsx", "../../src/document/components/chrome/siteSettings/ConfirmRemoveCustomDomainModal.tsx", "../../src/document/components/chrome/siteSettings/Domains/VersionMetadata.tsx", "../../src/document/components/chrome/siteSettings/Domains/labelForStatus.tsx", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomainDetails/ConflictsTable.tsx", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomainDetails/ConflictTable.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomainDetails/DNSTable.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomainDetails/DNSTable.tsx", "../../src/document/components/chrome/siteSettings/Domains/CustomDomain/CustomDomain.tsx", "../../src/document/components/chrome/siteSettings/Domains/UnpublishedState/UnpublishedState.styles.ts", "../../src/document/components/chrome/siteSettings/Domains/UnpublishedState/UnpublishedState.tsx", "../../src/document/components/chrome/siteSettings/Forms/GoogleAccountConnection.tsx", "../../src/document/components/chrome/siteSettings/Forms/GoogleAccountConnection.styles.ts", "../../src/document/components/chrome/siteSettings/Forms/UtmTracking.tsx", "../../src/document/components/chrome/siteSettings/Forms/FormsSettings.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/SocialImageSectionForCMSPage.tsx", "../../src/utils/getFirstObjectKey.ts", "../../src/document/components/chrome/siteSettings/SiteImages/SocialImageSection.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/ImagePreview.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/ImagePreview.styles.ts", "../../src/document/components/chrome/siteSettings/SiteImages/ImageUploadInput.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/ImageUploadInput.styles.ts", "../../src/document/components/chrome/siteSettings/SiteImages/SocialImageSection.styles.ts", "../../src/document/components/chrome/siteSettings/SiteImages/useChangeSiteImage.tsx", "../../src/document/components/utils/useConvertIdPathVariablesToReadable.ts", "../../src/document/components/chrome/siteSettings/Page/PageMetadata.tsx", "../../src/document/components/chrome/siteSettings/SearchResultPreview.styles.ts", "../../src/document/components/chrome/siteSettings/SearchResultPreview.tsx", "../../src/document/components/chrome/siteSettings/SettingTextArea.tsx", "../../src/document/components/chrome/siteSettings/SettingTextArea.styles.ts", "../../src/document/components/chrome/siteSettings/utils/handleSaveSettings.ts", "../../src/document/components/chrome/siteSettings/Page/PageMetadataSearchSection.tsx", "../../src/document/components/chrome/siteSettings/Page/PageMetadataSearchSection.styles.ts", "../../src/document/components/chrome/siteSettings/Page/PageSettings.tsx", "../../src/document/components/chrome/siteSettings/Plans/index.tsx", "../../src/document/components/chrome/siteSettings/Plans/Enterprise/Plans.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Enterprise/Plans.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/Plans.tsx", "../../src/document/components/chrome/siteSettings/Plans/usePlanQueryParam.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/Plans.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/addOns/confirmCancelAddOn.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/CurrentPlanAction.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/reactivatePlanToast.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/CurrentPlanAction.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansCard.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansCard.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/CurrentPlanDescription.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/CurrentPlanDescription.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/DomainVoucherBadge.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/DomainVoucherBadge.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlanFeatures.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlanFeatures.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansCardAddOns.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansCardAddOns.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansError.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/PlansSuccess.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/Preview.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/canToggleBillingPeriod.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/Preview.styles.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/hooks/useShouldShowDomainVoucherBadge.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/useStripePlans.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/api/checkoutSession.ts", "../../src/document/components/chrome/shared/UpsellModal/utils/editorLimitUpsellModal.tsx", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/resourceCounts.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/formatDisplayPrice.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/resourceLimits.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/utils/validateFeatureFlags.ts", "../../src/document/components/chrome/siteSettings/Plans/Stripe/components/RedirectFromStripeSuccess.tsx", "../../src/document/components/chrome/siteSettings/Plans/useSitePlans.ts", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeyModals.tsx", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeyModals.styles.ts", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeys.styles.ts", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeyRow.tsx", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeyTable.tsx", "../../src/document/components/chrome/siteSettings/Project/APIKeys/APIKeys.tsx", "../../src/document/components/chrome/siteSettings/Project/GoogleAnalytics.tsx", "../../src/document/components/chrome/siteSettings/Project/Images.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/AppleTouchIconSection.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/AppleTouchIconSection.styles.ts", "../../src/document/components/chrome/siteSettings/SiteImages/FaviconSection.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/UploadFavicon.tsx", "../../src/document/components/chrome/siteSettings/SiteImages/UploadFavicon.styles.ts", "../../src/document/components/chrome/siteSettings/Project/Site.tsx", "../../src/document/components/chrome/siteSettings/Project/DangerZone.tsx", "../../src/document/components/chrome/siteSettings/Project/ConfirmUnpublishProjectModal.tsx", "../../src/document/components/chrome/siteSettings/Project/DangerZone.styles.ts", "../../src/document/components/chrome/siteSettings/Project/Password.tsx", "../../src/document/components/chrome/floatingToolbar/useCurrentAndPrevious.ts", "../../src/document/components/chrome/siteSettings/Project/Project.styles.ts", "../../src/document/components/chrome/siteSettings/Project/useMetadataPerRouteInfo.ts", "../../src/document/components/chrome/siteSettings/Project/ProjectSettings.tsx", "../../src/document/components/chrome/siteSettings/Redirects/Redirects.tsx", "../../src/document/components/chrome/siteSettings/Redirects/CreateRedirect.tsx", "../../src/document/components/chrome/siteSettings/Redirects/CreateRedirect.styles.ts", "../../src/document/components/chrome/siteSettings/Redirects/useRedirectForm.tsx", "../../src/document/components/chrome/siteSettings/Redirects/useRedirectForm.styles.ts", "../../src/document/components/chrome/siteSettings/Redirects/RedirectsList.tsx", "../../src/document/components/chrome/siteSettings/Redirects/RedirectsList.styles.ts", "../../src/document/components/chrome/siteSettings/SiteSettingsSidebar.tsx", "../../src/document/components/chrome/siteSettings/settingsTabIsEqual.ts", "../../src/document/components/chrome/siteSettings/SiteSettingsPanelRow.tsx", "../../src/document/components/chrome/siteSettings/SiteSettingsRouteSegmentRow.tsx", "../../src/document/components/chrome/siteSettings/SiteSettingsVariantRow.tsx", "../../src/document/components/chrome/agentPanel/components/IconAgentClock.tsx", "../../src/document/components/chrome/siteSettings/sidebarIcons/SiteSettingsSidebarIcons.tsx", "../../src/document/components/chrome/siteSettings/Usage/Usage.tsx", "../../src/document/components/chrome/siteSettings/Usage/AgentsUsage/AgentsUsageFull.tsx", "../../src/document/components/chrome/siteSettings/Usage/utils/addUsageFilter.ts", "../../src/document/components/chrome/siteSettings/Usage/AgentsUsage/AgentsUsageLimited.tsx", "../../src/document/components/chrome/siteSettings/Usage/AgentsUsage/AgentsUsage.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/BandwidthUsage.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/BandwidthUsageUpgradeBanner.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/BandwidthUsageUpgradeBanner.styles.ts", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/BandwidthUsageSummaryRow.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/TopAssets.tsx", "../../src/utils/getAssetName.ts", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/BandwidthCategoryIcons.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/TopCategories.tsx", "../../src/document/components/chrome/siteSettings/Usage/BandwidthUsage/useBandwidthUsageData.ts", "../../src/document/components/chrome/siteSettings/Usage/UsageTypeSelector.tsx", "../../src/document/components/chrome/siteSettings/Usage/useUsagePageState.ts", "../../src/document/components/chrome/siteSettings/Versions.tsx", "../../src/document/components/chrome/siteSettings/Infobox.styles.ts", "../../src/document/components/chrome/siteSettings/Infobox.tsx", "../../src/document/components/chrome/siteSettings/PublishToCustomDomainModal.tsx", "../../src/document/components/chrome/siteSettings/VersionsView.tsx", "../../src/document/components/chrome/siteSettings/VersionsView.styles.ts", "../../src/document/components/chrome/statusBar/StatusBar.tsx", "../../src/document/components/chrome/toaster/Toaster.tsx", "../../src/document/components/chrome/toaster/Toast.styles.ts", "../../src/code-editor/CodeEditor.tsx", "../../src/code-editor/CodeEditor.styles.ts", "../../src/document/components/chrome/codePanel/CodeEditorContainer.tsx", "../../src/document/ipc/EditorAppImpl.ts", "../../src/document/ipc/services.ts"],
  "sourcesContent": ["module.exports = function (it) {\n  return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n", "var isObject = require('./_is-object');\nmodule.exports = function (it) {\n  if (!isObject(it)) throw TypeError(it + ' is not an object!');\n  return it;\n};\n", "// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n  if (it == undefined) throw TypeError(\"Can't call method on  \" + it);\n  return it;\n};\n", "// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n  return Object(defined(it));\n};\n", "// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n", "// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n", "var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true  -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n  return function (that, pos) {\n    var s = String(defined(that));\n    var i = toInteger(pos);\n    var l = s.length;\n    var a, b;\n    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n    a = s.charCodeAt(i);\n    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n      ? TO_STRING ? s.charAt(i) : a\n      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n  };\n};\n", "'use strict';\nvar at = require('./_string-at')(true);\n\n // `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n  return index + (unicode ? at(S, index).length : 1);\n};\n", "var toString = {}.toString;\n\nmodule.exports = function (it) {\n  return toString.call(it).slice(8, -1);\n};\n", "var core = module.exports = { version: '2.6.12' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n", "// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n  ? window : typeof self != 'undefined' && self.Math == Math ? self\n  // eslint-disable-next-line no-new-func\n  : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n", "module.exports = false;\n", "var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n  return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n  version: core.version,\n  mode: require('./_library') ? 'pure' : 'global',\n  copyright: '\u00A9 2020 Denis Pushkarev (zloirock.ru)'\n});\n", "var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n", "var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n  return store[name] || (store[name] =\n    USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n", "// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n  try {\n    return it[key];\n  } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n  var O, T, B;\n  return it === undefined ? 'Undefined' : it === null ? 'Null'\n    // @@toStringTag case\n    : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n    // builtinTag case\n    : ARG ? cof(O)\n    // ES3 arguments fallback\n    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n", "'use strict';\n\nvar classof = require('./_classof');\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n  var exec = R.exec;\n  if (typeof exec === 'function') {\n    var result = exec.call(R, S);\n    if (typeof result !== 'object') {\n      throw new TypeError('RegExp exec method returned something other than an Object or null');\n    }\n    return result;\n  }\n  if (classof(R) !== 'RegExp') {\n    throw new TypeError('RegExp#exec called on incompatible receiver');\n  }\n  return builtinExec.call(R, S);\n};\n", "'use strict';\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = require('./_an-object');\nmodule.exports = function () {\n  var that = anObject(this);\n  var result = '';\n  if (that.global) result += 'g';\n  if (that.ignoreCase) result += 'i';\n  if (that.multiline) result += 'm';\n  if (that.unicode) result += 'u';\n  if (that.sticky) result += 'y';\n  return result;\n};\n", "'use strict';\n\nvar regexpFlags = require('./_flags');\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar LAST_INDEX = 'lastIndex';\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n  var re1 = /a/,\n      re2 = /b*/g;\n  nativeExec.call(re1, 'a');\n  nativeExec.call(re2, 'a');\n  return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;\n})();\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;\n\nif (PATCH) {\n  patchedExec = function exec(str) {\n    var re = this;\n    var lastIndex, reCopy, match, i;\n\n    if (NPCG_INCLUDED) {\n      reCopy = new RegExp('^' + re.source + '$(?!\\\\s)', regexpFlags.call(re));\n    }\n    if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];\n\n    match = nativeExec.call(re, str);\n\n    if (UPDATES_LAST_INDEX_WRONG && match) {\n      re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;\n    }\n    if (NPCG_INCLUDED && match && match.length > 1) {\n      // Fix browsers whose `exec` methods don't consistently return `undefined`\n      // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n      // eslint-disable-next-line no-loop-func\n      nativeReplace.call(match[0], reCopy, function () {\n        for (i = 1; i < arguments.length - 2; i++) {\n          if (arguments[i] === undefined) match[i] = undefined;\n        }\n      });\n    }\n\n    return match;\n  };\n}\n\nmodule.exports = patchedExec;\n", "module.exports = function (exec) {\n  try {\n    return !!exec();\n  } catch (e) {\n    return true;\n  }\n};\n", "// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n", "var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n  return is ? document.createElement(it) : {};\n};\n", "module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n  return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n", "// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n  if (!isObject(it)) return it;\n  var fn, val;\n  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n  throw TypeError(\"Can't convert object to primitive value\");\n};\n", "var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n  anObject(O);\n  P = toPrimitive(P, true);\n  anObject(Attributes);\n  if (IE8_DOM_DEFINE) try {\n    return dP(O, P, Attributes);\n  } catch (e) { /* empty */ }\n  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n  if ('value' in Attributes) O[P] = Attributes.value;\n  return O;\n};\n", "module.exports = function (bitmap, value) {\n  return {\n    enumerable: !(bitmap & 1),\n    configurable: !(bitmap & 2),\n    writable: !(bitmap & 4),\n    value: value\n  };\n};\n", "var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n  return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n  object[key] = value;\n  return object;\n};\n", "var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n  return hasOwnProperty.call(it, key);\n};\n", "module.exports = require('./_shared')('native-function-to-string', Function.toString);\n", "var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar $toString = require('./_function-to-string');\nvar TO_STRING = 'toString';\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n  return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n  var isFunction = typeof val == 'function';\n  if (isFunction) has(val, 'name') || hide(val, 'name', key);\n  if (O[key] === val) return;\n  if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n  if (O === global) {\n    O[key] = val;\n  } else if (!safe) {\n    delete O[key];\n    hide(O, key, val);\n  } else if (O[key]) {\n    O[key] = val;\n  } else {\n    hide(O, key, val);\n  }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n  return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n", "module.exports = function (it) {\n  if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n  return it;\n};\n", "// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n  aFunction(fn);\n  if (that === undefined) return fn;\n  switch (length) {\n    case 1: return function (a) {\n      return fn.call(that, a);\n    };\n    case 2: return function (a, b) {\n      return fn.call(that, a, b);\n    };\n    case 3: return function (a, b, c) {\n      return fn.call(that, a, b, c);\n    };\n  }\n  return function (/* ...args */) {\n    return fn.apply(that, arguments);\n  };\n};\n", "var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n  var IS_FORCED = type & $export.F;\n  var IS_GLOBAL = type & $export.G;\n  var IS_STATIC = type & $export.S;\n  var IS_PROTO = type & $export.P;\n  var IS_BIND = type & $export.B;\n  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n  var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n  var key, own, out, exp;\n  if (IS_GLOBAL) source = name;\n  for (key in source) {\n    // contains in native\n    own = !IS_FORCED && target && target[key] !== undefined;\n    // export native or passed\n    out = (own ? target : source)[key];\n    // bind timers to global for call from export context\n    exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n    // extend global\n    if (target) redefine(target, key, out, type & $export.U);\n    // export\n    if (exports[key] != out) hide(exports, key, exp);\n    if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n  }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1;   // forced\n$export.G = 2;   // global\n$export.S = 4;   // static\n$export.P = 8;   // proto\n$export.B = 16;  // bind\n$export.W = 32;  // wrap\n$export.U = 64;  // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n", "'use strict';\nvar regexpExec = require('./_regexp-exec');\nrequire('./_export')({\n  target: 'RegExp',\n  proto: true,\n  forced: regexpExec !== /./.exec\n}, {\n  exec: regexpExec\n});\n", "'use strict';\nrequire('./es6.regexp.exec');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar fails = require('./_fails');\nvar defined = require('./_defined');\nvar wks = require('./_wks');\nvar regexpExec = require('./_regexp-exec');\n\nvar SPECIES = wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n  // #replace needs built-in support for named groups.\n  // #match works fine because it just return the exec results, even if it has\n  // a \"grops\" property.\n  var re = /./;\n  re.exec = function () {\n    var result = [];\n    result.groups = { a: '7' };\n    return result;\n  };\n  return ''.replace(re, '$<a>') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n  // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n  var re = /(?:)/;\n  var originalExec = re.exec;\n  re.exec = function () { return originalExec.apply(this, arguments); };\n  var result = 'ab'.split(re);\n  return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nmodule.exports = function (KEY, length, exec) {\n  var SYMBOL = wks(KEY);\n\n  var DELEGATES_TO_SYMBOL = !fails(function () {\n    // String methods call symbol-named RegEp methods\n    var O = {};\n    O[SYMBOL] = function () { return 7; };\n    return ''[KEY](O) != 7;\n  });\n\n  var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {\n    // Symbol-named RegExp methods call .exec\n    var execCalled = false;\n    var re = /a/;\n    re.exec = function () { execCalled = true; return null; };\n    if (KEY === 'split') {\n      // RegExp[@@split] doesn't call the regex's exec method, but first creates\n      // a new one. We need to return the patched regex when creating the new one.\n      re.constructor = {};\n      re.constructor[SPECIES] = function () { return re; };\n    }\n    re[SYMBOL]('');\n    return !execCalled;\n  }) : undefined;\n\n  if (\n    !DELEGATES_TO_SYMBOL ||\n    !DELEGATES_TO_EXEC ||\n    (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n    (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n  ) {\n    var nativeRegExpMethod = /./[SYMBOL];\n    var fns = exec(\n      defined,\n      SYMBOL,\n      ''[KEY],\n      function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n        if (regexp.exec === regexpExec) {\n          if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n            // The native String method already delegates to @@method (this\n            // polyfilled function), leasing to infinite recursion.\n            // We avoid it by directly calling the native @@method method.\n            return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n          }\n          return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n        }\n        return { done: false };\n      }\n    );\n    var strfn = fns[0];\n    var rxfn = fns[1];\n\n    redefine(String.prototype, KEY, strfn);\n    hide(RegExp.prototype, SYMBOL, length == 2\n      // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n      // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n      ? function (string, arg) { return rxfn.call(string, this, arg); }\n      // 21.2.5.6 RegExp.prototype[@@match](string)\n      // 21.2.5.9 RegExp.prototype[@@search](string)\n      : function (string) { return rxfn.call(string, this); }\n    );\n  }\n};\n", "// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n  return cof(it) == 'String' ? it.split('') : Object(it);\n};\n", "// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n  return IObject(defined(it));\n};\n", "var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n  index = toInteger(index);\n  return index < 0 ? max(index + length, 0) : min(index, length);\n};\n", "// false -> Array#indexOf\n// true  -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n  return function ($this, el, fromIndex) {\n    var O = toIObject($this);\n    var length = toLength(O.length);\n    var index = toAbsoluteIndex(fromIndex, length);\n    var value;\n    // Array#includes uses SameValueZero equality algorithm\n    // eslint-disable-next-line no-self-compare\n    if (IS_INCLUDES && el != el) while (length > index) {\n      value = O[index++];\n      // eslint-disable-next-line no-self-compare\n      if (value != value) return true;\n    // Array#indexOf ignores holes, Array#includes - not\n    } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n      if (O[index] === el) return IS_INCLUDES || index || 0;\n    } return !IS_INCLUDES && -1;\n  };\n};\n", "'use strict';\nvar fails = require('./_fails');\n\nmodule.exports = function (method, arg) {\n  return !!method && fails(function () {\n    // eslint-disable-next-line no-useless-call\n    arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n  });\n};\n", "exports.f = {}.propertyIsEnumerable;\n", "var pIE = require('./_object-pie');\nvar createDesc = require('./_property-desc');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar has = require('./_has');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {\n  O = toIObject(O);\n  P = toPrimitive(P, true);\n  if (IE8_DOM_DEFINE) try {\n    return gOPD(O, P);\n  } catch (e) { /* empty */ }\n  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n", "// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = require('./_is-object');\nvar anObject = require('./_an-object');\nvar check = function (O, proto) {\n  anObject(O);\n  if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n    function (test, buggy, set) {\n      try {\n        set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);\n        set(test, []);\n        buggy = !(test instanceof Array);\n      } catch (e) { buggy = true; }\n      return function setPrototypeOf(O, proto) {\n        check(O, proto);\n        if (buggy) O.__proto__ = proto;\n        else set(O, proto);\n        return O;\n      };\n    }({}, false) : undefined),\n  check: check\n};\n", "var isObject = require('./_is-object');\nvar setPrototypeOf = require('./_set-proto').set;\nmodule.exports = function (that, target, C) {\n  var S = target.constructor;\n  var P;\n  if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n    setPrototypeOf(that, P);\n  } return that;\n};\n", "var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n  return shared[key] || (shared[key] = uid(key));\n};\n", "var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n  var O = toIObject(object);\n  var i = 0;\n  var result = [];\n  var key;\n  for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n  // Don't enum bug & hidden keys\n  while (names.length > i) if (has(O, key = names[i++])) {\n    ~arrayIndexOf(result, key) || result.push(key);\n  }\n  return result;\n};\n", "// IE 8- don't enum bug keys\nmodule.exports = (\n  'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n", "// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = require('./_object-keys-internal');\nvar hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n  return $keys(O, hiddenKeys);\n};\n", "// 7.2.8 IsRegExp(argument)\nvar isObject = require('./_is-object');\nvar cof = require('./_cof');\nvar MATCH = require('./_wks')('match');\nmodule.exports = function (it) {\n  var isRegExp;\n  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');\n};\n", "'use strict';\nvar global = require('./_global');\nvar dP = require('./_object-dp');\nvar DESCRIPTORS = require('./_descriptors');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (KEY) {\n  var C = global[KEY];\n  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n    configurable: true,\n    get: function () { return this; }\n  });\n};\n", "// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = require('./_an-object');\nvar aFunction = require('./_a-function');\nvar SPECIES = require('./_wks')('species');\nmodule.exports = function (O, D) {\n  var C = anObject(O).constructor;\n  var S;\n  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n", "/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t    counter = 0,\n\t\t    length = string.length,\n\t\t    value,\n\t\t    extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t//  0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t    inputLength = input.length,\n\t\t    out,\n\t\t    i = 0,\n\t\t    n = initialN,\n\t\t    bias = initialBias,\n\t\t    basic,\n\t\t    j,\n\t\t    index,\n\t\t    oldi,\n\t\t    w,\n\t\t    k,\n\t\t    digit,\n\t\t    t,\n\t\t    /** Cached calculation results */\n\t\t    baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t    delta,\n\t\t    handledCPCount,\n\t\t    basicLength,\n\t\t    bias,\n\t\t    j,\n\t\t    m,\n\t\t    q,\n\t\t    k,\n\t\t    t,\n\t\t    currentValue,\n\t\t    output = [],\n\t\t    /** `inputLength` will hold the number of code points in `input`. */\n\t\t    inputLength,\n\t\t    /** Cached calculation results */\n\t\t    handledCPCountPlusOne,\n\t\t    baseMinusT,\n\t\t    qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n", "// 21.2.5.3 get RegExp.prototype.flags()\nif (require('./_descriptors') && /./g.flags != 'g') require('./_object-dp').f(RegExp.prototype, 'flags', {\n  configurable: true,\n  get: require('./_flags')\n});\n", "// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n  return cof(arg) == 'Array';\n};\n", "var aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar IObject = require('./_iobject');\nvar toLength = require('./_to-length');\n\nmodule.exports = function (that, callbackfn, aLen, memo, isRight) {\n  aFunction(callbackfn);\n  var O = toObject(that);\n  var self = IObject(O);\n  var length = toLength(O.length);\n  var index = isRight ? length - 1 : 0;\n  var i = isRight ? -1 : 1;\n  if (aLen < 2) for (;;) {\n    if (index in self) {\n      memo = self[index];\n      index += i;\n      break;\n    }\n    index += i;\n    if (isRight ? index < 0 : length <= index) {\n      throw TypeError('Reduce of empty array with no initial value');\n    }\n  }\n  for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {\n    memo = callbackfn(memo, self[index], index, O);\n  }\n  return memo;\n};\n", "// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n  ArrayProto[UNSCOPABLES][key] = true;\n};\n", "module.exports = function (done, value) {\n  return { value: value, done: !!done };\n};\n", "module.exports = {};\n", "// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n  return $keys(O, enumBugKeys);\n};\n", "var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n  anObject(O);\n  var keys = getKeys(Properties);\n  var length = keys.length;\n  var i = 0;\n  var P;\n  while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n  return O;\n};\n", "var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n", "// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n  // Thrash, waste and sodomy: IE GC bug\n  var iframe = require('./_dom-create')('iframe');\n  var i = enumBugKeys.length;\n  var lt = '<';\n  var gt = '>';\n  var iframeDocument;\n  iframe.style.display = 'none';\n  require('./_html').appendChild(iframe);\n  iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n  // createDict = iframe.contentWindow.Object;\n  // html.removeChild(iframe);\n  iframeDocument = iframe.contentWindow.document;\n  iframeDocument.open();\n  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n  iframeDocument.close();\n  createDict = iframeDocument.F;\n  while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n  return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n  var result;\n  if (O !== null) {\n    Empty[PROTOTYPE] = anObject(O);\n    result = new Empty();\n    Empty[PROTOTYPE] = null;\n    // add \"__proto__\" for Object.getPrototypeOf polyfill\n    result[IE_PROTO] = O;\n  } else result = createDict();\n  return Properties === undefined ? result : dPs(result, Properties);\n};\n", "var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n", "'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n  Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n  setToStringTag(Constructor, NAME + ' Iterator');\n};\n", "// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n  O = toObject(O);\n  if (has(O, IE_PROTO)) return O[IE_PROTO];\n  if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n    return O.constructor.prototype;\n  } return O instanceof Object ? ObjectProto : null;\n};\n", "'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n  $iterCreate(Constructor, NAME, next);\n  var getMethod = function (kind) {\n    if (!BUGGY && kind in proto) return proto[kind];\n    switch (kind) {\n      case KEYS: return function keys() { return new Constructor(this, kind); };\n      case VALUES: return function values() { return new Constructor(this, kind); };\n    } return function entries() { return new Constructor(this, kind); };\n  };\n  var TAG = NAME + ' Iterator';\n  var DEF_VALUES = DEFAULT == VALUES;\n  var VALUES_BUG = false;\n  var proto = Base.prototype;\n  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n  var $default = $native || getMethod(DEFAULT);\n  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n  var methods, key, IteratorPrototype;\n  // Fix native\n  if ($anyNative) {\n    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n      // Set @@toStringTag to native iterators\n      setToStringTag(IteratorPrototype, TAG, true);\n      // fix for some old engines\n      if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n    }\n  }\n  // fix Array#{values, @@iterator}.name in V8 / FF\n  if (DEF_VALUES && $native && $native.name !== VALUES) {\n    VALUES_BUG = true;\n    $default = function values() { return $native.call(this); };\n  }\n  // Define iterator\n  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n    hide(proto, ITERATOR, $default);\n  }\n  // Plug for library\n  Iterators[NAME] = $default;\n  Iterators[TAG] = returnThis;\n  if (DEFAULT) {\n    methods = {\n      values: DEF_VALUES ? $default : getMethod(VALUES),\n      keys: IS_SET ? $default : getMethod(KEYS),\n      entries: $entries\n    };\n    if (FORCED) for (key in methods) {\n      if (!(key in proto)) redefine(proto, key, methods[key]);\n    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n  }\n  return methods;\n};\n", "'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n  this._t = toIObject(iterated); // target\n  this._i = 0;                   // next index\n  this._k = kind;                // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n  var O = this._t;\n  var kind = this._k;\n  var index = this._i++;\n  if (!O || index >= O.length) {\n    this._t = undefined;\n    return step(1);\n  }\n  if (kind == 'keys') return step(0, index);\n  if (kind == 'values') return step(0, O[index]);\n  return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n", "// most Object methods by ES6 should accept primitives\nvar $export = require('./_export');\nvar core = require('./_core');\nvar fails = require('./_fails');\nmodule.exports = function (KEY, exec) {\n  var fn = (core.Object || {})[KEY] || Object[KEY];\n  var exp = {};\n  exp[KEY] = exec(fn);\n  $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n", "\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\n// Copyright Twitter Inc. Licensed under MIT\n// https://github.com/twitter/twemoji-parser/blob/master/LICENSE.md\n\n// This file is auto-generated\nexports.default = /(?:\\ud83d[\\udc68\\udc69])(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddb0-\\uddb3])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f)|[#*0-9]\\ufe0f?\\u20e3|(?:[\u00A9\u00AE\\u2122\\u265f]\\ufe0f)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\uddb5\\uddb6\\uddb8\\uddb9\\uddd1-\\udddd]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a-\\udc6d\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\udeeb\\udeec\\udef4-\\udef9]|\\ud83e[\\udd10-\\udd17\\udd1d\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd40-\\udd45\\udd47-\\udd70\\udd73-\\udd76\\udd7a\\udd7c-\\udda2\\uddb4\\uddb7\\uddc0-\\uddc2\\uddd0\\uddde-\\uddff]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a])|\\ufe0f/g;", "'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.TypeName = undefined;\nexports.parse = parse;\nexports.toCodePoints = toCodePoints;\n\nvar _regex = require('./lib/regex');\n\nvar _regex2 = _interopRequireDefault(_regex);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar TypeName = exports.TypeName = 'emoji';\n// Copyright Twitter Inc. Licensed under MIT\n// https://github.com/twitter/twemoji-parser/blob/master/LICENSE.md\nfunction parse(text, options) {\n  var assetType = options && options.assetType ? options.assetType : 'svg';\n  var getTwemojiUrl = options && options.buildUrl ? options.buildUrl : function (codepoints, assetType) {\n    return assetType === 'png' ? 'https://twemoji.maxcdn.com/2/72x72/' + codepoints + '.png' : 'https://twemoji.maxcdn.com/2/svg/' + codepoints + '.svg';\n  };\n\n  var entities = [];\n\n  _regex2.default.lastIndex = 0;\n  while (true) {\n    var result = _regex2.default.exec(text);\n    if (!result) {\n      break;\n    }\n\n    var emojiText = result[0];\n    var codepoints = toCodePoints(removeVS16s(emojiText)).join('-');\n\n    entities.push({\n      url: codepoints ? getTwemojiUrl(codepoints, assetType) : '',\n      indices: [result.index, _regex2.default.lastIndex],\n      text: emojiText,\n      type: TypeName\n    });\n  }\n  return entities;\n}\n\nvar vs16RegExp = /\\uFE0F/g;\n// avoid using a string literal like '\\u200D' here because minifiers expand it inline\nvar zeroWidthJoiner = String.fromCharCode(0x200d);\n\nvar removeVS16s = function removeVS16s(rawEmoji) {\n  return rawEmoji.indexOf(zeroWidthJoiner) < 0 ? rawEmoji.replace(vs16RegExp, '') : rawEmoji;\n};\n\nfunction toCodePoints(unicodeSurrogates) {\n  var points = [];\n  var char = 0;\n  var previous = 0;\n  var i = 0;\n  while (i < unicodeSurrogates.length) {\n    char = unicodeSurrogates.charCodeAt(i++);\n    if (previous) {\n      points.push((0x10000 + (previous - 0xd800 << 10) + (char - 0xdc00)).toString(16));\n      previous = 0;\n    } else if (char > 0xd800 && char <= 0xdbff) {\n      previous = char;\n    } else {\n      points.push(char.toString(16));\n    }\n  }\n  return points;\n}", "exports.f = Object.getOwnPropertySymbols;\n", "// all object keys, includes non-enumerable and symbols\nvar gOPN = require('./_object-gopn');\nvar gOPS = require('./_object-gops');\nvar anObject = require('./_an-object');\nvar Reflect = require('./_global').Reflect;\nmodule.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {\n  var keys = gOPN.f(anObject(it));\n  var getSymbols = gOPS.f;\n  return getSymbols ? keys.concat(getSymbols(it)) : keys;\n};\n", "'use strict';\nvar $defineProperty = require('./_object-dp');\nvar createDesc = require('./_property-desc');\n\nmodule.exports = function (object, index, value) {\n  if (index in object) $defineProperty.f(object, index, createDesc(0, value));\n  else object[index] = value;\n};\n", "var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n  var C;\n  if (isArray(original)) {\n    C = original.constructor;\n    // cross-realm fallback\n    if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n    if (isObject(C)) {\n      C = C[SPECIES];\n      if (C === null) C = undefined;\n    }\n  } return C === undefined ? Array : C;\n};\n", "// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = require('./_array-species-constructor');\n\nmodule.exports = function (original, length) {\n  return new (speciesConstructor(original))(length);\n};\n", "// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n  var IS_MAP = TYPE == 1;\n  var IS_FILTER = TYPE == 2;\n  var IS_SOME = TYPE == 3;\n  var IS_EVERY = TYPE == 4;\n  var IS_FIND_INDEX = TYPE == 6;\n  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n  var create = $create || asc;\n  return function ($this, callbackfn, that) {\n    var O = toObject($this);\n    var self = IObject(O);\n    var f = ctx(callbackfn, that, 3);\n    var length = toLength(self.length);\n    var index = 0;\n    var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n    var val, res;\n    for (;length > index; index++) if (NO_HOLES || index in self) {\n      val = self[index];\n      res = f(val, index, O);\n      if (TYPE) {\n        if (IS_MAP) result[index] = res;   // map\n        else if (res) switch (TYPE) {\n          case 3: return true;             // some\n          case 5: return val;              // find\n          case 6: return index;            // findIndex\n          case 2: result.push(val);        // filter\n        } else if (IS_EVERY) return false; // every\n      }\n    }\n    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n  };\n};\n", "var META = require('./_uid')('meta');\nvar isObject = require('./_is-object');\nvar has = require('./_has');\nvar setDesc = require('./_object-dp').f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n  return true;\n};\nvar FREEZE = !require('./_fails')(function () {\n  return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n  setDesc(it, META, { value: {\n    i: 'O' + ++id, // object ID\n    w: {}          // weak collections IDs\n  } });\n};\nvar fastKey = function (it, create) {\n  // return primitive with prefix\n  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n  if (!has(it, META)) {\n    // can't set metadata to uncaught frozen object\n    if (!isExtensible(it)) return 'F';\n    // not necessary to add metadata\n    if (!create) return 'E';\n    // add missing metadata\n    setMeta(it);\n  // return object ID\n  } return it[META].i;\n};\nvar getWeak = function (it, create) {\n  if (!has(it, META)) {\n    // can't set metadata to uncaught frozen object\n    if (!isExtensible(it)) return true;\n    // not necessary to add metadata\n    if (!create) return false;\n    // add missing metadata\n    setMeta(it);\n  // return hash weak collections IDs\n  } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n  return it;\n};\nvar meta = module.exports = {\n  KEY: META,\n  NEED: false,\n  fastKey: fastKey,\n  getWeak: getWeak,\n  onFreeze: onFreeze\n};\n", "exports.f = require('./_wks');\n", "var global = require('./_global');\nvar core = require('./_core');\nvar LIBRARY = require('./_library');\nvar wksExt = require('./_wks-ext');\nvar defineProperty = require('./_object-dp').f;\nmodule.exports = function (name) {\n  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n", "// all enumerable object keys, includes symbols\nvar getKeys = require('./_object-keys');\nvar gOPS = require('./_object-gops');\nvar pIE = require('./_object-pie');\nmodule.exports = function (it) {\n  var result = getKeys(it);\n  var getSymbols = gOPS.f;\n  if (getSymbols) {\n    var symbols = getSymbols(it);\n    var isEnum = pIE.f;\n    var i = 0;\n    var key;\n    while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n  } return result;\n};\n", "// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = require('./_to-iobject');\nvar gOPN = require('./_object-gopn').f;\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n  ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n  try {\n    return gOPN(it);\n  } catch (e) {\n    return windowNames.slice();\n  }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n", "// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n  try {\n    return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n  // 7.4.6 IteratorClose(iterator, completion)\n  } catch (e) {\n    var ret = iterator['return'];\n    if (ret !== undefined) anObject(ret.call(iterator));\n    throw e;\n  }\n};\n", "// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n", "var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n  if (it != undefined) return it[ITERATOR]\n    || it['@@iterator']\n    || Iterators[classof(it)];\n};\n", "var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n  var riter = [7][ITERATOR]();\n  riter['return'] = function () { SAFE_CLOSING = true; };\n  // eslint-disable-next-line no-throw-literal\n  Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n  if (!skipClosing && !SAFE_CLOSING) return false;\n  var safe = false;\n  try {\n    var arr = [7];\n    var iter = arr[ITERATOR]();\n    iter.next = function () { return { done: safe = true }; };\n    arr[ITERATOR] = function () { return iter; };\n    exec(arr);\n  } catch (e) { /* empty */ }\n  return safe;\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createAppLaunchEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerAppLaunchEvent instead of createAppLaunchEvent.\");\n  return {\n    ...payload,\n    event: \"app_launch\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerAppLaunchEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"app_launch\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createAppLaunchEvent,\n  triggerAppLaunchEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createCommentCreateEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerCommentCreateEvent instead of createCommentCreateEvent.\");\n  return {\n    ...payload,\n    event: \"comment_create\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerCommentCreateEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"comment_create\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createCommentCreateEvent,\n  triggerCommentCreateEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createCommentDeleteEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerCommentDeleteEvent instead of createCommentDeleteEvent.\");\n  return {\n    ...payload,\n    event: \"comment_delete\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerCommentDeleteEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"comment_delete\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createCommentDeleteEvent,\n  triggerCommentDeleteEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createCommentUpdateEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerCommentUpdateEvent instead of createCommentUpdateEvent.\");\n  return {\n    ...payload,\n    event: \"comment_update\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerCommentUpdateEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"comment_update\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createCommentUpdateEvent,\n  triggerCommentUpdateEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createComponentCodeOverrideSetEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerComponentCodeOverrideSetEvent instead of createComponentCodeOverrideSetEvent.\");\n  return {\n    ...payload,\n    event: \"component_code_override_set\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerComponentCodeOverrideSetEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"component_code_override_set\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createComponentCodeOverrideSetEvent,\n  triggerComponentCodeOverrideSetEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createExportBitmapEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerExportBitmapEvent instead of createExportBitmapEvent.\");\n  return {\n    ...payload,\n    event: \"export_bitmap\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerExportBitmapEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"export_bitmap\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createExportBitmapEvent,\n  triggerExportBitmapEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createGridsDeleteEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerGridsDeleteEvent instead of createGridsDeleteEvent.\");\n  return {\n    ...payload,\n    event: \"grids_delete\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerGridsDeleteEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"grids_delete\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createGridsDeleteEvent,\n  triggerGridsDeleteEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createThreadArchiveEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerThreadArchiveEvent instead of createThreadArchiveEvent.\");\n  return {\n    ...payload,\n    event: \"thread_archive\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerThreadArchiveEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"thread_archive\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createThreadArchiveEvent,\n  triggerThreadArchiveEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createToggleGridsEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerToggleGridsEvent instead of createToggleGridsEvent.\");\n  return {\n    ...payload,\n    event: \"toggle_grids\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerToggleGridsEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"toggle_grids\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createToggleGridsEvent,\n  triggerToggleGridsEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createToggleRulersEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerToggleRulersEvent instead of createToggleRulersEvent.\");\n  return {\n    ...payload,\n    event: \"toggle_rulers\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerToggleRulersEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"toggle_rulers\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createToggleRulersEvent,\n  triggerToggleRulersEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createTutorialVideoStartedEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerTutorialVideoStartedEvent instead of createTutorialVideoStartedEvent.\");\n  return {\n    ...payload,\n    event: \"tutorial_video_started\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerTutorialVideoStartedEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"tutorial_video_started\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createTutorialVideoStartedEvent,\n  triggerTutorialVideoStartedEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createTutorialVideoStepEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerTutorialVideoStepEvent instead of createTutorialVideoStepEvent.\");\n  return {\n    ...payload,\n    event: \"tutorial_video_step\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerTutorialVideoStepEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"tutorial_video_step\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createTutorialVideoStepEvent,\n  triggerTutorialVideoStepEvent\n};\n", "import { triggerEvent } from \"../listeners\";\nfunction createVariableDeleteEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerVariableDeleteEvent instead of createVariableDeleteEvent.\");\n  return {\n    ...payload,\n    event: \"variable_delete\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerVariableDeleteEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"variable_delete\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createVariableDeleteEvent,\n  triggerVariableDeleteEvent\n};\n", "import { addEventListener } from \"@framerjs/framer-events\"\nimport { logTracking } from \"document/EngineLoggers.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\n\nlet hasInstalledFramerEventEditReasonTracking = false\n\nexport function installFramerEventEditReasonTracking(engine: VekterEngine): void {\n\tif (hasInstalledFramerEventEditReasonTracking) return\n\thasInstalledFramerEventEditReasonTracking = true\n\n\t// Browser entrypoints own this listener. CLI eval runtimes still create engines, but they should\n\t// not inherit browser event wiring just because they imported a shared engine module.\n\taddEventListener(event => {\n\t\tengine.setEditReasonFromEvent(String(event.event))\n\t\tlogTracking.debug(event.event, event)\n\t})\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { EditorApp } from \"../EditorApp.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace EditorAppHelper {\n\ttype Interface = EditorApp.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__EditorApp__\",\n\t\tfingerprint: \"6016dc493a981e1bae5d36bc8e6f66d9\",\n\t\tmethods: {\n\t\t\tloadBlankProject: {},\n\t\t\tloadProject: {},\n\t\t\tloadProjectChunk: {},\n\t\t\tprepareNodeSnapshot: {},\n\t\t\tprepareScopeSnapshot: {},\n\t\t\texportToHTML: {},\n\t\t\twaitForRenderCycle: {},\n\t\t\twaitUntilRendered: {},\n\t\t\twaitForSandbox: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tloadBlankProject: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"loadBlankProject\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\tloadProject: voidMethodTemplate.bind(/* this: */ -1, \"loadProject\", /* accepts argument: */ true, helper),\n\t\t\t\tloadProjectChunk: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"loadProjectChunk\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\tprepareNodeSnapshot: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"prepareNodeSnapshot\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\tprepareScopeSnapshot: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"prepareScopeSnapshot\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\texportToHTML: valueMethodTemplate.bind(/* this: */ -1, \"exportToHTML\", /* accepts argument: */ false, helper),\n\t\t\t\twaitForRenderCycle: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"waitForRenderCycle\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twaitUntilRendered: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"waitUntilRendered\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twaitForSandbox: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"waitForSandbox\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { EditorAppHelper } from \"./service-runtime/EditorAppHelper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace EditorApp {\n\t/**\n\t * EditorApp is not documented.\n\t */\n\texport interface Interface {\n\t\tloadBlankProject(): Promise<void>\n\t\tloadProject(_: EditorApp.LoadProjectRequest): Promise<void>\n\t\tloadProjectChunk(_: EditorApp.LoadProjectChunkRequest): Promise<void>\n\t\tprepareNodeSnapshot(_: EditorApp.PrepareNodeSnapshotRequest): Promise<void>\n\t\tprepareScopeSnapshot(_: EditorApp.PrepareScopeSnapshotRequest): Promise<void>\n\t\texportToHTML(): Promise<EditorApp.ExportToHTMLResponse>\n\t\twaitForRenderCycle(): Promise<void>\n\t\twaitUntilRendered(): Promise<void>\n\t\twaitForSandbox(): Promise<void>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = EditorAppHelper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type LoadProjectRequest = ServiceValue<{\n\t\tdocument: string\n\t\tscripts: { readonly [_: string]: string }\n\t}>\n\n\texport type LoadProjectChunkRequest = ServiceValue<{\n\t\tvalue: string\n\t\tdone?: boolean\n\t}>\n\n\texport type SizeObject = ServiceValue<{\n\t\twidth: integer\n\t\theight: integer\n\t}>\n\n\texport type PrepareNodeSnapshotRequest = ServiceValue<{\n\t\tnodeId: string\n\t\tzoom: float\n\t\tpadding: integer\n\t\tclipContentOutsideNodeRect: boolean\n\t}>\n\n\texport type PrepareScopeSnapshotRequest = ServiceValue<{\n\t\tscopeId?: string\n\t\tsize?: EditorApp.SizeObject\n\t}>\n\n\texport type ExportToHTMLResponse = ServiceValue<{\n\t\thtml: string\n\t\tssgEditorInputBase64: string\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { ElectronProject } from \"../ElectronProject.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace ElectronProjectHelper {\n\ttype Interface = ElectronProject.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__ElectronProject__\",\n\t\tfingerprint: \"844b769ee2cc7016a85e72a0f0dc23e0\",\n\t\tmethods: {\n\t\t\tselectNode: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tselectNode: voidMethodTemplate.bind(/* this: */ -1, \"selectNode\", /* accepts argument: */ true, helper),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { ElectronProjectHelper } from \"./service-runtime/ElectronProjectHelper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace ElectronProject {\n\t/**\n\t * ElectronProject is not documented.\n\t */\n\texport interface Interface {\n\t\tselectNode(_: ElectronProject.SelectNodePayload): Promise<void>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = ElectronProjectHelper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type SelectNodePayload = ServiceValue<{\n\t\tnodeId: string\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { ElectronProjectV2 } from \"../ElectronProjectV2.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace ElectronProjectV2Helper {\n\ttype Interface = ElectronProjectV2.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__ElectronProjectV2__\",\n\t\tfingerprint: \"609ab67aa6212a2e92b0ea3798b8c2dc\",\n\t\tmethods: {\n\t\t\tselectNode: {},\n\t\t\topenPlugin: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tselectNode: voidMethodTemplate.bind(/* this: */ -1, \"selectNode\", /* accepts argument: */ true, helper),\n\t\t\t\topenPlugin: voidMethodTemplate.bind(/* this: */ -1, \"openPlugin\", /* accepts argument: */ true, helper),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { ElectronProjectV2Helper } from \"./service-runtime/ElectronProjectV2Helper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace ElectronProjectV2 {\n\t/**\n\t * ElectronProjectV2 is not documented.\n\t */\n\texport interface Interface {\n\t\tselectNode(_: ElectronProjectV2.SelectNodePayload): Promise<void>\n\t\topenPlugin(_: ElectronProjectV2.OpenPluginPayload): Promise<void>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = ElectronProjectV2Helper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type SelectNodePayload = ServiceValue<{\n\t\tnodeId: string\n\t}>\n\n\texport type OpenPluginPayload = ServiceValue<{\n\t\tpluginId: string\n\t\tversion?: string\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { ElectronWebRendering } from \"../ElectronWebRendering.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace ElectronWebRenderingHelper {\n\ttype Interface = ElectronWebRendering.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__ElectronWebRendering__\",\n\t\tfingerprint: \"79923a10a586630621d09aebc8921d01\",\n\t\tmethods: {\n\t\t\tcollectMetrics: {},\n\t\t\topenSaveDialog: {},\n\t\t\twillOpenWindow: {},\n\t\t\twriteToClipboard: {},\n\t\t\twriteToDisk: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tcollectMetrics: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"collectMetrics\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\topenSaveDialog: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"openSaveDialog\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twillOpenWindow: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"willOpenWindow\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twriteToClipboard: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"writeToClipboard\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twriteToDisk: voidMethodTemplate.bind(/* this: */ -1, \"writeToDisk\", /* accepts argument: */ true, helper),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { ElectronWebRenderingHelper } from \"./service-runtime/ElectronWebRenderingHelper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace ElectronWebRendering {\n\t/**\n\t * ElectronWebRendering is not documented.\n\t */\n\texport interface Interface {\n\t\tcollectMetrics(): Promise<ElectronWebRendering.MetricList>\n\t\topenSaveDialog(_: ElectronWebRendering.SaveDialogOptions): Promise<ElectronWebRendering.SaveDialogValue>\n\t\twillOpenWindow(_: ElectronWebRendering.WindowOptions): Promise<ElectronWebRendering.WindowReference>\n\t\twriteToClipboard(_: ElectronWebRendering.ClipboardOptions): Promise<void>\n\t\twriteToDisk(_: ElectronWebRendering.SnapshotOptions): Promise<void>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = ElectronWebRenderingHelper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type ImageType = ServiceValue<\"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/svg+xml\" | \"application/pdf\">\n\n\texport type WindowOptions = ServiceValue<{\n\t\turl: string\n\t\twidth: integer\n\t\theight: integer\n\t\toffscreen?: boolean\n\t}>\n\n\texport type WindowReference = ServiceValue<{\n\t\tid: string\n\t}>\n\n\texport type ClipboardOptions = ServiceValue<{\n\t\tref: ElectronWebRendering.WindowReference\n\t\ttype: ElectronWebRendering.ImageType\n\t\tnodeId: string\n\t\trect: Rect\n\t\tpixelRatio: float\n\t\tsvgString?: string\n\t}>\n\n\texport type SnapshotOptions = ServiceValue<{\n\t\tref: ElectronWebRendering.WindowReference\n\t\trect: Rect\n\t\ttype: ElectronWebRendering.ImageType\n\t\tnodeId: string\n\t\tpixelRatio: float\n\t\tcount?: integer\n\t\tdialogFilePath?: string\n\t\tsvgString?: string\n\t\tpathname?: string\n\t}>\n\n\texport type MetricList = ServiceValue<{\n\t\tmetrics: readonly ElectronWebRendering.Metric[]\n\t}>\n\n\texport type Metric = ServiceValue<{\n\t\tnodeId: string\n\t\tpixelRatio: float\n\t\tkb: float\n\t\thasSavedToDisk: boolean\n\t\terrorReason?: string\n\t}>\n\n\texport type SaveDialogOptions = ServiceValue<{\n\t\tcount: integer\n\t\tpathname: string\n\t}>\n\n\texport type SaveDialogValue = ServiceValue<{\n\t\tcanceled: boolean\n\t\tfilePath?: string\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { ElectronWebRenderingV2 } from \"../ElectronWebRenderingV2.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace ElectronWebRenderingV2Helper {\n\ttype Interface = ElectronWebRenderingV2.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__ElectronWebRenderingV2__\",\n\t\tfingerprint: \"6c902a5850607b51714e2b27dafbde81\",\n\t\tmethods: {\n\t\t\tcollectMetrics: {},\n\t\t\topenSaveDialog: {},\n\t\t\twillOpenWindow: {},\n\t\t\twriteToClipboard: {},\n\t\t\twriteToDisk: {},\n\t\t\tgetImageData: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tcollectMetrics: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"collectMetrics\",\n\t\t\t\t\t/* accepts argument: */ false,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\topenSaveDialog: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"openSaveDialog\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twillOpenWindow: valueMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"willOpenWindow\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twriteToClipboard: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"writeToClipboard\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t\twriteToDisk: voidMethodTemplate.bind(/* this: */ -1, \"writeToDisk\", /* accepts argument: */ true, helper),\n\t\t\t\tgetImageData: valueMethodTemplate.bind(/* this: */ -1, \"getImageData\", /* accepts argument: */ true, helper),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { ElectronWebRenderingV2Helper } from \"./service-runtime/ElectronWebRenderingV2Helper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace ElectronWebRenderingV2 {\n\t/**\n\t * ElectronWebRenderingV2 is not documented.\n\t */\n\texport interface Interface {\n\t\tcollectMetrics(): Promise<ElectronWebRenderingV2.MetricList>\n\t\topenSaveDialog(_: ElectronWebRenderingV2.SaveDialogOptions): Promise<ElectronWebRenderingV2.SaveDialogValue>\n\t\twillOpenWindow(_: ElectronWebRenderingV2.WindowOptions): Promise<ElectronWebRenderingV2.WindowReference>\n\t\twriteToClipboard(_: ElectronWebRenderingV2.ClipboardOptions): Promise<void>\n\t\twriteToDisk(_: ElectronWebRenderingV2.SnapshotOptions): Promise<void>\n\t\tgetImageData(_: ElectronWebRenderingV2.SnapshotOptions): Promise<ElectronWebRenderingV2.ImageData>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = ElectronWebRenderingV2Helper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type ImageType = ServiceValue<\"image/png\" | \"image/jpeg\" | \"image/webp\" | \"image/svg+xml\" | \"application/pdf\">\n\n\texport type WindowOptions = ServiceValue<{\n\t\turl: string\n\t\twidth: integer\n\t\theight: integer\n\t\toffscreen?: boolean\n\t}>\n\n\texport type WindowReference = ServiceValue<{\n\t\tid: string\n\t}>\n\n\texport type ClipboardOptions = ServiceValue<{\n\t\tref: ElectronWebRenderingV2.WindowReference\n\t\ttype: ElectronWebRenderingV2.ImageType\n\t\tnodeId: string\n\t\trect: Rect\n\t\tpixelRatio: float\n\t\tsvgString?: string\n\t}>\n\n\texport type SnapshotOptions = ServiceValue<{\n\t\tref: ElectronWebRenderingV2.WindowReference\n\t\trect: Rect\n\t\ttype: ElectronWebRenderingV2.ImageType\n\t\tnodeId: string\n\t\tpixelRatio: float\n\t\tcount?: integer\n\t\tdialogFilePath?: string\n\t\tsvgString?: string\n\t\tpathname?: string\n\t\tp3?: boolean\n\t}>\n\n\texport type ImageData = ServiceValue<{\n\t\timageData: string\n\t}>\n\n\texport type MetricList = ServiceValue<{\n\t\tmetrics: readonly ElectronWebRenderingV2.Metric[]\n\t}>\n\n\texport type Metric = ServiceValue<{\n\t\tnodeId: string\n\t\tpixelRatio: float\n\t\tkb: float\n\t\thasSavedToDisk: boolean\n\t\terrorReason?: string\n\t}>\n\n\texport type SaveDialogOptions = ServiceValue<{\n\t\tcount: integer\n\t\tpathname: string\n\t}>\n\n\texport type SaveDialogValue = ServiceValue<{\n\t\tcanceled: boolean\n\t\tfilePath?: string\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { SnapshotViewport } from \"../SnapshotViewport.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace SnapshotViewportHelper {\n\ttype Interface = SnapshotViewport.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__SnapshotViewport__\",\n\t\tfingerprint: \"5d7944c615588110457196b6afc7ce01\",\n\t\tmethods: {\n\t\t\tsetViewportSize: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tsetViewportSize: voidMethodTemplate.bind(\n\t\t\t\t\t/* this: */ -1,\n\t\t\t\t\t\"setViewportSize\",\n\t\t\t\t\t/* accepts argument: */ true,\n\t\t\t\t\thelper,\n\t\t\t\t),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { SnapshotViewportHelper } from \"./service-runtime/SnapshotViewportHelper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace SnapshotViewport {\n\t/**\n\t * SnapshotViewport is not documented.\n\t */\n\texport interface Interface {\n\t\tsetViewportSize(_: SnapshotViewport.SetViewportSizeRequest): Promise<void>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = SnapshotViewportHelper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n\n\t/*\n\t * Types\n\t */\n\n\texport type SetViewportSizeRequest = ServiceValue<{\n\t\twidth: integer\n\t\theight: integer\n\t}>\n}\n", "/*\n ****\n ******\n ******\n ******\n ****** \u267B\uFE0F Runtime helper generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n ****** See '../' for service types.\n ******\n ******\n ******\n ****\n */\n\n// The generated service helper may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport {\n\tService,\n\tServiceManager,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../../runtime/index.ts\"\n\nimport type { MenuActionTarget } from \"../MenuActionTarget.ts\"\n\nconst { onewayMethodTemplate, voidMethodTemplate, valueMethodTemplate, streamMethodTemplate } = ServiceRuntimePrivate\n\nexport namespace MenuActionTargetHelper {\n\ttype Interface = MenuActionTarget.Interface\n\n\texport const service: Service<Interface> = {\n\t\tid: \"__MenuActionTarget__\",\n\t\tfingerprint: \"2288dedaaf67013b5294929342d641ea\",\n\t\tmethods: {\n\t\t\tvalidate: {},\n\t\t\tdispatch: {},\n\t\t},\n\t\tnewOutgoingWrapper: (helper: ServiceMessageHelper): Interface => {\n\t\t\treturn {\n\t\t\t\tvalidate: valueMethodTemplate.bind(/* this: */ -1, \"validate\", /* accepts argument: */ true, helper),\n\t\t\t\tdispatch: valueMethodTemplate.bind(/* this: */ -1, \"dispatch\", /* accepts argument: */ true, helper),\n\t\t\t} as Interface\n\t\t},\n\t}\n}\n", "/*\n **********\n *********\n ********\n *******\n ****** \u267B\uFE0F Generated by the Services build process from .d.ts. Do not modify. See the Services README for more information.\n *****\n ****\n ***\n **\n */\n\n// The generated namespace may or may not use some of the runtime exports. For simplicity, we import all of them.\nimport type {\n\tService,\n\tServiceChannel,\n\tServiceMessageHelper,\n\tServiceRuntimePrivate,\n\tServiceValue,\n\tServiceStream,\n\tServiceStreamOptions,\n\tUnsafeJSON,\n\tfloat,\n\tinteger,\n\toneway,\n} from \"../../runtime/index.ts\"\nimport { ServiceManager } from \"../../runtime/index.ts\"\n\n// The generated namespace may or may not use some of the global types. For simplicity, we import all of them.\nimport type {\n\tPoint,\n\tSize,\n\tRect,\n\tUser,\n\tColor,\n\tMenuAction,\n\tMenuValidationResult,\n\tMenuDispatchResult,\n\tMenuActionState,\n\tArea,\n\tContextMenu,\n\tMenuOptionIconCrossOrigin,\n\tMenuOptionIcon,\n\tMenuItemOptions,\n\tContextMenuResult,\n} from \"./Global.ts\"\n\n// Import the service implementation\nimport { MenuActionTargetHelper } from \"./service-runtime/MenuActionTargetHelper.ts\"\n\nimport type { SharedService } from \"./SharedService.ts\"\n\nexport namespace MenuActionTarget {\n\t/**\n\t * MenuActionTarget is not documented.\n\t */\n\texport interface Interface {\n\t\tvalidate(_: MenuAction): Promise<MenuValidationResult>\n\t\tdispatch(_: MenuAction): Promise<MenuDispatchResult>\n\t}\n\n\t/*\n\t * Using the service\n\t */\n\n\texport const service: Service<Interface> = MenuActionTargetHelper.service\n\n\texport function on(channel: ServiceChannel): SharedService<Interface> {\n\t\t// Note: capture the shared service manager here so testing behavior is predictable\n\t\tconst sharedServices = ServiceManager.shared()\n\t\treturn {\n\t\t\texpect: () => sharedServices.expectWithoutDiscovery(service, channel),\n\t\t\tdiscover: options => sharedServices.discover(service, channel, options),\n\t\t\tregister: implementation => sharedServices.register({ channel, service, implementation }),\n\t\t}\n\t}\n\n\texport async function unregister(implementation: Interface): Promise<void> {\n\t\tvoid ServiceManager.shared().unregister(implementation)\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { globals } from \"./ProjectGlobal.styles.ts\"\n\nfunction updateLayoutStyleElement(element: HTMLStyleElement | null) {\n\tengine.stores.layoutState.updateLayoutStyleElement(element)\n}\n\nexport class Layout extends React.PureComponent<{ children?: React.ReactNode }> {\n\toverride componentWillUnmount() {\n\t\tupdateLayoutStyleElement(null)\n\t}\n\n\toverride render() {\n\t\t// data-export=\"false\" is used to indicate to the exporting mechanism to not collect these stylesheets\n\t\t// `globals` are the global styles, but set as className to make sure they are actually used.\n\t\treturn (\n\t\t\t<div className={globals}>\n\t\t\t\t<style ref={updateLayoutStyleElement} data-export=\"false\">\n\t\t\t\t\t{engine.stores.layoutState.cssText()}\n\t\t\t\t</style>\n\t\t\t\t{this.props.children}\n\t\t\t</div>\n\t\t)\n\t}\n}\n", "import { triggerAppLaunchEvent } from \"@framerjs/framer-events\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { Tutorial } from \"tutorial-next\"\nimport { fatalError, recoverFromError } from \"./VekterEngineErrorRecovery.ts\"\nimport { Document as DocumentContainer } from \"./components/Document.tsx\"\nimport { setupServices } from \"./ipc/services.ts\"\n\n// We have two levels of crash handling, one tries to recover, the other so the\n// user doesn't look at blank screen if the recovery fails, or the error\n// persists.\n\n// This is a pure component to make absolutely sure it does not rerender\nexport class Document extends React.PureComponent {\n\toverride render() {\n\t\treturn <ErrorHandlingDocument />\n\t}\n\n\toverride componentDidCatch(error: Error) {\n\t\t// We only process the error here, fatalError() itself will hijack the\n\t\t// browser to display an error message.\n\t\tfatalError(engine, \"Recovery after crash in rendering failed.\", error)\n\t}\n}\n\nclass ErrorHandlingDocument extends React.Component {\n\tprivate async loadDocumentWhenReady() {\n\t\t// Register services\n\t\tawait setupServices(engine)\n\t\t// Take the next step on initialization\n\t\tsetTimeout(() => this.initializeDocument(), 0)\n\t}\n\n\tprivate initializeDocument = engine.scheduler.wrapHandler(() => {\n\t\tconst appStartTime = window[\"__app-start-time\"] as number\n\t\tconst loadingTime = Date.now() - appStartTime\n\t\t// TODO: launch time could be more precise if started outside the web app\n\t\ttriggerAppLaunchEvent({\n\t\t\tloadingTime,\n\t\t\tdevicePixelRatio: window.devicePixelRatio,\n\t\t})\n\n\t\tengine.stores.chromeStore.initializeUserIsViewer()\n\n\t\t// Web will load documents via RemoteDocument.ts\n\t\t// Playwright will load documents via the EditorApp service\n\t}, \"nonUserEvent\")\n\n\toverride componentDidMount() {\n\t\t// FIXME: determine whether this should await instead\n\t\tthis.loadDocumentWhenReady().catch(unhandledError)\n\t}\n\n\toverride render() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<DocumentContainer />\n\t\t\t\t<Tutorial />\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride componentDidCatch(error: Error, info: React.ErrorInfo) {\n\t\trecoverFromError(engine, error, info)\n\t\tthis.forceUpdate()\n\t}\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { getNewProjectURL } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { appTour } from \"web/pages/projects/components/learn/utils/tutorials.ts\"\nimport { Player } from \"./Player.tsx\"\nimport { playerHeight } from \"./PlayerControls.styles.ts\"\nimport type { Step } from \"./Steps.tsx\"\nimport { TUTORIAL_STEP_KEY } from \"./tutorialToastKey.ts\"\n\nexport function Tutorial() {\n\tconst { publishStatus } = engine.stores.publishStore.useState()\n\tconst { isTutorialVisible, isTutorialActive } = engine.stores.chromeStore.useState(state => ({\n\t\tisTutorialVisible: state.mainView === ActiveMainView.Canvas,\n\t\tisTutorialActive: state.isTutorialActive,\n\t}))\n\n\tconst { tutorialId, steps, title, aspect, duplicateFrom, insertPanel } = appTour\n\n\tconst handleTimeChanged = React.useCallback(\n\t\t(_time: number, done?: boolean) => {\n\t\t\tif (!tutorialId) return\n\t\t\t// Timestamps are currently ignored\n\t\t\tif (done) {\n\t\t\t\tengine.stores.chromeStore.isTutorialActive = false\n\t\t\t}\n\t\t},\n\t\t[tutorialId],\n\t)\n\n\tconst handleOpenInNewTab = React.useCallback(() => {\n\t\tconst url = getNewProjectURL({\n\t\t\tduplicateFrom,\n\t\t\ttutorialId,\n\t\t\tinsertPanel,\n\t\t})\n\t\topenNewTab(url)\n\t}, [duplicateFrom, insertPanel, tutorialId])\n\n\tReact.useEffect(() => {\n\t\tconst { layoutState } = engine.stores\n\t\tif (!isTutorialActive) return\n\t\tif (!isTutorialVisible) {\n\t\t\tlayoutState.setTutorialHeight(0)\n\t\t\treturn\n\t\t}\n\t\tlayoutState.setTutorialHeight(playerHeight)\n\t\treturn () => {\n\t\t\tlayoutState.setTutorialHeight(0)\n\t\t}\n\t}, [isTutorialActive, isTutorialVisible])\n\n\tconst handleCompleteStep = (step: Step) => {\n\t\t// If this step is the publish step, but we have already published, don't show the toast\n\t\tif (step.isPublishStep && publishStatus !== PublishStatus.Unpublished) {\n\t\t\treturn\n\t\t}\n\t\tif (step.completionToast) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"info\",\n\t\t\t\ttext: step.completionToast,\n\t\t\t\tkey: TUTORIAL_STEP_KEY,\n\t\t\t\tduration: Infinity,\n\t\t\t\tshowCloseButton: \"never\",\n\t\t\t\taction: {\n\t\t\t\t\ttitle: \"Okay\",\n\t\t\t\t\tonClick: () => {},\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t}\n\n\tconst handlePlay = () => {\n\t\tif (!engine.stores.chromeStore.hasTutorialPlayed) {\n\t\t\t// Temporarily hide the generate page button, to show it again after\n\t\t\t// the tutorial open animation has finished.\n\t\t\tengine.stores.chromeStore.hideGeneratePageButton = true\n\t\t}\n\t\ttoast({\n\t\t\ttype: \"remove\",\n\t\t\tkey: TUTORIAL_STEP_KEY,\n\t\t})\n\t}\n\n\tconst handleDidShow = () => {\n\t\tengine.stores.chromeStore.hideGeneratePageButton = false\n\t}\n\n\tif (!isTutorialActive) return null\n\n\t// hiding tutorial because unmounting will require youtube player initialization\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tvisibility: !isTutorialVisible ? \"hidden\" : \"initial\",\n\t\t\t\tpointerEvents: !isTutorialVisible ? \"none\" : \"auto\",\n\t\t\t}}\n\t\t>\n\t\t\t<Player\n\t\t\t\tyoutubeVideoId={tutorialId}\n\t\t\t\tonTimeChanged={handleTimeChanged}\n\t\t\t\tsteps={addStepZeroIfNeeded(steps)}\n\t\t\t\ttitle={title}\n\t\t\t\taspect={aspect}\n\t\t\t\tonOpenInNewTab={handleOpenInNewTab}\n\t\t\t\tonCompleteStep={handleCompleteStep}\n\t\t\t\tonPlay={handlePlay}\n\t\t\t\tonDidShow={handleDidShow}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nfunction addStepZeroIfNeeded(steps: Step[]): Step[] {\n\tconst sortedSteps = [...steps].sort((a, b) => a.time - b.time)\n\tif (sortedSteps[0]?.time === 0) {\n\t\treturn sortedSteps\n\t}\n\n\treturn [{ time: 0, completionToast: \"\" }, ...sortedSteps]\n}\n", "import { getNewProjectURL } from \"@framerjs/shared\"\nimport type { Step } from \"tutorial-next/Steps.tsx\"\nimport sitesGettingStartedImage from \"../assets/sites-getting-started.jpg\"\nimport sitesGettingStartedVideo from \"../assets/sites-getting-started.mp4\"\ninterface Tutorial {\n\t/**\n\t * The ID of the youtube video.\n\t */\n\ttutorialId: string\n\ttitle: string\n\tduration: string\n\tsuccessMessage: string\n\timgUrl: string\n\tvideoUrl: string\n\tsteps: Step[]\n\ttutorialType: \"mobile\" | \"desktop\"\n\t/**\n\t * Optional ID of the framer project that will be duplicated.\n\t */\n\tduplicateFrom?: string\n\t/**\n\t * Optional option to open the tutorial with the insert menu open.\n\t */\n\tinsertPanel?: boolean\n\t/**\n\t * Optional series title and subtitle keys if in a series.\n\t */\n\tseriesTitle?: string\n\tseriesSubtitle?: string\n\t/**\n\t * Aspect ratio for video, ex 16:9 would be 1.779.\n\t */\n\taspect?: number\n}\n\nconst htmlAndAIAppTour: Tutorial = {\n\ttutorialId: \"Kfe831LNdxI\",\n\tduplicateFrom: \"starter-template-empty-site\",\n\ttitle: \"App Tour\",\n\tduration: \"6:19\",\n\taspect: 1.77777777777,\n\tinsertPanel: true,\n\timgUrl: sitesGettingStartedImage,\n\tvideoUrl: sitesGettingStartedVideo,\n\tsuccessMessage: \"You finished our App Tour!\",\n\tsteps: [\n\t\t{ time: 41, completionToast: \"Press the play button\" },\n\t\t{ time: 171, completionToast: \"Install the extension and copy paste elements from a site\" },\n\t\t{ time: 239, completionToast: \"Add pages and sections from the insert panel\" },\n\t],\n\ttutorialType: \"mobile\",\n}\n\nexport const appTour: Tutorial = {\n\ttutorialId: \"x-fUdqZzMVw\",\n\tduplicateFrom: \"starter-template-empty-site\",\n\ttitle: \"App Tour\",\n\tduration: \"4:00\",\n\taspect: 1.77777777777,\n\tinsertPanel: true,\n\timgUrl: sitesGettingStartedImage,\n\tvideoUrl: sitesGettingStartedVideo,\n\tsuccessMessage: \"You finished our App Tour!\",\n\tsteps: [\n\t\t{ time: 34, completionToast: \"Press the play button\" },\n\t\t{ time: 163, completionToast: \"Install the extension and copy paste elements from a site\" },\n\t],\n\ttutorialType: \"mobile\",\n}\n\nexport function openTutorial(options: {\n\ttutorialId: string\n\tduplicateFrom?: string\n\tinsertPanel?: boolean\n\tspaceId: string\n}) {\n\tconst url = new URL(getNewProjectURL(options), window.location.origin)\n\twindow.location.href = url.href\n}\n", "import { triggerTutorialVideoStartedEvent, triggerTutorialVideoStepEvent } from \"@framerjs/framer-events\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { type Variants, motion } from \"framer-motion\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport * as styles from \"./Player.styles.ts\"\nimport { controlsHeight } from \"./PlayerControls.styles.ts\"\nimport { PlayerControls } from \"./PlayerControls.tsx\"\nimport type { Step } from \"./Steps.tsx\"\nimport { findJustFinishedStepIndex, getCurrentStep, getReplayStepIndex } from \"./Steps.tsx\"\nimport { YouTube } from \"./YouTube.tsx\"\n\nconst log = getLogger(\"tutorial:player\")\n\nexport function Player({\n\tyoutubeVideoId,\n\tsteps = [],\n\tinitialTime = 0,\n\tshowMenu = false,\n\ttitle,\n\taspect = 1.779,\n\tonShowMoreVideos = () => {},\n\tonTimeChanged: notifyTimeChanged = () => {},\n\tonOpenInNewTab,\n\tonCompleteStep,\n\tonPlay,\n\tonDidShow,\n}: {\n\tyoutubeVideoId: string\n\tsteps?: Step[]\n\ttitle: string\n\t/**\n\t * The time at which the player will start playing.\n\t */\n\tinitialTime?: number\n\tshowMenu?: boolean\n\taspect?: number\n\tonTimeChanged?: (second: number, done?: boolean) => void\n\tonShowMoreVideos?: () => void\n\tonOpenInNewTab: () => void\n\tonCompleteStep?: (step: Step) => void\n\tonPlay: () => void\n\tonDidShow?: () => void\n}) {\n\tconst [started, setStarted] = React.useState(false)\n\tconst [playing, setPlaying] = React.useState(false)\n\tconst [minimized, setMinimized] = React.useState(!playing)\n\tconst [lastStopTime, setLastStopTime] = React.useState(initialTime)\n\tconst [startTime, setStartTime] = React.useState<number>()\n\tconst [currentTime, setCurrentTime] = React.useState(initialTime)\n\tconst seekTo = React.useRef<(time: number) => void>()\n\tconst { index: currentStepIndex } = getCurrentStep(currentTime, steps)\n\n\t// Temporarily remove auto-play until we can fix the \"blurry\" video issue\n\t// React.useEffect(() => {\n\t//     if (playing) return\n\t//     const startPlaying = setTimeout(() => setPlaying(true), 100)\n\t//     return () => {\n\t//         clearTimeout(startPlaying)\n\t//     }\n\t//     // Only do this when we're opening the tutorial for the first time, so it's not a jarring experience\n\t//     // eslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, [])\n\n\tconst handleClose = React.useCallback(() => {\n\t\tconst url = new URL(window.parent.location.href)\n\t\turl.searchParams.delete(\"tutorial\")\n\t\turl.searchParams.delete(\"steps\")\n\t\turl.searchParams.delete(\"title\")\n\t\turl.searchParams.delete(\"successMessage\")\n\t\tconst newUrl = url.toString()\n\t\twindow.location.href = newUrl\n\t}, [])\n\n\tconst handleMinimizePlayer = React.useCallback(() => {\n\t\tsetMinimized(true)\n\t\tsetPlaying(false)\n\t}, [setMinimized, setPlaying])\n\n\tconst handleMaximizePlayer = React.useCallback(() => {\n\t\tsetMinimized(false)\n\t\tsetPlaying(true)\n\t\tonPlay()\n\t}, [setMinimized, setPlaying, onPlay])\n\n\tconst handleReplayStep = () => {\n\t\tif (!started) {\n\t\t\tonPlayerStart(currentTime)\n\t\t\treturn\n\t\t}\n\t\tconst replayStepIndex = getReplayStepIndex(currentTime, steps)\n\t\tconst seekTime = steps[replayStepIndex]?.time || 0\n\t\tsetMinimized(false)\n\t\tsetPlaying(true)\n\t\tsetStarted(true)\n\t\tsetLastStopTime(seekTime)\n\t\tsetStartTime(undefined)\n\t\tseekTo.current?.(seekTime)\n\t}\n\n\tconst handleStepClick = React.useCallback(\n\t\t(stepIndex: number) => {\n\t\t\tconst seekTime = steps[stepIndex]?.time || 0\n\n\t\t\tsetStartTime(seekTime)\n\t\t\tsetStarted(true)\n\t\t\tsetPlaying(true)\n\t\t\tsetMinimized(false)\n\t\t\tsetLastStopTime(seekTime)\n\n\t\t\tif (started) {\n\t\t\t\tseekTo.current?.(seekTime)\n\t\t\t}\n\t\t},\n\t\t[setMinimized, setPlaying, setStarted, setLastStopTime, setStartTime, steps, started],\n\t)\n\n\tfunction onStepComplete(second: number) {\n\t\tconst { index, step } = getCurrentStep(second, steps)\n\t\tnotifyTimeChanged(second, index >= steps.length)\n\n\t\tif (index !== 0) {\n\t\t\ttriggerTutorialVideoStepEvent({ youtube: youtubeVideoId, step: index, total: steps.length })\n\t\t}\n\n\t\t// Don't stop for a step if we just started\n\t\tif (Math.abs(second - lastStopTime) < 2) {\n\t\t\tlog.info(\"Play started less then 2s ago, not stopping for step\")\n\t\t\treturn\n\t\t}\n\t\tsetPlaying(false)\n\t\tsetMinimized(true)\n\t\tonCompleteStep?.(step)\n\t}\n\n\tfunction onPlayerStart(newTime: number) {\n\t\tnotifyTimeChanged(newTime)\n\t\tif (!started) {\n\t\t\ttriggerTutorialVideoStartedEvent({ youtube: youtubeVideoId })\n\t\t}\n\t\tsetStartTime(undefined)\n\t\tsetStarted(true)\n\t\tsetPlaying(true)\n\t\tsetMinimized(false)\n\t\tsetLastStopTime(newTime)\n\t}\n\n\tfunction onPlayerPause(newTime: number) {\n\t\tnotifyTimeChanged(newTime)\n\t\tsetPlaying(false)\n\t\tsetLastStopTime(newTime)\n\t}\n\n\tfunction onPlayerEnd(newTime: number) {\n\t\tnotifyTimeChanged(newTime, true)\n\t\tsetPlaying(false)\n\t\tsetStarted(false)\n\t\tsetMinimized(true)\n\t\tonShowMoreVideos()\n\t\tsetStartTime(0)\n\t}\n\n\tconst stepHandlers = {\n\t\t0: onStepComplete,\n\t}\n\n\tfor (const step of steps) {\n\t\tstepHandlers[step.time] = onStepComplete\n\t}\n\n\tfunction onPlayerSecond(newTime: number) {\n\t\tconst stepTime = steps[findJustFinishedStepIndex(newTime, steps) || -1]?.time\n\t\tif (isNumber(stepTime)) {\n\t\t\tconst stepHandler = stepHandlers[stepTime]\n\t\t\tif (stepHandler) {\n\t\t\t\tstepHandler(stepTime)\n\t\t\t}\n\t\t}\n\t\tsetCurrentTime(newTime)\n\t}\n\n\tconst backgroundVariants: Variants = {\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\tdisplay: \"flex\",\n\t\t\ttransition: { type: \"tween\", duration: 0.1 },\n\t\t},\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\ttransition: { type: \"tween\", duration: 0.2, delay: 0.2 },\n\t\t\ttransitionEnd: {\n\t\t\t\tdisplay: \"none\",\n\t\t\t},\n\t\t},\n\t}\n\n\tconst playerYVariants: Variants = {\n\t\tvisible: {\n\t\t\ty: 0,\n\t\t\ttransition: { type: \"tween\", duration: 0.3, delay: 0.1 },\n\t\t},\n\t\thidden: {\n\t\t\ty: \"100vh\",\n\t\t\ttransition: { type: \"tween\", duration: 0.3, delay: 0.1 },\n\t\t},\n\t}\n\n\tconst playerVariants: Variants = {\n\t\tvisible: {\n\t\t\tscale: 1,\n\t\t\ttransition: { type: \"tween\", duration: 0.3, delay: 0.15 },\n\t\t},\n\t\thidden: {\n\t\t\tscale: 0,\n\t\t\ttransition: { type: \"tween\", duration: 0.3 },\n\t\t},\n\t}\n\n\tconst aspectStyles = React.useMemo(\n\t\t() => ({\n\t\t\twidth: `calc((100vh - (${dimensions.css.panelPadding} * 4) - ${controlsHeight * 2}px - 40px) * ${aspect})`,\n\t\t\tmaxHeight: `calc(90vw /${aspect})`,\n\t\t}),\n\t\t[aspect],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<motion.div\n\t\t\t\tclassName={styles.playerModalBackdrop}\n\t\t\t\tstyle={minimized ? { pointerEvents: \"none\" } : {}}\n\t\t\t\tonClick={handleMinimizePlayer}\n\t\t\t\tvariants={backgroundVariants}\n\t\t\t\tinitial=\"hidden\"\n\t\t\t\tanimate={minimized ? \"hidden\" : \"visible\"}\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={playerYVariants}\n\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\tanimate={minimized ? \"hidden\" : \"visible\"}\n\t\t\t\t\tonAnimationComplete={definition => {\n\t\t\t\t\t\tif (definition === \"visible\") onDidShow?.()\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={styles.playerModal}\n\t\t\t\t\t\tvariants={playerVariants}\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\tanimate={minimized ? \"hidden\" : \"visible\"}\n\t\t\t\t\t\tstyle={aspectStyles}\n\t\t\t\t\t>\n\t\t\t\t\t\t<YouTube\n\t\t\t\t\t\t\tid={youtubeVideoId}\n\t\t\t\t\t\t\tplay={playing}\n\t\t\t\t\t\t\tplayStartTime={startTime}\n\t\t\t\t\t\t\tonPlayerSecond={onPlayerSecond}\n\t\t\t\t\t\t\tseekTo={seekTo}\n\t\t\t\t\t\t\t{...{ onPlayerStart, onPlayerPause, onPlayerEnd }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\n\t\t\t<PlayerControls\n\t\t\t\tshowMenu={showMenu}\n\t\t\t\tshowReplay={started}\n\t\t\t\tminimized={minimized}\n\t\t\t\tonPlay={handleMaximizePlayer}\n\t\t\t\tonClose={handleClose}\n\t\t\t\tonPause={handleMinimizePlayer}\n\t\t\t\tonReplayStep={handleReplayStep}\n\t\t\t\tonShowVideos={onShowMoreVideos}\n\t\t\t\tonStepClick={handleStepClick}\n\t\t\t\tonOpenInNewTab={onOpenInNewTab}\n\t\t\t\ttotalSteps={steps.length}\n\t\t\t\tcurrentStep={currentStepIndex}\n\t\t\t\tisPlaying={playing}\n\t\t\t\ttitle={title}\n\t\t\t\tplayStarted={started || currentStepIndex > 0}\n\t\t\t/>\n\t\t</>\n\t)\n}\n", "import \"Player.styles_p1m4zv.wyw.css\"; export const pulse = \"pulse_ptq6o9j\";\nexport const playerModal = \"playerModal_pe39n1n\";\nexport const playerModalBackdrop = \"playerModalBackdrop_p2hn52g\";", "import \"PlayerControls.styles_1p5cxhi.wyw.css\"; export const controlsHeight = 30;\nexport const playerHeight = controlsHeight * 2;\nexport const playerControlsContainer = \"playerControlsContainer_puqt5a8\";\nexport const playerTitle = \"playerTitle_p5vqt3f\";\nexport const buttonWrapper = \"buttonWrapper_bnzb7mc\";\nexport const tooltip = \"tooltip_t9tg8rp\";\nexport const toolTipHeader = \"toolTipHeader_t90xxs\";\nexport const tooltipTitle = \"tooltipTitle_t11hj2me\";\nexport const tooltipDescription = \"tooltipDescription_t1ll58vw\";\nexport const playButton = \"playButton_p1nfzjin\";\nexport const stepButton = \"stepButton_s2qj5g8\";\nexport const menuButton = \"menuButton_maqoffv\";\nexport const replayButton = \"replayButton_r1jcaoqo\";\nexport const playerSteps = \"playerSteps_p1802zd8\";\nexport const centerPanel = \"centerPanel_cse2hkg\";\nexport const leftPanel = \"leftPanel_lzosd5j\";", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { ContextMenuButton, Stack, Text, TooltipComponent, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { colors } from \"../../../fresco/src/tokens/colors/index.ts\"\nimport { pulse } from \"./Player.styles.ts\"\nimport * as styles from \"./PlayerControls.styles.ts\"\n\nexport function PlayerControls({\n\tminimized,\n\tplayStarted,\n\tisPlaying,\n\tonPlay,\n\tonPause,\n\tonReplayStep,\n\tonShowVideos,\n\tonStepClick,\n\tonOpenInNewTab,\n\tshowMenu,\n\tcurrentStep,\n\ttotalSteps,\n\ttitle,\n}: {\n\tminimized: boolean\n\tplayStarted: boolean\n\tisPlaying: boolean\n\tonShowVideos: () => void\n\tonPlay: () => void\n\tonClose: () => void\n\tonPause: () => void\n\tonReplayStep: () => void\n\tonStepClick: (stepIndex: number) => void\n\tonOpenInNewTab: () => void\n\tshowMenu: boolean\n\tshowReplay: boolean\n\tcurrentStep: number\n\ttotalSteps: number\n\ttitle: string\n}) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst [hasPlayed, setHasPlayed] = React.useState(false)\n\tconst transition = { duration: 0.1 }\n\n\tconst pressPlay = () => {\n\t\tonPlay()\n\t\tif (!hasPlayed) {\n\t\t\tengine.stores.chromeStore.hasTutorialPlayed = true\n\t\t\tsetHasPlayed(true)\n\t\t}\n\t}\n\n\tconst handleContextMenu = React.useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tconst template: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Open in New Project\",\n\t\t\t\t\tclick: onOpenInNewTab,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Open Video Tutorials\",\n\t\t\t\t\tclick: () => openNewTab(\"https://www.framer.com/learn/#videos\"),\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Exit tutorial\",\n\t\t\t\t\tclick: () => (engine.stores.chromeStore.isTutorialActive = false),\n\t\t\t\t},\n\t\t\t]\n\t\t\tconst { top: buttonTop, right: buttonRight } = event.currentTarget.getBoundingClientRect()\n\n\t\t\tengine.stores.contextMenuStore.show(template, {\n\t\t\t\tlocation: { x: buttonRight, y: buttonTop - 20 },\n\t\t\t\tplacement: \"top-end\",\n\t\t\t})\n\t\t},\n\t\t[onOpenInNewTab],\n\t)\n\n\treturn (\n\t\t<motion.div className={styles.playerControlsContainer}>\n\t\t\t<div className={styles.leftPanel}>\n\t\t\t\t<motion.div\n\t\t\t\t\tstyle={{ display: showMenu ? undefined : \"none\" }}\n\t\t\t\t\tonClick={onShowVideos}\n\t\t\t\t\tclassName={styles.menuButton}\n\t\t\t\t\ttransition={transition}\n\t\t\t\t>\n\t\t\t\t\t<HamburgerIcon />\n\t\t\t\t</motion.div>\n\t\t\t\t<div className={styles.playerTitle}>{title}</div>\n\t\t\t</div>\n\n\t\t\t<div className={styles.centerPanel}>\n\t\t\t\t<div className={styles.buttonWrapper}>\n\t\t\t\t\t<PlayOrPauseButton\n\t\t\t\t\t\tonPlay={pressPlay}\n\t\t\t\t\t\tisPlaying={isPlaying}\n\t\t\t\t\t\tonPause={onPause}\n\t\t\t\t\t\tminimized={minimized}\n\t\t\t\t\t\tplayStarted={playStarted}\n\t\t\t\t\t/>\n\t\t\t\t\t{!hasPlayed && (\n\t\t\t\t\t\t<TooltipComponent\n\t\t\t\t\t\t\tclassName={styles.tooltip}\n\t\t\t\t\t\t\ttint={colors.modalBackground}\n\t\t\t\t\t\t\tdirection=\"bottom\"\n\t\t\t\t\t\t\thideArrow={isAgentExperimentOn}\n\t\t\t\t\t\t\ttooltip={\n\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={15}>\n\t\t\t\t\t\t\t\t\t<div className={styles.toolTipHeader}>\n\t\t\t\t\t\t\t\t\t\t<Text className={styles.tooltipTitle}>Get Started</Text>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<Text className={styles.tooltipDescription}>\n\t\t\t\t\t\t\t\t\t\tStart the interactive app tour by clicking the play button.\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</Stack>\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</div>\n\t\t\t</div>\n\n\t\t\t<Stack gap={10} direction=\"row\" justifyContent=\"flex-end\">\n\t\t\t\t<motion.div className={styles.playerSteps}>\n\t\t\t\t\t{Array(totalSteps)\n\t\t\t\t\t\t.fill(undefined)\n\t\t\t\t\t\t.map((_, index) => {\n\t\t\t\t\t\t\treturn <Step key={index} index={index} onStepClick={onStepClick} filled={index <= currentStep} />\n\t\t\t\t\t\t})}\n\t\t\t\t</motion.div>\n\t\t\t\t<ContextMenuButton onMouseDown={handleContextMenu} className={cx(styles.replayButton)} />\n\t\t\t\t<button type=\"button\" className={cx(truncateWithEllipsis, styles.replayButton)} onClick={onReplayStep}>\n\t\t\t\t\tReplay Step\n\t\t\t\t</button>\n\t\t\t</Stack>\n\t\t</motion.div>\n\t)\n}\n\nfunction Step({\n\tfilled,\n\tindex,\n\tonStepClick,\n}: {\n\tfilled: boolean\n\tindex: number\n\tonStepClick: (index: number) => void\n}) {\n\tconst handleClick = React.useCallback(() => {\n\t\tonStepClick(index)\n\t}, [index, onStepClick])\n\treturn (\n\t\t<motion.div\n\t\t\trole=\"button\"\n\t\t\ttabIndex={0}\n\t\t\tonClick={handleClick}\n\t\t\tclassName={styles.stepButton}\n\t\t\tstyle={filled ? { background: \"#fff\" } : {}}\n\t\t\twhileHover={{ scale: 2 }}\n\t\t\twhileTap={{ scale: 1.75 }}\n\t\t/>\n\t)\n}\n\nfunction PauseIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\">\n\t\t\t<path\n\t\t\t\td=\"M 1 3 C 1 1.895 1.895 1 3 1 L 7 1 C 8.105 1 9 1.895 9 3 L 9 21 C 9 22.105 8.105 23 7 23 L 3 23 C 1.895 23 1 22.105 1 21 Z M 15 3 C 15 1.895 15.895 1 17 1 L 21 1 C 22.105 1 23 1.895 23 3 L 23 21 C 23 22.105 22.105 23 21 23 L 17 23 C 15.895 23 15 22.105 15 21 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction PlayIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\">\n\t\t\t<path\n\t\t\t\td=\"M 7.301 1.453 C 6.302 0.822 5 1.54 5 2.721 L 5 21.279 C 5 22.46 6.302 23.178 7.301 22.547 L 21.992 13.268 C 22.924 12.68 22.924 11.32 21.992 10.732 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction HamburgerIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 3 0 C 4.657 0 6 1.343 6 3 C 6 4.657 4.657 6 3 6 C 1.343 6 0 4.657 0 3 C 0 1.343 1.343 0 3 0 Z M 11 0 C 12.657 0 14 1.343 14 3 C 14 4.657 12.657 6 11 6 C 9.343 6 8 4.657 8 3 C 8 1.343 9.343 0 11 0 Z M 11 8 C 12.657 8 14 9.343 14 11 C 14 12.657 12.657 14 11 14 C 9.343 14 8 12.657 8 11 C 8 9.343 9.343 8 11 8 Z M 3 8 C 4.657 8 6 9.343 6 11 C 6 12.657 4.657 14 3 14 C 1.343 14 0 12.657 0 11 C 0 9.343 1.343 8 3 8 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction MinimizeIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\">\n\t\t\t<path\n\t\t\t\td=\"M 1.5 15 L 9 15 L 9 22.5 M 22.5 9 L 15 9 L 15 1.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"3\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction PlayOrPauseButton({\n\tonPlay,\n\tonPause,\n\tplayStarted,\n\tminimized,\n\tisPlaying,\n}: {\n\tonPlay: () => void\n\tonPause: () => void\n\tplayStarted: boolean\n\tminimized: boolean\n\tisPlaying: boolean\n}) {\n\tif (!minimized) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tkey=\"pause-button\"\n\t\t\t\tclassName={playStarted ? styles.playButton : cx(styles.playButton, pulse)}\n\t\t\t\tonClick={onPause}\n\t\t\t>\n\t\t\t\t{isPlaying ? <PauseIcon /> : <MinimizeIcon />}\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div key=\"play-button\" className={playStarted ? styles.playButton : cx(styles.playButton, pulse)} onClick={onPlay}>\n\t\t\t<PlayIcon />\n\t\t</div>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\n\nexport interface Step {\n\ttime: number\n\tlabel?: string\n\tcompletionToast: string\n\t// This value only makes sense if true, otherwise it's undefined\n\tisPublishStep?: true\n}\n\nexport function getCurrentStep(time: number, steps: Step[]): { step: Step; index: number } {\n\tsteps = [...steps].sort((a, b) => a.time - b.time)\n\n\tlet index\n\tlet step\n\n\tfor (index = 0; index < steps.length; index++) {\n\t\tstep = steps[index]\n\t\tassert(step, \"Step must be defined\")\n\t\tconst nextStep = steps[index + 1]?.time || Infinity\n\t\tif (step.time <= time && time < nextStep) {\n\t\t\treturn { index, step }\n\t\t}\n\t}\n\n\tassert(step, \"No steps provided\")\n\n\treturn { index, step }\n}\n\nexport function getReplayStepIndex(time: number, steps: Step[]) {\n\tconst { index } = getCurrentStep(time, steps)\n\n\tconst step = steps[index]\n\tif (!step) return index\n\n\tconst atBegginingOfStep = Math.abs(step.time - time) <= 1\n\tif (atBegginingOfStep) {\n\t\treturn Math.max(index - 1, 0)\n\t}\n\treturn index\n}\n\nexport function findJustFinishedStepIndex(time: number, steps: Step[]) {\n\tconst { step, index } = getCurrentStep(time, steps)\n\tif (!step) return undefined\n\n\tconst stepTime = step.time\n\tif (time - stepTime <= 0.15) {\n\t\treturn index\n\t}\n\treturn undefined\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport React from \"react\"\n\n// Hacky type import to work around \"\u2026index.d.ts is not a module\"\n// eslint-disable-next-line spaced-comment\n/// <reference types=\"@types/youtube\" />\n\nconst log = getLogger(\"tutorial:youtube\")\n\nconst _waiting: YouTube[] = []\nlet _loaded = false\n\nfunction round(value: number, decimals = 1) {\n\treturn Math.round(value * (10 * decimals)) / (10 * decimals)\n}\n\nfunction onYouTubeIframeAPIReady() {\n\tlog.debug(\"onYouTubeIframeAPIReady\")\n\t_waiting.map(y => y.init())\n\t_waiting.splice(0, _waiting.length)\n}\n\nfunction loadScript() {\n\tif (_loaded) return\n\tconst tag = document.createElement(\"script\")\n\ttag.src = \"https://www.youtube.com/iframe_api\"\n\n\tconst firstScriptTag = document.getElementsByTagName(\"script\")[0]\n\tif (firstScriptTag) {\n\t\tif (firstScriptTag.parentNode) {\n\t\t\tfirstScriptTag.parentNode.insertBefore(tag, firstScriptTag)\n\t\t} else {\n\t\t\tdocument.head.appendChild(firstScriptTag)\n\t\t}\n\t}\n\n\twindow[\"onYouTubeIframeAPIReady\"] = onYouTubeIframeAPIReady\n\t_loaded = true\n}\n\ninterface YouTubeProps {\n\tid: string\n\tplay?: boolean\n\tplayStartTime?: number\n\tonPlayerReady?: () => void\n\tonPlayerStart?: (time: number) => void\n\tonPlayerPause?: (time: number) => void\n\tonPlayerEnd?: (time: number) => void\n\tonPlayerTick?: (second: number) => void\n\tonPlayerSecond?: (second: number) => void\n\tseekTo: React.MutableRefObject<undefined | ((time: number) => void)>\n}\n\nexport class YouTube extends React.Component<YouTubeProps, {}> {\n\tplayer?: YT.Player\n\tplaying = false\n\tplayTimer: number | null = null\n\tplaySecond = -1\n\tplayState: YT.PlayerState = -1\n\n\tinit = () => {\n\t\tlog.debug(this, \"init\")\n\t\tconst { id, play } = this.props\n\t\tthis.player = new YT.Player(id, {\n\t\t\theight: \"100%\",\n\t\t\twidth: \"100%\",\n\t\t\tvideoId: id,\n\t\t\tplayerVars: {\n\t\t\t\trel: 0,\n\t\t\t\tshowinfo: 0,\n\t\t\t\tecver: 2,\n\t\t\t\tmodestbranding: 1,\n\t\t\t\tautoplay: play ? 1 : 0,\n\t\t\t\tdisablekb: 1,\n\t\t\t\tfs: 0,\n\t\t\t} as YT.PlayerVars,\n\t\t\tevents: {\n\t\t\t\tonReady: this.onPlayerReady,\n\t\t\t\tonStateChange: this.onPlayerStateChange,\n\t\t\t},\n\t\t})\n\t}\n\n\tsetPlayerState = () => {\n\t\tconst { play, playStartTime } = this.props\n\n\t\t// We have to wait for the youtube player to load\n\t\tif (!this.player?.playVideo) {\n\t\t\tsetTimeout(this.setPlayerState, 200)\n\t\t\treturn\n\t\t}\n\n\t\tlog.debug(\"setPlayerState.play\", this.props.play, this.props.playStartTime)\n\n\t\tconst playerState = this.player.getPlayerState?.()\n\n\t\tif (play && playerState === YT.PlayerState.PLAYING) return\n\t\tif (!play && playerState === YT.PlayerState.PAUSED) return\n\n\t\tif (play) {\n\t\t\tif (playStartTime !== undefined) {\n\t\t\t\tthis.player.seekTo(playStartTime, true)\n\t\t\t}\n\t\t\tthis.player.playVideo()\n\t\t} else {\n\t\t\tthis.player.pauseVideo()\n\t\t}\n\t\tplay ? this.player.playVideo() : this.player.pauseVideo()\n\t}\n\n\tonPlayerReady = () => {\n\t\tlog.debug(\"onPlayerReady\")\n\t\tthis.setPlayerState()\n\t\tthis.props.seekTo.current = (time: number) => this.player?.seekTo(time, true)\n\t}\n\n\tonPlayerStateChange = (event: { data: YT.PlayerState }) => {\n\t\tlog.debug(\"onPlayerStateChange\", event.data)\n\t\tif (event.data === YT.PlayerState.BUFFERING) {\n\t\t\treturn\n\t\t}\n\t\tconst oldPlaying = this.playing\n\n\t\tthis.playState = event.data\n\t\tthis.playing = this.playState === YT.PlayerState.PLAYING\n\n\t\tif (this.playing !== oldPlaying) {\n\t\t\tthis.playing ? this.onPlayerStart() : this.onPlayerPause()\n\t\t\tif (this.playState === YT.PlayerState.ENDED) {\n\t\t\t\tthis.onPlayerEnd()\n\t\t\t}\n\t\t}\n\t}\n\n\tonPlayerStart = () => {\n\t\tlog.debug(\"start\")\n\t\tif (this.playTimer) {\n\t\t\tclearInterval(this.playTimer)\n\t\t}\n\t\tthis.playTimer = window.setInterval(this.onPlayerTick, 100)\n\t\tif (this.player) {\n\t\t\tthis.props.onPlayerStart?.(this.player.getCurrentTime())\n\t\t}\n\t}\n\n\tonPlayerPause = () => {\n\t\tlog.debug(\"onPlayerPause\")\n\t\tif (this.playTimer) {\n\t\t\tclearInterval(this.playTimer)\n\t\t}\n\t\tif (this.player) {\n\t\t\tthis.props.onPlayerPause?.(this.player.getCurrentTime())\n\t\t}\n\t}\n\n\tonPlayerEnd = () => {\n\t\tlog.debug(\"onPlayerEnd\")\n\t\tif (this.playTimer) {\n\t\t\tclearInterval(this.playTimer)\n\t\t}\n\t\tif (this.player) {\n\t\t\tthis.props.onPlayerEnd?.(this.player.getCurrentTime())\n\t\t}\n\t}\n\n\tonPlayerTick = () => {\n\t\tif (!this.player) return\n\t\tconst second = round(this.player.getCurrentTime())\n\t\tif (second !== this.playSecond) {\n\t\t\tthis.props.onPlayerTick?.(second)\n\t\t\tthis.props.onPlayerSecond?.(second)\n\t\t\tthis.playSecond = second\n\t\t}\n\t}\n\n\toverride componentDidMount() {\n\t\tif (_loaded) {\n\t\t\tthis.init()\n\t\t\treturn\n\t\t}\n\t\tloadScript()\n\t\t_waiting.push(this)\n\t}\n\n\toverride render() {\n\t\tthis.setPlayerState()\n\n\t\treturn <div id={this.props.id}></div>\n\t}\n}\n", "export const TUTORIAL_STEP_KEY = \"tutorial-task\"\n", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngineUpdateState } from \"document/VekterEngine.ts\"\nimport { ActionResponder } from \"document/components/actions/ActionResponder.tsx\"\nimport engine from \"document/engine.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport React from \"react\"\nimport { flushSync } from \"react-dom\"\nimport { InjectStylePresets } from \"renderer/InjectStylePresets.tsx\"\nimport { performanceMark } from \"utils/userTiming.ts\"\nimport { documentActionTarget } from \"./DocumentActionTarget.tsx\"\nimport { Canvas } from \"./canvas/Canvas.tsx\"\nimport { Chrome } from \"./chrome/Chrome.tsx\"\nimport { CodeEditorContainer } from \"./chrome/codePanel/CodeEditorContainer.tsx\"\n\nexport class Document extends React.Component<{}, VekterEngineUpdateState> {\n\t// The state is updated in VekterEngine.triggerReactUpdate()\n\toverride state = { update: engine.scheduler.update }\n\tupdate = engine.scheduler.update\n\n\tsetStateSync(state: VekterEngineUpdateState) {\n\t\tflushSync(() => {\n\t\t\tthis.setState(state)\n\t\t})\n\t}\n\n\toverride UNSAFE_componentWillMount(): void {\n\t\tengine.reactComponent = this\n\n\t\tthis.update = engine.scheduler.update\n\t\tthis.setState({ update: engine.scheduler.update })\n\n\t\tperformanceMark(\"frame\")\n\n\t\t// Note, we mount this inner Document component both when starting up, and when recovering errors.\n\t\tengine.scheduler.needToolProcessing = false\n\t\tengine.scheduler.inRendering = true\n\t\tengine.scheduler.needRendering = true\n\t\tengine.scheduler.needReport = true\n\n\t\tengine.assertReactRendering()\n\t\tengine.beginRendering()\n\t}\n\n\toverride shouldComponentUpdate(\n\t\t_nextProps: Readonly<{}>,\n\t\tnextState: Readonly<VekterEngineUpdateState>,\n\t\t_nextContext: any,\n\t): boolean {\n\t\tif (engine.scheduler.eventHandlingError) {\n\t\t\tthrow engine.scheduler.eventHandlingError\n\t\t}\n\t\tif (nextState.update === this.update) {\n\t\t\treturn false\n\t\t}\n\t\tthis.update = nextState.update\n\t\tassert(this.update === engine.scheduler.update, \"engine must drive document.state correctly\")\n\t\tengine.assertReactRendering()\n\t\tengine.beginRendering()\n\t\treturn true\n\t}\n\n\toverride render() {\n\t\tassert(this.update === engine.scheduler.update, \"engine must drive document.state correctly\")\n\t\tengine.assertReactRendering()\n\n\t\treturn (\n\t\t\t<div onContextMenu={this.onContextMenu}>\n\t\t\t\t<InjectStylePresets\n\t\t\t\t\tcomponentLoader={engine.componentLoader}\n\t\t\t\t\tpresetsListNode={PresetsListNode.get(engine.tree)}\n\t\t\t\t\tfontPreviewByNodeId={engine.stores.fontPreviewStore.fontPreviewByNodeId}\n\t\t\t\t/>\n\n\t\t\t\t<ActionResponder engine={engine} target={documentActionTarget} global>\n\t\t\t\t\t<Canvas key={engine.documentReloadKey} />\n\t\t\t\t\t{/* We do +100 here, so that as documentReloadKey increments, keys are not reused. */}\n\t\t\t\t\t<CodeEditorContainer key={engine.documentReloadKey + 100} />\n\t\t\t\t\t<Chrome key={engine.documentReloadKey + 200} />\n\t\t\t\t</ActionResponder>\n\t\t\t</div>\n\t\t)\n\t}\n\n\toverride componentDidMount() {\n\t\tassert(this.update === engine.scheduler.update, \"engine must drive document.state correctly\")\n\t\tengine.assertReactRendering()\n\t\tengine.endRendering()\n\n\t\t// In error recovery, we might be in engine.doRendering, which will call afterRendering itself\n\t\tif (engine.inDoRendering) return\n\n\t\tengine.afterRendering()\n\t\tengine.doReport()\n\t}\n\n\toverride componentDidUpdate() {\n\t\tassert(this.update === engine.scheduler.update, \"engine must drive document.state correctly\")\n\t\tengine.assertReactRendering()\n\t\tengine.endRendering()\n\t}\n\n\tonContextMenu = (event: React.MouseEvent) => {\n\t\tif (wantsNativeTextActions(event.target)) return\n\t\t// Make sure the standard WebKit context menu (Reload, etc) never appears\n\t\tevent.preventDefault()\n\t}\n}\n", "import type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { isVekterEngine } from \"document/useVekterEngine.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\n\n/**\n * Whether the current user is allowed to interact with the agent in the active scope.\n *\n * View-only users (lacking the `canDesign` permission) are blocked from starting a new\n * conversation, but can still see the panel if a conversation already exists in the active\n * scope so they can read prior messages.\n *\n * Imperative companion to `useCanViewAgent`. Use this from class methods, action handlers,\n * menu state, and other contexts where React hooks are not available.\n */\nexport function getCanViewAgent(engine: BaseEngine): boolean {\n\tif (!getIsViewOnly(engine, \"canDesign\")) return true\n\tif (!isVekterEngine(engine)) return false\n\tconst { agentStore } = engine.stores\n\tconst activeAgentId = agentStore.activeChatAgentId\n\tif (!activeAgentId) return false\n\tconst activeAgent = agentStore.getAgent(activeAgentId)\n\treturn (activeAgent?.userMessageCount ?? 0) > 0\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { AnyWebPageNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isKitPageNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { updateProject } from \"web/lib/ProjectAPI.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { createNewLocalKit } from \"../kits/LocalKit.ts\"\n\nexport async function applyKitFeatureToProject(engine: VekterEngine) {\n\tassert(!getIsViewOnly(engine, \"canDesign\"), \"Cannot execute actions in view-only mode\")\n\tassert(!projectFeatures.isOn(\"kit\"), \"Project should not be marked as a kit project\")\n\n\ttry {\n\t\t// Optimistically, set the new feature in the local project in the store.\n\t\tengine.stores.projectStore.updateProjectFeatures({ kit: true })\n\n\t\t// Persist the project feature to the project.\n\t\tconst projectId = engine.stores.projectStore.projectId\n\t\tawait updateProject(projectId, { canvasFeatures: { kit: true } })\n\n\t\tconst kit = createNewLocalKit()\n\n\t\t// Write the default kit manifest to the tree.\n\t\tengine.scheduler.process(() => {\n\t\t\tengine.tree.root.set({ kitManifest: { id: kit.id, title: kit.title } })\n\t\t})\n\n\t\t// Create the module. We need a module id to create screenshots.\n\t\tawait engine.stores.modulesStore.updateKit(kit, undefined, [], [], new Set())\n\n\t\t// If there are already web pages that can be converted to kit pages,\n\t\t// we can ask the user to convert the existing pages to kit pages.\n\t\tif (areThereAnyPagesToConvertToKit(engine.tree)) {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConvertToKitPage,\n\t\t\t\tsource: \"main_menu\",\n\t\t\t\twebPageIds: getPagesToConvertToKit(engine.tree),\n\t\t\t\tcreateBlankKitPage: true,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// Creates a new empty kit page.\n\t\tawait createBlankKitPage(engine)\n\t} catch (error) {\n\t\t// Rollback the local project feature and the project features.\n\t\tengine.stores.projectStore.updateProjectFeatures({ kit: false })\n\n\t\tengine.scheduler.process(() => {\n\t\t\tengine.tree.root.set({ kitManifest: undefined })\n\t\t})\n\t\tthrow error\n\t}\n}\n\n/**\n * Gets the pages to convert to a kit page. Makes sure it loads all the pages to get all the pages that will be\n * converted to a kit page.\n *\n * @param tree The canvas tree.\n * @returns The IDs of the pages to convert to a kit page.\n */\nexport function getPagesToConvertToKit(tree: CanvasTree): NodeID[] {\n\tconst pagesToConvert: NodeID[] = []\n\tfor (const node of tree.root.children) {\n\t\tif (!isWebPageNode(node) || !isPageConvertibleToKit(tree, node)) continue\n\t\tpagesToConvert.push(node.id)\n\t}\n\treturn pagesToConvert\n}\n\n/**\n * Checks if there are any pages to convert to a kit page. For all convertible pages (no ab testing variants),\n * we check if there is at least one loaded non empty page.\n *\n * Important: For performance reasons we don't load the pages here, we only check if the pages are convertible and we check\n * the already loaded pages. This is ok since when converting a kit to a kit project we don't want to show the modal\n * if there are only empty pages and the same for displaying the app menu option to convert. Worst case scenario the\n * modal is not shown at the time of creating the kit project (not loaded pages with content)\n * but the user can still convert later (pages eventually load).\n *\n * @param tree The canvas tree.\n * @returns `true` if there are any pages to convert to a kit page, `false` otherwise.\n */\nexport function areThereAnyPagesToConvertToKit(tree: CanvasTree): boolean {\n\tfor (const node of tree.root.children) {\n\t\tif (\n\t\t\tisWebPageNode(node) &&\n\t\t\tisPageConvertibleToKit(tree, node) &&\n\t\t\tnode.isLoaded() &&\n\t\t\tnode.getPrimaryVariant().children.length > 0\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a web page node can be converted to a kit page: no ab testing variants. We allow to convert empty pages.\n *\n * @param tree The canvas tree.\n * @param node The web page node to check.\n * @returns `true` if the web page node can be converted to a kit page, `false` otherwise.\n */\nexport function isPageConvertibleToKit(tree: CanvasTree, node: AnyWebPageNode): boolean {\n\treturn !isKitPageNode(node) && !node.hasAbTestingChildren(tree)\n}\n\nexport async function createBlankKitPage(engine: VekterEngine) {\n\t// KITS @TODO: In the future we might want this to contain a set of predefined sections.\n\tawait engine.createWebPage({ isWireframerKitPage: true })\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { afterValidatingActions, beforeValidatingActions } from \"document/components/actions/ActionResponder.tsx\"\nimport { ContextAlignment } from \"document/components/utils/contextAlignmentActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\nexport interface MenuContext {\n\ttree: CanvasTree\n\tselection: NodeID[]\n\tnodes: CanvasNode[]\n\tgroundNodes: CanvasNode[]\n\twithoutDescendants: CanvasNode[]\n\talignmentEnabled: boolean\n\tdistributionEnabled: boolean\n\talignToParentOptionsEnabled: boolean\n\tsingleNode: CanvasNode | null\n\tonlyTextNodes: boolean\n\tonlyShapeNodes: boolean\n\tactionArgument?: unknown\n}\n\nlet currentMenuContext: MenuContext | undefined\n\nbeforeValidatingActions(() => {\n\tassert(currentMenuContext === undefined)\n\tcurrentMenuContext = getMenuContext()\n})\n\nafterValidatingActions(() => {\n\tcurrentMenuContext = undefined\n})\n\nexport function getMenuContext(event?: Event & { actionArgument?: any }): MenuContext {\n\tif (currentMenuContext) return currentMenuContext\n\n\tconst { tree } = engine\n\tconst { selectionStore } = engine.stores\n\tconst scope = engine.stores.scopeStore.active\n\tconst nodes = tree.getNodes(selectionStore.ids)\n\tconst withoutDescendants = tree.withoutDescendants(nodes)\n\tconst groundNodes = scope.getGroundNodes()\n\treturn {\n\t\ttree,\n\t\tselection: selectionStore.ids,\n\t\tnodes,\n\t\tgroundNodes,\n\t\twithoutDescendants,\n\t\talignmentEnabled: ContextAlignment.alignEnabled(tree, withoutDescendants),\n\t\tdistributionEnabled: ContextAlignment.distributeEnabled(tree, withoutDescendants),\n\t\talignToParentOptionsEnabled: nodes.length !== 1,\n\t\tsingleNode: nodes.length === 1 ? (nodes[0] ?? null) : null,\n\t\tonlyTextNodes: nodes.length > 0 && nodes.find(node => !isTextNode(node)) === undefined,\n\t\tonlyShapeNodes: nodes.length > 0 && nodes.find(node => !isVectorNode(node)) === undefined,\n\t\tactionArgument: event?.actionArgument,\n\t}\n}\n", "/**\n * When a past version is loaded, almost the entire React component tree\n * is unmounted & remounted by `key` changes in `src/document/component/Document.tsx`.\n * This includes unmounting/remounting the history timeline panel, so in order\n * to preserve the local UI state, we need to persist outside of React.\n */\n\nconst SCROLL_POS_KEY = \"timelineScrollPos\" as const\n\nclass TimelineScrollState {\n\tprivate scrollPos: number\n\n\tconstructor() {\n\t\tthis.scrollPos = this.loadFromStorage()\n\t}\n\n\tprivate loadFromStorage(): number {\n\t\tconst maybeInt = sessionStorage.getItem(SCROLL_POS_KEY)\n\n\t\tif (maybeInt === null) return 0\n\n\t\tconst int = parseInt(maybeInt, 10)\n\t\tif (Number.isNaN(int)) {\n\t\t\tthis.set(0)\n\t\t\treturn 0\n\t\t} else {\n\t\t\treturn int\n\t\t}\n\t}\n\n\tprivate saveToStorage(): void {\n\t\tsessionStorage.setItem(SCROLL_POS_KEY, JSON.stringify(this.scrollPos))\n\t}\n\n\tget(): number {\n\t\treturn this.scrollPos\n\t}\n\n\tset(pos: number): void {\n\t\tthis.scrollPos = pos\n\t\tthis.saveToStorage()\n\t}\n\n\tclear(): void {\n\t\tthis.scrollPos = 0\n\t\tsessionStorage.removeItem(SCROLL_POS_KEY)\n\t}\n}\n\nconst timelineScrollState = new TimelineScrollState()\n\nexport function getTimelineScrollPos(): number {\n\treturn timelineScrollState.get()\n}\n\nexport function setTimelineScrollPos(pos: number): void {\n\ttimelineScrollState.set(pos)\n}\n\nexport function clearTimelineScrollPos(): void {\n\ttimelineScrollState.clear()\n}\n", "import engine from \"document/engine.ts\"\nimport { clearTimelineScrollPos } from \"./persistTimelinePanelState.ts\"\n\nexport function resetVersionHistoryState() {\n\tconst { historyStore, publishStore } = engine.stores\n\thistoryStore.restoreLatest()\n\tclearTimelineScrollPos()\n\tengine.scheduler.processWhenReady(() => publishStore.resetVersions())\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type { ActiveOverlay } from \"document/utils/ActiveEditorType.ts\"\nimport { useState } from \"react\"\n\nexport function useChromeOverlay() {\n\tconst [overlay, setOverlay] = useState<ActiveOverlay | null>(null)\n\t// @FIXME - This is a workaround to get the overlay from the useEngineState.\n\t// The useEngineState causes issues when its result is used in an useEffect (https://github.com/framer/FramerStudio/pull/15894).\n\tuseDeprecatedEngineState([engine.stores.chromeStore, EngineChange.Tree], () => {\n\t\tsetOverlay(engine.stores.chromeStore.overlay)\n\t})\n\treturn overlay\n}\n", "import type { ProjectState } from \"@framerjs/app-shared\"\nimport { assert, asLocalId, assertNever } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { closeCollectionItems } from \"document/components/chrome/contentManagement/utils/closeCollectionItems.tsx\"\nimport { getSelectedCollectionItem } from \"document/components/utils/collectionItemUtils.ts\"\nimport { switchCollectionItemOnCanvas } from \"document/components/utils/switchCollectionItemOnCanvas.ts\"\nimport { useChromeOverlay } from \"document/components/utils/useChromeOverlay.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport type { AnalyticsTab } from \"document/stores/AnalyticsStore.ts\"\nimport { analyticsImpressionTrackingPages } from \"document/stores/AnalyticsStore.ts\"\nimport type { Selection } from \"document/stores/SelectionStore.ts\"\nimport type { SiteSettingsTab } from \"document/stores/SiteSettingsStore.ts\"\nimport { SiteSettingsTabNames, siteSettingsImpressionTrackingPages } from \"document/stores/SiteSettingsStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type { ActiveOverlay } from \"document/utils/ActiveEditorType.ts\"\nimport { ActiveMainView, isActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport type { NewCollectionStackElement, OverlayStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { isNewCollectionItemStackElement, validateOverlayStack } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport React, { useEffect, useRef, useState } from \"react\"\nimport { isBoolean, isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport { setViewParamsInURL } from \"utils/urlParams.ts\"\nimport { prettyPathSegment } from \"web/lib/Project.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { HistoryController } from \"./HistoryController.tsx\"\n\ninterface BaseHistoryItem {\n\tmainView: ActiveMainView\n}\n\nexport interface CanvasHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.Canvas\n\t// This is the same as the `?node` query parameter. Theoretically, we could drop this and make\n\t// the URL the source of truth, but we'd have to refactor a significant portion of this file,\n\t// and it's probably not worth it.\n\tactiveScopeId: NodeID\n\tcollectionItemId: NodeID | null\n\toverlay: ActiveOverlay | null\n}\n\ninterface CollectionHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.ContentManagement\n\tselection: Selection\n\toverlay: ActiveOverlay | null\n}\n\ninterface CodeEditorHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.CodeEditor\n\tfilePath: string\n}\n\ninterface SiteSettingsHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.SiteSettings\n\tactiveTab: SiteSettingsTab | undefined\n}\n\ninterface AnalyticsHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.Analytics\n\tactiveTab: AnalyticsTab | undefined\n}\n\ninterface SimpleViewHistoryItem extends BaseHistoryItem {\n\tmainView: ActiveMainView.Preview | ActiveMainView.Localizations\n}\n\nexport type HistoryState =\n\t| CollectionHistoryItem\n\t| CanvasHistoryItem\n\t| CodeEditorHistoryItem\n\t| SiteSettingsHistoryItem\n\t| SimpleViewHistoryItem\n\t| AnalyticsHistoryItem\n\nconst historyController = new HistoryController<HistoryState>()\n\nexport function useHistory(project: ProjectState[\"project\"], engine: VekterEngine) {\n\tconst triggeredByUserNavigation = useRef(false)\n\n\t// Loading the canvas for the first time is a finicky process at the moment.\n\t// Since we disable users switching and such until the document is loaded.\n\t// So we track `hasMinimalEditableData` to know when we can start tracking history.\n\tconst hasMinimalEditableData = engine.stores.loadingStore.useState(state => state.hasMinimalEditableData)\n\tconst { mainView } = engine.stores.chromeStore.useState()\n\tconst isPreviewUIVisible = engine.stores.fullsizePreviewStore.useState(state => state.isPreviewUIVisible)\n\tconst overlay = useChromeOverlay()\n\tconst selection = engine.stores.selectionStore.useState(state => state.ids)\n\tconst localeId = engine.stores.localizationStore.useState(state => state.selectedLocaleId) ?? undefined\n\tconst activeSettingsTab = engine.stores.siteSettingsStore.useState(state => state.active)\n\tconst activeAnalyticsTab = engine.stores.analyticsStore.useState(state => state.active)\n\tconst { currentFilePath, currentCodeFileId } = engine.stores.codeEditorStore.useState()\n\tconst contentManagementOverlayStack = overlay?.type === \"collectionItem\" ? overlay.stack : null\n\n\tconst activeScope = engine.stores.scopeStore.useState(state => state.active)\n\tconst activeScopeId = activeScope.id\n\n\t// @FIXME - This is a workaround to get the selected collection item id from the useEngineState.\n\t// The useEngineState causes issues when its result is used in an useEffect (https://github.com/framer/FramerStudio/pull/15894).\n\tconst [collectionItemId, setCollectionItemId] = useState<NodeID | null>(null)\n\tuseDeprecatedEngineState(\n\t\t[engine.stores.scopeStore, EngineChange.TreeStore, EngineChange.ActiveBundle],\n\t\t() => {\n\t\t\tconst isolatedCanvasNode = engine.stores.scopeStore.active\n\t\t\tif (!isWebPageNode(isolatedCanvasNode)) {\n\t\t\t\tsetCollectionItemId(null)\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst selectedCollectionItem = getSelectedCollectionItem(\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tisolatedCanvasNode.dataIdentifier,\n\t\t\t\tengine.stores.scopeStore.getSelectedCollectionItemForWebPage(isolatedCanvasNode),\n\t\t\t\tlocaleId,\n\t\t\t)\n\t\t\tsetCollectionItemId(selectedCollectionItem?.id ?? null)\n\t\t},\n\t\t[localeId],\n\t)\n\n\t// Restore the last known history state when the document is fully loaded.\n\tuseEffect(() => {\n\t\tif (!hasMinimalEditableData) return\n\t\tconst lastKnownHistoryState = getHistoryState()\n\t\tif (!lastKnownHistoryState) return\n\t\tnavigateInHistoryStack(engine, lastKnownHistoryState)\n\t}, [hasMinimalEditableData, engine])\n\n\t// Update the URL when its dependencies change\n\tuseEffect(() => {\n\t\tif (!hasMinimalEditableData) return\n\t\tconst newUrl = persistSelectionInUrl({\n\t\t\tproject,\n\t\t\tactiveScopeId,\n\t\t\tselection,\n\t\t\tcollectionItemId,\n\t\t\tcontentManagementOverlayStack,\n\t\t\tcurrentCodeFileId,\n\t\t\tlocaleId: mainView === ActiveMainView.Localizations ? localeId : undefined,\n\t\t\tmainView,\n\t\t\tfullscreen: mainView === ActiveMainView.Preview && !isPreviewUIVisible ? \"true\" : null,\n\t\t\tactiveSettingsTab,\n\t\t\tactiveAnalyticsTab,\n\t\t})\n\n\t\tconst currentUrl = window.location.href\n\t\tif (currentUrl === newUrl) return\n\t\thistoryController.replace(undefined, newUrl)\n\t}, [\n\t\thasMinimalEditableData,\n\t\tactiveScopeId,\n\t\tselection,\n\t\tcurrentCodeFileId,\n\t\tcollectionItemId,\n\t\tcontentManagementOverlayStack,\n\t\tlocaleId,\n\t\tproject,\n\t\tmainView,\n\t\tisPreviewUIVisible,\n\t\tactiveSettingsTab,\n\t\tactiveAnalyticsTab,\n\t])\n\n\tuseEffect(() => {\n\t\tif (!hasMinimalEditableData) return\n\t\tif (triggeredByUserNavigation.current) {\n\t\t\ttriggeredByUserNavigation.current = false\n\t\t\treturn\n\t\t}\n\n\t\tconst currentHistoryState = getHistoryState()\n\t\tif (!currentHistoryState) {\n\t\t\tconst newHistoryState = getNewHistoryStateForMainView({\n\t\t\t\tmainView,\n\t\t\t\tactiveScopeId,\n\t\t\t\tcollectionItemId,\n\t\t\t\toverlay,\n\t\t\t\tselection,\n\t\t\t\tcurrentFilePath,\n\t\t\t\tactiveSettingsTab,\n\t\t\t\tactiveAnalyticsTab,\n\t\t\t})\n\t\t\taddToHistoryStack(newHistoryState, \"replace\")\n\t\t\treturn\n\t\t}\n\n\t\tconst addHistoryStateAction = shouldAddNewHistoryState(\n\t\t\tengine,\n\t\t\tcurrentHistoryState,\n\t\t\tmainView,\n\t\t\tactiveScopeId,\n\t\t\tcollectionItemId,\n\t\t\toverlay,\n\t\t\tselection,\n\t\t\tcurrentFilePath ?? null,\n\t\t\tactiveSettingsTab,\n\t\t\tactiveAnalyticsTab,\n\t\t)\n\t\tif (!addHistoryStateAction) return\n\n\t\tconst newHistoryState = getNewHistoryStateForMainView({\n\t\t\tmainView,\n\t\t\tactiveScopeId,\n\t\t\tcollectionItemId,\n\t\t\toverlay,\n\t\t\tselection,\n\t\t\tcurrentFilePath,\n\t\t\tactiveSettingsTab,\n\t\t\tactiveAnalyticsTab,\n\t\t})\n\n\t\taddToHistoryStack(newHistoryState, addHistoryStateAction)\n\t}, [\n\t\tengine,\n\t\thasMinimalEditableData,\n\t\tactiveScopeId,\n\t\tselection,\n\t\tmainView,\n\t\tcurrentFilePath,\n\t\tactiveSettingsTab,\n\t\tcollectionItemId,\n\t\toverlay,\n\t\tactiveAnalyticsTab,\n\t])\n\n\tuseEffect(() => {\n\t\tconst handleBeforeUserNavigation = () => {\n\t\t\ttriggeredByUserNavigation.current = true\n\t\t}\n\n\t\tconst handleAfterUserNavigation = (nextState: HistoryState) => {\n\t\t\tcloseCurrentView(engine, nextState)\n\n\t\t\ttrackNavigationFromMainView(nextState)\n\n\t\t\tnavigateInHistoryStack(engine, nextState)\n\t\t\t// This will update the nodeId search parameter with the new node in the URL.\n\t\t\thistoryController.replace(nextState)\n\t\t}\n\n\t\tconst removeUserInitiatedBackNavigationHandler = historyController.setUserInitiatedBackNavigationHandler(\n\t\t\tnextHistoryState => getUserInitiatedBackNavigationAction(engine, nextHistoryState),\n\t\t)\n\t\tconst unsubscribeFromBefore = historyController.subscribeToBeforeUserNavigation(handleBeforeUserNavigation)\n\t\tconst unsubscribeFromAfter = historyController.subscribeToAfterUserNavigation(handleAfterUserNavigation)\n\n\t\treturn () => {\n\t\t\tremoveUserInitiatedBackNavigationHandler()\n\t\t\tunsubscribeFromBefore()\n\t\t\tunsubscribeFromAfter()\n\t\t}\n\t}, [engine])\n}\n\nconst historyStateKey: keyof HistoryState = \"mainView\"\n\nfunction isHistoryState(state: unknown): state is HistoryState {\n\tif (!isObject(state)) return false\n\n\tconst mainView = state[historyStateKey]\n\treturn isActiveMainView(mainView)\n}\n\nexport async function getUserInitiatedBackNavigationAction(\n\tengine: VekterEngine,\n\tnextHistoryState: HistoryState | undefined,\n\tcurrentHistoryState: HistoryState | null = getHistoryState(),\n): Promise<\"pop\" | \"drop\" | \"prevent\" | \"skip\"> {\n\tif (nextHistoryState && shouldSkipStalePrivateDraftHistoryEntry(engine, nextHistoryState)) {\n\t\treturn \"skip\"\n\t}\n\n\tconst { contentManagementStore } = engine.stores\n\tconst activePrivateDraft = contentManagementStore.getActivePrivateDraftCollectionStackElement()\n\tif (!activePrivateDraft) {\n\t\treturn \"pop\"\n\t}\n\tconst activePrivateDraftHasHistoryEntry = historyStateHasActivePrivateDraft(currentHistoryState, activePrivateDraft)\n\n\tconst result = await closeCollectionItems({\n\t\tengine,\n\t\ttarget: \"active\",\n\t\taction: \"save-or-confirm-discard-on-failure\",\n\t})\n\n\tif (result.userKeptEditing) return \"prevent\"\n\tif (!activePrivateDraftHasHistoryEntry) {\n\t\t// Private draft items are inserted into the tree before React has necessarily pushed the matching history entry.\n\t\t// If browser back races that update, close the draft but keep the user on the current table/parent entry.\n\t\treturn \"prevent\"\n\t}\n\n\treturn result.saved ? \"pop\" : \"drop\"\n}\n\nfunction historyStateHasActivePrivateDraft(\n\thistoryState: HistoryState | null,\n\tactivePrivateDraft: NewCollectionStackElement,\n) {\n\tif (historyState?.mainView !== ActiveMainView.Canvas && historyState?.mainView !== ActiveMainView.ContentManagement) {\n\t\treturn false\n\t}\n\n\tconst overlay = historyState.overlay\n\tif (overlay?.type !== \"collectionItem\") return false\n\n\tconst activeHistoryElement = overlay.stack.at(-1)\n\tif (!activeHistoryElement) return false\n\tif (activeHistoryElement.type !== activePrivateDraft.type) return false\n\n\treturn activeHistoryElement.itemId === activePrivateDraft.itemId\n}\n\nfunction trackNavigationFromMainView(historyState: HistoryState) {\n\tlet page: Pages | null\n\n\tswitch (historyState.mainView) {\n\t\tcase ActiveMainView.Canvas:\n\t\t\tpage = Pages.canvas\n\t\t\tbreak\n\t\tcase ActiveMainView.ContentManagement:\n\t\t\tpage = Pages.collectionPanel\n\t\t\tbreak\n\t\tcase ActiveMainView.CodeEditor:\n\t\t\tpage = Pages.codeEditor\n\t\t\tbreak\n\t\tcase ActiveMainView.Localizations:\n\t\t\tpage = Pages.localizationPanel\n\t\t\tbreak\n\t\tcase ActiveMainView.Preview:\n\t\t\tpage = Pages.preview\n\t\t\tbreak\n\t\tcase ActiveMainView.SiteSettings:\n\t\t\tif (!historyState.activeTab) return\n\t\t\tpage = siteSettingsImpressionTrackingPages[historyState.activeTab.tab]\n\t\t\tbreak\n\t\tcase ActiveMainView.Analytics:\n\t\t\tif (!historyState.activeTab) return\n\t\t\tpage = analyticsImpressionTrackingPages[historyState.activeTab.tab]\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(historyState)\n\t}\n\n\tif (!page) return\n\trecord(\"ui_interaction\", { page, id: \"history_navigation\" })\n}\n\nexport function getHistoryState() {\n\tconst state = historyController.getCurrentState()\n\tif (!isHistoryState(state)) return null\n\treturn state\n}\n\n// Always track main view changes for history state updates.\n// In canvas view, monitor scope node ID changes.\n// In content management view, watch for selection modifications.\n// In code editor view, check for file path adjustments.\n// Changes in site settings, localizations, or preview are considered part of main view changes.\nexport function shouldAddNewHistoryState(\n\tengine: VekterEngine,\n\tcurrentHistoryState: HistoryState,\n\tmainView: ActiveMainView,\n\tactiveScopeId: NodeID,\n\tcollectionItemId: NodeID | null,\n\toverlay: ActiveOverlay | null,\n\tselection: Selection,\n\tcurrentFilePath: string | null,\n\tactiveSettingsTab: SiteSettingsTab | null,\n\tactiveAnalyticsTab: AnalyticsTab | null,\n): \"push\" | \"replace\" | \"drop\" | null {\n\tconst mainViewChanged = currentHistoryState.mainView !== mainView\n\tif (mainViewChanged) return \"push\"\n\tconst overlayForHistory = stripTransientCollectionItemOverlayStateForHistory(overlay)\n\n\tswitch (currentHistoryState.mainView) {\n\t\tcase ActiveMainView.Canvas: {\n\t\t\tconst currentOverlayForHistory = stripTransientCollectionItemOverlayStateForHistory(currentHistoryState.overlay)\n\t\t\tif (\n\t\t\t\tactiveScopeId === currentHistoryState.activeScopeId &&\n\t\t\t\tcollectionItemId === currentHistoryState.collectionItemId &&\n\t\t\t\tisEqual(overlayForHistory, currentOverlayForHistory)\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tif (isChangeDueToPrivateDraftCollectionItemSave(currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"replace\"\n\t\t\t}\n\n\t\t\tif (isChangeDueToPrivateDraftCollectionItemDiscard(engine, currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"replace\"\n\t\t\t}\n\n\t\t\tif (isChangeDueToExistingCollectionItemDeletion(engine, currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"drop\"\n\t\t\t}\n\n\t\t\treturn \"push\"\n\t\t}\n\t\tcase ActiveMainView.ContentManagement: {\n\t\t\tconst currentOverlayForHistory = stripTransientCollectionItemOverlayStateForHistory(currentHistoryState.overlay)\n\t\t\tif (isEqual(selection, currentHistoryState.selection) && isEqual(overlayForHistory, currentOverlayForHistory)) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tif (isChangeDueToPrivateDraftCollectionItemSave(currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"replace\"\n\t\t\t}\n\n\t\t\tif (isChangeDueToPrivateDraftCollectionItemDiscard(engine, currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"replace\"\n\t\t\t}\n\n\t\t\tif (isChangeDueToExistingCollectionItemDeletion(engine, currentHistoryState, overlayForHistory)) {\n\t\t\t\treturn \"drop\"\n\t\t\t}\n\n\t\t\t// Do not keep the empty no-collections placeholder CMS state as a history entry\n\t\t\tif (currentHistoryState.selection.length === 0) {\n\t\t\t\treturn \"replace\"\n\t\t\t}\n\n\t\t\treturn \"push\"\n\t\t}\n\t\tcase ActiveMainView.CodeEditor: {\n\t\t\tif (currentFilePath === currentHistoryState.filePath) return null\n\t\t\treturn \"push\"\n\t\t}\n\t\tcase ActiveMainView.SiteSettings: {\n\t\t\tif (isEqual(activeSettingsTab, currentHistoryState.activeTab)) return null\n\t\t\treturn \"push\"\n\t\t}\n\t\tcase ActiveMainView.Analytics: {\n\t\t\tif (isEqual(activeAnalyticsTab, currentHistoryState.activeTab)) return null\n\t\t\treturn \"push\"\n\t\t}\n\t\tcase ActiveMainView.Localizations:\n\t\tcase ActiveMainView.Preview:\n\t\t\treturn null\n\t\tdefault:\n\t\t\tassertNever(currentHistoryState)\n\t}\n}\n\nexport function getNewHistoryStateForMainView({\n\tmainView,\n\tactiveScopeId,\n\tcollectionItemId,\n\toverlay,\n\tselection,\n\tcurrentFilePath,\n\tactiveSettingsTab,\n\tactiveAnalyticsTab,\n}: {\n\tmainView: ActiveMainView\n\tactiveScopeId: NodeID | undefined\n\tcollectionItemId: NodeID | null\n\toverlay: ActiveOverlay | null\n\tselection: Selection\n\tcurrentFilePath: string | undefined\n\tactiveSettingsTab: SiteSettingsTab | null\n\tactiveAnalyticsTab: AnalyticsTab | null\n}): HistoryState {\n\tconst overlayForHistory = stripTransientCollectionItemOverlayStateForHistory(overlay)\n\n\tswitch (mainView) {\n\t\tcase ActiveMainView.Canvas:\n\t\t\tassert(activeScopeId, \"No active node id for canvas\")\n\t\t\treturn {\n\t\t\t\tmainView,\n\t\t\t\tactiveScopeId,\n\t\t\t\tcollectionItemId,\n\t\t\t\toverlay: overlayForHistory,\n\t\t\t}\n\t\tcase ActiveMainView.ContentManagement:\n\t\t\treturn {\n\t\t\t\tmainView,\n\t\t\t\tselection,\n\t\t\t\toverlay: overlayForHistory,\n\t\t\t}\n\t\tcase ActiveMainView.CodeEditor:\n\t\t\tassert(currentFilePath, \"No file path for code editor\")\n\t\t\treturn { mainView, filePath: currentFilePath }\n\t\tcase ActiveMainView.SiteSettings:\n\t\t\tassert(activeSettingsTab, \"No active settings tab for site settings\")\n\t\t\tif (activeSettingsTab.tab === SiteSettingsTabNames.versions) {\n\t\t\t\t// At this time, purely for scope-cutting reasons, the versions deep link to issues for a specific\n\t\t\t\t// version is meant to work one-way only, on the initial open, so let's prevent that part of the state\n\t\t\t\t// from being persisted.\n\t\t\t\tconst { id: _id, showDeploymentIssues: _showDeploymentIssues, ...rest } = activeSettingsTab\n\t\t\t\tactiveSettingsTab = rest\n\t\t\t}\n\t\t\treturn { mainView, activeTab: activeSettingsTab }\n\t\tcase ActiveMainView.Analytics:\n\t\t\tassert(activeAnalyticsTab, \"No active tab for analytics\")\n\t\t\treturn { mainView, activeTab: activeAnalyticsTab }\n\t\tcase ActiveMainView.Localizations:\n\t\tcase ActiveMainView.Preview:\n\t\t\treturn { mainView }\n\t\tdefault:\n\t\t\tassertNever(mainView)\n\t}\n}\n\nexport function persistSelectionInUrl({\n\tproject,\n\tactiveScopeId,\n\tselection,\n\tcollectionItemId,\n\tcurrentCodeFileId,\n\tcontentManagementOverlayStack,\n\tlocaleId,\n\tmainView,\n\tfullscreen,\n\tactiveSettingsTab,\n\tactiveAnalyticsTab,\n}: {\n\tproject: ProjectState[\"project\"]\n\tactiveScopeId: NodeID | undefined\n\tselection: Selection\n\tcollectionItemId: NodeID | null\n\tcurrentCodeFileId: string | null | undefined\n\tcontentManagementOverlayStack?: readonly OverlayStackElement[] | null\n\tlocaleId: LocaleId | undefined\n\tmainView: ActiveMainView\n\tfullscreen?: string | null\n\tactiveSettingsTab: SiteSettingsTab | null\n\tactiveAnalyticsTab: AnalyticsTab | null\n}): string {\n\tconst currentUrlString = window.location.href\n\tconst currentUrlSearchParams = new URL(currentUrlString).search\n\n\t// NOTE: Not using `prettyURL` here because it could rewrite the origin\n\tconst newUrl = new URL(\"/projects/\" + prettyPathSegment(project), window.location.origin)\n\t// Retain the initial query params, such as \"tutorial\".\n\tnewUrl.search = currentUrlSearchParams\n\n\tconst codeModuleLocalId = currentCodeFileId ? asLocalId(currentCodeFileId) : null\n\t// For content management, we want to persist the selection (which can be the collection ID or an item ID) so we can link to it.\n\tconst nodeIdToPersist =\n\t\tactiveScopeId === CONTENT_MANAGEMENT_ID\n\t\t\t? getContentManagementNodeIdToPersist(selection, contentManagementOverlayStack)\n\t\t\t: activeScopeId\n\tsetViewParamsInURL(newUrl, {\n\t\tnodeId: nodeIdToPersist,\n\t\tcodeModuleLocalId,\n\t\tcollectionItemInCanvasId: collectionItemId,\n\t\tlocaleId,\n\t\tmainView,\n\t\tfullscreen,\n\t\tsiteSettingsTab: activeSettingsTab,\n\t\tanalyticsTab: activeAnalyticsTab,\n\t})\n\treturn newUrl.href\n}\n\nfunction getContentManagementNodeIdToPersist(\n\tselection: Selection,\n\tcontentManagementOverlayStack: readonly OverlayStackElement[] | null | undefined,\n): NodeID | undefined {\n\tconst activeStackElement = contentManagementOverlayStack?.findLast(\n\t\telement => element.type === \"existing\" || element.type === \"privateDraft\",\n\t)\n\treturn activeStackElement?.itemId ?? selection[0]\n}\n\nexport function navigateInHistoryStack(engine: VekterEngine, targetHistoryState: HistoryState) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tswitch (targetHistoryState.mainView) {\n\t\t\tcase ActiveMainView.Canvas: {\n\t\t\t\tconst { activeScopeId, collectionItemId } = targetHistoryState\n\t\t\t\tif (!engine.tree.has(activeScopeId)) return\n\n\t\t\t\tengine.stores.scopeStore.select(activeScopeId, { keepHistory: true })\n\t\t\t\tif (collectionItemId) {\n\t\t\t\t\tswitchCollectionItemOnCanvas(engine.stores, collectionItemId)\n\t\t\t\t}\n\n\t\t\t\tif (targetHistoryState.overlay) {\n\t\t\t\t\tengine.stores.chromeStore.setOverlay(targetHistoryState.overlay)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ActiveMainView.ContentManagement: {\n\t\t\t\tconst { selection } = targetHistoryState\n\t\t\t\tfor (const item of selection) {\n\t\t\t\t\tconst selectionNode = engine.tree.get(item)\n\t\t\t\t\tif (!selectionNode) return\n\t\t\t\t}\n\t\t\t\tengine.stores.scopeStore.select(\"contentManagement\", { keepHistory: true })\n\t\t\t\tengine.stores.selectionStore.set(targetHistoryState.selection)\n\n\t\t\t\tif (targetHistoryState.overlay) {\n\t\t\t\t\tif (targetHistoryState.overlay.type === \"collectionItem\") {\n\t\t\t\t\t\tconst stack = validateOverlayStack(engine, targetHistoryState.overlay.stack)\n\t\t\t\t\t\tconst firstElement = stack.at(0)\n\n\t\t\t\t\t\tif (firstElement?.type === \"existing\" || firstElement?.type === \"privateDraft\") {\n\t\t\t\t\t\t\t// `targetHistoryState.selection` may not necessarily contain the correct one because a tmp\n\t\t\t\t\t\t\t// item may have turned existing (so it needs to be selected instead of its collection)\n\t\t\t\t\t\t\tengine.stores.selectionStore.set(firstElement.itemId)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tengine.stores.chromeStore.setOverlay({\n\t\t\t\t\t\t\ttype: \"collectionItem\",\n\t\t\t\t\t\t\tstack,\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tengine.stores.chromeStore.setOverlay(targetHistoryState.overlay)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ActiveMainView.CodeEditor:\n\t\t\t\tengine.stores.codeEditorStore.editFile(targetHistoryState.filePath)\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.Preview:\n\t\t\t\ttogglePreviewVisible(engine, { visible: true, source: \"back_navigation\" })\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.SiteSettings: {\n\t\t\t\tengine.stores.siteSettingsStore.open()\n\t\t\t\tconst activeTab = targetHistoryState.activeTab\n\t\t\t\tif (!isUndefined(activeTab)) {\n\t\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab(activeTab)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ActiveMainView.Analytics: {\n\t\t\t\tengine.stores.analyticsStore.open()\n\t\t\t\tconst activeTab = targetHistoryState.activeTab\n\t\t\t\tif (!isUndefined(activeTab)) {\n\t\t\t\t\tvoid engine.stores.analyticsStore.setActiveTab(activeTab)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ActiveMainView.Localizations:\n\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(true)\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(targetHistoryState)\n\t\t}\n\t}, \"nonUserEvent\")\n}\n\nfunction closeCurrentView(engine: VekterEngine, targetHistoryState: HistoryState) {\n\tconst { mainView, overlay } = engine.stores.chromeStore\n\tconst canvasCollectionItemOverlayOpen = overlay?.type === \"collectionItem\"\n\n\tif (mainView !== targetHistoryState.mainView) {\n\t\tswitch (mainView) {\n\t\t\tcase ActiveMainView.Canvas:\n\t\t\tcase ActiveMainView.ContentManagement:\n\t\t\t\t// These can't be dismissed unless the active scope is changed.\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.CodeEditor:\n\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.Preview:\n\t\t\t\ttogglePreviewVisible(engine, { visible: false, source: \"back_navigation\" })\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.SiteSettings:\n\t\t\t\tengine.stores.siteSettingsStore.close()\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.Localizations:\n\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t\t\tbreak\n\t\t\tcase ActiveMainView.Analytics:\n\t\t\t\tengine.stores.analyticsStore.close()\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(mainView)\n\t\t}\n\t\treturn\n\t}\n\n\t// Main view is the same.\n\tswitch (mainView) {\n\t\t// Canvas is the only view on which we can have close actions even if the view hasn't changed.\n\t\tcase ActiveMainView.Canvas: {\n\t\t\tassert(targetHistoryState.mainView === ActiveMainView.Canvas)\n\t\t\tif (!canvasCollectionItemOverlayOpen || targetHistoryState.overlay?.type === \"collectionItem\") return\n\t\t\tengine.stores.chromeStore.hideOverlay()\n\t\t\tbreak\n\t\t}\n\t\t// For any other views, there is no close action if the view hasn't changed.\n\t\tcase ActiveMainView.ContentManagement:\n\t\tcase ActiveMainView.CodeEditor:\n\t\tcase ActiveMainView.Preview:\n\t\tcase ActiveMainView.SiteSettings:\n\t\tcase ActiveMainView.Localizations:\n\t\tcase ActiveMainView.Analytics:\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(mainView)\n\t}\n}\n\nfunction stripTransientCollectionItemOverlayStateForHistory(overlay: ActiveOverlay | null): ActiveOverlay | null {\n\tif (overlay?.type !== \"collectionItem\") return overlay\n\n\treturn {\n\t\ttype: \"collectionItem\",\n\t\tstack: overlay.stack.map(element => {\n\t\t\tif (!isNewCollectionItemStackElement(element)) return element\n\t\t\tif (!element.showErrors && !element.attemptedClose) return element\n\n\t\t\t// Close attempts and validation display are transient UI state, not browser navigation state.\n\t\t\tconst { attemptedClose: _attemptedClose, ...elementForHistory } = element\n\t\t\treturn {\n\t\t\t\t...elementForHistory,\n\t\t\t\tshowErrors: false,\n\t\t\t}\n\t\t}),\n\t}\n}\n\nfunction isChangeDueToPrivateDraftCollectionItemSave(\n\tcurrentHistoryState: CollectionHistoryItem | CanvasHistoryItem,\n\tcurrentOverlay: ActiveOverlay | null,\n) {\n\tif (currentHistoryState.overlay?.type !== \"collectionItem\" || currentOverlay?.type !== \"collectionItem\") {\n\t\treturn false\n\t}\n\tconst prevLast = currentHistoryState.overlay.stack.at(-1)\n\tconst currentLast = currentOverlay.stack.at(-1)\n\treturn (\n\t\t(prevLast?.type === \"temporary\" || prevLast?.type === \"privateDraft\") &&\n\t\tcurrentLast?.type === \"existing\" &&\n\t\tprevLast.itemId === currentLast.itemId\n\t)\n}\n\nfunction isChangeDueToExistingCollectionItemDeletion(\n\tengine: VekterEngine,\n\tcurrentHistoryState: CollectionHistoryItem | CanvasHistoryItem,\n\tcurrentOverlay: ActiveOverlay | null,\n) {\n\tif (currentHistoryState.overlay?.type !== \"collectionItem\" || currentOverlay?.type !== \"collectionItem\") {\n\t\treturn false\n\t}\n\n\tconst prevStack = currentHistoryState.overlay.stack\n\tconst nextStack = currentOverlay.stack\n\tif (prevStack.length - 1 !== nextStack.length) return false\n\n\tconst prevLast = prevStack.at(-1)\n\treturn prevLast?.type === \"existing\" && !engine.tree.has(prevLast.itemId)\n}\n\nfunction isChangeDueToPrivateDraftCollectionItemDiscard(\n\tengine: VekterEngine,\n\tcurrentHistoryState: CollectionHistoryItem | CanvasHistoryItem,\n\tcurrentOverlay: ActiveOverlay | null,\n) {\n\tif (currentHistoryState.overlay?.type !== \"collectionItem\" || currentOverlay?.type !== \"collectionItem\") {\n\t\treturn false\n\t}\n\n\tconst prevStack = currentHistoryState.overlay.stack\n\tconst nextStack = currentOverlay.stack\n\tif (prevStack.length - 1 !== nextStack.length) return false\n\n\tconst prevLast = prevStack.at(-1)\n\treturn prevLast?.type === \"privateDraft\" && !engine.tree.has(prevLast.itemId)\n}\n\nfunction shouldSkipStalePrivateDraftHistoryEntry(engine: VekterEngine, targetHistoryState: HistoryState) {\n\treturn shouldSkipStalePrivateDraftHistoryEntryForOverlay(\n\t\tengine,\n\t\ttargetHistoryState,\n\t\tengine.stores.chromeStore.overlay,\n\t)\n}\n\nexport function shouldSkipStalePrivateDraftHistoryEntryForOverlay(\n\tengine: VekterEngine,\n\ttargetHistoryState: HistoryState,\n\tcurrentOverlay: ActiveOverlay | null,\n) {\n\tif (\n\t\ttargetHistoryState.mainView !== ActiveMainView.Canvas &&\n\t\ttargetHistoryState.mainView !== ActiveMainView.ContentManagement\n\t) {\n\t\treturn false\n\t}\n\n\tconst targetOverlay = targetHistoryState.overlay\n\tif (targetOverlay?.type !== \"collectionItem\" || currentOverlay?.type !== \"collectionItem\") return false\n\n\tconst validatedStack = validateOverlayStack(engine, targetOverlay.stack)\n\tif (!hasStalePrivateDraftStackElement(targetOverlay.stack, validatedStack)) return false\n\n\treturn isEqual(currentOverlay, { type: \"collectionItem\", stack: validatedStack })\n}\n\nfunction hasStalePrivateDraftStackElement(\n\tstack: readonly OverlayStackElement[],\n\tvalidatedStack: readonly OverlayStackElement[],\n) {\n\treturn stack.some((element, index) => {\n\t\tif (element.type !== \"privateDraft\") return false\n\n\t\tconst validatedElement = validatedStack[index]\n\t\tif (!validatedElement) return true\n\t\tif (validatedElement.type === \"privateDraft\" && validatedElement.itemId === element.itemId) return false\n\n\t\treturn true\n\t})\n}\n\nfunction addToHistoryStack(newHistoryState: HistoryState, addHistoryStateAction: \"push\" | \"replace\" | \"drop\") {\n\tswitch (addHistoryStateAction) {\n\t\tcase \"push\": {\n\t\t\thistoryController.push(newHistoryState)\n\t\t\tbreak\n\t\t}\n\t\tcase \"replace\": {\n\t\t\thistoryController.replace(newHistoryState)\n\t\t\tbreak\n\t\t}\n\t\tcase \"drop\": {\n\t\t\thistoryController.replaceDroppingForwardHistory(newHistoryState)\n\t\t\tbreak\n\t\t}\n\t\tdefault: {\n\t\t\tassertNever(addHistoryStateAction)\n\t\t}\n\t}\n}\n\nexport function canGoBackInHistory() {\n\t// window.navigation is not available on all browsers. In those cases, we assume that the browser can go back.\n\tconst { navigation } = window\n\tif (!navigation) return true\n\tconst { canGoBack } = navigation\n\treturn isBoolean(canGoBack) ? canGoBack : true\n}\n\nexport function canGoForwardInHistory() {\n\t// window.navigation is not available on all browsers. In those cases, we assume that the browser can go back.\n\tconst { navigation } = window\n\tif (!navigation) return true\n\tconst { canGoForward } = navigation\n\treturn isBoolean(canGoForward) ? canGoForward : true\n}\n\nexport function goBackInHistory() {\n\thistoryController.back()\n}\n\nexport function goForwardInHistory() {\n\thistoryController.forward()\n}\n\ninterface HistoryNavigationProps {\n\tproject: ProjectState[\"project\"]\n\tengine: VekterEngine\n}\n\nexport const HistoryNavigation = React.memo(function HistoryNavigation({ project, engine }: HistoryNavigationProps) {\n\tuseHistory(project, engine)\n\treturn null\n})\n", "import { assert, assertNever } from \"@framerjs/shared\"\n\ninterface StateWithMetadata<T> {\n\tisTransient?: boolean\n\ttimestamp: number\n\tvalue?: T\n}\n\ntype OnBeforeUserNavigation = () => void\ntype OnAfterUserNavigation<T> = (nextState: T) => void\n\ntype OnUserInitiatedBackNavigation<T> = (nextState: T | undefined) => Promise<\"pop\" | \"drop\" | \"prevent\" | \"skip\">\n\nconst blockedPopstateFallbackTimeoutMs = 1000\n\n/**\n * An extension of the browser history API with support for dropping forward history.\n * When possible, prefer to use this instead of interacting with the browser directly.\n */\nexport class HistoryController<T> {\n\tprivate currentState: StateWithMetadata<T> | null = null\n\tprivate beforeUserNavigationListeners = new Set<OnBeforeUserNavigation>()\n\tprivate afterUserNavigationListeners = new Set<OnAfterUserNavigation<T>>()\n\tprivate isPopstateHandlerBlocked: boolean = false\n\tprivate onUserInitiatedBackNavigation: OnUserInitiatedBackNavigation<T> | undefined\n\tprivate isListeningToPopstate = false\n\n\tconstructor() {\n\t\tthis.currentState = window.history.state\n\t}\n\n\tsetUserInitiatedBackNavigationHandler(handler: OnUserInitiatedBackNavigation<T>) {\n\t\tthis.onUserInitiatedBackNavigation = handler\n\t\tthis.addPopstateListener()\n\t\treturn () => {\n\t\t\tif (this.onUserInitiatedBackNavigation !== handler) return\n\t\t\tthis.onUserInitiatedBackNavigation = undefined\n\t\t\tthis.removePopstateListener()\n\t\t}\n\t}\n\n\tprivate addPopstateListener() {\n\t\tif (this.isListeningToPopstate) return\n\t\tthis.isListeningToPopstate = true\n\t\twindow.addEventListener(\"popstate\", this.handlePopstate)\n\t}\n\n\tprivate removePopstateListener() {\n\t\tif (!this.isListeningToPopstate) return\n\t\tthis.isListeningToPopstate = false\n\t\twindow.removeEventListener(\"popstate\", this.handlePopstate)\n\t}\n\n\tprivate handlePopstate = (event: PopStateEvent) => {\n\t\tvoid this.handleUserInitiatedNavigation(event.state)\n\t}\n\n\tsubscribeToBeforeUserNavigation(listener: OnBeforeUserNavigation) {\n\t\tthis.beforeUserNavigationListeners.add(listener)\n\t\treturn () => {\n\t\t\tthis.beforeUserNavigationListeners.delete(listener)\n\t\t}\n\t}\n\n\tsubscribeToAfterUserNavigation(listener: OnAfterUserNavigation<T>) {\n\t\tthis.afterUserNavigationListeners.add(listener)\n\t\treturn () => {\n\t\t\tthis.afterUserNavigationListeners.delete(listener)\n\t\t}\n\t}\n\n\tgetCurrentState(): T | undefined {\n\t\treturn this.currentState?.value\n\t}\n\n\tprivate setCurrentState(state: StateWithMetadata<T>) {\n\t\tthis.currentState = state\n\t}\n\n\tpush(value: T, url = window.location.href) {\n\t\tthis.setCurrentState({\n\t\t\tvalue,\n\t\t\ttimestamp: Date.now(),\n\t\t})\n\t\twindow.history.pushState(this.currentState, \"\", url)\n\t}\n\n\treplace(value: T | undefined = this.getCurrentState(), url = window.location.href) {\n\t\tthis.setCurrentState({\n\t\t\t// It's possible that currentState is undefined if this is the first navigation to the project\n\t\t\ttimestamp: this.currentState?.timestamp ?? Date.now(),\n\t\t\tvalue,\n\t\t})\n\t\twindow.history.replaceState(this.currentState, \"\", url)\n\t}\n\n\treplaceDroppingForwardHistory(value: T) {\n\t\tconst waiter = this.blockNextPopstate()\n\t\twindow.history.back()\n\t\tvoid waiter.then(didNavigate => {\n\t\t\tif (!didNavigate) return\n\t\t\tthis.dropForwardHistory({\n\t\t\t\tvalue,\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t})\n\t\t})\n\t}\n\n\tback() {\n\t\twindow.history.back()\n\t}\n\n\tforward() {\n\t\twindow.history.forward()\n\t}\n\n\tprivate async handleUserInitiatedNavigation(nextState: StateWithMetadata<T>): Promise<void> {\n\t\tif (this.isPopstateHandlerBlocked) return\n\t\tthis.beforeUserNavigationListeners.forEach(listener => listener())\n\n\t\t// This handler triggers after navigation, so \"currentState\"\n\t\t// is the previous state since we haven't updated it yet\n\t\tconst prevState = this.currentState\n\n\t\tconst isForward = (nextState?.timestamp ?? 0) > (prevState?.timestamp ?? 0)\n\n\t\tif (nextState?.isTransient) {\n\t\t\tthis.setCurrentState(nextState)\n\n\t\t\tconst waiter = this.blockNextPopstate()\n\n\t\t\tif (isForward) {\n\t\t\t\twindow.history.forward()\n\t\t\t} else {\n\t\t\t\twindow.history.back()\n\t\t\t}\n\n\t\t\tconst didNavigate = await waiter\n\t\t\tif (!didNavigate) return\n\n\t\t\treturn this.handleUserInitiatedNavigation(window.history.state)\n\t\t}\n\n\t\tif (isForward) {\n\t\t\tthis.setCurrentState(nextState)\n\t\t} else {\n\t\t\tconst onUserInitiatedBackNavigation = this.onUserInitiatedBackNavigation\n\t\t\tassert(onUserInitiatedBackNavigation, \"Missing user-initiated back navigation handler\")\n\t\t\tconst backNavigationAction = await onUserInitiatedBackNavigation(nextState?.value)\n\n\t\t\tswitch (backNavigationAction) {\n\t\t\t\tcase \"pop\": {\n\t\t\t\t\t// No need to do anything special as navigation already happened.\n\t\t\t\t\tthis.setCurrentState(nextState)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"skip\": {\n\t\t\t\t\tthis.setCurrentState(nextState)\n\t\t\t\t\treturn this.continueBackNavigation()\n\t\t\t\t}\n\t\t\t\tcase \"drop\": {\n\t\t\t\t\tthis.dropForwardHistory(nextState)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"prevent\": {\n\t\t\t\t\t// Navigation already happened, so we need to undo it.\n\t\t\t\t\twindow.history.pushState(prevState, \"\", window.location.href)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tassertNever(backNavigationAction)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lastState = this.getCurrentState()\n\t\tif (!lastState) return\n\t\tthis.afterUserNavigationListeners.forEach(listener => listener(lastState))\n\t}\n\n\tprivate async continueBackNavigation() {\n\t\tconst waiter = this.blockNextPopstate()\n\t\twindow.history.back()\n\t\tconst didNavigate = await waiter\n\t\tif (!didNavigate) return\n\t\treturn this.handleUserInitiatedNavigation(window.history.state)\n\t}\n\n\t/**\n\t * If we expect to invoke a history API that will trigger a \"popstate\" (e.g. `history.back` or `history.forward`),\n\t * waits for the event to be fired, and prevents that event from triggering {@link handleUserInitiatedNavigation}.\n\t */\n\tprivate async blockNextPopstate(): Promise<boolean> {\n\t\tthis.isPopstateHandlerBlocked = true\n\t\tconst didNavigate = await new Promise<boolean>(resolve => {\n\t\t\t// Browser history traversal normally emits popstate quickly, but no-op back/forward calls emit nothing.\n\t\t\t// Use a fallback so a missed event does not leave history handling blocked permanently.\n\t\t\tconst timeout = window.setTimeout(() => {\n\t\t\t\twindow.removeEventListener(\"popstate\", handlePopstate)\n\t\t\t\tresolve(false)\n\t\t\t}, blockedPopstateFallbackTimeoutMs)\n\n\t\t\tconst handlePopstate = () => {\n\t\t\t\twindow.clearTimeout(timeout)\n\t\t\t\tresolve(true)\n\t\t\t}\n\n\t\t\twindow.addEventListener(\"popstate\", handlePopstate, { once: true })\n\t\t})\n\t\tthis.isPopstateHandlerBlocked = false\n\t\treturn didNavigate\n\t}\n\n\t/**\n\t * Invalidates the current forward history, making it impossible to go forward. Since the browser doesn't support\n\t * this, we resort to a workaround:\n\t *\n\t * 1. We mark the current state as \"transient\" (by replacing it with the same state, except isTransient = true)\n\t * 2. We push a duplicate of the current state, with \"isTransient = false\". This drops the forward history.\n\t * 3. In {@link handleUserInitiatedNavigation}, when the user goes back or forward, if they would land in a\n\t *    transient state, their back/forward is duplicated so that they never land in it (and therefore it feels like\n\t *    it doesn't exist)\n\t *\n\t * The drawback is that the user will still be able to see the transient state by right-clicking the browser\n\t * navigation arrows, but they won't be able to land on it.\n\t */\n\tprivate dropForwardHistory(currentState: StateWithMetadata<T>) {\n\t\tif (!currentState.value) return\n\t\twindow.history.replaceState(\n\t\t\t{\n\t\t\t\tvalue: currentState.value,\n\t\t\t\tisTransient: true,\n\t\t\t\ttimestamp: currentState.timestamp,\n\t\t\t} satisfies StateWithMetadata<T>,\n\t\t\t\"\",\n\t\t\twindow.location.href,\n\t\t)\n\t\tthis.push(currentState.value)\n\t}\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isRouteSegmentNode, isRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { createRouteSegment } from \"./createRouteSegment.ts\"\nimport { editPageTitle } from \"./editPageRow.ts\"\nimport { getRawRouteSegmentFullPath } from \"./getRouteSegmentFullPath.ts\"\n\nconst defaultFolderName = \"new-folder\"\n\ninterface CreateFolderOptions {\n\t/**\n\t * The position in the parent to insert the new folder.\n\t * If not provided, the new folder will be inserted at the end of the parent.\n\t */\n\tpositionInParent?: number\n\t/**\n\t * The parent node ID where the folder should be created.\n\t * If not provided, the folder will be created at the root.\n\t */\n\tparentId?: string\n}\n\nexport function createFolder(engine: VekterEngine, options: CreateFolderOptions = {}) {\n\tconst rootNode = getRouteSegmentRootNode(engine.tree)\n\tconst parentNode = options.parentId ? engine.tree.get(options.parentId) : rootNode\n\tif (!parentNode || (!isRouteSegmentRootNode(parentNode) && !isRouteSegmentNode(parentNode))) return\n\n\tlet newFolderName = defaultFolderName\n\tconst existingPaths = new Set(parentNode.children?.map(child => child.segment) || [])\n\tif (existingPaths.has(newFolderName)) {\n\t\tnewFolderName = uniqueName(newFolderName, existingPaths, { withDash: true })\n\t}\n\n\tconst parentPath =\n\t\toptions.parentId && options.parentId !== rootNode.id\n\t\t\t? getRawRouteSegmentFullPath(engine.tree, engine.componentLoader, options.parentId)\n\t\t\t: \"\"\n\tconst fullPath = parentPath ? `${parentPath}/${newFolderName}` : newFolderName\n\n\tconst newFolder = createRouteSegment(engine.tree, engine.componentLoader, undefined, undefined, fullPath, {\n\t\tpositionInParent: options.positionInParent,\n\t})\n\n\tengine.scheduler.runAtEndOfFrame(() => {\n\t\teditPageTitle(newFolder.id)\n\t})\n\n\treturn newFolder\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport type { RouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { compareStringsNaturally } from \"utils/compareStringsNaturally.ts\"\nimport { isWithoutChildren } from \"./commons.ts\"\n\nfunction sortChildrenAlphabetically(\n\tnode: RouteSegmentNode | RouteSegmentRootNode,\n\trecursive: boolean,\n\tengine: VekterEngine,\n) {\n\tif (isWithoutChildren(node)) return\n\n\tconst sortedChildren = [...node.children].sort((a, b) => compareStringsNaturally(a.segment, b.segment))\n\n\tsortedChildren.forEach((child, index) => {\n\t\tengine.tree.moveNode(child, node.id, index)\n\t\tif (recursive) sortChildrenAlphabetically(child, true, engine)\n\t})\n}\n\n/**\n * Sorts the children of a route segment alphabetically.\n *\n * @param {VekterEngine} engine - The VekterEngine instance.\n * @param {NodeID | null} segmentId - The ID of the segment to sort children of. If not provided, all route segments will be sorted recursively from the segment root node.\n */\nexport function sortRouteSegmentsAlphabetically({\n\tengine,\n\tsegmentId,\n}: {\n\tengine: VekterEngine\n\tsegmentId?: NodeID | null\n}) {\n\tconst routeSegment = segmentId\n\t\t? engine.tree.getNode<RouteSegmentNode>(segmentId)\n\t\t: getRouteSegmentRootNode(engine.tree)\n\tif (!routeSegment) return\n\n\tconst recursive = !segmentId // If no id is provided, sort all route segments.\n\tsortChildrenAlphabetically(routeSegment, recursive, engine)\n}\n", "// This export is kept in a separate file as it\u2019s re-used by end-to-end tests.\nexport const showedInsertTooltipKey = \"showedInsertTooltip\"\n", "import { record } from \"web/lib/tracker.ts\"\nimport { setLocalStorageAndUpdateListeners } from \"web/lib/useLocalStorage.ts\"\nimport { showedInsertTooltipKey } from \"./insertButtonTooltipKey.ts\"\n\nexport function dismissInsertTooltip() {\n\trecord(\"ui_interaction\", { id: \"dismiss_insert_button_tooltip\", page: \"insert_button_tooltip\" })\n\tsetLocalStorageAndUpdateListeners(showedInsertTooltipKey, true)\n}\n", "import type { FramerSiteLinkUpdatePayload } from \"@framerjs/events\"\nimport type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { RichTextNode } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { type WithLinkUpdate, withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getLinkChangesTrackingPayload } from \"./trackLinkChanges.ts\"\nimport { updateRichTextNodeLink } from \"./updateRichTextLink.ts\"\n\nexport const stopTextLinkEditing = () => {\n\tengine.stores.toolStore.editedTextLink = undefined\n}\n\n/**\n * RichText link editing\n */\nexport const updateRichTextLink = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, link: Link | VariableReference | undefined, update: WithLinkUpdate) => {\n\t\tupdateRichTextNodeLink(engine, node, link, update)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nconst updateRichTextAnchorLinkTarget = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, openInNewTab: boolean | VariableReference) => {\n\t\tnode.setLinkOpenInNewTab(openInNewTab, true)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nconst updateRichTextLinkSmoothScroll = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, smoothScroll: boolean | VariableReference) => {\n\t\tnode.setLinkSmoothScroll(smoothScroll, true)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nconst updateRichTextLinkClickTrackingId = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, clickTrackingId: string | VariableReference | undefined) => {\n\t\tnode.setLinkClickTrackingId(clickTrackingId, true)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nconst updateRichTextLinkRelValues = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, relValues: readonly SupportedLinkRelValue[] | VariableReference | undefined) => {\n\t\tnode.setLinkRelValues(relValues, true)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nconst updateRichTextLinkPreserveParams = engine.scheduler.wrapHandler(\n\t(node: RichTextNode, preserveParams: boolean | VariableReference | undefined) => {\n\t\tnode.setLinkPreserveParams(preserveParams, true)\n\n\t\tengine.scheduler.runAtEndOfFrame(() => {\n\t\t\tstopTextLinkEditing()\n\t\t})\n\t},\n)\n\nfunction updateRichTextLinkPart<T extends keyof WithLinkUpdate>(\n\tnode: RichTextNode,\n\tupdateKey: T,\n\tupdateValue: NoInfer<WithLinkUpdate[T]>,\n) {\n\tswitch (updateKey) {\n\t\tcase \"linkOpenInNewTab\":\n\t\t\tupdateRichTextAnchorLinkTarget(node, (updateValue as WithLinkUpdate[\"linkOpenInNewTab\"]) ?? true)\n\t\t\tbreak\n\t\tcase \"linkSmoothScroll\":\n\t\t\tupdateRichTextLinkSmoothScroll(node, (updateValue as WithLinkUpdate[\"linkSmoothScroll\"]) ?? false)\n\t\t\tbreak\n\t\tcase \"linkClickTrackingId\":\n\t\t\tupdateRichTextLinkClickTrackingId(node, updateValue as WithLinkUpdate[\"linkClickTrackingId\"])\n\t\t\tbreak\n\t\tcase \"linkRelValues\":\n\t\t\tupdateRichTextLinkRelValues(node, updateValue as WithLinkUpdate[\"linkRelValues\"])\n\t\t\tbreak\n\t\tcase \"linkPreserveParams\":\n\t\t\tupdateRichTextLinkPreserveParams(node, updateValue as WithLinkUpdate[\"linkPreserveParams\"])\n\t\t\tbreak\n\t}\n}\n\ninterface LinkOptionsUpdate<T extends keyof WithLinkUpdate> {\n\tnodeIds: NodeID[]\n\tlink: Reduced<Link | DynamicValue | undefined>\n\tupdateKey: T\n\tupdateValue: WithLinkUpdate[T]\n\teventPayload: FramerSiteLinkUpdatePayload\n}\n\nexport function updateLinkOptions<T extends keyof WithLinkUpdate>(\n\tengine: BaseEngine,\n\t{ nodeIds, link, updateKey, updateValue, eventPayload }: LinkOptionsUpdate<T>,\n) {\n\tconst nodes = engine.tree.getNodes(nodeIds)\n\n\tconst nodesWithLink = nodes.filter(withLink)\n\tnodesWithLink.forEach(node => node.set({ [updateKey]: updateValue }))\n\n\tconst richTextNodes = nodes.filter(isRichTextNode)\n\tfor (const node of richTextNodes) {\n\t\tupdateRichTextLinkPart(node, updateKey, updateValue)\n\t}\n\n\tconst linkPayload = isLink(link) ? getLinkChangesTrackingPayload(link) : undefined\n\tif (linkPayload && !isVariableReference(updateValue)) {\n\t\trecord(\"site_link_update\", {\n\t\t\t...eventPayload,\n\t\t\tfromType: linkPayload?.linkType,\n\t\t\tfromTarget: linkPayload?.linkTarget,\n\t\t\tfromElement: linkPayload?.linkElement,\n\t\t})\n\t}\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { assert, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport {\n\tstopTextLinkEditing,\n\tupdateLinkOptions,\n\tupdateRichTextLink,\n} from \"document/components/utils/pageLinkHelpers.ts\"\nimport { trackLinkChanges } from \"document/components/utils/trackLinkChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisRichTextNode,\n\tisTextNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithLinkUpdate } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { shouldOpenLinkInNewTab, withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { NotFound, type Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedLink } from \"document/models/CanvasTree/traits/utils/reduceLink.ts\"\nimport { isSupportedLinkRelValueArray } from \"document/models/SupportedRelValue.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { migrateTextToRichTextNode } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React, { useCallback } from \"react\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { isBoolean, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { clearLink, getLinkInfoForRichTextNode } from \"../../links.ts\"\nimport {\n\ttype LinkOptionsVisibility,\n\tgetEventPayloadForLinkOptionsUpdate,\n\tgetLinkOptionsAdditionalMenuItems,\n\tuseLinkOptionVisibility,\n} from \"../utils/linkOptions.ts\"\nimport { LinkOptionRows } from \"./LinkOptionRows.tsx\"\nimport { LinkStylePresetRow } from \"./LinkStylePresetRow.tsx\"\nimport { PageLinkingRows } from \"./PageLinkingRows.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nexport const linkPanelId = \"framerUI-link-panel\"\n\nfunction isValidLinkValue(value: unknown): value is Link | DynamicValue | undefined {\n\treturn isUndefined(value) || isDynamicValue(value) || isLink(value)\n}\n\nfunction isEmptyLink(link: ReducedLink[\"link\"]): boolean {\n\treturn !link || isMixed(link)\n}\n\nconst computedLinkPopoutId = \"computed-link\"\n\ninterface LinkPanelUIProps extends Omit<ReducedLink, \"onlyNodesWithLink\" | \"onlyNodesSupportingLinkVariables\"> {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\ttrackingIdAIPrompt: Reduced<string>\n\tonChange: (link: Link | DynamicValue | undefined) => void\n}\n\nfunction LinkPanelUI({\n\tlink,\n\treadOnly,\n\ttrackingIdAIPrompt,\n\tnodeIds,\n\tonlyNodesWithLinkOptions,\n\tonlyNodesWithLinkSupportingComputedValues,\n\tonChange,\n\t...linkOptions\n}: LinkPanelUIProps) {\n\tconst isValidLink = isLink(link) || isDynamicValue(link) || isMixed(link)\n\n\tconst latestValue = React.useRef(link)\n\tlatestValue.current = link\n\n\tconst deleteLink = React.useCallback(() => {\n\t\tonChange(undefined)\n\t}, [onChange])\n\n\tconst handleLinkChange = useCallback(\n\t\t(value: Link | DynamicValue | undefined) => {\n\t\t\tif (!isValidLinkValue(value)) return\n\t\t\tif (value === latestValue.current) return\n\t\t\t// The handler can be called during unmount, so we need to handle\n\t\t\t// the event outside of React lifecycle.\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tonChange(value)\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst supportsFetchDataValues = useEngineState(\n\t\t() => {\n\t\t\tif (!onlyNodesWithLinkSupportingComputedValues) return false\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\t\t\treturn !isWebPageNode(activeScope) && !isLayoutTemplateNode(activeScope)\n\t\t},\n\t\t[],\n\t\t[engine.stores.scopeStore],\n\t)\n\n\tconst visibility = useLinkOptionVisibility(link, linkOptions)\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<LinkPanelHeader\n\t\t\t\t\tlink={link}\n\t\t\t\t\tcanAddOption={!readOnly && onlyNodesWithLinkOptions}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tvisibility={visibility}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t{...linkOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<PageLinkingRows\n\t\t\t\tlink={link}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonChange={handleLinkChange}\n\t\t\t\tonDelete={!readOnly && isValidLink ? deleteLink : undefined}\n\t\t\t\tsupportsPageLinks={\n\t\t\t\t\tengine.stores.scopeStore.scopeType !== ScopeType.CanvasPage &&\n\t\t\t\t\tengine.stores.scopeStore.scopeType !== ScopeType.DesignPage\n\t\t\t\t}\n\t\t\t\tsupportsVariables\n\t\t\t\tsupportsSlugVariables\n\t\t\t\tsupportsComputedValues={onlyNodesWithLinkSupportingComputedValues}\n\t\t\t\tcomputedValuePopoutId={computedLinkPopoutId}\n\t\t\t\tsupportsFetchDataValues={supportsFetchDataValues}\n\t\t\t/>\n\t\t\t{isValidLink && onlyNodesWithLinkOptions && (\n\t\t\t\t<LinkOptionRows\n\t\t\t\t\t{...linkOptions}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tlink={link}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\ttrackingIdAIPrompt={trackingIdAIPrompt}\n\t\t\t\t\tvisibility={visibility}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{isValidLink && <LinkStylePresetRow />}\n\t\t</Panel>\n\t)\n}\n\ninterface LinkPanelHeaderProps extends Omit<\n\tLinkPanelUIProps,\n\t\"onChange\" | \"trackingIdAIPrompt\" | \"onlyNodesWithLinkOptions\" | \"onlyNodesWithLinkSupportingComputedValues\"\n> {\n\tcanAddOption: boolean\n\tvisibility: LinkOptionsVisibility\n}\nconst LinkPanelHeader = React.memo(function LinkPanelHeader({\n\tlink,\n\tcanAddOption,\n\tnodeIds,\n\tvisibility,\n\treadOnly,\n\t...linkOptions\n}: LinkPanelHeaderProps) {\n\tconst displayMenu = canAddOption\n\t\t? (event: React.MouseEvent) => {\n\t\t\t\tconst menuItems = getLinkOptionsAdditionalMenuItems(link, linkOptions, visibility, (updateKey, updateValue) => {\n\t\t\t\t\tassert(updateKey in linkOptions, \"updateKey must be a valid link option\")\n\n\t\t\t\t\tupdateLinkOptions(engine, {\n\t\t\t\t\t\tnodeIds,\n\t\t\t\t\t\tlink,\n\t\t\t\t\t\tupdateKey,\n\t\t\t\t\t\tupdateValue,\n\t\t\t\t\t\teventPayload: getEventPayloadForLinkOptionsUpdate(updateKey, updateValue, linkOptions),\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t\t\t}\n\t\t: undefined\n\tconst buttonAction = !readOnly ? displayMenu : undefined\n\tconst hasButtonAction = Boolean(buttonAction)\n\n\treturn (\n\t\t<PanelSectionHeader\n\t\t\tid={linkPanelId}\n\t\t\ttitle={<T>{Dictionary.Link}</T>}\n\t\t\tclickable={hasButtonAction}\n\t\t\tonMouseDown={buttonAction}\n\t\t>\n\t\t\t{hasButtonAction && (\n\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t)}\n\t\t</PanelSectionHeader>\n\t)\n})\n\nfunction NodeLinkPanel({\n\tlink,\n\treadOnly,\n\tlinkOpenInNewTab,\n\tlinkSmoothScroll,\n\tlinkClickTrackingId,\n\tlinkRelValues,\n\tlinkPreserveParams,\n\ttrackingIdAIPrompt,\n\tnodeIds,\n\tonlyNodesWithLinkOptions,\n\tonlyNodesWithLinkSupportingComputedValues,\n\tanyExternalLinks,\n\tanyScrollTargets,\n}: Omit<Props, \"tool\">) {\n\tconst onChange = useEngineCallback(\n\t\t(value: Link | DynamicValue | undefined) => {\n\t\t\tconst newValueIsEmptyLink = isEmptyLink(value)\n\t\t\tconst newLink = newValueIsEmptyLink ? undefined : value\n\t\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\n\t\t\tlet openInNewTab: boolean | undefined = undefined\n\n\t\t\t/**\n\t\t\t * Before we introduce the `linkOpenInNewTab` prop, our code was\n\t\t\t * already using different anchor targets, depending on if the link\n\t\t\t * is an external one. To reflect that in the new UI (without a\n\t\t\t * migration), we infer the fallback `linkOpenInNewTab` value when\n\t\t\t * reducing the prop, by checking if `node.link` is a Framer page\n\t\t\t * link. This line of code is an on-demand migration, so that we\n\t\t\t * could actually initialize the `linkOpenInNewTab` prop with the\n\t\t\t * inferred value whenever you update the link.\n\t\t\t */\n\t\t\tif (isBoolean(linkOpenInNewTab)) {\n\t\t\t\topenInNewTab = linkOpenInNewTab\n\t\t\t}\n\t\t\t/**\n\t\t\t * If it is the first time you add a link to the node, we also\n\t\t\t * initialize the `linkOpenInNewTab` prop based on the new link.\n\t\t\t */\n\t\t\tif (!link && newLink) {\n\t\t\t\topenInNewTab = shouldOpenLinkInNewTab(value)\n\t\t\t}\n\n\t\t\tconst updates: WithLinkUpdate = {}\n\t\t\tif (isBoolean(openInNewTab)) {\n\t\t\t\tupdates.linkOpenInNewTab = openInNewTab\n\t\t\t}\n\n\t\t\tif (isSupportedLinkRelValueArray(linkRelValues)) {\n\t\t\t\tupdates.linkRelValues = linkRelValues\n\t\t\t}\n\n\t\t\tif (isBoolean(linkPreserveParams)) {\n\t\t\t\tupdates.linkPreserveParams = linkPreserveParams\n\t\t\t}\n\n\t\t\tif (isString(linkClickTrackingId)) {\n\t\t\t\tupdates.linkClickTrackingId = linkClickTrackingId\n\t\t\t}\n\n\t\t\tconst newSelection = new Set(engine.stores.selectionStore.ids)\n\t\t\tfor (const node of nodes) {\n\t\t\t\t// RichTextNode's handle link updates into the prosemirror\n\t\t\t\t// schema, rather than the WithLink trait.\n\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\tassert(!isComputedValue(newLink))\n\t\t\t\t\tupdateRichTextLink(node, newLink, updates)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// TextNode's need to be migrated to RichTextNodes when adding\n\t\t\t\t// links.\n\t\t\t\tif (isTextNode(node)) {\n\t\t\t\t\tconst migrationInfo = migrateTextToRichTextNode(engine, node)\n\t\t\t\t\tif (!migrationInfo) continue\n\n\t\t\t\t\tconst { idToSelect, richTextNode } = migrationInfo\n\t\t\t\t\tassert(!isComputedValue(newLink))\n\t\t\t\t\tupdateRichTextLink(richTextNode, newLink, updates)\n\t\t\t\t\tnewSelection.delete(node.id)\n\t\t\t\t\tnewSelection.add(idToSelect)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (withLink(node)) {\n\t\t\t\t\tnode.set({ link: newLink, ...updates })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst currentSelection = new Set(engine.stores.selectionStore.ids)\n\t\t\tif (!isShallowEqual(newSelection, currentSelection)) {\n\t\t\t\tengine.stores.selectionStore.set(newSelection)\n\t\t\t}\n\n\t\t\ttrackLinkChanges(link, newLink)\n\t\t},\n\t\t[nodeIds, link, linkOpenInNewTab, linkClickTrackingId, linkRelValues, linkPreserveParams],\n\t)\n\n\treturn (\n\t\t<LinkPanelUI\n\t\t\treadOnly={readOnly}\n\t\t\tlink={link}\n\t\t\tlinkOpenInNewTab={linkOpenInNewTab}\n\t\t\tlinkSmoothScroll={linkSmoothScroll}\n\t\t\tlinkClickTrackingId={linkClickTrackingId}\n\t\t\tlinkRelValues={linkRelValues}\n\t\t\tlinkPreserveParams={linkPreserveParams}\n\t\t\ttrackingIdAIPrompt={trackingIdAIPrompt}\n\t\t\tnodeIds={nodeIds}\n\t\t\tonlyNodesWithLinkOptions={onlyNodesWithLinkOptions}\n\t\t\tonlyNodesWithLinkSupportingComputedValues={onlyNodesWithLinkSupportingComputedValues}\n\t\t\tonChange={onChange}\n\t\t\tanyExternalLinks={anyExternalLinks}\n\t\t\tanyScrollTargets={anyScrollTargets}\n\t\t/>\n\t)\n}\n\nfunction useSelectedTextEditNode(nodeIds: NodeID[]): RichTextNode | null {\n\treturn useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => {\n\t\t\tif (nodeIds.length !== 1) return null\n\n\t\t\tconst nodeId = nodeIds[0]\n\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\treturn isRichTextNode(node) ? node : null\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\ninterface TextEditLinkPanelProps extends Pick<\n\tReducedLink,\n\t\"onlyNodesWithLinkOptions\" | \"anyExternalLinks\" | \"anyScrollTargets\"\n> {\n\tnodeIds: NodeID[]\n\ttool: Tools\n\treadOnly: boolean\n}\n\nconst updateRichTextNodeLink = engine.scheduler.wrapHandler((nodeId: string, update: WithLinkUpdate) => {\n\tconst updatedNode = engine.tree.getNode(nodeId)\n\tif (!isRichTextNode(updatedNode)) return\n\n\tupdateRichTextLink(updatedNode, engine.stores.toolStore.editedTextLink, update)\n\tstopTextLinkEditing()\n})\n\nfunction TextEditLinkPanel({ tool, nodeIds, ...props }: TextEditLinkPanelProps) {\n\tconst node = useSelectedTextEditNode(nodeIds)\n\tconst nodeId = node?.id\n\tconst textLink = engine.stores.toolStore.useState(state => state.textLink)\n\tconst linkInfo = getLinkInfoForRichTextNode(node, tool, textLink)\n\tconst openInNewTab = linkInfo?.openInNewTab\n\tconst clickTrackingId = linkInfo?.clickTrackingId\n\tconst relValues = linkInfo?.relValues\n\tconst trackingIdAIPrompt = linkInfo?.trackingIdAIPrompt\n\tconst linkPreserveParams = linkInfo?.preserveParams\n\n\tconst onChange = useEngineCallback(\n\t\t(value: Link | VariableReference | undefined) => {\n\t\t\tif (!nodeId) return\n\n\t\t\tif (isUndefined(value)) {\n\t\t\t\tclearLink(nodeId, null)\n\t\t\t} else {\n\t\t\t\tengine.stores.toolStore.editedTextLink = value\n\t\t\t\tupdateRichTextNodeLink(nodeId, {\n\t\t\t\t\tlinkOpenInNewTab: openInNewTab ?? shouldOpenLinkInNewTab(value),\n\t\t\t\t\tlinkClickTrackingId: clickTrackingId,\n\t\t\t\t\tlinkRelValues: relValues,\n\t\t\t\t\tlinkPreserveParams: linkPreserveParams,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeId, clickTrackingId, openInNewTab, relValues, linkPreserveParams],\n\t)\n\n\tif (!node) return null\n\n\treturn (\n\t\t<LinkPanelUI\n\t\t\t{...props}\n\t\t\tnodeIds={nodeIds}\n\t\t\tlink={linkInfo?.value}\n\t\t\tlinkOpenInNewTab={openInNewTab}\n\t\t\tlinkSmoothScroll={linkInfo?.smoothScroll}\n\t\t\tlinkClickTrackingId={clickTrackingId}\n\t\t\tlinkRelValues={relValues}\n\t\t\tlinkPreserveParams={linkPreserveParams}\n\t\t\ttrackingIdAIPrompt={trackingIdAIPrompt || NotFound}\n\t\t\tonChange={onChange}\n\t\t\tonlyNodesWithLinkSupportingComputedValues={false}\n\t\t/>\n\t)\n}\n\ninterface Props extends Omit<ReducedLink, \"onlyNodesWithLink\" | \"onlyNodesSupportingLinkVariables\"> {\n\tnodeIds: NodeID[]\n\ttool: Tools\n\treadOnly: boolean\n\ttrackingIdAIPrompt: Reduced<string>\n}\n\nexport const LinkPanel = React.memo(function LinkPanel({ tool, ...props }: Props) {\n\tif (tool === Tools.RichTextEdit) {\n\t\treturn (\n\t\t\t<TextEditLinkPanel\n\t\t\t\ttool={tool}\n\t\t\t\tnodeIds={props.nodeIds}\n\t\t\t\tonlyNodesWithLinkOptions={props.onlyNodesWithLinkOptions}\n\t\t\t\tanyExternalLinks={props.anyExternalLinks}\n\t\t\t\tanyScrollTargets={props.anyScrollTargets}\n\t\t\t\treadOnly={props.readOnly}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn <NodeLinkPanel {...props} />\n})\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { isEmptyObject } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { isOpenURLAction } from \"document/models/CanvasTree/actions/openURLActions.ts\"\nimport type { CanvasNode, CodeComponentNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { frameEventKeys, withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport type { WithLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { hasLink, withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { makeAiPromptForLinkClickTrackingId } from \"document/models/CanvasTree/traits/utils/reduceTrackingIdAIPrompt.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlPropKey, prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { isArray, isUndefined } from \"utils/typeChecks.ts\"\nimport { stopTextLinkEditing } from \"../utils/pageLinkHelpers.ts\"\n\nexport function codeComponentHasLinksDefinition(node: CodeComponentNode, componentLoader: AnyComponentLoader): boolean {\n\tconst definition = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tfor (const key in definition?.properties) {\n\t\tif (definition?.properties[key]?.type === ControlType.Link) return true\n\t}\n\n\treturn false\n}\n\ninterface LinkInfo {\n\tvalue: Link | VariableReference | undefined\n\topenInNewTab?: boolean | VariableReference\n\tsmoothScroll?: boolean | VariableReference\n\tclickTrackingId?: string | VariableReference\n\ttrackingIdAIPrompt: string | undefined\n\tcontrolPropKey?: string\n\trelValues?: readonly SupportedLinkRelValue[] | VariableReference\n\tpreserveParams?: boolean | VariableReference\n}\n\nexport function getLinkInfoForRichTextNode(\n\tnode: RichTextNode | null,\n\ttool: Tools,\n\ttextLink: Link | VariableReference | null,\n): LinkInfo | null {\n\tif (!node) return null\n\n\tif (tool === Tools.RichTextEdit) {\n\t\t// We do not support open in new tab and smooth scroll on legacy\n\t\t// TextNode. The UI won't be shown, here we just return undefined.\n\t\tconst openInNewTabs = isRichTextNode(node) ? node.getLinkOpenInNewTabs(true) : undefined\n\t\tconst smoothScrolls = isRichTextNode(node) ? node.getLinkSmoothScroll(true) : undefined\n\t\tconst clickTrackingIds = isRichTextNode(node) ? node.getLinkClickTrackingId(true) : undefined\n\t\tconst relValues = isRichTextNode(node) ? node.getLinkRelValues(true) : undefined\n\t\tconst preserveParams = isRichTextNode(node) ? node.getLinkPreserveParams(true) : undefined\n\n\t\tif (isVariableReference(textLink) || isLink(textLink)) {\n\t\t\tconst linkText = node.getSelectionText()\n\t\t\tconst textContent = node.getTextContent()\n\t\t\tconst link = isLink(textLink) ? textLink : undefined\n\t\t\treturn {\n\t\t\t\tvalue: textLink,\n\t\t\t\topenInNewTab: openInNewTabs?.[0] ?? false,\n\t\t\t\tsmoothScroll: smoothScrolls?.[0] ?? false,\n\t\t\t\tclickTrackingId: clickTrackingIds?.[0],\n\t\t\t\trelValues: relValues?.[0] ?? [],\n\t\t\t\tpreserveParams: preserveParams?.[0] ?? false,\n\t\t\t\ttrackingIdAIPrompt: makeAiPromptForLinkClickTrackingId(engine.tree, { textContent, linkText, link }),\n\t\t\t}\n\t\t}\n\t} else if (isRichTextNode(node)) {\n\t\tconst links = node.getLinks(true)\n\t\tconst openInNewTabs = node.getLinkOpenInNewTabs(true)\n\t\tconst smoothScrolls = node.getLinkSmoothScroll(true)\n\t\tconst clickTrackingIds = node.getLinkClickTrackingId(true)\n\t\tconst relValues = node.getLinkRelValues(true)\n\t\tconst preserveParams = node.getLinkPreserveParams(true)\n\n\t\tif (links.length === 1 && !isUndefined(links[0])) {\n\t\t\tconst linkText = node.getSelectionText()\n\t\t\tconst textContent = node.getTextContent()\n\t\t\tconst link = isLink(links[0]) ? links[0] : undefined\n\t\t\treturn {\n\t\t\t\tvalue: links[0],\n\t\t\t\topenInNewTab: openInNewTabs[0],\n\t\t\t\tsmoothScroll: smoothScrolls[0],\n\t\t\t\tclickTrackingId: clickTrackingIds[0],\n\t\t\t\trelValues: relValues[0],\n\t\t\t\tpreserveParams: preserveParams[0],\n\t\t\t\ttrackingIdAIPrompt: makeAiPromptForLinkClickTrackingId(engine.tree, { textContent, linkText, link }),\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\n/**\n * Clear the link from any node that supports linking.\n */\nexport const clearLink = engine.scheduler.wrapHandler(\n\t(nodeId: string, linkInfo: LinkInfo | null, onDone?: () => void) => {\n\t\tconst updatedNode = engine.tree.get(nodeId)\n\t\tif (!updatedNode) return\n\n\t\tif (isRichTextNode(updatedNode)) {\n\t\t\tupdatedNode.removeLink(true)\n\t\t\tstopTextLinkEditing()\n\t\t} else if (isCodeComponentNode(updatedNode)) {\n\t\t\tclearLinkOnCodeComponent(updatedNode, linkInfo)\n\t\t} else if (withFrameEvents(updatedNode) && withLink(updatedNode) && !hasLink(updatedNode)) {\n\t\t\tclearLinkOnFrame(updatedNode)\n\t\t} else if (withLink(updatedNode)) {\n\t\t\tupdatedNode.set({ link: undefined })\n\t\t}\n\n\t\tonDone?.()\n\t},\n)\n\nfunction clearLinkOnFrame(node: CanvasNode & WithFrameEvents & WithLink) {\n\t// Frames can have old OpenUrlActions. We need to support clearing\n\t// these links if the node's link hasn't been updated and migrated\n\t// to node.link.\n\tconst update: Record<string, EventAction[]> = {}\n\tframeEventKeys.forEach(eventKey => {\n\t\tconst value = node[eventKey]\n\t\tif (!Array.isArray(value)) return\n\t\tconst withoutOpenURLActions = value.filter((action: EventAction) => !isOpenURLAction(action))\n\t\tif (withoutOpenURLActions.length === value.length) return\n\t\tupdate[eventKey] = withoutOpenURLActions\n\t})\n\tif (Object.keys(update).length) {\n\t\tnode.set(update)\n\t}\n}\n\nfunction clearLinkOnCodeComponent(node: CodeComponentNode, linkInfo: LinkInfo | null) {\n\tif (linkInfo?.controlPropKey) {\n\t\tnode.set({ [prefixControlPropKey(linkInfo.controlPropKey)]: undefined })\n\t\treturn\n\t}\n\n\tconst update: Mutable<ControlProps> = {}\n\tObject.entries(node.getRawControlProps()).forEach(([propKey, prop]) => {\n\t\tif (!prop || prop.type !== ControlType.EventHandler) return\n\t\tif (!isArray(prop.value)) return\n\t\tconst withoutOpenURLActions = prop.value.filter((action): action is EventAction => !isOpenURLAction(action))\n\t\tif (withoutOpenURLActions.length === prop.value.length) return\n\t\tupdate[propKey] = { type: ControlType.EventHandler, value: withoutOpenURLActions }\n\t})\n\n\tif (!isEmptyObject(update)) {\n\t\tnode.set(prefixControlProps(update))\n\t}\n}\n", "import { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { updateLinkOptions } from \"document/components/utils/pageLinkHelpers.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { type Reduced, isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { type SupportedLinkRelValue, isSupportedLinkRelValueArray } from \"document/models/SupportedRelValue.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isBoolean, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { LinkOptionsVisibility } from \"../utils/linkOptions.ts\"\nimport { OpenInNewTabRow, PreserveParamsRow, SmoothScrollRow } from \"./LinkOptionBooleanRow.tsx\"\nimport { LinkRelValuesRow } from \"./LinkRelValuesRow.tsx\"\nimport { TrackingIdRow } from \"./TrackingIdRow.tsx\"\n\ninterface LinkOptionProps {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\tlink: Reduced<Link | DynamicValue | undefined>\n\tvisibility: LinkOptionsVisibility\n\tlinkOpenInNewTab: Reduced<boolean | VariableReference | undefined>\n\tlinkSmoothScroll: Reduced<boolean | VariableReference | undefined>\n\tlinkClickTrackingId: Reduced<string | VariableReference | undefined>\n\tlinkRelValues: Reduced<readonly SupportedLinkRelValue[] | VariableReference | undefined>\n\tlinkPreserveParams: Reduced<boolean | VariableReference | undefined>\n\ttrackingIdAIPrompt: Reduced<string>\n}\n\nexport const LinkOptionRows = React.memo(function LinkOptionRows({\n\tnodeIds,\n\treadOnly,\n\tlink,\n\tlinkOpenInNewTab,\n\tlinkSmoothScroll = false,\n\tlinkClickTrackingId,\n\ttrackingIdAIPrompt,\n\tlinkRelValues,\n\tlinkPreserveParams,\n\tvisibility,\n}: LinkOptionProps) {\n\tconst engine = useBaseEngine()\n\n\tconst onChangeOpenInNewTab = useEngineCallback(\n\t\t(value: boolean | VariableReference | undefined) => {\n\t\t\tif (isUndefined(value) || readOnly) return\n\n\t\t\tupdateLinkOptions(engine, {\n\t\t\t\tnodeIds,\n\t\t\t\tlink,\n\t\t\t\tupdateKey: \"linkOpenInNewTab\",\n\t\t\t\tupdateValue: value,\n\t\t\t\teventPayload: {\n\t\t\t\t\tfromNewTab: isBoolean(linkOpenInNewTab) ? linkOpenInNewTab : undefined,\n\t\t\t\t\ttoNewTab: isVariableReference(value) ? undefined : value,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[link, linkOpenInNewTab, nodeIds, readOnly],\n\t)\n\n\tconst onChangeSmoothScroll = useEngineCallback(\n\t\t(value: boolean | VariableReference | undefined) => {\n\t\t\tif (isUndefined(value) || readOnly) return\n\n\t\t\tupdateLinkOptions(engine, {\n\t\t\t\tnodeIds,\n\t\t\t\tlink,\n\t\t\t\tupdateKey: \"linkSmoothScroll\",\n\t\t\t\tupdateValue: value,\n\t\t\t\teventPayload: {\n\t\t\t\t\tfromSmoothScroll: isBoolean(linkSmoothScroll) ? linkSmoothScroll : undefined,\n\t\t\t\t\ttoSmoothscroll: isVariableReference(value) ? undefined : value,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[link, linkSmoothScroll, nodeIds, readOnly],\n\t)\n\n\tconst onChangeRelValues = useEngineCallback(\n\t\t(value: readonly SupportedLinkRelValue[] | VariableReference | undefined) => {\n\t\t\tif (readOnly) return\n\n\t\t\tupdateLinkOptions(engine, {\n\t\t\t\tnodeIds,\n\t\t\t\tlink,\n\t\t\t\tupdateKey: \"linkRelValues\",\n\t\t\t\tupdateValue: value,\n\t\t\t\teventPayload: {\n\t\t\t\t\tfromLinkRelValues: isSupportedLinkRelValueArray(linkRelValues) ? linkRelValues.join(\" \") : undefined,\n\t\t\t\t\ttoLinkRelValues: isSupportedLinkRelValueArray(value) ? value.join(\" \") : undefined,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[link, linkRelValues, nodeIds, readOnly],\n\t)\n\n\tconst onChangeClickTrackingId = useEngineCallback(\n\t\t(value: string | VariableReference | undefined) => {\n\t\t\tif (readOnly) return\n\n\t\t\tupdateLinkOptions(engine, {\n\t\t\t\tnodeIds,\n\t\t\t\tlink,\n\t\t\t\tupdateKey: \"linkClickTrackingId\",\n\t\t\t\tupdateValue: value,\n\t\t\t\teventPayload: {\n\t\t\t\t\tfromLinkClickTrackingId: isString(linkClickTrackingId) ? linkClickTrackingId : undefined,\n\t\t\t\t\ttoLinkClickTrackingId: isVariableReference(value) ? undefined : value,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[link, linkClickTrackingId, nodeIds, readOnly],\n\t)\n\n\tconst onChangePreserveParams = useEngineCallback(\n\t\t(value: boolean | VariableReference | undefined) => {\n\t\t\tif (readOnly) return\n\n\t\t\tupdateLinkOptions(engine, {\n\t\t\t\tnodeIds,\n\t\t\t\tlink,\n\t\t\t\tupdateKey: \"linkPreserveParams\",\n\t\t\t\tupdateValue: value,\n\t\t\t\teventPayload: {\n\t\t\t\t\tfromLinkPreserveParams: isBoolean(linkPreserveParams) ? linkPreserveParams : undefined,\n\t\t\t\t\ttoLinkPreserveParams: isVariableReference(value) ? undefined : value,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[link, linkPreserveParams, nodeIds, readOnly],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t{visibility.linkOpenInNewTab && (\n\t\t\t\t<OpenInNewTabRow supportsVariables value={linkOpenInNewTab} onChange={onChangeOpenInNewTab} />\n\t\t\t)}\n\n\t\t\t{visibility.linkSmoothScroll && (\n\t\t\t\t<SmoothScrollRow supportsVariables value={linkSmoothScroll} onChange={onChangeSmoothScroll} />\n\t\t\t)}\n\n\t\t\t{visibility.linkRelValues && (\n\t\t\t\t<LinkRelValuesRow readOnly={readOnly} value={linkRelValues} onChange={onChangeRelValues} />\n\t\t\t)}\n\n\t\t\t{visibility.linkPreserveParams && (\n\t\t\t\t<PreserveParamsRow supportsVariables value={linkPreserveParams} onChange={onChangePreserveParams} />\n\t\t\t)}\n\n\t\t\t{/* TODO - Let's move the value checking into the calculation of the visibility */}\n\t\t\t{visibility.linkClickTrackingId && isFoundAndNotUndefined(linkClickTrackingId) && (\n\t\t\t\t<TrackingIdRow\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tonChange={onChangeClickTrackingId}\n\t\t\t\t\ttrackingId={linkClickTrackingId}\n\t\t\t\t\taiPrompt={trackingIdAIPrompt}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { colors, palette } from \"@framerjs/fresco/tokens\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { isLinkStylePresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useMemo } from \"react\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { getLinkStylePresetsTitle } from \"../rows/SelectNodeLinkStylePresetRow.tsx\"\nimport { SelectLinkStyleEntityAssetPopout } from \"./SelectLinkStyleEntityAssetPopout.tsx\"\n\nconst EMPTY_IDS: string[] = []\n\nexport function LinkStylePresetRow() {\n\tconst linkStylePresetsState = useLinkStylePresetsState()\n\n\tconst nodeId = linkStylePresetsState?.nodeId\n\tconst nodeIds = useMemo(() => {\n\t\tif (isUndefined(nodeId)) return EMPTY_IDS\n\t\treturn [nodeId]\n\t}, [nodeId])\n\n\tif (isNull(linkStylePresetsState)) return null\n\n\treturn (\n\t\t<PanelRow title=\"Style\">\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tid=\"linkStylePreset\"\n\t\t\t\tnavigationTitle=\"Link Styles\"\n\t\t\t\ttitle={linkStylePresetsState.title}\n\t\t\t\ttitleColor={linkStylePresetsState.titleColor}\n\t\t\t\tpopout={<SelectLinkStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={linkStylePresetsState.presets} />}\n\t\t\t\tpreview={<PresetIconInverted foreground={linkStylePresetsState.previewBackgroundColor} icon=\"a\" />}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction useLinkStylePresetsState() {\n\treturn useDeprecatedEngineState([EngineChange.Tree, engine.stores.selectionStore], () => {\n\t\tif (engine.stores.selectionStore.ids.length !== 1) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst [nodeId] = engine.stores.selectionStore.ids\n\t\tconst node = engine.tree.get(nodeId)\n\t\tif (!node || !isRichTextNode(node)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst presets = node.getLinkStylePresets(true)\n\t\tconst presetNodes = engine.tree.getNodesWithTrait(presets, isLinkStylePresetNode)\n\t\tconst previewBackgroundColor = getPreviewBackgroundColor(presets)\n\t\tconst title = getLinkStylePresetsTitle(presetNodes)\n\t\tconst titleColor = presetNodes.length === 0 ? colors.popoutButtonTextPlaceholder : undefined\n\n\t\treturn {\n\t\t\tnodeId,\n\t\t\tpresets,\n\t\t\ttitle,\n\t\t\ttitleColor,\n\t\t\tpreviewBackgroundColor,\n\t\t}\n\t})\n}\n\nfunction getPreviewBackgroundColor(presets: Set<string | undefined>): string | undefined {\n\tif (presets.size > 1) return palette.blue60\n\n\tconst [presetId] = presets\n\tif (!presetId) return undefined\n\n\tconst preset = engine.tree.getNodeWithTrait(presetId, isLinkStylePresetNode)\n\tif (!preset) return undefined\n\n\treturn preset.linkTextColor\n}\n", "import { palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { useMemo } from \"react\"\nimport { getDefaultLinkStylePreset, insertLinkStylePreset } from \"utils/linkStylePresetUtils.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PresetIcon, PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport { SelectLinkStyleEntityAssetPopout, selectLinkStylePreset } from \"../panels/SelectLinkStyleEntityAssetPopout.tsx\"\nimport { useLinkStylePresets } from \"../panels/utils/useLinkStylePresets.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst selectLinkStylePresetPopoutId = \"selectLinkStylePresetPopoutId\"\nconst traitTypeKeys = [\"stylePresetLink\"] as const\n\nexport function addLinkStylePreset(nodeIds: string[]) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst preset = getDefaultLinkStylePreset(engine.tree) ?? LinkStylePresetNode.createDefault()\n\t\tinsertLinkStylePreset(engine, preset)\n\t\tselectLinkStylePreset(nodeIds, preset)\n\t\tpopoutWindow.navigation.presentPopout(selectLinkStylePresetPopoutId)\n\t})\n}\n\nexport function SelectNodeLinkStylePresetRow({ nodeIds, selectedIds }: Props) {\n\tconst presets = useLinkStylePresets()\n\n\tconst selectedPresets = useMemo(\n\t\t() =>\n\t\t\tpresets.filter(preset => {\n\t\t\t\treturn selectedIds.has(preset.id)\n\t\t\t}),\n\n\t\t[presets, selectedIds],\n\t)\n\n\tconst commonLinkColor = useMemo(() => {\n\t\tlet linkColor: string | undefined\n\n\t\tfor (const preset of selectedPresets) {\n\t\t\tlinkColor ??= preset.linkTextColor\n\n\t\t\tif (preset.linkTextColor !== linkColor) {\n\t\t\t\tlinkColor = palette.blue60\n\t\t\t}\n\t\t}\n\n\t\treturn linkColor ?? palette.blue60\n\t}, [selectedPresets])\n\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetLink: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Link\" traitTypeKeys={traitTypeKeys}>\n\t\t\t{selectedPresets.length > 0 ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tid={selectLinkStylePresetPopoutId}\n\t\t\t\t\tnavigationTitle=\"Link Styles\"\n\t\t\t\t\ttitle={getLinkStylePresetsTitle(selectedPresets)}\n\t\t\t\t\tpopout={<SelectLinkStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\t\tpreview={<PresetIconInverted foreground={commonLinkColor} icon=\"a\" />}\n\t\t\t\t\tonDelete={deselectPreset}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"preset\"\n\t\t\t\t\ticon={<PresetIcon icon=\"a\" />}\n\t\t\t\t\tonMouseDown={addLinkStylePreset(nodeIds)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nexport function getLinkStylePresetsTitle(presets: LinkStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.AddEllipsis\n\n\treturn preset.getName()\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\n\nconst emptyResult: LinkStylePresetNode[] = []\n\nexport function useLinkStylePresets() {\n\treturn useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\tconst listNode = PresetsListNode.get(engine.tree)\n\t\tif (!listNode) return emptyResult\n\n\t\treturn listNode.getLinkStylePresets()\n\t})\n}\n", "import { popoutWindow } from \"../PopoutWindow.tsx\"\n\nexport const mainFontPopoutId = \"typeface-popout\"\n\nexport const canToggleFontPopout = () => {\n\treturn popoutWindow.navigation.popoutIsRegistered(mainFontPopoutId)\n}\n\nexport const toggleFontPopout = () => {\n\tif (popoutWindow.navigation.isPresenting(mainFontPopoutId)) {\n\t\tpopoutWindow.close()\n\t} else {\n\t\tpopoutWindow.navigation.presentPopout(mainFontPopoutId)\n\t}\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isRichTextNode, isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { isGestureOrGestureVariantChild } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { codeComponentHasLinksDefinition } from \"../chrome/links.ts\"\n\nexport function canAddPageLink(componentLoader: ComponentLoader, nodes: CanvasNode[]): boolean {\n\tif (nodes.length !== 1) return false\n\tconst node = nodes[0]\n\tif (isGestureOrGestureVariantChild(node)) return false\n\n\tif (isRichTextNode(node)) {\n\t\t// RichText variables can contain links but they are edited by the RichTextEditorWithToolbar.\n\t\treturn !node.htmlContent\n\t}\n\n\tif (isTextNode(node)) {\n\t\treturn true\n\t}\n\n\t// Otherwise if the node is a code component, we can support links of the\n\t// component defines any ControlType.Link property controls.\n\tif (isCodeComponentNode(node)) {\n\t\treturn codeComponentHasLinksDefinition(node, componentLoader)\n\t}\n\n\treturn withLink(node)\n}\n", "import ShapeGroupNode from \"../nodes/ShapeGroupNode.ts\"\nimport type { VectorNode } from \"../nodes/TreeNode.ts\"\nimport type { BooleanShapeNode } from \"../nodes/shapes/BooleanShapeNode.ts\"\n\n// Exclude incorrectly removes BooleanShapeNode because it's a subtype of ShapeGroupNode.\ntype StyleSourceNode = Exclude<VectorNode, ShapeGroupNode> | BooleanShapeNode\n\nexport function getStyleSourceNodeFromVectorNodes(\n\tnodes: Iterable<VectorNode>,\n\t// BooleanShapeNode has children like ShapeGroupNode but is itself a style\n\t// source, not just a container, so it's included in the return type.\n): StyleSourceNode | null {\n\tfor (const node of nodes) {\n\t\tif (node instanceof ShapeGroupNode) {\n\t\t\tconst styleSourceNode = getStyleSourceNodeFromVectorNodes(node.children)\n\t\t\tif (styleSourceNode !== null) {\n\t\t\t\treturn styleSourceNode\n\t\t\t} // else continue\n\t\t} else {\n\t\t\treturn node\n\t\t}\n\t}\n\treturn null\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { copyShapeStyle } from \"document/components/tools/pathEdit/utils/index.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { BooleanShapeNode, CanvasNode, VectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { PathBooleanType, WithPathBoolean } from \"document/models/CanvasTree/traits/WithPathBoolean.ts\"\nimport { withBooleanPath } from \"document/models/CanvasTree/traits/WithPathBoolean.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { getStyleSourceNodeFromVectorNodes } from \"document/models/CanvasTree/utils/getStyleSourceNodeFromVectorNodes.ts\"\nimport { getFirstItemFromIterable } from \"utils/getFirstItemFromIterable.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\n\nexport const performShapeBooleanAction = engine.scheduler.wrapHandler(\n\t(nodes: CanvasNode[], nodesWithoutDescendants: CanvasNode[], pathBoolean: PathBooleanType) => {\n\t\tif (nodes.length === 1 && nodes[0] && withBooleanPath(nodes[0])) {\n\t\t\tif (nodes[0].originalid) return\n\t\t\ttoggleBooleanType(nodes[0], pathBoolean)\n\t\t} else if (nodesWithoutDescendants.length > 1) {\n\t\t\tcreateBooleanCompound(nodesWithoutDescendants, pathBoolean)\n\t\t}\n\t},\n)\n\nfunction toggleBooleanType(node: CanvasNode & WithPathBoolean, pathBoolean: PathBooleanType) {\n\tif (node.pathBoolean === pathBoolean) {\n\t\tif (ContextAction.canUngroup(engine.tree, [node])) {\n\t\t\tContextAction.ungroup(engine, [node])\n\t\t}\n\t\treturn\n\t}\n\n\tengine.tree.current(node)?.set({ pathBoolean })\n}\n\nfunction createBooleanCompound(withoutDescendants: CanvasNode[], pathBoolean: PathBooleanType) {\n\tconst booleanNodes = booleanableNodes(withoutDescendants)\n\tif (booleanNodes.length === 0) return\n\n\tconst styleSourceNode = getStyleSourceNodeFromVectorNodes(booleanNodes)\n\tif (!styleSourceNode) return\n\n\tconst tree = engine.tree\n\tconst firstNode = booleanNodes[0]\n\tassert(!isUndefined(firstNode), \"firstNode must be defined\")\n\tconst parentNode = engine.tree.getParent(firstNode.id)\n\tconst parentNodeId = parentNode ? parentNode.id : null\n\tconst newId = randomID()\n\n\tconst shapeStyle = copyShapeStyle(styleSourceNode)\n\tconst props: Partial<BooleanShapeNode> = {\n\t\tid: newId,\n\t\tpathBoolean,\n\t\t...shapeStyle,\n\t}\n\n\tconst sortedWithoutDescendants = tree.sortVisually(withoutDescendants)\n\tconst insertIndex = parentNode?.children.findIndex(child => sortedWithoutDescendants.includes(child))\n\tengine.createBooleanPath(parentNodeId, props, insertIndex)\n\n\tbooleanNodes.forEach(node => {\n\t\tconst update: Partial<VectorNode> = {\n\t\t\t...ContextAction.convertNodeToNewParentUpdate(tree, node, tree.getParent(node.id), parentNode),\n\t\t\t...shapeStyle,\n\t\t}\n\t\tengine.moveNode(node.id, newId)\n\t\tnode.set(update as any)\n\t})\n\n\tengine.stores.selectionStore.set(newId)\n}\n\nexport function shapeBooleanActionsEnabled(withoutDescendants: CanvasNode[]): boolean {\n\tconst selectedNodes: Set<CanvasNode> = new Set()\n\tfor (let i = 0, il = withoutDescendants.length; i < il; i++) {\n\t\tconst node = withoutDescendants[i]\n\t\tif (node && withShape(node) && !node.originalid) {\n\t\t\tselectedNodes.add(node)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif (selectedNodes.size === 1) {\n\t\tconst firstSelectedNode = getFirstItemFromIterable(selectedNodes)\n\t\tassert(firstSelectedNode, \"node must be found\")\n\t\treturn withBooleanPath(firstSelectedNode) && !firstSelectedNode.originalid\n\t} else {\n\t\treturn selectedNodes.size > 1\n\t}\n}\n\nfunction booleanableNodes(withoutDescendants: CanvasNode[]): VectorNode[] {\n\tif (withoutDescendants.length <= 1) return []\n\n\tconst selectedNodes: Set<CanvasNode> = new Set()\n\tfor (let i = 0, il = withoutDescendants.length; i < il; i++) {\n\t\tconst node = withoutDescendants[i]\n\t\tif (node && withShape(node) && !node.originalid) {\n\t\t\tselectedNodes.add(node)\n\t\t} else {\n\t\t\treturn []\n\t\t}\n\t}\n\tif (selectedNodes.size <= 1) return []\n\n\treturn engine.tree.sortVisually(Array.from(selectedNodes)) as VectorNode[]\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { triggerCanvasZoomEvent, triggerToggleGridsEvent, triggerToggleRulersEvent } from \"@framerjs/framer-events\"\nimport { assertNever, localModuleIdentifierForStableName, ModuleType, unhandledError } from \"@framerjs/shared\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport type { AppAction, PickAppActions } from \"app/AppActions.ts\"\nimport { getCanViewAgent } from \"app/agent/canViewAgent.ts\"\nimport {\n\tapplyKitFeatureToProject,\n\tareThereAnyPagesToConvertToKit,\n\tgetPagesToConvertToKit,\n} from \"app/ai/utils/kitProject.ts\"\nimport { browserAgentEvalsEnabled } from \"app/browserAgentEvals.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport type { ActionOptions, ActionState, ActionStateProvider } from \"document/components/actions/ActionResponder.tsx\"\nimport { ActionTarget } from \"document/components/actions/ActionResponder.tsx\"\nimport { openAnalyticsFromCurrentlySelectedItem } from \"document/components/chrome/analytics/utils/openAnalytics.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport { SampleColorTool } from \"document/components/tools/SampleColor.tsx\"\nimport { ContextAlignment } from \"document/components/utils/contextAlignmentActions.ts\"\nimport { flipShapes } from \"document/components/utils/dimensions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { MenuContext } from \"document/ipc/menu.ts\"\nimport { getMenuContext } from \"document/ipc/menu.ts\"\nimport { FrameNode, type TextNode } from \"document/models/CanvasTree/index.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisDesignPageNode,\n\tisFrameNode,\n\tisSlotNode,\n\tisSlotPropertyNode,\n\tisTextNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { hasFillEnabled } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { hasLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { withOverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { hasPageEffects, withPageEffects } from \"document/models/CanvasTree/traits/WithPageEffects.ts\"\nimport { withPath } from \"document/models/CanvasTree/traits/WithPath.ts\"\nimport { PathBooleanType } from \"document/models/CanvasTree/traits/WithPathBoolean.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { addGridToSelection } from \"document/models/CanvasTree/traits/utils/addGridsToSelection.ts\"\nimport { hasAnyEffect, nodeEffects, withAnyEffect } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { copyCSSForNodeEnabled } from \"document/models/CanvasTree/traits/utils/styleForNode.ts\"\nimport { getBoundingFrameForNodes } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport {\n\tmeasureCodeComponentsAndSizeToFit,\n\tsizeToFitContentEnabled,\n} from \"document/models/CanvasTree/utils/sizeToFitContent.ts\"\nimport { sortGroundNodesForPage } from \"document/models/CanvasTree/utils/sortGroundNodes.ts\"\nimport type { StyledTextDraft } from \"document/models/StyledText/StyledTextDraft.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport type { Action } from \"document/stores/ToolEnum.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport {\n\tActiveContentPanelTab,\n\tActiveLeftPanel,\n\tActiveMainView,\n\tCanvasPanelTab,\n} from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { textSelectionWantsNativeTextAction, wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport { environment } from \"environment/index.ts\"\nimport { resetVersionHistoryState } from \"history/resetVersionHistoryState.ts\"\nimport { RenderTarget } from \"library/index.ts\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { copyImportURL } from \"utils/clipboard/helpers/copyModuleImports.ts\"\nimport { canPasteInPlace } from \"utils/clipboard/pasteInPlace.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getSelectedCollectionItemForWebPage } from \"utils/getSelectedCollectionItemForWebPage.ts\"\nimport { renderNodeToSVG } from \"utils/renderNodeToSVG.tsx\"\nimport { academyURL, communityURL, marketplaceURL, requestFeatureURL } from \"utils/staticURLs.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { setViewParamsInURL } from \"utils/urlParams.ts\"\nimport { Pages, record, UIInteraction } from \"web/lib/tracker.ts\"\nimport {\n\tcanGoBackInHistory,\n\tcanGoForwardInHistory,\n\tgoBackInHistory,\n\tgoForwardInHistory,\n} from \"web/pages/project/lib/useHistory.tsx\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { hasCollectionDataSource } from \"../models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { createFolder } from \"./chrome/Pages/utils/createFolder.ts\"\nimport { sortRouteSegmentsAlphabetically } from \"./chrome/Pages/utils/sortRouteSegments.ts\"\nimport { dismissInsertTooltip } from \"./chrome/projectbar/InsertButtonTooltip.tsx\"\nimport { linkPanelId } from \"./chrome/properties/panels/LinkPanel.tsx\"\nimport { linkInputId } from \"./chrome/properties/panels/PageLinkingRows.tsx\"\nimport { ColorPickerPopoutContent } from \"./chrome/shared/ColorPicker/ColorPickerPopoutContent.tsx\"\nimport { canToggleFontPopout, toggleFontPopout } from \"./chrome/shared/FontPopout/FontPopoutControls.ts\"\nimport { GradientFillToolManagerTool, GradientMaskToolManagerTool } from \"./tools/gradient/GradientToolManagerTool.tsx\"\nimport { convertToOutline, convertToOutlineEnabled } from \"./tools/pathEdit/utils/convertToOutline.ts\"\nimport { flattenEnabled, flattenShapes } from \"./tools/pathEdit/utils/index.ts\"\nimport { canAddPageLink } from \"./utils/canAddPageLink.ts\"\nimport { ContextAction } from \"./utils/contextActions.ts\"\nimport { canAutoSizeNodes, enableAutoSizeForNodes } from \"./utils/enableAutoSizeForNodes.ts\"\nimport { openFirstLinkControlRow } from \"./utils/getFirstLinkControlRow.ts\"\nimport { performShapeBooleanAction, shapeBooleanActionsEnabled } from \"./utils/performShapeBooleanAction.ts\"\nimport { scopeAllowsRenameLayers } from \"./utils/renameLayers.ts\"\n\nfunction isCanvasVisible() {\n\treturn engine.stores.chromeStore.mainView === ActiveMainView.Canvas\n}\n\nfunction isCodeEditorVisible() {\n\treturn engine.stores.chromeStore.mainView === ActiveMainView.CodeEditor\n}\n\nfunction isCanvasOrCodeEditorVisible() {\n\treturn isCanvasVisible() || isCodeEditorVisible()\n}\n\nfunction hasClipboardEvent(actionArgument?: unknown): actionArgument is { event: ClipboardEvent } {\n\tif (!isObject(actionArgument) || !(\"event\" in actionArgument)) return false\n\treturn actionArgument.event instanceof ClipboardEvent\n}\n\nfunction canUseClipboard(context: MenuContext): boolean {\n\tconst { actionArgument } = context\n\tconst event = hasClipboardEvent(actionArgument) ? actionArgument.event : undefined\n\treturn isClipboardSupported(event)\n}\n\nfunction canToggleGuides(context: MenuContext): boolean {\n\treturn (\n\t\tisCanvasVisible() &&\n\t\t!getIsViewOnly(engine, \"canDesign\") &&\n\t\tcontext.nodes.every(node => isFrameNode(node) && context.tree.isGroundNode(node))\n\t)\n}\n\ntype KitActions = PickAppActions<\"createAIKit\" | \"convertPagesToKitPages\">\n\nconst KitActionStateProvider: ActionStateProvider<KitActions, MenuContext> = {\n\tcreateAIKit: () => !projectFeatures.isOn(\"kit\"),\n\tconvertPagesToKitPages: () => projectFeatures.isOn(\"kit\"),\n}\n\nclass KitActionTarget implements KitActions {\n\twantedActions = Object.keys(KitActionStateProvider) as (keyof KitActions & AppAction)[]\n\n\twantsActions = () => isCanvasVisible() && !engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\twantsAction = (action: keyof KitActions): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) return false\n\t\treturn KitActionStateProvider[action](getMenuContext())\n\t}\n\n\toptionsForAction(action: keyof KitActions): ActionOptions | undefined {\n\t\tif (action === \"createAIKit\") {\n\t\t\treturn {\n\t\t\t\tvisible: experiments.isOn(\"wireframerKits\") && !projectFeatures.isOn(\"kit\"),\n\t\t\t}\n\t\t} else if (action === \"convertPagesToKitPages\") {\n\t\t\treturn {\n\t\t\t\tvisible:\n\t\t\t\t\texperiments.isOn(\"wireframerKits\") &&\n\t\t\t\t\tprojectFeatures.isOn(\"kit\") &&\n\t\t\t\t\tareThereAnyPagesToConvertToKit(engine.tree),\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t}\n\n\tcreateAIKit() {\n\t\treturn applyKitFeatureToProject(engine)\n\t}\n\n\tasync convertPagesToKitPages() {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.ConvertToKitPage,\n\t\t\tsource: \"main_menu\",\n\t\t\twebPageIds: getPagesToConvertToKit(engine.tree),\n\t\t})\n\t}\n}\n\ntype NewPageActions = PickAppActions<\n\t\"newWebPage\" | \"newWebPageFolder\" | \"newPage\" | \"sortWebPagesAlphabetically\" | \"sortLayersAlphabetically\"\n>\n\nconst NewPageActionStateProvider: ActionStateProvider<NewPageActions, MenuContext> = {\n\tnewWebPage: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n\tnewWebPageFolder: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n\tnewPage: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n\tsortWebPagesAlphabetically: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n\tsortLayersAlphabetically: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n}\n\nclass NewPageActionTarget implements NewPageActions {\n\twantedActions = Object.keys(NewPageActionStateProvider) as (keyof NewPageActions & AppAction)[]\n\twantsActions = () => isCanvasVisible() && !engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\twantsAction = (action: keyof NewPageActions): ActionState => {\n\t\treturn NewPageActionStateProvider[action](getMenuContext())\n\t}\n\n\tnewWebPage() {\n\t\treturn engine.createWebPage()\n\t}\n\n\tnewWebPageFolder() {\n\t\tcreateFolder(engine)\n\t\tengine.stores.chromeStore.removePanelOverrides()\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Pages\n\t\tengine.stores.chromeStore.chromeIsVisible = true\n\t\tengine.stores.chromeStore.sitesPagesExpanded = true\n\t}\n\n\tsortWebPagesAlphabetically() {\n\t\tsortRouteSegmentsAlphabetically({ engine })\n\t}\n\n\tsortLayersAlphabetically() {\n\t\tsortGroundNodesForPage({ engine })\n\t}\n\n\tnewPage() {\n\t\tContextAction.createCanvasPage(engine)\n\t}\n}\n\ntype ImportActions = PickAppActions<\"importFigma\">\n\nconst importActionStateProvider: ActionStateProvider<ImportActions, MenuContext> = {\n\timportFigma: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n}\n\nclass ImportActionTarget implements ImportActions {\n\twantedActions = Object.keys(importActionStateProvider) as (keyof ImportActions & AppAction)[]\n\twantsActions = isCanvasVisible\n\n\twantsAction = (action: keyof ImportActions): ActionState => {\n\t\treturn importActionStateProvider[action](getMenuContext())\n\t}\n\n\timportFigma() {\n\t\tengine.stores.modalStore.set({ type: ModalType.ImportFigma, source: \"main_menu\" })\n\t}\n}\n\ntype QuickActionsActions = PickAppActions<\"quickActions\">\n\nclass QuickActionsActionTarget implements QuickActionsActions {\n\twantedActions: (keyof QuickActionsActions)[] = [\"quickActions\"]\n\twantsActions = () => engine.stores.loadingStore.isDocumentLoaded\n\n\tquickActions() {\n\t\tContextAction.toggleQuickActions(engine)\n\t}\n}\n\n// @TODO: can we merge it with the NewPageActionTarget and ImportActionTarget?\ntype FileActions = PickAppActions<\n\t| \"toggleVersionHistory\"\n\t| \"toggleLocalization\"\n\t| \"toggleContentManagement\"\n\t| \"openCanvas\"\n\t| \"openCMS\"\n\t| \"openLocalization\"\n\t| \"openAnalytics\"\n\t| \"openSettings\"\n\t| \"openEvaluations\"\n>\nclass FileActionTarget implements FileActions {\n\tprivate readonly modeActions: ReadonlySet<keyof FileActions> = new Set([\n\t\t\"openCanvas\",\n\t\t\"openCMS\",\n\t\t\"openLocalization\",\n\t\t\"openAnalytics\",\n\t\t\"openSettings\",\n\t\t\"openEvaluations\",\n\t])\n\n\twantedActions: (keyof FileActions)[] = [\n\t\t\"toggleVersionHistory\",\n\t\t\"toggleLocalization\",\n\t\t\"toggleContentManagement\",\n\t\t\"openCanvas\",\n\t\t\"openCMS\",\n\t\t\"openLocalization\",\n\t\t\"openAnalytics\",\n\t\t\"openSettings\",\n\t\t\"openEvaluations\",\n\t]\n\twantsAction = (action: keyof FileActions): ActionState => {\n\t\tif (action === \"toggleVersionHistory\") {\n\t\t\treturn engine.stores.chromeStore.mainView === ActiveMainView.Canvas\n\t\t}\n\t\tif (action === \"openEvaluations\") {\n\t\t\treturn experiments.isOn(\"agent\") && engine.stores.chromeStore.userIsEmployee && browserAgentEvalsEnabled\n\t\t}\n\t\tif (this.modeActions.has(action)) return experiments.isOn(\"agent\")\n\n\t\treturn true\n\t}\n\n\toptionsForAction = (action: keyof FileActions): ActionOptions | undefined => {\n\t\tconst { mainView } = engine.stores.chromeStore\n\t\tconst agentExperimentOn = experiments.isOn(\"agent\")\n\t\tif (action === \"openCanvas\") {\n\t\t\tconst isCanvasOrCodeEditor = mainView === ActiveMainView.Canvas || mainView === ActiveMainView.CodeEditor\n\t\t\treturn {\n\t\t\t\tchecked: !engine.stores.chromeStore.isEvaluationsModeActive && isCanvasOrCodeEditor,\n\t\t\t\tvisible: agentExperimentOn,\n\t\t\t\tenabled:\n\t\t\t\t\tengine.stores.chromeStore.isEvaluationsModeActive ||\n\t\t\t\t\t(mainView !== ActiveMainView.Canvas && mainView !== ActiveMainView.CodeEditor),\n\t\t\t}\n\t\t}\n\t\tif (action === \"openCMS\") {\n\t\t\treturn {\n\t\t\t\tchecked: mainView === ActiveMainView.ContentManagement,\n\t\t\t\tvisible: agentExperimentOn,\n\t\t\t\tenabled: mainView !== ActiveMainView.ContentManagement,\n\t\t\t}\n\t\t}\n\t\tif (action === \"openLocalization\") {\n\t\t\treturn {\n\t\t\t\tchecked: mainView === ActiveMainView.Localizations,\n\t\t\t\tvisible: agentExperimentOn,\n\t\t\t\tenabled: mainView !== ActiveMainView.Localizations,\n\t\t\t}\n\t\t}\n\t\tif (action === \"openAnalytics\") {\n\t\t\treturn {\n\t\t\t\tchecked: mainView === ActiveMainView.Analytics,\n\t\t\t\tvisible: agentExperimentOn,\n\t\t\t\tenabled: mainView !== ActiveMainView.Analytics,\n\t\t\t}\n\t\t}\n\t\tif (action === \"openSettings\") {\n\t\t\treturn {\n\t\t\t\tchecked: mainView === ActiveMainView.SiteSettings,\n\t\t\t\tvisible: agentExperimentOn,\n\t\t\t\tenabled: mainView !== ActiveMainView.SiteSettings,\n\t\t\t}\n\t\t}\n\t\tif (action === \"openEvaluations\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.chromeStore.isEvaluationsModeActive,\n\t\t\t\tvisible: agentExperimentOn && engine.stores.chromeStore.userIsEmployee && browserAgentEvalsEnabled,\n\t\t\t\tenabled: !engine.stores.chromeStore.isEvaluationsModeActive && browserAgentEvalsEnabled,\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t}\n\n\ttoggleLocalization() {\n\t\tengine.stores.chromeStore.setLocalizationsVisible(\n\t\t\tengine.stores.chromeStore.mainView !== ActiveMainView.Localizations,\n\t\t)\n\t}\n\n\ttoggleContentManagement = engine.scheduler.wrapHandler(() => {\n\t\tContextAction.toggleContentManagementScope(engine)\n\t})\n\n\tprivate resetMainViewState() {\n\t\tconst { analyticsStore, chromeStore, codeEditorStore, siteSettingsStore } = engine.stores\n\n\t\ttogglePreviewVisible(engine, { visible: false })\n\t\tsiteSettingsStore.close()\n\t\tanalyticsStore.close()\n\t\tchromeStore.setLocalizationsVisible(false)\n\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t\tcodeEditorStore.closeEditor()\n\n\t\tif (chromeStore.mainView === ActiveMainView.ContentManagement) {\n\t\t\tContextAction.toggleContentManagementScope(engine)\n\t\t}\n\t}\n\n\topenCanvas = engine.scheduler.wrapHandler(() => {\n\t\tthis.resetMainViewState()\n\t})\n\n\topenCMS = engine.scheduler.wrapHandler(() => {\n\t\tconst { chromeStore } = engine.stores\n\n\t\tif (chromeStore.mainView === ActiveMainView.ContentManagement) return\n\n\t\tthis.resetMainViewState()\n\t\tContextAction.toggleContentManagementScope(engine)\n\t})\n\n\topenLocalization = engine.scheduler.wrapHandler(() => {\n\t\tconst { chromeStore } = engine.stores\n\n\t\tif (chromeStore.mainView === ActiveMainView.Localizations) return\n\n\t\tthis.resetMainViewState()\n\t\tchromeStore.setLocalizationsVisible(true)\n\t})\n\n\topenEvaluations = engine.scheduler.wrapHandler(() => {\n\t\tconst { chromeStore } = engine.stores\n\n\t\tif (chromeStore.isEvaluationsModeActive) return\n\t\tif (!chromeStore.userIsEmployee) return\n\t\tif (!browserAgentEvalsEnabled) return\n\n\t\tthis.resetMainViewState()\n\t\tengine.cancelTool()\n\t\tchromeStore.enterEvaluationsMode()\n\t})\n\n\topenAnalytics = engine.scheduler.wrapHandler(() => {\n\t\tconst { chromeStore } = engine.stores\n\n\t\tif (chromeStore.mainView === ActiveMainView.Analytics) return\n\n\t\topenAnalyticsFromCurrentlySelectedItem(engine)\n\t})\n\n\topenSettings = engine.scheduler.wrapHandler(() => {\n\t\tconst { chromeStore } = engine.stores\n\n\t\tif (chromeStore.mainView === ActiveMainView.SiteSettings) return\n\n\t\tthis.resetMainViewState()\n\t\tengine.stores.siteSettingsStore.open()\n\t})\n\n\ttoggleVersionHistory() {\n\t\tconst willExitVersionHistory = engine.stores.chromeStore.isHistoryModeActive\n\t\tif (willExitVersionHistory) {\n\t\t\tresetVersionHistoryState()\n\t\t}\n\t\tengine.stores.chromeStore.isHistoryModeActive = !engine.stores.chromeStore.isHistoryModeActive\n\t}\n}\n\ntype NativeActions = PickAppActions<\"undo\" | \"redo\" | \"goBack\" | \"goForward\" | \"cut\" | \"copy\" | \"paste\" | \"selectAll\">\n\nconst nativeActionStateProvider: ActionStateProvider<NativeActions, MenuContext> = {\n\tundo: _context => {\n\t\treturn isCodeEditorVisible() ? \"native\" : engine.canUndo()\n\t},\n\tredo: _context => {\n\t\treturn isCodeEditorVisible() ? \"native\" : engine.canRedo()\n\t},\n\tgoBack: () => canGoBackInHistory(),\n\tgoForward: () => canGoForwardInHistory(),\n\tcut: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn wantsNativeTextActions() || !isCanvasVisible()\n\t\t\t? \"native\"\n\t\t\t: ContextAction.canCutNodes(engine, engine.tree.getNodes(context.selection))\n\t},\n\tcopy: context => {\n\t\tif (!canUseClipboard(context)) return false\n\n\t\treturn wantsNativeTextActions() || textSelectionWantsNativeTextAction() || !isCanvasVisible()\n\t\t\t? \"native\"\n\t\t\t: ContextAction.canCopyNodes(engine.tree.getNodes(context.selection))\n\t},\n\tpaste: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn wantsNativeTextActions() || !isCanvasVisible() ? \"native\" : true\n\t},\n\tselectAll: _context => {\n\t\treturn wantsNativeTextActions() || !isCanvasVisible()\n\t\t\t? \"native\"\n\t\t\t: engine.stores.treeStore.tree.root.children.length > 0\n\t},\n}\n\nclass NativeActionTarget implements NativeActions {\n\twantedActions = Object.keys(nativeActionStateProvider) as (keyof NativeActions & AppAction)[]\n\n\twantsAction = (action: keyof NativeActions, event: Event | undefined): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canSendDiffs\")) {\n\t\t\tswitch (action) {\n\t\t\t\tcase \"selectAll\":\n\t\t\t\tcase \"copy\":\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tconst { siteSettingsStore } = engine.stores\n\t\tif (siteSettingsStore.isOpen) {\n\t\t\tif (siteSettingsStore.getIsRedirectsVisible()) {\n\t\t\t\t// Undo and redo enabled state are handled by the engine\n\t\t\t\treturn action === \"undo\" || action === \"redo\"\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\treturn nativeActionStateProvider[action](getMenuContext(event))\n\t}\n\n\tundo() {\n\t\tengine.undo()\n\t}\n\n\tredo() {\n\t\tengine.redo()\n\t}\n\n\tgoBack() {\n\t\tgoBackInHistory()\n\t}\n\n\tgoForward() {\n\t\tgoForwardInHistory()\n\t}\n\n\tasync cut(args: { event?: ClipboardEvent } = {}) {\n\t\tconst { event } = args\n\t\tawait Clipboard.cut(engine, event)\n\t}\n\n\tasync copy(args: { event?: ClipboardEvent } = {}) {\n\t\tconst { event } = args\n\t\tawait Clipboard.copy(engine, event)\n\t}\n\n\tasync paste(\n\t\targs: {\n\t\t\tevent?: ClipboardEvent\n\t\t\tfromContextMenu?: boolean\n\t\t} = {},\n\t) {\n\t\tconst { fromContextMenu, event } = args\n\t\tconst { mouseStore, selectionStore, canvasStore } = engine.stores\n\t\tconst { canvasMousePosition } = mouseStore.latest\n\t\tconst selection = selectionStore.ids\n\t\tconst position =\n\t\t\tfromContextMenu && selection.length === 0 && canvasMousePosition\n\t\t\t\t? canvasMousePosition // If we\u2019re pasting from the canvas context menu, use the mouse position as center\n\t\t\t\t: canvasStore.getViewportCenterTakingOverlaysIntoAccount()\n\t\tawait Clipboard.paste(engine, { position }, event)\n\t}\n\n\tselectAll() {\n\t\tContextAction.selectAll(engine, engine.stores.selectionStore.ids)\n\t}\n}\n\ntype EditActions = PickAppActions<\n\t| \"copyStyle\"\n\t| \"copyFill\"\n\t| \"copyLink\"\n\t| \"copyNodeId\"\n\t| \"copyCSS\"\n\t| \"copySVG\"\n\t| \"copyText\"\n\t| \"copyGrid\"\n\t| \"copyEffects\"\n\t| \"copyCursor\"\n\t| \"copyURL\"\n\t| \"pasteStyle\"\n\t| \"pasteFill\"\n\t| \"pasteInPlace\"\n\t| \"pasteEffects\"\n\t| \"pasteCursor\"\n\t| \"pasteGrid\"\n\t| \"duplicate\"\n\t| \"delete\"\n\t| \"toggleLayerLock\"\n\t| \"toggleLayerVisible\"\n\t| \"rename\"\n\t| \"renameLayers\"\n\t| \"openPanelSearch\"\n\t| \"selectMostRecentPage\"\n\t| \"selectSiblings\"\n\t| \"selectGroundNode\"\n\t| \"selectParent\"\n\t| \"selectChildren\"\n\t| \"selectAllTopParents\"\n\t| \"selectTextNodes\"\n\t| \"sampleColor\"\n\t| \"startLinkTool\"\n>\n\nconst editActionStateProvider: ActionStateProvider<EditActions, MenuContext> = {\n\tcopyStyle: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn !isSlotNode(context.singleNode) && !isSlotPropertyNode(context.singleNode)\n\t},\n\tcopyFill: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn hasFillEnabled(context.singleNode)\n\t},\n\tcopyLink: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn !isSlotNode(context.singleNode) && !isSlotPropertyNode(context.singleNode)\n\t},\n\tcopyNodeId: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn !!context.singleNode\n\t},\n\tcopyCSS: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn copyCSSForNodeEnabled(context.singleNode)\n\t},\n\tcopySVG: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn isExportableAsSVG(context.singleNode)\n\t},\n\tcopyText: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn isAnyTextNode(context.singleNode)\n\t},\n\tcopyGrid: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\tif (!context.tree.isGroundNode(context.singleNode)) return false\n\t\tif (!withOverlayGrid(context.singleNode)) return false\n\t\treturn !!context.singleNode.overlayGrid\n\t},\n\tcopyEffects: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn hasAnyEffect(context.singleNode) || withPageEffects(context.singleNode)\n\t},\n\tcopyCursor: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn context.singleNode !== null && withCursor(context.singleNode)\n\t},\n\tcopyURL: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (!context.singleNode) return false\n\t\treturn isVectorSetItem(context.singleNode)\n\t},\n\tpasteStyle: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tif (context.selection.length === 0) return false\n\t\treturn context.nodes.every(node => !isSlotNode(node) && !isSlotPropertyNode(node))\n\t},\n\tpasteFill: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tconst { withoutDescendants } = context\n\t\treturn withoutDescendants.some(node => hasFillEnabled(node))\n\t},\n\tpasteInPlace: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn canPasteInPlace(context.singleNode)\n\t},\n\n\tpasteEffects: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tconst { withoutDescendants } = context\n\n\t\tconst canPasteEffects = withoutDescendants.some(node => {\n\t\t\treturn isBreakpointVariant(node) ? withPageEffects(node) : withAnyEffect(node)\n\t\t})\n\t\treturn canPasteEffects\n\t},\n\tpasteCursor: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\tconst { withoutDescendants } = context\n\t\treturn withoutDescendants.some(withCursor)\n\t},\n\tpasteGrid: context => {\n\t\tif (!canUseClipboard(context)) return false\n\t\treturn context.selection.length > 0\n\t},\n\tduplicate: context => {\n\t\treturn ContextAction.canDuplicateNodes(context.nodes)\n\t},\n\tdelete: context => {\n\t\treturn wantsNativeTextActions() ? \"native\" : ContextAction.canDeleteOrHideNodes(engine, context.nodes)\n\t},\n\ttoggleLayerLock: context => {\n\t\treturn ContextAction.toggleLockEnabled(context.withoutDescendants)\n\t},\n\ttoggleLayerVisible: context => {\n\t\treturn ContextAction.visibilityEnabled(context.nodes)\n\t},\n\trename: context => {\n\t\treturn (\n\t\t\tContextAction.canRename(context.tree, context.nodes) || ContextAction.canRenameActivePage(engine, context.nodes)\n\t\t)\n\t},\n\topenPanelSearch: () => {\n\t\treturn (\n\t\t\t// Monaco code editor has its own search functionality, and it's unclear how to override\n\t\t\t// that in certain cases (like if the editor is not focused).\n\t\t\tisCanvasVisible() &&\n\t\t\t// If content is not visible, then the async element look-up does not\n\t\t\t// work as intended. So for now, search will only work if this is the active\n\t\t\t// panel.\n\t\t\tengine.stores.chromeStore.leftPanel === ActiveLeftPanel.Canvas\n\t\t)\n\t},\n\trenameLayers: context => {\n\t\treturn (\n\t\t\tcontext.selection.length > 0 &&\n\t\t\texperiments.isOn(\"renameLayers\") &&\n\t\t\tscopeAllowsRenameLayers(engine.stores.scopeStore.active)\n\t\t)\n\t},\n\tselectMostRecentPage: _context => {\n\t\treturn engine.stores.scopeStore.canGoBack()\n\t},\n\tselectSiblings: context => {\n\t\treturn context.selection.length > 0\n\t},\n\tselectChildren: context => {\n\t\tconst selectedNodes = engine.stores.treeStore.tree.getNodes(context.selection)\n\t\tconst allChildren = selectedNodes.flatMap(node => node.children)\n\n\t\tif (allChildren.length === 0) return false\n\n\t\treturn context.selection.length > 0\n\t},\n\tselectGroundNode: context => {\n\t\treturn ContextAction.canSelectAncestor(engine.tree, context.selection)\n\t},\n\tselectParent: context => {\n\t\treturn ContextAction.canSelectAncestor(engine.tree, context.selection)\n\t},\n\tselectAllTopParents: _context => {\n\t\treturn engine.stores.treeStore.tree.root.children.length > 0\n\t},\n\tselectTextNodes: _context => {\n\t\treturn engine.stores.treeStore.tree.root.children.length > 0\n\t},\n\tsampleColor: context => {\n\t\treturn context.selection.length > 0\n\t},\n\tstartLinkTool: () => {\n\t\tconst activeScope = engine.stores.scopeStore.active\n\t\tif (isWebPageNode(activeScope)) {\n\t\t\tif (!engine.stores.chromeStore.chromeIsVisible) return false\n\t\t\treturn canAddPageLink(engine.componentLoader, engine.stores.selectionStore.nodes)\n\t\t}\n\t\treturn !isDesignPageNode(activeScope)\n\t},\n}\n\nclass EditActionTarget implements EditActions {\n\twantedActions = Object.keys(editActionStateProvider) as (keyof EditActions & AppAction)[]\n\twantsActions = () => isCanvasVisible() && !engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\twantsAction = (action: keyof EditActions, event: Event): ActionState => {\n\t\tif (\n\t\t\tgetIsViewOnly(engine, \"canDesign\") &&\n\t\t\t(action === \"pasteStyle\" ||\n\t\t\t\taction === \"pasteFill\" ||\n\t\t\t\taction === \"pasteInPlace\" ||\n\t\t\t\taction === \"pasteGrid\" ||\n\t\t\t\taction === \"pasteEffects\" ||\n\t\t\t\taction === \"pasteCursor\" ||\n\t\t\t\taction === \"rename\" ||\n\t\t\t\taction === \"renameLayers\" ||\n\t\t\t\taction === \"duplicate\" ||\n\t\t\t\taction === \"sampleColor\" ||\n\t\t\t\taction === \"startLinkTool\" ||\n\t\t\t\taction === \"delete\" ||\n\t\t\t\taction === \"toggleLayerVisible\" ||\n\t\t\t\taction === \"toggleLayerLock\")\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t\treturn editActionStateProvider[action](getMenuContext(event))\n\t}\n\n\toptionsForAction(action: keyof EditActions): ActionOptions | undefined {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tif (action === \"toggleLayerVisible\") {\n\t\t\treturn { label: ContextAction.visibilityTitle(selection) }\n\t\t} else if (action === \"toggleLayerLock\") {\n\t\t\tconst withoutDescendants = engine.tree.withoutDescendants(selection)\n\t\t\treturn { label: ContextAction.toggleLockTitle(withoutDescendants) }\n\t\t} else if (action === \"pasteGrid\" || action === \"copyGrid\") {\n\t\t\treturn { visible: engine.stores.persistedUserDefaults.displayGrids }\n\t\t} else if (action === \"renameLayers\") {\n\t\t\treturn { visible: experiments.isOn(\"renameLayers\") }\n\t\t} else if (action === \"copyURL\") {\n\t\t\treturn { visible: ContextAction.copyURLEnabled(selection) }\n\t\t} else if (action === \"startLinkTool\") {\n\t\t\treturn {\n\t\t\t\tvisible: engine.stores.scopeStore.scopeType !== ScopeType.VectorSet,\n\t\t\t}\n\t\t} else if (action === \"openPanelSearch\") {\n\t\t\treturn {\n\t\t\t\tvisible: isCanvasVisible() && engine.stores.chromeStore.leftPanel === ActiveLeftPanel.Canvas,\n\t\t\t}\n\t\t}\n\t}\n\n\tasync copyStyle() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node) return\n\t\tconst sourceProjectId = engine.stores.projectStore.projectId\n\t\tawait Clipboard.copyStyle(engine.tree, engine.componentLoader, node, sourceProjectId)\n\t}\n\n\tasync copyFill() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\n\t\tif (!node) return\n\n\t\tconst sourceProjectId = engine.stores.projectStore.projectId\n\t\tawait Clipboard.copyStyle(engine.tree, engine.componentLoader, node, sourceProjectId, TraitType.Fill)\n\t}\n\n\tasync copyLink() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node) return\n\t\tconst url = new URL(window.location.href)\n\t\turl.search = \"\"\n\t\tsetViewParamsInURL(url, { nodeId: node?.id })\n\t\tawait Clipboard.copyText(url.href)\n\t}\n\n\tasync copyNodeId() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node) return\n\t\tawait Clipboard.copyText(node.id)\n\t}\n\n\tasync copyCSS() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node) return\n\t\tawait Clipboard.copyCSSForNode(node, engine)\n\t}\n\n\tasync copySVG() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node) return\n\t\tif (!isExportableAsSVG(node)) return\n\t\tawait Clipboard.copySVG(\n\t\t\trenderNodeToSVG({\n\t\t\t\tnode,\n\t\t\t\trenderTarget: RenderTarget.export,\n\t\t\t\tisDarkMode: engine.stores.documentSettingsStore.hasDarkAppearance,\n\t\t\t\tcomponentLoader: engine.componentLoader,\n\t\t\t\tcombinedVariableValueMap: node.cache.getUnsafeCombinedVariableValueMap(),\n\t\t\t}),\n\t\t)\n\t}\n\n\tasync copyText() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node || !isAnyTextNode(node)) return\n\t\tconst text = isTextNode(node) ? node.text : node.getTextContent()\n\t\tawait Clipboard.copyText(text)\n\t}\n\n\tasync copyGrid() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!node || !withOverlayGrid(node)) return\n\t\tif (!node.overlayGrid) return\n\t\tawait Clipboard.copyGridOverlay(node.overlayGrid as any)\n\t}\n\n\tasync copyEffects() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\n\t\tif (!node) return\n\n\t\tif (hasAnyEffect(node)) {\n\t\t\tawait Clipboard.copyEffects(nodeEffects(node))\n\t\t} else if (hasPageEffects(node)) {\n\t\t\tawait Clipboard.copyPageEffects(node.pageEffects)\n\t\t}\n\t}\n\n\tasync copyCursor() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\n\t\tif (!node || !withCursor(node)) return\n\n\t\tawait Clipboard.copyCursors({\n\t\t\tcursor: node.cursor,\n\t\t\tcustomCursorVariant: node.customCursorVariant,\n\t\t\tcustomCursorFollow: node.customCursorFollow,\n\t\t\tcustomCursorOffsetX: node.customCursorOffsetX,\n\t\t\tcustomCursorOffsetY: node.customCursorOffsetY,\n\t\t\tcustomCursorPlacement: node.customCursorPlacement,\n\t\t\tcustomCursorAlignment: node.customCursorAlignment,\n\t\t\tcustomCursorTransition: node.customCursorTransition,\n\t\t\tcustomCursorTransitionEnabled: node.customCursorTransitionEnabled,\n\t\t\tcustomCursorType: node.customCursorType,\n\t\t\tcustomCursorSmartComponentId: node.customCursorSmartComponentId,\n\t\t})\n\t}\n\n\tasync copyURL() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tconst node = selection.length === 1 ? selection[0] : null\n\t\tif (!isVectorSetItem(node)) return\n\n\t\tcopyImportURL(engine, localModuleIdentifierForStableName(ModuleType.Vector, node.id, \"default\").value, false)\n\t\trecord(\"ui_interaction\", { id: UIInteraction.copyImportURL, page: Pages.contextMenu })\n\t}\n\n\tasync pasteStyle(\n\t\targs: {\n\t\t\tevent?: ClipboardEvent\n\t\t\ttype?: TraitType | TraitType[]\n\t\t} = {},\n\t) {\n\t\tconst selection = engine.stores.selectionStore.ids\n\t\tawait Clipboard.pasteStyle(engine, selection, args.event, args.type)\n\t}\n\n\tasync pasteFill(\n\t\targs: {\n\t\t\tevent?: ClipboardEvent\n\t\t} = {},\n\t) {\n\t\tconst selection = engine.stores.selectionStore.ids\n\t\tawait Clipboard.pasteStyle(engine, selection, args.event, TraitType.Fill)\n\t}\n\n\tasync pasteInPlace() {\n\t\tawait Clipboard.pasteInPlace(engine)\n\t}\n\n\tasync pasteEffects() {\n\t\tconst selection = engine.stores.selectionStore.ids\n\n\t\tconst selectedBreakpointNodes: string[] = []\n\t\tconst remainingSelectedNodes: string[] = []\n\n\t\tfor (let i = 0; i < selection.length; i++) {\n\t\t\tconst nodeId = selection[i]\n\t\t\tif (!nodeId) continue\n\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\tif (!node) continue\n\t\t\tif (isBreakpointVariant(node)) {\n\t\t\t\tselectedBreakpointNodes.push(nodeId)\n\t\t\t} else {\n\t\t\t\tremainingSelectedNodes.push(nodeId)\n\t\t\t}\n\t\t}\n\n\t\tawait Promise.all([\n\t\t\tClipboard.pasteEffects(engine, remainingSelectedNodes),\n\t\t\tClipboard.pastePageEffects(engine, selectedBreakpointNodes),\n\t\t])\n\t}\n\n\tasync pasteGrid() {\n\t\tconst selection = engine.stores.selectionStore.ids\n\t\tawait Clipboard.pasteGridOverlay(engine, selection)\n\t}\n\n\tasync pasteCursor() {\n\t\tconst selection = engine.stores.selectionStore.ids\n\t\tawait Clipboard.pasteCursors(engine, selection)\n\t}\n\n\tduplicate() {\n\t\tContextAction.duplicateNodes(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tdelete() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tContextAction.deleteAction(engine, selection)\n\t}\n\n\ttoggleLayerLock() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tContextAction.toggleLock(engine.tree, selection)\n\t}\n\n\ttoggleLayerVisible() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tContextAction.visibility(engine, selection)\n\t}\n\n\trename() {\n\t\tconst selection = engine.stores.selectionStore.nodes\n\t\tContextAction.rename(engine, selection)\n\t}\n\n\trenameLayers() {\n\t\tvoid ContextAction.renameLayers(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tselectMostRecentPage() {\n\t\tif (!engine.stores.scopeStore.canGoBack()) return\n\t\tconst mainPage = engine.stores.scopeStore.getMostRecentPage()\n\t\tengine.stores.scopeStore.select(mainPage.id, { keepHistory: false })\n\t}\n\n\tselectSiblings() {\n\t\tContextAction.selectAllSiblings(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tselectChildren() {\n\t\tContextAction.selectAllChildren(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tselectGroundNode() {\n\t\tContextAction.selectGroundNode(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tselectParent() {\n\t\tContextAction.selectParent(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tselectAllTopParents() {\n\t\tconst frameNodes = engine.stores.scopeStore.active.getGroundNodesOfType(FrameNode, (node: FrameNode) => {\n\t\t\treturn node.resolveValue(\"rotation\") === 0\n\t\t})\n\t\tengine.stores.selectionStore.set(frameNodes)\n\t}\n\n\tselectTextNodes() {\n\t\tContextAction.selectAllTextNodes(engine, engine.stores.selectionStore.ids)\n\t}\n\n\tsampleColor() {\n\t\tif (engine.tool instanceof GradientMaskToolManagerTool || engine.tool instanceof GradientFillToolManagerTool) {\n\t\t\tengine.tool.setTool(new SampleColorTool(engine))\n\t\t} else if (ColorPickerPopoutContent.sampleColor) {\n\t\t\tColorPickerPopoutContent.sampleColor()\n\t\t} else {\n\t\t\tengine.setTool(Tools.SampleColor)\n\t\t}\n\t}\n\n\tstartLinkTool() {\n\t\tif (isWebPageNode(engine.stores.scopeStore.active)) {\n\t\t\tconst singleNode = engine.stores.selectionStore.nodes[0]\n\t\t\tif (!singleNode) return\n\t\t\tif (isCodeComponentNode(singleNode)) {\n\t\t\t\topenFirstLinkControlRow(engine.componentLoader, singleNode)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the link input is shown, focus on the input, otherwise we\n\t\t\t// open the panel for the user\n\t\t\tconst linkInput = document.getElementById(linkInputId)\n\t\t\tif (linkInput) {\n\t\t\t\tlinkInput.click()\n\t\t\t}\n\t\t\t// Clicking the panel when the node has a link set will delete the\n\t\t\t// link. Technically if the node has a link, the link input should\n\t\t\t// exist, so the code should not reach this block. But we add the\n\t\t\t// condition here just in case the input element cannot be found for\n\t\t\t// whatever reason even if the node does have a link set.\n\t\t\telse if (!hasLink(singleNode)) {\n\t\t\t\tconst linkPanel = document.getElementById(linkPanelId)\n\t\t\t\tlinkPanel?.click()\n\t\t\t}\n\t\t} else {\n\t\t\tengine.setTool(Tools.Link)\n\t\t}\n\t}\n\n\topenPanelSearch() {\n\t\t// Some popouts have a search field that should be focused when pressing CMD+F, so we don't\n\t\t// do anything if a popout is open.\n\t\tif (popoutWindow.isOpen()) return\n\n\t\trecord(\"content_panel_search_focus\", { tab: engine.stores.chromeStore.contentPanelTab })\n\t\t// If the Quick Actions modal is open, we must wait for it to process\n\t\t// closing before we are able to focus the panel search input.\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tengine.stores.chromeStore.isContentPanelSearchFocused = true\n\t\t})\n\t}\n}\n\ntype ViewActions = PickAppActions<\n\t| \"zoomIn\"\n\t| \"zoomOut\"\n\t| \"zoomToFitAll\"\n\t| \"zoomToFitSelection\"\n\t| \"resetZoom\"\n\t| \"toggleInterface\"\n\t| \"toggleRulers\"\n\t| \"toggleGrids\"\n\t| \"toggleShowAllLinks\"\n\t| \"toggleShowHandoff\"\n\t| \"toggleShowPixelGrid\"\n\t| \"showPages\"\n\t| \"showLayers\"\n\t| \"showAssets\"\n\t| \"showAgent\"\n\t| \"newAgentChat\"\n\t| \"collapseLayers\"\n>\n\nconst viewActionStateProvider: ActionStateProvider<ViewActions, MenuContext> = {\n\tzoomIn: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tzoomOut: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tzoomToFitAll: context => {\n\t\tif (!isCanvasVisible()) return false\n\t\treturn context.groundNodes.length > 0\n\t},\n\tzoomToFitSelection: _context => {\n\t\tif (!isCanvasVisible()) return false\n\t\treturn engine.stores.selectionStore.ids.length > 0\n\t},\n\tresetZoom: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\ttoggleShowPixelGrid: () => {\n\t\treturn isCanvasVisible()\n\t},\n\ttoggleInterface: _context => {\n\t\treturn isCanvasVisible()\n\t},\n\ttoggleRulers: _context => {\n\t\treturn isCanvasVisible()\n\t},\n\ttoggleGrids: canToggleGuides,\n\n\ttoggleShowAllLinks: _context => {\n\t\treturn isCanvasVisible()\n\t},\n\ttoggleShowHandoff: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tshowPages: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tshowLayers: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tshowAssets: _context => {\n\t\treturn isCanvasOrCodeEditorVisible()\n\t},\n\tshowAgent: _context => {\n\t\tif (!experiments.isOn(\"agent\")) return false\n\t\tif (!getCanViewAgent(engine)) return false\n\t\t// Only wanted when `showAgent` has somewhere to go: focus an already-mounted input\n\t\t// (canvas chat panel, code editor agent panel, CMS table panel), or open the canvas\n\t\t// chat tab.\n\t\treturn isCanvasVisible() || engine.stores.chromeStore.focusAgentChatInput !== undefined\n\t},\n\tnewAgentChat: _context => {\n\t\tif (!experiments.isOn(\"agent\")) return false\n\t\tif (!getCanViewAgent(engine)) return false\n\t\tif (getIsViewOnly(engine, \"canDesign\")) return false\n\t\treturn isCanvasVisible() || engine.stores.chromeStore.focusAgentChatInput !== undefined\n\t},\n\tcollapseLayers: _context => {\n\t\treturn (\n\t\t\tengine.stores.chromeStore.leftPanel === ActiveLeftPanel.Canvas &&\n\t\t\tengine.stores.chromeStore.contentPanelTab === ActiveContentPanelTab.Layers\n\t\t)\n\t},\n}\n\nclass ViewActionTarget implements ViewActions {\n\twantedActions = Object.keys(viewActionStateProvider) as (keyof ViewActions & AppAction)[]\n\twantsActions = () => true\n\n\twantsAction = (action: keyof ViewActions): ActionState => {\n\t\treturn viewActionStateProvider[action](getMenuContext())\n\t}\n\n\toptionsForAction(action: keyof ViewActions): ActionOptions | undefined {\n\t\tif (action === \"toggleInterface\") {\n\t\t\treturn { checked: engine.stores.chromeStore.chromeIsVisible }\n\t\t}\n\t\tif (action === \"toggleRulers\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.displayRulers,\n\t\t\t}\n\t\t}\n\t\tif (action === \"toggleGrids\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.displayGrids,\n\t\t\t\tvisible: canToggleGuides(getMenuContext()),\n\t\t\t}\n\t\t}\n\t\tif (action === \"toggleShowPixelGrid\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.showPixelGrid }\n\t\t}\n\t\tif (action === \"toggleShowAllLinks\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.displayAllLinks }\n\t\t}\n\t\tif (action === \"toggleShowHandoff\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.showHandoff }\n\t\t}\n\t\tif (action === \"showAgent\") {\n\t\t\treturn { visible: experiments.isOn(\"agent\"), enabled: getCanViewAgent(engine) }\n\t\t}\n\t\tif (action === \"newAgentChat\") {\n\t\t\treturn { visible: experiments.isOn(\"agent\"), enabled: getCanViewAgent(engine) }\n\t\t}\n\n\t\treturn\n\t}\n\n\tzoomIn() {\n\t\tif (isCodeEditorVisible()) {\n\t\t\tengine.stores.persistedUserDefaults.editorFontSizeIncrease()\n\t\t\treturn\n\t\t}\n\t\tengine.stores.canvasStore.zoomIn(undefined, { animated: engine.stores.persistedUserDefaults.animateOnZoom })\n\t\ttriggerCanvasZoomEvent({\n\t\t\tsource: \"keyboard\",\n\t\t})\n\t}\n\n\tzoomOut() {\n\t\tif (isCodeEditorVisible()) {\n\t\t\tengine.stores.persistedUserDefaults.editorFontSizeDecrease()\n\t\t\treturn\n\t\t}\n\t\tengine.stores.canvasStore.zoomOut(undefined, { animated: engine.stores.persistedUserDefaults.animateOnZoom })\n\t\ttriggerCanvasZoomEvent({\n\t\t\tsource: \"keyboard\",\n\t\t})\n\t}\n\n\tzoomToFitAll() {\n\t\tengine.stores.canvasStore.zoomToFitAll()\n\t}\n\n\tzoomToFitSelection() {\n\t\tconst nodes = engine.stores.selectionStore.nodes\n\t\tconst frame = getBoundingFrameForNodes(\n\t\t\tengine.tree,\n\t\t\tnodes.length > 0 ? nodes : engine.stores.scopeStore.active.getGroundNodes(),\n\t\t)\n\n\t\tengine.stores.canvasStore.zoomToCenter(frame, {\n\t\t\tanimated: engine.stores.persistedUserDefaults.animateOnZoom,\n\t\t})\n\t}\n\n\tcollapseLayers() {\n\t\tif (engine.stores.selectionStore.ids.length > 0) {\n\t\t\tengine.stores.treeStore.collapseLayers(engine.stores.selectionStore.ids)\n\t\t} else {\n\t\t\t// If there is nothing selected, then we want to\n\t\t\t// collapse all of the ground nodes in the active scope.\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\t\t\tconst groundNodeIds = activeScope.getGroundNodes().map(n => n.id)\n\t\t\tengine.stores.treeStore.collapseLayers(groundNodeIds)\n\t\t}\n\t}\n\n\tresetZoom() {\n\t\tif (isCodeEditorVisible()) {\n\t\t\tengine.stores.persistedUserDefaults.editorFontSizeReset()\n\t\t\treturn\n\t\t}\n\t\tengine.stores.canvasStore.setZoom(1, { animated: engine.stores.persistedUserDefaults.animateOnZoom })\n\t}\n\n\ttoggleInterface() {\n\t\tengine.stores.chromeStore.chromeIsVisible = !engine.stores.chromeStore.chromeIsVisible\n\t}\n\n\ttoggleRulers() {\n\t\tengine.stores.persistedUserDefaults.displayRulers = !engine.stores.persistedUserDefaults.displayRulers\n\t\ttriggerToggleRulersEvent({ toggleVisible: engine.stores.persistedUserDefaults.displayRulers })\n\t}\n\n\ttoggleShowHandoff() {\n\t\tconst newValue = !engine.stores.persistedUserDefaults.showHandoff\n\t\tengine.stores.persistedUserDefaults.showHandoff = newValue\n\t\trecord(\"show_handoff_toggle\", { checked: newValue })\n\t}\n\n\ttoggleGrids() {\n\t\tif (!engine.stores.persistedUserDefaults.displayGrids) {\n\t\t\taddGridToSelection({\n\t\t\t\tengine,\n\t\t\t\tselection: engine.stores.selectionStore.ids,\n\t\t\t\tsource: \"main_menu\",\n\t\t\t\topenPopout: true,\n\t\t\t\tpreserveExisting: true,\n\t\t\t})\n\t\t}\n\t\tengine.stores.persistedUserDefaults.displayGrids = !engine.stores.persistedUserDefaults.displayGrids\n\t\ttriggerToggleGridsEvent({ toggleVisible: engine.stores.persistedUserDefaults.displayGrids })\n\t}\n\n\ttoggleShowPixelGrid() {\n\t\tengine.stores.persistedUserDefaults.showPixelGrid = !engine.stores.persistedUserDefaults.showPixelGrid\n\t}\n\n\ttoggleShowAllLinks() {\n\t\tconst newValue = !engine.stores.persistedUserDefaults.displayAllLinks\n\t\tengine.stores.persistedUserDefaults.displayAllLinks = newValue\n\t\trecord(\"show_all_links_toggle\", { checked: newValue })\n\t}\n\n\tshowPages() {\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Pages\n\t}\n\n\tshowLayers() {\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Layers\n\t}\n\n\tshowAssets() {\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Assets\n\t}\n\n\tshowAgent() {\n\t\tif (!getCanViewAgent(engine)) return\n\t\tconst { chromeStore } = engine.stores\n\t\t// If any `AgentChatInput` is currently mounted (canvas right panel, code editor side\n\t\t// panel, or CMS table panel), it has registered a focus callback \u2014 pressing A focuses it.\n\t\t// Otherwise open the canvas chat tab.\n\t\tif (chromeStore.focusAgentChatInput) {\n\t\t\tchromeStore.focusAgentChatInput()\n\t\t} else {\n\t\t\tchromeStore.activeRightPanelTab = CanvasPanelTab.Chat\n\t\t}\n\t}\n\n\tnewAgentChat() {\n\t\tif (!getCanViewAgent(engine)) return\n\t\tconst { chromeStore, agentStore } = engine.stores\n\t\tagentStore.activeChatAgentId = undefined\n\t\tif (chromeStore.focusAgentChatInput) {\n\t\t\tchromeStore.focusAgentChatInput()\n\t\t} else {\n\t\t\tchromeStore.pendingAgentChatInputFocus = true\n\t\t\tchromeStore.activeRightPanelTab = CanvasPanelTab.Chat\n\t\t}\n\t}\n}\n\ntype ToolActionTargetAction = Action | \"toggleInsert\" | \"generateWebPage\" | \"toggleLibraryModal\" | \"createWebPage\"\n\nconst toolActionTargetActions = [\n\t...Tools.allActions(),\n\t\"toggleInsert\",\n\t\"generateWebPage\",\n\t\"toggleLibraryModal\",\n\t\"createWebPage\",\n] satisfies ToolActionTargetAction[]\n\nclass ToolActionTarget implements ActionTarget<ToolActionTarget> {\n\t[key: `tool${string}`]: VoidFunction | undefined\n\n\twantedActions = toolActionTargetActions\n\twantsActions = isCanvasVisible\n\n\t#actionsAllowedInViewOnly = new Set<ToolActionTargetAction>([\"toolChat\", \"toolComment\", \"toolZoom\"])\n\n\twantsAction = (action: ToolActionTargetAction): ActionState => {\n\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\tconst { chromeStore } = engine.stores\n\t\tif ((isViewOnly || chromeStore.isPreviewingLocaleOnCanvas) && !this.#actionsAllowedInViewOnly.has(action)) {\n\t\t\treturn false\n\t\t}\n\t\tif (chromeStore.isPreviewingFeaturedTemplate && action === \"toolComment\") {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\n\toptionsForAction(action: ToolActionTargetAction): ActionOptions | undefined {\n\t\tconst { scopeStore, selectionStore } = engine.stores\n\t\tswitch (action) {\n\t\t\tcase Tools.actionForCase(Tools.Comment):\n\t\t\t\t// Was platform.isOn(\"supportsFeedback\")\n\t\t\t\treturn { visible: !(environment.isAutomation || environment.isTest) }\n\t\t\tcase Tools.actionForCase(Tools.Scale):\n\t\t\t\treturn {\n\t\t\t\t\tvisible: true,\n\t\t\t\t\tenabled: selectionStore.nodes.length > 0 && selectionStore.nodes.every(n => !isBreakpointVariant(n)),\n\t\t\t\t}\n\t\t\tcase Tools.actionForCase(Tools.CreateFrame):\n\t\t\tcase Tools.actionForCase(Tools.CreateRounded):\n\t\t\tcase Tools.actionForCase(Tools.CreateImage):\n\t\t\tcase Tools.actionForCase(Tools.CreateScreen):\n\t\t\tcase Tools.actionForCase(Tools.CreateVideo):\n\t\t\tcase Tools.actionForCase(Tools.CreateText):\n\t\t\tcase Tools.actionForCase(Tools.CreateStack):\n\t\t\t\treturn {\n\t\t\t\t\tvisible: scopeStore.scopeType !== ScopeType.VectorSet,\n\t\t\t\t}\n\t\t\tcase Tools.actionForCase(Tools.CreateRows):\n\t\t\tcase Tools.actionForCase(Tools.CreateColumns):\n\t\t\tcase Tools.actionForCase(Tools.CreateGrid):\n\t\t\tcase Tools.actionForCase(Tools.CreateGridRow):\n\t\t\tcase Tools.actionForCase(Tools.CreateGridSpan):\n\t\t\t\treturn {\n\t\t\t\t\t// If we make these not visible then the layout submenu will be empty and enabled\n\t\t\t\t\tenabled: scopeStore.scopeType !== ScopeType.VectorSet,\n\t\t\t\t}\n\t\t\tcase Tools.actionForCase(Tools.CreateMasonry):\n\t\t\t\treturn {\n\t\t\t\t\tvisible: experiments.isOn(\"masonryLayout\"),\n\t\t\t\t}\n\t\t\tcase Tools.actionForCase(Tools.AgentPanel):\n\t\t\t\treturn {\n\t\t\t\t\tvisible: experiments.isOn(\"agent\"),\n\t\t\t\t}\n\t\t}\n\t}\n\n\tconstructor() {\n\t\tfor (const name of Tools.allNames()) {\n\t\t\tconst key = Tools.actionForName(name)\n\t\t\tif (this[key]) continue\n\n\t\t\tthis[key] = () => {\n\t\t\t\tengine.setTool(Tools[name])\n\t\t\t\trecord(\"ui_interaction\", { id: `tool-${name}`, page: MetricsInteractionViews.MAIN_MENU })\n\t\t\t}\n\t\t}\n\t}\n\n\tcreateWebPage() {\n\t\treturn engine.createWebPage()\n\t}\n\n\ttoolPath() {\n\t\tengine.stores.selectionStore.clear()\n\t\tengine.setTool(Tools.Path)\n\t\trecord(\"ui_interaction\", { id: \"tool-Path\", page: MetricsInteractionViews.MAIN_MENU })\n\t}\n\n\ttoolScale() {\n\t\tconst { selectionStore } = engine.stores\n\t\tif (selectionStore.ids.length === 0) return\n\t\tif (selectionStore.nodes.some(n => isBreakpointVariant(n))) return\n\t\tif (engine.tool.enum === Tools.Scale) return // if tool is already, active, do not restart it\n\n\t\tengine.setTool(Tools.Scale)\n\t\tengine.stores.chromeStore.activeRightPanelTab = CanvasPanelTab.Properties\n\t\trecord(\"ui_interaction\", { id: \"tool-Scale\", page: MetricsInteractionViews.MAIN_MENU })\n\t}\n\n\ttoolAgentPanel() {\n\t\tconst currentTool = engine.tool.enum\n\t\tif (currentTool === Tools.AgentPanel || currentTool === Tools.AgentDragSelect) return\n\n\t\tContextAction.startAgentContextTool(engine)\n\t\trecord(\"ui_interaction\", { id: \"tool-AgentSelect\", page: MetricsInteractionViews.MAIN_MENU })\n\t}\n\n\ttoggleInsert() {\n\t\tengine.stores.chromeStore.toggleInsertSidebar()\n\t\t// If a user opens the insert toolbar, they know where to find it, so we shouldn't show a tooltip.\n\t\tdismissInsertTooltip()\n\t}\n\n\tgenerateWebPage() {\n\t\tif (!experiments.isOn(\"wireframerKits\")) {\n\t\t\tengine.stores.chromeStore.showInsertSidebar()\n\t\t\tengine.stores.insertSidebarStore.activeCategoryType = \"wireframer\"\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.chromeStore.showAiSidebar()\n\t}\n\n\ttoggleLibraryModal() {\n\t\tContextAction.toggleTeamLibrary(engine)\n\t}\n}\n\ntype LayoutActions = PickAppActions<\n\t| \"addEnclosingFrame\"\n\t| \"addEnclosingStack\"\n\t| \"autoSizeLayout\"\n\t| \"removeFramePreservingChildren\"\n\t| \"sizeToFitContent\"\n\t| \"moveForward\"\n\t| \"moveBackward\"\n\t| \"moveToFront\"\n\t| \"moveToBack\"\n\t| \"alignLeft\"\n\t| \"alignCenter\"\n\t| \"alignRight\"\n\t| \"alignTop\"\n\t| \"alignMiddle\"\n\t| \"alignBottom\"\n\t| \"distributeHorizontal\"\n\t| \"distributeVertical\"\n\t| \"alignToSelection\"\n\t| \"alignToParent\"\n>\n\nconst layoutActionStateProvider: ActionStateProvider<LayoutActions, MenuContext> = {\n\taddEnclosingFrame: context => {\n\t\treturn ContextAction.wrappingEnabled(engine, context.nodes)\n\t},\n\taddEnclosingStack: context => {\n\t\treturn ContextAction.wrappingEnabled(engine, context.nodes)\n\t},\n\tautoSizeLayout: context => {\n\t\tconst { withoutDescendants } = context\n\t\tconst shouldAutoSizeNodes =\n\t\t\twithoutDescendants.length === 1 &&\n\t\t\tcanAutoSizeNodes(engine.componentLoader, withoutDescendants, getIsViewOnly(engine, \"canDesign\"))\n\n\t\treturn (\n\t\t\tshouldAutoSizeNodes ||\n\t\t\tContextAction.canWrapInAutoSizedFrame(engine, context.nodes) ||\n\t\t\tContextAction.wrappingEnabled(engine, context.nodes)\n\t\t)\n\t},\n\tremoveFramePreservingChildren: context => {\n\t\treturn ContextAction.removeFrameEnabled(engine, context.nodes)\n\t},\n\tmoveForward: context => {\n\t\treturn ContextAction.sendForwardEnabled(context.tree, context.nodes)\n\t},\n\tmoveBackward: context => {\n\t\treturn ContextAction.sendBackwardEnabled(context.tree, context.nodes)\n\t},\n\tmoveToFront: context => {\n\t\treturn ContextAction.sendForwardEnabled(context.tree, context.nodes)\n\t},\n\tmoveToBack: context => {\n\t\treturn ContextAction.sendBackwardEnabled(context.tree, context.nodes)\n\t},\n\tsizeToFitContent: context => {\n\t\treturn sizeToFitContentEnabled(engine.componentLoader, context.nodes)\n\t},\n\talignLeft: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\talignCenter: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\talignRight: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\talignTop: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\talignMiddle: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\talignBottom: context => {\n\t\treturn context.alignmentEnabled\n\t},\n\tdistributeHorizontal: context => {\n\t\treturn context.distributionEnabled\n\t},\n\tdistributeVertical: context => {\n\t\treturn context.distributionEnabled\n\t},\n\talignToSelection: context => {\n\t\treturn context.alignToParentOptionsEnabled\n\t},\n\talignToParent: context => {\n\t\treturn context.alignToParentOptionsEnabled\n\t},\n}\n\nclass LayoutActionTarget implements LayoutActions {\n\twantedActions = Object.keys(layoutActionStateProvider) as (keyof LayoutActions & AppAction)[]\n\twantsActions = () => isCanvasVisible() && !engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\twantsAction = (action: keyof LayoutActions): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) return false\n\t\treturn layoutActionStateProvider[action](getMenuContext())\n\t}\n\n\toptionsForAction(action: keyof LayoutActions): ActionOptions | undefined {\n\t\tif (action === \"alignToSelection\" || action === \"alignToParent\") {\n\t\t\tconst { alignToParentOptionsEnabled } = getMenuContext()\n\t\t\treturn {\n\t\t\t\tchecked:\n\t\t\t\t\talignToParentOptionsEnabled &&\n\t\t\t\t\t(engine.stores.persistedUserDefaults.alignToParent\n\t\t\t\t\t\t? action === \"alignToParent\"\n\t\t\t\t\t\t: action === \"alignToSelection\"),\n\t\t\t}\n\t\t}\n\t\tif (action === \"autoSizeLayout\") {\n\t\t\tconst { withoutDescendants } = getMenuContext()\n\t\t\tconst shouldAutoSizeNodes =\n\t\t\t\twithoutDescendants.length === 1 &&\n\t\t\t\tcanAutoSizeNodes(engine.componentLoader, withoutDescendants, getIsViewOnly(engine, \"canDesign\"))\n\n\t\t\tif (shouldAutoSizeNodes) {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: actionLabels.autoSizeLayout,\n\t\t\t\t\tenabled: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tContextAction.canWrapInAutoSizedFrame(engine, engine.stores.selectionStore.nodes) ||\n\t\t\t\tContextAction.wrappingEnabled(engine, engine.stores.selectionStore.nodes)\n\t\t\t) {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: \"Add Stack Layout\",\n\t\t\t\t\tenabled: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tlabel: actionLabels.autoSizeLayout,\n\t\t\t\tenabled: false,\n\t\t\t}\n\t\t}\n\t}\n\n\taddEnclosingFrame() {\n\t\tContextAction.addFrame(engine, engine.stores.selectionStore.nodes)\n\t\trecord(\"layout_frame\", { source: \"main_menu\" })\n\t}\n\n\taddEnclosingStack() {\n\t\tContextAction.addStack(engine, engine.stores.selectionStore.nodes)\n\t\t// Metrics.push({ type: MetricEventType.LAYOUT_CREATE_FRAME, source: \"main_menu\" })\n\t}\n\n\tautoSizeLayout() {\n\t\tconst { withoutDescendants } = getMenuContext()\n\t\tconst shouldAutoSize =\n\t\t\twithoutDescendants.length === 1 &&\n\t\t\tcanAutoSizeNodes(engine.componentLoader, withoutDescendants, getIsViewOnly(engine, \"canDesign\"))\n\n\t\tif (shouldAutoSize) {\n\t\t\tthis.autoSize()\n\t\t\treturn\n\t\t}\n\n\t\tif (ContextAction.canWrapInAutoSizedFrame(engine, engine.stores.selectionStore.nodes)) {\n\t\t\tthis.addStackLayout()\n\t\t\treturn\n\t\t}\n\n\t\tthis.addEnclosingStack()\n\t}\n\n\tprivate addStackLayout() {\n\t\tContextAction.wrapInAutoSizedFrame(engine, engine.stores.selectionStore.nodes, \"main_menu\")\n\t}\n\n\tremoveFramePreservingChildren() {\n\t\tContextAction.removeFrame(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tprivate autoSize() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tenableAutoSizeForNodes(engine, withoutDescendants, \"main_menu\")\n\t}\n\n\tasync sizeToFitContent() {\n\t\tawait measureCodeComponentsAndSizeToFit(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tmoveForward() {\n\t\tContextAction.sendForward(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tmoveBackward() {\n\t\tContextAction.sendBackward(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tmoveToFront() {\n\t\tContextAction.sendToFront(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tmoveToBack() {\n\t\tContextAction.sendToBack(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\talignLeft() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, Dictionary.Left)\n\t}\n\n\talignCenter() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, \"Center\")\n\t}\n\n\talignRight() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, Dictionary.Right)\n\t}\n\n\talignTop() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, Dictionary.Top)\n\t}\n\n\talignMiddle() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, Dictionary.Middle)\n\t}\n\n\talignBottom() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.align(engine.tree, withoutDescendants, Dictionary.Bottom)\n\t}\n\n\tdistributeHorizontal() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.distribute(engine.tree, withoutDescendants, \"Horizontally\")\n\t}\n\n\tdistributeVertical() {\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(engine.stores.selectionStore.nodes)\n\t\tContextAlignment.distribute(engine.tree, withoutDescendants, \"Vertically\")\n\t}\n\n\talignToSelection() {\n\t\tengine.stores.persistedUserDefaults.alignToParent = false\n\t}\n\n\talignToParent() {\n\t\tengine.stores.persistedUserDefaults.alignToParent = true\n\t}\n}\n\ntype TextActions = PickAppActions<\"makeBold\" | \"makeItalic\" | \"makeUnderlined\" | \"chooseFontFamily\">\n\nconst textActionStateProvider: ActionStateProvider<TextActions, MenuContext> = {\n\tmakeBold: context => {\n\t\treturn context.onlyTextNodes\n\t},\n\tmakeItalic: context => {\n\t\treturn context.onlyTextNodes\n\t},\n\tmakeUnderlined: context => {\n\t\treturn context.onlyTextNodes\n\t},\n\tchooseFontFamily: canToggleFontPopout,\n}\n\ntype TextActionFormattingType = \"bold\" | \"italic\" | \"underline\"\nclass TextActionTarget implements TextActions {\n\twantedActions = Object.keys(textActionStateProvider) as (keyof TextActions & AppAction)[]\n\twantsActions = isCanvasVisible\n\n\twantsAction = (action: keyof TextActions): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) return false\n\t\treturn textActionStateProvider[action](getMenuContext())\n\t}\n\n\tmakeBold() {\n\t\tthis.formatCurrentSelection(\"bold\")\n\t}\n\n\tmakeItalic() {\n\t\tthis.formatCurrentSelection(\"italic\")\n\t}\n\n\tmakeUnderlined() {\n\t\tthis.formatCurrentSelection(\"underline\")\n\t}\n\n\t/**\n\t * Determines if the current node is currently being edited and ensures the formatting is applied\n\t * appropriately either to the selected text or to the node as a whole.\n\t * @param type the formatting style to be applied.\n\t */\n\tprivate formatCurrentSelection(type: TextActionFormattingType) {\n\t\tif (engine.stores.toolStore.tool === Tools.TextEdit) {\n\t\t\t// If editing we dispatch a keyboard event and have it picked up directly by the Editor\n\t\t\tconst eventInit = this.keydownEventOptionsForType(type)\n\n\t\t\t// We're already within an event handling phase and dispatching\n\t\t\t// this event will cause Draft to re-render causing the engine\n\t\t\t// to freakout. Instead enqueue this for the next frame.\n\t\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\t\tdocument.activeElement?.dispatchEvent(new KeyboardEvent(\"keydown\", { metaKey: true, ...eventInit }))\n\t\t\t})\n\t\t} else {\n\t\t\t// Otherwise apply formatting to the entire node.\n\t\t\tthis.applyFormattingForType(type)\n\t\t}\n\t}\n\n\tprivate keydownEventOptionsForType(type: TextActionFormattingType): Partial<KeyboardEventInit> {\n\t\tswitch (type) {\n\t\t\tcase \"bold\":\n\t\t\t\treturn { key: \"b\", code: \"KeyB\", keyCode: 66 }\n\t\t\tcase \"italic\":\n\t\t\t\treturn { key: \"i\", code: \"KeyI\", keyCode: 73 }\n\t\t\tcase \"underline\":\n\t\t\t\treturn { key: \"u\", code: \"KeyU\", keyCode: 85 }\n\t\t\tdefault:\n\t\t\t\treturn assertNever(type)\n\t\t}\n\t}\n\n\tprivate applyFormattingForType(type: TextActionFormattingType): void {\n\t\tconst { tree } = engine\n\t\tconst nodes = tree.getNodes(engine.stores.selectionStore.ids)\n\t\tconst textNodes = nodes.filter(isTextNode)\n\n\t\tconst onlyTextNodesSelected = nodes.length === textNodes.length\n\t\tif (!onlyTextNodesSelected) return\n\n\t\tfor (const node of textNodes) {\n\t\t\tconst newStyledText = formatText(node, node.styledText as StyledTextDraft, type)\n\t\t\tif (!newStyledText) continue\n\t\t\tnode.set({ styledText: newStyledText })\n\t\t}\n\t}\n\n\tchooseFontFamily() {\n\t\t// Blur active element before focusing font panel\n\t\tif (document.activeElement instanceof HTMLElement) {\n\t\t\tdocument.activeElement.blur()\n\t\t}\n\t\ttoggleFontPopout()\n\t}\n}\n\nfunction formatText(node: TextNode<unknown>, styledText: StyledTextDraft, type: TextActionFormattingType) {\n\tswitch (type) {\n\t\tcase \"bold\":\n\t\t\treturn styledText.toggleBold(false)\n\n\t\tcase \"italic\":\n\t\t\treturn styledText.toggleItalic(false)\n\n\t\t// Only handle underline for the whole text node.\n\t\t// Partial underline is handled in TextEditor.onUnderline\n\t\tcase \"underline\": {\n\t\t\tconst currentStyle = node.getTextDecorations(false)\n\n\t\t\t// Clear the text decoration if the whole text is underlined\n\t\t\tif (currentStyle.length === 1 && currentStyle[0] === \"underline\") {\n\t\t\t\tnode.setTextDecoration(\"none\", false)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Set text decoration to underline if it has something else than underline\n\t\t\tnode.setTextDecoration(\"underline\", false)\n\t\t\treturn\n\t\t}\n\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\ntype ShapeActions = PickAppActions<\n\t\"group\" | \"ungroup\" | \"flipHorizontal\" | \"flipVertical\" | \"convertToOutline\" | \"flattenPath\" | \"reversePath\"\n>\n\nconst shapeActionStateProvider: ActionStateProvider<ShapeActions, MenuContext> = {\n\tgroup: _context => {\n\t\treturn ContextAction.canJoinInGroup(engine, engine.stores.selectionStore.nodes)\n\t},\n\tungroup: context => {\n\t\treturn ContextAction.canUngroup(context.tree, engine.stores.selectionStore.nodes)\n\t},\n\tflipHorizontal: context => {\n\t\treturn context.onlyShapeNodes\n\t},\n\tflipVertical: context => {\n\t\treturn context.onlyShapeNodes\n\t},\n\tconvertToOutline: _context => {\n\t\treturn experiments.isOn(\"convertToOutline\") && convertToOutlineEnabled(engine.stores.selectionStore.nodes)\n\t},\n\tflattenPath: _context => {\n\t\treturn flattenEnabled(engine, engine.stores.selectionStore.nodes)\n\t},\n\treversePath: _context => {\n\t\treturn Boolean(ContextAction.reversePathDirectionEnabled(engine.stores.selectionStore.nodes))\n\t},\n}\n\nclass ShapeActionTarget implements ShapeActions {\n\twantedActions = Object.keys(shapeActionStateProvider) as (keyof ShapeActions & AppAction)[]\n\twantsActions = isCanvasVisible\n\n\twantsAction = (action: keyof ShapeActions): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) return false\n\t\treturn shapeActionStateProvider[action](getMenuContext())\n\t}\n\n\toptionsForAction(action: keyof ShapeActions): ActionOptions | undefined {\n\t\tif (action === \"convertToOutline\") {\n\t\t\treturn {\n\t\t\t\tvisible: experiments.isOn(\"convertToOutline\"),\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t}\n\n\tgroup() {\n\t\tContextAction.joinInGroup(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tungroup() {\n\t\tContextAction.ungroup(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tprivate flip(direction: \"horizontal\" | \"vertical\") {\n\t\tflipShapes(engine.tree, engine, engine.stores.selectionStore.ids, direction)\n\t}\n\n\tflipHorizontal() {\n\t\tthis.flip(\"horizontal\")\n\t}\n\n\tflipVertical() {\n\t\tthis.flip(\"vertical\")\n\t}\n\n\tasync convertToOutline() {\n\t\tif (engine.stores.selectionStore.nodes.length !== 1) return\n\t\tconst selectedNode = engine.stores.selectionStore.nodes[0]\n\t\tif (!selectedNode) return\n\t\tawait convertToOutline(engine, selectedNode)\n\t}\n\n\tflattenPath() {\n\t\tif (flattenEnabled(engine, engine.stores.selectionStore.nodes)) {\n\t\t\tflattenShapes(engine, engine.stores.selectionStore.nodes)\n\t\t}\n\t}\n\n\treversePath() {\n\t\tconst node = engine.stores.selectionStore.nodes.length === 1 ? engine.stores.selectionStore.nodes[0] : undefined\n\t\tif (node && withPath(node)) {\n\t\t\tContextAction.reversePathDirection(engine.tree, node)\n\t\t}\n\t}\n}\n\ntype ShapeBooleanActions = PickAppActions<\"unite\" | \"subtract\" | \"intersect\" | \"exclude\" | \"join\">\n\nconst shapeBooleanActionStateProvider: ActionStateProvider<ShapeBooleanActions, MenuContext> = {\n\tunite: context => shapeBooleanActionsEnabled(context.withoutDescendants),\n\tsubtract: context => shapeBooleanActionsEnabled(context.withoutDescendants),\n\tintersect: context => shapeBooleanActionsEnabled(context.withoutDescendants),\n\texclude: context => shapeBooleanActionsEnabled(context.withoutDescendants),\n\tjoin: context => shapeBooleanActionsEnabled(context.withoutDescendants),\n}\n\nclass ShapeBooleanActionTarget implements ShapeBooleanActions {\n\twantedActions = Object.keys(shapeBooleanActionStateProvider) as (keyof ShapeBooleanActions & AppAction)[]\n\twantsActions = isCanvasVisible\n\n\twantsAction = (action: keyof ShapeBooleanActions): ActionState => {\n\t\treturn shapeBooleanActionStateProvider[action](getMenuContext())\n\t}\n\n\tprivate performAction(type: PathBooleanType) {\n\t\tperformShapeBooleanAction(\n\t\t\tengine.stores.selectionStore.nodes,\n\t\t\tengine.tree.withoutDescendants(engine.stores.selectionStore.nodes),\n\t\t\ttype,\n\t\t)\n\t}\n\n\tunite() {\n\t\tthis.performAction(PathBooleanType.Unite)\n\t}\n\n\tsubtract() {\n\t\tthis.performAction(PathBooleanType.Subtract)\n\t}\n\n\tintersect() {\n\t\tthis.performAction(PathBooleanType.Intersect)\n\t}\n\n\texclude() {\n\t\tthis.performAction(PathBooleanType.Exclude)\n\t}\n\n\tjoin() {\n\t\tthis.performAction(PathBooleanType.Join)\n\t}\n}\n\ntype ComponentActions = PickAppActions<\n\t| \"makeComponent\"\n\t| \"makeCodeComponent\"\n\t| \"showComponentMaster\"\n\t| \"detachComponentInstanceFromMaster\"\n\t| \"updateComponentMasterFromInstance\"\n\t| \"resetComponentInstanceOverrides\"\n>\n\nconst componentActionStateProvider: ActionStateProvider<ComponentActions, MenuContext> = {\n\tmakeComponent: context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\") && ContextAction.canMakeComponent(engine, context.nodes)\n\t},\n\tmakeCodeComponent: _context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\")\n\t},\n\tshowComponentMaster: context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\") && ContextAction.canGoToMaster(context.tree, context.nodes) > 0\n\t},\n\tdetachComponentInstanceFromMaster: context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\") && ContextAction.canDetachFromMaster(engine, context.nodes)\n\t},\n\tupdateComponentMasterFromInstance: context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\") && ContextAction.canUpdateMasterFromInstance(context.tree, context.nodes)\n\t},\n\tresetComponentInstanceOverrides: context => {\n\t\treturn !getIsViewOnly(engine, \"canDesign\") && ContextAction.canResetToMasterValues(context.tree, context.nodes)\n\t},\n}\n\nclass ComponentActionTarget implements ComponentActions {\n\twantedActions = Object.keys(componentActionStateProvider) as (keyof ComponentActions & AppAction)[]\n\twantsActions = () => isCanvasOrCodeEditorVisible() && !engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\twantsAction = (action: keyof ComponentActions): ActionState => {\n\t\treturn componentActionStateProvider[action](getMenuContext())\n\t}\n\n\tmakeComponent() {\n\t\tContextAction.makeComponent(engine, \"main_menu\")\n\t}\n\n\tmakeCodeComponent() {\n\t\tContextAction.createCodeComponent(engine)\n\t}\n\n\tshowComponentMaster() {\n\t\tContextAction.goToMaster(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tdetachComponentInstanceFromMaster() {\n\t\tContextAction.detachFromMaster(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tupdateComponentMasterFromInstance() {\n\t\tContextAction.updateMasterFromInstance(engine, engine.stores.selectionStore.nodes)\n\t}\n\n\tresetComponentInstanceOverrides() {\n\t\tContextAction.resetToMasterValues(engine.tree, engine.stores.selectionStore.nodes)\n\t}\n}\n\ntype CodeActions = PickAppActions<\"createCodeComponent\" | \"createOverride\" | \"showAPIDocumentation\" | \"saveCodeFile\">\n\nclass CodeActionTarget implements CodeActions {\n\twantedActions: (keyof CodeActions & AppAction)[] = [\n\t\t\"createCodeComponent\",\n\t\t\"createOverride\",\n\t\t\"showAPIDocumentation\",\n\t\t\"saveCodeFile\",\n\t]\n\n\twantsActions = () => isCanvasOrCodeEditorVisible()\n\n\twantsAction = (action: keyof CodeActions): ActionState => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) {\n\t\t\tswitch (action) {\n\t\t\t\tcase \"createCodeComponent\":\n\t\t\t\tcase \"createOverride\":\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn isCanvasOrCodeEditorVisible()\n\t}\n\n\toptionsForAction(action: keyof CodeActions): ActionOptions | undefined {\n\t\tif (action === \"saveCodeFile\") {\n\t\t\treturn {\n\t\t\t\tvisible: engine.stores.codeEditorStore.currentCodeFileId != null && !getIsViewOnly(engine, \"canDesign\"),\n\t\t\t}\n\t\t}\n\t}\n\n\tcreateCodeComponent() {\n\t\tContextAction.createCodeComponent(engine)\n\t}\n\n\tcreateOverride() {\n\t\tContextAction.createCodeOverride(engine)\n\t}\n\n\tshowAPIDocumentation() {\n\t\topenNewTab(\"https://www.framer.com/api\")\n\t}\n\n\tsaveCodeFile() {\n\t\tengine.stores.codeEditorStore.saveCurrentFile().catch(unhandledError)\n\t}\n}\n\ntype PreferencesActions = PickAppActions<\n\t| \"newContentAsDraft\"\n\t| \"useDirectSelect\"\n\t| \"autoSwitchToLayers\"\n\t| \"nudgePreferences\"\n\t| \"animateOnZoom\"\n\t| \"reverseZoomDirection\"\n\t| \"fastZoom\"\n\t| \"keyboardZoomsToSelection\"\n\t| \"showScrollToContentToast\"\n\t| \"resetDefaultFrameBackground\"\n\t| \"togglePerformanceMode\"\n\t| \"toggleCanvasPages\"\n\t| \"exitCanvasOnDoubleClick\"\n\t| \"templatesModalOnNewProject\"\n>\n\nclass PreferencesActionTarget implements PreferencesActions {\n\twantedActions = [\n\t\t\"newContentAsDraft\",\n\t\t\"useDirectSelect\",\n\t\t\"autoSwitchToLayers\",\n\t\t\"nudgePreferences\",\n\t\t\"animateOnZoom\",\n\t\t\"showScrollToContentToast\",\n\t\t\"resetDefaultFrameBackground\",\n\t\t\"reverseZoomDirection\",\n\t\t\"fastZoom\",\n\t\t\"keyboardZoomsToSelection\",\n\t\t\"togglePerformanceMode\",\n\t\t\"toggleCanvasPages\",\n\t\t\"exitCanvasOnDoubleClick\",\n\t\t\"templatesModalOnNewProject\",\n\t] as (keyof PreferencesActions & AppAction)[]\n\twantsActions = () => true\n\twantsAction = (action: keyof PreferencesActions): ActionState => {\n\t\tif (action === \"resetDefaultFrameBackground\") {\n\t\t\treturn Boolean(engine.stores.persistedUserDefaults.frameBackground)\n\t\t}\n\t\treturn true\n\t}\n\n\toptionsForAction(action: keyof PreferencesActions): ActionOptions | undefined {\n\t\tif (action === \"useDirectSelect\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.useDirectSelect }\n\t\t} else if (action === \"autoSwitchToLayers\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.autoSwitchToLayers,\n\t\t\t}\n\t\t} else if (action === \"animateOnZoom\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.animateOnZoom }\n\t\t} else if (action === \"reverseZoomDirection\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.reverseZoomDirection }\n\t\t} else if (action === \"fastZoom\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.fastZoom }\n\t\t} else if (action === \"keyboardZoomsToSelection\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.keyboardZoomsToSelection }\n\t\t} else if (action === \"showScrollToContentToast\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.showScrollToContentToast,\n\t\t\t}\n\t\t} else if (action === \"togglePerformanceMode\") {\n\t\t\treturn { checked: engine.stores.persistedUserDefaults.performanceMode }\n\t\t} else if (action === \"toggleCanvasPages\") {\n\t\t\treturn {\n\t\t\t\tvisible: projectFeatures.isOn(\"canvasPages\"),\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.canvasPage,\n\t\t\t}\n\t\t} else if (action === \"newContentAsDraft\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.newContentAsDraft,\n\t\t\t}\n\t\t} else if (action === \"exitCanvasOnDoubleClick\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.exitCanvasOnDoubleClick,\n\t\t\t}\n\t\t} else if (action === \"templatesModalOnNewProject\") {\n\t\t\treturn {\n\t\t\t\tchecked: engine.stores.persistedUserDefaults.templatesModalOnNewProject,\n\t\t\t\tvisible: experiments.isOn(\"templatesModal\"),\n\t\t\t}\n\t\t}\n\t}\n\n\tnewContentAsDraft() {\n\t\tengine.stores.persistedUserDefaults.newContentAsDraft = !engine.stores.persistedUserDefaults.newContentAsDraft\n\t}\n\n\tuseDirectSelect() {\n\t\tengine.stores.persistedUserDefaults.useDirectSelect = !engine.stores.persistedUserDefaults.useDirectSelect\n\t}\n\n\tautoSwitchToLayers() {\n\t\tengine.stores.persistedUserDefaults.autoSwitchToLayers = !engine.stores.persistedUserDefaults.autoSwitchToLayers\n\t}\n\n\tnudgePreferences() {\n\t\tif (engine.stores.modalStore.active.type === ModalType.NudgePreferences) {\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t} else {\n\t\t\tengine.stores.modalStore.set({ type: ModalType.NudgePreferences, source: \"main_menu\" })\n\t\t}\n\t}\n\n\tresetDefaultFrameBackground() {\n\t\tengine.stores.persistedUserDefaults.frameBackground = null\n\t}\n\n\tanimateOnZoom() {\n\t\tengine.stores.persistedUserDefaults.animateOnZoom = !engine.stores.persistedUserDefaults.animateOnZoom\n\t}\n\n\treverseZoomDirection() {\n\t\tengine.stores.persistedUserDefaults.reverseZoomDirection = !engine.stores.persistedUserDefaults.reverseZoomDirection\n\t}\n\n\tfastZoom() {\n\t\tengine.stores.persistedUserDefaults.fastZoom = !engine.stores.persistedUserDefaults.fastZoom\n\t}\n\n\tkeyboardZoomsToSelection() {\n\t\tengine.stores.persistedUserDefaults.keyboardZoomsToSelection =\n\t\t\t!engine.stores.persistedUserDefaults.keyboardZoomsToSelection\n\t}\n\n\tshowScrollToContentToast() {\n\t\tengine.stores.persistedUserDefaults.showScrollToContentToast =\n\t\t\t!engine.stores.persistedUserDefaults.showScrollToContentToast\n\t}\n\n\ttogglePerformanceMode() {\n\t\tengine.stores.persistedUserDefaults.performanceMode = !engine.stores.persistedUserDefaults.performanceMode\n\t}\n\n\ttoggleCanvasPages() {\n\t\tengine.stores.persistedUserDefaults.canvasPage = !engine.stores.persistedUserDefaults.canvasPage\n\t}\n\n\texitCanvasOnDoubleClick() {\n\t\tengine.stores.persistedUserDefaults.exitCanvasOnDoubleClick =\n\t\t\t!engine.stores.persistedUserDefaults.exitCanvasOnDoubleClick\n\t}\n\n\ttemplatesModalOnNewProject() {\n\t\tengine.stores.persistedUserDefaults.templatesModalOnNewProject =\n\t\t\t!engine.stores.persistedUserDefaults.templatesModalOnNewProject\n\t}\n}\n\ntype HelpActions = PickAppActions<\n\t| \"keyboardShortcuts\"\n\t| \"requestFeature\"\n\t| \"openCommunity\"\n\t| \"copyVersion\"\n\t| \"sitesGetStarted\"\n\t| \"startAppTour\"\n\t| \"browseMarketplace\"\n>\n\nclass HelpActionTarget implements HelpActions {\n\twantedActions = [\n\t\t\"keyboardShortcuts\",\n\t\t\"requestFeature\",\n\t\t\"openCommunity\",\n\t\t\"copyVersion\",\n\t\t\"sitesGetStarted\",\n\t\t\"startAppTour\",\n\t\t\"browseMarketplace\",\n\t] as (keyof HelpActions & AppAction)[]\n\twantsActions = () => !engine.stores.siteSettingsStore.isOpen\n\twantsAction = (action: keyof HelpActionTarget): ActionState => {\n\t\tif (action === \"startAppTour\") {\n\t\t\treturn !engine.stores.chromeStore.isTutorialActive\n\t\t}\n\t\treturn true\n\t}\n\n\tkeyboardShortcuts() {\n\t\tif (engine.stores.modalStore.active.type === ModalType.Shortcuts) {\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t} else {\n\t\t\tengine.stores.modalStore.set({ type: ModalType.Shortcuts, source: \"main_menu\" })\n\t\t}\n\t}\n\n\t// NOTE: These links are also in Web\u2019s Sidebar.tsx\n\n\trequestFeature() {\n\t\topenNewTab(requestFeatureURL)\n\t}\n\n\tsitesGetStarted() {\n\t\topenNewTab(academyURL)\n\t}\n\n\topenCommunity() {\n\t\topenNewTab(communityURL)\n\t}\n\n\tcopyVersion() {\n\t\t// Implemented in useActionManager.tsx\n\t}\n\n\tstartAppTour() {\n\t\tengine.stores.chromeStore.isTutorialActive = true\n\t}\n\n\tbrowseMarketplace() {\n\t\topenNewTab(marketplaceURL)\n\t}\n}\n\nconst collectionActions = [\"nextCollectionItem\", \"previousCollectionItem\"] satisfies AppAction[]\ntype CollectionActions = PickAppActions<(typeof collectionActions)[number]>\n\nclass CollectionActionTarget implements CollectionActions, ActionTarget<CollectionActions> {\n\twantedActions = collectionActions\n\n\toptionsForAction(action: keyof CollectionActions): ActionOptions {\n\t\tswitch (action) {\n\t\t\tcase \"previousCollectionItem\": {\n\t\t\t\treturn { visible: this.#hasActiveCollection(), enabled: this.#hasPreviousCollectionItem() }\n\t\t\t}\n\n\t\t\tcase \"nextCollectionItem\": {\n\t\t\t\treturn { visible: this.#hasActiveCollection(), enabled: this.#hasNextCollectionItem() }\n\t\t\t}\n\t\t}\n\t}\n\n\twantsAction = (action: keyof CollectionActions): ActionState => {\n\t\tswitch (action) {\n\t\t\tcase \"nextCollectionItem\":\n\t\t\t\treturn this.#hasActiveCollection() && this.#hasNextCollectionItem()\n\t\t\tcase \"previousCollectionItem\":\n\t\t\t\treturn this.#hasActiveCollection() && this.#hasPreviousCollectionItem()\n\t\t}\n\t}\n\n\tnextCollectionItem() {\n\t\tthis.#updateCollectionItemInDirection(1)\n\t}\n\n\tpreviousCollectionItem() {\n\t\tthis.#updateCollectionItemInDirection(-1)\n\t}\n\n\t#updateCollectionItemInDirection(direction: -1 | 1) {\n\t\tconst collectionItemToSelect = this.#getCollectionItemInDirection(direction)\n\t\tif (!collectionItemToSelect) return\n\n\t\tengine.stores.scopeStore.setSelectedCollectionItemForWebPage(\n\t\t\tengine.stores.scopeStore.active.id,\n\t\t\tcollectionItemToSelect.id,\n\t\t)\n\t}\n\n\t#getActiveCollection() {\n\t\tconst activeNode = engine.stores.scopeStore.active\n\t\tif (!hasCollectionDataSource(activeNode)) return\n\n\t\treturn getCollectionForIdentifier(engine.tree, activeNode.dataIdentifier) ?? undefined\n\t}\n\n\t#getActiveCollectionItemId() {\n\t\tconst activeNode = engine.stores.scopeStore.active\n\t\treturn getSelectedCollectionItemForWebPage(engine, activeNode.id)\n\t}\n\n\t#getNextCollectionItem() {\n\t\treturn this.#getCollectionItemInDirection(1)\n\t}\n\n\t#getPreviousCollectionItem() {\n\t\treturn this.#getCollectionItemInDirection(-1)\n\t}\n\n\t#hasActiveCollection() {\n\t\treturn this.#getActiveCollection() !== undefined\n\t}\n\n\t#hasNextCollectionItem() {\n\t\treturn this.#getNextCollectionItem() !== undefined\n\t}\n\n\t#hasPreviousCollectionItem() {\n\t\treturn this.#getPreviousCollectionItem() !== undefined\n\t}\n\n\t#getCollectionItemInDirection(direction: -1 | 1) {\n\t\tconst collection = this.#getActiveCollection()\n\t\tif (!collection) return\n\n\t\tconst { selectedItemId } = this.#getActiveCollectionItemId()\n\t\tif (!selectedItemId) return\n\n\t\tconst allItems = collection.getSortedChildren(\"public-only\", \"group-drafts\")\n\t\tconst index = allItems.findIndex(item => item.id === selectedItemId)\n\t\tif (index < 0) return\n\n\t\treturn allItems[index + direction]\n\t}\n}\n\nexport const nativeActionTarget = new NativeActionTarget()\nconst newPageActionTarget = new NewPageActionTarget()\nconst quickActionsActionTarget = new QuickActionsActionTarget()\nconst importActionTarget = new ImportActionTarget()\nconst fileActionTarget = new FileActionTarget()\nconst editActionTarget = new EditActionTarget()\nconst viewActionTarget = new ViewActionTarget()\nconst toolActionTarget = new ToolActionTarget()\nconst layoutActionTarget = new LayoutActionTarget()\nconst textActionTarget = new TextActionTarget()\nconst shapeActionTarget = new ShapeActionTarget()\nconst shapeBooleanActionTarget = new ShapeBooleanActionTarget()\nconst componentActionTarget = new ComponentActionTarget()\nconst codeActionTarget = new CodeActionTarget()\nconst preferencesActionTarget = new PreferencesActionTarget()\nconst helpActionTarget = new HelpActionTarget()\nconst collectionActionTarget = new CollectionActionTarget()\nconst kitActionTarget = new KitActionTarget()\n\nexport const documentActionTarget = ActionTarget.chain(nativeActionTarget)\n\t.then(quickActionsActionTarget)\n\t.then(newPageActionTarget)\n\t.then(importActionTarget)\n\t.then(fileActionTarget)\n\t.then(editActionTarget)\n\t.then(viewActionTarget)\n\t.then(toolActionTarget)\n\t.then(layoutActionTarget)\n\t.then(textActionTarget)\n\t.then(shapeActionTarget)\n\t.then(shapeBooleanActionTarget)\n\t.then(componentActionTarget)\n\t.then(codeActionTarget)\n\t.then(preferencesActionTarget)\n\t.then(helpActionTarget)\n\t.then(collectionActionTarget)\n\t.then(kitActionTarget)\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport type { EngineStores } from \"document/EngineStores.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport { isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { isShapeContainerNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport React from \"react\"\n\nexport const gridOverdraw = 32\nconst gridZoomLevel = 8\n\nexport function shouldShowPixelGrid(stores: EngineStores) {\n\tconst zoom = stores.canvasStore.zoom\n\tconst showPixelGrid = stores.persistedUserDefaults.showPixelGrid\n\tconst shapeSelected = stores.selectionStore.nodes.some(node => isVectorNode(node) || isShapeContainerNode(node))\n\tconst { shapeToolActive } = stores.toolStore\n\n\treturn zoom >= gridZoomLevel && (shapeSelected || shapeToolActive || showPixelGrid)\n}\n\ninterface State {\n\tzoom: number\n\tcolorSamplerActive: boolean\n\tshapeModeActive: boolean\n\tshowPixelGrid: boolean\n}\n\nclass Grid extends React.PureComponent<{}, State> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.CanvasZoom,\n\t\tEngineChange.CanvasStore,\n\t\tEngineChange.UserDefaultsStore,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.selectionStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\tconst { canvasStore, toolStore, selectionStore, persistedUserDefaults } = engine.stores\n\t\tconst { shapeToolActive } = toolStore\n\t\tconst { zoom, colorSamplerActive } = canvasStore\n\t\tconst { showPixelGrid } = persistedUserDefaults\n\t\tconst shapeSelected = selectionStore.nodes.some(node => isVectorNode(node) || isShapeContainerNode(node))\n\n\t\treturn {\n\t\t\tzoom: zoom < gridZoomLevel ? 0 : zoom,\n\t\t\tcolorSamplerActive,\n\t\t\tshapeModeActive: shapeSelected || shapeToolActive,\n\t\t\tshowPixelGrid,\n\t\t}\n\t}\n\n\tcanvas: HTMLCanvasElement | null = null\n\trawWidth = -1\n\trawHeight = -1\n\tcanvasWidth = -1\n\tcanvasHeight = -1\n\n\tshowPixelGrid() {\n\t\treturn this.state.showPixelGrid || this.state.shapeModeActive\n\t}\n\n\tsetCanvas = (ref: HTMLCanvasElement | null) => {\n\t\tthis.canvas = ref\n\t\tthis.update()\n\t}\n\n\toverride render() {\n\t\treturn <canvas ref={this.setCanvas} style={this.getStyle()} />\n\t}\n\n\toverride componentDidMount() {\n\t\twindow.addEventListener(\"resize\", this.update)\n\t\tthis.update()\n\t}\n\n\toverride componentWillUnmount() {\n\t\twindow.removeEventListener(\"resize\", this.update)\n\t}\n\n\toverride componentDidUpdate = () => {\n\t\tthis.update()\n\t}\n\n\tupdate = () => {\n\t\tthis.updateSize()\n\t\tthis.updateCanvasStyle()\n\t\tthis.drawGrid()\n\t}\n\n\tupdateSize = () => {\n\t\tthis.rawWidth = window.innerWidth + gridOverdraw\n\t\tthis.rawHeight = window.innerHeight + gridOverdraw\n\n\t\tthis.canvasWidth = this.rawWidth * devicePixelRatio\n\t\tthis.canvasHeight = this.rawHeight * devicePixelRatio\n\t}\n\n\tupdateCanvasStyle = () => {\n\t\tif (!this.canvas) return\n\n\t\tthis.canvas.width = this.canvasWidth\n\t\tthis.canvas.height = this.canvasHeight\n\n\t\tconst style = this.getStyle()\n\t\tfor (const key in style) {\n\t\t\tthis.canvas.style[key] = style[key]\n\t\t}\n\t}\n\n\tdrawGrid = () => {\n\t\tif (!this.canvas || !this.showPixelGrid()) return\n\n\t\tconst devicePixelRatio = window.devicePixelRatio || 1\n\n\t\tconst { zoom, colorSamplerActive, shapeModeActive } = this.state\n\t\tif (zoom < 8 || colorSamplerActive) return\n\n\t\tconst g = this.canvas.getContext(\"2d\")\n\t\tif (!g) return\n\n\t\tg.strokeStyle = g.fillStyle = \"#7f7f7f\"\n\t\tg.lineWidth = 2\n\t\tg.globalAlpha = shapeModeActive ? 0.04 : 0.08\n\t\tg.beginPath()\n\t\tfor (let i = 0; i < 5000; i++) {\n\t\t\tconst step = i * zoom * devicePixelRatio\n\t\t\tg.moveTo(step, 0)\n\t\t\tg.lineTo(step, this.canvasHeight)\n\t\t\tg.moveTo(0, step)\n\t\t\tg.lineTo(this.canvasWidth, step)\n\t\t\tif (step > this.canvasWidth && step > this.canvasHeight) break\n\t\t}\n\t\tg.closePath()\n\t\tg.stroke()\n\n\t\tif (shapeModeActive) {\n\t\t\tg.lineWidth = 1.5\n\t\t\tg.globalAlpha = 0.35 * (zoom / 32)\n\t\t\tfor (let x = 0; x <= this.canvasWidth; x += zoom * devicePixelRatio) {\n\t\t\t\tfor (let y = 0; y <= this.canvasHeight; y += zoom * devicePixelRatio) {\n\t\t\t\t\tg.fillRect(x - 1.25, y - 1.25, 2.5, 2.5)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgetStyle = () => {\n\t\treturn {\n\t\t\twidth: `${window.innerWidth + gridOverdraw}px`,\n\t\t\theight: `${window.innerHeight + gridOverdraw}px`,\n\t\t\tdisplay: this.showPixelGrid() ? \"block\" : \"none\",\n\t\t}\n\t}\n}\n\nconst container = createContainer(Grid)\nexport { container as Grid }\n", "import { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { OverlayGrid, OverlayGridNode } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { orthogonalLinesForOverlayGrid, withOverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport React from \"react\"\nimport * as styles from \"./OverlayGrids.styles.ts\"\n\nconst GridOverlayElement = React.memo(function GridOverlayElement({\n\tgrid,\n\twidth,\n\theight,\n\tzoom,\n}: {\n\tgrid: OverlayGrid\n\twidth: number\n\theight: number\n\tzoom: number\n}) {\n\tconst end = grid.type === \"column\" ? width : height\n\tconst markers = [0, ...orthogonalLinesForOverlayGrid(grid, { width, height }), end]\n\tconst templateItems: string[] = []\n\tconst margin: number[] = []\n\n\tfor (let index = 0; index < markers.length; index++) {\n\t\tif (index === 0) continue\n\n\t\tconst size = markers[index] - markers[index - 1]\n\n\t\tif (index === 1 || index === markers.length - 1) {\n\t\t\tmargin.push(Math.max(size * zoom, 0) || 0)\n\t\t\tcontinue\n\t\t}\n\n\t\ttemplateItems.push(`${size * zoom}px`)\n\t}\n\n\tconst style: React.CSSProperties = {}\n\n\tif (grid.type === \"column\") {\n\t\tconst [marginLeft, marginRight] = margin\n\n\t\tObject.assign(style, {\n\t\t\tmarginLeft,\n\t\t\tmarginRight,\n\t\t\theight: \"100%\",\n\t\t\tgridTemplateColumns: templateItems.join(\" \"),\n\t\t\tjustifyContent: grid.distribution === \"stretch\" || grid.distribution === \"center\" ? \"center\" : undefined,\n\t\t})\n\t} else {\n\t\tconst [marginTop, marginBottom] = margin\n\n\t\tObject.assign(style, {\n\t\t\tmarginTop,\n\t\t\tmarginBottom,\n\t\t\twidth: \"100%\",\n\t\t\tgridTemplateRows: templateItems.join(\" \"),\n\t\t\talignContent: grid.distribution === \"stretch\" || grid.distribution === \"center\" ? \"center\" : undefined,\n\t\t})\n\t}\n\n\treturn (\n\t\t<div className={cx(styles.absoluteTopLeft, styles.grid)} style={style}>\n\t\t\t{templateItems.map((_, i) => {\n\t\t\t\t// Margin spacers\n\t\t\t\tif (i === templateItems.length - 1 || i === 0) return <div key={i} className={styles.templateItem} />\n\n\t\t\t\tconst hasBackgroundColor = i % 2 !== 0\n\t\t\t\tconst itemStyle = hasBackgroundColor ? { backgroundColor: grid.color } : {}\n\n\t\t\t\treturn <div key={i} className={styles.templateItem} style={itemStyle} />\n\t\t\t})}\n\t\t</div>\n\t)\n})\n\ninterface State {\n\tzoom: number\n\tisInteractive: boolean\n}\n\nclass Overlays extends React.Component<WrapperState, State> {\n\tstatic engineChangeKeys = [EngineChange.CanvasZoom]\n\n\tstatic calculateState(): State {\n\t\tconst { zoom, isInteractive } = engine.stores.canvasStore\n\t\treturn {\n\t\t\tzoom,\n\t\t\tisInteractive,\n\t\t}\n\t}\n\n\toverride shouldComponentUpdate(_: WrapperState, nextState: State) {\n\t\treturn nextState.isInteractive\n\t}\n\n\toverride render() {\n\t\tconst { zoom } = this.state\n\t\tconst { gridNodes, hiddenNodes } = this.props\n\n\t\treturn (\n\t\t\t<div className={styles.canvasRect}>\n\t\t\t\t{gridNodes.map(gridNode => {\n\t\t\t\t\tif (!gridNode.overlayGrid) return null\n\n\t\t\t\t\tconst rect = convertFrameToCanvas(engine.tree, gridNode)\n\t\t\t\t\tconst style: React.CSSProperties = {\n\t\t\t\t\t\tvisibility: hiddenNodes.includes(gridNode.id) ? \"hidden\" : undefined,\n\t\t\t\t\t\twidth: rect.width * zoom,\n\t\t\t\t\t\theight: rect.height * zoom,\n\t\t\t\t\t\ttransform: `translateX(${rect.x * zoom}px) translateY(${rect.y * zoom}px)`,\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div style={style} key={`grid-${gridNode.id}`} className={cx(styles.groundNode, styles.absoluteTopLeft)}>\n\t\t\t\t\t\t\t<GridOverlayElement width={rect.width} height={rect.height} zoom={zoom} grid={gridNode.overlayGrid} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nconst GridOverlays = createContainer(Overlays)\n\ninterface WrapperState {\n\tgridNodes: OverlayGridNode[]\n\thiddenNodes: NodeID[]\n}\n\nclass Container extends React.PureComponent<{}, WrapperState> {\n\tstatic engineChangeKeys = [EngineChange.TreeStore, EngineChange.ExitMove, engine.stores.scopeStore]\n\n\tstatic calculateState(): WrapperState {\n\t\tconst isMoving = engine.inMoveToolAndHasMoved()\n\t\tconst hiddenNodes: NodeID[] = []\n\t\tconst gridNodes: OverlayGridNode[] = []\n\t\tconst groundNodes = engine.stores.scopeStore.active.getGroundNodes()\n\n\t\tfor (const node of groundNodes) {\n\t\t\tif (\n\t\t\t\t!withOverlayGrid(node) ||\n\t\t\t\t!node.overlayGrid ||\n\t\t\t\t!node.isVisible() ||\n\t\t\t\t(withRotation(node) && node.resolveValue(\"rotation\") !== 0)\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (node.isSelected() && isMoving) hiddenNodes.push(node.id)\n\t\t\tgridNodes.push(node)\n\t\t}\n\n\t\treturn {\n\t\t\thiddenNodes,\n\t\t\tgridNodes,\n\t\t}\n\t}\n\n\toverride render() {\n\t\treturn <GridOverlays {...this.state} />\n\t}\n}\n\nexport const GridOverlayContainer = createContainer(Container)\n", "import \"OverlayGrids.styles_1ywcx5r.wyw.css\"; export const absoluteTopLeft = \"absoluteTopLeft_ax43q4p\";\nexport const groundNode = \"groundNode_g1wwdvv\";\nexport const grid = \"grid_g14x02bo\";\nexport const templateItem = \"templateItem_t1jzk97m\";\nexport const canvasRect = \"canvasRect_cx0lyw4\";", "import { ThemeOverride } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { GuideNode, GuideSelector } from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport {\n\tgetGuideAbsoluteOffset,\n\tisEqualGuide,\n\tisValidGuideNode,\n\twithGuides,\n} from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport { getAbsoluteOffset } from \"document/models/CanvasTree/traits/utils/getAbsoluteOffset.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { PointRounding } from \"document/stores/PathSelectionStore.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { roundedPoint } from \"../tools/pathEdit/utils/index.ts\"\nimport { isScopeUsingComponentTint } from \"../utils/getThemeOverrideMode.ts\"\nimport type { Props as GuideProps } from \"./Guide.tsx\"\nimport { Guide } from \"./Guide.tsx\"\nimport type { Range } from \"./Ruler.tsx\"\nimport { Ruler } from \"./Ruler.tsx\"\n\ninterface SelectedState {\n\tx: Range[]\n\ty: Range[]\n}\n\ninterface State {\n\tenabled: boolean\n\tcanvasWidth: number\n\tcanvasHeight: number\n\tzoom: number\n\tstart: Point\n\tselection: NodeID[]\n\ttool: Tools\n\tselectedGuide?: GuideSelector\n\thighlightedGuide?: GuideSelector\n\tghostGuide?: GuideSelector\n\tsnapLinesX: Set<number>\n\tsnapLinesY: Set<number>\n\thasDarkAppearance: boolean\n\tactiveScope: LoadedScopeNode\n\tinComponentOverlayEditMode: boolean\n}\n\nclass RulerWrapper extends React.PureComponent<{}, State> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.TreeStore, // listen to selection changes\n\t\tEngineChange.CanvasLiveTransform,\n\t\tEngineChange.UserDefaultsStore,\n\t\tEngineChange.DocumentSettings, // re-render rulers when switching theme\n\t\tEngineChange.TabContentWidth,\n\t\tEngineChange.PropertyPanelWidth,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.chromeStore,\n\t\tengine.stores.selectionStore,\n\t\tengine.stores.snapLinesStore,\n\t\tengine.stores.guidesStore,\n\t\tengine.stores.overlayStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\tconst {\n\t\t\tselectionStore,\n\t\t\tsnapLinesStore,\n\t\t\tdocumentSettingsStore,\n\t\t\tscopeStore,\n\t\t\tcanvasStore,\n\t\t\tguidesStore,\n\t\t\toverlayStore,\n\t\t\tpersistedUserDefaults,\n\t\t\ttoolStore,\n\t\t} = engine.stores\n\t\tconst { displayRulers } = persistedUserDefaults\n\t\tconst visibleRect = canvasStore.getCanvasVisibleRect()\n\t\tconst inComponentOverlayEditMode = isScopeUsingComponentTint(scopeStore.active) && overlayStore.editModeActive\n\n\t\treturn {\n\t\t\tenabled: displayRulers, // only enabled when user setting & experiment flag are both on\n\t\t\tzoom: canvasStore.zoom,\n\t\t\tselection: selectionStore.ids,\n\t\t\tcanvasWidth: visibleRect.width,\n\t\t\tcanvasHeight: visibleRect.height,\n\t\t\tstart: { x: visibleRect.x, y: visibleRect.y },\n\t\t\ttool: toolStore.tool,\n\t\t\tselectedGuide: guidesStore.selected,\n\t\t\thighlightedGuide: guidesStore.highlighted,\n\t\t\tghostGuide: guidesStore.ghost,\n\t\t\tsnapLinesX: snapLinesStore.x,\n\t\t\tsnapLinesY: snapLinesStore.y,\n\t\t\thasDarkAppearance: documentSettingsStore.hasDarkAppearance,\n\t\t\tactiveScope: scopeStore.active,\n\t\t\tinComponentOverlayEditMode,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tif (!withGuides(this.state.activeScope)) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t<ThemeOverride mode={this.getMode()}>\n\t\t\t\t<div style={canvasRectStyle}>\n\t\t\t\t\t{this.renderRulers()}\n\t\t\t\t\t{this.renderGuides()}\n\t\t\t\t\t{this.renderGhostGuide()}\n\t\t\t\t\t{this.renderSnapLines()}\n\t\t\t\t</div>\n\t\t\t</ThemeOverride>\n\t\t)\n\t}\n\n\tprivate getMode() {\n\t\treturn this.state.inComponentOverlayEditMode ? \"componentOverlayEditMode\" : undefined\n\t}\n\n\tgetSelectionPositions = (): SelectedState => {\n\t\tconst { selection } = this.state\n\t\tconst positions: SelectedState = { x: [], y: [] }\n\n\t\tselection.forEach(id => {\n\t\t\tconst node = engine.tree.getNode(id)\n\t\t\tif (!node) return\n\t\t\tconst canvasRect = convertFrameToCanvas(engine.tree, node)\n\t\t\t// for shape selection, round the value to half pixel\n\t\t\tconst { x: startX, y: startY } = roundedPoint({ x: canvasRect.x, y: canvasRect.y }, PointRounding.Half)\n\t\t\tconst { x: endX, y: endY } = roundedPoint(\n\t\t\t\t{ x: canvasRect.x + canvasRect.width, y: canvasRect.y + canvasRect.height },\n\t\t\t\tPointRounding.Half,\n\t\t\t)\n\n\t\t\tpositions.x.push({ start: startX, end: endX })\n\t\t\tpositions.y.push({ start: startY, end: endY })\n\t\t})\n\n\t\treturn { x: mergeIntersectRange(positions.x), y: mergeIntersectRange(positions.y) }\n\t}\n\n\tgetDisplayGuideValues = (\n\t\taxis: GuideProps[\"axis\"],\n\t): { type: GuideProps[\"type\"]; values: readonly number[] } | null => {\n\t\tconst { snapLinesX, snapLinesY, highlightedGuide, selectedGuide, ghostGuide, activeScope } = this.state\n\t\tif (!activeScope) return null\n\n\t\tconst snapLines = axis === \"x\" ? snapLinesX : snapLinesY\n\t\tconst values = new Set<number>()\n\n\t\tif (snapLines.size > 0) {\n\t\t\treturn {\n\t\t\t\ttype: \"snapLine\",\n\t\t\t\tvalues: Array.from(snapLines),\n\t\t\t}\n\t\t}\n\n\t\tif (highlightedGuide && highlightedGuide.nodeId === activeScope.id && highlightedGuide.axis === axis) {\n\t\t\tconst absOffset = getGuideAbsoluteOffset(engine.tree, highlightedGuide)\n\t\t\tif (isNumber(absOffset)) {\n\t\t\t\tvalues.add(absOffset)\n\t\t\t}\n\t\t}\n\n\t\tif (selectedGuide && selectedGuide.nodeId === activeScope.id && selectedGuide.axis === axis) {\n\t\t\tconst absOffset = getGuideAbsoluteOffset(engine.tree, selectedGuide)\n\t\t\tif (isNumber(absOffset)) {\n\t\t\t\tvalues.add(absOffset)\n\t\t\t}\n\t\t}\n\n\t\tif (ghostGuide && ghostGuide.nodeId === activeScope.id && ghostGuide.axis === axis) {\n\t\t\tconst absOffset = getGuideAbsoluteOffset(engine.tree, ghostGuide)\n\t\t\tif (isNumber(absOffset)) {\n\t\t\t\tvalues.add(absOffset)\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\ttype: \"guide\",\n\t\t\tvalues: Array.from(values),\n\t\t}\n\t}\n\n\tgetLineRange = (\n\t\ttree: CanvasTree,\n\t\tnode: CanvasNode,\n\t\taxis: GuideSelector[\"axis\"],\n\t): { rangeStart: number | undefined; rangeLength: number | undefined } => {\n\t\tif (isScopeNode(node)) {\n\t\t\treturn {\n\t\t\t\trangeStart: undefined,\n\t\t\t\trangeLength: undefined,\n\t\t\t}\n\t\t}\n\n\t\tconst rect = convertFrameToCanvas(tree, node)\n\t\treturn axis === \"x\"\n\t\t\t? { rangeStart: rect.y, rangeLength: rect.height }\n\t\t\t: { rangeStart: rect.x, rangeLength: rect.width }\n\t}\n\n\tisSnapLine = (axis: GuideSelector[\"axis\"], offset: number) => {\n\t\tconst { snapLinesX, snapLinesY } = this.state\n\t\tconst lines = axis === \"x\" ? snapLinesX : snapLinesY\n\n\t\treturn lines.has(offset)\n\t}\n\n\tisVisible = (axis: GuideSelector[\"axis\"], offset: number): boolean => {\n\t\treturn !this.isSnapLine(axis, offset)\n\t}\n\n\tshouldHighlight = (guide: GuideSelector): boolean => {\n\t\tconst { highlightedGuide, selectedGuide, tool } = this.state\n\t\tif (tool === Tools.Guide) return false\n\t\tconst isHighlighted: boolean = !!highlightedGuide && isEqualGuide(guide, highlightedGuide)\n\t\tconst isSelected: boolean = !!selectedGuide && isEqualGuide(guide, selectedGuide)\n\t\treturn isHighlighted || isSelected\n\t}\n\n\trenderRulers = () => {\n\t\tconst {\n\t\t\tzoom,\n\t\t\tstart,\n\t\t\tenabled,\n\t\t\tcanvasWidth,\n\t\t\tcanvasHeight,\n\t\t\thasDarkAppearance,\n\t\t\ttool,\n\t\t\tactiveScope,\n\t\t\tinComponentOverlayEditMode,\n\t\t} = this.state\n\n\t\tif (!enabled) return null\n\t\tconst selectedState = this.getSelectionPositions()\n\t\tconst pathEditModeActive = tool === Tools.Path\n\t\tconst inComponentScope = isSmartComponentNode(activeScope)\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div style={intersectionXStyle} />\n\t\t\t\t<div style={intersectionYStyle} />\n\t\t\t\t<Ruler\n\t\t\t\t\tkey=\"ruler-x\"\n\t\t\t\t\thasDarkAppearance={hasDarkAppearance}\n\t\t\t\t\taxis=\"x\"\n\t\t\t\t\tstart={start.x}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tlength={canvasWidth}\n\t\t\t\t\thighlight={selectedState.x}\n\t\t\t\t\tdisplayGuides={this.getDisplayGuideValues(\"x\")}\n\t\t\t\t\tpathEditModeActive={pathEditModeActive}\n\t\t\t\t\tinComponentScope={inComponentScope}\n\t\t\t\t\tinComponentOverlayEditMode={inComponentOverlayEditMode}\n\t\t\t\t/>\n\t\t\t\t<Ruler\n\t\t\t\t\tkey=\"ruler-y\"\n\t\t\t\t\thasDarkAppearance={hasDarkAppearance}\n\t\t\t\t\taxis=\"y\"\n\t\t\t\t\tstart={start.y}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tlength={canvasHeight}\n\t\t\t\t\thighlight={selectedState.y}\n\t\t\t\t\tdisplayGuides={this.getDisplayGuideValues(\"y\")}\n\t\t\t\t\tpathEditModeActive={pathEditModeActive}\n\t\t\t\t\tinComponentScope={inComponentScope}\n\t\t\t\t\tinComponentOverlayEditMode={inComponentOverlayEditMode}\n\t\t\t\t/>\n\t\t\t</>\n\t\t)\n\t}\n\n\trenderGuides = () => {\n\t\tconst { enabled, zoom, start, canvasWidth, canvasHeight, activeScope } = this.state\n\t\tif (!enabled || !activeScope) return null\n\t\tif (!withGuides(activeScope)) return null\n\t\tconst { guidesStore, canvasStore, treeStore } = engine.stores\n\n\t\t// only get groundNodes in visibleRect and the selected guide node\n\t\tconst groundNodes = activeScope.getGroundNodes(node => {\n\t\t\tif (!isValidGuideNode(node) || !node.isVisible()) return false\n\t\t\tconst nodeRect = convertFrameToCanvas(treeStore.tree, node)\n\t\t\tconst canvasRect = canvasStore.getCanvasVisibleRect()\n\t\t\tconst isSelectedGuideNode = guidesStore.selected ? node.id === guidesStore.selected.nodeId : false\n\t\t\treturn Rect.intersects(nodeRect, canvasRect) || isSelectedGuideNode\n\t\t}) as GuideNode[]\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{this.renderLines(\"guide\", activeScope, \"x\", activeScope.guidesX, zoom, start, canvasHeight)}\n\t\t\t\t{this.renderLines(\"guide\", activeScope, \"y\", activeScope.guidesY, zoom, start, canvasWidth)}\n\t\t\t\t{groundNodes.map(groundNode => (\n\t\t\t\t\t<React.Fragment key={`guide-${groundNode.id}`}>\n\t\t\t\t\t\t{this.renderLines(\"guide\", groundNode, \"x\", groundNode.guidesX, zoom, start, canvasHeight)}\n\t\t\t\t\t\t{this.renderLines(\"guide\", groundNode, \"y\", groundNode.guidesY, zoom, start, canvasWidth)}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t}\n\n\trenderSnapLines = () => {\n\t\tconst { zoom, start, snapLinesX, snapLinesY, canvasHeight, canvasWidth, activeScope } = this.state\n\t\tif (!activeScope) return null\n\t\tconst { guidesStore, treeStore } = engine.stores\n\n\t\tlet snapNode: CanvasNode = activeScope\n\t\tif (guidesStore.ghost && guidesStore.ghost.nodeId) {\n\t\t\tconst node = treeStore.tree.getNode(guidesStore.ghost.nodeId)\n\t\t\tsnapNode = node && isValidGuideNode(node) ? node : activeScope\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{this.renderLines(\"snapLine\", snapNode, \"x\", Array.from(snapLinesX), zoom, start, canvasHeight)}\n\t\t\t\t{this.renderLines(\"snapLine\", snapNode, \"y\", Array.from(snapLinesY), zoom, start, canvasWidth)}\n\t\t\t</>\n\t\t)\n\t}\n\n\tgetGuideInset = () => {\n\t\treturn this.state.enabled ? dimensions.values.rulerWidth - dimensions.values.rulerTickLength : 0\n\t}\n\n\trenderLines = (\n\t\ttype: GuideProps[\"type\"],\n\t\tnode: CanvasNode,\n\t\taxis: GuideProps[\"axis\"],\n\t\tlines: readonly number[],\n\t\tzoom: number,\n\t\tstart: Point,\n\t\tlength: number,\n\t) => {\n\t\tif (!node || lines.length === 0) return null\n\n\t\tconst { guidesStore, treeStore } = engine.stores\n\t\tlet lineRange = this.getLineRange(treeStore.tree, node, axis)\n\n\t\tconst inset = this.getGuideInset()\n\n\t\tif (type === \"guide\" && isValidGuideNode(node)) {\n\t\t\treturn lines.map((value: number) => {\n\t\t\t\tconst guide = { nodeId: node.id, axis, offset: value }\n\t\t\t\tconst isHighlighted = this.shouldHighlight(guide)\n\t\t\t\tif (!isGuideInFrameRect(treeStore.tree, node, guide)) {\n\t\t\t\t\tif (!isHighlighted) return null\n\t\t\t\t\t// if the guide is moved (with arrow keys) to outside of the frame,\n\t\t\t\t\t// range full dashed lines\n\t\t\t\t\tlineRange = { ...lineRange, rangeLength: 0 }\n\t\t\t\t}\n\t\t\t\tconst isVisble = this.isVisible(axis, value) && !(guidesStore.ghost && isEqualGuide(guide, guidesStore.ghost))\n\t\t\t\tconst absoluteOffset = getAbsoluteOffset(treeStore.tree, node, axis, value)\n\t\t\t\treturn isVisble ? (\n\t\t\t\t\t<Guide\n\t\t\t\t\t\tkey={`${type}-${axis}-${value}`}\n\t\t\t\t\t\thighlight={isHighlighted}\n\t\t\t\t\t\ttype={type}\n\t\t\t\t\t\taxis={axis}\n\t\t\t\t\t\tposition={absoluteOffset}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tcanvasStartX={start.x}\n\t\t\t\t\t\tcanvasStartY={start.y}\n\t\t\t\t\t\tinset={inset}\n\t\t\t\t\t\trulerWidth={dimensions.values.rulerWidth}\n\t\t\t\t\t\ttickLength={dimensions.values.rulerTickLength}\n\t\t\t\t\t\tlength={length}\n\t\t\t\t\t\trangeStart={lineRange.rangeStart}\n\t\t\t\t\t\trangeLength={lineRange.rangeLength}\n\t\t\t\t\t/>\n\t\t\t\t) : null\n\t\t\t})\n\t\t}\n\n\t\treturn lines.map((value: number) => (\n\t\t\t<Guide\n\t\t\t\tkey={`${type}-${axis}-${value}`}\n\t\t\t\ttype={type}\n\t\t\t\taxis={axis}\n\t\t\t\tposition={value}\n\t\t\t\tzoom={zoom}\n\t\t\t\tcanvasStartX={start.x}\n\t\t\t\tcanvasStartY={start.y}\n\t\t\t\tinset={inset}\n\t\t\t\trulerWidth={dimensions.values.rulerWidth}\n\t\t\t\ttickLength={dimensions.values.rulerTickLength}\n\t\t\t\tlength={length}\n\t\t\t\trangeStart={lineRange.rangeStart}\n\t\t\t\trangeLength={lineRange.rangeLength}\n\t\t\t/>\n\t\t))\n\t}\n\n\trenderGhostGuide = () => {\n\t\tconst { ghostGuide, zoom, start, canvasHeight, canvasWidth, activeScope } = this.state\n\t\tif (!ghostGuide) return null\n\n\t\tconst { nodeId, axis, offset } = ghostGuide\n\t\tif (!nodeId) return null\n\n\t\tconst { treeStore } = engine.stores\n\t\tconst ghostGuideNode = (treeStore.tree.getNode(nodeId) as GuideNode) ?? activeScope\n\t\tconst absoluteOffset = getAbsoluteOffset(treeStore.tree, ghostGuideNode, axis, offset)\n\t\tif (!this.isVisible(axis, absoluteOffset)) return null\n\n\t\tlet lineRange = this.getLineRange(treeStore.tree, ghostGuideNode, axis)\n\t\tconst length = axis === \"x\" ? canvasHeight : canvasWidth\n\t\t// when moving a guide with arrow keys and it hits an existing guide,\n\t\t// vekter will create a ghost guide to avoid deleting the existing one.\n\t\t// So here we still need to render a full-dashed ghost guide for this specific case\n\t\tif (!isGuideInFrameRect(treeStore.tree, ghostGuideNode, ghostGuide)) {\n\t\t\tlineRange = { ...lineRange, rangeLength: 0 }\n\t\t}\n\t\treturn (\n\t\t\t<Guide\n\t\t\t\tkey=\"guide-ghost\"\n\t\t\t\ttype=\"guide\"\n\t\t\t\thighlight\n\t\t\t\taxis={axis}\n\t\t\t\tposition={absoluteOffset}\n\t\t\t\tzoom={zoom}\n\t\t\t\tcanvasStartX={start.x}\n\t\t\t\tcanvasStartY={start.y}\n\t\t\t\tinset={this.getGuideInset()}\n\t\t\t\trulerWidth={dimensions.values.rulerWidth}\n\t\t\t\ttickLength={dimensions.values.rulerTickLength}\n\t\t\t\tlength={length}\n\t\t\t\trangeStart={lineRange.rangeStart}\n\t\t\t\trangeLength={lineRange.rangeLength}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nconst isGuideInFrameRect = (tree: CanvasTree, node: GuideNode, selector: GuideSelector) => {\n\tif (isScopeNode(node)) return true\n\tconst frameRect = convertFrameToCanvas(tree, node)\n\tconst { offset, axis } = selector\n\tconst lengthKey = axis === \"x\" ? \"width\" : \"height\"\n\t// the offset is relative to the starting point of the rect,\n\t// so using height/width would be enough\n\treturn offset >= 0 && offset <= frameRect[lengthKey]\n}\n\nconst mergeIntersectRange = (ranges: Range[]) => {\n\tconst result: Range[] = []\n\tlet last: Range | undefined\n\n\tranges.sort(compare)\n\tranges.forEach(function (r) {\n\t\tif (!last || r.start > last.end || r.end < last.start) {\n\t\t\tlast = r\n\t\t\tresult.push(last)\n\t\t} else if (r.end > last.end) {\n\t\t\tlast.end = r.end\n\t\t} else if (r.start < last.start) {\n\t\t\tlast.start = r.start\n\t\t}\n\t})\n\n\treturn result\n}\n\nconst compare = (a: Range, b: Range) => {\n\tif (a.start < b.start) return -1\n\tif (a.start > b.start) return 1\n\treturn 0\n}\n\nconst canvasRectStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\ttop: \"var(--framerInternalUI-chromeMarginTop)\",\n\tleft: \"var(--framerInternalUI-chromeMarginLeft)\",\n\tright: \"var(--framerInternalUI-chromeMarginRight)\",\n\tbottom: \"var(--framerInternalUI-chromeMarginBottom)\",\n\tpointerEvents: \"none\",\n\tzIndex: 0,\n}\n\nconst intersectionBaseStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tzIndex: 2,\n}\n\nconst intersectionXStyle: React.CSSProperties = {\n\t...intersectionBaseStyle,\n\twidth: dimensions.values.rulerWidth + 20,\n\theight: dimensions.values.rulerWidth - 1,\n\tbackground: `linear-gradient(to right, ${colors.rulerBackground} 50%, ${colors.rulerFadeOut} 100%)`,\n}\n\nconst intersectionYStyle: React.CSSProperties = {\n\t...intersectionBaseStyle,\n\twidth: dimensions.values.rulerWidth - 1,\n\theight: dimensions.values.rulerWidth + 20,\n\tbackground: `linear-gradient(to bottom, ${colors.rulerBackground} 50%, ${colors.rulerFadeOut} 100%)`,\n}\nconst container = createContainer(RulerWrapper)\nexport { container as RulerWrapper }\n", "import { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport * as styles from \"./Guide.styles.ts\"\n\nconst guideStrokeWidth = 2\nconst guideDashArray = 5\nconst guideDashArrayOffset = 5\nexport interface Props {\n\taxis: \"x\" | \"y\"\n\ttype: \"guide\" | \"snapLine\"\n\tcanvasStartX: number\n\tcanvasStartY: number\n\tposition: number\n\tzoom: number\n\trulerWidth: number\n\tlength: number\n\tinset: number\n\ttickLength: number\n\thighlight?: boolean\n\trangeStart?: number\n\trangeLength?: number\n\tinComponentCanvas?: boolean\n}\n\nexport class Guide extends React.PureComponent<Props, {}> {\n\toverride render() {\n\t\tconst { axis, position, zoom, canvasStartX, canvasStartY, rulerWidth, type, length } = this.props\n\t\tconst isHorizontal = axis === \"y\"\n\t\tconst canvasStart = isHorizontal ? canvasStartY : canvasStartX\n\t\tconst scaledOffset = (position - canvasStart) * zoom\n\t\t// don't render if out of viewport\n\t\tif (scaledOffset < rulerWidth) return null\n\n\t\tconst guideStyles = this.pickGuideStyles(axis, scaledOffset)\n\t\tconst scaledLength = length * zoom\n\t\tconst inset = this.withInset() ? this.props.inset : 0\n\t\tconst viewBoxWidth = isHorizontal ? scaledLength - inset : 2\n\t\tconst viewBoxHeight = isHorizontal ? 2 : scaledLength - inset\n\n\t\treturn (\n\t\t\t<div className={cx(type === \"snapLine\" ? styles.fadeIn : \"\", this.pickStrokeColor())} style={guideStyles}>\n\t\t\t\t<svg\n\t\t\t\t\tviewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}\n\t\t\t\t\twidth={viewBoxWidth}\n\t\t\t\t\theight={viewBoxHeight}\n\t\t\t\t\tstyle={{ display: \"block\" }}\n\t\t\t\t>\n\t\t\t\t\t{this.renderLine()}\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t)\n\t}\n\n\trenderLine = () => {\n\t\tconst { type, axis, zoom, length, rangeStart, rangeLength, canvasStartX, canvasStartY, highlight, tickLength } =\n\t\t\tthis.props\n\t\tconst isHorizontal = axis === \"y\"\n\t\tconst scaledLength = length * zoom\n\n\t\tif (!isNumber(rangeStart) || !isNumber(rangeLength)) {\n\t\t\tconst toX = isHorizontal ? scaledLength : 0\n\t\t\tconst toY = isHorizontal ? 0 : scaledLength\n\t\t\treturn <line x1=\"0\" y1=\"0\" x2={toX} y2={toY} strokeWidth={guideStrokeWidth} stroke=\"currentColor\" />\n\t\t}\n\n\t\tconst inset = this.withInset() ? this.props.inset : 0\n\t\tconst canvasStart = isHorizontal ? canvasStartX : canvasStartY\n\t\tconst scaledRangeStart = (rangeStart - canvasStart) * zoom - inset\n\t\tconst scaledRangeEnd = (rangeStart + rangeLength - canvasStart) * zoom - inset\n\n\t\tconst tickX = isHorizontal ? tickLength : 0\n\t\tconst tickY = isHorizontal ? 0 : tickLength\n\t\tconst toX1 = isHorizontal ? scaledRangeStart : 0\n\t\tconst toY1 = isHorizontal ? 0 : scaledRangeStart\n\t\tconst toX2 = isHorizontal ? scaledRangeEnd : 0\n\t\tconst toY2 = isHorizontal ? 0 : scaledRangeEnd\n\t\tconst toX3 = isHorizontal ? scaledLength : 0\n\t\tconst toY3 = isHorizontal ? 0 : scaledLength\n\t\tconst withDash = highlight || type === \"snapLine\"\n\t\tconst dashOffset = rangeLength === 0 ? Math.floor(guideDashArrayOffset / 2) : guideDashArrayOffset\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{/* tick line */}\n\t\t\t\t{withDash && <line x1=\"0\" y1=\"0\" x2={tickX} y2={tickY} strokeWidth={guideStrokeWidth} stroke=\"currentColor\" />}\n\t\t\t\t{/* draw the first line reversely so the dash offset starts from the frame */}\n\t\t\t\t{withDash && (\n\t\t\t\t\t<line\n\t\t\t\t\t\tx1={toX1}\n\t\t\t\t\t\ty1={toY1}\n\t\t\t\t\t\tx2={tickX}\n\t\t\t\t\t\ty2={tickY}\n\t\t\t\t\t\tstrokeWidth={guideStrokeWidth}\n\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\tstrokeDasharray={guideDashArray}\n\t\t\t\t\t\tstrokeDashoffset={dashOffset}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<line x1={toX1} y1={toY1} x2={toX2} y2={toY2} strokeWidth={guideStrokeWidth} stroke=\"currentColor\" />\n\t\t\t\t{withDash && (\n\t\t\t\t\t<line\n\t\t\t\t\t\tx1={toX2}\n\t\t\t\t\t\ty1={toY2}\n\t\t\t\t\t\tx2={toX3}\n\t\t\t\t\t\ty2={toY3}\n\t\t\t\t\t\tstrokeWidth={guideStrokeWidth}\n\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\tstrokeDasharray={guideDashArray}\n\t\t\t\t\t\tstrokeDashoffset={dashOffset}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n\n\tpickGuideStyles = (axis: Props[\"axis\"], transformValue: number): React.CSSProperties => {\n\t\tconst isHorizontal = axis === \"y\"\n\t\tconst withInset = this.withInset()\n\t\treturn {\n\t\t\tposition: \"absolute\",\n\t\t\tleft: isHorizontal && withInset ? `${this.props.inset}px` : 0,\n\t\t\ttop: !isHorizontal && withInset ? `${this.props.inset}px` : 0,\n\t\t\ttransform: isHorizontal ? `translateY(${transformValue - 0.5}px)` : `translateX(${transformValue - 0.5}px)`, // -0.5 to align the guides to the ruler ticks\n\t\t\twillChange: \"transform\",\n\t\t\t...(isHorizontal ? { right: 0, height: \"1px\" } : { bottom: 0, width: \"1px\" }),\n\t\t}\n\t}\n\n\tpickStrokeColor = () => {\n\t\tconst { highlight, type } = this.props\n\t\tif (type === \"snapLine\") return styles.snapLine\n\t\tif (highlight) return styles.highlightedGuide\n\t\treturn styles.guide\n\t}\n\n\twithInset = (): boolean => this.props.highlight || this.props.type === \"snapLine\"\n}\n", "import \"Guide.styles_mzd4ll.wyw.css\"; export const guide = \"guide_gl2m1vk\";\nexport const highlightedGuide = \"highlightedGuide_h7xronl\";\nexport const snapLine = \"snapLine_s52dxz6\";\nexport const fadeIn = \"fadeIn_f146oaoj\";", "import type { ColorTokenKey } from \"@framerjs/fresco/src/tokens/colors/colorTypes\"\nimport { colorValues, colors, dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { roundedNumber } from \"library/render/utils/roundedNumber.ts\"\nimport React from \"react\"\nimport type { Props as GuideProps } from \"./Guide.tsx\"\n\nconst strokeLineWidth = 1\nconst rulerFont = `normal 400 10px ${fonts.family.sansSerifWithoutEmoji}`\nconst { rulerWidth, rulerTickLength } = dimensions.values\n\nconst getColorValues = (darkMode: boolean) => {\n\treturn darkMode ? colorValues.dark : colorValues.light\n}\n\nexport interface Range {\n\tstart: number\n\tend: number\n}\n\ninterface Props {\n\treadonly length: number\n\treadonly axis: \"x\" | \"y\"\n\treadonly start: number\n\treadonly zoom: number\n\treadonly highlight: Range[]\n\treadonly displayGuides: {\n\t\treadonly type: GuideProps[\"type\"]\n\t\treadonly values: readonly number[]\n\t} | null\n\treadonly hasDarkAppearance: boolean\n\treadonly inComponentScope: boolean\n\treadonly inComponentOverlayEditMode: boolean\n\treadonly pathEditModeActive: boolean\n}\n\nexport class Ruler extends React.Component<Props, {}> {\n\tprivate ctx: CanvasRenderingContext2D | null = null\n\n\toverride componentDidMount() {\n\t\tthis.updateCanvasSize()\n\t\tthis.renderRuler()\n\t}\n\n\toverride shouldComponentUpdate(prevProps: Props) {\n\t\treturn !isEqual(prevProps, this.props)\n\t}\n\n\toverride componentDidUpdate(prevProps: Props) {\n\t\tif (prevProps.length !== this.props.length) {\n\t\t\tthis.updateCanvasSize()\n\t\t}\n\n\t\tthis.renderRuler()\n\t}\n\n\tupdateCanvasSize = () => {\n\t\tif (!this.ctx) return\n\n\t\tconst ctx = this.ctx\n\t\tconst { canvas } = ctx\n\t\tif (!canvas) return\n\n\t\tconst { layoutState, chromeStore } = engine.stores\n\n\t\t// multiply by dpr to give the canvas a bigger size,\n\t\t// and then scale back to fix fillText blurry\n\t\tconst dpr = this.getDevicePixelRatio()\n\t\tif (this.props.axis === \"x\") {\n\t\t\tconst canvasWidth = chromeStore.chromeIsVisible\n\t\t\t\t? window.innerWidth - layoutState.currentChromeMarginLeft - layoutState.currentChromeMarginRight\n\t\t\t\t: window.innerWidth\n\t\t\tcanvas.width = canvasWidth * dpr\n\t\t\tcanvas.height = rulerWidth * dpr\n\t\t} else {\n\t\t\tconst canvasHeight =\n\t\t\t\twindow.innerHeight - layoutState.currentChromeMarginTop - layoutState.currentChromeMarginBottom\n\t\t\tcanvas.width = rulerWidth * dpr\n\t\t\tcanvas.height = canvasHeight * dpr\n\t\t}\n\n\t\tctx.scale(dpr, dpr)\n\t\t// context state is lost on resize\n\t\tctx.lineWidth = strokeLineWidth\n\t\tctx.font = rulerFont\n\t\tctx.textAlign = \"center\"\n\t}\n\n\tgetColorForCurrentMode = (defaultColor: ColorTokenKey, componentOverlayEditModeColor: ColorTokenKey) => {\n\t\tconst { hasDarkAppearance, inComponentOverlayEditMode } = this.props\n\t\tconst colorValuesInMode = getColorValues(hasDarkAppearance)\n\n\t\tif (inComponentOverlayEditMode) {\n\t\t\treturn colorValuesInMode[componentOverlayEditModeColor]\n\t\t}\n\n\t\treturn colorValuesInMode[defaultColor]\n\t}\n\n\tgetRulerTickColor = () => {\n\t\treturn this.getColorForCurrentMode(\"rulerTickColor\", \"rulerComponentOverlayEditModeTickColor\")\n\t}\n\n\tgetRulerBorderColor = () => {\n\t\treturn this.getColorForCurrentMode(\"rulerBorderColor\", \"rulerComponentOverlayEditModeBorderColor\")\n\t}\n\n\tgetRulerTextColor = () => {\n\t\treturn this.getColorForCurrentMode(\"rulerTextColor\", \"rulerComponentOverlayEditModeTextColor\")\n\t}\n\n\tgetGuideHighlightColor = () => {\n\t\tconst { inComponentScope } = this.props\n\t\treturn this.getColorForCurrentMode(\n\t\t\tinComponentScope ? \"guideComponentHighlightColor\" : \"guideHighlightColor\",\n\t\t\t\"guideComponentHighlightColor\",\n\t\t)\n\t}\n\n\tgetSnapLineColor = () => {\n\t\treturn this.props.hasDarkAppearance ? colorValues.dark.snapLine : colorValues.light.snapLine\n\t}\n\n\tgetDevicePixelRatio = () => window.devicePixelRatio || 1\n\n\trenderRuler = () => {\n\t\tif (!this.ctx) return\n\t\tconst { canvas } = this.ctx\n\t\tthis.ctx.clearRect(0, 0, canvas.width, canvas.height)\n\t\tthis.drawRuler(this.ctx)\n\t}\n\n\tdrawRuler = (ctx: CanvasRenderingContext2D) => {\n\t\tthis.drawTicks(ctx)\n\t\tthis.drawAxis(ctx)\n\t\tthis.drawHighlight(ctx)\n\t\tthis.drawGuideValues(ctx)\n\t}\n\n\tdrawAxis = (ctx: CanvasRenderingContext2D) => {\n\t\tconst { axis } = this.props\n\t\tlet startX: number, startY: number, endX: number, endY: number\n\n\t\tctx.strokeStyle = this.getRulerBorderColor()\n\t\tctx.beginPath()\n\n\t\tif (axis === \"x\") {\n\t\t\tstartX = 0\n\t\t\tstartY = rulerWidth - 0.5 // 0.5 is needed to avoid boundary mismatch\n\t\t\tendX = ctx.canvas.width\n\t\t\tendY = rulerWidth - 0.5\n\t\t} else {\n\t\t\tstartX = rulerWidth - 0.5\n\t\t\tstartY = 0\n\t\t\tendX = rulerWidth - 0.5\n\t\t\tendY = ctx.canvas.height\n\t\t}\n\n\t\tctx.moveTo(startX, startY)\n\t\tctx.lineTo(endX, endY)\n\t\tctx.stroke()\n\t\tctx.closePath()\n\t}\n\n\tdrawTicks = (ctx: CanvasRenderingContext2D) => {\n\t\tconst { start, length, zoom, axis } = this.props\n\t\tconst end = start + length\n\t\tconst step = calculateStep(zoom)\n\t\tconst firstTickValue = Math.ceil(start / step) * step\n\t\tconst lastTickValue = Math.floor(end / step) * step\n\t\tconst offset = Math.abs(firstTickValue - start) // first tick offset from the starting point\n\t\tconst styledValues: { pos: number; value: number; alpha: number }[] = []\n\n\t\tctx.save()\n\t\tctx.beginPath()\n\t\tctx.strokeStyle = this.getRulerTickColor()\n\t\tctx.fillStyle = this.getRulerTextColor()\n\t\tfor (let value = firstTickValue, i = 0; value <= lastTickValue; value += step, i++) {\n\t\t\tconst pos = (offset + step * i) * zoom\n\n\t\t\tconst nearestDist = Math.min(this.getDistToNearestHighlight(value), this.getDistToNearestDisplayGuide(value))\n\t\t\tconst alpha = this.getAlphaByDist(nearestDist) // fade tick as the highlight gets closer\n\n\t\t\t// pick out faded values and highlighted values, and draw them in different paths using different color & alpha\n\t\t\tif (this.checkIsInHighlight(value) || alpha < 1) {\n\t\t\t\tstyledValues.push({ pos, value, alpha })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (axis === \"x\") {\n\t\t\t\tthis.drawHorizontalTick(ctx, pos, rulerWidth, pos, rulerWidth - rulerTickLength, value)\n\t\t\t} else {\n\t\t\t\tthis.drawVerticalTick(ctx, rulerWidth, pos, rulerWidth - rulerTickLength, pos, value)\n\t\t\t}\n\t\t}\n\n\t\tctx.stroke()\n\n\t\t// draw faded or highlighted value\n\t\tstyledValues.forEach(item => {\n\t\t\tctx.beginPath()\n\t\t\tconst { pos, value, alpha } = item\n\t\t\tconst guideHighlightColor = this.getGuideHighlightColor()\n\t\t\tconst textColor = this.checkIsInHighlight(value) ? guideHighlightColor : this.getRulerTextColor()\n\t\t\tconst tickColor = this.checkIsInHighlight(value) ? guideHighlightColor : this.getRulerTickColor()\n\t\t\tctx.strokeStyle = tickColor\n\t\t\tctx.fillStyle = textColor\n\t\t\tctx.globalAlpha = alpha\n\n\t\t\tif (axis === \"x\") {\n\t\t\t\tthis.drawHorizontalTick(ctx, pos, rulerWidth, pos, rulerWidth - rulerTickLength, value)\n\t\t\t} else {\n\t\t\t\tthis.drawVerticalTick(ctx, rulerWidth, pos, rulerWidth - rulerTickLength, pos, value)\n\t\t\t}\n\n\t\t\tctx.stroke()\n\t\t})\n\n\t\tctx.restore()\n\t}\n\n\tdrawHighlight = (ctx: CanvasRenderingContext2D) => {\n\t\tconst { start, highlight, axis, zoom, displayGuides } = this.props\n\t\tconst values: Set<number> = new Set()\n\n\t\thighlight.forEach(range => {\n\t\t\tconst highlightStart = (range.start - start) * zoom\n\t\t\tconst highlightEnd = (range.end - start) * zoom\n\t\t\tconst highlightLength = (range.end - range.start) * zoom\n\t\t\tconst guideHighlightColor = this.getGuideHighlightColor()\n\n\t\t\t// draw the actual highlight rect\n\t\t\tctx.fillStyle = guideHighlightColor\n\t\t\tctx.globalAlpha = 0.1\n\t\t\tif (axis === \"x\") {\n\t\t\t\tctx.fillRect(highlightStart, 0, highlightLength, rulerWidth)\n\t\t\t} else {\n\t\t\t\tctx.fillRect(0, highlightStart, rulerWidth, highlightLength)\n\t\t\t}\n\t\t\tctx.globalAlpha = 1\n\n\t\t\t// draw highlight axis\n\t\t\tctx.strokeStyle = guideHighlightColor\n\t\t\tctx.beginPath()\n\t\t\tif (axis === \"x\") {\n\t\t\t\tctx.moveTo(highlightStart, rulerWidth - 0.5)\n\t\t\t\tctx.lineTo(highlightEnd, rulerWidth - 0.5)\n\t\t\t} else {\n\t\t\t\tctx.moveTo(rulerWidth - 0.5, highlightStart)\n\t\t\t\tctx.lineTo(rulerWidth - 0.5, highlightEnd)\n\t\t\t}\n\t\t\tctx.stroke()\n\t\t\tctx.closePath()\n\n\t\t\t// prepare range edge values to draw text labels & ticks\n\t\t\tif (!displayGuides || !displayGuides.values.includes(range.start)) {\n\t\t\t\tvalues.add(range.start)\n\t\t\t}\n\n\t\t\tif (!displayGuides || !displayGuides.values.includes(range.end)) {\n\t\t\t\tvalues.add(range.end)\n\t\t\t}\n\t\t})\n\n\t\tthis.drawHighlightTicks(ctx, values)\n\t}\n\n\tdrawHighlightTicks = (ctx: CanvasRenderingContext2D, values: Set<number>) => {\n\t\tif (values.size === 0) return\n\n\t\tconst { zoom, axis, start, pathEditModeActive } = this.props\n\t\tconst guideHighlightColor = this.getGuideHighlightColor()\n\n\t\tctx.fillStyle = guideHighlightColor\n\t\tctx.strokeStyle = guideHighlightColor\n\t\tlet prevHighlightValue = Infinity\n\n\t\tvalues.forEach((value: number) => {\n\t\t\tconst tickPosition = (value - start) * zoom\n\n\t\t\t// draw ticks\n\t\t\tctx.beginPath()\n\t\t\tif (axis === \"x\") {\n\t\t\t\tctx.moveTo(tickPosition, rulerWidth)\n\t\t\t\tctx.lineTo(tickPosition, rulerWidth - rulerTickLength)\n\t\t\t} else {\n\t\t\t\tctx.moveTo(rulerWidth, tickPosition)\n\t\t\t\tctx.lineTo(rulerWidth - rulerTickLength, tickPosition)\n\t\t\t}\n\t\t\tctx.stroke()\n\t\t\tctx.closePath()\n\n\t\t\t// draw values\n\t\t\tconst distToPrevHighlightValue = Math.abs(prevHighlightValue - value) * zoom\n\t\t\tconst distToNearestDisplayGuides = this.getDistToNearestDisplayGuide(value)\n\t\t\tconst dist = Math.min(distToPrevHighlightValue, distToNearestDisplayGuides)\n\t\t\tconst alpha = this.getAlphaByDist(dist)\n\t\t\tctx.globalAlpha = alpha\n\n\t\t\tconst roundedValue = pathEditModeActive ? value : roundedNumber(value, 0)\n\t\t\tif (axis === \"x\") {\n\t\t\t\tctx.fillText(roundedValue.toString(), tickPosition, rulerWidth - rulerTickLength - 3)\n\t\t\t} else {\n\t\t\t\tctx.save()\n\t\t\t\tctx.translate(rulerWidth - 0.5, tickPosition) // translate the origin to the current position\n\t\t\t\tctx.rotate(-Math.PI / 2)\n\t\t\t\tctx.fillText(roundedValue.toString(), 0, -rulerTickLength - 3)\n\t\t\t\tctx.restore()\n\t\t\t}\n\n\t\t\t// hide the highlighted label if the previous one is \"visible\"\n\t\t\tif (alpha > 0.3) {\n\t\t\t\tprevHighlightValue = value\n\t\t\t}\n\n\t\t\tctx.globalAlpha = 1 // reset everytime\n\t\t})\n\t}\n\n\tcheckIsInHighlight = (value: number) => {\n\t\tconst { highlight } = this.props\n\t\treturn highlight.some(range => value >= range.start && value <= range.end)\n\t}\n\n\tgetDistToNearestHighlight = (value: number) => {\n\t\tconst { highlight, zoom } = this.props\n\t\tlet distToNearestHighlight = Infinity\n\n\t\thighlight.forEach(range => {\n\t\t\tconst dist = Math.min(Math.abs(range.start - value), Math.abs(range.end - value))\n\t\t\tif (dist < distToNearestHighlight) distToNearestHighlight = dist\n\t\t})\n\n\t\treturn (distToNearestHighlight *= zoom)\n\t}\n\n\tgetDistToNearestDisplayGuide = (value: number) => {\n\t\tconst { displayGuides, zoom } = this.props\n\t\tlet distToNearestDisplayGuides = Infinity\n\n\t\tif (displayGuides) {\n\t\t\tdisplayGuides.values.forEach((guideValue: number) => {\n\t\t\t\tdistToNearestDisplayGuides = Math.min(Math.abs(guideValue - value), distToNearestDisplayGuides)\n\t\t\t})\n\t\t}\n\n\t\treturn (distToNearestDisplayGuides *= zoom)\n\t}\n\n\tgetAlphaByDist = (dist: number) => {\n\t\tconst M: number = dimensions.values.rulerMaskWidth\n\t\tif (dist < M / 2) return 0\n\t\tif (dist < M) return (-4 / M ** 2) * dist ** 2 + (8 / M) * dist - 3 // descent faster near M/2\n\t\treturn 1\n\t}\n\n\tdrawHorizontalTick = (\n\t\tctx: CanvasRenderingContext2D,\n\t\tstartX: number,\n\t\tstartY: number,\n\t\tendX: number,\n\t\tendY: number,\n\t\tvalue: number,\n\t) => {\n\t\tctx.moveTo(startX, startY)\n\t\tctx.lineTo(endX, endY)\n\t\tctx.fillText(value.toString(), endX, endY - 3)\n\t}\n\n\tdrawVerticalTick = (\n\t\tctx: CanvasRenderingContext2D,\n\t\tstartX: number,\n\t\tstartY: number,\n\t\tendX: number,\n\t\tendY: number,\n\t\tvalue: number,\n\t) => {\n\t\tctx.moveTo(startX, startY)\n\t\tctx.lineTo(endX, endY)\n\t\tctx.save()\n\t\tctx.translate(endX, endY) // translate the origin to the current position\n\t\tctx.rotate(-Math.PI / 2)\n\t\tctx.fillText(value.toString(), 0, -3)\n\t\tctx.restore()\n\t}\n\n\tdrawGuideValues = (ctx: CanvasRenderingContext2D) => {\n\t\tconst { start, zoom, axis, displayGuides, pathEditModeActive } = this.props\n\n\t\tif (!displayGuides || displayGuides.values.length === 0) return\n\n\t\tctx.fillStyle = displayGuides.type === \"guide\" ? this.getGuideHighlightColor() : this.getSnapLineColor()\n\n\t\tdisplayGuides.values.forEach((value: number) => {\n\t\t\tconst pos = (value - start) * zoom\n\t\t\tif (pos < rulerWidth) return // don't render value when the guide is still covered by the ruler\n\t\t\tconst roundedValue = pathEditModeActive ? value : roundedNumber(value, 0)\n\t\t\tif (axis === \"y\") {\n\t\t\t\tctx.save()\n\t\t\t\tctx.translate(rulerWidth - rulerTickLength, pos)\n\t\t\t\tctx.rotate(-Math.PI / 2)\n\t\t\t\tctx.fillText(roundedValue.toString(), 0, -3)\n\t\t\t\tctx.restore()\n\t\t\t} else {\n\t\t\t\tctx.fillText(roundedValue.toString(), pos, rulerWidth - rulerTickLength - 3)\n\t\t\t}\n\t\t})\n\t}\n\n\toverride render() {\n\t\tconst { axis } = this.props\n\t\tconst rulerStyle =\n\t\t\taxis === \"x\"\n\t\t\t\t? { ...axisYRulerStyle, height: `${rulerWidth}px` }\n\t\t\t\t: { ...axisXRulerStyle, width: `${rulerWidth}px` }\n\t\tconst canvasStyle = axis === \"x\" ? { width: \"100%\" } : { height: \"100%\" }\n\t\treturn (\n\t\t\t<div style={{ ...baseRulerStyle, ...rulerStyle }}>\n\t\t\t\t<canvas ref={this.saveCanvasContext} style={canvasStyle} />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tsaveCanvasContext = (ref: HTMLCanvasElement) => {\n\t\tif (ref) {\n\t\t\tthis.ctx = ref.getContext(\"2d\")\n\t\t}\n\t}\n}\n\nconst calculateStep = (scale: number) => {\n\tif (scale < 0.03) return 5000\n\tif (scale < 0.05) return 2500\n\tif (scale < 0.1) return 1000\n\tif (scale <= 0.2) return 500\n\tif (scale <= 0.5) return 250\n\tif (scale <= 1) return 100\n\tif (scale <= 2) return 50\n\tif (scale <= 3) return 25\n\tif (scale <= 4) return 20\n\treturn 10\n}\n\nconst baseRulerStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\ttop: \"0\",\n\tleft: \"0\",\n\toverflow: \"hidden\",\n\tbackgroundColor: colors.rulerBackground,\n\tpointerEvents: \"auto\",\n}\n\nconst axisYRulerStyle = {\n\twidth: \"100%\",\n\tright: \"0\",\n}\n\nconst axisXRulerStyle = {\n\theight: \"100%\",\n\tbottom: \"0\",\n}\n", "import { Events } from \"@framerjs/fresco/layout-transitions\"\nimport { assert, isAppleDevice, isCommandKeyPressed, isSafariDesktop, unhandledError } from \"@framerjs/shared\"\nimport { benchCreate, benchZoom } from \"debug-utils/bench.ts\"\nimport { crash } from \"debug-utils/crash.ts\"\nimport { isSelectable } from \"document/components/tools/utils/isSelectable.ts\"\nimport { Context, showContextMenu } from \"document/components/utils/contextMenu.ts\"\nimport { editActionForNodes } from \"document/components/utils/editActionForNodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { closestGuideInRange, getGuideNode } from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport { UpdateType } from \"document/stores/CanvasStore.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport { canReadClipboardWithoutPromptingUser } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { getSelectableTopNodeAtPoint } from \"../tools/utils/getSelectableTopNodeAtPoint.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport { CanvasEventTargetId } from \"./CanvasEventTargetId.ts\"\n\ninterface Props {\n\tchildren?: React.ReactNode\n\tcursor?: string\n}\n\ninterface GestureEvent extends MouseEvent {\n\trotation: number\n\tscale: number\n}\n\ntype KeyboardLayoutMap = Map<string, string>\n\n// FIXME: this whole class needs to be cleaned up. ToolManagerMenu should be refactored, and tools should support being used while the modifier is still down\nexport class CanvasEventTarget extends React.PureComponent<Props> {\n\telement: HTMLElement | null = null\n\tkeyboardLayoutMap?: KeyboardLayoutMap\n\tlastWheelEventTime?: number\n\n\tkeyDown = engine.scheduler.wrapAtomicHandler((event: KeyboardEvent) => {\n\t\tif (event.defaultPrevented) return\n\n\t\tconst isBody = event.target === document.body\n\t\tconst isButton = event.target instanceof HTMLButtonElement\n\n\t\tif (!isBody && (!isButton || event.key === \"Tab\")) {\n\t\t\treturn\n\t\t}\n\n\t\tconst { chromeStore, mouseStore } = engine.stores\n\n\t\t// Skip canvas events when fullsize preview or settings are displayed\n\t\tswitch (chromeStore.mainView) {\n\t\t\tcase ActiveMainView.SiteSettings:\n\t\t\tcase ActiveMainView.ContentManagement:\n\t\t\tcase ActiveMainView.Preview:\n\t\t\tcase ActiveMainView.Localizations:\n\t\t\t\treturn\n\t\t}\n\n\t\tif (chromeStore.overlay) {\n\t\t\treturn\n\t\t}\n\n\t\tmouseStore.onKeyDown(event)\n\t\tif (event.defaultPrevented) return\n\n\t\t// Listen to the cmd + / shortcut and trigger the insert modal.\n\t\t// We did not define the key-binding in appMenu to avoid blocking the\n\t\t// commenting shortcut when the code editor is open.\n\t\t// see: https://github.com/framer/company/issues/23221#issuecomment-954777713\n\t\tconst ctrlOrMeta = isCommandKeyPressed(event)\n\t\tconst isGermanKeyboard = this.keyboardLayoutMap?.get(\"Minus\") === \"\u00DF\"\n\n\t\tconst isSlash =\n\t\t\t// General keyboard layout.\n\t\t\tevent.key === \"/\" ||\n\t\t\t// For German keyboard, slash is Shift+7.\n\t\t\t(isGermanKeyboard && ctrlOrMeta && event.shiftKey && event.code === \"Digit7\") ||\n\t\t\t// Special solution for Safari. When holding Cmd/Ctrl+Shift+7 on a\n\t\t\t// German keyboard, it will set keyIdentifier (non-standard) to the\n\t\t\t// value for \"/\", while all other event values will indicate \"7\".\n\t\t\t// This means we can trust this to be a real press of the actual\n\t\t\t// slash key on any layout.\n\t\t\t(event.shiftKey && hasKeyIdentifier(event, \"U+002F\"))\n\n\t\tif (ctrlOrMeta && isSlash) {\n\t\t\tif (getIsViewOnly(engine, \"canDesign\")) return\n\t\t\tif (chromeStore.mainView === ActiveMainView.CodeEditor) return\n\t\t\t// Prevent native browser event (in Chrome cmd+shift+/ calls out the\n\t\t\t// help menu for example)\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tif (event.repeat) return\n\n\t\t\tContextAction.toggleTeamLibrary(engine)\n\t\t\treturn\n\t\t}\n\n\t\t// tests\n\t\t// eslint-disable-next-line no-restricted-syntax -- Used for testing\n\t\tif (event.altKey && event.ctrlKey && event.metaKey) {\n\t\t\tif (event.key === \"m\" && benchCreate) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tbenchCreate(engine).catch(unhandledError)\n\t\t\t} else if (event.key === \"z\" && benchZoom) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tbenchZoom(engine).catch(unhandledError)\n\t\t\t} else if (event.key === \"n\" && crash) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tcrash()\n\t\t\t}\n\t\t}\n\t})\n\n\tkeyPress = engine.scheduler.wrapHandler((event: KeyboardEvent) => {\n\t\tconst { chromeStore, mouseStore } = engine.stores\n\t\tif (event.defaultPrevented) return\n\t\tif (event.target !== document.body) return\n\t\tif (chromeStore.overlay) return\n\n\t\tmouseStore.onKeyPress(event)\n\t})\n\n\tkeyUp = engine.scheduler.wrapAtomicHandler((event: KeyboardEvent) => {\n\t\tif (event.defaultPrevented) return\n\t\tif (event.target !== document.body) {\n\t\t\t// If focus moved from the document to an input while a modifier key is down it will get stuck\n\t\t\t// even when the body is refocused (until the next key press), so we clear it here.\n\t\t\t// https://github.com/framer/company/issues/35631\n\t\t\tengine.stores.mouseStore.clearKeys()\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.mouseStore.onKeyUp(event)\n\t})\n\n\tprivate onMouseDown = engine.scheduler.wrapAtomicHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tconst { canvasMouseTarget, selectionOutlineTracker } = engine.stores\n\t\tcanvasMouseTarget.handleMouseDown(event, \"mousedown\")\n\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t})\n\n\tprivate onMouseMove = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tconst { canvasMouseTarget, selectionOutlineTracker } = engine.stores\n\t\tcanvasMouseTarget.handleMouseMove(event)\n\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t})\n\n\tprivate onMouseUp = engine.scheduler.wrapAtomicHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tconst { canvasMouseTarget, selectionOutlineTracker } = engine.stores\n\t\tcanvasMouseTarget.handleMouseUp(event)\n\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t})\n\n\tprivate onMouseEnter = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.mouseStore.setMouseOnCanvas(true)\n\t})\n\n\tprivate onMouseEnterDocument = (event: MouseEvent) => {\n\t\t// For the middle mouse button, Chrome doesn't emit MouseUp events when they happen outside the browser window\n\t\t// This detects if that occurred and triggers a fake event to maintain correct state\n\t\tif (engine.stores.mouseStore.canvasMiddleMouseButtonDownPosition && !Events.isMiddleMouseClick(event)) {\n\t\t\tthis.triggerFakeMouseUp()\n\t\t}\n\t}\n\n\tprivate onMouseLeave = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.mouseStore.setMouseOnCanvas(false)\n\t})\n\n\tonDoubleClick = engine.scheduler.wrapAtomicHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tconst { canvasMouseTarget, selectionStore, toolStore, overlayStore, persistedUserDefaults, scopeStore } =\n\t\t\tengine.stores\n\t\tconst [canvasPoint] = canvasMouseTarget.getPointsFromEvent(event.nativeEvent)\n\t\tconst selectionDidChange = updateSelectionForDoubleClick(canvasPoint)\n\t\tif (selectionDidChange) return\n\n\t\tif (selectionStore.ids.length === 0) {\n\t\t\t// When double clicking the canvas while the highlight (default) tool was active, the select tool is currently active.\n\t\t\t// We check for the active tool to prevent exiting the current scope when double clicking to zoom in.\n\t\t\tconst tool = toolStore.tool\n\t\t\tif (tool === Tools.Select || tool === Tools.Highlight) {\n\t\t\t\tif (overlayStore.editModeActive) {\n\t\t\t\t\toverlayStore.exitEditMode(selectionStore)\n\t\t\t\t} else if (persistedUserDefaults.exitCanvasOnDoubleClick && scopeStore.canGoBack()) {\n\t\t\t\t\tscopeStore.goBack()\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst editAction = editActionForNodes(engine, selectionStore.ids, \"mouse\")\n\t\tif (editAction) editAction()\n\t})\n\n\tonWheel = engine.scheduler.wrapHandler((event: WheelEvent) => {\n\t\tconst { mouseStore, canvasStore, persistedUserDefaults } = engine.stores\n\t\tif (\n\t\t\t!this.element ||\n\t\t\t!(event.target instanceof Node) ||\n\t\t\t!this.element.contains(event.target) ||\n\t\t\tmouseStore.canvasMiddleMouseButtonDownPosition\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\n\t\tconst fastZoomKey = isAppleDevice() ? event.ctrlKey : event.altKey\n\t\tconst zoomKey = isCommandKeyPressed(event)\n\t\tconst isScrollZooming = zoomKey || fastZoomKey\n\n\t\t// In Chrome, the ctrlKey may be synthesized due to pinch gesture.\n\t\t// The ctrlKey can get stuck in some cases (no keyup), but we can guess (unreliably,\n\t\t// but in most cases) that it\u2019s a pinch gesture from the event properties.\n\t\tconst isContinuousWheel = event.deltaMode === 0 && !Number.isInteger(event.deltaY)\n\t\tconst isPinchZooming = event.ctrlKey && (!mouseStore.UNSAFE__ctrlKey || isContinuousWheel)\n\n\t\tlet { deltaX, deltaY } = event\n\t\tswitch (event.deltaMode) {\n\t\t\tcase 0:\n\t\t\t\t// Delta values are specified in pixels\n\t\t\t\tif (!isAppleDevice() && !isScrollZooming && (Math.abs(deltaY) >= 100 || Math.abs(deltaX) >= 100)) {\n\t\t\t\t\t// In windows, the default scroll step is 3 lines, which gives 150px delta and causes a very sensitive zoom.\n\t\t\t\t\t// This lowers the scroll sensitivity to a more relevant range.\n\t\t\t\t\tdeltaX /= 3\n\t\t\t\t\tdeltaY /= 3\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 1:\n\t\t\t\t// Delta values are specified in lines.\n\t\t\t\tdeltaX *= 16\n\t\t\t\tdeltaY *= 16\n\t\t\t\tbreak\n\t\t\tcase 2:\n\t\t\t\t// Delta values are specified in pages.\n\t\t\t\tdeltaX *= 1000\n\t\t\t\tdeltaY *= 750\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (!isScrollZooming && !isPinchZooming) {\n\t\t\tconst containerDeltaX = !isAppleDevice() && event.shiftKey ? deltaY : deltaX\n\t\t\tconst containerDeltaY = !isAppleDevice() && event.shiftKey ? deltaX : deltaY\n\t\t\tcanvasStore.scroll(containerDeltaX, containerDeltaY, UpdateType.Live)\n\t\t\treturn\n\t\t}\n\n\t\tconst zoomPoint = { x: event.pageX, y: event.pageY }\n\t\tconst isFastZoom = fastZoomKey || persistedUserDefaults.fastZoom\n\t\tthis.handleZoomEvent(normalizeWheelZoom(event, this.lastWheelEventTime), zoomPoint, isPinchZooming, isFastZoom)\n\t\tthis.lastWheelEventTime = event.timeStamp\n\t})\n\n\thandleZoomEvent = (deltaY: number, zoomPoint: Point, isPinchZooming: boolean, isFastZoom: boolean) => {\n\t\tif (isPinchZooming) {\n\t\t\t// When pinch zooming, delta Y should be flipped to match gesture.\n\t\t\tdeltaY *= -1\n\t\t} else {\n\t\t\tif (!isAppleDevice()) {\n\t\t\t\t// Make Windows follow natural scrolling.\n\t\t\t\tdeltaY *= -1\n\t\t\t}\n\n\t\t\tif (engine.stores.persistedUserDefaults.reverseZoomDirection) {\n\t\t\t\t// Reverse zoom direction according to user preferences\n\t\t\t\tdeltaY *= -1\n\t\t\t}\n\t\t}\n\n\t\t// We've adjusted the values to closely match the zooming speed of other popular apps.\n\t\t// Adjust the base scaling factor to make all zooming more or less sensitive\n\t\t// fast zoom will increase the zoom speed for all zooming where it is applied (via key or preference)\n\t\t// pinch zoom deltas are generally small fractions, where scroll to zoom is higher values, so we need to scale those up to pinch zoom feel good\n\t\tconst baseScalingFactor = 0.001\n\t\tconst fastZoomScale = isFastZoom ? 2 : 1\n\t\tconst pinchZoomScale = isPinchZooming ? 6 : 1\n\n\t\tthis.changeMagnificationThrottled(deltaY, zoomPoint, 1 + baseScalingFactor * fastZoomScale * pinchZoomScale)\n\t}\n\n\tdidMagnifyThisFrame = false\n\tpendingMagnification = 1\n\n\tchangeMagnificationThrottled = (delta: number, containerPoint: Point, scalingFactor: number) => {\n\t\tconst { canvasStore } = engine.stores\n\t\tthis.pendingMagnification += delta\n\t\tif (!this.didMagnifyThisFrame) {\n\t\t\tcanvasStore.changeExponentialZoomBy(this.pendingMagnification, containerPoint, scalingFactor)\n\t\t\tthis.didMagnifyThisFrame = true\n\t\t\tthis.pendingMagnification = 0\n\t\t}\n\t\trequestAnimationFrame(() => {\n\t\t\tif (this.pendingMagnification === 0) {\n\t\t\t\tthis.didMagnifyThisFrame = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcanvasStore.changeExponentialZoomBy(this.pendingMagnification, containerPoint, scalingFactor)\n\t\t\tthis.didMagnifyThisFrame = true\n\t\t\tthis.pendingMagnification = 0\n\t\t})\n\t}\n\n\thandleZoomGesture = (delta: number, containerPoint: Point) => {\n\t\tthis.changeMagnificationThrottled(delta, containerPoint, 3)\n\t}\n\n\tpointerEventPoints: Map<number, Point> = new Map()\n\tlastPointerCount = 0\n\tpointerEventCenter: Point | undefined\n\tpointerEventDistance: number | undefined\n\n\tonPointerDown = (event: React.PointerEvent<HTMLElement>) => {\n\t\t// Only track touches. Mouse and pen do not apply for our purposes.\n\t\tif (event.pointerType !== \"touch\") return\n\t\tthis.pointerEventPoints.set(event.pointerId, Point(event.clientX, event.clientY))\n\t}\n\n\tonPointerUpOrCancel = (event: React.PointerEvent<HTMLElement>) => {\n\t\tthis.pointerEventPoints.delete(event.pointerId)\n\t\tif (this.pointerEventPoints.size < 1) {\n\t\t\tthis.lastPointerCount = 0\n\t\t\tthis.pointerEventCenter = undefined\n\t\t}\n\t\tif (this.pointerEventPoints.size < 2) {\n\t\t\tthis.pointerEventDistance = undefined\n\t\t}\n\t}\n\n\tonPointerMove = engine.scheduler.wrapHandler((event: React.PointerEvent<HTMLElement>) => {\n\t\t// Don't update pointers that we don't track.\n\t\tif (!this.pointerEventPoints.has(event.pointerId)) {\n\t\t\treturn\n\t\t}\n\t\tthis.pointerEventPoints.set(event.pointerId, Point(event.clientX, event.clientY))\n\t\t// Ignore more than 2 active pointers.\n\t\tif (this.pointerEventPoints.size > 2) return\n\t\tconst points = Array.from(this.pointerEventPoints.values())\n\t\tif (!points[0]) return\n\n\t\t// There may be one or two pointers depending on the gesture. Two pointers can zoom and pan\n\t\t// but one pointer can only pan.\n\t\tconst center = points[1] ? Point.center(points[0], points[1]) : points[0]\n\t\tconst distance = points[1] ? Point.distance(points[0], points[1]) / 200 : undefined\n\n\t\tif (distance !== undefined && this.pointerEventDistance !== undefined) {\n\t\t\tthis.handleZoomGesture(distance - this.pointerEventDistance, center)\n\t\t}\n\n\t\t// Only apply panning when number of touches stays the same.\n\t\tif (this.lastPointerCount === points.length && this.pointerEventCenter !== undefined) {\n\t\t\tconst panning = Point.subtract(this.pointerEventCenter, center)\n\t\t\t// If we have two fingers on the screen we need to do a live update as we are scaling at the same time\n\t\t\tengine.stores.canvasStore.scroll(panning.x, panning.y, UpdateType.Live)\n\t\t}\n\n\t\tthis.lastPointerCount = points.length\n\t\tthis.pointerEventCenter = center\n\t\tthis.pointerEventDistance = distance\n\t})\n\n\t// Safari desktop gesture events support\n\n\tgestureEventLastScale: number | undefined\n\n\tonGestureStart = (event: GestureEvent) => {\n\t\t// Prevent Safari from doing page zooming.\n\t\t// eslint-disable-next-line framer-studio/tscompat -- Only Safari will call this event.\n\t\tevent.preventDefault()\n\t\tthis.gestureEventLastScale = event.scale\n\t}\n\n\tonGestureEnd = () => {\n\t\tthis.gestureEventLastScale = undefined\n\t}\n\n\tonGestureChange = engine.scheduler.wrapHandler((event: GestureEvent) => {\n\t\tif (this.gestureEventLastScale === undefined) return\n\n\t\t// Prevent Safari going into tab overview mode.\n\t\t/* eslint-disable framer-studio/tscompat -- We check for support via the line above. */\n\t\tevent.preventDefault()\n\t\tconst scaleDelta = event.scale / (this.gestureEventLastScale || 1) - 1\n\t\tconst center = Point(event.clientX, event.clientY)\n\t\tthis.handleZoomGesture(scaleDelta, center)\n\t\tthis.gestureEventLastScale = event.scale\n\t\t/* eslint-enable framer-studio/tscompat */\n\t})\n\n\toverride componentDidMount() {\n\t\tconst canvasSize = this.getCanvasEventTargetSize()\n\t\tconst { canvasStore } = engine.stores\n\t\tcanvasStore.setContainerSize(canvasSize.width, canvasSize.height)\n\n\t\twindow.addEventListener(\"blur\", this.onWindowBlur)\n\t\twindow.addEventListener(\"mouseup\", this.onMouseUpNative)\n\t\tdocument.addEventListener(\"mouseenter\", this.onMouseEnterDocument)\n\t\twindow.addEventListener(\"resize\", this.onWindowResize)\n\t\t// As of Chrome 73, \"passive\" is on by default for wheel and mousewheel events.\n\t\twindow.addEventListener(\"wheel\", this.onWheel, { passive: false })\n\t\tdocument.addEventListener(\"keydown\", this.keyDown)\n\t\tdocument.addEventListener(\"keypress\", this.keyPress)\n\t\tdocument.addEventListener(\"keyup\", this.keyUp)\n\n\t\tif (\"keyboard\" in navigator) {\n\t\t\tnavigator.keyboard\n\t\t\t\t?.getLayoutMap?.()\n\t\t\t\t.then(keyboardLayoutMap => {\n\t\t\t\t\tthis.keyboardLayoutMap = keyboardLayoutMap\n\t\t\t\t})\n\t\t\t\t.catch(unhandledError)\n\t\t}\n\t}\n\n\toverride componentWillUnmount() {\n\t\twindow.removeEventListener(\"blur\", this.onWindowBlur)\n\t\twindow.removeEventListener(\"mouseup\", this.onMouseUpNative)\n\t\tdocument.removeEventListener(\"mouseenter\", this.onMouseEnterDocument)\n\t\twindow.removeEventListener(\"resize\", this.onWindowResize)\n\t\twindow.removeEventListener(\"wheel\", this.onWheel)\n\t\tdocument.removeEventListener(\"keydown\", this.keyDown)\n\t\tdocument.removeEventListener(\"keypress\", this.keyPress)\n\t\tdocument.removeEventListener(\"keyup\", this.keyUp)\n\n\t\twindow.removeEventListener(\"gesturestart\", this.onGestureStart)\n\t\twindow.removeEventListener(\"gestureend\", this.onGestureEnd)\n\t\twindow.removeEventListener(\"gesturechange\", this.onGestureChange)\n\t}\n\n\toverride componentDidUpdate(prevProps: Props) {\n\t\tconst { cursor } = this.props\n\t\tconst cursorDidChange = cursor !== prevProps.cursor\n\n\t\tif (cursor && cursorDidChange && this.element) {\n\t\t\t// Webkit doesn't update cursor correctly\n\t\t\tthis.element.style.setProperty(\"cursor\", \"\")\n\t\t\tthis.element.style.setProperty(\"cursor\", cursor)\n\t\t}\n\t}\n\n\ttriggerFakeMouseUp = () => {\n\t\tassert(!engine.scheduler.inEventHandling, \"engine should not be in event handling\")\n\t\tconst mouseUpEvent = document.createEvent(\"HTMLEvents\")\n\t\tmouseUpEvent.initEvent(\"mouseup\", true, true)\n\t\tif (this.element) this.element.dispatchEvent(mouseUpEvent)\n\t}\n\n\ttriggerFakeKeyUp = () => {\n\t\tassert(!engine.scheduler.inEventHandling, \"engine should not be in event handling\")\n\t\t// Trigger a fake 'key up' event that will follow the React path, but clears all modifiers\n\t\tconst keyUpEvent = document.createEvent(\"HTMLEvents\")\n\t\tkeyUpEvent.initEvent(\"keyup\", true, true)\n\t\tdocument.body.dispatchEvent(keyUpEvent)\n\t}\n\n\tonWindowBlur = () => {\n\t\tif (engine.scheduler.inRendering || engine.scheduler.inPostProcessing) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.triggerFakeMouseUp()\n\t\t\t\tthis.triggerFakeKeyUp()\n\t\t\t})\n\t\t} else {\n\t\t\tthis.triggerFakeMouseUp()\n\t\t\tthis.triggerFakeKeyUp()\n\t\t}\n\t}\n\n\tgetCanvasEventTargetSize = () => {\n\t\t// As of mid-2021, the canvas always fills the whole window. Given this,\n\t\t// we're returning window.innerWidth/Height instead of this.element.clientWidth/Height.\n\t\t// This allows us to avoid an unnecessary forced layout recalculation\n\t\treturn {\n\t\t\twidth: window.innerWidth,\n\t\t\theight: window.innerHeight,\n\t\t}\n\t}\n\n\tsetElement = (element: HTMLElement | null) => {\n\t\tthis.element = element\n\t\tif (!element) return\n\t\t// Different browsers support different events for handling touch gestures. Currently we handle gesturechange\n\t\t// on desktop Safari and pointermove on all other browsers that support it. Every browser has supported pointermove since 2020\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent#browser_compatibility\n\t\tswitch (true) {\n\t\t\tcase \"PointerEvent\" in globalThis && !isSafariDesktop():\n\t\t\t\t// The ideal case (we hook up the events in the render() method).\n\t\t\t\tbreak\n\t\t\tcase \"GestureEvent\" in globalThis:\n\t\t\t\t// This is probably Safari on desktop.\n\t\t\t\twindow.addEventListener(\"gesturestart\", this.onGestureStart)\n\t\t\t\twindow.addEventListener(\"gestureend\", this.onGestureEnd)\n\t\t\t\twindow.addEventListener(\"gesturechange\", this.onGestureChange)\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\t// This should be pretty rare but hopefully the browser\n\t\t\t\t// supports \"wheel\" with virtual Control when zooming.\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tonWindowResize = engine.scheduler.wrapHandler(() => {\n\t\tconst canvasSize = this.getCanvasEventTargetSize()\n\t\tconst { canvasStore } = engine.stores\n\t\tcanvasStore.setContainerSize(canvasSize.width, canvasSize.height)\n\t})\n\n\tonMouseUpNative = (event: Event) => {\n\t\t// Our custom event triggered by window blur\n\t\tif (!event.isTrusted) {\n\t\t\treturn\n\t\t}\n\n\t\t// Mouse up outside of window\n\t\tif (event.target === document.documentElement) {\n\t\t\tthis.triggerFakeMouseUp()\n\t\t}\n\t}\n\n\tonContextMenu = engine.scheduler.wrapHandler(async (event: React.MouseEvent<HTMLElement>) => {\n\t\tif (event.defaultPrevented) {\n\t\t\treturn\n\t\t}\n\n\t\t// Allow right click on input elements.\n\t\tif (wantsNativeTextActions(event.target)) {\n\t\t\treturn\n\t\t}\n\t\tconst {\n\t\t\tguidesStore,\n\t\t\tselectionStore,\n\t\t\tcanvasMouseTarget,\n\t\t\tscopeStore,\n\t\t\ttreeStore,\n\t\t\tpersistedUserDefaults,\n\t\t\tcanvasStore,\n\t\t\tmouseStore,\n\t\t} = engine.stores\n\n\t\tconst [mouse] = canvasMouseTarget.getPointsFromEvent(event.nativeEvent)\n\t\tclearSelectionWhenClickedOnCanvas(mouse)\n\t\tclearSelectedGuideWhenClickedOnCanvas(mouse)\n\n\t\tif (guidesStore.highlighted) {\n\t\t\tguidesStore.selected = guidesStore.highlighted\n\t\t\tguidesStore.highlighted = undefined\n\t\t\tselectionStore.clear()\n\t\t} else {\n\t\t\tconst nodesAtPoint = treeStore.tree.getNodesAtPoint(scopeStore.active, mouse, true, canvasStore.zoom < 4)\n\t\t\tconst nodesAtPointIds = nodesAtPoint.map(node => node.id)\n\n\t\t\tconst anySelectedNodeUnderMouse = selectionStore.ids.some(selectedId => nodesAtPointIds.includes(selectedId))\n\n\t\t\tif (!anySelectedNodeUnderMouse) {\n\t\t\t\tconst selectableNodes = nodesAtPoint.filter(nodeItem => {\n\t\t\t\t\treturn isSelectable({\n\t\t\t\t\t\tnode: nodeItem,\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tcmdKey: mouseStore.latest.cmdKey,\n\t\t\t\t\t\tuseDirectSelect: persistedUserDefaults.useDirectSelect,\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t\tconst selectableTopNode = treeStore.tree.getTopMostChildNode(selectableNodes)\n\t\t\t\tif (selectableTopNode && !selectionStore.ids.includes(selectableTopNode.id)) {\n\t\t\t\t\tselectionStore.set(selectableTopNode)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst clipboardGrid = (await canReadClipboardWithoutPromptingUser()) ? await Clipboard.getGridOverlay() : undefined\n\t\ttreeStore.setHighlight(null)\n\t\tshowContextMenu({\n\t\t\tcoordinate: Point(event.clientX, event.clientY),\n\t\t\tengine,\n\t\t\tselection: selectionStore.ids,\n\t\t\tselectedGuide: guidesStore.selected,\n\t\t\tclipboardGrid,\n\t\t\tcontext: Context.Canvas,\n\t\t})\n\t})\n\n\toverride render() {\n\t\tconst { cursor } = this.props\n\n\t\tconst style: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\ttop: 0,\n\t\t\tleft: 0,\n\t\t\tright: 0,\n\t\t\tbottom: 0,\n\t\t\tbackground: \"transparent\",\n\t\t\toverflow: \"hidden\",\n\t\t\tcursor: cursor ?? \"\",\n\t\t\ttouchAction: \"none\",\n\t\t}\n\n\t\treturn (\n\t\t\t// biome-ignore lint/nursery/noStaticElementInteractions: handlers are to handle bubbled events\n\t\t\t<div\n\t\t\t\tid={CanvasEventTargetId}\n\t\t\t\tstyle={style}\n\t\t\t\tref={this.setElement}\n\t\t\t\tonMouseMove={this.onMouseMove}\n\t\t\t\tonMouseDown={this.onMouseDown}\n\t\t\t\tonMouseUp={this.onMouseUp}\n\t\t\t\tonDoubleClick={this.onDoubleClick}\n\t\t\t\tonContextMenu={this.onContextMenu}\n\t\t\t\tonMouseEnter={this.onMouseEnter}\n\t\t\t\tonMouseLeave={this.onMouseLeave}\n\t\t\t\tonPointerDown={this.onPointerDown}\n\t\t\t\tonPointerUp={this.onPointerUpOrCancel}\n\t\t\t\tonPointerCancel={this.onPointerUpOrCancel}\n\t\t\t\tonPointerMove={this.onPointerMove}\n\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nfunction updateSelectionForDoubleClick(mouse: Point): boolean {\n\tconst { tool } = engine\n\tconst { selectionStore, treeStore } = engine.stores\n\n\tif (tool.enum !== Tools.Highlight && tool.enum !== Tools.Move) {\n\t\treturn false\n\t}\n\n\tconst selectableTopNode = getSelectableTopNodeAtPoint({ point: mouse, engine, doubleClick: true })\n\tif (selectableTopNode && !selectionStore.ids.includes(selectableTopNode.id)) {\n\t\ttreeStore.setHighlight(null)\n\t\tselectionStore.set(selectableTopNode, { sticky: selectionStore.isSticky })\n\t\treturn true\n\t}\n\treturn false\n}\n\nfunction clearSelectionWhenClickedOnCanvas(mouse: Point) {\n\tconst { scopeStore, selectionStore, treeStore, canvasStore } = engine.stores\n\tconst nodesAtPoint = treeStore.tree.getNodesAtPoint(scopeStore.active, mouse, false, canvasStore.zoom < 4)\n\tif (nodesAtPoint.length === 0) {\n\t\tselectionStore.clear()\n\t}\n}\n\nfunction clearSelectedGuideWhenClickedOnCanvas(mouse: Point) {\n\tconst { guidesStore, scopeStore, treeStore, canvasStore } = engine.stores\n\tif (!guidesStore.selected) return\n\n\tconst guideNode = getGuideNode(treeStore.tree, guidesStore.selected)\n\tif (!guideNode) return\n\n\tconst selectedGuideAtPoint = closestGuideInRange(treeStore.tree, scopeStore.active, mouse, canvasStore.zoom)\n\tif (!selectedGuideAtPoint) {\n\t\tguidesStore.clearSelected()\n\t}\n}\n\n/** 120 is the default value for discrete zoom delta in Chrome and Safari */\nconst defaultDiscreteZoomDelta = 120\nfunction normalizeWheelZoom(event: WheelEvent, lastWheelEventTime?: number): number {\n\t// this is a non-standard property that is available on all major browsers, and also our only way to\n\t// normalize the delta value across browsers and wheel settings. We first use it to identify if it is a discrete wheel event\n\t// such as from a single step on a mouse wheel. We consider other events to be accelerated and use the raw delta value.\n\t// See more information: https://developer.mozilla.org/en-US/docs/Web/API/Element/mousewheel_event#wheeldelta_wheeldeltax_and_wheeldeltay_value\n\tconst wheelDelta =\n\t\t\"wheelDelta\" in event && typeof event.wheelDelta === \"number\" && !Number.isNaN(event.wheelDelta)\n\t\t\t? event.wheelDelta\n\t\t\t: 0\n\t// we decide if it is a discrete scroll wheel event (single step on a scroll wheel) using the following rules\n\t// - if the delta is represented as lines or screens rather than pixels\n\t// - if the delta is an integer *and* the wheelDelta corresponds to a known pattern for discrete scroll wheel events (%120 for chromium and safari, %48 for firefox)\n\t//   *and* the gap between events is larger than a fixed threshold\n\t// with these rules we avoid normalizing the delta for accelerated scroll events in all browsers\n\tconst isContinuousScroll = lastWheelEventTime && event.timeStamp - lastWheelEventTime < 24\n\tconst isDiscreteWheel =\n\t\tevent.deltaMode !== 0 ||\n\t\t(!isContinuousScroll && Number.isInteger(event.deltaY) && (wheelDelta % 120 === 0 || wheelDelta % 48 === 0))\n\treturn isDiscreteWheel ? defaultDiscreteZoomDelta * Math.sign(event.deltaY) : event.deltaY\n}\n\nfunction hasKeyIdentifier(event: KeyboardEvent & { keyIdentifier?: string }, keyIdentifier: string) {\n\treturn event.keyIdentifier === keyIdentifier\n}\n", "import { PortalWithTheme } from \"@framerjs/fresco\"\nimport { ZIndex } from \"@framerjs/fresco/src/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type React from \"react\"\nimport { useCallback, useLayoutEffect, useRef } from \"react\"\nimport * as styles from \"./FeedbackThreadPopover.styles.ts\"\nimport { InlineFeedbackThread } from \"./InlineFeedbackThread.tsx\"\n\ninterface FeedbackThreadPopoverProps {\n\tcurrentUserId: string\n\tthreadId: string\n\tanchor: HTMLElement | null\n\twithin: { top: number; right: number; bottom: number; left: number }\n}\n\nconst OFFSET_X = 10\n\n/**\n * Uses requestAnimationFrame to continuously track the anchor's screen\n * position so the popover follows canvas pan/zoom without lag.\n */\nfunction useAnchorTracking(\n\tanchor: HTMLElement | null,\n\twithin: FeedbackThreadPopoverProps[\"within\"],\n\tpopoverRef: React.RefObject<HTMLDivElement | null>,\n) {\n\tconst withinRef = useRef(within)\n\twithinRef.current = within\n\n\tuseLayoutEffect(() => {\n\t\tif (!anchor) return\n\n\t\tlet rafId: number\n\t\tlet prevAnchorLeft = NaN\n\t\tlet prevAnchorTop = NaN\n\n\t\tconst updatePosition = () => {\n\t\t\tconst el = popoverRef.current\n\t\t\tif (!el) {\n\t\t\t\trafId = requestAnimationFrame(updatePosition)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst anchorRect = anchor.getBoundingClientRect()\n\t\t\tif (anchorRect.left === prevAnchorLeft && anchorRect.top === prevAnchorTop) {\n\t\t\t\trafId = requestAnimationFrame(updatePosition)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tprevAnchorLeft = anchorRect.left\n\t\t\tprevAnchorTop = anchorRect.top\n\n\t\t\tconst popoverRect = el.getBoundingClientRect()\n\t\t\tconst vw = window.visualViewport?.width ?? window.innerWidth\n\t\t\tconst vh = window.visualViewport?.height ?? window.innerHeight\n\t\t\tconst w = withinRef.current\n\n\t\t\tconst resolvedWithin = {\n\t\t\t\ttop: w.top,\n\t\t\t\tright: w.right < 0 ? w.right + vw : w.right,\n\t\t\t\tbottom: w.bottom < 0 ? w.bottom + vh : w.bottom,\n\t\t\t\tleft: w.left,\n\t\t\t}\n\n\t\t\tconst spaceRight = resolvedWithin.right - anchorRect.right - OFFSET_X\n\t\t\tlet left: number\n\t\t\tif (spaceRight >= popoverRect.width) {\n\t\t\t\tleft = anchorRect.right + OFFSET_X\n\t\t\t} else {\n\t\t\t\tleft = anchorRect.left - popoverRect.width - OFFSET_X\n\t\t\t}\n\n\t\t\tlet top = Math.round(anchorRect.top + anchorRect.height / 2 - popoverRect.height / 2)\n\n\t\t\ttop = Math.max(resolvedWithin.top, Math.min(top, resolvedWithin.bottom - popoverRect.height))\n\t\t\tleft = Math.max(resolvedWithin.left, Math.min(left, resolvedWithin.right - popoverRect.width))\n\n\t\t\tel.style.transform = `translate(${left}px, ${top}px)`\n\t\t\tel.style.visibility = \"\"\n\n\t\t\trafId = requestAnimationFrame(updatePosition)\n\t\t}\n\n\t\tupdatePosition()\n\t\treturn () => cancelAnimationFrame(rafId)\n\t}, [anchor, popoverRef])\n}\n\nexport function FeedbackThreadPopover({ currentUserId, threadId, anchor, within }: FeedbackThreadPopoverProps) {\n\tconst isCanvasInteractive = useEngineState(\n\t\t() => engine.stores.canvasStore.isInteractive,\n\t\t[],\n\t\t[EngineChange.CanvasLiveTransform, EngineChange.CanvasZoom],\n\t)\n\n\tconst popoverRef = useRef<HTMLDivElement>(null)\n\tuseAnchorTracking(anchor, within, popoverRef)\n\n\t// Prevent React synthetic events from bubbling through the portal into\n\t// the canvas, which would cause the mouse store to register a canvas\n\t// click and dismiss the popover.\n\tconst stopCanvasPropagation = useCallback((e: React.MouseEvent) => e.stopPropagation(), [])\n\n\tif (!anchor) return null\n\n\treturn (\n\t\t<PortalWithTheme>\n\t\t\t{/* biome-ignore lint/nursery/noStaticElementInteractions: stops React synthetic events from reaching the canvas */}\n\t\t\t<div\n\t\t\t\tref={popoverRef}\n\t\t\t\tdata-is-popover=\"true\"\n\t\t\t\tclassName={cx(styles.popover, !isCanvasInteractive && styles.hidden)}\n\t\t\t\tonMouseDown={stopCanvasPropagation}\n\t\t\t\tonMouseUp={stopCanvasPropagation}\n\t\t\t\t// Starts hidden at (0,0) to avoid a flash; the rAF positioning\n\t\t\t\t// loop in useAnchorTracking clears visibility once placed.\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"fixed\",\n\t\t\t\t\ttop: 0,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\tzIndex: ZIndex.canvasPopover,\n\t\t\t\t\tvisibility: \"hidden\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<InlineFeedbackThread currentUserId={currentUserId} threadId={threadId} />\n\t\t\t</div>\n\t\t</PortalWithTheme>\n\t)\n}\n", "import \"FeedbackThreadPopover.styles_1q2fdid.wyw.css\"; export const popover = \"popover_p1y1s9sp\";\nexport const hidden = \"hidden_hjvgghq\";", "import {\n\ttriggerCommentCreateEvent,\n\ttriggerCommentDeleteEvent,\n\ttriggerCommentUpdateEvent,\n\ttriggerThreadArchiveEvent,\n} from \"@framerjs/framer-events\"\nimport { assertNever, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MetricsInteractionViews } from \"app/metrics.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type { Dispatcher } from \"feedback/actions.ts\"\nimport { FeedbackActionType } from \"feedback/actions.ts\"\nimport type { Mention } from \"feedback/types.ts\"\nimport { Tab } from \"feedback/types.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\ninterface CreateDispatcherOptions {\n\tmetricsContext: MetricsInteractionViews\n}\n\nexport function createFeedbackDispatcher({ metricsContext }: CreateDispatcherOptions): Dispatcher {\n\treturn async action => {\n\t\tswitch (action.type) {\n\t\t\tcase FeedbackActionType.Copy:\n\t\t\t\treturn Clipboard.copyText(action.data).catch(unhandledError)\n\t\t\tcase FeedbackActionType.TabChange:\n\t\t\t\treturn handleTabChange(action.tab, metricsContext)\n\t\t\tcase FeedbackActionType.ThreadNew:\n\t\t\t\treturn handleThreadNew()\n\t\t\tcase FeedbackActionType.ThreadCreate:\n\t\t\t\tthrow new Error(\"ThreadCreate is not supported from the canvas HUD\")\n\t\t\tcase FeedbackActionType.ThreadSelect:\n\t\t\t\treturn handleThreadSelect(action.id, metricsContext)\n\t\t\tcase FeedbackActionType.ThreadUpdate:\n\t\t\t\tif (typeof action.archived === \"boolean\") {\n\t\t\t\t\treturn action.archived ? handleThreadArchive(action.id) : handleThreadUnarchive(action.id)\n\t\t\t\t}\n\t\t\t\tthrow new Error(\"ThreadUpdate without archive flag is not implemented\")\n\t\t\tcase FeedbackActionType.ThreadDelete:\n\t\t\t\treturn handleThreadDelete(action.id, action.hasMultipleComments)\n\t\t\tcase FeedbackActionType.CommentCreate:\n\t\t\t\treturn handleCommentCreate(action.threadId, action.text, action.mentions)\n\t\t\tcase FeedbackActionType.CommentEdit:\n\t\t\t\treturn engine.stores.feedbackStore.setCommentEditable(action.id)\n\t\t\tcase FeedbackActionType.CommentEditCancel:\n\t\t\t\treturn engine.stores.feedbackStore.clearCommentEditable(action.id)\n\t\t\tcase FeedbackActionType.CommentUpdate:\n\t\t\t\treturn handleCommentUpdate(action.threadId, action.id, action.text, action.mentions)\n\t\t\tcase FeedbackActionType.CommentDelete:\n\t\t\t\treturn handleCommentDelete(action.threadId, action.id)\n\t\t\tcase FeedbackActionType.CommentResend:\n\t\t\t\treturn engine.stores.feedbackStore.resendComment({ commentId: action.id })\n\t\t\tcase FeedbackActionType.ContextMenuOpen:\n\t\t\t\treturn engine.stores.contextMenuStore.show(action.items, { location: action.point, onDone: action.onDone })\n\t\t\tdefault:\n\t\t\t\treturn assertNever(action)\n\t\t}\n\t}\n}\n\n// TODO: Update tracking for agent\n\nasync function handleTabChange(tab: Tab, metricsContext: MetricsInteractionViews): Promise<void> {\n\tconst { feedbackStore } = engine.stores\n\tawait feedbackStore.setSelectedSidebarTab(tab)\n\trecord(\"ui_interaction\", { page: metricsContext, id: `sidebar-feedback-tab-${tab.toLowerCase()}` })\n\tif (tab === Tab.Archived) await feedbackStore.loadArchivedThreads()\n}\n\nfunction handleThreadNew(): void {\n\tconst { feedbackStore, canvasStore } = engine.stores\n\tconst point = canvasStore.getViewportCenter()\n\tfeedbackStore.createDraftThread({ type: \"canvas\", ...point })\n}\n\nasync function handleThreadSelect(\n\tthreadId: string | undefined,\n\tmetricsContext: MetricsInteractionViews,\n): Promise<void> {\n\tconst { feedbackStore } = engine.stores\n\tif (threadId) {\n\t\tawait feedbackStore.setSelectedThread(threadId)\n\t\tif (feedbackStore.selectedThread) {\n\t\t\trecord(\"ui_interaction\", { page: metricsContext, id: \"sidebar-feedback-select-thread\" })\n\t\t}\n\t} else {\n\t\tawait feedbackStore.clearSelectedThread()\n\t}\n}\n\nasync function handleThreadArchive(threadId: string): Promise<void> {\n\ttriggerThreadArchiveEvent({ threadId })\n\tawait engine.stores.feedbackStore.archiveThread(threadId)\n}\n\nasync function handleThreadUnarchive(threadId: string): Promise<void> {\n\ttriggerThreadArchiveEvent({ threadId })\n\tawait engine.stores.feedbackStore.unarchiveThread(threadId)\n}\n\nfunction handleThreadDelete(threadId: string, hasMultipleComments: boolean): void {\n\tconst { modalStore, feedbackStore } = engine.stores\n\tmodalStore.set({\n\t\ttype: ModalType.ConfirmDestructiveFeedbackAction,\n\t\ttitle: hasMultipleComments ? \"Delete Thread\" : \"Delete Comment\",\n\t\tdescription: hasMultipleComments\n\t\t\t? \"Are you sure that you want to delete this thread? This cannot be undone.\"\n\t\t\t: \"Are you sure that you want to delete this comment? This cannot be undone.\",\n\t\tconfirmLabel: Dictionary.Delete,\n\t\tsource: \"feedback\",\n\t\tonConfirm: async () => {\n\t\t\tawait feedbackStore.deleteThread(threadId)\n\t\t},\n\t})\n}\n\nasync function handleCommentCreate(threadId: string, text: string, mentions: Mention[]): Promise<void> {\n\tconst { thread, comment } = await engine.stores.feedbackStore.createComment({ threadId, text, mentions })\n\ttriggerCommentCreateEvent({ commentId: comment.id, threadId: thread.id, type: \"thread\" })\n}\n\nasync function handleCommentUpdate(\n\tthreadId: string,\n\tcommentId: string,\n\ttext: string,\n\tmentions: Mention[],\n): Promise<void> {\n\tconst { feedbackStore } = engine.stores\n\tawait feedbackStore.clearCommentEditable(commentId)\n\ttriggerCommentUpdateEvent({ commentId, threadId })\n\tawait feedbackStore.updateComment({ threadId, commentId, text, mentions })\n}\n\nfunction handleCommentDelete(threadId: string, commentId: string): void {\n\tconst { modalStore, feedbackStore } = engine.stores\n\tmodalStore.set({\n\t\ttype: ModalType.ConfirmDestructiveFeedbackAction,\n\t\ttitle: \"Delete Comment\",\n\t\tdescription: \"Are you sure that you want to delete this comment? This cannot be undone.\",\n\t\tconfirmLabel: Dictionary.Delete,\n\t\tsource: \"feedback\",\n\t\tonConfirm: async () => {\n\t\t\ttriggerCommentDeleteEvent({ commentId, threadId })\n\t\t\tawait feedbackStore.deleteComment({ threadId, commentId })\n\t\t},\n\t})\n}\n", "import type { MenuItemOptions } from \"app/menu.ts\"\nimport { useCallback } from \"react\"\nimport { type Dispatcher, FeedbackActionType } from \"./actions.ts\"\nimport { isLocalId } from \"./model.ts\"\nimport type { CommentMetadataMap, Point, Thread } from \"./types.ts\"\nimport { getThreadPermalink } from \"./utils.ts\"\n\nexport function useCommentContextMenu({\n\tcurrentUserId,\n\tthreads,\n\tarchivedThreads,\n\tcommentMetadata: commentMetadataMap,\n\tdispatch,\n}: {\n\tcurrentUserId: string\n\tthreads: readonly Thread[]\n\tarchivedThreads: readonly Thread[]\n\tcommentMetadata: CommentMetadataMap\n\tdispatch: Dispatcher\n}): ({\n\tthreadId,\n\tcommentId,\n\tpoint,\n\tonDone,\n}: {\n\tthreadId: string\n\tcommentId?: string\n\tpoint: Point\n\tonDone?: () => void\n}) => void {\n\treturn useCallback(\n\t\tasync ({ threadId, commentId, point, onDone }) => {\n\t\t\tconst target = threads.concat(archivedThreads).find(t => t.id === threadId)\n\t\t\tif (!target) return\n\n\t\t\tconst commentIndex = target.comments.findIndex(c => c.id === commentId)\n\t\t\tconst comment = target.comments[commentIndex]\n\t\t\tif (!comment) return\n\n\t\t\tconst commentMetadata = commentMetadataMap.get(comment.id)\n\t\t\tconst hasSendError = Boolean(commentMetadata?.hasSendError)\n\t\t\tconst modificationsEnabled =\n\t\t\t\t!target.archived && !isLocalId(commentId || threadId) && currentUserId === comment.author.id\n\n\t\t\tconst items: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Resend\",\n\t\t\t\t\tvisible: hasSendError,\n\t\t\t\t\tclick: () => dispatch({ type: FeedbackActionType.CommentResend, id: comment.id }),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Copy Link\",\n\t\t\t\t\tvisible: !hasSendError,\n\t\t\t\t\tenabled: !isLocalId(commentId || threadId),\n\t\t\t\t\tclick: () => dispatch({ type: FeedbackActionType.Copy, data: getThreadPermalink({ threadId, commentId }) }),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Edit\",\n\t\t\t\t\tvisible: modificationsEnabled && !hasSendError,\n\t\t\t\t\tenabled: modificationsEnabled && !hasSendError,\n\t\t\t\t\tclick: () => dispatch({ type: FeedbackActionType.CommentEdit, id: comment.id, threadId }),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Delete\",\n\t\t\t\t\tvisible: modificationsEnabled && !hasSendError,\n\t\t\t\t\tenabled: modificationsEnabled && !hasSendError,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tcommentIndex === 0\n\t\t\t\t\t\t\t? void dispatch({\n\t\t\t\t\t\t\t\t\ttype: FeedbackActionType.ThreadDelete,\n\t\t\t\t\t\t\t\t\tid: threadId,\n\t\t\t\t\t\t\t\t\thasMultipleComments: target.comments.length > 1,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t: void dispatch({ type: FeedbackActionType.CommentDelete, id: comment.id, threadId })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tawait dispatch({ type: FeedbackActionType.ContextMenuOpen, items, point, onDone })\n\t\t},\n\t\t[currentUserId, threads, archivedThreads, commentMetadataMap, dispatch],\n\t)\n}\n", "import { IconComment, Scroll, Stack } from \"@framerjs/fresco\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { MetricsViewContext } from \"app/metrics.ts\"\nimport { createFeedbackDispatcher } from \"document/components/chrome/feedback/dispatcher.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { FeedbackActionType } from \"feedback/actions.ts\"\nimport type { Comment, Mention, Point } from \"feedback/types.ts\"\nimport { useCommentContextMenu } from \"feedback/useCommentContextMenu.ts\"\nimport { isEditing } from \"feedback/utils.ts\"\nimport React, { Fragment, useCallback, useContext, useMemo, useRef } from \"react\"\nimport { InlineFeedbackComment } from \"./InlineFeedbackComment.tsx\"\nimport { InlineFeedbackComposer } from \"./InlineFeedbackComposer.tsx\"\nimport * as styles from \"./InlineFeedbackThread.styles.ts\"\n\ninterface Props {\n\tclassName?: string\n\tcurrentUserId: string\n\tthreadId: string\n}\n\nexport const InlineFeedbackThread = React.memo(function InlineFeedbackThread({\n\tclassName,\n\tcurrentUserId,\n\tthreadId,\n}: Props) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst metricsContext = useContext(MetricsViewContext)\n\tconst dispatch = useMemo(() => createFeedbackDispatcher({ metricsContext }), [metricsContext])\n\n\tconst feedbackStore = engine.stores.feedbackStore\n\tconst { threads, archivedThreads } = feedbackStore\n\n\t// Subscribe to a stable version of the thread to avoid unnecessary re-renders\n\tconst { comments, mentionableUsers, commentMetadata, editingCommentId } = useEngineState(\n\t\t() => {\n\t\t\tconst { mentionableUsers, commentMetadata } = feedbackStore\n\t\t\tconst threadComments = feedbackStore.getThread(threadId)?.comments ?? []\n\t\t\tconst comments: Comment[] = threadComments.filter(comment => !comment.deletedBy)\n\t\t\tconst editingComment = comments.find(comment => isEditing(comment, commentMetadata))\n\t\t\treturn {\n\t\t\t\tcomments,\n\t\t\t\tmentionableUsers,\n\t\t\t\tcommentMetadata,\n\t\t\t\teditingCommentId: editingComment?.id,\n\t\t\t}\n\t\t},\n\t\t[threadId],\n\t\tengine.stores.feedbackStore,\n\t\t{\n\t\t\tdeepEqual: true,\n\t\t},\n\t)\n\n\tconst scrollEndRef = useRef<HTMLDivElement | null>(null)\n\n\tconst handleCommentContextMenu = useCommentContextMenu({\n\t\tcurrentUserId,\n\t\tthreads,\n\t\tarchivedThreads,\n\t\tcommentMetadata,\n\t\tdispatch,\n\t})\n\n\tconst onContextMenu = useCallback(\n\t\t(commentId: string, point: Point, onDone?: () => void) => {\n\t\t\thandleCommentContextMenu({ threadId, commentId, point, onDone })\n\t\t},\n\t\t[handleCommentContextMenu, threadId],\n\t)\n\n\tconst handleReplySubmit = useCallback(\n\t\tasync (text: string, mentions: Mention[]) => {\n\t\t\tawait dispatch({\n\t\t\t\ttype: FeedbackActionType.CommentCreate,\n\t\t\t\tthreadId,\n\t\t\t\ttext,\n\t\t\t\tmentions,\n\t\t\t})\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tscrollEndRef.current?.scrollIntoView({ behavior: \"smooth\" })\n\t\t\t})\n\t\t},\n\t\t[dispatch, threadId],\n\t)\n\n\tconst handleEditSubmit = useCallback(\n\t\tasync (commentId: string, text: string, mentions: Mention[]) => {\n\t\t\tawait dispatch({\n\t\t\t\ttype: FeedbackActionType.CommentUpdate,\n\t\t\t\tthreadId,\n\t\t\t\tid: commentId,\n\t\t\t\ttext,\n\t\t\t\tmentions,\n\t\t\t})\n\t\t},\n\t\t[dispatch, threadId],\n\t)\n\n\tconst handleEditCancel = useCallback(\n\t\tasync (commentId: string) => {\n\t\t\tawait dispatch({\n\t\t\t\ttype: FeedbackActionType.CommentEditCancel,\n\t\t\t\tthreadId: threadId,\n\t\t\t\tid: commentId,\n\t\t\t})\n\t\t},\n\t\t[dispatch, threadId],\n\t)\n\n\tconst handleResolve = useCallback(() => {\n\t\tvoid dispatch({ type: FeedbackActionType.ThreadUpdate, id: threadId, archived: true })\n\t}, [dispatch, threadId])\n\n\t// TODO: We need to add auto scroll behavior here when coming from link.\n\treturn (\n\t\t<Stack className={className}>\n\t\t\t<Scroll className={styles.commentsScroll} direction=\"vertical\" showScrollbar={false}>\n\t\t\t\t<ul className={styles.comments}>\n\t\t\t\t\t{comments.map((comment, index) => (\n\t\t\t\t\t\t<Fragment key={comment.id}>\n\t\t\t\t\t\t\t<InlineFeedbackComment\n\t\t\t\t\t\t\t\tcomment={comment}\n\t\t\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t\t\t\tisFirstComment={index === 0}\n\t\t\t\t\t\t\t\tisEditing={editingCommentId === comment.id}\n\t\t\t\t\t\t\t\tonEditSubmit={handleEditSubmit}\n\t\t\t\t\t\t\t\tonEditCancel={handleEditCancel}\n\t\t\t\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\t\t\t\tonResolve={handleResolve}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<div className={styles.divider} />\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\n\t\t\t\t<div ref={scrollEndRef} />\n\t\t\t</Scroll>\n\n\t\t\t<div className={styles.reply}>\n\t\t\t\t<span className={styles.replyIcon}>\n\t\t\t\t\t<IconComment />\n\t\t\t\t</span>\n\n\t\t\t\t<InlineFeedbackComposer\n\t\t\t\t\t// TODO: revisit this. Maybe refactor FeedbackCommentForm\n\t\t\t\t\t// Using a key here to make sure if the thread id changes the prose mirror editor\n\t\t\t\t\t// is remounted and callbacks work again.\n\t\t\t\t\tkey={threadId}\n\t\t\t\t\tclassName={styles.replyComposer}\n\t\t\t\t\tplaceholder={Dictionary.ReplyEllipsis}\n\t\t\t\t\tdefaultValue=\"\"\n\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\tonSubmit={handleReplySubmit}\n\t\t\t\t\tonCancel={noop}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n})\n", "import { type Suggester, suggest } from \"prosemirror-suggest\"\n\nconst supportedCharacters = new RegExp(/\\p{L}/u)\nexport function mentionPlugin(\n\tonOpen: (params: {\n\t\tquery: string\n\t\tcoordinates: { left: number; top: number }\n\t\tmentionPosition: { from: number; to: number }\n\t}) => void,\n\tonClose: () => void,\n) {\n\tconst suggester: Suggester = {\n\t\tchar: \"@\",\n\t\tname: \"mention\",\n\t\tsupportedCharacters,\n\t\tcaptureChar: true,\n\t\tmatchOffset: 1,\n\t\tcaseInsensitive: true,\n\t\tunicode: true,\n\t\tonChange: params => {\n\t\t\tconst { query, view, range, exitReason } = params\n\n\t\t\tif (exitReason) {\n\t\t\t\tonClose()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst coords = view.coordsAtPos(range.from)\n\n\t\t\tonOpen({\n\t\t\t\tquery: query.full.toLowerCase(),\n\t\t\t\tcoordinates: { left: coords.left, top: coords.bottom },\n\t\t\t\tmentionPosition: { from: range.from, to: range.to },\n\t\t\t})\n\t\t},\n\n\t\tdisableDecorations: (editorState, match) => {\n\t\t\treturn match.range.to < editorState.selection.to\n\t\t},\n\t}\n\n\treturn suggest(suggester)\n}\n", "import type { WindowWithCurrentUser } from \"@framerjs/app-shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { mentionPlugin } from \"feedback/mentionPlugin.ts\"\nimport { DOMParser, DOMSerializer, type Mark, type Node as ProseMirrorNode, Schema } from \"prosemirror-model\"\nimport { EditorState, type Transaction } from \"prosemirror-state\"\nimport { Plugin } from \"prosemirror-state\"\nimport { EditorView } from \"prosemirror-view\"\nimport { getCharDeleteRange } from \"prosemirror/deleteCharCommand.ts\"\nimport type { ProseMirror } from \"prosemirror/loader.ts\"\nimport { useImportProseMirror } from \"prosemirror/loader.ts\"\nimport { useInsertionEffect, useMemo, useRef } from \"react\"\nimport { isDefined } from \"utils/typeChecks.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\n\ninterface OnSubmitRef {\n\tcurrent: (state: EditorState) => boolean\n}\n\nconst currentUser = (window as WindowWithCurrentUser)?.framerUser\n\nfunction placeholderPlugin(placeholderText: string) {\n\treturn new Plugin({\n\t\tview(editorView) {\n\t\t\tconst dom = editorView.dom\n\n\t\t\tdom.setAttribute(\"data-placeholder\", placeholderText)\n\t\t\tupdatePlaceholder(editorView)\n\n\t\t\treturn {\n\t\t\t\tupdate(view) {\n\t\t\t\t\tupdatePlaceholder(view)\n\t\t\t\t},\n\t\t\t\tdestroy() {\n\t\t\t\t\tdom.removeAttribute(\"data-placeholder\")\n\t\t\t\t\tdom.classList.remove(\"has-placeholder\")\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t})\n}\n\nexport function isCommentEmpty(doc: ProseMirrorNode) {\n\treturn doc.childCount === 1 && doc.firstChild?.isTextblock && doc.firstChild?.content.size === 0\n}\n\nfunction updatePlaceholder(view: EditorView) {\n\tconst { doc } = view.state\n\tconst dom = view.dom\n\n\tconst isEmpty = isCommentEmpty(doc)\n\n\tif (isEmpty) {\n\t\tdom.classList.add(\"has-placeholder\")\n\t} else {\n\t\tdom.classList.remove(\"has-placeholder\")\n\t}\n}\n\nexport function useFeedbackCommentEditorView(\n\tplaceholderText: string,\n\tonSubmit: (state: EditorState) => boolean,\n\thandleEscape: () => void,\n\tsetIsValid: (value: boolean) => void,\n\tonOpen: (params: {\n\t\tquery: string\n\t\tcoordinates: { left: number; top: number }\n\t\tmentionPosition: { from: number; to: number }\n\t}) => void,\n\tonClose: () => void,\n\tclearOnSubmit: boolean = true,\n) {\n\tconst proseMirror = useImportProseMirror()\n\n\t// Use a ref to store the latest onSubmit callback so the ProseMirror keymap handler\n\t// always calls the current version, even though the editor view is only created once.\n\t// This fixes a bug where switching threads would cause comments to be posted to the\n\t// wrong thread because the onSubmit callback was captured in a stale closure.\n\t// Note: handleEscape doesn't need this fix because it doesn't reference thread-specific state.\n\tconst onSubmitRef = useRef(onSubmit)\n\t// Update the ref in useInsertionEffect to avoid issues with React's concurrent rendering.\n\t// Mutating refs during render can cause problems in future React versions.\n\tuseInsertionEffect(() => {\n\t\tonSubmitRef.current = onSubmit\n\t}, [onSubmit])\n\n\tconst editorView = useConstant(() =>\n\t\tcreateFeedbackCommentEditorView(\n\t\t\tproseMirror,\n\t\t\tplaceholderText,\n\t\t\tonSubmitRef,\n\t\t\thandleEscape,\n\t\t\tsetIsValid,\n\t\t\tonOpen,\n\t\t\tonClose,\n\t\t\tclearOnSubmit,\n\t\t),\n\t)\n\treturn editorView\n}\n\ninterface MentionAttrs {\n\treadonly userId: string\n\treadonly type: \"userId\"\n\tname: string\n}\n\ntype MentionMark = Mark<MentionAttrs>\n\nexport function isMentionMark(mark: Mark): mark is MentionMark {\n\treturn mark.type === schema.marks.mention\n}\n\nconst strongRegex = /^(bold(er)?|[5-9]\\d{2,})$/\n\nexport const schema = new Schema({\n\tnodes: {\n\t\tdoc: {\n\t\t\tcontent: \"block+\",\n\t\t},\n\t\tparagraph: {\n\t\t\tcontent: \"inline*\",\n\t\t\tgroup: \"block\",\n\t\t\tparseDOM: [{ tag: \"p\" }],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"p\", 0]\n\t\t\t},\n\t\t},\n\t\ttext: {\n\t\t\tinline: true,\n\t\t\tgroup: \"inline\",\n\t\t},\n\t\tlineBreak: {\n\t\t\tinline: true,\n\t\t\tgroup: \"inline\",\n\n\t\t\tselectable: false,\n\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement(\"br\")\n\t\t\t},\n\n\t\t\tparseDOM: [\n\t\t\t\t{\n\t\t\t\t\t// When serializing we add a trailing break if the last node is a line break.\n\t\t\t\t\ttag: \"br.trailing-break\",\n\t\t\t\t\tignore: true,\n\t\t\t\t},\n\n\t\t\t\t{\n\t\t\t\t\ttag: \"br\",\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n\tmarks: {\n\t\t// Ported over from https://github.com/ProseMirror/prosemirror-schema-basic/blob/8ce70c4971d7354651a6fb7df879212e37939083/src/schema-basic.ts\n\t\tem: {\n\t\t\tparseDOM: [\n\t\t\t\t{ tag: \"i\" },\n\t\t\t\t{ tag: \"em\" },\n\t\t\t\t{ style: \"font-style=italic\" },\n\t\t\t\t{ style: \"font-style=normal\", clearMark: m => m.type.name === \"em\" },\n\t\t\t],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"em\", 0]\n\t\t\t},\n\t\t},\n\n\t\tstrong: {\n\t\t\tparseDOM: [\n\t\t\t\t{ tag: \"strong\" },\n\t\t\t\t// This works around a Google Docs misbehavior where\n\t\t\t\t// pasted content will be inexplicably wrapped in `<b>`\n\t\t\t\t// tags with a font-weight normal.\n\t\t\t\t{ tag: \"b\", getAttrs: (node: HTMLElement) => node.style.fontWeight !== \"normal\" && null },\n\t\t\t\t{ style: \"font-weight=400\", clearMark: m => m.type.name === \"strong\" },\n\t\t\t\t{ style: \"font-weight\", getAttrs: (value: string) => strongRegex.test(value) && null },\n\t\t\t],\n\t\t\ttoDOM() {\n\t\t\t\treturn [\"strong\", 0]\n\t\t\t},\n\t\t},\n\t\tmention: {\n\t\t\tattrs: {\n\t\t\t\tuserId: { default: \"\" },\n\t\t\t\tname: { default: \"\" },\n\t\t\t},\n\t\t\tinclusive: false,\n\n\t\t\ttoDOM(mark) {\n\t\t\t\treturn [\n\t\t\t\t\t\"span\",\n\t\t\t\t\t{\n\t\t\t\t\t\tclass: `framer-mention ${mark.attrs.userId === currentUser.id ? \"current-user\" : \"\"}`,\n\t\t\t\t\t\t\"data-name\": mark.attrs.name,\n\t\t\t\t\t\t\"data-user-id\": mark.attrs.userId,\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t]\n\t\t\t},\n\n\t\t\tparseDOM: [\n\t\t\t\t{\n\t\t\t\t\ttag: \"span.framer-mention\",\n\t\t\t\t\tgetAttrs(dom: HTMLSpanElement) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tuserId: dom.dataset.userId || \"\",\n\t\t\t\t\t\t\tname: dom.dataset.name || \"\",\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\nexport function isValidComment(value: string): boolean {\n\treturn value.trim().length > 0\n}\n\nfunction createFeedbackCommentEditorView(\n\tproseMirror: ProseMirror,\n\tplaceholderText: string,\n\tonSubmitRef: OnSubmitRef,\n\thandleEscape: () => void,\n\tsetIsValid: (isValid: boolean) => void,\n\tonOpen: (params: {\n\t\tquery: string\n\t\tcoordinates: { left: number; top: number }\n\t\tmentionPosition: { from: number; to: number }\n\t}) => void,\n\tonClose: () => void,\n\tclearOnSubmit: boolean = true,\n) {\n\tconst { undo, redo, history, keymap, toggleMark, baseKeymap } = proseMirror\n\n\tconst plugins = [\n\t\tkeymap({\n\t\t\t\"Mod-b\": toggleMark(schema.marks.strong),\n\t\t\t\"Mod-i\": toggleMark(schema.marks.em),\n\t\t\t\"Mod-z\": undo,\n\t\t\t\"Mod-Shift-z\": redo,\n\t\t\t\"Shift-Enter\": (state, dispatch) => {\n\t\t\t\tif (!dispatch) return false\n\t\t\t\tconst lineBreak = schema.nodes.lineBreak.create()\n\t\t\t\tconst transaction = state.tr.replaceSelectionWith(lineBreak).scrollIntoView()\n\t\t\t\tdispatch(transaction)\n\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tEnter: (state, dispatch) => {\n\t\t\t\tif (!dispatch || !isValidComment(state.doc.textContent)) return false\n\t\t\t\t// Read from ref to get the latest callback, avoiding stale closure issues\n\t\t\t\tconst successfullySubmitted = onSubmitRef.current(state)\n\t\t\t\tif (!successfullySubmitted) return false\n\t\t\t\tif (clearOnSubmit) dispatch(state.tr.delete(0, state.doc.content.size))\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tEscape: (_, dispatch) => {\n\t\t\t\tif (!dispatch) return false\n\t\t\t\thandleEscape()\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tDelete: (state, dispatch) => {\n\t\t\t\tif (!dispatch) return false\n\t\t\t\thandleDeleteText(state, dispatch, \"forward\")\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tBackspace: (state, dispatch) => {\n\t\t\t\tif (!dispatch) return false\n\t\t\t\thandleDeleteText(state, dispatch, \"backward\")\n\t\t\t\treturn true\n\t\t\t},\n\t\t}),\n\t\tkeymap(baseKeymap),\n\t\thistory(),\n\t\texperiments.isOn(\"mentionsInComments\") ? mentionPlugin(onOpen, onClose) : undefined,\n\t\tplaceholderPlugin(placeholderText),\n\t].filter(isDefined)\n\n\tconst editorView = new EditorView(null, {\n\t\tstate: EditorState.create({\n\t\t\tschema,\n\t\t\tplugins,\n\t\t}),\n\t\tdispatchTransaction: (transaction: Transaction) => {\n\t\t\tconst newState = editorView.state.apply(transaction)\n\t\t\teditorView.updateState(newState)\n\n\t\t\tif (transaction.docChanged) {\n\t\t\t\tsetIsValid(isValidComment(newState.doc.textContent))\n\t\t\t}\n\t\t},\n\t})\n\n\treturn editorView\n}\n\nfunction handleDeleteText(\n\tstate: EditorState,\n\tdispatch: (tr: Transaction) => void,\n\tdirection: \"forward\" | \"backward\",\n): void {\n\tconst range = getCharDeleteRange(state, direction)\n\tif (!range) return\n\n\tconst tr = state.tr\n\tstate.doc.nodesBetween(range.from, range.to, (node, position) => {\n\t\tconst mentionMark = node.marks.find(m => isMentionMark(m))\n\t\tif (mentionMark) {\n\t\t\ttr.removeMark(position, position + node.nodeSize, schema.marks.mention)\n\t\t}\n\t})\n\ttr.delete(range.from, range.to)\n\tdispatch(tr)\n}\n\nexport function useSafeComment(text: string): { html: string; textContent: string } {\n\treturn useMemo(() => {\n\t\tconst parsed = parseComment(text)\n\t\treturn {\n\t\t\thtml: serializeComment(parsed),\n\t\t\ttextContent: parsed.textContent,\n\t\t}\n\t}, [text])\n}\n\nconst domParser = DOMParser.fromSchema(schema)\n\nexport function parseComment(html: string) {\n\t// Previous versions of commenting stored line breaks as `/n` instead of `<br>`.\n\t// In order for prosemirror to parse the comment correctly, we need to replace the line breaks with `<br>`.\n\thtml = html.replace(/\\n/g, \"<br>\")\n\n\tconst template = document.createElement(\"template\")\n\ttemplate.innerHTML = html\n\n\tconst parsed = domParser.parse(template.content, {\n\t\tpreserveWhitespace: true,\n\t})\n\n\treturn parsed\n}\n\nconst domSerializer = DOMSerializer.fromSchema(schema)\nexport function serializeComment(doc: ProseMirrorNode) {\n\tconst fragment = domSerializer.serializeFragment(doc.content)\n\n\tconst div = document.createElement(\"div\")\n\tdiv.appendChild(fragment)\n\n\treturn div.innerHTML\n}\n", "import { Avatar, Stack } from \"@framerjs/fresco\"\nimport { shadows } from \"@framerjs/fresco/tokens\"\nimport type { Comment, Mention, MentionableUser, Point } from \"feedback/types.ts\"\nimport { useSafeComment } from \"feedback/useFeedbackCommentEditorView.ts\"\nimport type React from \"react\"\nimport { useCallback, useState } from \"react\"\nimport { formatDate } from \"web/lib/Project.ts\"\nimport { formatDistanceToNowShort } from \"web/pages/project/lib/formatDistanceToNowShort.ts\"\nimport { FeedbackThreadActions } from \"./FeedbackThreadActions.tsx\"\nimport * as styles from \"./InlineFeedbackComment.styles.ts\"\nimport { InlineFeedbackComposer } from \"./InlineFeedbackComposer.tsx\"\nimport * as shared from \"./agentFeedbackComment.styles.ts\"\n\ninterface Props {\n\tcomment: Comment\n\tmentionableUsers: readonly MentionableUser[]\n\tisFirstComment?: boolean\n\tisEditing?: boolean\n\tonEditSubmit: (commentId: string, text: string, mentions: Mention[]) => Promise<void>\n\tonEditCancel: (commentId: string) => Promise<void>\n\tonContextMenu: (commentId: string, point: Point, onDone?: () => void) => void\n\tonResolve: () => void\n}\n\nexport function InlineFeedbackComment({\n\tcomment,\n\tmentionableUsers,\n\tisFirstComment = false,\n\tisEditing = false,\n\tonEditSubmit,\n\tonEditCancel,\n\tonContextMenu,\n\tonResolve,\n}: Props) {\n\tconst [isMenuOpen, setIsMenuOpen] = useState(false)\n\n\tconst author = comment.author\n\tconst date = comment.createdAt\n\tconst text = comment.text\n\t// Do we need to handle hasOnlyEmoji here? If so define how.\n\tconst { html } = useSafeComment(text)\n\n\tconst handleEditSubmit = useCallback(\n\t\tasync (text: string, mentions: Mention[]) => {\n\t\t\tawait onEditSubmit(comment.id, text, mentions)\n\t\t},\n\t\t[comment.id, onEditSubmit],\n\t)\n\n\tconst handleEditCancel = useCallback(async () => {\n\t\tawait onEditCancel(comment.id)\n\t}, [comment.id, onEditCancel])\n\n\tconst handleContextMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.preventDefault()\n\t\t\tsetIsMenuOpen(true)\n\t\t\tconst point = { x: event.clientX, y: event.clientY }\n\t\t\tonContextMenu(comment.id, point, () => setIsMenuOpen(false))\n\t\t},\n\t\t[comment.id, onContextMenu],\n\t)\n\n\tif (comment.deletedBy) return null\n\n\treturn (\n\t\t<li className={styles.comment} onContextMenu={handleContextMenu}>\n\t\t\t<Stack direction=\"row\">\n\t\t\t\t<Avatar\n\t\t\t\t\tsize={30}\n\t\t\t\t\tsrc={author?.avatar}\n\t\t\t\t\ttext={author?.initials}\n\t\t\t\t\tradiusCustomStyles={shared.avatarRadiusLarge}\n\t\t\t\t\tshadow={shadows.avatar}\n\t\t\t\t/>\n\n\t\t\t\t<Stack className={styles.commentHeader} gap={0} justifyContent=\"center\" alignItems=\"stretch\">\n\t\t\t\t\t<span className={shared.authorName}>{author?.name}</span>\n\n\t\t\t\t\t<time className={shared.timestamp} dateTime={date.toDateString()} title={formatDate(date)}>\n\t\t\t\t\t\t{formatDistanceToNowShort(date, { addSuffix: true, justNow: true })}\n\t\t\t\t\t</time>\n\t\t\t\t</Stack>\n\n\t\t\t\t<FeedbackThreadActions\n\t\t\t\t\tvisible={isMenuOpen}\n\t\t\t\t\tmenuOpen={isMenuOpen}\n\t\t\t\t\tshowResolve={isFirstComment}\n\t\t\t\t\tonMenuClick={handleContextMenu}\n\t\t\t\t\tonResolveClick={onResolve}\n\t\t\t\t/>\n\t\t\t</Stack>\n\n\t\t\t{isEditing ? (\n\t\t\t\t<InlineFeedbackComposer\n\t\t\t\t\tplaceholder=\"\"\n\t\t\t\t\tdefaultValue={comment.text}\n\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\tonSubmit={handleEditSubmit}\n\t\t\t\t\tonCancel={handleEditCancel}\n\t\t\t\t\tclearOnSubmit={false}\n\t\t\t\t\tautoFocus\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tclassName={styles.commentText}\n\t\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\t\tdangerouslySetInnerHTML={{ __html: html }}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</li>\n\t)\n}\n", "import { IconDots } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { AgentButton } from \"../AgentButton/AgentButton.tsx\"\nimport * as styles from \"./FeedbackThreadActions.styles.ts\"\n\ninterface FeedbackThreadActionsProps {\n\tvisible?: boolean\n\tshowResolve?: boolean\n\tactive?: boolean\n\tmenuOpen?: boolean\n\tonMenuClick: (event: React.MouseEvent) => void\n\tonResolveClick: () => void\n}\n\nexport function FeedbackThreadActions({\n\tvisible,\n\tshowResolve = true,\n\tactive = false,\n\tmenuOpen = false,\n\tonMenuClick,\n\tonResolveClick,\n}: FeedbackThreadActionsProps) {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\n\tconst handleResolveClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\t\t\tonResolveClick()\n\t\t},\n\t\t[onResolveClick],\n\t)\n\n\tconst handleMenuClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\t\t\tonMenuClick(event)\n\t\t},\n\t\t[onMenuClick],\n\t)\n\n\tif (isViewOnly) return null\n\n\treturn (\n\t\t<div className={styles.actions}>\n\t\t\t<AgentButton\n\t\t\t\tvariant=\"clean\"\n\t\t\t\taria-label=\"More actions\"\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.actionButton,\n\t\t\t\t\tvisible && styles.actionButtonVisible,\n\t\t\t\t\tactive && styles.actionButtonActive,\n\t\t\t\t\tmenuOpen && styles.actionButtonHighlighted,\n\t\t\t\t)}\n\t\t\t\tonMouseDown={handleMenuClick}\n\t\t\t>\n\t\t\t\t<IconDots />\n\t\t\t</AgentButton>\n\t\t\t{showResolve && (\n\t\t\t\t<AgentButton\n\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\taria-label=\"Resolve\"\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.actionButton,\n\t\t\t\t\t\tvisible && styles.actionButtonVisible,\n\t\t\t\t\t\tactive && styles.actionButtonActive,\n\t\t\t\t\t)}\n\t\t\t\t\tonMouseDown={handleResolveClick}\n\t\t\t\t>\n\t\t\t\t\t<AgentFeedbackResolveIcon />\n\t\t\t\t</AgentButton>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction AgentFeedbackResolveIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"m5.5 10 1.939 1.939a1.5 1.5 0 0 0 2.122 0L14.5 7\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"FeedbackThreadActions.styles_1fqn15y.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { sharedIconColors } from \"../AgentButton/AgentButton.styles.ts\";\nexport const actions = \"actions_a1qv96k3\";\nexport const actionButtonVisible = \"actionButtonVisible_ayei3a2\";\nexport const actionButtonActive = \"actionButtonActive_a20hrgq\";\nexport const actionButtonHighlighted = \"actionButtonHighlighted_a1tzt4gw\";\nexport const actionButton = cx(sharedIconColors, \"actionButton_aliqskn\");", "import \"agentFeedbackComment.styles_14v0dq2.wyw.css\"; export const avatarRadius = \"avatarRadius_a19naofu\";\nexport const avatarRadiusLarge = \"avatarRadiusLarge_a39dp9y\";\nexport const authorName = \"authorName_a17a4k22\";\nexport const timestamp = \"timestamp_t1gqpv43\";\nexport const commentText = \"commentText_cyr9d8t\";", "import \"InlineFeedbackComment.styles_1eqquoh.wyw.css\"; import { cx } from \"@linaria/core\";\nimport * as shared from \"./agentFeedbackComment.styles.ts\";\nexport const comment = \"comment_c10t0xk9\";\nexport const commentHeader = \"commentHeader_c1lcb5cu\";\nexport const commentText = cx(shared.commentText, \"commentText_c7a35n0\");", "import { Role } from \"@framerjs/app-shared\"\nimport { IconSend, Popover } from \"@framerjs/fresco\"\nimport type { AttachmentEdgePreferences } from \"@framerjs/fresco/src/components/Popover\"\nimport { cx } from \"@linaria/core\"\nimport { experiments } from \"app/experiments.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { EditorState, TextSelection } from \"prosemirror-state\"\nimport { useCallback, useLayoutEffect, useMemo, useRef, useState } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport * as styles from \"./FeedbackCommentForm.styles.ts\"\nimport { MentionSuggestionList } from \"./MentionSuggestionList.tsx\"\nimport type { Mention, MentionableUser } from \"./types.ts\"\nimport {\n\tisCommentEmpty,\n\tisMentionMark,\n\tisValidComment,\n\tparseComment,\n\tschema,\n\tserializeComment,\n\tuseFeedbackCommentEditorView,\n} from \"./useFeedbackCommentEditorView.ts\"\n\ninterface Props {\n\tclassName?: string\n\tbuttonClassName?: string\n\ttextEditorClassName?: string\n\tplaceholderText?: string\n\tmentionableUsers: readonly MentionableUser[]\n\tdisabled?: boolean\n\tdefaultValue?: string\n\tautoFocus?: boolean\n\tclearOnSubmit?: boolean\n\tonSubmit: (value: string, mentions: Mention[]) => void\n\tonCancel: () => void\n}\n\ninterface SuggestionState {\n\tquery: string\n\tcoordinates: { top: number; left: number }\n\tmentionPosition: { from: number; to: number }\n}\n\nexport function FeedbackCommentForm({\n\tclassName,\n\tbuttonClassName,\n\ttextEditorClassName,\n\tplaceholderText = \"Reply\u2026\",\n\tmentionableUsers,\n\tdisabled = false,\n\tdefaultValue = \"\",\n\tautoFocus = true,\n\tclearOnSubmit = true,\n\tonSubmit,\n\tonCancel,\n}: Props) {\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst [isValid, setIsValid] = useState(() => isValidComment(defaultValue))\n\tconst prosemirrorDivRef = useRef<HTMLDivElement>(null)\n\n\tconst [suggestionState, setSuggestionState] = useState<SuggestionState | null>(null)\n\tconst suggestedUsers = useMemo(() => {\n\t\tconst query = (suggestionState?.query ?? \"\").toLowerCase()\n\t\treturn mentionableUsers\n\t\t\t.filter(user => user.name.toLowerCase().includes(query))\n\t\t\t.sort((a, b) => {\n\t\t\t\tif (a.isProjectMember !== b.isProjectMember) return a.isProjectMember ? -1 : 1\n\t\t\t\tconst aName = a.name.toLowerCase()\n\t\t\t\tconst bName = b.name.toLowerCase()\n\t\t\t\tconst aIndex = aName.indexOf(query)\n\t\t\t\tconst bIndex = bName.indexOf(query)\n\t\t\t\tconst aStarts = aIndex === 0\n\t\t\t\tconst bStarts = bIndex === 0\n\t\t\t\tif (aStarts !== bStarts) return aStarts ? -1 : 1\n\t\t\t\tif (aIndex !== bIndex) return aIndex - bIndex\n\t\t\t\treturn aName.localeCompare(bName)\n\t\t\t})\n\t}, [mentionableUsers, suggestionState])\n\n\tconst handleOpen = ({\n\t\tquery,\n\t\tcoordinates,\n\t\tmentionPosition,\n\t}: {\n\t\tquery: string\n\t\tcoordinates: SuggestionState[\"coordinates\"]\n\t\tmentionPosition: SuggestionState[\"mentionPosition\"]\n\t}) => {\n\t\tsetSuggestionState({ query, coordinates, mentionPosition })\n\t}\n\n\tconst onDismissMentionSuggestions = useCallback(() => {\n\t\tsetSuggestionState(null)\n\t}, [])\n\tconst projectMemberIds = useMemo(() => {\n\t\treturn new Set(mentionableUsers.filter(user => user.isProjectMember).map(user => user.id))\n\t}, [mentionableUsers])\n\n\tconst handleSubmitComment = useCallback(\n\t\t(editorState: EditorState): boolean => {\n\t\t\tconst comment = serializeComment(editorState.doc)\n\t\t\tif (!isValidComment(comment)) return false\n\n\t\t\tconst uniqueMentionedUserIds = new Set<string>()\n\n\t\t\teditorState.doc.descendants(node => {\n\t\t\t\tif (node.isText && node.marks.length > 0) {\n\t\t\t\t\tnode.marks.forEach(mark => {\n\t\t\t\t\t\tif (isMentionMark(mark)) {\n\t\t\t\t\t\t\tif (!isString(mark.attrs.userId)) return\n\t\t\t\t\t\t\tuniqueMentionedUserIds.add(mark.attrs.userId)\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treturn true // continue traversal\n\t\t\t})\n\t\t\tconst mentionedUserIds = Array.from(uniqueMentionedUserIds)\n\n\t\t\tonSubmit(\n\t\t\t\tcomment,\n\t\t\t\tmentionedUserIds.map(userId => ({ type: \"userId\", value: userId })),\n\t\t\t)\n\t\t\t// TODO: Bulk invite users, supporting existing invites (they should be ignored in the backend, FE doesn't need to handle it)\n\t\t\t// Then \"isProjectMember\" should be removed from MentionableUser\n\t\t\tconst invites = mentionedUserIds.filter(userId => !projectMemberIds.has(userId))\n\t\t\tvoid Promise.allSettled(\n\t\t\t\tinvites.map(userId =>\n\t\t\t\t\tremoteDispatch?.invite({\n\t\t\t\t\t\tuserId,\n\t\t\t\t\t\trole: Role.Viewer,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t)\n\t\t\treturn true\n\t\t},\n\t\t[onSubmit, remoteDispatch, projectMemberIds],\n\t)\n\n\tconst editorView = useFeedbackCommentEditorView(\n\t\tplaceholderText,\n\t\thandleSubmitComment,\n\t\tonCancel,\n\t\tsetIsValid,\n\t\thandleOpen,\n\t\tonDismissMentionSuggestions,\n\t\tclearOnSubmit,\n\t)\n\tconst [previousValue, setPreviousValue] = useState<string | null>(null)\n\n\tif (previousValue !== defaultValue) {\n\t\tsetPreviousValue(defaultValue)\n\t\tif (editorView) {\n\t\t\teditorView.updateState(\n\t\t\t\tEditorState.create({\n\t\t\t\t\tdoc: parseComment(defaultValue),\n\t\t\t\t\tschema: editorView.state.schema,\n\t\t\t\t\tplugins: editorView.state.plugins,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t}\n\n\t/**\n\t * Handles submission and content clearing for button clicks.\n\t * Note: Enter key submission + clearing is handled separately in useFeedbackCommentEditorView\n\t * due to hook initialization order preventing editorView access in handleSubmitComment.\n\t */\n\tconst handleSubmitAndClearContent = useCallback(() => {\n\t\tconst { state, dispatch } = editorView\n\t\tconst { tr, doc } = state\n\t\tconst success = handleSubmitComment(state)\n\t\tif (!success) return\n\n\t\tif (clearOnSubmit) tr.delete(0, doc.content.size)\n\n\t\tdispatch(tr)\n\t}, [editorView, handleSubmitComment, clearOnSubmit])\n\n\tuseLayoutEffect(() => {\n\t\tconst element = prosemirrorDivRef.current\n\t\tassert(element, \"Element must exist\")\n\n\t\telement.appendChild(editorView.dom)\n\t\tconst { doc } = editorView.state\n\t\tconst isEmpty = isCommentEmpty(doc)\n\n\t\tif (isEmpty) {\n\t\t\tconst safeSelectionPosition = Math.max(editorView.state.doc.content.size - 1, 0)\n\t\t\tconst tr = editorView.state.tr.setSelection(TextSelection.create(editorView.state.doc, safeSelectionPosition))\n\n\t\t\teditorView.dispatch(tr)\n\t\t}\n\n\t\tif (autoFocus) {\n\t\t\trequestAnimationFrame(() => editorView.dom.focus())\n\t\t}\n\n\t\treturn () => {\n\t\t\telement.removeChild(editorView.dom)\n\t\t}\n\t}, [editorView, autoFocus])\n\n\tconst handleInsertMention = useCallback(\n\t\t(userId: string, name: string) => {\n\t\t\tif (!suggestionState) return\n\t\t\tconst { tr } = editorView.state\n\t\t\tconst { from, to } = suggestionState.mentionPosition\n\n\t\t\tconst mentionMark = schema.marks.mention\n\n\t\t\ttr.replaceWith(from, to, schema.text(`${name}`, [mentionMark.create({ userId, name })]))\n\t\t\ttr.insert(from + name.length, schema.text(\" \"))\n\n\t\t\teditorView.dispatch(tr)\n\t\t\tsetTimeout(() => editorView.focus(), 0)\n\t\t\tonDismissMentionSuggestions()\n\t\t},\n\t\t[editorView, suggestionState, onDismissMentionSuggestions],\n\t)\n\n\tconst anchorRef = useRef<HTMLDivElement>(null)\n\n\tuseLayoutEffect(() => {\n\t\tif (!suggestionState) return\n\t\tconst { left, top } = suggestionState.coordinates\n\t\tconst anchorElement = anchorRef.current\n\t\tif (!anchorElement) return\n\n\t\tanchorElement.style.left = `${left}px`\n\t\tanchorElement.style.top = `${top - 20}px`\n\t}, [suggestionState])\n\n\treturn (\n\t\t<>\n\t\t\t{createPortal(\n\t\t\t\t<div ref={anchorRef} className={styles.anchor} id=\"mention-suggestion-list-anchor\" />,\n\t\t\t\tdocument.body,\n\t\t\t)}\n\t\t\t<div className={cx(styles.container, className)}>\n\t\t\t\t<div\n\t\t\t\t\tref={prosemirrorDivRef}\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t\trole=\"textbox\"\n\t\t\t\t\tclassName={cx(styles.textEditor, textEditorClassName)}\n\t\t\t\t/>\n\t\t\t\t<button\n\t\t\t\t\tclassName={cx(styles.button, buttonClassName, isValid && styles.active)}\n\t\t\t\t\tonClick={handleSubmitAndClearContent}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\taria-label=\"submit\"\n\t\t\t\t\tdisabled={disabled || !isValid}\n\t\t\t\t>\n\t\t\t\t\t<IconSend />\n\t\t\t\t</button>\n\t\t\t\t{suggestionState && anchorRef.current && (\n\t\t\t\t\t<MentionSuggestionList\n\t\t\t\t\t\tanchor={anchorRef.current}\n\t\t\t\t\t\tusers={suggestedUsers}\n\t\t\t\t\t\tonSelect={handleInsertMention}\n\t\t\t\t\t\tonDismiss={onDismissMentionSuggestions}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</>\n\t)\n}\n\nexport function EditFeedbackCommentForm(props: Props) {\n\treturn (\n\t\t<div className={styles.editing}>\n\t\t\t<FeedbackCommentForm {...props} />\n\t\t</div>\n\t)\n}\n\ninterface FloatingProps extends Props {\n\tanchor: HTMLElement | null\n\twithin: { top: number; right: number; bottom: number; left: number }\n}\n\n// TODO: Clean this up. Maybe FeedbackCommentForm could have variants. Would be cleaner.\nconst floatingFeedbackCommentFormOffset = { x: 10, y: -10 }\nconst agentFloatingFeedbackCommentFormOffset = { x: 10, y: 0 }\nconst attachTo: AttachmentEdgePreferences = [\"right\", \"left\"]\n\nexport function FloatingFeedbackCommentForm({ anchor, onCancel, within, ...props }: FloatingProps) {\n\tconst isAgentEnabled = experiments.isOn(\"agent\")\n\tconst offset = isAgentEnabled ? agentFloatingFeedbackCommentFormOffset : floatingFeedbackCommentFormOffset\n\tconst alignSelf = isAgentEnabled ? \"center\" : \"start\"\n\tconst popoverThemeBehavior = isAgentEnabled ? \"none\" : \"auto\"\n\treturn (\n\t\t<Popover\n\t\t\tanchor={anchor}\n\t\t\talignSelf={alignSelf}\n\t\t\tattachTo={attachTo}\n\t\t\tonClose={onCancel}\n\t\t\tshowArrow={false}\n\t\t\toffset={offset}\n\t\t\twithin={within}\n\t\t\tclassName={cx(styles.popoverOverride, isAgentEnabled && styles.agentPopoverOverride)}\n\t\t\tthemeBehavior={popoverThemeBehavior}\n\t\t>\n\t\t\t<div className={cx(styles.floating, isAgentEnabled && styles.agentFloating)}>\n\t\t\t\t<FeedbackCommentForm {...props} placeholderText=\"Comment\u2026\" onCancel={onCancel} />\n\t\t\t</div>\n\t\t</Popover>\n\t)\n}\n", "import { createContext, useContext, useMemo } from \"react\"\nimport { AccessRequestResponseStatus } from \"web/lib/grantAccessRequest.ts\"\nimport { InviteStatus } from \"./api/invite.ts\"\nimport { UpdateUserPermissionsStatus } from \"./api/updateUserPermissions.ts\"\nimport type { API } from \"./useAPI.ts\"\n\nexport interface RemoteDispatch {\n\tpollProject: API[\"pollProject\"]\n\tinvite: API[\"invite\"]\n\tremoveInvite: API[\"removeInvite\"]\n\tremoveUserPermissions: API[\"removeUserPermissions\"]\n\tupdateUserPermissions: API[\"updateUserPermissions\"]\n\tgrantProjectAccessRequest: API[\"grantProjectAccessRequest\"]\n\tdenyProjectAccessRequest: API[\"denyProjectAccessRequest\"]\n\tforceRefreshACL: API[\"forceRefreshACL\"]\n}\n\nexport const RemoteDispatchContext = createContext<RemoteDispatch | null>(null)\n\nexport function useRemoteDispatch() {\n\treturn useContext(RemoteDispatchContext)\n}\n\nexport function useCreateRemoteDispatch(api: API) {\n\treturn useMemo<RemoteDispatch>(\n\t\t() => ({\n\t\t\tpollProject: async params => {\n\t\t\t\treturn api.pollProject(params)\n\t\t\t},\n\t\t\t// These changes can affect the license restrictions (e.g. editor\n\t\t\t// limit), so we also refetch the project metadata to get up-to-date\n\t\t\t// feature flags.\n\t\t\tinvite: async params => {\n\t\t\t\tconst result = await api.invite(params)\n\t\t\t\tif (result.status === InviteStatus.Success) {\n\t\t\t\t\tapi.getProject()\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t},\n\t\t\tremoveInvite: async params => {\n\t\t\t\tawait api.removeInvite(params)\n\t\t\t\tapi.getProject()\n\t\t\t\treturn\n\t\t\t},\n\t\t\tremoveUserPermissions: async params => {\n\t\t\t\tawait api.removeUserPermissions(params)\n\t\t\t\tapi.getProject()\n\t\t\t\treturn\n\t\t\t},\n\t\t\tupdateUserPermissions: async params => {\n\t\t\t\tconst result = await api.updateUserPermissions(params)\n\t\t\t\tif (result.status === UpdateUserPermissionsStatus.Success) {\n\t\t\t\t\tapi.getProject()\n\t\t\t\t}\n\t\t\t\treturn result\n\t\t\t},\n\t\t\tgrantProjectAccessRequest: async params => {\n\t\t\t\tconst response = await api.grantProjectAccessRequest(params)\n\t\t\t\tif (response.status === AccessRequestResponseStatus.Success) {\n\t\t\t\t\tapi.getProject()\n\t\t\t\t}\n\t\t\t\treturn response\n\t\t\t},\n\t\t\tdenyProjectAccessRequest: async params => {\n\t\t\t\tconst response = await api.denyProjectAccessRequest(params)\n\t\t\t\tif (response.status === AccessRequestResponseStatus.Success) {\n\t\t\t\t\tapi.getProject()\n\t\t\t\t}\n\t\t\t\treturn response\n\t\t\t},\n\t\t\tforceRefreshACL: async () => {\n\t\t\t\tawait api.forceRefreshACL()\n\t\t\t\treturn\n\t\t\t},\n\t\t}),\n\t\t[api],\n\t)\n}\n", "import \"FeedbackCommentForm.styles_6qxtgb.wyw.css\"; export const container = \"container_cq6gcc8\";\nexport const anchor = \"anchor_a2ihc83\";\nexport const active = \"active_a1hq99n8\";\nexport const button = \"button_b1qh101v\";\nexport const textEditor = \"textEditor_tsgq3xe\";\nexport const editing = \"editing_eek58r\";\nexport const popoverOverride = \"popoverOverride_p1jzdgcz\";\nexport const agentPopoverOverride = \"agentPopoverOverride_a19c58nd\";\nexport const floating = \"floating_f1nkufnp\";\nexport const agentFloating = \"agentFloating_au5rqxc\";", "import { Popover, Stack, truncateWithEllipsis, useViewportResize } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type { MentionableUser } from \"feedback/types.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { CommentAvatar } from \"./CommentAvatar.tsx\"\nimport * as styles from \"./MentionSuggestionList.styles.ts\"\n\ninterface MentionSuggestionListProps {\n\tusers: MentionableUser[]\n\tonDismiss: () => void\n\tonSelect: (userId: string, name: string) => void\n\tanchor: HTMLDivElement\n}\n\nexport function MentionSuggestionList({ users, onSelect, onDismiss, anchor }: MentionSuggestionListProps) {\n\tconst [highlightedIndex, setHighlightedIndex] = useState<number>(0)\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent) => {\n\t\t\tswitch (event.key) {\n\t\t\t\tcase \"ArrowDown\": {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tconst newIndex = (highlightedIndex + 1) % users.length\n\t\t\t\t\tsetHighlightedIndex(newIndex)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"ArrowUp\": {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tconst newIndex = highlightedIndex === 0 ? users.length - 1 : highlightedIndex - 1\n\t\t\t\t\tsetHighlightedIndex(newIndex)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"Tab\":\n\t\t\t\tcase \"Enter\": {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tconst selectedUser = users[highlightedIndex]\n\t\t\t\t\tif (selectedUser) {\n\t\t\t\t\t\tonSelect(selectedUser.id, selectedUser.name)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"Escape\": {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tevent.stopPropagation()\n\n\t\t\t\t\tonDismiss()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[users, highlightedIndex, onSelect, onDismiss],\n\t)\n\n\tuseEffect(() => {\n\t\tconst abortController = new AbortController()\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown, { capture: true, signal: abortController.signal })\n\t\treturn () => abortController.abort()\n\t}, [handleKeyDown])\n\n\tuseViewportResize(onDismiss)\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={anchor}\n\t\t\talignSelf=\"start\"\n\t\t\tshowArrow={false}\n\t\t\tonClose={onDismiss}\n\t\t\tanimateAppear={false}\n\t\t\tfocusTrapEnabled={false}\n\t\t\tattachTo=\"auto-vertical\"\n\t\t\tclassName={styles.popover}\n\t\t>\n\t\t\t<Stack className={styles.suggestionList} gap={0}>\n\t\t\t\t{users.length === 0 ? (\n\t\t\t\t\t<div className={cx(styles.suggestionItem, styles.noUsersFound)}>No users found.</div>\n\t\t\t\t) : (\n\t\t\t\t\tusers.map((user, index) => (\n\t\t\t\t\t\t<MentionSuggestionListItem\n\t\t\t\t\t\t\tkey={user.id}\n\t\t\t\t\t\t\tuser={user}\n\t\t\t\t\t\t\tisHighlighted={index === highlightedIndex}\n\t\t\t\t\t\t\tonMouseMove={() => {\n\t\t\t\t\t\t\t\tif (index !== highlightedIndex) {\n\t\t\t\t\t\t\t\t\tsetHighlightedIndex(index)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonMouseDown={() => onSelect(user.id, user.name)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Popover>\n\t)\n}\n\ninterface MentionSuggestionListItemProps {\n\tisHighlighted: boolean\n\tuser: MentionableUser\n\tonMouseDown: () => void\n\tonMouseMove: () => void\n}\n\nfunction MentionSuggestionListItem({ user, isHighlighted, onMouseDown, onMouseMove }: MentionSuggestionListItemProps) {\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\tuseEffect(() => {\n\t\tif (isHighlighted) containerRef.current?.scrollIntoView({ block: \"nearest\", behavior: \"instant\" })\n\t}, [isHighlighted])\n\n\tconst shouldShowOverlay = isHighlighted && !user.avatar\n\n\treturn (\n\t\t<Stack\n\t\t\tjustifyContent=\"flex-start\"\n\t\t\talignItems=\"center\"\n\t\t\tref={containerRef}\n\t\t\tclassName={cx(styles.suggestionItem, isHighlighted && styles.highlightedSuggestion)}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonMouseMove={onMouseMove}\n\t\t>\n\t\t\t<CommentAvatar\n\t\t\t\tauthor={user}\n\t\t\t\tradiusCustomStyles={styles.avatarRadius}\n\t\t\t\tsize={22}\n\t\t\t\ttextCustomStyles={styles.avatarText}\n\t\t\t\tshowOverlay={shouldShowOverlay}\n\t\t\t/>\n\t\t\t<span className={truncateWithEllipsis}>{user.name}</span>\n\t\t\t{!user.isProjectMember && (\n\t\t\t\t<span className={cx(styles.badge, isHighlighted && styles.highlightedBadge)}>Invite</span>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "export function initials(displayName: string): string {\n\treturn displayName\n\t\t.split(\" \")\n\t\t.map(part => part[0])\n\t\t.join(\"\")\n}\n", "import \"CommentAvatar.styles_15520oh.wyw.css\"; export const overlayStyles = \"overlayStyles_o1o5trv8\";\nexport const avatarContainer = \"avatarContainer_a1xwkzvs\";", "import { getMultiplayerColor } from \"@framerjs/app-shared/src/lib/getMultiplayerColor.ts\"\nimport type { RemoteCursor } from \"document/RemoteUsers.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { stringToCharCodeSum } from \"web/lib/stringToCharCodeSum.ts\"\n\ninterface MagicColorContextProps {\n\tisDarkMode: boolean\n\tcursors: RemoteCursor[]\n}\n\n// Temp fix to make user colors available to the Feedback UI. We need to\n// consolidate this with whatever we end-up using once we've merged all the\n// multiplayer code between FramerWeb & FramerStudio.\nexport const MagicColorContext = React.createContext<MagicColorContextProps>({ isDarkMode: false, cursors: [] })\n\nexport function useUserColor(id: string): string {\n\tconst props = React.useContext(MagicColorContext)\n\n\tconst remoteUserColor = engine.stores.remoteUsers.getCursor(id)?.getHexColor(props.isDarkMode)\n\tif (remoteUserColor) return remoteUserColor\n\n\treturn getMultiplayerColor(stringToCharCodeSum(id), props.isDarkMode)\n}\n", "import { Avatar } from \"@framerjs/fresco\"\nimport type React from \"react\"\nimport { initials as initialsFromName } from \"../users/initials.ts\"\nimport * as styles from \"./CommentAvatar.styles.ts\"\nimport { useUserColor } from \"./MagicColorContext.tsx\"\nimport type { User } from \"./types.ts\"\n\ninterface CommentAvatarProps extends React.ComponentProps<typeof Avatar> {\n\tauthor: User\n\tshowOverlay?: boolean\n}\n\nexport const CommentAvatar = ({ author, showOverlay = false, ...avatarProps }: CommentAvatarProps) => {\n\tconst color = useUserColor(author.id)\n\n\treturn (\n\t\t<div className={styles.avatarContainer}>\n\t\t\t<Avatar\n\t\t\t\ttext={author.initials || initialsFromName(author.name)}\n\t\t\t\tsrc={author.avatar || \"\"}\n\t\t\t\tcolor={color}\n\t\t\t\t{...avatarProps}\n\t\t\t/>\n\t\t\t{showOverlay && <div className={styles.overlayStyles} />}\n\t\t</div>\n\t)\n}\n", "import \"MentionSuggestionList.styles_4bmwq8.wyw.css\"; export const popover = \"popover_p1bbz3po\";\nexport const suggestionList = \"suggestionList_s1wce3gd\";\nexport const suggestionItem = \"suggestionItem_s9rqd1m\";\nexport const noUsersFound = \"noUsersFound_n5wgill\";\nexport const highlightedSuggestion = \"highlightedSuggestion_h8yt9eb\";\nexport const avatarText = \"avatarText_aar31xz\";\nexport const avatarRadius = \"avatarRadius_a1q91901\";\nexport const badge = \"badge_b1l4u4wy\";\nexport const highlightedBadge = \"highlightedBadge_hmpyi98\";", "import \"InlineFeedbackComposer.styles_15m8x5a.wyw.css\"; export const composer = \"composer_cio4vee\";\nexport const composerTextEditor = \"composerTextEditor_cc0d7lm\";\nexport const composerButton = \"composerButton_csozr19\";", "import { cx } from \"@linaria/core\"\nimport { FeedbackCommentForm } from \"feedback/FeedbackCommentForm.tsx\"\nimport type { Mention, MentionableUser } from \"feedback/types.ts\"\nimport * as styles from \"./InlineFeedbackComposer.styles.ts\"\n\ninterface Props {\n\tclassName?: string\n\tplaceholder: string\n\tdefaultValue: string\n\tmentionableUsers: readonly MentionableUser[]\n\tautoFocus?: boolean\n\tclearOnSubmit?: boolean\n\tonSubmit: (text: string, mentions: Mention[]) => Promise<void>\n\tonCancel: () => void\n}\n\nexport function InlineFeedbackComposer({\n\tclassName,\n\tplaceholder,\n\tdefaultValue,\n\tmentionableUsers,\n\tautoFocus = false,\n\tclearOnSubmit,\n\tonSubmit,\n\tonCancel,\n}: Props) {\n\treturn (\n\t\t<FeedbackCommentForm\n\t\t\tclassName={cx(styles.composer, className)}\n\t\t\tbuttonClassName={styles.composerButton}\n\t\t\ttextEditorClassName={styles.composerTextEditor}\n\t\t\tmentionableUsers={mentionableUsers}\n\t\t\tdefaultValue={defaultValue}\n\t\t\tplaceholderText={placeholder}\n\t\t\tautoFocus={autoFocus}\n\t\t\tclearOnSubmit={clearOnSubmit}\n\t\t\tonSubmit={onSubmit}\n\t\t\tonCancel={onCancel}\n\t\t/>\n\t)\n}\n", "import \"InlineFeedbackThread.styles_19za76k.wyw.css\"; import { cx } from \"@linaria/core\";\nexport const commentsScroll = \"commentsScroll_c1amtwqz\";\nexport const comments = \"comments_cgwpfag\";\nexport const reply = \"reply_r5h1aqh\";\nexport const replyComposer = \"replyComposer_rzmsov2\";\nconst iconBase = \"iconBase_i1h7xo6y\";\nexport const replyIcon = cx(iconBase, \"replyIcon_rzr099u\");\nexport const divider = \"divider_dn4mixg\";", "import { triggerCommentCreateEvent } from \"@framerjs/framer-events\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, getLogger } from \"@framerjs/shared\"\nimport { FeedbackThreadPopover } from \"app/agent/components/Feedback/FeedbackThreadPopover.tsx\"\nimport { agentDimensionTokenOverrides } from \"app/agent/utils/dimensions.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { MetricsViewContext } from \"app/metrics.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { RemoteCursor } from \"document/RemoteUsers.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { MagicColorContext } from \"feedback/MagicColorContext.tsx\"\nimport { motion } from \"framer-motion\"\nimport React, { Suspense } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { FloatingFeedbackCommentForm } from \"../../../feedback/FeedbackCommentForm.tsx\"\nimport { FeedbackPin } from \"../../../feedback/FeedbackPin.tsx\"\nimport { anchorToPoint, anchorToScope } from \"../../../feedback/anchorUtils.ts\"\nimport { isDraftThread, isLocalId } from \"../../../feedback/model.ts\"\nimport type { Anchor, CommentMetadataMap, Mention, MentionableUser, Point, Thread } from \"../../../feedback/types.ts\"\nimport { Tab } from \"../../../feedback/types.ts\"\nimport type { CanvasTree, LoadedScopeNode } from \"../../models/CanvasTree/index.ts\"\nimport * as styles from \"./FeedbackSurface.styles.ts\"\n\nconst log = getLogger(\"FeedbackSurface\")\n\ndeclare module \"react\" {\n\tinterface CSSProperties {\n\t\t// Add a CSS Custom Property\n\t\t\"--framerInternalCanvas-zoom\"?: string\n\t}\n}\n\ninterface State {\n\tcurrentUserId: string | null\n\tthreads: readonly Thread[]\n\tdraftThread: Thread | undefined\n\tisActive: boolean\n\tselectedThreadId: string | undefined\n\tselectedThreadPosition: Point | undefined\n\tthreadIdUnderMouse: string | undefined\n\tcommentMetadata: CommentMetadataMap\n\ttree: CanvasTree\n\tactiveScope: LoadedScopeNode\n\tisDarkMode: boolean\n\tcursors: RemoteCursor[]\n\tmentionableUsers: readonly MentionableUser[]\n\tfeedbackPopoverWithin: { top: number; right: number; bottom: number; left: number }\n}\n\ninterface Props {\n\tzoom: number\n}\n\nclass FeedbackSurfaceInternal extends React.PureComponent<Props, State> {\n\tstatic engineChangeKeys = [\n\t\tengine.stores.feedbackStore,\n\t\tEngineChange.Tool,\n\t\tEngineChange.TreeStore,\n\t\tEngineChange.RemoteUsersStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.toolStore,\n\t]\n\n\tstatic override contextType = MetricsViewContext\n\tdeclare context: React.ContextType<typeof MetricsViewContext>\n\n\t// Instance field for the form anchor element\n\tprivate commentFormAnchor: HTMLElement | null = null\n\n\t// Callback ref to capture the anchor element and trigger a render when available\n\tprivate setCommentFormAnchor = (element: HTMLDivElement | null) => {\n\t\tif (this.commentFormAnchor !== element) {\n\t\t\tthis.commentFormAnchor = element\n\t\t\t// Force a re-render so the FloatingFeedbackCommentForm receives a non-null anchor immediately\n\t\t\tthis.forceUpdate()\n\t\t}\n\t}\n\n\t// Instance field for the selected pin anchor element\n\tprivate selectedThreadAnchor: HTMLElement | null = null\n\tprivate shouldIgnoreNextCanvasClick = false\n\n\toverride componentDidMount(): void {\n\t\tdocument.addEventListener(\"pointerdown\", this.handleGlobalPointerDown, true)\n\t}\n\n\toverride componentWillUnmount(): void {\n\t\tdocument.removeEventListener(\"pointerdown\", this.handleGlobalPointerDown, true)\n\t}\n\n\t/**\n\t * Handles global pointer down events to mark the canvas click as ignored\n\t * if it occurs within a feedback thread popover.\n\t * This is used to prevent the canvas from detecting a click when the user is\n\t * just dismissing the feedback thread popover.\n\t */\n\tprivate handleGlobalPointerDown = (event: PointerEvent) => {\n\t\tconst { feedbackStore, toolStore } = engine.stores\n\n\t\tif (toolStore.tool !== Tools.Comment || !feedbackStore.selectedThreadId) return\n\n\t\tconst target = event.target as HTMLElement | null\n\t\tif (!target) return\n\n\t\tconst backdrop = target.closest(\"[data-is-popover-backdrop='true']\")\n\t\tif (!backdrop) return\n\n\t\tthis.shouldIgnoreNextCanvasClick = true\n\t}\n\n\t// Callback ref to capture the anchor element and trigger a render when available\n\tprivate setSelectedThreadAnchor = (element: HTMLDivElement | null) => {\n\t\tif (this.selectedThreadAnchor !== element) {\n\t\t\tthis.selectedThreadAnchor = element\n\t\t\tthis.forceUpdate()\n\t\t}\n\t}\n\n\tstatic calculateState(): State {\n\t\tconst { canvasStore, feedbackStore, layoutState, toolStore, remoteUsers, scopeStore } = engine.stores\n\t\tcanvasStore.assertInteractive()\n\n\t\tconst {\n\t\t\tthreads,\n\t\t\tarchivedThreads,\n\t\t\tdraftThread,\n\t\t\tselectedThread,\n\t\t\tselectionState,\n\t\t\tthreadIdUnderMouse,\n\t\t\tcurrentUser,\n\t\t\tcommentMetadata,\n\t\t\tmentionableUsers,\n\t\t} = feedbackStore\n\n\t\tconst padding = experiments.isOn(\"agent\")\n\t\t\t? agentDimensionTokenOverrides.panelPadding\n\t\t\t: dimensions.values.panelPadding\n\n\t\tconst feedbackPopoverWithin = {\n\t\t\tleft: layoutState.currentChromeMarginLeft + padding,\n\t\t\tright: -layoutState.currentChromeMarginRight - padding,\n\t\t\ttop: layoutState.currentChromeMarginTop + padding,\n\t\t\tbottom: -layoutState.currentChromeMarginBottom - padding,\n\t\t}\n\n\t\treturn {\n\t\t\tisActive: toolStore.feedbackModeActive,\n\t\t\tthreads: selectionState.tab === Tab.Archived ? archivedThreads : threads,\n\t\t\tdraftThread,\n\t\t\tcurrentUserId: currentUser ? currentUser.id : null,\n\t\t\tselectedThreadId: selectionState.threadId,\n\t\t\tthreadIdUnderMouse: threadIdUnderMouse || undefined,\n\t\t\tselectedThreadPosition: selectedThread ? anchorToPoint(engine.tree, selectedThread.anchor) : undefined,\n\t\t\tcommentMetadata,\n\t\t\tisDarkMode: remoteUsers.isDarkMode,\n\t\t\tcursors: remoteUsers.cursors,\n\t\t\ttree: engine.tree,\n\t\t\tactiveScope: scopeStore.active,\n\t\t\tmentionableUsers,\n\t\t\tfeedbackPopoverWithin,\n\t\t}\n\t}\n\n\tprivate lastPinPosition: { x: number; y: number } | undefined = undefined\n\n\tprivate handlePinMouseEnter = engine.scheduler.wrapHandler((evt: React.MouseEvent<HTMLElement>) => {\n\t\tconst { threadId } = evt.currentTarget.dataset\n\t\tengine.stores.feedbackStore.threadIdUnderMouse = threadId\n\t})\n\n\tprivate handlePinMouseLeave = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.feedbackStore.threadIdUnderMouse = undefined\n\t})\n\n\tprivate handlePinMouseDown = engine.scheduler.wrapHandler((evt: React.MouseEvent<HTMLElement>) => {\n\t\tconst { threadId } = evt.currentTarget.dataset\n\t\tconst thread = threadId && engine.stores.feedbackStore.getThread(threadId)\n\t\tif (thread) {\n\t\t\tthis.lastPinPosition = anchorToPoint(engine.tree, thread.anchor)\n\t\t}\n\t})\n\n\tprivate handlePinClick = engine.scheduler.wrapHandler((evt: React.MouseEvent<HTMLElement>) => {\n\t\ttry {\n\t\t\tconst { feedbackStore } = engine.stores\n\t\t\tconst { threadId } = evt.currentTarget.dataset\n\t\t\tconst thread = threadId && feedbackStore.getThread(threadId)\n\n\t\t\tif (!thread) return\n\n\t\t\t// Skip click if we we moved the pin.\n\t\t\tif (thread && this.lastPinPosition) {\n\t\t\t\tconst point = anchorToPoint(this.state.tree, thread.anchor)\n\t\t\t\tconst deltaX = Math.abs(point.x - this.lastPinPosition.x)\n\t\t\t\tconst deltaY = Math.abs(point.y - this.lastPinPosition.y)\n\t\t\t\tif (deltaX || deltaY) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// FeedbackSurface is not a child of Chrome,\n\t\t\t// so events intraction events triggered by `data-metric-id={*}` are not tracked\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: this.context,\n\t\t\t\tid: \"feedback-pin\",\n\t\t\t})\n\n\t\t\tfeedbackStore.setSelectedThread(thread.id).catch(log.reportError)\n\t\t} finally {\n\t\t\tthis.lastPinPosition = undefined\n\t\t}\n\t})\n\n\tprivate handleSubmitComment = engine.scheduler.wrapHandler((text: string, mentions: Mention[]) => {\n\t\tconst { selectedThreadId, selectedThreadPosition } = this.state\n\t\tif (selectedThreadId && selectedThreadPosition) {\n\t\t\tengine.stores.feedbackStore\n\t\t\t\t.createComment({ threadId: selectedThreadId, text, mentions })\n\t\t\t\t.then(({ thread, comment }) => {\n\t\t\t\t\ttriggerCommentCreateEvent({\n\t\t\t\t\t\tcommentId: comment.id,\n\t\t\t\t\t\tthreadId: thread.id,\n\t\t\t\t\t\ttype: \"canvas\",\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\t})\n\n\tprivate markCanvasDismissalClick() {\n\t\tif (!this.shouldIgnoreNextCanvasClick) return\n\t\tengine.stores.feedbackStore.ignoreNextClick = true\n\t\tthis.shouldIgnoreNextCanvasClick = false\n\t}\n\n\tprivate handleCancelComment = async () => {\n\t\tconst { selectedThreadId } = this.state\n\t\tif (selectedThreadId) {\n\t\t\t// Remove the draft thread.\n\t\t\tthis.markCanvasDismissalClick()\n\t\t\tawait engine.stores.feedbackStore.clearSelectedThread()\n\t\t}\n\t}\n\n\tprivate renderFeedbackThreadPopover() {\n\t\tconst { selectedThreadId, currentUserId } = this.state\n\t\tif (!selectedThreadId || !currentUserId) return null\n\n\t\tconst isAgentEnabled = experiments.isOn(\"agent\")\n\t\tif (!isAgentEnabled) return null\n\n\t\tconst isTransient = isDraftThread(selectedThreadId)\n\t\tif (isTransient) return null\n\n\t\tconst thread = engine.stores.feedbackStore.getThread(selectedThreadId)\n\t\tif (!thread) return null\n\n\t\treturn (\n\t\t\t<MagicColorContext.Provider value={{ isDarkMode: this.state.isDarkMode, cursors: this.state.cursors }}>\n\t\t\t\t<FeedbackThreadPopover\n\t\t\t\t\tcurrentUserId={currentUserId}\n\t\t\t\t\tthreadId={thread.id}\n\t\t\t\t\tanchor={this.selectedThreadAnchor}\n\t\t\t\t\twithin={this.state.feedbackPopoverWithin}\n\t\t\t\t/>\n\t\t\t</MagicColorContext.Provider>\n\t\t)\n\t}\n\n\tprivate renderCommentForm() {\n\t\tconst { currentUserId, draftThread, tree, mentionableUsers } = this.state\n\t\tif (!draftThread || !currentUserId) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst isAgentEnabled = experiments.isOn(\"agent\")\n\n\t\tconst currentUser = engine.stores.feedbackStore.currentUser\n\t\tconst avatar = currentUser ? { src: currentUser.avatar, initials: currentUser.initials } : undefined\n\n\t\tconst zoomPoint = getZoomPoint(tree, draftThread.anchor)\n\t\treturn (\n\t\t\t<motion.div\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t...zoomPoint,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tkey={draftThread.id}\n\t\t\t\t\tdata-thread-id={draftThread.id}\n\t\t\t\t\tonClick={this.handlePinClick}\n\t\t\t\t\tonMouseDown={this.handlePinMouseDown}\n\t\t\t\t\tonMouseEnter={this.handlePinMouseEnter}\n\t\t\t\t\tonMouseLeave={this.handlePinMouseLeave}\n\t\t\t\t>\n\t\t\t\t\t<div ref={this.setCommentFormAnchor} className={isAgentEnabled ? styles.pinAnchor : styles.createPin} />\n\n\t\t\t\t\t{isAgentEnabled && (\n\t\t\t\t\t\t<FeedbackPin\n\t\t\t\t\t\t\tid={draftThread.id}\n\t\t\t\t\t\t\tpoint={{ x: 0, y: 0 }}\n\t\t\t\t\t\t\tthreadIndex={0}\n\t\t\t\t\t\t\tavatar={avatar}\n\t\t\t\t\t\t\tdisableIntroAnimation\n\t\t\t\t\t\t\tuseSmoothAnimations\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<MagicColorContext.Provider value={{ isDarkMode: this.state.isDarkMode, cursors: this.state.cursors }}>\n\t\t\t\t\t<FloatingFeedbackCommentForm\n\t\t\t\t\t\twithin={this.state.feedbackPopoverWithin}\n\t\t\t\t\t\tanchor={this.commentFormAnchor}\n\t\t\t\t\t\tonSubmit={this.handleSubmitComment}\n\t\t\t\t\t\tonCancel={this.handleCancelComment}\n\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t/>\n\t\t\t\t</MagicColorContext.Provider>\n\t\t\t</motion.div>\n\t\t)\n\t}\n\n\tprivate renderPin(thread: Thread, index: number) {\n\t\tconst { commentMetadata, tree, activeScope } = this.state\n\t\tconst point = getZoomPoint(tree, thread.anchor)\n\t\tconst isTransient = isDraftThread(thread.id)\n\t\tconst pageId = anchorToScope(tree, thread.anchor)\n\n\t\tif (pageId !== activeScope.id) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst useSmoothAnimations = experiments.isOn(\"agent\")\n\t\tconst disableIntroAnimation = useSmoothAnimations && isLocalId(thread.id)\n\t\tconst isSelected = this.state.selectedThreadId === thread.id\n\n\t\tconst comment = thread.comments[0]\n\t\tconst author = comment?.author\n\t\tconst avatar = author\n\t\t\t? {\n\t\t\t\t\tsrc: author.avatar,\n\t\t\t\t\tinitials: author.initials,\n\t\t\t\t}\n\t\t\t: undefined\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{ position: \"absolute\" }}\n\t\t\t\tkey={getKeyForThread(thread, commentMetadata)}\n\t\t\t\tdata-thread-id={thread.id}\n\t\t\t\tonClick={this.handlePinClick}\n\t\t\t\tonMouseDown={this.handlePinMouseDown}\n\t\t\t\tonMouseEnter={this.handlePinMouseEnter}\n\t\t\t\tonMouseLeave={this.handlePinMouseLeave}\n\t\t\t>\n\t\t\t\t<FeedbackPin\n\t\t\t\t\tid={thread.id}\n\t\t\t\t\tpoint={point}\n\t\t\t\t\tisFlipped={isTransient}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\tisAnySelected={this.state.selectedThreadId !== undefined}\n\t\t\t\t\tthreadIndex={index}\n\t\t\t\t\tavatar={avatar}\n\t\t\t\t\tuseSmoothAnimations={useSmoothAnimations}\n\t\t\t\t\tdisableIntroAnimation={disableIntroAnimation}\n\t\t\t\t/>\n\n\t\t\t\t{/* This is the anchor for the feedback thread popover. Using it to avoid anchoring to the\n                feedback pin which contains animations. This is only rendered when the thread is selected. */}\n\t\t\t\t{isSelected && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={this.setSelectedThreadAnchor}\n\t\t\t\t\t\tclassName={styles.pinAnchor}\n\t\t\t\t\t\tstyle={{ \"--pin-x\": point.x, \"--pin-y\": point.y }}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n\n\toverride render() {\n\t\tengine.stores.canvasStore.assertInteractive()\n\n\t\tconst { threads, isActive } = this.state\n\t\tif (!isActive) return null\n\n\t\treturn (\n\t\t\t<Suspense fallback={null}>\n\t\t\t\t<div style={{ cursor: \"initial\", \"--framerInternalCanvas-zoom\": `${this.props.zoom}` }}>\n\t\t\t\t\t{threads.map(this.renderPin, this)}\n\t\t\t\t\t{this.renderCommentForm()}\n\t\t\t\t\t{this.renderFeedbackThreadPopover()}\n\t\t\t\t</div>\n\t\t\t</Suspense>\n\t\t)\n\t}\n}\n\nexport type FeedbackSurface = FeedbackSurfaceInternal\nexport const FeedbackSurface = createContainer(FeedbackSurfaceInternal)\n\nfunction getZoomPoint(tree: CanvasTree, anchor: Anchor): { x: string; y: string } {\n\tconst point = anchorToPoint(tree, anchor)\n\treturn {\n\t\tx: `calc(${point.x}px * var(--framerInternalCanvas-zoom, 1))`,\n\t\ty: `calc(${point.y}px * var(--framerInternalCanvas-zoom, 1))`,\n\t}\n}\n\nfunction getKeyForThread(thread: Thread, metadata: CommentMetadataMap) {\n\t// Always use the optimistic comment id (when available) as the thread key\n\t// to avoid remounting when the server responds with the new comment.\n\tconst comment = thread.comments[0]\n\tassert(comment, \"Thread must have a comment\")\n\tconst data = metadata.get(comment.id)\n\treturn data?.localId || comment.id\n}\n", "import { Avatar } from \"@framerjs/fresco\"\nimport { palette, shadows } from \"@framerjs/fresco/src/tokens\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { motion } from \"framer-motion\"\nimport React, { useCallback, useMemo } from \"react\"\nimport * as styles from \"./FeedbackPin.styles.ts\"\n\ninterface Props<T> {\n\tid: T\n\tpoint: {\n\t\treadonly x: string | number\n\t\treadonly y: string | number\n\t}\n\tisFlipped?: boolean\n\tonClick?: (id: T) => void\n\tisSelected?: boolean\n\tisAnySelected?: boolean\n\tthreadIndex: number\n\tavatar?: { src?: string; initials?: string }\n\tdisableIntroAnimation?: boolean\n\tuseSmoothAnimations?: boolean\n}\n\nexport function FeedbackPin<T>({\n\tid,\n\tpoint,\n\tisFlipped = false,\n\tonClick = noop,\n\tisSelected,\n\tisAnySelected,\n\tthreadIndex,\n\tavatar,\n\tdisableIntroAnimation = false,\n\tuseSmoothAnimations = false,\n}: Props<T>) {\n\t// Internal boolean if a thread has been opened after it's been mounted\n\tconst [threadHasBeenOpened, setThreadHasBeenOpened] = React.useState(false)\n\n\t// \"Intro\" animation should only once\n\tconst [animate, setAnimate] = React.useState(isFlipped || disableIntroAnimation ? \"introWithoutDelay\" : \"intro\")\n\n\t// This holds the original coordinates for the pin when it loads.\n\t// When the user moves the pin around, it will check if it's initial state\n\t// needs to be hover or outro.\n\tconst [originalPoint] = React.useState(point)\n\n\tconst handleClick = useCallback(() => onClick(id), [id, onClick])\n\n\tconst pinAnimations = useMemo(\n\t\t() => (useSmoothAnimations ? createSmoothPinAnimations(threadIndex) : createPinAnimations(threadIndex)),\n\t\t[useSmoothAnimations, threadIndex],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (isAnySelected && !isFlipped) {\n\t\t\tif (isSelected) {\n\t\t\t\tsetAnimate(\"active\")\n\t\t\t} else {\n\t\t\t\tsetAnimate(\"inactive\")\n\t\t\t}\n\t\t}\n\n\t\tif (isAnySelected) setThreadHasBeenOpened(true)\n\n\t\t// After a thread has been opened, the default animate is now \"introWithoutDelay\"\n\t\tif (!isAnySelected && threadHasBeenOpened) {\n\t\t\tsetAnimate(\"introWithoutDelay\")\n\t\t}\n\t}, [isAnySelected, isSelected, isFlipped, threadHasBeenOpened])\n\n\tfunction handleHoverStart() {\n\t\tif (!isFlipped && !isSelected) setAnimate(\"hoverStart\")\n\t}\n\tfunction handleHoverEnd() {\n\t\tif (!isFlipped) {\n\t\t\tif (isAnySelected && !isSelected) {\n\t\t\t\tsetAnimate(\"inactive\")\n\t\t\t} else {\n\t\t\t\tsetAnimate(\"hoverEnd\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handleInitial() {\n\t\tif (disableIntroAnimation) {\n\t\t\treturn \"introWithoutDelay\"\n\t\t}\n\t\t// feedbackpin gets new point values on drag,\n\t\t// initial gets called over and over, this handles that.\n\t\tif (originalPoint === point) {\n\t\t\t// inital values before dragging\n\t\t\treturn \"outro\"\n\t\t} else {\n\t\t\tif (isSelected && !isFlipped) {\n\t\t\t\t// dragging while selected\n\t\t\t\treturn \"active\"\n\t\t\t} else {\n\t\t\t\t// dragging while not selected\n\t\t\t\treturn \"introWithoutDelay\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tvariants={pinAnimations}\n\t\t\tinitial={handleInitial()}\n\t\t\tanimate={animate}\n\t\t\tclassName={styles.container}\n\t\t\tstyle={{\n\t\t\t\ty: point.y,\n\t\t\t\tx: point.x,\n\t\t\t}}\n\t\t\tonHoverStart={handleHoverStart}\n\t\t\tonHoverEnd={handleHoverEnd}\n\t\t>\n\t\t\t<button type=\"button\" className={cx(styles.pin, isFlipped && styles.isFlipped)} onClick={handleClick}>\n\t\t\t\t{avatar && (\n\t\t\t\t\t<Avatar\n\t\t\t\t\t\tsize={28}\n\t\t\t\t\t\tsrc={avatar.src}\n\t\t\t\t\t\ttext={avatar.initials}\n\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\tradiusCustomStyles={styles.customRadiusAvatar}\n\t\t\t\t\t\tshadow={shadows.avatar}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</button>\n\t\t</motion.div>\n\t)\n}\n\nfunction createPinAnimations(threadIndex: number) {\n\treturn {\n\t\tactive: { scale: 1, rotate: 0, opacity: 1 },\n\t\tinactive: { scale: 0.8, rotate: 0, opacity: 0.5 },\n\t\thoverStart: { scale: 1.1, rotate: 0, opacity: 1 },\n\t\thoverEnd: { scale: 1, rotate: 0, opacity: 1 },\n\t\tintro: {\n\t\t\tscale: 1,\n\t\t\trotate: 0,\n\t\t\topacity: 1,\n\t\t\ttransition: { delay: threadIndex * 0.02 },\n\t\t},\n\t\tintroWithoutDelay: { scale: 1, rotate: 0, opacity: 1 },\n\t\toutro: { scale: 0, rotate: 0, opacity: 0 },\n\t}\n}\n\nfunction createSmoothPinAnimations(threadIndex: number) {\n\tconst smoothTransition = { type: \"tween\", duration: 0.18, ease: \"easeOut\" }\n\n\treturn {\n\t\tactive: { scale: 1, rotate: 0, opacity: 1, transition: smoothTransition },\n\t\tinactive: { scale: 0.9, rotate: 0, opacity: 0.65, transition: smoothTransition },\n\t\thoverStart: { scale: 1.06, rotate: 0, opacity: 1, transition: smoothTransition },\n\t\thoverEnd: { scale: 1, rotate: 0, opacity: 1, transition: smoothTransition },\n\t\tintro: { scale: 1, rotate: 0, opacity: 1, transition: { ...smoothTransition, delay: threadIndex * 0.02 } },\n\t\tintroWithoutDelay: { scale: 1, rotate: 0, opacity: 1, transition: smoothTransition },\n\t\toutro: { scale: 0, rotate: 0, opacity: 0, transition: { type: \"tween\", duration: 0.16, ease: \"easeIn\" } },\n\t}\n}\n", "import \"FeedbackPin.styles_764l1r.wyw.css\"; export const container = \"container_c1434qa7\";\nexport const pin = \"pin_pfifbr6\";\nexport const customRadiusAvatar = \"customRadiusAvatar_cu918rl\";\nexport const isFlipped = \"isFlipped_ijyamnc\";", "import \"FeedbackSurface.styles_1rs82iz.wyw.css\"; export const createPin = \"createPin_c1qv96ah\";\nexport const pinAnchor = \"pinAnchor_p1ysy9j\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { ControlsContainer } from \"../canvas-hud/ControlsContainer.tsx\"\n\ninterface State {\n\tzoom: number\n\tcolorSamplerActive: boolean\n}\n\nclass HUD extends React.PureComponent<{}, State> {\n\tstatic engineChangeKeys = [EngineChange.CanvasZoom, EngineChange.CanvasStore]\n\n\tstatic calculateState(): State {\n\t\tconst { zoom, colorSamplerActive } = engine.stores.canvasStore\n\t\treturn { zoom, colorSamplerActive }\n\t}\n\n\toverride render() {\n\t\tconst { zoom, colorSamplerActive } = this.state\n\t\treturn <ControlsContainer zoom={zoom} colorSamplerActive={colorSamplerActive} />\n\t}\n}\n\nconst container = createContainer(HUD)\nexport { container as HUD }\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CodeComponentNode, LoadedScopeNode, MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { NodeLinks } from \"./NodeLinks.tsx\"\n\ninterface Props {\n\tbackground: boolean\n}\n\ninterface State {\n\tshowArrows: boolean\n\thighlight: MaybeNodeID\n\tzoom: number\n\ttool: Tools.SlotConnect | Tools.Link | null\n\tcodeComponentArrows: ReadonlySet<CodeComponentNode>\n\tlinkedNavigationNodes: readonly { fromNode: CanvasNode; toNode: CanvasNode }[]\n\tlinkedVariantNodes: readonly { fromNode: CanvasNode; toNode: CanvasNode & IsVariant }[]\n\tlinkedGestureNodes: readonly { fromNode: CanvasNode & IsVariant; toNode: CanvasNode & IsVariant }[]\n\tsingleSelectedNode: CanvasNode | null\n\tisViewOnly: boolean\n\tactiveScope: LoadedScopeNode\n\tisPreviewingLocaleOnCanvas: boolean\n\t/** Used only to force rendering when layout measurements are updated */\n\tdomLayoutUpdate: number\n\tinOverlayEditMode: boolean\n}\n\nclass NodeLinksC extends React.PureComponent<Props, State> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.Arrows,\n\t\tEngineChange.CanvasZoom,\n\t\tEngineChange.CanvasStore,\n\t\tEngineChange.Tool,\n\t\tEngineChange.DocumentSettings,\n\t\tEngineChange.SelectionOutline,\n\t\tEngineChange.TreeStore,\n\t\tEngineChange.TreeDOMLayoutSync,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.debugStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.chromeStore,\n\t\tengine.stores.selectionStore,\n\t\tengine.stores.projectStore,\n\t\tengine.stores.sessionStore,\n\t\tengine.stores.overlayStore,\n\t\tengine.stores.loadingStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\tconst {\n\t\t\tcanvasStore,\n\t\t\ttoolStore,\n\t\t\tdebugStore,\n\t\t\tselectionOutlineTracker,\n\t\t\ttreeStore,\n\t\t\toverlayStore,\n\t\t\tchromeStore,\n\t\t\tselectionStore,\n\t\t\tscopeStore,\n\t\t} = engine.stores\n\t\tcanvasStore.assertInteractive()\n\n\t\tlet currentTool: Tools | null = toolStore.tool\n\n\t\t// Only update when the navigation or content link tools change\n\t\tswitch (currentTool) {\n\t\t\tcase Tools.Link:\n\t\t\tcase Tools.SlotConnect:\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcurrentTool = null\n\t\t}\n\n\t\tconst treeIndexes = treeStore.getPartialIndexes()\n\n\t\treturn {\n\t\t\tshowArrows:\n\t\t\t\t!debugStore.hideArrows &&\n\t\t\t\tengine.shouldShowArrows() &&\n\t\t\t\tselectionOutlineTracker.shouldShowSelectionOutlineForTool(toolStore.tool),\n\t\t\thighlight: treeStore.highlight,\n\t\t\tzoom: canvasStore.zoom,\n\t\t\ttool: currentTool,\n\t\t\tdomLayoutUpdate: treeStore.domLayoutUpdate,\n\t\t\tcodeComponentArrows: treeIndexes.activeScopeCodeComponentArrows,\n\t\t\tlinkedNavigationNodes: treeIndexes.activeScopeLinkedNavigationNodes,\n\t\t\tlinkedVariantNodes: treeIndexes.activeScopeLinkedVariantNodes,\n\t\t\tlinkedGestureNodes: treeIndexes.activeScopeLinkedGestureNodes,\n\t\t\tisViewOnly: getIsViewOnly(engine, \"canDesign\"),\n\t\t\tsingleSelectedNode: selectionStore.nodes.length === 1 ? selectionStore.nodes[0]! : null,\n\t\t\tactiveScope: scopeStore.active,\n\t\t\tisPreviewingLocaleOnCanvas: chromeStore.isPreviewingLocaleOnCanvas,\n\t\t\tinOverlayEditMode: overlayStore.editModeActive,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tengine.stores.canvasStore.assertInteractive()\n\n\t\tconst { background } = this.props\n\t\tconst {\n\t\t\tshowArrows,\n\t\t\thighlight,\n\t\t\tzoom,\n\t\t\ttool,\n\t\t\tcodeComponentArrows,\n\t\t\tlinkedNavigationNodes,\n\t\t\tlinkedVariantNodes,\n\t\t\tlinkedGestureNodes,\n\t\t\tisViewOnly,\n\t\t\tsingleSelectedNode,\n\t\t\tactiveScope,\n\t\t\tisPreviewingLocaleOnCanvas,\n\t\t\tinOverlayEditMode,\n\t\t} = this.state\n\n\t\tif (!showArrows || inOverlayEditMode) return null\n\n\t\treturn (\n\t\t\t<NodeLinks\n\t\t\t\ttree={engine.tree}\n\t\t\t\thighlight={highlight}\n\t\t\t\tsingleSelectedNode={singleSelectedNode}\n\t\t\t\tzoom={zoom}\n\t\t\t\tbackground={background}\n\t\t\t\ttool={tool}\n\t\t\t\tcodeComponentArrows={codeComponentArrows}\n\t\t\t\tlinkedNavigationNodes={linkedNavigationNodes}\n\t\t\t\tlinkedVariantNodes={linkedVariantNodes}\n\t\t\t\tlinkedGestureNodes={linkedGestureNodes}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tactiveScope={activeScope}\n\t\t\t\tisPreviewingLocaleOnCanvas={isPreviewingLocaleOnCanvas}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nexport const NodeLinksContainer = createContainer(NodeLinksC)\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { convertCornerPointsToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Matrix } from \"document/models/Matrix.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { toSVGPath } from \"library/render/traits/Path.ts\"\nimport { Line } from \"library/render/types/Line.ts\"\nimport { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { memoize } from \"library/utils/memoize.ts\"\nimport React from \"react\"\nimport type { CanvasNode, CanvasTree } from \"../../models/CanvasTree/index.ts\"\n\nexport enum ArrowDirection {\n\tUp,\n\tRight,\n\tDown,\n\tLeft,\n}\n\nconst arrowPointOffset = 4\nconst arrowPointOffsetLarge = arrowPointOffset * 3\nconst oppositeDirectionMap = {\n\t[ArrowDirection.Left]: ArrowDirection.Right,\n\t[ArrowDirection.Right]: ArrowDirection.Left,\n\t[ArrowDirection.Down]: ArrowDirection.Up,\n\t[ArrowDirection.Up]: ArrowDirection.Down,\n}\n\ninterface Props {\n\ttintColor: string\n\tactive: boolean\n\tstartX: number\n\tstartY: number\n\tendX: number\n\tendY: number\n\tendDirection: ArrowDirection\n\tstartOffsetX: number\n\tstartOffsetY: number\n\tstartDirection: ArrowDirection\n\tbackground: boolean\n\tshowArrowHead: boolean\n\tisSelfLink?: boolean\n\tzoom: number\n\t/* whether to render the offset part from the source to its ancestor */\n\trenderOffset?: boolean\n}\n\nexport const Arrow = React.memo(function Arrow(props: Props) {\n\tconst {\n\t\ttintColor,\n\t\tactive,\n\t\tstartDirection: direction,\n\t\tstartOffsetX,\n\t\tstartOffsetY,\n\t\tshowArrowHead,\n\t\tisSelfLink,\n\t\tbackground,\n\t\tzoom,\n\t\trenderOffset = true,\n\t} = props\n\n\tconst start = { x: props.startX, y: props.startY }\n\tconst startWithOffset = { x: start.x + startOffsetX, y: start.y + startOffsetY }\n\n\t// The part over the node\n\tif (!background) {\n\t\treturn offsetLine(start, startWithOffset, zoom, active, tintColor, renderOffset)\n\t}\n\n\t// The part on the canvas (on the background behind the node)\n\tconst startX = props.startX * zoom\n\tconst startY = props.startY * zoom\n\n\tconst offsetX = startWithOffset.x * zoom\n\tconst offsetY = startWithOffset.y * zoom\n\n\tconst endX = props.endX * zoom\n\tconst endY = props.endY * zoom\n\n\tconst minX = Math.min(offsetX, endX)\n\tconst minY = Math.min(offsetY, endY)\n\tconst maxX = Math.max(offsetX, endX)\n\tconst maxY = Math.max(offsetY, endY)\n\n\tconst width = Math.max(maxX - minX, 1)\n\tconst height = Math.max(maxY - minY, 1)\n\n\tconst localStartX = startX - minX\n\tconst localStartY = startY - minY\n\n\tconst localOffsetX = offsetX - minX\n\tconst localOffsetY = offsetY - minY\n\n\tconst localEndOffset = arrowHeadOffset(\n\t\tshowArrowHead,\n\t\tisSelfLink ? oppositeDirectionMap[direction] : direction,\n\t\tzoom,\n\t\t// Use a larger offset for arrows when the height of the self-link curves is visually small\n\t\tisSelfLink && height < 20 ? arrowPointOffsetLarge : arrowPointOffset,\n\t)\n\n\tconst localEndX = endX - minX + localEndOffset.x\n\tconst localEndY = endY - minY + localEndOffset.y\n\n\tconst path = generatePath(\n\t\tdirection,\n\t\tlocalStartX,\n\t\tlocalStartY,\n\t\tlocalOffsetX,\n\t\tlocalOffsetY,\n\t\tlocalEndX,\n\t\tlocalEndY,\n\t\tzoom,\n\t\tisSelfLink,\n\t)\n\n\tconst zoomScale = Math.ceil(Math.pow(11, Math.pow(zoom, 0.1))) / 11\n\n\treturn (\n\t\t<svg style={style(minX, minY, active)} width={width} height={height} fill=\"transparent\">\n\t\t\t<path d={path} strokeWidth={2} stroke={active ? tintColor : colors.canvasConnectionLine} />\n\t\t\t{showArrowHead && (\n\t\t\t\t<path\n\t\t\t\t\td={arrowHead(localEndX, localEndY, direction, zoomScale, isSelfLink)}\n\t\t\t\t\tstroke={active ? tintColor : colors.canvasConnectionLine}\n\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</svg>\n\t)\n})\n\nfunction offsetLine(\n\tstart: Point,\n\tend: Point | null,\n\tzoom: number,\n\tactive: boolean,\n\ttintColor: string,\n\trenderOffset = true,\n) {\n\tif (!end || !renderOffset) return null\n\n\tconst startX = start.x * zoom\n\tconst startY = start.y * zoom\n\tconst endX = end.x * zoom\n\tconst endY = end.y * zoom\n\n\tconst minX = Math.min(startX, endX)\n\tconst minY = Math.min(startY, endY)\n\tconst maxX = Math.max(startX, endX)\n\tconst maxY = Math.max(startY, endY)\n\n\tconst width = Math.max(maxX - minX, 1)\n\tconst height = Math.max(maxY - minY, 1)\n\n\tconst localStartX = startX - minX\n\tconst localStartY = startY - minY\n\n\tconst localEndX = endX - minX\n\tconst localEndY = endY - minY\n\n\treturn (\n\t\t<svg style={style(minX, minY)} width={width} height={height} fill=\"transparent\">\n\t\t\t<line\n\t\t\t\tx1={localStartX}\n\t\t\t\ty1={localStartY}\n\t\t\t\tx2={localEndX}\n\t\t\t\ty2={localEndY}\n\t\t\t\tstrokeWidth={2}\n\t\t\t\tstroke={active ? tintColor : colors.canvasConnectionLine}\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction style(minX: number, minY: number, active?: boolean): React.CSSProperties {\n\treturn {\n\t\tposition: \"absolute\",\n\t\ttransform: `translate(${minX}px, ${minY}px)`,\n\t\toverflow: \"visible\",\n\t\tpointerEvents: \"none\",\n\t\tzIndex: active ? 10000 : undefined,\n\t}\n}\n\nexport function preferredArrowDirection(sourceRect: Rect, destinationRect: Rect) {\n\tconst srcBounds = Rect.positions(sourceRect)\n\tconst destBounds = Rect.positions(destinationRect)\n\n\tif (Rect.overlapHorizontally(sourceRect, destinationRect)) {\n\t\tconst destinationBelow = destBounds.minY > srcBounds.maxY\n\t\tconst destinationAbove = destBounds.maxY < srcBounds.minY\n\n\t\tif (destinationBelow) {\n\t\t\treturn ArrowDirection.Down\n\t\t} else if (destinationAbove) {\n\t\t\treturn ArrowDirection.Up\n\t\t}\n\t}\n\n\treturn destBounds.midX < srcBounds.midX ? ArrowDirection.Left : ArrowDirection.Right\n}\n\nexport function rectStartPoint(sourceRect: Rect, sourceMatrix: DOMMatrixReadOnly, direction: ArrowDirection) {\n\tlet start: Point\n\tswitch (direction) {\n\t\tcase ArrowDirection.Right:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.MiddleRight)\n\t\t\tbreak\n\t\tcase ArrowDirection.Left:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.MiddleLeft)\n\t\t\tbreak\n\t\tcase ArrowDirection.Down:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.CenterBottom)\n\t\t\tbreak\n\t\tcase ArrowDirection.Up:\n\t\tdefault:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.CenterTop)\n\t\t\tbreak\n\t}\n\treturn Matrix.convertPoint(sourceMatrix, start)\n}\n\nexport function arrowPoints(\n\ttree: CanvasTree,\n\tsourceRect: Rect,\n\tsourceMatrix: DOMMatrixReadOnly,\n\tdestinationRect: Rect,\n\tdestinationMatrix: DOMMatrixReadOnly,\n\tstartDirection: ArrowDirection,\n\tsourceAncestor: CanvasNode | null,\n) {\n\tlet start: Point\n\tlet end: Point\n\n\tswitch (startDirection) {\n\t\tcase ArrowDirection.Right:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.MiddleRight)\n\t\t\tend = rectPosition(destinationRect, RectPosition.MiddleLeft)\n\t\t\tbreak\n\t\tcase ArrowDirection.Left:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.MiddleLeft)\n\t\t\tend = rectPosition(destinationRect, RectPosition.MiddleRight)\n\t\t\tbreak\n\t\tcase ArrowDirection.Down:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.CenterBottom)\n\t\t\tend = rectPosition(destinationRect, RectPosition.CenterTop)\n\t\t\tbreak\n\t\tcase ArrowDirection.Up:\n\t\tdefault:\n\t\t\tstart = rectPosition(sourceRect, RectPosition.CenterTop)\n\t\t\tend = rectPosition(destinationRect, RectPosition.CenterBottom)\n\t\t\tbreak\n\t}\n\n\tstart = Matrix.convertPoint(sourceMatrix, start)\n\n\tconst offset = sourceAncestor ? arrowSourceOffset(tree, sourceAncestor, start, startDirection) : { x: 0, y: 0 }\n\n\tend = Matrix.convertPoint(destinationMatrix, end)\n\n\treturn { start, end, offset }\n}\n\nenum RectPosition {\n\tCenterTop,\n\tMiddleRight,\n\tCenterBottom,\n\tMiddleLeft,\n}\n\nfunction rectPosition(rect: Rect, position: RectPosition) {\n\tswitch (position) {\n\t\tcase RectPosition.CenterTop:\n\t\t\treturn { x: rect.width / 2, y: 0 }\n\t\tcase RectPosition.MiddleRight:\n\t\t\treturn { x: rect.width, y: rect.height / 2 }\n\t\tcase RectPosition.CenterBottom:\n\t\t\treturn { x: rect.width / 2, y: rect.height }\n\t\tcase RectPosition.MiddleLeft:\n\t\t\treturn { x: 0, y: rect.height / 2 }\n\t}\n}\n\nexport function topAncestor(tree: CanvasTree, node: CanvasNode) {\n\tif (tree.isGroundNode(node)) return null\n\treturn tree.getGroundNodeFor(node)\n}\n\nfunction canvasSidesForNode(tree: CanvasTree, node: CanvasNode): Line[] {\n\tconst points = convertCornerPointsToCanvas(tree, node)\n\tconst count = points.length\n\treturn points.map((corner, index) => {\n\t\tconst nextIndex = (index + 1) % count\n\t\tconst nextCorner = points[nextIndex]!\n\t\treturn Line(corner, nextCorner)\n\t})\n}\n\nfunction lineForArrowStartAndDirection(a: Point, direction: ArrowDirection) {\n\tconst b = { ...a }\n\tswitch (direction) {\n\t\tcase ArrowDirection.Right:\n\t\tcase ArrowDirection.Left:\n\t\t\tb.x += 10\n\t\t\tbreak\n\t\tcase ArrowDirection.Up:\n\t\tcase ArrowDirection.Down:\n\t\tdefault:\n\t\t\tb.y += 10\n\t\t\tbreak\n\t}\n\treturn Line(a, b)\n}\n\nfunction bestIntersection(point: Point, intersections: (Point | null)[], direction: ArrowDirection) {\n\tlet validIntersection: Point | null = null\n\tlet smallestIntersectionOffset = Infinity\n\tfor (const intersection of intersections) {\n\t\tif (!intersection) continue\n\t\tlet offset: number\n\t\tswitch (direction) {\n\t\t\tcase ArrowDirection.Right:\n\t\t\t\toffset = intersection.x - point.x\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Left:\n\t\t\t\toffset = point.x - intersection.x\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Down:\n\t\t\t\toffset = intersection.y - point.y\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Up:\n\t\t\tdefault:\n\t\t\t\toffset = point.y - intersection.y\n\t\t}\n\t\tif (offset < 0 || offset > smallestIntersectionOffset) continue\n\t\tsmallestIntersectionOffset = offset\n\t\tvalidIntersection = intersection\n\t}\n\treturn validIntersection\n}\n\nexport function arrowSourceOffset(\n\ttree: CanvasTree,\n\ttopAncestorNode: CanvasNode,\n\tpoint: Point,\n\tdirection: ArrowDirection,\n): Point {\n\tconst mainLine = lineForArrowStartAndDirection(point, direction)\n\tconst sideLines = canvasSidesForNode(tree, topAncestorNode)\n\tconst intersections = sideLines.map(sideLine => Line.intersection(sideLine, mainLine))\n\tconst intersectionFound = bestIntersection(point, intersections, direction)\n\tif (!intersectionFound) return { x: 0, y: 0 }\n\tswitch (direction) {\n\t\tcase ArrowDirection.Right:\n\t\tcase ArrowDirection.Left:\n\t\t\treturn { x: intersectionFound.x - point.x, y: 0 }\n\t\tdefault:\n\t\t\treturn { y: intersectionFound.y - point.y, x: 0 }\n\t}\n}\n\n// Main path\n\nconst cache = new Map()\n\nfunction generatePath(\n\tdirection: ArrowDirection,\n\tstartX: number,\n\tstartY: number,\n\toffsetX: number,\n\toffsetY: number,\n\tendX: number,\n\tendY: number,\n\tzoom: number,\n\tisSelfLink: boolean = false,\n): string {\n\tconst key = JSON.stringify([direction, startX, startY, endX, endY])\n\treturn memoize(2000, cache, key, () => {\n\t\tlet horizontalDir = 0\n\t\tlet verticalDir = 0\n\n\t\tswitch (direction) {\n\t\t\tcase ArrowDirection.Right:\n\t\t\t\thorizontalDir = 1\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Left:\n\t\t\t\thorizontalDir = -1\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Down:\n\t\t\t\tverticalDir = 1\n\t\t\t\tbreak\n\t\t\tcase ArrowDirection.Up:\n\t\t\t\tverticalDir = -1\n\t\t\t\tbreak\n\t\t}\n\n\t\tconst horDistance = Math.abs(startX - endX) / 2\n\t\tconst offset = 8\n\t\tconst ArrowCurveOffset = Math.min(horDistance, 20) * zoom + offset\n\n\t\tlet path: readonly PathSegment[]\n\n\t\tif (isSelfLink) {\n\t\t\tconst selfLinkDistanceX = 150 * horizontalDir\n\n\t\t\tpath = [\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: startX,\n\t\t\t\t\ty: startY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX + offset * horizontalDir,\n\t\t\t\t\ty: startY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX + offset * horizontalDir + selfLinkDistanceX,\n\t\t\t\t\ty: (startY + endY) / 2,\n\t\t\t\t\tradius: 100,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX + offset * horizontalDir,\n\t\t\t\t\ty: endY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX,\n\t\t\t\t\ty: endY,\n\t\t\t\t}),\n\t\t\t]\n\t\t} else if (offsetX === endX || offsetY === endY) {\n\t\t\tpath = [\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: startX,\n\t\t\t\t\ty: startY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX,\n\t\t\t\t\ty: offsetY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX,\n\t\t\t\t\ty: endY,\n\t\t\t\t}),\n\t\t\t]\n\t\t} else {\n\t\t\tpath = [\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: startX,\n\t\t\t\t\ty: startY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX,\n\t\t\t\t\ty: offsetY,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX + offset * horizontalDir,\n\t\t\t\t\ty: offsetY + offset * verticalDir,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: offsetX + ArrowCurveOffset * horizontalDir,\n\t\t\t\t\ty: offsetY + ArrowCurveOffset * verticalDir,\n\t\t\t\t\tradius: 100,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX - ArrowCurveOffset * horizontalDir,\n\t\t\t\t\ty: endY - ArrowCurveOffset * verticalDir,\n\t\t\t\t\tradius: 100,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX - offset * horizontalDir,\n\t\t\t\t\ty: endY - offset * verticalDir,\n\t\t\t\t}),\n\t\t\t\tnew PathSegment({\n\t\t\t\t\tx: endX,\n\t\t\t\t\ty: endY,\n\t\t\t\t}),\n\t\t\t]\n\t\t}\n\n\t\tconst pathWithRadius = Path.applyRadius(path, false)\n\t\tconst result = toSVGPath(pathWithRadius)\n\t\treturn result\n\t})\n}\n\n// Arrow head\n\nconst arrowHeadCrossOffset = 5\nconst arrowHeadBackOffset = 4.1\nconst arrowHeadFrontOffset = arrowHeadCrossOffset - arrowHeadBackOffset\n\nconst Origin = { x: 0, y: 0 }\n\nfunction arrowHeadOffset(\n\tshowArrowHead: boolean,\n\tdirection: ArrowDirection,\n\tzoom: number,\n\tarrowOffset = arrowPointOffset,\n) {\n\tif (!showArrowHead) return Origin\n\tconst offset = Math.max(2, Math.min(arrowOffset, arrowOffset * zoom))\n\tswitch (direction) {\n\t\tcase ArrowDirection.Right:\n\t\t\treturn { x: -offset, y: 0 }\n\t\tcase ArrowDirection.Left:\n\t\t\treturn { x: offset, y: 0 }\n\t\tcase ArrowDirection.Down:\n\t\t\treturn { x: 0, y: -offset }\n\t\tcase ArrowDirection.Up:\n\t\t\treturn { x: 0, y: offset }\n\t}\n}\n\nfunction arrowHead(x: number, y: number, direction: ArrowDirection, zoomScale: number, isSelfLink = false) {\n\tconst backOffset = arrowHeadBackOffset * zoomScale\n\tconst crossOffset = arrowHeadCrossOffset * zoomScale\n\tconst frontOffset = arrowHeadFrontOffset * zoomScale\n\n\tswitch (isSelfLink ? oppositeDirectionMap[direction] : direction) {\n\t\tcase ArrowDirection.Left:\n\t\t\treturn `M${x + backOffset}, ${y - crossOffset} ${x - frontOffset}, ${y} ${x + backOffset}, ${y + crossOffset}`\n\t\tcase ArrowDirection.Right:\n\t\t\treturn `M${x - backOffset}, ${y - crossOffset} ${x + frontOffset}, ${y} ${x - backOffset}, ${y + crossOffset}`\n\t\tcase ArrowDirection.Down:\n\t\t\treturn `M${x - crossOffset}, ${y - backOffset} ${x}, ${y + frontOffset} ${x + crossOffset}, ${y - backOffset}`\n\t\tcase ArrowDirection.Up:\n\t\t\treturn `M${x - crossOffset}, ${y + backOffset} ${x}, ${y - frontOffset} ${x + crossOffset}, ${y + backOffset}`\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { Tools } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\n\nconst outletSize = 11\n\ninterface Props {\n\tx: number\n\ty: number\n\tzoom: number\n\ttintColor: string\n\ttoolIsActive: boolean\n\thighlighted: boolean\n\tselected: boolean\n\tid: NodeID\n\ttool: Tools\n\tmulti?: boolean\n}\n\ninterface State {\n\tmouseOver: boolean\n}\n\nexport class Outlet extends React.Component<Props, State> {\n\toverride state: State = { mouseOver: false }\n\n\tonMouseEnter = () => {\n\t\tthis.setState({ mouseOver: true })\n\t}\n\n\tonMouseLeave = () => {\n\t\tthis.setState({ mouseOver: false })\n\t}\n\n\tonMouseMove = (event: React.MouseEvent<HTMLElement>) => {\n\t\tevent.stopPropagation()\n\t}\n\n\tactivateTool = engine.scheduler.wrapHandler(() => {\n\t\tconst { id, tool } = this.props\n\t\tengine.stores.selectionStore.set(id)\n\t\tengine.setTool(tool)\n\t})\n\n\toverride render() {\n\t\tconst { selected, highlighted, toolIsActive, multi, zoom, tintColor } = this.props\n\t\tconst { mouseOver } = this.state\n\n\t\tconst outletHeight = multi ? 23 : outletSize\n\n\t\tconst left = Math.round(this.props.x * zoom - Math.ceil(outletSize / 2))\n\t\tconst top = this.props.y * zoom - 0.5 * outletHeight + 0.5\n\n\t\tconst style: React.CSSProperties = {\n\t\t\t...baseStyle,\n\t\t\theight: outletHeight,\n\t\t\ttransform: `translateX(${left}px) translateY(${top}px)`,\n\t\t\tbackground: selected && (toolIsActive || !mouseOver) ? tintColor : \"white\",\n\t\t\tborder: `1px solid ${selected || highlighted || mouseOver ? tintColor : colors.canvasConnectionLine}`,\n\t\t}\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={style}\n\t\t\t\tonMouseEnter={this.onMouseEnter}\n\t\t\t\tonMouseLeave={this.onMouseLeave}\n\t\t\t\tonMouseMove={this.onMouseMove}\n\t\t\t\tonMouseDown={this.activateTool}\n\t\t\t>\n\t\t\t\t{childDots(mouseOver && !(toolIsActive && selected), tintColor, multi)}\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nfunction childDots(mouseOver: boolean, tintColor: string, multi: boolean | undefined) {\n\tif (multi) {\n\t\treturn [\n\t\t\tchildDot(mouseOver, tintColor, multi, -1),\n\t\t\tchildDot(mouseOver, tintColor, multi),\n\t\t\tchildDot(mouseOver, tintColor, multi, 1),\n\t\t]\n\t}\n\n\treturn childDot(mouseOver, tintColor, multi)\n}\n\nfunction childDot(mouseOver: boolean, tintColor: string, multi: boolean | undefined, yOffset = 0) {\n\treturn <div key={yOffset} style={childDotStyle(tintColor, yOffset, multi, mouseOver)} />\n}\n\nconst childDotBaseStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\twidth: outletSize - 5,\n\theight: outletSize - 5,\n\tbackground: \"#09F\",\n\tborderRadius: \"50%\",\n\tpointerEvents: \"none\",\n}\n\nconst dotSize = outletSize - 6\n\nfunction childDotStyle(\n\tbackground: string,\n\tyOffset: number,\n\tmulti: boolean | undefined,\n\tmouseOver: boolean,\n): React.CSSProperties {\n\treturn {\n\t\t...childDotBaseStyle,\n\t\twidth: dotSize,\n\t\theight: dotSize,\n\t\tbackground: mouseOver ? background : \"white\",\n\t\ttransform: `translateX(2px) translateY(${yOffset * (dotSize + 1)}px) translateY(${multi ? 8 : 2}px)`,\n\t}\n}\n\nconst baseStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\twidth: outletSize,\n\theight: outletSize,\n\tbackground: \"white\",\n\tborderRadius: outletSize,\n\tzIndex: 10001,\n}\n", "import { isEmptyObject, unhandledError } from \"@framerjs/shared\"\nimport type { GetHiddenStateForControlsByNodeArgs } from \"canvas-sandbox/ControlsVisibility.ts\"\nimport { Arrow, ArrowDirection, rectStartPoint } from \"document/components/canvas-hud/Arrow.tsx\"\nimport { Outlet } from \"document/components/canvas-hud/Outlet.tsx\"\nimport { isWaitingForMeasuredRect } from \"document/components/utils/isWaitingForMeasuredRect.ts\"\nimport engine from \"document/engine.ts\"\nimport { hasEvents } from \"document/models/CanvasTree/actions/actions.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tCodeComponentNode,\n\tLoadedScopeNode,\n\tMaybeNodeID,\n\tNodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCanvasPageNode,\n\tisCodeComponentNode,\n\tisDesignPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tacceptsMultipleSlotItems,\n\tgetSlotItemsBySlotKey,\n\tgetSlotKeys,\n\thasAnySlots,\n} from \"document/models/CanvasTree/nodes/utils/slotUtils.ts\"\nimport { isLocalSmartComponentInstance } from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { withBreakpointVariants } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport { withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { withGestureVariants, withReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport type { IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tisGestureOrGestureVariantChild,\n\tisReplicaVariantOrReplicaVariantChild,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { withFormInputEvents } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type React from \"react\"\nimport { useEffect, useMemo, useState } from \"react\"\nimport { calculateArrowPosition } from \"../tools/linkTool/Link.tsx\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { ActionOutlet } from \"./ActionOutlet.tsx\"\nimport { Arrows } from \"./Arrows.tsx\"\n\ntype SlotKey = string\ntype HiddenSlots = Record<SlotKey, boolean>\ntype HiddenSlotsByNodeId = Record<NodeID, HiddenSlots>\n\ninterface Props {\n\ttree: CanvasTree\n\ttool: Tools.SlotConnect | Tools.Link | null\n\tcodeComponentArrows: ReadonlySet<CodeComponentNode>\n\tlinkedNavigationNodes: readonly { fromNode: CanvasNode; toNode: CanvasNode }[]\n\tlinkedVariantNodes: readonly { fromNode: CanvasNode; toNode: CanvasNode & IsVariant }[]\n\tlinkedGestureNodes: readonly { fromNode: CanvasNode & IsVariant; toNode: CanvasNode & IsVariant }[]\n\thighlight: MaybeNodeID\n\tsingleSelectedNode: CanvasNode | null\n\tzoom: number\n\tbackground: boolean\n\tisViewOnly: boolean\n\tactiveScope: LoadedScopeNode\n\tisPreviewingLocaleOnCanvas: boolean\n}\n\nexport function NodeLinks({\n\ttree,\n\ttool,\n\tcodeComponentArrows,\n\tlinkedNavigationNodes,\n\tlinkedVariantNodes,\n\tlinkedGestureNodes,\n\thighlight,\n\tzoom,\n\tbackground,\n\tsingleSelectedNode,\n\tisViewOnly,\n\tactiveScope,\n\tisPreviewingLocaleOnCanvas,\n}: Props) {\n\tconst slotKeysByNodeId = useMemo<ReadonlyMap<NodeID, readonly string[]>>(() => {\n\t\tconst result = new Map<NodeID, readonly string[]>()\n\t\tfor (const codeComponentNode of codeComponentArrows) {\n\t\t\tresult.set(codeComponentNode.id, getSlotKeys(codeComponentNode, engine.componentLoader))\n\t\t}\n\t\treturn result\n\t}, [codeComponentArrows])\n\n\tconst [hiddenSlotsByNodeId, setHiddenSlotsByNodeId] = useState<HiddenSlotsByNodeId | undefined>(undefined)\n\n\t/**\n\t * FIXME: the logic below seems like a lot of work on every re-render\n\t * We might consider changing the mechanism of how control.hidden state works\n\t * so instead of pulling it from the Sandbox, Sandbox would push it when it changes.\n\t * Need to evaluate which approach is ultimately faster\n\t */\n\tuseEffect(() => {\n\t\tconst args: GetHiddenStateForControlsByNodeArgs = {}\n\n\t\tfor (const [nodeId, slotKeys] of slotKeysByNodeId.entries()) {\n\t\t\targs[nodeId] = { controlNames: slotKeys }\n\t\t}\n\n\t\tif (isEmptyObject(args)) return\n\n\t\tconst controlsVisibility = engine.getControlsVisibility()\n\t\tif (!controlsVisibility) return\n\n\t\tcontrolsVisibility\n\t\t\t.getHiddenStateForControlsByNode(args)\n\t\t\t.then(hiddenControlsByNodeId => {\n\t\t\t\tsetHiddenSlotsByNodeId(currentHiddenState => {\n\t\t\t\t\tif (!currentHiddenState) return hiddenControlsByNodeId\n\t\t\t\t\t// FIXME: can we be smarter about it, and avoid deep comparison on every update?\n\t\t\t\t\tif (isEqual(currentHiddenState, hiddenControlsByNodeId, true)) return currentHiddenState\n\t\t\t\t\treturn hiddenControlsByNodeId\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch(err => {\n\t\t\t\tunhandledError(err)\n\t\t\t\tsetHiddenSlotsByNodeId(current => {\n\t\t\t\t\tconst newHiddenState: HiddenSlotsByNodeId = {}\n\n\t\t\t\t\tfor (const [nodeId, slotKeys] of slotKeysByNodeId.entries()) {\n\t\t\t\t\t\tconst hiddenStateForNode: HiddenSlots = {}\n\t\t\t\t\t\tnewHiddenState[nodeId] = hiddenStateForNode\n\n\t\t\t\t\t\tfor (const slotKey of slotKeys) {\n\t\t\t\t\t\t\thiddenStateForNode[slotKey] = false\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (current === undefined) return newHiddenState\n\t\t\t\t\tif (isEqual(current, newHiddenState, true)) return current\n\t\t\t\t\treturn newHiddenState\n\t\t\t\t})\n\t\t\t})\n\t})\n\n\tfunction renderSlots(): React.ReactElement[] {\n\t\tconst elements: React.ReactElement[] = []\n\n\t\tfor (const fromNode of codeComponentArrows) {\n\t\t\tif (!fromNode.cache.visible) continue\n\n\t\t\tconst fromScope = tree.getScopeNodeFor(fromNode)\n\t\t\tif (fromScope === null || fromScope.id !== activeScope.id) continue\n\n\t\t\tconst fromNodeId = fromNode.id\n\t\t\tconst selected = fromNode.isSelected()\n\t\t\tconst highlighted = highlight === fromNodeId && !selected\n\t\t\tconst tint = getTintColor(fromNode)\n\n\t\t\tif (hiddenSlotsByNodeId !== undefined) {\n\t\t\t\tconst hiddenSlotsState = hiddenSlotsByNodeId[fromNodeId]\n\n\t\t\t\tconst hiddenSlots = new Set()\n\t\t\t\tfor (const slotKey of getSlotKeys(fromNode, engine.componentLoader)) {\n\t\t\t\t\tif (hiddenSlotsState?.[slotKey]) hiddenSlots.add(slotKey)\n\t\t\t\t}\n\n\t\t\t\tconst nonHiddenSlotItemNodes: CanvasNode[] = []\n\n\t\t\t\tconst slotItemsBySlotKey = getSlotItemsBySlotKey(tree, fromNode, engine.componentLoader)\n\t\t\t\tfor (const slotKey in slotItemsBySlotKey) {\n\t\t\t\t\tif (hiddenSlots.has(slotKey)) continue\n\n\t\t\t\t\tconst slotItems = slotItemsBySlotKey[slotKey]\n\t\t\t\t\tif (!slotItems) continue\n\n\t\t\t\t\tfor (const slotItem of slotItems) {\n\t\t\t\t\t\tnonHiddenSlotItemNodes.push(slotItem.node)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst arrows = (\n\t\t\t\t\t<Arrows\n\t\t\t\t\t\tkey={`arrow-${fromNodeId}-slot`}\n\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t\tsource={fromNode}\n\t\t\t\t\t\tdestinations={nonHiddenSlotItemNodes}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\ttintColor={tint}\n\t\t\t\t\t\tactive={highlighted || selected}\n\t\t\t\t\t\tbackground={background}\n\t\t\t\t\t\tshowArrowHead={false}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t\telements.push(arrows)\n\t\t\t}\n\n\t\t\tconst canUpdateSlots = !isReplicaVariantOrReplicaVariantChild(fromNode)\n\n\t\t\t// Don't render slot connectors for Prototype component\n\t\t\tconst isPrototypeNode = fromNode.codeComponentIdentifier === HardCodedCodeIdentifier.prototype\n\n\t\t\tif (!background && !isViewOnly && !isPreviewingLocaleOnCanvas && selected && canUpdateSlots && !isPrototypeNode) {\n\t\t\t\tconst hiddenSlotsState = hiddenSlotsByNodeId ? hiddenSlotsByNodeId[fromNodeId] : undefined\n\t\t\t\tconst start = rectStartPoint(tree.getRect(fromNode), fromNode.canvasMatrix(), ArrowDirection.Right)\n\t\t\t\tconst slotKeys = getSlotKeys(fromNode, engine.componentLoader)\n\t\t\t\tif (hiddenSlotsState && slotKeys.length > 0) {\n\t\t\t\t\tconst activeSlotKeys = slotKeys.filter(slotKey => !hiddenSlotsState[slotKey])\n\t\t\t\t\tif (activeSlotKeys.length > 0) {\n\t\t\t\t\t\tconst outlet = (\n\t\t\t\t\t\t\t<Outlet\n\t\t\t\t\t\t\t\tkey={`slot-outlet-${fromNodeId}`}\n\t\t\t\t\t\t\t\tx={start.x}\n\t\t\t\t\t\t\t\ty={start.y}\n\t\t\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\t\t\ttintColor={tint}\n\t\t\t\t\t\t\t\ttoolIsActive={tool === Tools.SlotConnect}\n\t\t\t\t\t\t\t\tselected={selected}\n\t\t\t\t\t\t\t\thighlighted={highlighted}\n\t\t\t\t\t\t\t\tid={fromNodeId}\n\t\t\t\t\t\t\t\ttool={Tools.SlotConnect}\n\t\t\t\t\t\t\t\tmulti={acceptsMultipleSlotItems(fromNode, engine.componentLoader, activeSlotKeys)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t\telements.push(outlet)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn elements\n\t}\n\n\tfunction renderNavigation() {\n\t\tif (!isCanvasPageNode(activeScope)) return null\n\n\t\tconst elements: React.ReactElement[] = []\n\n\t\tfor (const { fromNode, toNode } of linkedNavigationNodes) {\n\t\t\tif (!fromNode.cache.visible) continue\n\t\t\tif (!toNode.cache.visible) continue\n\n\t\t\tconst fromScope = tree.getScopeNodeFor(fromNode)\n\t\t\tif (fromScope === null || fromScope.id !== activeScope.id) continue\n\n\t\t\tconst selected = fromNode.isSelected()\n\t\t\tconst highlighted = highlight === fromNode.id && !selected\n\n\t\t\tif (selected && tool === Tools.Link) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst { startDirection, endDirection, startPoint, endPoint, offsetPoint, isSelfLink, preventArrowRender } =\n\t\t\t\tcalculateArrowPosition({\n\t\t\t\t\ttree,\n\t\t\t\t\tsrcNode: fromNode,\n\t\t\t\t\tdestNode: toNode,\n\t\t\t\t\tzoom,\n\t\t\t\t})\n\n\t\t\tif (preventArrowRender) continue\n\n\t\t\tconst navigationArrow = (\n\t\t\t\t<Arrow\n\t\t\t\t\tkey={`arrow-${fromNode.id}-${toNode.id}`}\n\t\t\t\t\tstartX={startPoint.x}\n\t\t\t\t\tstartY={startPoint.y}\n\t\t\t\t\tendX={endPoint.x}\n\t\t\t\t\tendY={endPoint.y}\n\t\t\t\t\tstartOffsetX={offsetPoint.x}\n\t\t\t\t\tstartOffsetY={offsetPoint.y}\n\t\t\t\t\tstartDirection={startDirection}\n\t\t\t\t\tendDirection={endDirection}\n\t\t\t\t\tisSelfLink={isSelfLink}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\ttintColor={getTintColor(fromNode)}\n\t\t\t\t\tactive={highlighted || selected}\n\t\t\t\t\tbackground={background}\n\t\t\t\t\tshowArrowHead\n\t\t\t\t/>\n\t\t\t)\n\n\t\t\telements.push(navigationArrow)\n\t\t}\n\n\t\treturn elements\n\t}\n\n\tfunction renderGestureLinks() {\n\t\tif (!withGestureVariants(activeScope)) return null\n\n\t\tconst elements: React.ReactElement[] = []\n\n\t\tfor (const { fromNode, toNode } of linkedGestureNodes) {\n\t\t\tif (!fromNode.cache.visible) continue\n\t\t\tif (!toNode.cache.visible) continue\n\n\t\t\tconst fromScopeNode = tree.getScopeNodeFor(fromNode)\n\t\t\tif (fromScopeNode === null || fromScopeNode.id !== activeScope.id) continue\n\n\t\t\tconst toScopeNode = tree.getScopeNodeFor(toNode)\n\t\t\tif (toScopeNode === null || toScopeNode.id !== activeScope.id) continue\n\n\t\t\tconst selected = fromNode.isSelected()\n\t\t\tconst highlighted = highlight === fromNode.id && !selected\n\n\t\t\tconst { startDirection, endDirection, startPoint, endPoint, offsetPoint, isSelfLink, preventArrowRender } =\n\t\t\t\tcalculateArrowPosition({\n\t\t\t\t\ttree,\n\t\t\t\t\tsrcNode: fromNode,\n\t\t\t\t\tdestNode: toNode,\n\t\t\t\t\tstartDirectionOverride: ArrowDirection.Up,\n\t\t\t\t\tendDirectionOverride: ArrowDirection.Down,\n\t\t\t\t\tzoom,\n\t\t\t\t})\n\n\t\t\tif (preventArrowRender) continue\n\n\t\t\tconst navigationArrow = (\n\t\t\t\t<Arrow\n\t\t\t\t\tkey={`gesture-arrow-${fromNode.id}-${toNode.id}`}\n\t\t\t\t\tstartX={startPoint.x}\n\t\t\t\t\tstartY={startPoint.y}\n\t\t\t\t\tendX={endPoint.x}\n\t\t\t\t\tendY={endPoint.y}\n\t\t\t\t\tstartOffsetX={offsetPoint.x}\n\t\t\t\t\tstartOffsetY={offsetPoint.y}\n\t\t\t\t\tstartDirection={startDirection}\n\t\t\t\t\tendDirection={endDirection}\n\t\t\t\t\tisSelfLink={isSelfLink}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\ttintColor={getTintColor(fromNode)}\n\t\t\t\t\tactive={highlighted || selected}\n\t\t\t\t\tbackground={background}\n\t\t\t\t\tshowArrowHead={false}\n\t\t\t\t/>\n\t\t\t)\n\n\t\t\telements.push(navigationArrow)\n\t\t}\n\n\t\treturn elements\n\t}\n\n\tfunction renderVariantLinks() {\n\t\tif (!withReplicaVariants(activeScope) || withBreakpointVariants(activeScope)) return null\n\n\t\tconst elements: React.ReactElement[] = []\n\n\t\tfor (const { fromNode, toNode } of linkedVariantNodes) {\n\t\t\tif (!fromNode.cache.visible) continue\n\t\t\tif (!toNode.cache.visible) continue\n\n\t\t\tconst fromScopeNode = tree.getScopeNodeFor(fromNode)\n\t\t\tif (fromScopeNode === null || fromScopeNode.id !== activeScope.id) continue\n\n\t\t\tconst toScopeNode = tree.getScopeNodeFor(toNode)\n\t\t\tif (toScopeNode === null || toScopeNode.id !== activeScope.id) continue\n\n\t\t\tconst selected = fromNode.isSelected()\n\t\t\tconst highlighted = highlight === fromNode.id && !selected\n\n\t\t\tif (selected && tool === Tools.Link) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst { startDirection, endDirection, startPoint, endPoint, offsetPoint, isSelfLink, preventArrowRender } =\n\t\t\t\tcalculateArrowPosition({\n\t\t\t\t\ttree,\n\t\t\t\t\tsrcNode: fromNode,\n\t\t\t\t\tdestNode: toNode,\n\t\t\t\t\tzoom,\n\t\t\t\t})\n\n\t\t\tif (preventArrowRender) continue\n\n\t\t\tconst navigationArrow = (\n\t\t\t\t<Arrow\n\t\t\t\t\tkey={`variant-arrow-${fromNode.id}-${toNode.id}`}\n\t\t\t\t\tstartX={startPoint.x}\n\t\t\t\t\tstartY={startPoint.y}\n\t\t\t\t\tendX={endPoint.x}\n\t\t\t\t\tendY={endPoint.y}\n\t\t\t\t\tstartOffsetX={offsetPoint.x}\n\t\t\t\t\tstartOffsetY={offsetPoint.y}\n\t\t\t\t\tstartDirection={startDirection}\n\t\t\t\t\tendDirection={endDirection}\n\t\t\t\t\tisSelfLink={isSelfLink}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\ttintColor={getTintColor(fromNode)}\n\t\t\t\t\tactive={highlighted || selected}\n\t\t\t\t\tbackground={background}\n\t\t\t\t\tshowArrowHead\n\t\t\t\t\trenderOffset={selected || highlighted}\n\t\t\t\t/>\n\t\t\t)\n\n\t\t\telements.push(navigationArrow)\n\t\t}\n\n\t\treturn elements\n\t}\n\n\tfunction actionOutletNode(): CanvasNode | null {\n\t\tsingleSelectedNode = engine.tree.current(singleSelectedNode)\n\t\tif (!singleSelectedNode) return null\n\t\tif (!singleSelectedNode.cache.visible) return null\n\t\tif (isGestureOrGestureVariantChild(singleSelectedNode)) return null\n\n\t\tif (withBreakpointVariants(activeScope)) {\n\t\t\treturn null\n\t\t}\n\n\t\tif (isDesignPageNode(activeScope)) {\n\t\t\treturn null\n\t\t}\n\n\t\t// If the platform supports variant editing, always show the action\n\t\t// outlet so that users could create an action via linking.\n\t\tif (isLocalSmartComponentInstance(singleSelectedNode)) {\n\t\t\treturn singleSelectedNode\n\t\t}\n\n\t\tif (!hasEvents(singleSelectedNode, engine.componentLoader)) return null\n\n\t\tif (isCodeComponentNode(singleSelectedNode)) {\n\t\t\tconst hasSlots = hasAnySlots(singleSelectedNode, engine.componentLoader)\n\t\t\tif (hasSlots) return null\n\t\t\tif (!hasEvents(singleSelectedNode, engine.componentLoader)) return null\n\t\t\treturn singleSelectedNode\n\t\t} else if (withFrameEvents(singleSelectedNode) || withFormInputEvents(singleSelectedNode)) {\n\t\t\treturn singleSelectedNode\n\t\t}\n\n\t\treturn null\n\t}\n\n\tfunction renderActionOutlet() {\n\t\tif (background || isViewOnly || isPreviewingLocaleOnCanvas) return null\n\n\t\tconst actionNode = actionOutletNode()\n\t\t// Hide action outlet when node or node ancestor is hidden or still\n\t\t// waiting for measurements\n\t\tif (!actionNode || !actionNode.cache.visible || isWaitingForMeasuredRect(actionNode)) return null\n\t\tconst size = tree.getRect(actionNode)\n\n\t\t// Hide action outlet when the layer is really tiny\n\t\tconst screenHeight = size.height * zoom\n\t\tif (screenHeight < 26) return null\n\n\t\tconst outletOrigin = tree.convertPointToCanvas(actionNode, {\n\t\t\tx: size.width,\n\t\t\ty: size.height / 2,\n\t\t})\n\n\t\treturn (\n\t\t\t<ActionOutlet\n\t\t\t\tkey={`navigation-outlet-${actionNode.id}`}\n\t\t\t\ttint={getTintColor(actionNode)}\n\t\t\t\tx={outletOrigin.x}\n\t\t\t\ty={outletOrigin.y}\n\t\t\t\tzoom={zoom}\n\t\t\t\ttoolIsActive={tool === Tools.Link}\n\t\t\t\tid={actionNode.id}\n\t\t\t\ttool={Tools.Link}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{renderSlots()}\n\t\t\t{renderNavigation()}\n\t\t\t{renderVariantLinks()}\n\t\t\t{renderGestureLinks()}\n\t\t\t{renderActionOutlet()}\n\t\t</>\n\t)\n}\n", "import {\n\tArrow,\n\tArrowDirection,\n\tarrowPoints,\n\tarrowSourceOffset,\n\tpreferredArrowDirection,\n\trectStartPoint,\n\ttopAncestor,\n} from \"document/components/canvas-hud/Arrow.tsx\"\nimport { PopoutContext } from \"document/components/chrome/shared/PopoutContext.ts\"\nimport { PopoutNavigation } from \"document/components/chrome/shared/PopoutNavigation.tsx\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isUserComponent } from \"document/models/CanvasTree/traits/utils/isUserComponent.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport { createPortal } from \"react-dom\"\nimport type { ToolProps } from \"../props.ts\"\nimport { getTintColor } from \"../utils/getTintColor.ts\"\nimport { LinkPopover } from \"./LinkPopover.tsx\"\nimport type { LinkTool } from \"./LinkTool.ts\"\n\nexport class Link extends React.Component<ToolProps<LinkTool>, { count: number }> {\n\toverride state = {\n\t\tcount: 0,\n\t}\n\n\tprivate popoutNavigation = new PopoutNavigation({\n\t\ttriggerRender: () => {\n\t\t\tthis.setState(({ count }) => {\n\t\t\t\treturn { count: count + 1 }\n\t\t\t})\n\t\t},\n\t})\n\n\tpopover = (endPoint: Point, linkSource: CanvasNode, linkTarget: CanvasNode | null) => {\n\t\tconst { myTool } = this.props\n\n\t\tif (!linkTarget) {\n\t\t\tif (myTool.activePopover) {\n\t\t\t\tmyTool.activePopover = null\n\t\t\t}\n\t\t\treturn null\n\t\t}\n\n\t\tconst popoverType = myTool.activePopover\n\t\tif (!popoverType) return null\n\n\t\treturn (\n\t\t\t<LinkPopover\n\t\t\t\tanchorX={endPoint.x}\n\t\t\t\tanchorY={endPoint.y}\n\t\t\t\tzoom={myTool.engine.stores.canvasStore.zoom}\n\t\t\t\tmyTool={myTool}\n\t\t\t\tlinkSourceId={linkSource.id}\n\t\t\t\tisComponent={isUserComponent(linkSource)}\n\t\t\t\tnavigation={this.popoutNavigation}\n\t\t\t\t_count={this.state.count}\n\t\t\t\tpopoverType={popoverType}\n\t\t\t\tscopeType={myTool.engine.stores.scopeStore.scopeType}\n\t\t\t/>\n\t\t)\n\t}\n\n\toverride render() {\n\t\tconst linkSource = this.props.myTool.getLinkSource()\n\t\tconst linkTarget = this.props.myTool.getLinkTarget()\n\n\t\tif (!linkSource) return null\n\t\tconst { tree, stores } = this.props.myTool.engine\n\t\tconst { canvasStore, mouseStore } = stores\n\t\tconst { canvasMousePosition } = mouseStore.latest\n\t\tconst { startDirection, endDirection, startPoint, endPoint, offsetPoint, isSelfLink } = calculateArrowPosition({\n\t\t\ttree,\n\t\t\tmouse: canvasMousePosition,\n\t\t\tsrcNode: linkSource,\n\t\t\tdestNode: linkTarget,\n\t\t\tzoom: canvasStore.zoom,\n\t\t})\n\n\t\tconst popoverContainer = document.getElementById(\"canvas_popover_portal\")\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Arrow\n\t\t\t\t\ttintColor={getTintColor(linkSource)}\n\t\t\t\t\tactive\n\t\t\t\t\tstartX={startPoint.x}\n\t\t\t\t\tstartY={startPoint.y}\n\t\t\t\t\tendX={endPoint.x}\n\t\t\t\t\tendY={endPoint.y}\n\t\t\t\t\tstartDirection={startDirection}\n\t\t\t\t\tendDirection={endDirection}\n\t\t\t\t\tstartOffsetX={offsetPoint.x}\n\t\t\t\t\tstartOffsetY={offsetPoint.y}\n\t\t\t\t\tbackground\n\t\t\t\t\tshowArrowHead\n\t\t\t\t\tisSelfLink={isSelfLink}\n\t\t\t\t\tzoom={canvasStore.zoom}\n\t\t\t\t/>\n\t\t\t\t{popoverContainer && (\n\t\t\t\t\t<PopoutContext.Provider value={this.popoutNavigation}>\n\t\t\t\t\t\t{createPortal(this.popover(endPoint, linkSource, linkTarget), popoverContainer)}\n\t\t\t\t\t</PopoutContext.Provider>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n}\n\nexport function calculateArrowPosition({\n\ttree,\n\tmouse = { x: 0, y: 0 },\n\tsrcNode,\n\tdestNode,\n\tstartDirectionOverride,\n\tendDirectionOverride,\n\tzoom = 1,\n}: {\n\ttree: CanvasTree\n\tmouse?: Point\n\tsrcNode: CanvasNode\n\tdestNode: CanvasNode | null\n\tstartDirectionOverride?: ArrowDirection\n\tendDirectionOverride?: ArrowDirection\n\tzoom?: number\n}) {\n\tlet preventArrowRender = false\n\tconst selfLinkYDistance = 25\n\tconst sourceCanvasRect = convertFrameToCanvas(tree, srcNode)\n\tconst sourceRect = tree.getRect(srcNode)\n\tconst sourceMatrix = srcNode.canvasMatrix()\n\tlet startDirection =\n\t\tstartDirectionOverride ?? preferredArrowDirection(sourceCanvasRect, { ...mouse, width: 1, height: 1 })\n\tlet endDirection =\n\t\tendDirectionOverride ?? preferredArrowDirection({ ...mouse, width: 1, height: 1 }, sourceCanvasRect)\n\n\tlet startPoint = rectStartPoint(sourceRect, sourceMatrix, startDirection)\n\tlet endPoint = mouse\n\tlet offsetPoint: Point = { x: 0, y: 0 }\n\n\tif (destNode) {\n\t\tconst destCanvasRect = convertFrameToCanvas(tree, destNode)\n\n\t\tstartDirection = startDirectionOverride ?? preferredArrowDirection(sourceCanvasRect, destCanvasRect)\n\t\tendDirection = endDirectionOverride ?? preferredArrowDirection(destCanvasRect, sourceCanvasRect)\n\t\tstartPoint = rectStartPoint(sourceRect, sourceMatrix, startDirection)\n\n\t\tif (srcNode.id === destNode.id) {\n\t\t\tendPoint = {\n\t\t\t\tx: startPoint.x,\n\t\t\t\ty: startPoint.y + Math.min(Math.min(selfLinkYDistance / zoom, selfLinkYDistance * 4), sourceRect.height / 3),\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstartDirection,\n\t\t\t\tendDirection,\n\t\t\t\tstartPoint,\n\t\t\t\tendPoint,\n\t\t\t\toffsetPoint,\n\t\t\t\tisSelfLink: true,\n\t\t\t\tpreventArrowRender,\n\t\t\t}\n\t\t}\n\n\t\tconst ancestor = topAncestor(tree, srcNode)\n\n\t\tif (ancestor?.id === destNode.id) {\n\t\t\tconst destRect = tree.getRect(destNode)\n\t\t\tconst destRectMaxY = destRect.y + destRect.height\n\n\t\t\tstartDirection = ArrowDirection.Right\n\t\t\tendDirection = ArrowDirection.Right\n\t\t\tstartPoint = rectStartPoint(sourceRect, sourceMatrix, startDirection)\n\t\t\tendPoint = rectStartPoint(destRect, destNode.canvasMatrix(), endDirection)\n\t\t\toffsetPoint = ancestor ? arrowSourceOffset(tree, ancestor, startPoint, startDirection) : { x: 0, y: 0 }\n\n\t\t\tconst curveDistance = Math.min(Math.min(selfLinkYDistance / zoom, selfLinkYDistance * 4), destRect.height / 3)\n\n\t\t\t// Flip the curve if the startpoint is over 75% of the parent height\n\t\t\tconst arrowDownEndYThreshold = destRect.y + destRect.height * 0.75\n\t\t\tconst curveDirection = startPoint.y + curveDistance < arrowDownEndYThreshold ? 1 : -1\n\n\t\t\tendPoint = {\n\t\t\t\tx: endPoint.x,\n\t\t\t\ty: startPoint.y + curveDistance * curveDirection,\n\t\t\t}\n\n\t\t\t// Prevent rendering of arrows if vertically out of bounds\n\t\t\tconst arrowMinY = Math.max(startPoint.y, endPoint.y)\n\t\t\tconst arrowMaxY = Math.min(startPoint.y, endPoint.y)\n\n\t\t\tif (arrowMinY < destRect.y || arrowMaxY > destRectMaxY) {\n\t\t\t\tpreventArrowRender = true\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tstartDirection,\n\t\t\t\tendDirection,\n\t\t\t\tstartPoint,\n\t\t\t\tendPoint,\n\t\t\t\toffsetPoint,\n\t\t\t\tisSelfLink: true,\n\t\t\t\tpreventArrowRender,\n\t\t\t}\n\t\t}\n\n\t\tconst { end, offset } = arrowPoints(\n\t\t\ttree,\n\t\t\tsourceRect,\n\t\t\tsrcNode.canvasMatrix(),\n\t\t\ttree.getRect(destNode),\n\t\t\tdestNode.canvasMatrix(),\n\t\t\tstartDirection,\n\t\t\ttopAncestor(tree, srcNode),\n\t\t)\n\t\tendPoint = end\n\t\toffsetPoint = offset\n\t}\n\n\treturn { startDirection, endDirection, startPoint, endPoint, offsetPoint, isSelfLink: false, preventArrowRender }\n}\n", "import { NavigationStack, ThemeOverride } from \"@framerjs/fresco\"\nimport { usePopoutContent } from \"document/components/chrome/shared/PopoutButton.tsx\"\nimport { PopoutContext } from \"document/components/chrome/shared/PopoutContext.ts\"\nimport type { PopoutNavigation } from \"document/components/chrome/shared/PopoutNavigation.tsx\"\nimport type { NavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport type { SetVariantAction } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { CanvasPopover } from \"../shared/CanvasPopover.tsx\"\nimport { InteractionConfig } from \"./InteractionConfig.tsx\"\nimport * as styles from \"./LinkPopover.styles.ts\"\nimport type { LinkTool, PopoverType } from \"./LinkTool.ts\"\n\ninterface Props extends InnerProps {\n\tanchorX: number\n\tanchorY: number\n\tzoom: number\n\tisComponent: boolean\n}\n\nexport const LinkPopover = ({\n\tanchorX,\n\tanchorY,\n\tzoom,\n\tmyTool,\n\tlinkSourceId,\n\tisComponent,\n\tnavigation,\n\tpopoverType,\n\tscopeType,\n\t_count,\n}: Props) => {\n\tconst { engine } = myTool\n\tconst onDismiss = engine.scheduler.wrapHandler(() => {\n\t\tengine.exitTool()\n\t\tnavigation.close()\n\t})\n\n\treturn (\n\t\t<CanvasPopover anchorX={anchorX * zoom} anchorY={anchorY * zoom} onDismiss={onDismiss}>\n\t\t\t<ThemeOverride mode={(isComponent || myTool.isVariantLink) && \"component\"}>\n\t\t\t\t<LinkPopoverInner\n\t\t\t\t\tmyTool={myTool}\n\t\t\t\t\tlinkSourceId={linkSourceId}\n\t\t\t\t\tnavigation={navigation}\n\t\t\t\t\tpopoverType={popoverType}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t_count={_count}\n\t\t\t\t/>\n\t\t\t</ThemeOverride>\n\t\t</CanvasPopover>\n\t)\n}\n\ninterface InnerProps {\n\tmyTool: LinkTool\n\tlinkSourceId: NodeID\n\tnavigation: PopoutNavigation\n\tpopoverType: PopoverType\n\tscopeType: ScopeType\n\t_count: number\n}\n\nconst LinkPopoverInner = React.memo(function LinkPopoverInner({\n\tmyTool,\n\tlinkSourceId,\n\tnavigation,\n\tpopoverType,\n\tscopeType,\n}: InnerProps) {\n\tconst handleConfirmNavigationInteraction = useEngineCallback(\n\t\t(nodeId: NodeID, eventKey: string, action: NavigationAction) => {\n\t\t\t// selectedLayerId should only be set to another layer than the link source when in smart component action workflow,\n\t\t\t// if an existing event is selected, the selected layer should be set to the instance (link source)\n\t\t\tif (nodeId === linkSourceId) {\n\t\t\t\tmyTool.updateNavigationTargetForSource(eventKey, action)\n\t\t\t} else {\n\t\t\t\tconst source = myTool.getLinkSource()\n\t\t\t\tconst target = myTool.getLinkTarget()\n\t\t\t\tif (!source || !target) return myTool.exitTool()\n\t\t\t\tmyTool.addEventHandlerToSmartComponentAndAssignAction(source, target, nodeId, eventKey, action)\n\t\t\t}\n\t\t},\n\t\t[myTool, linkSourceId],\n\t)\n\n\tconst handleConfirmSetVariantInteraction = useEngineCallback(\n\t\t(nodeId: NodeID, eventKey: string, action: SetVariantAction) => {\n\t\t\tif (!myTool.isVariantLink) return myTool.exitTool()\n\t\t\tif (nodeId === linkSourceId) {\n\t\t\t\tmyTool.updateVariantTargetForSource(eventKey, action)\n\t\t\t} else {\n\t\t\t\tconst source = myTool.getLinkSource()\n\t\t\t\tconst target = myTool.getLinkTarget()\n\t\t\t\tif (!source || !target) return myTool.exitTool()\n\t\t\t\tmyTool.addEventHandlerToSmartComponentAndAssignAction(source, target, nodeId, eventKey, action)\n\t\t\t}\n\t\t},\n\t\t[myTool, linkSourceId],\n\t)\n\n\tconst { present: presentInteraction } = usePopoutContent({\n\t\tid: \"interaction-config\",\n\t\tnavigationTitle: \"Interaction\",\n\t\tdisplayDivider: true,\n\t\tpopout: (\n\t\t\t<InteractionConfig\n\t\t\t\tmyTool={myTool}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tlinkSourceId={linkSourceId}\n\t\t\t\tonAddNavigation={handleConfirmNavigationInteraction}\n\t\t\t\tonAddSetVariant={handleConfirmSetVariantInteraction}\n\t\t\t/>\n\t\t),\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Only run on mount\n\tReact.useEffect(() => {\n\t\tpresentInteraction()\n\t}, [popoverType])\n\n\tif (navigation.stack.length < 1) return null\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t{navigation.isOpen() && (\n\t\t\t\t<PopoutContext.Provider value={navigation}>\n\t\t\t\t\t<NavigationStack\n\t\t\t\t\t\tstack={navigation.stack}\n\t\t\t\t\t\tcurrentIndex={navigation.currentStackIndex}\n\t\t\t\t\t\tonBack={navigation.goBack}\n\t\t\t\t\t/>\n\t\t\t\t</PopoutContext.Provider>\n\t\t\t)}\n\t\t</div>\n\t)\n})\n", "import { TooltipArrow } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport {\n\tpopoverAnimateState,\n\tpopoverExitState,\n\tpopoverInitialState,\n\tpopoverTransition,\n} from \"../utils/popoverAnimations.ts\"\nimport * as styles from \"./CanvasPopover.styles.ts\"\n\ntype AnchorPosition = \"start\" | \"center\" | \"end\"\n\n// Animation origins based on anchorAlignmentX (all from top since popover appears below anchor)\nconst originStartTop = { originX: 0, originY: 0 } // start \u2192 left edge at anchor\nconst originCenterTop = { originX: 0.5, originY: 0 } // center \u2192 center at anchor\nconst originEndTop = { originX: 1, originY: 0 }\n\ninterface Props {\n\t/** screen coordinates */\n\tanchorX: number\n\tanchorY: number\n\tanchorAlignmentX?: AnchorPosition\n\tchildren: React.ReactNode\n\tonDismiss: (event: MouseEvent | KeyboardEvent) => void\n\t/* If true, we would render an arrow pointing to the anchor. */\n\tshowArrow?: boolean\n\t/* If true, we would not apply any default styles to the popover. Use it if you simply want to render a popover with custom styling, while reusing the functionality provided by the component. */\n\tstyleless?: boolean\n\t/** If true, animate fade-in/out and scale-in/out based on anchorAlignmentX */\n\tanimate?: boolean\n}\n\nconst extraOffset = 8\n\nexport function CanvasPopover({\n\tanchorX,\n\tanchorY,\n\tanchorAlignmentX = \"center\",\n\tchildren,\n\tonDismiss,\n\tshowArrow = false,\n\tstyleless = false,\n\tanimate = false,\n}: Props) {\n\tReact.useEffect(() => {\n\t\tconst closeIfClickedOutside = (event: MouseEvent) => {\n\t\t\tif (!isPopoverElement(event.target)) {\n\t\t\t\t// This is a workaround to force blur the input inside the popover when unmount\n\t\t\t\tconst activeElement = document.activeElement\n\t\t\t\tif (isPopoverElement(activeElement)) {\n\t\t\t\t\tactiveElement.blur()\n\t\t\t\t}\n\n\t\t\t\tonDismiss(event)\n\t\t\t}\n\t\t}\n\t\tdocument.addEventListener(\"mousedown\", closeIfClickedOutside)\n\t\treturn () => document.removeEventListener(\"mousedown\", closeIfClickedOutside)\n\t}, [onDismiss])\n\n\tReact.useEffect(() => {\n\t\tconst closeIfPressEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === \"Escape\") {\n\t\t\t\tonDismiss(event)\n\t\t\t}\n\t\t}\n\t\tdocument.addEventListener(\"keydown\", closeIfPressEscape)\n\t\treturn () => document.removeEventListener(\"keydown\", closeIfPressEscape)\n\t}, [onDismiss])\n\n\tconst offset = showArrow ? dimensions.values.tooltipArrowHeight + extraOffset : 0\n\tconst position: React.CSSProperties = {\n\t\ttop: anchorY + offset,\n\t}\n\n\tswitch (anchorAlignmentX) {\n\t\tcase \"start\":\n\t\t\tposition.left = anchorX\n\t\t\tbreak\n\t\tcase \"center\":\n\t\t\tposition.left = anchorX - styles.popoverWidth / 2\n\t\t\tbreak\n\t\tcase \"end\":\n\t\t\tposition.left = anchorX - styles.popoverWidth\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(anchorAlignmentX)\n\t}\n\n\tconst animationProps = animate\n\t\t? {\n\t\t\t\tinitial: popoverInitialState,\n\t\t\t\tanimate: popoverAnimateState,\n\t\t\t\texit: popoverExitState,\n\t\t\t\ttransition: popoverTransition,\n\t\t\t\tstyle: { ...position, ...getAnimationOrigin(anchorAlignmentX) },\n\t\t\t}\n\t\t: {}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={cx(styles.popover, !styleless && styles.stylefulPopover)}\n\t\t\tstyle={position}\n\t\t\tonClick={stopPropagation}\n\t\t\tonMouseDown={stopPropagation}\n\t\t\tonMouseUp={stopPropagation}\n\t\t\trole=\"presentation\"\n\t\t\tdata-is-canvas-popover\n\t\t\t{...animationProps}\n\t\t>\n\t\t\t{showArrow && <TooltipArrow className={styles.arrow} direction=\"top\" />}\n\t\t\t{children}\n\t\t</motion.div>\n\t)\n}\n\nfunction isPopoverElement(element: unknown): element is HTMLElement | SVGElement {\n\tif (!(element instanceof HTMLElement || element instanceof SVGElement)) return false\n\treturn (\n\t\t!!element.closest(\"[data-is-canvas-popover]\") ||\n\t\t!!element.closest(\"[data-is-context-menu]\") ||\n\t\t!!element.closest(\"[data-backdrop]\")\n\t)\n}\n\nfunction stopPropagation(event: React.MouseEvent | React.KeyboardEvent) {\n\tevent.stopPropagation()\n}\n\nfunction getAnimationOrigin(alignment: AnchorPosition) {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn originStartTop\n\t\tcase \"center\":\n\t\t\treturn originCenterTop\n\t\tcase \"end\":\n\t\t\treturn originEndTop\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n", "import type { Transition } from \"framer-motion\"\n\nexport const popoverInitialState = { opacity: 0, scale: 0.96 }\nexport const popoverAnimateState = { opacity: 1, scale: 1 }\nexport const popoverExitState = popoverInitialState\nexport const popoverTransition = { type: \"spring\", duration: 0.15 } satisfies Transition\n", "import \"CanvasPopover.styles_1xra2cx.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const popoverWidth = dimensions.values.popoverWidth;\nexport const popover = \"popover_p1y8x7k7\";\nexport const stylefulPopover = \"stylefulPopover_se79z5x\";\nexport const arrow = \"arrow_a1rujljk\";", "import type { NavigateOptions, SerializedVerifiedActionControls } from \"@framerjs/framer-runtime\"\nimport { Stack } from \"@framerjs/fresco\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport {\n\tisNavigateAppearsFrom,\n\tisNavigateTransition,\n\tisNavigationAction,\n\tnavigationActionKeys,\n} from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport { isOpenURLAction, openURLActionKeys } from \"document/models/CanvasTree/actions/openURLActions.ts\"\nimport {\n\tisSetVariableValueAction,\n\tisValidScopeNodeForSetVariableValueAction,\n} from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport { isTriggerEventAction, triggerEventActionKeys } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport { isSetVariantAction, setVariantActionKeys } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCanvasPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tframeMouseEventKeys,\n\tframeTapEventKeys,\n\tisLegacyFrameEventKey,\n\tkeyDownKey,\n\twithFrameEvents,\n} from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { formEventKeys as frameFormEventKeys } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProp, ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport { getReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getLocaleVariable, getLocaleVariableControl } from \"document/utils/LocaleVariable.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useEffect, useMemo, useState } from \"react\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport type { Serializable } from \"utils/rpc/types.ts\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { KeyInputRow } from \"../codeComponentRows/KeyInputRow.tsx\"\nimport { NavigationTargetRow } from \"../codeComponentRows/NavigationTargetRow.tsx\"\nimport { TransitionControlPropRow } from \"../codeComponentRows/TransitionControlPropRow.tsx\"\nimport { EventActionVariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { isValidPropertyValueType } from \"../codeComponentRows/utils/isValidPropertyValue.ts\"\nimport { EventActionDelayRow } from \"./EventActionDelayRow.tsx\"\nimport { EventActionInputValueRow } from \"./EventActionInputValueRow.tsx\"\nimport { EventActionPauseOffscreenRow } from \"./EventActionPauseOffscreenRow.tsx\"\nimport { EventActionSetVariableValueRows } from \"./EventActionSetVariableValueRows.tsx\"\nimport { EventActionTriggerRow } from \"./EventActionTriggerRow.tsx\"\nimport { EventActionVariableRow } from \"./EventActionVariableRow.tsx\"\nimport { PageLinkingRowsForAction } from \"./PageLinkingRowsForAction.tsx\"\nimport type { EventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\n\nfunction controlValuesFromEventAction(eventAction: EventAction, eventKey: string) {\n\tconst result: { [key: string]: unknown } = { eventKey }\n\n\tconst controlKeys = Object.keys(eventAction.controls)\n\tfor (let i = 0, il = controlKeys.length; i < il; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: The key exists.\n\t\tconst key = controlKeys[i]!\n\t\tconst controlProp = eventAction.controls[key]\n\t\tif (!controlProp) continue\n\t\tif (!isValidPropertyValueType(controlProp.type, controlProp.value)) continue\n\t\tresult[key] = controlProp.value\n\t}\n\n\treturn result\n}\n\ninterface HiddenByControlName {\n\t[controlName: string]: boolean\n}\n\ninterface EventActionPropertiesProps {\n\tnode: CanvasNode\n\tnodeIds: NodeID[]\n\taction: EventAction\n\teventKey: string // \"onTap\"\n\tallEventKeys: string[]\n\tindex: number\n\tscopeType: ScopeType\n\tonChange: (update: EventAction, nodeId: NodeID, prop: string, index: number) => void\n\tonChangeTrigger: (nodeId: string, currentEventKey: string, newEventKey: string, index: number) => void\n\teventKeyToDisplayNameMap: EventKeyToDisplayNameMap | null\n\tshowTargetRow?: boolean\n\tshowTriggerRow?: boolean\n\tshowVariantRow?: boolean\n\tshowDelayRow?: boolean\n\tshowInputValueRow?: boolean\n\tdisplayTriggerAsSegmentedControl?: boolean\n}\n\nconst onUnsupportedImageUpload = () => {\n\tthrow Error(\"image uploads are not supported\")\n}\n\nexport function EventActionProperties({\n\tnode,\n\tnodeIds,\n\taction,\n\teventKey,\n\tallEventKeys,\n\tindex,\n\tscopeType,\n\tonChange,\n\tonChangeTrigger,\n\teventKeyToDisplayNameMap,\n\tshowTargetRow = true,\n\tshowTriggerRow = true,\n\tshowVariantRow = true,\n\tshowDelayRow = true,\n\tshowInputValueRow = false,\n\tdisplayTriggerAsSegmentedControl = false,\n}: EventActionPropertiesProps) {\n\tconst scopeNode = useEngineState(() => engine.tree.getScopeNodeFor(node), [node], EngineChange.Tree)\n\n\tconst [hiddenByControlName, setHiddenByControlName] = useState<HiddenByControlName | undefined>(undefined)\n\tconst lastHiddenByControlNameRef = React.useRef(hiddenByControlName)\n\tlastHiddenByControlNameRef.current = hiddenByControlName\n\tconst lastDisplayedEventKeys = React.useRef<string[][]>([])\n\n\tconst actionEntity = engine.componentLoader.actionForIdentifier(action.actionIdentifier)\n\tconst propertyControls = actionEntity ? actionEntity.properties : undefined\n\tconst nodeId = node.id\n\n\tconst supportsPageLinks = scopeType !== ScopeType.CanvasPage && scopeType !== ScopeType.DesignPage\n\n\tuseEffect(() => {\n\t\tif (propertyControls == null) return\n\t\tconst controlNames = Object.keys(propertyControls)\n\t\tconst actionProps = controlValuesFromEventAction(action, eventKey)\n\n\t\tconst controlsVisibility = engine.getControlsVisibility()\n\t\tassert(controlsVisibility, \"Controls visibility not available\")\n\n\t\tcontrolsVisibility\n\t\t\t.getHiddenStateForActionControls({\n\t\t\t\tactionIdentifier: action.actionIdentifier,\n\t\t\t\tcontrolNames,\n\t\t\t\tactionProps: actionProps as Record<string, Serializable>,\n\t\t\t})\n\t\t\t.then(hiddenState => {\n\t\t\t\tconst lastHiddenState = lastHiddenByControlNameRef.current\n\t\t\t\tif (!isShallowEqual(lastHiddenState, hiddenState)) {\n\t\t\t\t\tsetHiddenByControlName(hiddenState)\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tunhandledError(error)\n\t\t\t\tsetHiddenByControlName(\n\t\t\t\t\tcontrolNames.reduce<Record<string, false>>((result, controlName) => {\n\t\t\t\t\t\tresult[controlName] = false\n\t\t\t\t\t\treturn result\n\t\t\t\t\t}, {}),\n\t\t\t\t)\n\t\t\t})\n\t}, [nodeId, eventKey, index, action, propertyControls])\n\n\tconst isNavigateAction = isNavigationAction(action)\n\tconst changeHandler = React.useCallback(\n\t\t(controlProps: Record<string, ControlProp>) => {\n\t\t\tconst controls = { ...action.controls, ...controlProps }\n\t\t\tonChange({ ...action, controls }, nodeId, eventKey, index)\n\t\t\tif (isNavigateAction) {\n\t\t\t\tonChangeNavigateAction(controlProps)\n\t\t\t}\n\t\t},\n\t\t[action, isNavigateAction, onChange, nodeId, eventKey, index],\n\t)\n\n\tconst localeControlDescription = useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\treturn getLocaleVariableControl(getLocaleVariable(engine.tree))\n\t})\n\n\t// For the Set Locale action, we want to override the locale id control with the global locale\n\t// control definition. That way its automatically in sync with all of the available locales.\n\tconst actionControls = useMemo<SerializedVerifiedActionControls>(() => {\n\t\tif (actionEntity?.type !== \"action\") return {}\n\t\tconst controls = actionEntity?.properties ?? {}\n\n\t\tif (action.actionIdentifier !== HardCodedCodeIdentifier.setLocaleAction) return controls\n\t\tif (!localeControlDescription) return controls\n\n\t\tconst localeIdKey = \"localeId\"\n\t\tconst currentControl = controls[localeIdKey]\n\t\tassert(currentControl && currentControl.type === ControlType.Enum)\n\n\t\tconst result: SerializedVerifiedActionControls = {\n\t\t\t...controls,\n\t\t\t[localeIdKey]: localeControlDescription,\n\t\t}\n\t\treturn result\n\t}, [actionEntity, action.actionIdentifier, localeControlDescription])\n\n\tconst controlProps = getControlProps(actionControls, action.controls)\n\tconst reducedControlProp = getReducedControlProps(actionControls, [controlProps])\n\n\tconst reducedChangeHandler = (actionProp: string, getUpdate: (current: ControlProp) => ControlProp) => {\n\t\tconst current = controlProps[actionProp]\n\t\tassert(current)\n\t\tconst controlProp = getUpdate(current)\n\t\tchangeHandler({ [actionProp]: controlProp })\n\t}\n\n\tif (!actionEntity) {\n\t\treturn null\n\t}\n\n\tconst rows: JSX.Element[] = []\n\n\tObject.keys(actionControls).forEach(actionProp => {\n\t\tconst property = actionControls[actionProp]\n\n\t\tif (!property) return\n\t\tif (hiddenByControlName === undefined || hiddenByControlName[actionProp] === true) return\n\t\tif (isNavigationAction(action)) {\n\t\t\tif (actionProp === navigationActionKeys.target) return\n\t\t\tif (actionProp === navigationActionKeys.type) {\n\t\t\t\tif (showTargetRow) {\n\t\t\t\t\trows.push(\n\t\t\t\t\t\t<NavigationTargetRow\n\t\t\t\t\t\t\tkey=\"navigateTarget\"\n\t\t\t\t\t\t\ttree={engine.tree}\n\t\t\t\t\t\t\tprop={eventKey}\n\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\taction={action}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t/>,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif (isSetVariantAction(action)) {\n\t\t\tif (!showVariantRow && actionProp === setVariantActionKeys.type) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (actionProp === setVariantActionKeys.variantId) {\n\t\t\t\tif (showVariantRow) {\n\t\t\t\t\trows.push(\n\t\t\t\t\t\t<PanelRow key=\"variantInput\" title={Dictionary.Variant}>\n\t\t\t\t\t\t\t<EventActionVariantSelector\n\t\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\t\tactiveScope={engine.stores.scopeStore.active}\n\t\t\t\t\t\t\t\taction={action}\n\t\t\t\t\t\t\t\tprop={eventKey}\n\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>,\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 (actionProp === setVariantActionKeys.pauseOffscreen) {\n\t\t\t\trows.push(\n\t\t\t\t\t<EventActionPauseOffscreenRow\n\t\t\t\t\t\tnodeId={nodeId}\n\t\t\t\t\t\tprop={eventKey}\n\t\t\t\t\t\taction={action}\n\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t/>,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif (isTriggerEventAction(action) && actionProp === triggerEventActionKeys.id) {\n\t\t\trows.push(\n\t\t\t\t<EventActionVariableRow\n\t\t\t\t\tkey=\"triggerEvent\"\n\t\t\t\t\tnodeId={node.id}\n\t\t\t\t\taction={action}\n\t\t\t\t\tprop={eventKey}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tif (isOpenURLAction(action) && actionProp === openURLActionKeys.url) {\n\t\t\trows.push(\n\t\t\t\t<PageLinkingRowsForAction\n\t\t\t\t\tkey=\"pageLinkingRows\"\n\t\t\t\t\taction={action}\n\t\t\t\t\tsupportsPageLinks={supportsPageLinks}\n\t\t\t\t\tonChange={(controlProp, key) => changeHandler({ [key]: controlProp })}\n\t\t\t\t/>,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tif (actionProp === \"animation\" && property.type === ControlType.Transition) {\n\t\t\tconst controlProp = reducedControlProp[actionProp]\n\t\t\tassert(controlProp && controlProp.type === ControlType.Transition)\n\t\t\trows.push(\n\t\t\t\t<TransitionControlPropRow\n\t\t\t\t\tkey=\"transitionAnimation\"\n\t\t\t\t\tcontrolKey={actionProp}\n\t\t\t\t\tcontrol={property}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tonChange={(value, key) => changeHandler({ [key]: value })}\n\t\t\t\t\tshowRowTitle={false}\n\t\t\t\t/>,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\trows.push(\n\t\t\t<ControlPropRow\n\t\t\t\tkey={actionProp}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tcontrol={property}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tcontrolKey={actionProp}\n\t\t\t\tonChange={reducedChangeHandler}\n\t\t\t\tonImageUpload={onUnsupportedImageUpload}\n\t\t\t\tcontrolProp={reducedControlProp[actionProp]!}\n\t\t\t/>,\n\t\t)\n\t})\n\n\tif (isSetVariableValueAction(action) && isValidScopeNodeForSetVariableValueAction(scopeNode)) {\n\t\trows.push(\n\t\t\t<EventActionSetVariableValueRows\n\t\t\t\tkey=\"setVariableValueRows\"\n\t\t\t\taction={action}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tscopeNode={scopeNode}\n\t\t\t\tonControlPropsChange={changeHandler}\n\t\t\t\tonImageUpload={onUnsupportedImageUpload}\n\t\t\t/>,\n\t\t)\n\t}\n\n\tlet displayedEventKeys = [allEventKeys]\n\tconst isCanvasPage = isCanvasPageNode(scopeNode)\n\tconst isNodeWithFrameEvents = withFrameEvents(node)\n\tif (isNodeWithFrameEvents && showTriggerRow) {\n\t\tconst touchEventKeys: string[] = []\n\t\tconst otherEventKeys: string[] = []\n\t\tconst mouseEventKeys: string[] = []\n\t\tconst formEventKeys: string[] = []\n\n\t\tallEventKeys.forEach(key => {\n\t\t\tif (!shouldShowEventKey(key, eventKey)) return\n\n\t\t\tif ((frameTapEventKeys as string[]).includes(key)) {\n\t\t\t\ttouchEventKeys.push(key)\n\t\t\t} else if ((frameMouseEventKeys as string[]).includes(key)) {\n\t\t\t\tmouseEventKeys.push(key)\n\t\t\t} else if ((frameFormEventKeys as string[]).includes(key)) {\n\t\t\t\tformEventKeys.push(key)\n\t\t\t} else {\n\t\t\t\totherEventKeys.push(key)\n\t\t\t}\n\t\t})\n\n\t\tdisplayedEventKeys = [formEventKeys, touchEventKeys, otherEventKeys, mouseEventKeys]\n\t}\n\n\tif (isEqual(displayedEventKeys, lastDisplayedEventKeys.current)) {\n\t\tdisplayedEventKeys = lastDisplayedEventKeys.current\n\t} else {\n\t\tlastDisplayedEventKeys.current = displayedEventKeys\n\t}\n\n\tconst showKeyRow = isNodeWithFrameEvents && eventKey === keyDownKey\n\n\treturn (\n\t\t<Stack gap={0}>\n\t\t\t{showTriggerRow && (\n\t\t\t\t<EventActionTriggerRow\n\t\t\t\t\tnodeId={nodeId}\n\t\t\t\t\teventKey={eventKey}\n\t\t\t\t\teventKeys={displayedEventKeys}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tonChange={onChangeTrigger}\n\t\t\t\t\teventKeyToDisplayNameMap={eventKeyToDisplayNameMap}\n\t\t\t\t\tisNodeWithFrameEvents={isNodeWithFrameEvents}\n\t\t\t\t\tisCanvasPage={isCanvasPage}\n\t\t\t\t\tdisplaySegmentedControl={displayTriggerAsSegmentedControl}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{showInputValueRow && (\n\t\t\t\t<EventActionInputValueRow nodeId={nodeId} prop={eventKey} action={action} index={index} onChange={onChange} />\n\t\t\t)}\n\t\t\t{showKeyRow && <KeyInputRow nodeId={node.id} action={action} prop={eventKey} index={index} onChange={onChange} />}\n\t\t\t{showDelayRow && (\n\t\t\t\t<EventActionDelayRow\n\t\t\t\t\tnodeId={nodeId}\n\t\t\t\t\tprop={eventKey}\n\t\t\t\t\taction={action}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\tisNodeWithFrameEvents={isNodeWithFrameEvents}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{rows}\n\t\t</Stack>\n\t)\n}\n\nconst transitionKey: keyof NavigateOptions = \"transition\"\nconst appearsFromKey: keyof NavigateOptions = \"appearsFrom\"\n\nfunction onChangeNavigateAction(controlProps: ControlProps) {\n\tconst { documentSettingsStore } = engine.stores\n\tconst transition = controlProps[transitionKey]?.value\n\tif (isNavigateTransition(transition)) {\n\t\tdocumentSettingsStore.defaultTransition = transition\n\t}\n\tconst appearsFrom = controlProps[appearsFromKey]?.value\n\tif (isNavigateAppearsFrom(appearsFrom)) {\n\t\tdocumentSettingsStore.defaultAppearsFrom = appearsFrom\n\t}\n}\n\nfunction shouldShowEventKey(key: string, eventKey: string) {\n\t// Don't hide keys in use\n\tif (key === eventKey) return true\n\t// Always show onMouseEnter/onMouseLeave\n\tif (key === \"onMouseEnter\" || key === \"onMouseLeave\") {\n\t\treturn true\n\t}\n\t// Hide legacy frame event keys\n\treturn !isLegacyFrameEventKey(key)\n}\n", "export function isXboxLayout(gamepadId: string) {\n\tif (gamepadId.match(/xbox/iu)) return true\n\treturn false\n}\n\nexport function isPlaystationLayout(gamepadId: string) {\n\tif (gamepadId.match(/Wireless Controller/i)) return true\n\tif (gamepadId.match(/ps[1-5|]/i)) return true\n\tif (gamepadId.match(/playstation/i)) return true\n\treturn false\n}\n", "import { truncateWithEllipsis, useReadOnly } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { isPlaystationLayout, isXboxLayout } from \"document/components/utils/gamepad.ts\"\nimport type { EventAction, RecordedGamepadKey, RecordedKeyboardKey } from \"document/models/EventAction.ts\"\nimport { isRecordedGamepadKey } from \"document/models/EventAction.ts\"\nimport type { FramerGamepadKeydownData } from \"library/modules/useGamepad.ts\"\nimport { GamepadContext, isFramerGamepadKeydownData } from \"library/modules/useGamepad.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./KeyInputRow.styles.ts\"\n\ninterface Props {\n\tnodeId: string\n\tindex: number\n\tprop: string\n\taction: EventAction\n\tonChange: (update: EventAction, nodeId: string, prop: string, index: number) => void\n}\n\nexport function shortcutKeyForAction(action: EventAction): string | undefined {\n\tif (!action.meta?.key) return undefined\n\treturn keyInputDisplayValue(action.meta.key)\n}\n\nconst keyMap: Record<string, string> = {\n\t\"8\": \"\u232B\", // backspace\n\t\"9\": \"\u21E5\", // tab\n\t\"13\": \"\u21A9\", // enter\n\t\"20\": \"\u21EA\", // capslock\n\t\"27\": \"Esc\", // escape\n\t\"32\": \"\u23B5\", // space\n\t\"37\": \"\u2190\", // arrow left\n\t\"38\": \"\u2191\", // arrow up\n\t\"39\": \"\u2192\", // arrow right\n\t\"40\": \"\u2193\", // arrow down\n\t\"107\": \"=\", // add\n\t\"109\": \"-\", // subtract\n\t\"186\": \";\", // semicolon\n\t\"187\": \"=\", // equals\n\t\"188\": \",\", // comma\n\t\"189\": \"-\", // dash\n\t\"190\": \".\", // period\n\t\"191\": \"/\", // slash\n\t\"192\": \"`\", // back quote\n\t\"219\": \"[\", // open bracket\n\t\"220\": \"\\\\\", // backslash\n\t\"221\": \"]\", // close bracket\n\t\"222\": \"'\", // single quote\n}\n\nconst xboxGamepadKeyMap = {\n\t\"Axis 0-\": \"LStick Left\",\n\t\"Axis 0+\": \"LStick Right\",\n\t\"Axis 1-\": \"LStick Up\",\n\t\"Axis 1+\": \"LStick Down\",\n\t\"Axis 2-\": \"RStick Left\",\n\t\"Axis 2+\": \"RStick Right\",\n\t\"Axis 3-\": \"RStick Up\",\n\t\"Axis 3+\": \"RStick Down\",\n\t\"Button 0\": \"A\",\n\t\"Button 1\": \"B\",\n\t\"Button 2\": \"X\",\n\t\"Button 3\": \"Y\",\n\t\"Button 4\": \"LB\",\n\t\"Button 5\": \"RB\",\n\t\"Button 6\": \"LT\",\n\t\"Button 7\": \"RT\",\n\t\"Button 8\": \"View\",\n\t\"Button 9\": \"Menu\",\n\t\"Button 10\": \"LStick Pressed\",\n\t\"Button 11\": \"RStick Pressed\",\n\t\"Button 12\": \"DPad Up\",\n\t\"Button 13\": \"DPad Down\",\n\t\"Button 14\": \"DPad Left\",\n\t\"Button 15\": \"DPad Right\",\n\t\"Button 16\": \"Power\",\n}\n\nconst playstationGamepadKeyMap = {\n\t\"Axis 0-\": \"LStick Left\",\n\t\"Axis 0+\": \"LStick Right\",\n\t\"Axis 1-\": \"LStick Up\",\n\t\"Axis 1+\": \"LStick Down\",\n\t\"Axis 2-\": \"RStick Left\",\n\t\"Axis 2+\": \"RStick Right\",\n\t\"Axis 3-\": \"RStick Up\",\n\t\"Axis 3+\": \"RStick Down\",\n\t\"Button 0\": \"\u2715 (Cross)\",\n\t\"Button 1\": \"\u25CB (Circle)\",\n\t\"Button 2\": \"\u25A2 (Square)\",\n\t\"Button 3\": \"\u25B3 (Triangle)\",\n\t\"Button 4\": \"L1\",\n\t\"Button 5\": \"R1\",\n\t\"Button 6\": \"L2\",\n\t\"Button 7\": \"R2\",\n\t\"Button 8\": \"Share\",\n\t\"Button 9\": \"Options\",\n\t\"Button 10\": \"LStick Pressed\",\n\t\"Button 11\": \"RStick Pressed\",\n\t\"Button 12\": \"DPad Up\",\n\t\"Button 13\": \"DPad Down\",\n\t\"Button 14\": \"DPad Left\",\n\t\"Button 15\": \"DPad Right\",\n\t\"Button 16\": \"PS Button\",\n\t\"Button 17\": \"Touchpad\",\n}\n\nfunction getGamepadKeyMap(gamepadId?: string) {\n\tif (!gamepadId) return null\n\tif (isXboxLayout(gamepadId)) return xboxGamepadKeyMap\n\tif (isPlaystationLayout(gamepadId)) return playstationGamepadKeyMap\n\treturn null\n}\n\nfunction characterFromKeyCode(keyCode: number) {\n\t// We use keyCode for the label because it isn't affected by the modifiers,\n\t// and is consistent across different language keyboards.\n\tlet charCode = keyCode\n\t// String.fromCharCode is expecting ASCII code, which is different from the\n\t// key code. ASCII code allocated to numbers are 48~57, so numpad keys (\n\t// 96~105) need to be shifted by 48 to get the right ASCII code.\n\tif (keyCode >= 96 && keyCode <= 105) {\n\t\tcharCode -= 48\n\t}\n\n\treturn String.fromCharCode(charCode)\n}\n\nfunction keyInputDisplayValue(keyInput: RecordedKeyboardKey | RecordedGamepadKey | null) {\n\tif (keyInput === null) return undefined\n\tif (isRecordedGamepadKey(keyInput)) {\n\t\tif (keyInput.mapping !== \"standard\") return keyInput.key\n\n\t\tconst gamepadKeyMap = getGamepadKeyMap(keyInput.gamepadId)\n\t\treturn gamepadKeyMap?.[keyInput.key] ?? keyInput.key\n\t}\n\n\tif (keyInput.keyCode === undefined) return undefined\n\n\tlet displayValue = \"\"\n\tif (keyInput.metaKey) displayValue += \"\u2318\"\n\tif (keyInput.ctrlKey) displayValue += \"\u2303\"\n\tif (keyInput.shiftKey) displayValue += \"\u21E7\"\n\tif (keyInput.altKey) displayValue += \"\u2325\"\n\n\tconst keyMapValue = keyMap[keyInput.keyCode]\n\n\tconst displayKeyCode = keyMapValue || characterFromKeyCode(keyInput.keyCode)\n\tdisplayValue += displayKeyCode\n\n\treturn displayValue\n}\n\nexport function KeyInputRow(props: Props) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst onKeyUp = React.useCallback((event: React.KeyboardEvent) => {\n\t\tevent.preventDefault()\n\t}, [])\n\n\t// Keep a copy of props on a ref so that we never invalidate the recordKey\n\t// callback, allowing us to unregister the callback on the gamepad context\n\t// by identity.\n\tconst latestPropsRef = React.useRef<Props>(props)\n\tReact.useEffect(() => {\n\t\tlatestPropsRef.current = props\n\t}, [props])\n\n\tconst recordKey = React.useCallback(\n\t\t(keyEventOrData: React.KeyboardEvent | FramerGamepadKeydownData) => {\n\t\t\tconst { onChange, nodeId, index, prop, action } = latestPropsRef.current\n\t\t\tif (isReadOnly) return\n\n\t\t\tlet newKeyInput: RecordedKeyboardKey | RecordedGamepadKey | undefined = undefined\n\t\t\tif (isFramerGamepadKeydownData(keyEventOrData)) {\n\t\t\t\tif (keyEventOrData.inputs.length === 0) return\n\t\t\t\tnewKeyInput = getNewGamepadInput(keyEventOrData)\n\t\t\t} else {\n\t\t\t\tkeyEventOrData.preventDefault()\n\t\t\t\tnewKeyInput = getNewKeyboardInput(keyEventOrData)\n\t\t\t}\n\n\t\t\tif (!newKeyInput) return\n\n\t\t\tconst updatedAction: EventAction = {\n\t\t\t\t...action,\n\t\t\t\tmeta: {\n\t\t\t\t\t...action.meta,\n\t\t\t\t\tkey: newKeyInput,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tonChange(updatedAction, nodeId, prop, index)\n\t\t},\n\t\t[isReadOnly],\n\t)\n\n\tconst gamepadContext = React.useContext(GamepadContext)\n\tconst label = shortcutKeyForAction(props.action)\n\n\t// Unbind the listener when the Row is unmounted.\n\tReact.useEffect(() => () => gamepadContext.unregister(recordKey), [recordKey, gamepadContext])\n\n\treturn (\n\t\t<PanelRow title=\"Key\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<div className={styles.keyInputWrapper}>\n\t\t\t\t\t<input\n\t\t\t\t\t\t// only auto-focus the input if no key has been added\n\t\t\t\t\t\tautoFocus={label === undefined}\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tplaceholder=\"Press Key\u2026\"\n\t\t\t\t\t\t// set a fallback value to keep the component controlled\n\t\t\t\t\t\tvalue={label ?? \"\"}\n\t\t\t\t\t\treadOnly // resolve warning on input without onChange\n\t\t\t\t\t\tonKeyDown={recordKey}\n\t\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\t\tonFocus={() => gamepadContext.register(recordKey)}\n\t\t\t\t\t\tonBlur={() => gamepadContext.unregister(recordKey)}\n\t\t\t\t\t\tclassName={cx(truncateWithEllipsis, styles.keyInput)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\nfunction isValidValue(keyCode: number): keyCode is number {\n\tconst keyMapValue = keyMap[keyCode]\n\tconst charCodeValue = characterFromKeyCode(keyCode)\n\tconst value = keyMapValue || charCodeValue\n\n\treturn value.trim().length > 0\n}\n\nfunction isValidKeyboardKey(event: React.KeyboardEvent): boolean {\n\t// Check only general keys and numpad keys, ignore modifiers\n\t// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/location\n\tif (event.location !== 0 && event.location !== 3) return false\n\tif (!isValidValue(event.keyCode)) return false\n\treturn true\n}\n\nfunction getNewKeyboardInput(event: React.KeyboardEvent): RecordedKeyboardKey | undefined {\n\tif (!isValidKeyboardKey(event)) return\n\n\treturn {\n\t\tcode: event.nativeEvent.code,\n\t\tkey: event.key,\n\t\t// eslint-disable-next-line no-restricted-syntax -- Used only for formatting a display value of the shortcut\n\t\tmetaKey: event.metaKey,\n\t\tctrlKey: event.ctrlKey,\n\t\taltKey: event.altKey,\n\t\tshiftKey: event.shiftKey,\n\t\tkeyCode: event.keyCode,\n\t}\n}\n\nfunction getNewGamepadInput(data: FramerGamepadKeydownData): RecordedGamepadKey | undefined {\n\treturn {\n\t\tkey: data.inputs[0],\n\t\tgamepadId: data.id,\n\t\tmapping: data.mapping,\n\t}\n}\n", "import \"KeyInputRow.styles_maonu5.wyw.css\"; export const keyInputWrapper = \"keyInputWrapper_ktrqp2c\";\nexport const keyInput = \"keyInput_k1htnhsu\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Slot } from \"document/components/chrome/properties/codeComponentRows/utils/Slot.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport { updatedNavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props {\n\ttree: CanvasTree\n\tnode: CanvasNode\n\taction: NavigationAction\n\tprop: string\n\tindex: number\n\tonChange: (update: NavigationAction, nodeId: string, prop: string, index: number) => void\n}\n\nexport class NavigationTargetRow extends React.Component<Props> {\n\tonChange = (action: NavigationAction) => {\n\t\tconst { onChange, node, prop, index } = this.props\n\t\tonChange(action, node.id, prop, index)\n\t}\n\n\tonPrevious = () => {\n\t\tthis.onChange(\n\t\t\tupdatedNavigationAction(this.props.action, {\n\t\t\t\ttype: { type: ControlType.Enum, value: \"previous\" },\n\t\t\t}),\n\t\t)\n\t}\n\n\tonChangeTarget = (id: NodeID) => {\n\t\tthis.onChange(\n\t\t\tupdatedNavigationAction(this.props.action, {\n\t\t\t\ttype: { type: ControlType.Enum, value: \"next\" },\n\t\t\t\ttarget: { type: ControlType.ComponentInstance, value: id },\n\t\t\t}),\n\t\t)\n\t}\n\n\toverride render() {\n\t\tconst { tree, node, action } = this.props\n\n\t\tconst type = action.controls.type?.value\n\t\tconst target = action.controls.target?.value\n\n\t\tconst slotOptions = Slot.optionsForNode(tree, engine.componentLoader, engine.stores.scopeStore.active, node)\n\t\tconst slotOptionIds = slotOptions.map(option => option.id)\n\t\tconst targetInSlotOptions = slotOptionIds.some(id => target === id)\n\n\t\tconst goBackSelected = type === \"previous\"\n\t\tconst nothingSelected = !goBackSelected && !targetInSlotOptions\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Target\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\ttitle={Dictionary.SelectEllipsis}\n\t\t\t\t\t\t\tselected={nothingSelected}\n\t\t\t\t\t\t\tvisible={nothingSelected}\n\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem type=\"divider\" />\n\t\t\t\t\t\t<PopupButtonItem title=\"Back to Previous\" selected={goBackSelected} onSelect={this.onPrevious} />\n\t\t\t\t\t\t<PopupButtonItem type=\"divider\" />\n\t\t\t\t\t\t{slotOptions.length > 0 ? (\n\t\t\t\t\t\t\tslotOptions.map(slotOption => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\tkey={slotOption.id}\n\t\t\t\t\t\t\t\t\t\tidentifier={slotOption.id}\n\t\t\t\t\t\t\t\t\t\ttitle={slotOption.resolveValue(\"name\") || getDefaultName(engine.componentLoader, slotOption)}\n\t\t\t\t\t\t\t\t\t\tselected={!goBackSelected && slotOption.id === target}\n\t\t\t\t\t\t\t\t\t\tonSelect={this.onChangeTarget}\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\t\t<PopupButtonItem title=\"No Targets Available\" />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport type { PanelRowResetReplicaOverridesOptions } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport {\n\tdefaultDurationBasedSpringTransition,\n\tisPartialTransition,\n\tisTransition,\n\ttoVekterTransition,\n} from \"document/models/Transition.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedTransitionControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ControlType, type TransitionControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { useCallback } from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { TransitionPopoutButton } from \"../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { getVariableFromInfo } from \"../useVariableProviderInfo.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\nconst transitionTypes: Transition[\"type\"][] = [false, \"tween\", \"spring\"]\n\ninterface Props extends PanelRowResetReplicaOverridesOptions {\n\tcontrolKey: string\n\tcontrol: TransitionControlDescription\n\tcontrolProp: ReducedTransitionControlProp\n\tonChange: (value: ControlProp, prop: string) => void\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n\tsortable?: boolean\n\tpopoutId?: string\n\tsupportsVariables?: boolean\n\t/* Hide the row title, but preserve the navigation stack title and the double-column layout */\n\tshowRowTitle?: boolean\n}\n\nexport function TransitionControlPropRow({\n\tcontrol,\n\tcontrolKey,\n\tcontrolProp,\n\tonChange,\n\tonContextMenu,\n\tsortable,\n\tshowRowTitle = true,\n\tpopoutId,\n\tsupportsVariables = false,\n\t// Replica override options\n\ttraitTypes,\n\ttraitTypeKeys,\n}: Props) {\n\tconst { value } = controlProp\n\n\tconst title = sortable ? undefined : control.title || titleCase(controlKey)\n\tconst defaultValue = getDefaultTransitionControlValue(control)\n\n\tconst changeValue = useCallback(\n\t\t(newValue: Transition | VariableReference) => {\n\t\t\tonChange({ type: control.type, value: newValue }, controlKey)\n\t\t},\n\t\t[onChange, control, controlKey],\n\t)\n\n\tconst resetToDefault = useCallback(() => {\n\t\tif (defaultValue) {\n\t\t\tchangeValue(defaultValue)\n\t\t}\n\t}, [changeValue, defaultValue])\n\n\tconst copy = useCallback(() => {\n\t\tif (!isTransition(value)) return\n\t\tClipboard.copyAnimationTransition(value).catch(unhandledError)\n\t}, [value])\n\n\tconst paste = useCallback(async () => {\n\t\tconst clipboardTransition = await Clipboard.getAnimationTransition()\n\t\tif (clipboardTransition) {\n\t\t\tchangeValue(clipboardTransition)\n\t\t}\n\t}, [changeValue])\n\n\tconst pasteEnabled = useCallback(async () => {\n\t\tconst clipboardTransition = await Clipboard.getAnimationTransition()\n\t\treturn !!clipboardTransition\n\t}, [])\n\n\tconst createVariable = useCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst name = control.title || titleCase(controlKey)\n\t\t\tconst initialValue = isPartialTransition(value) ? toVekterTransition(value) : defaultDurationBasedSpringTransition\n\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Transition,\n\t\t\t\tname,\n\t\t\t\tinitialValue,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\n\t\t\tchangeValue(variableRef)\n\t\t},\n\t\t[changeValue, value, control, controlKey],\n\t)\n\n\tconst removeDynamicValue = useCallback(() => {\n\t\tif (!isVariableReference(value)) return\n\n\t\tconst variable = getVariableFromInfo(value, engine.stores.treeStore.variableProviderInfo)\n\t\tif (variable?.type === ControlType.Transition && variable.initialValue) {\n\t\t\tchangeValue(toVekterTransition(variable.initialValue))\n\t\t} else {\n\t\t\tchangeValue(defaultDurationBasedSpringTransition)\n\t\t}\n\t}, [changeValue, value])\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={showRowTitle ? title : \" \"} // use a space to keep the double column layout\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonCopy={sortable ? undefined : copy}\n\t\t\tonPaste={sortable ? undefined : paste}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\tonResetToDefault={!sortable ? resetToDefault : undefined}\n\t\t\tresetToDefaultEnabled={!!defaultValue && !isEqual(defaultValue, value)}\n\t\t\ttraitTypes={traitTypes}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\twithReorderControl={sortable}\n\t\t\tvariableType={supportedVariableTypesByControlType[ControlType.Transition]}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\tonSelectVariable={changeValue}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t>\n\t\t\t{isVariableReference(value) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[ControlType.Transition]}\n\t\t\t\t\treference={value}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={title || \"Animation\"}\n\t\t\t\t\ttransition={value}\n\t\t\t\t\tonChange={changeValue}\n\t\t\t\t\twrapperStyle={sortable ? { flexGrow: 1 } : undefined}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tshowType={transitionTypes}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nexport function getDefaultTransitionControlValue(control: TransitionControlDescription): Transition | undefined {\n\treturn isPartialTransition(control.defaultValue) ? toVekterTransition(control.defaultValue) : undefined\n}\n", "import { setVariantActionControlTypes } from \"@framerjs/framer-runtime\"\nimport { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { SetVariantAction } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport { updatedSetVariantAction } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { CanvasNode, LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport React from \"react\"\nimport type { VariantOption } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface VariantSelectorProps {\n\ttopLevelVariants: VariantOption[]\n\tselection: Set<NodeID | undefined>\n\tonSelect: (variantId: NodeID) => void\n\tenabled?: boolean\n}\n\nexport function VariantSelector(props: VariantSelectorProps) {\n\tconst { topLevelVariants, selection, enabled, onSelect } = props\n\tconst nothingSelected = topLevelVariants.every(variant => !selection.has(variant.id))\n\treturn (\n\t\t<div style={doubleColumn}>\n\t\t\t<PopupButton enabled={enabled}>\n\t\t\t\t<PopupButtonItem title=\"Set Variant\u2026\" selected={nothingSelected} visible={nothingSelected} enabled={false} />\n\t\t\t\t<PopupButtonItem type=\"divider\" />\n\t\t\t\t{topLevelVariants.map(variant => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={variant.id}\n\t\t\t\t\t\tidentifier={variant.id}\n\t\t\t\t\t\ttitle={variant.title}\n\t\t\t\t\t\tselected={selection.has(variant.id)}\n\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</div>\n\t)\n}\n\ninterface Props {\n\tnode: CanvasNode\n\tactiveScope: LoadedScopeNode\n\taction: SetVariantAction\n\tprop: string\n\tindex: number\n\tonChange: (update: SetVariantAction, nodeId: string, prop: string, index: number) => void\n}\n\nexport class EventActionVariantSelector extends React.Component<Props> {\n\tonSelect = (id: NodeID) => {\n\t\tconst { onChange, node, prop, index } = this.props\n\t\tconst action = updatedSetVariantAction(this.props.action, {\n\t\t\tvariantId: { type: setVariantActionControlTypes.variantId, value: id },\n\t\t})\n\n\t\tonChange(action, node.id, prop, index)\n\t}\n\n\toverride render() {\n\t\tconst { action, activeScope } = this.props\n\n\t\tif (!isSmartComponentNode(activeScope)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst selection = new Set([action.controls.variantId.value])\n\t\tconst topLevelVariants = activeScope.getTopLevelVariants().map(variant => {\n\t\t\treturn {\n\t\t\t\tid: variant.id,\n\t\t\t\ttitle: variant.resolveValue(\"name\") ?? Dictionary.Variant,\n\t\t\t}\n\t\t})\n\n\t\treturn <VariantSelector topLevelVariants={topLevelVariants} selection={selection} onSelect={this.onSelect} />\n\t}\n}\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { appearKey } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport React from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\n\nconst min = 0\nconst step = 0.1\n\ninterface Props {\n\tnodeId: string\n\tprop: string\n\taction: EventAction\n\tindex: number\n\tonChange: (update: EventAction, nodeId: string, prop: string, index: number) => void\n\tisNodeWithFrameEvents: boolean\n}\n\nexport const EventActionDelayRow = ({ nodeId, prop, action, index, onChange, isNodeWithFrameEvents }: Props) => {\n\tconst inputRef = React.useRef<HTMLInputElement | null>(null)\n\n\t// Auto-focus the delay row when the appear trigger is selected and there's\n\t// no delay added already\n\tReact.useEffect(() => {\n\t\tif (!(isNodeWithFrameEvents && prop === appearKey)) return\n\t\tif (action.meta?.delay !== undefined) return\n\t\tinputRef.current?.focus()\n\t}, [prop, isNodeWithFrameEvents, action])\n\n\tconst handleChange = (value: number) => {\n\t\tconst newAction = { ...action, meta: { ...action.meta, delay: value } }\n\t\tonChange(newAction, nodeId, prop, index)\n\t}\n\n\tconst delay = action.meta?.delay ?? 0\n\n\treturn (\n\t\t<PanelRow title=\"Delay\">\n\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\tref={inputRef}\n\t\t\t\tvalue={delay}\n\t\t\t\tdefaultValue={0}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tmin={min}\n\t\t\t\tstep={step}\n\t\t\t\tlabel=\"S\"\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { EventAction, EventActionInputValuePredicate } from \"document/models/EventAction.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\n\ninterface Props {\n\tnodeId: string\n\tprop: string\n\taction: EventAction\n\tindex: number\n\tonChange: (update: EventAction, nodeId: string, prop: string, index: number) => void\n}\n\nconst anyFormValuePredicate = \"any\"\ntype EventActionPredicate = EventActionInputValuePredicate | typeof anyFormValuePredicate\n\nconst formValueOptions: EventActionPredicate[] = [anyFormValuePredicate, \"empty\", \"set\"]\nconst formValueTitles: Record<EventActionPredicate, string> = {\n\tany: \"Any\",\n\tempty: \"Is Empty\",\n\tset: \"Is Set\",\n}\n\nfunction titleForOption(option: EventActionPredicate): string {\n\treturn formValueTitles[option]\n}\n\nfunction valueForOption(option: EventActionPredicate): EventActionInputValuePredicate | undefined {\n\treturn option === anyFormValuePredicate ? undefined : option\n}\n\nexport const EventActionInputValueRow = ({ nodeId, prop, action, index, onChange }: Props) => {\n\tconst handleChange = (value: EventActionPredicate) => {\n\t\tonChange({ ...action, meta: { ...action.meta, inputValue: valueForOption(value) } }, nodeId, prop, index)\n\t}\n\n\tconst inputValue = action.meta?.inputValue\n\n\treturn (\n\t\t<PanelRow title=\"Value\">\n\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t{formValueOptions.map(value => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={value}\n\t\t\t\t\t\t\tidentifier={value}\n\t\t\t\t\t\t\ttitle={titleForOption(value)}\n\t\t\t\t\t\t\tselected={inputValue === value}\n\t\t\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props {\n\tnodeId: string\n\tprop: string\n\taction: EventAction\n\tindex: number\n\tonChange: (update: EventAction, nodeId: string, prop: string, index: number) => void\n}\n\nexport const EventActionPauseOffscreenRow = ({ nodeId, prop, action, index, onChange }: Props) => {\n\tconst handleChange = (value: boolean) => {\n\t\tconst newAction = {\n\t\t\t...action,\n\t\t\tcontrols: {\n\t\t\t\t...action.controls,\n\t\t\t\tpauseOffscreen: { type: ControlType.Boolean, value },\n\t\t\t},\n\t\t}\n\t\tonChange(newAction, nodeId, prop, index)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Off Screen\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier=\"play\"\n\t\t\t\t\ttitle=\"Play\"\n\t\t\t\t\tselected={!action.controls.pauseOffscreen?.value}\n\t\t\t\t\tonSelect={() => handleChange(false)}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier=\"pause\"\n\t\t\t\t\ttitle=\"Pause\"\n\t\t\t\t\tselected={!!action.controls.pauseOffscreen?.value}\n\t\t\t\t\tonSelect={() => handleChange(true)}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport type { SetVariableValueOptions } from \"@framerjs/framer-runtime\"\nimport { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport {\n\ttype SetVariableActionSupportedVariableDefinition,\n\ttype SetVariableValueAction,\n\tisValidVariableForSetVariableValueAction,\n} from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport type { NodeID, ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype VariableID,\n\ttype WithVariables,\n\tcontrolDescriptionFromVariable,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProp } from \"document/models/controlProps/getControlProps.ts\"\nimport {\n\tgetReducedControlPropForControl,\n\treduceControlProp,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useMemo } from \"react\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { ComputedValuesSupportedProvider, PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { getSuggestedControlPropForSetVariableValueAction } from \"./utils/displayActionsMenu.ts\"\n\ninterface EventActionSetVariableValueRowsProps {\n\taction: SetVariableValueAction\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\tscopeNode: ScopeNode & WithVariables\n\tonControlPropsChange(controlProps: Record<string, ControlProp>): void\n\tonImageUpload(upload: Promise<AssetReference | null>, controlKey: string): void\n}\n\nexport function EventActionSetVariableValueRows({\n\taction,\n\tnodeIds,\n\tscopeType,\n\tscopeNode,\n\tonControlPropsChange,\n\tonImageUpload,\n}: EventActionSetVariableValueRowsProps) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst supportedVariables = useMemo(\n\t\t() => scopeNode.variables.filter(isValidVariableForSetVariableValueAction),\n\t\t[scopeNode.variables],\n\t)\n\n\tconst hasVariables = supportedVariables.length > 0\n\n\tconst selectedVariableId = action.controls.variableId.value\n\tconst selectedVariable = scopeNode.getVariable(selectedVariableId)\n\n\tfunction onSelectVariableId(variableId: VariableID) {\n\t\tconst controlProps: Partial<Record<keyof SetVariableValueOptions, ControlProp>> = {\n\t\t\tvariableId: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: variableId,\n\t\t\t},\n\t\t}\n\n\t\tconst variable = supportedVariables.find(\n\t\t\t(supportedVariable): supportedVariable is SetVariableActionSupportedVariableDefinition =>\n\t\t\t\tsupportedVariable.id === variableId,\n\t\t)\n\n\t\tif (variable) {\n\t\t\tconst suggestedControlProp = getSuggestedControlPropForSetVariableValueAction(engine, variable)\n\t\t\tif (suggestedControlProp) {\n\t\t\t\tcontrolProps.value = suggestedControlProp\n\t\t\t}\n\t\t}\n\n\t\tonControlPropsChange(controlProps)\n\t}\n\n\tconst controlPropRowProps = useMemo(() => {\n\t\tif (!selectedVariable) return\n\n\t\tconst controlDescription = controlDescriptionFromVariable(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tselectedVariable,\n\t\t\tscopeType,\n\t\t)\n\t\tif (!controlDescription) return\n\n\t\tconst controlProp = getControlProp(controlDescription, action.controls.value)\n\t\tif (!controlProp) return\n\n\t\tconst reducedControlProp = getReducedControlPropForControl(controlDescription)\n\t\tif (!reducedControlProp) return\n\n\t\treduceControlProp(reducedControlProp, controlProp, controlDescription)\n\n\t\treturn {\n\t\t\tcontrol: {\n\t\t\t\t...controlDescription,\n\t\t\t\ttitle: \"Value\",\n\t\t\t\tdescription: undefined,\n\t\t\t},\n\t\t\tcontrolProp: reducedControlProp,\n\t\t\tonChange(controlKey: string, getUpdate: (current: ControlProp) => ControlProp) {\n\t\t\t\tconst newControlProp = getUpdate(controlProp)\n\t\t\t\tonControlPropsChange({ [controlKey]: newControlProp })\n\t\t\t},\n\t\t}\n\t}, [action, onControlPropsChange, selectedVariable, scopeType])\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title={Dictionary.Variable}>\n\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass} enabled={hasVariables}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={hasVariables ? Dictionary.SelectEllipsis : \"No Variables\"}\n\t\t\t\t\t\tvisible={!selectedVariable}\n\t\t\t\t\t\tselected={!selectedVariable}\n\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{supportedVariables.map(variable => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={variable.id}\n\t\t\t\t\t\t\tidentifier={variable.id}\n\t\t\t\t\t\t\ttitle={variable.name}\n\t\t\t\t\t\t\tselected={variable.id === selectedVariableId}\n\t\t\t\t\t\t\tonSelect={onSelectVariableId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\n\t\t\t<ComputedValuesSupportedProvider value={true}>\n\t\t\t\t{controlPropRowProps && (\n\t\t\t\t\t<ControlPropRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tcontrolKey=\"value\"\n\t\t\t\t\t\tonImageUpload={onImageUpload}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tsupportsComputedValues={true}\n\t\t\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\t\t\tsupportsVariables={true}\n\t\t\t\t\t\t{...controlPropRowProps}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</ComputedValuesSupportedProvider>\n\t\t</>\n\t)\n}\n", "import type {\n\tEntityDefinition,\n\tNavigateOptions,\n\tPackageIdentifier,\n\tSetVariableValueOptions,\n} from \"@framerjs/framer-runtime\"\nimport { navigateActionControlTypes, setVariantActionControlTypes } from \"@framerjs/framer-runtime\"\nimport { localPackageFallbackIdentifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getCompatibleVariablesByProvider } from \"document/components/chrome/properties/utils/useDisplayVariableAssignmentOptions.ts\"\nimport { createAndAssignActionVariableToNode } from \"document/components/tools/utils/createAndAssignActionVariableToNode.ts\"\nimport engine from \"document/engine.ts\"\nimport { hasEvents } from \"document/models/CanvasTree/actions/actions.ts\"\nimport type { SetVariableActionSupportedVariableDefinition } from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport { isValidVariableForSetVariableValueAction } from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport type { NodeID, ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCanvasPageNode,\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { nodeIsInOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport {\n\tgetSmartComponentForCodeComponent,\n\tisLocalSmartComponentInstance,\n} from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasPaginationEnabled } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport {\n\tisAnyCollectionReferencingVariableDefinition,\n\twithQueryParam,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ControlProp, ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getParentCollectionRepeater } from \"utils/repeaterUtils.ts\"\n\nconst topLevelPackages: Readonly<PackageIdentifier[]> = [\"framer\", localPackageFallbackIdentifier]\n\ntype CreateActionHandler = (eventKey: string, action: EntityDefinition, controlOverrides?: ControlProps) => void\n\nexport function displayActionsMenu(nodeId: NodeID, eventKey: string, location: Point, handler: CreateActionHandler) {\n\tengine.stores.contextMenuStore.show(actionsMenu(nodeId, eventKey, handler), { location })\n}\n\nfunction actionsMenu(nodeId: NodeID, eventKey: string, handler: CreateActionHandler) {\n\tconst menu: MenuItemOptions[] = []\n\tconst { scopeType, active: scopeNode } = engine.stores.scopeStore\n\n\tconst navigateActionItems = getNavigateActionItems(eventKey, scopeType, handler)\n\tif (navigateActionItems) menu.push(...navigateActionItems)\n\n\tconst variantActionItems = getVariantActionItems(eventKey, scopeType, handler)\n\tif (variantActionItems) menu.push(...variantActionItems)\n\n\tconst variableActionItems = getVariableActionItems(nodeId, eventKey, scopeNode, handler)\n\tif (variableActionItems) menu.push(...variableActionItems)\n\n\tconst setVariableValueActionItem = getSetVariableValueActionItem(scopeNode, eventKey, handler)\n\tif (setVariableValueActionItem) menu.push(setVariableValueActionItem)\n\n\tconst resetVariablesActionItem = getResetVariableValuesActionItem(scopeNode, eventKey, handler)\n\tif (resetVariablesActionItem) menu.push(resetVariablesActionItem)\n\n\tconst overlayActionItems = getOverlayActionItems(nodeId, eventKey, scopeType, handler)\n\tif (overlayActionItems) menu.push(...overlayActionItems)\n\n\tconst loadMoreActionItems = getLoadMoreActionItems(nodeId, eventKey, handler)\n\tif (loadMoreActionItems) menu.push(...loadMoreActionItems)\n\n\tconst localeActionItem = getLocaleActionItem(eventKey, scopeType, handler)\n\tif (localeActionItem) {\n\t\tmenu.push({ type: \"separator\" })\n\t\tmenu.push(localeActionItem)\n\t}\n\n\tconst extraItems: MenuItemOptions[] = getPackageActionItems(eventKey, scopeNode, handler)\n\n\tif (extraItems.length) {\n\t\tmenu.push({ type: \"separator\" }, ...extraItems)\n\t}\n\n\treturn menu\n}\n\nfunction getPackageActionItems(eventKey: string, scopeNode: ScopeNode, handler: CreateActionHandler) {\n\tconst menuItems: MenuItemOptions[] = []\n\n\tfor (const topLevelPackage of topLevelPackages) {\n\t\tconst packageItems = actionsForPackage(topLevelPackage, eventKey, scopeNode, handler)\n\t\tif (packageItems) {\n\t\t\tmenuItems.push(...packageItems, { type: \"separator\" })\n\t\t}\n\t}\n\n\treturn menuItems\n}\n\nfunction isVisibleAction(actionIdentifier: string, scopeNode: ScopeNode): boolean {\n\tif (isSmartComponentNode(scopeNode)) {\n\t\t// Smart Components only show variant & variable actions, which are hardcoded instead of loaded from packages.\n\t\t// The Link panel is available in Smart Component canvas as well, so no need to show the action there.\n\t\treturn false\n\t}\n\n\tswitch (actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.openURLAction:\n\t\t\t// Only show open link action in canvas pages in sites projects & prototyping projects.\n\t\t\treturn isCanvasPageNode(scopeNode)\n\t\tcase HardCodedCodeIdentifier.triggerEventAction:\n\t\tcase HardCodedCodeIdentifier.setVariantAction:\n\t\tcase HardCodedCodeIdentifier.navigationAction:\n\t\tcase HardCodedCodeIdentifier.showOverlayAction:\n\t\tcase HardCodedCodeIdentifier.showRelativeOverlayAction:\n\t\tcase HardCodedCodeIdentifier.dismissOverlayAction:\n\t\tcase HardCodedCodeIdentifier.consoleLogAction:\n\t\tcase HardCodedCodeIdentifier.loadMoreAction:\n\t\tcase HardCodedCodeIdentifier.setLocaleAction:\n\t\tcase HardCodedCodeIdentifier.setVariableValueAction:\n\t\tcase HardCodedCodeIdentifier.resetVariableValuesAction:\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn true\n\t}\n}\n\nfunction actionsForPackage(\n\tpackageIdentifier: PackageIdentifier,\n\teventKey: string,\n\tscopeNode: ScopeNode,\n\thandler: CreateActionHandler,\n): MenuItemOptions[] | null {\n\tconst actions: EntityDefinition[] = []\n\tfor (const component of engine.componentLoader.getAllEntities()) {\n\t\tif (component.type !== \"action\") continue\n\t\tif (component.packageIdentifier !== packageIdentifier) continue\n\t\tif (!isVisibleAction(component.identifier, scopeNode)) continue\n\t\tactions.push(component)\n\t}\n\tif (actions.length === 0) return null\n\n\treturn actions\n\t\t.map(action => ({\n\t\t\tlabel: action.name,\n\t\t\tclick: () => handler(eventKey, action),\n\t\t}))\n\t\t.sort((a, b) => a.label.localeCompare(b.label))\n}\n\nfunction getNavigateActionItems(\n\teventKey: string,\n\tscopeType: ScopeType,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions[] {\n\tif (scopeType !== ScopeType.CanvasPage) return null\n\n\tconst navigateAction = engine.componentLoader.componentForIdentifier(HardCodedCodeIdentifier.navigationAction)\n\tif (!navigateAction) return null\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.Transition,\n\t\t\tclick: () => {\n\t\t\t\thandler(eventKey, navigateAction, {\n\t\t\t\t\ttransition: {\n\t\t\t\t\t\ttype: navigateActionControlTypes.transition,\n\t\t\t\t\t\tvalue: engine.stores.documentSettingsStore.defaultTransition,\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: \"Transition Back\",\n\t\t\tclick: () => {\n\t\t\t\tconst navigateType: NavigateOptions[\"type\"] = \"previous\"\n\t\t\t\thandler(eventKey, navigateAction, {\n\t\t\t\t\ttype: { type: navigateActionControlTypes.type, value: navigateType },\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getVariantActionItems(\n\teventKey: string,\n\tscopeType: ScopeType,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions[] {\n\tif (scopeType !== ScopeType.SmartComponent) return null\n\n\tconst setVariantAction = engine.componentLoader.componentForIdentifier(HardCodedCodeIdentifier.setVariantAction)\n\tif (!setVariantAction) return null\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"New Transition\",\n\t\t\tclick: () => {\n\t\t\t\thandler(eventKey, setVariantAction, {\n\t\t\t\t\ttype: { type: setVariantActionControlTypes.type, value: \"set\" },\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getLoadMoreActionItems(\n\tnodeId: NodeID,\n\teventKey: string,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions[] {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return null\n\n\tconst collectionRepeaterNode = getParentCollectionRepeater(engine.tree, node)\n\tif (!collectionRepeaterNode || !hasPaginationEnabled(collectionRepeaterNode)) return null\n\n\tconst loadMoreAction = engine.componentLoader.componentForIdentifier(HardCodedCodeIdentifier.loadMoreAction)\n\tif (!loadMoreAction) return null\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Load More\",\n\t\t\tclick: () => {\n\t\t\t\thandler(eventKey, loadMoreAction, {})\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getOverlayActionItems(\n\tnodeId: NodeID,\n\teventKey: string,\n\tscopeType: ScopeType,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions[] {\n\tif (\n\t\tscopeType !== ScopeType.WebPage &&\n\t\tscopeType !== ScopeType.SmartComponent &&\n\t\tscopeType !== ScopeType.LayoutTemplate\n\t) {\n\t\treturn null\n\t}\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node || !nodeIsInOverlay(node)) return null\n\n\tconst dismissOverlayAction = engine.componentLoader.componentForIdentifier(\n\t\tHardCodedCodeIdentifier.dismissOverlayAction,\n\t)\n\tif (!dismissOverlayAction) return null\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Close Overlay\",\n\t\t\tclick: () => {\n\t\t\t\thandler(eventKey, dismissOverlayAction, {})\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getLocaleActionItem(\n\teventKey: string,\n\tscopeType: ScopeType,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions {\n\tif (\n\t\tscopeType !== ScopeType.WebPage &&\n\t\tscopeType !== ScopeType.SmartComponent &&\n\t\tscopeType !== ScopeType.LayoutTemplate\n\t) {\n\t\treturn null\n\t}\n\n\tconst setLocaleAction = engine.componentLoader.componentForIdentifier(HardCodedCodeIdentifier.setLocaleAction)\n\tif (!setLocaleAction) return null\n\n\tconst locales = engine.tree.root.locales\n\tif (!locales || locales.length === 0) return null\n\n\treturn {\n\t\tlabel: `Set ${Dictionary.Locale}`,\n\t\tclick: () => {\n\t\t\thandler(eventKey, setLocaleAction, {})\n\t\t},\n\t}\n}\n\nfunction getVariableActionItems(\n\tnodeId: NodeID,\n\teventKey: string,\n\tscopeNode: ScopeNode,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions[] {\n\tif (!isSmartComponentNode(scopeNode) && !isLayoutTemplateNode(scopeNode)) return null\n\n\tconst triggerEventAction = engine.componentLoader.componentForIdentifier(HardCodedCodeIdentifier.triggerEventAction)\n\tif (!triggerEventAction) return null\n\n\tconst eventVariables = scopeNode.variables.filter(\n\t\tvariable => variable.type === ControlType.EventHandler && variable.name,\n\t)\n\n\tconst anyEventVariables = eventVariables.length > 0\n\n\tconst { variablesStore, modalStore, codeGenerationStore } = engine.stores\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"New Event\",\n\t\t\tclick: () => {\n\t\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\t\tif (!node) return\n\n\t\t\t\tconst newEvent = (newEventKey: string) => {\n\t\t\t\t\t// Open the variables modal and let the user name the variable\n\t\t\t\t\tconst temp = variablesStore.createTemporaryVariable(nodeId, newEventKey, \"canvas_component\", {\n\t\t\t\t\t\ttype: ControlType.EventHandler,\n\t\t\t\t\t\tname: Dictionary.Click,\n\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t})\n\t\t\t\t\tvariablesStore.selectedVariablePath = [temp.id]\n\t\t\t\t\tmodalStore.set({ type: ModalType.Variables, source: \"properties\" })\n\t\t\t\t}\n\n\t\t\t\tif (!hasEvents(node, engine.componentLoader) && isLocalSmartComponentInstance(node)) {\n\t\t\t\t\tconst smartComponentNode = getSmartComponentForCodeComponent(engine.tree, node)\n\t\t\t\t\tengine.loadScopesThenProcess([smartComponentNode], ([loadedSmartComponentNode]) => {\n\t\t\t\t\t\t// We do nothing if the smart component no longer exists.\n\t\t\t\t\t\tif (!loadedSmartComponentNode) return\n\n\t\t\t\t\t\tconst frameEventKey = eventKey\n\t\t\t\t\t\tconst variableId = createAndAssignActionVariableToNode(\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\tloadedSmartComponentNode.getPrimaryVariant(),\n\t\t\t\t\t\t\tframeEventKey,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tcodeGenerationStore,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tassert(variableId, \"Should be able to create event key for local smart component node\")\n\t\t\t\t\t\tnewEvent(variableId)\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tnewEvent(eventKey)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Choose Event\",\n\t\t\tvisible: anyEventVariables,\n\t\t\tsubmenu: anyEventVariables\n\t\t\t\t? eventVariables.map(variable => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\thandler(eventKey, triggerEventAction, {\n\t\t\t\t\t\t\t\t\tid: { type: ControlType.String, value: variable.id },\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: undefined,\n\t\t},\n\t]\n}\n\nfunction getSetVariableValueActionItem(\n\tscopeNode: ScopeNode,\n\teventKey: string,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions {\n\tif (!isSmartComponentNode(scopeNode) && !isWebPageNode(scopeNode)) return null\n\n\tconst supportedVariables = scopeNode.variables.filter(isValidVariableForSetVariableValueAction)\n\tif (supportedVariables.length === 0) return null\n\n\tconst setVariableValueAction = engine.componentLoader.componentForIdentifier(\n\t\tHardCodedCodeIdentifier.setVariableValueAction,\n\t)\n\tif (!setVariableValueAction) return null\n\n\treturn {\n\t\tlabel: setVariableValueAction.name,\n\t\tsubmenu: supportedVariables.map(variable => {\n\t\t\treturn {\n\t\t\t\tlabel: variable.name,\n\t\t\t\tclick() {\n\t\t\t\t\tconst controlProps: Partial<Record<keyof SetVariableValueOptions, ControlProp>> = {\n\t\t\t\t\t\tvariableId: {\n\t\t\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\t\t\tvalue: variable.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\n\t\t\t\t\tconst suggestedControlProp = getSuggestedControlPropForSetVariableValueAction(engine, variable)\n\n\t\t\t\t\tif (suggestedControlProp) {\n\t\t\t\t\t\tcontrolProps.value = suggestedControlProp\n\t\t\t\t\t}\n\n\t\t\t\t\thandler(eventKey, setVariableValueAction, controlProps)\n\t\t\t\t},\n\t\t\t}\n\t\t}),\n\t}\n}\n\nfunction getResetVariableValuesActionItem(\n\tscopeNode: ScopeNode,\n\teventKey: string,\n\thandler: CreateActionHandler,\n): null | MenuItemOptions {\n\tif (!isWebPageNode(scopeNode)) return null\n\n\tconst hasQueryParams = scopeNode.variables.some(withQueryParam)\n\tif (!hasQueryParams) return null\n\n\tconst resetVariableValuesAction = engine.componentLoader.componentForIdentifier(\n\t\tHardCodedCodeIdentifier.resetVariableValuesAction,\n\t)\n\tif (!resetVariableValuesAction) return null\n\n\treturn {\n\t\tlabel: resetVariableValuesAction.name,\n\t\tclick: () => {\n\t\t\thandler(eventKey, resetVariableValuesAction, {})\n\t\t},\n\t}\n}\n\nexport function getSuggestedControlPropForSetVariableValueAction(\n\tvekterEngine: VekterEngine,\n\tvariable: SetVariableActionSupportedVariableDefinition,\n): ControlProp | undefined {\n\tconst variableInfo = vekterEngine.stores.treeStore.variableProviderInfo\n\tif (!variableInfo) return\n\n\tconst compatibleVariablesByProvider = getCompatibleVariablesByProvider(\n\t\tvekterEngine,\n\t\tvariableInfo,\n\t\tvariable.type,\n\t\tundefined,\n\t\tfalse,\n\t\tisAnyCollectionReferencingVariableDefinition(variable) ? variable.dataIdentifier : undefined,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tundefined,\n\t\tfalse,\n\t\t// Don't suggest to set a variable to itself\n\t\tcandidateVariable => candidateVariable.id !== variable.id,\n\t)\n\n\tfor (const { providerId, compatibleVariables } of compatibleVariablesByProvider) {\n\t\tfor (const { variable: compatibleVariable, compatibleNestedVariables } of compatibleVariables) {\n\t\t\t// Don't suggest nested variables\n\t\t\tif (compatibleNestedVariables) continue\n\n\t\t\tconst value = createVariableReference(compatibleVariable.id, providerId)\n\n\t\t\tif (variable.type === \"controlReference\") {\n\t\t\t\tif (variable.expectedType === ControlType.SegmentedEnum) continue\n\t\t\t\treturn { type: variable.expectedType, value }\n\t\t\t}\n\n\t\t\treturn { type: variable.type, value }\n\t\t}\n\t}\n}\n", "import { PopupButton, PopupButtonItem, SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { keyDownKey } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport React from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport type { EventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\nimport { eventKeyToDisplayName } from \"./utils/eventKeyToDisplayName.ts\"\n\ninterface Props {\n\tnodeId: string\n\ttitle?: string\n\teventKey: string\n\teventKeys: string[][] // each group is separated with a divider\n\tindex: number\n\tonChange: (nodeId: string, currentEventKey: string, newEventKey: string, index: number) => void\n\tonRemove?: (nodeId: string, eventKey: string, index: number) => void\n\teventKeyToDisplayNameMap: EventKeyToDisplayNameMap | null\n\tisNodeWithFrameEvents: boolean\n\tisCanvasPage: boolean\n\tdisplaySegmentedControl?: boolean\n}\n\nexport class EventActionTriggerRow extends React.PureComponent<Props> {\n\tonSelect = (newEventKey: string) => {\n\t\tconst { nodeId, eventKey, index, onChange } = this.props\n\t\tonChange(nodeId, eventKey, newEventKey, index)\n\t}\n\n\ttitle = (eventKey: string) => {\n\t\treturn eventKeyToDisplayName(eventKey, this.props.eventKeyToDisplayNameMap, true)\n\t}\n\n\titemIsEnabled = (eventKey: string) => {\n\t\tconst { isCanvasPage, isNodeWithFrameEvents } = this.props\n\t\tif (isCanvasPage) return true\n\t\tconst isFrameKeydownEvent = isNodeWithFrameEvents && eventKey === keyDownKey\n\t\treturn !isFrameKeydownEvent\n\t}\n\n\toverride render() {\n\t\tconst {\n\t\t\teventKey: selectedEventKey,\n\t\t\teventKeys,\n\t\t\tdisplaySegmentedControl = false,\n\t\t\ttitle = \"On\",\n\t\t\tnodeId,\n\t\t\tindex,\n\t\t\tonRemove,\n\t\t} = this.props\n\n\t\treturn (\n\t\t\t<PanelRow title={title} onDelete={onRemove ? () => onRemove(nodeId, selectedEventKey, index) : undefined}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t{displaySegmentedControl ? (\n\t\t\t\t\t\t<SegmentedControl direction=\"vertical\">\n\t\t\t\t\t\t\t{eventKeys.map(group => {\n\t\t\t\t\t\t\t\tconst rows: JSX.Element[] = []\n\t\t\t\t\t\t\t\tgroup.forEach(eventKey => {\n\t\t\t\t\t\t\t\t\tconst enabled = this.itemIsEnabled(eventKey)\n\t\t\t\t\t\t\t\t\tif (!enabled) return\n\t\t\t\t\t\t\t\t\trows.push(\n\t\t\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\t\t\tkey={eventKey}\n\t\t\t\t\t\t\t\t\t\t\tidentifier={eventKey}\n\t\t\t\t\t\t\t\t\t\t\ttitle={this.title}\n\t\t\t\t\t\t\t\t\t\t\tselected={selectedEventKey === eventKey}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={this.onSelect}\n\t\t\t\t\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\t\t\t\t/>,\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\treturn rows\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t{eventKeys.map((group, idx) => {\n\t\t\t\t\t\t\t\tconst rows: ((JSX.Element | undefined)[] | JSX.Element)[] = []\n\t\t\t\t\t\t\t\tif (idx > 0) {\n\t\t\t\t\t\t\t\t\trows.push(<PopupButtonItem type=\"divider\" key={`divider-${idx}`} />)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst triggerRows = group.map(eventKey => {\n\t\t\t\t\t\t\t\t\tconst enabled = this.itemIsEnabled(eventKey)\n\t\t\t\t\t\t\t\t\tif (!enabled) return\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\t\tkey={eventKey}\n\t\t\t\t\t\t\t\t\t\t\tidentifier={eventKey}\n\t\t\t\t\t\t\t\t\t\t\ttitle={this.title}\n\t\t\t\t\t\t\t\t\t\t\tselected={selectedEventKey === eventKey}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={this.onSelect}\n\t\t\t\t\t\t\t\t\t\t/>\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\trows.push(triggerRows)\n\n\t\t\t\t\t\t\t\treturn rows\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport type { TriggerEventAction } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport { updatedTriggerEventAction } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { instantiateExistingVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { eventKeyToDisplayName } from \"./utils/eventKeyToDisplayName.ts\"\n\ninterface Props {\n\tnodeId: string\n\tindex: number\n\tprop: string\n\taction: TriggerEventAction\n\tonChange: (update: TriggerEventAction, nodeId: string, prop: string, index: number) => void\n}\n\nexport function EventActionVariableRow({ nodeId, index, prop, action, onChange }: Props) {\n\tconst updateVariableId = (value: string) => {\n\t\tconst newAction = updatedTriggerEventAction(action, { id: { type: ControlType.String, value } })\n\t\tonChange(newAction, nodeId, prop, index)\n\t}\n\n\tconst onSelectVariable = (reference: VariableReference) => {\n\t\tupdateVariableId(reference.id)\n\t}\n\n\tconst onCreateVariable = (scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.EventHandler,\n\t\t\tname: eventKeyToDisplayName(prop, null), // \"prop\" is the eventKey\n\t\t\tinitialValue: undefined,\n\t\t})\n\t\tif (variableRef) {\n\t\t\tupdateVariableId(variableRef.id)\n\t\t}\n\t}\n\n\tconst selectedVariableId = action.controls.id?.value ?? \"\"\n\tconst reference = instantiateExistingVariableReference(selectedVariableId, undefined)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Event\"\n\t\t\tvariableType={ControlType.EventHandler}\n\t\t\tdynamicValue={reference}\n\t\t\tonSelectVariable={onSelectVariable}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={noop}\n\t\t\tsupportsVariables\n\t\t>\n\t\t\t<VariableReferenceButton expectedType={ControlType.Number} reference={reference} onRemove={undefined} />\n\t\t</PanelRow>\n\t)\n}\n\n// We don't want to allow unasigning a variable in this specific UI\nfunction noop() {}\n", "import type { OpenURLAction } from \"document/models/CanvasTree/actions/openURLActions.ts\"\nimport { openURLActionKeys } from \"document/models/CanvasTree/actions/openURLActions.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { getLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { PageLinkingRows } from \"./PageLinkingRows.tsx\"\n\ninterface Props {\n\taction: OpenURLAction\n\tsupportsPageLinks: boolean\n\tonChange: (controlProp: ControlProp, actionProp: string) => void\n}\n\nexport function PageLinkingRowsForAction({ action, supportsPageLinks, onChange }: Props) {\n\tconst changeHandler = (url: Link | VariableReference | undefined) => {\n\t\tonChange({ type: ControlType.Link, value: url }, openURLActionKeys.url)\n\t}\n\n\treturn (\n\t\t<PageLinkingRows\n\t\t\t// Old ControlType.Link values could be a string, coerce those to a\n\t\t\t// Link for reading and editing.\n\t\t\tlink={getLink(action.controls.url.value)}\n\t\t\tsupportsPageLinks={supportsPageLinks}\n\t\t\tonChange={changeHandler}\n\t\t\tsupportsVariables={false}\n\t\t/>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/src/tokens\"\nimport { EventActionProperties } from \"document/components/chrome/properties/panels/EventActionProperties.tsx\"\nimport { getMemoEventKeyToDisplayNameMap } from \"document/components/chrome/properties/panels/utils/eventKeyToDisplayName.ts\"\nimport { eventsForNode } from \"document/components/chrome/properties/utils/eventActions.ts\"\nimport { hasEvents } from \"document/models/CanvasTree/actions/actions.ts\"\nimport type { NavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport { createNavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport type { SetVariantAction } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport {\n\tcreateSetVariantAction,\n\tisSetVariantAction,\n\tisSetVariantType,\n} from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { CanvasNode, NodeID, SmartComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tgetSmartComponentForCodeComponent,\n\tisLocalSmartComponentInstance,\n} from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { isFormInputEventKey } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as styles from \"./LinkPopover.styles.ts\"\nimport type { LinkTool } from \"./LinkTool.ts\"\n\ninterface InteractionProps {\n\tmyTool: LinkTool\n\tlinkSourceId: NodeID | null\n\tscopeType: ScopeType\n\tonAddNavigation: (nodeId: NodeID, eventKey: string, action: NavigationAction) => void\n\t// Not required in the component creation popover\n\tonAddSetVariant?: (nodeId: NodeID, eventKey: string, action: SetVariantAction) => void\n}\n\nexport const InteractionConfig = React.memo(function Interaction({\n\tmyTool,\n\tlinkSourceId,\n\tscopeType,\n\tonAddNavigation,\n\tonAddSetVariant,\n}: InteractionProps) {\n\tconst { engine, isVariantLink } = myTool\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\n\tconst [selectedEventKey, setEventKey] = React.useState<string | null>(null)\n\tconst [variantAction, setVariantAction] = React.useState<SetVariantAction>(\n\t\tcreateSetVariantAction({ variantId: myTool._linkTargetId ?? undefined }),\n\t)\n\tconst { documentSettingsStore } = engine.stores\n\tconst [navigateAction, setNavigateAction] = React.useState<NavigationAction>(\n\t\tcreateNavigationAction({\n\t\t\ttransition: documentSettingsStore.defaultTransition,\n\t\t\tappearsFrom: documentSettingsStore.defaultAppearsFrom,\n\t\t}),\n\t)\n\n\t// We only want to run the effect on unmount, but we also want the data stays updated,\n\t// so we put them in refs.\n\tconst navigateActionRef = React.useRef(navigateAction)\n\tconst variantActionRef = React.useRef(variantAction)\n\tconst eventKeyRef = React.useRef(selectedEventKey)\n\tconst selectedNodeIdRef = React.useRef<string | undefined>()\n\n\t// Add the action on unmount\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: cleanup effect\n\tReact.useLayoutEffect(() => {\n\t\treturn () => {\n\t\t\t// We might get unmounted because the user switched to view only mode (eg the connection\n\t\t\t// dropped). We should not be changing the document in that case and just cancel.\n\t\t\tif (isViewOnly) return\n\n\t\t\tconst eventKey = eventKeyRef.current\n\t\t\tconst linkSource = myTool.getLinkSource()\n\t\t\tconst selectedNode = myTool.getLinkSourceCandidate()\n\t\t\tconst linkTarget = myTool.getLinkTarget()\n\t\t\tconst selectedNodeId = selectedNodeIdRef.current\n\n\t\t\t// The link setup might not be valid anymore due to local (e.g. undo) or remote changes\n\t\t\tif (\n\t\t\t\t!eventKey ||\n\t\t\t\t!linkSource ||\n\t\t\t\t!linkTarget ||\n\t\t\t\t!selectedNode ||\n\t\t\t\t!selectedNodeId ||\n\t\t\t\tlinkSource.id !== selectedNode.id\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tif (isVariantLink) {\n\t\t\t\t\tconst type = variantActionRef.current.controls.type?.value\n\t\t\t\t\tif (!isSetVariantType(type)) return\n\t\t\t\t\tonAddSetVariant?.(selectedNodeId, eventKey, variantActionRef.current)\n\t\t\t\t} else {\n\t\t\t\t\tonAddNavigation(selectedNodeId, eventKey, navigateActionRef.current)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tconst linkSource = engine.tree.getNode(linkSourceId)\n\n\t// If the platform does not support variant editing, a component instance\n\t// without events won't be picked as the link source in the first place, so\n\t// the platform check here is just a safe guard.\n\tconst shouldUseLayerInsteadOfLinkSource =\n\t\tlinkSource && isLocalSmartComponentInstance(linkSource) && !hasEvents(linkSource, engine.componentLoader)\n\n\t// While we don't really use this state, but we do need to re-render when a shallow scope is loaded.\n\tconst [_, setSmartComponentScopeNode] = React.useState<SmartComponentNode | null>(null)\n\n\tlet node: CanvasNode | null | undefined\n\tif (shouldUseLayerInsteadOfLinkSource) {\n\t\tconst smartComponentScope = getSmartComponentForCodeComponent(engine.tree, linkSource)\n\t\tif (!smartComponentScope) return null\n\t\tif (!smartComponentScope.isLoaded()) {\n\t\t\tsmartComponentScope.load(loadedSmartComponentScope => {\n\t\t\t\tsetSmartComponentScopeNode(loadedSmartComponentScope)\n\t\t\t})\n\t\t\treturn null\n\t\t}\n\t\tnode = smartComponentScope.getPrimaryVariant()\n\t} else {\n\t\tnode = linkSource\n\t}\n\n\tif (!node) return null\n\n\tselectedNodeIdRef.current = node.id\n\n\tconst nodeEvents = eventsForNode(engine.componentLoader, node)\n\tconst eventKeys = Object.keys(nodeEvents)\n\tif (eventKeys.length < 1) return null\n\n\tconst identifier = isVariantLink ? HardCodedCodeIdentifier.setVariantAction : HardCodedCodeIdentifier.navigationAction\n\tconst actionEntity = engine.componentLoader.componentForIdentifier(identifier)\n\tif (!actionEntity) return null\n\n\tconst property = isVariantLink ? actionEntity.properties.type : actionEntity.properties.transition\n\tif (!property || property.type !== ControlType.Enum) return null\n\n\tconst handleChangeTrigger = (_nodeId: string, _currentEventKey: string, newEventKey: string, _index: number) => {\n\t\tsetEventKey(newEventKey)\n\t}\n\n\tconst handleChangeAction = (update: NavigationAction | SetVariantAction) => {\n\t\tif (isSetVariantAction(update)) {\n\t\t\tsetVariantAction(update)\n\t\t\tvariantActionRef.current = update\n\t\t} else {\n\t\t\tsetNavigateAction(update)\n\t\t\tnavigateActionRef.current = update\n\t\t}\n\t}\n\n\tconst displayMap = isCodeComponentNode(node) ? getMemoEventKeyToDisplayNameMap(engine.componentLoader, node) : null\n\tconst eventKey = selectedEventKey ?? eventKeys[0]\n\teventKeyRef.current = eventKey\n\treturn (\n\t\t<Stack\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tclassName={styles.container}\n\t\t\tgap={5}\n\t\t>\n\t\t\t<EventActionProperties\n\t\t\t\tnode={node}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tnodeIds={[node.id]}\n\t\t\t\taction={isVariantLink ? variantAction : navigateAction}\n\t\t\t\teventKey={eventKey}\n\t\t\t\tallEventKeys={eventKeys}\n\t\t\t\tindex={0}\n\t\t\t\tonChange={handleChangeAction}\n\t\t\t\tonChangeTrigger={handleChangeTrigger}\n\t\t\t\teventKeyToDisplayNameMap={displayMap}\n\t\t\t\tshowTargetRow={false}\n\t\t\t\tshowDelayRow={!isFormInputEventKey(eventKey)}\n\t\t\t\tshowTriggerRow={isCodeComponentNode(node) ? eventKeys.length > 1 : true}\n\t\t\t\tshowVariantRow={false}\n\t\t\t\tshowInputValueRow={isFormInputEventKey(eventKey)}\n\t\t\t\tdisplayTriggerAsSegmentedControl={isVariantLink && !isCodeComponentNode(node)}\n\t\t\t/>\n\t\t</Stack>\n\t)\n})\n", "import \"LinkPopover.styles_q2naot.wyw.css\"; export const container = \"container_cl03y42\";\nexport const button = \"button_bpgbfxm\";\nexport const description = \"description_d1xhhhdn\";", "import \"ActionOutlet.styles_oqamcg.wyw.css\"; export const tintKey = \"--tint\";\nexport const outletWidth = 17;\nexport const outletHeight = 17;\nexport const outlet = \"outlet_o1o865yb\";", "import type { CSSProperties } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { Tools } from \"document/stores/ToolEnum.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport * as styles from \"./ActionOutlet.styles.ts\"\n\ninterface Props {\n\tx: number\n\ty: number\n\ttint: string\n\tzoom: number\n\ttoolIsActive: boolean\n\tid: NodeID\n\ttool: Tools\n}\n\nexport function ActionOutlet({ x, y, tint, zoom, id, tool }: Props) {\n\tconst activateTool = useEngineCallback(() => {\n\t\tengine.stores.selectionStore.set(id)\n\t\tengine.setTool(tool)\n\t}, [id, tool])\n\n\tif (zoom < 0.1) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tstyle={\n\t\t\t\t{\n\t\t\t\t\ttop: Math.floor(y * zoom - styles.outletHeight / 2),\n\t\t\t\t\tleft: Math.floor(x * zoom - styles.outletWidth / 2),\n\t\t\t\t\t[styles.tintKey]: tint,\n\t\t\t\t} as CSSProperties\n\t\t\t}\n\t\t\ttitle=\"Connect to navigate\"\n\t\t\tclassName={styles.outlet}\n\t\t\tonMouseDown={activateTool}\n\t\t>\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"17\" height=\"17\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 9 4.151 C 9 3.657 8.358 3.462 8.084 3.874 L 4.518 9.223 C 4.297 9.555 4.535 10 4.934 10 L 7.5 10 C 7.776 10 8 10.224 8 10.5 L 8 12.849 C 8 13.343 8.642 13.538 8.916 13.126 L 12.482 7.777 C 12.703 7.445 12.465 7 12.066 7 L 9.5 7 C 9.224 7 9 6.776 9 6.5 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t></path>\n\t\t\t</svg>\n\t\t</div>\n\t)\n}\n", "import { Arrow, ArrowDirection, arrowPoints, topAncestor } from \"document/components/canvas-hud/Arrow.tsx\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type React from \"react\"\ninterface Props {\n\ttree: CanvasTree\n\tsource: CanvasNode\n\tdestinations: CanvasNode[]\n\tzoom: number\n\ttintColor: string\n\tactive: boolean\n\tbackground: boolean\n\tshowArrowHead: boolean\n}\n\nexport function Arrows(props: Props) {\n\tconst { tree, source, destinations, zoom, tintColor, active, background, showArrowHead } = props\n\tconst sourceRect = tree.getRect(source)\n\tconst sourceMatrix = source.canvasMatrix()\n\n\tconst arrows: React.ReactElement[] = []\n\tconst visitedDestinations: NodeID[] = []\n\n\tfor (let i = 0, il = destinations.length; i < il; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: loop\n\t\tconst destination = destinations[i]!\n\n\t\tif (visitedDestinations.includes(destination.id)) continue\n\t\tvisitedDestinations.push(destination.id)\n\n\t\tconst { start, end, offset } = arrowPoints(\n\t\t\ttree,\n\t\t\tsourceRect,\n\t\t\tsourceMatrix,\n\t\t\ttree.getRect(destination),\n\t\t\tdestination.canvasMatrix(),\n\t\t\tArrowDirection.Right,\n\t\t\ttopAncestor(tree, source),\n\t\t)\n\n\t\tarrows.push(\n\t\t\t<Arrow\n\t\t\t\tkey={source.id + destination.id + i}\n\t\t\t\ttintColor={tintColor}\n\t\t\t\tactive={active}\n\t\t\t\tstartX={start.x}\n\t\t\t\tstartY={start.y}\n\t\t\t\tendX={end.x}\n\t\t\t\tendY={end.y}\n\t\t\t\tstartDirection={ArrowDirection.Right}\n\t\t\t\tendDirection={ArrowDirection.Right}\n\t\t\t\tstartOffsetX={offset.x}\n\t\t\t\tstartOffsetY={offset.y}\n\t\t\t\tbackground={background}\n\t\t\t\tshowArrowHead={showArrowHead}\n\t\t\t\tzoom={zoom}\n\t\t\t/>,\n\t\t)\n\t}\n\n\treturn arrows\n}\n", "import engine from \"document/engine.ts\"\nimport type { CanvasNode, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCodeComponentNode,\n\tisFrameNode,\n\tisShapeContainerNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Breakpoints } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport { isUserComponent } from \"document/models/CanvasTree/traits/utils/isUserComponent.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\nimport { withRotation } from \"../../models/CanvasTree/traits/WithRotation.ts\"\nimport { ScreenTitle } from \"./ScreenTitle.tsx\"\n\ninterface Props {\n\tnodes: CanvasNode[]\n\tselection: NodeID[]\n\thighlight: MaybeNodeID\n\tzoom: number\n\ttool: Tools\n\tisViewOnly: boolean\n\thideTitles?: boolean\n\thomeNodeId: MaybeNodeID\n\t/** Used to show a comment indicator on the frame label */\n\tframesWithThreads: ReadonlySet<string>\n\tactiveBundleHash: string\n\t/**\n\t * Used to re-render external module components' titles when those are loaded.\n\t */\n\tvisibleGroundExternalModuleComponentsHash: string\n\tbreakpoints?: Breakpoints\n\tbreakpointsInOverlayEditMode?: Map<NodeID, NodeID>\n\tgroundNodesWithEmptyStateRepeaters?: ReadonlySet<NodeID>\n\t/** @deprecated: For Wireframer generations. For agent generations, use agentGeneratingNodes instead. */\n\tgeneratingNodes: Set<NodeID>\n\tagentGeneratingNodes: Set<NodeID>\n\t/** A unique key consisting agentID + requestID per each agent generation. Used to determine the animation variant. */\n\tagentGeneratingKey?: string\n}\n\nclass ScreensImplementation extends React.PureComponent<Props> {\n\toverride render() {\n\t\tconst {\n\t\t\thighlight,\n\t\t\tnodes,\n\t\t\tzoom,\n\t\t\ttool,\n\t\t\tisViewOnly,\n\t\t\tselection,\n\t\t\tframesWithThreads,\n\t\t\thideTitles,\n\t\t\thomeNodeId,\n\t\t\tactiveBundleHash,\n\t\t\tvisibleGroundExternalModuleComponentsHash,\n\t\t\tbreakpoints,\n\t\t\tgeneratingNodes,\n\t\t\tagentGeneratingNodes,\n\t\t\tagentGeneratingKey,\n\t\t} = this.props\n\t\tif (hideTitles) return null\n\n\t\t// The screen titles are not so useful at high zoom levels and become quite large.\n\t\tif (zoom > 8) return null\n\n\t\tconst screenTitles: JSX.Element[] = []\n\n\t\tconst ignoreMouse = tool === Tools.Highlight || tool === Tools.Move\n\t\tconst slotConnect = tool === Tools.SlotConnect\n\t\tconst singleSelectedNode = selection.length === 1 ? engine.tree.getNode(selection[0]) : null\n\t\tconst singleSelectedNodeUserComponent = singleSelectedNode ? isUserComponent(singleSelectedNode) : false\n\n\t\tfor (let i = 0, il = nodes.length; i < il; i++) {\n\t\t\tconst node = nodes[i]\n\t\t\tif (!node) continue\n\n\t\t\tif (withRotation(node) && node.resolveValue(\"rotation\") !== 0) continue\n\n\t\t\tscreenTitles.push(\n\t\t\t\t<ScreenTitle\n\t\t\t\t\tkey={node.id}\n\t\t\t\t\tnode={node}\n\t\t\t\t\tisSelected={node.isSelected()}\n\t\t\t\t\tisHighlighted={node.id === highlight}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\thasThread={framesWithThreads.has(node.id)}\n\t\t\t\t\tsingleSelectedNodeUserComponent={singleSelectedNodeUserComponent}\n\t\t\t\t\tisSingleNodeSelected={selection.length === 1}\n\t\t\t\t\tignoreMouse={ignoreMouse}\n\t\t\t\t\tslotConnect={slotConnect}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\thomeNodeId={homeNodeId}\n\t\t\t\t\tactiveBundleHash={activeBundleHash}\n\t\t\t\t\tvisibleGroundExternalModuleComponentsHash={visibleGroundExternalModuleComponentsHash}\n\t\t\t\t\tbreakpoint={breakpoints?.[node.id]}\n\t\t\t\t\teditMode={getEditMode(node, this.props)}\n\t\t\t\t\tisGenerating={generatingNodes.has(node.id)}\n\t\t\t\t\tisAgentGenerating={agentGeneratingNodes.has(node.id)}\n\t\t\t\t\tagentGeneratingKey={agentGeneratingKey}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\treturn screenTitles\n\t}\n}\n\nexport const Screens = React.memo(function Screens({\n\tvisibleGroundNodes,\n\t...props\n}: Omit<Props, \"nodes\"> & {\n\tvisibleGroundNodes: CanvasNode[]\n}) {\n\tconst groundNodesWithEmptyStateRepeaters = engine.stores.repeaterStore.useState(\n\t\tstate => state.groundNodesWithEmptyStates,\n\t)\n\n\tconst nodes = React.useMemo(\n\t\t() =>\n\t\t\tvisibleGroundNodes.filter(node => isFrameNode(node) || isCodeComponentNode(node) || isShapeContainerNode(node)),\n\t\t[visibleGroundNodes],\n\t)\n\n\treturn (\n\t\t<ScreensImplementation\n\t\t\t{...props}\n\t\t\tnodes={nodes}\n\t\t\tgroundNodesWithEmptyStateRepeaters={groundNodesWithEmptyStateRepeaters}\n\t\t/>\n\t)\n})\n\nfunction getEditMode(\n\tnode: CanvasNode,\n\t{ breakpointsInOverlayEditMode, groundNodesWithEmptyStateRepeaters }: Props,\n): React.ComponentProps<typeof ScreenTitle>[\"editMode\"] {\n\tif (breakpointsInOverlayEditMode?.has(node.id)) return \"overlay\"\n\tif (groundNodesWithEmptyStateRepeaters?.has(node.id)) return \"emptyState\"\n\treturn undefined\n}\n", "import { CenterChild, IconLayerComment, IconLayerHome, Stack } from \"@framerjs/fresco\"\nimport { Events } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, fonts } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { MoveTool } from \"document/components/tools/MoveTool.ts\"\nimport { showContextMenu } from \"document/components/utils/contextMenu.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\n/* eslint-disable jsx-a11y/click-events-have-key-events */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport type { CanvasNode, MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Breakpoint } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport { withLock } from \"document/models/CanvasTree/traits/WithLock.ts\"\nimport { isMaster } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tisBreakpointVariant,\n\tisGestureVariant,\n\tisVariant,\n\ttitleForGestureType,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isUserComponent } from \"document/models/CanvasTree/traits/utils/isUserComponent.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { isPreviewableNode } from \"document/utils/isPreviewableNode.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { forceLayerBackingWithCSSProperties } from \"library/render/utils/setLayerBacked.ts\"\nimport React from \"react\"\nimport { getAcceleratorTokenSeparator, getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport { AutoSizeEditableText } from \"../AutoSizeEditableText.tsx\"\nimport { isWireframerVisible } from \"../chrome/insertSidebar/utils/isWireframerOpen.ts\"\nimport { ActiveScopeVisibleInLocale } from \"../chrome/localization/useActiveScopeVisibleInLocale.tsx\"\nimport { ToolbarTooltip } from \"../chrome/projectbar/ToolbarTooltip.tsx\"\nimport { isAgentPanelTool } from \"../tools/utils/agentToolHelpers.ts\"\nimport * as chatStyles from \"../utils/chat.styles.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport { AIGeneratingIcon } from \"./AIGeneratingIcon.tsx\"\nimport { titleBarPadding } from \"./BreakpointCreationButton.styles.ts\"\nimport { BreakpointCreationButton } from \"./BreakpointCreationButton.tsx\"\nimport { PlayButton, playButtonSmallSideSize, squaredPlayButtonSmallSideSize } from \"./PlayButton.tsx\"\nimport * as styles from \"./ScreenTitle.styles.ts\"\nimport {\n\ttype AnimationVariant,\n\tScreenTitleAgentAnimation,\n\tscreenTitleAgentAnimationVariants,\n} from \"./ScreenTitleAgentAnimation.tsx\"\n\n// When zoomed in far, we still want to limit the width of screen titles to something reasonable.\nconst MAX_TITLE_WIDTH = 2000\nconst previewAccelerator = getActionAccelerator(\"showPreview\")\nconst previewTooltipShortcut = previewAccelerator\n\t? getAcceleratorTokens(previewAccelerator).join(getAcceleratorTokenSeparator())\n\t: undefined\n\ntype EditMode = \"overlay\" | \"emptyState\"\n\ninterface Props {\n\tnode: CanvasNode\n\tisSelected: boolean\n\tisSingleNodeSelected?: boolean\n\tisHighlighted: boolean\n\tisViewOnly: boolean\n\teditMode: EditMode | undefined\n\thasThread: boolean\n\tsingleSelectedNodeUserComponent: boolean\n\tignoreMouse: boolean\n\tslotConnect: boolean\n\tzoom: number\n\thomeNodeId: MaybeNodeID\n\t/** Used to re-render code component screen titles */\n\tactiveBundleHash: string\n\t/**\n\t * Used to re-render external module components' titles when those are loaded.\n\t */\n\tvisibleGroundExternalModuleComponentsHash: string\n\tbreakpoint?: Breakpoint\n\t/* @deprecated: For Wireframer generations. For agent generations, use isAgentGenerating instead. */\n\tisGenerating: boolean\n\tisAgentGenerating: boolean\n\tagentGeneratingKey?: string\n}\n\n// Events\n\nfunction getNodeFromEvent(event: React.SyntheticEvent<HTMLElement>): CanvasNode | null {\n\treturn engine.tree.get(event.currentTarget.getAttribute(\"data-node\"))\n}\n\nconst mouseDown = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tif (!Events.isLeftMouseClick(event)) return\n\tlet node = getNodeFromEvent(event)\n\tif (!node) return\n\tif (withLock(node) && node.locked) return\n\n\tconst { overlayStore, selectionStore, chromeStore } = engine.stores\n\n\t// If there is an active overlay in the selected ground node, select it\n\t// instead.\n\tif (overlayStore.editModeActive) {\n\t\tif (isVariant(node) && overlayStore.variantsWithActiveOverlays.has(node.id)) {\n\t\t\tconst overlayNode = engine.tree.get(overlayStore.variantsWithActiveOverlays.get(node.id))\n\t\t\tif (overlayNode) node = overlayNode\n\t\t}\n\t}\n\n\tfunction selectNode(switchToProperties: boolean = true) {\n\t\tif (!node) return\n\t\tif (event.shiftKey) {\n\t\t\tselectionStore.toggle(node)\n\t\t} else {\n\t\t\tif (!node.isSelected()) {\n\t\t\t\tselectionStore.set(node, { switchToLayers: true, switchToProperties })\n\n\t\t\t\tif (!isWireframerVisible(engine.stores)) {\n\t\t\t\t\tchromeStore.removePanelOverrides()\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (engine.tool.enum === Tools.Highlight) {\n\t\tselectNode()\n\t\tengine.setTool(Tools.Move)\n\t\treturn\n\t}\n\n\tif (isAgentPanelTool(engine.tool)) {\n\t\tengine.stores.treeStore.setHighlight(null)\n\t\tengine.tool.selectCallback([node.id])\n\t}\n})\n\nconst doubleClick = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tconst node = getNodeFromEvent(event)\n\tif (!node) return\n\n\tevent.preventDefault()\n\tevent.stopPropagation()\n\n\tif (isFrameNode(node) && isBreakpointVariant(node)) {\n\t\tContextAction.showCustomBreakpointModal(\n\t\t\tengine,\n\t\t\t\"update\",\n\t\t\tnode.id,\n\t\t\tnode.resolveValue(\"name\") ?? undefined,\n\t\t\tnode.width,\n\t\t)\n\t}\n})\n\nconst mouseMove = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tlet node = getNodeFromEvent(event)\n\tif (!node) return\n\tif (withLock(node) && node.locked) return\n\tif (engine.tool.enum !== Tools.Highlight && engine.tool.enum !== Tools.AgentPanel) {\n\t\treturn\n\t}\n\n\tevent.stopPropagation()\n\n\tconst { overlayStore, treeStore } = engine.stores\n\n\t// If there is an active overlay in the selected ground node, highlight it\n\t// instead.\n\tif (overlayStore.editModeActive) {\n\t\tif (isVariant(node) && overlayStore.variantsWithActiveOverlays.has(node.id)) {\n\t\t\tconst overlayNode = engine.tree.get(overlayStore.variantsWithActiveOverlays.get(node.id))\n\t\t\tif (overlayNode) node = overlayNode\n\t\t}\n\t}\n\n\tif (treeStore.highlight === node.id) return\n\tif (node.isSelected()) return\n\n\ttreeStore.setHighlight(node.id)\n})\n\nconst mouseLeave = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tevent.stopPropagation()\n\n\tif (engine.tool.enum !== Tools.Highlight && engine.tool.enum !== Tools.AgentPanel) {\n\t\treturn\n\t}\n\tconst { treeStore } = engine.stores\n\n\ttreeStore.setHighlight(null)\n})\n\nconst onContextMenu = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tif (event.defaultPrevented) {\n\t\treturn\n\t}\n\tconst node = getNodeFromEvent(event)\n\tif (!node) return\n\n\tif (withLock(node) && node.locked) return\n\tif (!node.isSelected()) {\n\t\tengine.stores.selectionStore.set(node)\n\t}\n\tshowContextMenu({\n\t\tcoordinate: Point(event.clientX, event.clientY),\n\t\tengine,\n\t\tselection: engine.stores.selectionStore.ids,\n\t})\n\tevent.preventDefault()\n})\n\nconst editModeExitActions: Record<EditMode, () => void> = {\n\toverlay: () => engine.stores.overlayStore.exitEditMode(engine.stores.selectionStore),\n\temptyState: () => engine.stores.repeaterStore.exitEditMode(engine.stores.selectionStore),\n}\n\nfunction getBackgroundColor(isInEditMode: boolean, isSelectedOrHighlighted: boolean) {\n\tif (isInEditMode) return colors.tint\n\tif (isSelectedOrHighlighted) return colors.breakpointTitleBackgroundPrimary\n\treturn colors.breakpointTitleBackground\n}\n\nfunction getTextColor(isInEditMode: boolean, isSelectedOrHighlighted: boolean) {\n\tif (isInEditMode) return \"#fff\"\n\tif (isSelectedOrHighlighted) return colors.tint\n\treturn colors.breakpointTitle\n}\n\nfunction getPlayButtonColor(isInEditMode: boolean, isSelectedOrHighlighted: boolean) {\n\tif (isInEditMode) return \"rgba(255, 255, 255, 0.3)\"\n\tif (isSelectedOrHighlighted) return colors.tint\n\treturn colors.breakpointPlayButtonBackground\n}\n\nfunction getBreakpointBarPadding(\n\tshowSmallTitleBar: boolean,\n\tuseAgentBreakpointBarRefresh: boolean,\n): { x: number; y: number } {\n\tif (useAgentBreakpointBarRefresh) return showSmallTitleBar ? { x: 3, y: 3 } : { x: 5, y: 5 }\n\tif (showSmallTitleBar) return { x: 3, y: 3 }\n\n\treturn { x: titleBarPadding, y: titleBarPadding }\n}\n\nfunction getBreakpointBarBorderRadius(showSmallTitleBar: boolean, useAgentBreakpointBarRefresh: boolean) {\n\tif (useAgentBreakpointBarRefresh) return showSmallTitleBar ? 6 : 10\n\treturn showSmallTitleBar ? 5 : 10\n}\n\nfunction getBreakpointBarActionClassName(showSmallTitleBar: boolean, useAgentBreakpointBarRefresh: boolean) {\n\tif (useAgentBreakpointBarRefresh) return styles.breakpointBarAction\n\treturn showSmallTitleBar ? styles.marginRightSmall : styles.marginRightLarge\n}\n\n// Hash the same input string to the same 32-bit integer.\nfunction hashString(value: string): number {\n\tlet hash = 2166136261\n\tfor (let index = 0; index < value.length; index++) {\n\t\thash ^= value.charCodeAt(index)\n\t\thash = Math.imul(hash, 16777619)\n\t}\n\treturn hash >>> 0\n}\n\n// Randomly pick an animation variant based on the generation key. The result should be stable given\n// the same input.\nfunction getScreenTitleAgentAnimationVariant(generationKey: string | undefined): AnimationVariant {\n\tif (!generationKey) return \"ghost-flow\"\n\n\tconst variantIndex = hashString(generationKey) % screenTitleAgentAnimationVariants.length\n\treturn screenTitleAgentAnimationVariants[variantIndex] ?? \"ghost-flow\"\n}\n\nexport class ScreenTitle extends React.PureComponent<Props> {\n\topenPreview = engine.scheduler.wrapHandler(() => {\n\t\tconst { selectionStore } = engine.stores\n\t\tconst screenId = this.props.node.id\n\t\tconst selectedNodes = selectionStore.nodes\n\n\t\tconst screenContainsSelection =\n\t\t\tselectedNodes.length > 0 &&\n\t\t\tselectedNodes.every(selectedNode => engine.tree.getGroundNodeFor(selectedNode).id === screenId)\n\n\t\tif (screenContainsSelection) {\n\t\t\ttogglePreviewVisible(engine, { source: \"canvas_inline\" })\n\t\t} else {\n\t\t\tselectionStore.set(this.props.node.id)\n\t\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\t\ttogglePreviewVisible(engine, { source: \"canvas_inline\" })\n\t\t\t})\n\t\t}\n\t})\n\n\thandleTitleChange = (nodeName: string) =>\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tconst renamableNode = engine.tree.get(this.props.node.id)\n\t\t\trenamableNode?.set({ name: nodeName.length > 0 ? nodeName : null })\n\t\t})\n\n\toverride render() {\n\t\tconst {\n\t\t\tnode,\n\t\t\tsingleSelectedNodeUserComponent,\n\t\t\tisSelected,\n\t\t\tisSingleNodeSelected,\n\t\t\tisHighlighted,\n\t\t\teditMode,\n\t\t\tisViewOnly,\n\t\t\thasThread,\n\t\t\tignoreMouse,\n\t\t\tslotConnect,\n\t\t\tzoom,\n\t\t\thomeNodeId,\n\t\t\tbreakpoint,\n\t\t\tisGenerating,\n\t\t\tisAgentGenerating,\n\t\t\tagentGeneratingKey,\n\t\t} = this.props\n\t\tif (!node.isVisible()) return null\n\t\t// Don't show screen titles of layers that are live sorting\n\t\tif (engine.tool instanceof MoveTool) {\n\t\t\tif (isSelected && engine.tool.commonStackOrGridParentAtStart !== null) return null\n\t\t\tif (\n\t\t\t\tnode.id === engine.tool.options?.reorderNode?.id ||\n\t\t\t\tnode.id === engine.tool.options?.reorderNode?.originalid\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t}\n\n\t\tconst nodeCanvasRect = convertFrameToCanvas(engine.tree, node)\n\t\tconst frame = Rect.multiply(nodeCanvasRect, zoom)\n\n\t\tconst isHomeNode = node.id === homeNodeId\n\n\t\tconst nodeLabel = getLabelForNode(node)\n\t\tconst selectedOrHighlighted = isSelected || isHighlighted || isAgentGenerating\n\n\t\tif (isFrameNode(node) && isBreakpointVariant(node)) {\n\t\t\tconst showSmallTitleBar = zoom <= 0.25\n\t\t\tconst showDimension = !editMode && !showSmallTitleBar && frame.width > 200\n\t\t\tconst showPlayButton = !engine.stores.chromeStore.displayMinimalUI && frame.width > playButtonSmallSideSize * 2\n\t\t\tconst showBreakpointButton =\n\t\t\t\t!engine.stores.chromeStore.displayMinimalUI && !editMode && zoom >= 0.1 && frame.width > 100 && !isViewOnly\n\n\t\t\tconst showBreakpointLabel = !editMode && !showSmallTitleBar && frame.width > 500\n\n\t\t\tconst showEditModeLabel = !!editMode && frame.width > 200\n\t\t\tconst showExitEditModeButton = editMode && zoom >= 0.1 && frame.width > (showEditModeLabel ? 225 : 125)\n\n\t\t\tconst nodeName = node.resolveValue(\"name\") || getDefaultName(engine.componentLoader, node)\n\t\t\tconst dimension = showDimension && breakpoint ? getDisplayedDimension(nodeCanvasRect, breakpoint) : null\n\t\t\tconst useAgentBreakpointBarRefresh = experiments.isOn(\"agent\")\n\t\t\tconst useAgentDefaultActionSurface = useAgentBreakpointBarRefresh && !editMode && !selectedOrHighlighted\n\n\t\t\tconst fontSize = showSmallTitleBar ? 8 : 12\n\t\t\tconst gap = showSmallTitleBar ? 5 : 10\n\t\t\tconst padding = getBreakpointBarPadding(showSmallTitleBar, useAgentBreakpointBarRefresh)\n\t\t\tconst borderRadius = getBreakpointBarBorderRadius(showSmallTitleBar, useAgentBreakpointBarRefresh)\n\n\t\t\tconst style: React.CSSProperties = {\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twidth: frame.width,\n\t\t\t\ttransform: `translateX(${frame.x}px) translateY(-100%) translateY(${Math.round(frame.y - gap)}px)`,\n\t\t\t\tfontSize,\n\t\t\t\t/* fonts.weight.heading is a custom CSS variable */\n\t\t\t\tfontWeight: fonts.weight.heading as React.CSSProperties[\"fontWeight\"],\n\t\t\t\tcursor: ignoreMouse ? \"default\" : undefined,\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\tpadding: `${padding.y}px ${padding.x}px`,\n\t\t\t\tminHeight: squaredPlayButtonSmallSideSize + padding.y * 2,\n\t\t\t\tborderRadius,\n\t\t\t\tmarginRight: padding.x,\n\t\t\t\tcolor: getTextColor(!!editMode, selectedOrHighlighted),\n\t\t\t\tbackgroundColor: getBackgroundColor(!!editMode, selectedOrHighlighted),\n\t\t\t}\n\n\t\t\tforceLayerBackingWithCSSProperties(style)\n\n\t\t\tconst actionClassName = getBreakpointBarActionClassName(showSmallTitleBar, useAgentBreakpointBarRefresh)\n\t\t\tconst breakpointBarClassName = cx(\n\t\t\t\tuseAgentBreakpointBarRefresh && styles.breakpointBarRefreshed,\n\t\t\t\tuseAgentBreakpointBarRefresh && showSmallTitleBar && styles.breakpointBarSmallRefreshed,\n\t\t\t\tuseAgentBreakpointBarRefresh &&\n\t\t\t\t\t(selectedOrHighlighted || isAgentGenerating) &&\n\t\t\t\t\tstyles.breakpointBarRefreshedTintedBorder,\n\t\t\t)\n\n\t\t\tif (isGenerating) {\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cx(\"ScreenTitle\", breakpointBarClassName)}\n\t\t\t\t\t\tdata-node={node.id}\n\t\t\t\t\t\tonMouseDown={mouseDown}\n\t\t\t\t\t\tonMouseMove={mouseMove}\n\t\t\t\t\t\tonMouseLeave={mouseLeave}\n\t\t\t\t\t\tonDoubleClick={doubleClick}\n\t\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t>\n\t\t\t\t\t\t<AIGeneratingIcon\n\t\t\t\t\t\t\tclassName={actionClassName}\n\t\t\t\t\t\t\tagentRefreshed={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\tvariant={selectedOrHighlighted ? \"primary\" : \"default\"}\n\t\t\t\t\t\t\tsmall={showSmallTitleBar}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className={cx(styles.screenTitle, useAgentBreakpointBarRefresh && styles.breakpointTitleRefreshed)}>\n\t\t\t\t\t\t\t{Dictionary.Generating}\n\t\t\t\t\t\t\t<span className={chatStyles.loadingDots} />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (isAgentGenerating) {\n\t\t\t\tconst animationVariant = getScreenTitleAgentAnimationVariant(agentGeneratingKey)\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cx(\"ScreenTitle\", breakpointBarClassName)}\n\t\t\t\t\t\tdata-node={node.id}\n\t\t\t\t\t\tonMouseDown={mouseDown}\n\t\t\t\t\t\tonMouseMove={mouseMove}\n\t\t\t\t\t\tonMouseLeave={mouseLeave}\n\t\t\t\t\t\tonDoubleClick={doubleClick}\n\t\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ScreenTitleAgentAnimation\n\t\t\t\t\t\t\tcolor={editMode ? \"onTint\" : \"default\"}\n\t\t\t\t\t\t\tvariant={animationVariant}\n\t\t\t\t\t\t\tsmall={showSmallTitleBar}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BreakpointTitleContent\n\t\t\t\t\t\t\tnodeName={nodeName}\n\t\t\t\t\t\t\tdimension={dimension}\n\t\t\t\t\t\t\teditMode={editMode}\n\t\t\t\t\t\t\tshowEditModeLabel={showEditModeLabel}\n\t\t\t\t\t\t\tshowSmallTitleBar={showSmallTitleBar}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tuseAgentBreakpointBarRefresh={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\tonTitleChange={this.handleTitleChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{showBreakpointButton && (\n\t\t\t\t\t\t\t<BreakpointCreationButton\n\t\t\t\t\t\t\t\tagentRefreshed={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\t\tvariant={selectedOrHighlighted ? \"primary\" : \"default\"}\n\t\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\t\tshowLabel={showBreakpointLabel && !useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\t\tshowToolbarTooltip={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\t\tsmall={showSmallTitleBar}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{showExitEditModeButton && (\n\t\t\t\t\t\t\t<ExitEditModeButton editMode={editMode} useAgentBreakpointBarRefresh={useAgentBreakpointBarRefresh} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(\"ScreenTitle\", breakpointBarClassName)}\n\t\t\t\t\tdata-node={node.id}\n\t\t\t\t\tonMouseDown={mouseDown}\n\t\t\t\t\tonMouseMove={mouseMove}\n\t\t\t\t\tonMouseLeave={mouseLeave}\n\t\t\t\t\tonDoubleClick={doubleClick}\n\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\tstyle={style}\n\t\t\t\t>\n\t\t\t\t\t{showPlayButton && (\n\t\t\t\t\t\t<ActiveScopeVisibleInLocale>\n\t\t\t\t\t\t\t{isVisibleInLocale => (\n\t\t\t\t\t\t\t\t<ToolbarTooltip\n\t\t\t\t\t\t\t\t\tenabled={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\t\t\ttext={Dictionary.Preview}\n\t\t\t\t\t\t\t\t\tshortcut={previewTooltipShortcut}\n\t\t\t\t\t\t\t\t\tdirection=\"bottom\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<PlayButton\n\t\t\t\t\t\t\t\t\t\tagentRefreshed={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\t\t\t\tagentRefreshedDefaultSurface={useAgentDefaultActionSurface}\n\t\t\t\t\t\t\t\t\t\tclassName={actionClassName}\n\t\t\t\t\t\t\t\t\t\tcolor={getPlayButtonColor(!!editMode, selectedOrHighlighted)}\n\t\t\t\t\t\t\t\t\t\tonClick={this.openPreview}\n\t\t\t\t\t\t\t\t\t\tsquared\n\t\t\t\t\t\t\t\t\t\tsmall={showSmallTitleBar}\n\t\t\t\t\t\t\t\t\t\tenabled={isVisibleInLocale}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolbarTooltip>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</ActiveScopeVisibleInLocale>\n\t\t\t\t\t)}\n\t\t\t\t\t<BreakpointTitleContent\n\t\t\t\t\t\tnodeName={nodeName}\n\t\t\t\t\t\tdimension={dimension}\n\t\t\t\t\t\teditMode={editMode}\n\t\t\t\t\t\tshowEditModeLabel={showEditModeLabel}\n\t\t\t\t\t\tshowSmallTitleBar={showSmallTitleBar}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tuseAgentBreakpointBarRefresh={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\tonTitleChange={this.handleTitleChange}\n\t\t\t\t\t/>\n\t\t\t\t\t{showBreakpointButton && (\n\t\t\t\t\t\t<BreakpointCreationButton\n\t\t\t\t\t\t\tagentRefreshed={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\tvariant={selectedOrHighlighted ? \"primary\" : \"default\"}\n\t\t\t\t\t\t\tnode={node}\n\t\t\t\t\t\t\tshowLabel={showBreakpointLabel && !useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\tshowToolbarTooltip={useAgentBreakpointBarRefresh}\n\t\t\t\t\t\t\tsmall={showSmallTitleBar}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{showExitEditModeButton && (\n\t\t\t\t\t\t<ExitEditModeButton editMode={editMode} useAgentBreakpointBarRefresh={useAgentBreakpointBarRefresh} />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\t// Adjust the font size and hit area based on the zoom level\n\t\tconst fontSize = Math.ceil(11 ** (zoom ** 0.1))\n\t\tconst ellipsisWidth = fontSize\n\t\tlet width = Math.min(MAX_TITLE_WIDTH, frame.width - 2)\n\t\tlet paddingY = Math.ceil(Math.min(zoom ** 0.25 * 10, Math.ceil(0.75 * fontSize)))\n\t\tconst x = Math.round(frame.x + 0.4 * Math.min(0, width - ellipsisWidth))\n\n\t\tif (width < 1.5 * ellipsisWidth) {\n\t\t\twidth = ellipsisWidth\n\t\t\tpaddingY = Math.floor(0.6 * paddingY)\n\t\t}\n\n\t\tconst height = fontSize + 2 * paddingY\n\n\t\tlet className: string | undefined = undefined\n\t\tif (slotConnect && isHighlighted && singleSelectedNodeUserComponent) {\n\t\t\tclassName = styles.defaultTemplate\n\t\t} else if (isUserComponent(node)) {\n\t\t\tclassName = styles.defaultTemplate\n\t\t} else if (selectedOrHighlighted) {\n\t\t\tclassName = styles.selected\n\t\t} else {\n\t\t\tclassName = styles.defaultLabel\n\t\t}\n\n\t\tconst canPreviewNode = isPreviewableNode(node, engine.tree)\n\t\tconst showPlayButton =\n\t\t\tisSelected && isSingleNodeSelected && zoom > 0.1 && frame.width > playButtonSmallSideSize * 2 && canPreviewNode\n\n\t\tconst style: React.CSSProperties = {\n\t\t\twidth: width,\n\t\t\twillChange: \"transform\",\n\t\t\t/* stylelint-disable */\n\t\t\ttransform: `translate(${x}px, ${Math.round(frame.y - height)}px)`,\n\t\t\t/* fonts.weight.heading is a custom CSS variable */\n\t\t\tfontWeight: fonts.weight.heading as React.CSSProperties[\"fontWeight\"],\n\t\t\tfontSize,\n\t\t\theight: height,\n\t\t\tcursor: ignoreMouse ? \"default\" : undefined,\n\t\t}\n\n\t\tconst labelStyle: React.CSSProperties = {\n\t\t\tlineHeight: 1.2, // align the screen title with the icon/preview button without cropping the text\n\t\t\tmaxWidth: hasThread ? width - 20 : width,\n\t\t}\n\n\t\tforceLayerBackingWithCSSProperties(style)\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cx(\"ScreenTitle\", className)}\n\t\t\t\tdata-node={node.id}\n\t\t\t\tonMouseDown={mouseDown}\n\t\t\t\tonMouseMove={mouseMove}\n\t\t\t\tonDoubleClick={doubleClick}\n\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\tstyle={style}\n\t\t\t>\n\t\t\t\t{showPlayButton ? (\n\t\t\t\t\t<PlayButton\n\t\t\t\t\t\tcolor={singleSelectedNodeUserComponent ? colors.componentTint : colors.tint}\n\t\t\t\t\t\tonClick={this.openPreview}\n\t\t\t\t\t\tsmall={zoom < 0.25}\n\t\t\t\t\t\tsquared={true}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<span className={styles.iconWrapper}>\n\t\t\t\t\t\t{getIcon({\n\t\t\t\t\t\t\thasThread,\n\t\t\t\t\t\t\tisHomeNode,\n\t\t\t\t\t\t})}\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t<span className={styles.titleWrapper} style={labelStyle}>\n\t\t\t\t\t<AutoSizeEditableText\n\t\t\t\t\t\tdisallowEmptyValue={false}\n\t\t\t\t\t\treadOnly={isViewOnly}\n\t\t\t\t\t\tvalue={node.resolveValue(\"name\") || getDefaultName(engine.componentLoader, node)}\n\t\t\t\t\t\tonChange={this.handleTitleChange}\n\t\t\t\t\t\tpostFix={nodeLabel}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t)\n\t}\n\n\t// NOTE: Required for performance tests, see RenderPerformance.test.ts\n\tstatic displayName = \"ScreenTitle\"\n}\n\nfunction getLabelForNode(node: CanvasNode): string | null {\n\tif (isMaster(node)) {\n\t\treturn ` \u00B7 ${Dictionary.Primary}`\n\t} else if (isGestureVariant(node)) {\n\t\treturn ` \u00B7 ${titleForGestureType(node.gesture)}`\n\t}\n\treturn null\n}\n\nfunction getIcon({ hasThread, isHomeNode }: { hasThread: boolean; isHomeNode: boolean }): React.ReactNode {\n\tif (isHomeNode) return <IconLayerHome className={styles.icon} />\n\tif (hasThread) return <IconLayerComment className={styles.icon} />\n\treturn null\n}\n\nfunction getDisplayedDimension(nodeCanvasRect: Rect, breakpoint: Breakpoint): string | undefined {\n\tconst breakpointMax = breakpoint.max\n\tconst breakpointMin = breakpoint.min\n\n\tif (breakpointMin === undefined && breakpointMax === undefined) {\n\t\treturn nodeCanvasRect.width.toString()\n\t}\n\n\tif (breakpointMax && breakpointMin === undefined) {\n\t\treturn breakpointMax.toString()\n\t}\n\n\tif (breakpointMin && breakpointMax === undefined) {\n\t\treturn breakpointMin.toString()\n\t}\n\n\treturn [breakpointMax, breakpointMin].join(\" \u2014 \")\n}\n\ninterface BreakpointTitleContentProps {\n\tnodeName: string\n\tdimension: string | null | undefined\n\teditMode: EditMode | undefined\n\tshowEditModeLabel: boolean\n\tshowSmallTitleBar: boolean\n\tisViewOnly: boolean\n\tuseAgentBreakpointBarRefresh: boolean\n\tonTitleChange: (nodeName: string) => void\n}\n\nconst editModeDictionary: Record<EditMode, string> = {\n\toverlay: Dictionary.Overlay,\n\temptyState: Dictionary.EmptyState,\n}\n\nfunction BreakpointTitleContent({\n\tnodeName,\n\tdimension,\n\teditMode,\n\tshowEditModeLabel,\n\tshowSmallTitleBar,\n\tisViewOnly,\n\tuseAgentBreakpointBarRefresh,\n\tonTitleChange,\n}: BreakpointTitleContentProps) {\n\tif (editMode) {\n\t\treturn (\n\t\t\t<Stack direction=\"row\" gap={6} style={{ flex: 1 }}>\n\t\t\t\t{showEditModeLabel && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className={styles.editModeLabel}>Editing {editModeDictionary[editMode]}</span>\n\t\t\t\t\t\t<span>\u00B7</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t<span\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.breakpointNameInEditMode,\n\t\t\t\t\t\tuseAgentBreakpointBarRefresh && styles.breakpointNameInEditModeRefreshed,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{nodeName}\n\t\t\t\t</span>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\tif (showSmallTitleBar) {\n\t\treturn (\n\t\t\t<span className={cx(styles.screenTitle, useAgentBreakpointBarRefresh && styles.breakpointTitleRefreshed)}>\n\t\t\t\t{nodeName}\n\t\t\t</span>\n\t\t)\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tclassName={cx(\n\t\t\t\tstyles.breakpointTitleContainer,\n\t\t\t\tuseAgentBreakpointBarRefresh && styles.breakpointTitleContainerRefreshed,\n\t\t\t)}\n\t\t>\n\t\t\t<AutoSizeEditableText\n\t\t\t\tdisallowEmptyValue={false}\n\t\t\t\treadOnly={isViewOnly}\n\t\t\t\tvalue={nodeName}\n\t\t\t\tonChange={onTitleChange}\n\t\t\t/>\n\t\t\t{dimension && (\n\t\t\t\t<span className={cx(styles.dimension, useAgentBreakpointBarRefresh && styles.dimensionRefreshed)}>\n\t\t\t\t\t{dimension}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n\nconst ExitEditModeButton: React.FC<{ editMode: EditMode; useAgentBreakpointBarRefresh: boolean }> = ({\n\teditMode,\n\tuseAgentBreakpointBarRefresh,\n}) => {\n\treturn (\n\t\t<CenterChild\n\t\t\tclassName={cx(styles.exitModeButton, useAgentBreakpointBarRefresh && styles.exitModeButtonRefreshed)}\n\t\t\tonClick={editModeExitActions[editMode]}\n\t\t\tonMouseDown={e => e.stopPropagation()}\n\t\t\ttitle={Dictionary.Done}\n\t\t>\n\t\t\t<span>{Dictionary.Done}</span>\n\t\t</CenterChild>\n\t)\n}\n", "import { TextInput, type TextInputProps } from \"@framerjs/fresco\"\nimport React from \"react\"\nimport * as styles from \"./AutoSizeEditableText.styles.ts\"\nimport * as screenTitleStyles from \"./canvas-hud/ScreenTitle.styles.ts\"\n\nexport interface AutoSizeEditableTextProps {\n\tvalue: string\n\tonChange: (value: string) => void\n\treadOnly?: boolean\n\t// Append a thing to the end of the displayed text outside of edit mode\n\tpostFix?: React.ReactNode | null\n\tonEndEditing?: () => void\n\t// Aborts the edit if the value is empty\n\tdisallowEmptyValue?: boolean\n\t// Disable entering edit mode on double click (use imperative handle instead)\n\tdisableEditOnDoubleClick?: boolean\n}\n\nexport interface AutoSizeEditableTextHandle {\n\tstartEditing: () => void\n\tstopEditing: () => void\n}\n\nexport const AutoSizeEditableText = React.memo(\n\tReact.forwardRef<AutoSizeEditableTextHandle, AutoSizeEditableTextProps>(function AutoSizeEditableText(\n\t\t{\n\t\t\tvalue,\n\t\t\tonChange,\n\t\t\treadOnly,\n\t\t\tpostFix,\n\t\t\tonEndEditing,\n\t\t\tdisallowEmptyValue = true,\n\t\t\tdisableEditOnDoubleClick = false,\n\t\t}: AutoSizeEditableTextProps,\n\t\tref,\n\t) {\n\t\tconst [isEditing, setIsEditing] = React.useState(false)\n\t\tconst [internalValue, setInternalValue] = React.useState(value)\n\n\t\tconst onDoubleClick = (e: React.MouseEvent<HTMLSpanElement>) => {\n\t\t\tif (disableEditOnDoubleClick) return\n\t\t\te.stopPropagation()\n\t\t\tsetIsEditing(true)\n\t\t}\n\n\t\tconst endEditing = React.useCallback(() => {\n\t\t\tsetIsEditing(false)\n\t\t\tonEndEditing?.()\n\t\t}, [onEndEditing])\n\n\t\tconst onInputChange = (changeValue: string, final: boolean) => {\n\t\t\tif (!final) {\n\t\t\t\tsetInternalValue(changeValue)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tendEditing()\n\n\t\t\tif (disallowEmptyValue && changeValue.trim() === \"\") {\n\t\t\t\tsetInternalValue(value)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tonChange(changeValue)\n\t\t}\n\n\t\tReact.useEffect(() => {\n\t\t\tsetInternalValue(value)\n\t\t}, [value])\n\n\t\t// Handle blur: reset display value and exit edit mode\n\t\tconst resetOnBlur: TextInputProps[\"onBlur\"] = (_event, isCancelled) => {\n\t\t\tif (isCancelled) {\n\t\t\t\tsetInternalValue(value)\n\t\t\t}\n\t\t\tendEditing()\n\t\t}\n\n\t\tReact.useImperativeHandle(\n\t\t\tref,\n\t\t\t() => ({\n\t\t\t\tstartEditing: () => {\n\t\t\t\t\tif (!readOnly) setIsEditing(true)\n\t\t\t\t},\n\t\t\t\tstopEditing: () => {\n\t\t\t\t\tsetInternalValue(value)\n\t\t\t\t\tendEditing()\n\t\t\t\t},\n\t\t\t}),\n\t\t\t[readOnly, value, endEditing],\n\t\t)\n\n\t\tif (readOnly) {\n\t\t\treturn (\n\t\t\t\t<span className={screenTitleStyles.screenTitle}>\n\t\t\t\t\t{value}\n\t\t\t\t\t{postFix}\n\t\t\t\t</span>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t// biome-ignore lint/nursery/noStaticElementInteractions: would be chaotic for this to be focusable\n\t\t\t<span className={screenTitleStyles.screenTitle} onDoubleClick={onDoubleClick}>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className={styles.internalValue}>{internalValue}</span>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\t\tenabled={isEditing}\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t\tblurOnEnter\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tonBlur={resetOnBlur}\n\t\t\t\t\t\t\tonChange={onInputChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{internalValue}\n\t\t\t\t\t\t{postFix}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</span>\n\t\t)\n\t}),\n)\n", "import \"AutoSizeEditableText.styles_bhbr8.wyw.css\"; export const input = \"input_inublzl\";\nexport const internalValue = \"internalValue_io0s293\";", "import \"ScreenTitle.styles_1n2i11q.wyw.css\"; import { cx } from \"@linaria/core\";\nconst baseLabelStyles = \"baseLabelStyles_b12yzu4a\";\nexport const defaultLabel = \"defaultLabel_d17pjcxl\";\nexport const defaultTemplate = cx(defaultLabel, \"defaultTemplate_daf2sa4\");\nexport const selected = cx(defaultLabel, \"selected_s15g8nus\");\nexport const iconWrapper = \"iconWrapper_i1rc7pmc\";\nexport const icon = \"icon_ijs0g5f\";\nexport const breakpointTitleContainer = \"breakpointTitleContainer_bwtxabf\";\nexport const breakpointTitleContainerRefreshed = cx(breakpointTitleContainer, \"breakpointTitleContainerRefreshed_bzey606\");\nexport const screenTitle = cx(baseLabelStyles, \"screenTitle_s18feudp\");\nexport const breakpointTitleRefreshed = cx(screenTitle, \"breakpointTitleRefreshed_b1ljmsjm\");\nexport const titleWrapper = cx(baseLabelStyles, \"titleWrapper_t1ogdz35\");\nexport const editModeLabel = cx(baseLabelStyles, \"editModeLabel_evvj2n0\");\nexport const breakpointNameInEditMode = cx(baseLabelStyles, \"breakpointNameInEditMode_b10bxvzq\");\nexport const breakpointNameInEditModeRefreshed = cx(breakpointNameInEditMode, \"breakpointNameInEditModeRefreshed_bqxrjtv\");\nexport const dimension = cx(baseLabelStyles, \"dimension_d1x8k0bb\");\nexport const dimensionRefreshed = cx(dimension, \"dimensionRefreshed_d1iprrh7\");\nexport const exitModeButton = \"exitModeButton_e164kih\";\nexport const exitModeButtonRefreshed = cx(exitModeButton, \"exitModeButtonRefreshed_e13rtvq4\");\nexport const marginRightLarge = \"marginRightLarge_m1ir9uxi\";\nexport const marginRightSmall = \"marginRightSmall_mqj28f9\";\nexport const breakpointBarRefreshed = \"breakpointBarRefreshed_bb5tx4m\";\nexport const breakpointBarSmallRefreshed = \"breakpointBarSmallRefreshed_b1jaknjd\";\nexport const breakpointBarRefreshedTintedBorder = \"breakpointBarRefreshedTintedBorder_bnrt221\";\nexport const breakpointBarAction = \"breakpointBarAction_bajakt7\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { isIncludedInLocale } from \"./includedLocales.ts\"\n\nexport function useActiveScopeVisibleInLocale(): boolean {\n\treturn useDeprecatedEngineState(\n\t\t[EngineChange.Tree, engine.stores.scopeStore, engine.stores.chromeStore, engine.stores.localizationStore],\n\t\t() => {\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\n\t\t\tconst activeLocaleId =\n\t\t\t\tengine.stores.chromeStore.mainView === ActiveMainView.Canvas\n\t\t\t\t\t? engine.stores.chromeStore.canvasLocaleId\n\t\t\t\t\t: engine.stores.localizationStore.selectedLocaleId\n\n\t\t\tif (!activeLocaleId) return true\n\n\t\t\treturn isIncludedInLocale(engine.tree, activeScope, activeLocaleId)\n\t\t},\n\t)\n}\n\nexport function ActiveScopeVisibleInLocale({ children }: { children: (isVisibleInLocale: boolean) => JSX.Element }) {\n\tconst isVisibleInLocale = useActiveScopeVisibleInLocale()\n\treturn children(isVisibleInLocale)\n}\n", "import type { VekterTool } from \"document/VekterTool.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport type { AgentPanelTool } from \"../AgentPanelTool.ts\"\n\nexport function isAgentTool(toolEnum: Tools): boolean {\n\treturn toolEnum === Tools.AgentPanel || toolEnum === Tools.AgentSelect || toolEnum === Tools.AgentDragSelect\n}\n\nexport function isAgentPanelTool(tool: VekterTool): tool is AgentPanelTool {\n\tif (tool.enum === Tools.AgentPanel) return true\n\n\tif (tool.enum === Tools.AgentDragSelect) {\n\t\treturn tool.fromTool === Tools.AgentPanel\n\t}\n\n\treturn false\n}\n", "import \"chat.styles_1qb80by.wyw.css\"; export const loadingDots = \"loadingDots_l13jzsqu\";", "import \"AIGeneratingIcon.styles_gw787i.wyw.css\"; export const button = \"button_b1uwjb2n\";\nexport const buttonSmall = \"buttonSmall_bermsty\";\nexport const primaryButton = \"primaryButton_plmx7l4\";\nexport const wrapper = \"wrapper_wptszy6\";", "import \"AgentBreakpointBar.styles_jf0a5j.wyw.css\"; export const defaultActionSurface = \"defaultActionSurface_d4zsnmv\";\nexport const defaultActionIconColor = \"defaultActionIconColor_d1p64n15\";", "import { CenterChild } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { WireframerIcon } from \"../chrome/insertSidebar/dataSources/icons/WireframerIcon.tsx\"\nimport * as styles from \"./AIGeneratingIcon.styles.ts\"\nimport * as agentBreakpointBarStyles from \"./AgentBreakpointBar.styles.ts\"\n\ninterface Props {\n\tvariant: \"default\" | \"primary\"\n\tclassName?: string\n\tagentRefreshed?: boolean\n\tsmall?: boolean\n}\n\nexport const AIGeneratingIcon = ({ variant, className, agentRefreshed, small }: Props) => {\n\treturn (\n\t\t<div className={cx(styles.wrapper, className)}>\n\t\t\t<CenterChild\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.button,\n\t\t\t\t\tsmall && styles.buttonSmall,\n\t\t\t\t\tvariant === \"primary\" && styles.primaryButton,\n\t\t\t\t\tagentRefreshed && variant === \"default\" && agentBreakpointBarStyles.defaultActionSurface,\n\t\t\t\t\tagentRefreshed && variant === \"default\" && agentBreakpointBarStyles.defaultActionIconColor,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<WireframerIcon fill=\"currentColor\" />\n\t\t\t</CenterChild>\n\t\t</div>\n\t)\n}\n", "import \"BreakpointCreationButton.styles_1u1bwnm.wyw.css\"; export const titleBarPadding = 10;\nexport const plusButton = \"plusButton_pgmkc0r\";\nexport const plusButtonSmall = \"plusButtonSmall_p14wr8nu\";\nexport const icon = \"icon_i5wzo8n\";\nexport const iconSmall = \"iconSmall_iherjn8\";\nexport const primaryPlusButton = \"primaryPlusButton_p1utmw0a\";\nexport const wrapper = \"wrapper_w717r55\";\nexport const marginLeft = \"marginLeft_m1slaick\";\nexport const smallMarginLeft = \"smallMarginLeft_sxanjor\";\nexport const label = \"label_lki72x9\";", "import { CenterChild, IconAgentPlus } from \"@framerjs/fresco\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { AgentInputSegment } from \"app/agent/editor/agentInputSchema.ts\"\nimport { defaultAgentModel } from \"app/ai/languageModels.ts\"\nimport { getDefaultReasoningEffortForModel, isValidEffortForModel } from \"app/ai/models.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport {\n\tToolbarTooltip,\n\tgetNativeToolbarTooltipText,\n\tuseToolbarTooltipVariant,\n} from \"document/components/chrome/projectbar/ToolbarTooltip.tsx\"\nimport { FALLBACK_PATH, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, FrameNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withBreakpointVariants } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport type { IsBreakpoint, IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { CanvasPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport pluralize from \"pluralize\"\nimport React from \"react\"\nimport { rightSideOf } from \"../tools/utils/FramesHelper.ts\"\nimport { type BreakpointSuggestion, showBreakpointMenu } from \"../utils/breakpointSuggestion.ts\"\nimport { breakpointVariantDefaults } from \"../utils/breakpointVariantDefaults.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport * as agentBreakpointBarStyles from \"./AgentBreakpointBar.styles.ts\"\nimport * as styles from \"./BreakpointCreationButton.styles.ts\"\n\ninterface Props {\n\tnode: CanvasNode & FrameNode & IsVariant & IsBreakpoint\n\tvariant: \"default\" | \"primary\"\n\tshowLabel?: boolean\n\tshowToolbarTooltip?: boolean\n\tagentRefreshed?: boolean\n\tsmall?: boolean\n}\n\nexport const BreakpointCreationButton = ({\n\tnode,\n\tvariant,\n\tshowLabel,\n\tshowToolbarTooltip,\n\tagentRefreshed,\n\tsmall,\n}: Props) => {\n\tconst buttonRef = React.useRef<HTMLDivElement | null>(null)\n\tconst isPrimary = variant === \"primary\"\n\tconst tooltipVariant = useToolbarTooltipVariant()\n\tconst shouldUseToolbarTooltip = showToolbarTooltip === true && tooltipVariant === \"toolbar\"\n\tconst tooltipText = Dictionary.Breakpoint\n\tconst handleClick = () => {\n\t\tconst button = buttonRef.current\n\t\tif (!button) return\n\n\t\tshowAddBreakpointMenu(node, button)\n\t}\n\n\tconst button = (\n\t\t<div\n\t\t\tref={buttonRef}\n\t\t\tonClick={handleClick}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.wrapper,\n\t\t\t\t!agentRefreshed && styles.marginLeft,\n\t\t\t\t!agentRefreshed && small && styles.smallMarginLeft,\n\t\t\t)}\n\t\t\ttitle={shouldUseToolbarTooltip ? undefined : getNativeToolbarTooltipText(tooltipText)}\n\t\t\taria-label={shouldUseToolbarTooltip ? tooltipText : undefined}\n\t\t>\n\t\t\t{showLabel && <span className={styles.label}> {Dictionary.Breakpoint}</span>}\n\t\t\t<CenterChild\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.plusButton,\n\t\t\t\t\tsmall && styles.plusButtonSmall,\n\t\t\t\t\tisPrimary && styles.primaryPlusButton,\n\t\t\t\t\tagentRefreshed && !isPrimary && agentBreakpointBarStyles.defaultActionSurface,\n\t\t\t\t\tagentRefreshed && !isPrimary && agentBreakpointBarStyles.defaultActionIconColor,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<span className={cx(styles.icon, small && styles.iconSmall)}>\n\t\t\t\t\t<IconAgentPlus />\n\t\t\t\t</span>\n\t\t\t</CenterChild>\n\t\t</div>\n\t)\n\n\treturn (\n\t\t<ToolbarTooltip enabled={shouldUseToolbarTooltip} text={tooltipText} direction=\"bottom\">\n\t\t\t{button}\n\t\t</ToolbarTooltip>\n\t)\n}\n\nfunction showAddBreakpointMenu(node: CanvasNode & FrameNode & IsVariant & IsBreakpoint, button: HTMLDivElement) {\n\tconst scope = engine.tree.getScopeNodeFor(node)\n\tif (!withBreakpointVariants(scope)) return null\n\n\tshowBreakpointMenu(engine, {\n\t\tnode,\n\t\tbutton,\n\t\tonSelectBreakpoint: breakpoint => {\n\t\t\tconst baseNodeRect = engine.tree.getRect(node)\n\t\t\tconst newBreakpointRect: Rect | null = rightSideOf(engine.tree, scope, node, baseNodeRect)\n\t\t\tconst viewportHeight = breakpoint.viewportHeight ?? Math.min(1200, node.height)\n\n\t\t\tContextAction.createBreakpoint(\n\t\t\t\tengine,\n\t\t\t\tnode,\n\t\t\t\tscope,\n\t\t\t\tnewBreakpointRect,\n\t\t\t\tbreakpoint.width,\n\t\t\t\tbreakpoint.name,\n\t\t\t\tviewportHeight,\n\t\t\t)\n\t\t},\n\t\tonSelectCustom: () => ContextAction.showCustomBreakpointModal(engine, \"add\", node.id),\n\t\tonMakeResponsive: suggestedBreakpoints => createResponsiveBreakpointChat(node, suggestedBreakpoints),\n\t})\n}\n\nfunction createResponsiveBreakpointChat(\n\tnode: CanvasNode & FrameNode & IsVariant & IsBreakpoint,\n\tsuggestedBreakpoints: readonly BreakpointSuggestion[],\n): void {\n\tconst scope = engine.tree.getScopeNodeFor(node)\n\tif ((!isWebPageNode(scope) && !isLayoutTemplateNode(scope)) || !withBreakpointVariants(scope)) return\n\n\tlet scopeName: string | undefined\n\tif (isLayoutTemplateNode(scope)) {\n\t\tscopeName = scope.resolveValue(\"name\") ?? Dictionary.Template\n\t} else {\n\t\tconst pagePath = getWebPagePath(engine.tree, scope) ?? FALLBACK_PATH\n\t\tscopeName = scope.id === engine.tree.root.homePageNodeId ? Dictionary.Home : pagePath\n\t}\n\n\tconst promptParts = createMakeResponsivePromptParts(scope.id, scopeName, suggestedBreakpoints)\n\n\tengine.stores.selectionStore.clear()\n\n\tconst newAgent = engine.stores.agentStore.create({\n\t\tscopeId: scope.id,\n\t})\n\tengine.stores.agentStore.activeChatAgentId = newAgent.id\n\tengine.stores.chromeStore.activeRightPanelTab = CanvasPanelTab.Chat\n\n\tconst model = engine.stores.persistedUserDefaults.agentSelectedModel ?? defaultAgentModel\n\tconst persistedReasoningEffort = engine.stores.persistedUserDefaults.agentSelectedReasoningByModel[model]\n\tconst reasoningEffort =\n\t\tpersistedReasoningEffort && isValidEffortForModel(persistedReasoningEffort, model)\n\t\t\t? persistedReasoningEffort\n\t\t\t: getDefaultReasoningEffortForModel(model)\n\n\tvoid newAgent.send(promptParts, emptyArray(), model, reasoningEffort)\n}\n\nfunction createMakeResponsivePromptParts(\n\tpageId: NodeID,\n\tpagePath: string,\n\tsuggestedBreakpoints: readonly BreakpointSuggestion[],\n): readonly AgentInputSegment[] {\n\tconst breakpointInstruction = createBreakpointInstruction(suggestedBreakpoints)\n\n\treturn [\n\t\tbreakpointInstruction,\n\t\t{\n\t\t\ttype: \"layer\",\n\t\t\tnodes: [{ id: pageId, name: pagePath, type: \"breakpoint\" }],\n\t\t},\n\t\t\" responsive.\",\n\t]\n}\nconst list = new Intl.ListFormat(\"en\", { style: \"long\", type: \"conjunction\" })\nfunction createBreakpointInstruction(suggestedBreakpoints: readonly BreakpointSuggestion[]): string {\n\tconst labels = suggestedBreakpoints.map(suggestion => {\n\t\tconst isDefault = breakpointVariantDefaults.some(\n\t\t\tpreset => preset.name === suggestion.name && preset.width === suggestion.width,\n\t\t)\n\t\treturn isDefault ? suggestion.name : `${suggestion.name} (${suggestion.width}px)`\n\t})\n\treturn `Add ${list.format(labels)} ${pluralize(\"breakpoint\", labels.length)} to make `\n}\n", "import \"PlayButton.styles_1p3iha5.wyw.css\"; export const previewButtonIcon = \"previewButtonIcon_p1df2pba\";\nexport const previewButtonIconLegacy = \"previewButtonIconLegacy_potjghv\";\nexport const previewButtonIconSmall = \"previewButtonIconSmall_phymfn9\";\nexport const previewButtonIconSmallLegacy = \"previewButtonIconSmallLegacy_pyrl8m2\";\nexport const previewButton = \"previewButton_p1hq7lqy\";\nexport const previewButtonLegacy = \"previewButtonLegacy_p16zzr3s\";\nexport const previewButtonRefreshed = \"previewButtonRefreshed_ph10fn\";\nexport const squaredPreviewButton = \"squaredPreviewButton_svagp0i\";\nexport const squaredPreviewButtonLegacy = \"squaredPreviewButtonLegacy_sfrxos5\";\nexport const squaredPreviewButtonSmall = \"squaredPreviewButtonSmall_s1ua7c5k\";\nexport const previewButtonDisabled = \"previewButtonDisabled_pdidbjw\";", "import { IconLayerPreview } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport * as agentBreakpointBarStyles from \"./AgentBreakpointBar.styles.ts\"\nimport * as styles from \"./PlayButton.styles.ts\"\n\ninterface PlayButtonProps {\n\tonClick?: () => void\n\tcolor?: string\n\tagentRefreshed?: boolean\n\tagentRefreshedDefaultSurface?: boolean\n\tsmall?: boolean\n\tsquared?: boolean\n\tenabled?: boolean\n\tclassName?: string\n}\n\nexport const playButtonSmallSideSize = 16\nconst playButtonSmallSize = { width: playButtonSmallSideSize, height: playButtonSmallSideSize }\nexport const squaredPlayButtonSmallSideSize = 12\nconst squaredPlayButtonSmallSize = { width: squaredPlayButtonSmallSideSize, height: squaredPlayButtonSmallSideSize }\nconst legacyPlayButtonSideSize = 18\nexport const agentPlayButtonSideSize = 20\nconst legacyPlayButtonDefaultSize = { width: legacyPlayButtonSideSize, height: legacyPlayButtonSideSize }\nconst agentPlayButtonDefaultSize = { width: agentPlayButtonSideSize, height: agentPlayButtonSideSize }\n\nexport const PlayButton = ({\n\tcolor,\n\tagentRefreshed,\n\tagentRefreshedDefaultSurface,\n\tsmall,\n\tsquared,\n\tenabled = true,\n\tonClick,\n\tclassName,\n}: PlayButtonProps) => {\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.previewButton,\n\t\t\t\t!agentRefreshed && styles.previewButtonLegacy,\n\t\t\t\tagentRefreshed && styles.previewButtonRefreshed,\n\t\t\t\tsquared && styles.squaredPreviewButton,\n\t\t\t\t!agentRefreshed && squared && styles.squaredPreviewButtonLegacy,\n\t\t\t\tsquared && small && styles.squaredPreviewButtonSmall,\n\t\t\t\t!enabled && styles.previewButtonDisabled,\n\t\t\t\tagentRefreshedDefaultSurface && agentBreakpointBarStyles.defaultActionSurface,\n\t\t\t\tagentRefreshedDefaultSurface && agentBreakpointBarStyles.defaultActionIconColor,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={() => enabled && onClick?.()}\n\t\t\t// Prevent mouse down on the play button from triggering the parent\n\t\t\t// Screen Title component's mouse down action, which selects the\n\t\t\t// ground node.\n\t\t\tonMouseDown={e => onClick && e.stopPropagation()}\n\t\t\tdata-testid=\"preview-play-button\"\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: agentRefreshedDefaultSurface ? undefined : color,\n\t\t\t\t...(small\n\t\t\t\t\t? squared\n\t\t\t\t\t\t? squaredPlayButtonSmallSize\n\t\t\t\t\t\t: playButtonSmallSize\n\t\t\t\t\t: agentRefreshed\n\t\t\t\t\t\t? agentPlayButtonDefaultSize\n\t\t\t\t\t\t: legacyPlayButtonDefaultSize),\n\t\t\t}}\n\t\t>\n\t\t\t{agentRefreshed ? (\n\t\t\t\t<span className={small && squared ? styles.previewButtonIconSmall : styles.previewButtonIcon}>\n\t\t\t\t\t<PreviewIcon />\n\t\t\t\t</span>\n\t\t\t) : (\n\t\t\t\t<IconLayerPreview\n\t\t\t\t\tclassName={small && squared ? styles.previewButtonIconSmallLegacy : styles.previewButtonIconLegacy}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction PreviewIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" viewBox=\"0 0 20 20\" aria-hidden=\"true\">\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=\"2\"\n\t\t\t\td=\"M8.021 5.43a1 1 0 0 0-1.521.853v7.434a1 1 0 0 0 1.521.853l6.083-3.717a1 1 0 0 0 0-1.706Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport * as styles from \"./ScreenTitleAgentAnimation.styles.ts\"\n\nexport type AnimationVariant = \"ghost-flow\" | \"double-slow\" | \"dance-spark\"\nexport const screenTitleAgentAnimationVariants: readonly AnimationVariant[] = [\n\t\"ghost-flow\",\n\t\"double-slow\",\n\t\"dance-spark\",\n]\n\nconst rowCount = 4\nconst ghostFlowPeriod = 750\nconst ghostFlowStep = ghostFlowPeriod / 4\nconst doubleSlowPeriod = 1200 * 1.6\nconst doubleSlowScale = 1.6\nconst danceSparkPeriod = 1200\n\nconst knuthHashPrime = 2654435761\n\ninterface ScreenTitleAgentAnimationProps {\n\tcolor?: \"default\" | \"onTint\"\n\tvariant: AnimationVariant\n\tsmall: boolean\n}\n\n// Deterministic hash function to generate a random-ish index between 0-15 from row and col\nfunction hashDot(row: number, col: number) {\n\treturn ((row * 7 + col * 13 + row * col * 5) * knuthHashPrime) % 16\n}\n\nfunction getDotClassName(variant: AnimationVariant) {\n\tswitch (variant) {\n\t\tcase \"dance-spark\":\n\t\t\treturn styles.danceSpark\n\t\tcase \"ghost-flow\":\n\t\t\treturn styles.ghostFlow\n\t\tcase \"double-slow\":\n\t\t\treturn styles.doubleSlow\n\t\tdefault:\n\t\t\tassertNever(variant, \"Unknown animation variant\")\n\t}\n}\n\nfunction getDotDelay(variant: AnimationVariant, row: number, col: number) {\n\tif (variant === \"dance-spark\") {\n\t\treturn -Math.round((hashDot(row, col) * danceSparkPeriod) / 16)\n\t}\n\n\tif (variant === \"double-slow\") {\n\t\tconst baseDelay = (col % 2) * 190 + row * 120 + col * 55\n\t\treturn -((baseDelay * doubleSlowScale) % doubleSlowPeriod)\n\t}\n\n\tconst tArrive = ((((row - col) * ghostFlowStep) % ghostFlowPeriod) + ghostFlowPeriod) % ghostFlowPeriod\n\treturn tArrive === 0 ? 0 : tArrive - ghostFlowPeriod\n}\n\nexport const ScreenTitleAgentAnimation = React.memo(function ScreenTitleAgentAnimation({\n\tcolor = \"default\",\n\tvariant,\n\tsmall,\n}: ScreenTitleAgentAnimationProps) {\n\tconst className = getDotClassName(variant)\n\tconst dotSize = small ? styles.cellSizeSmall : styles.cellSize\n\tconst gridSize = small ? styles.gridSizeSmall : styles.gridSize\n\tconst dotStep = (gridSize - dotSize) / (rowCount - 1)\n\treturn (\n\t\t<div className={cx(styles.container, small && styles.containerSmall)}>\n\t\t\t<div className={cx(styles.grid, small && styles.gridSmall)}>\n\t\t\t\t{Array.from({ length: rowCount * rowCount }, (_, i) => {\n\t\t\t\t\tconst row = Math.floor(i / rowCount)\n\t\t\t\t\tconst col = i % rowCount\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={`${row}-${col}`}\n\t\t\t\t\t\t\tclassName={cx(styles.cell, color === \"onTint\" && styles.cellOnTint, className, small && styles.cellSmall)}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\ttop: row * dotStep,\n\t\t\t\t\t\t\t\tleft: col * dotStep,\n\t\t\t\t\t\t\t\tanimationDelay: `${getDotDelay(variant, row, col)}ms`,\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</div>\n\t\t</div>\n\t)\n})\n", "import \"ScreenTitleAgentAnimation.styles_y999t5.wyw.css\"; import { agentPlayButtonSideSize, squaredPlayButtonSmallSideSize } from \"./PlayButton.tsx\";\nexport const ghostFlow = \"ghostFlow_g10i1t8h\";\nexport const doubleSlow = \"doubleSlow_d182trns\";\nexport const danceSpark = \"danceSpark_dz1uv7e\";\nexport const cellSize = 2;\nexport const cellSizeSmall = 1.5;\nexport const gridSize = agentPlayButtonSideSize - 2 * cellSize;\nexport const gridSizeSmall = squaredPlayButtonSmallSideSize - 2 * cellSizeSmall;\nexport const container = \"container_ci6o9sh\";\nexport const containerSmall = \"containerSmall_cfgxhmo\";\nexport const grid = \"grid_gl8bbok\";\nexport const gridSmall = \"gridSmall_g17yp7np\";\nexport const cell = \"cell_ciua124\";\nexport const cellOnTint = \"cellOnTint_caw9bjh\";\nexport const cellSmall = \"cellSmall_cwqrx8m\";", "import React from \"react\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { EngineChange } from \"../../EngineChanges.ts\"\nimport { createContainer } from \"../../components/utils/createContainer.ts\"\nimport engine from \"../../engine.ts\"\nimport { ToolManager } from \"./ToolManager.tsx\"\nimport type { ToolsProps, ToolsState } from \"./props.ts\"\n\nclass Tools extends React.PureComponent<ToolsProps, ToolsState> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.MouseStore,\n\t\tEngineChange.Highlight,\n\t\tEngineChange.CanvasStore,\n\t\tEngineChange.SelectionOutline,\n\t\tEngineChange.DocumentSettings,\n\t\tEngineChange.UserDefaultsStore,\n\t\tEngineChange.TreeDOMLayoutSync,\n\t\tengine.stores.selectionStore,\n\t\tengine.stores.overlayStore,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.effectStore,\n\t\tengine.stores.chromeStore,\n\t\tengine.stores.insertSidebarStore,\n\t\tengine.stores.modalStore,\n\t\tengine.stores.aiGenerationStore,\n\t]\n\n\tstatic calculateState(): ToolsState {\n\t\tconst {\n\t\t\tmouseStore,\n\t\t\ttoolStore,\n\t\t\ttreeStore,\n\t\t\tcanvasStore,\n\t\t\tchromeStore,\n\t\t\toverlayStore,\n\t\t\tmodalStore,\n\t\t\tselectionStore,\n\t\t\teffectStore,\n\t\t\tselectionOutlineTracker,\n\t\t} = engine.stores\n\t\tconst tool = toolStore.tool\n\t\treturn {\n\t\t\tmouse: mouseStore.canvasMousePosition,\n\t\t\tmouseRaw: mouseStore.windowMousePosition,\n\t\t\tmouseDown: mouseStore.canvasMouseDownPosition,\n\t\t\tmouseDownRaw: mouseStore.windowMouseDownPosition,\n\t\t\tmouseOnCanvas: mouseStore.isMouseOnCanvas,\n\t\t\tmiddleMouseButtonDown: mouseStore.canvasMiddleMouseButtonDownPosition,\n\t\t\tmiddleMouseButtonDownRaw: mouseStore.windowMiddleMouseButtonDownPosition,\n\t\t\tshiftKey: mouseStore.shiftKey,\n\t\t\tctrlKey: mouseStore.ctrlKey,\n\t\t\taltKey: mouseStore.altKey,\n\t\t\tcmdKey: mouseStore.cmdKey,\n\t\t\tspacebar: mouseStore.spacebar,\n\t\t\tactiveOverlays: overlayStore.activeOverlays,\n\t\t\teditModeActive: overlayStore.editModeActive,\n\t\t\tactiveModal: modalStore.active.type,\n\t\t\tshouldShowGeneratePageButton: chromeStore.shouldShowGeneratePageButton,\n\t\t\tdomLayoutUpdate: treeStore.domLayoutUpdate,\n\t\t\tshouldShowSelection: engine.shouldShowSelection(),\n\t\t\tshouldShowSelectionOutline: selectionOutlineTracker.shouldShowSelectionOutlineForTool(tool),\n\t\t\ttextLink: toolStore.textLink,\n\t\t\teditedTextLink: toolStore.editedTextLink,\n\t\t\tstackInsertionIndicator: toolStore.stackInsertionIndicator,\n\t\t\treplaceableFloatingPositionNode: toolStore.replaceableFloatingPositionNode,\n\t\t\tvisibleCanvasRect: canvasStore.getCanvasVisibleRect(),\n\t\t\tisEffectPreview: !isNull(effectStore.activeEffect),\n\t\t\tisColorSamplerActive: canvasStore.colorSamplerActive,\n\t\t\tautoDetachingNodeId: chromeStore.autoDetachingNodeId,\n\t\t\tcolorStopSelection: selectionStore.gradientStopId,\n\t\t\ttilingBackgroundFrameUploadInProgressNodeIDs: chromeStore.uploadingTilingImageMap,\n\t\t\tcodeComponentInsertionInProgressNodeIDs: toolStore.codeComponentInProgressInsertionIndicatorNodeIDs,\n\t\t}\n\t}\n\n\toverride render() {\n\t\treturn <ToolManager {...this.props} {...this.state} />\n\t}\n}\nconst ToolsContainer = createContainer(Tools)\nexport { ToolsContainer as Tools }\n", "import { VekterEngine } from \"document/VekterEngine.ts\"\nimport { FrameNode, NullID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { FramePresetID } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { getFramePresetCategory } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as classes from \"./CanvasFramePreset.styles.ts\"\n\ninterface Props extends Rect {\n\tframePreset: FramePresetID | null\n\tzoom: number\n}\n\nexport const CanvasFramePreset = React.memo(function CanvasFramePreset({ framePreset, zoom, ...rect }: Props) {\n\tconst engine = VekterEngine.shared()\n\tconst onMouseDown = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tconst tree = engine.tree\n\t\tconst newId = randomID()\n\t\tconst preset = framePreset ?? undefined\n\t\tconst properties: Partial<FrameNode> = { id: newId, framePreset: preset }\n\n\t\tproperties.left = rect.x\n\t\tproperties.top = rect.y\n\t\tproperties.width = rect.width\n\t\tproperties.height = rect.height\n\t\tproperties.overflow = \"hidden\"\n\t\tproperties.isScreen = true\n\n\t\tengine.createFrame(NullID, properties)\n\n\t\trecord(\"layout_frame\", {\n\t\t\twidth: rect.width,\n\t\t\theight: rect.height,\n\t\t\tpresetDeviceType: preset,\n\t\t\tpresetDeviceTypeCategory: getFramePresetCategory(preset),\n\t\t\tsource: \"suggestion\",\n\t\t})\n\n\t\tengine.stores.selectionStore.set(newId)\n\n\t\t// Place nodes in same place in new Frame\n\t\tconst groundNodesInRect = engine.stores.scopeStore.active.getGroundNodes(node => {\n\t\t\tif (node instanceof FrameNode) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst nodeFrame = tree.getRect(node)\n\t\t\treturn Rect.intersects(nodeFrame, rect)\n\t\t})\n\n\t\tgroundNodesInRect.forEach(node => {\n\t\t\tconst nodeFrame = tree.getRect(node)\n\t\t\tconst convertedFrame = Rect.offset(nodeFrame, Point.reverse(rect))\n\t\t\tconst parentNode = tree.getParent(node.id)\n\t\t\tengine.moveNode(node.id, newId)\n\t\t\tnode.set(\n\t\t\t\tnode.updateForRect({\n\t\t\t\t\trect: convertedFrame,\n\t\t\t\t\t// For ground nodes, the parentSize for calculating size &\n\t\t\t\t\t// position is the same. CanvasPage presets can not be\n\t\t\t\t\t// effected by viewport either.\n\t\t\t\t\tparentSizeInfo: { sizing: rect, positioning: rect, viewport: null, layout: null },\n\t\t\t\t\tconstraintsLocked: false,\n\t\t\t\t\tshouldGuessPinToBottom: true,\n\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parentNode),\n\t\t\t\t}),\n\t\t\t)\n\t\t})\n\n\t\tengine.exitTool()\n\t\tengine.stores.canvasStore.scrollToCenter(Rect.center(rect))\n\t\tevent.stopPropagation()\n\t})\n\n\tconst convertedRect = Rect.multiply(rect, zoom)\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classes.framePreset}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tstyle={{\n\t\t\t\ttop: convertedRect.y,\n\t\t\t\tleft: convertedRect.x,\n\t\t\t\twidth: convertedRect.width,\n\t\t\t\theight: convertedRect.height,\n\t\t\t}}\n\t\t/>\n\t)\n})\n", "import \"CanvasFramePreset.styles_vl3102.wyw.css\"; export const framePreset = \"framePreset_fusleyq\";", "import type { CanvasTree, LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { FrameNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCanvasPageNode, isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { FramePresetID } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { CanvasFramePreset } from \"./CanvasFramePreset.tsx\"\n\ninterface Props {\n\ttree: CanvasTree\n\tzoom: number\n\tactiveScope: LoadedScopeNode\n\tselection?: NodeID[]\n}\n\ninterface PresetInfo {\n\trect: Rect\n\tframePreset: FramePresetID | null\n}\n\nexport function CanvasFramePresets({ tree, zoom, activeScope, selection }: Props) {\n\t// Suggestions only supported in canvas pages.\n\tif (!isCanvasPageNode(activeScope)) return null\n\n\t// If a selection is provided, don't try to filter ground nodes to find\n\t// nodes made from presets.\n\tconst suggestionNodes = selection\n\t\t? []\n\t\t: activeScope.getGroundNodesOfType(FrameNode, node => {\n\t\t\t\treturn node.resolveValue(\"rotation\") === 0 && !!node.framePreset\n\t\t\t})\n\n\t// If a selection is provided ignore whether or not it has a preset.\n\tselection?.forEach(id => {\n\t\tconst node = tree.get(id)\n\t\tif (!node || !tree.isGroundNode(node) || !isFrameNode(node)) return\n\t\tsuggestionNodes.push(node)\n\t})\n\n\tif (suggestionNodes.length === 0) return null\n\n\tconst framesWithPresets: PresetInfo[] = suggestionNodes\n\t\t.map(node => ({ rect: convertFrameToCanvas(tree, node), framePreset: node.framePreset }))\n\t\t.reverse()\n\n\t// Make sure presets don't overlap with canvas layers and other preset suggestions\n\tconst occupiedRects = activeScope.getGroundNodes().map(groundNode => convertFrameToCanvas(tree, groundNode))\n\n\tconst presetSuggestions: PresetInfo[] = []\n\n\tframesWithPresets.forEach(frameWithPreset => {\n\t\tgetSuggestedPresets(frameWithPreset).forEach(neighborFrame => {\n\t\t\tconst noFreeSpace = occupiedRects.some(rect => {\n\t\t\t\treturn Rect.intersects(neighborFrame.rect, rect)\n\t\t\t})\n\t\t\tif (noFreeSpace) return\n\t\t\tpresetSuggestions.push(neighborFrame)\n\t\t\toccupiedRects.push(neighborFrame.rect)\n\t\t})\n\t})\n\n\treturn (\n\t\t<>\n\t\t\t{presetSuggestions.map(({ rect, framePreset }, index) => {\n\t\t\t\treturn <CanvasFramePreset key={index} framePreset={framePreset} zoom={zoom} {...rect} />\n\t\t\t})}\n\t\t</>\n\t)\n}\n\nconst margin = 100\n\nfunction getSuggestedPresets(deviceInfo: PresetInfo): PresetInfo[] {\n\tconst rect = deviceInfo.rect\n\tconst rightPoint = { x: rect.x + rect.width + margin, y: rect.y }\n\tconst bottomPoint = { x: rect.x, y: rect.y + rect.height + margin }\n\treturn [rightPoint, bottomPoint].map(point => {\n\t\treturn {\n\t\t\tframePreset: deviceInfo.framePreset,\n\t\t\trect: {\n\t\t\t\t...rect,\n\t\t\t\tx: Math.round(point.x),\n\t\t\t\ty: Math.round(point.y),\n\t\t\t},\n\t\t}\n\t})\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { WithStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { toSVGPath } from \"library/render/traits/Path.ts\"\nimport type { WithShape } from \"library/render/traits/Shape.ts\"\nimport { roundToHalfPixel } from \"library/render/utils/roundedNumber.ts\"\nimport React from \"react\"\nimport { convertPathToCanvas } from \"../utils/index.ts\"\n\ninterface Props {\n\ttree: CanvasTree\n\tnode: CanvasNode & WithShape & WithStroke\n\tzoom: number\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport class ShapeHighlight extends React.Component<Props, {}> {\n\toverride render() {\n\t\tconst { tree, node, zoom, onContextMenu } = this.props\n\n\t\tconst normalizedPaths = convertPathToCanvas(tree, node, node.calculatedPaths(), zoom)\n\n\t\tconst boundingBox = Path.boundingBox(normalizedPaths)\n\t\tlet { x, y } = boundingBox\n\t\tconst { width, height } = boundingBox\n\t\tx = roundToHalfPixel(x)\n\t\ty = roundToHalfPixel(y)\n\t\tconst translatedPath = toSVGPath(normalizedPaths, { x: -x, y: -y })\n\n\t\tconst style: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\tleft: x,\n\t\t\ttop: y,\n\t\t}\n\n\t\tconst svgStyle: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\twidth: width,\n\t\t\theight: height,\n\t\t\toverflow: \"visible\",\n\t\t\tfill: \"transparent\",\n\t\t\tstrokeWidth: 1,\n\t\t\tstroke: colors.tint,\n\t\t}\n\n\t\treturn (\n\t\t\t<div className=\"ShapeHighlight\" style={style} onContextMenu={onContextMenu}>\n\t\t\t\t<svg\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tstyle={svgStyle}\n\t\t\t\t\tkey={node.id + \"overlay\"}\n\t\t\t\t\tstrokeLinecap={node.lineCap}\n\t\t\t\t\tstrokeLinejoin={node.lineJoin}\n\t\t\t\t>\n\t\t\t\t\t<path d={translatedPath} />\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t)\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ConstrainedAxes } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport type { FramePoint, FramePoints } from \"document/models/FramePoint.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/index.ts\"\nimport type React from \"react\"\nimport * as Cursor from \"utils/cursor.ts\"\n\nexport const resizeKnobRadius = 4.5\n\ninterface Props {\n\tframePoints: FramePoints\n\tindex: number\n\tvisibleMidPoint: boolean\n\tborderColor: string\n\thidden: boolean\n\tconstraints: ConstrainedAxes | null\n\tignorePointerEvents: boolean\n\tskewed?: boolean\n}\n\nexport function ResizeHandle({\n\tindex,\n\tframePoints,\n\tvisibleMidPoint,\n\thidden,\n\tborderColor,\n\tconstraints = null,\n\tignorePointerEvents,\n}: Props) {\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\tconst framePoint = framePoints[index]\n\tassert(framePoint, \"framePoint must be defined\", framePoints, index)\n\n\tconst { x, y, fx, fy } = framePoint\n\tconst style: React.CSSProperties = {\n\t\t...resizeHandlesStyle(borderColor, agentExperimentIsOn),\n\t\topacity: hidden ? 0 : 1,\n\t\tcursor: Cursor.resizing(framePoint, framePoints, constraints),\n\t\tpointerEvents: ignorePointerEvents ? \"none\" : \"auto\",\n\t\ttransform: `translate(${x}px, ${y}px) translateZ(0) translateX(${knobOffset(fx)}px) translateY(${knobOffset(fy)}px)`,\n\t}\n\n\tconst isMidFramePoint = fx === 0.5 || fy === 0.5\n\tif (!visibleMidPoint && isMidFramePoint) {\n\t\tstyle.border = \"none\"\n\t\tstyle.backgroundColor = \"transparent\"\n\t\tstyle.zIndex = 0\n\n\t\tif (fx === 0.5) {\n\t\t\tconst pointBefore = framePoints[index - 1]\n\t\t\tconst pointAfter = framePoints[index + 1]\n\t\t\tassert(pointBefore && pointAfter, \"framePoints must be defined\", framePoints, index)\n\t\t\tstyle.width = Point.distance(pointBefore, pointAfter)\n\t\t\tstyle.transform = `translate(${pointBefore.x}px, ${\n\t\t\t\tpointBefore.y - resizeKnobRadius\n\t\t\t}px) translateZ(0) rotate(${Point.angle(pointBefore, framePoint) + 90}deg)`\n\t\t\tstyle.transformOrigin = `0px ${resizeKnobRadius}px`\n\t\t}\n\n\t\tif (fy === 0.5) {\n\t\t\tconst pointBefore = framePoints[index - 3]\n\t\t\tconst pointAfter = framePoints[index + 3]\n\t\t\tassert(pointBefore && pointAfter, \"framePoints must be defined\", framePoints, index)\n\t\t\tstyle.height = Point.distance(pointBefore, pointAfter)\n\t\t\tstyle.transform = `translate(${pointBefore.x - resizeKnobRadius}px, ${\n\t\t\t\tpointBefore.y\n\t\t\t}px) translateZ(0) rotate(${Point.angle(framePoint, pointAfter)}deg)`\n\t\t\tstyle.transformOrigin = `${resizeKnobRadius}px 0px`\n\t\t}\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tkey={style.cursor} // Change the key when the cursor changed, otherwise cursor doesn't update correctly\n\t\t\tstyle={style}\n\t\t\tonMouseDown={mouseDownHandler(framePoint)}\n\t\t\tonMouseMove={mouseMoveHandler}\n\t\t\tdata-testid={`resizehandle-${fx}-${fy}`}\n\t\t/>\n\t)\n}\n\nfunction mouseDownHandler(framePoint: FramePoint) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst isScaleToolActive = engine.stores.toolStore.tool === Tools.Scale\n\t\treturn engine.setToolWithHandle(isScaleToolActive ? Tools.Scale : Tools.Resize, framePoint, !isScaleToolActive)\n\t})\n}\n\nconst mouseMoveHandler = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tengine.stores.treeStore.setHighlight(null)\n\tevent.stopPropagation()\n})\n\n// Knobs on different position need different offsets to perfectly align their center point with the selection outline.\nfunction knobOffset(position: 0 | 0.5 | 1) {\n\treturn position === 0 ? -Math.floor(resizeKnobRadius) : -Math.ceil(resizeKnobRadius)\n}\n\nexport const resizeHandlesStyle = (borderColor: string, agentExperimentIsOn: boolean): React.CSSProperties => {\n\tconst baseStyles: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\twidth: resizeKnobRadius * 2,\n\t\theight: resizeKnobRadius * 2,\n\t\tborderRadius: 8,\n\t\twillChange: \"transform\",\n\t\tpointerEvents: \"auto\",\n\t\tzIndex: 1,\n\t}\n\n\tif (agentExperimentIsOn) {\n\t\treturn {\n\t\t\t...baseStyles,\n\t\t\tbackgroundColor: borderColor,\n\t\t}\n\t}\n\n\treturn {\n\t\t...baseStyles,\n\t\tbackgroundColor: \"white\",\n\t\tborder: `${borderColor} 1px solid`,\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, PathNode } from \"document/models/CanvasTree/index.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport type React from \"react\"\nimport { ShapeHighlight } from \"../tools/pathEdit/controls/ShapeHighlight.tsx\"\nimport { resizeHandlesStyle } from \"./ResizeHandle.tsx\"\n\ninterface Props {\n\tnode: PathNode\n\tzoom: number\n\ttree: CanvasTree\n\thidden: boolean\n}\n\ninterface HandleProps {\n\tx: number\n\ty: number\n\tindex: 0 | 1\n}\n\nexport function SelectedLine({ node, zoom, tree, hidden }: Props) {\n\tif (hidden) return null\n\n\tconst segmentA = node.pathSegments[0]\n\tconst segmentB = node.pathSegments[1]\n\tif (!segmentA || !segmentB) return null\n\n\tconst pointA = tree.convertPointToCanvas(node, segmentA)\n\tconst pointB = tree.convertPointToCanvas(node, segmentB)\n\n\treturn (\n\t\t<>\n\t\t\t<ShapeHighlight tree={tree} node={node} zoom={zoom} />\n\t\t\t<ResizeHandle x={pointA.x * zoom} y={pointA.y * zoom} index={0} />\n\t\t\t<ResizeHandle x={pointB.x * zoom} y={pointB.y * zoom} index={1} />\n\t\t</>\n\t)\n}\n\nfunction ResizeHandle({ x, y, index }: HandleProps) {\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\t...resizeHandlesStyle(colors.tint, agentExperimentIsOn),\n\t\t\t\ttransform: `translate(${x}px, ${y}px) translateZ(0) translateX(-5px) translateY(-5px)`,\n\t\t\t}}\n\t\t\tonMouseDown={mouseDownHandler(index)}\n\t\t\tonMouseMove={mouseMoveHandler}\n\t\t/>\n\t)\n}\n\nfunction mouseDownHandler(index: 0 | 1) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.toolStore.straightLineAnchorIndex = index\n\t\tengine.setTool(Tools.LineAnchorMove)\n\t})\n}\n\nconst mouseMoveHandler = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tengine.stores.treeStore.setHighlight(null)\n\tevent.stopPropagation()\n})\n", "import { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { withRadiusPerCorner } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\n\ninterface Props {\n\ttree: CanvasTree\n\tnode: Readonly<CanvasNode> & WithRadius\n\tisToolActive?: boolean\n\tborderColor: string\n\tzoom: number\n\thidden?: boolean\n}\n\nexport class BorderRadiusHandle extends React.Component<Props> {\n\tonMouseDown = VekterEngine.shared().scheduler.wrapHandler(() => {\n\t\tVekterEngine.shared().setTool(Tools.Radius)\n\t})\n\n\toverride render() {\n\t\tconst { tree, node, zoom, isToolActive, borderColor, hidden } = this.props\n\t\tconst radius = node.radius ?? 0\n\n\t\tif (isVariableReference(radius) || isComputedValue(radius)) {\n\t\t\treturn null\n\t\t}\n\n\t\tif (withRadiusPerCorner(node) && node.radiusPerCorner) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst frame = tree.getRect(node)\n\t\tconst renderedRect = Rect.multiply(frame, zoom)\n\n\t\tif (renderedRect.width < 32 || renderedRect.height < 32) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst maxRadius = Math.min(frame.width / 2, frame.height / 2)\n\n\t\tlet minProgres = 0\n\t\tif (!isToolActive) {\n\t\t\tconst maxPixels = maxRadius * zoom\n\t\t\tminProgres = 10 / maxPixels\n\t\t}\n\n\t\tconst progress = Math.max(Math.min(radius / maxRadius, 1), minProgres)\n\n\t\tlet min = { x: 0, y: 0 }\n\t\tlet max = { x: maxRadius, y: maxRadius }\n\t\tmin = tree.convertPointToCanvas(node, min, true)\n\t\tmax = tree.convertPointToCanvas(node, max, true)\n\t\tmin.x *= zoom\n\t\tmin.y *= zoom\n\t\tmax.x *= zoom\n\t\tmax.y *= zoom\n\n\t\tconst deltaX = max.x - min.x\n\t\tconst deltaY = max.y - min.y\n\n\t\tconst current = { x: min.x + deltaX * progress, y: min.y + deltaY * progress }\n\n\t\tconst style: React.CSSProperties = {\n\t\t\t...baseStyle,\n\t\t\tborder: `1px solid ${borderColor}`,\n\t\t\ttransform: `translate(${Math.round(current.x - 4.5)}px, ${Math.round(current.y - 4.5)}px) translateZ(0)`,\n\t\t\topacity: hidden ? 0 : 1,\n\t\t}\n\n\t\treturn (\n\t\t\t<div style={style} onMouseDown={this.onMouseDown}>\n\t\t\t\t<div style={centerDot(borderColor)} />\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nconst baseStyle: React.CSSProperties = {\n\tposition: \"absolute\",\n\twidth: 9,\n\theight: 9,\n\tborderRadius: 5,\n\tbackgroundColor: \"white\",\n}\n\nconst centerDot = (tintColor: string): React.CSSProperties => ({\n\tposition: \"absolute\",\n\twidth: 3,\n\theight: 3,\n\tbackgroundColor: tintColor,\n\tleft: 2,\n\ttop: 2,\n\tborderRadius: 1.5,\n})\n", "import { isNumber } from \"@framerjs/assets/src/utils.ts\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { BorderRadiusHandle } from \"document/components/canvas-hud/BorderRadiusHandle.tsx\"\nimport { isWaitingForMeasuredRect } from \"document/components/utils/isWaitingForMeasuredRect.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisRectangleShapeNode,\n\tisShapeContainerNode,\n\tisShapeGroupNode,\n\tisStackComponent,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport { hasVisibleFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { isOverflowVisuallyHidden } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { WithRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { withRadius, withRelativeRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport { hasNonDefaultRadius } from \"document/models/CanvasTree/traits/utils/radius.ts\"\nimport {\n\tconvertFramePointsToCanvas,\n\tgetCornerPointsOnCanvasWithZoom,\n} from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { FramePoints } from \"document/models/FramePoint.ts\"\nimport { FramePoint } from \"document/models/FramePoint.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport type { ToolStore } from \"document/stores/ToolStore.ts\"\nimport { isLayoutSection, simpleSelectionForLayoutSectionEnabled } from \"document/utils/layoutSectionHelpers.ts\"\nimport { Point } from \"library/index.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { forceLayerBackingWithCSSProperties } from \"library/render/utils/setLayerBacked.ts\"\nimport React from \"react\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { ShapeHighlight } from \"../tools/pathEdit/controls/ShapeHighlight.tsx\"\nimport type { CanvasControlSpatialStore } from \"../tools/utils/CanvasControlSpatialStore.ts\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { isSkewedQuadrilateralPoints } from \"../utils/isSkewedQuadrilateralPoints.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\nimport { PaddingHandles } from \"./PaddingHandles.tsx\"\nimport { getInflatedCornerPointsForRotationHandles } from \"./RotationHandle.tsx\"\nimport { SelectionHandles } from \"./SelectionHandles.tsx\"\nimport { StackGapHandles } from \"./StackGapHandles.tsx\"\n\nconst noPointerEventsStyle: React.CSSProperties = { pointerEvents: \"none\" }\nforceLayerBackingWithCSSProperties(noPointerEventsStyle)\n\nfunction radiusHasVisibleEffect(node: Readonly<CanvasNode> & WithRadius): boolean {\n\tif (hasVisibleFill(node)) {\n\t\treturn true\n\t}\n\tif (withBorder(node) && node.borderEnabled) {\n\t\treturn true\n\t}\n\tif (withStroke(node) && node.strokeEnabled) {\n\t\treturn true\n\t}\n\tif (withShadow(node) && node.shadows?.length) {\n\t\treturn true\n\t}\n\tif (isOverflowVisuallyHidden(node) && node.children && isNumber(node.radius) && node.radius > 0) {\n\t\treturn true\n\t}\n\treturn false\n}\n\ninterface Props {\n\ttool: Tools\n\ttree: CanvasTree\n\tselectionWithoutDescendants: NodeID[]\n\tzoom: number\n\tisViewOnly: boolean\n\thidden: boolean\n\tshowSelectionOutline: boolean\n\tisEffectPreview: boolean\n\tisColorSamplerActive: boolean\n\tisMoving: boolean\n\tshiftKey: boolean\n\tctrlKey: boolean\n\taltKey: boolean\n\tcmdKey: boolean\n\tignorePointerEvents: boolean\n\tcanvasControlSpatialStore?: CanvasControlSpatialStore\n\tclippingRect: Rect\n\ttoolStore: ToolStore\n\t// For agent selection mode\n\tdisplayFill?: boolean\n\tskipLargeLayer?: boolean\n}\n\nexport function SelectionBox({\n\ttree,\n\tselectionWithoutDescendants,\n\tzoom,\n\tshowSelectionOutline,\n\thidden,\n\ttool,\n\tisViewOnly,\n\tisEffectPreview,\n\tisColorSamplerActive,\n\tisMoving,\n\tignorePointerEvents,\n\tcanvasControlSpatialStore,\n\tclippingRect,\n\ttoolStore,\n\tdisplayFill = false,\n\tskipLargeLayer = true,\n}: Props) {\n\tconst showSelectionHandles = Boolean(!isViewOnly && engine.tool.displaySelectionHandles)\n\n\tconst isScaleTool = tool === Tools.Scale\n\n\tlet corners: [Point, Point, Point, Point] | undefined\n\tlet inflatedRotationCorners: [Point, Point, Point, Point] | undefined\n\tlet outlines: JSX.Element[] = []\n\tlet borderRadiusHandle: JSX.Element | null = null\n\tlet framePoints: FramePoints | null = null\n\tlet tint = colors.tint\n\tlet isSingleSelectedStackWithoutWrapping = false\n\tlet isWebPageWithLayoutTemplate = false\n\tlet showRotationHandles = false\n\n\tlet isLayoutSectionSelectedWithSimplifiedSelection = false\n\t/**\n\t * Temporarily hide the padding handles when a form is selected. They can\n\t * overlap with the form button. In the future we should use the\n\t * CanvasControlSpatialStore to check if the handle would overlap and only\n\t * hide it then.\n\t */\n\tlet isFormContainerNode = false\n\n\tlet shapeStrokeHighlight: (JSX.Element | null)[] = []\n\n\tif (selectionWithoutDescendants.length === 1) {\n\t\tconst node = tree.getNode(selectionWithoutDescendants[0])\n\n\t\tshowRotationHandles =\n\t\t\t!isNull(node) &&\n\t\t\t!isScaleTool &&\n\t\t\twithRotation(node) &&\n\t\t\t!isVariableReference(node.rotation) &&\n\t\t\t!isLayoutSectionSelectedWithSimplifiedSelection\n\n\t\tif (!node?.cache.visible || isWaitingForMeasuredRect(node) || (withFormInput(node) && node.formInputHidden)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst usesLayoutTemplateRect = withDOMLayout(node) && node.usesLayoutTemplateRectForModuleIdentifierCached()\n\t\tcorners = getCornerPointsOnCanvasWithZoom(tree, node, zoom)\n\n\t\tisWebPageWithLayoutTemplate = !!usesLayoutTemplateRect\n\t\tif (!corners) return null\n\n\t\tisSingleSelectedStackWithoutWrapping = isStackComponent(node) && !node.stackWrapEnabled\n\t\tisFormContainerNode = isFormContainer(node)\n\n\t\tisLayoutSectionSelectedWithSimplifiedSelection =\n\t\t\tisLayoutSection(tree, node) && simpleSelectionForLayoutSectionEnabled(zoom)\n\n\t\tif (withRotation(node)) {\n\t\t\tinflatedRotationCorners = getInflatedCornerPointsForRotationHandles(tree, node, zoom)\n\t\t}\n\n\t\tconst framePointsWithoutZoom = convertFramePointsToCanvas(tree, node)\n\t\tframePoints = framePointsWithoutZoom?.map((point: FramePoint) => ({\n\t\t\t...point,\n\t\t\t...Point.multiply(point, zoom),\n\t\t})) as FramePoints | null\n\t\ttint = getTintColor(node)\n\n\t\tif (\n\t\t\tshowSelectionHandles &&\n\t\t\t!isScaleTool &&\n\t\t\t!isBreakpointVariant(node) &&\n\t\t\twithRadius(node) &&\n\t\t\t!(withRelativeRadius(node) && node.radiusIsRelative) &&\n\t\t\t!isShapeContainerNode(node) &&\n\t\t\tradiusHasVisibleEffect(node) &&\n\t\t\t!isLayoutSectionSelectedWithSimplifiedSelection &&\n\t\t\t!isSkewedQuadrilateralPoints(corners)\n\t\t) {\n\t\t\tborderRadiusHandle = (\n\t\t\t\t<BorderRadiusHandle\n\t\t\t\t\tkey=\"borderRadiusHandle\"\n\t\t\t\t\tnode={node}\n\t\t\t\t\ttree={tree}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tborderColor={tint}\n\t\t\t\t\thidden={hidden}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\tconst shouldRenderShapeHighlight =\n\t\t\twithShape(node) &&\n\t\t\twithStroke(node) &&\n\t\t\t!isShapeGroupNode(node) &&\n\t\t\t// Don't show shape highlight when the selected node is a rectangle,\n\t\t\t// as the highlight won't be pixel-aligned with the selection box due to the tiny rounding difference.\n\t\t\t(!isRectangleShapeNode(node) || hasNonDefaultRadius(node))\n\n\t\tif (shouldRenderShapeHighlight) {\n\t\t\tshapeStrokeHighlight = [<ShapeHighlight key={`shapeHighlight_${node.id}`} tree={tree} node={node} zoom={zoom} />]\n\t\t}\n\t} else {\n\t\tconst selectionFrames = toolStore.getZoomAdjustedSelectionFrames(engine, selectionWithoutDescendants, zoom)\n\n\t\tif (!selectionFrames) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst { merged: mergedFrame, frames: outlineFrames } = selectionFrames\n\n\t\tframePoints = FramePoint.fromFrame(mergedFrame)\n\t\tcorners = Rect.cornerPoints(mergedFrame)\n\n\t\tif (!hidden) {\n\t\t\toutlines = outlineFrames.map((outlineFrame, key) => {\n\t\t\t\treturn <Outline key={key} clippingRect={clippingRect} rect={outlineFrame} />\n\t\t\t})\n\n\t\t\tshapeStrokeHighlight = selectionWithoutDescendants.map(id => {\n\t\t\t\tconst node = tree.getNode(id)\n\t\t\t\tif (!node) return null\n\t\t\t\tif (withShape(node) && withStroke(node) && !isShapeGroupNode(node)) {\n\t\t\t\t\treturn <ShapeHighlight key={`shapehighlight_${id}`} tree={tree} node={node} zoom={zoom} />\n\t\t\t\t}\n\t\t\t\treturn null\n\t\t\t})\n\t\t}\n\t}\n\tconst showStackHandles =\n\t\t!isViewOnly &&\n\t\t!isEffectPreview &&\n\t\tshowSelectionOutline &&\n\t\t!isColorSamplerActive &&\n\t\tisSingleSelectedStackWithoutWrapping &&\n\t\t!isWebPageWithLayoutTemplate\n\tconst showPaddingHandles =\n\t\tshowStackHandles &&\n\t\tengine.tool.displayPaddingHandles &&\n\t\t!isLayoutSectionSelectedWithSimplifiedSelection &&\n\t\t!isFormContainerNode\n\tconst showGapHandles =\n\t\tengine.tool.displayGapHandles && showStackHandles && !isLayoutSectionSelectedWithSimplifiedSelection\n\n\tconst selectionHash = selectionWithoutDescendants.join(\"\")\n\n\treturn (\n\t\t<>\n\t\t\t{outlines}\n\t\t\t{shapeStrokeHighlight}\n\t\t\t<Overlay\n\t\t\t\tpoints={corners}\n\t\t\t\tborderColor={tint}\n\t\t\t\tbackgroundColor={displayFill ? colors.tintDimmed : undefined}\n\t\t\t\tskipLargeLayer={skipLargeLayer}\n\t\t\t\t// @FIXME: Can we early return null in the ToolManager if the selection box needs to be hidden?\n\t\t\t\tborderWidth={hidden ? 0 : 1}\n\t\t\t\ttestId=\"selection-box-overlay\"\n\t\t\t\tclippingRect={clippingRect}\n\t\t\t\tstyle={{ opacity: isMoving ? 0.2 : 1, ...noPointerEventsStyle }}\n\t\t\t>\n\t\t\t\t{({ rect, skewed }) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{showSelectionHandles && framePoints && (\n\t\t\t\t\t\t\t<SelectionHandles\n\t\t\t\t\t\t\t\tkey={selectionHash + \"handles\"}\n\t\t\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t\t\t\tselection={selectionWithoutDescendants}\n\t\t\t\t\t\t\t\tframe={rect}\n\t\t\t\t\t\t\t\thidden={hidden}\n\t\t\t\t\t\t\t\tborderColor={tint}\n\t\t\t\t\t\t\t\tframePoints={framePoints}\n\t\t\t\t\t\t\t\tshowRotationHandles={showRotationHandles}\n\t\t\t\t\t\t\t\tinflatedRotationCorners={inflatedRotationCorners}\n\t\t\t\t\t\t\t\tignorePointerEvents={ignorePointerEvents}\n\t\t\t\t\t\t\t\tisLayoutSectionSelectedWithSimplifiedSelection={isLayoutSectionSelectedWithSimplifiedSelection}\n\t\t\t\t\t\t\t\tforceShowAllHandles={isScaleTool}\n\t\t\t\t\t\t\t\tskewed={skewed}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{showGapHandles && !skewed && canvasControlSpatialStore && (\n\t\t\t\t\t\t\t<StackGapHandles\n\t\t\t\t\t\t\t\tkey={selectionHash + \"gap-handles\"}\n\t\t\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\t\t\tselection={selectionWithoutDescendants}\n\t\t\t\t\t\t\t\tframe={rect}\n\t\t\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\t\t\tcanvasControlSpatialStore={canvasControlSpatialStore}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{showPaddingHandles && !skewed && framePoints && (\n\t\t\t\t\t\t\t<PaddingHandles\n\t\t\t\t\t\t\t\tkey={selectionHash + \"padding-handles\"}\n\t\t\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\t\t\tselection={selectionWithoutDescendants}\n\t\t\t\t\t\t\t\tframe={rect}\n\t\t\t\t\t\t\t\tframePoints={framePoints}\n\t\t\t\t\t\t\t\tzoom={zoom}\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</Overlay>\n\t\t\t{borderRadiusHandle}\n\t\t</>\n\t)\n}\n\n/**\n * Outline rectangles and the clipping rectangle are not shallowly equal on every mousemove, causing re-renders\n */\nconst Outline = React.memo(\n\t({ rect, clippingRect }: { rect: Rect; clippingRect: Rect }) => (\n\t\t<Overlay\n\t\t\tpoints={Rect.cornerPoints(rect)}\n\t\t\troundToOutside={false}\n\t\t\tborderColor={colors.tint}\n\t\t\tborderWidth={1}\n\t\t\topacity={0.3}\n\t\t\tstyle={noPointerEventsStyle}\n\t\t\tclippingRect={clippingRect}\n\t\t/>\n\t),\n\t(prevProps, nextProps) => {\n\t\tconst { rect: prevRect, clippingRect: prevClippingRect } = prevProps\n\t\tconst { rect: nextRect, clippingRect: nextClippingRect } = nextProps\n\n\t\tif (!Rect.equals(prevRect, nextRect)) return false\n\t\tif (!Rect.equals(prevClippingRect, nextClippingRect)) return false\n\n\t\treturn true\n\t},\n)\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isOverflowVisuallyHidden } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport { getCanvasBoundingRectCached } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\n\nexport function isClippedOnCanvasByGroundNode(engine: VekterEngine, node: CanvasNode): boolean {\n\tconst groundNode = engine.tree.get(engine.stores.treeStore.treeIndex.getGroundNodeIdFor(node.id))\n\treturn (\n\t\t!!groundNode &&\n\t\tisOverflowVisuallyHidden(groundNode) &&\n\t\t!Rect.containsRect(\n\t\t\tgetCanvasBoundingRectCached(engine.tree, groundNode),\n\t\t\tgetCanvasBoundingRectCached(engine.tree, node),\n\t\t)\n\t)\n}\n", "import \"PaddingOverlay.styles_1x6x2tc.wyw.css\"; export const wrapper = \"wrapper_w11vcdps\";", "/* eslint-disable jsx-a11y/interactive-supports-focus */\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport * as handleStyles from \"./SpacerHandle.styles.ts\"\n\nexport const handleLongSide = 20\nconst handleShortSide = 4\n\ninterface SpacerHandleProps {\n\tonMouseDown?: (event: React.MouseEvent) => void\n\tonMouseUp?: (event: React.MouseEvent) => void\n\tonMouseMove?: (event: React.MouseEvent) => void\n\n\tisDragging: boolean\n\tisVertical: boolean\n\tsize: number\n\tcursor: string | undefined\n\tstyle?: React.CSSProperties\n\n\ttint: string\n\thoveredBackgroundColor: string\n\n\thandleStyle?: React.CSSProperties\n}\n\n/** Adjusts small gap handles so that they hug the stack parent dimensions  */\nfunction getAdjustedSize(size: number): number {\n\tif (size === 0) return handleShortSide\n\n\treturn size\n}\n\nexport const SpacerHandle = ({\n\tsize,\n\tisVertical,\n\tisDragging,\n\tcursor,\n\tonMouseDown,\n\tonMouseUp,\n\tonMouseMove,\n\tstyle,\n\ttint,\n\thoveredBackgroundColor,\n\thandleStyle,\n}: SpacerHandleProps) => {\n\tconst [isHovered, setIsHovered] = React.useState(false)\n\tconst styles = {\n\t\theight: isVertical ? getAdjustedSize(size) : \"100%\",\n\t\twidth: isVertical ? \"100%\" : getAdjustedSize(size),\n\t\ttop: isVertical ? 0 : undefined,\n\t\tbottom: isVertical ? 0 : undefined,\n\t\tleft: isVertical ? undefined : 0,\n\t\tright: isVertical ? undefined : 0,\n\t\t...style,\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\tclassName={handleStyles.control}\n\t\t\tstyle={styles}\n\t\t>\n\t\t\t{size > 0 && (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{ \"--hovered-bg-color\": hoveredBackgroundColor }}\n\t\t\t\t\tclassName={cx(handleStyles.controlBg, isHovered && !isDragging && handleStyles.controlBgHovered)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<div\n\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\tonMouseMove={onMouseMove}\n\t\t\t\tonMouseUp={onMouseUp}\n\t\t\t\trole=\"button\"\n\t\t\t\tclassName={cx(handleStyles.handle, isDragging && handleStyles.handleWithoutPointerEvents)}\n\t\t\t\tstyle={{\n\t\t\t\t\t\"--tint\": tint,\n\t\t\t\t\theight: isVertical ? handleShortSide : handleLongSide,\n\t\t\t\t\twidth: isVertical ? handleLongSide : handleShortSide,\n\t\t\t\t\tcursor,\n\t\t\t\t\t...handleStyle,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n", "import \"SpacerHandle.styles_1fboqxi.wyw.css\"; export const control = \"control_cu9nhr8\";\nexport const controlBg = \"controlBg_c44wqtc\";\nexport const controlBgHovered = \"controlBgHovered_c1wepey\";\nexport const handle = \"handle_h1uq6vx4\";\nexport const handleWithoutPointerEvents = \"handleWithoutPointerEvents_h12wyzfs\";", "import { colors } from \"@framerjs/fresco/tokens\"\nimport type { PaddingSize } from \"document/components/tools/Padding.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { StackComponentNode } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isRotated } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { convertRectToCanvasWithRotation } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { FramePoint, FramePoints } from \"document/models/FramePoint.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { paddingFromNode } from \"document/utils/StackComponent/paddingFromNode.ts\"\nimport { getSingleSelectedStackNode } from \"document/utils/getSingleSelectedStackNode.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type React from \"react\"\nimport * as Cursor from \"utils/cursor.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { isClippedOnCanvasByGroundNode } from \"../utils/isClippedOnCanvasByGroundNode.ts\"\nimport * as styles from \"./PaddingOverlay.styles.ts\"\nimport { SpacerHandle, handleLongSide } from \"./SpacerHandle.tsx\"\n\nconst createMouseDownHandler = (framePoint: FramePoint) =>\n\tengine.scheduler.wrapHandler(() => {\n\t\tengine.setToolWithHandle(Tools.Padding, framePoint)\n\t})\n\nconst mouseMoveHandler = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tengine.stores.treeStore.setHighlight(null)\n\tevent.stopPropagation()\n})\n\ninterface Padding {\n\ttop: number\n\tleft: number\n\tbottom: number\n\tright: number\n}\n\n/**\n * Will calculate the effective padding around the content of the stack and\n * adjust it for the current zoom level. The effective (or visual) padding is\n * the actual distance between the edge of the content bounding box and the edge\n * of the container, regardless of the real CSS padding value.\n *\n * For example, if a 10px tall Frame is positioned at the bottom of a 50px tall\n * stack, which has 5px padding on each side, then the distance from the top\n * edge of the container to the top edge of the frame is 35px, not 5px.\n *\n * We use this function to correctly center the padding handles around the\n * content of a stack in the case where one side is Fixed, and the other one is\n * Auto.\n *\n * @param node\n * @param zoom\n * @returns\n */\nconst getZoomAdjustedEffectivePaddingForNode = (node: StackComponentNode, zoom: number): Padding => {\n\tconst rect = convertRectToCanvasWithRotation(engine.tree, node)\n\tconst childrenRects = engine.stores.layoutCache.getChildrenRects(node.id)\n\n\t// The padding handles won't be rendered if the padding is dynamic.\n\tif (isDynamicValue(node.padding)) {\n\t\treturn { top: 0, bottom: 0, left: 0, right: 0 }\n\t}\n\n\tlet padding: Padding = paddingFromNode(node)\n\n\tif (childrenRects && childrenRects.length > 0) {\n\t\tconst contentRect = Rect.merge(...childrenRects)\n\t\tpadding = {\n\t\t\ttop: contentRect.y,\n\t\t\tleft: contentRect.x,\n\t\t\tbottom: rect.height - Rect.maxY(contentRect),\n\t\t\tright: rect.width - Rect.maxX(contentRect),\n\t\t}\n\t}\n\n\treturn {\n\t\ttop: padding.top * zoom,\n\t\tbottom: padding.bottom * zoom,\n\t\tleft: padding.left * zoom,\n\t\tright: padding.right * zoom,\n\t}\n}\n\ninterface Props {\n\ttool: Tools\n\tframe: Rect\n\tframePoints: FramePoints\n\tselection: NodeID[]\n\tzoom: number\n}\n\nexport function PaddingHandles({ tool, selection, frame, framePoints, zoom }: Props) {\n\tconst { handle } = engine\n\tconst isPaddingToolActive = tool === Tools.Padding\n\tconst node = getSingleSelectedStackNode(selection, engine.tree)\n\tif (!node || node.children.length === 0) return null\n\tif (isDynamicValue(node.padding)) return null\n\n\tconst padding = getZoomAdjustedEffectivePaddingForNode(node, zoom)\n\n\tconst allowVerticalResize = node.heightType === DimensionType.Auto && enoughSpaceForHandles(false, frame, padding)\n\tconst allowHorizontalResize = node.widthType === DimensionType.Auto && enoughSpaceForHandles(true, frame, padding)\n\n\tif (!allowHorizontalResize && !allowVerticalResize) return null\n\n\t// If the Stack is clipped by the ground node, don't show the padding handles.\n\tif (isClippedOnCanvasByGroundNode(engine, node)) return null\n\n\t// If the Stack is rotated, don't show the padding handles.\n\tif (isRotated(node)) {\n\t\treturn null\n\t}\n\n\tconst paddingHandlePoints: FramePoint[] = []\n\n\tlet currentlyDraggedHandle: FramePoint | undefined\n\n\tif (isPaddingToolActive) {\n\t\t// The actual x and y of the frame point will change as we update the\n\t\t// node, so we compare only the relative fx / fy to find the currently\n\t\t// dragged padding handle\n\t\tif (isNull(handle)) return null\n\t\tcurrentlyDraggedHandle = framePoints.find(point => point.fx === handle.fx && point.fy === handle.fy)\n\t}\n\n\t// If we're currently dragging a padding handle it should be the only one displayed\n\tif (currentlyDraggedHandle) {\n\t\tpaddingHandlePoints.push(currentlyDraggedHandle)\n\t} else {\n\t\tif (allowVerticalResize) {\n\t\t\t// 1 = top midpoint, 7 = bottom midpoint\n\t\t\tpaddingHandlePoints.push(framePoints[1], framePoints[7])\n\t\t}\n\n\t\tif (allowHorizontalResize) {\n\t\t\t// 3 = left midpoint, 5 = right midpoint\n\t\t\tpaddingHandlePoints.push(framePoints[3], framePoints[5])\n\t\t}\n\t}\n\n\t// 0 = top midpoint, 1 = bottom midpoint, 2 = left midpoint, 3 = right midpoint\n\tconst handles = paddingHandlePoints.map(point => {\n\t\tconst size = paddingForSide(padding, point)\n\t\tconst cursor = Cursor.resizing(point, framePoints, null)\n\n\t\treturn (\n\t\t\t<SpacerHandle\n\t\t\t\tkey={`padding-handle-${point.fx}-${point.fy}`}\n\t\t\t\tsize={size}\n\t\t\t\tisVertical={point.fx === 0.5}\n\t\t\t\tisDragging={point === currentlyDraggedHandle}\n\t\t\t\ttint={colors.tint}\n\t\t\t\thoveredBackgroundColor={colors.tintDimmed}\n\t\t\t\tcursor={cursor}\n\t\t\t\tonMouseDown={createMouseDownHandler(point)}\n\t\t\t\tonMouseMove={mouseMoveHandler}\n\t\t\t\tstyle={{\n\t\t\t\t\ttop: point.fy === 1 ? undefined : 0,\n\t\t\t\t\tbottom: point.fy === 0 ? undefined : 0,\n\t\t\t\t\tleft: point.fx === 1 ? undefined : 0,\n\t\t\t\t\tright: point.fx === 0 ? undefined : 0,\n\t\t\t\t}}\n\t\t\t\thandleStyle={{\n\t\t\t\t\ttransform: transformForSide(point),\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={styles.wrapper}\n\t\t\tstyle={{\n\t\t\t\twidth: frame.width,\n\t\t\t\theight: frame.height,\n\t\t\t}}\n\t\t>\n\t\t\t{handles}\n\t\t</div>\n\t)\n}\n\nconst paddingHandleMargin = 20\n\nfunction enoughSpaceForHandles(horizontal: boolean, frame: Rect, padding: Padding): boolean {\n\t// Find the center of the intersection of the content bounds and the\n\t// container frame. In the case where the content bounds are sticking\n\t// outside of the stack's frame, this would be the visible portion of the\n\t// content. The padding handles will be centered around it.\n\tconst visibleMinX = Math.max(0, padding.left)\n\tconst visibleMinY = Math.max(0, padding.top)\n\tconst visibleMaxX = Math.min(frame.width, frame.width - padding.right)\n\tconst visibleMaxY = Math.min(frame.height, frame.height - padding.bottom)\n\tconst contentCenter = {\n\t\tx: visibleMinX + (visibleMaxX - visibleMinX) / 2,\n\t\ty: visibleMinY + (visibleMaxY - visibleMinY) / 2,\n\t}\n\n\t// Pick two points that represent the extremes of the handle on its longer\n\t// side. In the horizontal padding case the handle itself is a tall\n\t// rectangle, so we'll pick points on the top and bottom edges. Respectively\n\t// in the vertical padding case we'll pick points on the left and right\n\t// edges.\n\tconst handleOffset = handleLongSide / 2 + paddingHandleMargin\n\tconst edgePoints: Point[] = []\n\tif (horizontal) {\n\t\tedgePoints.push(Point(0, contentCenter.y - handleOffset), Point(0, contentCenter.y + handleOffset))\n\t} else {\n\t\tedgePoints.push(Point(contentCenter.x - handleOffset, 0), Point(contentCenter.x + handleOffset, 0))\n\t}\n\n\t// Check if both points are inside the container frame, which would mean\n\t// that the handle can fit.\n\tconst frameAtOrigin = Rect.atOrigin(frame)\n\treturn edgePoints.every(point => Rect.containsPoint(frameAtOrigin, point))\n}\n\nfunction paddingForSide(padding: PaddingSize, framePoint: FramePoint): number {\n\tif (framePoint.fy === 0) {\n\t\treturn padding.top\n\t} else if (framePoint.fy === 1) {\n\t\treturn padding.bottom\n\t} else if (framePoint.fx === 0) {\n\t\treturn padding.left\n\t} else if (framePoint.fx === 1) {\n\t\treturn padding.right\n\t} else {\n\t\treturn 0\n\t}\n}\n\nconst handleOffsetAmount = 1\n\nfunction transformForSide(framePoint: FramePoint): string {\n\tif (framePoint.fy === 0) {\n\t\treturn `translateY(-${handleOffsetAmount}px)`\n\t} else if (framePoint.fy === 1) {\n\t\treturn `translateY(${handleOffsetAmount}px)`\n\t} else if (framePoint.fx === 0) {\n\t\treturn `translateX(-${handleOffsetAmount}px)`\n\t} else {\n\t\treturn `translateX(${handleOffsetAmount}px)`\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { FramePoint, FramePoints } from \"document/models/FramePoint.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/index.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type React from \"react\"\nimport * as Cursor from \"utils/cursor.ts\"\nimport { resizeKnobRadius } from \"./ResizeHandle.tsx\"\n\nconst hitTargetSize = 18\n\ninterface Props {\n\tframe: Rect\n\tframePoints: FramePoints\n\tinflatedCorners: [Point, Point, Point, Point] | undefined\n\tindex: number\n\thidden: boolean\n\tignorePointerEvents: boolean\n}\n\nexport function RotationHandle({ frame, index, framePoints, inflatedCorners, hidden, ignorePointerEvents }: Props) {\n\tconst framePoint = framePoints[index]\n\tassert(framePoint, \"framePoint must be defined\", framePoints, index)\n\n\tif (!inflatedCorners) return null\n\n\tconst { x, y } = translateForHandle(framePoint, framePoints, frame, inflatedCorners)\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tbackgroundColor: \"transparent\",\n\t\twidth: hitTargetSize,\n\t\theight: hitTargetSize,\n\t\topacity: hidden ? 0 : 1,\n\t\twillChange: \"transform\",\n\t\ttransform: `translate(${x}px, ${y}px) translate(-50%, -50%) translateZ(0)`,\n\t\tcursor: Cursor.rotating(framePoint, framePoints),\n\t\tpointerEvents: ignorePointerEvents ? \"none\" : \"auto\",\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tkey={style.cursor} // Change the key when the cursor changed, otherwise cursor doesn't update correctly\n\t\t\tstyle={style}\n\t\t\tonMouseDown={mouseDownHandler(framePoint)}\n\t\t\tonMouseMove={mouseMoveHandler}\n\t\t/>\n\t)\n}\n\n/**\n * We need to offset the rotation handle hit target to extend from the resize handle (knob) in the outward directions.\n * To achieve that, we inflate the polygon by half of the hit target size and use the inflated corners as the center\n * point for the hit target.\n *\n *  Before offset:\n *  O\u2500\u2500\u2500\u2500\u2510\n *  \u2502    \u2502\n *  \u2502    \u2502\n *  \u2514\u2500\u2500\u2500\u2500\u2518\n * After offset:\n *  \u250C\u2500\u2500\u2500\u2500\u2510     \u250C\u2500\u2500\u2500\u2500\u2510\n *  \u2502(0) \u2502     \u2502 (1)\u2502\n *  \u2502   o\u251C\u2500\u2500\u2500\u2500\u2500\u2524o   \u2502\n *  \u2514\u2500\u2500\u2500\u252C\u2518     \u2514\u252C\u2500\u2500\u2500\u2518\n *      \u2502       \u2502\n *  \u250C\u2500\u2500\u2500\u2534\u2510     \u250C\u2534\u2500\u2500\u2500\u2510\n *  \u2502   o\u251C\u2500\u2500\u2500\u2500\u2500\u2524o   \u2502\n *  \u2502(3) \u2502     \u2502 (2)\u2502\n *  \u2514\u2500\u2500\u2500\u2500\u2518     \u2514\u2500\u2500\u2500\u2500\u2518\n */\nfunction translateForHandle(\n\tframePoint: FramePoint,\n\tframePoints: FramePoints,\n\tboundingRect: Rect,\n\tinflatedCorners: [Point, Point, Point, Point],\n) {\n\tconst cornerIndex = cornerIndexFromFramePointIndex(framePoint, framePoints)\n\tconst corner = inflatedCorners[cornerIndex]\n\tassert(corner, \"rotation corner must be defined\", inflatedCorners, cornerIndex)\n\n\treturn {\n\t\tx: corner.x - boundingRect.x,\n\t\ty: corner.y - boundingRect.y,\n\t}\n}\n\n/**\n * Given a corner framePoint, return its corner index: tl: 0, tr: 1, br: 2, bl: 3\n *\n *   0   1   2         0       1\n *    o\u2500\u2500o\u2500\u2500o           o\u2500\u2500o\u2500\u2500o\n *    \u2502  4  \u2502           \u2502     \u2502\n *  3 o  o  o 5  ==>    o  o  o\n *    \u2502     \u2502           \u2502     \u2502\n *    o\u2500\u2500o\u2500\u2500o           o\u2500\u2500o\u2500\u2500o\n *   6   7   8         3       2\n */\n\nfunction cornerIndexFromFramePointIndex(framePoint: FramePoint, framePoints: FramePoints): number {\n\tconst handleIndex = framePoints.findIndex(fp => fp.fx === framePoint.fx && fp.fy === framePoint.fy)\n\tswitch (handleIndex) {\n\t\tcase 0:\n\t\t\treturn 0\n\t\tcase 2:\n\t\t\treturn 1\n\t\tcase 6:\n\t\t\treturn 3\n\t\tcase 8:\n\t\t\treturn 2\n\t\tdefault:\n\t\t\treturn 0\n\t}\n}\n\nfunction mouseDownHandler(framePoint: FramePoint) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tengine.setToolWithHandle(Tools.Rotate, framePoint)\n\t})\n}\n\nconst mouseMoveHandler = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tengine.stores.treeStore.setHighlight(null)\n\tevent.stopPropagation()\n})\n\nexport function getInflatedCornerPointsForRotationHandles(tree: CanvasTree, node: CanvasNode, zoom: number) {\n\tconst nodeRect = tree.getRect(node)\n\tconst scale = withTransforms(node) ? (node.resolveValue(\"scale\") ?? 1) : 1\n\n\tconst inflatedNodeRect = Rect.inflate(\n\t\tRect.atOrigin(nodeRect),\n\t\tscale ? (hitTargetSize / 2 - resizeKnobRadius) / scale / zoom : 0,\n\t)\n\n\treturn Rect.cornerPoints(inflatedNodeRect).map(point =>\n\t\tPoint.multiply(tree.convertPointToCanvas(node, point), zoom),\n\t) as [Point, Point, Point, Point]\n}\n", "import { experiments } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { hasGridLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { ConstrainedAxes } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { constraintsForNodeRect } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { getDimensionOrVariantDimensionType } from \"document/models/CanvasTree/traits/utils/getDimensionOrVariantDimensionType.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { FramePoints } from \"document/models/FramePoint.ts\"\nimport type { Point } from \"library/index.ts\"\nimport { DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport { isFiniteNumber } from \"library/render/utils/isFiniteNumber.ts\"\nimport { ResizeHandle } from \"./ResizeHandle.tsx\"\nimport { RotationHandle } from \"./RotationHandle.tsx\"\n\nconst allMidPoints = [1, 3, 5, 7]\nObject.freeze(allMidPoints)\n\ninterface Props {\n\ttree: CanvasTree\n\tframe: Rect\n\tselection: NodeID[]\n\tframePoints: FramePoints\n\tshowRotationHandles: boolean\n\tinflatedRotationCorners: [Point, Point, Point, Point] | undefined\n\tborderColor: string\n\tignorePointerEvents: boolean\n\thidden: boolean\n\tisLayoutSectionSelectedWithSimplifiedSelection: boolean\n\tforceShowAllHandles: boolean\n\tskewed?: boolean\n}\n\nexport function SelectionHandles(props: Props) {\n\tconst {\n\t\tframe,\n\t\tframePoints,\n\t\tshowRotationHandles,\n\t\tinflatedRotationCorners,\n\t\tselection,\n\t\ttree,\n\t\thidden,\n\t\tborderColor,\n\t\tignorePointerEvents,\n\t\tforceShowAllHandles,\n\t\tskewed = false,\n\t} = props\n\tconst singleSelection = selection.length === 1\n\n\tlet singleSelectedNode: CanvasNode | null = null\n\n\tif (singleSelection) {\n\t\tsingleSelectedNode = tree.getNode(selection[0])\n\t\tif (!singleSelectedNode) {\n\t\t\treturn null\n\t\t}\n\t}\n\n\tconst resizeHandles: JSX.Element[] = []\n\tconst rotationHandles: JSX.Element[] = []\n\n\tlet resizeFramePointIndexes: number[] = []\n\tconst visibleMidPointFramePointIndexes: number[] = forceShowAllHandles ? allMidPoints : []\n\tconst rotationFramePointIndexes: number[] = []\n\n\tframePoints.forEach((framePoint, index) => {\n\t\tconst { fx, fy } = framePoint\n\t\tconst isMidPoint = fx === 0.5 || fy === 0.5\n\t\tconst isCenter = fx === 0.5 && fy === 0.5\n\t\tif (isCenter) return false\n\n\t\t// only show handles when there is enough space\n\t\tconst threshold = 20\n\t\tif (frame.height < threshold || frame.width < threshold) {\n\t\t\t// If the frame is skewed, just hide all handles when there's not enough space, as picking two corner\n\t\t\t// handles won't necessarily match the bounding lines anymore in a skewed rect. If `forceShowAllHandles` is\n\t\t\t// true, such as with Scale Tool, we will show handles for skewed nodes.\n\t\t\tif (skewed && !forceShowAllHandles) return false\n\n\t\t\tif ((fy === 1 && fx === 0) || (fy === 0 && fx === 1)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif (fx === 0.5 && frame.height < threshold) return false\n\t\tif (fy === 0.5 && frame.width < threshold) return false\n\t\tif (frame.width < threshold * 0.7 && frame.height < threshold * 0.7) return false\n\n\t\tif (!isMidPoint) {\n\t\t\trotationFramePointIndexes.push(index)\n\t\t}\n\n\t\tresizeFramePointIndexes.push(index)\n\t})\n\n\tlet isAutoWidth = false\n\tlet isAutoHeight = false\n\tlet isFractionWidth = false\n\tlet isFractionHeight = false\n\tlet isAnyRelativeDimension = false\n\tlet constraints: ConstrainedAxes | null = null\n\tlet isFullWidthGridCell = false\n\tlet isFullHeightGridCell = false\n\tconst isRichTextWithTextFit = isRichTextNode(singleSelectedNode) && singleSelectedNode.textFitViewBoxSize\n\tif (singleSelectedNode && isPinnable(singleSelectedNode)) {\n\t\tconst { widthType, heightType } = getDimensionOrVariantDimensionType(engine.componentLoader, singleSelectedNode)\n\t\tisAutoWidth = isAutoDimensionType(widthType)\n\t\tisAutoHeight = isAutoDimensionType(heightType)\n\t\tisFractionWidth = widthType === DimensionType.FractionOfFreeSpace\n\t\tisFractionHeight = heightType === DimensionType.FractionOfFreeSpace\n\t\tisAnyRelativeDimension = heightType === DimensionType.Percentage || widthType === DimensionType.Percentage\n\n\t\tconst parent = tree.getParent(singleSelectedNode.id)\n\t\tconstraints = constraintsForNodeRect(\n\t\t\tsingleSelectedNode,\n\t\t\ttree.getRect(singleSelectedNode),\n\t\t\tengine.componentLoader,\n\t\t\ttree.getParentSizeInfo(singleSelectedNode),\n\t\t)\n\t\tisFullWidthGridCell = Boolean(\n\t\t\twithGridItemSize(singleSelectedNode) &&\n\t\t\tparent &&\n\t\t\thasGridLayout(parent) &&\n\t\t\tsingleSelectedNode.gridItemFillCellWidth &&\n\t\t\tisPositionRelative(singleSelectedNode, parent),\n\t\t)\n\n\t\tisFullHeightGridCell = Boolean(\n\t\t\twithGridItemSize(singleSelectedNode) &&\n\t\t\tparent &&\n\t\t\thasGridLayout(parent) &&\n\t\t\tsingleSelectedNode.gridItemFillCellHeight &&\n\t\t\t(experiments.isOn(\"gridBentoFit\") || singleSelectedNode.cache.parentDirectedRowHeightType !== \"fit\") &&\n\t\t\tisPositionRelative(singleSelectedNode, parent),\n\t\t)\n\t}\n\n\t// If the current frame cannot be resized on an axis due to size\n\t// constraints, don't show handles for that axis.\n\tconst isLockedX = (constraints?.x.max && constraints.x.min) || isFullWidthGridCell\n\tconst isLockedY = (constraints?.y.max && constraints.y.min) || isFullHeightGridCell\n\n\t// The logic below clears out and adds back in certain handles based on node properties. For the prop\n\t// `forceShowAllHandles`, it avoids all of this resetting logic and retains all handles set previously.\n\tif (!forceShowAllHandles) {\n\t\tif (isAnyRelativeDimension && singleSelectedNode && singleSelectedNode.cache.parentDirected === \"grid\") {\n\t\t\t// clear resize handles\n\t\t\tresizeFramePointIndexes = []\n\t\t} else if (\n\t\t\tsingleSelectedNode &&\n\t\t\t(isAutoWidth || isAutoHeight || isFractionWidth || isFractionHeight || isLockedX || isLockedY)\n\t\t) {\n\t\t\t// clear default resize handles\n\t\t\tresizeFramePointIndexes = []\n\n\t\t\t// Stack children with aspect ratio locked, and a fractional\n\t\t\t// dimension cannot be resized.\n\t\t\tconst isAspectLocked =\n\t\t\t\t(isFractionHeight || isFractionWidth || isFullWidthGridCell || isFullHeightGridCell) &&\n\t\t\t\twithAspectRatio(singleSelectedNode) &&\n\t\t\t\tisFiniteNumber(singleSelectedNode.aspectRatio)\n\n\t\t\tconst framePointIndexes: number[] = []\n\t\t\tif ((isAutoWidth && isAutoHeight) || (isLockedX && isLockedY) || isAspectLocked) {\n\t\t\t\tif (\n\t\t\t\t\tisAnyTextNode(singleSelectedNode) &&\n\t\t\t\t\t!isFullWidthGridCell &&\n\t\t\t\t\t!isFullHeightGridCell &&\n\t\t\t\t\t!isRichTextWithTextFit\n\t\t\t\t) {\n\t\t\t\t\tconst fontSizes = singleSelectedNode.getFontSizes(false)\n\t\t\t\t\tconst hasVariableReference = fontSizes.some(isVariableReference)\n\n\t\t\t\t\tconst hasTextStylePreset = isRichTextNode(singleSelectedNode) && singleSelectedNode.hasTextStylePresets(false)\n\n\t\t\t\t\tif (!hasVariableReference && !hasTextStylePreset) {\n\t\t\t\t\t\tframePointIndexes.push(framePointIndexForAutoSizedTextNode(tree, singleSelectedNode))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!isAutoHeight && !isFractionHeight && !isLockedY) {\n\t\t\t\t\tframePointIndexes.push(1, 7)\n\t\t\t\t}\n\t\t\t\tif (!isAutoWidth && !isFractionWidth && !isLockedX) {\n\t\t\t\t\tframePointIndexes.push(3, 5)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tframePointIndexes.forEach(index => {\n\t\t\t\tresizeFramePointIndexes.push(index)\n\t\t\t\tvisibleMidPointFramePointIndexes.push(index)\n\t\t\t})\n\t\t}\n\t}\n\n\tresizeFramePointIndexes.forEach(index => {\n\t\tconst handle = (\n\t\t\t<ResizeHandle\n\t\t\t\tkey={index}\n\t\t\t\tindex={index}\n\t\t\t\tframePoints={framePoints}\n\t\t\t\tvisibleMidPoint={false}\n\t\t\t\tborderColor={borderColor}\n\t\t\t\thidden={hidden}\n\t\t\t\tskewed={skewed}\n\t\t\t\tconstraints={constraints}\n\t\t\t\tignorePointerEvents={ignorePointerEvents}\n\t\t\t/>\n\t\t)\n\n\t\tresizeHandles.push(handle)\n\t})\n\n\t// The visible midpoint resize handles will be rendered on top of regular resize\n\t// handles. In the auto-width/height case, each edge will get a invisible midpoint\n\t// handle, which will cover the length of the edge, and a visible midpoint handle,\n\t// which will just render the little circle.\n\tvisibleMidPointFramePointIndexes.forEach(index => {\n\t\tconst handle = (\n\t\t\t<ResizeHandle\n\t\t\t\tkey={`midpoint-handle-${index}`}\n\t\t\t\tindex={index}\n\t\t\t\tframePoints={framePoints}\n\t\t\t\tvisibleMidPoint\n\t\t\t\tborderColor={borderColor}\n\t\t\t\thidden={hidden}\n\t\t\t\tskewed={skewed}\n\t\t\t\tconstraints={constraints}\n\t\t\t\tignorePointerEvents={ignorePointerEvents}\n\t\t\t/>\n\t\t)\n\n\t\tresizeHandles.push(handle)\n\t})\n\n\tif (showRotationHandles) {\n\t\trotationFramePointIndexes.forEach(index => {\n\t\t\tconst rotationHandle = (\n\t\t\t\t<RotationHandle\n\t\t\t\t\tkey={`rotation-handle-${index}`}\n\t\t\t\t\tframe={frame}\n\t\t\t\t\tindex={index}\n\t\t\t\t\tframePoints={framePoints}\n\t\t\t\t\thidden={hidden}\n\t\t\t\t\tinflatedCorners={inflatedRotationCorners}\n\t\t\t\t\tignorePointerEvents={ignorePointerEvents}\n\t\t\t\t/>\n\t\t\t)\n\t\t\trotationHandles.push(rotationHandle)\n\t\t})\n\t}\n\n\treturn <>{[...rotationHandles, ...resizeHandles]}</>\n}\n\nconst framePointIndexForAutoSizedTextNode = (tree: CanvasTree, node: CanvasNode & WithPins) => {\n\tif (tree.getParent(node.id) === null) {\n\t\treturn 7\n\t}\n\n\tif (node.top !== null) {\n\t\tif (node.left !== null) {\n\t\t\treturn 8\n\t\t} else if (node.right !== null) {\n\t\t\treturn 6\n\t\t} else {\n\t\t\treturn 7\n\t\t}\n\t}\n\tif (node.bottom !== null) {\n\t\tif (node.left !== null) {\n\t\t\treturn 2\n\t\t} else if (node.right !== null) {\n\t\t\treturn 0\n\t\t} else {\n\t\t\treturn 1\n\t\t}\n\t} else {\n\t\tif (node.left !== null) {\n\t\t\treturn 5\n\t\t} else if (node.right !== null) {\n\t\t\treturn 3\n\t\t} else {\n\t\t\treturn 7\n\t\t}\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/src/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { supportGap } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isRotated } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { FramePoint } from \"document/models/FramePoint.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { getLayoutDirectionValue } from \"document/utils/getLayoutDirectionValue.ts\"\nimport { getSingleSelectedStackNode } from \"document/utils/getSingleSelectedStackNode.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { cursorImage } from \"utils/cursor.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { CanvasControlSpatialStore } from \"../tools/utils/CanvasControlSpatialStore.ts\"\nimport {\n\tgetConstrainedZoomAdjustedPaddings,\n\tgetNumericGapUnlessDynamic,\n\tgetZoomAdjustedChildrenRects,\n\tgetZoomAdjustedGapRects,\n} from \"../utils/stackLayoutHelpers.ts\"\nimport * as wrapperStyles from \"./PaddingOverlay.styles.ts\"\nimport { SpacerHandle } from \"./SpacerHandle.tsx\"\n\nconst mouseMoveHandler = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\tengine.stores.treeStore.setHighlight(null)\n\tevent.stopPropagation()\n})\ninterface GapInfo {\n\tpoint: FramePoint\n\trect: Rect\n}\ninterface Props {\n\ttool: Tools\n\tframe: Rect\n\tselection: NodeID[]\n\tzoom: number\n\tcanvasControlSpatialStore: CanvasControlSpatialStore\n}\n\nexport function StackGapHandles({ tool, selection, frame, zoom, canvasControlSpatialStore }: Props) {\n\tconst currentlyDraggedHandleIndexRef = React.useRef<number | null>(null)\n\n\tconst isGapToolActive = tool === Tools.Gap\n\tconst stack = getSingleSelectedStackNode(selection, engine.tree)\n\n\tif (!stack || stack.children.length === 0 || !supportGap(stack)) return null\n\n\tconst stackDirection = stack.resolveValue(\"stackDirection\")\n\tif (!stackDirection) return null\n\n\tconst gap = getNumericGapUnlessDynamic(stack.gap, stackDirection)\n\tif (!isNumber(gap)) return null\n\n\tconst activeLocale = engine.tree.root.getLocale(engine.stores.chromeStore.canvasLocaleId)\n\tconst layoutDirection = getLayoutDirectionValue(activeLocale, engine.tree.root.adaptLayoutToTextDirection)\n\n\tconst childrenRects = getZoomAdjustedChildrenRects(engine, stack, zoom)\n\tconst padding = getConstrainedZoomAdjustedPaddings(zoom, stack, frame, Rect.merge(...childrenRects))\n\tconst gapRects = getZoomAdjustedGapRects(stack, zoom, frame, childrenRects, padding, layoutDirection)\n\tif (!gapRects) return null\n\n\t// If the Stack is rotated, don't show the gap handles.\n\tif (isRotated(stack)) {\n\t\treturn null\n\t}\n\n\tconst gapsInfo: GapInfo[] = gapRects.map(gapRect => {\n\t\tconst points = FramePoint.fromFrame(gapRect)\n\t\t// return the center point\n\t\treturn { point: points[4], rect: gapRect } as GapInfo\n\t})\n\n\tconst isVertical = stackDirection === \"vertical\"\n\n\tlet displayedHandles: GapInfo[] = []\n\tlet currentlyDraggedHandle: GapInfo | null = null\n\tif (isGapToolActive && currentlyDraggedHandleIndexRef.current !== null) {\n\t\tcurrentlyDraggedHandle = gapsInfo[currentlyDraggedHandleIndexRef.current] || null\n\t}\n\n\t// If we're currently dragging a handle it should be the only one displayed\n\tif (currentlyDraggedHandle) {\n\t\tdisplayedHandles.push(currentlyDraggedHandle)\n\t} else {\n\t\tdisplayedHandles = gapsInfo.filter(({ rect }) => canvasControlSpatialStore.addControlWithRect(rect))\n\t}\n\n\tconst getHandlePositionStyle = (handle: Rect): React.CSSProperties | undefined => {\n\t\tif (isVertical) {\n\t\t\treturn {\n\t\t\t\t// The width of the handle should take into account any left and right padding\n\t\t\t\t// so that the gap handle doesn't overlap the padding handles.\n\t\t\t\twidth: frame.width - padding.left - padding.right,\n\t\t\t\theight: handle.height,\n\t\t\t\ttransform: `translateX(${padding.left}px) translateY(${handle.y - frame.y}px)`,\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\twidth: handle.width,\n\t\t\theight: frame.height - padding.top - padding.bottom,\n\t\t\ttransform: `translateX(${handle.x - frame.x}px) translateY(${padding.top}px)`,\n\t\t}\n\t}\n\n\tconst handles = displayedHandles.map((handle, idx) => {\n\t\tconst { point, rect } = handle\n\n\t\tconst handleMouseDown = engine.scheduler.wrapHandler(() => {\n\t\t\tcurrentlyDraggedHandleIndexRef.current = idx\n\t\t\tengine.setToolWithHandle(Tools.Gap, point)\n\t\t})\n\n\t\tconst handleMouseUp = () => {\n\t\t\tcurrentlyDraggedHandleIndexRef.current = null\n\t\t}\n\n\t\tconst cursor = cursorImage(isVertical ? \"resize-north-south\" : \"resize-east-west\")\n\n\t\tconst size = isVertical ? rect.height : rect.width\n\t\tconst isDragging = handle === currentlyDraggedHandle\n\n\t\treturn (\n\t\t\t<SpacerHandle\n\t\t\t\tkey={`gap-handle-${idx}`}\n\t\t\t\tisDragging={isDragging}\n\t\t\t\tisVertical={isVertical}\n\t\t\t\tsize={size}\n\t\t\t\ttint={colors.stackGapHandleTint}\n\t\t\t\thoveredBackgroundColor={colors.stackGapHandleBackground}\n\t\t\t\tcursor={cursor}\n\t\t\t\tstyle={getHandlePositionStyle(rect)}\n\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\tonMouseUp={handleMouseUp}\n\t\t\t\tonMouseMove={mouseMoveHandler}\n\t\t\t/>\n\t\t)\n\t})\n\n\treturn (\n\t\t<div\n\t\t\tclassName={wrapperStyles.wrapper}\n\t\t\tstyle={{\n\t\t\t\twidth: frame.width,\n\t\t\t\theight: frame.height,\n\t\t\t}}\n\t\t>\n\t\t\t{handles}\n\t\t</div>\n\t)\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { StackComponentNode } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype TwoPixelNumberShorthand,\n\tgetNumericColumnGapFromShorthand,\n\tgetNumericRowGapFromShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { supportGap } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { convertRectToCanvasWithRotation } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { paddingFromNode } from \"document/utils/StackComponent/paddingFromNode.ts\"\nimport type { StackDirection } from \"library/components/Stack/types.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport type { TextDirection } from \"text/types.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\n\nexport const getZoomAdjustedChildrenRects = (engine: VekterEngine, stack: StackComponentNode, zoom: number): Rect[] => {\n\tconst childrenRects = engine.stores.layoutCache.getChildrenRects(stack.id)\n\tif (!childrenRects) return []\n\n\tconst stackRect = convertRectToCanvasWithRotation(engine.tree, stack)\n\n\treturn childrenRects.map(childRect => {\n\t\treturn {\n\t\t\tx: (stackRect.x + childRect.x) * zoom,\n\t\t\ty: (stackRect.y + childRect.y) * zoom,\n\t\t\twidth: childRect.width * zoom,\n\t\t\theight: childRect.height * zoom,\n\t\t}\n\t})\n}\n\nconst getZoomAdjustedPaddings = (stack: StackComponentNode, zoom: number) => {\n\tconst paddings = paddingFromNode(stack)\n\treturn {\n\t\tleft: paddings.left * zoom,\n\t\tright: paddings.right * zoom,\n\t\ttop: paddings.top * zoom,\n\t\tbottom: paddings.bottom * zoom,\n\t}\n}\n\n/**\n * Determine the visible zoom corrected padding between the stack's bounding box\n * and its contents. We use the difference between the stack's rect, and the\n * measured rect of all descendants to determine padding. This avoids having to\n * recreate a flex-box implementation to understand what padding is assigned\n * where when the stack is smaller than its paddings and its contents. For\n * example, when a horizontal stack has 100px padding, 100px tall content, and\n * a maxHeight of 200px, padding will only be drawn at the top of the box,\n * leaving no visible padding at the bottom.\n */\nexport const getConstrainedZoomAdjustedPaddings = (\n\tzoom: number,\n\tstack: StackComponentNode,\n\tstackRect: Rect,\n\tcontentRect: Rect,\n) => {\n\tconst paddings = getZoomAdjustedPaddings(stack, zoom)\n\n\t// We don't want to draw padding outside of the bounding box of the stack,\n\t// so we constrain the contents bounding box so that it is totally\n\t// contained.\n\tconst contentX = Math.max(stackRect.x, contentRect.x)\n\tconst contentY = Math.max(stackRect.y, contentRect.y)\n\tconst contentWidth = Math.min(stackRect.width, contentRect.width)\n\tconst contentHeight = Math.min(stackRect.height, contentRect.height)\n\n\t// Paddings can never be larger than the defined values, even if there is\n\t// more space between the stack bounding box and the content bounding box,\n\t// so only return the smaller value, and never a negative value. This avoids\n\t// errors in calculations that determine free space by summing paddings.\n\treturn {\n\t\ttop: Math.min(paddings.top, Math.max(contentY - stackRect.y, 0)),\n\t\tright: Math.min(paddings.right, Math.max(stackRect.x + stackRect.width - (contentX + contentWidth), 0)),\n\t\tbottom: Math.min(paddings.bottom, Math.max(stackRect.y + stackRect.height - (contentY + contentHeight), 0)),\n\t\tleft: Math.min(paddings.left, Math.max(contentX - stackRect.x, 0)),\n\t}\n}\ninterface Paddings {\n\ttop: number\n\tright: number\n\tbottom: number\n\tleft: number\n}\n\nexport function getNumericGapUnlessDynamic(\n\tgap: TwoPixelNumberShorthand | number | undefined | DynamicValue,\n\tstackDirection: StackDirection,\n): number | undefined {\n\tif (isDynamicValue(gap)) return undefined\n\tif (stackDirection === \"vertical\") return getNumericColumnGapFromShorthand(gap)\n\treturn getNumericRowGapFromShorthand(gap)\n}\n\nexport const getZoomAdjustedGapRects = (\n\tstack: StackComponentNode,\n\tzoom: number,\n\tstackRect: Rect,\n\tchildrenRects: Rect[],\n\tadjustedPaddings: Paddings,\n\tlayoutDirection: TextDirection,\n): Rect[] | null => {\n\tif (!supportGap(stack)) return null\n\tconst stackDirection = stack.resolveValue(\"stackDirection\")\n\tif (!stackDirection) return null\n\tconst gap = getNumericGapUnlessDynamic(stack.gap, stackDirection)\n\tif (!isNumber(gap)) return null\n\tconst { top, right, bottom, left } = adjustedPaddings\n\n\t// Determine the free space available to draw the gap rects. Gap rects\n\t// always fill the space between the stacks paddings, but never exceed the\n\t// stack's bounding box.\n\tconst gapRects: Rect[] = []\n\n\tconst gapZoomed = gap * zoom\n\n\tchildrenRects.forEach((childRect, idx) => {\n\t\tif (idx === childrenRects.length - 1) return\n\t\tswitch (stackDirection) {\n\t\t\tcase \"horizontal\":\n\t\t\t\tgapRects.push({\n\t\t\t\t\tx: layoutDirection === \"ltr\" ? childRect.x + childRect.width : childRect.x - gapZoomed,\n\t\t\t\t\ty: stackRect.y + top,\n\t\t\t\t\twidth: gapZoomed,\n\t\t\t\t\theight: stackRect.height - top - bottom,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\tcase \"vertical\":\n\t\t\t\tgapRects.push({\n\t\t\t\t\tx: stackRect.x + left,\n\t\t\t\t\ty: childRect.y + childRect.height,\n\t\t\t\t\twidth: stackRect.width - left - right,\n\t\t\t\t\theight: gapZoomed,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t}\n\t})\n\n\treturn gapRects\n}\n", "import { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { getScopeTypeForScope } from \"document/base-engine/BaseScopeStore.ts\"\nimport { CanvasFramePresets } from \"document/components/canvas-hud/CanvasFramePresets.tsx\"\nimport { Overlay } from \"document/components/canvas-hud/Overlay.tsx\"\nimport { SelectedLine } from \"document/components/canvas-hud/SelectedLine.tsx\"\nimport { SelectionBox } from \"document/components/canvas-hud/SelectionBox.tsx\"\nimport { showContextMenu } from \"document/components/utils/contextMenu.ts\"\nimport { isWaitingForMeasuredRect } from \"document/components/utils/isWaitingForMeasuredRect.ts\"\nimport { elementsEqual } from \"document/components/utils/list.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { generateReplicaChildId } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport {\n\tisCanvasPageNode,\n\tisCodeComponentNode,\n\tisDataRepeater,\n\tisFrameNode,\n\tisOverlayNode,\n\tisShapeContainerNode,\n\tisShapeGroupNode,\n\tisSlotNode,\n\tisSlotPropertyNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { withReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { hasAnyViewHeightConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { hasViewportHeight } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport type { WithViewport } from \"document/models/CanvasTree/traits/WithViewport.ts\"\nimport { isFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport { isUserComponent } from \"document/models/CanvasTree/traits/utils/isUserComponent.ts\"\nimport {\n\tcanBePositionFixed,\n\tisPositionFixed,\n\tscopeTypeSupportsPositionFixed,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport {\n\tgetViewportHeight,\n\tgetViewportProviderForNode,\n\tsupportsViewportSizing,\n} from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport {\n\tconvertRectToCanvasWithRotation,\n\tgetCornerPointsOnCanvasWithZoom,\n} from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { mouseDidMove } from \"utils/mouseDidMove.ts\"\nimport { isRepeatedItem } from \"utils/repeaterUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { wantsNativeTextActions } from \"../../utils/wantsNativeTextActions.ts\"\nimport { CMSBadge } from \"../canvas-hud/CMSBadge.tsx\"\nimport { CodeComponentInProgressInsertionOverlay } from \"../canvas-hud/CodeComponentInProgressInsertionOverlay.tsx\"\nimport { CollectionRepeaterButton } from \"../canvas-hud/CollectionRepeaterButton.tsx\"\nimport { FormElementButton } from \"../canvas-hud/FormElementButton.tsx\"\nimport { InsertionIndicator } from \"../canvas-hud/InsertionIndicator.tsx\"\nimport { OverlayInsertionIndicator } from \"../canvas-hud/OverlayInsertionIndicator.tsx\"\nimport { ParentHighlight } from \"../canvas-hud/ParentHighlight.tsx\"\nimport { PinningCanvasVisualization } from \"../canvas-hud/PinningCanvasVisualization.tsx\"\nimport { RepeatedItemButton } from \"../canvas-hud/RepeatedItemButton.tsx\"\nimport { SiblingOutline } from \"../canvas-hud/SiblingOutline.tsx\"\nimport { UploadingOverlays } from \"../canvas-hud/TilingBackgroundImageUploadingIndicator.tsx\"\nimport { ViewportHandle, ViewportHighlight } from \"../canvas-hud/ViewportHighlight.tsx\"\nimport { uniqueMaskId } from \"../chrome/properties/rows/MasksRow.tsx\"\nimport { isStraightRectangle } from \"../utils/isSkewedQuadrilateralPoints.ts\"\nimport { AgentDragSelectTool } from \"./AgentSelectTool.ts\"\nimport { CodeFilesProgressStateOverlay, ComponentInstancePlaceholder } from \"./ComponentInstancePlaceholder.tsx\"\nimport type { CreateTool } from \"./Create.tsx\"\nimport { CreateCodeComponent } from \"./CreateCodeComponent.tsx\"\nimport { CreateVideoTool } from \"./CreateCodeComponentTool.ts\"\nimport { CreateFrame } from \"./CreateFrame.tsx\"\nimport {\n\tCreateColumnsTool,\n\tCreateFrameTool,\n\tCreateGridRowTool,\n\tCreateGridSpanTool,\n\tCreateGridTool,\n\tCreateImageTool,\n\tCreateMasonryTool,\n\tCreateRoundedTool,\n\tCreateRowsTool,\n\tCreateScreenTool,\n\tCreateStackTool,\n} from \"./CreateFrameTool.ts\"\nimport { CreateShape } from \"./CreateShape.tsx\"\nimport {\n\tCreateOvalShapeTool,\n\tCreatePolygonShapeTool,\n\tCreateRectangleShapeTool,\n\tCreateStarShapeTool,\n} from \"./CreateShapeTool.ts\"\nimport { CreateText } from \"./CreateText.tsx\"\nimport { CreateTextTool } from \"./CreateTextTool.ts\"\nimport { GuideMove } from \"./GuideMove.tsx\"\nimport { GuideMoveTool } from \"./GuideMoveTool.ts\"\nimport { Highlight } from \"./Highlight.tsx\"\nimport { HighlightStackItem, HighlightStackItemTool } from \"./HighlightStackItem.tsx\"\nimport { DirectSelectTool, HighlightTool } from \"./HighlightTool.ts\"\nimport { Move } from \"./Move.tsx\"\nimport { MoveTool } from \"./MoveTool.ts\"\nimport { Pan, PanTool } from \"./Pan.tsx\"\nimport { Radius } from \"./Radius.tsx\"\nimport { RadiusTool } from \"./RadiusTool.ts\"\nimport { Resize } from \"./Resize.tsx\"\nimport { ResizeTool } from \"./ResizeTool.ts\"\nimport { Rotate, RotateTool } from \"./Rotate.tsx\"\nimport { SampleColor, SampleColorTool } from \"./SampleColor.tsx\"\nimport { Select, SelectTool } from \"./Select.tsx\"\nimport { SlotConnect } from \"./SlotConnect.tsx\"\nimport { SlotConnectTool } from \"./SlotConnectTool.ts\"\nimport * as styles from \"./ToolManager.styles.ts\"\nimport { ZoomSelect } from \"./ZoomSelect.tsx\"\nimport { ZoomSelectTool } from \"./ZoomSelectTool.ts\"\nimport { GradientToolManager } from \"./gradient/GradientToolManager.tsx\"\nimport { GradientFillToolManagerTool, GradientMaskToolManagerTool } from \"./gradient/GradientToolManagerTool.tsx\"\nimport { Link } from \"./linkTool/Link.tsx\"\nimport { LinkTool } from \"./linkTool/LinkTool.ts\"\nimport { VekterPathEngine } from \"./pathEdit/PathToolManager.tsx\"\nimport { ShapeHighlight } from \"./pathEdit/controls/ShapeHighlight.tsx\"\nimport { PathEdit } from \"./pathEdit/index.tsx\"\nimport type { ToolManagerProps, ToolManagerState } from \"./props.ts\"\nimport { CanvasControlSpatialStore } from \"./utils/CanvasControlSpatialStore.ts\"\nimport { isAgentTool } from \"./utils/agentToolHelpers.ts\"\nimport { getBackgroundTintColor, getTintColor } from \"./utils/getTintColor.ts\"\nimport { singleSelectedStraightPath } from \"./utils/singleSelectedStraightPath.ts\"\n\nexport class ToolManager extends React.Component<ToolManagerProps, ToolManagerState> {\n\toverride state = {\n\t\tselectionChange: false,\n\t\tupdate: 0,\n\t}\n\n\t// Lifecycle\n\n\toverride UNSAFE_componentWillReceiveProps(nextProps: ToolManagerProps) {\n\t\tconst { mouseDown, tool, tree, selection, mouse } = nextProps\n\n\t\tconst eqlTree = tree.root === this.props.tree.root\n\t\tconst eqlTool = tool === this.props.tool\n\t\tconst eqlMouse = !mouseDidMove(mouse, this.props.mouse)\n\t\tconst eqlMouseDown = !mouseDidMove(mouseDown, this.props.mouseDown)\n\n\t\tconst eqlSelection = elementsEqual(selection, this.props.selection)\n\t\tif (eqlTree && eqlTool && eqlMouse && eqlMouseDown && eqlSelection) {\n\t\t\treturn\n\t\t}\n\n\t\tconst newState: Partial<ToolManagerState> = {}\n\t\tconst selectionChange = selection !== engine.stores.selectionStore.ids\n\n\t\tnewState.selectionChange = selectionChange\n\t\tthis.setState(prevState => {\n\t\t\treturn { ...prevState, ...newState }\n\t\t})\n\t}\n\n\ttoolComponent() {\n\t\tconst { tool } = engine\n\n\t\tswitch (tool.constructor) {\n\t\t\tcase HighlightTool:\n\t\t\tcase DirectSelectTool:\n\t\t\t\treturn <Highlight {...this.props} {...this.state} myTool={tool as HighlightTool} />\n\t\t\tcase AgentDragSelectTool:\n\t\t\tcase SelectTool:\n\t\t\t\treturn <Select {...this.props} myTool={tool as SelectTool} />\n\t\t\tcase MoveTool:\n\t\t\t\treturn <Move myTool={tool as MoveTool} />\n\t\t\tcase CreateScreenTool:\n\t\t\tcase CreateFrameTool:\n\t\t\tcase CreateRoundedTool:\n\t\t\tcase CreateImageTool:\n\t\t\t\treturn <CreateFrame {...this.props} myTool={tool as CreateFrameTool} />\n\t\t\tcase CreateStackTool:\n\t\t\tcase CreateRowsTool:\n\t\t\tcase CreateColumnsTool:\n\t\t\tcase CreateGridTool:\n\t\t\tcase CreateGridRowTool:\n\t\t\tcase CreateGridSpanTool:\n\t\t\tcase CreateMasonryTool:\n\t\t\tcase CreateVideoTool:\n\t\t\t\treturn <CreateCodeComponent {...this.props} myTool={tool as CreateTool} />\n\t\t\tcase ZoomSelectTool:\n\t\t\t\treturn <ZoomSelect myTool={tool as ZoomSelectTool} />\n\t\t\tcase PanTool:\n\t\t\t\treturn <Pan />\n\t\t\tcase VekterPathEngine:\n\t\t\t\treturn <PathEdit {...this.props} myTool={tool as VekterPathEngine} />\n\t\t\tcase ResizeTool:\n\t\t\t\treturn <Resize myTool={tool as ResizeTool} />\n\t\t\tcase RotateTool:\n\t\t\t\treturn <Rotate myTool={tool as RotateTool} />\n\t\t\tcase RadiusTool:\n\t\t\t\treturn <Radius {...this.props} myTool={tool as RadiusTool} />\n\t\t\tcase SampleColorTool:\n\t\t\t\treturn <SampleColor {...this.props} myTool={tool as SampleColorTool} />\n\t\t\tcase GradientMaskToolManagerTool: {\n\t\t\t\t// Key is needed because we use `GradientToolManager` for both `FillGradient` and `MaskGradient`\n\t\t\t\t// and we need to re-render the component when the tool changes. Otherwise, switching between\n\t\t\t\t// fill popout and mask popout won't always work as expected.\n\t\t\t\tconst gradientTool = tool as GradientMaskToolManagerTool\n\t\t\t\treturn <GradientToolManager key={uniqueMaskId(gradientTool.maskIds)} {...this.props} myTool={gradientTool} />\n\t\t\t}\n\t\t\tcase GradientFillToolManagerTool:\n\t\t\t\treturn <GradientToolManager key={tool.enum} {...this.props} myTool={tool as GradientFillToolManagerTool} />\n\t\t\tcase CreateTextTool:\n\t\t\t\treturn <CreateText {...this.props} myTool={tool as CreateTextTool} />\n\t\t\tcase CreateRectangleShapeTool:\n\t\t\tcase CreateOvalShapeTool:\n\t\t\tcase CreateStarShapeTool:\n\t\t\tcase CreatePolygonShapeTool:\n\t\t\t\treturn <CreateShape {...this.props} myTool={tool as CreateTool} />\n\t\t\tcase SlotConnectTool:\n\t\t\t\treturn <SlotConnect myTool={tool as SlotConnectTool} />\n\t\t\tcase LinkTool:\n\t\t\t\treturn <Link myTool={tool as LinkTool} />\n\t\t\tcase GuideMoveTool:\n\t\t\t\treturn <GuideMove {...this.props} myTool={tool as GuideMoveTool} />\n\t\t\tcase HighlightStackItemTool:\n\t\t\t\treturn <HighlightStackItem {...this.props} myTool={tool as HighlightStackItemTool} />\n\t\t}\n\t\treturn null\n\t}\n\n\thighlightComponent() {\n\t\tconst { highlight, selection, tree, zoom, tool, visibleCanvasRect } = this.props\n\t\tif (tool === Tools.LoadingShield) return\n\t\tif (!highlight || selection.includes(highlight)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst highlightedNode = tree.get(highlight)\n\t\tif (!highlightedNode || !highlightedNode.cache.visible || isWaitingForMeasuredRect(highlightedNode)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (highlightedNode.cache.slotPropertyAncestorId) {\n\t\t\treturn\n\t\t}\n\n\t\tif (withShape(highlightedNode) && withStroke(highlightedNode) && !isShapeGroupNode(highlightedNode)) {\n\t\t\treturn <ShapeHighlight tree={tree} node={highlightedNode} zoom={zoom} onContextMenu={this.highlightContextMenu} />\n\t\t} else {\n\t\t\tconst id = selection[0]\n\t\t\tconst singleSelectedNode = id && selection.length === 1 ? tree.getNode(id) : null\n\t\t\tlet backgroundColor = \"transparent\"\n\t\t\tlet borderColor = getTintColor(highlightedNode)\n\n\t\t\tif (tool === Tools.SlotConnect || tool === Tools.Link) {\n\t\t\t\tbackgroundColor = singleSelectedNode ? getBackgroundTintColor(singleSelectedNode) : backgroundColor\n\t\t\t\tborderColor = singleSelectedNode ? getTintColor(singleSelectedNode) : borderColor\n\t\t\t}\n\n\t\t\tif (isAgentTool(tool)) {\n\t\t\t\tbackgroundColor = colors.tintDimmed\n\t\t\t}\n\n\t\t\tconst points = getCornerPointsOnCanvasWithZoom(tree, highlightedNode, zoom)\n\t\t\tif (!points) return null\n\t\t\treturn (\n\t\t\t\t<Overlay\n\t\t\t\t\tpoints={points}\n\t\t\t\t\tbackgroundColor={backgroundColor}\n\t\t\t\t\tborderColor={borderColor}\n\t\t\t\t\tborderWidth={this.props.shouldShowSelectionOutline ? 1 : 0}\n\t\t\t\t\tonContextMenu={this.highlightContextMenu}\n\t\t\t\t\tclippingRect={Rect.multiply(visibleCanvasRect, zoom)}\n\t\t\t\t\tdashed={isSlotNode(highlightedNode)}\n\t\t\t\t\tskipLargeLayer={!isAgentTool(tool)}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t}\n\n\taiGeneratedHighlightComponent() {\n\t\tconst { tree, zoom, sectionBeingGenerated } = this.props\n\n\t\tconst sectionNode = tree.get(sectionBeingGenerated)\n\t\tif (!sectionNode || !sectionNode.cache.visible || isWaitingForMeasuredRect(sectionNode)) return\n\n\t\tconst points = getCornerPointsOnCanvasWithZoom(tree, sectionNode, zoom)\n\n\t\treturn (\n\t\t\t<Overlay\n\t\t\t\tpoints={points}\n\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\tborderColor={colors.aiHighlightBorder}\n\t\t\t\tborderWidth={1}\n\t\t\t\tclassName={styles.generatedHighlightAnimation}\n\t\t\t/>\n\t\t)\n\t}\n\n\tlayoutTemplateHitTargetOutlines() {\n\t\tconst { highlight, selection, tree, zoom, tool, visibleCanvasRect } = this.props\n\t\tif (tool === Tools.LoadingShield) return\n\n\t\tconst selectionHidden =\n\t\t\tengine.stores.toolStore.isDefaultToolActive &&\n\t\t\t!this.props.shouldShowSelectionOutline &&\n\t\t\t!this.state.selectionChange\n\n\t\tconst visible =\n\t\t\t!isNull(highlight) ||\n\t\t\t(engine.tool.displaySelectionBox &&\n\t\t\t\tengine.shouldShowSelection() &&\n\t\t\t\t!this.props.replaceableFloatingPositionNode &&\n\t\t\t\t!selectionHidden &&\n\t\t\t\t!engine.inMoveToolAndHasMoved())\n\n\t\tif (!visible) return\n\n\t\tconst id = selection[0]\n\t\tconst node = tree.get(highlight) ?? (id && selection.length === 1 ? tree.getNode(id) : null)\n\n\t\tif (!node || !node.cache.visible || isWaitingForMeasuredRect(node) || !node.cache.layoutTemplateRects) return\n\n\t\tconst borderColor = getTintColor(node)\n\t\tconst outlines: React.ReactElement[] = []\n\n\t\tfor (const [layoutTemplateSelector, rectInfo] of node.cache.layoutTemplateRects) {\n\t\t\tconst { canvasCorners: corners } = rectInfo\n\t\t\tif (!corners) continue\n\t\t\tconst points = corners.map(corner => Point.multiply(corner, zoom)) as [Point, Point, Point, Point]\n\n\t\t\toutlines.push(\n\t\t\t\t<Overlay\n\t\t\t\t\tkey={layoutTemplateSelector}\n\t\t\t\t\tpoints={points}\n\t\t\t\t\tbackgroundColor=\"transparent\"\n\t\t\t\t\tborderColor={borderColor}\n\t\t\t\t\tborderWidth={1}\n\t\t\t\t\tonContextMenu={this.highlightContextMenu}\n\t\t\t\t\tclippingRect={Rect.multiply(visibleCanvasRect, zoom)}\n\t\t\t\t\troundToOutside={false}\n\t\t\t\t\tshowRectEdges={getShowRectEdges(node.cache.cornerPoints, zoom)}\n\t\t\t\t\tdashed\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\treturn outlines\n\t}\n\n\tcmsBadgeComponent() {\n\t\tif (engine.tool.cmsBadge === \"hidden\") return\n\t\tif (!engine.shouldShowSelection()) return\n\t\tif (this.props.replaceableFloatingPositionNode) return\n\n\t\tconst { tree, zoom } = this.props\n\t\tlet selection = engine.stores.selectionStore.nodes\n\n\t\tif (engine.tool instanceof MoveTool && engine.tool.options?.reorderNode) {\n\t\t\tif (engine.tree.hasNode(engine.tool.options.reorderNode)) selection = [engine.tool.options.reorderNode]\n\t\t}\n\n\t\tconst withoutDescendants = tree.withoutDescendants(selection)\n\t\tconst selectionWithoutDescendants = withoutDescendants.map(node => node.id)\n\t\tconst anySlotPropertyChild = withoutDescendants.some(node => node.cache.slotPropertyAncestorId)\n\n\t\tif (anySlotPropertyChild) return null\n\t\tif (withoutDescendants.length !== 1) return null\n\n\t\tconst node = withoutDescendants[0]\n\t\tif (!node?.parentid) return null\n\n\t\tconst parent = tree.get(node.parentid)\n\t\t// Only show the badge on nodes inside a breakpoint\n\t\tif (isCanvasPageNode(parent) || isWebPageNode(parent)) {\n\t\t\treturn null\n\t\t}\n\n\t\tif (!node.cache.visible || isWaitingForMeasuredRect(node) || (withFormInput(node) && node.formInputHidden)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst corners = getCornerPointsOnCanvasWithZoom(tree, node, zoom)\n\t\tif (!corners || !isStraightRectangle(corners)) return null\n\n\t\treturn (\n\t\t\t<CMSBadge\n\t\t\t\tselectionWithoutDescendants={selectionWithoutDescendants}\n\t\t\t\ttree={tree}\n\t\t\t\tzoom={zoom}\n\t\t\t\tcorners={corners}\n\t\t\t\tisUserComponent={isUserComponent(node)}\n\t\t\t\tdisabled={engine.tool.cmsBadge === \"disabled\"}\n\t\t\t/>\n\t\t)\n\t}\n\n\tselectionComponent() {\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection()) return\n\t\tif (this.props.replaceableFloatingPositionNode) return\n\n\t\tconst isScaleTool = this.props.tool === Tools.Scale\n\n\t\tconst hidden =\n\t\t\t(engine.stores.toolStore.isDefaultToolActive || isScaleTool) &&\n\t\t\t!this.props.shouldShowSelectionOutline &&\n\t\t\t!this.state.selectionChange\n\n\t\tconst straightPath = singleSelectedStraightPath(engine.stores.selectionStore.nodes)\n\t\tif (straightPath) {\n\t\t\treturn <SelectedLine node={straightPath} zoom={this.props.zoom} tree={this.props.tree} hidden={hidden} />\n\t\t}\n\n\t\tconst { isViewOnly, tree, visibleCanvasRect } = this.props\n\t\tlet selection = engine.stores.selectionStore.nodes\n\t\tif (engine.tool instanceof MoveTool && engine.tool.options?.reorderNode) {\n\t\t\tif (engine.tree.hasNode(engine.tool.options.reorderNode)) selection = [engine.tool.options.reorderNode]\n\t\t}\n\n\t\tconst withoutDescendants = tree.withoutDescendants(selection)\n\t\tconst selectedSlotNode = selection.length === 1 && isSlotNode(selection[0])\n\t\tconst ignorePointerEvents = !engine.stores.toolStore.isDefaultToolActive && !isScaleTool\n\n\t\tconst anySlotPropertyChild = withoutDescendants.some(node => node.cache.slotPropertyAncestorId)\n\t\tif (anySlotPropertyChild) return null\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{!isViewOnly && engine.tool.displaySelectionHandles && !isScaleTool && (\n\t\t\t\t\t<CanvasFramePresets {...this.props} selection={engine.stores.selectionStore.ids} />\n\t\t\t\t)}\n\t\t\t\t<SelectionBox\n\t\t\t\t\tselectionWithoutDescendants={withoutDescendants.map(node => node.id)} // FIXME\n\t\t\t\t\thidden={hidden}\n\t\t\t\t\tshowSelectionOutline={this.props.shouldShowSelectionOutline}\n\t\t\t\t\tisEffectPreview={this.props.isEffectPreview}\n\t\t\t\t\tisColorSamplerActive={this.props.isColorSamplerActive}\n\t\t\t\t\tisMoving={engine.inMoveToolAndHasMoved()}\n\t\t\t\t\tignorePointerEvents={ignorePointerEvents}\n\t\t\t\t\ttool={this.props.tool}\n\t\t\t\t\ttree={this.props.tree}\n\t\t\t\t\tzoom={this.props.zoom}\n\t\t\t\t\tisViewOnly={this.props.isViewOnly || selectedSlotNode}\n\t\t\t\t\tshiftKey={this.props.shiftKey}\n\t\t\t\t\tctrlKey={this.props.ctrlKey}\n\t\t\t\t\taltKey={this.props.altKey}\n\t\t\t\t\tcmdKey={this.props.cmdKey}\n\t\t\t\t\tclippingRect={Rect.multiply(visibleCanvasRect, this.props.zoom)}\n\t\t\t\t\tcanvasControlSpatialStore={this.canvasControlSpatialStore}\n\t\t\t\t\ttoolStore={engine.stores.toolStore}\n\t\t\t\t\t// AgentSelect tool renders its own selection box, so we only check AgentDragSelect tool here.\n\t\t\t\t\tdisplayFill={this.props.tool === Tools.AgentDragSelect}\n\t\t\t\t\tskipLargeLayer={this.props.tool !== Tools.AgentDragSelect}\n\t\t\t\t/>\n\t\t\t</>\n\t\t)\n\t}\n\n\tstackInsertionIndicator() {\n\t\tconst { stackInsertionIndicator, zoom } = this.props\n\t\tif (!stackInsertionIndicator) return\n\t\treturn <InsertionIndicator insertion={stackInsertionIndicator} zoom={zoom} />\n\t}\n\n\toverlayInsertionIndicator() {\n\t\tconst { replaceableFloatingPositionNode, zoom, tree } = this.props\n\t\tif (!replaceableFloatingPositionNode) return\n\n\t\treturn <OverlayInsertionIndicator id={replaceableFloatingPositionNode} zoom={zoom} tree={tree} />\n\t}\n\n\tpinningVisualization() {\n\t\t// Hide pin visualization when not selected, or Distance lines are shown\n\t\t// to prevent overlaps.\n\t\t// @FIXME: we have three ways of determining if the selection box should be hidden. Can we consolidate these?\n\t\tif (\n\t\t\t!engine.tool.displaySelectionBox ||\n\t\t\t(engine.stores.toolStore.tool === Tools.Highlight && this.props.altKey) ||\n\t\t\tisAgentTool(engine.tool.enum)\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tif (!engine.shouldShowSelection() && engine.stores.toolStore.tool !== Tools.Move) return\n\t\tif (!this.props.shouldShowSelectionOutline) return\n\t\tconst { selection, tree, zoom } = this.props\n\t\treturn <PinningCanvasVisualization selection={selection} tree={tree} zoom={zoom} />\n\t}\n\n\tvariantHelperHighlight() {\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection()) return\n\n\t\tconst hidden =\n\t\t\tengine.stores.toolStore.isDefaultToolActive &&\n\t\t\t!this.props.shouldShowSelectionOutline &&\n\t\t\t!this.state.selectionChange\n\n\t\tconst { tree, zoom, visibleCanvasRect } = this.props\n\n\t\tif (engine.stores.selectionStore.nodes.length !== 1) return\n\n\t\t// Only show helper for single selections\n\t\tconst singleSelectedNode = engine.stores.selectionStore.nodes[0]\n\t\tif (!singleSelectedNode) return\n\n\t\tif (singleSelectedNode.cache.slotPropertyAncestorId) return\n\n\t\tif (tree.isGroundNode(singleSelectedNode)) return\n\n\t\tconst scopeNode = tree.getScopeNodeFor(singleSelectedNode)\n\n\t\tif (!scopeNode || !withReplicaVariants(scopeNode)) return\n\n\t\tconst topLevelVariants = scopeNode.getTopLevelReplicaVariants()\n\t\tconst nodeIdsToSelectInSiblingVariants: Set<NodeID> = new Set()\n\n\t\t// In the case of selecting within a replica variant\n\t\tif (isReplicaOrReplicaChild(singleSelectedNode)) {\n\t\t\tnodeIdsToSelectInSiblingVariants.add(singleSelectedNode.originalid)\n\t\t}\n\n\t\ttopLevelVariants.forEach(variant => {\n\t\t\tnodeIdsToSelectInSiblingVariants.add(generateReplicaChildId(variant.id, singleSelectedNode.getPrimaryId()))\n\t\t})\n\n\t\tnodeIdsToSelectInSiblingVariants.delete(singleSelectedNode.id)\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(nodeIdsToSelectInSiblingVariants).map(id => (\n\t\t\t\t\t<SiblingOutline\n\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\tid={id}\n\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t\t\t\thidden={hidden}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</>\n\t\t)\n\t}\n\n\tparentHighlightComponent() {\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection() && !engine.stores.toolStore.isDefaultToolActive) return\n\n\t\tconst { selection, tree, zoom, visibleCanvasRect, activeOverlays } = this.props\n\t\tif (engine.tool instanceof MoveTool && engine.tool.hasMoved) return\n\t\tif (isAgentTool(engine.tool.enum)) return\n\n\t\tconst id = selection[0]\n\t\tif (!id || selection.length > 1) return\n\t\tconst node = tree.getNode(id)\n\t\tif (!node || !node.cache.visible || isPositionFixed(node) || activeOverlays.has(id)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (node.cache.slotPropertyAncestorId) return\n\t\tif (isSlotNode(node)) return\n\n\t\tconst parent = tree.getParent(id)\n\t\tif (!parent) return\n\t\tif (parent.id === engine.stores.treeStore.highlight) return\n\t\t// Shape container node already has a grey outline\n\t\tif (isShapeContainerNode(parent) && !isVectorSetItem(parent)) return\n\t\t// For shapes, only render parent highlight on shape groups.\n\t\tif (withShape(parent) && !isShapeGroupNode(parent)) return\n\t\treturn (\n\t\t\t<ParentHighlight\n\t\t\t\tids={[parent.id]}\n\t\t\t\ttree={tree}\n\t\t\t\tzoom={zoom}\n\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t\tdashed\n\t\t\t\toutlineWidth={1}\n\t\t\t/>\n\t\t)\n\t}\n\n\tslotPropertyHighlightComponent() {\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection() && !engine.stores.toolStore.isDefaultToolActive) return\n\n\t\tconst { selection, tree, zoom, visibleCanvasRect } = this.props\n\t\tif (engine.tool instanceof MoveTool && engine.tool.hasMoved) return\n\n\t\tconst id = selection[0]\n\t\tif (!id || selection.length > 1) return\n\t\tlet node = tree.getNode(id)\n\t\tif (isSlotPropertyNode(node)) return\n\n\t\tif (!node?.cache.slotPropertyAncestorId) return\n\n\t\twhile (node?.cache.slotPropertyAncestorId) {\n\t\t\tnode = tree.getNode(node.cache.slotPropertyAncestorId)\n\t\t}\n\n\t\tif (!isSlotPropertyNode(node)) return\n\t\tconst codeComponent = tree.get(node.parentid)\n\t\tif (!isCodeComponentNode(codeComponent)) return\n\n\t\treturn (\n\t\t\t<ParentHighlight\n\t\t\t\tdashed\n\t\t\t\ttree={tree}\n\t\t\t\tzoom={zoom}\n\t\t\t\toutlineWidth={1}\n\t\t\t\tids={[codeComponent.id]}\n\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t/>\n\t\t)\n\t}\n\n\tfloatingTriggerHighlightComponent() {\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection() && !engine.stores.toolStore.isDefaultToolActive) return\n\n\t\tconst { selection, tree, zoom, visibleCanvasRect, activeOverlays } = this.props\n\t\tif (engine.tool instanceof MoveTool && engine.tool.hasMoved) return\n\n\t\tconst id = selection[0]\n\t\tif (!id || selection.length > 1) return\n\t\tconst node = tree.getNode(id)\n\t\tconst overlayId = node?.cache.overlayAncestorId ?? (hasFloatingPosition(node) ? node.id : undefined)\n\t\tif (!overlayId) return\n\t\tconst overlay = tree.get(overlayId)\n\t\tif (!node || !node.cache.visible || !hasFloatingPosition(overlay) || !activeOverlays.has(overlayId)) return\n\n\t\tconst trigger = tree.getParent(overlayId)\n\t\tif (!trigger) return\n\t\tif (trigger.id === engine.stores.treeStore.highlight) return\n\n\t\tconst { borderColor, backgroundColor } = isUserComponent(tree.getGroundNodeFor(trigger))\n\t\t\t? {\n\t\t\t\t\tbackgroundColor: colors.canvasComponentOverlayTriggerBackground,\n\t\t\t\t\tborderColor: colors.canvasComponentOverlayTriggerOutline,\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tbackgroundColor: colors.canvasOverlayTriggerBackground,\n\t\t\t\t\tborderColor: colors.canvasOverlayTriggerOutline,\n\t\t\t\t}\n\n\t\treturn (\n\t\t\t<ParentHighlight\n\t\t\t\tids={[trigger.id]}\n\t\t\t\ttree={tree}\n\t\t\t\tzoom={zoom}\n\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t\toutlineWidth={1}\n\t\t\t\tbackgroundColor={backgroundColor}\n\t\t\t\tborderColor={borderColor}\n\t\t\t/>\n\t\t)\n\t}\n\n\tshouldShowViewportUI(tree: CanvasTree, selectedNode: CanvasNode) {\n\t\tif (!selectedNode.cache.visible) return false\n\t\tif (isWaitingForMeasuredRect(selectedNode)) return false\n\n\t\tif (isPositionFixed(selectedNode) && canBePositionFixed(tree, selectedNode)) return true\n\t\tif (\n\t\t\t(hasViewportHeight(selectedNode) || hasAnyViewHeightConstraints(selectedNode)) &&\n\t\t\tsupportsViewportSizing(tree, selectedNode)\n\t\t) {\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tgetViewportPropsForSelection(): ViewportProps | null {\n\t\tconst { highlight, tree, selection, activeScope } = this.props\n\n\t\tlet targetNode: CanvasNode | null = null\n\n\t\tconst id = selection[0]\n\t\tif (id && selection.length === 1) targetNode = tree.getNode<CanvasNode>(id)\n\n\t\tconst selected = !!targetNode\n\t\tif (highlight) targetNode = targetNode ?? tree.getNode(highlight)\n\n\t\tif (!targetNode || !this.shouldShowViewportUI(tree, targetNode)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst viewportProvider = getViewportProviderForNode(tree, targetNode.id)\n\t\tif (!viewportProvider) return null\n\n\t\tconst positionFixed = isPositionFixed(targetNode)\n\n\t\t// Even though we don't support `position: fixed` in Smart Components, some legacy projects might have\n\t\t// `position: fixed` nodes in a Smart Component due to flows like componentization.\n\t\tif (positionFixed && !scopeTypeSupportsPositionFixed(getScopeTypeForScope(activeScope))) return null\n\n\t\t// For vh nodes we don't want to use the screen height, because the screen height may depend on the node's\n\t\t// height\n\t\tconst isVHNode = !positionFixed\n\n\t\treturn {\n\t\t\tviewportProvider,\n\t\t\tselected,\n\t\t\tviewportHeight: getViewportHeight(viewportProvider, tree.getRect(viewportProvider), !isVHNode),\n\t\t\tattachToNode: isVHNode ? targetNode.id : undefined,\n\t\t}\n\t}\n\n\tgetViewportPropsForActiveOverlay(overlayId: NodeID): ViewportProps | null {\n\t\tconst { tree } = this.props\n\n\t\tconst overlayNode = tree.getNode(overlayId)\n\t\tif (!overlayNode || !isOverlayNode(overlayNode)) return null\n\n\t\tconst viewportProvider = getViewportProviderForNode(tree, overlayNode.id)\n\t\tif (!viewportProvider) return null\n\n\t\treturn {\n\t\t\tviewportProvider,\n\t\t\tselected: true,\n\t\t\tviewportHeight: getViewportHeight(viewportProvider, tree.getRect(viewportProvider)),\n\t\t\tattachToNode: undefined,\n\t\t}\n\t}\n\n\tgetViewportProps(): ViewportProps[] | null {\n\t\tif (!engine.shouldShowSelection() && !engine.stores.toolStore.isDefaultToolActive) return null\n\n\t\tconst seenScreenId = new Set()\n\t\tconst result: ViewportProps[] = []\n\t\tif (this.props.editModeActive) {\n\t\t\tthis.props.activeOverlays.forEach(overlayId => {\n\t\t\t\tconst viewportPropsForOverlay = this.getViewportPropsForActiveOverlay(overlayId)\n\t\t\t\tif (viewportPropsForOverlay && !seenScreenId.has(viewportPropsForOverlay.viewportProvider.id)) {\n\t\t\t\t\tseenScreenId.add(viewportPropsForOverlay.viewportProvider.id)\n\t\t\t\t\tresult.push(viewportPropsForOverlay)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tconst viewportPropsForSelection = this.getViewportPropsForSelection()\n\t\tif (viewportPropsForSelection && !seenScreenId.has(viewportPropsForSelection.viewportProvider.id)) {\n\t\t\tseenScreenId.add(viewportPropsForSelection.viewportProvider.id)\n\t\t\tresult.push(viewportPropsForSelection)\n\t\t}\n\t\treturn result\n\t}\n\n\tviewportOutline(viewportProps: ViewportProps[] | null) {\n\t\tif (!viewportProps) return null\n\t\tconst { zoom } = this.props\n\n\t\treturn viewportProps.map(props => {\n\t\t\tconst { viewportProvider, viewportHeight, selected, attachToNode } = props\n\t\t\tif (attachToNode) return null\n\n\t\t\treturn (\n\t\t\t\t<ViewportHighlight\n\t\t\t\t\tkey={`viewport-outline-${viewportProvider.id}`}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tscreenId={viewportProvider.id}\n\t\t\t\t\tviewportHeight={viewportHeight}\n\t\t\t\t\ttint={getTintColor(viewportProvider)}\n\t\t\t\t\tselected={selected}\n\t\t\t\t/>\n\t\t\t)\n\t\t})\n\t}\n\n\tviewportHandle(viewportProps: ViewportProps[] | null) {\n\t\tif (!viewportProps) return null\n\t\tconst { zoom, isViewOnly } = this.props\n\t\treturn viewportProps.map(props => {\n\t\t\tconst { viewportProvider, viewportHeight, selected, attachToNode } = props\n\n\t\t\t// Don't allow viewport resizing in view only mode.\n\t\t\tif (isViewOnly || !selected) return null\n\n\t\t\t// Don't show viewport pill if the gradient handles are rendered\n\t\t\tif (!engine.tool.displayViewportHandle) return null\n\n\t\t\tconst baseNode = attachToNode ? engine.tree.getNode(attachToNode) : viewportProvider\n\t\t\tif (!baseNode) return null\n\n\t\t\treturn (\n\t\t\t\t<ViewportHandle\n\t\t\t\t\tkey={`viewport-handle-${viewportProvider.id}`}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tscreenId={viewportProvider.id}\n\t\t\t\t\tviewportHeight={viewportHeight}\n\t\t\t\t\tdragging={!!engine.tool.displayViewportLabel}\n\t\t\t\t\ttint={getTintColor(baseNode)}\n\t\t\t\t\tattachToNode={attachToNode}\n\t\t\t\t/>\n\t\t\t)\n\t\t})\n\t}\n\n\taddElementButton() {\n\t\tif (this.props.isViewOnly) return\n\t\tif (!engine.tool.displaySelectionBox) return\n\t\tif (!engine.shouldShowSelection()) return\n\t\tif (isAgentTool(engine.tool.enum)) return\n\n\t\tconst { selection, tree, zoom } = this.props\n\n\t\tconst id = selection[0]\n\n\t\tif (!id || selection.length !== 1) return\n\n\t\t// If we are zoomed out too much, don't show the button\n\t\t// as it will appear too large.\n\t\tif (zoom < 0.5) return\n\n\t\tconst singleSelectedNode = engine.tree.getNode(id)\n\t\tif (!singleSelectedNode) return\n\n\t\t// Can happen when a parent is hidden or the collection list doesn't have any data\n\t\tif (!singleSelectedNode.cache.visible) return\n\n\t\tconst showFormElementButton = isFormContainer(singleSelectedNode)\n\t\tconst showRepeatedItemButton = !isCodeComponentNode(singleSelectedNode) && isRepeatedItem(tree, singleSelectedNode)\n\n\t\tconst showCollectionRepeaterButton = isDataRepeater(singleSelectedNode)\n\n\t\tif (!showFormElementButton && !showRepeatedItemButton && !showCollectionRepeaterButton) {\n\t\t\treturn\n\t\t}\n\n\t\tconst canvasRectWithRotation = convertRectToCanvasWithRotation(tree, singleSelectedNode)\n\t\tif (canvasRectWithRotation.rotation !== 0) return null\n\n\t\tconst horizontal =\n\t\t\tisFrameNode(singleSelectedNode) &&\n\t\t\tsingleSelectedNode.layout === \"stack\" &&\n\t\t\tsingleSelectedNode.stackDirection === \"horizontal\"\n\n\t\tconst x = horizontal\n\t\t\t? Rect.maxX(canvasRectWithRotation) * zoom\n\t\t\t: (canvasRectWithRotation.x + canvasRectWithRotation.width / 2) * zoom\n\t\tconst y = horizontal\n\t\t\t? (canvasRectWithRotation.y + canvasRectWithRotation.height / 2) * zoom\n\t\t\t: Rect.maxY(canvasRectWithRotation) * zoom\n\n\t\tconst coordinate = { x, y }\n\n\t\tconst rect: Rect = {\n\t\t\tx: coordinate.x - styles.canvasSectionButtonWidth / 2,\n\t\t\ty: coordinate.y - dimensions.values.inputHeight / 2,\n\t\t\twidth: styles.canvasSectionButtonWidth,\n\t\t\theight: dimensions.values.inputHeight,\n\t\t}\n\n\t\tif (!this.canvasControlSpatialStore.addControlWithRect(rect)) {\n\t\t\treturn null\n\t\t}\n\n\t\tif (showCollectionRepeaterButton) {\n\t\t\treturn <CollectionRepeaterButton tint={colors.tint} center={coordinate} containerNodeId={singleSelectedNode.id} />\n\t\t}\n\n\t\tif (showRepeatedItemButton) {\n\t\t\treturn <RepeatedItemButton tint={colors.tint} center={coordinate} repeatedElement={singleSelectedNode} />\n\t\t}\n\n\t\tif (showFormElementButton) {\n\t\t\treturn (\n\t\t\t\t<FormElementButton\n\t\t\t\t\ttint={getTintColor(singleSelectedNode)}\n\t\t\t\t\tcenter={coordinate}\n\t\t\t\t\tcontainerNodeId={singleSelectedNode.id}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t}\n\n\tcanvasControlSpatialStore = new CanvasControlSpatialStore()\n\n\toverride render() {\n\t\tengine.assertReactRendering()\n\n\t\tthis.canvasControlSpatialStore.reset()\n\n\t\tconst viewportProps = this.getViewportProps()\n\t\tconst viewportHandle = this.viewportHandle(viewportProps)\n\t\tconst viewportOutline = this.viewportOutline(viewportProps)\n\n\t\treturn (\n\t\t\t<div className=\"ToolManager\">\n\t\t\t\t{this.pinningVisualization()}\n\t\t\t\t<ComponentInstancePlaceholder\n\t\t\t\t\tzoom={this.props.zoom}\n\t\t\t\t\ttree={this.props.tree}\n\t\t\t\t\tactiveScope={this.props.activeScope}\n\t\t\t\t/>\n\t\t\t\t<CodeFilesProgressStateOverlay\n\t\t\t\t\tzoom={this.props.zoom}\n\t\t\t\t\ttree={this.props.tree}\n\t\t\t\t\tactiveScope={this.props.activeScope}\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: \"contents\",\n\t\t\t\t\t\tvisibility: this.props.shouldShowSelection ? undefined : \"hidden\",\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{this.parentHighlightComponent()}\n\t\t\t\t\t{this.layoutTemplateHitTargetOutlines()}\n\t\t\t\t\t{this.highlightComponent()}\n\t\t\t\t\t{this.slotPropertyHighlightComponent()}\n\t\t\t\t\t{this.floatingTriggerHighlightComponent()}\n\t\t\t\t\t{viewportOutline}\n\t\t\t\t\t{this.selectionComponent()}\n\t\t\t\t\t{this.cmsBadgeComponent()}\n\t\t\t\t\t{this.addElementButton()}\n\t\t\t\t\t{this.aiGeneratedHighlightComponent()}\n\t\t\t\t</div>\n\t\t\t\t{this.stackInsertionIndicator()}\n\t\t\t\t{this.overlayInsertionIndicator()}\n\n\t\t\t\t<CodeComponentInProgressInsertionOverlay\n\t\t\t\t\tids={Array.from(this.props.codeComponentInsertionInProgressNodeIDs)}\n\t\t\t\t\tzoom={this.props.zoom}\n\t\t\t\t\ttree={this.props.tree}\n\t\t\t\t/>\n\n\t\t\t\t<UploadingOverlays\n\t\t\t\t\tids={Array.from(this.props.tilingBackgroundFrameUploadInProgressNodeIDs)}\n\t\t\t\t\tzoom={this.props.zoom}\n\t\t\t\t\ttree={this.props.tree}\n\t\t\t\t/>\n\n\t\t\t\t{this.toolComponent()}\n\n\t\t\t\t{this.variantHelperHighlight()}\n\t\t\t\t{viewportHandle}\n\t\t\t</div>\n\t\t)\n\t}\n\n\thighlightContextMenu = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLElement>) => {\n\t\tif (event.defaultPrevented) {\n\t\t\treturn\n\t\t}\n\n\t\tif (wantsNativeTextActions(event.target)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst { highlight } = this.props\n\t\tif (!highlight) {\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.selectionStore.set(highlight) // Set to make the target of the context menu clear\n\n\t\tshowContextMenu({ coordinate: Point(event.clientX, event.clientY), engine, selection: [highlight] })\n\n\t\tevent.preventDefault()\n\t})\n}\n\ninterface ViewportProps {\n\tviewportProvider: CanvasNode & WithViewport\n\tselected: boolean\n\tviewportHeight: number\n\tattachToNode: NodeID | undefined\n}\n\nfunction getShowRectEdges(\n\tcontainerPoints: Point[] | undefined,\n\tzoom: number,\n): (roundedPaintedPoints: Point[], skewed: boolean) => [boolean, boolean, boolean, boolean] | undefined {\n\treturn (roundedPaintedPoints: Point[], skewed: boolean) => {\n\t\tif (skewed) return undefined\n\t\tif (!Point.isQuadrilateralPoints(containerPoints) || !Point.isQuadrilateralPoints(roundedPaintedPoints)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst containerPointsWithZoom = containerPoints.map(point => Point.multiply(point, zoom)) as [\n\t\t\tPoint,\n\t\t\tPoint,\n\t\t\tPoint,\n\t\t\tPoint,\n\t\t]\n\t\tconst containerRect = Rect.fromPoints(containerPointsWithZoom)\n\n\t\tconst showRectEdges: [boolean, boolean, boolean, boolean] = [true, true, true, true]\n\t\troundedPaintedPoints.forEach((point: Point, index: number) => {\n\t\t\tconst nextPoint = roundedPaintedPoints[(index + 1) % roundedPaintedPoints.length]\n\t\t\tif (!nextPoint) return\n\t\t\tconst touchAnyEdge = lineOverlapsWithRectEdge(point, nextPoint, containerRect, zoom)\n\t\t\tif (touchAnyEdge) showRectEdges[index] = false\n\t\t})\n\t\treturn showRectEdges\n\t}\n}\n\nfunction lineOverlapsWithRectEdge(a: Point, b: Point, rect: Rect, zoom: number) {\n\tconst vertical = a.x === b.x\n\tconst horizontal = a.y === b.y\n\t// Don't deal with rotated lines, as we assume the container rect cannot be rotated.\n\tif (!vertical && !horizontal) return false\n\n\tif (horizontal) {\n\t\tif (mightOverlap(a.y, rect.y, zoom)) return true\n\t\tif (mightOverlap(a.y, rect.y + rect.height, zoom)) return true\n\t}\n\n\tif (vertical) {\n\t\tif (mightOverlap(a.x, rect.x, zoom)) return true\n\t\tif (mightOverlap(a.x, rect.x + rect.width, zoom)) return true\n\t}\n\n\treturn false\n}\n\nconst threshold = 1\nfunction mightOverlap(a: number, b: number, zoom: number) {\n\treturn Math.abs(a - b) * zoom < threshold\n}\n", "import { Badge, IconCollection } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionRepeater,\n\tisFrameNode,\n\tisRichTextNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withVariableProvider } from \"document/models/CanvasTree/traits/WithVariableProvider.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { Point } from \"library/index.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { singular } from \"pluralize\"\nimport { memo, useLayoutEffect, useMemo, useRef, useState } from \"react\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getFirstRepeaterItemId } from \"utils/getFirstRepeaterItemId.ts\"\nimport { getParentCollectionRepeater, isRepeatedItem } from \"utils/repeaterUtils.ts\"\nimport { forEachVariableReferenceOfNode } from \"utils/updateDynamicValues.ts\"\nimport { getVariableSourceDataIdentifier } from \"utils/variableMetadata.ts\"\nimport { getVariableAndProviderFromInfo } from \"../chrome/properties/useVariableProviderInfo.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport { createEditVariableAction } from \"../utils/editActionForNodes.ts\"\nimport { cmsBadge, cmsBadgeDisabled, cmsBadgeHidden } from \"./CMSBadge.styles.ts\"\n\ninterface CMSBadgeProps {\n\tselectionWithoutDescendants: NodeID[]\n\ttree: CanvasTree\n\tzoom: number\n\tcorners: Point[]\n\tdisabled: boolean\n\tisUserComponent: boolean\n}\n\nexport const CMSBadge = memo(function CMSBadge({\n\tselectionWithoutDescendants,\n\ttree,\n\tzoom,\n\tcorners,\n\tdisabled,\n\tisUserComponent,\n}: CMSBadgeProps) {\n\tconst cmsBadgeRef = useRef<HTMLDivElement>(null)\n\tconst selectedId = selectionWithoutDescendants.length === 1 ? selectionWithoutDescendants[0] : undefined\n\tconst [measuredBadgeWidth, setMeasuredWidth] = useState<number | Unmeasured>(unmeasured)\n\n\tconst collectionAndVariableName = useCollectionAndVariableNameForSelection(tree, selectedId)\n\n\t// Calculate text content for dependency tracking\n\tconst badgeTitle = useMemo(() => {\n\t\tif (!collectionAndVariableName) return null\n\t\tconst { collectionName, variableName } = collectionAndVariableName\n\t\tif (!collectionName || !variableName) return null\n\n\t\treturn `${singular(collectionName)} ${variableName}`\n\t}, [collectionAndVariableName])\n\n\t// Only measure width when text content changes\n\tuseLayoutEffect(() => {\n\t\tif (!cmsBadgeRef.current || !badgeTitle) return\n\t\tconst newWidth = cmsBadgeRef.current.clientWidth\n\t\tsetMeasuredWidth(newWidth)\n\t}, [badgeTitle])\n\n\t// Calculate visibility without DOM operations\n\tconst shouldHideBadge = useMemo(() => {\n\t\treturn shouldHide(selectedId, tree, zoom, measuredBadgeWidth)\n\t}, [selectedId, tree, zoom, measuredBadgeWidth])\n\n\tconst onMouseDownHandler = useEngineCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tif (!selectedId) return\n\n\t\t\teditCollectionFieldForCanvasNode(selectedId)\n\t\t\tevent.stopPropagation()\n\t\t},\n\t\t[selectedId],\n\t)\n\n\tif (!badgeTitle) return null\n\n\tconst rect = Rect.boundingRectFromPoints(corners)\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\twillChange: \"transform\",\n\t\t\t\ttransform: `translateX(${rect.x}px) translateY(${rect.y}px)`,\n\t\t\t}}\n\t\t>\n\t\t\t<Badge\n\t\t\t\tvariant={disabled ? undefined : isUserComponent ? \"componentTint\" : \"primary\"}\n\t\t\t\tclassName={cx(cmsBadge, disabled && cmsBadgeDisabled, shouldHideBadge && cmsBadgeHidden)}\n\t\t\t\tonMouseDown={onMouseDownHandler}\n\t\t\t\taria-label={`Variable ${badgeTitle} is linked to CMS collection`}\n\t\t\t\trole=\"button\"\n\t\t\t\tref={cmsBadgeRef}\n\t\t\t>\n\t\t\t\t<IconCollection />\n\t\t\t\t{badgeTitle}\n\t\t\t</Badge>\n\t\t</div>\n\t)\n})\n\nconst unmeasured = Symbol(\"unmeasured\")\ntype Unmeasured = typeof unmeasured\n\nfunction isUnmeasured(value: number | Unmeasured): value is Unmeasured {\n\treturn value === unmeasured\n}\n\nfunction showCollectionInCMS(collection: CollectionNode) {\n\tContextAction.toggleContentManagementScope(engine)\n\tengine.stores.selectionStore.set(collection.id)\n}\n\nfunction editCollectionFieldForCanvasNode(nodeId: NodeID) {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return\n\n\tconst variableReference = getVariableReferenceFromNode(engine.tree, node)\n\n\t// We try to highlight the field in the CMS.\n\tif (variableReference) {\n\t\tconst action = createEditVariableAction(engine, node, variableReference)\n\t\taction()\n\t\treturn\n\t}\n\n\t// In case no variable is assigned, we show the collection directly from the CMS.\n\tif (!withVariableProvider(node)) return\n\n\tconst collection = getCollectionForRepeater(engine.tree, node)\n\tif (!collection) return\n\n\t// If the node is a collection repeater, we show the collection in the CMS as the \"collection\" is selected as a whole.\n\tif (isCollectionRepeater(node)) {\n\t\tshowCollectionInCMS(collection)\n\t\treturn\n\t}\n\n\t// Otherwise, we show the collection item in the overlay stack.\n\tconst collectionItemId = getFirstRepeaterItemId(node, engine.stores.treeStore.sandboxRepeaterData)\n\tconst collectionItem = engine.tree.get(collectionItemId)\n\n\t// If the collection item is not found, we show the collection in the CMS to avoid a \"click does nothing\" situation.\n\tif (!isCollectionItemNode(collectionItem)) {\n\t\tshowCollectionInCMS(collection)\n\t\treturn\n\t}\n\n\t// Otherwise, we show the collection item in the overlay stack.\n\tengine.stores.contentManagementStore.pushExistingItemToOverlayStack(collectionItem.id)\n}\n\nfunction shouldHide(\n\tnodeId: string | undefined,\n\ttree: CanvasTree,\n\tzoom: number,\n\tmeasuredBadgeWidth: number | Unmeasured,\n) {\n\t// If the badge is not rendered yet, we hide it.\n\tif (isUnmeasured(measuredBadgeWidth)) return true\n\n\t// If the user has moved the node, we hide the badge so that we don't have to re-measure it.\n\tif (engine.inMoveToolAndHasMoved()) return true\n\n\tconst minimumRenderedNodeHeightInPixels = 15\n\n\tif (!nodeId) return true\n\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return true\n\n\tconst frame = tree.getRect(node)\n\n\tconst renderedRect = Rect.multiply(frame, zoom)\n\n\treturn renderedRect.width < measuredBadgeWidth || renderedRect.height < minimumRenderedNodeHeightInPixels\n}\n\nfunction useCollectionAndVariableNameForSelection(\n\ttree: CanvasTree,\n\tselectedId: NodeID | undefined,\n): { collectionName: string | null; variableName: string } | null {\n\treturn useMemo(() => {\n\t\tif (!selectedId) return null\n\n\t\tconst node = tree.getNode(selectedId)\n\n\t\tif (!node) return null\n\n\t\t// We first check if the node is a collection repeater or a repeater descendent as in this case\n\t\t// the variable name shown is hardcoded to \"Item\" or \"List\"\n\t\tif (isCollectionRepeater(node) || isRepeatedItem(tree, node)) {\n\t\t\tconst collection = getCollectionForRepeater(tree, node)\n\n\t\t\tif (collection) {\n\t\t\t\t// If the node is a descent of a repeater but a repeater itself we want to show which collection is it linked to.\n\t\t\t\treturn {\n\t\t\t\t\tcollectionName: collection.resolveValue(\"name\"),\n\t\t\t\t\t// Variable name is hardcoded as repeater or repeater descents might not have directly assigned variables but we still want to be aware of the collection link\n\t\t\t\t\tvariableName: isCollectionRepeater(node) ? Dictionary.List : Dictionary.Item,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If the node is not a collection repeater or a repeater descendent, we get the variable reference from the node\n\t\tconst variableReference = getVariableReferenceFromNode(tree, node)\n\t\tif (!variableReference) return null\n\n\t\tconst { variable } = getVariableAndProviderFromInfo(variableReference, engine.stores.treeStore.variableProviderInfo)\n\t\tif (!variable) return null\n\n\t\tconst sourceDataIdentifier = getVariableSourceDataIdentifier(variable)\n\t\tif (!sourceDataIdentifier) return null\n\n\t\tconst collection = getCollectionForIdentifier(engine.tree, sourceDataIdentifier)\n\t\tif (!collection) return null\n\n\t\treturn { collectionName: collection.resolveValue(\"name\"), variableName: variable.name }\n\t}, [selectedId, tree])\n}\n\nfunction getCollectionForRepeater(tree: CanvasTree, node: CanvasNode) {\n\tif (isCollectionRepeater(node)) {\n\t\treturn getCollectionForIdentifier(tree, node.dataIdentifier)\n\t}\n\tif (isRepeatedItem(tree, node)) {\n\t\tconst repeater = getParentCollectionRepeater(tree, node)\n\t\tif (!repeater) return null\n\t\treturn getCollectionForIdentifier(tree, repeater.dataIdentifier)\n\t}\n}\n\nfunction getVariableReferenceFromNode(tree: CanvasTree, node: CanvasNode) {\n\tif (isFrameNode(node)) {\n\t\tif (isVariableReference(node.fillColor)) {\n\t\t\treturn node.fillColor\n\t\t}\n\n\t\tif (isVariableReference(node.fillImage)) {\n\t\t\treturn node.fillImage\n\t\t}\n\t}\n\tif (isRichTextNode(node)) {\n\t\tif (isVariableReference(node.htmlContent)) {\n\t\t\treturn node.htmlContent\n\t\t}\n\t\tif (isVariableReference(node.textContent)) {\n\t\t\treturn node.textContent\n\t\t}\n\t}\n\n\tlet result: VariableReference | undefined\n\n\tforEachVariableReferenceOfNode(tree, node, \"includeInherited\", \"readsRawNodeData\", undefined, variable => {\n\t\tresult ??= variable\n\t})\n\n\treturn result\n}\n", "import \"CMSBadge.styles_1rdhshe.wyw.css\"; export const cmsBadge = \"cmsBadge_csoioth\";\nexport const cmsBadgeDisabled = \"cmsBadgeDisabled_ch5xzsa\";\nexport const cmsBadgeHidden = \"cmsBadgeHidden_c1gq301t\";", "import engine from \"document/engine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { convertRectToCanvasWithRotation } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/index.ts\"\nimport { VideoOverlay } from \"../tools/VideoOverlay.tsx\"\n\ninterface UploadingOverlaysProps {\n\tids: NodeID[]\n\tzoom: number\n\ttree: CanvasTree\n}\n\nexport function CodeComponentInProgressInsertionOverlay({ ids, zoom, tree }: UploadingOverlaysProps) {\n\treturn (\n\t\t<>\n\t\t\t{ids.map(id => (\n\t\t\t\t<InProgressOverlay key={id} id={id} zoom={zoom} tree={tree} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n\nfunction InProgressOverlay({ id, zoom, tree }: { id: NodeID; zoom: number; tree: CanvasTree }) {\n\tconst node = tree.get(id)\n\tif (!node) return null\n\n\tconst nodeCanvasRectWithRotation = convertRectToCanvasWithRotation(tree, node, engine.componentLoader)\n\tconst nodeRect = Rect.multiply(nodeCanvasRectWithRotation, zoom)\n\tconst points = Rect.cornerPoints(nodeRect)\n\n\treturn <VideoOverlay points={points} />\n}\n", "import { assertNever, unhandledError } from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { isCollectionRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { createCollectionItemWhenReady } from \"utils/createCollectionItem.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { addInfiniteScrollPagination, addLoadMorePagination } from \"./pagination.ts\"\nimport { createEmptyStateChild } from \"./repeater.ts\"\n\nfunction makeRepeaterPaginationContextMenu(engine: VekterEngine, repeater: DataRepeater): MenuItemOptions[] {\n\treturn [\n\t\t{\n\t\t\tlabel: \"Infinite Scroll\",\n\t\t\tclick: () => {\n\t\t\t\taddInfiniteScrollPagination(engine, repeater).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Load More\",\n\t\t\tclick: () => {\n\t\t\t\taddLoadMorePagination(engine, repeater).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction makeRepeaterFullContextMenu(engine: VekterEngine, repeater: DataRepeater): MenuItemOptions[] {\n\tconst items: MenuItemOptions[] = []\n\n\tif (isCollectionRepeater(repeater)) {\n\t\titems.push({\n\t\t\tlabel: \"Add Item\",\n\t\t\tclick: () => {\n\t\t\t\tconst collection = getCollectionForIdentifier(engine.tree, repeater.dataIdentifier)\n\t\t\t\tif (!collection) return\n\n\t\t\t\tcreateCollectionItemWhenReady({\n\t\t\t\t\tcollectionId: collection.id,\n\t\t\t\t\tengine,\n\t\t\t\t\tsource: \"pagination_menu\",\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\t}\n\n\titems.push({\n\t\tlabel: \"Add Pagination\",\n\t\tsubmenu: makeRepeaterPaginationContextMenu(engine, repeater),\n\t})\n\n\titems.push({\n\t\tlabel: \"Add Empty State\",\n\t\tclick: () => {\n\t\t\tengine.scheduler.process(() => {\n\t\t\t\tengine.stores.repeaterStore.showEmptyState(repeater.id)\n\t\t\t})\n\t\t\tcreateEmptyStateChild(engine, repeater)\n\t\t},\n\t})\n\n\treturn items\n}\n\nfunction makeRepeaterContextMenu(\n\tengine: VekterEngine,\n\trepeater: DataRepeater,\n\toptions: \"pagination\" | \"full\" = \"full\",\n): MenuItemOptions[] {\n\tif (options === \"full\") {\n\t\treturn makeRepeaterFullContextMenu(engine, repeater)\n\t}\n\n\tif (options === \"pagination\") {\n\t\treturn makeRepeaterPaginationContextMenu(engine, repeater)\n\t}\n\n\treturn assertNever(options)\n}\n\nexport function displayRepeaterContextMenu(\n\tlocation: Point,\n\tengine: VekterEngine,\n\trepeater: DataRepeater,\n\toptions: \"pagination\" | \"full\" = \"full\",\n) {\n\tconst items = makeRepeaterContextMenu(engine, repeater, options)\n\tengine.stores.contextMenuStore.show(items, { location, onCancel: engine.exitTool })\n}\n", "import { IconAddSmall } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport { stopPropagation } from \"../chrome/properties/rows/utils/stopPropagation.ts\"\nimport * as styles from \"./ElementButton.styles.ts\"\n\ninterface Props {\n\ttint: string\n\tcenter: Point\n\tdisplayCreateMenu: (event: React.MouseEvent) => void\n}\n\nexport function ElementButton({ tint, center, displayCreateMenu }: Props) {\n\tconst onMouseOver = React.useCallback(() => {\n\t\t// When hovering the element button, remove any highlight so that it's\n\t\t// clear what node the button is for.\n\t\tengine.stores.treeStore.setHighlight(null)\n\t}, [])\n\n\treturn (\n\t\t<div>\n\t\t\t<button\n\t\t\t\ttype=\"submit\"\n\t\t\t\tclassName={styles.plusButton}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: tint,\n\t\t\t\t\tboxShadow:\n\t\t\t\t\t\ttint === colors.componentTint\n\t\t\t\t\t\t\t? colors.buttonWithDepthPrimaryComponentShadow\n\t\t\t\t\t\t\t: colors.buttonWithDepthPrimaryShadow,\n\t\t\t\t\tcolor: \"white\",\n\t\t\t\t\tleft: center.x,\n\t\t\t\t\ttop: center.y,\n\t\t\t\t}}\n\t\t\t\tonClick={displayCreateMenu}\n\t\t\t\tonMouseDown={stopPropagation}\n\t\t\t\tonMouseOver={onMouseOver}\n\t\t\t\tonFocus={onMouseOver}\n\t\t\t\t// Stop the highlight from being reset while the button is still hovered.\n\t\t\t\tonMouseMove={stopPropagation}\n\t\t\t\tonDoubleClick={stopPropagation}\n\t\t\t>\n\t\t\t\t<div className={styles.iconAdd}>\n\t\t\t\t\t<IconAddSmall />\n\t\t\t\t</div>\n\t\t\t</button>\n\t\t</div>\n\t)\n}\n", "import \"ElementButton.styles_ukfx3x.wyw.css\"; export const plusButton = \"plusButton_pi74223\";\nexport const iconAdd = \"iconAdd_i1dp5mpg\";", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDataRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport type React from \"react\"\nimport { displayRepeaterContextMenu } from \"../utils/displayRepeaterContextMenu.ts\"\nimport { ElementButton } from \"./ElementButton.tsx\"\n\ninterface Props {\n\ttint: string\n\tcenter: Point\n\tcontainerNodeId: NodeID\n}\n\nexport function CollectionRepeaterButton({ tint, center, containerNodeId }: Props) {\n\tconst displayCreateMenu = useEngineCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\n\t\t\tconst container = engine.tree.get(containerNodeId)\n\t\t\tif (!container || !isDataRepeater(container)) return\n\n\t\t\tdisplayRepeaterContextMenu(engine.stores.mouseStore.latest.windowMousePosition, engine, container)\n\t\t},\n\t\t[containerNodeId],\n\t)\n\n\treturn <ElementButton tint={tint} center={center} displayCreateMenu={displayCreateMenu} />\n}\n", "import type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { FormBooleanInputNode } from \"document/models/CanvasTree/nodes/forms/FormBooleanInputNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisFormBooleanInputNode,\n\tisFormPlainTextInputNode,\n\tisFormSelectNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasLabelTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport type { WithFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { isFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages } from \"web/lib/tracker.ts\"\nimport {\n\tcreateAndInsertFormSubmitButton,\n\tcreateCheckboxLabelBlock,\n\tcreateInputLabelBlock,\n\tcreateRadioGroup,\n\tcreateSelectLabelBlock,\n} from \"../chrome/insertSidebar/dataSources/utils.tsx\"\nimport { getDefaultName } from \"../utils/nodes.ts\"\nimport { ElementButton } from \"./ElementButton.tsx\"\n\ninterface Props {\n\ttint: string\n\tcenter: Point\n\tcontainerNodeId: NodeID\n}\n\nexport function FormElementButton({ tint, center, containerNodeId }: Props) {\n\tuseRecordEffect(\"ui_impression\", { page: Pages.formContainerAddInput })\n\n\tconst displayCreateMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{ label: \"Text\", click: () => insertInput(containerNodeId) },\n\t\t\t\t\t{ label: \"Checkbox\", click: () => insertCheckbox(containerNodeId) },\n\t\t\t\t\t{ label: \"Radio\", click: () => insertRadio(containerNodeId) },\n\t\t\t\t\t{ label: \"Select\", click: () => insertSelect(containerNodeId) },\n\t\t\t\t\t...getFormElementInstances(containerNodeId),\n\t\t\t\t\t...getFormSubmitButtonMenuOption(containerNodeId),\n\t\t\t\t],\n\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[containerNodeId],\n\t)\n\n\treturn <ElementButton tint={tint} center={center} displayCreateMenu={displayCreateMenu} />\n}\n\nfunction cloneLastInputLabelBlockOfType(\n\tform: CanvasNode & WithFormContainer,\n\tpredicate: <T extends CanvasNode>(node: T) => node is T & any,\n): CanvasNode | undefined {\n\tif (!form.children) return\n\n\tconst inputs: CanvasNode[] = []\n\tfor (const node of form.walk()) {\n\t\tif (!predicate(node)) continue\n\t\tinputs.push(node)\n\t}\n\n\tfor (let index = inputs.length - 1; index >= 0; index--) {\n\t\tconst input = inputs[index]\n\t\tif (!input) continue\n\t\tconst label = engine.tree.getAncestorThatMatches(input, hasLabelTag)\n\t\tif (!label || !label.cache.formContainerAncestorId) continue\n\t\treturn label.clone({ visible: true })\n\t}\n\n\treturn undefined\n}\n\n/**\n * Used to ensure that replica insert operations are performed on the original form.\n */\nfunction getFormInsertionTarget(form: CanvasNode & WithFormContainer): CanvasNode & WithFormContainer {\n\tif (form.originalid) {\n\t\tconst original = engine.tree.get(form.originalid)\n\t\tif (isFormContainer(original)) return original\n\t}\n\n\treturn form\n}\n\nfunction insertInputBeforeSubmitButton(\n\tform: CanvasNode & WithFormContainer,\n\tcreateNode: (targetForm: CanvasNode & WithFormContainer) => CanvasNode | undefined,\n) {\n\tconst targetForm = getFormInsertionTarget(form)\n\tif (!targetForm) return\n\n\tconst input = createNode(targetForm)\n\tif (!input) return\n\n\tconst defaultIndex = targetForm.children?.length ? targetForm.children.length - 1 : 0\n\tconst buttonIndex = targetForm.children?.findIndex(node => node.id === targetForm.formSubmitButtonId) ?? defaultIndex\n\n\tengine.tree.insertNode(input, targetForm.id, buttonIndex)\n}\n\nfunction insertInput(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return\n\n\tinsertInputBeforeSubmitButton(form, targetForm => {\n\t\treturn (\n\t\t\tcloneLastInputLabelBlockOfType(targetForm, isFormPlainTextInputNode) ??\n\t\t\tcreateInputLabelBlock({\n\t\t\t\tlabel: \"Name\",\n\t\t\t\ttype: \"text\",\n\t\t\t\tplaceholder: \"Jane Smith\",\n\t\t\t\tname: \"Name\",\n\t\t\t})\n\t\t)\n\t})\n}\n\nfunction isCheckboxNode(node: CanvasNode): node is FormBooleanInputNode & { booleanInputType: \"checkbox\" } {\n\treturn isFormBooleanInputNode(node) && node.formBooleanInputType === \"checkbox\"\n}\n\nfunction isRadioNode(node: CanvasNode): node is FormBooleanInputNode & { booleanInputType: \"radio\" } {\n\treturn isFormBooleanInputNode(node) && node.formBooleanInputType === \"radio\"\n}\n\nfunction insertCheckbox(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return\n\n\tinsertInputBeforeSubmitButton(form, targetForm => {\n\t\treturn cloneLastInputLabelBlockOfType(targetForm, isCheckboxNode) ?? createCheckboxLabelBlock()\n\t})\n}\n\nfunction insertRadio(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return\n\n\tinsertInputBeforeSubmitButton(form, targetForm => {\n\t\treturn cloneLastInputLabelBlockOfType(targetForm, isRadioNode) ?? createRadioGroup()\n\t})\n}\n\nfunction insertSelect(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return\n\n\tinsertInputBeforeSubmitButton(form, targetForm => {\n\t\treturn cloneLastInputLabelBlockOfType(targetForm, isFormSelectNode) ?? createSelectLabelBlock()\n\t})\n}\n\nfunction hasFormSubmitButton(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return false\n\tif (!form.formSubmitButtonId) return false\n\n\tfor (const { node, skipChildren } of form.walkWithSkipChildren()) {\n\t\tif (!isCodeComponentNode(node)) continue\n\n\t\tconst id = node.getPrimaryId()\n\t\tif (id === form.formSubmitButtonId) {\n\t\t\treturn true\n\t\t}\n\n\t\t// skip overlays\n\t\tskipChildren()\n\t}\n\n\treturn false\n}\n\nfunction getFormSubmitButtonMenuOption(formId: NodeID): MenuItemOptions[] {\n\tconst hasSubmitButton = hasFormSubmitButton(formId)\n\treturn [\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: \"Submit\",\n\t\t\tchecked: hasSubmitButton,\n\t\t\tenabled: !hasSubmitButton,\n\t\t\tclick: () => {\n\t\t\t\tconst form = engine.tree.get(formId)\n\t\t\t\tif (!form || !isFormContainer(form)) return\n\n\t\t\t\t// If by the time the user clicks the submit button, the form has already been submitted, don't allow the user to add the submit button again.\n\t\t\t\tif (hasFormSubmitButton(formId)) return\n\n\t\t\t\tconst buttonId = randomID()\n\t\t\t\tcreateAndInsertFormSubmitButton(engine, form, buttonId)\n\n\t\t\t\tengine.tree.current(form)?.set({ formSubmitButtonId: buttonId })\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getFormElementInstances(formId: NodeID) {\n\tconst form = engine.tree.get(formId)\n\tif (!form || !isFormContainer(form)) return []\n\n\tconst identifiers = new Set<string>()\n\tconst items: MenuItemOptions[] = []\n\tfor (const { node, skipChildren } of form.walkWithSkipChildren()) {\n\t\tconst id = node.getPrimaryId()\n\t\tif (isCodeComponentNode(node)) {\n\t\t\tif (!identifiers.has(node.codeComponentIdentifier) && id !== form.formSubmitButtonId) {\n\t\t\t\tidentifiers.add(node.codeComponentIdentifier)\n\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: node.resolveValue(\"name\") ?? getDefaultName(engine.componentLoader, node),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tinsertInputBeforeSubmitButton(form, () => node.clone())\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\t// limit the length of the menu to 5 items\n\t\t\t\tif (items.length >= 5) break\n\t\t\t}\n\t\t\t// Always skip children of any code component as we don't want to\n\t\t\t// include instances in overlays the component may trigger.\n\t\t\tskipChildren()\n\t\t}\n\t}\n\n\tif (items.length === 0) return []\n\n\titems.unshift({ type: \"separator\" })\n\n\treturn items\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport type { Line } from \"library/render/types/Line.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport * as styles from \"./InsertionIndicator.styles.ts\"\n\ninterface Props {\n\tinsertion: Line | null\n\tzoom: number\n}\n\nexport class InsertionIndicator extends React.Component<Props> {\n\toverride render() {\n\t\tconst { insertion, zoom } = this.props\n\t\tif (!insertion) return null\n\n\t\tconst a = Point.multiply(insertion.a, zoom)\n\t\tconst b = Point.multiply(insertion.b, zoom)\n\n\t\tconst angle = Point.angle(a, b)\n\t\tconst length = Point.distance(a, b)\n\n\t\tconst style: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\tleft: a.x,\n\t\t\ttop: a.y,\n\t\t\twidth: Math.max(length, 1),\n\t\t\theight: styles.borderWidth,\n\t\t\tbackgroundColor: colors.tint,\n\t\t\ttransformOrigin: \"0 0\",\n\t\t\ttransform: `rotate(${angle + 90}deg) translateY(-${styles.borderWidth / 2}px)`,\n\t\t}\n\t\treturn (\n\t\t\t<div style={style}>\n\t\t\t\t<div className={cx(styles.circle, styles.circleStart)} />\n\t\t\t\t<div className={cx(styles.circle, styles.circleEnd)} />\n\t\t\t</div>\n\t\t)\n\t}\n}\n", "import \"InsertionIndicator.styles_1kq8jy0.wyw.css\"; export const borderWidth = 2;\nexport const circle = \"circle_co0276o\";\nexport const circleStart = \"circleStart_c1qhqnox\";\nexport const circleEnd = \"circleEnd_cm3xzoo\";", "import { Stack } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { getCornerPointsOnCanvasWithZoom } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { Rect } from \"library/index.ts\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\n\nfunction OverlayIcon({ tint }: { tint: string }) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t<path\n\t\t\t\td=\"M 4 1.5 C 4 0.672 4.672 0 5.5 0 L 10.5 0 C 11.328 0 12 0.672 12 1.5 L 12 6.5 C 12 7.328 11.328 8 10.5 8 L 5.5 8 C 4.672 8 4 7.328 4 6.5 Z\"\n\t\t\t\tfill={tint}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 0 5.5 C 0 4.672 0.672 4 1.5 4 L 3 4 L 3 6.75 C 3 7.993 4.007 9 5.25 9 L 8 9 L 8 10.5 C 8 11.328 7.328 12 6.5 12 L 1.5 12 C 0.672 12 0 11.328 0 10.5 Z\"\n\t\t\t\tfill={tint}\n\t\t\t\topacity=\"0.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction SwapIcon({ tint }: { tint: string }) {\n\treturn (\n\t\t<Stack\n\t\t\tjustifyContent=\"center\"\n\t\t\talignItems=\"center\"\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: tint,\n\t\t\t\tborderRadius: 8,\n\t\t\t\twidth: 30,\n\t\t\t\theight: 30,\n\t\t\t\tzIndex: 1,\n\t\t\t}}\n\t\t>\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 5 8 L 5 7 C 5 5.895 5.895 5 7 5 L 15 5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"hsl(0, 0%, 100%)\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 5 15 L 13 15 C 14.105 15 15 14.105 15 13 L 15 12\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"hsl(0, 0%, 100%)\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 13.5 1.5 L 17 5 L 13.5 8.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"hsl(0, 0%, 100%)\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 6.5 11.5 L 3 15 L 6.5 18.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"hsl(0, 0%, 100%)\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t</Stack>\n\t)\n}\n\nconst minLongLabelSize = 120\nconst minShortLabelSize = 70\nfunction overlayLabelForRect(rect: Rect) {\n\tif (rect.width > minLongLabelSize) return \"Add Overlay\u2026\"\n\tif (rect.width > minShortLabelSize) return \"Add\u2026\"\n\treturn \"\"\n}\n\nconst minIconSize = 30\nfunction Inner({ rect, tint, swap }: { rect: Rect; tint: string; swap: boolean }) {\n\tconst label = swap ? \"Swap\" : overlayLabelForRect(rect)\n\tif (rect.height <= minIconSize || rect.width <= minIconSize) return null\n\n\treturn (\n\t\t<>\n\t\t\t{swap ? <SwapIcon tint={tint} /> : <OverlayIcon tint={tint} />}\n\t\t\t{label && <p style={{ color: tint, margin: 0 }}> {label} </p>}\n\t\t</>\n\t)\n}\n\nconst borderWidth = 2\nexport function OverlayInsertionIndicator({ id, zoom, tree }: { id: NodeID; zoom: number; tree: CanvasTree }) {\n\tconst node = tree.get(id)\n\tif (!node) return null\n\n\tconst tint = getTintColor(node)\n\tconst swap = hasFloatingPosition(node)\n\n\treturn (\n\t\t<Overlay\n\t\t\tkey={id}\n\t\t\tpoints={getCornerPointsOnCanvasWithZoom(tree, node, zoom)}\n\t\t\tborderColor={tint}\n\t\t\tborderWidth={borderWidth}\n\t\t\tbackgroundColor={colors.panelBackground}\n\t\t\t// Don't block pointer events from reaching the CanvasDropZone\n\t\t\tstyle={{ pointerEvents: \"none\" }}\n\t\t>\n\t\t\t{({ rect }) => (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection={swap ? \"column\" : \"row\"}\n\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tgap={10}\n\t\t\t\t\tstyle={{ height: \"100%\", width: \"100%\" }}\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\tbackground: tint,\n\t\t\t\t\t\t\topacity: 0.2,\n\t\t\t\t\t\t\tinset: 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<Inner tint={tint} rect={rect} swap={swap} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Overlay>\n\t)\n}\n", "import type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { convertFrameToCanvas, getCornerPointsOnCanvasWithZoom } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\n\ninterface Props {\n\tids: NodeID[]\n\ttree: CanvasTree\n\tzoom: number\n\toutlineWidth?: number\n\tvisibleCanvasRect: Rect\n\tdashed?: boolean\n\tborderColor?: string\n\tbackgroundColor?: string\n}\n\nexport function ParentHighlight({\n\tbackgroundColor,\n\tborderColor,\n\tdashed = false,\n\tids,\n\toutlineWidth = 2,\n\ttree,\n\tvisibleCanvasRect,\n\tzoom,\n}: Props) {\n\tif (ids.length === 0) return null\n\n\tconst frameOutlines: JSX.Element[] = []\n\n\tfor (const node of tree.getNodes(ids)) {\n\t\tconst nodeCanvasRect = convertFrameToCanvas(tree, node)\n\t\t// If the parent is out of the viewport, don't render the outline\n\t\tif (\n\t\t\tvisibleCanvasRect &&\n\t\t\t!Rect.containsRect(visibleCanvasRect, nodeCanvasRect) &&\n\t\t\t!Rect.intersects(visibleCanvasRect, nodeCanvasRect)\n\t\t) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If the parent is bigger than the viewport, don't render it either.\n\t\tif (Rect.containsRect(nodeCanvasRect, visibleCanvasRect)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst tint = getTintColor(node)\n\t\tif (dashed) {\n\t\t\tframeOutlines.push(\n\t\t\t\t<Overlay\n\t\t\t\t\tkey={node.id}\n\t\t\t\t\tpoints={getCornerPointsOnCanvasWithZoom(tree, node, zoom)}\n\t\t\t\t\tborderWidth={outlineWidth}\n\t\t\t\t\tborderColor={tint}\n\t\t\t\t\tdashed\n\t\t\t\t\t// Don't block pointer events from reaching the CanvasDropZone\n\t\t\t\t\tstyle={{ pointerEvents: \"none\" }}\n\t\t\t\t/>,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\tframeOutlines.push(\n\t\t\t<Overlay\n\t\t\t\tkey={node.id}\n\t\t\t\tpoints={getCornerPointsOnCanvasWithZoom(tree, node, zoom)}\n\t\t\t\tborderColor={borderColor ?? tint}\n\t\t\t\tborderWidth={outlineWidth}\n\t\t\t\tbackgroundColor={backgroundColor}\n\t\t\t\tclippingRect={Rect.multiply(visibleCanvasRect, zoom)}\n\t\t\t\t// Don't block pointer events from reaching the CanvasDropZone\n\t\t\t\tstyle={{ pointerEvents: \"none\" }}\n\t\t\t/>,\n\t\t)\n\t}\n\n\treturn <>{frameOutlines}</>\n}\n", "import \"DashedLine.styles_n54qwj.wyw.css\"; export const svg = \"svg_s14zeb80\";", "import type React from \"react\"\nimport * as styles from \"./DashedLine.styles.ts\"\n\ninterface DashedLineProps {\n\tx: number\n\ty: number\n\tdirection: \"vertical\" | \"horizontal\"\n\tmaxLength: number\n\tlength: number\n\tcolor: string\n\tstrokeWidth?: number\n\tstrokeDasharray?: number\n\tstrokeDashoffset?: number\n}\n\nexport const DashedLine = ({\n\tx,\n\ty,\n\tdirection,\n\tmaxLength,\n\tlength,\n\tcolor,\n\tstrokeWidth = 2,\n\tstrokeDasharray = 2,\n\tstrokeDashoffset = 2,\n}: DashedLineProps) => {\n\tif (length === 0) return null\n\n\tconst isVertical = direction === \"vertical\"\n\tconst sizeStyle = isVertical ? { height: maxLength, width: strokeWidth } : { width: maxLength, height: strokeWidth }\n\n\tconst wrapperStyle: React.CSSProperties = {\n\t\t...sizeStyle,\n\t\tposition: \"absolute\",\n\t\twillChange: \"transform\",\n\t\ttransform: `translateX(${x}px) translateY(${y}px)`,\n\t\tcolor,\n\t}\n\n\tconst x2 = isVertical ? 0 : length\n\tconst y2 = isVertical ? length : 0\n\n\treturn (\n\t\t<div style={wrapperStyle}>\n\t\t\t<svg className={styles.svg}>\n\t\t\t\t<line\n\t\t\t\t\tx1={0}\n\t\t\t\t\ty1={0}\n\t\t\t\t\tx2={x2}\n\t\t\t\t\ty2={y2}\n\t\t\t\t\tstrokeWidth={strokeWidth}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeDasharray={strokeDasharray}\n\t\t\t\t\tstrokeDashoffset={strokeDashoffset}\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t</div>\n\t)\n}\n", "import type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport {\n\tconvertCornerPointsToCanvas,\n\tconvertFrameToCanvas,\n\tconvertRectToCanvasWithRotation,\n\tgetParentViewportRect,\n} from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { isSkewedQuadrilateralPoints } from \"../utils/isSkewedQuadrilateralPoints.ts\"\nimport { isWaitingForMeasuredRect } from \"../utils/isWaitingForMeasuredRect.ts\"\nimport { DashedLine } from \"./DashedLine.tsx\"\n\ninterface Props {\n\ttree: CanvasTree\n\tselection: NodeID[]\n\tzoom: number\n}\n\ntype Pin = \"top\" | \"right\" | \"bottom\" | \"left\"\n\nconst pins: Pin[] = [\"top\", \"right\", \"bottom\", \"left\"]\n\nexport const PinningCanvasVisualization = ({ tree, selection, zoom }: Props) => {\n\tif (selection.length !== 1) return null\n\n\tconst node = tree.getNode(selection[0])\n\tif (!node || !isPinnable(node) || !node.cache.visible) return null\n\tif (withRotation(node) && node.resolveValue(\"rotation\") !== 0) return null\n\tif (hasFloatingPosition(node)) return null\n\tif (isWaitingForMeasuredRect(node)) return null\n\n\tconst parent = tree.getParent(node.id)\n\tif (!parent || isPositionRelative(node, parent)) return null\n\tconst parentCanvasRect = convertRectToCanvasWithRotation(tree, parent)\n\tif (parentCanvasRect.rotation !== 0) return null\n\n\tconst cornerPoints = convertCornerPointsToCanvas(tree, node)\n\tif (isSkewedQuadrilateralPoints(cornerPoints)) return null\n\n\tconst viewportRect = getParentViewportRect(tree, node)\n\tconst referenceRect = viewportRect ?? parentCanvasRect\n\tconst nodeCanvasRect = convertFrameToCanvas(tree, node)\n\n\tconst pinnedSides = pins.filter(pin => {\n\t\treturn isNumber(node[pin])\n\t})\n\n\t// Don't show the center cross for text node as it might be distracting\n\tif (pinnedSides.length === 0 && !isTextNode(node)) {\n\t\treturn <PinCenterVisualization nodeCanvasRect={nodeCanvasRect} zoom={zoom} color={getTintColor(node)} />\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{pinnedSides.map(pin => {\n\t\t\t\tconst pinDistance = node[pin]\n\t\t\t\tif (!pinDistance || pinDistance <= 0) return null\n\t\t\t\treturn (\n\t\t\t\t\t<PinSideVisualization\n\t\t\t\t\t\tkey={pin}\n\t\t\t\t\t\tpin={pin}\n\t\t\t\t\t\tnodeCanvasRect={nodeCanvasRect}\n\t\t\t\t\t\tparentCanvasRect={referenceRect}\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\tcolor={getTintColor(parent)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n\ninterface PinVisualizationProps {\n\tpin: Pin\n\tnodeCanvasRect: Rect\n\tparentCanvasRect: Rect\n\tzoom: number\n\tcolor: string\n}\n\nfunction getPinPoint(pin: Pin, nodeRect: Rect): Point {\n\tswitch (pin) {\n\t\tcase \"top\":\n\t\t\treturn { x: nodeRect.x + nodeRect.width / 2, y: nodeRect.y }\n\t\tcase \"right\":\n\t\t\treturn { x: nodeRect.x + nodeRect.width, y: nodeRect.y + nodeRect.height / 2 }\n\t\tcase \"bottom\":\n\t\t\treturn { x: nodeRect.x + nodeRect.width / 2, y: nodeRect.y + nodeRect.height }\n\t\tcase \"left\":\n\t\t\treturn { x: nodeRect.x, y: nodeRect.y + nodeRect.height / 2 }\n\t}\n}\n\nfunction pointOnOuterRect(pin: Pin, innerPoint: Point, outerRect: Rect): Point {\n\tswitch (pin) {\n\t\tcase \"top\":\n\t\t\treturn { x: innerPoint.x, y: outerRect.y }\n\t\tcase \"right\":\n\t\t\treturn { x: outerRect.x + outerRect.width, y: innerPoint.y }\n\t\tcase \"bottom\":\n\t\t\treturn { x: innerPoint.x, y: outerRect.y + outerRect.height }\n\t\tcase \"left\":\n\t\t\treturn { x: outerRect.x, y: innerPoint.y }\n\t}\n}\n\nfunction PinSideVisualization({ pin, nodeCanvasRect, parentCanvasRect, zoom, color }: PinVisualizationProps) {\n\tconst innerPoint = Point.pixelAligned(Point.multiply(getPinPoint(pin, nodeCanvasRect), zoom))\n\tconst outerRect = Rect.multiply(parentCanvasRect, zoom)\n\tif (!Rect.containsPoint(outerRect, innerPoint)) return null\n\n\tconst outerPoint = Point.pixelAligned(pointOnOuterRect(pin, innerPoint, outerRect))\n\n\tconst xs = [innerPoint.x, outerPoint.x]\n\tconst ys = [innerPoint.y, outerPoint.y]\n\n\tconst minX = Math.min(...xs)\n\tconst maxX = Math.max(...xs)\n\tconst minY = Math.min(...ys)\n\tconst maxY = Math.max(...ys)\n\tconst deltaX = maxX - minX\n\tconst deltaY = maxY - minY\n\tconst direction = deltaX > deltaY ? \"horizontal\" : \"vertical\"\n\treturn (\n\t\t<DashedLine\n\t\t\tx={minX}\n\t\t\ty={minY}\n\t\t\tdirection={direction}\n\t\t\tmaxLength={direction === \"horizontal\" ? outerRect.width : outerRect.height}\n\t\t\tlength={Math.max(deltaX, deltaY)}\n\t\t\tcolor={color}\n\t\t/>\n\t)\n}\n\nconst crossSize = 34\nfunction PinCenterVisualization({\n\tnodeCanvasRect,\n\tzoom,\n\tcolor,\n}: Pick<PinVisualizationProps, \"nodeCanvasRect\" | \"zoom\" | \"color\">) {\n\tconst nodeRect = Rect.multiply(nodeCanvasRect, zoom)\n\tif (nodeRect.width < crossSize || nodeRect.height < crossSize) return null\n\n\tconst centerPoint = Point.pixelAligned(Rect.center(nodeRect))\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\twidth: crossSize,\n\t\t\t\theight: crossSize,\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tdisplay: \"flex\",\n\t\t\t\tjustifyContent: \"center\",\n\t\t\t\talignItems: \"center\",\n\t\t\t\ttransform: `translateX(${centerPoint.x - crossSize / 2}px) translateY(${centerPoint.y - crossSize / 2}px)`,\n\t\t\t\tcolor: color,\n\t\t\t}}\n\t\t>\n\t\t\t<DashedCross />\n\t\t</div>\n\t)\n}\n\nfunction DashedCross() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width={crossSize} height={crossSize}>\n\t\t\t<path d=\"M 17 0 L 17 34\" fill=\"transparent\" stroke=\"currentColor\" strokeDasharray=\"2\"></path>\n\t\t\t<path d=\"M 0 17 L 34 17\" fill=\"transparent\" stroke=\"currentColor\" strokeDasharray=\"2\"></path>\n\t\t</svg>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CodeComponentNode, FrameNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport { createRichTextNodeWithTag, getDefaultPresets } from \"document/models/CanvasTree/nodes/RichTextNode.utils.ts\"\nimport { isCollectionRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { createComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasAnyLayout, hasStackLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tcontrolDescriptionFromVariable,\n\tisArrayOfObjectControlDescription,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { createValueTransformWithName } from \"document/models/CanvasTree/traits/utils/valueTransformUtils.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { VariableProviderInfo } from \"document/utils/VariableProviderInfo.ts\"\nimport { createArrayStack, createCollectionList } from \"document/utils/contentCreationTemplates.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { setupInsertedCollectionRepeater } from \"document/utils/setupInsertedCollectionRepeater.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type React from \"react\"\nimport { useMemo } from \"react\"\nimport { isNestedVariableId } from \"utils/collectionReferenceUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { componentUpdateForVectorSetItemControl } from \"utils/vectorSets.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport { ElementButton } from \"./ElementButton.tsx\"\n\ninterface Props {\n\ttint: string\n\tcenter: Point\n\trepeatedElement: CanvasNode\n}\n\nexport function RepeatedItemButton({ tint, center, repeatedElement }: Props) {\n\tconst menuOptions = useMemo(() => {\n\t\tconst variableInfo = engine.stores.treeStore.variableProviderInfo\n\t\tif (!variableInfo) return\n\n\t\tconst repeater = engine.tree.getParent(repeatedElement.id)\n\t\tif (!isCollectionRepeater(repeater)) return\n\n\t\t// FIXME: once we ship full arrays we should make this button work with the variables on the\n\t\t// node and not looking up the collection.\n\t\tconst collection = getCollectionForIdentifier(engine.tree, repeater.dataIdentifier)\n\t\tif (!collection) return\n\n\t\treturn getMenuItemsForCollectionNode(variableInfo, collection, repeater.id, repeatedElement, [], [])\n\t}, [repeatedElement])\n\n\tconst displayCreateMenu = useEngineCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tassert(menuOptions)\n\n\t\t\tevent.stopPropagation()\n\t\t\tengine.stores.contextMenuStore.show(menuOptions, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[menuOptions],\n\t)\n\n\tif (!menuOptions) return null\n\n\treturn <ElementButton tint={tint} center={center} displayCreateMenu={displayCreateMenu} />\n}\n\nfunction wrapInStackIfNeeded(parent: CanvasNode) {\n\tif (hasAnyLayout(parent)) return parent.id\n\n\treturn ContextAction.addStack(engine, [parent])\n}\n\nfunction getMenuItemsForCollectionNode(\n\tvariableInfo: VariableProviderInfo,\n\tcollection: CollectionNode,\n\tproviderId: string,\n\tparent: CanvasNode,\n\tparentCollectionIds: NodeID[],\n\tvariablePath: string[] = [],\n): MenuItemOptions[] {\n\tconst items: MenuItemOptions[] = []\n\n\tconst slugId = collection.variables.find(variable => variable.type === \"slug\")?.id\n\n\tcollection.variables.forEach(variable => {\n\t\tlet variableId = variable.id\n\t\tif (variablePath.length > 0) {\n\t\t\tvariableId = `${variablePath.join(\".\")}.${variableId}`\n\t\t}\n\n\t\tswitch (variable.type) {\n\t\t\tcase ControlType.Array: {\n\t\t\t\tif (isNestedVariableId(variableId)) break\n\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst control = variableInfo.combinedControls.get(providerId)?.get(variable.id)\n\t\t\t\t\t\tif (!isArrayOfObjectControlDescription(control)) return\n\n\t\t\t\t\t\tconst repeater = createArrayStack({\n\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\tvariableId,\n\t\t\t\t\t\t\tproperties: control.control.controls,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tconst targetNode = engine.tree.get(targetNodeId)\n\t\t\t\t\t\tassert(targetNode, \"Target node must exist\")\n\n\t\t\t\t\t\tengine.tree.insertNode(repeater, targetNodeId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.RichText: {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst text = new RichTextNode({\n\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\thtml: variable.name,\n\t\t\t\t\t\t\thtmlContent: createVariableReference(variableId, providerId),\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\twidthType: DimensionType.FixedNumber,\n\t\t\t\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\t\t\t\t...getDefaultPresets(engine.tree),\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tengine.tree.insertNode(text, targetNodeId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.Date:\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.Number:\n\t\t\tcase ControlType.Boolean:\n\t\t\tcase ControlType.Enum: {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tlet textContent: DynamicValue = createVariableReference(variableId, providerId)\n\n\t\t\t\t\t\tconst transform = getStringTransformForVariable(variable)\n\t\t\t\t\t\tif (transform) {\n\t\t\t\t\t\t\ttextContent = createComputedValue(ControlType.String, textContent, [transform])\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst isMultiLine = Boolean(variable.type === ControlType.String && variable.options?.displayTextArea)\n\t\t\t\t\t\tconst text = createRichTextNodeWithTag({\n\t\t\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\t\t\ttag: \"p\",\n\t\t\t\t\t\t\ttext: variable.name,\n\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\t\ttextContent,\n\t\t\t\t\t\t\t\twidth: isMultiLine ? 300 : undefined,\n\t\t\t\t\t\t\t\twidthType: isMultiLine ? DimensionType.FixedNumber : DimensionType.Auto,\n\t\t\t\t\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tengine.tree.insertNode(text, targetNodeId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.Image: {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst image = new FrameNode({\n\t\t\t\t\t\t\twidth: 30,\n\t\t\t\t\t\t\theight: 30,\n\t\t\t\t\t\t\tradius: 8,\n\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\tfillEnabled: true,\n\t\t\t\t\t\t\tfillType: \"image\",\n\t\t\t\t\t\t\tfillImage: createVariableReference(variableId, providerId),\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tengine.tree.insertNode(image, targetNodeId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.CollectionReference: {\n\t\t\t\tconst referenceCollection = getCollectionForIdentifier(engine.tree, variable.dataIdentifier)\n\t\t\t\tif (!referenceCollection) return\n\t\t\t\tif (parentCollectionIds.includes(referenceCollection.id)) return\n\n\t\t\t\tconst children = getMenuItemsForCollectionNode(\n\t\t\t\t\tvariableInfo,\n\t\t\t\t\treferenceCollection,\n\t\t\t\t\tproviderId,\n\t\t\t\t\tparent,\n\t\t\t\t\t[...parentCollectionIds, referenceCollection.id],\n\t\t\t\t\t[...variablePath, variable.id],\n\t\t\t\t)\n\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tsubmenu: children,\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.MultiCollectionReference: {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst collectionDefinition = engine.componentLoader.dataForIdentifier(variable.dataIdentifier)\n\t\t\t\t\t\tassert(collectionDefinition, \"Collection definition must exist\")\n\n\t\t\t\t\t\tconst webPages = engine.stores.scopeStore.getWebPageNodes()\n\t\t\t\t\t\tconst webPageUsingCollection = webPages.find(webPage => {\n\t\t\t\t\t\t\treturn webPage.dataIdentifier === variable.dataIdentifier\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tconst stackDirection =\n\t\t\t\t\t\t\thasStackLayout(parent) && !isDynamicValue(parent.stackDirection) ? parent.stackDirection : \"vertical\"\n\n\t\t\t\t\t\tconst repeater = createCollectionList({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tidentifier: variable.dataIdentifier,\n\t\t\t\t\t\t\tslugId,\n\t\t\t\t\t\t\tproperties: collectionDefinition.properties,\n\t\t\t\t\t\t\tdetailPageId: webPageUsingCollection?.id,\n\t\t\t\t\t\t\tstackDirection,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tconst targetNode = engine.tree.get(targetNodeId)\n\t\t\t\t\t\tassert(targetNode, \"Target node must exist\")\n\n\t\t\t\t\t\tengine.tree.insertNode(repeater, targetNodeId)\n\t\t\t\t\t\tsetupInsertedCollectionRepeater(engine, targetNode, repeater)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcase ControlType.VectorSetItem: {\n\t\t\t\tconst control = controlDescriptionFromVariable(\n\t\t\t\t\tengine.tree,\n\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\tvariable,\n\t\t\t\t\tScopeType.ContentManagement,\n\t\t\t\t)\n\t\t\t\tconst update = componentUpdateForVectorSetItemControl(control, engine.tree, engine.stores.modulesStore)\n\n\t\t\t\tif (!update) break\n\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: variable.name,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst targetNodeId = wrapInStackIfNeeded(parent)\n\t\t\t\t\t\tconst component = new CodeComponentNode({\n\t\t\t\t\t\t\t...update,\n\t\t\t\t\t\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t\t\t\t\t\tdynamicVectorSetIdentifier: createVariableReference(variableId, providerId),\n\t\t\t\t\t\t})\n\t\t\t\t\t\tengine.tree.insertNode(component, targetNodeId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t})\n\n\treturn items\n}\n\nfunction getStringTransformForVariable(variable: VariableDefinition) {\n\tswitch (variable.type) {\n\t\tcase ControlType.Number: {\n\t\t\treturn createValueTransformWithName({\n\t\t\t\tname: \"numberToString\",\n\t\t\t\tinput: ControlType.Number,\n\t\t\t\toutput: ControlType.String,\n\t\t\t})\n\t\t}\n\n\t\tcase ControlType.Date: {\n\t\t\tconst transform = createValueTransformWithName({\n\t\t\t\tname: \"toDateString\",\n\t\t\t\tinput: ControlType.Date,\n\t\t\t\toutput: ControlType.String,\n\t\t\t})\n\n\t\t\tif (variable.options?.displayTime) {\n\t\t\t\ttransform.display = \"date-time\"\n\t\t\t}\n\n\t\t\treturn transform\n\t\t}\n\n\t\tcase ControlType.Boolean: {\n\t\t\tconst transform = createValueTransformWithName({\n\t\t\t\tname: \"convertFromBoolean\",\n\t\t\t\tinput: ControlType.Boolean,\n\t\t\t\toutput: ControlType.String,\n\t\t\t})\n\n\t\t\ttransform.falsy = \"No\"\n\t\t\ttransform.truthy = \"Yes\"\n\n\t\t\treturn transform\n\t\t}\n\n\t\tcase ControlType.Enum: {\n\t\t\treturn createValueTransformWithName({\n\t\t\t\tname: \"enumToDisplayName\",\n\t\t\t\tinput: ControlType.Enum,\n\t\t\t\toutput: ControlType.String,\n\t\t\t})\n\t\t}\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { convertFrameToCanvas, getCornerPointsOnCanvasWithZoom } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { getTintColor } from \"../tools/utils/getTintColor.ts\"\nimport { isClippedOnCanvasByGroundNode } from \"../utils/isClippedOnCanvasByGroundNode.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\n\ninterface Props {\n\tid: NodeID\n\ttree: CanvasTree\n\tzoom: number\n\tvisibleCanvasRect?: Rect\n\thidden: boolean\n}\n\nexport function SiblingOutline({ tree, id, zoom, hidden, visibleCanvasRect }: Props) {\n\tconst outlineWidth = 2\n\tlet tint = colors.tint\n\n\tconst node = tree.getNode(id)\n\tif (!node || !node.cache.visible) return null\n\n\ttint = getTintColor(node)\n\n\tconst nodeCanvasRect = convertFrameToCanvas(tree, node)\n\n\t// If the parent is out of (or bigger than) the viewport, don't render the outline\n\tif (\n\t\tvisibleCanvasRect &&\n\t\t!Rect.containsRect(visibleCanvasRect, nodeCanvasRect) &&\n\t\t!Rect.intersects(visibleCanvasRect, nodeCanvasRect)\n\t) {\n\t\treturn null\n\t}\n\n\t// Don't show the outline if it would be clipped by the ground node.\n\tif (isClippedOnCanvasByGroundNode(engine, node)) return null\n\n\treturn (\n\t\t<Overlay\n\t\t\tpoints={getCornerPointsOnCanvasWithZoom(tree, node, zoom)}\n\t\t\tborderColor={tint}\n\t\t\tborderWidth={hidden ? 0 : outlineWidth}\n\t\t\tstyle={{ opacity: 0.3 }}\n\t\t/>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getCornerPointsOnCanvasWithZoom } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\n\ninterface UploadingOverlaysProps {\n\tids: NodeID[]\n\tzoom: number\n\ttree: CanvasTree\n}\n\nexport function UploadingOverlays({ ids, zoom, tree }: UploadingOverlaysProps) {\n\treturn (\n\t\t<>\n\t\t\t{ids.map(id => (\n\t\t\t\t<TilingBackgroundImageUploadingIndicator key={id} id={id} zoom={zoom} tree={tree} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n\nfunction TilingBackgroundImageUploadingIndicator({ id, zoom, tree }: { id: NodeID; zoom: number; tree: CanvasTree }) {\n\tconst node = tree.get(id)\n\tif (!node) return null\n\n\treturn (\n\t\t<Overlay\n\t\t\tkey={id}\n\t\t\tpoints={getCornerPointsOnCanvasWithZoom(tree, node, zoom)}\n\t\t\tbackgroundColor={colors.tintDimmed}\n\t\t\tborderWidth={0}\n\t\t\tborderColor=\"none\"\n\t\t\t// Don't block pointer events from reaching the CanvasDropZone\n\t\t\tstyle={{ pointerEvents: \"none\" }}\n\t\t>\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tjustifyContent=\"center\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tgap={10}\n\t\t\t\tstyle={{ height: \"100%\", width: \"100%\" }}\n\t\t\t>\n\t\t\t\t<p style={{ color: colors.tint, margin: 0 }}>Uploading\u2026</p>\n\t\t\t</Stack>\n\t\t</Overlay>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithViewport } from \"document/models/CanvasTree/traits/WithViewport.ts\"\nimport { canNodeProvideViewportRect } from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport { convertRectToCanvasWithRotation } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type React from \"react\"\nimport { useCallback, useState } from \"react\"\nimport { cursorImage } from \"utils/cursor.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { useTimeout } from \"utils/useTimeout.tsx\"\nimport { stopPropagation } from \"../chrome/properties/rows/utils/stopPropagation.ts\"\nimport { GPULayer } from \"./GPULayer.tsx\"\nimport * as styles from \"./ViewportHighlight.styles.ts\"\n\ninterface Props {\n\tselected: boolean\n\ttint: string\n\tviewportHeight: number\n\tscreenId: NodeID\n\tzoom: number\n}\n\nexport function ViewportHighlight({ selected, viewportHeight, tint, screenId, zoom }: Props) {\n\tconst screen = getViewportProvidingGroundNode(screenId)\n\tif (!screen) return null\n\n\tconst { screenRect, viewportRect } = createViewportRects(screen, viewportHeight, zoom)\n\tif (!viewportRect || !screenRect) return null\n\n\tconst { width, height, x, y } = screenRect\n\n\tconst containerStyle: React.CSSProperties = {\n\t\twidth: width,\n\t\theight: height,\n\t\ttransform: `translateX(${x}px) translateY(${y}px)`,\n\t\ttransformOrigin: \"0 0\",\n\t}\n\n\tconst offscreenOverlayHeight = screenRect.height - viewportRect.height\n\n\treturn (\n\t\t<div className={styles.container} style={containerStyle}>\n\t\t\t{offscreenOverlayHeight > 1 && (\n\t\t\t\t<OffscreenOverlay\n\t\t\t\t\ttint={tint}\n\t\t\t\t\theight={offscreenOverlayHeight}\n\t\t\t\t\twidth={width}\n\t\t\t\t\ttop={viewportRect.height}\n\t\t\t\t\tselected={selected}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{/* Top */}\n\t\t\t{selected && <GPULayer color={tint} width={width} height={1} x={0} y={0} />}\n\t\t\t{/* Right */}\n\t\t\t{selected && <GPULayer color={tint} width={1} height={viewportRect.height} x={width - 1} y={0} />}\n\t\t\t{/* Left */}\n\t\t\t{selected && <GPULayer color={tint} width={1} height={viewportRect.height} x={0} y={0} />}\n\t\t\t{/* Bottom */}\n\t\t\t<GPULayer color={tint} width={width} height={1} x={0} y={viewportRect.height} />\n\t\t</div>\n\t)\n}\n\ninterface OffscreenOverlayProps {\n\twidth: number\n\theight: number\n\ttint: string\n\ttop: number\n\tselected?: boolean\n}\n\nfunction OffscreenOverlay({ width, height, tint, top, selected }: OffscreenOverlayProps) {\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\twidth: width,\n\t\theight: height,\n\t\ttop,\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{selected && <div style={{ ...style, backgroundColor: \"transparent\", border: `1px dashed ${tint}` }} />}\n\t\t\t<div style={{ ...style, backgroundColor: tint, opacity: 0.1 }} />\n\t\t</>\n\t)\n}\n\nconst cursor = cursorImage(\"resize-north-south\")\n\nexport function ViewportHandle({\n\tviewportHeight,\n\ttint,\n\tstyle,\n\tdragging,\n\tscreenId,\n\tzoom,\n\tattachToNode,\n}: {\n\tviewportHeight: number\n\ttint: string\n\tstyle?: React.CSSProperties\n\tdragging: boolean\n\tscreenId: NodeID\n\tzoom: number\n\t// If given, we render the viewport pill attached to the bottom of the node (instead of the screen)\n\tattachToNode: NodeID | undefined\n}) {\n\tconst [editing, setEditing] = useState(false)\n\tconst { startTimeout, cancelTimeout } = useTimeout()\n\n\tconst onMouseDown = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\t// avoid deselecting the node\n\t\t\tstopPropagation(event)\n\n\t\t\tconst screen = getViewportProvidingGroundNode(screenId)\n\t\t\tif (!screen) return\n\n\t\t\tconst isDoubleClick = event.detail === 2\n\t\t\tif (isDoubleClick) return\n\n\t\t\tconst setViewportResizeTool = engine.scheduler.wrapHandler(() => {\n\t\t\t\t// since we block the mouse event above, we need to manually update the mousedown state in the mouse store\n\t\t\t\tengine.stores.mouseStore.setMouseDown(true)\n\t\t\t\tengine.setTool(Tools.ViewportResize, {\n\t\t\t\t\tvariantNodeId: screenId,\n\t\t\t\t\tattachToNode,\n\t\t\t\t})\n\t\t\t})\n\n\t\t\t// wait to see if the user is double-clicking\n\t\t\tstartTimeout(setViewportResizeTool, 100)\n\t\t},\n\t\t[screenId, attachToNode, startTimeout],\n\t)\n\n\tconst onDoubleClick = useCallback(() => {\n\t\tcancelTimeout()\n\t\tsetEditing(true)\n\t}, [cancelTimeout])\n\n\tconst onEdit = useCallback(\n\t\t(value: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\n\t\t\tconst variant = getViewportProvidingGroundNode(screenId)\n\t\t\tif (!variant) return reset()\n\n\t\t\tconst newViewportHeight = parseInt(value)\n\t\t\tif (!isNumber(newViewportHeight)) return reset()\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tvariant.set({ viewportHeight: newViewportHeight })\n\t\t\t})\n\n\t\t\tsetEditing(false)\n\t\t},\n\t\t[screenId],\n\t)\n\n\tconst attachingRect = getAttachingRectForHandle(screenId, attachToNode, viewportHeight, zoom)\n\tif (!attachingRect) return null\n\tconst { width, height, x, y, maxHeight, viewportHeight: renderedViewportHeight } = attachingRect\n\tconst showViewportPill = width >= 100\n\n\tif (!showViewportPill) return null\n\n\treturn (\n\t\t<div\n\t\t\tclassName={styles.handle}\n\t\t\tstyle={{\n\t\t\t\t...style,\n\t\t\t\ttransform: `translateX(${x + width / 2 - styles.handleWidth / 2}px) translateY(${\n\t\t\t\t\ty + height - styles.handleHeight / 2\n\t\t\t\t}px)`,\n\t\t\t\tbackground: tint,\n\t\t\t\tboxShadow:\n\t\t\t\t\ttint === colors.componentTint\n\t\t\t\t\t\t? colors.buttonWithDepthPrimaryComponentShadow\n\t\t\t\t\t\t: colors.buttonWithDepthPrimaryShadow,\n\t\t\t\tcursor,\n\t\t\t}}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonClick={cancelTimeout}\n\t\t\trole=\"slider\"\n\t\t\taria-valuenow={viewportHeight}\n\t\t\ttabIndex={-1}\n\t\t\tonDoubleClick={stopPropagation}\n\t\t>\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" style={{ minWidth: 16 }}>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 5.203 11 L 8.203 14 L 11.203 11\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\topacity={renderedViewportHeight >= maxHeight ? 0.5 : 1}\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 5.203 5 L 8.203 2 L 11.203 5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\topacity={viewportHeight <= 0 ? 0.5 : 1}\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t\t<div className={styles.handleText} onDoubleClick={onDoubleClick}>\n\t\t\t\t{editing ? (\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvalue={isNumber(viewportHeight) ? viewportHeight.toString() + \"px\" : \"Viewport\"}\n\t\t\t\t\t\tonClick={stopPropagation}\n\t\t\t\t\t\tonDoubleClick={stopPropagation}\n\t\t\t\t\t\tonMouseDown={stopPropagation}\n\t\t\t\t\t\tonChange={onEdit}\n\t\t\t\t\t\tchangeOnBlur\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\tgetHandleText(dragging, viewportHeight)\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction getHandleText(dragging: boolean, viewportHeight: number) {\n\treturn dragging ? `${Math.round(viewportHeight)}px` : \"Viewport\"\n}\n\nfunction getViewportProvidingGroundNode(id: NodeID): (CanvasNode & WithViewport) | null {\n\tconst screen = engine.tree.get(id)\n\tif (!screen || !engine.tree.isGroundNode(screen) || !canNodeProvideViewportRect(screen)) return null\n\n\treturn screen\n}\n\nfunction prepareRect(rect: Rect, zoom: number): Rect {\n\tconst nodeRect = Rect.multiply(rect, zoom)\n\treturn Rect.roundToOutside(nodeRect)\n}\n\nfunction getAttachingRectForHandle(\n\tscreenId: NodeID,\n\tattachToNodeId: NodeID | undefined,\n\tviewportHeight: number,\n\tzoom: number,\n): (Rect & { viewportHeight: number; maxHeight: number }) | undefined {\n\tconst screen = engine.tree.getNode(screenId)\n\tif (!screen) return\n\n\tconst screenCanvasRectWithRotation = convertRectToCanvasWithRotation(engine.tree, screen)\n\tif (!screenCanvasRectWithRotation) return\n\tconst screenRect = prepareRect(screenCanvasRectWithRotation, zoom)\n\n\tconst viewportRectWithRotation = {\n\t\t...screenCanvasRectWithRotation,\n\t\theight: Math.min(screenCanvasRectWithRotation.height, viewportHeight),\n\t}\n\tconst viewportRect = prepareRect(viewportRectWithRotation, zoom)\n\n\tif (attachToNodeId) {\n\t\tconst attachToNode = engine.tree.getNode(attachToNodeId)\n\t\tif (!attachToNode) return\n\t\tconst attachToNodeRect = prepareRect(convertRectToCanvasWithRotation(engine.tree, attachToNode), zoom)\n\t\tif (!attachToNodeRect) return\n\t\treturn {\n\t\t\t...attachToNodeRect,\n\t\t\t// We inset the node rect height by 1px so that selection box lines overlap the viewport line.\n\t\t\theight: attachToNodeRect.height - 1,\n\t\t\tmaxHeight: screenRect.height,\n\t\t\tviewportHeight: viewportRect.height,\n\t\t}\n\t}\n\n\treturn {\n\t\t...viewportRect,\n\t\t// We inset the screen rect height by 1px so that selection box lines overlap the viewport line.\n\t\theight: viewportRect.height - 1,\n\t\tviewportHeight: viewportRect.height,\n\t\tmaxHeight: screenRect.height,\n\t}\n}\n\nfunction createViewportRects(\n\tscreen: CanvasNode,\n\tviewportHeight: number,\n\tzoom: number,\n): { screenRect?: Rect; viewportRect?: Rect } {\n\tconst nodeCanvasRectWithRotation = convertRectToCanvasWithRotation(engine.tree, screen)\n\tif (!nodeCanvasRectWithRotation) return {}\n\n\tconst viewportRectWithRotation = {\n\t\t...nodeCanvasRectWithRotation,\n\t\theight: Math.min(nodeCanvasRectWithRotation.height, viewportHeight),\n\t}\n\n\tconst viewportRect = prepareRect(viewportRectWithRotation, zoom)\n\n\treturn {\n\t\tscreenRect: prepareRect(nodeCanvasRectWithRotation, zoom),\n\t\tviewportRect: { ...viewportRect, height: viewportRect.height - 1 },\n\t}\n}\n", "import { useCallback, useEffect, useRef } from \"react\"\n\nexport const useTimeout = () => {\n\tconst timeoutRef = useRef<number | undefined>(undefined)\n\n\tconst startTimeout = useCallback((callback: (...args: unknown[]) => unknown, timeout: number) => {\n\t\ttimeoutRef.current = window.setTimeout(callback, timeout)\n\t}, [])\n\n\tconst cancelTimeout = useCallback(() => {\n\t\twindow.clearTimeout(timeoutRef.current)\n\t}, [])\n\n\t// clean up any trailing timeout on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tcancelTimeout()\n\t\t}\n\t}, [cancelTimeout])\n\n\treturn { startTimeout, cancelTimeout }\n}\n", "import \"ViewportHighlight.styles_o9tiq4.wyw.css\"; export const container = \"container_cdzlior\";\nexport const handleWidth = 94;\nexport const handleHeight = 30;\nexport const handle = \"handle_h1daohbd\";\nexport const handleText = \"handleText_hm6p9mf\";", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport type { Writeable } from \"@framerjs/shared\"\nimport { List, getLogger } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, FrameNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { Mask, WithMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { getDuplicatedMask, maskAddedImageDefaults, withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { MasksByNodeId, ReducedMask, ReducedMasks } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { getNodeMaskForMaskId } from \"document/models/Gradient.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { createAssetReferenceForUploadImageResult } from \"document/utils/createAssetReferenceFromImageUpload.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { containsMixedValue } from \"utils/containsMixedValue.ts\"\nimport { isArray, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { DarkModeContext } from \"web/components/DarkModeProvider.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport type { ImageUploadResult } from \"web/pages/project/lib/UploadService.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { addMaskForNodes } from \"../panels/utils/addMaskForNodes.ts\"\nimport { useCopyPasteArrayProperty } from \"../panels/utils/useCopyPasteArrayProperty.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport type { TilingBackgroundPatternPresetName } from \"./FillImagePatternPresetsRow/presetOptions.ts\"\nimport { MaskPopoutButton } from \"./MaskPopout.tsx\"\nimport * as classes from \"./MaskRow.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props extends Omit<ReducedMasks, \"onlyNodesWithMask\"> {\n\tnodeIds: NodeID[]\n}\n\nconst log = getLogger(\"failed-mask-image-upload\")\n\nconst maskTraitTypes = [TraitType.Mask]\n\nexport const MasksRow = React.memo(function MasksRow({ nodeIds, masks }: Props) {\n\tconst darkMode = useDarkMode()\n\tconst isReadOnly = useReadOnly()\n\tconst selectedGradientStopId = engine.stores.selectionStore.useState(state => state.gradientStopId)\n\tconst canCopyMasks = useCallback(() => {\n\t\tif (!isClipboardSupported()) return false\n\t\tif (!isArray(masks) || masks.length === 0) return false\n\t\treturn !containsMixedValue(masks)\n\t}, [masks])\n\n\tconst canCopySingleMask = useCallback(\n\t\t(index: number) => {\n\t\t\tif (!isClipboardSupported()) return false\n\t\t\tif (!isArray(masks) || masks.length === 0) return false\n\t\t\tconst mask = masks[index]\n\t\t\tif (!mask) return false\n\t\t\treturn !containsMixedValue(mask)\n\t\t},\n\t\t[masks],\n\t)\n\n\tconst [canPasteMasks, pasteAllMasks, pasteMask, copyAllMasks, copyMask, clipboardItemsLength] =\n\t\tuseCopyPasteArrayProperty(TraitType.Mask, nodeIds, canCopyMasks, canCopySingleMask)\n\n\tconst removeAllMasks = useEngineCallback((): void => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withMasks)) {\n\t\t\tnode.set({ masks: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst removeMask = engine.scheduler.wrapHandler((index: number) => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withMasks)) {\n\t\t\tif (!node.masks) return\n\t\t\tnode.set({ masks: List.remove(node.masks, index) })\n\t\t}\n\t})\n\n\tconst moveMask = engine.scheduler.wrapHandler((from: number, to: number) => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withMasks)) {\n\t\t\tif (!node.masks) return\n\t\t\tnode.set({ masks: List.move(node.masks, from, to) })\n\t\t}\n\t})\n\n\tconst addMask = engine.scheduler.wrapHandler(() => {\n\t\taddMaskForNodes(engine.tree, nodeIds, masks)\n\t})\n\n\tconst handleUploadedImages = engine.scheduler.wrapHandler(uploadedImages)\n\n\tconst onChangeImages = React.useCallback(\n\t\tasync (maskIds: Record<NodeID, NodeID>, imageUpload: Promise<ImageUploadResult[]>) => {\n\t\t\t// We determine the nodes to be updates already at the point of starting\n\t\t\t// the image upload; if we'd do it later (when the image is uploaded) the selection\n\t\t\t// may have changed, and we would update the wrong nodes.\n\t\t\ttry {\n\t\t\t\tconst images = await imageUpload\n\t\t\t\tif (images.length === 0) return\n\t\t\t\tconst latestNodes = engine.tree.getNodesWithTrait(nodeIds, withMasks)\n\t\t\t\tif (latestNodes.length === 0) return\n\t\t\t\thandleUploadedImages(maskIds, latestNodes, images)\n\t\t\t} catch (reason) {\n\t\t\t\ttoast({\n\t\t\t\t\tkey: `unsuccessful-mask-image-upload`,\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\ttext: `Could not upload the image.`,\n\t\t\t\t\ticon: \"error\",\n\t\t\t\t\tduration: 5000,\n\t\t\t\t})\n\t\t\t\tlog.reportError(reason)\n\t\t\t}\n\t\t},\n\t\t[handleUploadedImages, nodeIds],\n\t)\n\n\tconst updateValues = useEngineCallback(\n\t\t(maskIds: Record<NodeID, NodeID>, getValue: (mask: Mask) => Partial<Mask> | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withMasks)) {\n\t\t\t\tif (!node.masks) continue\n\t\t\t\tconst maskId = maskIds[node.id]\n\t\t\t\tif (!maskId) continue\n\t\t\t\tconst mask = getNodeMaskForMaskId(node, maskId)\n\n\t\t\t\tif (!mask) continue\n\n\t\t\t\tconst newValue = getValue(mask.value)\n\n\t\t\t\tif (isUndefined(newValue)) continue\n\t\t\t\tnode.set({\n\t\t\t\t\tmasks: List.replace(node.masks, mask.index, getUpdatedMask(mask.value, newValue)),\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst getPasteTitle = useCallback(async () => {\n\t\tconst length = await clipboardItemsLength()\n\t\treturn length > 1 ? \"Paste All\" : \"Paste\"\n\t}, [clipboardItemsLength])\n\n\tconst displayContextMenuForItem = async (event: React.MouseEvent, index: number) => {\n\t\t// Prevent native context menu from showing up\n\t\tevent.preventDefault()\n\n\t\t// Prevent row context menu from showing up\n\t\tevent.stopPropagation()\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Copy\",\n\t\t\t\t\tclick: () => copyMask(index),\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: await getPasteTitle(),\n\t\t\t\t\tclick: async () => pasteMask(index),\n\t\t\t\t\tenabled: !isReadOnly && (await canPasteMasks()),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Duplicate\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withMasks)) {\n\t\t\t\t\t\t\tif (!node.masks) continue\n\t\t\t\t\t\t\tconst mask = node.masks[index]\n\t\t\t\t\t\t\tif (!mask) continue\n\n\t\t\t\t\t\t\tconst duplicatedMask = getDuplicatedMask(mask)\n\t\t\t\t\t\t\tconst newMasks = List.insert(node.masks, index, duplicatedMask)\n\t\t\t\t\t\t\tnode.set({ masks: newMasks })\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Remove\",\n\t\t\t\t\tclick: () => removeMask(index),\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\tconst hideMaskRow = isUndefined(masks) || isNotFound(masks)\n\tif (hideMaskRow) return null\n\n\tconst masksCount = isArray(masks) ? masks.length : 0\n\tconst canSort = masksCount > 1\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Mask\"\n\t\t\tonDelete={removeAllMasks}\n\t\t\tonAdd={addMask}\n\t\t\ttraitTypes={maskTraitTypes}\n\t\t\tcopyEnabled={canCopyMasks}\n\t\t\tonCopy={copyAllMasks}\n\t\t\tdeleteTitle={masksCount > 1 ? \"Remove All\" : \"Remove\"}\n\t\t\tcopyTitle={masksCount > 1 ? \"Copy All\" : \"Copy\"}\n\t\t\tpasteTitle={getPasteTitle}\n\t\t\tpasteEnabled={canPasteMasks}\n\t\t\tonPaste={pasteAllMasks}\n\t\t>\n\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t{masksCount > 0 && (\n\t\t\t\t\t<Sortable\n\t\t\t\t\t\tenabled={canSort}\n\t\t\t\t\t\tclassName={classes.sortable}\n\t\t\t\t\t\titems={isArray(masks) ? masks : []}\n\t\t\t\t\t\tmoveItem={moveMask}\n\t\t\t\t\t\tkeyForItem={getMaskId}\n\t\t\t\t\t\tremoveItem={removeMask}\n\t\t\t\t\t\tonDragStart={popoutWindow.close}\n\t\t\t\t\t>\n\t\t\t\t\t\t{({ item: mask, index }) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<DarkModeContext.Provider value={darkMode}>\n\t\t\t\t\t\t\t\t\t<MaskPopoutButton\n\t\t\t\t\t\t\t\t\t\tkey={getMaskId(mask)}\n\t\t\t\t\t\t\t\t\t\tmaskIds={mask.maskIds}\n\t\t\t\t\t\t\t\t\t\tisLastMask={index === masksCount - 1}\n\t\t\t\t\t\t\t\t\t\tmaskCount={masksCount}\n\t\t\t\t\t\t\t\t\t\tmaskType={mask.maskType}\n\t\t\t\t\t\t\t\t\t\tmaskValue={mask.maskValue}\n\t\t\t\t\t\t\t\t\t\tmaskMode={mask.maskMode}\n\t\t\t\t\t\t\t\t\t\tmaskRepeat={mask.maskRepeat}\n\t\t\t\t\t\t\t\t\t\tmaskPosition={mask.maskPosition}\n\t\t\t\t\t\t\t\t\t\tmaskComposite={mask.maskComposite}\n\t\t\t\t\t\t\t\t\t\tselectedGradientStopId={selectedGradientStopId}\n\t\t\t\t\t\t\t\t\t\tupdateValues={updateValues}\n\t\t\t\t\t\t\t\t\t\tonDelete={() => removeMask(index)}\n\t\t\t\t\t\t\t\t\t\tonContextMenuForItem={event => displayContextMenuForItem(event, index)}\n\t\t\t\t\t\t\t\t\t\tonChangeImages={onChangeImages}\n\t\t\t\t\t\t\t\t\t\timageReferences={mask.maskImages}\n\t\t\t\t\t\t\t\t\t\tmaskImageResize={mask.maskImageResize}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</DarkModeContext.Provider>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}}\n\t\t\t\t\t</Sortable>\n\t\t\t\t)}\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"mask\" onClick={addMask} />\n\t\t\t</Stack>\n\t\t</PanelRow>\n\t)\n})\n\nfunction getUpdatedMask(mask: Mask, values: Writeable<Partial<Mask>>): Mask {\n\treturn {\n\t\t...mask,\n\t\t...values,\n\t}\n}\n\nfunction uploadedImages(\n\tmaskIds: MasksByNodeId,\n\tlatestNodes: (CanvasNode & WithMasks)[],\n\timages: ImageUploadResult[],\n\tpresetName?: TilingBackgroundPatternPresetName,\n) {\n\tlatestNodes.forEach((node, index) => {\n\t\tif (!node.masks) return\n\t\tconst maskId = maskIds[node.id]\n\t\tif (!maskId) return\n\t\tconst mask = getNodeMaskForMaskId(node, maskId)\n\t\tif (!mask) return\n\n\t\tconst imageInfo = images[index % images.length]\n\t\tif (!imageInfo) return\n\t\tconst { imageSize, asset } = imageInfo\n\n\t\tconst currentSize = isString(mask.value.maskImage)\n\t\t\t? parseAssetReference(mask.value.maskImage)?.preferredSize\n\t\t\t: undefined\n\n\t\tconst assetReference = createAssetReferenceForUploadImageResult(imageInfo, currentSize, presetName)\n\n\t\tconst update: Partial<Mask> = {\n\t\t\tmaskType: \"image\",\n\t\t\tmaskImage: assetReference,\n\t\t\t...maskAddedImageDefaults,\n\t\t\tmaskMode: asset.mimeType.startsWith(\"image/svg\") ? \"alpha\" : \"luminance\",\n\t\t}\n\n\t\t// when there is an exisiting mask image, we want to keep the image settings\n\t\tif (isString(mask.value.maskImage)) {\n\t\t\tupdate.maskImageResize = mask.value.maskImageResize\n\t\t\tupdate.maskRepeat = mask.value.maskRepeat\n\t\t\tupdate.maskPosition = mask.value.maskPosition\n\t\t\tupdate.maskMode = mask.value.maskMode\n\t\t\tupdate.maskComposite = mask.value.maskComposite\n\t\t}\n\n\t\tconst nodeUpdate: Partial<FrameNode & WithMasks> = {\n\t\t\t// No imageSizeToNonZero because guessing here isn't helpful\n\t\t\tintrinsicHeight: imageSize.naturalHeight,\n\t\t\tintrinsicWidth: imageSize.naturalWidth,\n\t\t\tmasks: List.replace(node.masks, mask.index, getUpdatedMask(mask.value, update)),\n\t\t}\n\n\t\tnode.set(nodeUpdate)\n\t})\n}\n\n/**\n * Generate a unique key based on the selection of nodes and active masks.\n */\nexport function uniqueMaskId(maskIds: Record<NodeID, NodeID> | null): string {\n\tlet maskKey = \"\"\n\tfor (const key in maskIds) {\n\t\tmaskKey += `${key}${maskIds[key]}`\n\t}\n\treturn maskKey\n}\n\nfunction getMaskId(value: ReducedMask): string {\n\treturn uniqueMaskId(value.maskIds)\n}\n", "import type { AssetSize } from \"@framerjs/assets\"\nimport { updateAssetReferencePreferredSize } from \"@framerjs/assets\"\nimport { NumberInputWithTicker, NumberInputWithTickerAndStepper, Slider, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tMask,\n\tMaskComposite,\n\tMaskMode,\n\tMaskPosition,\n\tMaskRepeat,\n\tMaskSize,\n\tMaskType,\n\tMaskValueTypeForMaskType,\n} from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { MASK_POPOUT_ID, convertMaskGradientToTheme } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFoundAndNotMixed } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { MasksByNodeId, ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport { isGradient } from \"document/models/Gradient.ts\"\nimport type { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { isLinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport React, { useCallback } from \"react\"\nimport { isNull, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { batchUploadImages } from \"web/lib/batchUploaderUtils.tsx\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport type { ImageUploadResult } from \"web/pages/project/lib/UploadService.ts\"\nimport { ButtonWithPreview } from \"../../shared/ButtonWithPreview.tsx\"\nimport type { ColorPickerTab } from \"../../shared/ColorPicker/ColorPickerFillTypeTabs.tsx\"\nimport {\n\tColorPickerFillTypeTabs,\n\tcolorPickerFillTypeTabsWithoutSolid,\n} from \"../../shared/ColorPicker/ColorPickerFillTypeTabs.tsx\"\nimport { useBackgroundCSSString } from \"../../shared/ColorPicker/FillPopoutButton.tsx\"\nimport { GradientStopsSlider } from \"../../shared/ColorPicker/GradientStopsSlider.tsx\"\nimport { decimalToRoundedAndClampedPercentage } from \"../../shared/ColorPicker/utils.ts\"\nimport { ImagePicker, reduceImageReferences } from \"../../shared/ImagePicker.tsx\"\nimport { PopoutButtonBackgroundPreview } from \"../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { MaskCompositeRow } from \"./MaskCompositeRow.tsx\"\nimport { MaskImageResizeRow } from \"./MaskImageResizeRow.tsx\"\nimport { MaskModeRow } from \"./MaskModeRow.tsx\"\nimport * as styles from \"./MaskPopout.styles.ts\"\nimport { MaskPositionRow } from \"./MaskPositionRow.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nexport function getMaskPopoutId(id: NodeID): string {\n\treturn `${MASK_POPOUT_ID}-${id}`\n}\n\ninterface Props extends Omit<ReducedMask, \"maskImages\"> {\n\tisLastMask: boolean\n\tmaskCount: number\n\tmaskType: Reduced<MaskType>\n\timageReferences: Set<string>\n\tselectedGradientStopId: string | undefined\n\tupdateValues: (maskIds: MasksByNodeId, getValue: (mask: Mask) => Partial<Mask> | undefined) => void\n\tonChangeImages: (maskIds: MasksByNodeId, imageUpload: Promise<ImageUploadResult[]>) => void\n\tonContextMenuForItem: (event: React.MouseEvent<Element, MouseEvent>) => void\n\tonDelete: (() => void) | undefined\n}\n\nfunction getFirstId(ids: MasksByNodeId): NodeID | undefined {\n\tfor (const id in ids) {\n\t\treturn ids[id]\n\t}\n\n\treturn undefined\n}\n\nexport const MaskPopoutButton = React.memo(\n\t({\n\t\tmaskIds,\n\t\tmaskCount,\n\t\tisLastMask,\n\t\tmaskType,\n\t\tmaskValue,\n\t\tmaskMode,\n\t\tmaskRepeat,\n\t\tmaskPosition,\n\t\tmaskComposite,\n\t\timageReferences,\n\t\tselectedGradientStopId,\n\t\tmaskImageResize,\n\t\tupdateValues,\n\t\tonChangeImages,\n\t\tonContextMenuForItem,\n\t\tonDelete,\n\t}: Props) => {\n\t\tconst popoutCanBeOpened = maskType && isFoundAndNotMixed(maskType) && isFoundAndNotMixed(maskValue)\n\t\tconst title = getTitle(maskType, maskValue)\n\t\tconst firstMaskId = getFirstId(maskIds)\n\n\t\tconst onDismiss = React.useCallback(() => {\n\t\t\tif (engine.stores.toolStore.tool !== Tools.MaskGradient) return\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tenableGradientTool(engine, maskIds, false)\n\t\t\t})\n\t\t}, [maskIds])\n\n\t\treturn popoutCanBeOpened && firstMaskId ? (\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={getMaskPopoutId(firstMaskId)}\n\t\t\t\tpopout={\n\t\t\t\t\t<MaskPopout\n\t\t\t\t\t\tmaskIds={maskIds}\n\t\t\t\t\t\tmaskType={maskType}\n\t\t\t\t\t\tmaskValue={maskValue}\n\t\t\t\t\t\tmaskCount={maskCount}\n\t\t\t\t\t\tisLastMask={isLastMask}\n\t\t\t\t\t\tmaskMode={maskMode}\n\t\t\t\t\t\tmaskRepeat={maskRepeat}\n\t\t\t\t\t\tmaskPosition={maskPosition}\n\t\t\t\t\t\tmaskComposite={maskComposite}\n\t\t\t\t\t\timageReferences={imageReferences}\n\t\t\t\t\t\tselectedGradientStopId={selectedGradientStopId}\n\t\t\t\t\t\tupdateValues={updateValues}\n\t\t\t\t\t\tonChangeImages={onChangeImages}\n\t\t\t\t\t\tmaskImageResize={maskImageResize}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tnavigationTitle={Dictionary.Mask}\n\t\t\t\ttitle={title}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t\tonContextMenu={onContextMenuForItem}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonMaskPreview maskType={maskType} maskValue={maskValue} imageReferences={imageReferences} />\n\t\t\t\t}\n\t\t\t/>\n\t\t) : (\n\t\t\t<Stack className={styles.disabledPreviewButton}>\n\t\t\t\t<ButtonWithPreview\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonMaskPreview maskType={maskType} maskValue={maskValue} imageReferences={imageReferences} />\n\t\t\t\t\t}\n\t\t\t\t\tenabled={false}\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\tdoubleColumn\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t)\n\t},\n)\n\ntype MaskPickerTab = Exclude<ColorPickerTab, \"solid\">\n\ninterface MaskPopoutProps extends Omit<Props, \"onDelete\" | \"onContextMenuForItem\"> {\n\tmaskType: MaskType\n}\n\nfunction enableGradientTool(vekterEngine: VekterEngine, maskIds: MasksByNodeId, enabled = true) {\n\tenabled ? vekterEngine.setTool(Tools.MaskGradient, maskIds) : vekterEngine.exitTool()\n}\n\nconst MaskPopout = React.memo(\n\t({\n\t\tmaskIds,\n\t\tmaskCount,\n\t\tisLastMask,\n\t\tmaskType,\n\t\tmaskValue,\n\t\tmaskMode,\n\t\tmaskRepeat,\n\t\tmaskPosition,\n\t\tmaskComposite,\n\t\tselectedGradientStopId,\n\t\timageReferences,\n\t\tmaskImageResize,\n\t\tupdateValues,\n\t\tonChangeImages,\n\t}: MaskPopoutProps) => {\n\t\tconst { isDarkMode } = useDarkMode()\n\t\tconst currentTab = getCurrentTab(maskType)\n\t\tconst rotation = getRotation(maskType, maskValue)\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tif (engine.stores.toolStore.tool === Tools.MaskGradient) return\n\t\t\tenableGradientTool(engine, maskIds)\n\t\t})\n\n\t\tconst alpha = React.useMemo(() => {\n\t\t\tif (isGradient(maskValue)) {\n\t\t\t\tconst gradientStop = maskValue.stops.find(stop => stop.id === selectedGradientStopId)\n\t\t\t\tif (!gradientStop) return undefined\n\t\t\t\tconst gradientStopAlpha = ConvertColor.getAlpha(gradientStop.value)\n\t\t\t\treturn decimalToRoundedAndClampedPercentage(gradientStopAlpha)\n\t\t\t}\n\t\t\treturn undefined\n\t\t}, [selectedGradientStopId, maskValue])\n\n\t\tconst isGifImage = React.useMemo(\n\t\t\t() => reduceImageReferences(Array.from(imageReferences)).fileExtensions.has(\"gif\"),\n\t\t\t[imageReferences],\n\t\t)\n\n\t\tconst isPngWithLuminance = React.useMemo(() => {\n\t\t\tconst isPNG = reduceImageReferences(Array.from(imageReferences)).fileExtensions.has(\"png\")\n\t\t\tconst maskModeIsLuminance = maskMode.has(\"luminance\")\n\t\t\treturn isPNG && maskModeIsLuminance\n\t\t}, [imageReferences, maskMode])\n\n\t\tconst onRemoveImageMask = useEngineCallback(() => {\n\t\t\tupdateValues(maskIds, () => ({ maskImage: null }))\n\t\t}, [updateValues, maskIds])\n\n\t\tconst onChangeAlpha = useEngineCallback(\n\t\t\t(value: number) => {\n\t\t\t\tupdateValues(maskIds, mask => {\n\t\t\t\t\tconst properties: Partial<Mask> = {}\n\t\t\t\t\t// the new gradient stops are obtained from the linear gradient because\n\t\t\t\t\t// all gradient types have the same stops and are always in sync.\n\n\t\t\t\t\tconst gradientStop = mask.maskLinearGradient?.stops.find(stop => stop.id === selectedGradientStopId)\n\t\t\t\t\tif (!gradientStop) return properties\n\t\t\t\t\tconst updatedStops =\n\t\t\t\t\t\tmask.maskLinearGradient?.stops.map(stop => {\n\t\t\t\t\t\t\tif (stop.id !== selectedGradientStopId) return stop\n\t\t\t\t\t\t\tconst updatedStopValue = ConvertColor.setAlpha(stop.value, value / 100)\n\t\t\t\t\t\t\treturn stop.merge({ value: updatedStopValue })\n\t\t\t\t\t\t}) ?? []\n\n\t\t\t\t\tproperties.maskLinearGradient = mask.maskLinearGradient?.updated({ stops: updatedStops })\n\t\t\t\t\tproperties.maskConicGradient = mask.maskConicGradient?.updated({ stops: updatedStops })\n\t\t\t\t\tproperties.maskRadialGradient = mask.maskRadialGradient?.updated({ stops: updatedStops })\n\t\t\t\t\treturn properties\n\t\t\t\t})\n\t\t\t},\n\t\t\t[selectedGradientStopId, updateValues, maskIds],\n\t\t)\n\n\t\tconst onChangeRotation = useEngineCallback(\n\t\t\t(value: number) => {\n\t\t\t\tupdateValues(maskIds, mask => ({\n\t\t\t\t\tmaskLinearGradient: mask.maskLinearGradient?.updated({ angle: value }),\n\t\t\t\t\tmaskConicGradient: mask.maskConicGradient?.updated({ angle: value }),\n\t\t\t\t}))\n\t\t\t},\n\t\t\t[updateValues, maskIds],\n\t\t)\n\n\t\tconst onChangeTab = React.useCallback(\n\t\t\t(tab: MaskPickerTab) => {\n\t\t\t\tif (currentTab === tab) return\n\t\t\t\tswitch (tab) {\n\t\t\t\t\tcase \"linear\":\n\t\t\t\t\t\tupdateValues(maskIds, () => ({ maskType: \"linear-gradient\" }))\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"radial\":\n\t\t\t\t\t\tupdateValues(maskIds, () => ({ maskType: \"radial-gradient\" }))\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"conic\":\n\t\t\t\t\t\tupdateValues(maskIds, () => ({ maskType: \"conic-gradient\" }))\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"image\":\n\t\t\t\t\t\tupdateValues(maskIds, () => ({ maskType: \"image\" }))\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(tab)\n\t\t\t\t}\n\t\t\t},\n\t\t\t[updateValues, currentTab, maskIds],\n\t\t)\n\n\t\tconst onChangeImageResize = useEngineCallback(\n\t\t\t(size: MaskSize, repeat: MaskRepeat) => {\n\t\t\t\tupdateValues(maskIds, () => ({ maskImageResize: size, maskRepeat: repeat }))\n\t\t\t},\n\t\t\t[updateValues, maskIds],\n\t\t)\n\n\t\tconst onChangeMaskMode = useEngineCallback(\n\t\t\t(mode: MaskMode) => {\n\t\t\t\tupdateValues(maskIds, () => ({ maskMode: mode }))\n\t\t\t},\n\t\t\t[maskIds, updateValues],\n\t\t)\n\n\t\tconst onChangeMaskImageAssetSize = useEngineCallback(\n\t\t\t(size: AssetSize) => {\n\t\t\t\tupdateValues(maskIds, mask => {\n\t\t\t\t\tif (!isString(mask.maskImage)) return\n\t\t\t\t\tconst maskImage = updateAssetReferencePreferredSize(mask.maskImage, size)\n\t\t\t\t\treturn { maskImage }\n\t\t\t\t})\n\t\t\t},\n\t\t\t[maskIds, updateValues],\n\t\t)\n\n\t\tconst onChangeColorStops = useEngineCallback(\n\t\t\t(stops: readonly GradientColorStop[]) => {\n\t\t\t\tupdateValues(maskIds, mask => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmaskLinearGradient: mask.maskLinearGradient?.updated({ stops }),\n\t\t\t\t\t\tmaskConicGradient: mask.maskConicGradient?.updated({ stops }),\n\t\t\t\t\t\tmaskRadialGradient: mask.maskRadialGradient?.updated({ stops }),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t[maskIds, updateValues],\n\t\t)\n\n\t\tconst onChangeMaskPosition = useEngineCallback(\n\t\t\t(position: MaskPosition) => {\n\t\t\t\tupdateValues(maskIds, () => ({ maskPosition: position }))\n\t\t\t},\n\t\t\t[maskIds, updateValues],\n\t\t)\n\n\t\tconst onChangeImagesForMask = useEngineCallback(\n\t\t\t(images: Promise<ImageUploadResult[]>) => {\n\t\t\t\tonChangeImages(maskIds, images)\n\t\t\t},\n\t\t\t[onChangeImages, maskIds],\n\t\t)\n\n\t\tconst onChangeMaskComposite = useEngineCallback(\n\t\t\t(composite: MaskComposite) => {\n\t\t\t\tupdateValues(maskIds, () => ({ maskComposite: composite }))\n\t\t\t},\n\t\t\t[maskIds, updateValues],\n\t\t)\n\n\t\tconst onImageBatchUpload = useCallback(\n\t\t\t(files: FileList | File[], maxUploads?: number) => batchUploadImages(engine, files, maxUploads),\n\t\t\t[],\n\t\t)\n\t\tconst onCropClick = useCallback(\n\t\t\t(image: string) => {\n\t\t\t\tengine.stores.modalStore.push({\n\t\t\t\t\ttype: ModalType.ImageCrop,\n\t\t\t\t\tinitialImage: image,\n\t\t\t\t\tonChange: onChangeImagesForMask,\n\t\t\t\t\tsource: \"image_picker\",\n\t\t\t\t})\n\t\t\t},\n\t\t\t[onChangeImagesForMask],\n\t\t)\n\n\t\treturn (\n\t\t\t<Stack gap={0} className={styles.container}>\n\t\t\t\t{currentTab && (\n\t\t\t\t\t<ColorPickerFillTypeTabs\n\t\t\t\t\t\ttabsToShow={colorPickerFillTypeTabsWithoutSolid}\n\t\t\t\t\t\tcurrentTab={currentTab}\n\t\t\t\t\t\tonChangeTab={onChangeTab}\n\t\t\t\t\t\tdisplaySeparator\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{isGradient(maskValue) && (\n\t\t\t\t\t<div className={styles.sectionWithDivider}>\n\t\t\t\t\t\t<div className={styles.gradientStopsSliderContainer}>\n\t\t\t\t\t\t\t<GradientStopsSlider\n\t\t\t\t\t\t\t\tgradient={maskValue}\n\t\t\t\t\t\t\t\tonChangeColorStops={(stops: readonly GradientColorStop[]) => onChangeColorStops(stops)}\n\t\t\t\t\t\t\t\tfillGradientCSS={maskValue.toCSS(90)}\n\t\t\t\t\t\t\t\tisDarkMode={isDarkMode}\n\t\t\t\t\t\t\t\tgradientToolType={Tools.MaskGradient}\n\t\t\t\t\t\t\t\twithDivider={false}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<Stack gap={0} paddingTop={dimensions.css.panelPadding}>\n\t\t\t\t\t{isNumber(alpha) ? (\n\t\t\t\t\t\t<PanelRow title=\"Alpha\">\n\t\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\t\tmax={100}\n\t\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t\t\tvalue={alpha}\n\t\t\t\t\t\t\t\tonChange={onChangeAlpha}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t) : null}\n\n\t\t\t\t\t{isNumber(rotation) ? (\n\t\t\t\t\t\t<PanelRow title=\"Rotation\">\n\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\tunit=\"\u00B0\"\n\t\t\t\t\t\t\t\tmin={-360}\n\t\t\t\t\t\t\t\tmax={360}\n\t\t\t\t\t\t\t\tvalue={rotation}\n\t\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t\t\tonChange={onChangeRotation}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Slider value={rotation} min={0} max={360} onChange={onChangeRotation} />\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t) : null}\n\n\t\t\t\t\t{maskCount > 1 && maskType !== \"image\" && (\n\t\t\t\t\t\t<MaskCompositeRow\n\t\t\t\t\t\t\tenabled={!isLastMask}\n\t\t\t\t\t\t\tmaskComposite={maskComposite}\n\t\t\t\t\t\t\tonChangeMaskComposite={onChangeMaskComposite}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\n\t\t\t\t{maskType === \"image\" && (\n\t\t\t\t\t<ImagePicker\n\t\t\t\t\t\timageReferences={Array.from(imageReferences)}\n\t\t\t\t\t\tonChangeImages={onChangeImagesForMask}\n\t\t\t\t\t\tonRemoveImage={imageReferences.size > 0 ? onRemoveImageMask : undefined}\n\t\t\t\t\t\tonChangeAssetSize={onChangeMaskImageAssetSize}\n\t\t\t\t\t\tenableFooter={false}\n\t\t\t\t\t\tonImageBatchUpload={onImageBatchUpload}\n\t\t\t\t\t\tonCropClick={onCropClick}\n\t\t\t\t\t\textraControls={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{!isUndefined(maskImageResize) && (\n\t\t\t\t\t\t\t\t\t<MaskImageResizeRow\n\t\t\t\t\t\t\t\t\t\tenabled={!isNull(maskValue)}\n\t\t\t\t\t\t\t\t\t\tmaskImageResize={maskImageResize}\n\t\t\t\t\t\t\t\t\t\tmaskRepeat={maskRepeat}\n\t\t\t\t\t\t\t\t\t\tonChangeImageResize={onChangeImageResize}\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\t{!isUndefined(maskMode) && (\n\t\t\t\t\t\t\t\t\t<MaskModeRow enabled={!isNull(maskValue)} maskMode={maskMode} onChangeMaskMode={onChangeMaskMode} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{!isUndefined(maskPosition) && (\n\t\t\t\t\t\t\t\t\t<MaskPositionRow\n\t\t\t\t\t\t\t\t\t\tenabled={!isNull(maskValue)}\n\t\t\t\t\t\t\t\t\t\tmaskPosition={maskPosition}\n\t\t\t\t\t\t\t\t\t\tonChangeMaskPosition={onChangeMaskPosition}\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\t{maskCount > 1 && (\n\t\t\t\t\t\t\t\t\t<MaskCompositeRow\n\t\t\t\t\t\t\t\t\t\tenabled={!isLastMask}\n\t\t\t\t\t\t\t\t\t\tmaskComposite={maskComposite}\n\t\t\t\t\t\t\t\t\t\tonChangeMaskComposite={onChangeMaskComposite}\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\t{isGifImage && (\n\t\t\t\t\t\t\t\t\t<DescriptionRow description=\"Animated GIF masks don\u2019t work in Safari.\" withMargin={false} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{isPngWithLuminance && (\n\t\t\t\t\t\t\t\t\t<DescriptionRow description=\"Images with Luminance may not work in Safari.\" withMargin={false} />\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</Stack>\n\t\t)\n\t},\n)\n\nconst PopoutButtonMaskPreview = React.memo(\n\t({ maskType, maskValue, imageReferences }: Pick<Props, \"maskType\" | \"maskValue\" | \"imageReferences\">) => {\n\t\tconst { isDarkMode } = useDarkMode()\n\t\tconst currentType = isFoundAndNotMixed(maskType) ? maskType : undefined\n\n\t\tconst background = useBackgroundCSSString(\n\t\t\tisGradient(maskValue) ? convertMaskGradientToTheme(maskValue, isDarkMode) : \"\",\n\t\t\t{ currentType: currentType, imageReferences: isFoundAndNotMixed(maskValue) ? imageReferences : undefined },\n\t\t)\n\n\t\treturn (\n\t\t\t<PopoutButtonBackgroundPreview\n\t\t\t\tbackground={background}\n\t\t\t\tdefaultBackgroundColor=\"transparent\"\n\t\t\t\tbackgroundPositionX={undefined}\n\t\t\t\tbackgroundPositionY={undefined}\n\t\t\t/>\n\t\t)\n\t},\n)\n\nfunction getRotation(maskType: MaskType, maskValue: Reduced<MaskValueTypeForMaskType>): number | undefined {\n\tif (maskType !== \"linear-gradient\" && maskType !== \"conic-gradient\") return undefined\n\tif (isLinearGradient(maskValue) || isConicGradient(maskValue)) return maskValue.angle\n\tif (isMixed(maskValue)) return 0\n\treturn undefined\n}\n\nfunction getCurrentTab(maskType: MaskType | undefined): ColorPickerTab | null {\n\tif (!maskType) return null\n\n\tswitch (maskType) {\n\t\tcase \"linear-gradient\":\n\t\t\treturn \"linear\"\n\t\tcase \"radial-gradient\":\n\t\t\treturn \"radial\"\n\t\tcase \"conic-gradient\":\n\t\t\treturn \"conic\"\n\t\tcase \"image\":\n\t\t\treturn \"image\"\n\t\tdefault:\n\t\t\tassertNever(maskType)\n\t}\n}\n\nfunction getTitle(maskType: Reduced<MaskType | undefined>, maskValue: Reduced<MaskValueTypeForMaskType>) {\n\tif (isMixed(maskType) || isMixed(maskValue)) return Dictionary.Mixed\n\tif (maskType && isUndefined(maskValue)) return Dictionary.AddEllipsis\n\n\tswitch (maskType) {\n\t\tcase \"linear-gradient\":\n\t\t\treturn Dictionary.Linear\n\t\tcase \"radial-gradient\":\n\t\t\treturn Dictionary.Radial\n\t\tcase \"conic-gradient\":\n\t\t\treturn Dictionary.Conic\n\t\tcase \"image\":\n\t\t\treturn Dictionary.Image\n\t\tdefault:\n\t\t\tassert(maskType, \"Invalid mask type\")\n\t}\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { MaskComposite } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { memo } from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface MaskCompositeRowProps extends Pick<ReducedMask, \"maskComposite\"> {\n\tonChangeMaskComposite: (composite: MaskComposite) => void\n\tenabled?: boolean\n}\n\nexport const MaskCompositeRow = memo(\n\t({ maskComposite, enabled = true, onChangeMaskComposite }: MaskCompositeRowProps) => {\n\t\treturn (\n\t\t\t<PanelRow title=\"Composite\">\n\t\t\t\t<SegmentedControl style={doubleColumn} enabled={enabled}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"add\"\n\t\t\t\t\t\ttitle=\"Add\"\n\t\t\t\t\t\tselected={maskComposite.has(\"add\")}\n\t\t\t\t\t\tonSelect={onChangeMaskComposite}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaskCompositeIcon maskComposite=\"add\" />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"subtract\"\n\t\t\t\t\t\ttitle=\"Subtract\"\n\t\t\t\t\t\tselected={maskComposite.has(\"subtract\")}\n\t\t\t\t\t\tonSelect={onChangeMaskComposite}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaskCompositeIcon maskComposite=\"subtract\" />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"intersect\"\n\t\t\t\t\t\ttitle=\"Intersect\"\n\t\t\t\t\t\tselected={maskComposite.has(\"intersect\")}\n\t\t\t\t\t\tonSelect={onChangeMaskComposite}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaskCompositeIcon maskComposite=\"intersect\" />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"exclude\"\n\t\t\t\t\t\ttitle=\"Exclude\"\n\t\t\t\t\t\tselected={maskComposite.has(\"exclude\")}\n\t\t\t\t\t\tonSelect={onChangeMaskComposite}\n\t\t\t\t\t>\n\t\t\t\t\t\t<MaskCompositeIcon maskComposite=\"exclude\" />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t)\n\t},\n)\n\nfunction MaskCompositeIcon({ maskComposite }: { maskComposite: MaskComposite }) {\n\tswitch (maskComposite) {\n\t\tcase \"add\":\n\t\t\treturn (\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 0 1.5 C 0 0.672 0.672 0 1.5 0 L 6.5 0 C 7.328 0 8 0.672 8 1.5 L 8 4 L 10.5 4 C 11.328 4 12 4.672 12 5.5 L 12 10.5 C 12 11.328 11.328 12 10.5 12 L 5.5 12 C 4.672 12 4 11.328 4 10.5 L 4 8 L 1.5 8 C 0.672 8 0 7.328 0 6.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></path>\n\t\t\t\t</svg>\n\t\t\t)\n\t\tcase \"subtract\":\n\t\t\treturn (\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 0 1.5 C 0 0.672 0.672 0 1.5 0 L 6.5 0 C 7.328 0 8 0.672 8 1.5 L 8 3 L 5 3 C 3.895 3 3 3.895 3 5 L 3 8 L 1.5 8 C 0.672 8 0 7.328 0 6.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></path>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 12 10.5 C 12 11.328 11.328 12 10.5 12 L 5.5 12 C 4.672 12 4 11.328 4 10.5 L 4 5.5 C 4 4.672 4.672 4 5.5 4 L 10.5 4 C 11.328 4 12 4.672 12 5.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t></path>\n\t\t\t\t</svg>\n\t\t\t)\n\t\tcase \"intersect\":\n\t\t\treturn (\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 0 1.5 C 0 0.672 0.672 0 1.5 0 L 6.5 0 C 7.328 0 8 0.672 8 1.5 L 8 3 L 5.017 3.052 C 3.94 3.071 3.071 3.94 3.052 5.017 L 3 8 L 1.5 8 C 0.672 8 0 7.328 0 6.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t></path>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 12 10.5 C 12 11.328 11.328 12 10.5 12 L 5.5 12 C 4.672 12 4 11.328 4 10.5 L 4 9 L 6.983 8.948 C 8.06 8.929 8.929 8.06 8.948 6.983 L 9 4 L 10.5 4 C 11.328 4 12 4.672 12 5.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t></path>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 4 5.5 C 4 4.672 4.672 4 5.5 4 L 8 4 L 8 6.5 C 8 7.328 7.328 8 6.5 8 L 4 8 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></path>\n\t\t\t\t</svg>\n\t\t\t)\n\t\tcase \"exclude\":\n\t\t\treturn (\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 0 1.5 C 0 0.672 0.672 0 1.5 0 L 6.5 0 C 7.328 0 8 0.672 8 1.5 L 8 3 L 5.017 3.052 C 3.94 3.071 3.071 3.94 3.052 5.017 L 3 8 L 1.5 8 C 0.672 8 0 7.328 0 6.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></path>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 12 10.5 C 12 11.328 11.328 12 10.5 12 L 5.5 12 C 4.672 12 4 11.328 4 10.5 L 4 9 L 6.983 8.948 C 8.06 8.929 8.929 8.06 8.948 6.983 L 9 4 L 10.5 4 C 11.328 4 12 4.672 12 5.5 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t></path>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 4 5.5 C 4 4.672 4.672 4 5.5 4 L 8 4 L 8 6.5 C 8 7.328 7.328 8 6.5 8 L 4 8 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t></path>\n\t\t\t\t</svg>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(maskComposite, \"Unsupported mask composite\")\n\t}\n}\n", "import { NumberInputWithTicker, PopupButton, PopupButtonItem, Slider } from \"@framerjs/fresco\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport type { MaskRepeat, MaskSize } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport type { ImageFit } from \"library/render/types/BackgroundImage.ts\"\nimport { memo } from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ntype MaskImageFit = Exclude<ImageFit, \"stretch\">\nconst imageResizeOptions: MaskImageFit[] = [\"fill\", \"fit\", \"tile\"]\n\ninterface MaskImageResizeRowProps extends Pick<ReducedMask, \"maskImageResize\" | \"maskRepeat\"> {\n\tonChangeImageResize: (size: MaskSize, repeat: MaskRepeat) => void\n\tenabled?: boolean\n}\n\nexport const MaskImageResizeRow = memo(\n\t({ enabled = true, maskImageResize, maskRepeat, onChangeImageResize }: MaskImageResizeRowProps) => {\n\t\tconst maskImageFit = maskSizeToMaskImageFit(maskImageResize, maskRepeat)\n\t\tconst isTileOnly = commonValue(maskImageFit) === \"tile\"\n\t\tconst tileScale = isTileOnly ? getMaskScaleValue(maskImageResize) : undefined\n\n\t\tconst onChangeImageResizeWithRepeat = (fit: MaskImageFit) => {\n\t\t\tswitch (fit) {\n\t\t\t\tcase \"fill\":\n\t\t\t\t\tonChangeImageResize(\"cover\", \"no-repeat\")\n\t\t\t\t\tbreak\n\t\t\t\tcase \"fit\":\n\t\t\t\t\tonChangeImageResize(\"contain\", \"no-repeat\")\n\t\t\t\t\tbreak\n\t\t\t\tcase \"tile\":\n\t\t\t\t\tonChangeImageResize(100, \"repeat\")\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(fit)\n\t\t\t}\n\t\t}\n\n\t\tconst onChangeTileScale = (size: number) => {\n\t\t\tonChangeImageResize(size, \"repeat\")\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t\t<PopupButton enabled={enabled} wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t\t{imageResizeOptions.map(resizeOption => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={resizeOption}\n\t\t\t\t\t\t\t\t\tidentifier={resizeOption}\n\t\t\t\t\t\t\t\t\ttitle={capitalizeFirstLetter}\n\t\t\t\t\t\t\t\t\tselected={maskImageFit.has(resizeOption)}\n\t\t\t\t\t\t\t\t\tonSelect={onChangeImageResizeWithRepeat}\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</PopupButton>\n\t\t\t\t</PanelRow>\n\n\t\t\t\t{isTileOnly && (\n\t\t\t\t\t<PanelRow title=\"Scale\">\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tprecision={0}\n\t\t\t\t\t\t\tvalue={tileScale}\n\t\t\t\t\t\t\tdefaultValue={1}\n\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t\tonChange={onChangeTileScale}\n\t\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Slider enabled={enabled} value={tileScale} min={1} max={200} step={1} onChange={onChangeTileScale} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t},\n)\n\nfunction maskSizeToMaskImageFit(\n\tmaskSize: Set<MaskSize | undefined>,\n\tmaskRepeat: Set<MaskRepeat | undefined>,\n): Set<MaskImageFit> {\n\tconst maskImageFit = new Set<MaskImageFit>()\n\tif (maskRepeat.has(\"repeat\")) maskImageFit.add(\"tile\")\n\tif (maskSize.has(\"contain\")) maskImageFit.add(\"fit\")\n\tif (maskSize.has(\"cover\")) maskImageFit.add(\"fill\")\n\treturn maskImageFit\n}\n\nfunction getMaskScaleValue(maskSize: Set<MaskSize | undefined>) {\n\tconst maskSizeCommonValue = commonValue(maskSize)\n\tif (isNotFound(maskSizeCommonValue) || isMixed(maskSizeCommonValue)) return undefined\n\tif (isNumber(maskSizeCommonValue)) return maskSizeCommonValue\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { MaskMode } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { memo } from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface MaskModeRowProps extends Pick<ReducedMask, \"maskMode\"> {\n\tonChangeMaskMode: (mode: MaskMode) => void\n\tenabled?: boolean\n}\nconst maskModeOptions: MaskMode[] = [\"luminance\", \"alpha\"]\n\nexport const MaskModeRow = memo(({ maskMode, onChangeMaskMode, enabled = true }: MaskModeRowProps) => {\n\treturn (\n\t\t<PanelRow title=\"Mode\">\n\t\t\t<PopupButton enabled={enabled} wrapperClassName={doubleColumnClass}>\n\t\t\t\t{maskModeOptions.map(modeOption => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={modeOption}\n\t\t\t\t\t\t\tidentifier={modeOption}\n\t\t\t\t\t\t\ttitle={capitalizeFirstLetter}\n\t\t\t\t\t\t\tselected={maskMode.has(modeOption)}\n\t\t\t\t\t\t\tonSelect={onChangeMaskMode}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</PopupButton>\n\t\t</PanelRow>\n\t)\n})\n", "import \"MaskPopout.styles_16h4841.wyw.css\"; export const container = \"container_c12dw6h7\";\nexport const sectionWithDivider = \"sectionWithDivider_s1otkumv\";\nexport const gradientStopsSliderContainer = \"gradientStopsSliderContainer_g1ppalyf\";\nexport const disabledPreviewButton = \"disabledPreviewButton_dwxnb2w\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MaskPosition } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { useMemo } from \"react\"\nimport { capitalizeFirstLetterOfEachWord } from \"utils/capitalizeFirstLetter.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { IconPosition } from \"./FillImagePositionRow.tsx\"\nimport * as styles from \"./MaskPositionRow.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface MaskPositionRowProps extends Pick<ReducedMask, \"maskPosition\"> {\n\tonChangeMaskPosition: (position: MaskPosition) => void\n\tenabled?: boolean\n}\nconst maskPositionOptions: MaskPosition[] = [\n\t\"top left\",\n\t\"top\",\n\t\"top right\",\n\t\"left\",\n\t\"center\",\n\t\"right\",\n\t\"bottom left\",\n\t\"bottom\",\n\t\"bottom right\",\n]\n\nfunction getMaskPositionLabel(positionValue: MaskPosition) {\n\tswitch (positionValue) {\n\t\tcase \"top left\":\n\t\tcase \"top right\":\n\t\tcase \"left\":\n\t\tcase \"center\":\n\t\tcase \"right\":\n\t\tcase \"bottom left\":\n\t\tcase \"bottom right\":\n\t\t\treturn positionValue\n\t\tcase \"top\":\n\t\t\treturn \"top center\"\n\t\tcase \"bottom\":\n\t\t\treturn \"bottom center\"\n\t\tdefault:\n\t\t\tassertNever(positionValue, \"Unsupported mask position\")\n\t}\n}\n\nexport function MaskPositionRow({ maskPosition, onChangeMaskPosition, enabled = true }: MaskPositionRowProps) {\n\tconst selectedOption = commonValue(maskPosition)\n\n\tconst items: React.ReactNode[] = useMemo(() => {\n\t\tconst updatedItems: React.ReactNode[] = []\n\n\t\tif (isMixed(selectedOption)) {\n\t\t\tupdatedItems.push(<PopupButtonItem key=\"mixed\" selected title={Dictionary.Mixed} />)\n\t\t\tupdatedItems.push(<PopupButtonItem key=\"mixed-divider\" type=\"divider\" />)\n\t\t}\n\n\t\tmaskPositionOptions.forEach((option, index) => {\n\t\t\tconst optionLabel = getMaskPositionLabel(option)\n\t\t\tupdatedItems.push(\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\tkey={index}\n\t\t\t\t\tidentifier={option}\n\t\t\t\t\ttitle={capitalizeFirstLetterOfEachWord(optionLabel)}\n\t\t\t\t\tselected={option === selectedOption}\n\t\t\t\t\tonSelect={onChangeMaskPosition}\n\t\t\t\t/>,\n\t\t\t)\n\n\t\t\tif ((index + 1) % 3 === 0) {\n\t\t\t\tupdatedItems.push(<PopupButtonItem key={index + \"divider\"} type=\"divider\" />)\n\t\t\t}\n\t\t})\n\t\treturn updatedItems\n\t}, [selectedOption, onChangeMaskPosition])\n\n\tif (isUndefined(selectedOption) || isNotFound(selectedOption)) return null\n\n\treturn (\n\t\t<PanelRow title=\"Position\">\n\t\t\t<PopupButton\n\t\t\t\tenabled={enabled}\n\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper\n\t\t\t\t\t\tclassName={cx(!enabled && styles.disabledIconWrapper)}\n\t\t\t\t\t\tbackground={colors.popupButtonPreviewIconBackground}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconPosition\n\t\t\t\t\t\t\tselectedOption={selectedOption}\n\t\t\t\t\t\t\toptionItems={maskPositionOptions}\n\t\t\t\t\t\t\tfirstPositionKey=\"top left\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{items}\n\t\t\t</PopupButton>\n\t\t</PanelRow>\n\t)\n}\n", "import \"MaskPositionRow.styles_1gbeaic.wyw.css\"; export const disabledIconWrapper = \"disabledIconWrapper_dkyvi6e\";", "import { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { Mask } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { maskAddedImageDefaults, withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedMask } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport { ConicGradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport { getMaskPopoutId } from \"../../rows/MaskPopout.tsx\"\n\nconst defaultGradientStops: readonly GradientColorStop[] = [\n\tnew GradientColorStop({ value: \"rgba(0,0,0,0)\", position: 0 }),\n\tnew GradientColorStop({ value: \"rgba(0,0,0,1)\", position: 1 }),\n]\n\nexport const maskAddedDefaults: Omit<Mask, \"id\"> = {\n\tmaskType: \"linear-gradient\",\n\t// NOTE: For linear gradient masks, we invert the default gradient direction compared to regular fill gradients.\n\t// While regular gradients default to transparent\u2192solid, masks default to solid\u2192transparent to create a fade-out\n\t// effect at the bottom of the selection. This intentionally overrides the default gradient angle defined in the\n\t// `LinearGradient` class. Overriding the stops would create inconsistencies when editing a gradient and switching\n\t// to another gradient type.\n\tmaskLinearGradient: new LinearGradient({ stops: defaultGradientStops, angle: 0 }),\n\tmaskRadialGradient: new RadialGradient({ stops: defaultGradientStops }),\n\tmaskConicGradient: new ConicGradient({ stops: defaultGradientStops }),\n\tmaskImage: null,\n\tmaskComposite: \"add\",\n\t...maskAddedImageDefaults,\n}\n\nexport function addMaskForNodes(tree: CanvasTree, nodeIds: NodeID[], masks: Reduced<ReducedMask[]>) {\n\tconst nodes = tree.getNodesWithTrait(nodeIds, withMasks)\n\tconst maskCount = isArray(masks) ? masks.length : 0\n\tconst shouldCreateNewList = maskCount === 0\n\tconst id = randomID()\n\tconst maskSettings: Mask = { id, ...maskAddedDefaults }\n\n\tfor (const node of nodes) {\n\t\tconst masksForNode = shouldCreateNewList || !node.masks ? [maskSettings] : [...node.masks, { ...maskSettings }]\n\t\tnode.set({ masks: masksForNode }, tree)\n\t}\n\n\tpopoutWindow.navigation.presentPopoutOnRegistration(getMaskPopoutId(id))\n}\n", "import { assert, List, assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { supportsBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport type { Mask, WithMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { getDuplicatedMask, isMask, withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { WithShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { isShadow, withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport {\n\ttype TriggerAction,\n\ttype WithTriggerActions,\n\tisTriggerAction,\n\twithTriggerActions,\n} from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport type { BoxShadow, Shadow } from \"document/models/Shadow.ts\"\nimport { getDuplicatedShadow, isBoxShadow } from \"document/models/Shadow.ts\"\nimport { useMemo } from \"react\"\nimport { canReadClipboardWithoutPromptingUser, isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isArray, isUndefined } from \"utils/typeChecks.ts\"\n\ninterface PropertyTypeMapping {\n\tmasks: Mask\n\tshadows: Shadow\n\tboxShadows: BoxShadow\n\ttriggerActions: TriggerAction\n}\ntype PropertyArrayItemType<T extends keyof PropertyTypeMapping> = PropertyTypeMapping[T]\ntype ArrayPropertyTraitType = TraitType.Mask | TraitType.Shadows | TraitType.TriggerActions\ntype PropertyArrayTraitKey = keyof WithMasks | keyof WithShadow | keyof WithBoxShadow | keyof WithTriggerActions\ntype PropertyArrayTrait = WithMasks | WithShadow | WithBoxShadow | WithTriggerActions\ntype PropertyArrayItems = PropertyArrayItemType<PropertyArrayTraitKey>[]\n\nfunction getNodesForPropertyArrayTraitKey(traitTypeKey: PropertyArrayTraitKey, nodeIds: NodeID[]) {\n\tswitch (traitTypeKey) {\n\t\tcase \"masks\":\n\t\t\treturn engine.tree.getNodesWithTrait(nodeIds, withMasks)\n\t\tcase \"shadows\":\n\t\t\treturn engine.tree.getNodesWithTrait(nodeIds, withShadow)\n\t\tcase \"boxShadows\":\n\t\t\treturn engine.tree.getNodesWithTrait(nodeIds, supportsBoxShadow)\n\t\tcase \"triggerActions\":\n\t\t\treturn engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\tdefault:\n\t\t\tassertNever(traitTypeKey, `Unsupported type: ${traitTypeKey}`)\n\t}\n}\n\nfunction getNodeTraitItems(\n\ttraitTypeKey: PropertyArrayTraitKey,\n\titems: PropertyArrayItems,\n): PropertyArrayTrait | undefined {\n\tswitch (traitTypeKey) {\n\t\tcase \"masks\":\n\t\t\tif (!isArrayWithTraitType(items, traitTypeKey)) return undefined\n\t\t\treturn { masks: items }\n\t\tcase \"shadows\":\n\t\t\tif (!isArrayWithTraitType(items, traitTypeKey)) return undefined\n\t\t\treturn { shadows: items }\n\t\tcase \"boxShadows\":\n\t\t\tif (!isArrayWithTraitType(items, traitTypeKey)) return undefined\n\t\t\treturn { boxShadows: items }\n\t\tcase \"triggerActions\":\n\t\t\tif (!isArrayWithTraitType(items, traitTypeKey)) return undefined\n\t\t\treturn { triggerActions: items }\n\t\tdefault:\n\t\t\tassertNever(traitTypeKey, `Unsupported type: ${traitTypeKey}`)\n\t}\n}\n\nconst copyItems = async (\n\ttraitTypeKey: PropertyArrayTraitKey,\n\ttraitType: ArrayPropertyTraitType,\n\tnodeIds: NodeID[],\n\tcanCopy: (index: number | undefined) => boolean,\n\tindex: number | undefined = undefined,\n) => {\n\tconst nodes = getNodesForPropertyArrayTraitKey(traitTypeKey, nodeIds)\n\n\tif (nodes.length === 0 || !canCopy(index)) return\n\tconst node = nodes[0]\n\tassert(node, \"Node not found\")\n\n\tlet itemsToCopy = node[traitTypeKey]\n\tif (!isArray(itemsToCopy)) return\n\n\tif (!isUndefined(index)) {\n\t\tconst item = itemsToCopy[index]\n\t\tif (!item) return\n\t\titemsToCopy = [item]\n\t}\n\n\tconst nodeTraitItems = getNodeTraitItems(traitTypeKey, itemsToCopy)\n\tif (!nodeTraitItems) return\n\n\tconst clone = node.clone()\n\tclone.set(nodeTraitItems)\n\n\tconst sourceProjectId = engine.stores.projectStore.projectId\n\tawait Clipboard.copyStyle(engine.tree, engine.componentLoader, clone, sourceProjectId, traitType)\n}\n\nasync function getItemsFromClipboard<T extends PropertyArrayTraitKey>(\n\ttraitTypeKey: T,\n): Promise<PropertyArrayItemType<T>[] | undefined> {\n\tconst stylesData = await Clipboard.getStyleData(undefined)\n\tif (!stylesData) return\n\n\tconst styleTree = CanvasTree.fromJS(stylesData.tree, engine.componentLoader)\n\tif (!styleTree) return\n\n\tconst node = styleTree.rootAtStart\n\tswitch (traitTypeKey) {\n\t\tcase \"masks\":\n\t\t\tif (!withMasks(node)) return\n\t\t\treturn node.masks?.map(getDuplicatedMask) as PropertyArrayItemType<T>[]\n\t\tcase \"shadows\":\n\t\t\tif (!withShadow(node)) return\n\t\t\treturn node.shadows?.map(getDuplicatedShadow) as PropertyArrayItemType<T>[]\n\t\tcase \"boxShadows\":\n\t\t\tif (!supportsBoxShadow(node)) return\n\t\t\tif (isDynamicValue(node.boxShadows)) return\n\t\t\treturn node.boxShadows?.map(getDuplicatedShadow) as PropertyArrayItemType<T>[]\n\t\tcase \"triggerActions\":\n\t\t\tif (!withTriggerActions(node)) return\n\t\t\t// See {getDuplicatedTriggerAction}, we duplicate trigger actions while pasting because we must replace actions\n\t\t\t// depending on the target node (target component may have different variants, or source and target may be different node types).\n\t\t\t// We return the raw trigger actions here because it is used for checks in `canPasteItems` and `getItemsInClipboardLength`.\n\t\t\treturn node.triggerActions as PropertyArrayItemType<T>[]\n\t\tdefault:\n\t\t\tassertNever(traitTypeKey, `Unsupported type: ${traitTypeKey}`)\n\t}\n}\n\nasync function pasteItems(traitTypeKey: PropertyArrayTraitKey, ids: NodeID[], index: number | undefined = undefined) {\n\tconst items = await getItemsFromClipboard(traitTypeKey)\n\tif (isUndefined(items)) return\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst nodes = getNodesForPropertyArrayTraitKey(traitTypeKey, ids)\n\t\tfor (const node of nodes) {\n\t\t\t// When not pasting on specific item, replace all current items with the items in clipboard\n\t\t\tif (isUndefined(index)) {\n\t\t\t\tnode.set({ [traitTypeKey]: items })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Replace the item at the given index with all items in clipboard\n\t\t\tconst currentItems = node[traitTypeKey]\n\t\t\tif (isUndefined(currentItems)) continue\n\t\t\tnode.set({ [traitTypeKey]: List.replace(currentItems, index, items) })\n\t\t}\n\t})\n}\n\nfunction isArrayWithTraitType<T extends PropertyArrayTraitKey>(\n\titems: unknown,\n\ttraitTypeKey: T,\n): items is PropertyArrayItemType<T>[] {\n\tif (!isArray(items)) return false\n\treturn items.every(item => {\n\t\tswitch (traitTypeKey) {\n\t\t\tcase \"masks\":\n\t\t\t\treturn isMask(item)\n\t\t\tcase \"shadows\":\n\t\t\t\treturn isShadow(item)\n\t\t\tcase \"boxShadows\":\n\t\t\t\treturn isBoxShadow(item)\n\t\t\tcase \"triggerActions\":\n\t\t\t\treturn isTriggerAction(item)\n\t\t\tdefault:\n\t\t\t\tassertNever(traitTypeKey, `Unsupported type: ${traitTypeKey}`)\n\t\t}\n\t})\n}\n\nconst canPasteItems = async (traitTypeKey: PropertyArrayTraitKey) => {\n\tif (!isClipboardSupported()) return false\n\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\n\tconst items = await getItemsFromClipboard(traitTypeKey)\n\treturn isArray(items) && items.length > 0\n}\n\nconst getItemsInClipboardLength = async (traitTypeKey: PropertyArrayTraitKey) => {\n\tconst items = await getItemsFromClipboard(traitTypeKey)\n\treturn items?.length ?? 0\n}\n\nfunction getTraitTypeKeyForTraitType(traitType: ArrayPropertyTraitType, nodeIds: NodeID[]): PropertyArrayTraitKey {\n\tswitch (traitType) {\n\t\tcase TraitType.Mask:\n\t\t\treturn \"masks\"\n\t\tcase TraitType.Shadows: {\n\t\t\tif (nodeIds.length === 0) return \"shadows\"\n\n\t\t\t// `TraitType.Shadows` is used for both `shadows` and `boxShadows` so\n\t\t\t// we need to determine which one to use based on the selection\n\t\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\t\t\tconst node = nodes[0]\n\t\t\tassert(node, \"Node not found\")\n\n\t\t\tif (supportsBoxShadow(node)) return \"boxShadows\"\n\t\t\treturn \"shadows\"\n\t\t}\n\t\tcase TraitType.TriggerActions:\n\t\t\treturn \"triggerActions\"\n\t\tdefault:\n\t\t\tassertNever(traitType, `Unsupported type: ${traitType}`)\n\t}\n}\n\nexport const useCopyPasteArrayProperty = (\n\ttraitType: ArrayPropertyTraitType,\n\tnodeIds: NodeID[],\n\tcanCopyAllItems: () => boolean,\n\tcanCopySingleItem: (index: number) => boolean,\n) => {\n\treturn useMemo(() => {\n\t\tconst traitTypeKey = getTraitTypeKeyForTraitType(traitType, nodeIds)\n\t\tconst canPasteCallback = () => canPasteItems(traitTypeKey)\n\n\t\tconst pasteAllItemsCallback = () => pasteItems(traitTypeKey, nodeIds)\n\t\tconst pasteItemCallback = (index: number) => pasteItems(traitTypeKey, nodeIds, index)\n\n\t\tconst copyAllItemsCallback = () => copyItems(traitTypeKey, traitType, nodeIds, canCopyAllItems)\n\t\tconst copyItemCallback = (index: number) => copyItems(traitTypeKey, traitType, nodeIds, canCopySingleItem, index)\n\n\t\tconst clipboardItemsLengthCallback = () => getItemsInClipboardLength(traitTypeKey)\n\n\t\treturn [\n\t\t\tcanPasteCallback,\n\t\t\tpasteAllItemsCallback,\n\t\t\tpasteItemCallback,\n\t\t\tcopyAllItemsCallback,\n\t\t\tcopyItemCallback,\n\t\t\tclipboardItemsLengthCallback,\n\t\t] as const\n\t}, [traitType, nodeIds, canCopySingleItem, canCopyAllItems])\n}\n", "import \"MaskRow.styles_zqriuf.wyw.css\"; export const sortable = \"sortable_s6jd2na\";", "import type { SVGProps } from \"react\"\n\nexport function IconAgentLocalizationMagic(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" 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\tstrokeWidth=\"2\"\n\t\t\t\td=\"M13.385 7.996a1.62 1.62 0 0 1 3.23 0V8A5.85 5.85 0 0 0 22 13.385h.004a1.62 1.62 0 0 1 0 3.23H22A5.85 5.85 0 0 0 16.615 22v.004a1.62 1.62 0 0 1-3.23 0V22A5.85 5.85 0 0 0 8 16.615h-.004a1.62 1.62 0 0 1 0-3.23H8A5.85 5.85 0 0 0 13.385 8Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"sharedLocalization.styles_1el8dl7.wyw.css\"; export const pulseAnimation = \"pulseAnimation_p16byb61\";", "import { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { IconAgentLocalizationMagic } from \"./IconAgentLocalizationMagic.tsx\"\nimport { pulseAnimation } from \"./sharedLocalization.styles.ts\"\n\nexport function IconMagic({ active, width = 22, height = 22 }: { active: boolean; width?: number; height?: number }) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tif (agentExperimentEnabled) {\n\t\treturn <IconAgentLocalizationMagic className={cx(active && pulseAnimation)} width={width} height={height} />\n\t}\n\n\treturn (\n\t\t<svg\n\t\t\tclassName={cx(active && pulseAnimation)}\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\tviewBox=\"0 0 22 22\"\n\t\t\twidth={width}\n\t\t\theight={height}\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M 9.811 8.535 C 10.089 8.473 10.306 8.256 10.368 7.978 L 11.017 5.055 C 11.188 4.289 12.279 4.289 12.449 5.055 L 13.099 7.978 C 13.161 8.256 13.378 8.473 13.656 8.535 L 16.579 9.184 C 17.344 9.354 17.344 10.446 16.579 10.616 L 13.656 11.265 C 13.378 11.327 13.161 11.544 13.099 11.822 L 12.449 14.745 C 12.279 15.511 11.188 15.511 11.017 14.745 L 10.368 11.822 C 10.306 11.544 10.089 11.327 9.811 11.265 L 6.888 10.616 C 6.122 10.446 6.122 9.354 6.888 9.184 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 5.911 14.535 C 6.189 14.473 6.406 14.256 6.468 13.978 L 6.667 13.083 C 6.738 12.762 7.195 12.762 7.267 13.083 L 7.465 13.978 C 7.527 14.256 7.744 14.473 8.022 14.535 L 8.917 14.733 C 9.238 14.805 9.238 15.262 8.917 15.333 L 8.022 15.532 C 7.744 15.594 7.527 15.811 7.465 16.089 L 7.267 16.983 C 7.195 17.304 6.738 17.304 6.667 16.983 L 6.468 16.089 C 6.406 15.811 6.189 15.594 5.911 15.532 L 5.017 15.333 C 4.696 15.262 4.696 14.805 5.017 14.733 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "import \"ComponentInstancePlaceholder.styles_jp49vj.wyw.css\"; export const componentProgressOverlayInner = \"componentProgressOverlayInner_c1ulzfhj\";\nexport const componentProgressOverlayAnimation = \"componentProgressOverlayAnimation_c1s0oill\";\nexport const componentProgressOverlayTitle = \"componentProgressOverlayTitle_c1erq8ni\";\nexport const componentProgressOverlayCodePreview = \"componentProgressOverlayCodePreview_c1ssh5cj\";", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, LoadedScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tconvertRectToCanvasWithRotation,\n\tgetCornerPointsOnCanvasWithZoom,\n} from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { isDefined, isNull } from \"utils/typeChecks.ts\"\nimport { Overlay } from \"../canvas-hud/Overlay.tsx\"\nimport { IconMagic } from \"../chrome/localization/IconMagic.tsx\"\nimport * as styles from \"./ComponentInstancePlaceholder.styles.ts\"\nimport { getEmptySpaceRect } from \"./getEmptySpaceRect.ts\"\n\ninterface ProgressOverlayProps {\n\ttitle: string | undefined\n\tcodePreview: string | null | undefined\n\tpoints: Point[]\n\tzoom: number\n\tcanvasRectWithRotation: Rect & { rotation: number }\n\ttransparentBorder?: boolean\n}\n\nfunction ProgressOverlay({\n\ttitle = \"Generating\u2026\",\n\tcodePreview,\n\tpoints,\n\tzoom,\n\tcanvasRectWithRotation,\n\ttransparentBorder = false,\n}: ProgressOverlayProps) {\n\tconst showCodePreview = !isNull(codePreview) && isDefined(codePreview)\n\tconst shouldShowIconOnly = canvasRectWithRotation.width * zoom <= 70 || canvasRectWithRotation.height * zoom <= 70\n\n\tconst fontSize = Math.ceil(10 ** (zoom ** 0.1))\n\tconst gap = zoom < 0.25 ? 4 : Math.ceil(8 ** (zoom ** 0.1))\n\n\treturn (\n\t\t<Overlay\n\t\t\tpoints={points}\n\t\t\tbackgroundColor={colors.componentProgressOverlayBackground}\n\t\t\tborderColor={transparentBorder ? \"transparent\" : colors.componentProgressOverlayBorder}\n\t\t\tborderWidth={1}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.componentProgressOverlayInner,\n\t\t\t\t\t(shouldShowIconOnly || !showCodePreview) && styles.componentProgressOverlayAnimation,\n\t\t\t\t)}\n\t\t\t\tstyle={{ fontSize, gap, transform: `rotate(${canvasRectWithRotation.rotation}deg)` }}\n\t\t\t>\n\t\t\t\t{shouldShowIconOnly && <IconMagic active={false} />}\n\t\t\t\t{!shouldShowIconOnly && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{!showCodePreview && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<IconMagic active={false} />\n\t\t\t\t\t\t\t\t<span className={styles.componentProgressOverlayTitle}>{title}</span>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{showCodePreview && <pre className={styles.componentProgressOverlayCodePreview}>{codePreview}</pre>}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</Overlay>\n\t)\n}\n\nexport function ComponentInstancePlaceholder({\n\tzoom,\n\tactiveScope,\n\ttree,\n}: {\n\tzoom: number\n\ttree: CanvasTree\n\tactiveScope: LoadedScopeNode\n}) {\n\tconst { pluginStore } = engine.stores\n\tconst placeholder = useEngineState(() => pluginStore.componentInstancePlaceholder, [], [pluginStore])\n\n\tif (!placeholder) return null\n\tif (activeScope.id !== placeholder.scopeId) return null\n\n\tconst rect = getEmptySpaceRect(tree, placeholder.width, placeholder.height, activeScope)\n\tconst zoomedRect = Rect.multiply(rect, zoom)\n\tconst points = Rect.cornerPoints(zoomedRect)\n\n\treturn (\n\t\t<ProgressOverlay\n\t\t\ttitle={placeholder.title}\n\t\t\tcodePreview={placeholder.codePreview}\n\t\t\tpoints={points}\n\t\t\tzoom={zoom}\n\t\t\tcanvasRectWithRotation={{\n\t\t\t\t...rect,\n\t\t\t\trotation: 0,\n\t\t\t}}\n\t\t/>\n\t)\n}\n\nexport function CodeFilesProgressStateOverlay({\n\tzoom,\n\ttree,\n\tactiveScope,\n}: {\n\tzoom: number\n\ttree: CanvasTree\n\tactiveScope: LoadedScopeNode\n}) {\n\tconst { pluginStore, selectionStore, treeStore } = engine.stores\n\tconst selectedIds = selectionStore.useState(state => state.ids)\n\n\tconst codeFilesProgressState = useEngineState(() => pluginStore.codeFilesProgressState, [], [pluginStore])\n\tif (codeFilesProgressState.size === 0) return null\n\n\tconst components: React.ReactNode[] = []\n\tfor (const [codeFileId, state] of codeFilesProgressState.entries()) {\n\t\tconst treeIndexes = treeStore.getPartialIndexes()\n\t\tfor (const node of treeIndexes.codeComponents) {\n\t\t\tif (treeStore.treeIndex.getScopeIdFor(node.id) !== activeScope.id) continue\n\n\t\t\tconst moduleIdentifier = parseModuleIdentifier(node.codeComponentIdentifier)\n\t\t\tif (!isLocalModuleIdentifier(moduleIdentifier)) continue\n\t\t\tif (moduleIdentifier.localId !== codeFileId) continue\n\n\t\t\tconst points = getCornerPointsOnCanvasWithZoom(tree, node, zoom)\n\t\t\tconst canvasRectWithRotation = convertRectToCanvasWithRotation(tree, node)\n\n\t\t\tcomponents.push(\n\t\t\t\t<ProgressOverlay\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tkey={node.id}\n\t\t\t\t\tpoints={points}\n\t\t\t\t\ttitle={state.title}\n\t\t\t\t\tcodePreview={state.codePreview}\n\t\t\t\t\tcanvasRectWithRotation={canvasRectWithRotation}\n\t\t\t\t\ttransparentBorder={selectedIds.includes(node.id)}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn components\n}\n", "import React from \"react\"\nimport type { CreateTool } from \"./Create.tsx\"\nimport { Create } from \"./Create.tsx\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\n\nexport class CreateCodeComponent extends React.Component<ToolPropsWithManagerProps<CreateTool>> {\n\toverride render() {\n\t\treturn <Create {...this.props} />\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport type { VekterTool } from \"document/VekterTool.ts\"\nimport { ParentHighlight } from \"document/components/canvas-hud/ParentHighlight.tsx\"\nimport type { CanvasNode, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { NonDynamicValueRecord } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { Overlay } from \"../canvas-hud/Overlay.tsx\"\nimport { isSkewedQuadrilateralPoints } from \"../utils/isSkewedQuadrilateralPoints.ts\"\nimport type { CreateToolHelper } from \"./CreateToolHelper.ts\"\nimport { ShapeOutline } from \"./pathEdit/controls/ShapeOutline.tsx\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\nimport type { SnapTool } from \"./utils/SnapTool.ts\"\nimport { withSnapping } from \"./utils/withSnapping.tsx\"\n\nexport type UpdatesFinishedCallback = () => void\n\nexport interface CreateOptions<T = CanvasNode> {\n\tid: NodeID\n\tparentId: MaybeNodeID\n\tindexInParent: number\n\trect: Rect\n\tproperties: Partial<NonDynamicValueRecord<T>>\n\trotation: number\n\toriginalParentId: MaybeNodeID | undefined\n}\n\nexport interface CreateTool extends VekterTool {\n\thelper: CreateToolHelper\n\tsnapper: SnapTool\n\tcreate(options: CreateOptions<CanvasNode>): UpdatesFinishedCallback | undefined\n}\n\nclass Create extends React.Component<ToolPropsWithManagerProps<CreateTool> & { children?: React.ReactNode }> {\n\toverride render() {\n\t\tconst tool = this.props.myTool\n\t\tconst engine = tool.engine\n\t\tconst helper = tool.helper\n\t\tconst { tree, altKey, shiftKey, zoom } = this.props\n\n\t\tif (!helper.snappedMouse || helper.showFrame === false) {\n\t\t\treturn null\n\t\t}\n\n\t\tlet outline: JSX.Element | null = null\n\n\t\tconst visibleCanvasRect = engine.stores.canvasStore.getCanvasVisibleRect()\n\t\tif (helper.snappedMouseDown) {\n\t\t\tif (helper.overlayComponent) {\n\t\t\t\tconst Component = helper.overlayComponent\n\t\t\t\toutline = <Component points={helper.points} />\n\t\t\t} else if (helper.overlayShape && !isSkewedQuadrilateralPoints(helper.points)) {\n\t\t\t\tconst halfPixelAligned = tool.enum === Tools.Path\n\t\t\t\t// Don't show perfect shape outlines when skewed, falling\n\t\t\t\t// through to just showing a skewed bounding rect.\n\t\t\t\tconst frame = Rect.multiply(\n\t\t\t\t\thelper.frame(\n\t\t\t\t\t\thelper.snappedMouseDown,\n\t\t\t\t\t\thelper.snappedMouse,\n\t\t\t\t\t\tshiftKey,\n\t\t\t\t\t\taltKey && !engine.stores.mouseStore.latest.spacebar,\n\t\t\t\t\t\thalfPixelAligned,\n\t\t\t\t\t),\n\t\t\t\t\tzoom,\n\t\t\t\t)\n\t\t\t\tconst segments = helper.overlayShape(frame.width, frame.height)?.[0]?.pathSegments\n\t\t\t\tif (segments) {\n\t\t\t\t\tconst shape = [Path.applyRadius(segments, true, zoom)]\n\t\t\t\t\toutline = <ShapeOutline paths={shape} offset={frame} />\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutline = <Overlay points={helper.points} borderWidth={1} borderColor={colors.canvasCreatePreviewBorder} />\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{outline}\n\t\t\t\t<ParentHighlight\n\t\t\t\t\tids={helper.parentHighlight ? [helper.parentHighlight] : []}\n\t\t\t\t\ttree={tree}\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t\t/>\n\t\t\t\t{this.props.children}\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nconst exportWithSnapping = withSnapping(Create)\nexport { exportWithSnapping as Create }\n", "import { colors } from \"@framerjs/fresco/tokens\"\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 type { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\n\ninterface Props {\n\toffset: Point\n\tpaths: WithPaths\n}\n\nexport class ShapeOutline extends React.Component<Props, {}> {\n\toverride render() {\n\t\tconst { paths, offset } = this.props\n\n\t\tconst path = toSVGPath(paths)\n\t\tconst boundingBox = Path.boundingBox(paths)\n\n\t\tconst svgStyle: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\ttransform: `translate(${offset.x + 0.5}px, ${offset.y + 0.5}px)`,\n\t\t\twidth: boundingBox.width,\n\t\t\theight: boundingBox.height,\n\t\t\toverflow: \"visible\",\n\t\t\tfill: \"transparent\",\n\t\t\tstrokeWidth: 1,\n\t\t\tstroke: colors.canvasCreatePreviewBorder,\n\t\t}\n\n\t\treturn (\n\t\t\t<svg width=\"100%\" height=\"100%\" style={svgStyle} key=\"shape-overlay\">\n\t\t\t\t<path d={path} />\n\t\t\t</svg>\n\t\t)\n\t}\n}\n", "import { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport * as styles from \"./EqualDistanceFrames.styles.ts\"\nimport { Overlay } from \"./Overlay.tsx\"\n\ninterface Props {\n\tframesX: Rect[]\n\tframesY: Rect[]\n\tzoom: number\n}\n\nexport class EqualDistanceFrames extends React.Component<Props, {}> {\n\toverride render() {\n\t\tconst { framesX, framesY, zoom } = this.props\n\n\t\tconst frameOverlays: JSX.Element[] = []\n\t\tconst distanceLabels: JSX.Element[] = []\n\n\t\tconst renderedFramesX: Rect[] = merge(framesX, true)\n\t\tconst renderedFramesY: Rect[] = merge(framesY, false)\n\n\t\trenderedFramesX.forEach((frame, index) => {\n\t\t\tconst realFrame = Rect.multiply(frame, zoom)\n\t\t\tconst key = \"x\" + index\n\t\t\tdistanceLabels.push(label(realFrame, frame, false, key))\n\n\t\t\tframeOverlays.push(\n\t\t\t\t<Overlay\n\t\t\t\t\tkey={key}\n\t\t\t\t\tclassName={styles.fadeIn}\n\t\t\t\t\tpoints={Rect.cornerPoints(realFrame)}\n\t\t\t\t\tbackgroundColor=\"magenta\"\n\t\t\t\t\tborderColor=\"transparent\"\n\t\t\t\t\tborderWidth={0}\n\t\t\t\t\troundToOutside={false}\n\t\t\t\t/>,\n\t\t\t)\n\t\t})\n\n\t\trenderedFramesY.map((frame, index) => {\n\t\t\tconst key = \"y\" + index\n\t\t\tconst realFrame = Rect.multiply(frame, zoom)\n\t\t\tdistanceLabels.push(label(realFrame, frame, true, key))\n\t\t\tframeOverlays.push(\n\t\t\t\t<Overlay\n\t\t\t\t\tkey={key}\n\t\t\t\t\tclassName={styles.fadeIn}\n\t\t\t\t\tpoints={Rect.cornerPoints(realFrame)}\n\t\t\t\t\tbackgroundColor=\"magenta\"\n\t\t\t\t\tborderColor=\"transparent\"\n\t\t\t\t\tborderWidth={0}\n\t\t\t\t\troundToOutside={false}\n\t\t\t\t/>,\n\t\t\t)\n\t\t})\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div style={{ opacity: 0.3 }}>{frameOverlays}</div>\n\t\t\t\t{distanceLabels}\n\t\t\t</>\n\t\t)\n\t}\n}\n\nconst merge = (frames: Rect[], horizontally: boolean) => {\n\tconst result: Rect[] = []\n\tframes.forEach(frame => {\n\t\tconst mergeableRect = result.find(existing => {\n\t\t\tif (horizontally) {\n\t\t\t\treturn existing.x === frame.x && Rect.maxX(existing) === Rect.maxX(frame)\n\t\t\t} else {\n\t\t\t\treturn existing.y === frame.y && Rect.maxY(existing) === Rect.maxY(frame)\n\t\t\t}\n\t\t})\n\t\tif (mergeableRect !== undefined) {\n\t\t\tif (horizontally) {\n\t\t\t\tconst maxY = Math.max(Rect.maxY(mergeableRect), Rect.maxY(frame))\n\t\t\t\tmergeableRect.y = Math.min(frame.y, mergeableRect.y)\n\t\t\t\tmergeableRect.height = maxY - mergeableRect.y\n\t\t\t} else {\n\t\t\t\tconst maxX = Math.max(Rect.maxX(mergeableRect), Rect.maxX(frame))\n\t\t\t\tmergeableRect.x = Math.min(frame.x, mergeableRect.x)\n\t\t\t\tmergeableRect.width = maxX - mergeableRect.x\n\t\t\t}\n\t\t} else {\n\t\t\tresult.push({ ...frame })\n\t\t}\n\t})\n\treturn result\n}\n\nconst label = (rect: Rect, originalRect: Rect, isVertical: boolean, key: string) => {\n\tlet x = 0\n\tlet y = 0\n\n\tif (isVertical) {\n\t\tx = Rect.maxX(rect)\n\t\ty = rect.y + rect.height / 2\n\t} else {\n\t\tx = rect.x + rect.width / 2\n\t\ty = Rect.maxY(rect)\n\t}\n\n\tconst labelStyle: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tleft: x,\n\t\ttop: y,\n\t\tpadding: \"2px 4px\",\n\t\tborderRadius: 10,\n\t\tbackground: \"magenta\",\n\t\tcolor: \"white\",\n\t\tfontSize: \"10px\",\n\t\tlineHeight: \"1em\",\n\t\ttransform: transform(isVertical),\n\t}\n\n\treturn (\n\t\t<div key={`dist-label${key}`} className={styles.fadeIn} style={labelStyle}>\n\t\t\t{isVertical ? originalRect.height : originalRect.width}\n\t\t</div>\n\t)\n}\n\nfunction transform(isVertical: boolean) {\n\tif (isVertical) {\n\t\treturn `translateX(4px) translateY(-50%)`\n\t} else {\n\t\treturn `translateY(4px) translateX(-50%)`\n\t}\n}\n", "import \"EqualDistanceFrames.styles_1ag4465.wyw.css\"; export const fadeIn = \"fadeIn_fitcqga\";", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { VekterEngine } from \"document/VekterEngine.ts\"\nimport { Line } from \"library/render/types/Line.ts\"\nimport React from \"react\"\nimport SnapLine from \"./SnapLine.tsx\"\n\ninterface Props {\n\tsnapConstraint: Line | null\n\tzoom: number\n}\n\nexport class SnapConstraint extends React.Component<Props> {\n\toverride render() {\n\t\tconst { snapConstraint, zoom } = this.props\n\t\tif (snapConstraint === null) {\n\t\t\treturn null\n\t\t}\n\t\tif (Line.isOrthogonal(snapConstraint)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst { x, y, width, height } = VekterEngine.shared().stores.canvasStore.getCanvasVisibleRect()\n\t\tconst top = Line({ x, y }, { x: x + width, y })\n\t\tconst bottom = Line({ x, y: y + height }, { x: x + width, y: y + height })\n\t\tlet a = Line.intersection(snapConstraint, top)\n\t\tlet b = Line.intersection(snapConstraint, bottom)\n\n\t\tif (a === null || b === null) {\n\t\t\tconst left = Line({ x, y }, { x, y: y + height })\n\t\t\tconst right = Line({ x: x + width, y }, { x: x + width, y: y + height })\n\t\t\ta = Line.intersection(snapConstraint, left)\n\t\t\tb = Line.intersection(snapConstraint, right)\n\t\t}\n\n\t\tif (a === null || b === null) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn <SnapLine key=\"snapConstraint\" a={a} b={b} zoom={zoom} stroke={colors.snapConstraint} />\n\t}\n}\n", "import \"SnapLine.styles_1jr73bz.wyw.css\"; export const fadeIn = \"fadeIn_fnlvytk\";", "import { Point } from \"library/render/types/Point.ts\"\nimport type React from \"react\"\nimport * as styles from \"./SnapLine.styles.ts\"\n\ninterface Props {\n\ta: Point\n\tb: Point\n\tzoom: number\n\tstroke: string\n}\n\n// biome-ignore lint/style/noDefaultExport: <explanation>\nexport default function SnapLine({ a, b, zoom, stroke }: Props) {\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tbackgroundColor: stroke,\n\t\twidth: `1px`,\n\t\theight: `${Point.distance(a, b) * zoom}px`,\n\t\ttransformOrigin: \"0 0\",\n\t\ttransform: `translate(${Math.round(a.x * zoom)}px, ${Math.round(\n\t\t\ta.y * zoom,\n\t\t)}px) translateZ(0) rotate(${Point.angle(a, b).toFixed(4)}deg)`,\n\t}\n\n\treturn <div style={style} className={styles.fadeIn} />\n}\n", "import type { VekterTool } from \"document/VekterTool.ts\"\nimport { EqualDistanceFrames } from \"document/components/canvas-hud/EqualDistanceFrames.tsx\"\nimport { SnapConstraint } from \"document/components/canvas-hud/SnapConstraint.tsx\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport type { SnapTool } from \"./SnapTool.ts\"\n\ninterface Props {\n\tmyTool: VekterTool\n}\n\nexport function withSnapping<P>(Component: React.ComponentClass<P & Props>): React.ComponentClass<P> {\n\tclass WithSnapping extends React.Component<Props & P & { children?: React.ReactNode }> {\n\t\toverride render() {\n\t\t\tconst state = (this.props.myTool as any).snapper as SnapTool\n\t\t\tif (!state) {\n\t\t\t\treturn this.props.children\n\t\t\t}\n\t\t\tconst { zoom } = engine.stores.canvasStore\n\t\t\treturn (\n\t\t\t\t<Component {...this.props}>\n\t\t\t\t\t<EqualDistanceFrames zoom={zoom} framesX={state.distanceFramesX} framesY={state.distanceFramesY} />\n\t\t\t\t\t<SnapConstraint zoom={zoom} {...state} />\n\t\t\t\t\t{this.props.children}\n\t\t\t\t</Component>\n\t\t\t)\n\t\t}\n\t}\n\n\tWithSnapping[\"displayName\"] = `WithSnapping(${Component.displayName || Component.name})`\n\treturn WithSnapping\n}\n", "import { CanvasFramePresets } from \"document/components/canvas-hud/CanvasFramePresets.tsx\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Create } from \"./Create.tsx\"\nimport type { CreateFrameBaseToolType } from \"./CreateFrameTool.ts\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\n\nexport function CreateFrame(props: ToolPropsWithManagerProps<CreateFrameBaseToolType>) {\n\tconst { myTool } = props\n\tconst shouldDisplayPresets = !myTool.drawingDidStart && myTool.enum === Tools.CreateScreen\n\t// {...props} includes the `selection` array, but we want to show presets\n\t// for all the ground nodes in the active scope, not a subset, so we unset\n\t// it here.\n\treturn (\n\t\t<>\n\t\t\t{shouldDisplayPresets && <CanvasFramePresets {...props} selection={undefined} />}\n\t\t\t<Create {...props} />\n\t\t</>\n\t)\n}\n", "import React from \"react\"\nimport type { CreateTool } from \"./Create.tsx\"\nimport { Create } from \"./Create.tsx\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\n\ninterface Props extends ToolPropsWithManagerProps<CreateTool> {\n\toval?: boolean\n}\n\nexport class CreateShape extends React.Component<Props> {\n\toverride render() {\n\t\treturn <Create {...this.props} />\n\t}\n}\n", "import React from \"react\"\nimport { Create } from \"./Create.tsx\"\nimport type { CreateTextTool } from \"./CreateTextTool.ts\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\n\nexport class CreateText extends React.Component<ToolPropsWithManagerProps<CreateTextTool>> {\n\toverride render() {\n\t\tconst tool = this.props.myTool\n\t\tconst { canvasMousePosition, canvasMouseDownPosition } = tool.engine.stores.mouseStore.latest\n\t\ttool.helper.showTooltip = tool.pastMinimumDrag(canvasMousePosition, canvasMouseDownPosition)\n\t\treturn <Create {...this.props} />\n\t}\n}\n", "import React from \"react\"\nimport { Distances } from \"../canvas-hud/Distances.tsx\"\nimport type { GuideMoveTool } from \"./GuideMoveTool.ts\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\n\nexport class GuideMove extends React.Component<ToolPropsWithManagerProps<GuideMoveTool>> {\n\toverride render() {\n\t\tconst { altKey, myTool, ...rest } = this.props\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{altKey ? (\n\t\t\t\t\t<Distances\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\thighlightedGuide={myTool.engine.stores.guidesStore.ghost}\n\t\t\t\t\t\tselectedGuide={myTool.startGuideSelector}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t)\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { Overlay } from \"document/components/canvas-hud/Overlay.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, MaybeNodeID, NodeID, OverlayNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDrawableNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isOverlayNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { FloatingAlignment, FloatingPlacement } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tDEFAULT_FLOATING_ALIGNMENT,\n\tDEFAULT_FLOATING_PLACEMENT,\n\thasFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { GuideSelector } from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport {\n\tgetGuideAbsoluteOffset,\n\tgetGuideNode,\n\tgetOrthogonalAxis,\n} from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport { isRotatedAndNotAxisAligned } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { canBePositionFixed, isPositionFixed } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { convertFrameToCanvas, getParentViewportRect } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { Props as DistanceLineProps } from \"./DistanceLine.tsx\"\nimport { DistanceLine } from \"./DistanceLine.tsx\"\n\ntype DistanceLinePropsWithoutZoom = Omit<DistanceLineProps, \"zoom\">\ninterface Props {\n\ttree: CanvasTree\n\tzoom: number\n\tselection: NodeID[]\n\thighlight: MaybeNodeID\n\tselectedGuide?: GuideSelector\n\thighlightedGuide?: GuideSelector\n}\n\nfunction isChild(parent: CanvasNode, child: CanvasNode) {\n\treturn parent.some(node => node === child)\n}\n\nexport class Distances extends React.Component<Props, never> {\n\toverride render() {\n\t\tconst { tree, zoom, selection, highlight, selectedGuide, highlightedGuide } = this.props\n\t\tif (selection.length < 1 && !selectedGuide) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst singleSelectedNode = this.getSingleSelectedNode(tree, selection)\n\t\tconst isSelectionRotated = singleSelectedNode && isRotatedAndNotAxisAligned(singleSelectedNode)\n\n\t\tconst highlightNode = this.getReferenceNode(tree, highlight, selection, selectedGuide)\n\t\tconst isHighlightRotated = highlightNode && isRotatedAndNotAxisAligned(highlightNode)\n\t\tconst highlightBoundingBox = highlightNode ? convertFrameToCanvas(tree, highlightNode) : null\n\n\t\tif (!highlightBoundingBox && !highlightedGuide) return null\n\n\t\tconst selectionBoundingBox: Rect | null = this.getSelectionBoundingBox(tree, selection)\n\n\t\tconst lines = this.getDistanceLines(\n\t\t\ttree,\n\t\t\tselection,\n\t\t\tsingleSelectedNode,\n\t\t\tselectionBoundingBox,\n\t\t\tselectedGuide,\n\t\t\thighlightedGuide,\n\t\t\thighlightNode,\n\t\t\thighlightBoundingBox,\n\t\t)\n\t\tif (!lines) return null\n\n\t\treturn (\n\t\t\t<div style={{ pointerEvents: \"none\" }}>\n\t\t\t\t{lines.map(({ a, b, displayLength, dashed }) => (\n\t\t\t\t\t<DistanceLine key={`distance-(${a.x},${b.x})-(${a.y},${b.y})`} {...{ a, b, zoom, displayLength, dashed }} />\n\t\t\t\t))}\n\t\t\t\t{isSelectionRotated && this.renderRotationOverlay(selectionBoundingBox, zoom)}\n\t\t\t\t{isHighlightRotated && this.renderRotationOverlay(highlightBoundingBox, zoom)}\n\t\t\t</div>\n\t\t)\n\t}\n\n\tgetSingleSelectedNode = (tree: CanvasTree, selection: NodeID[]): CanvasNode | null => {\n\t\tif (selection.length !== 1) return null\n\t\treturn tree.getNode(selection[0])\n\t}\n\n\tgetSelectionBoundingBox = (tree: CanvasTree, selection: NodeID[]) => {\n\t\treturn Rect.merge(\n\t\t\t...selection.map(id => {\n\t\t\t\tconst node = tree.getNode(id) as CanvasNode\n\t\t\t\treturn convertFrameToCanvas(tree, node)\n\t\t\t}),\n\t\t)\n\t}\n\n\tgetDistanceLines = (\n\t\ttree: CanvasTree,\n\t\tselection: NodeID[],\n\t\tsingleSelectedNode: CanvasNode | null,\n\t\tselectionBoundingBox: Rect | null,\n\t\tselectedGuide: GuideSelector | undefined,\n\t\thighlightedGuide: GuideSelector | undefined,\n\t\thighlightNode: CanvasNode | null,\n\t\thighlightBoundingBox: Rect | null,\n\t): DistanceLinePropsWithoutZoom[] | null => {\n\t\t// selection is a guide\n\t\tif (selectedGuide) {\n\t\t\treturn this.getDistanceLinesForSelectedGuide(tree, selectedGuide, highlightedGuide, highlightBoundingBox)\n\t\t} else if (\n\t\t\tsingleSelectedNode &&\n\t\t\t((canBePositionFixed(tree, singleSelectedNode) && isPositionFixed(singleSelectedNode)) ||\n\t\t\t\tisOverlayNode(singleSelectedNode))\n\t\t) {\n\t\t\treturn this.getDistanceLinesToViewportRect(tree, singleSelectedNode, selectionBoundingBox)\n\t\t} else if (singleSelectedNode && hasFloatingPosition(singleSelectedNode)) {\n\t\t\treturn this.getDistanceLinesForFloatingNode(tree, singleSelectedNode, selectionBoundingBox)\n\t\t} else if (singleSelectedNode || selection.length > 1) {\n\t\t\t// selection is frame(s)\n\t\t\treturn this.getDistanceLinesForSelectedFrames(\n\t\t\t\ttree,\n\t\t\t\tsingleSelectedNode,\n\t\t\t\tselectionBoundingBox,\n\t\t\t\thighlightedGuide,\n\t\t\t\thighlightNode,\n\t\t\t\thighlightBoundingBox,\n\t\t\t)\n\t\t}\n\t\treturn null\n\t}\n\n\tgetDistanceLinesForFloatingNode = (tree: CanvasTree, selectedNode: CanvasNode, selectionBoundingBox: Rect | null) => {\n\t\tif (!selectionBoundingBox) return null\n\t\tif (!hasFloatingPosition(selectedNode)) return null\n\n\t\tconst anchorNode = tree.getParent(selectedNode.id)\n\t\tif (!anchorNode) return null\n\n\t\tconst lines: DistanceLinePropsWithoutZoom[] = []\n\t\tconst anchorRect = convertFrameToCanvas(tree, anchorNode)\n\n\t\tconst { floatingRectX, anchorRectX } = this.getXPositionOnRects(\n\t\t\tselectionBoundingBox,\n\t\t\tanchorRect,\n\t\t\tselectedNode.floatingPlacement,\n\t\t\tselectedNode.floatingAlignment,\n\t\t)\n\t\tconst { floatingRectY, anchorRectY } = this.getYPositionOnRects(\n\t\t\tselectionBoundingBox,\n\t\t\tanchorRect,\n\t\t\tselectedNode.floatingPlacement,\n\t\t\tselectedNode.floatingAlignment,\n\t\t)\n\n\t\tlines.push({\n\t\t\ta: { x: floatingRectX, y: floatingRectY },\n\t\t\tb: { x: anchorRectX, y: floatingRectY },\n\t\t\tdisplayLength: true,\n\t\t})\n\t\tlines.push({\n\t\t\ta: { x: anchorRectX, y: floatingRectY },\n\t\t\tb: { x: anchorRectX, y: anchorRectY },\n\t\t\tdisplayLength: true,\n\t\t})\n\n\t\treturn lines\n\t}\n\n\tgetXPositionOnRects = (\n\t\tfloatingRect: Rect,\n\t\tanchorRect: Rect,\n\t\tplacement: FloatingPlacement = DEFAULT_FLOATING_PLACEMENT,\n\t\talignment: FloatingAlignment = DEFAULT_FLOATING_ALIGNMENT,\n\t) => {\n\t\tlet floatingRectX: number | null = null\n\t\tlet anchorRectX: number | null = null\n\t\tswitch (placement) {\n\t\t\tcase \"left\": {\n\t\t\t\tfloatingRectX = Rect.maxX(floatingRect)\n\t\t\t\tanchorRectX = Rect.minX(anchorRect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"right\": {\n\t\t\t\tfloatingRectX = Rect.minX(floatingRect)\n\t\t\t\tanchorRectX = Rect.maxX(anchorRect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"top\":\n\t\t\tcase \"bottom\": {\n\t\t\t\tswitch (alignment) {\n\t\t\t\t\tcase \"start\": {\n\t\t\t\t\t\tfloatingRectX = Rect.minX(floatingRect)\n\t\t\t\t\t\tanchorRectX = Rect.minX(anchorRect)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"center\": {\n\t\t\t\t\t\tfloatingRectX = Rect.center(floatingRect).x\n\t\t\t\t\t\tanchorRectX = Rect.center(anchorRect).x\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"end\": {\n\t\t\t\t\t\tfloatingRectX = Rect.maxX(floatingRect)\n\t\t\t\t\t\tanchorRectX = Rect.maxX(anchorRect)\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(alignment)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(placement)\n\t\t}\n\n\t\treturn { floatingRectX, anchorRectX }\n\t}\n\n\tgetYPositionOnRects = (\n\t\tfloatingRect: Rect,\n\t\tanchorRect: Rect,\n\t\tplacement: FloatingPlacement = DEFAULT_FLOATING_PLACEMENT,\n\t\talignment: FloatingAlignment = DEFAULT_FLOATING_ALIGNMENT,\n\t) => {\n\t\tlet floatingRectY: number | null = null\n\t\tlet anchorRectY: number | null = null\n\t\tswitch (placement) {\n\t\t\tcase \"top\": {\n\t\t\t\tfloatingRectY = Rect.maxY(floatingRect)\n\t\t\t\tanchorRectY = Rect.minY(anchorRect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"bottom\": {\n\t\t\t\tfloatingRectY = Rect.minY(floatingRect)\n\t\t\t\tanchorRectY = Rect.maxY(anchorRect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"left\":\n\t\t\tcase \"right\": {\n\t\t\t\tswitch (alignment) {\n\t\t\t\t\tcase \"start\": {\n\t\t\t\t\t\tfloatingRectY = Rect.minY(floatingRect)\n\t\t\t\t\t\tanchorRectY = Rect.minY(anchorRect)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"center\": {\n\t\t\t\t\t\tfloatingRectY = Rect.center(floatingRect).y\n\t\t\t\t\t\tanchorRectY = Rect.center(anchorRect).y\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"end\": {\n\t\t\t\t\t\tfloatingRectY = Rect.maxY(floatingRect)\n\t\t\t\t\t\tanchorRectY = Rect.maxY(anchorRect)\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(alignment)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(placement)\n\t\t}\n\n\t\treturn { floatingRectY, anchorRectY }\n\t}\n\n\tgetDistanceLinesForSelectedGuide = (\n\t\ttree: CanvasTree,\n\t\tselectedGuide: GuideSelector,\n\t\thighlightedGuide: GuideSelector | undefined,\n\t\thighlightBoundingBox: Rect | null,\n\t) => {\n\t\tconst guideToGuide = !!highlightedGuide\n\t\tconst guideToFrame = !!highlightBoundingBox\n\t\tif (guideToGuide) {\n\t\t\treturn this.getLineFromGuideToGuide(tree, selectedGuide, highlightedGuide)\n\t\t} else if (guideToFrame) {\n\t\t\treturn this.getLinesFromGuideToRect(tree, selectedGuide, highlightBoundingBox)\n\t\t}\n\n\t\treturn null\n\t}\n\n\tgetDistanceLinesForSelectedFrames = (\n\t\ttree: CanvasTree,\n\t\tsingleSelectedNode: CanvasNode | null,\n\t\tselectionBoundingBox: Rect | null,\n\t\thighlightedGuide: GuideSelector | undefined,\n\t\thighlightNode: CanvasNode | null,\n\t\thighlightBoundingBox: Rect | null,\n\t) => {\n\t\tconst frameToGuide = selectionBoundingBox && highlightedGuide\n\t\tconst frameToFrame = selectionBoundingBox && highlightBoundingBox\n\t\tif (frameToGuide) {\n\t\t\treturn this.getLinesFromGuideToRect(tree, highlightedGuide, selectionBoundingBox)\n\t\t} else if (frameToFrame) {\n\t\t\treturn this.getLinesFromRectToRect(singleSelectedNode, selectionBoundingBox, highlightNode, highlightBoundingBox)\n\t\t}\n\n\t\treturn null\n\t}\n\n\tgetDistanceLinesToViewportRect = (\n\t\ttree: CanvasTree,\n\t\tselectedNode: (CanvasNode & WithPositionType) | OverlayNode,\n\t\tselectionBoundingBox: Rect | null,\n\t) => {\n\t\tif (!selectionBoundingBox) return null\n\t\tif (!isPinnable(selectedNode)) return null\n\t\tconst breakpoint = tree.getParent(selectedNode.id)\n\t\tif (!breakpoint || !isBreakpointVariant(breakpoint)) return null\n\t\tconst viewportRect = getParentViewportRect(tree, selectedNode)\n\t\tif (!viewportRect) return null\n\t\tconst lines = this.getLinesFromRectToRect(selectedNode, selectionBoundingBox, breakpoint, viewportRect)\n\n\t\treturn lines\n\t}\n\n\t// The reference node is either the highlighted node, or the parent node of\n\t// the selected node/guide.\n\tgetReferenceNode = (\n\t\ttree: CanvasTree,\n\t\thighlightId: MaybeNodeID | undefined,\n\t\tselection: NodeID[],\n\t\tselectedGuide: GuideSelector | undefined,\n\t) => {\n\t\tlet referenceNode: CanvasNode | null = null\n\n\t\tconst showDistanceToParent = highlightId == null || selection.includes(highlightId)\n\t\tif (showDistanceToParent) {\n\t\t\tif (selectedGuide) {\n\t\t\t\thighlightId = selectedGuide.nodeId\n\t\t\t} else {\n\t\t\t\thighlightId = this.getCommonParentIdForSelection(tree, selection)\n\t\t\t}\n\t\t}\n\n\t\treferenceNode = highlightId ? tree.getNode(highlightId) : null\n\t\treturn isScopeNode(referenceNode) ? null : referenceNode\n\t}\n\n\tgetCommonParentIdForSelection = (tree: CanvasTree, selection: NodeID[]) => {\n\t\tconst parentIds = selection.map(id => {\n\t\t\tconst node = tree.getNode(id)\n\t\t\treturn node ? tree.getParentId(node) : null\n\t\t})\n\t\tconst commonParentId = commonValue(parentIds)\n\t\tif (!isString(commonParentId)) return null\n\n\t\tconst commonParentNode = tree.getNode(commonParentId)\n\t\tif (!commonParentNode || !isDrawableNode(commonParentNode)) return null\n\n\t\treturn commonParentId\n\t}\n\n\tgetLineFromGuideToGuide = (tree: CanvasTree, guideA: GuideSelector, guideB: GuideSelector) => {\n\t\tif (guideA.axis !== guideB.axis) return null\n\n\t\tconst lines: DistanceLinePropsWithoutZoom[] = []\n\t\tconst { axis } = guideA\n\t\tconst orthogonalAxis = getOrthogonalAxis(axis)\n\t\tconst absOffsetB = getGuideAbsoluteOffset(tree, guideB)\n\t\tconst absOffsetA = getGuideAbsoluteOffset(tree, guideA)\n\n\t\tlet pos\n\t\tconst lengthKey = getLengthKey(axis)\n\t\t// distance line always goes from guideA to guideB\n\t\tif (guideA.nodeId === tree.root.id) {\n\t\t\tconst canvasRect = engine.stores.canvasStore.getCanvasVisibleRect()\n\t\t\tpos = canvasRect[orthogonalAxis] + canvasRect[lengthKey] / 2\n\t\t} else {\n\t\t\tconst guideNodeA = getGuideNode(tree, guideA)\n\t\t\tif (!guideNodeA) return null\n\t\t\tconst rectA = convertFrameToCanvas(tree, guideNodeA)\n\t\t\tpos = rectA[orthogonalAxis] + rectA[lengthKey] / 2\n\t\t}\n\t\tconst a = { [axis]: absOffsetA, [orthogonalAxis]: pos } as Point\n\t\tconst b = { [axis]: absOffsetB, [orthogonalAxis]: pos } as Point\n\n\t\tif (!a || !b) return null\n\t\tlines.push({ a, b, displayLength: true })\n\t\treturn lines\n\t}\n\n\tgetLinesFromGuideToRect = (tree: CanvasTree, guide: GuideSelector, rect: Rect) => {\n\t\tconst lines: DistanceLinePropsWithoutZoom[] = []\n\t\tconst { nodeId: guideNodeId, axis } = guide\n\t\tconst absOffset = getGuideAbsoluteOffset(tree, guide)\n\t\tif (!guideNodeId || !absOffset) return null\n\n\t\tconst lengthKey = getLengthKey(axis)\n\t\tconst widthKey = getWidthKey(axis)\n\t\tconst orthogonalAxis = getOrthogonalAxis(axis)\n\t\tconst rectStart = rect[axis]\n\t\tconst rectEnd = rectStart + rect[widthKey]\n\t\tconst pos = rect[orthogonalAxis] + rect[lengthKey] / 2\n\t\tconst a = { [axis]: absOffset, [orthogonalAxis]: pos } as Point\n\t\tif (absOffset < rectStart) {\n\t\t\tconst b = { [axis]: rectStart, [orthogonalAxis]: pos } as Point\n\t\t\tlines.push({ a, b, displayLength: true })\n\t\t} else if (absOffset > rectEnd) {\n\t\t\tconst b = { [axis]: rectEnd, [orthogonalAxis]: pos } as Point\n\t\t\tlines.push({ a, b, displayLength: true })\n\t\t} else if (absOffset > rectStart && absOffset < rectEnd) {\n\t\t\tconst b = { [axis]: rectStart, [orthogonalAxis]: pos } as Point\n\t\t\tlines.push({ a, b, displayLength: true })\n\t\t\tconst b2 = { [axis]: rectEnd, [orthogonalAxis]: pos } as Point\n\t\t\tlines.push({ a, b: b2, displayLength: true })\n\t\t}\n\n\t\treturn lines\n\t}\n\n\tgetLinesFromRectToRect = (\n\t\tselectedNode: CanvasNode | null,\n\t\tselectionRect: Rect,\n\t\thighlightedNode: CanvasNode | null,\n\t\thighlightRect: Rect,\n\t) => {\n\t\tconst intersects = Rect.intersects(highlightRect, selectionRect)\n\n\t\tconst lines: DistanceLinePropsWithoutZoom[] = []\n\n\t\tconst selectedChildNodeIntersectsWithParentRect =\n\t\t\tselectedNode && highlightedNode && intersects && isChild(selectedNode, highlightedNode)\n\t\tconst selectedParentNodeIntersectsWithChildRect =\n\t\t\tselectedNode && highlightedNode && intersects && isChild(highlightedNode, selectedNode)\n\n\t\tif (Rect.containsRect(selectionRect, highlightRect)) {\n\t\t\tlines.push(...containedLinesOverlap(selectionRect, highlightRect))\n\t\t} else if (Rect.containsRect(highlightRect, selectionRect)) {\n\t\t\tlines.push(...containedLinesOverlap(highlightRect, selectionRect))\n\t\t} else if (selectedChildNodeIntersectsWithParentRect) {\n\t\t\tlines.push(...containedLinesOverlap(selectionRect, highlightRect))\n\t\t} else if (selectedParentNodeIntersectsWithChildRect) {\n\t\t\tlines.push(...containedLinesOverlap(highlightRect, selectionRect))\n\t\t} else if (intersects) {\n\t\t\tconst highlightCorners = Rect.cornerPoints(highlightRect)\n\t\t\tconst selectionCorners = Rect.cornerPoints(selectionRect)\n\n\t\t\thighlightCorners.forEach((c1, index) => {\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: highlightCorners and selectionCorners are the same union type and have the same length, so c2 must be defined\n\t\t\t\tconst c2 = selectionCorners[index]!\n\t\t\t\tif (pointIn9SliceMidFrame(c1, selectionRect) && pointIn9SliceMidFrame(c2, highlightRect)) {\n\t\t\t\t\tconst minX = Math.min(c1.x, c2.x)\n\t\t\t\t\tconst maxX = Math.max(c1.x, c2.x)\n\t\t\t\t\tconst minY = Math.min(c1.y, c2.y)\n\t\t\t\t\tconst maxY = Math.max(c1.y, c2.y)\n\t\t\t\t\tconst connection = { x: Math.min(c1.x, c2.x), y: Math.min(c1.y, c2.y) }\n\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\tconnection.x = maxX\n\t\t\t\t\t}\n\t\t\t\t\tif (index === 2) {\n\t\t\t\t\t\tconnection.x = maxX\n\t\t\t\t\t\tconnection.y = maxY\n\t\t\t\t\t}\n\t\t\t\t\tif (index === 3) {\n\t\t\t\t\t\tconnection.y = maxY\n\t\t\t\t\t}\n\t\t\t\t\tlet flipX = connection.x !== maxX ? connection.x < maxX : connection.x < minX\n\t\t\t\t\tlet flipY = connection.y !== maxY ? connection.y < maxY : connection.y < minY\n\n\t\t\t\t\tif (c1.x !== connection.x) {\n\t\t\t\t\t\tconst tempX = flipX\n\t\t\t\t\t\tflipX = flipY\n\t\t\t\t\t\tflipY = tempX\n\t\t\t\t\t}\n\t\t\t\t\tlines.push({ a: c1, b: connection, flipSide: flipX, displayLength: true })\n\t\t\t\t\tlines.push({ a: c2, b: connection, flipSide: flipY, displayLength: true })\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\tif (Rect.maxX(highlightRect) < selectionRect.x) {\n\t\t\t\t// distance to the left\n\t\t\t\tconst y = selectionRect.y + selectionRect.height / 2\n\t\t\t\tconst a = { x: selectionRect.x, y }\n\t\t\t\tconst b = { x: Rect.maxX(highlightRect), y }\n\t\t\t\tlines.push({ a, b, displayLength: true })\n\n\t\t\t\tif (Rect.maxY(highlightRect) < y) {\n\t\t\t\t\tconst sA = { ...b, y: Rect.maxY(highlightRect) }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t} else if (highlightRect.y > y) {\n\t\t\t\t\tconst sA = { ...b, y: highlightRect.y }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t}\n\t\t\t} else if (Rect.maxX(selectionRect) < highlightRect.x) {\n\t\t\t\t// distance to the right\n\t\t\t\tconst y = selectionRect.y + selectionRect.height / 2\n\t\t\t\tconst a = { x: Rect.maxX(selectionRect), y }\n\t\t\t\tconst b = { x: highlightRect.x, y }\n\t\t\t\tlines.push({ a, b, displayLength: true })\n\n\t\t\t\tif (Rect.maxY(highlightRect) < y) {\n\t\t\t\t\tconst sA = { ...b, y: Rect.maxY(highlightRect) }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t} else if (highlightRect.y > y) {\n\t\t\t\t\tconst sA = { ...b, y: highlightRect.y }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Rect.maxY(highlightRect) < selectionRect.y) {\n\t\t\t\t// distance to top\n\t\t\t\tconst x = selectionRect.x + selectionRect.width / 2\n\t\t\t\tconst a = { x, y: selectionRect.y }\n\t\t\t\tconst b = { x, y: Rect.maxY(highlightRect) }\n\t\t\t\tlines.push({ a, b, displayLength: true })\n\n\t\t\t\tif (Rect.maxX(highlightRect) < x) {\n\t\t\t\t\tconst sA = { ...b, x: Rect.maxX(highlightRect) }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t} else if (highlightRect.x > x) {\n\t\t\t\t\tconst sA = { ...b, x: highlightRect.x }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t}\n\t\t\t} else if (Rect.maxY(selectionRect) < highlightRect.y) {\n\t\t\t\t// distance to bottom\n\t\t\t\tconst x = selectionRect.x + selectionRect.width / 2\n\t\t\t\tconst a = { x, y: Rect.maxY(selectionRect) }\n\t\t\t\tconst b = { x, y: highlightRect.y }\n\t\t\t\tlines.push({ a, b, displayLength: true })\n\n\t\t\t\tif (Rect.maxX(highlightRect) < x) {\n\t\t\t\t\tconst sA = { ...b, x: Rect.maxX(highlightRect) }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t} else if (highlightRect.x > x) {\n\t\t\t\t\tconst sA = { ...b, x: highlightRect.x }\n\t\t\t\t\tlines.push({ a: sA, b, dashed: true })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn lines\n\t}\n\n\trenderRotationOverlay = (boundingBox: Rect | null, zoom: number) => {\n\t\tif (!boundingBox) return null\n\n\t\treturn (\n\t\t\t<Overlay\n\t\t\t\tpoints={Rect.cornerPoints(Rect.multiply(boundingBox, zoom))}\n\t\t\t\tdashed\n\t\t\t\tborderColor=\"magenta\"\n\t\t\t\tborderWidth={1}\n\t\t\t\troundToOutside={false}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nconst getLengthKey = (axis: GuideSelector[\"axis\"]): \"height\" | \"width\" => {\n\treturn axis === \"x\" ? \"height\" : \"width\"\n}\n\nconst getWidthKey = (axis: GuideSelector[\"axis\"]): \"height\" | \"width\" => {\n\treturn axis === \"x\" ? \"width\" : \"height\"\n}\n\n// Check if the point locates in the shadowed area around a frame\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// \u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\n// \u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502  Frame   \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\n// \u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\n// \u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\n//          \u2502\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u25A7\u2502\nconst pointIn9SliceMidFrame = (point: Point, frame: Rect) => {\n\tif (Rect.containsPoint(frame, point)) {\n\t\treturn false\n\t}\n\tif (point.y > frame.y && point.y < Rect.maxY(frame)) {\n\t\treturn true\n\t}\n\treturn point.x > frame.x && point.x < Rect.maxX(frame)\n}\n\nconst containedLinesOverlap = (outerBox: Rect, innerBox: Rect) => {\n\tconst lines: DistanceLinePropsWithoutZoom[] = []\n\n\tconst innerPositions = Rect.positions(innerBox)\n\tconst outerPositions = Rect.positions(outerBox)\n\tconst midPositions = Rect.containsRect(outerBox, innerBox)\n\t\t? innerPositions\n\t\t: Rect.positions(Rect.intersection(innerBox, outerBox))\n\n\tconst leftA = { x: innerPositions.minX, y: midPositions.midY }\n\tconst leftB = { x: outerPositions.minX, y: midPositions.midY }\n\tlines.push({ a: leftA, b: leftB, displayLength: true })\n\n\tconst rightA = { x: innerPositions.maxX, y: midPositions.midY }\n\tconst rightB = { x: outerPositions.maxX, y: midPositions.midY }\n\tlines.push({ a: rightA, b: rightB, displayLength: true })\n\n\tconst topA = { x: midPositions.midX, y: innerPositions.minY }\n\tconst topB = { x: midPositions.midX, y: outerPositions.minY }\n\tlines.push({ a: topA, b: topB, displayLength: true })\n\n\tconst bottomA = { x: midPositions.midX, y: innerPositions.maxY }\n\tconst bottomB = { x: midPositions.midX, y: outerPositions.maxY }\n\tlines.push({ a: bottomA, b: bottomB, displayLength: true })\n\n\treturn lines\n}\n", "import { Point } from \"library/render/types/Point.ts\"\nimport type React from \"react\"\n\nexport interface Props {\n\ta: Point\n\tb: Point\n\tzoom: number\n\tdashed?: boolean\n\tdisplayLength?: boolean\n\tflipSide?: boolean\n}\n\nexport function DistanceLine({ a, b, zoom, dashed, displayLength, flipSide }: Props) {\n\tconst start = Point.angle(a, b) < 0 ? a : b\n\tconst end = Point.angle(a, b) < 0 ? b : a\n\tconst style: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\twidth: `1px`,\n\t\theight: `${Point.distance(start, end) * zoom}px`,\n\t\ttransformOrigin: \"0 0\",\n\t\tborderLeft: dashed ? \"1px dashed magenta\" : \"1px solid magenta\",\n\t\ttransform: `translate(${Math.round(start.x * zoom)}px, ${Math.round(\n\t\t\tstart.y * zoom,\n\t\t)}px) translateZ(0) rotate(${Point.angle(start, end).toFixed(4)}deg)`,\n\t}\n\n\tconst length = Math.round(Point.distance(start, end))\n\n\tif (length === 0) {\n\t\treturn <noscript />\n\t}\n\n\tconst line = <div style={style} />\n\n\tif (!displayLength) return line\n\n\tconst isVertical = start.x === end.x\n\n\tconst labelStyle: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\tleft: ((start.x + end.x) / 2) * zoom,\n\t\ttop: ((start.y + end.y) / 2) * zoom,\n\t\tpadding: \"2px 4px\",\n\t\tborderRadius: 10,\n\t\tbackground: \"magenta\",\n\t\tcolor: \"white\",\n\t\tfontSize: \"10px\",\n\t\tlineHeight: \"1em\",\n\t\ttransform: transform(isVertical, flipSide === true),\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{line}\n\t\t\t<div style={labelStyle}>{length}</div>\n\t\t</>\n\t)\n}\n\nfunction transform(isVertical: boolean, isFlipped: boolean) {\n\tif (isVertical) {\n\t\treturn `translateX(-${isFlipped ? 100 : 0}%) translateX(${isFlipped ? -4 : 4}px) translateY(-50%)`\n\t} else {\n\t\treturn `translateY(-${isFlipped ? 100 : 0}%) translateY(${isFlipped ? -4 : 4}px) translateX(-50%)`\n\t}\n}\n", "import { Distances } from \"document/components/canvas-hud/Distances.tsx\"\nimport React from \"react\"\nimport type { HighlightTool } from \"./HighlightTool.ts\"\nimport type { ToolPropsWithManagerPropsAndState } from \"./props.ts\"\n\nexport class Highlight extends React.Component<ToolPropsWithManagerPropsAndState<HighlightTool>> {\n\toverride render() {\n\t\tconst { isViewOnly, altKey } = this.props\n\t\tconst { engine } = this.props.myTool\n\t\tconst { guidesStore, chromeStore } = engine.stores\n\n\t\tif (chromeStore.isHistoryModeActive) return null\n\n\t\tconst isPreviewingLocale = chromeStore.isPreviewingLocaleOnCanvas\n\t\tconst showDistances = altKey || (!isPreviewingLocale && isViewOnly)\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{showDistances && (\n\t\t\t\t\t<Distances {...this.props} selectedGuide={guidesStore.selected} highlightedGuide={guidesStore.highlighted} />\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n}\n", "import { InsertionIndicator } from \"document/components/canvas-hud/InsertionIndicator.tsx\"\nimport { ParentHighlight } from \"document/components/canvas-hud/ParentHighlight.tsx\"\nimport { defaultStackDirection } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport React from \"react\"\nimport { ReorderHandle } from \"../canvas-hud/ReorderHandles.tsx\"\nimport type { MoveTool } from \"./MoveTool.ts\"\nimport type { ToolProps } from \"./props.ts\"\nimport { getTintColor } from \"./utils/getTintColor.ts\"\nimport { withSnapping } from \"./utils/withSnapping.tsx\"\n\nclass Move extends React.Component<ToolProps<MoveTool> & { children?: React.ReactNode }> {\n\toverride render() {\n\t\tconst tool = this.props.myTool\n\n\t\tconst { stackOrGridInsertionLine, commonStackOrGridParentAtStart } = tool\n\t\tconst { tree } = tool.engine\n\t\tconst { selectionStore, canvasStore } = tool.engine.stores\n\n\t\tconst reorderNode = tool.options?.reorderNode\n\t\tif (reorderNode && commonStackOrGridParentAtStart) {\n\t\t\tif (selectionStore.ids.length !== 1) return null\n\t\t\tconst singleSelectedNode = selectionStore.ids[0]\n\n\t\t\tconst variant = reorderNode.id === singleSelectedNode ? \"tint\" : \"tintDimmed\"\n\t\t\tconst tint = getTintColor(reorderNode)\n\t\t\tconst direction =\n\t\t\t\tcommonStackOrGridParentAtStart.layout === \"grid\"\n\t\t\t\t\t? \"horizontal\"\n\t\t\t\t\t: (commonStackOrGridParentAtStart.resolveValue(\"stackDirection\") ?? defaultStackDirection)\n\n\t\t\treturn (\n\t\t\t\t<ReorderHandle\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tnodeId={reorderNode.id}\n\t\t\t\t\ttint={tint}\n\t\t\t\t\treorderDimension={tool.options.directionLock ? \"single\" : \"multi\"}\n\t\t\t\t\tdirection={direction}\n\t\t\t\t\tzoom={canvasStore.zoom}\n\t\t\t\t\ttree={tree}\n\t\t\t\t\tstyle={{ cursor: \"grabbing\" }}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\tconst visibleCanvasRect = canvasStore.getCanvasVisibleRect()\n\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<ParentHighlight\n\t\t\t\t\tids={[...tool.highlightedParents]}\n\t\t\t\t\ttree={tree}\n\t\t\t\t\tzoom={canvasStore.zoom}\n\t\t\t\t\tvisibleCanvasRect={visibleCanvasRect}\n\t\t\t\t/>\n\t\t\t\t{this.props.children}\n\t\t\t\t<InsertionIndicator insertion={stackOrGridInsertionLine} zoom={canvasStore.zoom} />\n\t\t\t</div>\n\t\t)\n\t}\n}\n\nconst exportWithSnapping = withSnapping(Move)\nexport { exportWithSnapping as Move }\n", "import \"ReorderHandles.styles_ixh1de.wyw.css\"; export const handleContainer = \"handleContainer_h1fo4x6i\";\nexport const handle = \"handle_h12okbp\";\nexport const variants = {\n  tint: \"tint_t1w865l9\",\n  tintDimmed: \"tintDimmed_tbn1291\",\n  dimmed: \"dimmed_dw7wd68\"\n};", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRotated } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { convertFrameToCanvas, convertRectToCanvasWithRotation } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport type { StackDirection } from \"library/index.ts\"\nimport { Point } from \"library/index.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./ReorderHandles.styles.ts\"\n\ninterface HandleProps {\n\tvariant: styles.ReorderHandleVariant\n\ttint: string\n\tnodeId: NodeID\n\tzoom: number\n\ttree: CanvasTree\n\tdirection: StackDirection\n\treorderDimension?: \"multi\" | \"single\"\n\tstyle?: React.CSSProperties\n\tposition?: Rect\n\ttrackingType?: \"grid\" | \"stack\"\n}\n\nconst controlOffset = 8\nconst handleSize = 20\n\nfunction getRectForReorderHandle(\n\tnode: CanvasNode,\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\tzoom: number,\n\tdirection?: StackDirection,\n): Rect | null {\n\tif (isRotated(node)) return null\n\n\tconst nodeCanvasRectWithRotation = convertRectToCanvasWithRotation(tree, node, componentLoader)\n\tconst nodeRect = Rect.multiply(nodeCanvasRectWithRotation, zoom)\n\tconst roundedNodeRect = Rect.roundToOutside(nodeRect)\n\n\tconst minSize = handleSize * 1.5\n\tif (direction === \"horizontal\" && nodeRect.width < minSize) return null\n\tif (direction === \"vertical\" && nodeRect.height < minSize) return null\n\n\treturn direction === \"horizontal\"\n\t\t? {\n\t\t\t\theight: handleSize,\n\t\t\t\twidth: handleSize,\n\t\t\t\tx: roundedNodeRect.x + (roundedNodeRect.width - handleSize) / 2,\n\t\t\t\ty: roundedNodeRect.y + roundedNodeRect.height + controlOffset,\n\t\t\t}\n\t\t: {\n\t\t\t\theight: handleSize,\n\t\t\t\twidth: handleSize,\n\t\t\t\tx: roundedNodeRect.x - handleSize - controlOffset,\n\t\t\t\ty: roundedNodeRect.y + (roundedNodeRect.height - handleSize) / 2,\n\t\t\t}\n}\n\nfunction convertRectToLayout(rect: Rect): React.CSSProperties {\n\treturn {\n\t\tleft: rect.x,\n\t\ttop: rect.y,\n\t\theight: rect.height,\n\t\twidth: rect.width,\n\t}\n}\n\nconst exitStackHighlightTool = engine.scheduler.wrapHandler(() => {\n\tif (engine.stores.toolStore.tool === Tools.HighlightStackItem) engine.exitTool()\n})\n\nconst startToolStackHighlightTool = (id: NodeID) =>\n\tengine.scheduler.wrapHandler(() => {\n\t\t// Only interrupt the Highlight tool.\n\t\tif (engine.stores.toolStore.tool !== Tools.Highlight) return\n\t\tengine.setTool(Tools.HighlightStackItem, { node: id })\n\t})\n\nexport function ReorderHandle({\n\tvariant,\n\treorderDimension,\n\ttint,\n\tposition,\n\tnodeId,\n\ttree,\n\tzoom,\n\tdirection,\n\ttrackingType,\n\tstyle: outerStyle,\n}: HandleProps) {\n\tconst node = tree.get(nodeId)\n\tif (!node) return null\n\n\tconst controlPosition = position ?? getRectForReorderHandle(node, tree, engine.componentLoader, zoom, direction)\n\tif (!controlPosition) return null\n\n\tconst iconStyle: React.CSSProperties = {}\n\tif (direction === \"horizontal\") iconStyle.transform = \"rotate(90deg)\"\n\n\tconst style: React.CSSProperties = {\n\t\t...outerStyle,\n\t\t\"--tint\": tint,\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tclassName={styles.handleContainer}\n\t\t\tstyle={convertRectToLayout(controlPosition)}\n\t\t\tonMouseEnter={startToolStackHighlightTool(node.id)}\n\t\t\tonMouseLeave={exitStackHighlightTool}\n\t\t>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={cx(styles.handle, styles.variants[variant])}\n\t\t\t\tstyle={style}\n\t\t\t\tonMouseDown={() => {\n\t\t\t\t\tconst controlCenter = Rect.center(Rect.divide(controlPosition, zoom))\n\t\t\t\t\tconst nodeCanvasRect = convertFrameToCanvas(tree, node)\n\t\t\t\t\tconst nodeCenter = Rect.center(nodeCanvasRect)\n\t\t\t\t\tconst reorderOffset = Point.subtract(nodeCenter, controlCenter)\n\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tengine.setTool(Tools.Move, {\n\t\t\t\t\t\t\treorderNode: node,\n\t\t\t\t\t\t\tdirectionLock: reorderDimension !== \"multi\" ? direction : undefined,\n\t\t\t\t\t\t\treorderOffset,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tif (trackingType) {\n\t\t\t\t\t\t\trecord(\"canvas_layout_reorder\", {\n\t\t\t\t\t\t\t\tlayoutType: trackingType,\n\t\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t\tdimension: variant === \"tint\" ? \"selection\" : \"parent\",\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\t\t{reorderDimension === \"multi\" ? <IconReorderMulti /> : <IconReorder style={iconStyle} />}\n\t\t\t</button>\n\t\t</Stack>\n\t)\n}\n\nfunction IconReorder({ style }: { style: React.CSSProperties }) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" style={style}>\n\t\t\t<path\n\t\t\t\td=\"M 1 2.5 C 1 1.948 1.448 1.5 2 1.5 L 10 1.5 C 10.552 1.5 11 1.948 11 2.5 L 11 2.5 C 11 3.052 10.552 3.5 10 3.5 L 2 3.5 C 1.448 3.5 1 3.052 1 2.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 1 6 C 1 5.448 1.448 5 2 5 L 10 5 C 10.552 5 11 5.448 11 6 L 11 6 C 11 6.552 10.552 7 10 7 L 2 7 C 1.448 7 1 6.552 1 6 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 1 9.5 C 1 8.948 1.448 8.5 2 8.5 L 10 8.5 C 10.552 8.5 11 8.948 11 9.5 L 11 9.5 C 11 10.052 10.552 10.5 10 10.5 L 2 10.5 C 1.448 10.5 1 10.052 1 9.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconReorderMulti() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t<path\n\t\t\t\td=\"M 8.5 2 C 9.328 2 10 2.672 10 3.5 C 10 4.328 9.328 5 8.5 5 C 7.672 5 7 4.328 7 3.5 C 7 2.672 7.672 2 8.5 2 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 8.5 7 C 9.328 7 10 7.672 10 8.5 C 10 9.328 9.328 10 8.5 10 C 7.672 10 7 9.328 7 8.5 C 7 7.672 7.672 7 8.5 7 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 3.5 2 C 4.328 2 5 2.672 5 3.5 C 5 4.328 4.328 5 3.5 5 C 2.672 5 2 4.328 2 3.5 C 2 2.672 2.672 2 3.5 2 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 3.5 7 C 4.328 7 5 7.672 5 8.5 C 5 9.328 4.328 10 3.5 10 C 2.672 10 2 9.328 2 8.5 C 2 7.672 2.672 7 3.5 7 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { BorderRadiusHandle } from \"document/components/canvas-hud/BorderRadiusHandle.tsx\"\nimport { withRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport React from \"react\"\nimport type { RadiusTool } from \"./RadiusTool.ts\"\nimport type { ToolPropsWithManagerProps } from \"./props.ts\"\nimport { getTintColor } from \"./utils/getTintColor.ts\"\n\nexport class Radius extends React.Component<ToolPropsWithManagerProps<RadiusTool>> {\n\toverride render() {\n\t\tconst { selection, tree, zoom } = this.props\n\t\tconst node = tree.getNode(selection[0])\n\t\tif (!node || !withRadius(node) || isBreakpointVariant(node)) return null\n\t\treturn (\n\t\t\t<BorderRadiusHandle\n\t\t\t\tkey=\"borderRadiusHandle\"\n\t\t\t\tnode={node}\n\t\t\t\ttree={tree}\n\t\t\t\tisToolActive={this.props.myTool.mouseHasChanged}\n\t\t\t\tborderColor={getTintColor(node)}\n\t\t\t\tzoom={zoom}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import React from \"react\"\nimport type { ResizeTool } from \"./ResizeTool.ts\"\nimport type { ToolProps } from \"./props.ts\"\nimport { withSnapping } from \"./utils/withSnapping.tsx\"\n\nclass Resize extends React.Component<ToolProps<ResizeTool> & { children?: React.ReactNode }> {\n\toverride render() {\n\t\treturn this.props.children\n\t}\n}\n\nconst exportWithSnapping = withSnapping(Resize)\nexport { exportWithSnapping as Resize }\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport {\n\tArrow,\n\tArrowDirection,\n\tarrowPoints,\n\tpreferredArrowDirection,\n\trectStartPoint,\n\ttopAncestor,\n} from \"document/components/canvas-hud/Arrow.tsx\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isUserComponent } from \"document/models/CanvasTree/traits/utils/isUserComponent.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport type { SlotConnectTool } from \"./SlotConnectTool.ts\"\nimport type { ToolProps } from \"./props.ts\"\n\nexport class SlotConnect extends React.Component<ToolProps<SlotConnectTool>> {\n\toverride render() {\n\t\tconst { tree } = this.props.myTool.engine\n\t\tconst { selectionStore, treeStore, canvasStore, mouseStore } = this.props.myTool.engine.stores\n\t\tconst { canvasMousePosition } = mouseStore.latest\n\n\t\tconst firstId = selectionStore.ids[0]\n\t\tif (!firstId) return null\n\t\tconst node = tree.getNode(firstId)\n\t\tif (!node || !isCodeComponentNode(node)) return null\n\n\t\tconst sourceRect = tree.getRect(node)\n\t\tconst sourceMatrix = node.canvasMatrix()\n\t\tconst sourceCanvasRect = convertFrameToCanvas(tree, node)\n\n\t\tlet startDirection = preferredArrowDirection(sourceCanvasRect, { ...canvasMousePosition, width: 1, height: 1 })\n\t\tlet endDirection = preferredArrowDirection({ ...canvasMousePosition, width: 1, height: 1 }, sourceCanvasRect)\n\n\t\tconst start = rectStartPoint(sourceRect, sourceMatrix, ArrowDirection.Right)\n\t\tlet endPoint = canvasMousePosition\n\t\tlet offsetPoint: Point = { x: 0, y: 0 }\n\n\t\tconst highlightNode = treeStore.highlight ? tree.getNode(treeStore.highlight) : null\n\n\t\tif (highlightNode) {\n\t\t\tstartDirection = preferredArrowDirection(sourceCanvasRect, convertFrameToCanvas(tree, highlightNode))\n\t\t\tendDirection = preferredArrowDirection(convertFrameToCanvas(tree, highlightNode), sourceCanvasRect)\n\n\t\t\tconst destRect = tree.getRect(highlightNode)\n\t\t\tconst { end, offset } = arrowPoints(\n\t\t\t\ttree,\n\t\t\t\tsourceRect,\n\t\t\t\tnode.canvasMatrix(),\n\t\t\t\tdestRect,\n\t\t\t\thighlightNode.canvasMatrix(),\n\t\t\t\tstartDirection,\n\t\t\t\ttopAncestor(tree, node),\n\t\t\t)\n\t\t\tendPoint = end\n\t\t\toffsetPoint = offset\n\t\t}\n\n\t\treturn (\n\t\t\t<Arrow\n\t\t\t\ttintColor={isUserComponent(node) ? colors.componentTint : colors.tint}\n\t\t\t\tactive\n\t\t\t\tstartX={start.x}\n\t\t\t\tstartY={start.y}\n\t\t\t\tendX={endPoint.x}\n\t\t\t\tendY={endPoint.y}\n\t\t\t\tstartDirection={startDirection}\n\t\t\t\tendDirection={endDirection}\n\t\t\t\tstartOffsetX={offsetPoint.x}\n\t\t\t\tstartOffsetY={offsetPoint.y}\n\t\t\t\tbackground\n\t\t\t\tshowArrowHead={false}\n\t\t\t\tzoom={canvasStore.zoom}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import \"ToolManager.styles_4x5cxl.wyw.css\"; export const canvasSectionButtonWidth = 112;\nexport const generatedHighlightAnimation = \"generatedHighlightAnimation_gn6lneq\";", "import { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, NodeID, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { getActiveGradient, getGradientType } from \"document/models/Gradient.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { SampleColorTool } from \"../SampleColor.tsx\"\nimport { SampleColor } from \"../SampleColor.tsx\"\nimport type { SubToolManagerProps } from \"../props.ts\"\nimport { GradientAngleTool } from \"./GradientAngleTool.tsx\"\nimport { GradientCenterMoveTool } from \"./GradientCenterMoveTool.tsx\"\nimport { GradientStopMoveTool } from \"./GradientStopMoveTool.tsx\"\nimport type { GradientToolManagerToolType } from \"./GradientToolManagerTool.tsx\"\nimport { RadialGradientResizeTool } from \"./RadialGradientResizeTool.tsx\"\nimport { GradientHandles } from \"./controls/GradientHandles.tsx\"\nimport type { VekterGradientTool } from \"./types.ts\"\n\ntype Props = { colorStopSelection: NodeID | undefined } & SubToolManagerProps<GradientToolManagerToolType>\n\ntype GradientNode = (CanvasNode & (WithFill | WithMasks)) | RichTextNode\n\nexport class GradientToolManager extends React.Component<Props> {\n\t// FIXME: ! is unsafe; the gradientEngine is assigned in UNSAFE_componentWillMount, not in the constructor,\n\t// so if the external code forgets to do that, we\u2019ll have a runtime error\n\tgradientEngine!: GradientToolManagerToolType\n\n\toverride UNSAFE_componentWillMount() {\n\t\tthis.gradientEngine = this.props.myTool\n\t}\n\n\toverride render() {\n\t\tconst { gradientNode } = this.gradientEngine\n\t\tif (!gradientNode) return null\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{this.handles(gradientNode)}\n\t\t\t\t{this.activeToolElement(gradientNode)}\n\t\t\t</>\n\t\t)\n\t}\n\n\tactiveToolElement = (_node: GradientNode) => {\n\t\tconst { gradientEngine } = this\n\t\tconst { tool } = gradientEngine\n\t\tif (!tool) return null\n\n\t\tswitch (tool.__class) {\n\t\t\tcase ClassDiscriminator.SampleColorTool: {\n\t\t\t\t// TODO replace with yet another subtool manager\n\t\t\t\tconst vekterEngine = new VekterEngine()\n\t\t\t\tvekterEngine.setTool(Tools.SampleColor)\n\t\t\t\tvekterEngine.setExit(gradientEngine.setDefault)\n\t\t\t\treturn <SampleColor {...this.props} myTool={vekterEngine.tool as SampleColorTool} />\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn null\n\t\t}\n\t}\n\n\tonRotate = VekterEngine.shared().scheduler.wrapHandler(() => {\n\t\tconst { gradientNode } = this.gradientEngine\n\t\tif (!gradientNode) return\n\n\t\tswitch (getGradientType(gradientNode, this.gradientEngine)) {\n\t\t\tcase \"linear-gradient\":\n\t\t\tcase \"conic-gradient\":\n\t\t\t\tthis.gradientEngine.setTool(new GradientAngleTool(this.gradientEngine.engine))\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t})\n\n\tonMoveConicGradient = VekterEngine.shared().scheduler.wrapHandler(() => {\n\t\tthis.gradientEngine.setTool(new GradientCenterMoveTool(this.gradientEngine.engine))\n\t})\n\n\tonSelectStop = VekterEngine.shared().scheduler.wrapHandler((id: NodeID, index: number) => {\n\t\t// Use the global VekterEngine here as the setting is shared across the document\n\t\tconst { gradientNode } = this.gradientEngine\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\n\t\tif (!gradientNode || !gradient) return\n\n\t\tVekterEngine.shared().stores.selectionStore.gradientStopId = id\n\t\tthis.gradientEngine.fallbackGradientStopIndex = index\n\n\t\tswitch (getGradientType(gradientNode, this.gradientEngine)) {\n\t\t\tcase \"linear-gradient\":\n\t\t\tcase \"conic-gradient\":\n\t\t\t\tthis.gradientEngine.setTool(new GradientStopMoveTool(this.gradientEngine.engine))\n\t\t\t\tbreak\n\t\t\tcase \"radial-gradient\":\n\t\t\t\tif (index === 0) {\n\t\t\t\t\tthis.gradientEngine.setTool(new GradientCenterMoveTool(this.gradientEngine.engine))\n\t\t\t\t} else if (index < gradient.stops.length - 1) {\n\t\t\t\t\tthis.gradientEngine.setTool(new GradientStopMoveTool(this.gradientEngine.engine))\n\t\t\t\t} else {\n\t\t\t\t\tthis.gradientEngine.setTool(new RadialGradientResizeTool(this.gradientEngine.engine))\n\t\t\t\t}\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t})\n\n\tonHeightFactorStart = VekterEngine.shared().scheduler.wrapHandler(() => {\n\t\tthis.gradientEngine.setTool(new RadialGradientResizeTool(this.gradientEngine.engine, { isHorizontal: false }))\n\t})\n\n\thandles = (node: GradientNode) => {\n\t\tconst gradient = getActiveGradient(node, this.gradientEngine)\n\t\tif (!gradient) return null\n\n\t\treturn (\n\t\t\t<GradientHandles\n\t\t\t\t{...this.props}\n\t\t\t\tnode={node}\n\t\t\t\tgradient={gradient}\n\t\t\t\tmaskId={this.gradientEngine.maskIds?.[node.id] ?? null}\n\t\t\t\tisDarkMode={this.gradientEngine.engine.stores.documentSettingsStore.hasDarkAppearance}\n\t\t\t\tgradientToolActive={isGradientEditTool(this.gradientEngine.tool)}\n\t\t\t\trotateToolActive={this.gradientEngine.tool instanceof GradientAngleTool}\n\t\t\t\tonRotate={this.onRotate}\n\t\t\t\tonSelectStop={this.onSelectStop}\n\t\t\t\tonHeightFactorStart={this.onHeightFactorStart}\n\t\t\t\tonMoveConicGradient={this.onMoveConicGradient}\n\t\t\t\tgradientToolType={this.gradientEngine.enum}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nfunction isGradientEditTool(tool: VekterGradientTool | null) {\n\tif (!tool) return false\n\treturn (\n\t\ttool instanceof GradientStopMoveTool ||\n\t\ttool instanceof GradientAngleTool ||\n\t\ttool instanceof GradientCenterMoveTool ||\n\t\ttool instanceof RadialGradientResizeTool\n\t)\n}\n", "import { VekterTool } from \"document/VekterTool.ts\"\nimport { withClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { GradientToolManagerToolType } from \"./GradientToolManagerTool.tsx\"\n\nexport class VekterGradientTool extends withClassDiscriminator(\"VekterGradientTool\", VekterTool) {\n\t// FIXME: ! is unsafe; the gradientEngine is assigned externally, not in the constructor,\n\t// so if the external code forgets to do that, we\u2019ll have a runtime error\n\tgradientEngine!: GradientToolManagerToolType\n}\n", "import { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport type { ConicGradient } from \"document/models/Gradient.ts\"\nimport {\n\tconicGradientUpdate,\n\tgetActiveGradient,\n\tlinearGradientUpdate,\n\tupdateMaskGradientForNode,\n} from \"document/models/Gradient.ts\"\nimport type { LinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { isLinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { rotationCursorSouthNorth } from \"utils/cursor.ts\"\nimport { VekterGradientTool } from \"./types.ts\"\nimport { gradientCoordinates } from \"./utils.ts\"\n\nexport class GradientAngleTool extends VekterGradientTool {\n\toverride readonly enum = Tools.Unknown\n\n\t// FIXME: !s are unsafe; they are assigned in `.start()`, but not in the constructor,\n\t// so there\u2019s a period of time where these fields are undefined\n\tstartGradient!: LinearGradient | ConicGradient\n\tgradientCenterPoint!: Point\n\tmouseDidMovePastThreshold = false\n\n\toverride start() {\n\t\tthis.engine.beginUndoGroup()\n\t\tconst gradientNode = this.gradientEngine.gradientNode\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\n\t\t// TODO: Account for RadialGradient here (or sooner).\n\t\tif (!gradientNode || !gradient || (!isLinearGradient(gradient) && !isConicGradient(gradient))) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tconst coordinates = gradientCoordinates(this.engine.tree, gradientNode, gradient)\n\t\tif (!coordinates || coordinates.type === \"radial\") {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tthis.gradientCenterPoint = coordinates.center\n\t\tthis.startGradient = gradient\n\t\t// Avoid a flash of the default cursor when pressing the rotation handle (and starting the tool)\n\t\tthis.updateCursor()\n\t}\n\n\toverride stop() {\n\t\tthis.engine.stores.toolStore.tooltip = undefined\n\t\tthis.engine.endUndoGroup()\n\t\tthis.engine.stores.mouseCursorStore.clear()\n\n\t\t// When the mouse is released, we want to update the gradient coordinates\n\t\t// in the parent tool manager so we have an up to date set of coordinates\n\t\t// when checking if the gradientIsInRange.\n\t\tthis.gradientEngine.updateCoordinates()\n\t}\n\toverride update() {\n\t\tconst { toolStore, selectionStore, mouseStore } = this.engine.stores\n\t\tconst { latest, previous } = mouseStore\n\t\tconst { canvasMouseDownPosition, canvasMousePosition, shiftKey } = latest\n\t\tconst { gradientNode } = this.gradientEngine\n\n\t\tif (!gradientNode) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tconst currentMouse = previous.canvasMousePosition\n\t\tconst currentShift = previous.shiftKey\n\n\t\tif (!canvasMouseDownPosition || !currentMouse || !canvasMousePosition) {\n\t\t\tthis.gradientEngine.setDefault()\n\t\t\treturn\n\t\t}\n\n\t\tconst mouseMove = canvasMousePosition.x !== currentMouse.x || canvasMousePosition.y !== currentMouse.y\n\t\tconst modifierChange = shiftKey !== currentShift\n\n\t\tconst distance = Point.distance(canvasMousePosition, canvasMouseDownPosition)\n\t\tif (!this.mouseDidMovePastThreshold && distance > 1) {\n\t\t\tthis.mouseDidMovePastThreshold = true\n\t\t}\n\n\t\tif (!this.mouseDidMovePastThreshold) {\n\t\t\treturn\n\t\t}\n\n\t\tif (mouseMove || modifierChange) {\n\t\t\tconst center = this.gradientCenterPoint\n\t\t\tconst angle1 = Math.atan2(canvasMouseDownPosition.y - center.y, canvasMouseDownPosition.x - center.x)\n\t\t\tconst angle2 = Math.atan2(canvasMousePosition.y - center.y, canvasMousePosition.x - center.x)\n\t\t\tlet angle = angle2 - angle1\n\t\t\tangle = (angle * 180) / Math.PI\n\n\t\t\tlet rotation = this.startGradient.angle + angle\n\n\t\t\tif (shiftKey) {\n\t\t\t\tconst times = Math.round(rotation / 45)\n\t\t\t\trotation = times * 45\n\t\t\t}\n\n\t\t\trotation = Math.round(rotation)\n\n\t\t\tif (rotation >= 360) {\n\t\t\t\trotation -= 360\n\t\t\t} else if (rotation < 0) {\n\t\t\t\trotation += 360\n\t\t\t}\n\n\t\t\ttoolStore.tooltip = `${rotation}\u00B0`\n\t\t\tthis.updateCursor()\n\n\t\t\tconst gradient = this.startGradient.updated({ angle: rotation })\n\t\t\tconst type = this.gradientEngine.enum\n\t\t\tif (isRichTextNode(gradientNode) && type === Tools.FillGradient) {\n\t\t\t\tgradientNode.setFill(gradient)\n\t\t\t} else if (type === Tools.FillGradient) {\n\t\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withFill)\n\t\t\t\tnodes.forEach(node =>\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tfillLinearGradient: linearGradientUpdate(node, { angle: rotation }, type),\n\t\t\t\t\t\tfillConicGradient: conicGradientUpdate(node, { angle: rotation }, type),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else if (type === Tools.MaskGradient) {\n\t\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withMasks)\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\tconst maskId = this.gradientEngine.maskIds?.[node.id]\n\t\t\t\t\tif (!maskId) return\n\t\t\t\t\tupdateMaskGradientForNode(node, maskId, {\n\t\t\t\t\t\tmaskLinearGradient: { angle: rotation },\n\t\t\t\t\t\tmaskConicGradient: { angle: rotation },\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateCursor() {\n\t\tconst { mouseCursorStore, mouseStore } = this.engine.stores\n\t\tconst { canvasMousePosition } = mouseStore.latest\n\t\tconst center = this.gradientCenterPoint\n\t\tconst angle = Point.angleFromX(center, canvasMousePosition)\n\t\tmouseCursorStore.current = rotationCursorSouthNorth(angle)\n\t}\n}\n", "import type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { convertCornerPointsToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport {\n\tconicGradientUpdate,\n\tgetActiveGradient,\n\tradialGradientUpdate,\n\tupdateMaskGradientForNode,\n} from \"document/models/Gradient.ts\"\nimport { isRadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport type { OrthogonalLines } from \"document/models/Snapping.ts\"\nimport { snap } from \"document/models/Snapping.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { roundedNumber } from \"library/render/utils/roundedNumber.ts\"\nimport { grabbingCursor } from \"utils/cursor.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { VekterGradientTool } from \"./types.ts\"\nimport { gradientCoordinates } from \"./utils.ts\"\n\nexport class GradientCenterMoveTool extends VekterGradientTool {\n\toverride readonly enum = Tools.Unknown\n\t// Track the delta between the start mouse position and the center point of the circle\n\tmouseCenterPointDelta: Point | undefined\n\tmouseDidMovePastThreshold = false\n\n\t// snapping\n\t// FIXME: ! is unsafe; it is assigned in `.start()`, but not in the constructor,\n\t// so there\u2019s a period of time where this field is undefined\n\tsnapData!: OrthogonalLines\n\n\toverride start() {\n\t\tthis.engine.beginUndoGroup()\n\t\tconst gradientNode = this.gradientEngine.gradientNode\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\n\t\tif (!gradientNode || !gradient || (!isRadialGradient(gradient) && !isConicGradient(gradient))) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\t\tconst coordinates = gradientCoordinates(this.engine.tree, gradientNode, gradient)\n\t\tif (coordinates?.type === \"radial\") {\n\t\t\tconst centerPoint = coordinates.center\n\t\t\tconst mouse = this.engine.stores.mouseStore.latest.canvasMousePosition\n\t\t\tthis.mouseCenterPointDelta = { x: mouse.x - centerPoint.x, y: mouse.y - centerPoint.y }\n\t\t}\n\n\t\tthis.snapData = generateSnappingData(this.engine.tree, gradientNode)\n\t}\n\n\toverride stop() {\n\t\tconst { mouseCursorStore, toolStore, snapLinesStore } = this.engine.stores\n\t\tmouseCursorStore.current = undefined\n\t\ttoolStore.tooltip = undefined\n\t\tsnapLinesStore.clear()\n\t\tthis.engine.endUndoGroup()\n\n\t\t// When the center move is completed, we need to update the\n\t\t// coordinates in the parent tool manager so we have an up to date set of\n\t\t// coordinates when checking if the gradientIsInRange.\n\t\tthis.gradientEngine.updateCoordinates()\n\t}\n\n\toverride update() {\n\t\tconst { tree } = this.engine\n\t\tconst { selectionStore, snapLinesStore, toolStore, canvasStore, mouseStore } = this.engine.stores\n\t\tconst { previous, latest } = mouseStore\n\t\tconst { canvasMouseDownPosition, canvasMousePosition, shiftKey } = latest\n\t\tconst { gradientNode } = this.gradientEngine\n\n\t\tconst currentMouse = previous.canvasMousePosition\n\t\tconst currentShift = previous.shiftKey\n\t\tconst type = this.gradientEngine.enum\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\n\t\tif (!canvasMouseDownPosition || !currentMouse || !canvasMousePosition || !gradientNode || !gradient) {\n\t\t\tthis.gradientEngine.setDefault()\n\t\t\treturn\n\t\t}\n\n\t\tconst distance = Point.distance(canvasMousePosition, canvasMouseDownPosition)\n\t\tif (!this.mouseDidMovePastThreshold && distance > 1) {\n\t\t\tthis.mouseDidMovePastThreshold = true\n\t\t}\n\n\t\tif (!this.mouseDidMovePastThreshold) {\n\t\t\treturn\n\t\t}\n\n\t\tconst mouseDidMove = canvasMousePosition.x !== currentMouse.x || canvasMousePosition.y !== currentMouse.y\n\t\tconst modifierDidChange = shiftKey !== currentShift\n\n\t\tif (!mouseDidMove && !modifierDidChange) return\n\n\t\ttoolStore.tooltip = undefined\n\t\tthis.updateCursor()\n\n\t\t// For a radial gradient, the move handle is the starting stop, which might not be at (0,0). Therefore here we\n\t\t// offset the mouse point to the actual center point of the circle.\n\t\tconst mouseRebasedToCenter = this.mouseCenterPointDelta\n\t\t\t? Point.subtract(canvasMousePosition, this.mouseCenterPointDelta)\n\t\t\t: canvasMousePosition\n\t\tconst { point: snapPoint, snapLines } = snap(this.snapData, canvasStore.zoom, mouseRebasedToCenter)\n\n\t\tconst snappedMouse = { ...mouseRebasedToCenter }\n\t\tif (isNumber(snapPoint.x)) snappedMouse.x = snapPoint.x\n\t\tif (isNumber(snapPoint.y)) snappedMouse.y = snapPoint.y\n\n\t\tsnapLinesStore.x = snapLines.x\n\t\tsnapLinesStore.y = snapLines.y\n\n\t\tconst localCenterPoint = tree.convertPointToNode(gradientNode, snappedMouse)\n\t\tconst rect = Rect.atOrigin(tree.getRect(gradientNode))\n\n\t\tconst update = {\n\t\t\tcenterAnchorX: roundedNumber(localCenterPoint.x / rect.width, 3),\n\t\t\tcenterAnchorY: roundedNumber(localCenterPoint.y / rect.height, 3),\n\t\t}\n\n\t\tif (isRichTextNode(gradientNode) && type === Tools.FillGradient) {\n\t\t\tgradientNode.setFill(gradient.updated(update))\n\t\t} else if (type === Tools.FillGradient) {\n\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withFill)\n\t\t\tnodes.forEach(node =>\n\t\t\t\tnode.set({\n\t\t\t\t\tfillRadialGradient: radialGradientUpdate(node, update, type),\n\t\t\t\t\tfillConicGradient: conicGradientUpdate(node, update, type),\n\t\t\t\t}),\n\t\t\t)\n\t\t} else if (type === Tools.MaskGradient) {\n\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withMasks)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst maskId = this.gradientEngine.maskIds?.[node.id]\n\t\t\t\tif (!maskId) return\n\t\t\t\tupdateMaskGradientForNode(node, maskId, {\n\t\t\t\t\tmaskRadialGradient: update,\n\t\t\t\t\tmaskConicGradient: update,\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t}\n\n\tupdateCursor() {\n\t\tthis.engine.stores.mouseCursorStore.current = grabbingCursor\n\t}\n}\n\nfunction generateSnappingData(tree: CanvasTree, node: CanvasNode): OrthogonalLines {\n\tconst cornerPoints = convertCornerPointsToCanvas(tree, node)\n\tconst rect = Rect.atOrigin(tree.getRect(node))\n\tconst centerPoint = tree.convertPointToCanvas(node, Rect.center(rect))\n\tconst canvasSnapPoints = [...cornerPoints, centerPoint]\n\n\tconst x = new Set<number>()\n\tconst y = new Set<number>()\n\n\tfor (const canvasSnapPoint of canvasSnapPoints) {\n\t\tx.add(canvasSnapPoint.x)\n\t\ty.add(canvasSnapPoint.y)\n\t}\n\n\treturn { x, y }\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { Gradient } from \"document/models/Gradient.ts\"\nimport {\n\tconicGradientUpdate,\n\tgetActiveGradient,\n\tlinearGradientUpdate,\n\tradialGradientUpdate,\n\tupdateMaskGradientForNode,\n} from \"document/models/Gradient.ts\"\nimport type { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Line } from \"library/render/types/Line.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport { grabbingCursor } from \"utils/cursor.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { VekterGradientTool } from \"./types.ts\"\nimport type { GradientCoordinates } from \"./utils.ts\"\nimport { getConicGradientStopPositionAtMouse, gradientCoordinates } from \"./utils.ts\"\n\nconst minSize = { width: 2, height: 2 }\n\nexport class GradientStopMoveTool extends VekterGradientTool {\n\toverride readonly enum = Tools.Unknown\n\n\t// FIXME: !s are unsafe; they are assigned in `.start()`, but not in the constructor,\n\t// so there\u2019s a period of time where these fields are undefined\n\tcoordinates!: GradientCoordinates\n\tgradient!: Gradient\n\tstartColorStop!: GradientColorStop\n\tstartColorStopPosition!: number\n\n\tmouseDidMovePastThreshold = false\n\n\tstopDelta: number = 0\n\n\t// snapping\n\tsnappingPoints!: Point[]\n\n\toverride start() {\n\t\tthis.engine.beginUndoGroup()\n\t\tconst gradientNode = this.gradientEngine.gradientNode\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\t\tlet stop = gradient?.stops.find(({ id }) => id === this.engine.stores.selectionStore.gradientStopId)\n\n\t\t// In case text gradients don't have ids, fallback to lookup by index.\n\t\t// As soon as the gradient is edited by this tool, the id will be\n\t\t// persisted in the Rich Text. This means we will never lookup by index\n\t\t// when reordering.\n\t\tconst index = this.gradientEngine.fallbackGradientStopIndex\n\t\tif (!stop && isNumber(index)) stop = gradient?.stops[index]\n\n\t\tif (!gradientNode || !gradient || !stop) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tconst coordinates = gradientCoordinates(this.engine.tree, gradientNode, gradient)\n\t\tif (!coordinates) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tthis.coordinates = coordinates\n\t\tthis.gradient = gradient\n\t\tthis.startColorStop = stop\n\t\tthis.startColorStopPosition = stop.position\n\t\tif (coordinates.type === \"linear\" || coordinates.type === \"radial\") {\n\t\t\tthis.snappingPoints = [coordinates.start, coordinates.end]\n\t\t}\n\t}\n\toverride stop() {\n\t\tthis.engine.stores.toolStore.tooltip = undefined\n\t\tthis.engine.endUndoGroup()\n\t\tthis.engine.stores.mouseCursorStore.clear()\n\t}\n\toverride update() {\n\t\tconst { toolStore, selectionStore, canvasStore, mouseStore } = this.engine.stores\n\t\tconst { latest, previous } = mouseStore\n\t\tconst { canvasMouseDownPosition, canvasMousePosition, shiftKey } = latest\n\t\tconst gradientNode = this.gradientEngine.gradientNode\n\t\tif (!gradientNode) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tconst currentMouse = previous.canvasMousePosition\n\t\tconst currentShift = previous.shiftKey\n\n\t\tconst gradient = this.gradient\n\t\tif (!canvasMouseDownPosition || !currentMouse || !canvasMousePosition || !gradient) {\n\t\t\tthis.gradientEngine.setDefault()\n\t\t\treturn\n\t\t}\n\n\t\tconst coordinates = this.coordinates\n\t\tif (!coordinates) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tconst mouseMove = canvasMousePosition.x !== currentMouse.x || canvasMousePosition.y !== currentMouse.y\n\t\tconst modifierChange = shiftKey !== currentShift\n\n\t\tconst distance = Point.distance(canvasMousePosition, canvasMouseDownPosition)\n\t\tif (!this.mouseDidMovePastThreshold && distance * canvasStore.zoom > 1) {\n\t\t\tthis.mouseDidMovePastThreshold = true\n\t\t}\n\n\t\tif (!this.mouseDidMovePastThreshold) {\n\t\t\treturn\n\t\t}\n\n\t\tif (mouseMove || modifierChange) {\n\t\t\tconst snappedMouse = { ...canvasMousePosition }\n\t\t\tif (coordinates.type === \"linear\" || coordinates.type === \"radial\") {\n\t\t\t\tconst snapPoint = findClosestPointInRangeOnLineFromMouse(\n\t\t\t\t\tthis.snappingPoints,\n\t\t\t\t\tcoordinates.axis,\n\t\t\t\t\tcanvasMousePosition,\n\t\t\t\t\t10 / canvasStore.zoom,\n\t\t\t\t)\n\t\t\t\tif (snapPoint) {\n\t\t\t\t\tsnappedMouse.x = snapPoint.x\n\t\t\t\t\tsnappedMouse.y = snapPoint.y\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet position = this.getStopPosition(coordinates, snappedMouse, this.startColorStopPosition)\n\t\t\tposition = roundTo(position, shiftKey ? 5 : 1)\n\n\t\t\tthis.updateCursor()\n\n\t\t\ttoolStore.tooltip = `${Math.round(position * 100)}%`\n\n\t\t\tconst nextStops = [...gradient.stops]\n\t\t\tconst index = gradient.stops.findIndex(({ id }) => id === this.startColorStop.id)\n\n\t\t\tnextStops.splice(index, 1, this.startColorStop.merge({ position }))\n\n\t\t\tconst update = { stops: nextStops.sort((a, b) => a.position - b.position) }\n\n\t\t\tconst nextGradient = gradient.updated(update)\n\t\t\tif (!nextGradient) return\n\n\t\t\t// For old RichTextNode gradients, the id might need to be updated\n\t\t\t// to be consistent after the first update which persists the new\n\t\t\t// ids.\n\t\t\tselectionStore.gradientStopId = this.startColorStop.id\n\n\t\t\tconst type = this.gradientEngine.enum\n\t\t\tif (isRichTextNode(gradientNode) && type === Tools.FillGradient) {\n\t\t\t\tgradientNode.setFill(nextGradient)\n\t\t\t} else if (type === Tools.FillGradient) {\n\t\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withFill)\n\t\t\t\tnodes.forEach(node =>\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tfillLinearGradient: linearGradientUpdate(node, update, Tools.FillGradient),\n\t\t\t\t\t\tfillRadialGradient: radialGradientUpdate(node, update, Tools.FillGradient),\n\t\t\t\t\t\tfillConicGradient: conicGradientUpdate(node, update, Tools.FillGradient),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else if (type === Tools.MaskGradient) {\n\t\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withMasks)\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\tconst maskId = this.gradientEngine.maskIds?.[node.id]\n\t\t\t\t\tif (!maskId) return\n\t\t\t\t\tupdateMaskGradientForNode(node, maskId, {\n\t\t\t\t\t\tmaskLinearGradient: update,\n\t\t\t\t\t\tmaskRadialGradient: update,\n\t\t\t\t\t\tmaskConicGradient: update,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateCursor() {\n\t\tthis.engine.stores.mouseCursorStore.current = grabbingCursor\n\t}\n\n\tprivate getStopPosition(coordinates: GradientCoordinates, mouse: Point, startPosition: number): number {\n\t\tconst { type } = coordinates\n\t\tswitch (type) {\n\t\t\tcase \"linear\":\n\t\t\tcase \"radial\": {\n\t\t\t\tconst pointOnLine = Line.projectPoint(coordinates.axis, mouse)\n\t\t\t\tif (!pointOnLine) return startPosition\n\n\t\t\t\tconst originalPointOnLine = Line.pointAtPercentDistance(coordinates.axis, startPosition)\n\n\t\t\t\tthis.stopDelta += Point.distance(originalPointOnLine, pointOnLine)\n\n\t\t\t\tconst deltaStart = Line.distance(Line(coordinates.start, pointOnLine))\n\t\t\t\tconst lineLength = Line.distance(coordinates.axis)\n\n\t\t\t\tconst distEnd = Point.distance(pointOnLine, coordinates.end)\n\t\t\t\tconst distStart = Point.distance(pointOnLine, coordinates.start)\n\n\t\t\t\tconst isPointInsideRect = Rect.containsPoint(\n\t\t\t\t\tRect.withMinSize(Rect.fromTwoPoints(coordinates.start, coordinates.end), minSize),\n\t\t\t\t\tpointOnLine,\n\t\t\t\t)\n\t\t\t\tconst sign = isPointInsideRect ? 1 : distStart < distEnd ? -1 : 1\n\t\t\t\tlet position = (deltaStart * sign) / lineLength\n\t\t\t\t// Clamp radial gradient stop position to 0~1\n\t\t\t\tif (type === \"radial\") {\n\t\t\t\t\tposition = Math.max(position, 0)\n\t\t\t\t\tposition = Math.min(position, 1)\n\t\t\t\t}\n\t\t\t\treturn position\n\t\t\t}\n\t\t\tcase \"conic\": {\n\t\t\t\treturn getConicGradientStopPositionAtMouse(coordinates, mouse)\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(type)\n\t\t}\n\t}\n}\n\nfunction findClosestPointInRangeOnLineFromMouse(\n\tpoints: Point[],\n\tline: Line,\n\tmouse: Point,\n\tthreshold: number,\n): Point | undefined {\n\tlet closestPoint: Point | undefined = undefined\n\tlet shortestDistance = Infinity\n\tpoints.forEach(point => {\n\t\tconst pointOnLine = Line.projectPoint(line, mouse)\n\t\tif (!pointOnLine) return\n\t\tconst distance = Point.distance(pointOnLine, point)\n\t\tif (distance > threshold) return\n\t\tif (distance < shortestDistance) {\n\t\t\tclosestPoint = point\n\t\t\tshortestDistance = distance\n\t\t}\n\t})\n\n\treturn closestPoint\n}\n\nfunction roundTo(decimalValue: number, step: number): number {\n\tconst decimalStep = step / 100\n\treturn Math.round(decimalValue / decimalStep) * decimalStep\n}\n", "import { List } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { getActiveGradient, getNodeMaskForMaskId } from \"document/models/Gradient.ts\"\nimport type { RadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { isRadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { roundedNumber } from \"library/render/utils/roundedNumber.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { VekterGradientTool } from \"./types.ts\"\n\nexport class RadialGradientResizeTool extends VekterGradientTool {\n\toverride readonly enum = Tools.Unknown\n\t// FIXME: ! is unsafe; it is assigned in `.start()`, but not in the constructor,\n\t// so there\u2019s a period of time where this field is undefined\n\tstartGradient!: RadialGradient\n\tmouseDidMovePastThreshold = false\n\tprivate isHorizontal = true\n\n\tconstructor(engine: VekterEngine, options?: { isHorizontal: boolean }) {\n\t\tsuper(engine)\n\t\tif (options) this.isHorizontal = options.isHorizontal\n\t}\n\n\toverride start() {\n\t\tthis.engine.beginUndoGroup()\n\t\tconst { gradientNode } = this.gradientEngine\n\t\tconst gradient = getActiveGradient(gradientNode, this.gradientEngine)\n\n\t\tif (!gradientNode || !gradient || !isRadialGradient(gradient)) {\n\t\t\tthis.engine.exitTool()\n\t\t\treturn\n\t\t}\n\n\t\tthis.startGradient = gradient\n\t}\n\n\toverride stop() {\n\t\tthis.engine.stores.toolStore.tooltip = undefined\n\t\tthis.engine.endUndoGroup()\n\n\t\t// When the user finishes resizing the radial gradient, we want to update\n\t\t// the coordinates that the tool manager is using to calculate if the gradient\n\t\t// is in range of the mouse cursor.\n\t\tthis.gradientEngine.updateCoordinates()\n\t}\n\n\toverride update() {\n\t\tconst { tree } = this.engine\n\t\tconst { selectionStore, canvasStore, mouseStore } = this.engine.stores\n\t\tconst { previous, latest } = mouseStore\n\t\tconst { canvasMouseDownPosition, canvasMousePosition, shiftKey } = latest\n\t\tconst { gradientNode } = this.gradientEngine\n\n\t\tconst currentMouse = previous.canvasMousePosition\n\t\tconst currentShift = previous.shiftKey\n\n\t\tif (!canvasMouseDownPosition || !currentMouse || !canvasMousePosition || !gradientNode) {\n\t\t\tthis.gradientEngine.setDefault()\n\t\t\treturn\n\t\t}\n\n\t\tconst distance = Point.distance(canvasMousePosition, canvasMouseDownPosition)\n\t\tif (!this.mouseDidMovePastThreshold && distance > 1) {\n\t\t\tthis.mouseDidMovePastThreshold = true\n\t\t}\n\n\t\tif (!this.mouseDidMovePastThreshold) {\n\t\t\treturn\n\t\t}\n\n\t\tconst mouseDidMove = canvasMousePosition.x !== currentMouse.x || canvasMousePosition.y !== currentMouse.y\n\t\tconst modifierDidChange = shiftKey !== currentShift\n\n\t\tif (!mouseDidMove && !modifierDidChange) return\n\n\t\tconst rect = tree.getRect(gradientNode)\n\t\tconst localPoint = tree.convertPointToNode(gradientNode, canvasMousePosition)\n\t\tconst centerX = rect.width * this.startGradient.centerAnchorX\n\t\tconst deltaX = Math.abs(localPoint.x - centerX)\n\t\tconst centerY = rect.height * this.startGradient.centerAnchorY\n\t\tconst deltaY = Math.abs(localPoint.y - centerY)\n\n\t\tconst length = this.isHorizontal ? rect.width : rect.height\n\t\tconst snappingThreshold = 10 / canvasStore.zoom / length\n\t\tconst delta = this.isHorizontal ? deltaX : deltaY\n\t\tconst factor = snap(delta / length, snappingThreshold)\n\t\tconst originalFactor = this.isHorizontal ? this.startGradient.widthFactor : this.startGradient.heightFactor\n\t\tconst ratio = shiftKey ? factor / originalFactor : 1\n\n\t\tconst update: Partial<RadialGradient> = {\n\t\t\twidthFactor: this.isHorizontal ? factor : this.startGradient.widthFactor * ratio,\n\t\t\theightFactor: this.isHorizontal ? this.startGradient.heightFactor * ratio : factor,\n\t\t}\n\n\t\tconst fillRadialGradient = this.startGradient.updated(update)\n\t\tif (!isRadialGradient(fillRadialGradient)) return\n\t\tconst type = this.gradientEngine.enum\n\t\tif (isRichTextNode(gradientNode) && type === Tools.FillGradient) {\n\t\t\tgradientNode.setFill(fillRadialGradient)\n\t\t} else if (type === Tools.FillGradient) {\n\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withFill)\n\t\t\tnodes.forEach(node => node.set({ fillRadialGradient, fillType: \"radial-gradient\" }))\n\t\t} else if (type === Tools.MaskGradient) {\n\t\t\tconst nodes = this.engine.tree.getNodesWithTrait(selectionStore.ids, withMasks)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tif (isUndefined(node.masks)) return\n\t\t\t\tconst maskId = this.gradientEngine.maskIds?.[node.id]\n\t\t\t\tif (!maskId) return\n\t\t\t\tconst mask = getNodeMaskForMaskId(node, maskId)\n\t\t\t\tif (!mask) return\n\t\t\t\tconst newValue = {\n\t\t\t\t\t...mask.value,\n\t\t\t\t\tmaskRadialGradient: fillRadialGradient,\n\t\t\t\t}\n\t\t\t\tnode.set({\n\t\t\t\t\tmasks: List.replace(node.masks, mask.index, newValue),\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t\tthis.engine.stores.toolStore.tooltip = `${factor}`\n\t}\n}\n\nconst snappingValues = [0.25, 0.5, 0.75, 1, 1.5, 2]\n\nfunction snap(value: number, snappingThreshold: number) {\n\tfor (const snapValue of snappingValues) {\n\t\tif (Math.abs(value - snapValue) < snappingThreshold) {\n\t\t\treturn snapValue\n\t\t}\n\t}\n\treturn roundedNumber(value, 2)\n}\n", "import { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { convertMaskGradientStopToTheme, withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport type { Gradient, GradientTool } from \"document/models/Gradient.ts\"\nimport {\n\tconicGradientUpdate,\n\tlinearGradientUpdate,\n\tradialGradientUpdate,\n\tupdateMaskGradientForNode,\n} from \"document/models/Gradient.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { motion, useMotionValue } from \"framer-motion\"\nimport { Color, Rect } from \"library/index.ts\"\nimport { P3Color } from \"library/render/types/Color/Color.ts\"\nimport { ConvertColor } from \"library/render/types/Color/ConvertColor.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport { rotationCursorSouthNorth } from \"utils/cursor.ts\"\nimport { memoizeOne } from \"utils/memoizeOne.ts\"\nimport type { ConicGradientCoordinates, GradientCoordinates } from \"../utils.ts\"\nimport {\n\tgetConicGradientStopPositionAtMouse,\n\tgetGradientStopPoints,\n\tgetPointOnCircleByAngle,\n\tgradientCoordinates,\n\tinterpolateColorAtPosition,\n\tresolveStopColor,\n} from \"../utils.ts\"\nimport * as styles from \"./GradientHandles.styles.ts\"\n\nconst addAndSelectGradientStop = engine.scheduler.wrapHandler(\n\t(\n\t\toffset: number,\n\t\tgradient: Gradient,\n\t\tnode: CanvasNode,\n\t\tisDarkMode: boolean,\n\t\tgradientToolType: GradientTool,\n\t\tonSelectStop: (id: NodeID, index: number) => void,\n\t\tmaskId: NodeID | null,\n\t) => {\n\t\tconst latestNode = engine.tree.current(node)\n\t\tif (!latestNode) return\n\n\t\tconst newStop = new GradientColorStop({\n\t\t\tposition: offset,\n\t\t\tvalue: interpolateColorAtPosition(engine.tree, gradient.stops, offset, isDarkMode),\n\t\t})\n\n\t\tconst stops = [...gradient.stops, newStop].sort((a, b) => a.position - b.position)\n\t\tif (isRichTextNode(latestNode) && gradientToolType === Tools.FillGradient) {\n\t\t\tlatestNode.setFill(gradient.updated({ stops }))\n\t\t} else if (gradientToolType === Tools.FillGradient && withFill(latestNode)) {\n\t\t\tlatestNode.set({\n\t\t\t\tfillLinearGradient: linearGradientUpdate(latestNode, { stops }, Tools.FillGradient),\n\t\t\t\tfillRadialGradient: radialGradientUpdate(latestNode, { stops }, Tools.FillGradient),\n\t\t\t\tfillConicGradient: conicGradientUpdate(latestNode, { stops }, Tools.FillGradient),\n\t\t\t})\n\t\t} else if (gradientToolType === Tools.MaskGradient && withMasks(latestNode)) {\n\t\t\tupdateMaskGradientForNode(latestNode, maskId, {\n\t\t\t\tmaskLinearGradient: { stops },\n\t\t\t\tmaskRadialGradient: { stops },\n\t\t\t\tmaskConicGradient: { stops },\n\t\t\t})\n\t\t}\n\n\t\t// When a new stop is created, also trigger onSelectStop so that you can add and move the new stop without mouse\n\t\t// up first.\n\t\tconst newStopIndex = stops.findIndex(stop => stop.id === newStop.id)\n\t\tonSelectStop(newStop.id, newStopIndex)\n\t},\n)\n\ninterface Props {\n\ttree: CanvasTree\n\tnode: CanvasNode\n\tcolorStopSelection: NodeID | undefined\n\tgradient: Gradient\n\tmaskId: NodeID | null\n\tzoom: number\n\tisDarkMode: boolean\n\trotateToolActive: boolean\n\tgradientToolActive: boolean\n\tgradientToolType: GradientTool\n\tonSelectStop: (id: NodeID, index: number) => void\n\tonRotate?: () => void\n\tonHeightFactorStart?: () => void\n\tonMoveConicGradient?: () => void\n}\n\nexport class GradientHandles extends React.Component<Props> {\n\toverride render() {\n\t\tconst {\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tgradient,\n\t\t\tzoom,\n\t\t\tcolorStopSelection,\n\t\t\tisDarkMode,\n\t\t\tgradientToolActive,\n\t\t\trotateToolActive,\n\t\t\tgradientToolType,\n\t\t} = this.props\n\t\tconst coordinates = gradientCoordinates(tree, node, gradient)\n\t\tif (!coordinates) {\n\t\t\treturn null\n\t\t}\n\t\tconst stopPoints = getGradientStopPoints(coordinates, gradient.stops)\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{this.outline(coordinates, zoom, rotateToolActive)}\n\t\t\t\t{this.conicGradientOuterRotationHandle(coordinates, zoom, gradientToolActive)}\n\t\t\t\t{this.axis(gradient.stops, coordinates, stopPoints, zoom, gradientToolActive)}\n\t\t\t\t{this.conicGradientCircumference(coordinates, zoom, gradientToolActive)}\n\t\t\t\t{this.conicGradientInnerRotationHandle(coordinates, zoom, gradientToolActive)}\n\t\t\t\t{this.conicGradientMoveHandle(coordinates, zoom, gradientToolActive)}\n\t\t\t\t{this.rotationHandle(coordinates, stopPoints, 0, zoom)}\n\t\t\t\t{this.rotationHandle(coordinates, stopPoints, 1, zoom)}\n\t\t\t\t{this.radialGradientHeightFactorHandle(coordinates, zoom)}\n\t\t\t\t{gradient.stops.map((stop, index) => {\n\t\t\t\t\tconst maskGradientStop = gradientToolType === Tools.MaskGradient ? gradient.stops[index] : undefined\n\t\t\t\t\treturn this.gradientDot(\n\t\t\t\t\t\tcoordinates,\n\t\t\t\t\t\tstopPoints,\n\t\t\t\t\t\tmaskGradientStop ? convertMaskGradientStopToTheme(maskGradientStop, isDarkMode) : stop,\n\t\t\t\t\t\tzoom,\n\t\t\t\t\t\tindex,\n\t\t\t\t\t\tcolorStopSelection,\n\t\t\t\t\t\tisDarkMode,\n\t\t\t\t\t\tgradientToolActive,\n\t\t\t\t\t\ttree,\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t}\n\n\toutline = (coordinates: GradientCoordinates, zoom: number, rotateToolActive: boolean) => {\n\t\tif (coordinates.type !== \"radial\" && coordinates.type !== \"linear\") return null\n\t\tif (coordinates.type === \"linear\" && !rotateToolActive) return null\n\n\t\tif (coordinates.type === \"radial\") {\n\t\t\tconst { size, rotation, start: center } = coordinates\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: Math.round(size.width * zoom),\n\t\t\t\t\t\theight: Math.round(size.height * zoom),\n\t\t\t\t\t\ttop: Math.round((center.y - size.height / 2) * zoom),\n\t\t\t\t\t\tleft: Math.round((center.x - size.width / 2) * zoom),\n\t\t\t\t\t\tboxShadow: \"0 0 0 1px rgba(255,255,255,.25), inset 0 0 0 1px rgba(0,0,0,.1)\",\n\t\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\t\ttransform: `rotate(${rotation}deg)`,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\tconst { size, start, end, center } = coordinates\n\t\tconst rotation = Point.angle(start, end)\n\t\tif (Math.round(rotation) % 90 === 0) {\n\t\t\treturn null\n\t\t}\n\t\treturn (\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\twidth: Math.round(size.width * zoom),\n\t\t\t\t\theight: Math.round(size.height * zoom),\n\t\t\t\t\ttop: Math.round((center.y - size.height / 2) * zoom),\n\t\t\t\t\tleft: Math.round((center.x - size.width / 2) * zoom),\n\t\t\t\t\tboxShadow: \"0 0 0 1px rgba(255,255,255,.25), inset 0 0 0 1px rgba(0,0,0,.1)\",\n\t\t\t\t\ttransform: `rotate(${rotation}deg)`,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconicGradientMoveHandle = (coordinates: GradientCoordinates, zoom: number, gradientToolActive: boolean) => {\n\t\tif (coordinates.type !== \"conic\") return null\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonMouseDown={this.props.onMoveConicGradient}\n\t\t\t\tclassName={cx(styles.centerPoint, gradientToolActive && styles.movingHandle)}\n\t\t\t\tstyle={{\n\t\t\t\t\ttop: coordinates.center.y * zoom,\n\t\t\t\t\tleft: coordinates.center.x * zoom,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t}\n\n\tradialGradientHeightFactorHandle = (coordinates: GradientCoordinates, zoom: number) => {\n\t\tif (coordinates.type !== \"radial\") return null\n\t\tconst realLocation = Point.pixelAligned(Point.multiply(coordinates.topCenter, zoom))\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={styles.handle}\n\t\t\t\tstyle={{\n\t\t\t\t\ttop: realLocation.y,\n\t\t\t\t\tleft: realLocation.x,\n\t\t\t\t\twidth: styles.moveOrResizeHandleSize,\n\t\t\t\t\theight: styles.moveOrResizeHandleSize,\n\t\t\t\t}}\n\t\t\t\tonMouseDown={this.props.onHeightFactorStart}\n\t\t\t/>\n\t\t)\n\t}\n\n\trotationHandle = (coordinates: GradientCoordinates, stopPoints: Point[], index: number, zoom: number) => {\n\t\tif (coordinates.type !== \"linear\") return null\n\t\tconst { center } = coordinates\n\t\tconst start = stopPoints[0]\n\t\tconst end = stopPoints[stopPoints.length - 1]\n\t\tif (!start || !end) return null\n\n\t\tconst location = index === 0 ? start : end\n\t\tconst angle = Point.angle(center, location)\n\t\tconst rad = (angle * Math.PI) / 180\n\t\tconst offset = {\n\t\t\tx: -Math.sin(rad) * 10,\n\t\t\ty: Math.cos(rad) * 10,\n\t\t}\n\t\tconst realLocation = Point.add(Point.multiply(location, zoom), offset)\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tkey={index}\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\ttransform: \"translate(-50%, -50%)\",\n\t\t\t\t\ttop: realLocation.y,\n\t\t\t\t\tleft: realLocation.x,\n\t\t\t\t\twidth: 19,\n\t\t\t\t\theight: 19,\n\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\tcursor: rotationCursorSouthNorth(Point.angleFromX(center, location)),\n\t\t\t\t}}\n\t\t\t\tonMouseDown={this.props.onRotate}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconicGradientOuterRotationHandle = (coordinates: GradientCoordinates, zoom: number, gradientToolActive: boolean) => {\n\t\tif (coordinates.type !== \"conic\") return null\n\t\treturn (\n\t\t\t<RotationCircle\n\t\t\t\tzoom={zoom}\n\t\t\t\tonRotate={this.props.onRotate}\n\t\t\t\tcoordinates={coordinates}\n\t\t\t\tsize={\n\t\t\t\t\tcoordinates.radius * 2 * zoom + styles.conicGradientOuterRotationSafeArea + styles.axisSafeAreaPerSide * 2\n\t\t\t\t}\n\t\t\t\tgradientToolActive={gradientToolActive}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconicGradientInnerRotationHandle = (coordinates: GradientCoordinates, zoom: number, gradientToolActive: boolean) => {\n\t\tif (coordinates.type !== \"conic\") return null\n\t\treturn (\n\t\t\t<RotationCircle\n\t\t\t\tzoom={zoom}\n\t\t\t\tonRotate={this.props.onRotate}\n\t\t\t\tcoordinates={coordinates}\n\t\t\t\tsize={styles.moveOrResizeHandleSize + styles.conicGradientInnerRotationSafeArea}\n\t\t\t\tgradientToolActive={gradientToolActive}\n\t\t\t/>\n\t\t)\n\t}\n\n\tprivate gradientDotValues(color: string) {\n\t\tif (!Color.isP3String(color)) {\n\t\t\treturn {\n\t\t\t\tbase: ConvertColor.toHSL(color).l <= 0.9 ? \"white\" : \"#ccc\",\n\t\t\t\thue: ConvertColor.setAlpha(color, 1),\n\t\t\t}\n\t\t}\n\n\t\tconst parsed = P3Color.fromString(color)\n\t\t// If we can't parse the p3 color, use the color with whatever alpha value it has.\n\t\tif (!parsed) return { base: \"white\", hue: color }\n\n\t\t// Calculate the lightness of the p3 color as if it were RGB.\n\t\tconst l = parsed.hsl().l\n\t\tconst hue = parsed.toString(\"p3\", { a: 1 })\n\n\t\treturn {\n\t\t\tbase: l <= 0.9 ? \"white\" : \"#ccc\",\n\t\t\thue,\n\t\t}\n\t}\n\n\tgradientDot = (\n\t\tcoordinates: GradientCoordinates,\n\t\tstopPoints: Point[],\n\t\tstop: GradientColorStop,\n\t\tzoom: number,\n\t\tindex: number,\n\t\tcolorStopSelection: NodeID | undefined,\n\t\tisDarkMode: boolean,\n\t\tgradientToolActive: boolean,\n\t\ttree: CanvasTree,\n\t) => {\n\t\tconst location = stopPoints[index]\n\t\tif (!location) return null\n\n\t\tconst realLocation =\n\t\t\tcoordinates.type === \"conic\"\n\t\t\t\t? Point.pixelAligned(Point.add(Point.multiply(location, zoom), Point.multiply(coordinates.center, zoom)))\n\t\t\t\t: Point.pixelAligned(Point.multiply(location, zoom))\n\t\tconst selected = stop.id === colorStopSelection\n\t\tconst size = selected ? 15 : 11\n\t\tconst color = resolveStopColor(tree, stop, isDarkMode)\n\t\tconst { base, hue } = memoizeOne(this.gradientDotValues)(color)\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\trole=\"slider\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\taria-valuemin={0}\n\t\t\t\taria-valuemax={1}\n\t\t\t\taria-valuenow={stop.position}\n\t\t\t\tkey={stop.id}\n\t\t\t\tclassName={cx(styles.handle, gradientToolActive && styles.movingHandle, selected && styles.selectedHandle)}\n\t\t\t\tstyle={{\n\t\t\t\t\ttop: realLocation.y,\n\t\t\t\t\tleft: realLocation.x,\n\t\t\t\t\twidth: size,\n\t\t\t\t\theight: size,\n\t\t\t\t}}\n\t\t\t\tonMouseDown={this.props.onSelectStop ? this.props.onSelectStop.bind(this, stop.id, index) : undefined}\n\t\t\t\t// When the mouse hover over the knob, show its position instead of the mouse position.\n\t\t\t\tonMouseEnter={() => {\n\t\t\t\t\tif (gradientToolActive) return\n\t\t\t\t\tengine.stores.toolStore.tooltip = `${Math.round(stop.position * 100)}%`\n\t\t\t\t}}\n\t\t\t\tonMouseLeave={() => {\n\t\t\t\t\tif (gradientToolActive) return\n\t\t\t\t\tengine.stores.toolStore.tooltip = undefined\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tleft: 2,\n\t\t\t\t\t\tright: 2,\n\t\t\t\t\t\ttop: 2,\n\t\t\t\t\t\tbottom: 2,\n\t\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\t\tbackgroundColor: base,\n\t\t\t\t\t\tbackgroundImage: `linear-gradient(${color}, ${color})`,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\tleft: 2,\n\t\t\t\t\t\tright: 2,\n\t\t\t\t\t\ttop: 2,\n\t\t\t\t\t\theight: (size - 4) / 2,\n\t\t\t\t\t\tborderTopLeftRadius: \"100%\",\n\t\t\t\t\t\tborderTopRightRadius: \"100%\",\n\t\t\t\t\t\ttransform: \"rotate(-45deg)\",\n\t\t\t\t\t\ttransformOrigin: \"50% 100%\",\n\t\t\t\t\t\tbackgroundColor: hue,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\t\tboxShadow: \"inset 0 0 0 2px white, inset 0 0 0 3px rgba(0,0,0,.1)\",\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t}\n\n\taddGradientStop = (position: number) => {\n\t\tconst { gradient, node, isDarkMode, onSelectStop, gradientToolType, maskId } = this.props\n\t\taddAndSelectGradientStop(position, gradient, node, isDarkMode, gradientToolType, onSelectStop, maskId)\n\t}\n\n\tconicGradientCircumference = (coordinates: GradientCoordinates, zoom: number, gradientToolActive: boolean) => {\n\t\tif (coordinates.type !== \"conic\") return null\n\t\treturn (\n\t\t\t<ConicGradientCircumference\n\t\t\t\tzoom={zoom}\n\t\t\t\tcoordinates={coordinates}\n\t\t\t\tgradientToolActive={gradientToolActive}\n\t\t\t\tonAddStop={this.addGradientStop}\n\t\t\t/>\n\t\t)\n\t}\n\n\taxis = (\n\t\tstops: readonly GradientColorStop[],\n\t\tcoordinates: GradientCoordinates,\n\t\tstopPoints: Point[],\n\t\tzoom: number,\n\t\tgradientToolActive: boolean,\n\t) => {\n\t\tif (coordinates.type === \"conic\") return null\n\t\tconst { start: boxStart, end: boxEnd } = coordinates\n\t\tconst start = stopPoints[0]\n\t\tconst end = stopPoints[stopPoints.length - 1]\n\t\tif (!start || !end) return null\n\n\t\tconst startPosition = stops[0]?.position ?? 0\n\t\tconst endPosition = stops[stops.length - 1]?.position ?? 1\n\n\t\treturn (\n\t\t\t<GradientAxis\n\t\t\t\tstartPosition={startPosition}\n\t\t\t\tendPosition={endPosition}\n\t\t\t\tstart={start}\n\t\t\t\tend={end}\n\t\t\t\tboxStart={boxStart}\n\t\t\t\tboxEnd={boxEnd}\n\t\t\t\tgradientToolActive={gradientToolActive}\n\t\t\t\tzoom={zoom}\n\t\t\t\tonAddStop={this.addGradientStop}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nfunction ConicGradientCircumference({\n\tcoordinates,\n\tzoom,\n\tgradientToolActive,\n\tonAddStop,\n}: {\n\tzoom: number\n\tcoordinates: ConicGradientCoordinates\n\tgradientToolActive: boolean\n\tonAddStop: (position: number) => void\n}) {\n\tconst [showPlaceholder, setShowPlaceholder] = React.useState(false)\n\n\t// Unlike the gradient stop position, the rendered position does not care about the rotation angle of the gradient.\n\tconst renderedPosition = useMotionValue(0)\n\n\tconst updatePlaceholderPosition = (forceUpdatePosition: boolean = false) => {\n\t\tif (!showPlaceholder && !forceUpdatePosition) return\n\t\t// @TODO: can we render with relative position to avoid all this shenanigans\n\t\tconst newPosition = getConicGradientStopPositionAtMouse(coordinates, engine.stores.mouseStore.canvasMousePosition)\n\t\tconst gradientAngleDelta = coordinates.angle / 360\n\t\trenderedPosition.set(newPosition + gradientAngleDelta)\n\n\t\tif (gradientToolActive) return\n\t\tengine.stores.toolStore.tooltip = `${Math.round((newPosition < 0 ? 1 + newPosition : newPosition) * 100)}%`\n\t}\n\n\tconst degrees = renderedPosition.get() * 360\n\tconst location = getPointOnCircleByAngle(degrees, coordinates.radius)\n\tconst realLocation = Point.pixelAligned(\n\t\tPoint.add(Point.multiply(location, zoom), Point.multiply(coordinates.center, zoom)),\n\t)\n\n\tconst axisTransform = `translate(${Math.round(coordinates.center.x * zoom)}px, ${Math.round(\n\t\tcoordinates.center.y * zoom,\n\t)}px) translateZ(0) translateX(-50%) translateY(-50%)`\n\n\treturn (\n\t\t<>\n\t\t\t{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\twidth: coordinates.radius * 2 * zoom + styles.axisSafeAreaPerSide * 2,\n\t\t\t\t\theight: coordinates.radius * 2 * zoom + styles.axisSafeAreaPerSide * 2,\n\t\t\t\t\tborderRadius: \"50%\",\n\t\t\t\t\ttransform: axisTransform,\n\t\t\t\t}}\n\t\t\t\tonMouseEnter={() => {\n\t\t\t\t\tsetShowPlaceholder(true)\n\t\t\t\t\tupdatePlaceholderPosition(true)\n\t\t\t\t}}\n\t\t\t\tonMouseMove={() => {\n\t\t\t\t\tupdatePlaceholderPosition()\n\t\t\t\t}}\n\t\t\t\tonMouseLeave={() => {\n\t\t\t\t\tsetShowPlaceholder(false)\n\t\t\t\t\tif (gradientToolActive) return\n\t\t\t\t\tengine.stores.toolStore.tooltip = undefined\n\t\t\t\t}}\n\t\t\t\tonMouseDown={() => {\n\t\t\t\t\tconst gradientAngleDelta = coordinates.angle / 360\n\t\t\t\t\tconst position = renderedPosition.get() - gradientAngleDelta\n\t\t\t\t\tconst normalizedPosition = position < 0 ? 1 + position : position\n\t\t\t\t\tonAddStop(normalizedPosition)\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className={styles.conicAxis}></div>\n\t\t\t</div>\n\n\t\t\t<motion.div\n\t\t\t\tclassName={styles.placeholder}\n\t\t\t\tstyle={{\n\t\t\t\t\ttop: realLocation.y,\n\t\t\t\t\tleft: realLocation.x,\n\t\t\t\t\tvisibility: !gradientToolActive && showPlaceholder ? undefined : \"hidden\",\n\t\t\t\t}}\n\t\t\t\ttransformTemplate={transformTemplate}\n\t\t\t/>\n\t\t\t{/* Center area that doesn't respond any action */}\n\t\t\t<div\n\t\t\t\tclassName={cx(styles.conicCenterArea, gradientToolActive && styles.movingHandle)}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: axisTransform,\n\t\t\t\t}}\n\t\t\t></div>\n\t\t</>\n\t)\n}\n\nfunction GradientAxis({\n\tstartPosition,\n\tendPosition,\n\tstart,\n\tend,\n\tboxStart,\n\tboxEnd,\n\tzoom,\n\tgradientToolActive,\n\tonAddStop,\n}: {\n\tstartPosition: number\n\tendPosition: number\n\tstart: Point\n\tend: Point\n\tboxStart: Point\n\tboxEnd: Point\n\tzoom: number\n\tgradientToolActive: boolean\n\tonAddStop: (position: number) => void\n}) {\n\tconst [showPlaceholder, setShowPlaceholder] = React.useState(false)\n\tconst placeholderPositionRef = React.useRef(0)\n\tconst attemptToShowPlaceholderRef = React.useRef(false)\n\n\tconst updatePlaceholderPosition = (event: React.MouseEvent) => {\n\t\tif (!attemptToShowPlaceholderRef.current) return\n\n\t\t// We need the offsetY on the nativeEvent to calculate the position of the placeholder. If the\n\t\t// target of the nativeEvent is not the right one, don't show the placeholder just yet. We can't use\n\t\t// currentTarget because React binds events at the document level.\n\t\tif (event.nativeEvent.target !== event.currentTarget) return\n\n\t\t// Only when we can actually get the position from the mouse, show the placeholder.\n\t\tif (attemptToShowPlaceholderRef.current && !showPlaceholder) {\n\t\t\tsetShowPlaceholder(true)\n\t\t}\n\n\t\tconst position = getPositionOnAxis({ start, boxStart, boxEnd, y: event.nativeEvent.offsetY, zoom })\n\t\tplaceholderPositionRef.current = position\n\n\t\tif (gradientToolActive) return\n\t\tengine.stores.toolStore.tooltip = `${Math.round(position * 100)}%`\n\t}\n\t// Render a 1x1 container for the line segment at the center of the element.\n\t// This ensures that repositioning the stops doesn't update the translate\n\t// that positions the line on top of the element and ensures that the line\n\t// doesn't appear to \"jiggle\" as gradient stops are repositioned.\n\tconst center = Rect.center(Rect.fromTwoPoints(boxStart, boxEnd))\n\t// Then calculate start points offset from the center point, and use that to\n\t// translate the line back to its intended starting point, out of the 1x1\n\t// center point.\n\tconst height = Point.distance(start, end)\n\n\t// In every case except where both start and end position are\n\t// greater than the centre (0.5), we need to offset the line in\n\t// a negative direction so that it falls nicely between the two handles.\n\tconst direction = startPosition > 0.5 && endPosition > 0.5 ? 1 : -1\n\n\tconst offset = Point.distance(start, center) * direction\n\tconst pointOnLine = Point.distance(boxStart, boxEnd) * Math.abs(placeholderPositionRef.current - startPosition)\n\treturn (\n\t\t<div\n\t\t\tclassName={styles.lineTransform}\n\t\t\tstyle={{\n\t\t\t\ttransform: `translate(${Math.round(center.x * zoom)}px, ${Math.round(\n\t\t\t\t\tcenter.y * zoom,\n\t\t\t\t)}px) translateZ(0) rotate(${Point.angle(start, end).toFixed(4)}deg) translateX(-50%)`,\n\t\t\t}}\n\t\t>\n\t\t\t{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n\t\t\t<div\n\t\t\t\tclassName={styles.line}\n\t\t\t\tstyle={{\n\t\t\t\t\theight: height * zoom,\n\t\t\t\t\ttransform: `translateY(${offset * zoom}px)`,\n\t\t\t\t}}\n\t\t\t\tonMouseEnter={() => {\n\t\t\t\t\tattemptToShowPlaceholderRef.current = true\n\t\t\t\t}}\n\t\t\t\tonMouseMove={updatePlaceholderPosition}\n\t\t\t\tonMouseLeave={() => {\n\t\t\t\t\tattemptToShowPlaceholderRef.current = false\n\t\t\t\t\tsetShowPlaceholder(false)\n\n\t\t\t\t\tif (gradientToolActive) return\n\t\t\t\t\tengine.stores.toolStore.tooltip = undefined\n\t\t\t\t}}\n\t\t\t\tonMouseDown={() => {\n\t\t\t\t\tonAddStop(placeholderPositionRef.current)\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName={styles.placeholder}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\ty: pointOnLine * zoom,\n\t\t\t\t\t\tvisibility: !gradientToolActive && showPlaceholder ? undefined : \"hidden\",\n\t\t\t\t\t}}\n\t\t\t\t\ttransformTemplate={transformTemplate}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\ninterface PositionOnAxis {\n\tstart: Point\n\tboxStart: Point\n\tboxEnd: Point\n\ty: number\n\tzoom: number\n}\n\nfunction getPositionOnAxis({ start, boxStart, boxEnd, y, zoom }: PositionOnAxis) {\n\tconst rect = Rect.fromTwoPoints(boxStart, boxEnd)\n\tconst denominator = Point.distance(boxStart, boxEnd) * zoom\n\tconst needsOffset = !Rect.containsPoint(Rect.withMinSize(rect, { width: 2, height: 2 }), start)\n\tconst offsetAbs = Point.distance(boxStart, start) * zoom\n\tconst offset = needsOffset ? offsetAbs : offsetAbs * -1\n\tconst numerator = y - offset\n\n\treturn numerator / denominator\n}\n\nfunction RotationCircle({\n\tcoordinates,\n\tzoom,\n\tsize,\n\tgradientToolActive,\n\tonRotate,\n}: {\n\tcoordinates: GradientCoordinates\n\tzoom: number\n\tsize: number\n\tgradientToolActive: boolean\n\tonRotate?: () => void\n}) {\n\tconst [cursor, setCursor] = React.useState<string | undefined>(undefined)\n\tif (coordinates.type !== \"conic\" || !onRotate) return null\n\n\treturn (\n\t\t<div\n\t\t\tonMouseMove={() => {\n\t\t\t\tif (gradientToolActive) return\n\t\t\t\tconst { center } = coordinates\n\t\t\t\tconst angle = Point.angleFromX(center, engine.stores.mouseStore.latest.canvasMousePosition)\n\t\t\t\tsetCursor(rotationCursorSouthNorth(angle))\n\t\t\t}}\n\t\t\tclassName={styles.outerRotateCircumference}\n\t\t\tstyle={{\n\t\t\t\ttop: coordinates.center.y * zoom,\n\t\t\t\tleft: coordinates.center.x * zoom,\n\t\t\t\twidth: size,\n\t\t\t\theight: size,\n\t\t\t\tcursor: gradientToolActive ? \"unset\" : cursor,\n\t\t\t}}\n\t\t\tonMouseDown={onRotate}\n\t\t/>\n\t)\n}\n\n/** A transform template to use instead of defining one inline each time we rerender. Saves a bit of\n * performance. But also makes sure we don't give away a closure that retains memory reference for\n * potentially a long time. */\nfunction transformTemplate(_: unknown, x: string) {\n\treturn `${x} translateY(-50%) translateX(-50%)`\n}\n", "import \"GradientHandles.styles_3a30z1.wyw.css\"; export const conicGradientInnerRotationSafeArea = 40;\nexport const conicGradientOuterRotationSafeArea = 20;\nexport const moveOrResizeHandleSize = 9;\nexport const axisSafeAreaPerSide = 10;\nexport const handle = \"handle_hdi0p8q\";\nexport const selectedHandle = \"selectedHandle_s1bfq32m\";\nexport const placeholder = \"placeholder_p17jpch9\";\nexport const lineTransform = \"lineTransform_lra1u9e\";\nexport const outerRotateCircumference = \"outerRotateCircumference_ogx4i30\";\nexport const line = \"line_l1pzff63\";\nexport const centerPoint = \"centerPoint_c167wkl6\";\nexport const movingHandle = \"movingHandle_m1ipmuem\";\nexport const conicAxis = \"conicAxis_cjpzawj\";\nexport const conicCenterArea = \"conicCenterArea_clbxif\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PathSelectionState } from \"document/stores/PathSelectionStore.ts\"\nimport React from \"react\"\nimport type { ToolPropsWithManagerProps } from \"../props.ts\"\nimport type { VekterPathEngine } from \"./PathToolManager.tsx\"\nimport { PathToolManager } from \"./PathToolManager.tsx\"\n\nclass PathEdit extends React.PureComponent<ToolPropsWithManagerProps<VekterPathEngine>, PathSelectionState> {\n\tstatic engineChangeKeys = [EngineChange.PathSelection]\n\n\tstatic calculateState(): PathSelectionState {\n\t\treturn engine.stores.pathSelectionStore.state\n\t}\n\n\toverride render() {\n\t\treturn <PathToolManager {...this.props} {...this.state} />\n\t}\n}\n\nconst PathEditContainer = createContainer(PathEdit)\nexport { PathEditContainer as PathEdit }\n", "import { Rect } from \"library/render/types/Rect.ts\"\n\nconst minControlDistance = 10\n\nexport class CanvasControlSpatialStore {\n\tprivate inflatedRects: Rect[] = []\n\n\treset() {\n\t\tthis.inflatedRects = []\n\t}\n\n\t/** Returns whether there is enough space for the control. */\n\taddControlWithRect(rect: Rect): boolean {\n\t\tconst intersectsWithExistingControl = this.inflatedRects.some(existingRect => Rect.intersects(existingRect, rect))\n\t\tif (intersectsWithExistingControl) return false\n\n\t\tconst inflatedRect = Rect.inflate(rect, minControlDistance)\n\t\tthis.inflatedRects.push(inflatedRect)\n\t\treturn true\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isPathNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isStraightCurve } from \"library/render/traits/Path.ts\"\n\nexport function singleSelectedStraightPath(selectedNodes: CanvasNode[]) {\n\tconst firstNode = selectedNodes[0]\n\tif (selectedNodes.length !== 1 || !isPathNode(firstNode)) return null\n\tif (firstNode.pathSegments.length !== 2) return null\n\tconst pathSegment1 = firstNode.pathSegments[0]\n\tconst pathSegment2 = firstNode.pathSegments[1]\n\treturn isStraightCurve(pathSegment1, pathSegment2) ? firstNode : null\n}\n", "import { ThemeOverride } from \"@framerjs/fresco\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { NodeLinksContainer } from \"document/components/canvas-hud/NodeLinksContainer.tsx\"\nimport { Screens } from \"document/components/canvas-hud/Screens.tsx\"\nimport { Tools } from \"document/components/tools/index.tsx\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport {\n\ttype CanvasNode,\n\ttype CanvasTree,\n\ttype LoadedScopeNode,\n\ttype MaybeNodeID,\n\ttype NodeID,\n\tWebPageNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCanvasPageNode,\n\tisCodeComponentNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withBreakpointVariants } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport type { FramePoint } from \"document/models/FramePoint.ts\"\nimport { Tools as ToolType } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { isScopeUsingComponentTint } from \"../utils/getThemeOverrideMode.ts\"\nimport { VariantSuggestion } from \"./VariantSuggestion.tsx\"\n\ninterface Props {\n\tzoom: number\n\tcolorSamplerActive: boolean\n}\n\ninterface State {\n\ttree: CanvasTree\n\tselection: NodeID[]\n\thighlight: MaybeNodeID\n\tactiveScope: LoadedScopeNode\n\tvisibleGroundNodes: CanvasNode[]\n\ttool: ToolType\n\thandle: FramePoint | null\n\tshowTitles: boolean\n\tshowVariantSuggestion: boolean\n\tisViewOnly: boolean\n\t/** Used to show a comment indicator on the frame label */\n\tframesWithThreads: ReadonlySet<string>\n\tpreviewNodeId: MaybeNodeID\n\t/** Used only to force rendering when layout measurements are updated */\n\tdomLayoutUpdate: number\n\t/** Used to re-render code component screen titles */\n\tactiveBundleHash: string\n\t/**\n\t * Used to re-render external module components' titles when those are loaded.\n\t */\n\tvisibleGroundExternalModuleComponentsHash: string\n\tbreakpointsInOverlayEditMode: Map<NodeID, NodeID>\n\tgeneratingNodes: Set<NodeID>\n\tagentGeneratingNodes: Set<NodeID>\n\tagentGeneratingKey: string | undefined\n\tsectionBeingGenerated: NodeID | null\n}\n\nclass ControlsContainer extends React.PureComponent<Props, State> {\n\tstatic engineChangeKeys = [\n\t\tengine.stores.feedbackStore,\n\t\tEngineChange.Highlight,\n\t\tEngineChange.TreeStore,\n\t\tEngineChange.SelectionOutline,\n\t\tEngineChange.CanvasStore,\n\t\tEngineChange.TreeDOMLayoutSync,\n\t\tEngineChange.ActiveBundle,\n\t\tengine.stores.agentStore,\n\t\tengine.stores.loadedExternalModulesStore,\n\t\tengine.stores.debugStore,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.selectionStore,\n\t\tengine.stores.chromeStore,\n\t\tengine.stores.previewStore,\n\t\tengine.stores.overlayStore,\n\t\tengine.stores.projectStore,\n\t\tengine.stores.sessionStore,\n\t\tengine.stores.loadingStore,\n\t\tengine.stores.aiGenerationStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\tconst {\n\t\t\tagentStore,\n\t\t\ttreeStore,\n\t\t\toverlayStore,\n\t\t\taiGenerationStore,\n\t\t\tchromeStore,\n\t\t\tscopeStore,\n\t\t\ttoolStore,\n\t\t\tdebugStore,\n\t\t\tloadedExternalModulesStore,\n\t\t\tfeedbackStore,\n\t\t\tpreviewStore,\n\t\t\tselectionStore,\n\t\t\tcomponentsStore,\n\t\t} = engine.stores\n\t\tconst visibleGroundNodes = treeStore.visibleGroundNodesInActiveScope\n\n\t\t// We only render titles for the ground nodes hence iterating only over those.\n\t\tconst visibleGroundExternalModuleComponents = new Set<string>()\n\t\tfor (const node of visibleGroundNodes) {\n\t\t\tif (!isCodeComponentNode(node)) continue\n\t\t\tif (!loadedExternalModulesStore.hasModuleForIdentifier(node.codeComponentIdentifier)) continue\n\t\t\tvisibleGroundExternalModuleComponents.add(node.codeComponentIdentifier)\n\t\t}\n\t\tlet visibleGroundExternalModuleComponentsHash = \"\"\n\t\tfor (const c of visibleGroundExternalModuleComponents) {\n\t\t\tvisibleGroundExternalModuleComponentsHash += c\n\t\t}\n\n\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\") || chromeStore.isPreviewingLocaleOnCanvas\n\n\t\tconst isInSmartComponentScope = isSmartComponentNode(scopeStore.active)\n\t\tconst inComponentCanvasWithActiveOverlay = isInSmartComponentScope && overlayStore.editModeActive\n\n\t\tconst sectionBeingGenerated = aiGenerationStore.getSectionBeingGenerated()\n\n\t\t// Build a set of node ids that are currently being generated in AI.\n\t\tconst generatingNodes = visibleGroundNodes.reduce((acc, node) => {\n\t\t\tconst webPageNode = WebPageNode.getFor(treeStore.tree, node)\n\t\t\tif (!webPageNode) return acc\n\n\t\t\tconst isGenerating = aiGenerationStore.isGeneratingPage(webPageNode.id)\n\t\t\tif (!isGenerating) return acc\n\n\t\t\t// Check if the generating section belongs to the web page node.\n\t\t\tconst isGeneratingSection =\n\t\t\t\t[...webPageNode.descendants()].find(descendant => descendant.id === sectionBeingGenerated) ?? false\n\t\t\tif (isGeneratingSection) {\n\t\t\t\tacc.add(node.id)\n\t\t\t}\n\n\t\t\treturn acc\n\t\t}, new Set<NodeID>())\n\n\t\tconst agentGeneratingNodes = agentStore.activeBreakpoints\n\t\tconst activeAgent = agentStore.activeChatAgentId ? agentStore.getAgent(agentStore.activeChatAgentId) : undefined\n\t\tconst agentGeneratingKey = activeAgent ? `${activeAgent.id}:${activeAgent.turnId}` : undefined\n\n\t\treturn {\n\t\t\tisViewOnly,\n\t\t\ttree: engine.tree,\n\t\t\tdomLayoutUpdate: treeStore.domLayoutUpdate,\n\t\t\tselection: selectionStore.ids,\n\t\t\thighlight: treeStore.highlight,\n\t\t\tactiveScope: scopeStore.active,\n\t\t\tvisibleGroundNodes,\n\t\t\ttool: toolStore.tool,\n\t\t\thandle: toolStore.handle,\n\t\t\tshowTitles: !debugStore.hideTitles,\n\t\t\tshowVariantSuggestion: !engine.inMoveToolAndHasMoved() && !inComponentCanvasWithActiveOverlay,\n\t\t\tframesWithThreads: feedbackStore.framesWithThreads,\n\t\t\tpreviewNodeId: (previewStore.isActive && previewStore.previewNode?.id) || null,\n\t\t\tactiveBundleHash: componentsStore.activeBundleHash,\n\t\t\tvisibleGroundExternalModuleComponentsHash,\n\t\t\tbreakpointsInOverlayEditMode: overlayStore.variantsWithActiveOverlays,\n\t\t\tgeneratingNodes,\n\t\t\tagentGeneratingNodes,\n\t\t\tagentGeneratingKey,\n\t\t\tsectionBeingGenerated,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst {\n\t\t\ttree,\n\t\t\tvisibleGroundNodes,\n\t\t\tselection,\n\t\t\thighlight,\n\t\t\ttool,\n\t\t\tframesWithThreads,\n\t\t\tactiveScope,\n\t\t\tactiveBundleHash,\n\t\t\tvisibleGroundExternalModuleComponentsHash,\n\t\t\thandle,\n\t\t\tisViewOnly,\n\t\t\tshowTitles,\n\t\t\tshowVariantSuggestion,\n\t\t\tdomLayoutUpdate,\n\t\t\tbreakpointsInOverlayEditMode,\n\t\t\tgeneratingNodes,\n\t\t\tagentGeneratingNodes,\n\t\t\tagentGeneratingKey,\n\t\t\tsectionBeingGenerated,\n\t\t} = this.state\n\t\tconst { zoom, colorSamplerActive } = this.props\n\t\tconst hidden = !showTitles || colorSamplerActive\n\t\tconst isScaleTool = tool === ToolType.Scale\n\t\tconst breakpoints =\n\t\t\twithBreakpointVariants(activeScope) && activeScope.isValid() ? activeScope.getBreakpointValues() : undefined\n\n\t\treturn (\n\t\t\t<ThemeOverride mode={isScopeUsingComponentTint(activeScope) ? \"component\" : undefined}>\n\t\t\t\t<div className=\"ControlsContainer\">\n\t\t\t\t\t<div style={{ visibility: hidden ? \"hidden\" : undefined }}>\n\t\t\t\t\t\t<Screens\n\t\t\t\t\t\t\tvisibleGroundNodes={visibleGroundNodes}\n\t\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\t\thighlight={highlight}\n\t\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tframesWithThreads={framesWithThreads}\n\t\t\t\t\t\t\thomeNodeId={isCanvasPageNode(activeScope) ? activeScope.homeNodeId : null}\n\t\t\t\t\t\t\tactiveBundleHash={activeBundleHash}\n\t\t\t\t\t\t\tvisibleGroundExternalModuleComponentsHash={visibleGroundExternalModuleComponentsHash}\n\t\t\t\t\t\t\tbreakpoints={breakpoints}\n\t\t\t\t\t\t\tbreakpointsInOverlayEditMode={breakpointsInOverlayEditMode}\n\t\t\t\t\t\t\tgeneratingNodes={generatingNodes}\n\t\t\t\t\t\t\tagentGeneratingNodes={agentGeneratingNodes}\n\t\t\t\t\t\t\tagentGeneratingKey={agentGeneratingKey}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{showVariantSuggestion && (\n\t\t\t\t\t\t<VariantSuggestion\n\t\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\t\tactiveScope={activeScope}\n\t\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tdomLayoutUpdate={domLayoutUpdate}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<Tools\n\t\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t\ttree={tree}\n\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\thandle={handle}\n\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\thighlight={highlight}\n\t\t\t\t\t\tactiveScope={activeScope}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tsectionBeingGenerated={sectionBeingGenerated}\n\t\t\t\t\t/>\n\t\t\t\t\t{!isScaleTool ? <NodeLinksContainer background={false} /> : null}\n\t\t\t\t</div>\n\t\t\t</ThemeOverride>\n\t\t)\n\t}\n}\n\nconst controlsContainer = createContainer(ControlsContainer)\nexport { controlsContainer as ControlsContainer }\n", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, LoadedScopeNode, NodeID, ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { GestureVariants, WithReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport { withGestureVariants, withReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport type { GestureType, IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tisBreakpointVariant,\n\tisGestureVariant,\n\tisTopLevelVariant,\n\tisVariant,\n\ttitleForGestureType,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { type IsVectorSetItem, isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { type WithVectorSetItems, withVectorSetItems } from \"document/models/CanvasTree/traits/WithVectorSetItems.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport React, { useMemo } from \"react\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { getFetchURLsFromNode } from \"../chrome/properties/utils/useFetchURLsUsedInScope.ts\"\nimport { bottomSideOf, rightSideOf } from \"../tools/utils/FramesHelper.ts\"\nimport { ContextAction } from \"../utils/contextActions.ts\"\nimport { isWaitingForMeasuredRect } from \"../utils/isWaitingForMeasuredRect.ts\"\nimport { CanvasSuggestion } from \"./CanvasSuggestion.tsx\"\n\ninterface Props {\n\tactiveScope: LoadedScopeNode\n\tselection: NodeID[]\n\tzoom: number\n\ttree: CanvasTree\n\tisViewOnly: boolean\n\t/** Used only to force rendering when layout measurements are updated */\n\tdomLayoutUpdate: number\n}\n\nfunction shouldDisplayGesturesSuggestion(gestures: GestureVariants, hasFetchInScope: boolean) {\n\tconst hasHoverOrPressedVacancy = gestures.hover === null || gestures.pressed === null\n\n\tif (!hasFetchInScope) return hasHoverOrPressedVacancy\n\n\tconst hasLoadingVacancy = gestures.loading === null\n\tconst hasErrorVacancy = gestures.error === null\n\n\treturn hasHoverOrPressedVacancy || hasLoadingVacancy || hasErrorVacancy\n}\n\nfunction isScopeWithSuggestions<T extends Loaded<ScopeNode>>(\n\tscope: T,\n): scope is T & (WithReplicaVariants | WithVectorSetItems) {\n\treturn withReplicaVariants(scope) || withVectorSetItems(scope)\n}\n\nfunction isGroundNodeWithSuggestions<T extends Loaded<ScopeNode>>(\n\tnode: CanvasNode,\n\tscope: T,\n): node is CanvasNode & (IsVariant | IsVectorSetItem) {\n\tif (isVariant(node)) return !isBreakpointVariant(node) && withReplicaVariants(scope)\n\tif (isVectorSetItem(node)) return withVectorSetItems(scope)\n\n\treturn false\n}\n\nexport const VariantSuggestion = React.memo(function VariantSuggestions({\n\tselection,\n\ttree,\n\tactiveScope,\n\tzoom,\n\tisViewOnly,\n}: Props) {\n\tif (isViewOnly) return null\n\tconst nodes = tree.getNodes(selection)\n\tconst singleSelectedNode = nodes.length === 1 ? nodes[0] : undefined\n\tif (!singleSelectedNode || !tree.isGroundNode(singleSelectedNode)) return null\n\n\tif (isWaitingForMeasuredRect(singleSelectedNode)) return null\n\n\t// Make sure the selected ground node is in a Smart Component or Vector Set\n\tconst scopeNode = tree.getScopeNodeFor(singleSelectedNode)\n\tif (!scopeNode || scopeNode.id !== activeScope.id) return null\n\tif (!isScopeWithSuggestions(scopeNode)) return null\n\tif (!isGroundNodeWithSuggestions(singleSelectedNode, scopeNode)) return null\n\n\treturn <VariantSuggestionInner node={singleSelectedNode} scopeNode={scopeNode} tree={tree} zoom={zoom} />\n})\n\ninterface InnerProps {\n\tnode: CanvasNode & (IsVariant | IsVectorSetItem)\n\tscopeNode: Loaded<ScopeNode> & (WithReplicaVariants | WithVectorSetItems)\n\ttree: CanvasTree\n\tzoom: number\n}\n\nfunction getSuggestionRect(\n\tnode: CanvasNode,\n\ttree: CanvasTree,\n\tscopeNode: Loaded<ScopeNode> & (WithReplicaVariants | WithVectorSetItems),\n\trect: Rect,\n) {\n\tif (!isTopLevelVariant(node) && !isVectorSetItem(node)) return null\n\treturn rightSideOf(tree, scopeNode, node, rect, isVectorSetItem(node) ? rect.width : undefined)\n}\n\nfunction getGesturesForTopLevelVariant(scopeNode: Loaded<ScopeNode>, topLevelVariant: CanvasNode) {\n\tif (!withGestureVariants(scopeNode) || !isTopLevelVariant(topLevelVariant)) return null\n\n\t// Only show suggestion for gesture variants if the vacancy is still open\n\treturn scopeNode.getGesturesForTopLevelVariant(topLevelVariant)\n}\n\nfunction getTemporaryVariantRect(\n\tscopeNode: Loaded<ScopeNode>,\n\ttree: CanvasTree,\n\ttopLevelVariant: CanvasNode,\n\tgestures: GestureVariants | null,\n\trect: Rect,\n\thasFetchInScope: boolean,\n) {\n\tif (!gestures || !shouldDisplayGesturesSuggestion(gestures, hasFetchInScope)) return null\n\n\treturn bottomSideOf(tree, scopeNode, topLevelVariant, rect, 100)\n}\n\nfunction VariantSuggestionInner({ node, scopeNode, tree, zoom }: InnerProps) {\n\tconst fetchURLsUsedInActiveScope = useMemo(() => getFetchURLsFromNode(engine.componentLoader, node), [node])\n\tconst hasFetchInScope = fetchURLsUsedInActiveScope.length > 0\n\n\tconst topLevelVariant =\n\t\tisGestureVariant(node) && withGestureVariants(scopeNode) ? scopeNode.getTopLevelVariantForGesture(node) : node\n\n\t// Get the suggested rects\n\tconst baseNodeRect = tree.getRect(node)\n\tconst suggestionRect = getSuggestionRect(node, tree, scopeNode, baseNodeRect)\n\tconst gestures = getGesturesForTopLevelVariant(scopeNode, topLevelVariant)\n\tconst temporaryVariantRect = getTemporaryVariantRect(\n\t\tscopeNode,\n\t\ttree,\n\t\ttopLevelVariant,\n\t\tgestures,\n\t\tbaseNodeRect,\n\t\thasFetchInScope,\n\t)\n\n\tconst createTopLevelVariant = engine.scheduler.wrapHandler(() => {\n\t\tswitch (scopeNode.__class) {\n\t\t\tcase ClassDiscriminator.SmartComponentNode:\n\t\t\t\tif (\n\t\t\t\t\t!suggestionRect ||\n\t\t\t\t\t!topLevelVariant ||\n\t\t\t\t\t!isFrameNode(topLevelVariant) ||\n\t\t\t\t\t!isVariant(topLevelVariant) ||\n\t\t\t\t\t!withReplicaVariants(scopeNode)\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tContextAction.createVariant(\n\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\tengine.stores.treeStore.tree,\n\t\t\t\t\tengine.stores.selectionStore,\n\t\t\t\t\tengine.stores.canvasStore,\n\t\t\t\t\tscopeNode,\n\t\t\t\t\ttopLevelVariant,\n\t\t\t\t\tsuggestionRect,\n\t\t\t\t)\n\t\t\t\tbreak\n\t\t\tcase ClassDiscriminator.VectorSetNode:\n\t\t\t\tif (!isVectorSetItem(node) || !withVectorSetItems(scopeNode) || isNull(suggestionRect)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tContextAction.createVectorSetItem(engine.stores, scopeNode, node, suggestionRect, \"canvas\")\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t})\n\n\tconst createGestureVariant = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\t\tif (!gestures || !withGestureVariants(scopeNode)) return\n\n\t\tfunction createGesture(scope: Loaded<ScopeNode>, gesture: GestureType) {\n\t\t\tif (\n\t\t\t\t!engine.tree.has(topLevelVariant.id) ||\n\t\t\t\t!topLevelVariant ||\n\t\t\t\t!isFrameNode(topLevelVariant) ||\n\t\t\t\t!isVariant(topLevelVariant) ||\n\t\t\t\t!withReplicaVariants(scope) ||\n\t\t\t\t!temporaryVariantRect\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst overrides = node && isGestureVariant(node) ? node.replicaInfo?.overrides : undefined\n\n\t\t\tContextAction.createVariant(\n\t\t\t\tengine.componentLoader,\n\t\t\t\tengine.stores.treeStore.tree,\n\t\t\t\tengine.stores.selectionStore,\n\t\t\t\tengine.stores.canvasStore,\n\t\t\t\tscope,\n\t\t\t\ttopLevelVariant,\n\t\t\t\ttemporaryVariantRect,\n\t\t\t\t{\n\t\t\t\t\tgesture,\n\t\t\t\t\toverrides,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Hover,\n\t\t\t\tenabled: !gestures.hover,\n\t\t\t\tclick: () => createGesture(scopeNode, \"hover\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Pressed,\n\t\t\t\tenabled: !gestures.pressed,\n\t\t\t\tclick: () => createGesture(scopeNode, \"pressed\"),\n\t\t\t},\n\t\t]\n\n\t\tif (hasFetchInScope) {\n\t\t\tmenuItems.push({\n\t\t\t\tlabel: Dictionary.Loading,\n\t\t\t\tenabled: !gestures.loading,\n\t\t\t\tclick: () => createGesture(scopeNode, \"loading\"),\n\t\t\t})\n\n\t\t\tif (gestures.loading) {\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: \"Error\",\n\t\t\t\t\tenabled: !gestures.error,\n\t\t\t\t\tclick: () => createGesture(scopeNode, \"error\"),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst enabledItems = menuItems.filter(item => item.enabled && item.click)\n\t\tif (enabledItems.length === 1) {\n\t\t\tconst enabledItem = enabledItems[0]\n\t\t\tassert(enabledItem?.click)\n\t\t\tenabledItem.click()\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t})\n\n\tconst variantTitles = gestures && temporaryVariantTitles(gestures, hasFetchInScope)\n\n\tconst { title, tooltip } = withReplicaVariants(scopeNode)\n\t\t? {\n\t\t\t\ttitle: Dictionary.Variant,\n\t\t\t\ttooltip: `Add ${Dictionary.Variant}`,\n\t\t\t}\n\t\t: {\n\t\t\t\ttitle: Dictionary.Add,\n\t\t\t\ttooltip: `Add ${Dictionary.Vector}`,\n\t\t\t}\n\n\tconst isVectorSetItemSuggestion = isVectorSetItem(topLevelVariant)\n\tconst tint = isVectorSetItemSuggestion ? colors.tint : undefined\n\tconst tintDimmed = isVectorSetItemSuggestion ? colors.tintDimmed : undefined\n\n\treturn (\n\t\t<>\n\t\t\t{suggestionRect && (\n\t\t\t\t<CanvasSuggestion\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t{...suggestionRect}\n\t\t\t\t\ttint={tint}\n\t\t\t\t\ttintDimmed={tintDimmed}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\ttooltip={tooltip}\n\t\t\t\t\tonMouseDown={createTopLevelVariant}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{temporaryVariantRect && variantTitles && (\n\t\t\t\t<CanvasSuggestion\n\t\t\t\t\tzoom={zoom}\n\t\t\t\t\t{...temporaryVariantRect}\n\t\t\t\t\ttint={tint}\n\t\t\t\t\ttintDimmed={tintDimmed}\n\t\t\t\t\ttitle={variantTitles.join(\" / \")}\n\t\t\t\t\ttooltip={temporaryVariantTooltip(variantTitles)}\n\t\t\t\t\tonMouseDown={createGestureVariant}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nfunction temporaryVariantTitles(gestureVariants: GestureVariants, hasFetchInScope: boolean) {\n\tconst variantTitles: string[] = []\n\n\tif (!gestureVariants.hover) {\n\t\tvariantTitles.push(titleForGestureType(\"hover\"))\n\t}\n\n\tif (!gestureVariants.pressed) {\n\t\tvariantTitles.push(titleForGestureType(\"pressed\"))\n\t}\n\n\tif (!gestureVariants.loading && hasFetchInScope) {\n\t\tvariantTitles.push(titleForGestureType(\"loading\"))\n\t}\n\n\tif (gestureVariants.loading && !gestureVariants.error) {\n\t\tvariantTitles.push(titleForGestureType(\"error\"))\n\t}\n\n\treturn variantTitles\n}\n\nfunction temporaryVariantTooltip(titles: string[]) {\n\tif (titles.length === 1) return `Add ${titles[0]} Variant`\n\n\tconst lastItem = titles.pop()\n\tconst variants = `${titles.join(\", \")} or ${lastItem}`\n\n\treturn `Add ${variants} Variant`\n}\n", "import \"CanvasSuggestion.styles_17an5d0.wyw.css\"; export const container = \"container_c1ky6wg5\";\nexport const stack = \"stack_s1wjybqg\";\nexport const hitTarget = \"hitTarget_hmsy2o8\";\nexport const hitTargetFullSize = \"hitTargetFullSize_h375zf5\";\nexport const hitTargetTint = \"hitTargetTint_hc6y30l\";", "import { IconPlusEncircled, Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type React from \"react\"\nimport * as styles from \"./CanvasSuggestion.styles.ts\"\n\ninterface Props {\n\tx: number\n\ty: number\n\twidth: number\n\theight: number\n\tzoom: number\n\ttitle: string\n\ttooltip: string\n\tsmallHitTarget?: boolean\n\ttint?: string\n\ttintDimmed?: string\n\tonMouseDown: (event: React.MouseEvent) => void\n}\n\nexport function CanvasSuggestion({\n\tonMouseDown,\n\ttitle,\n\ttooltip,\n\tsmallHitTarget = false,\n\tzoom,\n\ttint,\n\ttintDimmed,\n\t...canvasRect\n}: Props) {\n\tconst rect = Rect.multiply(canvasRect, zoom)\n\n\tconst isIconVisible = rect.width > 30 && rect.height > 30\n\n\tconst titleFitsVertically = rect.height > 80 && rect.width > 50\n\tconst titleFitsHorizontally = rect.width > 200 && rect.height > 30\n\n\tconst isTitleVisible = titleFitsVertically || titleFitsHorizontally\n\tconst flipDirection = !titleFitsVertically && titleFitsHorizontally\n\n\tconst mouseDownHandler = (event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\t\tonMouseDown(event)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"center\"\n\t\t\tclassName={styles.container}\n\t\t\tgap={0}\n\t\t\tstyle={{\n\t\t\t\tleft: rect.x,\n\t\t\t\ttop: rect.y,\n\t\t\t\twidth: rect.width,\n\t\t\t\theight: rect.height,\n\t\t\t\t\"--tint\": tint,\n\t\t\t\t\"--tint-dimmed\": tintDimmed,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\trole=\"button\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tclassName={cx(styles.hitTarget, !smallHitTarget && styles.hitTargetFullSize, styles.hitTargetTint)}\n\t\t\t\tonMouseDown={mouseDownHandler}\n\t\t\t/>\n\t\t\t<Stack\n\t\t\t\ttitle={tooltip}\n\t\t\t\tdirection={flipDirection ? \"row\" : \"column\"}\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"center\"\n\t\t\t\tclassName={styles.stack}\n\t\t\t\tgap={8}\n\t\t\t>\n\t\t\t\t{isIconVisible && <IconPlusEncircled />}\n\t\t\t\t{isTitleVisible && <div>{title}</div>}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { ThemeOverride } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment } from \"app/experiments.ts\"\nimport { MetricsInteractionViews, MetricsViewContext } from \"app/metrics.ts\"\nimport { CanvasSandboxRenderer, canvasSandboxZIndex } from \"canvas-sandbox-renderer/CanvasSandboxRenderer.tsx\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { Grid, gridOverdraw, shouldShowPixelGrid } from \"document/components/canvas-hud/Grid.tsx\"\nimport { GridOverlayContainer } from \"document/components/canvas-hud/OverlayGrids.tsx\"\nimport { RulerWrapper } from \"document/components/canvas-hud/RulerWrapper.tsx\"\nimport { CanvasEventTarget } from \"document/components/canvas/CanvasEventTarget.tsx\"\nimport { FeedbackSurface } from \"document/components/canvas/FeedbackSurface.tsx\"\nimport { HUD } from \"document/components/canvas/HUD.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { isZoomTool } from \"document/stores/ToolStore.ts\"\nimport React from \"react\"\nimport { canvasTransform, canvasTransformContainerStyle } from \"renderer/CanvasRenderer.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { VekterCollectionReferenceVariableEditor } from \"../VekterCollectionReferenceVariableEditor.tsx\"\nimport { VekterDateVariableEditor } from \"../VekterDateVariableEditor.tsx\"\nimport { VekterEnumVariableEditor } from \"../VekterEnumVariableEditor.tsx\"\nimport { NodeLinksContainer } from \"../canvas-hud/NodeLinksContainer.tsx\"\nimport { CanvasLoadingShield } from \"../chrome/CanvasLoadingShield.tsx\"\nimport { createContainer } from \"../utils/createContainer.ts\"\nimport { isScopeUsingComponentTint } from \"../utils/getThemeOverrideMode.ts\"\nimport { AgentUpdateHighlightContainer } from \"./AgentUpdateHighlightContainer.tsx\"\nimport { CanvasDropZone } from \"./CanvasDropZone.tsx\"\nimport { MultiplayerHUD } from \"./MultiplayerHUD.tsx\"\nimport { VekterCollectionRichTextVariableEditor } from \"./VekterCollectionRichTextVariableEditor.tsx\"\nimport { VekterRichTextEditor } from \"./VekterRichTextEditor.tsx\"\nimport { VekterStringVariableEditor } from \"./VekterStringVariableEditor.tsx\"\n\ninterface State {\n\tcursor?: string\n\tzoom: number\n\tisInteractive: boolean\n\tisViewportEmpty?: boolean\n\tcanvasOffsetX: number\n\tcanvasOffsetY: number\n\ttool: Tools\n\tfeedbackModeIsActive: boolean\n\tisUserInteractionsDisabled: boolean\n\tdisplayOverlayGrids: boolean\n\tdisplayPixelGrid: boolean\n\tactiveScopeId: NodeID\n\tpixelGridOffsetX: number\n\tpixelGridOffsetY: number\n}\nclass Canvas extends React.PureComponent<{}, State> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.CanvasLiveTransform,\n\t\tEngineChange.CanvasZoom,\n\t\tEngineChange.DocumentSettings,\n\t\tengine.stores.feedbackStore,\n\t\tEngineChange.UserDefaultsStore,\n\t\tengine.stores.mouseCursorStore,\n\t\tengine.stores.loadingStore,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.agentStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\t// When editing vectors at high zoom, the grid container being offset by 0.5px in some\n\t\t// ancestor means that drawing will appear to be misaligned to the grid. To ensure the grid\n\t\t// is useful, we offset it to be pixel aligned to the shape container.\n\t\tconst pathEditorOffset = engine.stores.toolStore.nodeInPathEditorOffset\n\n\t\tconst { canvasStore, persistedUserDefaults, toolStore, scopeStore, mouseCursorStore, loadingStore } = engine.stores\n\n\t\treturn {\n\t\t\tcanvasOffsetX: canvasStore.offset.x,\n\t\t\tcanvasOffsetY: canvasStore.offset.y,\n\t\t\tzoom: canvasStore.zoom,\n\t\t\tisInteractive: canvasStore.isInteractive,\n\t\t\tisViewportEmpty: canvasStore.contentOutOfView,\n\t\t\tcursor: mouseCursorStore.current,\n\t\t\ttool: toolStore.tool,\n\t\t\tdisplayOverlayGrids: persistedUserDefaults.displayGrids,\n\t\t\tfeedbackModeIsActive: toolStore.feedbackModeActive,\n\t\t\tisUserInteractionsDisabled: loadingStore.isUserInteractionsDisabled,\n\t\t\tdisplayPixelGrid: shouldShowPixelGrid(engine.stores),\n\t\t\tactiveScopeId: scopeStore.activeId,\n\t\t\tpixelGridOffsetX: pathEditorOffset ? pathEditorOffset.x : 0,\n\t\t\tpixelGridOffsetY: pathEditorOffset ? pathEditorOffset.y : 0,\n\t\t}\n\t}\n\n\tprivate hudBackgroundSurface = React.createRef<HTMLDivElement>()\n\tprivate gridSurface = React.createRef<HTMLDivElement>()\n\tprivate hudSurface = React.createRef<HTMLDivElement>()\n\tprivate canvasPopoverContainer = React.createRef<HTMLDivElement>()\n\tprivate richTextEditorSurface = React.createRef<HTMLDivElement>()\n\tprivate feedbackSurfaceWrapper = React.createRef<HTMLDivElement>()\n\tprivate multiplayerCursorsWrapper = React.createRef<HTMLDivElement>()\n\n\toverride componentDidMount() {\n\t\tthis.componentDidUpdate(this.props, this.state)\n\t}\n\n\toverride componentDidUpdate(_: unknown, previousState: Readonly<State>) {\n\t\tconst hudBackgroundSurface = this.hudBackgroundSurface.current\n\t\tconst gridSurface = this.gridSurface.current\n\t\tconst hudSurface = this.hudSurface.current\n\t\tconst canvasPopoverContainer = this.canvasPopoverContainer.current\n\t\tconst richTextEditorSurface = this.richTextEditorSurface.current\n\t\tconst feedbackSurfaceWrapper = this.feedbackSurfaceWrapper.current\n\t\tconst multiplayerCursorsWrapper = this.multiplayerCursorsWrapper.current\n\n\t\tconst { zoom, canvasOffsetX, canvasOffsetY, isInteractive, displayPixelGrid, isViewportEmpty, tool } = this.state\n\t\tconst hudOffsetX = canvasOffsetX * zoom\n\t\tconst hudOffsetY = canvasOffsetY * zoom\n\n\t\tconst gridOffsetX = this.state.pixelGridOffsetX * zoom\n\t\tconst gridOffsetY = this.state.pixelGridOffsetY * zoom\n\n\t\tif (richTextEditorSurface) {\n\t\t\t// We don't want to move or touch the text editor surface while scrolling or zooming,\n\t\t\t// unless it has a text editor. This works around the new chrome compositor resizing the\n\t\t\t// ground node layers by 1 pixel and repainting them while scrolling, zooming, or moving.\n\t\t\tif (isInteractive || richTextEditorSurface.firstElementChild) {\n\t\t\t\trichTextEditorSurface.style.opacity = \"1\"\n\t\t\t\trichTextEditorSurface.style.transform = canvasTransform(zoom, canvasOffsetX, canvasOffsetY)\n\t\t\t} else {\n\t\t\t\trichTextEditorSurface.style.opacity = \"0\"\n\t\t\t}\n\t\t}\n\n\t\t// HUD elements we stop and hide when not interactive\n\t\tfor (const surface of [canvasPopoverContainer, feedbackSurfaceWrapper, multiplayerCursorsWrapper]) {\n\t\t\tif (!surface) continue\n\t\t\tif (isInteractive) {\n\t\t\t\tsurface.style.opacity = \"1\"\n\t\t\t\tsurface.style.transform = `translateX(${-hudOffsetX}px) translateY(${-hudOffsetY}px)`\n\t\t\t} else {\n\t\t\t\tsurface.style.opacity = \"0\"\n\t\t\t}\n\t\t}\n\n\t\t// HUD, background and foreground\n\t\tfor (const surface of [hudBackgroundSurface, hudSurface]) {\n\t\t\tif (!surface) continue\n\t\t\tsurface.style.opacity = isInteractive ? \"1\" : \"0\"\n\t\t\tsurface.style.transition = isInteractive ? \"opacity 0.15s\" : \"\"\n\t\t\tif (!isInteractive) continue\n\t\t\tsurface.style.transform = `translateX(${-hudOffsetX}px) translateY(${-hudOffsetY}px)`\n\t\t}\n\n\t\t// Grid\n\t\tif (gridSurface) {\n\t\t\t// Only show and update grid if it is potentially being rendered.\n\t\t\tif (isInteractive && displayPixelGrid) {\n\t\t\t\tgridSurface.style.opacity = \"1\"\n\t\t\t\tconst xSnapOff = fmod(hudOffsetX + gridOffsetX, zoom)\n\t\t\t\tconst ySnapOff = fmod(hudOffsetY + gridOffsetY, zoom)\n\t\t\t\tgridSurface.style.transform = `translateX(${-xSnapOff}px) translateY(${-ySnapOff}px)`\n\t\t\t} else {\n\t\t\t\tgridSurface.style.opacity = \"0\"\n\t\t\t}\n\t\t}\n\n\t\tconst shouldShowViewportEmptyToast =\n\t\t\tengine.stores.persistedUserDefaults.showScrollToContentToast &&\n\t\t\tisViewportEmpty &&\n\t\t\t(engine.stores.toolStore.isDefaultToolActive || isZoomTool(tool))\n\n\t\tif (this.state.activeScopeId !== previousState?.activeScopeId) {\n\t\t\tthis.removeViewportEmptyToast()\n\t\t}\n\n\t\tif (shouldShowViewportEmptyToast) {\n\t\t\t// If there's already a viewport empty toast scheduled, do nothing,\n\t\t\t// otherwise start the timer.\n\t\t\tthis.scheduleViewportEmptyToast()\n\t\t} else {\n\t\t\t// If there's a scheduled viewport empty toast but we no longer need\n\t\t\t// to show the toast (e.g. user pans back to content)\n\t\t\tthis.cancelScheduledViewportEmptyToast?.()\n\t\t}\n\t}\n\n\tprivate cancelScheduledViewportEmptyToast: (() => void) | null = null\n\tprivate scheduleViewportEmptyToast = () => {\n\t\tif (this.cancelScheduledViewportEmptyToast) return\n\n\t\tconst viewportEmptyToastTimer = window.setTimeout(() => {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"info\",\n\t\t\t\tprimaryText: \"Your content\",\n\t\t\t\tsecondaryText: \"is out of view.\",\n\t\t\t\tkey: \"canvas-viewport-empty\",\n\t\t\t\ticon: \"view-only\",\n\t\t\t\tduration: 3000,\n\t\t\t\taction: {\n\t\t\t\t\ttitle: Dictionary.Show,\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\tengine.stores.canvasStore.zoomToFitAll()\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tshowCloseButton: \"never\",\n\n\t\t\t\tonDisappear: () => {\n\t\t\t\t\tthis.cancelScheduledViewportEmptyToast = null\n\t\t\t\t},\n\t\t\t})\n\t\t}, 500)\n\n\t\tthis.cancelScheduledViewportEmptyToast = () => {\n\t\t\twindow.clearTimeout(viewportEmptyToastTimer)\n\t\t\tthis.cancelScheduledViewportEmptyToast = null\n\t\t}\n\t}\n\tprivate removeViewportEmptyToast = () => {\n\t\ttoast({\n\t\t\ttype: \"remove\",\n\t\t\tkey: \"canvas-viewport-empty\",\n\t\t})\n\n\t\tthis.cancelScheduledViewportEmptyToast?.()\n\t}\n\n\toverride render() {\n\t\tconst {\n\t\t\tcursor,\n\t\t\tfeedbackModeIsActive,\n\t\t\tisInteractive,\n\t\t\tisUserInteractionsDisabled,\n\t\t\tdisplayOverlayGrids,\n\t\t\tdisplayPixelGrid,\n\t\t\ttool,\n\t\t} = this.state\n\t\tconst isScaleTool = tool === Tools.Scale\n\t\tconst canvas = (\n\t\t\t<>\n\t\t\t\t<CanvasEventTarget cursor={cursor}>\n\t\t\t\t\t<ThemeOverride\n\t\t\t\t\t\tmode={isScopeUsingComponentTint(engine.tree.get(this.state.activeScopeId)) ? \"component\" : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"hudBackgroundSurface\"\n\t\t\t\t\t\t\tstyle={{ ...hudSurfaceStyle, ...hudBackgroundStyle }}\n\t\t\t\t\t\t\tref={this.hudBackgroundSurface}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{isUserInteractionsDisabled || isScaleTool ? null : <NodeLinksContainer background />}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</ThemeOverride>\n\t\t\t\t\t<CanvasSandboxRenderer />\n\t\t\t\t\t<div className=\"gridSurface\" style={gridSurfaceStyle} ref={this.gridSurface}>\n\t\t\t\t\t\t{displayPixelGrid && <Grid />}\n\t\t\t\t\t</div>\n\t\t\t\t\t<CanvasDropZone />\n\t\t\t\t\t<div className=\"richTextEditorSurface\" style={textEditorSurfaceStyle} ref={this.richTextEditorSurface}>\n\t\t\t\t\t\t{isUserInteractionsDisabled ? null : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{tool === Tools.RichTextEdit && <VekterRichTextEditor />}\n\t\t\t\t\t\t\t\t{tool === Tools.RichTextVariableEdit && <VekterCollectionRichTextVariableEditor />}\n\t\t\t\t\t\t\t\t{tool === Tools.StringVariableEdit && <VekterStringVariableEditor />}\n\t\t\t\t\t\t\t\t{tool === Tools.DateVariableEdit && <VekterDateVariableEditor />}\n\t\t\t\t\t\t\t\t{tool === Tools.EnumVariableEdit && <VekterEnumVariableEditor />}\n\t\t\t\t\t\t\t\t{tool === Tools.CollectionReferenceVariableEdit && <VekterCollectionReferenceVariableEditor />}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"hudSurface\" style={hudSurfaceStyle} ref={this.hudSurface}>\n\t\t\t\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t\t\t\t<ThemeOverride\n\t\t\t\t\t\t\t\tmode={isScopeUsingComponentTint(engine.tree.get(this.state.activeScopeId)) ? \"component\" : undefined}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<AgentUpdateHighlightContainer isInteractive={isInteractive} />\n\t\t\t\t\t\t\t</ThemeOverride>\n\t\t\t\t\t\t</Experiment>\n\t\t\t\t\t\t{displayOverlayGrids ? <GridOverlayContainer /> : null}\n\t\t\t\t\t\t{isUserInteractionsDisabled ? null : <HUD />}\n\t\t\t\t\t</div>\n\t\t\t\t\t{feedbackModeIsActive && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"feedbackSurfaceEventTarget\"\n\t\t\t\t\t\t\tstyle={{ position: \"absolute\", top: 0, left: 0, width: \"100%\", height: \"100%\" }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.FEEDBACK_SURFACE}>\n\t\t\t\t\t\t\t\t<div className=\"feedbackSurfaceWrapper\" ref={this.feedbackSurfaceWrapper}>\n\t\t\t\t\t\t\t\t\t<FeedbackSurface zoom={this.state.zoom} />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className=\"multiplayerCursorsWrapper\" ref={this.multiplayerCursorsWrapper}>\n\t\t\t\t\t\t<MultiplayerHUD zoom={this.state.zoom} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<RulerWrapper />\n\t\t\t\t</CanvasEventTarget>\n\t\t\t\t<div ref={this.canvasPopoverContainer} id=\"canvas_popover_portal\" style={hudSurfaceStyle} />\n\t\t\t</>\n\t\t)\n\t\treturn <CanvasLoadingShield enabled={tool === Tools.LoadingShield}>{canvas}</CanvasLoadingShield>\n\t}\n}\n\nconst hudSurfaceStyle: React.CSSProperties = {\n\t...canvasTransformContainerStyle,\n\ttransitionTimingFunction: \"ease-in-out\",\n}\n\nconst hudBackgroundStyle: React.CSSProperties = {\n\t...canvasTransformContainerStyle,\n\tzIndex: canvasSandboxZIndex - 1,\n}\n\nconst textEditorSurfaceStyle: React.CSSProperties = {\n\t...canvasTransformContainerStyle,\n\tWebkitFontSmoothing: \"antialiased\",\n\tMozOsxFontSmoothing: \"grayscale\",\n}\n\nconst gridSurfaceStyle: React.CSSProperties = {\n\t...canvasTransformContainerStyle,\n\twidth: undefined,\n\theight: undefined,\n\tbottom: -gridOverdraw,\n\tright: -gridOverdraw,\n\twillChange: \"transform, opacity\",\n\tbackground: \"transparent\",\n\topacity: \"1\",\n}\n\nfunction fmod(a: number, b: number): number {\n\treturn a - Math.floor(a / b) * b\n}\n\nconst CanvasContainer = createContainer(Canvas)\nexport { CanvasContainer as Canvas }\n", "import { isSafari } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { CanvasElementTransform } from \"renderer/CanvasElementTransform.tsx\"\nimport { useCanvasZoom, useNodeMatrix, useNodeRect } from \"./editorUtils.tsx\"\n\n// We need an element transform here for Safari, because the surface may get 3d accelerated for any\n// reason, making the fonts blurry in a zoomed state.\nconst needsTransform = isSafari()\n\ninterface EditorNodeTransformProps {\n\tnode: CanvasNode\n\tchildren?: React.ReactNode\n}\n\nexport function EditorNodeTransform({ node, children }: EditorNodeTransformProps) {\n\tconst zoom = useCanvasZoom()\n\tconst rect = useNodeRect(node, node.id)\n\tconst matrix = useNodeMatrix(node, node.id)\n\n\treturn (\n\t\t<CanvasElementTransform\n\t\t\tenabled={needsTransform}\n\t\t\tid={node.id}\n\t\t\tscale={zoom}\n\t\t\toffset={0}\n\t\t\tleft={rect.x}\n\t\t\ttop={rect.y}\n\t\t\twidth={rect.width}\n\t\t\theight={rect.height}\n\t\t\tmatrix={matrix}\n\t\t>\n\t\t\t{children}\n\t\t</CanvasElementTransform>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { CollectionReferenceVariableEditor } from \"./canvas/CollectionReferenceVariableEditor.tsx\"\nimport { EditorNodeTransform } from \"./canvas/EditorNodeTransform.tsx\"\nimport { CollectionReferenceVariableEditTool } from \"./tools/CollectionReferenceVariableEditTool.ts\"\n\nexport function VekterCollectionReferenceVariableEditor() {\n\tconst isInteractive = engine.stores.canvasStore.isInteractive\n\tconst scopeNode = engine.stores.scopeStore.useState(state => state.active)\n\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = engine.tool instanceof CollectionReferenceVariableEditTool ? engine.tool : undefined\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getNode()\n\t\t\tif (!node) return\n\n\t\t\treturn { tool, node, renderId: node.id }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.toolStore],\n\t)\n\n\tif (!props?.tool || !props.node) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<CollectionReferenceVariableEditor {...props} hidden={!isInteractive} scopeNode={scopeNode} />\n\t\t</EditorNodeTransform>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { DateVariableEditor } from \"./canvas/DateVariableEditor.tsx\"\nimport { EditorNodeTransform } from \"./canvas/EditorNodeTransform.tsx\"\nimport { DateVariableEditTool } from \"./tools/DateVariableEditTool.ts\"\n\nexport function VekterDateVariableEditor() {\n\tconst scopeNode = engine.stores.scopeStore.useState(state => state.active)\n\tconst isInteractive = engine.stores.canvasStore.isInteractive\n\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = getActiveDateVariableEditTool()\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getNode()\n\t\t\tif (!node) return\n\n\t\t\treturn { tool, node, renderId: node.id }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.toolStore],\n\t)\n\n\tif (!props) return null\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<DateVariableEditor {...props} backdropEnabled={false} hidden={!isInteractive} scopeNode={scopeNode} />\n\t\t</EditorNodeTransform>\n\t)\n}\n\nfunction getActiveDateVariableEditTool(): DateVariableEditTool | undefined {\n\tif (engine.tool instanceof DateVariableEditTool) return engine.tool\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { EditorNodeTransform } from \"./canvas/EditorNodeTransform.tsx\"\nimport { EnumVariableEditor } from \"./canvas/EnumVariableEditor.tsx\"\nimport { EnumVariableEditTool } from \"./tools/EnumVariableEditTool.ts\"\n\nexport function VekterEnumVariableEditor() {\n\tconst scopeNode = engine.stores.scopeStore.useState(state => state.active)\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = getActiveEnumVariableEditTool()\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getNode()\n\t\t\tif (!node) return\n\n\t\t\treturn { tool, node, renderId: node.id }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.toolStore],\n\t)\n\n\tif (!props) return null\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<EnumVariableEditor {...props} scopeNode={scopeNode} />\n\t\t</EditorNodeTransform>\n\t)\n}\n\nfunction getActiveEnumVariableEditTool(): EnumVariableEditTool | undefined {\n\tif (engine.tool instanceof EnumVariableEditTool) return engine.tool\n}\n", "import { cx } from \"@linaria/core\"\nimport { AnimatePresence } from \"framer-motion\"\nimport React from \"react\"\nimport * as styles from \"./CanvasLoadingShield.styles.ts\"\nimport { DelayMountOrUnmount } from \"./shared/DelayUnmount.tsx\"\n\ninterface Props {\n\tenabled: boolean\n\tchildren?: React.ReactNode\n}\n\n/**\n * Cover the children with a faded overlay when loading, at the same time block interactions to the canvas including\n * panning and zooming, by disabling the pointer events on the wrapper.\n */\nexport const CanvasLoadingShield = React.memo(function CanvasLoadingShield({ enabled, children }: Props) {\n\treturn (\n\t\t<>\n\t\t\t<div className={cx(enabled && styles.blockPointerEvents)}>{children}</div>\n\t\t\t<DelayMountOrUnmount visible={enabled} mountDelay={0} minimumVisible={300}>\n\t\t\t\t<AnimatePresence>\n\t\t\t\t\t<div className={styles.overlay} />\n\t\t\t\t</AnimatePresence>\n\t\t\t</DelayMountOrUnmount>\n\t\t</>\n\t)\n})\n", "import \"CanvasLoadingShield.styles_1tow4xg.wyw.css\"; export const overlay = \"overlay_o1eizccc\";\nexport const blockPointerEvents = \"blockPointerEvents_bcxojyn\";", "import { emptyArray } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { AnimatePresence, motion, type MotionProps } from \"framer-motion\"\nimport { Rect } from \"library/index.ts\"\nimport React from \"react\"\nimport { isWaitingForMeasuredRect } from \"../utils/isWaitingForMeasuredRect.ts\"\nimport { BorderSweepOverlay } from \"./BorderSweepOverlay.tsx\"\n\ninterface AgentUpdateHighlightContainerProps {\n\tisInteractive: boolean\n}\n\nexport function AgentUpdateHighlightContainer({ isInteractive }: AgentUpdateHighlightContainerProps) {\n\tconst previousInteractiveBoxesRef = React.useRef<AgentUpdateHighlightBoxes>({\n\t\toutlineBoxes: emptyArray(),\n\t\tfilledBoxes: emptyArray(),\n\t})\n\tconst boxes = useEngineState(\n\t\t() => {\n\t\t\t// When canvas is not interactive, we hide the HUD layer with opacity: 0 anyway, so we\n\t\t\t// don't need to do all the calculations for the boxes.\n\t\t\tif (!isInteractive) return previousInteractiveBoxesRef.current\n\t\t\tconst nextBoxes = getAgentUpdateHighlightBoxes()\n\t\t\tpreviousInteractiveBoxesRef.current = nextBoxes\n\t\t\treturn nextBoxes\n\t\t},\n\t\t[isInteractive],\n\t\t[engine.stores.agentStore, EngineChange.TreeDOMLayoutSync, EngineChange.CanvasZoom],\n\t\t{ deepEqual: true },\n\t)\n\treturn <AgentUpdateHighlight outlineBoxes={boxes.outlineBoxes} filledBoxes={boxes.filledBoxes} />\n}\n\ninterface AgentUpdateHighlightBoxes {\n\toutlineBoxes: readonly { id: NodeID; rect: Rect | null }[]\n\tfilledBoxes: readonly { id: NodeID; rect: Rect | null }[]\n}\n\nfunction getAgentUpdateHighlightBoxes(): AgentUpdateHighlightBoxes {\n\tconst { canvasStore, agentStore } = engine.stores\n\treturn {\n\t\toutlineBoxes: getAgentUpdateBoxesByIds(engine, agentStore.activeSelectionNodes, canvasStore.zoom),\n\t\tfilledBoxes: getAgentUpdateBoxesByIds(engine, agentStore.updatingCanvasNodes, canvasStore.zoom),\n\t}\n}\n\nconst enterExitAnimation: MotionProps = {\n\tinitial: { opacity: 0 },\n\tanimate: { opacity: 1 },\n\texit: { opacity: 0 },\n\ttransition: { duration: 0.3 },\n}\n\n/**\n * The motion.div is always rendered as long as the node ID is in the set. But we only render the\n * BorderSweepOverlay if the rect is not null. This means the box will use an exit animation if the\n * node stops highlighting (removed from the set), but instant disappear if the node is not rendered\n * (e.g. switching scopes).\n */\nconst AgentUpdateHighlight = ({ outlineBoxes, filledBoxes }: AgentUpdateHighlightBoxes) => {\n\treturn (\n\t\t<AnimatePresence initial={true}>\n\t\t\t{outlineBoxes.map(box => (\n\t\t\t\t<motion.div key={\"outline-\" + box.id} {...enterExitAnimation}>\n\t\t\t\t\t{box.rect ? <BorderSweepOverlay rect={box.rect} withFill={false} /> : null}\n\t\t\t\t</motion.div>\n\t\t\t))}\n\t\t\t{filledBoxes.map(box => (\n\t\t\t\t<motion.div key={\"fill-\" + box.id} {...enterExitAnimation}>\n\t\t\t\t\t{box.rect ? <BorderSweepOverlay rect={box.rect} withFill={true} /> : null}\n\t\t\t\t</motion.div>\n\t\t\t))}\n\t\t</AnimatePresence>\n\t)\n}\n\nfunction getAgentUpdateBoxesByIds(\n\tengine: VekterEngine,\n\tnodeIds: Set<NodeID>,\n\tzoom: number,\n): readonly { id: NodeID; rect: Rect | null }[] {\n\tif (nodeIds.size === 0) return emptyArray()\n\n\tconst result: { id: NodeID; rect: Rect | null }[] = []\n\tfor (const id of nodeIds) {\n\t\tresult.push({\n\t\t\tid,\n\t\t\trect: getHighlightRectIfRendered(engine, id, zoom),\n\t\t})\n\t}\n\treturn result\n}\n\nfunction getHighlightRectIfRendered(engine: VekterEngine, nodeId: NodeID, zoom: number): Rect | null {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node) return null\n\tif (!node.isVisible() || !node.cache.visible) return null\n\tif (isWaitingForMeasuredRect(node)) return null\n\tconst groundNodeId = node.cache.groundNodeAncestorId\n\tif (!engine.stores.treeStore.groundNodesInViewport.has(groundNodeId ?? node.id)) return null\n\n\tconst canvasFrame = convertFrameToCanvas(engine.tree, node)\n\treturn Rect.multiply(canvasFrame, zoom)\n}\n", "import { Rect } from \"library/render/types/Rect.ts\"\nimport { memo, useLayoutEffect, useMemo, useRef } from \"react\"\nimport * as styles from \"./BorderSweepOverlay.styles.ts\"\n\n/** Disable sweep animation when both dimensions exceed this size. */\nconst beamMaxDimensionSize = 1500\n/** Number of beams orbiting the border. */\nconst beamCount = 2\n/** Beam trail length as a percentage of perimeter. This is more or less an arbitrary value that\n * looks good consider we have two beams. */\nconst beamLengthPercent = 38\n/** Thickness of each strip in CSS px. Constant across the trail length. The gradient handles the\n *  visible falloff at the head/tail. Matches the static border width. */\nconst beamThickness = 1\n/** Duration for a full 0%-100% loop in milliseconds. */\nconst beamOrbitDurationMs = 3500\n\nconst beamSides = [\"top\", \"right\", \"bottom\", \"left\"] as const\ntype BeamSide = (typeof beamSides)[number]\n\ninterface BorderSweepOverlayProps {\n\t/** The box for the animation in world/screen space. */\n\trect: Rect\n\t/** Enables low-opacity pulsing fill inside the box. */\n\twithFill: boolean\n}\n\nexport const BorderSweepOverlay = memo(function BorderSweepOverlay({ rect, withFill }: BorderSweepOverlayProps) {\n\tconst width = Math.max(1, rect.width)\n\tconst height = Math.max(1, rect.height)\n\tconst boxStyles: React.CSSProperties = {\n\t\twidth,\n\t\theight,\n\t\ttransform: `translateX(${rect.x}px) translateY(${rect.y}px)`,\n\t}\n\n\tconst shouldDisableSweepAnimation = width > beamMaxDimensionSize && height > beamMaxDimensionSize\n\t// Snap to whole pixels before computing geometry/keyframes. Canvas pan/zoom feeds this\n\t// component floats from `Rect.multiply(canvasFrame, zoom)` that drift subpixel-ly every frame;\n\t// without snapping, the useMemo key invalidates each tick and every strip's layout effect\n\t// restart a pointless WAAPI animation per frame.\n\tconst keyframesWidth = Math.round(width)\n\tconst keyframesHeight = Math.round(height)\n\tconst beamGeometry = useMemo(\n\t\t() => buildBeamGeometry(keyframesWidth, keyframesHeight),\n\t\t[keyframesWidth, keyframesHeight],\n\t)\n\n\tif (shouldDisableSweepAnimation) {\n\t\treturn (\n\t\t\t<div className={styles.sweepOverlay} style={boxStyles}>\n\t\t\t\t{withFill && <div className={styles.fillLayer} />}\n\t\t\t\t<div className={styles.borderLayer} />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst beamWrapperStyle: React.CSSProperties = {\n\t\t\"--beam-trail-length\": `${beamGeometry.beamLength.toFixed(2)}px`,\n\t\t\"--beam-strip-thickness\": `${beamThickness}px`,\n\t}\n\n\treturn (\n\t\t<div className={styles.sweepOverlay} style={boxStyles}>\n\t\t\t{withFill && <div className={styles.fillLayer} />}\n\t\t\t<div className={styles.borderLayer} />\n\t\t\t<div className={styles.beam} style={beamWrapperStyle}>\n\t\t\t\t{beamSides.map(side => (\n\t\t\t\t\t<div key={side} className={styles.beamSide} style={beamGeometry.sideContainerStyles[side]}>\n\t\t\t\t\t\t{beamGeometry.strips[side].map(strip => (\n\t\t\t\t\t\t\t<BeamStrip key={strip.key} keyframes={beamGeometry.keyframes} delayMs={strip.delayMs} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</div>\n\t)\n}, areBorderSweepOverlayPropsEqual)\n\nfunction areBorderSweepOverlayPropsEqual(prev: BorderSweepOverlayProps, next: BorderSweepOverlayProps) {\n\treturn prev.withFill === next.withFill && Rect.equals(prev.rect, next.rect)\n}\n\ninterface BeamStripProps {\n\tkeyframes: Keyframe[]\n\tdelayMs: number\n}\n\nconst BeamStrip = memo(function BeamStrip({ keyframes, delayMs }: BeamStripProps) {\n\tconst elementRef = useRef<HTMLDivElement>(null)\n\tconst prevAnimationTimeRef = useRef<CSSNumberish | null>(null)\n\n\tuseLayoutEffect(() => {\n\t\tconst element = elementRef.current\n\t\tif (!element) return\n\n\t\tconst animation = element.animate(keyframes, {\n\t\t\tduration: beamOrbitDurationMs,\n\t\t\titerations: Infinity,\n\t\t\teasing: \"linear\",\n\t\t\tdelay: delayMs,\n\t\t})\n\n\t\tanimation.currentTime = prevAnimationTimeRef.current ?? 0\n\n\t\treturn () => {\n\t\t\tprevAnimationTimeRef.current = animation.currentTime ?? 0\n\t\t\tanimation.cancel()\n\t\t}\n\t}, [keyframes, delayMs])\n\n\treturn <div ref={elementRef} className={styles.beamStrip} />\n})\n\n/**\n * Compute the static side container layout and the per-(side, beam) keyframe arrays from the\n * snapped path dimensions. Side container styles are inline because they all share one class,\n * positioning + rotation are the only per-side differences. Keyframes are linear: the strip slides\n * exactly one perimeter per orbit, so the moment it disappears off one side's right edge (clipped\n * by overflow:hidden) matches the moment it enters the adjacent side's left edge.\n */\nfunction buildBeamGeometry(width: number, height: number) {\n\t// Each side is offset by 1px, so that two strips don't overlap at the corner, causing the\n\t// corner to be 'brighter' due to the alpha.\n\tconst topLength = Math.max(0, width - 1)\n\tconst rightLength = Math.max(0, height - 1)\n\tconst bottomLength = Math.max(0, width - 1)\n\tconst leftLength = Math.max(0, height - 1)\n\tconst perimeter = topLength + rightLength + bottomLength + leftLength\n\tconst beamLength = perimeter * (beamLengthPercent / 100)\n\n\tconst sideContainerStyles: Record<BeamSide, React.CSSProperties> = {\n\t\ttop: {\n\t\t\ttop: 0,\n\t\t\tleft: 0,\n\t\t\twidth: topLength,\n\t\t\theight: beamThickness,\n\t\t},\n\t\tright: {\n\t\t\ttop: 0,\n\t\t\tleft: width,\n\t\t\twidth: rightLength,\n\t\t\theight: beamThickness,\n\t\t\ttransform: \"rotate(90deg)\",\n\t\t},\n\t\tbottom: {\n\t\t\ttop: height,\n\t\t\tleft: width,\n\t\t\twidth: bottomLength,\n\t\t\theight: beamThickness,\n\t\t\ttransform: \"rotate(180deg)\",\n\t\t},\n\t\tleft: {\n\t\t\ttop: height,\n\t\t\tleft: 0,\n\t\t\twidth: leftLength,\n\t\t\theight: beamThickness,\n\t\t\ttransform: \"rotate(270deg)\",\n\t\t},\n\t}\n\n\tconst keyframes: Keyframe[] = [\n\t\t{ offset: 0, transform: `translateX(${(-beamLength).toFixed(2)}px)` },\n\t\t{ offset: 1, transform: `translateX(${(perimeter - beamLength).toFixed(2)}px)` },\n\t]\n\n\tconst strips: Record<BeamSide, BeamStripDescriptor[]> = {\n\t\ttop: buildSideStrips(\"top\", 0, perimeter),\n\t\tright: buildSideStrips(\"right\", topLength, perimeter),\n\t\tbottom: buildSideStrips(\"bottom\", topLength + rightLength, perimeter),\n\t\tleft: buildSideStrips(\"left\", topLength + rightLength + bottomLength, perimeter),\n\t}\n\n\treturn { beamLength, sideContainerStyles, keyframes, strips }\n}\n\ninterface BeamStripDescriptor {\n\t/** Stable React key per (side, beam). */\n\tkey: string\n\t/* delay of the strip's cycle in milliseconds. */\n\tdelayMs: number\n}\n\nfunction buildSideStrips(side: BeamSide, stripStart: number, perimeter: number): BeamStripDescriptor[] {\n\tif (!perimeter) return []\n\n\tconst descriptors: BeamStripDescriptor[] = []\n\tfor (let beamIndex = 0; beamIndex < beamCount; beamIndex++) {\n\t\t// Head's perimeter coord at t=0 for this beam. beam 0 parks at p=0 (top-left corner) with\n\t\t// its trail draped backward across left+bottom; subsequent beams are evenly spaced around\n\t\t// the orbit.\n\t\tconst beamStartFraction = beamIndex / beamCount\n\t\tconst stripStartFraction = stripStart / perimeter\n\t\t// Still have 1 - stripStartFraction to travel before it can wrap to re-enter the viewport\n\t\t// of [sideStart, sideStart + edge], so it needs to be fast-forwarded (with a negative\n\t\t// delay) to that position.\n\t\tconst delayMs = (beamStartFraction + (1 - stripStartFraction)) * beamOrbitDurationMs * -1\n\t\tdescriptors.push({ key: `${side}-${beamIndex}`, delayMs })\n\t}\n\treturn descriptors\n}\n", "import \"BorderSweepOverlay.styles_1yg2a6z.wyw.css\"; export const sweepOverlay = \"sweepOverlay_s1an6ylf\";\nexport const borderLayer = \"borderLayer_b1ci3puv\";\nexport const fillLayer = \"fillLayer_fmqwtk5\";\nexport const beam = \"beam_b1jxr4co\";\nexport const beamSide = \"beamSide_b1h5ubnk\";\nexport const beamStrip = \"beamStrip_bvtkh6\";", "import { getMultiplayerColor } from \"@framerjs/app-shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { RemoteCursor } from \"document/RemoteUsers.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { LoadedScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { DarkModeContext } from \"web/components/DarkModeProvider.tsx\"\nimport * as classes from \"./Multiplayer.styles.ts\"\n\ninterface State {\n\tcursors: RemoteCursor[]\n\tactiveScope: LoadedScopeNode\n\tactiveBranchId: string\n\tisHistoricTree: boolean\n}\n\ninterface Props {\n\tzoom: number\n}\n\nexport const MultiplayerHUD = createContainer(\n\tclass MultiplayerHUD extends React.PureComponent<Props, State> {\n\t\tstatic override contextType = DarkModeContext\n\t\tdeclare context: React.ContextType<typeof DarkModeContext>\n\n\t\tstatic engineChangeKeys = [\n\t\t\tEngineChange.RemoteUsersStore,\n\t\t\tEngineChange.TreeStore,\n\t\t\tengine.stores.scopeStore,\n\t\t\tengine.stores.historyStore,\n\t\t]\n\n\t\tstatic calculateState(): State {\n\t\t\tconst { canvasStore, remoteUsers, scopeStore, historyStore, treeStore } = engine.stores\n\t\t\tcanvasStore.assertInteractive()\n\t\t\treturn {\n\t\t\t\tcursors: remoteUsers.cursors,\n\t\t\t\tactiveScope: scopeStore.active,\n\t\t\t\tactiveBranchId: treeStore.branchId,\n\t\t\t\tisHistoricTree: !historyStore.isLatestTreeVersion(),\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst { isDarkMode } = this.context\n\t\t\tconst { cursors, activeScope, activeBranchId, isHistoricTree } = this.state\n\t\t\tconst { zoom } = this.props\n\n\t\t\tif (isHistoricTree) return null\n\n\t\t\treturn (\n\t\t\t\t<div className={classes.multiplayer}>\n\t\t\t\t\t{cursors.map(cursor => {\n\t\t\t\t\t\tif (cursor.isIdle) return null\n\t\t\t\t\t\tif (cursor.branchId !== activeBranchId) return null\n\t\t\t\t\t\tif (cursor.pageId !== activeScope.id) return\n\n\t\t\t\t\t\tconst color = getMultiplayerColor(cursor.color, isDarkMode)\n\n\t\t\t\t\t\tconst style = {\n\t\t\t\t\t\t\tx: cursor.x,\n\t\t\t\t\t\t\ty: cursor.y,\n\t\t\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\t\t\t\"--color\": color,\n\t\t\t\t\t\t} as MotionStyle\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\t\t\ttransition={{ duration: 1, ease: \"linear\" }}\n\t\t\t\t\t\t\t\tkey={cursor.id}\n\t\t\t\t\t\t\t\ttransformTemplate={({ x, y }: { x: string; y: string }) =>\n\t\t\t\t\t\t\t\t\t`translate(${parseFloat(x) * zoom}px, ${parseFloat(y) * zoom}px)`\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName={classes.cursor}\n\t\t\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className={classes.cursorGraphic} />\n\t\t\t\t\t\t\t\t<span className={classes.label}>{cursor.chat || cursor.userName}</span>\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\t},\n)\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo } from \"react\"\nimport { RichTextVariableEditTool } from \"../tools/RichTextVariableEditTool.ts\"\nimport { CollectionRichTextVariableEditor } from \"./CollectionRichTextVariableEditor.tsx\"\nimport { EditorNodeTransform } from \"./EditorNodeTransform.tsx\"\nimport { useCanvasZoom } from \"./editorUtils.tsx\"\n\nexport const VekterCollectionRichTextVariableEditor = memo(function VekterCollectionRichTextVariableEditor() {\n\tconst zoom = useCanvasZoom()\n\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = getActiveRichTextVariableEditTool()\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getNode()\n\t\t\tif (!node) return\n\n\t\t\tconst proseMirror = tool.proseMirror\n\t\t\tif (!proseMirror) return\n\n\t\t\tconst scopeNode = engine.stores.scopeStore.active\n\t\t\treturn { tool, scopeNode, node, renderId: node.id, proseMirror }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, EngineChange.CanvasZoom, EngineChange.TreeDOMLayoutSync, engine.stores.toolStore],\n\t)\n\n\tconst handleMouseDown = useEngineCallback((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\t\tengine.stores.canvasMouseTarget.handleMouseDown(event, \"autoscroll\")\n\t}, [])\n\n\tif (!props) return\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<CollectionRichTextVariableEditor {...props} zoom={zoom} onMouseDown={handleMouseDown} />\n\t\t</EditorNodeTransform>\n\t)\n})\n\nfunction getActiveRichTextVariableEditTool() {\n\tif (engine.tool instanceof RichTextVariableEditTool) {\n\t\treturn engine.tool\n\t}\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type React from \"react\"\nimport { memo } from \"react\"\nimport { RichTextEditTool } from \"../tools/RichTextEditTool.ts\"\nimport { EditorNodeTransform } from \"./EditorNodeTransform.tsx\"\nimport { RichTextEditor } from \"./RichTextEditor.tsx\"\nimport { useCanvasZoom } from \"./editorUtils.tsx\"\n\nexport const VekterRichTextEditor = memo(function VekterRichTextEditor() {\n\tconst zoom = useCanvasZoom()\n\tconst scopeNode = engine.stores.scopeStore.useState(state => state.active)\n\n\tconst handleMouseDown = useEngineCallback((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\t\tengine.stores.canvasMouseTarget.handleMouseDown(event, \"autoscroll\")\n\t}, [])\n\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = getActiveRichTextEditTool()\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getRichTextNode()\n\t\t\tif (!node) return\n\n\t\t\tconst editorView = engine.stores.toolStore.proseMirrorView\n\t\t\tif (!editorView) return\n\n\t\t\treturn { tool, node, renderId: node.id, editorView }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.toolStore],\n\t)\n\n\tif (!props) return null\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<RichTextEditor {...props} scopeNode={scopeNode} handleMouseDown={handleMouseDown} zoom={zoom} />\n\t\t</EditorNodeTransform>\n\t)\n})\n\nfunction getActiveRichTextEditTool() {\n\tif (engine.tool instanceof RichTextEditTool) return engine.tool\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo } from \"react\"\nimport { StringVariableEditTool } from \"../tools/StringVariableEditTool.ts\"\nimport { EditorNodeTransform } from \"./EditorNodeTransform.tsx\"\nimport { StringEditor } from \"./StringEditor.tsx\"\nimport { useCanvasZoom } from \"./editorUtils.tsx\"\n\nexport const VekterStringVariableEditor = memo(function VekterStringVariableEditor() {\n\tconst props = useEngineState(\n\t\t() => {\n\t\t\tconst tool = getActiveStringVariableEditTool()\n\t\t\tif (!tool) return\n\n\t\t\tconst node = tool.getNode()\n\t\t\tif (!node) return\n\n\t\t\treturn { tool, node, renderId: node.id }\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.toolStore, EngineChange.ActiveBundle],\n\t)\n\n\tconst zoom = useCanvasZoom()\n\n\tconst handleMouseDown = useEngineCallback((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\t\tengine.stores.canvasMouseTarget.handleMouseDown(event, \"autoscroll\")\n\t}, [])\n\n\tconst scopeNode = engine.stores.scopeStore.useState(state => state.active)\n\tif (!scopeNode) return null\n\tif (!props) return null\n\n\treturn (\n\t\t<EditorNodeTransform node={props.node}>\n\t\t\t<StringEditor {...props} scopeNode={scopeNode} zoom={zoom} onMouseDown={handleMouseDown} />\n\t\t</EditorNodeTransform>\n\t)\n})\n\nfunction getActiveStringVariableEditTool() {\n\tif (engine.tool instanceof StringVariableEditTool) {\n\t\treturn engine.tool\n\t}\n}\n", "import { colors, dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\n\ninterface State {\n\tmouseRaw: Point\n\ttooltip: string | undefined\n\ttooltipColor: string\n}\n\nclass Tooltip extends React.PureComponent<{}, State> {\n\tstatic engineChangeKeys = [EngineChange.MouseStore, engine.stores.toolStore]\n\n\tstatic calculateState(): State {\n\t\treturn {\n\t\t\tmouseRaw: engine.stores.mouseStore.windowMousePosition,\n\t\t\ttooltip: engine.stores.toolStore.tooltip,\n\t\t\ttooltipColor: engine.tool.enum === Tools.Gap ? colors.stackGapHandleTint : colors.tint,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { tooltip, mouseRaw, tooltipColor } = this.state\n\n\t\tif (!tooltip || tooltip.length === 0) return null\n\n\t\t// Offset the tooltip by 8px to the right and bottom\n\t\t// of the user's cursor position.\n\t\tconst point: Point = Point.add(mouseRaw, { x: 8, y: 8 })\n\n\t\tconst style: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\twidth: \"auto\",\n\t\t\theight: dimensions.css.inputHeight,\n\t\t\ttransform: `translate(${Math.round(point.x)}px, ${Math.round(point.y)}px)`,\n\t\t\tpointerEvents: \"none\",\n\t\t\tpadding: \"0 10px\",\n\t\t\tfontSize: fonts.size.base,\n\t\t\tfontWeight: fonts.weight.base as React.CSSProperties[\"fontWeight\"],\n\t\t\tdisplay: \"flex\",\n\t\t\tplaceItems: \"center\",\n\t\t\tplaceContent: \"center\",\n\t\t\tcolor: colors.canvasTooltipText,\n\t\t\tbackgroundColor: tooltipColor,\n\t\t\tWebkitUserSelect: \"none\",\n\t\t\tuserSelect: \"none\",\n\t\t\tborderRadius: 8,\n\t\t\tcontain: \"content\",\n\t\t\tfontVariantNumeric: \"tabular-nums\",\n\t\t\tWebkitFontSmoothing: \"subpixel-antialiased\",\n\t\t}\n\n\t\treturn <div style={style}>{tooltip}</div>\n\t}\n}\n\nconst container = createContainer(Tooltip)\nexport { container as Tooltip }\n", "import type { MouseTrackerEvent } from \"@framerjs/fresco\"\nimport { MouseTracker } from \"@framerjs/fresco\"\nimport React from \"react\"\n\nconst resizeAreaWidth = 8\n\nexport enum HandleCoordinate {\n\tStart = 0,\n\tMid = 0.5,\n\tEnd = 1,\n}\n\nexport interface FreedomOfMovement {\n\ttopMaxReached: boolean\n\ttopMinReached: boolean\n\trightMaxReached: boolean\n\trightMinReached: boolean\n\tbottomMaxReached: boolean\n\tbottomMinReached: boolean\n\tleftMaxReached: boolean\n\tleftMinReached: boolean\n}\n\ntype DragHandleEvent = (event: MouseTrackerEvent, fx: HandleCoordinate, fy: HandleCoordinate) => void\n\nconst handles: [HandleCoordinate, HandleCoordinate][] = [\n\t[HandleCoordinate.Start, HandleCoordinate.Start],\n\t[HandleCoordinate.Mid, HandleCoordinate.Start],\n\t[HandleCoordinate.End, HandleCoordinate.Start],\n\t[HandleCoordinate.End, HandleCoordinate.Mid],\n\t[HandleCoordinate.End, HandleCoordinate.End],\n\t[HandleCoordinate.Mid, HandleCoordinate.End],\n\t[HandleCoordinate.Start, HandleCoordinate.End],\n\t[HandleCoordinate.Start, HandleCoordinate.Mid],\n]\n\ninterface RezizeProps {\n\tonDrag: DragHandleEvent\n\tonDragStart: DragHandleEvent\n\tonDragEnd: DragHandleEvent\n\tfreedomOfMovement: FreedomOfMovement\n\tenabled?: boolean\n}\n\nexport const WindowResize = React.memo(\n\t({ onDrag, onDragStart, onDragEnd, freedomOfMovement, enabled = true }: RezizeProps) => {\n\t\tconst offset = resizeAreaWidth / 2\n\t\tconst style: React.CSSProperties = {\n\t\t\tposition: \"absolute\",\n\t\t\ttop: -offset,\n\t\t\tleft: -offset,\n\t\t\tright: -offset,\n\t\t\t// Needed to give the container height, for some reason `bottom` is\n\t\t\t// ignored, might be related to display: grid...\n\t\t\theight: `calc(100% + ${resizeAreaWidth}px)`,\n\t\t\tzIndex: 1,\n\t\t\tpointerEvents: \"none\",\n\t\t}\n\n\t\treturn (\n\t\t\t<div style={style}>\n\t\t\t\t{enabled &&\n\t\t\t\t\thandles.map(([fx, fy], index) => (\n\t\t\t\t\t\t<Handle\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\tfx={fx}\n\t\t\t\t\t\t\tfy={fy}\n\t\t\t\t\t\t\tonDrag={onDrag}\n\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\tonDragEnd={onDragEnd}\n\t\t\t\t\t\t\tfreedomOfMovement={freedomOfMovement}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t</div>\n\t\t)\n\t},\n)\n\ninterface HandleProps extends RezizeProps {\n\tfx: HandleCoordinate\n\tfy: HandleCoordinate\n}\n\nfunction Handle({ fx, fy, onDrag, onDragStart, onDragEnd, freedomOfMovement }: HandleProps) {\n\tconst isCorner = isCornerCoordinate(fx, fy)\n\treturn (\n\t\t<MouseTracker\n\t\t\tonDrag={useDragHandler(onDrag, fx, fy)}\n\t\t\tonDragStart={useDragHandler(onDragStart, fx, fy)}\n\t\t\tonDragEnd={useDragHandler(onDragEnd, fx, fy)}\n\t\t\tstyle={{\n\t\t\t\tposition: \"absolute\",\n\t\t\t\tdisplay: canMove(fx, fy, freedomOfMovement) ? \"block\" : \"none\",\n\t\t\t\tpointerEvents: \"all\",\n\t\t\t\tcursor: cursorForCoordinate(fx, fy, freedomOfMovement),\n\t\t\t\t// Make the corner drag handles bigger\n\t\t\t\ttransform: isCorner ? \"scale(2)\" : undefined,\n\t\t\t\tzIndex: isCorner ? 2 : 1,\n\t\t\t\t...handlePosition(fx, fy),\n\t\t\t}}\n\t\t/>\n\t)\n}\n\nfunction canMove(fx: HandleCoordinate, fy: HandleCoordinate, freedomOfMovement: FreedomOfMovement) {\n\tswitch (fx) {\n\t\tcase HandleCoordinate.Start:\n\t\t\tif (freedomOfMovement.leftMinReached && freedomOfMovement.leftMaxReached) return false\n\t\t\tbreak\n\t\tcase HandleCoordinate.End:\n\t\t\tif (freedomOfMovement.rightMinReached && freedomOfMovement.rightMaxReached) return false\n\t\t\tbreak\n\t}\n\tswitch (fy) {\n\t\tcase HandleCoordinate.Start:\n\t\t\tif (freedomOfMovement.topMinReached && freedomOfMovement.topMaxReached) return false\n\t\t\tbreak\n\t\tcase HandleCoordinate.End:\n\t\t\tif (freedomOfMovement.bottomMinReached && freedomOfMovement.bottomMaxReached) return false\n\t\t\tbreak\n\t}\n\treturn true\n}\n\nfunction useDragHandler(\n\thandler: DragHandleEvent,\n\tfx: HandleCoordinate,\n\tfy: HandleCoordinate,\n): (event: MouseTrackerEvent) => void {\n\treturn React.useCallback((event: MouseTrackerEvent) => handler(event, fx, fy), [handler, fx, fy])\n}\n\nfunction isEdgeCoordinate(coordinate: HandleCoordinate) {\n\treturn coordinate !== HandleCoordinate.Mid\n}\n\nfunction isCornerCoordinate(fx: HandleCoordinate, fy: HandleCoordinate) {\n\treturn isEdgeCoordinate(fx) && isEdgeCoordinate(fy)\n}\n\nfunction cursorForCoordinate(fx: HandleCoordinate, fy: HandleCoordinate, freedomOfMovement: FreedomOfMovement) {\n\tif (fx === HandleCoordinate.Mid) {\n\t\t// Center\n\t\tif (fy === HandleCoordinate.Start) {\n\t\t\t// Top\n\t\t\tif (freedomOfMovement.topMaxReached) return \"s-resize\"\n\t\t\tif (freedomOfMovement.topMinReached) return \"n-resize\"\n\t\t} else {\n\t\t\t// Bottom\n\t\t\tif (freedomOfMovement.bottomMaxReached) return \"n-resize\"\n\t\t\tif (freedomOfMovement.bottomMinReached) return \"s-resize\"\n\t\t}\n\t\treturn \"ns-resize\"\n\t}\n\tif (fy === HandleCoordinate.Mid) {\n\t\t// Middle\n\t\tif (fx === HandleCoordinate.Start) {\n\t\t\t// Left\n\t\t\tif (freedomOfMovement.leftMaxReached) return \"e-resize\"\n\t\t\tif (freedomOfMovement.leftMinReached) return \"w-resize\"\n\t\t} else {\n\t\t\t// Right\n\t\t\tif (freedomOfMovement.rightMaxReached) return \"w-resize\"\n\t\t\tif (freedomOfMovement.rightMinReached) return \"e-resize\"\n\t\t}\n\t\treturn \"ew-resize\"\n\t}\n\n\t// Corners\n\n\tif (fx === HandleCoordinate.Start) {\n\t\t// Left\n\t\tif (fy === HandleCoordinate.Start) {\n\t\t\t// Top\n\t\t\tif (freedomOfMovement.topMaxReached && freedomOfMovement.leftMaxReached) return \"se-resize\"\n\t\t\tif (freedomOfMovement.topMinReached && freedomOfMovement.leftMinReached) return \"nw-resize\"\n\t\t\treturn \"nwse-resize\"\n\t\t} else {\n\t\t\t// Bottom\n\t\t\tif (freedomOfMovement.bottomMaxReached && freedomOfMovement.leftMaxReached) return \"ne-resize\"\n\t\t\tif (freedomOfMovement.bottomMinReached && freedomOfMovement.leftMinReached) return \"sw-resize\"\n\t\t\treturn \"nesw-resize\"\n\t\t}\n\t}\n\n\t// Right\n\tif (fy === HandleCoordinate.Start) {\n\t\t// Top\n\t\tif (freedomOfMovement.topMaxReached && freedomOfMovement.rightMaxReached) return \"sw-resize\"\n\t\tif (freedomOfMovement.topMinReached && freedomOfMovement.rightMinReached) return \"ne-resize\"\n\t\treturn \"nesw-resize\"\n\t} else {\n\t\t// Bottom\n\t\tif (freedomOfMovement.bottomMaxReached && freedomOfMovement.rightMaxReached) return \"nw-resize\"\n\t\tif (freedomOfMovement.bottomMinReached && freedomOfMovement.rightMinReached) return \"se-resize\"\n\t\treturn \"nwse-resize\"\n\t}\n}\n\nfunction handlePosition(fx: HandleCoordinate, fy: HandleCoordinate): React.CSSProperties {\n\tconst result: React.CSSProperties = {}\n\n\tswitch (fx) {\n\t\tcase HandleCoordinate.Start:\n\t\t\tresult.left = 0\n\t\t\tresult.width = resizeAreaWidth\n\t\t\tbreak\n\t\tcase HandleCoordinate.Mid:\n\t\t\tresult.left = resizeAreaWidth\n\t\t\tresult.right = resizeAreaWidth\n\t\t\tbreak\n\t\tcase HandleCoordinate.End:\n\t\t\tresult.right = 0\n\t\t\tresult.width = resizeAreaWidth\n\t\t\tbreak\n\t}\n\n\tswitch (fy) {\n\t\tcase HandleCoordinate.Start:\n\t\t\tresult.top = 0\n\t\t\tresult.height = resizeAreaWidth\n\t\t\tbreak\n\t\tcase HandleCoordinate.Mid:\n\t\t\tresult.top = resizeAreaWidth\n\t\t\tresult.bottom = resizeAreaWidth\n\t\t\tbreak\n\t\tcase HandleCoordinate.End:\n\t\t\tresult.bottom = 0\n\t\t\tresult.height = resizeAreaWidth\n\t\t\tbreak\n\t}\n\n\treturn result\n}\n", "import { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport type { MouseTrackerEvent } from \"@framerjs/fresco\"\nimport { CustomModal, IconGlobeLarge, Progress, Stack } from \"@framerjs/fresco\"\nimport { ZIndex, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { FreedomOfMovement } from \"document/components/chrome/preview/WindowResize.tsx\"\nimport { HandleCoordinate, WindowResize } from \"document/components/chrome/preview/WindowResize.tsx\"\nimport { DarkOnDarkThemeOverride } from \"document/components/chrome/shared/DarkOnDarkThemeOverride.tsx\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { clamp } from \"framer-motion\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { safeWindow } from \"library/utils/safeWindow.ts\"\nimport React, { useCallback, useLayoutEffect, useRef } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { isDefined, isNumber, isObject, isString } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport type { DragData, DragStartInfo } from \"#framer-plugin/dragging.ts\"\nimport type { UIOptions } from \"#framer-plugin/framerAPI.ts\"\nimport { FloatingWindow, FloatingWindowDraggableArea } from \"../document/components/chrome/shared/FloatingWindow.tsx\"\nimport type { ActivePlugin } from \"./ActivePlugin.ts\"\nimport { Plugin } from \"./Plugin.tsx\"\nimport { PluginHeader } from \"./PluginHeader.tsx\"\nimport * as styles from \"./PluginUI.styles.ts\"\nimport type { PluginManifestId } from \"./plugins.ts\"\nimport { getPluginIcon, isApiPluginManifest } from \"./plugins.ts\"\nimport { useStorage } from \"./useStorage.ts\"\nimport { shouldRenderAsModal } from \"./utils/modes.ts\"\n\nfunction getInitialLeftOffset(position: NonNullable<UIOptions>[\"position\"]): `${number}%` {\n\tif (!isString(position)) return \"0%\"\n\tif (position === \"center\") return \"50%\"\n\tif (position.includes(\"right\")) return \"100%\"\n\treturn \"0%\"\n}\n\nfunction getInitialTopOffset(position: NonNullable<UIOptions>[\"position\"]): `${number}%` {\n\tif (!isString(position)) return \"0%\"\n\tif (position === \"center\") return \"50%\"\n\tif (position.includes(\"bottom\")) return \"100%\"\n\treturn \"0%\"\n}\n\nconst noFreedomOfMovement: FreedomOfMovement = {\n\ttopMaxReached: true,\n\ttopMinReached: true,\n\trightMaxReached: true,\n\trightMinReached: true,\n\tbottomMaxReached: true,\n\tbottomMinReached: true,\n\tleftMaxReached: true,\n\tleftMinReached: true,\n}\n\nfunction getMaxWidth(constraintsRect: DOMRect, contentStartRect: DOMRect, fx: HandleCoordinate): number {\n\tconst startWidth = contentStartRect.width\n\tswitch (fx) {\n\t\tcase HandleCoordinate.Mid:\n\t\t\treturn startWidth\n\t\tcase HandleCoordinate.Start:\n\t\t\treturn startWidth + Math.max(0, contentStartRect.left - constraintsRect.left)\n\t\tcase HandleCoordinate.End:\n\t\t\treturn startWidth + Math.max(0, constraintsRect.right - contentStartRect.right)\n\t\tdefault:\n\t\t\tassertNever(fx)\n\t}\n}\n\nfunction getMaxHeight(constraintsRect: DOMRect, contentStartRect: DOMRect, fy: HandleCoordinate): number {\n\tconst startHeight = contentStartRect.height\n\tswitch (fy) {\n\t\tcase HandleCoordinate.Mid:\n\t\t\treturn startHeight\n\t\tcase HandleCoordinate.Start:\n\t\t\treturn startHeight + Math.max(0, contentStartRect.top - constraintsRect.top)\n\t\tcase HandleCoordinate.End:\n\t\t\treturn startHeight + Math.max(0, constraintsRect.bottom - contentStartRect.bottom)\n\t\tdefault:\n\t\t\tassertNever(fy)\n\t}\n}\n\nfunction getConstraintsRect(\n\tisModal: boolean,\n\tresizeConstraintsRef: React.RefObject<HTMLElement | null>,\n): DOMRect | null {\n\tif (isModal) {\n\t\tconst modalMargin = 40\n\t\treturn new DOMRect(\n\t\t\tmodalMargin,\n\t\t\tmodalMargin,\n\t\t\twindow.innerWidth - modalMargin * 2,\n\t\t\twindow.innerHeight - modalMargin * 2,\n\t\t)\n\t}\n\n\tconst constraintsElement = resizeConstraintsRef.current\n\tif (!constraintsElement) return null\n\treturn constraintsElement.getBoundingClientRect()\n}\n\nconst timeBeforeToastAppearsMs = 500\nconst minimumToastVisibilityMs = 300\n\nconst resizeWidthVariable = \"--resize-width\"\nconst resizeHeightVariable = \"--resize-height\"\n\nfunction getCurrentSize(contentElement: HTMLDivElement, axis: \"width\" | \"height\"): number {\n\tconst variable = axis === \"width\" ? resizeWidthVariable : resizeHeightVariable\n\tconst currentSize = contentElement.style.getPropertyValue(variable)\n\tif (currentSize) {\n\t\tconst currentNumberSize = parseInt(currentSize)\n\t\tif (isNumber(currentNumberSize)) return currentNumberSize\n\t}\n\n\tconst bounds = contentElement.getBoundingClientRect()\n\treturn axis === \"width\" ? bounds.width : bounds.height\n}\n\nfunction useMinMaxSize(\n\tmin: number,\n\tmax: number,\n\tresizable: NonNullable<UIOptions>[\"resizable\"],\n\taxis: \"width\" | \"height\",\n\tresizableContentRef: React.RefObject<HTMLDivElement>,\n) {\n\tuseLayoutEffect(() => {\n\t\tconst isThisAxisResizable = resizable === true || resizable === axis\n\t\tif (!isThisAxisResizable) return\n\n\t\tconst contentElement = resizableContentRef.current\n\t\tif (!contentElement) return\n\n\t\tconst currentSize = getCurrentSize(contentElement, axis)\n\t\tconst variable = axis === \"width\" ? resizeWidthVariable : resizeHeightVariable\n\t\tif (currentSize < min) contentElement.style.setProperty(variable, `${min}px`)\n\t\telse if (currentSize > max) contentElement.style.setProperty(variable, `${max}px`)\n\t}, [axis, min, max, resizable, resizableContentRef])\n}\n\nfunction getResizeRect(\n\tcontentStartRect: DOMRect,\n\tconstraintsRect: DOMRect,\n\tnewWidth: number,\n\tnewHeight: number,\n\tfx: HandleCoordinate,\n\tfy: HandleCoordinate,\n): { top: number; right: number; bottom: number; left: number; width: number; height: number } {\n\tconst deltaWidth = newWidth - contentStartRect.width\n\tconst deltaHeight = newHeight - contentStartRect.height\n\n\tconst startTop = contentStartRect.top - constraintsRect.top\n\tconst startRight = constraintsRect.right - contentStartRect.right\n\tconst startBottom = constraintsRect.bottom - contentStartRect.bottom\n\tconst startLeft = contentStartRect.left - constraintsRect.left\n\n\tconst top = fy === HandleCoordinate.Start ? startTop - deltaHeight : startTop\n\tconst right = fx === HandleCoordinate.End ? startRight - deltaWidth : startRight\n\tconst bottom = fy === HandleCoordinate.End ? startBottom - deltaHeight : startBottom\n\tconst left = fx === HandleCoordinate.Start ? startLeft - deltaWidth : startLeft\n\n\treturn { top, right, bottom, left, width: newWidth, height: newHeight }\n}\n\nfunction isSize(value: unknown): value is Size {\n\tconst widthKey: keyof Size = \"width\"\n\tconst heightKey: keyof Size = \"height\"\n\treturn isObject(value) && isNumber(value[widthKey]) && isNumber(value[heightKey])\n}\n\n/**\n * Synchronize dark mode state from React context with the pluginStore Plugins\n * need this value to be accessible from a store to notify active plugins when\n * the theme changes.\n *\n * Because theming is supported in app contexts where there is no engine, we\n * cannot move everything to a store for a single source of truth\n */\nfunction useSynchronizeDarkModeWithPluginStore() {\n\tconst { isDarkMode } = useDarkMode()\n\n\tuseLayoutEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.pluginStore.setTheme(isDarkMode ? \"dark\" : \"light\")\n\t\t})\n\t}, [isDarkMode])\n}\n\nconst InnerPluginUI = React.memo(function InnerPluginUI({ activePlugin }: { activePlugin: ActivePlugin }) {\n\tuseSynchronizeDarkModeWithPluginStore()\n\tconst renderAsModal = shouldRenderAsModal(activePlugin.modeHandlers.mode)\n\n\tconst dismissPlugin = engine.scheduler.wrapHandler(() => {\n\t\tconst { closeWarning } = activePlugin.windowState.getState()\n\t\tif (closeWarning) {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConfirmationPlugin,\n\t\t\t\tsource: \"confirmation_plugin_modal\",\n\t\t\t\ttitle: \"Closing Plugin\",\n\t\t\t\tdescription: closeWarning,\n\t\t\t\tconfirmLabel: \"Close\",\n\t\t\t\tcancelLabel: \"Cancel\",\n\t\t\t\tvariant: \"destructive\",\n\t\t\t\tonConfirm: () => {\n\t\t\t\t\tengine.stores.pluginStore.closePlugin(activePlugin.manifestId)\n\t\t\t\t},\n\t\t\t})\n\t\t} else {\n\t\t\tengine.stores.pluginStore.closePlugin(activePlugin.manifestId)\n\t\t}\n\t})\n\n\tconst isInFront = engine.stores.chromeStore.useState(state => state.floatingWindowInFront === \"plugin\")\n\n\tconst resizeConstraintsRef = useRef<HTMLElement | null>(null)\n\tconst resizableContentRef = useRef<HTMLDivElement | null>(null)\n\n\tconst handlePointerDown = useEngineCallback(() => {\n\t\tengine.stores.chromeStore.floatingWindowInFront = \"plugin\"\n\t}, [])\n\n\tconst { manifestId } = activePlugin\n\tconst {\n\t\tvisible,\n\t\tposition,\n\t\tresizable = false,\n\t\twidth: preferredWidth = dimensions.values.popoverWidth,\n\t\theight: preferredContentHeight = 600,\n\t\tminWidth: rawMinWidth = dimensions.values.popoverWidth,\n\t\tminHeight: minContentHeight = 200,\n\t\tmaxWidth: rawMaxWidth = Infinity,\n\t\tmaxHeight: maxContentHeight = Infinity,\n\t\tlocalizationProgress,\n\t\tbackgroundMessage,\n\t} = activePlugin.windowState.useState()\n\n\tconst preferredHeight = preferredContentHeight + dimensions.values.floatingWindowToolbarHeight\n\tconst minHeight = Math.max(\n\t\tminContentHeight + dimensions.values.floatingWindowToolbarHeight,\n\t\t100 + dimensions.values.floatingWindowToolbarHeight,\n\t)\n\tconst minWidth = Math.max(rawMinWidth, 100)\n\n\t// \"Preferred\" because the constraint box (canvas or viewport) takes precedence\n\tconst maxWidthPreferred = Math.max(rawMaxWidth, minWidth)\n\tconst maxHeightPreferred = Math.max(maxContentHeight + dimensions.values.floatingWindowToolbarHeight, minHeight)\n\n\tconst [resizeSize, setResizeSize] = useStorage(\n\t\t`plugin-resize-${renderAsModal ? \"window\" : \"modal\"}-${activePlugin.manifestId}`,\n\t\tisSize,\n\t)\n\n\tconst dragStartRectRef = useRef<DOMRect | null>(null)\n\tconst [freedomOfMovement, setFreedomOfMovement] = React.useState(noFreedomOfMovement)\n\n\tconst updateFreedomOfMovement = useCallback(() => {\n\t\tconst constraintsRect = getConstraintsRect(renderAsModal, resizeConstraintsRef)\n\t\tconst contentElement = resizableContentRef.current\n\n\t\tif (!constraintsRect || !contentElement || !resizable) {\n\t\t\tsetFreedomOfMovement(current => (isEqual(current, noFreedomOfMovement) ? current : noFreedomOfMovement))\n\t\t\treturn\n\t\t}\n\n\t\tconst contentRect = contentElement.getBoundingClientRect()\n\n\t\tconst noResizableWidth = resizable === \"height\"\n\t\tconst noResizableHeight = resizable === \"width\"\n\n\t\tconst minWidthReached = noResizableWidth || contentRect.width <= minWidth\n\t\tconst minHeightReached = noResizableHeight || contentRect.height <= minHeight\n\n\t\tconst maxWidthReached = noResizableWidth || contentRect.width >= maxWidthPreferred\n\t\tconst maxHeightReached = noResizableHeight || contentRect.height >= maxHeightPreferred\n\n\t\tconst newFreedomOfMovement: FreedomOfMovement = {\n\t\t\ttopMaxReached: maxHeightReached || contentRect.top <= constraintsRect.top,\n\t\t\ttopMinReached: minHeightReached,\n\t\t\trightMaxReached: maxWidthReached || contentRect.right >= constraintsRect.right,\n\t\t\trightMinReached: minWidthReached,\n\t\t\tbottomMaxReached: maxHeightReached || contentRect.bottom >= constraintsRect.bottom,\n\t\t\tbottomMinReached: minHeightReached,\n\t\t\tleftMaxReached: maxWidthReached || contentRect.left <= constraintsRect.left,\n\t\t\tleftMinReached: minWidthReached,\n\t\t}\n\n\t\tsetFreedomOfMovement(current => (isEqual(current, newFreedomOfMovement) ? current : newFreedomOfMovement))\n\t}, [minHeight, minWidth, maxHeightPreferred, maxWidthPreferred, renderAsModal, resizable])\n\n\tuseMinMaxSize(minHeight, maxHeightPreferred, resizable, \"height\", resizableContentRef)\n\tuseMinMaxSize(minWidth, maxWidthPreferred, resizable, \"width\", resizableContentRef)\n\n\tconst handleDragStart = useCallback(() => {\n\t\tconst contentElement = resizableContentRef.current\n\t\tdragStartRectRef.current = contentElement?.getBoundingClientRect() ?? null\n\t}, [])\n\n\tconst handleDrag = useCallback(\n\t\t(event: MouseTrackerEvent, fx: HandleCoordinate, fy: HandleCoordinate) => {\n\t\t\tconst dragStartRect = dragStartRectRef.current\n\t\t\tif (!dragStartRect) return\n\n\t\t\tconst contentElement = resizableContentRef.current\n\t\t\tif (!contentElement) return\n\n\t\t\tconst constraintsRect = getConstraintsRect(renderAsModal, resizeConstraintsRef)\n\t\t\tif (!constraintsRect) return\n\n\t\t\tconst maxWidthAllowed = renderAsModal ? constraintsRect.width : getMaxWidth(constraintsRect, dragStartRect, fx)\n\t\t\tconst maxHeightAllowed = renderAsModal ? constraintsRect.height : getMaxHeight(constraintsRect, dragStartRect, fy)\n\n\t\t\tconst maxWidth = Math.min(maxWidthPreferred, maxWidthAllowed)\n\t\t\tconst maxHeight = Math.min(maxHeightPreferred, maxHeightAllowed)\n\n\t\t\tconst offsetX = event.offset.x * ((fx - 0.5) * 2)\n\t\t\tconst offsetY = event.offset.y * ((fy - 0.5) * 2)\n\n\t\t\tconst deltaX = renderAsModal ? offsetX * 2 : offsetX\n\t\t\tconst deltaY = renderAsModal ? offsetY * 2 : offsetY\n\n\t\t\tconst newWidth = clamp(minWidth, maxWidth, dragStartRect.width + deltaX)\n\t\t\tconst newHeight = clamp(minHeight, maxHeight, dragStartRect.height + deltaY)\n\n\t\t\tconst resizedRect = getResizeRect(dragStartRect, constraintsRect, newWidth, newHeight, fx, fy)\n\n\t\t\tcontentElement.style.setProperty(resizeWidthVariable, `${resizedRect.width}px`)\n\t\t\tcontentElement.style.setProperty(resizeHeightVariable, `${resizedRect.height}px`)\n\n\t\t\tconst floatingWindow = activePlugin.floatingWindowRef.current\n\t\t\tif (floatingWindow) floatingWindow.setResizeRect(resizedRect)\n\n\t\t\tsetResizeSize({ width: newWidth, height: newHeight })\n\n\t\t\tupdateFreedomOfMovement()\n\t\t},\n\t\t[\n\t\t\trenderAsModal,\n\t\t\tminWidth,\n\t\t\tminHeight,\n\t\t\tmaxWidthPreferred,\n\t\t\tmaxHeightPreferred,\n\t\t\tsetResizeSize,\n\t\t\tupdateFreedomOfMovement,\n\t\t\tactivePlugin.floatingWindowRef,\n\t\t],\n\t)\n\n\tconst handleDragEnd = useCallback(() => {\n\t\tdragStartRectRef.current = null\n\t}, [])\n\n\tconst canResizeWidth = resizable === true || resizable === \"width\"\n\tconst canResizeHeight = resizable === true || resizable === \"height\"\n\n\tconst widthStyle = canResizeWidth\n\t\t? `var(${resizeWidthVariable}, ${resizeSize?.width ?? preferredWidth}px)`\n\t\t: preferredWidth\n\tconst heightStyle = canResizeHeight\n\t\t? `var(${resizeHeightVariable}, ${resizeSize?.height ?? preferredHeight}px)`\n\t\t: preferredHeight\n\n\t// Recalculate freedom of movement when visibility changes and when the window is resized\n\tReact.useEffect(updateFreedomOfMovement, [\n\t\trenderAsModal,\n\t\tvisible,\n\t\tpreferredWidth,\n\t\tpreferredHeight,\n\t\tresizable,\n\t\tminWidth,\n\t\tminHeight,\n\t\tmaxWidthPreferred,\n\t\tmaxHeightPreferred,\n\t\tupdateFreedomOfMovement,\n\t])\n\n\tconst name = activePlugin.name\n\tconst icon = getPluginIcon(activePlugin.manifest)\n\n\tconst [forceToastVisible, setForceToastVisible] = React.useState(false)\n\n\t// Toast shouldn't come up when the plugin is hidden or \"suspended\"\n\tconst shouldShowToast = (!visible && !activePlugin.hiddenDueToUnsupportedView) || forceToastVisible\n\n\tconst pluginVisible = visible && !activePlugin.hiddenDueToUnsupportedView\n\n\tconst toastVisible = useRef(false)\n\n\tconst toastText = backgroundMessage ? `${name} \u00B7 ${backgroundMessage}` : name\n\t// Also set on ref to avoid re-running timer effect on toastText change\n\tconst toastTextRef = useRef(toastText)\n\ttoastTextRef.current = toastText\n\n\tconst upsertToast = useCallback(\n\t\t(text: string) => {\n\t\t\tconst toastKey = `plugin-info-${manifestId}`\n\t\t\ttoastVisible.current = true\n\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"progress\",\n\t\t\t\tkey: toastKey,\n\t\t\t\ttext,\n\t\t\t\tshowCloseButton: \"never\",\n\t\t\t\tduration: Infinity,\n\t\t\t\taction: {\n\t\t\t\t\ttitle: \"Cancel\",\n\t\t\t\t\tonClick: () => engine.stores.pluginStore.closePlugin(manifestId),\n\t\t\t\t},\n\t\t\t\tonDisappear: () => {\n\t\t\t\t\ttoastVisible.current = false\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[manifestId],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (!shouldShowToast) return\n\n\t\tconst toastKey = `plugin-info-${manifestId}`\n\n\t\tconst timers = new Set<number>()\n\n\t\tconst mainTimer = safeWindow.setTimeout(() => {\n\t\t\tsetForceToastVisible(true)\n\t\t\tupsertToast(toastTextRef.current)\n\n\t\t\tconst timer = safeWindow.setTimeout(() => {\n\t\t\t\tsetForceToastVisible(false)\n\t\t\t}, minimumToastVisibilityMs)\n\n\t\t\ttimers.add(timer)\n\t\t}, timeBeforeToastAppearsMs)\n\n\t\ttimers.add(mainTimer)\n\n\t\treturn () => {\n\t\t\tfor (const timer of timers) clearTimeout(timer)\n\t\t\tsetForceToastVisible(false)\n\t\t\ttoast({ type: \"remove\", key: toastKey })\n\t\t}\n\t}, [manifestId, shouldShowToast, upsertToast])\n\n\t// Update when background status text changes\n\tReact.useEffect(() => {\n\t\tif (!shouldShowToast) return\n\t\tif (!toastVisible.current) return\n\n\t\tupsertToast(toastText)\n\t}, [shouldShowToast, toastText, upsertToast])\n\n\tconst menuItems = activePlugin.menuItems.useState()\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tif (isApiPluginManifest(activePlugin.manifest)) {\n\t\treturn null\n\t}\n\n\tif (renderAsModal) {\n\t\treturn (\n\t\t\t<DarkOnDarkThemeOverride>\n\t\t\t\t<CustomModal\n\t\t\t\t\tmountedWhenHidden\n\t\t\t\t\tvisible={pluginVisible}\n\t\t\t\t\thasBackdrop={false}\n\t\t\t\t\tclassName={styles.modal}\n\t\t\t\t\tonDismiss={dismissPlugin}\n\t\t\t\t\tref={resizableContentRef}\n\t\t\t\t\tzIndex={ZIndex.modalWithoutPopovers}\n\t\t\t\t\tstyle={{ width: widthStyle, height: heightStyle }}\n\t\t\t\t\t{...modalThemeProps}\n\t\t\t\t>\n\t\t\t\t\t<Stack gap={0} direction=\"column\" className={styles.modalContent}>\n\t\t\t\t\t\t<WindowResize\n\t\t\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\t\t\tfreedomOfMovement={freedomOfMovement}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PluginHeader menuItems={menuItems} icon={icon} name={name} dismiss={dismissPlugin} />\n\t\t\t\t\t\t<div className={styles.pluginContainer}>\n\t\t\t\t\t\t\t{isDefined(localizationProgress) && (\n\t\t\t\t\t\t\t\t<div className={styles.progressOverlay}>\n\t\t\t\t\t\t\t\t\t<Progress startFromZero value={localizationProgress} className={styles.progress} />\n\t\t\t\t\t\t\t\t\t<Stack gap={dimensions.css.modalGap} alignItems=\"center\">\n\t\t\t\t\t\t\t\t\t\t<div className={styles.localizationIconContainer}>\n\t\t\t\t\t\t\t\t\t\t\t<IconGlobeLarge />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<Stack gap={dimensions.css.inputSpacing}>\n\t\t\t\t\t\t\t\t\t\t\t<span className={styles.progressHeading}>Applying Updates</span>\n\t\t\t\t\t\t\t\t\t\t\t<span className={styles.progressParagraph}>This can take a few moments.</span>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<Plugin\n\t\t\t\t\t\t\t\tref={activePlugin.iFrameRef}\n\t\t\t\t\t\t\t\tmanifest={activePlugin.manifest}\n\t\t\t\t\t\t\t\tmode={activePlugin.modeHandlers.mode}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Stack>\n\t\t\t\t</CustomModal>\n\t\t\t</DarkOnDarkThemeOverride>\n\t\t)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DragPreview activePlugin={activePlugin} />\n\t\t\t<FloatingWindow\n\t\t\t\tref={activePlugin.floatingWindowRef}\n\t\t\t\tvisible={pluginVisible}\n\t\t\t\trestorationKey={`plugin-floating-window-position-${activePlugin.manifestId}`}\n\t\t\t\tcontainerRef={resizeConstraintsRef}\n\t\t\t\tonPointerDownCapture={handlePointerDown}\n\t\t\t\tinitialLeftOffset={getInitialLeftOffset(position)}\n\t\t\t\tinitialTopOffset={getInitialTopOffset(position)}\n\t\t\t\tonDragEnd={updateFreedomOfMovement}\n\t\t\t\tzIndex={isInFront ? ZIndex.floatingWindowFront : ZIndex.floatingWindow}\n\t\t\t>\n\t\t\t\t<WindowResize\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tfreedomOfMovement={freedomOfMovement}\n\t\t\t\t/>\n\t\t\t\t<Stack\n\t\t\t\t\tref={resizableContentRef}\n\t\t\t\t\tgap={0}\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tclassName={cx(styles.window, appPointerEvents)}\n\t\t\t\t\tstyle={{ width: widthStyle, height: heightStyle }}\n\t\t\t\t>\n\t\t\t\t\t<FloatingWindowDraggableArea>\n\t\t\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t\t\t<PluginHeader menuItems={menuItems} icon={icon} name={name} dismiss={dismissPlugin} />\n\t\t\t\t\t\t</HandleClickOnClick>\n\t\t\t\t\t</FloatingWindowDraggableArea>\n\t\t\t\t\t<div className={styles.pluginContainer}>\n\t\t\t\t\t\t<Plugin\n\t\t\t\t\t\t\tref={activePlugin.iFrameRef}\n\t\t\t\t\t\t\tmanifest={activePlugin.manifest}\n\t\t\t\t\t\t\tmode={activePlugin.modeHandlers.mode}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t</FloatingWindow>\n\t\t</>\n\t)\n})\n\nfunction getSVGBackgroundImageForDragPreview(dragData: DragData, dragStartInfo: DragStartInfo): string | undefined {\n\tif (dragData.previewImage) return\n\tif (dragData.type !== \"svg\" || !dragStartInfo.svgRect) return\n\tconst encodedSVG = encodeURIComponent(dragData.svg)\n\treturn `url('data:image/svg+xml;utf8,${encodedSVG}')`\n}\n\nfunction getBackgroundImageForDragPreview(dragData: DragData): string | undefined {\n\tif (dragData.previewImage) return `url(${dragData.previewImage})`\n}\n\nfunction getBackgroundImageSizeForDragPreview(dragData: DragData, dragStartInfo: DragStartInfo): string {\n\tif (dragData.type !== \"svg\" || !dragStartInfo.svgRect || dragData.previewImage) return \"cover\"\n\treturn `${dragStartInfo.svgRect.width}px ${dragStartInfo.svgRect.height}px`\n}\n\nfunction DragPreview({ activePlugin }: { activePlugin: ActivePlugin }) {\n\tconst dragState = activePlugin.dragState.useState()\n\tconst { isDarkMode } = useDarkMode()\n\n\tconst handleTransitionEnd = useCallback(\n\t\t(event: React.TransitionEvent<HTMLDivElement>) => {\n\t\t\tif (event.target !== event.currentTarget) return\n\t\t\tconst dragStateType = activePlugin.dragState.getState().type\n\t\t\tif (dragStateType !== \"cancelled\" && dragStateType !== \"success\") return\n\t\t\tactivePlugin.dragState.setState({ type: \"idle\" })\n\t\t},\n\t\t[activePlugin],\n\t)\n\n\tswitch (dragState.type) {\n\t\tcase \"dragging\":\n\t\tcase \"cancelled\":\n\t\tcase \"success\":\n\t\t\tbreak\n\t\tcase \"idle\":\n\t\tcase \"dataReceived\":\n\t\t\tif (!dragState.dragPreviewImagePreload) return null\n\t\t\treturn createPortal(\n\t\t\t\t<img\n\t\t\t\t\talt=\"\"\n\t\t\t\t\tsrc={dragState.dragPreviewImagePreload}\n\t\t\t\t\tclassName={styles.offScreenDragPreviewPreloadImage}\n\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t/>,\n\t\t\t\tdocument.body,\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(dragState)\n\t}\n\n\tconst { dragInfo, dragStartInfo, dragData, offset, hasBeenOverCanvas } = dragState\n\tif (!dragInfo) return null\n\n\tconst dragDeltaX = dragInfo.mouse.x - dragStartInfo.mouse.x\n\tconst dragDeltaY = dragInfo.mouse.y - dragStartInfo.mouse.y\n\n\tconst isCancelled = dragState.type === \"cancelled\"\n\tconst isSuccess = dragState.type === \"success\"\n\tconst isEnded = isCancelled || isSuccess\n\tconst transitionDuration = isCancelled ? `${0.4}s` : `${0.2}s`\n\n\tconst translateX = isCancelled ? 0 : dragDeltaX\n\tconst translateY = isCancelled ? 0 : dragDeltaY\n\n\tconst svgBackgroundImage = getSVGBackgroundImageForDragPreview(dragData, dragStartInfo)\n\tconst backgroundImage = svgBackgroundImage ?? getBackgroundImageForDragPreview(dragData)\n\tconst shouldInvert = Boolean(svgBackgroundImage && dragData.type === \"svg\" && dragData.invertInDarkMode !== false)\n\n\treturn createPortal(\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttransition: isEnded ? `transform ${transitionDuration}, opacity ${transitionDuration}` : \"none\",\n\t\t\t\ttop: dragStartInfo.elementRect.y,\n\t\t\t\tleft: dragStartInfo.elementRect.x,\n\t\t\t\ttransform: `translate(${translateX}px, ${translateY}px)`,\n\t\t\t\twidth: dragStartInfo.elementRect.width,\n\t\t\t\theight: dragStartInfo.elementRect.height,\n\t\t\t\tpointerEvents: \"none\",\n\t\t\t\tfilter: svgBackgroundImage\n\t\t\t\t\t? undefined\n\t\t\t\t\t: \"drop-shadow(0 4px 12px rgba(0,0,0,0.25)) drop-shadow(0 2px 6px rgba(0,0,0,0.35))\",\n\t\t\t\tzIndex: 9999,\n\t\t\t\twillChange: \"transform\",\n\t\t\t\topacity: isEnded ? 0 : 0.4,\n\t\t\t}}\n\t\t\tonTransitionEnd={handleTransitionEnd}\n\t\t>\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"absolute\",\n\t\t\t\t\ttop: 0,\n\t\t\t\t\tleft: 0,\n\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\theight: \"100%\",\n\t\t\t\t\tborderRadius: 8,\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t\tjustifyContent: \"center\",\n\t\t\t\t\talignItems: \"center\",\n\t\t\t\t\tfilter: isDarkMode && shouldInvert ? \"invert(1)\" : undefined,\n\t\t\t\t\tbackgroundColor: backgroundImage ? `rgba(120,120,120, 0.3)` : \"rgb(120,120,120)\",\n\t\t\t\t\tbackgroundImage,\n\t\t\t\t\tbackgroundSize: getBackgroundImageSizeForDragPreview(dragData, dragStartInfo),\n\t\t\t\t\tbackgroundRepeat: \"no-repeat\",\n\t\t\t\t\tbackgroundPosition: \"center\",\n\t\t\t\t\ttransition: \"transform 0.2s\",\n\t\t\t\t\twillChange: \"transform\",\n\t\t\t\t\ttransform: hasBeenOverCanvas && !isCancelled ? `translate(${offset.x}px, ${offset.y}px)` : undefined,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>,\n\t\tdocument.body,\n\t)\n}\n\nfunction PluginPreload({ manifestId }: { manifestId: PluginManifestId }) {\n\tconst manifest = engine.stores.pluginStore.manifestById.get(manifestId)\n\tif (!manifest) return null\n\tif (isApiPluginManifest(manifest)) return null\n\n\treturn (\n\t\t<div className={styles.preloadWrapper}>\n\t\t\t<Plugin isPreload manifest={manifest} mode=\"canvas\" />\n\t\t</div>\n\t)\n}\n\nexport const PluginUI = React.memo(function FloatingPluginWindows() {\n\tconst { activePlugin, pluginManifestIdToPreload } = engine.stores.pluginStore.useState()\n\n\treturn (\n\t\t<>\n\t\t\t{pluginManifestIdToPreload && <PluginPreload manifestId={pluginManifestIdToPreload} />}\n\t\t\t{activePlugin && <InnerPluginUI key={activePlugin.manifestId} activePlugin={activePlugin} />}\n\t\t</>\n\t)\n})\n", "import { assert } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport React, { useMemo } from \"react\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport * as styles from \"./Plugin.styles.ts\"\nimport { trimPluginIdPrefix } from \"./pluginManifestValidation.ts\"\nimport { type HostedPluginManifest, codeLinkManifestId } from \"./plugins.ts\"\n\nconst basePermissions = [\n\t\"accelerometer\",\n\t\"autoplay\",\n\t\"camera\",\n\t\"clipboard-read\",\n\t\"clipboard-write\",\n\t\"display-capture\",\n\t\"encrypted-media\",\n\t\"fullscreen\",\n\t\"geolocation\",\n\t\"microphone\",\n\t\"midi\",\n\t\"picture-in-picture\",\n\t\"speaker-selection\",\n\t\"xr-spatial-tracking\",\n]\n\nfunction getIFramePermissions(pluginId: string): string {\n\tconst permissions = [...basePermissions]\n\tif (trimPluginIdPrefix(pluginId) === codeLinkManifestId) {\n\t\tpermissions.push(\"local-network-access\")\n\t}\n\treturn permissions.join(\"; \")\n}\n\ninterface Props {\n\tmode: Mode\n\tmanifest: HostedPluginManifest\n\tisPreload?: boolean\n}\n\nexport const Plugin = React.memo(\n\tReact.forwardRef<HTMLIFrameElement, Props>(function Plugin({ mode, manifest, isPreload = false }, forwardedRef) {\n\t\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\t\tconst src = useMemo(() => {\n\t\t\tassert(manifest.entrypointUrl, \"Plugin must have an entrypointUrl\")\n\t\t\tconst url = new URL(manifest.entrypointUrl)\n\t\t\turl.searchParams.set(\"mode\", mode)\n\t\t\t// When shipping agents, remove manifest gating and all framer.css data-framer-styles gating\n\t\t\tif (isAgentExperimentOn && manifest.prereleaseStyles) {\n\t\t\t\turl.searchParams.set(\"styles\", \"prerelease\")\n\t\t\t}\n\n\t\t\treturn url.toString()\n\t\t}, [mode, manifest, isAgentExperimentOn])\n\n\t\treturn (\n\t\t\t<iframe\n\t\t\t\tsrc={src}\n\t\t\t\tref={forwardedRef}\n\t\t\t\ttitle=\"plugin\"\n\t\t\t\tdata-is-plugin\n\t\t\t\t// eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox -- False positive\n\t\t\t\tsandbox={\n\t\t\t\t\tisPreload\n\t\t\t\t\t\t? \"allow-downloads allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-forms\"\n\t\t\t\t\t\t: \"allow-downloads allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-forms\"\n\t\t\t\t}\n\t\t\t\tallow={getIFramePermissions(manifest.id)}\n\t\t\t\tclassName={styles.iFrame}\n\t\t\t/>\n\t\t)\n\t}),\n)\n", "import \"Plugin.styles_nahe6r.wyw.css\"; export const iFrame = \"iFrame_iq3fq1y\";", "export function IconChevronDown() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\">\n\t\t\t<path\n\t\t\t\td=\"M1 2.5l3 3 3-3\"\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></path>\n\t\t</svg>\n\t)\n}\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, CenterChild, IconClose, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { IconChevronDown } from \"document/components/chrome/contentManagement/assets/IconChevronDown.tsx\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useRef } from \"react\"\nimport { isFunction } from \"utils/typeChecks.ts\"\nimport * as styles from \"./PluginHeader.styles.ts\"\nimport { PluginIcon } from \"./PluginIcon.tsx\"\n\ninterface Props {\n\tname: string\n\tmenuItems?: readonly MenuItemOptions[]\n\tsubtitle?: string\n\ticon: string\n\tdismiss: (() => void) | \"hidden\"\n}\n\nexport function PluginHeader({ name, menuItems, dismiss, subtitle, icon }: Props) {\n\tconst menuRef = useRef<HTMLDivElement>(null)\n\tconst menuEnabled = menuItems && menuItems.length > 0\n\n\tconst showMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\t\t\tif (!menuEnabled || !menuRef.current) return\n\n\t\t\tconst bounds = menuRef.current.getBoundingClientRect()\n\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: bounds.left - 5,\n\t\t\t\t\ty: bounds.bottom,\n\t\t\t\t},\n\t\t\t\tclassName: `${styles.menu}`,\n\t\t\t})\n\t\t},\n\t\t[menuItems, menuEnabled],\n\t)\n\tconst menuClickHandlers = useClickHandlers(showMenu)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\tclassName={styles.header}\n\t\t>\n\t\t\t<CenterChild className={styles.iconWrapper}>\n\t\t\t\t<PluginIcon src={icon} size=\"small\" />\n\t\t\t</CenterChild>\n\t\t\t<span className={styles.title}>\n\t\t\t\t<span\n\t\t\t\t\t{...(menuEnabled && menuClickHandlers)}\n\t\t\t\t\tclassName={cx(truncateWithEllipsis, styles.titleText, menuEnabled && styles.menuClickTarget)}\n\t\t\t\t\tref={menuRef}\n\t\t\t\t>\n\t\t\t\t\t{name}\n\t\t\t\t</span>\n\t\t\t\t{menuEnabled && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\ttitle=\"Menu\"\n\t\t\t\t\t\tonClick={showMenu}\n\t\t\t\t\t\tclassName={cx(styles.headerIcon, styles.menuClickTarget)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconChevronDown />\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t{subtitle && <span className={styles.subtitle}>{` \u2022 ${subtitle}`}</span>}\n\t\t\t</span>\n\t\t\t{isFunction(dismiss) && (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\ttitle=\"Close Plugin\"\n\t\t\t\t\tclassName={cx(styles.closeIcon, styles.headerIcon)}\n\t\t\t\t\tonClick={dismiss}\n\t\t\t\t>\n\t\t\t\t\t<IconClose />\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"PluginHeader.styles_xrqdnr.wyw.css\"; export const header = \"header_h68zce7\";\nexport const iconWrapper = \"iconWrapper_ijy1fdo\";\nexport const headerIcon = \"headerIcon_h1qd2yil\";\nexport const closeIcon = \"closeIcon_cfp5gi\";\nexport const title = \"title_t1pf2ewt\";\nexport const titleText = \"titleText_tabpnaq\";\nexport const menuClickTarget = \"menuClickTarget_m1spq9ci\";\nexport const subtitle = \"subtitle_s8cylvf\";\nexport const menu = \"menu_m11bhw12\";", "import \"PluginUI.styles_17lpg7e.wyw.css\"; export const window = \"window_w15telv8\";\nexport const modal = \"modal_m1k2its4\";\nexport const pluginContainer = \"pluginContainer_p1ctxt4g\";\nexport const modalContent = \"modalContent_m1xihr77\";\nexport const offScreenDragPreviewPreloadImage = \"offScreenDragPreviewPreloadImage_o1i0zi9e\";\nexport const preloadWrapper = \"preloadWrapper_pbn5v30\";\nexport const progressOverlay = \"progressOverlay_p1gt9w7e\";\nexport const progress = \"progress_p1xh48zh\";\nexport const localizationIconContainer = \"localizationIconContainer_l1aftsf2\";\nexport const progressHeading = \"progressHeading_pdjujzd\";\nexport const progressParagraph = \"progressParagraph_p7xucul\";", "import { useCondition } from \"app/FeatureSet.tsx\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { MetricsInteractionViews, MetricsViewContext } from \"app/metrics.ts\"\nimport { Tooltip } from \"document/components/canvas-hud/Tooltip.tsx\"\nimport engine from \"document/engine.ts\"\nimport { wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport { environment } from \"environment/index.ts\"\nimport { PluginUI } from \"plugins/PluginUI.tsx\"\nimport React from \"react\"\nimport { nativeActionTarget } from \"../DocumentActionTarget.tsx\"\nimport type { ActionState } from \"../actions/ActionResponder.tsx\"\nimport { ActionResponder } from \"../actions/ActionResponder.tsx\"\nimport { ChromeWrapper } from \"./ChromeWrapper.tsx\"\nimport { LoadingIndicator } from \"./LoadingIndicator.tsx\"\nimport { Modals } from \"./Modals.tsx\"\nimport { PopoutWindowManager } from \"./PopoutWindowManager.tsx\"\nimport { CodeEditorAgentPanel } from \"./agentPanel/CodeEditorAgentPanel.tsx\"\nimport { AiSidebar } from \"./aiSidebar/AiSidebar.tsx\"\nimport { Analytics } from \"./analytics/Analytics.tsx\"\nimport { AnalyticsSidebar } from \"./analytics/components/AnalyticsSidebar.tsx\"\nimport { CollectionItemOverlay } from \"./contentManagement/CollectionItemOverlay.tsx\"\nimport { CollectionItemsTable } from \"./contentManagement/CollectionItemTable.tsx\"\nimport { CollectionLeftPanel } from \"./contentManagement/CollectionLeftPanel.tsx\"\nimport { ContentPanel } from \"./contentPanel/ContentPanel.tsx\"\nimport { DebugBar } from \"./debugbar/LazyDebugBar.tsx\"\nimport { FloatingToolbar } from \"./floatingToolbar/FloatingToolbar.tsx\"\nimport { InsertSidebar } from \"./insertSidebar/InsertSidebar.tsx\"\nimport { LocaleCanvasPreviewToast } from \"./localization/LocaleCanvasPreviewToast.tsx\"\nimport { LocalizationSidebar } from \"./localization/LocalizationSidebar.tsx\"\nimport { LocalizationTable } from \"./localization/LocalizationTable.tsx\"\nimport { LocalizationTextEditorOverlay } from \"./localization/LocalizationTextEditorOverlay.tsx\"\nimport { CodeEditorPreview } from \"./preview/CodeEditorPreview.tsx\"\nimport { OverCanvasPreview } from \"./preview/OverCanvasPreview.tsx\"\nimport { ProjectBar } from \"./projectbar/ProjectBar.tsx\"\nimport { ViewingBranchFromOtherUserToast } from \"./projectbar/ViewingBranchFromOtherUserToast.tsx\"\nimport { RightPanel } from \"./rightPanel/rightPanel.tsx\"\nimport { BreadcrumbBar } from \"./shared/BreadcrumbBar.tsx\"\nimport { Crash } from \"./shared/Crash.tsx\"\nimport { OptimizationIssuesLogWindow } from \"./siteSettings/OptimizationIssuesLogWindow.tsx\"\nimport { SiteSettings } from \"./siteSettings/SiteSettings.tsx\"\nimport { StatusBar } from \"./statusBar/StatusBar.tsx\"\nimport { Toaster } from \"./toaster/Toaster.tsx\"\n\nfunction UIContainer({ children }: { children: React.ReactNode }) {\n\tconst documentLoaded = engine.stores.loadingStore.useState(loadingStore => loadingStore.documentLoaded)\n\tconst suppressUIMount = useCondition(employeesOnlySettings, \"suppressUIMount\", variant => variant === \"on\")\n\tif (!documentLoaded || suppressUIMount) return null\n\treturn children\n}\n\nexport class Chrome extends React.PureComponent {\n\toverride render() {\n\t\tengine.stores.canvasStore.assertInteractive()\n\t\tconst supportsProjectBar = !(environment.isAutomation || environment.isTest)\n\t\treturn (\n\t\t\t<ChromeWrapper>\n\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.CHROME}>\n\t\t\t\t\t<UIContainer>\n\t\t\t\t\t\t<RightPanel />\n\t\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.CONTENT_PANEL}>\n\t\t\t\t\t\t\t<ActionResponder engine={engine} target={this}>\n\t\t\t\t\t\t\t\t<ContentPanel />\n\t\t\t\t\t\t\t</ActionResponder>\n\t\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t\t\t<BreadcrumbBar />\n\t\t\t\t\t\t<CollectionLeftPanel />\n\t\t\t\t\t\t<CollectionItemsTable />\n\t\t\t\t\t\t<CollectionItemOverlay />\n\t\t\t\t\t\t<InsertSidebar />\n\t\t\t\t\t\t<AiSidebar />\n\t\t\t\t\t\t<LocalizationSidebar />\n\t\t\t\t\t\t<LocalizationTable />\n\t\t\t\t\t\t<LocalizationTextEditorOverlay />\n\t\t\t\t\t\t{supportsProjectBar && <ProjectBar />}\n\t\t\t\t\t\t<FloatingToolbar />\n\t\t\t\t\t\t{!environment.isPhone && <CodeEditorPreview />}\n\t\t\t\t\t\t{!environment.isPhone && <CodeEditorAgentPanel />}\n\t\t\t\t\t\t{(!environment.isPhone || engine.stores.previewStore.forceOverCanvasPreviewRender) && <OverCanvasPreview />}\n\t\t\t\t\t\t<SiteSettings />\n\t\t\t\t\t\t<OptimizationIssuesLogWindow />\n\t\t\t\t\t\t<AnalyticsSidebar />\n\t\t\t\t\t\t<Analytics />\n\t\t\t\t\t\t<PopoutWindowManager />\n\t\t\t\t\t\t<PluginUI />\n\t\t\t\t\t\t<Tooltip />\n\t\t\t\t\t\t<Modals />\n\t\t\t\t\t</UIContainer>\n\t\t\t\t\t<Crash />\n\t\t\t\t\t<LoadingIndicator />\n\t\t\t\t\t<DebugBar />\n\t\t\t\t\t<StatusBar />\n\t\t\t\t\t<Toaster />\n\t\t\t\t\t<ViewingBranchFromOtherUserToast />\n\t\t\t\t\t<LocaleCanvasPreviewToast />\n\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t</ChromeWrapper>\n\t\t)\n\t}\n\n\t// Forward undo events to the standard handler if there's no focused field\n\n\twantedActions: (keyof this & keyof typeof nativeActionTarget)[] = [\"undo\", \"redo\"]\n\n\twantsAction = (action: \"undo\" | \"redo\", event?: Event): ActionState => {\n\t\treturn wantsNativeTextActions() ? \"native\" : nativeActionTarget.wantsAction(action, event)\n\t}\n\n\tundo() {\n\t\tnativeActionTarget.undo()\n\t}\n\n\tredo() {\n\t\tnativeActionTarget.redo()\n\t}\n}\n", "import type { ThemeOverrideMode } from \"@framerjs/fresco\"\nimport { FrescoSettings, ThemeOverride } from \"@framerjs/fresco\"\nimport { agentDimensionTokenOverrides } from \"app/agent/utils/dimensions.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type React from \"react\"\nimport { disableAppPointerEvents, enableAppPointerEvents } from \"utils/appPointerEvents.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getThemeOverrideDependencies, getThemeOverrideMode } from \"../utils/getThemeOverrideMode.ts\"\nimport { PopoutContext } from \"./shared/PopoutContext.ts\"\nimport { popoutWindow } from \"./shared/PopoutWindow.tsx\"\n\nconst beginUndoGroup = engine.scheduler.wrapHandler(() => engine.beginUndoGroup())\n\nconst endUndoGroup = engine.scheduler.wrapHandler(() => engine.endUndoGroup())\n\nfunction sendMetricsUIChromeEvent(event: React.MouseEvent<HTMLElement>) {\n\tif (!event.target) return\n\tconst target = event.target as HTMLElement\n\tconst id = target.dataset.metricId\n\tconst view = target.dataset.metricView\n\tif (!id || !view) return\n\n\trecord(\"ui_interaction\", {\n\t\tid,\n\t\tpage: view,\n\t})\n}\n\ninterface Props {\n\tchildren: React.ReactNode\n}\n\nexport function ChromeWrapper({ children }: Props) {\n\tconst { persistedUserDefaults } = engine.stores\n\tconst { smallNudgeIncrement, largeNudgeIncrement } = useDeprecatedEngineState(EngineChange.UserDefaultsStore, () => ({\n\t\tsmallNudgeIncrement: persistedUserDefaults.smallNudgeIncrement,\n\t\tlargeNudgeIncrement: persistedUserDefaults.largeNudgeIncrement,\n\t}))\n\n\tconst themeOverride = useDeprecatedEngineState<ThemeOverrideMode | undefined>(\n\t\tgetThemeOverrideDependencies(engine.stores),\n\t\t() => getThemeOverrideMode(engine.stores),\n\t)\n\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<div onClickCapture={sendMetricsUIChromeEvent}>\n\t\t\t<FrescoSettings\n\t\t\t\tbeginUndoGroup={beginUndoGroup}\n\t\t\t\tendUndoGroup={endUndoGroup}\n\t\t\t\tmouseTrackerWillStart={disableAppPointerEvents}\n\t\t\t\tmouseTrackerDidEnd={enableAppPointerEvents}\n\t\t\t\tsmallNudgeIncrement={smallNudgeIncrement}\n\t\t\t\tlargeNudgeIncrement={largeNudgeIncrement}\n\t\t\t\tdimensionTokenOverrides={agentExperimentIsOn ? agentDimensionTokenOverrides : undefined}\n\t\t\t>\n\t\t\t\t<PopoutContext.Provider value={popoutWindow.navigation}>\n\t\t\t\t\t<ThemeOverride mode={themeOverride}>{children}</ThemeOverride>\n\t\t\t\t</PopoutContext.Provider>\n\t\t\t</FrescoSettings>\n\t\t</div>\n\t)\n}\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useState } from \"react\"\n\nexport function DeleteFileModal({\n\tisCodeFileInUse,\n\tpath,\n\tonConfirm,\n\thasBackdrop = true,\n\ttitle = \"Delete Code File\",\n}: ModalProps<ModalType.DeleteFile>) {\n\tconst [onDeletedPromise, setOnDeletedPromise] = useState<null | Promise<void>>(null)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tuseEffect(() => {\n\t\tif (!onDeletedPromise) return\n\t\tvoid onDeletedPromise.finally(() => setOnDeletedPromise(null))\n\t}, [onDeletedPromise])\n\n\tfunction confirmationHandler() {\n\t\tsetOnDeletedPromise(onConfirm())\n\t}\n\n\tconst content = isCodeFileInUse ? (\n\t\t<>\n\t\t\t<T>The file</T> <b>{path}</b>{\" \"}\n\t\t\t<T>\n\t\t\t\tcannot be deleted because it is currently in use. Please make sure to first delete all uses of components or\n\t\t\t\toverrides from this file.\n\t\t\t</T>\n\t\t</>\n\t) : (\n\t\t<>\n\t\t\t<T>You are about to delete file</T> <b>{path}</b>.{\" \"}\n\t\t\t<T>It will be removed permanently from your project. This cannot be undone.</T>\n\t\t</>\n\t)\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={title}\n\t\t\tdescription={content}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonConfirm={confirmationHandler}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonEnabled={!isCodeFileInUse}\n\t\t\tconfirmButtonLoading={!!onDeletedPromise}\n\t\t\thasBackdrop={hasBackdrop}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import type { LocalModuleId, LocalModuleIdentifierString } from \"@framerjs/shared\"\nimport { ModuleType, asLocalId, getLogger, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withCodeOverride } from \"document/models/CanvasTree/traits/WithCodeOverride.ts\"\nimport { withCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\n\nconst log = getLogger(\"codeFileUsageChecker\")\n\nfunction hasLocalModule(\n\tidentifier: string | undefined,\n\tlocalId: LocalModuleId,\n): identifier is LocalModuleIdentifierString {\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!isLocalModuleIdentifier(parsed)) return false\n\treturn parsed.localId === localId\n}\n\n/**\n * Checks if a code file with the given LocalModuleId is currently in use\n */\nfunction isCodeFileInUseByLocalId(localId: LocalModuleId, path?: string): boolean {\n\t// Check if any other modules depend on this one\n\tif (path) {\n\t\tconst dependents = engine.stores.modulesStore.getDependentsOfModule(path)\n\t\tif (dependents && dependents.size > 0) {\n\t\t\tlog.debug(path, \"is in use by\", [...dependents.keys()])\n\t\t\treturn true\n\t\t}\n\t}\n\n\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\n\t// Check if the code file is used anywhere in the canvas tree\n\treturn tree.root.some(node => {\n\t\tif (withCodeOverride(node) && hasLocalModule(node.codeOverrideIdentifier, localId)) {\n\t\t\tlog.debug(path || localId, \"is in use as an override on node\", node.id)\n\t\t\treturn true\n\t\t}\n\t\tif (isCodeComponentNode(node) && hasLocalModule(node.codeComponentIdentifier, localId)) {\n\t\t\tlog.debug(path || localId, \"is in use by code component instance\", node.id)\n\t\t\treturn true\n\t\t}\n\t\tif (withCollectionDataSource(node) && hasLocalModule(node.dataIdentifier, localId)) {\n\t\t\tlog.debug(path || localId, \"is in use as a data source by node\", node.id)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n}\n\n/**\n * Checks if a code file is currently in use given its path\n */\nexport function isCodeFileInUseByPath(path: string): boolean {\n\tconst localId = engine.stores.modulesStore.localModules.get(path)?.localId\n\tif (!localId) return false\n\n\treturn isCodeFileInUseByLocalId(localId, path)\n}\n\n/**\n * Checks if a code file node is currently in use\n */\nfunction isCodeFileInUseByNode(node: CanvasNode): boolean {\n\tif (!isLocalModuleNode(node) || node.save.type !== ModuleType.Code) return false\n\n\tconst localId = asLocalId(node.id)\n\tconst path = node.save.name ? `${ModuleType.Code}/${node.save.name}` : undefined\n\n\treturn isCodeFileInUseByLocalId(localId, path)\n}\n\n/**\n * Checks if any of the given code files are currently in use\n */\nexport function areCodeFilesInUse(codeFiles: CanvasNode[]): boolean {\n\treturn codeFiles.some(codeFile => isCodeFileInUseByNode(codeFile))\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { DeleteFileModal } from \"document/components/chrome/shared/DeleteFileModal.tsx\"\nimport { isCodeFileInUseByPath } from \"document/components/chrome/utils/codeFileUsageChecker.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { splitTypeSlashName } from \"modules/utils.ts\"\n\nexport const DeleteCodeFileModal = ({ path, onConfirm }: ModalProps<ModalType.DeleteCodeFile>) => {\n\tconst isCodeFileInUse = useEngineState(\n\t\t() => isCodeFileInUseByPath(path),\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.modulesStore],\n\t)\n\tconst displayPath = splitTypeSlashName(path)[1]\n\treturn (\n\t\t<DeleteFileModal path={displayPath} onConfirm={onConfirm} isCodeFileInUse={isCodeFileInUse} hasBackdrop={false} />\n\t)\n}\n", "import { InputWrapper, Modal, Stack, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { useState } from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as styles from \"./CreateManagedCollectionModal.styles.ts\"\nimport { PluginHeader } from \"./PluginHeader.tsx\"\nimport { createPluginManagedCollection } from \"./collections.ts\"\nimport { getPluginIcon } from \"./plugins.ts\"\n\nconst dismiss = engine.stores.modalStore.dismiss\n\nexport function CreateManagedCollectionModal({ manifest }: ModalProps<ModalType.CreateManagedCollection>) {\n\tassert(\n\t\tmanifest.modes.includes(\"syncManagedCollection\") || manifest.modes.includes(\"configureManagedCollection\"),\n\t\t\"Plugin must support managed collections\",\n\t)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tconst isViewOnly = useIsViewOnly(\"canAddCollections\")\n\n\tconst existingNames = useDeprecatedEngineState<Set<string>>(EngineChange.Tree, () => {\n\t\tconst result = new Set<string>()\n\n\t\tconst contentManagementNode = getContentManagementNode(engine.tree)\n\t\tif (!contentManagementNode) return result\n\n\t\tconst loadedContentManagementNode = contentManagementNode.loaded\n\t\tif (!loadedContentManagementNode) return result\n\n\t\tfor (const collectionNode of loadedContentManagementNode.children) {\n\t\t\tconst name = collectionNode.resolveValue(\"name\")\n\t\t\tif (name) result.add(name)\n\t\t}\n\n\t\treturn result\n\t})\n\n\tconst [name, setName] = useState(() => {\n\t\tconst defaultName = manifest.name\n\t\treturn uniqueName(defaultName, existingNames)\n\t})\n\n\tconst canCreateCollection = name.length > 0 && !existingNames.has(name) && !isViewOnly\n\n\tconst createCollection = useEngineCallback(() => {\n\t\tengine.stores.modalStore.dismiss()\n\t\tengine.stores.chromeStore.activeCollectionPanelTab = CollectionPanelTab.Collections\n\t\tcreatePluginManagedCollection(engine, manifest, name)\n\t}, [manifest, name])\n\n\treturn (\n\t\t<Modal.Root onDismiss={dismiss} onConfirm={createCollection} className={styles.noPadding} {...modalThemeProps}>\n\t\t\t<PluginHeader name=\"New Collection\" icon={getPluginIcon(manifest)} dismiss=\"hidden\" />\n\t\t\t<Stack gap={0} paddingLeft={dimensions.css.modalPadding} paddingRight={dimensions.css.modalPadding}>\n\t\t\t\t<Stack gap={8}>\n\t\t\t\t\t<InputWrapper large>\n\t\t\t\t\t\t<TextInput value={name} placeholder=\"My Collection\" onChange={setName} constantChange autoFocus />\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t<Modal.Text>This Plugin will create a new Collection for you that can be synced at any time.</Modal.Text>\n\t\t\t\t</Stack>\n\t\t\t\t<Modal.Footer separator>\n\t\t\t\t\t<Modal.CancelButton>Cancel</Modal.CancelButton>\n\t\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={canCreateCollection}>\n\t\t\t\t\t\tCreate\n\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t</Modal.Footer>\n\t\t\t</Stack>\n\t\t</Modal.Root>\n\t)\n}\n", "import \"CreateManagedCollectionModal.styles_1hs96ik.wyw.css\"; export const noPadding = \"noPadding_n3n1rvl\";", "import { InputWrapper, Link, Modal, TextInput, modalStyles } from \"@framerjs/fresco\"\nimport { ZIndex } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { validateCustomCanonicalURL } from \"document/utils/validateCustomCanonicalURL.ts\"\nimport type { ReactNode } from \"react\"\nimport { useEffect, useRef, useState } from \"react\"\nimport { isPluginDevelopmentUrl } from \"./plugins.ts\"\nimport { showPluginUrlFailedToast } from \"./toast.ts\"\nimport { defaultDevelopmentUrl } from \"./utils/getDefaultDevelopmentPluginManifest.ts\"\n\ntype Props = ModalProps<ModalType.PluginFromURL>\n\ninterface Content {\n\tbody: ReactNode\n\ttitle: string\n\tplaceholder: string\n}\n\nconst content: Record<Props[\"environment\"], Content> = {\n\tdefault: {\n\t\tbody: (\n\t\t\t<>\n\t\t\t\t{\"Enter a URL for a hosted Framer Plugin. Read \"}\n\t\t\t\t<Link href=\"https://framer.com/developers/plugins/sharing\" target=\"_blank\">\n\t\t\t\t\tthe guide\n\t\t\t\t</Link>\n\t\t\t\t{\" to setup your own.\"}\n\t\t\t</>\n\t\t),\n\t\ttitle: \"Open Plugin URL\",\n\t\tplaceholder: \"https://example.com\",\n\t},\n\tdevelopment: {\n\t\ttitle: \"Open Development Plugin\",\n\t\tbody: (\n\t\t\t<>\n\t\t\t\t{\"Run Plugin development locally and enter your localhost URL. \"}\n\t\t\t\t<Link href=\"https://framer.com/developers/plugins/quick-start\" target=\"_blank\">\n\t\t\t\t\tLearn more\n\t\t\t\t</Link>\n\t\t\t</>\n\t\t),\n\t\tplaceholder: defaultDevelopmentUrl,\n\t},\n}\n\nexport function PluginFromURLModal({ environment, onSelectPlugin }: Props) {\n\tconst [url, setUrl] = useState(environment === \"development\" ? defaultDevelopmentUrl : \"\")\n\tconst inputRef = useRef<HTMLInputElement | null>(null)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tconst validatedURL = validateCustomCanonicalURL(url)\n\tlet isValidURL = validatedURL.result === \"ok\"\n\n\t// When opening a URL for development we validate that it is a localhost\n\t// URL. This is so we don't have people abusing this feature for Team\n\t// Plugins which we want to sell instead of giving away for free. Employees\n\t// are allowed to do this for easier testing.\n\tif (environment === \"development\" && validatedURL.result === \"ok\" && !engine.stores.chromeStore.userIsEmployee) {\n\t\tisValidURL = isPluginDevelopmentUrl(validatedURL.normalizedValue)\n\t}\n\n\tuseEffect(() => {\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.focus()\n\t\t\tinputRef.current.select()\n\t\t}\n\t}, [])\n\n\tfunction handleSubmit() {\n\t\tassert(validatedURL.result === \"ok\")\n\n\t\tvoid engine.stores.pluginStore\n\t\t\t.loadManifestFromUrl(validatedURL.normalizedValue)\n\t\t\t.then(onSelectPlugin)\n\t\t\t.catch(error => {\n\t\t\t\tshowPluginUrlFailedToast(validatedURL.normalizedValue, error)\n\t\t\t})\n\n\t\tengine.stores.modalStore.dismiss()\n\t}\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tvisible\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tclassName={modalStyles.container}\n\t\t\tonConfirm={handleSubmit}\n\t\t\tzIndex={ZIndex.modalWithoutPopovers}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header>{content[environment].title}</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tplaceholder={content[environment].placeholder}\n\t\t\t\t\t\tonChange={setUrl}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t/>\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Modal.Text>{content[environment].body}</Modal.Text>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton>Cancel</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton enabled={isValidURL}>Open</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { Button, Scroll, Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { PopoutButton } from \"document/components/chrome/shared/PopoutButton.tsx\"\nimport { TableSearchBar } from \"document/components/chrome/shared/TableSearchBar.tsx\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useMemo, useState } from \"react\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { PluginIcon } from \"./PluginIcon.tsx\"\nimport * as styles from \"./PluginPicker.styles.ts\"\nimport { PluginRow } from \"./PluginRow.tsx\"\nimport fallbackIcon from \"./icons/FallbackPlugin.png\"\nimport type { VekterPluginManifest } from \"./plugins.ts\"\nimport { getPluginIcon } from \"./plugins.ts\"\nimport { showUnsupportedModesToast } from \"./toast.ts\"\nimport {\n\tnormalizePluginSearchTerms,\n\tpluginMatchesSearchTerms,\n\tuseEligiblePluginManifests,\n} from \"./useEligiblePluginManifests.ts\"\nimport { getDefaultDevelopmentPluginManifest } from \"./utils/getDefaultDevelopmentPluginManifest.ts\"\n\nexport type NonCanvasPluginMode = Exclude<Mode, \"canvas\">\n\ninterface PluginPickerProps {\n\tmodes: NonCanvasPluginMode[]\n\tonSelect: (pluginManifest: VekterPluginManifest, mode: NonCanvasPluginMode) => void\n}\n\nexport function PluginPicker({ modes, onSelect }: PluginPickerProps) {\n\tconst [searchValue, setSearchValue] = useState(\"\")\n\tconst normalizedSearchTerms = useMemo(() => normalizePluginSearchTerms(searchValue), [searchValue])\n\n\tconst displayPluginDeveloperTools = useDeprecatedEngineState(\n\t\tEngineChange.UserDefaultsStore,\n\t\t() => engine.stores.persistedUserDefaults.displayPluginDeveloperTools,\n\t)\n\n\tconst activePlugin = engine.stores.pluginStore.useState(store => {\n\t\tif (!store.activePlugin?.isHostedPlugin()) return null\n\t\tif (store.activePlugin.modeHandlers.mode === \"canvas\") return null\n\n\t\treturn {\n\t\t\tmanifestId: store.activePlugin.manifestId,\n\t\t\turl: store.activePlugin.manifest.entrypointUrl,\n\t\t}\n\t})\n\n\tconst eligibleManifests = useEligiblePluginManifests(modes)\n\n\tconst filteredPlugins = useMemo(() => {\n\t\tif (normalizedSearchTerms.length === 0) return eligibleManifests\n\t\treturn eligibleManifests.filter(manifest => pluginMatchesSearchTerms(manifest, normalizedSearchTerms))\n\t}, [eligibleManifests, normalizedSearchTerms])\n\n\tfunction handleSelectPlugin(manifest: VekterPluginManifest) {\n\t\tconst { modes: pluginModes } = manifest\n\t\tassert(pluginModes)\n\t\tconst mode = modes.find(mode => pluginModes.includes(mode))\n\n\t\tif (!mode) {\n\t\t\tshowUnsupportedModesToast(modes)\n\t\t\treturn\n\t\t}\n\n\t\tonSelect(manifest, mode)\n\t}\n\n\tfunction handleSelectDevelopmentPlugin() {\n\t\tgetDefaultDevelopmentPluginManifest(engine, \"image_picker\", handleSelectPlugin)\n\t}\n\n\treturn (\n\t\t<Stack direction=\"column\" gap={0} className={styles.container}>\n\t\t\t<TableSearchBar enabled value={searchValue} onChange={setSearchValue} placeholder=\"Search\u2026\" />\n\n\t\t\t<Scroll className={styles.pluginContent}>\n\t\t\t\t<Stack direction=\"column\" gap={0} padding={`calc(${dimensions.css.panelPadding} / 2)`}>\n\t\t\t\t\t{displayPluginDeveloperTools && (\n\t\t\t\t\t\t<PluginRow\n\t\t\t\t\t\t\tvariant=\"withinPopout\"\n\t\t\t\t\t\t\ticon={<PluginIcon src={fallbackIcon} />}\n\t\t\t\t\t\t\tlabel=\"Open Development Plugin\"\n\t\t\t\t\t\t\tselected={false}\n\t\t\t\t\t\t\tonClick={handleSelectDevelopmentPlugin}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{filteredPlugins.map(pluginManifest => (\n\t\t\t\t\t\t<PluginRow\n\t\t\t\t\t\t\tkey={pluginManifest.id}\n\t\t\t\t\t\t\tvariant=\"withinPopout\"\n\t\t\t\t\t\t\ticon={<PluginIcon src={getPluginIcon(pluginManifest)} />}\n\t\t\t\t\t\t\tlabel={pluginManifest.name}\n\t\t\t\t\t\t\tselected={activePlugin?.manifestId === pluginManifest.id}\n\t\t\t\t\t\t\tonClick={() => handleSelectPlugin(pluginManifest)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t\t</Scroll>\n\t\t\t{displayPluginDeveloperTools && (\n\t\t\t\t<Stack padding={dimensions.css.panelPadding}>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.PluginFromURL,\n\t\t\t\t\t\t\t\tsource: \"properties\",\n\t\t\t\t\t\t\t\tenvironment: \"default\",\n\t\t\t\t\t\t\t\tonSelectPlugin: handleSelectPlugin,\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\tOpen Plugin URL\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\ninterface PluginPickerPopoutButtonProps extends PluginPickerProps {\n\tclassName?: string\n}\n\nexport function PluginPickerPopoutButton({ className, ...props }: PluginPickerPopoutButtonProps) {\n\tconst isReadOnly = useReadOnly()\n\n\treturn (\n\t\t<PopoutButton\n\t\t\tuseFrescoButton\n\t\t\tdisplayDivider\n\t\t\ttitle={Dictionary.Plugins}\n\t\t\tenabled={!isReadOnly}\n\t\t\tclassName={className}\n\t\t\tnavigationTitle={Dictionary.Plugins}\n\t\t\tpopout={<PluginPicker {...props} />}\n\t\t/>\n\t)\n}\n", "import \"PluginPicker.styles_1t1tro3.wyw.css\"; export const container = \"container_c1m5obzh\";\nexport const pluginContent = \"pluginContent_p1pcc42h\";", "import \"PluginRow.styles_8qgv8i.wyw.css\"; export const row = \"row_r1o0gcbd\";\nexport const sidebarRow = \"sidebarRow_s7bl2k2\";\nexport const selectedRow = \"selectedRow_s106ymwh\";\nexport const sidebarSelectedRow = \"sidebarSelectedRow_s1s5abwz\";\nexport const iconWrapper = \"iconWrapper_i2vksm\";\nexport const sidebarIconWrapper = \"sidebarIconWrapper_sxr9vp8\";\nexport const title = \"title_tvvxm45\";\nexport const sidebarTitle = \"sidebarTitle_s1xthyr5\";\nexport const sidebarSelectedTitle = \"sidebarSelectedTitle_s15wze92\";", "import { Button, CenterChild, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type { ReactNode } from \"react\"\nimport * as styles from \"./PluginRow.styles.ts\"\n\ninterface PluginRowProps {\n\ticon: ReactNode\n\tlabel: string\n\tselected: boolean\n\tonClick: () => void\n\tvariant: \"withinPopout\" | \"withinSidebar\"\n}\n\nexport function PluginRow({ icon, label, selected, onClick, variant }: PluginRowProps) {\n\tconst isWithinSidebar = variant === \"withinSidebar\"\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"clean\"\n\t\t\tclassName={cx(\n\t\t\t\tstyles.row,\n\t\t\t\tisWithinSidebar && styles.sidebarRow,\n\t\t\t\tselected && styles.selectedRow,\n\t\t\t\tselected && isWithinSidebar && styles.sidebarSelectedRow,\n\t\t\t)}\n\t\t\tonClick={onClick}\n\t\t>\n\t\t\t<CenterChild className={cx(styles.iconWrapper, isWithinSidebar && styles.sidebarIconWrapper)}>{icon}</CenterChild>\n\t\t\t<span\n\t\t\t\tclassName={cx(\n\t\t\t\t\ttruncateWithEllipsis,\n\t\t\t\t\tstyles.title,\n\t\t\t\t\tisWithinSidebar && styles.sidebarTitle,\n\t\t\t\t\tselected && isWithinSidebar && styles.sidebarSelectedTitle,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{label}\n\t\t\t</span>\n\t\t</Button>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport { useMemo } from \"react\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { isExternalPluginIdOfPublishedPlugin, isLocalDevelopmentPluginManifestId } from \"./pluginManifestValidation.ts\"\nimport type { HostedPluginManifest } from \"./plugins.ts\"\nimport { isApiPluginManifest } from \"./plugins.ts\"\n\n/**\n * Returns the plugin manifests that should be visible in plugin pickers, filtered to those that\n * support at least one of the given modes. Excludes API plugins, local-development plugins, and\n * external plugins that are shadowed by a published version. Order matches `pluginStore.sortedManifests`\n * (recents first, then alphabetical).\n */\nexport function useEligiblePluginManifests(modes: readonly Mode[]): readonly HostedPluginManifest[] {\n\tconst { pluginStore } = engine.stores\n\tconst { sortedManifests, publishedPluginManifests } = pluginStore.useState(state => ({\n\t\tsortedManifests: state.sortedManifests,\n\t\tpublishedPluginManifests: state.publishedPluginManifests,\n\t}))\n\n\treturn useMemo(() => {\n\t\tconst result: HostedPluginManifest[] = []\n\t\tfor (const manifest of sortedManifests) {\n\t\t\tif (isApiPluginManifest(manifest)) continue\n\t\t\tif (isLocalDevelopmentPluginManifestId(manifest.id)) continue\n\t\t\tif (isExternalPluginIdOfPublishedPlugin(manifest.id, publishedPluginManifests)) continue\n\t\t\tif (!modes.some(mode => manifest.modes.includes(mode))) continue\n\t\t\tresult.push(manifest)\n\t\t}\n\t\treturn result\n\t}, [sortedManifests, publishedPluginManifests, modes])\n}\n\n/** Splits a free-form search input into normalized lowercase tokens. */\nexport function normalizePluginSearchTerms(searchValue: string): readonly string[] {\n\treturn searchValue.toLowerCase().trim().split(\" \").filter(Boolean)\n}\n\n/** Returns true if the manifest's name or aliases match every normalized search term. */\nexport function pluginMatchesSearchTerms(\n\tmanifest: HostedPluginManifest,\n\tnormalizedSearchTerms: readonly string[],\n): boolean {\n\tif (normalizedSearchTerms.length === 0) return true\n\tconst lowerName = manifest.name.toLowerCase()\n\treturn normalizedSearchTerms.every(term => {\n\t\tif (lowerName.includes(term)) return true\n\t\tif (!manifest.aliases) return false\n\t\treturn manifest.aliases.some(alias => alias.toLowerCase().includes(term))\n\t})\n}\n", "import \"PluginWithModePickerModal.styles_18wg7d1.wyw.css\"; export const modal = \"modal_mj1kxfj\";\nexport const bottomSeparator = \"bottomSeparator_b1ey6lsg\";", "import { Modal, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { PluginPicker } from \"./PluginPicker.tsx\"\nimport * as styles from \"./PluginWithModePickerModal.styles.ts\"\n\nexport function PluginWithModePickerModal({ modes, onSelect }: ModalProps<ModalType.PluginWithModePicker>) {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\treturn (\n\t\t<Modal.Root visible onDismiss={engine.stores.modalStore.dismiss} className={styles.modal} {...modalThemeProps}>\n\t\t\t<Stack\n\t\t\t\tpaddingLeft={dimensions.css.modalPadding}\n\t\t\t\tpaddingRight={dimensions.css.modalPadding}\n\t\t\t\tclassName={styles.bottomSeparator}\n\t\t\t>\n\t\t\t\t<Modal.Header closeButton>Import via Plugin</Modal.Header>\n\t\t\t</Stack>\n\t\t\t<PluginPicker modes={modes} onSelect={onSelect} />\n\t\t</Modal.Root>\n\t)\n}\n", "import { FocusTrapOverride, ModalVisibilityContext, ModalZIndexContext } from \"@framerjs/fresco\"\nimport { DeleteCodeFileModal } from \"code-editor/DeleteCodeFileModal.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { CreateManagedCollectionModal } from \"plugins/CreateManagedCollectionModal.tsx\"\nimport { PluginFromURLModal } from \"plugins/PluginFromURLModal.tsx\"\nimport { PluginWithModePickerModal } from \"plugins/PluginWithModePickerModal.tsx\"\nimport React from \"react\"\nimport { TemplatesModal } from \"web/pages/project/components/TemplatesModal/TemplatesModal.tsx\"\nimport { TransferProjectModal } from \"web/pages/project/components/TransferProjectModal.tsx\"\nimport { KitRemixModal } from \"../../../web/pages/project/components/KitRemixModal/KitRemixModal.tsx\"\nimport { QuickActionsModal } from \"./QuickActions/QuickActionsModal.tsx\"\nimport { CreateAbTestModal } from \"./analytics/modals/CreateAbTestModal.tsx\"\nimport { StopAbTestModal } from \"./analytics/modals/StopAbTestModal.tsx\"\nimport { ShortcutsModal } from \"./cheatsheet/ShortcutsModal.tsx\"\nimport { CodeFileCreationModal } from \"./codePanel/CodeFileCreationModal.tsx\"\nimport { ConfirmDestructiveFeedbackActionModal } from \"./feedback/ConfirmDestructiveFeedbackActionModal.tsx\"\nimport { FigmaImportModal } from \"./figma/FigmaImportModal.tsx\"\nimport { FigmaImportTutorialModal } from \"./figma/FigmaImportTutorialModal.tsx\"\nimport { getZIndexForModal } from \"./isModalInFrontOfPopover.ts\"\nimport { LocaleReadyModal } from \"./localization/LocaleReadyModal.tsx\"\nimport { LocalizationGlossaryModal } from \"./localization/LocalizationGlossaryModal.tsx\"\nimport { NudgePreferencesModal } from \"./nudgePreferences/NudgePreferencesModal.tsx\"\nimport { AddToLibraryModal } from \"./shared/AddToLibraryModal.tsx\"\nimport { BatchTranslateModal } from \"./shared/BatchTranslateModal.tsx\"\nimport { BuyAiCreditsModal } from \"./shared/BuyAiCredits/BuyAiCreditsModal.tsx\"\nimport { ComponentCreationModal } from \"./shared/ComponentCreationModal.tsx\"\nimport {\n\tConfirmBatchTranslateAllModal,\n\tConfirmBatchTranslateLayersModal,\n} from \"./shared/ConfirmBatchTranslateAllModal.tsx\"\nimport { ConfirmDefaultLanguageModal } from \"./shared/ConfirmDefaultLanguageModal.tsx\"\nimport { ConfirmModal } from \"./shared/ConfirmModal.tsx\"\nimport { ConvertToCMSPageModal } from \"./shared/ConvertToCMSPageModal.tsx\"\nimport { ConvertToKitPageModal } from \"./shared/ConvertToKitPageModal.tsx\"\nimport { CreateLayoutTemplateModal } from \"./shared/CreateLayoutTemplateModal.tsx\"\nimport { CustomBreakpointModal } from \"./shared/CustomBreakpointModal.tsx\"\nimport { DarkOnDarkThemeOverride } from \"./shared/DarkOnDarkThemeOverride.tsx\"\nimport { DeleteEntityFolderModal } from \"./shared/DeleteEntityFolderModal.tsx\"\nimport { DeleteFileModal } from \"./shared/DeleteFileModal.tsx\"\nimport { DeleteMultipleCodeFilesModal } from \"./shared/DeleteMultipleCodeFilesModal.tsx\"\nimport { DeleteMultipleEntityFoldersModal } from \"./shared/DeleteMultipleEntityFoldersModal.tsx\"\nimport { DuplicateProjectWithVersionModal } from \"./shared/DuplicateProjectWithVersionModal.tsx\"\nimport { DuplicateWebPageModal } from \"./shared/DuplicateWebPageModal.tsx\"\nimport { EditVectorModal } from \"./shared/EditVectorModal.tsx\"\nimport { DeleteCustomFontModal } from \"./shared/FontPopout/DeleteCustomFontModal.tsx\"\nimport { ImageCropModal } from \"./shared/ImageCropModal.tsx\"\nimport { ImageFocalPointModal } from \"./shared/ImageFocalPointModal.tsx\"\nimport { LayoutTemplateFlowEffectRegenerationModal } from \"./shared/LayoutTemplateFlowEffectRegenerationModal.tsx\"\nimport { LoadingFullDocumentModal } from \"./shared/LoadingFullDocumentModal.tsx\"\nimport { LocaleSettingsModal } from \"./shared/LocaleSettingsModal.tsx\"\nimport { ModulePublishingModal } from \"./shared/ModulePublishingModal/ModulePublishingModal.tsx\"\nimport { RedirectsImportModal } from \"./shared/RedirectsImportModal.tsx\"\nimport { RemoveFromLibraryModal } from \"./shared/RemoveFromLibraryModal.tsx\"\nimport { ReplaceTextStylePresetModal } from \"./shared/ReplaceTextStylePresetModal.tsx\"\nimport { ReplaceWebPageModal } from \"./shared/ReplaceWebPageModal.tsx\"\nimport { RequestControlModal } from \"./shared/RequestControlModal.tsx\"\nimport { SubscriptionNotInOrderModal } from \"./shared/SubscriptionNotInOrder/SubscriptionNotInOrderModal.tsx\"\nimport { UnlinkComponentModal } from \"./shared/UnlinkComponentModal.tsx\"\nimport { UnsavedChangesModal } from \"./shared/UnsavedChangesModal.tsx\"\nimport { UpgradeDocumentModal } from \"./shared/UpgradeDocumentModal.tsx\"\nimport { UpsellEnterpriseModal } from \"./shared/UpsellModal/UpsellEnterpriseModal.tsx\"\nimport { VariablesModal } from \"./shared/VariablesModal/VariablesModal.tsx\"\nimport { VectorImportModal } from \"./shared/VectorImportModal.tsx\"\nimport { VectorSetCreationModal } from \"./shared/VectorSetCreationModal.tsx\"\nimport { VectorSetUnlinkModal } from \"./shared/VectorSetUnlinkModal.tsx\"\nimport { EditCustomCodeModal } from \"./siteSettings/CustomCode/EditCustomCodeModal.tsx\"\nimport { ViewCustomCodeModal } from \"./siteSettings/CustomCode/ViewCustomCodeModal.tsx\"\nimport { AcquireAddOnModal } from \"./siteSettings/Plans/Stripe/addOns/AcquireAddOnModal.tsx\"\nimport { ConfirmAcquireAddOnModal } from \"./siteSettings/Plans/Stripe/addOns/ConfirmAcquireAddOnModal.tsx\"\nimport { UpsellFeatureModal } from \"./siteSettings/Plans/Stripe/components/UpsellFeatureModal.tsx\"\nimport { PlanCancellationModal } from \"./siteSettings/Plans/Stripe/modals/PlanCancellationModal.tsx\"\nimport {\n\tOverrideFileModal,\n\tUnsupportedFileSizeModal,\n\tUnsupportedFileTypeModal,\n} from \"./siteSettings/Project/FileModals.tsx\"\n\ntype ModalMap = { [K in ModalType]: ((props: ModalProps<K>) => JSX.Element | null) | null }\n\n// \uD83D\uDD34 Please keep alphabetically sorted!\nconst modals: ModalMap = {\n\t[ModalType.AcquireAddonModal]: AcquireAddOnModal,\n\t[ModalType.AddToLibrary]: AddToLibraryModal,\n\t[ModalType.BatchTranslate]: BatchTranslateModal,\n\t[ModalType.BuyAiCreditsModal]: BuyAiCreditsModal,\n\t[ModalType.CodeFileCreation]: CodeFileCreationModal,\n\t[ModalType.ConfirmAcquireAddOn]: ConfirmAcquireAddOnModal,\n\t[ModalType.Confirmation]: ConfirmModal,\n\t[ModalType.ConfirmationPlugin]: ConfirmModal,\n\t[ModalType.ConfirmBatchTranslateAll]: ConfirmBatchTranslateAllModal,\n\t[ModalType.ConfirmBatchTranslateLayers]: ConfirmBatchTranslateLayersModal,\n\t[ModalType.ConfirmDefaultLanguage]: ConfirmDefaultLanguageModal,\n\t[ModalType.ConfirmDeleteCollectionItems]: ConfirmModal,\n\t[ModalType.ConfirmDeleteCustomCode]: ConfirmModal,\n\t[ModalType.ConfirmDestructiveFeedbackAction]: ConfirmDestructiveFeedbackActionModal,\n\t[ModalType.ConfirmCollectionItemStatusChange]: ConfirmModal,\n\t[ModalType.ConfirmDraftLocale]: ConfirmModal,\n\t[ModalType.ConfirmDraftPage]: ConfirmModal,\n\t[ModalType.ConfirmHideAllInThisLocale]: ConfirmModal,\n\t[ModalType.ConfirmPublishAbTest]: ConfirmModal,\n\t[ModalType.ConfirmPublishDraftCollectionItem]: ConfirmModal,\n\t[ModalType.ConfirmPublishDraftLocale]: ConfirmModal,\n\t[ModalType.ConfirmPublishDraftPage]: ConfirmModal,\n\t[ModalType.ConfirmRemoveTriggerEvent]: ConfirmModal,\n\t[ModalType.ConfirmUpdatingAbVariants]: ConfirmModal,\n\t[ModalType.ConvertToCMSPage]: ConvertToCMSPageModal,\n\t[ModalType.ConvertToKitPage]: ConvertToKitPageModal,\n\t[ModalType.CreateAbTest]: CreateAbTestModal,\n\t[ModalType.CreateComponent]: ComponentCreationModal,\n\t[ModalType.CreateLayoutTemplate]: CreateLayoutTemplateModal,\n\t[ModalType.CreateManagedCollection]: CreateManagedCollectionModal,\n\t[ModalType.CustomBreakpoint]: CustomBreakpointModal,\n\t[ModalType.DeleteCodeFile]: DeleteCodeFileModal,\n\t[ModalType.DeleteCustomFont]: DeleteCustomFontModal,\n\t[ModalType.DeleteEntityFolder]: DeleteEntityFolderModal,\n\t[ModalType.DeleteFile]: DeleteFileModal,\n\t[ModalType.DeleteMultipleCodeFiles]: DeleteMultipleCodeFilesModal,\n\t[ModalType.DeleteMultipleEntityFolders]: DeleteMultipleEntityFoldersModal,\n\t[ModalType.DuplicateProjectWithVersion]: DuplicateProjectWithVersionModal,\n\t[ModalType.DuplicateWebPage]: DuplicateWebPageModal,\n\t[ModalType.EditCustomCode]: EditCustomCodeModal,\n\t[ModalType.EditVector]: EditVectorModal,\n\t[ModalType.FigmaImportTutorial]: FigmaImportTutorialModal,\n\t[ModalType.ImageCrop]: ImageCropModal,\n\t[ModalType.ImageFocalPoint]: ImageFocalPointModal,\n\t[ModalType.ImportFigma]: FigmaImportModal,\n\t[ModalType.ImportRedirects]: RedirectsImportModal,\n\t[ModalType.KitRemix]: KitRemixModal,\n\t[ModalType.LayoutTemplateFlowEffectRegeneration]: LayoutTemplateFlowEffectRegenerationModal,\n\t[ModalType.LoadingFullDocument]: LoadingFullDocumentModal,\n\t[ModalType.LocaleReady]: LocaleReadyModal,\n\t[ModalType.LocaleSettings]: LocaleSettingsModal,\n\t[ModalType.LocalizationGlossary]: LocalizationGlossaryModal,\n\t[ModalType.NudgePreferences]: NudgePreferencesModal,\n\t[ModalType.OverrideFile]: OverrideFileModal,\n\t[ModalType.PlanCancellation]: PlanCancellationModal,\n\t[ModalType.PluginFromURL]: PluginFromURLModal,\n\t[ModalType.PluginWithModePicker]: PluginWithModePickerModal,\n\t[ModalType.PublishModule]: ModulePublishingModal,\n\t[ModalType.QuickActions]: QuickActionsModal,\n\t[ModalType.RemoveTeamLibraryModule]: RemoveFromLibraryModal,\n\t[ModalType.ReplaceTextStylePreset]: ReplaceTextStylePresetModal,\n\t[ModalType.ReplaceWebPage]: ReplaceWebPageModal,\n\t[ModalType.RequestControl]: RequestControlModal,\n\t[ModalType.Shortcuts]: ShortcutsModal,\n\t[ModalType.StopAbTest]: StopAbTestModal,\n\t[ModalType.SubscriptionNotInOrder]: SubscriptionNotInOrderModal,\n\t[ModalType.Templates]: TemplatesModal,\n\t[ModalType.TransferProject]: TransferProjectModal,\n\t[ModalType.UnlinkComponent]: UnlinkComponentModal,\n\t[ModalType.UnsavedChanges]: UnsavedChangesModal,\n\t[ModalType.UnsupportedFileSize]: UnsupportedFileSizeModal,\n\t[ModalType.UnsupportedFileType]: UnsupportedFileTypeModal,\n\t[ModalType.UpgradeDocument]: UpgradeDocumentModal,\n\t[ModalType.UpsellEnterprise]: UpsellEnterpriseModal,\n\t[ModalType.UpsellFeature]: UpsellFeatureModal,\n\t[ModalType.Variables]: VariablesModal,\n\t[ModalType.VectorImport]: VectorImportModal,\n\t[ModalType.VectorSetCreation]: VectorSetCreationModal,\n\t[ModalType.VectorSetUnlink]: VectorSetUnlinkModal,\n\t[ModalType.ViewCustomCode]: ViewCustomCodeModal,\n\t// On page editor modals.\n\t[ModalType.OnPageCMSFieldsModal]: null,\n\t[ModalType.OnPageRichTextEditor]: null,\n\t[ModalType.OnPageRichTextVariantOverride]: null,\n\t// Handled elsewhere.\n\t[ModalType.ApplyPromotionCode]: null,\n\t[ModalType.CompleteSignup]: null,\n\t[ModalType.CreateTeam]: null,\n\t[ModalType.DashboardAcquireAddonModal]: null,\n\t[ModalType.DashboardAddFile]: null,\n\t[ModalType.DashboardAddHeader]: null,\n\t[ModalType.DashboardAddRedirect]: null,\n\t[ModalType.DashboardAddRewrite]: null,\n\t[ModalType.DashboardEditFile]: null,\n\t[ModalType.DashboardEditHeader]: null,\n\t[ModalType.DashboardEditRedirect]: null,\n\t[ModalType.DashboardEditRewrite]: null,\n\t[ModalType.DashboardRequestProjectAccess]: null,\n\t[ModalType.DashboardUnsupportedFileType]: null,\n\t[ModalType.DeprecatedDrafts]: null,\n\t[ModalType.FlexToYearly]: null,\n\t[ModalType.SwitchToYearly]: null,\n\t[ModalType.ManageSeats]: null,\n\t[ModalType.MigrateBilling]: null,\n\t[ModalType.SelectProjectToUpgrade]: null,\n\t[ModalType.Welcome]: null,\n\n\t[ModalType.None]: null,\n}\n\nexport const Modals = React.memo(function Modals() {\n\tconst { stack } = engine.stores.modalStore.useState()\n\tconst isDocumentLoaded = engine.stores.loadingStore.useState(state => state.isDocumentLoaded)\n\tconst hasPluginModalInFront = engine.stores.pluginStore.useState(({ activePlugin }) => {\n\t\tif (!activePlugin) return false\n\t\treturn activePlugin.modeHandlers.mode !== \"canvas\"\n\t})\n\n\tif (!isDocumentLoaded) return null\n\n\treturn (\n\t\t<DarkOnDarkThemeOverride>\n\t\t\t{stack.map((modal, index) => {\n\t\t\t\tconst { type, ...props } = modal\n\n\t\t\t\tconst ModalComponent = modals[type]\n\t\t\t\tif (!ModalComponent) return null\n\n\t\t\t\tconst isFrontMostModal = index === stack.length - 1\n\t\t\t\tconst key = modal.type + index\n\n\t\t\t\treturn (\n\t\t\t\t\t<FocusTrapOverride key={key} allowFocusTrap={isFrontMostModal && !hasPluginModalInFront}>\n\t\t\t\t\t\t<ModalZIndexContext.Provider value={getZIndexForModal(type)}>\n\t\t\t\t\t\t\t<ModalVisibilityContext.Provider value={isFrontMostModal ? \"visible\" : \"hidden\"}>\n\t\t\t\t\t\t\t\t<ModalComponent {...(props as any)} />\n\t\t\t\t\t\t\t</ModalVisibilityContext.Provider>\n\t\t\t\t\t\t</ModalZIndexContext.Provider>\n\t\t\t\t\t</FocusTrapOverride>\n\t\t\t\t)\n\t\t\t})}\n\t\t</DarkOnDarkThemeOverride>\n\t)\n})\n", "import { CustomModal, Link, Modal, Spinner, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { getNewProjectURL } from \"@framerjs/shared/src/projectURL.ts\"\nimport { cx } from \"@linaria/core\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport { isEmptyWebPage } from \"document/firstScopeFinder.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { startTransition, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { updateProject } from \"web/lib/ProjectAPI.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { PreviewButton } from \"./PreviewButton.tsx\"\nimport * as styles from \"./TemplatesModal.styles.ts\"\nimport { type TemplateCategory, templateCategories, templates } from \"./templates.ts\"\n\n// For more context:\n// Criteria for how to determine if a project is new was discussed here:\n// https://framer-team.slack.com/archives/C3L0MQQ6L/p1761073623462409\nconst getIsNewDocument = async (): Promise<boolean> => {\n\tconst webpages = engine.stores.scopeStore.getWebPageNodes()\n\t// If there are multiple webpages, it's not a new document\n\tif (webpages.length > 1) {\n\t\treturn Promise.resolve(false)\n\t}\n\n\t// If there is one webpage and it's not empty, it's not a new document\n\tif (webpages.length === 1 && webpages[0] && !isEmptyWebPage(webpages[0])) {\n\t\treturn Promise.resolve(false)\n\t}\n\n\t// If there are 0 webpages, but there's at least one design page, it's not a new document\n\tconst designPages = engine.stores.scopeStore.getDesignPageNodes()\n\tif (designPages.length >= 1) {\n\t\treturn Promise.resolve(false)\n\t}\n\n\t// If there are 0 webpages and 0 design pages, check cms collections\n\tconst contentManagement = await getContentManagementNode(engine.stores.treeStore.tree)?.load()\n\t// If there is no content management node, it's a new document\n\tif (!contentManagement) return Promise.resolve(true)\n\n\t// If there are no cms collections, it's a new document\n\tif (contentManagement.children.length === 0) {\n\t\treturn Promise.resolve(true)\n\t}\n\t// If there are cms collections, it's not a new document\n\treturn Promise.resolve(false)\n}\n\nfunction toKebabCase(text: string) {\n\treturn text.toLowerCase().split(\" \").join(\"-\")\n}\n\nexport function TemplatesModal() {\n\tconst { user } = engine.stores.sessionStore.useState()\n\tconst { project, projectId } = engine.stores.projectStore.useState()\n\tconst currentSpace = useMemo(\n\t\t() => user.spaces.find(space => space.id === project?.space.id),\n\t\t[project?.space.id, user.spaces],\n\t)\n\n\treturn <TemplatesModalInner currentSpaceId={currentSpace?.id} projectId={projectId} />\n}\n\ninterface TempaltesModalInnerProps {\n\tcurrentSpaceId: string | undefined\n\tprojectId: string\n}\nfunction TemplatesModalInner({ currentSpaceId, projectId }: TempaltesModalInnerProps) {\n\tconst [loading, setLoading] = useState<string | undefined>()\n\tconst [activeCategory, setActiveCategory] = useState<TemplateCategory>(\"Portfolio\")\n\tconst scrollContainerRef = useRef<HTMLDivElement>(null)\n\tconst sectionRefs = useRef<Map<TemplateCategory, HTMLDivElement>>(new Map())\n\tconst activeCategoryRef = useRef<TemplateCategory>(activeCategory)\n\tconst isScrollingProgrammatically = useRef(false)\n\tconst scrollAbortControllerRef = useRef<AbortController | null>(null)\n\n\tuseEffect(() => {\n\t\trecord(\"ui_impression\", { page: Pages.templateModal })\n\t}, [])\n\n\tconst onSelectTemplate = useCallback(\n\t\tasync (remixLink: string, templateTitle: string) => {\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: Pages.templateModal,\n\t\t\t\tid: `${UIInteraction.selectTemplate}-${toKebabCase(templateTitle)}`,\n\t\t\t})\n\t\t\tsetLoading(remixLink)\n\t\t\tconst isNewDocument = await getIsNewDocument()\n\t\t\tif (isNewDocument) {\n\t\t\t\t// Only archive new documents when picking a template\n\t\t\t\tawait updateProject(projectId, { archived: true })\n\t\t\t}\n\t\t\twindow.location.href = remixLink\n\t\t},\n\t\t[projectId],\n\t)\n\n\tconst scrollToCategory = useCallback((category: TemplateCategory) => {\n\t\t// Abort any ongoing scroll operation\n\t\tif (scrollAbortControllerRef.current) {\n\t\t\tscrollAbortControllerRef.current.abort()\n\t\t}\n\n\t\t// Create new AbortController for this scroll operation\n\t\tconst abortController = new AbortController()\n\t\tscrollAbortControllerRef.current = abortController\n\n\t\tconst sectionElement = sectionRefs.current.get(category)\n\t\tif (sectionElement && scrollContainerRef.current) {\n\t\t\tconst containerRect = scrollContainerRef.current.getBoundingClientRect()\n\t\t\tconst sectionRect = sectionElement.getBoundingClientRect()\n\t\t\tconst scrollOffset = sectionRect.top - containerRect.top + scrollContainerRef.current.scrollTop - 15\n\n\t\t\tscrollContainerRef.current.scrollTo({\n\t\t\t\ttop: scrollOffset,\n\t\t\t\tbehavior: \"instant\",\n\t\t\t})\n\n\t\t\tsetTimeout(() => {\n\t\t\t\t// Only reset if this scroll operation hasn't been aborted\n\t\t\t\tif (!abortController.signal.aborted) {\n\t\t\t\t\tisScrollingProgrammatically.current = false\n\t\t\t\t\tscrollAbortControllerRef.current = null\n\t\t\t\t}\n\t\t\t}, 1200) // This the exact time it takes to scroll from the top category to the last one. If you're adding more, update this number.\n\t\t}\n\t}, [])\n\n\tconst handleCategoryClick = useCallback(\n\t\t(category: TemplateCategory) => {\n\t\t\tisScrollingProgrammatically.current = true\n\n\t\t\tactiveCategoryRef.current = category\n\t\t\tstartTransition(() => {\n\t\t\t\tsetActiveCategory(category)\n\t\t\t})\n\t\t\tscrollToCategory(category)\n\t\t},\n\t\t[scrollToCategory],\n\t)\n\n\t// Scroll spy: detect which section is visible\n\tuseEffect(() => {\n\t\tconst scrollContainer = scrollContainerRef.current\n\t\tif (!scrollContainer) return\n\n\t\tconst handleScroll = () => {\n\t\t\t// Ignore scroll events during programmatic scrolling\n\t\t\tif (isScrollingProgrammatically.current) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst containerRect = scrollContainer.getBoundingClientRect()\n\t\t\tlet currentCategory: TemplateCategory | null = null\n\n\t\t\t// Find which section is currently most visible\n\t\t\tfor (const [category, element] of sectionRefs.current.entries()) {\n\t\t\t\tconst elementRect = element.getBoundingClientRect()\n\t\t\t\tconst relativeTop = elementRect.top - containerRect.top\n\n\t\t\t\t// If this section is above or near the top of the viewport\n\t\t\t\tif (relativeTop <= 100) {\n\t\t\t\t\tcurrentCategory = category\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Only update if we found a category and it's different from current\n\t\t\tif (currentCategory && currentCategory !== activeCategoryRef.current) {\n\t\t\t\tactiveCategoryRef.current = currentCategory\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tsetActiveCategory(currentCategory)\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tscrollContainer.addEventListener(\"scroll\", handleScroll, { passive: true })\n\t\treturn () => {\n\t\t\tscrollContainer.removeEventListener(\"scroll\", handleScroll)\n\t\t}\n\t}, [])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\treturn (\n\t\t<CustomModal\n\t\t\tvisible\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tclassName={styles.modal}\n\t\t\thasBackdrop\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header closeButton className={styles.header} onDismiss={engine.stores.modalStore.dismiss}>\n\t\t\t\tPick a Template\n\t\t\t</Modal.Header>\n\n\t\t\t<Stack direction=\"row\" gap={0}>\n\t\t\t\t<Stack direction=\"column\" padding={dimensions.css.modalPadding} gap={5} className={styles.sidebar}>\n\t\t\t\t\t{templateCategories.map(category => (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tdisabled={!!loading}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tkey={category}\n\t\t\t\t\t\t\tclassName={cx(styles.category, activeCategory === category && styles.activeCategory)}\n\t\t\t\t\t\t\tonClick={() => handleCategoryClick(category)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{category}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t\t<Link\n\t\t\t\t\t\tclassName={styles.marketplaceLink}\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\thref=\"https://www.framer.com/marketplace/templates\"\n\t\t\t\t\t>\n\t\t\t\t\t\tAll Templates\n\t\t\t\t\t</Link>\n\t\t\t\t</Stack>\n\t\t\t\t<Stack\n\t\t\t\t\tpadding={dimensions.css.modalPadding}\n\t\t\t\t\tclassName={styles.templatesList}\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap={30}\n\t\t\t\t\tref={scrollContainerRef}\n\t\t\t\t>\n\t\t\t\t\t<BlankProjectCard loading={!!loading} currentSpaceId={currentSpaceId} />\n\t\t\t\t\t{templates.map((template, index) => {\n\t\t\t\t\t\tconst isFirstInCategory = index === 0 || templates[index - 1]?.category !== template.category\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\tkey={template.remixURL(currentSpaceId)}\n\t\t\t\t\t\t\t\tref={el => {\n\t\t\t\t\t\t\t\t\tif (isFirstInCategory && el) {\n\t\t\t\t\t\t\t\t\t\tsectionRefs.current.set(template.category, el)\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\tdirection=\"column\"\n\t\t\t\t\t\t\t\talignItems=\"flex-start\"\n\t\t\t\t\t\t\t\tclassName={cx(styles.templateCard, loading && styles.disabled)}\n\t\t\t\t\t\t\t\tgap={10}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\tclassName={cx(styles.resetButton, styles.templateImageContainer)}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tonClick={() => onSelectTemplate(template.remixURL(currentSpaceId), template.title)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\t\t\t\t\tsrcSet={`${template.thumbnail}?scale-down-to=306 2x, ${template.thumbnail}?scale-down-to=765 2.5x`}\n\t\t\t\t\t\t\t\t\t\tsrc={`${template.thumbnail}?scale-down-to=153`}\n\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\tclassName={styles.templateImage}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<Stack direction=\"row\" gap={0} justifyContent=\"space-between\" className={styles.textRow}>\n\t\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={0}>\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => onSelectTemplate(template.remixURL(currentSpaceId), template.title)}\n\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.templateTitle, styles.resetButton)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{template.title}\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\thref={`https://www.framer.com/@${template.authorSlug}`}\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.templateCreator}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{template.authorName}\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t<div className={styles.spinnerContainer}>\n\t\t\t\t\t\t\t\t\t\t{loading === template.remixURL(currentSpaceId) && <Spinner />}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t<PreviewButton previewURL={template.previewURL} />\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</CustomModal>\n\t)\n}\n\nfunction BlankProjectCard({ loading, currentSpaceId }: { loading: boolean; currentSpaceId: string | undefined }) {\n\tconst selectBlankProject = useCallback(async () => {\n\t\trecord(\"ui_interaction\", { page: Pages.templateModal, id: UIInteraction.selectBlankProject })\n\t\tconst isNewDocument = await getIsNewDocument()\n\t\tif (isNewDocument) {\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t\treturn\n\t\t} else {\n\t\t\twindow.location.href = getNewProjectURL({ spaceId: currentSpaceId, skipTemplatesModal: true })\n\t\t}\n\t}, [currentSpaceId])\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\talignItems=\"flex-start\"\n\t\t\tclassName={cx(styles.templateCard, loading && styles.disabled)}\n\t\t\tgap={10}\n\t\t>\n\t\t\t<button className={cx(styles.resetButton, styles.blankProjectCard)} type=\"button\" onClick={selectBlankProject}>\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t\t\t<title>Blank Project</title>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 9 1 C 9 0.448 9.448 0 10 0 C 10.552 0 11 0.448 11 1 L 11 9 L 19 9 C 19.552 9 20 9.448 20 10 C 20 10.552 19.552 11 19 11 L 11 11 L 11 19 C 11 19.552 10.552 20 10 20 C 9.448 20 9 19.552 9 19 L 9 11 L 1 11 C 0.448 11 0 10.552 0 10 C 0 9.448 0.448 9 1 9 L 9 9 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t</button>\n\t\t\t<Stack direction=\"row\" gap={0} justifyContent=\"space-between\" className={styles.textRow}>\n\t\t\t\t<Stack direction=\"column\" gap={0}>\n\t\t\t\t\t<div className={styles.templateTitle}>Blank</div>\n\t\t\t\t\t<div className={styles.templateCreator}>Project</div>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { useCallback } from \"react\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./PreviewButton.styles.ts\"\n\ninterface Props {\n\tpreviewURL: string\n}\nexport function PreviewButton({ previewURL }: Props) {\n\tconst onClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.templateModal, id: UIInteraction.previewTemplate })\n\t}, [])\n\n\treturn (\n\t\t<a onClick={onClick} href={previewURL} target=\"_blank\" rel=\"nofollow noreferrer\" className={styles.button}>\n\t\t\t<EyeIcon />\n\t\t</a>\n\t)\n}\n\nfunction EyeIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"9\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>Preview</title>\n\t\t\t<path\n\t\t\t\td=\"M 6.5 0 C 11 0 13 3.5 13 4.5 C 13 5.5 11 9 6.5 9 C 2 9 0 5.5 0 4.5 C 0 3.5 2 0 6.5 0 Z M 4.5 4.5 C 4.5 5.605 5.395 6.5 6.5 6.5 C 7.605 6.5 8.5 5.605 8.5 4.5 C 8.5 3.395 7.605 2.5 6.5 2.5 C 5.395 2.5 4.5 3.395 4.5 4.5 Z\"\n\t\t\t\tfill=\"rgb(255, 255, 255)\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"PreviewButton.styles_1rnc1wk.wyw.css\"; export const previewButtonSize = 20;\nexport const button = \"button_blqmz12\";", "import \"TemplatesModal.styles_vqnn6p.wyw.css\"; export const modal = \"modal_m1pt1w7w\";\nexport const header = \"header_hy0g9oc\";\nexport const sidebar = \"sidebar_s10kx1qt\";\nexport const marketplaceLink = \"marketplaceLink_m1xk7bno\";\nexport const category = \"category_cx0jfay\";\nexport const activeCategory = \"activeCategory_a1u0e5wt\";\nexport const templatesList = \"templatesList_t17melal\";\nexport const templateCard = \"templateCard_t17811g7\";\nexport const resetButton = \"resetButton_r1qk330y\";\nexport const disabled = \"disabled_dh8h9js\";\nexport const templateImageContainer = \"templateImageContainer_t9eyoij\";\nexport const blankProjectCard = \"blankProjectCard_btl8ws6\";\nexport const templateImage = \"templateImage_t1e8cg78\";\nexport const templateTitle = \"templateTitle_t11zwv8r\";\nexport const textRow = \"textRow_t8y9bkz\";\nexport const templateCreator = \"templateCreator_t6mzsw7\";\nexport const spinnerContainer = \"spinnerContainer_s13pt94u\";", "export const templateCategories = [\"Portfolio\", \"Business\", \"Agency\", \"Resume\"] as const\n\nexport type TemplateCategory = (typeof templateCategories)[number]\n\nconst duplicateType = \"canvasTemplateModal\"\ninterface Template {\n\ttitle: string\n\tremixURL: (spaceId: string | undefined) => string\n\tthumbnail: string\n\tauthorName: string\n\tauthorSlug: string\n\tcategory: TemplateCategory\n\tpreviewURL: string\n}\nexport const templates: Template[] = [\n\t// Portfolio\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/GD8inhbe6dHYZGoNOJgNpAIikg.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=Z7D4Y2ypAczRKN1T3YSt&via=rea9nn0&dub_id=O9CnlWCZjEXlm5PM\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Pearl\",\n\t\tauthorName: \"Dawid Pietrasiak\",\n\t\tauthorSlug: \"dawid-pietrasiak\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://pearl.framer.website\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/exZLIcsaelvhmc06S3FnkS5Qbs.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/remix/jIfu4DippRa9riV1tRd5?via=xyf27il&dub_id=COtUxUHOrBR0OJvm\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Cole\",\n\t\tauthorName: \"Muhammed Irshad\",\n\t\tauthorSlug: \"muhammed-irshad\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://derekcole.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/EIp8TnMR8MPTUFzdHvnl94JfBc.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=fIghHErL6y4Qvflp6KLr&via=mvmdlcp&dub_id=8Udj514O5wlzcYtR\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Nitro\",\n\t\tauthorName: \"Easyfast\",\n\t\tauthorSlug: \"stfnco\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://nitro.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/sHulK0HjcsGwMfwygGBon36Rw0.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/projects/new?duplicate=gK77JE89uguwKf2Pk0Dj&via=peterkonti\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Stelvio\",\n\t\tauthorName: \"Peter Konti\",\n\t\tauthorSlug: \"peter-konti\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://stelvio.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/KSZdzvp6sjvE3IL6oL8pitgxSuY.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=1PoOxCKC8dlycAcswbny&via=19kzosh&dub_id=ObwNFNgFKoB3PTz2\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Palmer\",\n\t\tauthorName: \"Westhill Studio\",\n\t\tauthorSlug: \"westhill-studio\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://palmer-template.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/yHrcr4qIs7cH4dzdpeEHQfc0.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=cwvQjB7HUf269LR8CZ9G&via=9ghp8sd&dub_id=t9mqXaVdUfKyWzwR\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Void\",\n\t\tauthorName: \"Widya Bayu\",\n\t\tauthorSlug: \"widya-bayu\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://void.framer.wiki/?via=widya10\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/UuaQoofJ6AKWuZlA9SrFHcgrI.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=e3ctXMbktOIuiLnYkoQ4&via=fmox8bc&dub_id=d1sH7J2Hoih4aAVa\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Outlined\",\n\t\tauthorName: \"Ilia Delin\",\n\t\tauthorSlug: \"iliadelin\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://outlined-template.framer.website\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/0zYHgSMRLDNnKtNMCitLHOd75g.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/projects/new?duplicate=fgI0L5KAa6lPH7Ztc4K0&via=joao\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Akio\",\n\t\tauthorName: \"Joao Alano\",\n\t\tauthorSlug: \"joao-alano\",\n\t\tcategory: \"Portfolio\",\n\t\tpreviewURL: \"https://akiotemplate.framer.website/\",\n\t},\n\t// Business\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/kFgF2u1vwP8GCAh2txy7ZKLnQ0k.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=DvAwlkYT9mAAc9WIP4rQ&via=4qgu2no&dub_id=OFK6lbzbJApqSyhA\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Trinity\",\n\t\tauthorName: \"Sohil\",\n\t\tauthorSlug: \"sohil\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://trinityfinancial.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/ho6wcLF4DD7AbpNo1qW5GFuICw.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=nasE63fRTzwlXz8HQOQr&via=8ypz0ho&dub_id=qNoIyMcHfdXeq5yk\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Wallet\",\n\t\tauthorName: \"Akim\",\n\t\tauthorSlug: \"akim-perminov\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://wallettemplate.framer.website\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/MHtERHXLA2xQWCd9nSIizSC4WgI.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=cd3ncjQdcDIEv1vHxgk1&via=o50imxj&dub_id=s9CN7migBdxgRolY\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Draftr\",\n\t\tauthorName: \"Salim from Webestica\",\n\t\tauthorSlug: \"webestica\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://draftr-wbs.framer.website\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/0oXRvwPIP5ySNMNPsLDremnxjjk.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/remix/unwQew1UQAQLwsbGdbsk?via=eyigwee&dub_id=TGc1XEUD8XHfdh0d\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Dreelio\",\n\t\tauthorName: \"Leonardo Chike\",\n\t\tauthorSlug: \"leonardo-chike\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://dreelio.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/lEDDMg02bKt6HSB9mQThbA3DQb4.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=5ApegM5Tv2YIbYfJ918w&via=yxmmlik&dub_id=jwe8v2dRv2TX0FmR\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Xtract\",\n\t\tauthorName: \"Kanishk Dubey\",\n\t\tauthorSlug: \"kanishk-dubey-6o17f\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://xtract.framer.ai/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/N3aiDrtSqZoashnB4PlMExXK30.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=UibhXrRpXQOYVSLfiniC&via=yxefz4y&dub_id=02msNLJespU5obAy\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Nova App\",\n\t\tauthorName: \"Jae Yi\",\n\t\tauthorSlug: \"jae-yi\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://novaapptemplate.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/Ngszg5QLdKcfFDzC4DtF0dxn1nQ.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=f6gxKAeEhHoj5hkjLzDj&via=vqqs3l4&dub_id=ueVDM4mrNmrKv2BH\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Flowline\",\n\t\tauthorName: \"Mike (PixlJoy)\",\n\t\tauthorSlug: \"pixljoydesign\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://flowline.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/JDyjTtF0JAHCSxWTRpUT8KAST8.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=W9tnG8yKRFGzdrtKddSM&via=brdre42&dub_id=uIQfKY3zkMS3DQZm\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Cryptix\",\n\t\tauthorName: \"Arthur Duchesne\",\n\t\tauthorSlug: \"arthurdch\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://cryptix.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/ewsG8REA5tb1hAeOY4utYXwvY.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=u5huaqKr0LkqiCDJspT2&via=fmvjq17&dub_id=ywmBssp4KO8vtva9\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Meridian\",\n\t\tauthorName: \"Moyin\",\n\t\tauthorSlug: \"moyin\",\n\t\tcategory: \"Business\",\n\t\tpreviewURL: \"https://meridian.framer.ai/\",\n\t},\n\t// Agency\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/TUJSjshvPluFma8sWN2uoVoBO8.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/projects/new?duplicate=I0FQZDLKTJo3620z4nFY&via=gustaveflowbert\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Lando\",\n\t\tauthorName: \"Gustave Flowbert\",\n\t\tauthorSlug: \"gustave-flowbert\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://lando.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/bbfgQFISQHYyGm18Gt5kEAki8.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=aR5uS3pLN5ALjiD0TThA&via=ckf1i9j&dub_id=qiH5tkKrA6Y6ms7d\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Talentify\",\n\t\tauthorName: \"Ramish Aziz\",\n\t\tauthorSlug: \"ramish-aziz\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://talentify.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/ZNwuDSha4MCjSG9cUeAP7xJpaQ.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=RaqjBIgSS8UHSGmfon5x&via=q6tyt1z&dub_id=Uj2PfljBhaIENbcs\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Florent S.\",\n\t\tauthorName: \"Omakase\",\n\t\tauthorSlug: \"omakasedesign\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://oma-florent.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/vvRT2D5WXh7ZdCOwv4zRhdloli4.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=1qaVFUbdzuHfOPomZctt&via=z1h7gsj&dub_id=7ziLkMcHnYHG6kOi\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Portfolite\",\n\t\tauthorName: \"Framebase\",\n\t\tauthorSlug: \"framebase\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://portfolite.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/qpTP6aeSKT6Z41KDhfF7EWTv2M.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/remix/5TNmAdRAeq9LGCZGjZkt?via=1dkmjhb&dub_id=X8ARwNV1q6tDko1W\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Noora\",\n\t\tauthorName: \"Jakke Dea\",\n\t\tauthorSlug: \"jakke-dea\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://noora.framer.media/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/zxc9LO81wINARDvZzBzbhNcPUs.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=NWhYgJZ7zrzOnxvLZKKu&via=aysf1tn&dub_id=qAGcOLcU6fgdx7HF\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Finito\",\n\t\tauthorName: \"Tiago Silva\",\n\t\tauthorSlug: \"tiago-silva\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://finito.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/or96IqGNcPZgsGlKtrZvTsUvHY.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=pdTkFpcRROYKqp5CfjsV&via=r6vzqyg&dub_id=jmVJu3N3gnbV5N81\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Limitless\",\n\t\tauthorName: \"Hamza Ehsan\",\n\t\tauthorSlug: \"hamza-ehsan\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://limitless.framer.photos\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/ertAqiofhCMIgXmF8fWrkMurJW0.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=b3e9TdIS6TBPv1cKiENS&via=sk81okx&dub_id=v4NnYb8lyvhNZXld\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Magnetto\",\n\t\tauthorName: \"Future Things\",\n\t\tauthorSlug: \"future-things\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://magnetto.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/oSiQIJLgpYMAzuCZGrA90acX98.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=e4i2r5AMEPZcntProg2J&via=udvuxoy&dub_id=mpOYfpkfBPFlGoDz\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Pixend\",\n\t\tauthorName: \"EV Studio\",\n\t\tauthorSlug: \"ev-studio\",\n\t\tcategory: \"Agency\",\n\t\tpreviewURL: \"https://pixendagency.framer.website/\",\n\t},\n\t// Resume\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/lRklVwDj3Z5ZXpqQPaHtZqZyH4.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/projects/new?duplicate=7F9DfTGyptNeF2PfhLzS&via=justinmfarrugia\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Core\",\n\t\tauthorName: \"Justin Farrugia\",\n\t\tauthorSlug: \"justinfarrugia\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://core.framer.media/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/ebNbxaWj4fnHgNZjUWCNy2lN94.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\"https://framer.com/remix/rQyg76sMVv3DPWSaULM7?via=nhrg2xx&dub_id=uO7VmRXDhCOOKmuI\")\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Linx\",\n\t\tauthorName: \"C\u00E9dric\",\n\t\tauthorSlug: \"cedric\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://linx.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/880ZlJ7XZpAfz3ftlhPHMrX9Ymk.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=aod62rKLXSc5hUf6ZV7i&via=wc9mme5&dub_id=MBNHhqVeFQhDTzTO\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Mateo\",\n\t\tauthorName: \"Antonio P\u00E9rez\",\n\t\tauthorSlug: \"antonioperez\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://mateo-cv.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/sQuhpbSmDUVZ6Rb2URI0oInKk.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=d07iZliwXGG5CFnlJSgT&via=cpxtzzl&dub_id=SiygXkoc2nT8C6Gm\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"OutlineCV\",\n\t\tauthorName: \"Sasha Mozdir\",\n\t\tauthorSlug: \"sashamozdir\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://outlinecv.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/zIP32PhM19Ys81lN1gsElfmRHTo.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=Wd7boi5i3L7EM3FJPeBj&via=dqaczf7&dub_id=LuppwkE1TPfXLiWB\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Pearce\",\n\t\tauthorName: \"D14\",\n\t\tauthorSlug: \"d14\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://pearce.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/rfx5L5sIP1n9khkMqASmjc9Kmzg.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=IyQstaH56pxStrKrpG1q&via=teoi9or&dub_id=A16Fh1tCpjTxBmPX\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Civio\",\n\t\tauthorName: \"Studio Kismo\",\n\t\tauthorSlug: \"studio-kismo\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://civio-template.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/Y87StYVDubnUdsQbV58vkKWs.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=ZUiASHXjpuXOFECFtfKQ&via=7yo1dla&dub_id=E0dCGiJNnEQZI9eS\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Ryan Sulliva\",\n\t\tauthorName: \"Starterrr\",\n\t\tauthorSlug: \"starterrr\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://ryan-sullivan-template.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/5h75ZeqlNydbIDcweS92o5hSi8.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=5w489Epu8ZaNiDjtE5fL&via=yxwy6pc&dub_id=RXhP5zg2ypBu7gmK\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Resumx\",\n\t\tauthorName: \"Justin Farrugia\",\n\t\tauthorSlug: \"justinfarrugia\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://resumx.framer.website/\",\n\t},\n\t{\n\t\tthumbnail: \"https://framerusercontent.com/images/K31fSAb9OHkaaUiNktRvM7zV8.png\",\n\t\tremixURL: (spaceId: string | undefined) => {\n\t\t\tconst url = new URL(\n\t\t\t\t\"https://framer.com/projects/new?duplicate=fnR1GMdXrQg55KXmMlBm&via=eioszt8&dub_id=zBi03psmVMhVKQaH\",\n\t\t\t)\n\t\t\turl.searchParams.set(\"duplicateType\", duplicateType)\n\t\t\tif (spaceId) {\n\t\t\t\turl.searchParams.set(\"team\", spaceId)\n\t\t\t}\n\t\t\treturn url.href\n\t\t},\n\t\ttitle: \"Ceres\",\n\t\tauthorName: \"Merlin Schr\u00F6ter\",\n\t\tauthorSlug: \"merlin-schroeter\",\n\t\tcategory: \"Resume\",\n\t\tpreviewURL: \"https://jake-smith.framer.website/\",\n\t},\n]\n", "import { ApiError, HTTP_ERROR_CODES, Role, openNewTab } from \"@framerjs/app-shared\"\nimport { Button, CheckBox, InputWrapper, Modal, Stack, T, TextInput } from \"@framerjs/fresco\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useState } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport { isValidEmail } from \"web/lib/isValidEmail.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./TransferProjectModal.styles.ts\"\n\nconst log = getLogger(\"TransferProjectModal\")\n\nconst page = Pages.projectTransferModal\n\nasync function transferProject(projectId: string, recipientEmail: string, role: Role): Promise<void> {\n\tawait apiFetcher.post(`/web/projects/transfer-requests/`, {\n\t\tprojectId,\n\t\trecipientEmail,\n\t\trole,\n\t})\n}\n\nexport function TransferProjectModal({ userEmail }: ModalProps<ModalType.TransferProject>) {\n\tconst [email, setEmail] = useState(\"\")\n\tconst [isTransferring, setIsTransferring] = useState(false)\n\tconst [addAsEditor, setAddAsEditor] = useState(true)\n\n\tuseRecordEffect(\"ui_impression\", { page })\n\n\tconst handleTransfer = async () => {\n\t\tif (!isValidEmail(email)) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\ticon: \"error\",\n\t\t\t\tprimaryText: \"Please enter\",\n\t\t\t\tsecondaryText: \"a valid email address.\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.transferProject })\n\t\tsetIsTransferring(true)\n\t\ttry {\n\t\t\tconst role = addAsEditor ? Role.Collaborator : Role.Viewer\n\t\t\tawait transferProject(engine.stores.projectStore.projectId, email, role)\n\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\ticon: \"success\",\n\t\t\t\tprimaryText: \"Transfer request\",\n\t\t\t\tsecondaryText: \"sent successfully.\",\n\t\t\t})\n\t\t\tengine.stores.modalStore.dismissModal(ModalType.TransferProject)\n\t\t} catch (error) {\n\t\t\tlog.reportError(error)\n\t\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Conflict) {\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\ticon: \"error\",\n\t\t\t\t\tprimaryText: \"Transfer request\",\n\t\t\t\t\tsecondaryText: \"already sent.\",\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\ticon: \"error\",\n\t\t\t\t\tprimaryText: \"Failed to send\",\n\t\t\t\t\tsecondaryText: \"transfer request.\",\n\t\t\t\t})\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsTransferring(false)\n\t\t}\n\t}\n\n\tconst handleDismiss = () => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.dismiss })\n\t\tengine.stores.modalStore.dismissModal(ModalType.TransferProject)\n\t}\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<Modal.Root onDismiss={handleDismiss} onConfirm={handleTransfer} {...modalThemeProps}>\n\t\t\t<Modal.Header>Transfer Project</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<div className={styles.modalText}>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tEnter the email of the person that you want to transfer this site to. When the transfer is complete, the\n\t\t\t\t\t\tsubscription on this project will be cancelled and the domain name transferred.\n\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\topenNewTab(\"https://www.framer.com/help/articles/how-to-transfer-your-site-to-someone-else/\")\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\tLearn more\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput value={email} placeholder={userEmail} onChange={setEmail} constantChange autoFocus type=\"email\" />\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Stack direction=\"row\" gap={6} alignItems=\"center\">\n\t\t\t\t\t<CheckBox id=\"add-as-editor\" value={addAsEditor} onChange={setAddAsEditor} enabled={!isTransferring} />\n\t\t\t\t\t<label htmlFor=\"add-as-editor\" style={{ color: \"inherit\", cursor: \"pointer\" }}>\n\t\t\t\t\t\t<T className={styles.modalText}>Add yourself as an editor</T>\n\t\t\t\t\t</label>\n\t\t\t\t</Stack>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton enabled={!isTransferring}>Cancel</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={email.length > 0 && !isTransferring}>\n\t\t\t\t\t{Dictionary.Transfer}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import \"TransferProjectModal.styles_wh2d9s.wyw.css\"; export const modalText = \"modalText_m1sn18nu\";", "import { Modal, Stack } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback } from \"react\"\nimport * as styles from \"./KitRemixModal.styles.ts\"\nimport aiKitsBanner from \"./assets/ai-kits-banner.png\"\n\nexport function KitRemixModal(_props: ModalProps<ModalType.KitRemix>) {\n\tconst dismiss = useCallback(() => {\n\t\tengine.stores.modalStore.dismiss()\n\t}, [])\n\n\treturn (\n\t\t<Modal.Root visible onDismiss={dismiss}>\n\t\t\t<Modal.Header separator={false}>Get Started</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Image src={aiKitsBanner} alt=\"AI Kits\" className={styles.banner} />\n\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tStart prompting to generate new pages using this AI Kit. You can also manually add new sections via the Insert\n\t\t\t\t\tPanel.\n\t\t\t\t</Modal.Text>\n\n\t\t\t\t<Stack direction=\"column\" gap={5}>\n\t\t\t\t\t<Shortcut shortcutKey=\"A\" description=\"To generate with AI\" />\n\t\t\t\t\t<Shortcut shortcutKey=\"I\" description=\"To insert sections\" />\n\t\t\t\t</Stack>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton variant=\"default\">Got it</Modal.CancelButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\ntype ShortcutProps = {\n\tshortcutKey: string\n\tdescription: string\n}\n\nconst Shortcut = ({ shortcutKey, description }: ShortcutProps) => {\n\treturn (\n\t\t<Stack direction=\"row\" gap={10}>\n\t\t\t<kbd className={styles.shortcutKey}>{shortcutKey}</kbd>\n\t\t\t<div className={styles.text}>{description}</div>\n\t\t</Stack>\n\t)\n}\n", "import \"KitRemixModal.styles_xan1w4.wyw.css\"; export const modal = \"modal_m1y22opf\";\nexport const header = \"header_hups9py\";\nexport const content = \"content_c19u584b\";\nexport const banner = \"banner_bygsga0\";\nexport const shortcutKey = \"shortcutKey_s1lvxsby\";\nexport const text = \"text_t2y8jod\";\nexport const button = \"button_b1xog3w4\";", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { ComboBox, Modal } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getTitleForWebPage } from \"document/components/utils/webPageTitles.ts\"\nimport engine from \"document/engine.ts\"\nimport { AnalyticsScopeNode, type NodeID, type ShallowWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useState } from \"react\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\n\nexport function CreateAbTestModal({ onConfirm }: ModalProps<ModalType.CreateAbTest>) {\n\tconst { pageIdByTitle, titleByPageId, comboBoxItems } = useEngineState(\n\t\t() => {\n\t\t\tconst result: {\n\t\t\t\tpageIdByTitle: Record<string, NodeID>\n\t\t\t\ttitleByPageId: Record<NodeID, string>\n\t\t\t\tcomboBoxItems: ComboBoxListItem[]\n\t\t\t} = {\n\t\t\t\tpageIdByTitle: {},\n\t\t\t\ttitleByPageId: {},\n\t\t\t\tcomboBoxItems: [],\n\t\t\t}\n\n\t\t\tconst seenWebPageIds = new Set<NodeID>()\n\n\t\t\t// Skip the pages that are already A/B tested\n\t\t\tconst funnelNodes = AnalyticsScopeNode.get(engine.tree)?.loaded?.children\n\t\t\tif (funnelNodes) {\n\t\t\t\tfor (const node of funnelNodes) {\n\t\t\t\t\tif (node.abTestingParentId && node.status !== FunnelStatus.Stopped) {\n\t\t\t\t\t\tseenWebPageIds.add(node.abTestingParentId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst homePageNode = engine.tree.get<ShallowWebPageNode>(engine.tree.root.homePageNodeId)\n\t\t\tif (homePageNode && !seenWebPageIds.has(homePageNode.id)) {\n\t\t\t\tconst title = getTitleForWebPage(engine.tree, engine.componentLoader, homePageNode)\n\t\t\t\tresult.pageIdByTitle[title] = homePageNode.id\n\t\t\t\tresult.titleByPageId[homePageNode.id] = title\n\t\t\t\tresult.comboBoxItems.push({ type: \"option\", value: title })\n\t\t\t}\n\n\t\t\tconst routeSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\t\t\tfor (const segment of routeSegmentRootNode.walk()) {\n\t\t\t\tif (!isRouteSegmentNode(segment) || !segment.webPageId) continue\n\n\t\t\t\t// Skip already seen pages\n\t\t\t\tif (seenWebPageIds.has(segment.webPageId)) continue\n\n\t\t\t\tconst webPageNode = engine.tree.get<ShallowWebPageNode>(segment.webPageId)\n\t\t\t\tif (!webPageNode) continue\n\n\t\t\t\t// Mark as seen\n\t\t\t\tseenWebPageIds.add(webPageNode.id)\n\n\t\t\t\tconst title = getTitleForWebPage(engine.tree, engine.componentLoader, webPageNode)\n\t\t\t\tresult.pageIdByTitle[title] = webPageNode.id\n\t\t\t\tresult.titleByPageId[webPageNode.id] = title\n\t\t\t\tresult.comboBoxItems.push({ type: \"option\", value: title })\n\t\t\t}\n\n\t\t\treturn result\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle],\n\t\t{ deepEqual: true },\n\t)\n\n\tconst [selectedPageId, setSelectedPageId] = useState<string | undefined>(undefined)\n\n\tconst onChange = useEngineCallback(\n\t\t(title: string, _final: boolean, reset: () => void) => {\n\t\t\tconst newPageId = pageIdByTitle[title]\n\t\t\tif (selectedPageId || newPageId) {\n\t\t\t\tsetSelectedPageId(newPageId)\n\t\t\t}\n\t\t\treset()\n\t\t},\n\t\t[pageIdByTitle, selectedPageId],\n\t)\n\n\tconst handleConfirm = useEngineCallback(() => {\n\t\tif (selectedPageId) {\n\t\t\tonConfirm(selectedPageId)\n\t\t\tengine.stores.modalStore.dismissModal(ModalType.CreateAbTest)\n\t\t}\n\t}, [selectedPageId, onConfirm])\n\n\tconst handleCancel = useEngineCallback(() => {\n\t\tengine.stores.modalStore.dismissModal(ModalType.CreateAbTest)\n\t}, [])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tif (comboBoxItems.length === 0) {\n\t\treturn (\n\t\t\t<Modal.Root visible onDismiss={handleCancel} onConfirm={handleConfirm} {...modalThemeProps}>\n\t\t\t\t<Modal.Header>{Dictionary.NewABTest}</Modal.Header>\n\t\t\t\t<Modal.Content>\n\t\t\t\t\t<Modal.Text>No pages are available for testing. Stop an existing test or create a new page.</Modal.Text>\n\t\t\t\t</Modal.Content>\n\t\t\t\t<Modal.Footer>\n\t\t\t\t\t<Modal.CancelButton>{Dictionary.Close}</Modal.CancelButton>\n\t\t\t\t</Modal.Footer>\n\t\t\t</Modal.Root>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Modal.Root visible onDismiss={handleCancel} onConfirm={handleConfirm} {...modalThemeProps}>\n\t\t\t<Modal.Header>{Dictionary.NewABTest}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>Select the page that you want to test.</Modal.Text>\n\t\t\t\t<ComboBox\n\t\t\t\t\trightChevron\n\t\t\t\t\tautoCompleteEnabled\n\t\t\t\t\titems={comboBoxItems}\n\t\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\tvalue={selectedPageId ? (titleByPageId[selectedPageId] ?? \"\") : \"\"}\n\t\t\t\t/>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={Boolean(selectedPageId)}>\n\t\t\t\t\t{Dictionary.Confirm}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { CheckBox, Modal, Spinner, Stack } from \"@framerjs/fresco\"\nimport { emptyArray, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useMemo, useState } from \"react\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\nimport { DropdownMenuButton } from \"../components/DropdownMenuButton.tsx\"\nimport { type AbTestVariantMetrics, fetchAbTestDropOff } from \"../utils/fetchUtils.ts\"\nimport { getAbTestQuery } from \"../utils/getAbTestQuery.ts\"\nimport { getAbTestStats } from \"../utils/getAbTestStats.ts\"\nimport type { AbVariantWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport { useAbTestVariantsWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport * as styles from \"./StopAbTestModal.styles.ts\"\n\nconst log = getLogger(\"StopAbTestModal\")\n\nconst noBestVariant = {\n\tbestVariantId: undefined,\n\tlift: undefined,\n}\n\nexport function StopAbTestModal({ funnelId, onConfirm }: ModalProps<ModalType.StopAbTest>) {\n\tconst abTestQuery = useEngineState(() => getAbTestQuery(funnelId, engine), [funnelId], [EngineChange.Tree], {\n\t\tdeepEqual: true,\n\t})\n\n\tconst [abTestMetrics, setAbTestMetrics] = useState<readonly AbTestVariantMetrics[]>()\n\n\tuseEffect(() => {\n\t\tconst abortController = new AbortController()\n\t\tif (!abTestQuery) return\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tconst response = await fetchAbTestDropOff(\n\t\t\t\t\tengine.stores.projectStore.projectId,\n\t\t\t\t\tabTestQuery,\n\t\t\t\t\tabortController.signal,\n\t\t\t\t)\n\t\t\t\tsetAbTestMetrics(response.metrics)\n\t\t\t} catch (e) {\n\t\t\t\tif (abortController.signal.aborted) return\n\t\t\t\tlog.reportError(e)\n\t\t\t\tsetAbTestMetrics(emptyArray())\n\t\t\t}\n\t\t})()\n\t\treturn () => abortController.abort()\n\t}, [abTestQuery])\n\n\tconst allVariants = useAbTestVariantsWithMetrics(funnelId, abTestMetrics)\n\tconst { bestVariantId, lift }: { bestVariantId: NodeID | undefined; lift: number | undefined } = useMemo(() => {\n\t\tconst stats = allVariants && getAbTestStats(allVariants)\n\t\tif (!stats?.bestIsWinner) return noBestVariant\n\t\treturn {\n\t\t\tbestVariantId: stats.best.abVariantId,\n\t\t\tlift: stats.best.lift ?? undefined,\n\t\t}\n\t}, [allVariants])\n\n\tconst abVariants: readonly AbVariantWithMetrics[] = useMemo(() => {\n\t\tif (!allVariants || !abTestQuery) return emptyArray()\n\t\tconst result: AbVariantWithMetrics[] = []\n\t\tfor (const abVariant of allVariants) {\n\t\t\t// Skip deleted variants (that don't exist in the tree)\n\t\t\tif (abVariant.isDeleted) continue\n\n\t\t\t// Rename the control variant\n\t\t\tconst name = abVariant.id === abTestQuery.controlVariantId ? \"Keep Control\" : abVariant.name\n\n\t\t\tresult.push({\n\t\t\t\t...abVariant,\n\t\t\t\t// Add the winner label to the best variant\n\t\t\t\tname: abVariant.id === bestVariantId ? `${name} (Winner)` : name,\n\t\t\t})\n\t\t}\n\t\treturn result\n\t}, [allVariants, abTestQuery, bestVariantId])\n\n\tconst [variant, setVariant] = useState<AbVariantWithMetrics>()\n\n\tif (!variant && abVariants.length > 0 && abTestMetrics) {\n\t\t// Once the metrics have loaded, select the best variant if it exists\n\t\t// otherwise set the control variant\n\t\tconst best = abVariants.find(abVariant => abVariant.id === bestVariantId)\n\t\tsetVariant(best ?? abVariants[0])\n\t}\n\n\tconst items = useMemo((): MenuItemOptions[] => {\n\t\tif (!abTestQuery) return []\n\t\tconst list: MenuItemOptions[] = [{ type: \"separator\" }]\n\t\tlet bestOption: MenuItemOptions | undefined\n\t\tlet controlOption: MenuItemOptions | undefined\n\t\tfor (const abVariant of abVariants) {\n\t\t\tconst item = {\n\t\t\t\tlabel: abVariant.name,\n\t\t\t\tclick: () => setVariant(abVariant),\n\t\t\t}\n\t\t\tif (abVariant.id === abTestQuery.controlVariantId) {\n\t\t\t\tcontrolOption = item\n\t\t\t} else if (abVariant.id === bestVariantId) {\n\t\t\t\tbestOption = item\n\t\t\t} else {\n\t\t\t\tlist.push(item)\n\t\t\t}\n\t\t}\n\t\tif (controlOption) list.unshift(controlOption)\n\t\tif (bestOption) list.unshift(bestOption)\n\t\tif (!controlOption && !bestOption) list.shift() // remove the separator\n\t\treturn list\n\t}, [abVariants, abTestQuery, bestVariantId])\n\n\tconst [deleteOtherVariants, setDeleteOtherVariants] = useState(false)\n\tconst [confirmLoading, setConfirmLoading] = useState(false)\n\n\tconst handleConfirm = useEngineCallback(async () => {\n\t\tif (!variant || !allVariants || confirmLoading) return\n\t\tsetConfirmLoading(true)\n\t\ttry {\n\t\t\tawait onConfirm({\n\t\t\t\tvariantId: variant.id,\n\t\t\t\tabVariantsSnapshot: allVariants.map(({ name, id }) => ({ name, id })),\n\t\t\t\tdeleteOtherVariants,\n\t\t\t\tlift: variant.id === bestVariantId ? lift : undefined,\n\t\t\t})\n\t\t} finally {\n\t\t\tsetConfirmLoading(false)\n\t\t}\n\t\tengine.stores.modalStore.dismissModal(ModalType.StopAbTest)\n\t}, [variant, allVariants, onConfirm, deleteOtherVariants, bestVariantId, lift, confirmLoading])\n\n\tconst handleDismiss = useEngineCallback(() => {\n\t\tif (confirmLoading) return\n\t\tengine.stores.modalStore.dismissModal(ModalType.StopAbTest)\n\t}, [confirmLoading])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst dropdownLabel = abTestMetrics ? (variant ? variant.name : \"Select Variant\u2026\") : Dictionary.LoadingEllipsis\n\n\treturn (\n\t\t<Modal.Root visible onDismiss={handleDismiss} onConfirm={handleConfirm} {...modalThemeProps}>\n\t\t\t<Modal.Header>Stop A/B Test</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tSelect the page variant that you want to replace the control variant with. Publish your site again to confirm\n\t\t\t\t\tthe changes.\n\t\t\t\t</Modal.Text>\n\t\t\t\t<DropdownMenuButton label={dropdownLabel} items={items} loading={!abTestMetrics} enabled={!confirmLoading} />\n\t\t\t\t<Stack direction=\"row\" gap={6} alignItems=\"center\" className={styles.checkboxRow}>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tid=\"delete-other-variants\"\n\t\t\t\t\t\tenabled={!confirmLoading}\n\t\t\t\t\t\tvalue={deleteOtherVariants}\n\t\t\t\t\t\tonChange={setDeleteOtherVariants}\n\t\t\t\t\t/>\n\t\t\t\t\t<label htmlFor=\"delete-other-variants\">Delete other variants</label>\n\t\t\t\t</Stack>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton enabled={!confirmLoading}>Cancel</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={!!variant && !confirmLoading}>\n\t\t\t\t\t{confirmLoading ? <Spinner /> : Dictionary.Confirm}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FunnelFilter } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport type { FunnelStepNode } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { FunnelStep } from \"../types.ts\"\n\nexport interface FunnelQuery {\n\tsteps: FunnelStep[]\n\tfunnelFilters: {\n\t\tcountryCode: string[] | undefined\n\t\tbrowser: string[] | undefined\n\t\tos: string[] | undefined\n\t\tdevice: string[] | undefined\n\t\tutmCampaign: string[] | undefined\n\t\tutmSource: string[] | undefined\n\t\tutmContent: string[] | undefined\n\t\tutmTerm: string[] | undefined\n\t\tutmMedium: string[] | undefined\n\t}\n}\n\n/** Retrieves params that are needed to query funnel dropoff results\n * Returns null if the query is invalid\n */\nexport function getFunnelQuery(id: NodeID, engine: VekterEngine): FunnelQuery | null {\n\tconst funnel = engine.tree.getNodeWithTrait(id, isFunnelNode)\n\tif (!funnel) return null\n\n\tconst funnelSteps: FunnelStep[] = []\n\tfor (const stepNode of funnel.children) {\n\t\tconst step = getFunnelStep(stepNode)\n\t\tif (!step) return null\n\t\tfunnelSteps.push(step)\n\t}\n\n\tif (funnelSteps.length === 0) return null\n\n\treturn {\n\t\tsteps: funnelSteps,\n\t\tfunnelFilters: {\n\t\t\tcountryCode: toFunnelQueryFilter(funnel.filterByCountryCode),\n\t\t\tbrowser: toFunnelQueryFilter(funnel.filterByBrowser),\n\t\t\tos: toFunnelQueryFilter(funnel.filterByOs),\n\t\t\tdevice: toFunnelQueryFilter(funnel.filterByDevice),\n\t\t\tutmCampaign: toFunnelQueryFilter(funnel.filterByUtmCampaign),\n\t\t\tutmSource: toFunnelQueryFilter(funnel.filterByUtmSource),\n\t\t\tutmContent: toFunnelQueryFilter(funnel.filterByUtmContent),\n\t\t\tutmTerm: toFunnelQueryFilter(funnel.filterByUtmTerm),\n\t\t\tutmMedium: toFunnelQueryFilter(funnel.filterByUtmMedium),\n\t\t},\n\t}\n}\n\nfunction toFunnelQueryFilter(funnelFilter: readonly FunnelFilter[] | undefined): string[] | undefined {\n\tif (!funnelFilter) return undefined\n\treturn funnelFilter.map(filter => filter.value).filter(Boolean)\n}\n\n/** Validates the step and gets its query params */\nfunction getFunnelStep(stepNode: FunnelStepNode): FunnelStep | undefined {\n\tconst [firstAction] = stepNode.children\n\tif (!firstAction) return\n\n\tconst eventType = firstAction.trackingEventType\n\tif (!eventType) return undefined\n\n\tswitch (eventType) {\n\t\tcase \"pageview\": {\n\t\t\tconst routePaths: string[] = []\n\t\t\tfor (const action of stepNode.children) {\n\t\t\t\tif (action.trackingEventType === eventType && action.trackingRoutePath) {\n\t\t\t\t\troutePaths.push(action.trackingRoutePath)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\teventType,\n\t\t\t\troutePaths: routePaths.length > 0 ? routePaths : undefined,\n\t\t\t}\n\t\t}\n\n\t\tcase \"click\":\n\t\tcase \"form_submit\":\n\t\tcase \"custom\":\n\t\tcase \"trigger_invoke\": {\n\t\t\tconst trackingIds: string[] = []\n\t\t\tfor (const action of stepNode.children) {\n\t\t\t\tif (action.trackingEventType === eventType && action.trackingId) {\n\t\t\t\t\ttrackingIds.push(action.trackingId)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\teventType,\n\t\t\t\ttrackingIds: trackingIds.length > 0 ? trackingIds : undefined,\n\t\t\t}\n\t\t}\n\n\t\tdefault:\n\t\t\tassertNever(eventType)\n\t}\n}\n", "import type Engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { FunnelQuery } from \"./getFunnelQuery.ts\"\nimport { getFunnelQuery } from \"./getFunnelQuery.ts\"\n\nexport interface AbTestQuery extends FunnelQuery {\n\tabTestId: NodeID\n\tcontrolVariantId: NodeID\n\tfromDay: string\n\ttoDay: string\n}\n\n/** Retrieves params that are needed to query A/B test results\n * Returns null if the query is invalid\n */\nexport function getAbTestQuery(id: NodeID, engine: typeof Engine): AbTestQuery | null {\n\tconst funnel = engine.tree.getNodeWithTrait(id, isFunnelNode)\n\t// If no abTestingParentId then it's a normal funnel and not A/B test\n\tif (!funnel || !funnel.abTestingParentId) {\n\t\treturn null\n\t}\n\n\tif (!funnel.startedAt) {\n\t\t// Do not attempt to fetch data for A/B tests that are not started\n\t\treturn null\n\t}\n\n\tconst query = getFunnelQuery(id, engine)\n\tif (!query) {\n\t\t// If we can't get the funnel query, we can't get the A/B test query\n\t\treturn null\n\t}\n\n\treturn {\n\t\tabTestId: funnel.id,\n\t\tcontrolVariantId: funnel.abTestingParentId,\n\t\tfromDay: funnel.startedAt.split(\"T\")[0],\n\t\ttoDay: (funnel.stoppedAt ?? new Date().toISOString()).split(\"T\")[0],\n\t\tfunnelFilters: query.funnelFilters,\n\t\tsteps: query.steps,\n\t}\n}\n", "import type { AbTestVariantMetrics } from \"./fetchUtils.ts\"\nimport type { AbVariantWithMetrics } from \"./useAbTestVariantsWithMetrics.ts\"\n\ninterface AbTestStats {\n\tbest: AbTestVariantMetrics\n\tdaysLeft: number\n\tbestIsWinner: boolean\n}\n\n/**\n * Calculates the statistics for an A/B test based on the provided variants.\n * Only considers variants that are not deleted and have valid metrics.\n *\n * @param variants - The variants to calculate the statistics for.\n * @returns The statistics for the A/B test, or null if there are no valid variants.\n */\nexport function getAbTestStats(variants: readonly AbVariantWithMetrics[]): AbTestStats | null {\n\tlet best: AbTestVariantMetrics | null = null\n\tlet daysLeft: number | null = null\n\n\tfor (const { metrics, isDeleted } of variants) {\n\t\t// Skip the missing metrics or deleted variants\n\t\tif (!metrics || isDeleted) continue\n\n\t\tif (best === null || metrics.probabilityOfBeingBest > best.probabilityOfBeingBest) {\n\t\t\tbest = metrics\n\t\t}\n\t\tif (daysLeft === null || metrics.timeToSignificanceEstimateDays > daysLeft) {\n\t\t\tdaysLeft = metrics.timeToSignificanceEstimateDays\n\t\t}\n\t}\n\n\treturn best !== null && daysLeft !== null\n\t\t? {\n\t\t\t\tbest,\n\t\t\t\tdaysLeft,\n\t\t\t\tbestIsWinner: best.probabilityOfBeingBest >= 0.9 && daysLeft === 0,\n\t\t\t}\n\t\t: null\n}\n", "import { emptyArray } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { AbVariant } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\nimport type { AbTestVariantMetrics } from \"./fetchUtils.ts\"\nimport { getVariantNameById } from \"./getVariantNameById.ts\"\n\nexport interface AbVariantWithMetrics extends AbVariant {\n\t/** Joined metrics from the backend, can be missing\n\t * because they haven't been fetched yet, or\n\t * because they don't exist for this variant.\n\t */\n\tmetrics: AbTestVariantMetrics | undefined\n\t/** Used for determinig the color of a variant */\n\tindex: number\n\t/** Variant has been deleted from the tree */\n\tisDeleted: boolean\n}\n\n/** Gets variant names from the tree and from the backend response (if available).\n * Joins metrics from the backend (if available).\n */\nexport function useAbTestVariantsWithMetrics(\n\tfunnelId: NodeID,\n\tcurrentMetrics: readonly AbTestVariantMetrics[] | undefined,\n): readonly AbVariantWithMetrics[] | null {\n\tconst treeVariants: readonly AbVariant[] = useEngineState(\n\t\t() =>\n\t\t\tengine.tree\n\t\t\t\t.getNodeWithTrait(funnelId, isFunnelNode)\n\t\t\t\t?.getAbVariantDistributionsPpm(engine.tree, engine.componentLoader).distributions ?? emptyArray(),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t\t{ deepEqual: true }, // because we create a new object\n\t)\n\n\tconst abVariantsWithMetrics = useMemo(() => {\n\t\tconst abTestingParentId = engine.tree.getNodeWithTrait(funnelId, isFunnelNode)?.abTestingParentId\n\t\tif (!abTestingParentId) return null\n\n\t\tconst variants = treeVariants.map(variant => ({ ...variant, isDeleted: false }))\n\n\t\tconst existingVariants = new Set<NodeID>()\n\t\tfor (const variant of variants) {\n\t\t\texistingVariants.add(variant.id)\n\t\t}\n\n\t\tconst metricsByVariant: Record<string, AbTestVariantMetrics> = {}\n\n\t\t// Add names from the table response, because the pages may have been deleted.\n\t\t// (we could have added variant names from `currentConversionRate` too,\n\t\t// but they should match the ones from the table, which respondes sooner)\n\t\tif (currentMetrics) {\n\t\t\tfor (const metric of currentMetrics) {\n\t\t\t\tmetricsByVariant[metric.abVariantId] = metric\n\t\t\t\tif (existingVariants.has(metric.abVariantId)) continue\n\t\t\t\texistingVariants.add(metric.abVariantId)\n\t\t\t\tconst name = getVariantNameById(metric.abVariantId, abTestingParentId)\n\t\t\t\tvariants.push({ id: metric.abVariantId, name: `${name} (Deleted)`, isDeleted: true })\n\t\t\t}\n\t\t}\n\n\t\treturn variants.map((variant, i) => ({ ...variant, index: i, metrics: metricsByVariant[variant.id] }))\n\t}, [funnelId, treeVariants, currentMetrics])\n\treturn abVariantsWithMetrics\n}\n", "import { ModuleType, localModuleIdForStableName } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\nexport function getVariantNameById(id: NodeID, controlPageId: NodeID): string {\n\tif (id === controlPageId) return \"Control\"\n\n\tconst node = engine.tree.getNodeWithTrait(id, isFunnelNode)\n\n\tif (!node) {\n\t\tconst localModuleId = localModuleIdForStableName(ModuleType.Screen, id)\n\t\tconst module = engine.stores.modulesStore.getPersistedModuleByLocalId(localModuleId)\n\t\treturn module?.title || module?.name || Dictionary.Variant\n\t}\n\n\treturn node.resolveValue(\"name\") ?? getDefaultName(engine.componentLoader, node)\n}\n", "import \"StopAbTestModal.styles_jpvjaa.wyw.css\"; export const checkboxRow = \"checkboxRow_c1kw5moa\";", "import { CustomModal, IconClose, Scroll, Stack, Translatable as T, Text } from \"@framerjs/fresco\"\nimport { dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport { getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport type { ShortcutsItem } from \"./ShortcutsList.tsx\"\nimport { ShortcutsList } from \"./ShortcutsList.tsx\"\nimport * as styles from \"./ShortcutsModal.styles.ts\"\nimport type { ShortcutsModalConfig } from \"./config.ts\"\nimport { ShortcutGroups, shortcutsModalConfig } from \"./config.ts\"\n\ntype Shortcuts = {\n\t[key in ShortcutGroups]: ShortcutsItem[]\n}\n\nexport const ShortcutsModal = () => {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<CustomModal visible onDismiss={engine.stores.modalStore.dismiss} className={styles.modal} {...modalThemeProps}>\n\t\t\t<ShortcutsModalInner />\n\t\t</CustomModal>\n\t)\n}\n\nexport const ShortcutsModalInner = () => {\n\tconst config = shortcutsModalConfig()\n\tconst shortcuts = getShortcutsForRender(config)\n\n\tconst [showDivider, setShowDivider] = React.useState(false)\n\n\tconst handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n\t\tsetShowDivider(event.currentTarget.scrollTop > dimensions.values.inputSpacing)\n\t}\n\n\treturn (\n\t\t<Scroll direction=\"vertical\" onScroll={handleScroll} className={styles.scroll}>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={cx(styles.header, showDivider && styles.headerDivider)}\n\t\t\t>\n\t\t\t\t<Text size={fonts.size.heading} className={styles.modalTitle}>\n\t\t\t\t\t<T>Keyboard Shortcuts</T>\n\t\t\t\t</Text>\n\t\t\t\t<div className={styles.actions}>\n\t\t\t\t\t<div className={styles.action} onClick={engine.stores.modalStore.dismiss}>\n\t\t\t\t\t\t<IconClose />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t\t<div className={styles.body}>{renderShortcutsContent(shortcuts)}</div>\n\t\t</Scroll>\n\t)\n}\n\nfunction renderShortcutsContent(appMenu: Shortcuts) {\n\tif (Object.keys(appMenu).length === 0) return null\n\n\t// render the lists in order so they fit perfectly in the space\n\treturn Object.keys(ShortcutGroups).map((title: keyof typeof ShortcutGroups) => {\n\t\tconst items = appMenu[title]\n\t\tif (!items.length) return null\n\t\treturn <ShortcutsList key={`shortcut-list-${title}`} title={title} items={items} />\n\t})\n}\n\nfunction getShortcutsForRender(config: ShortcutsModalConfig): Shortcuts {\n\tconst shortcuts = {} as Shortcuts\n\tlet group: keyof ShortcutsModalConfig\n\tfor (group in config) {\n\t\tconst groupConfig = config[group]\n\t\tshortcuts[group] = groupConfig.display.map(action => ({\n\t\t\tlabel: groupConfig.labelOverrides?.[action] ?? actionLabels[action] ?? \"\",\n\t\t\taccelerator: getAcceleratorTokens(getActionAccelerator(action, { platform: \"mac\" }) ?? \"\"),\n\t\t\tacceleratorWindows: getAcceleratorTokens(getActionAccelerator(action, { platform: \"windows\" }) ?? \"\"),\n\t\t}))\n\t}\n\treturn shortcuts\n}\n", "import \"ShortcutsModal.styles_1vtye1t.wyw.css\"; export const modal = \"modal_muq5s4h\";\nexport const scroll = \"scroll_scn3p3\";\nexport const header = \"header_hy95ik9\";\nexport const headerDivider = \"headerDivider_hiofzzv\";\nexport const modalTitle = \"modalTitle_m3xbuek\";\nexport const body = \"body_bk2ylc7\";\nexport const list = \"list_l119fedh\";\nexport const title = \"title_t1y5plxw\";\nexport const actions = \"actions_aio4hni\";\nexport const action = \"action_a1dr92ms\";\nexport const divider = \"divider_dwzxl6l\";\nexport const item = \"item_iu7bsh7\";\nexport const label = \"label_lujuicf\";\nexport const acceleratorLabel = \"acceleratorLabel_afh958b\";\nexport const disabled = \"disabled_d1ew13lq\";", "import { Translatable as T, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { isAppleDevice } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./ShortcutsModal.styles.ts\"\n\nexport interface ShortcutsItem {\n\tlabel: string\n\taccelerator: string[]\n\tacceleratorWindows: string[]\n\tdisabled?: boolean\n}\n\ninterface Props {\n\ttitle: string\n\titems: ShortcutsItem[]\n}\n\nexport const ShortcutsList = ({ title, items }: Props) => {\n\treturn (\n\t\t<div className={styles.list}>\n\t\t\t<h3 className={styles.title}>{title}</h3>\n\t\t\t<div className={styles.divider}></div>\n\t\t\t<div>\n\t\t\t\t{items.map((item, i) => {\n\t\t\t\t\tif (!isAppleDevice() && (!item.acceleratorWindows || item.acceleratorWindows.length === 0)) return null\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ShortcutsItem\n\t\t\t\t\t\t\tkey={`shortcut-item-${i}`}\n\t\t\t\t\t\t\tlabel={item.label}\n\t\t\t\t\t\t\taccelerator={isAppleDevice() ? item.accelerator : item.acceleratorWindows}\n\t\t\t\t\t\t\tdisabled={item.disabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nconst ShortcutsItem = ({\n\tlabel,\n\taccelerator,\n\tdisabled,\n}: {\n\tlabel: string\n\taccelerator: string[]\n\tdisabled?: boolean\n}) => {\n\treturn (\n\t\t<div className={cx(styles.item, disabled && styles.disabled)}>\n\t\t\t<div className={cx(truncateWithEllipsis, styles.label)}>{label}</div>\n\t\t\t<div>\n\t\t\t\t{accelerator.map((acceleratorLabel, i) => (\n\t\t\t\t\t<span key={`${label}-shortcut-${i}`} className={styles.acceleratorLabel}>\n\t\t\t\t\t\t<T>{acceleratorLabel}</T>\n\t\t\t\t\t</span>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "import type { AppAction } from \"app/AppActions.ts\"\nimport {\n\talignmentActions,\n\tcomponentActions,\n\teditActions,\n\tfileActions,\n\tgraphicActions,\n\tlayoutActions,\n\tsitesActions,\n\ttextActions,\n\ttoolActions,\n\tviewActions,\n} from \"app/AppActions.ts\"\nimport { experiments } from \"app/experiments.ts\"\n\nexport enum ShortcutGroups {\n\tPublish = \"Publish\",\n\tFile = \"File\",\n\tAlignment = \"Alignment\",\n\tEdit = \"Edit\",\n\tGraphic = \"Graphic\",\n\tText = \"Text\",\n\tTools = \"Tools\",\n\tComponent = \"Component\",\n\tLayout = \"Layout\",\n\tView = \"View\",\n}\n\ninterface ShortcutGroupConfig {\n\tactions:\n\t\t| typeof fileActions\n\t\t| typeof layoutActions\n\t\t| typeof sitesActions\n\t\t| typeof editActions\n\t\t| typeof graphicActions\n\t\t| typeof toolActions\n\t\t| typeof alignmentActions\n\t\t| typeof viewActions\n\t\t| typeof componentActions\n\t\t| typeof textActions\n\n\tdisplay: AppAction[]\n\tomitted: AppAction[]\n\n\tlabelOverrides?: { [K in AppAction]?: string }\n}\n\nexport type ShortcutsModalConfig = Record<ShortcutGroups, ShortcutGroupConfig>\n\nconst withAgentExperiment = experiments.isOn(\"agent\")\n\nexport const shortcutsModalConfig = (): ShortcutsModalConfig => {\n\treturn {\n\t\t[ShortcutGroups.File]: {\n\t\t\tactions: fileActions,\n\t\t\tdisplay: [\n\t\t\t\t\"quickActions\",\n\t\t\t\t\"newProject\",\n\t\t\t\t\"uploadImage\",\n\t\t\t\t\"toggleContentManagement\",\n\t\t\t\t\"toggleLocalization\",\n\t\t\t\t\"toggleVersionHistory\",\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t\"uploadVideo\",\n\t\t\t\t\"newWebPage\",\n\t\t\t\t\"newPage\",\n\t\t\t\t\"newWebPageFolder\",\n\t\t\t\t\"sortWebPagesAlphabetically\",\n\t\t\t\t\"sortLayersAlphabetically\",\n\t\t\t\t\"importFigma\",\n\t\t\t\t\"goToProjects\",\n\t\t\t\t\"duplicateProject\",\n\t\t\t\t\"saveTemplateAsProject\",\n\t\t\t\t\"duplicateTemplate\",\n\t\t\t\t\"archiveProject\",\n\t\t\t\t\"unarchiveProject\",\n\t\t\t\t\"copyProjectLink\",\n\t\t\t\t\"copyRemixLink\",\n\t\t\t\t\"copyAIKitRemixLink\",\n\t\t\t\t\"toggleBetaChannel\",\n\t\t\t\t\"transferProject\",\n\t\t\t\t\"createAIKit\",\n\t\t\t\t\"convertPagesToKitPages\",\n\t\t\t\t\"openCanvas\",\n\t\t\t\t\"openCMS\",\n\t\t\t\t\"openLocalization\",\n\t\t\t\t\"openSettings\",\n\t\t\t\t\"openEvaluations\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Layout]: {\n\t\t\tactions: layoutActions,\n\t\t\tdisplay: [\n\t\t\t\t\"addEnclosingFrame\",\n\t\t\t\t\"addEnclosingStack\",\n\t\t\t\t\"autoSizeLayout\",\n\t\t\t\t\"removeFramePreservingChildren\",\n\t\t\t\t\"moveForward\",\n\t\t\t\t\"moveBackward\",\n\t\t\t\t\"moveToFront\",\n\t\t\t\t\"moveToBack\",\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t\"sizeToFitContent\",\n\t\t\t\t\"alignLeft\",\n\t\t\t\t\"alignCenter\",\n\t\t\t\t\"alignRight\",\n\t\t\t\t\"alignTop\",\n\t\t\t\t\"alignMiddle\",\n\t\t\t\t\"alignBottom\",\n\t\t\t\t\"distributeHorizontal\",\n\t\t\t\t\"distributeVertical\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Publish]: {\n\t\t\tactions: sitesActions,\n\t\t\tdisplay: [\n\t\t\t\t\"publishSite\",\n\t\t\t\t\"openPublishedSite\",\n\t\t\t\t\"openSettings\",\n\t\t\t\t\"showPreview\",\n\t\t\t\t\"togglePreviewInterface\",\n\t\t\t\t\"previewNextBreakpoint\",\n\t\t\t\t\"previewPreviousBreakpoint\",\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t\"openGeneralSettings\",\n\t\t\t\t\"openDomainSettings\",\n\t\t\t\t\"openRedirects\",\n\t\t\t\t\"openForms\",\n\t\t\t\t\"openStagingAndVersions\",\n\t\t\t\t\"openAnalytics\",\n\t\t\t\t\"openPlans\",\n\t\t\t\t\"openTemplates\",\n\t\t\t\t\"openUsage\",\n\t\t\t\t\"openCustomCode\",\n\t\t\t\t\"inviteCollaborators\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Edit]: {\n\t\t\tactions: editActions,\n\t\t\tdisplay: [\n\t\t\t\t\"undo\",\n\t\t\t\t\"redo\",\n\t\t\t\t\"goBack\",\n\t\t\t\t\"goForward\",\n\t\t\t\t\"copyStyle\",\n\t\t\t\t\"pasteStyle\",\n\t\t\t\t\"duplicate\",\n\t\t\t\t\"delete\",\n\t\t\t\t\"toggleLayerLock\",\n\t\t\t\t\"toggleLayerVisible\",\n\t\t\t\t\"rename\",\n\t\t\t\t\"openPanelSearch\",\n\t\t\t\t\"openTextSearchPlugin\",\n\t\t\t\t\"selectMostRecentPage\",\n\t\t\t\t\"selectGroundNode\",\n\t\t\t\t\"selectParent\",\n\t\t\t\t\"selectAll\",\n\t\t\t\t\"selectSiblings\",\n\t\t\t\t\"fakeSelectChildren\",\n\t\t\t\t\"cycleSelection\",\n\t\t\t\t\"decycleSelection\",\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t\"cut\",\n\t\t\t\t\"copy\",\n\t\t\t\t\"copyFill\",\n\t\t\t\t\"copyCSS\",\n\t\t\t\t\"copySVG\",\n\t\t\t\t\"copyText\",\n\t\t\t\t\"copyGrid\",\n\t\t\t\t\"copyLink\",\n\t\t\t\t\"copyNodeId\",\n\t\t\t\t\"copyEffects\",\n\t\t\t\t\"copyCursor\",\n\t\t\t\t\"copyURL\",\n\t\t\t\t\"paste\",\n\t\t\t\t\"pasteFill\",\n\t\t\t\t\"pasteInPlace\",\n\t\t\t\t\"pasteGrid\",\n\t\t\t\t\"pasteEffects\",\n\t\t\t\t\"pasteCursor\",\n\t\t\t\t\"toggleLayerClip\",\n\t\t\t\t\"renameLayers\",\n\t\t\t\t\"selectAllTopParents\",\n\t\t\t\t\"selectTextNodes\",\n\t\t\t\t\"selectTextNodesWithSameFont\",\n\t\t\t\t\"selectAllLayersWithSameFill\",\n\t\t\t\t\"selectChildren\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Graphic]: {\n\t\t\tactions: graphicActions,\n\t\t\tdisplay: [\"group\", \"ungroup\"],\n\t\t\tomitted: [\"flipHorizontal\", \"flipVertical\", \"convertToOutline\", \"flattenPath\", \"reversePath\"],\n\t\t},\n\t\t[ShortcutGroups.Tools]: {\n\t\t\tactions: toolActions,\n\t\t\tdisplay: [\n\t\t\t\t\"toggleInsert\",\n\t\t\t\t...(withAgentExperiment ? [] : [\"generateWebPage\" as const]),\n\t\t\t\t\"toggleLibraryModal\",\n\t\t\t\t\"toolCreateFrame\",\n\t\t\t\t\"toolCreateRounded\",\n\t\t\t\t\"toolCreateImage\",\n\t\t\t\t\"toolCreateVideo\",\n\t\t\t\t\"toolCreateStack\",\n\t\t\t\t\"toolCreateRows\",\n\t\t\t\t\"toolCreateColumns\",\n\t\t\t\t\"toolCreateGrid\",\n\t\t\t\t\"toolCreateMasonry\",\n\t\t\t\t\"toolCreateText\",\n\t\t\t\t\"startLinkTool\",\n\t\t\t\t\"toolComment\",\n\t\t\t\t\"toolScale\",\n\t\t\t\t\"toolZoom\",\n\t\t\t\t\"sampleColor\",\n\t\t\t\t...(withAgentExperiment ? [\"toolAgentPanel\" as const] : []),\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t...(!withAgentExperiment ? [] : [\"generateWebPage\" as const]),\n\t\t\t\t...(!withAgentExperiment ? [\"toolAgentPanel\" as const] : []),\n\t\t\t\t\"toolAgentDragSelect\",\n\t\t\t\t\"toolAgentSelect\",\n\t\t\t\t\"toolCreateScreen\",\n\t\t\t\t\"toolHighlight\",\n\t\t\t\t\"toolDirectSelect\",\n\t\t\t\t\"toolSelect\",\n\t\t\t\t\"toolPan\",\n\t\t\t\t\"toolZoomSelect\",\n\t\t\t\t\"toolMove\",\n\t\t\t\t\"toolResize\",\n\t\t\t\t\"toolRotate\",\n\t\t\t\t\"toolLineAnchorMove\",\n\t\t\t\t\"toolCollectionReferenceVariableEdit\",\n\t\t\t\t\"toolCreateOvalShape\",\n\t\t\t\t\"toolCreateRectangleShape\",\n\t\t\t\t\"toolCreatePolygonShape\",\n\t\t\t\t\"toolCreateStarShape\",\n\t\t\t\t\"toolCreateGridSpan\",\n\t\t\t\t\"toolCreateGridRow\",\n\t\t\t\t\"toolEnumVariableEdit\",\n\t\t\t\t\"toolLink\",\n\t\t\t\t\"toolLoadingShield\",\n\t\t\t\t\"toolTextEdit\",\n\t\t\t\t\"toolRichTextEdit\",\n\t\t\t\t\"toolRichTextVariableEdit\",\n\t\t\t\t\"toolStringVariableEdit\",\n\t\t\t\t\"toolDateVariableEdit\",\n\t\t\t\t\"toolPadding\",\n\t\t\t\t\"toolGap\",\n\t\t\t\t\"toolPath\",\n\t\t\t\t\"toolRadius\",\n\t\t\t\t\"toolFillGradient\",\n\t\t\t\t\"toolMaskGradient\",\n\t\t\t\t\"toolSlotConnect\",\n\t\t\t\t\"toolSampleColor\",\n\t\t\t\t\"toolGuide\",\n\t\t\t\t\"toolChat\",\n\t\t\t\t\"toolUnknown\",\n\t\t\t\t\"toolViewportResize\",\n\t\t\t\t\"toolHighlightStackItem\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Alignment]: {\n\t\t\tactions: alignmentActions,\n\t\t\tdisplay: [\n\t\t\t\t\"alignLeft\",\n\t\t\t\t\"alignCenter\",\n\t\t\t\t\"alignRight\",\n\t\t\t\t\"alignTop\",\n\t\t\t\t\"alignMiddle\",\n\t\t\t\t\"alignBottom\",\n\t\t\t\t\"distributeHorizontal\",\n\t\t\t\t\"distributeVertical\",\n\t\t\t],\n\t\t\tomitted: [\"alignToSelection\", \"alignToParent\"],\n\t\t},\n\t\t[ShortcutGroups.View]: {\n\t\t\tactions: viewActions,\n\t\t\tdisplay: [\n\t\t\t\t\"toggleAppearance\",\n\t\t\t\t\"zoomIn\",\n\t\t\t\t\"zoomOut\",\n\t\t\t\t\"resetZoom\",\n\t\t\t\t\"zoomToFitAll\",\n\t\t\t\t\"zoomToFitSelection\",\n\t\t\t\t\"toggleInterface\",\n\t\t\t\t\"toggleRulers\",\n\t\t\t\t\"collapseLayers\",\n\t\t\t\t\"toggleGrids\",\n\t\t\t\t\"showPages\",\n\t\t\t\t\"showLayers\",\n\t\t\t\t\"showAssets\",\n\t\t\t\t...(experiments.isOn(\"agent\") ? ([\"showAgent\", \"newAgentChat\"] as const) : []),\n\t\t\t],\n\t\t\tomitted: [\n\t\t\t\t...(!experiments.isOn(\"agent\") ? ([\"showAgent\", \"newAgentChat\"] as const) : []),\n\t\t\t\t\"toggleShowPixelGrid\",\n\t\t\t\t\"toggleShowAllLinks\",\n\t\t\t\t\"toggleShowHandoff\",\n\t\t\t\t\"toggleAppearanceSystem\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Component]: {\n\t\t\tactions: componentActions,\n\t\t\tdisplay: [\"makeComponent\", \"makeCodeComponent\"],\n\t\t\tomitted: [\n\t\t\t\t\"showComponentMaster\",\n\t\t\t\t\"detachComponentInstanceFromMaster\",\n\t\t\t\t\"updateComponentMasterFromInstance\",\n\t\t\t\t\"resetComponentInstanceOverrides\",\n\t\t\t],\n\t\t},\n\t\t[ShortcutGroups.Text]: {\n\t\t\tactions: textActions,\n\t\t\tdisplay: [\"makeBold\", \"makeItalic\", \"makeUnderlined\"],\n\t\t\tomitted: [\"chooseFontFamily\"],\n\t\t},\n\t}\n}\n", "// eslint-disable-next-line @typescript-eslint/triple-slash-reference,spaced-comment\n/// <reference path=\"../../../../code-editor/typings.d.ts\" />\n\nimport { splitExtension } from \"@framerjs/assets\"\nimport { ConfirmationModal, RadioButton, RadioButtonGroup, TextInput } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { createCodeFileData, hasValidExtension, isValidModuleName } from \"code-editor/utils.ts\"\nimport engine from \"document/engine.ts\"\nimport type { MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CODE_FILE_ENTITY_TYPE_ROOT_ID } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { LocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport {\n\tcreateEntityFolderNodesFromPath,\n\tgetPathForEntityFolderNodeId,\n} from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { createReferenceForNodeIfNeeded } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { CodeFileCreationType } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { tsxExtension } from \"utils/fileExtensionNames.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { expandAssetEntityItems } from \"../assets/utils/expandAssetEntityItems.ts\"\nimport * as styles from \"./CodeFileCreationModal.styles.ts\"\n\nconst allCodeFileCreationTypes = [CodeFileCreationType.Component, CodeFileCreationType.Override]\n\n// Remember the last code file creation type when not explicitly set in the modal.\nlet defaultCreationType = CodeFileCreationType.Component\n\nfunction hasValidFileName(name: string) {\n\tconst userEnteredName = name.length > 0\n\tif (!userEnteredName) return false\n\treturn isValidNewFileName(name)\n}\n\nexport function CodeFileCreationModal({\n\tcreationType: initialCreationType,\n\tparentId,\n}: ModalProps<ModalType.CodeFileCreation>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst codeFileTypes = allCodeFileCreationTypes\n\n\tconst [type, setType] = React.useState(initialCreationType ?? defaultCreationType)\n\tconst [name, setName] = React.useState(\"\")\n\n\t// Handle async deps state\n\tconst creationEnabled = hasValidFileName(name)\n\n\t// Handle file creation or reload\n\tconst submitHandler = useEngineCallback(() => {\n\t\tif (!creationEnabled || !hasValidFileName(name)) {\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.chromeStore.codeFilesExpanded = true\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Assets\n\n\t\tcreateCodeFile(name, type === CodeFileCreationType.Override ? \"override\" : \"component\", parentId)\n\n\t\t// Next time the modal opens without an opinion on which type of file to create, use the one the user picked here.\n\t\tdefaultCreationType = type\n\n\t\tengine.stores.modalStore.dismiss()\n\t}, [type, name, creationEnabled, parentId])\n\n\tconst onSelectHandler = React.useCallback((creationType: CodeFileCreationType | undefined) => {\n\t\tif (!creationType) return\n\t\tsetType(creationType)\n\t}, [])\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"New Code File\"\n\t\t\tconfirmLabel=\"Create\"\n\t\t\tonConfirm={submitHandler}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonEnabled={creationEnabled}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t>\n\t\t\t<TextInput value={name} placeholder=\"Title\" onChange={setName} constantChange autoFocus />\n\t\t\t{codeFileTypes.length > 1 && (\n\t\t\t\t<RadioButtonGroup>\n\t\t\t\t\t{codeFileTypes.map(codeFileType => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\tkey={codeFileType}\n\t\t\t\t\t\t\t\tidentifier={codeFileType}\n\t\t\t\t\t\t\t\ttitle={titleForCodeFileCreationType}\n\t\t\t\t\t\t\t\tselected={codeFileType === type}\n\t\t\t\t\t\t\t\tonSelect={onSelectHandler}\n\t\t\t\t\t\t\t\tclassName={isAgentExperimentOn ? styles.agentRadioButtonRow : undefined}\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</RadioButtonGroup>\n\t\t\t)}\n\t\t</ConfirmationModal>\n\t)\n}\n\nfunction titleForCodeFileCreationType(creationType: CodeFileCreationType) {\n\tswitch (creationType) {\n\t\tcase CodeFileCreationType.Component:\n\t\t\treturn Dictionary.NewComponent\n\t\tcase CodeFileCreationType.Override:\n\t\t\treturn Dictionary.NewOverride\n\t}\n}\n\nfunction isValidNewFileName(name: string) {\n\tconst [_, extension] = splitExtension(name)\n\n\tconst fileName = extension ? name : name + tsxExtension\n\treturn (\n\t\tisValidModuleName(name) &&\n\t\thasValidExtension(fileName) &&\n\t\t!engine.stores.modulesStore.getModuleEntryByUniqueName(fileName)\n\t)\n}\n\nconst leadingSlashRegex = /^\\/+/u\n\nfunction createCodeFile(name: string, type: \"component\" | \"override\", parentId: MaybeNodeID) {\n\tconst parentPath = isString(parentId) ? getPathForEntityFolderNodeId(engine, parentId) : \"\"\n\tconst sanitizedName = name.replace(leadingSlashRegex, \"\")\n\tconst fullName = parentPath ? `${parentPath}/${sanitizedName}` : name\n\n\tconst data = createCodeFileData(fullName, type)\n\tif (!data) return\n\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\tengine.stores.codeEditorStore.createFile({\n\t\tpath: data.path,\n\t\tcontent: data.content,\n\t\topenFile: true,\n\t\topenPreview: type === \"component\",\n\t\tonSuccess: id => {\n\t\t\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\t\t\tconst node = engine.tree.get<LocalModuleNode>(id)\n\t\t\tif (!node) return\n\n\t\t\tconst finalParentId = createEntityFolderNodesFromPath(\n\t\t\t\tengine.tree,\n\t\t\t\tname,\n\t\t\t\tparentId ?? CODE_FILE_ENTITY_TYPE_ROOT_ID,\n\t\t\t)\n\n\t\t\t// If the name contains a path, we need to create a reference node\n\t\t\t// for the smart component and the folders extracted from the path\n\t\t\tcreateReferenceForNodeIfNeeded(engine.tree, finalParentId, id, true)\n\n\t\t\texpandAssetEntityItems(engine, finalParentId, false)\n\t\t},\n\t})\n}\n", "import \"CodeFileCreationModal.styles_1wpuoo4.wyw.css\"; export const agentRadioButtonRow = \"agentRadioButtonRow_a1co7t24\";", "import { ConfirmationModal } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useState } from \"react\"\n\nexport function ConfirmDestructiveFeedbackActionModal({\n\tonConfirm,\n\ttitle,\n\tdescription,\n\tconfirmLabel,\n}: ModalProps<ModalType.ConfirmDestructiveFeedbackAction>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst [onDeletedPromise, setOnDeletedPromise] = useState<null | Promise<void>>(null)\n\n\tuseEffect(() => {\n\t\tlet active = true\n\t\tif (!onDeletedPromise) return\n\t\tvoid onDeletedPromise.finally(() => {\n\t\t\tif (active) {\n\t\t\t\tsetOnDeletedPromise(null)\n\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t}\n\t\t})\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [onDeletedPromise])\n\n\tfunction confirmationHandler() {\n\t\tsetOnDeletedPromise(onConfirm())\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tconfirmLabel={confirmLabel}\n\t\t\tonConfirm={confirmationHandler}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonLoading={!!onDeletedPromise}\n\t\t\thasBackdrop\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import \"FigmaModals.styles_1l6b8ij.wyw.css\"; export const orderedList = \"orderedList_o1tvak24\";\nexport const link = \"link_l1prqzd\";", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { Button, Modal } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./FigmaModals.styles.ts\"\nimport figmaToFramerImage from \"./assets/paste-from-figma.jpg\"\n\nconst importGuideURL = \"https://www.framer.com/learn/figma-import/\"\nconst installPluginURL = \"https://www.figma.com/community/plugin/1037108608720448600/Framer-Copy-Paste\"\n\nexport function FigmaImportModal() {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tlargeModal\n\t\t\thasBackdrop\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tonConfirm={() => openNewTab(installPluginURL)}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header closeButton separator={false}>\n\t\t\t\tPaste from Figma\n\t\t\t</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Image src={figmaToFramerImage} alt=\"Paste from Figma\" />\n\n\t\t\t\t<ol className={styles.orderedList}>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t{`Read the `}\n\t\t\t\t\t\t<Button variant=\"link\" className={styles.link} onClick={() => openNewTab(importGuideURL)}>\n\t\t\t\t\t\t\tguide\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{` and `}\n\t\t\t\t\t\t<Button variant=\"link\" className={styles.link} onClick={() => openNewTab(installPluginURL)}>\n\t\t\t\t\t\t\tinstall plugin\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>Select layers in Figma to copy</li>\n\t\t\t\t\t<li>Click on the Framer plugin</li>\n\t\t\t\t\t<li>Paste layers in Framer</li>\n\t\t\t\t</ol>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.ActionButton>Get Plugin</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { Modal } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport tutorialVideoCover from \"./assets/tutorialVideoCover.jpg\"\n\nconst videoTutorialURL = \"https://youtu.be/HVndoTUI1JY\"\n\nexport function FigmaImportTutorialModal() {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst openVideoInNewTab = () => {\n\t\topenNewTab(videoTutorialURL)\n\t\trecord(\"ui_interaction\", { id: UIInteraction.openFigmaTutorialLink, page: Pages.figmaImportTutorialModal })\n\t\tengine.stores.modalStore.dismiss()\n\t}\n\n\tconst dismiss = () => {\n\t\trecord(\"ui_interaction\", { id: UIInteraction.dismissFigmaTutorialModal, page: Pages.figmaImportTutorialModal })\n\t\tengine.stores.modalStore.dismiss()\n\t}\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.figmaImportTutorialModal })\n\n\treturn (\n\t\t<Modal.Root hasBackdrop onDismiss={dismiss} onConfirm={openVideoInNewTab} {...modalThemeProps}>\n\t\t\t<Modal.Header closeButton separator={false}>\n\t\t\t\tImporting from Figma\n\t\t\t</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Image src={tutorialVideoCover} alt=\"Figma import video tutorial\" />\n\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tLearn how to import your designs from Figma turning them into a real, responsive website to publish in Framer.\n\t\t\t\t</Modal.Text>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.ActionButton>Watch Tutorial</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { Emoji, Modal, Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useMemo } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport { getFlagEmojiForLocaleCode } from \"../shared/getFlagEmojiForLocaleCode.ts\"\nimport { isLocaleCode } from \"../shared/locales.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./LocaleReadyModal.styles.ts\"\n\nconst dismiss = engine.stores.modalStore.dismiss\n\nexport function LocaleReadyModal({ activeLocale }: ModalProps<ModalType.LocaleReady>) {\n\tconst { isDarkMode } = useDarkMode()\n\tconst hasEmojiFlag = useMemo<boolean>(() => {\n\t\tconst localeCode = activeLocale.code\n\t\tconst isValidLocaleCode = isLocaleCode(localeCode)\n\t\tif (!isValidLocaleCode) return false\n\t\tconst emoji = getFlagEmojiForLocaleCode(localeCode)\n\t\treturn Boolean(emoji)\n\t}, [activeLocale])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<Modal.Root onDismiss={dismiss} {...modalThemeProps}>\n\t\t\t<Modal.Header>Reached 100%</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>{`You've fully translated ${activeLocale.name}. Would you like to mark this locale as Ready?`}</Modal.Text>\n\t\t\t\t<Stack gap={0} direction=\"column\" alignItems=\"center\" justifyContent=\"center\" className={styles.flagWrapper}>\n\t\t\t\t\t<div className={cx(styles.background, hasEmojiFlag && styles.backgroundWithFlag)}>\n\t\t\t\t\t\t{hasEmojiFlag && <LocaleFlag localeCode={activeLocale.code} emojiClassName={styles.backgroundFlag} />}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={styles.flagContainer}>\n\t\t\t\t\t\t<div className={cx(styles.shadow, isDarkMode && styles.shadowDark)}>\n\t\t\t\t\t\t\t{hasEmojiFlag ? (\n\t\t\t\t\t\t\t\t<LocaleFlag localeCode={activeLocale.code} emojiClassName={styles.shadowFlag} />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Emoji emojiClassName={styles.shadowFlag}>\uD83C\uDF89</Emoji>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{hasEmojiFlag ? (\n\t\t\t\t\t\t\t<LocaleFlag localeCode={activeLocale.code} emojiClassName={styles.flag} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Emoji emojiClassName={styles.flag}>\uD83C\uDF89</Emoji>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton>Not Now</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton\n\t\t\t\t\tonClick={engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\tconst currentLocales = engine.tree.root.locales\n\t\t\t\t\t\tif (!currentLocales) return\n\t\t\t\t\t\tconst locales = currentLocales.map(locale => {\n\t\t\t\t\t\t\tif (locale.id !== activeLocale.id) return locale\n\t\t\t\t\t\t\trecord(\"locale_update\", {\n\t\t\t\t\t\t\t\tdraft: false,\n\t\t\t\t\t\t\t\tcode: locale.code,\n\t\t\t\t\t\t\t\tname: locale.name,\n\t\t\t\t\t\t\t\tslug: locale.slug,\n\t\t\t\t\t\t\t\thasFallback: Boolean(locale.fallback),\n\t\t\t\t\t\t\t\tsource: \"locale_ready_modal\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn { ...locale, draft: false }\n\t\t\t\t\t\t})\n\t\t\t\t\t\tengine.tree.root.set({ locales })\n\n\t\t\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\tMark as Ready\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import \"LocaleReadyModal.styles_qsa2a.wyw.css\"; export const flagWrapper = \"flagWrapper_f1y7od8q\";\nexport const background = \"background_be4a43g\";\nexport const backgroundWithFlag = \"backgroundWithFlag_b3k0ng8\";\nexport const backgroundFlag = \"backgroundFlag_bo01zr3\";\nexport const flagContainer = \"flagContainer_f18dizsm\";\nexport const flag = \"flag_f4sk1ey\";\nexport const shadow = \"shadow_sx4nbd1\";\nexport const shadowDark = \"shadowDark_s1i5rpz3\";\nexport const shadowFlag = \"shadowFlag_s88s9hd\";", "import { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tContextMenuButton,\n\tEmptyState,\n\ttype EmptyStateProps,\n\tReadOnlyContext,\n\tSearchBar,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n\tTextArea,\n\tTextInput,\n\ttruncateWithEllipsis,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport {\n\tLOCALIZATION_GLOSSARY_ID,\n\tLocalizationGlossaryNode,\n} from \"document/models/CanvasTree/nodes/LocalizationGlossaryNode.ts\"\nimport { forwardRef, useEffect, useMemo, useRef, useState } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { compareStringsNaturally } from \"utils/compareStringsNaturally.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { EngineChange } from \"../../../EngineChanges.ts\"\nimport type { NodeID } from \"../../../models/CanvasTree/index.ts\"\nimport { LocalizationGlossaryItemNode } from \"../../../models/CanvasTree/nodes/LocalizationGlossaryItemNode.ts\"\nimport { isLocalizationGlossaryItemNode } from \"../../../models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"../../../useEngineState.ts\"\nimport { IconGlossaryFill } from \"../projectbar/icons/IconGlossaryFill.tsx\"\nimport { IconSectionHeaderPlus } from \"../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport {\n\ttitle as panelRowTitle,\n\ttitleWrapper as panelRowTitleWrapper,\n} from \"../properties/rows/PanelRowTitle.styles.ts\"\nimport { PanelRowView } from \"../properties/rows/PanelRowView.tsx\"\nimport { doubleColumnClass } from \"../properties/utils/doubleColumn.styles.ts\"\nimport { ModalWithSidebar } from \"../shared/ModalWithSidebar.tsx\"\nimport { ModalToolbarButton } from \"../shared/VariablesModal/ModalToolbarButton.tsx\"\nimport { getNoSearchResultProps } from \"../shared/utils/getNoSearchResultProps.ts\"\nimport * as styles from \"./LocalizationGlossaryModal.styles.ts\"\nimport { getTranslationForLocale } from \"./glossaryUtils.ts\"\nimport { useLocales } from \"./useLocales.ts\"\n\nexport function LocalizationGlossaryModal() {\n\tconst isReadOnly = useIsViewOnly(\"canEditLocalizedValues\")\n\n\tusePreloadedScope(LOCALIZATION_GLOSSARY_ID)\n\n\tconst glossaryItems = useEngineState(\n\t\t(): readonly LocalizationGlossaryItemNode[] => {\n\t\t\tconst glossary = LocalizationGlossaryNode.get(engine.tree)\n\t\t\tif (!glossary?.isLoaded()) return emptyArray<LocalizationGlossaryItemNode>()\n\t\t\treturn glossary.children.toArray()\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst [searchString, setSearchString] = useState(\"\")\n\n\tconst sortedAndFilteredItems = useMemo(\n\t\t() =>\n\t\t\tglossaryItems\n\t\t\t\t.filter(item => {\n\t\t\t\t\tconst searchStringLowerCased = searchString.toLowerCase()\n\t\t\t\t\tconst includesInTerm = item.term.toLowerCase().includes(searchStringLowerCased)\n\t\t\t\t\tif (includesInTerm) return true\n\n\t\t\t\t\treturn Object.values(item.translations).some(({ value }) =>\n\t\t\t\t\t\tvalue.toLowerCase().includes(searchStringLowerCased),\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t\t.toSorted((a, b) => compareStringsNaturally(a.term, b.term)),\n\t\t[glossaryItems, searchString],\n\t)\n\n\tconst [rawSelectedItemId, setRawSelectedItemId] = useState<NodeID | null>(() => sortedAndFilteredItems[0]?.id || null)\n\n\t// In case the selectedGlossaryItemId has been otherwise removed from the tree\n\tconst selectedItemId = useEngineState(\n\t\t() => (engine.tree.has(rawSelectedItemId) ? rawSelectedItemId : null),\n\t\t[rawSelectedItemId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst termInputRef = useRef<HTMLInputElement>(null)\n\n\tconst addAndSelectGlossaryItem = () => {\n\t\tconst existingNewNode = glossaryItems.find(item => item.term === \"\")\n\t\tif (existingNewNode) {\n\t\t\tsetSearchString(\"\")\n\t\t\tsetRawSelectedItemId(existingNewNode.id)\n\t\t\ttermInputRef.current?.focus()\n\t\t\treturn\n\t\t}\n\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tconst newNode = new LocalizationGlossaryItemNode()\n\t\t\tconst glossaryNode = LocalizationGlossaryNode.ensure(engine.tree)\n\t\t\tengine.tree.insertNode(newNode, glossaryNode.id)\n\t\t\tsetRawSelectedItemId(newNode.id)\n\t\t\tsetSearchString(\"\")\n\t\t})\n\t}\n\n\tconst duplicateGlossaryItem = (nodeId: NodeID) => {\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\tif (node) {\n\t\t\t\tconst clone = node.clone()\n\t\t\t\tassert(isLocalizationGlossaryItemNode(clone), \"Cloned node is not a glossary item\")\n\t\t\t\tclone.set({\n\t\t\t\t\tterm: `${clone.term} (Copy)`,\n\t\t\t\t})\n\t\t\t\tconst glossaryNode = LocalizationGlossaryNode.ensure(engine.tree)\n\t\t\t\tengine.tree.insertNode(clone, glossaryNode.id)\n\t\t\t\tsetRawSelectedItemId(clone.id)\n\t\t\t}\n\t\t})\n\t}\n\n\tconst deleteGlossaryItem = (nodeId: NodeID) => {\n\t\tengine.scheduler.process(() => engine.deleteNode(nodeId))\n\t}\n\n\tconst selectedItemIndex = sortedAndFilteredItems.findIndex(item => item.id === selectedItemId)\n\t// we want to update scroll on selectedItemIndex change, so if user changes term and it changes position\n\t// in the list (the list is sorted in alphabetical order) - it is still visible for user.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tuseEffect(() => {\n\t\tif (!selectedItemId) return\n\t\tconst selectedItemElement = selectedItemId && document.querySelector(`#${getGlossaryItemElementId(selectedItemId)}`)\n\t\tif (selectedItemElement) {\n\t\t\tselectedItemElement.scrollIntoView({\n\t\t\t\tblock: \"nearest\",\n\t\t\t\tbehavior: \"auto\",\n\t\t\t})\n\t\t}\n\t}, [selectedItemId, selectedItemIndex])\n\n\tconst selectedItemSatisfiesSearch = !searchString || sortedAndFilteredItems.some(item => item.id === selectedItemId)\n\tconst isEmpty = glossaryItems.length === 0\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={isReadOnly}>\n\t\t\t<ModalWithSidebar\n\t\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\t\tmodalTitle={Dictionary.Glossary}\n\t\t\t\thideSidebar={isEmpty}\n\t\t\t\tthemeOverrideMode=\"darkOnDarkModal\"\n\t\t\t\t// We need to to use HandleClickOnClick to account for pressing this button when\n\t\t\t\t// still on a \"new item\". Mouse-down behavior would not have persisted a new value\n\t\t\t\t// to the tree yet, and would mean this button re-selects the current (no longer new)\n\t\t\t\t// node.\n\t\t\t\ttoolbarActions={\n\t\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t\t<ModalToolbarButton title=\"Add term\" onClick={addAndSelectGlossaryItem} enabled={!isReadOnly}>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</ModalToolbarButton>\n\t\t\t\t\t</HandleClickOnClick>\n\t\t\t\t}\n\t\t\t\tsidebarHeader={\n\t\t\t\t\t<SearchBar\n\t\t\t\t\t\tclassName={styles.searchBar}\n\t\t\t\t\t\tvalue={searchString}\n\t\t\t\t\t\tonChange={setSearchString}\n\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\tisIconVisible\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsidebarContent={\n\t\t\t\t\t<Stack direction=\"column\" gap={5}>\n\t\t\t\t\t\t{sortedAndFilteredItems.map(({ term, id }) => (\n\t\t\t\t\t\t\t<GlossaryTermsRow\n\t\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\tterm={term}\n\t\t\t\t\t\t\t\tselected={selectedItemId === id}\n\t\t\t\t\t\t\t\tonClick={setRawSelectedItemId}\n\t\t\t\t\t\t\t\tonDelete={deleteGlossaryItem}\n\t\t\t\t\t\t\t\tonDuplicate={duplicateGlossaryItem}\n\t\t\t\t\t\t\t\tisReadOnly={isReadOnly}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Stack>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{selectedItemId && selectedItemSatisfiesSearch ? (\n\t\t\t\t\t<GlossaryTermDetails nodeId={selectedItemId} ref={termInputRef} />\n\t\t\t\t) : (\n\t\t\t\t\t<EmptyDetail totalItemCount={glossaryItems.length} visibleItemCount={sortedAndFilteredItems.length} />\n\t\t\t\t)}\n\t\t\t</ModalWithSidebar>\n\t\t</ReadOnlyContext.Provider>\n\t)\n}\n\ninterface GlossaryTermsRowProps {\n\tid: string\n\tterm: string\n\tselected: boolean\n\tonClick: (id: string) => void\n\tonDuplicate: (id: string) => void\n\tonDelete: (id: string) => void\n\tisReadOnly: boolean\n}\n\nconst getGlossaryItemElementId = (id: string) => `glossary-item-${id}`\n\nfunction GlossaryTermsRow({ id, term, selected, onClick, onDuplicate, onDelete, isReadOnly }: GlossaryTermsRowProps) {\n\tconst [isMenuOpen, setIsMenuOpen] = useState(false)\n\n\tfunction displayContextMenu({ clientX, clientY }: React.MouseEvent) {\n\t\tsetIsMenuOpen(true)\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tenabled: !isReadOnly && term !== \"\",\n\t\t\t\t\tclick: () => onDuplicate(id),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t\tclick: () => onDelete(id),\n\t\t\t\t},\n\t\t\t],\n\t\t\t{\n\t\t\t\tlocation: { x: clientX, y: clientY },\n\t\t\t\tonDone: () => setIsMenuOpen(false),\n\t\t\t},\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tid={getGlossaryItemElementId(id)}\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tpaddingLeft={dimensions.css.inputSpacing}\n\t\t\tpaddingRight={5}\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tonClick={() => onClick(id)}\n\t\t\tonContextMenu={displayContextMenu}\n\t\t\tclassName={cx(styles.row, selected && styles.selectedRow)}\n\t\t>\n\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>{term || \"New Term\"}</div>\n\t\t\t<ContextMenuButton\n\t\t\t\tclassName={cx(styles.contextMenuButton, isMenuOpen && styles.contextMenuButtonActive)}\n\t\t\t\tonClick={event => {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tdisplayContextMenu(event)\n\t\t\t\t}}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\ninterface GlossaryTermDetailsProps {\n\tnodeId: NodeID\n}\n\nconst GlossaryTermDetails = forwardRef<HTMLInputElement, GlossaryTermDetailsProps>(function GlossaryTermDetails(\n\t{ nodeId },\n\ttermInputRef,\n) {\n\tconst glossaryItem = useEngineState(() => engine.tree.getNode(nodeId), [nodeId], [EngineChange.Tree])\n\tconst locales = useLocales()\n\tconst isReadOnly = useReadOnly()\n\n\tif (!isLocalizationGlossaryItemNode(glossaryItem)) {\n\t\treturn null\n\t}\n\n\tconst changeTerm = (value: string, _final: boolean, reset: () => void) => {\n\t\tif (!value.trim()) {\n\t\t\t// Stop users from setting an empty string as a term\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\t\tengine.scheduler.process(() => {\n\t\t\tconst latestGlossaryItem = engine.tree.current(glossaryItem)\n\t\t\tlatestGlossaryItem?.set({ term: value })\n\t\t})\n\t}\n\n\tconst changeHandler = (\n\t\tvalue: Pick<\n\t\t\tPartial<LocalizationGlossaryItemNode>,\n\t\t\t\"description\" | \"caseSensitive\" | \"translatable\" | \"translations\"\n\t\t>,\n\t) => {\n\t\tengine.scheduler.process(() => {\n\t\t\tconst latestGlossaryItem = engine.tree.current(glossaryItem)\n\t\t\tlatestGlossaryItem?.set(value)\n\t\t})\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tpadding={dimensions.css.inputSpacing}\n\t\t\tpaddingRight={dimensions.css.modalPadding}\n\t\t>\n\t\t\t<Stack direction=\"column\" gap={0}>\n\t\t\t\t<PanelRowView title=\"Term\">\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={termInputRef}\n\t\t\t\t\t\tautoFocus={glossaryItem.term === \"\"}\n\t\t\t\t\t\tvalue={glossaryItem.term}\n\t\t\t\t\t\tonChange={changeTerm}\n\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRowView>\n\n\t\t\t\t<PanelRowView title=\"Description\">\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tvalue={glossaryItem.description}\n\t\t\t\t\t\tonChange={description => changeHandler({ description })}\n\t\t\t\t\t\tminRows={2}\n\t\t\t\t\t\tmaxRows={10}\n\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRowView>\n\n\t\t\t\t<PanelRowView title=\"Case Sensitive\">\n\t\t\t\t\t<BooleanSegmentedControl\n\t\t\t\t\t\tvalue={glossaryItem.caseSensitive}\n\t\t\t\t\t\tonSelect={caseSensitive => changeHandler({ caseSensitive })}\n\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRowView>\n\n\t\t\t\t<PanelRowView title=\"Translatable\">\n\t\t\t\t\t<BooleanSegmentedControl\n\t\t\t\t\t\tvalue={glossaryItem.translatable}\n\t\t\t\t\t\tonSelect={translatable => changeHandler({ translatable })}\n\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRowView>\n\t\t\t</Stack>\n\n\t\t\t<Stack className={styles.translationsPanel} gap={0}>\n\t\t\t\t<div className={styles.translationsHeading}>Translations</div>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap={0}\n\t\t\t\t\tclassName={cx(!glossaryItem.translatable && styles.disabledTranslations)}\n\t\t\t\t\t// Force re-render when the translatable prop changes. The\n\t\t\t\t\t// translated value can get stuck when disabling translation\n\t\t\t\t\t// directly after adding a value here.\n\t\t\t\t\tkey={`${glossaryItem.translatable ? \"enabled\" : \"disabled\"}`}\n\t\t\t\t>\n\t\t\t\t\t{locales.map(locale => {\n\t\t\t\t\t\tconst existingTranslation = glossaryItem.translations[locale.id]?.value\n\t\t\t\t\t\tconst textFieldValue = glossaryItem.translatable && existingTranslation ? existingTranslation : \"\"\n\n\t\t\t\t\t\tlet placeholder: string | undefined = glossaryItem.term\n\t\t\t\t\t\tif (glossaryItem.translatable) {\n\t\t\t\t\t\t\tif (locale.fallback) {\n\t\t\t\t\t\t\t\tplaceholder = getTranslationForLocale(locale.fallback, glossaryItem, locales) || undefined\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// we ignore translatable terms which user didn't translate and which don't have a fallback\n\t\t\t\t\t\t\t\tplaceholder = undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PanelRowView key={locale.id}>\n\t\t\t\t\t\t\t\t<div className={panelRowTitleWrapper}>\n\t\t\t\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, panelRowTitle)}>\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.inputSpacing}>\n\t\t\t\t\t\t\t\t\t\t\t<LocaleFlag localeCode={locale.code} />\n\t\t\t\t\t\t\t\t\t\t\t<span className={truncateWithEllipsis}>{locale.name}</span>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\t\t\t\t\tconst sanitizedValue = value.trim()\n\t\t\t\t\t\t\t\t\t\tconst { [locale.id]: oldTranslation, ...translationsToSave } = glossaryItem.translations\n\n\t\t\t\t\t\t\t\t\t\tif (sanitizedValue) {\n\t\t\t\t\t\t\t\t\t\t\ttranslationsToSave[locale.id] = { value: sanitizedValue }\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tchangeHandler({\n\t\t\t\t\t\t\t\t\t\t\ttranslations: translationsToSave,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tvalue={textFieldValue}\n\t\t\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\t\t\tenabled={glossaryItem.translatable && !isReadOnly}\n\t\t\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PanelRowView>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n\nfunction BooleanSegmentedControl({\n\tvalue,\n\tonSelect,\n\tenabled,\n}: {\n\tvalue: boolean\n\tonSelect: (value: boolean) => void\n\tenabled: boolean\n}) {\n\treturn (\n\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={true}\n\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\tselected={value}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\tenabled={enabled}\n\t\t\t/>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={false}\n\t\t\t\ttitle={Dictionary.No}\n\t\t\t\tselected={!value}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\tenabled={enabled}\n\t\t\t/>\n\t\t</SegmentedControl>\n\t)\n}\n\nfunction EmptyDetail({ totalItemCount, visibleItemCount }: { totalItemCount: number; visibleItemCount: number }) {\n\tlet props: EmptyStateProps = {\n\t\ticon: <IconGlossaryFill />,\n\t\ttitle: Dictionary.Glossary,\n\t\tbody: undefined,\n\t}\n\n\tif (totalItemCount === 0) {\n\t\tprops.body = `A glossary ensures key terms are always translated your way. Start by adding a term.`\n\t} else if (visibleItemCount === 0) {\n\t\tprops = getNoSearchResultProps()\n\t} else {\n\t\tprops.body = \"Select a term from the sidebar\"\n\t}\n\n\treturn (\n\t\t<EmptyState\n\t\t\tcenter\n\t\t\ticonLarge\n\t\t\tmaxBodyWidth={185}\n\t\t\ticonColor={colors.tint}\n\t\t\ticonBackgroundColor={colors.tintDimmed}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n", "export function IconGlossaryFill() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"15\" fill=\"none\">\n\t\t\t<path\n\t\t\t\td=\"M 0 2 C 0 0.895 0.895 0 2 0 L 8 0 C 9.105 0 10 0.895 10 2 L 10 12.755 C 10 13.62 8.975 14.077 8.331 13.498 L 5.669 11.102 C 5.289 10.76 4.711 10.76 4.331 11.102 L 1.669 13.498 C 1.025 14.077 0 13.62 0 12.755 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import {\n\tButton,\n\tCenterChild,\n\tCustomModal,\n\tIconArrowLeft,\n\ttype ModalProps,\n\tScroll,\n\tStack,\n\tThemeOverride,\n\ttype ThemeOverrideMode,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./ModalWithSidebar.styles.ts\"\n\nconst maxContentHeight = 485\n\ninterface ModalWithSidebarProps extends Omit<ModalProps, \"visible\" | \"legacy\" | \"variant\" | \"darkOnDark\"> {\n\tmodalTitle: string\n\tpreferredContentHeight?: number\n\tonConfirm?: VoidFunction\n\tconfirmEnabled?: boolean\n\tthemeOverrideMode?: ThemeOverrideMode\n\tonBack?: VoidFunction\n\n\thideSidebar?: boolean\n\tsidebarHeader?: React.ReactNode\n\tsidebarContent: React.ReactNode\n\ttoolbarActions?: React.ReactNode\n\t/**\n\t * Whether the modal implements a scrollable sidebar (and associated padding). Switch off when\n\t * passing a Scroll component within sidebarContent.\n\t */\n\tscrollableSidebar?: boolean\n}\n\nexport function ModalWithSidebar({\n\tclassName,\n\tmodalTitle,\n\tchildren,\n\tonConfirm,\n\tonBack,\n\tsidebarContent,\n\tconfirmEnabled = true,\n\ttoolbarActions,\n\thideSidebar = false,\n\tsidebarHeader,\n\tonKeyDown,\n\tpreferredContentHeight = maxContentHeight,\n\tthemeOverrideMode,\n\tscrollableSidebar = true,\n\t...props\n}: ModalWithSidebarProps) {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tconst handleSubmit = useCallback(\n\t\t(event: React.FormEvent) => {\n\t\t\tevent.preventDefault()\n\t\t\tif (!confirmEnabled) return\n\t\t\tonConfirm?.()\n\t\t},\n\t\t[onConfirm, confirmEnabled],\n\t)\n\n\tconst handleKeydown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tonKeyDown?.(event)\n\n\t\t\tif (event.defaultPrevented) return\n\t\t\tif (!confirmEnabled) return\n\t\t\tif (event.key !== \"Enter\") return\n\t\t\tif (!onConfirm) return\n\n\t\t\tevent.preventDefault()\n\t\t\tonConfirm()\n\t\t},\n\t\t[confirmEnabled, onConfirm, onKeyDown],\n\t)\n\n\treturn (\n\t\t<ThemeOverride mode={themeOverrideMode}>\n\t\t\t<CustomModal\n\t\t\t\tvisible\n\t\t\t\t{...props}\n\t\t\t\tonKeyDown={handleKeydown}\n\t\t\t\tclassName={cx(styles.modal, className)}\n\t\t\t\t{...modalThemeProps}\n\t\t\t>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap={0}\n\t\t\t\t\tjustifyContent=\"stretch\"\n\t\t\t\t\tclassName={styles.container}\n\t\t\t\t\tstyle={{ height: Math.max(maxContentHeight, preferredContentHeight) }}\n\t\t\t\t>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\tclassName={cx(truncateWithEllipsis, styles.header)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{onBack && (\n\t\t\t\t\t\t\t<Button variant=\"withDepth\" title=\"Back\" onClick={onBack} className={styles.backButton}>\n\t\t\t\t\t\t\t\t<CenterChild className={styles.noShrink}>\n\t\t\t\t\t\t\t\t\t<IconArrowLeft />\n\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span className={cx(styles.title, truncateWithEllipsis)}>{modalTitle}</span>\n\t\t\t\t\t\t<Stack direction=\"row\" gap={0} className={styles.toolbar}>\n\t\t\t\t\t\t\t{toolbarActions}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<form onSubmit={handleSubmit} className={styles.content}>\n\t\t\t\t\t\t<Stack direction=\"row\" gap={0} className={styles.sidebarAndDetailWrapper}>\n\t\t\t\t\t\t\t{!hideSidebar && (\n\t\t\t\t\t\t\t\t<Stack direction=\"column\" gap={0} className={styles.sidebar}>\n\t\t\t\t\t\t\t\t\t{!!sidebarHeader && <div className={styles.sidebarHeader}>{sidebarHeader}</div>}\n\t\t\t\t\t\t\t\t\t{scrollableSidebar ? (\n\t\t\t\t\t\t\t\t\t\t<Scroll className={cx(styles.sidebarContent, styles.sidebarScrollContent)}>{sidebarContent}</Scroll>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<div className={cx(styles.sidebarContent)}>{sidebarContent}</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<Scroll className={styles.detail}>{children}</Scroll>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</form>\n\t\t\t\t</Stack>\n\t\t\t</CustomModal>\n\t\t</ThemeOverride>\n\t)\n}\n", "import \"ModalWithSidebar.styles_vj1lj6.wyw.css\"; export const modal = \"modal_m76567h\";\nexport const container = \"container_c5f6r0t\";\nexport const title = \"title_t1q78a49\";\nexport const header = \"header_h1u727jd\";\nexport const content = \"content_cm3spoz\";\nexport const sidebarAndDetailWrapper = \"sidebarAndDetailWrapper_s19f06gs\";\nexport const sidebar = \"sidebar_s1042ow3\";\nexport const sidebarHeader = \"sidebarHeader_s1i8r2e0\";\nexport const sidebarContent = \"sidebarContent_s1n3rd6g\";\nexport const sidebarScrollContent = \"sidebarScrollContent_svnksd3\";\nexport const detail = \"detail_d5wjdnd\";\nexport const toolbar = \"toolbar_t1wvh4hk\";\nexport const backButton = \"backButton_b1utsdg7\";\nexport const noShrink = \"noShrink_nxz97lf\";", "import { ReadOnlyContext, useReadOnly } from \"@framerjs/fresco\"\nimport {\n\tPanelSectionHeaderButton,\n\ttype PanelSectionHeaderButtonProps,\n} from \"../../properties/panels/PanelSectionHeaderButton.tsx\"\n\ninterface Props extends PanelSectionHeaderButtonProps {\n\tenabled?: boolean\n}\n\nexport function ModalToolbarButton({ className, enabled = true, ...props }: Props) {\n\tconst readOnly = useReadOnly()\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={!enabled || readOnly}>\n\t\t\t<PanelSectionHeaderButton className={className} {...props} />\n\t\t</ReadOnlyContext.Provider>\n\t)\n}\n", "import \"LocalizationGlossaryModal.styles_rfo3g0.wyw.css\"; export const contextMenuButton = \"contextMenuButton_c1pwcbm7\";\nexport const contextMenuButtonActive = \"contextMenuButtonActive_cxhjtjv\";\nexport const row = \"row_rkcf448\";\nexport const selectedRow = \"selectedRow_s1tdogd0\";\nexport const rowTitle = \"rowTitle_rlfbsu5\";\nexport const translationsPanel = \"translationsPanel_t1xfy29\";\nexport const translationsHeading = \"translationsHeading_taic914\";\nexport const disabledTranslations = \"disabledTranslations_dnqsy0f\";\nexport const searchBar = \"searchBar_s1ln0rnv\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\n\nconst noLocales: readonly Locale[] = []\n\nexport function useLocales() {\n\treturn useDeprecatedEngineState([EngineChange.Tree], () => {\n\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return noLocales\n\t\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\t\treturn tree.root.locales ?? noLocales\n\t})\n}\n", "import { IconArrowKeys, IconShiftKey, Modal, NumberInputWithTicker, Text } from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { isAppleDevice } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./NudgePreferencesModal.styles.ts\"\n\ninterface NudgePreferencesModalInnerProps {\n\tsmallNudgeIncrement: number\n\tlargeNudgeIncrement: number\n}\n\nconst NudgePreferencesModalInner = ({ smallNudgeIncrement, largeNudgeIncrement }: NudgePreferencesModalInnerProps) => {\n\tconst [smallIncrement, setSmallIncrement] = React.useState(smallNudgeIncrement)\n\tconst [largeIncrement, setLargeIncrement] = React.useState(largeNudgeIncrement)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst onSmallIncrementChange = (value: number) => {\n\t\tengine.stores.persistedUserDefaults.smallNudgeIncrement = value\n\t\tsetSmallIncrement(value)\n\t}\n\tconst onLargeIncrementChange = (value: number) => {\n\t\tengine.stores.persistedUserDefaults.largeNudgeIncrement = value\n\t\tsetLargeIncrement(value)\n\t}\n\n\treturn (\n\t\t<Modal.Root onDismiss={engine.stores.modalStore.dismiss} className={styles.modal} {...modalThemeProps}>\n\t\t\t<Modal.Header closeButton>Nudge Amount</Modal.Header>\n\t\t\t<Modal.Content className={styles.content}>\n\t\t\t\t<div className={styles.infoRow}>\n\t\t\t\t\t<div className={styles.infoDescription}>\n\t\t\t\t\t\t<Text size={fonts.size.base}>Use</Text>\n\n\t\t\t\t\t\t<span style={{ margin: \"0 10px\" }}>\n\t\t\t\t\t\t\t<IconArrowKeys />\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t<Text size={fonts.size.base}>to move layers by</Text>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\twrapperStyle={{ width: 68 }}\n\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\tvalue={smallIncrement}\n\t\t\t\t\t\tonChange={onSmallIncrementChange}\n\t\t\t\t\t\tlabel=\"px\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.infoRow}>\n\t\t\t\t\t<div className={styles.infoDescription}>\n\t\t\t\t\t\t<Text size={fonts.size.base}>\n\t\t\t\t\t\t\t{\"Additionally, hold \"}\n\t\t\t\t\t\t\t<span className={styles.shift}>\n\t\t\t\t\t\t\t\t{isAppleDevice() ? <IconShiftKey /> : <span className={styles.shiftWindowsIcon}>Shift</span>}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{\" to move by\"}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\twrapperStyle={{ width: 68 }}\n\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\tvalue={largeIncrement}\n\t\t\t\t\t\tonChange={onLargeIncrementChange}\n\t\t\t\t\t\tlabel=\"px\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Modal.Content>\n\t\t</Modal.Root>\n\t)\n}\n\nexport function NudgePreferencesModal() {\n\tconst { smallNudgeIncrement, largeNudgeIncrement } = useDeprecatedEngineState(EngineChange.UserDefaultsStore, () => ({\n\t\tsmallNudgeIncrement: engine.stores.persistedUserDefaults.smallNudgeIncrement,\n\t\tlargeNudgeIncrement: engine.stores.persistedUserDefaults.largeNudgeIncrement,\n\t}))\n\n\treturn (\n\t\t<NudgePreferencesModalInner smallNudgeIncrement={smallNudgeIncrement} largeNudgeIncrement={largeNudgeIncrement} />\n\t)\n}\n", "import \"NudgePreferencesModal.styles_1hqb93m.wyw.css\"; export const infoRow = \"infoRow_i1jmx58h\";\nexport const content = \"content_c8yjjwe\";\nexport const modal = \"modal_m8xjuf5\";\nexport const infoDescription = \"infoDescription_iiiabzy\";\nexport const shift = \"shift_sebnvg9\";\nexport const shiftWindowsIcon = \"shiftWindowsIcon_s11bses1\";", "import { delay } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { BatchTranslation, initialBatchTranslationState } from \"../localization/BatchTranslation.ts\"\nimport * as styles from \"./BatchTranslateModal.styles.ts\"\nimport { ProgressModal } from \"./ProgressModal.tsx\"\n\nfunction dismiss() {\n\t// There might be \"undraft\" modals higher up in the stack, so we want to ensure we only dismiss the batch translate modal\n\tengine.stores.modalStore.dismissModal(ModalType.BatchTranslate)\n}\n\nfunction openLocaleReadyModals(localesWithKeyPaths: ModalProps<ModalType.BatchTranslate>[\"localesWithKeyPaths\"]) {\n\tfor (const { locale } of localesWithKeyPaths) {\n\t\tif (!locale.draft) continue\n\n\t\tconst progressAfterUpdate = engine.stores.localizationStore.progressPerLocale[locale.id]\n\t\tif (progressAfterUpdate !== 1) continue\n\n\t\tengine.stores.modalStore.push({\n\t\t\ttype: ModalType.LocaleReady,\n\t\t\tactiveLocale: locale,\n\t\t\tsource: \"automatic\",\n\t\t})\n\t}\n}\n\nexport function BatchTranslateModal({ localesWithKeyPaths }: ModalProps<ModalType.BatchTranslate>) {\n\tconst [currentLocaleIndex, setCurrentLocaleIndex] = React.useState(0)\n\tconst [currentLocaleState, setCurrentLocaleState] = React.useState(initialBatchTranslationState)\n\tconst [completedItemCount, setCompletedItemCount] = React.useState(0)\n\tconst batchTranslationRef = React.useRef<BatchTranslation | null>(null)\n\n\tReact.useEffect(() => {\n\t\tlet hasBegunUndoGroup = false\n\t\tlet hasRunCleanup = false\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tif (hasRunCleanup) return\n\t\t\tengine.beginUndoGroup()\n\t\t\thasBegunUndoGroup = true\n\t\t})\n\n\t\treturn () => {\n\t\t\thasRunCleanup = true\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tif (!hasBegunUndoGroup) return\n\t\t\t\tengine.endUndoGroup()\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tconst totalItemCount = React.useMemo(() => {\n\t\treturn localesWithKeyPaths.reduce((sum, entry) => sum + entry.keyPaths.size, 0)\n\t}, [localesWithKeyPaths])\n\n\tconst currentEntry = localesWithKeyPaths[currentLocaleIndex]\n\tconst isPersistingPartialResults = currentLocaleState.type === \"persistingPartialResults\"\n\n\tconst stopTranslation = React.useCallback(() => {\n\t\tbatchTranslationRef.current?.stop()\n\t}, [])\n\n\tconst handleDismiss = React.useCallback(() => {\n\t\tif (currentLocaleState.type === \"done\" || currentLocaleState.type === \"stopped\") {\n\t\t\tdismiss()\n\t\t\treturn\n\t\t}\n\n\t\tstopTranslation()\n\t}, [stopTranslation, currentLocaleState.type])\n\n\tReact.useEffect(() => {\n\t\tif (!currentEntry) return\n\n\t\tconst waitOneSecondFromStart = delay(1000)\n\n\t\tconst batchTranslation = new BatchTranslation(engine, currentEntry.locale, currentEntry.keyPaths, stateUpdate => {\n\t\t\tif (stateUpdate.type === \"done\") {\n\t\t\t\tbatchTranslationRef.current = null\n\n\t\t\t\tconst nextIndex = currentLocaleIndex + 1\n\t\t\t\tif (nextIndex < localesWithKeyPaths.length) {\n\t\t\t\t\tsetCurrentLocaleState(initialBatchTranslationState)\n\t\t\t\t\tsetCompletedItemCount(previous => previous + currentEntry.keyPaths.size)\n\t\t\t\t\tsetCurrentLocaleIndex(nextIndex)\n\t\t\t\t} else {\n\t\t\t\t\tconst waitBrieflyWhenDone = delay(200)\n\t\t\t\t\tvoid Promise.allSettled([waitOneSecondFromStart, waitBrieflyWhenDone]).finally(() => {\n\t\t\t\t\t\tdismiss()\n\t\t\t\t\t\topenLocaleReadyModals(localesWithKeyPaths)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t} else if (stateUpdate.type === \"stopped\") {\n\t\t\t\tbatchTranslationRef.current = null\n\t\t\t\tdismiss()\n\t\t\t} else {\n\t\t\t\tsetCurrentLocaleState(stateUpdate)\n\t\t\t}\n\t\t})\n\t\tbatchTranslationRef.current = batchTranslation\n\n\t\tbatchTranslation.start()\n\n\t\treturn () => {\n\t\t\tbatchTranslation.stop()\n\t\t\tif (batchTranslationRef.current === batchTranslation) {\n\t\t\t\tbatchTranslationRef.current = null\n\t\t\t}\n\t\t}\n\t}, [currentLocaleIndex, localesWithKeyPaths, currentEntry])\n\n\tconst overallFinishedCount = completedItemCount + currentLocaleState.finishedCount\n\tconst currentLocaleKeyPathsSize = currentEntry?.keyPaths.size ?? 0\n\tconst currentLocaleProgress = currentLocaleState.progress * currentLocaleKeyPathsSize\n\tconst completedProgress = completedItemCount + currentLocaleProgress\n\tconst overallProgress = totalItemCount > 0 ? completedProgress / totalItemCount : 0\n\n\tconst localesRemaining = localesWithKeyPaths.length - currentLocaleIndex - 1\n\tconst localeText = localesRemaining === 1 ? \"locale\" : \"locales\"\n\tconst localesRemainingText = localesRemaining > 0 ? ` ${localesRemaining} ${localeText} remaining. ` : \" \"\n\n\tconst description = `Translating ${currentEntry?.locale.name}.${localesRemainingText}Please keep the project open until the process is complete.`\n\n\treturn (\n\t\t<ProgressModal\n\t\t\ttitle={`AI ${Dictionary.Translate}`}\n\t\t\tdescription={description}\n\t\t\tfinishedCount={overallFinishedCount}\n\t\t\ttotalCount={totalItemCount}\n\t\t\tprogress={overallProgress}\n\t\t\tshowCloseButton={false}\n\t\t\tcompleted={currentLocaleState.type === \"done\"}\n\t\t\tonComplete={dismiss}\n\t\t\tonCancel={stopTranslation}\n\t\t\tonDismiss={handleDismiss}\n\t\t\ttextClassName={styles.modalText}\n\t\t\tcancelButtonText={isPersistingPartialResults ? \"Stopping\u2026\" : \"Stop\"}\n\t\t\tcancelButtonEnabled={!isPersistingPartialResults}\n\t\t/>\n\t)\n}\n", "import \"BatchTranslateModal.styles_9bal9o.wyw.css\"; export const modalText = \"modalText_mlw5h84\";", "import \"ProgressModal.styles_1oi71ec.wyw.css\"; export const label = \"label_l1y2h2pr\";", "import { Modal, Progress } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { formatNumberCompactNotation } from \"document/components/chrome/analytics/utils/formatUtils.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./ProgressModal.styles.ts\"\n\ninterface Props {\n\ttitle: string\n\tdescription: string\n\tfinishedCount?: number\n\ttotalCount?: number\n\thasBackdrop?: boolean\n\tshowCloseButton?: boolean\n\tprogress: number\n\tcompleted: boolean\n\tonComplete: () => void\n\tonCancel: () => void\n\tonDismiss: () => void\n\ttextClassName?: string\n\tcancelButtonText?: string\n\tcancelButtonEnabled?: boolean\n}\n\nexport const ProgressModal = ({\n\ttitle,\n\tdescription,\n\tfinishedCount,\n\ttotalCount,\n\tprogress,\n\thasBackdrop = false,\n\tshowCloseButton = true,\n\tcompleted,\n\tonComplete,\n\tonCancel,\n\tonDismiss,\n\ttextClassName,\n\tcancelButtonText = Dictionary.Cancel,\n\tcancelButtonEnabled = true,\n}: Props) => {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<Modal.Root onDismiss={onDismiss} hasBackdrop={hasBackdrop} {...modalThemeProps}>\n\t\t\t<Modal.Header\n\t\t\t\taccessory={\n\t\t\t\t\t!isUndefined(totalCount) ? (\n\t\t\t\t\t\t<span className={styles.label}>\n\t\t\t\t\t\t\t{formatNumberCompactNotation(finishedCount ?? 0)} / {formatNumberCompactNotation(totalCount)}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : undefined\n\t\t\t\t}\n\t\t\t\tcloseButton={showCloseButton}\n\t\t\t\tseparator={false}\n\t\t\t>\n\t\t\t\t{title}\n\t\t\t</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<Progress value={progress} />\n\t\t\t\t<Modal.Text className={textClassName}>{description}</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer separator={false}>\n\t\t\t\t{completed ? (\n\t\t\t\t\t<Modal.ActionButton onClick={onComplete}>{Dictionary.Done}</Modal.ActionButton>\n\t\t\t\t) : (\n\t\t\t\t\t<Modal.CancelButton onClick={onCancel} enabled={cancelButtonEnabled}>\n\t\t\t\t\t\t{cancelButtonText}\n\t\t\t\t\t</Modal.CancelButton>\n\t\t\t\t)}\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import {\n\tProjectLicensePeriod,\n\tTeamAddOnLicenseType,\n\tgetTeamAddOnLicenseTypeName,\n\topenNewTab,\n} from \"@framerjs/app-shared\"\nimport {\n\tConfirmationModal,\n\tLink,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { assertNever, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { format } from \"date-fns\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { aiFreeCreditsURL, contactSupportURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { PriceItemList, PriceItemRow } from \"web/components/PriceItemRow.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { PollStatus, pollProject } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { formatNumberCommaSeparatorNotation } from \"../../analytics/utils/formatUtils.ts\"\nimport { PaymentErrorStatus, type PaymentError } from \"../../siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { showPaymentErrorToast } from \"../../siteSettings/Plans/Stripe/showPaymentErrorToast.ts\"\nimport * as styles from \"./BuyAiCreditsModal.styles.ts\"\nimport type { CurrentTeamAddOnSubscription } from \"./api/getTeamAddOnPlan.ts\"\nimport {\n\tPreviewTeamAiCreditsStatus,\n\ttype PreviewTeamAiCreditsError,\n\ttype TeamAddOnPreview,\n} from \"./api/previewTeamAddOn.ts\"\nimport { BuyAiCreditsStatus, type BuyAiCreditsState, creditPackOptions, useBuyAiCredits } from \"./useBuyAiCredits.ts\"\n\nconst errorToastKey = \"buy-ai-credits-error\"\n\nconst log = getLogger(\"BuyAiCreditsModal\")\n\ninterface PurchaseContext {\n\tteamId: string\n\tprojectId: string\n\tmonthlyUsage: number\n\tmonthlyLimit: number | null\n}\n\nfunction getPurchaseContext(): PurchaseContext | null {\n\tconst project = engine.stores.projectStore.project\n\tif (project?.space.scope !== \"organization\") return null\n\treturn {\n\t\tteamId: project.space.ownerId,\n\t\tprojectId: project.id,\n\t\tmonthlyUsage: project.usage.aiCredits?.currentMonth ?? 0,\n\t\tmonthlyLimit: project.settings.resourceLimits.aiCredits,\n\t}\n}\n\nexport function BuyAiCreditsModal({ onSuccess }: ModalProps<ModalType.BuyAiCreditsModal>) {\n\tconst context = useEngineState(() => getPurchaseContext(), [], [engine.stores.projectStore])\n\tif (!context) return null\n\treturn <BuyAiCreditsModalGate context={context} onSuccess={onSuccess} />\n}\n\nfunction BuyAiCreditsModalGate({ context, onSuccess }: { context: PurchaseContext; onSuccess?: () => void }) {\n\tconst { state, selectQuantity, selectPeriod, confirm } = useBuyAiCredits({ teamId: context.teamId })\n\n\tconst handleDismiss = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.buyAiCreditsModal, id: UIInteraction.dismiss })\n\t\tengine.stores.modalStore.dismissModal(ModalType.BuyAiCreditsModal)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tswitch (state.status) {\n\t\t\tcase BuyAiCreditsStatus.UpdateSuccess:\n\t\t\t\tengine.stores.modalStore.dismissModal(ModalType.BuyAiCreditsModal)\n\t\t\t\tvoid runPostPurchasePoll(context.projectId, context.monthlyLimit, onSuccess)\n\t\t\t\treturn toast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"success\",\n\t\t\t\t\tprimaryText: state.isFirstPurchase ? \"Purchased credits\" : \"Updated credits\",\n\t\t\t\t\tsecondaryText: \"add-on\",\n\t\t\t\t\tkey: \"successful-buy-ai-credits\",\n\t\t\t\t\ticon: \"success\",\n\t\t\t\t})\n\t\t\tcase BuyAiCreditsStatus.LoadError:\n\t\t\t\tengine.stores.modalStore.dismissModal(ModalType.BuyAiCreditsModal)\n\t\t\t\treturn showLoadErrorToast(state.error)\n\t\t\tcase BuyAiCreditsStatus.PaymentError:\n\t\t\t\t// Dismiss the modal so the toast isn't trapped behind the backdrop; the toast's\n\t\t\t\t// \"Try Again\" action re-opens the modal so the user can confirm afresh.\n\t\t\t\tengine.stores.modalStore.dismissModal(ModalType.BuyAiCreditsModal)\n\t\t\t\treturn showPaymentErrorToast(state.error, {\n\t\t\t\t\tteamId: context.teamId,\n\t\t\t\t\tretry: () => engine.stores.modalStore.set({ type: ModalType.BuyAiCreditsModal, source: \"toast\", onSuccess }),\n\t\t\t\t\tgetPage: buyAiCreditsPaymentErrorPage,\n\t\t\t\t})\n\t\t}\n\t}, [context, state, onSuccess, confirm])\n\n\tif (\n\t\tstate.status === BuyAiCreditsStatus.UpdateSuccess ||\n\t\tstate.status === BuyAiCreditsStatus.LoadError ||\n\t\tstate.status === BuyAiCreditsStatus.PaymentError\n\t) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<BuyAiCreditsModalContent\n\t\t\tstate={state}\n\t\t\tselectQuantity={selectQuantity}\n\t\t\tselectPeriod={selectPeriod}\n\t\t\tconfirm={confirm}\n\t\t\tonDismiss={handleDismiss}\n\t\t\tmonthlyUsage={context.monthlyUsage}\n\t\t\tmonthlyLimit={context.monthlyLimit}\n\t\t/>\n\t)\n}\n\nfunction BuyAiCreditsModalContent({\n\tstate,\n\tselectQuantity,\n\tselectPeriod,\n\tconfirm,\n\tonDismiss,\n\tmonthlyUsage,\n\tmonthlyLimit,\n}: {\n\tstate: Exclude<\n\t\tBuyAiCreditsState,\n\t\t| { status: BuyAiCreditsStatus.LoadError }\n\t\t| { status: BuyAiCreditsStatus.UpdateSuccess }\n\t\t| { status: BuyAiCreditsStatus.PaymentError }\n\t>\n\tselectQuantity: (next: number) => void\n\tselectPeriod: (next: ProjectLicensePeriod) => void\n\tconfirm: () => void\n\tonDismiss: () => void\n\tmonthlyUsage: number\n\tmonthlyLimit: number | null\n}) {\n\tconst { quantity, period, currentAddOn } = state\n\t// \"No changes\" means the form matches the existing add-on \u2014 show a single Dismiss\n\t// button and the current subscription breakdown instead of a price preview.\n\tconst hasChanges = state.status !== BuyAiCreditsStatus.NoChanges\n\tconst subscription = state.status === BuyAiCreditsStatus.NoChanges ? state.subscription : null\n\n\t// Keeps the most recent successful preview visible while a new one loads.\n\tconst previewRef = useRef<TeamAddOnPreview | undefined>(undefined)\n\n\tconst cachedPreview = useMemo(() => {\n\t\tif (state.status === BuyAiCreditsStatus.Preview) {\n\t\t\tpreviewRef.current = state.preview\n\t\t\treturn state.preview\n\t\t}\n\t\treturn previewRef.current\n\t}, [state])\n\n\tconst handleConfirm = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.buyAiCreditsModal, id: UIInteraction.confirmBuyAiCredits })\n\t\tconfirm()\n\t}, [confirm])\n\n\tconst handleQuantityChange = useCallback(\n\t\t(next: number) => {\n\t\t\tif (next === quantity) return\n\t\t\trecord(\"ui_interaction\", { page: Pages.buyAiCreditsModal, id: UIInteraction.changeBuyAiCreditsQuantity })\n\t\t\tselectQuantity(next)\n\t\t},\n\t\t[quantity, selectQuantity],\n\t)\n\n\tconst handlePeriodChange = useCallback(\n\t\t(next: ProjectLicensePeriod) => {\n\t\t\tif (next === period) return\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: Pages.buyAiCreditsModal,\n\t\t\t\tid:\n\t\t\t\t\tnext === ProjectLicensePeriod.Year\n\t\t\t\t\t\t? UIInteraction.toggleBuyAiCreditsPeriodToYearly\n\t\t\t\t\t\t: UIInteraction.toggleBuyAiCreditsPeriodToMonthly,\n\t\t\t})\n\t\t\tselectPeriod(next)\n\t\t},\n\t\t[period, selectPeriod],\n\t)\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.buyAiCreditsModal })\n\n\tconst isUpdating = state.status === BuyAiCreditsStatus.Updating\n\tconst isLoading = state.status === BuyAiCreditsStatus.Loading\n\tconst canConfirm = hasChanges && state.status === BuyAiCreditsStatus.Preview\n\tconst formEnabled = !isUpdating\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle={getTeamAddOnLicenseTypeName(TeamAddOnLicenseType.AiCredits)}\n\t\t\tonDismiss={isUpdating ? undefined : onDismiss}\n\t\t\tconfirmLabel={hasChanges ? Dictionary.Confirm : undefined}\n\t\t\tonConfirm={hasChanges ? handleConfirm : undefined}\n\t\t\tconfirmButtonEnabled={canConfirm}\n\t\t\tconfirmButtonLoading={isUpdating}\n\t\t\tcancelLabel={hasChanges ? Dictionary.Cancel : Dictionary.Dismiss}\n\t\t\tonCancel={onDismiss}\n\t\t\tcancelButtonEnabled={!isUpdating}\n\t\t\thasBackdrop\n\t\t>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<p className={styles.description}>\n\t\t\t\t\t{monthlyLimit != null ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\tYou\u2019ve used {formatNumberCommaSeparatorNotation(monthlyUsage)} of your{\" \"}\n\t\t\t\t\t\t\t{formatNumberCommaSeparatorNotation(monthlyLimit)} monthly credits. Upgrade your site plan or add the\n\t\t\t\t\t\t\tcredits {Dictionary.AddOn} to{\" \"}\n\t\t\t\t\t\t\t<Link variant=\"linkLined\" href={aiFreeCreditsURL}>\n\t\t\t\t\t\t\t\tincrease your limit\n\t\t\t\t\t\t\t</Link>\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\t<>\n\t\t\t\t\t\t\tAdd the credits {Dictionary.AddOn} to{\" \"}\n\t\t\t\t\t\t\t<Link variant=\"linkLined\" href={aiFreeCreditsURL}>\n\t\t\t\t\t\t\t\tincrease your monthly AI credit limit\n\t\t\t\t\t\t\t</Link>\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</p>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack justifyContent=\"space-between\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t\t<span className={styles.rowLabel}>Monthly Credits</span>\n\t\t\t\t\t<PopupButton enabled={formEnabled} wrapperClassName={styles.quantityButton}>\n\t\t\t\t\t\t{creditPackOptions.map(option => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\t\toption === currentAddOn?.quantity && option !== quantity\n\t\t\t\t\t\t\t\t\t\t? `${formatNumberCommaSeparatorNotation(option)} (current)`\n\t\t\t\t\t\t\t\t\t\t: formatNumberCommaSeparatorNotation(option)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tselected={option === quantity}\n\t\t\t\t\t\t\t\tonSelect={handleQuantityChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack justifyContent=\"space-between\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t\t<span className={styles.rowLabel}>Billing</span>\n\t\t\t\t\t<SegmentedControl enabled={formEnabled} className={styles.segmented}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={ProjectLicensePeriod.Month}\n\t\t\t\t\t\t\ttitle=\"Monthly\"\n\t\t\t\t\t\t\tselected={period === ProjectLicensePeriod.Month}\n\t\t\t\t\t\t\tonSelect={() => handlePeriodChange(ProjectLicensePeriod.Month)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={ProjectLicensePeriod.Year}\n\t\t\t\t\t\t\ttitle=\"Yearly\"\n\t\t\t\t\t\t\tselected={period === ProjectLicensePeriod.Year}\n\t\t\t\t\t\t\tonSelect={() => handlePeriodChange(ProjectLicensePeriod.Year)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</Stack>\n\t\t\t\t<Separator height={1} />\n\t\t\t\t{hasChanges ? (\n\t\t\t\t\t<PriceBreakdown preview={cachedPreview} isLoading={isLoading} />\n\t\t\t\t) : (\n\t\t\t\t\tsubscription && <CurrentSubscriptionBreakdown subscription={subscription} />\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</ConfirmationModal>\n\t)\n}\n\nfunction CurrentSubscriptionBreakdown({ subscription }: { subscription: CurrentTeamAddOnSubscription }) {\n\tconst { plan, includesVat, vatPercentage } = subscription\n\tconst amount = Number.parseFloat(plan.amount)\n\t// `amount` is quoted ex-VAT (matches the workspace plan convention). When VAT is part of\n\t// what the user will be billed, we layer it on top to give a Subtotal/VAT/Total breakdown;\n\t// otherwise (e.g. US sales-tax regions) we show a single Total with an explicit footnote.\n\tconst vat = includesVat && vatPercentage ? amount * (vatPercentage / 100) : 0\n\tconst renewsDate = format(new Date(plan.nextBillDate), \"MMM d, yyyy\")\n\n\tif (includesVat) {\n\t\treturn (\n\t\t\t<PriceItemList>\n\t\t\t\t<PriceItemRow title=\"Subtotal\" price={amount} currency={plan.currency} />\n\t\t\t\t{vat > 0 && vatPercentage && (\n\t\t\t\t\t<PriceItemRow title={`VAT \u00B7 ${vatPercentage}%`} price={vat} currency={plan.currency} />\n\t\t\t\t)}\n\t\t\t\t<PriceItemRow\n\t\t\t\t\ttitle={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{`Billed on ${renewsDate}`}\n\t\t\t\t\t\t\t<span className={styles.asterisk}>*</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t\tprice={amount + vat}\n\t\t\t\t\tcurrency={plan.currency}\n\t\t\t\t\tbold\n\t\t\t\t/>\n\t\t\t\t<p className={styles.footnote}>*excluding any applicable discounts</p>\n\t\t\t</PriceItemList>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PriceItemList>\n\t\t\t<PriceItemRow title=\"Total\" price={amount} currency={plan.currency} bold />\n\t\t\t<Separator height={1} />\n\t\t\t<p className={styles.footnote}>Renews on {renewsDate}. Amounts shown exclude applicable tax and/or discounts.</p>\n\t\t</PriceItemList>\n\t)\n}\n\nfunction PriceBreakdown({ preview, isLoading }: { preview?: TeamAddOnPreview; isLoading: boolean }) {\n\tif (preview === undefined) {\n\t\treturn (\n\t\t\t<PriceItemList isLoading={isLoading}>\n\t\t\t\t<PriceItemRow title=\"Subtotal\" />\n\t\t\t\t<PriceItemRow title=\"Proration\" />\n\t\t\t\t<PriceItemRow title=\"Tax\" />\n\t\t\t\t<PriceItemRow title=\"Pay Now\" />\n\t\t\t</PriceItemList>\n\t\t)\n\t}\n\n\tconst { currency, items } = preview\n\tconst subtotal = Number.parseFloat(preview.subtotal)\n\tconst total = Number.parseFloat(preview.total)\n\tconst tax = preview.tax != null ? Number.parseFloat(preview.tax) : 0\n\tconst discount = preview.discount != null ? Number.parseFloat(preview.discount) : 0\n\tconst credit = Number.parseFloat(preview.credit)\n\tconst totalWithCredit = Number.parseFloat(preview.totalWithCredit)\n\tconst priceBeforeProration = items.reduce((acc, item) => acc + Number.parseFloat(item.amountWithoutProration), 0)\n\tconst proration = subtotal - priceBeforeProration\n\t// When the order total is negative the user is being refunded/credited rather than charged.\n\tconst creditedAmount = total < 0 ? -total : 0\n\t// Cap the displayed applied credit at the order total \u2014 the leftover stays in the user's balance.\n\tconst appliedCredit = total + credit < 0 ? -total : credit\n\n\treturn (\n\t\t<PriceItemList>\n\t\t\t{items.map(item => (\n\t\t\t\t<PriceItemRow\n\t\t\t\t\tkey={item.plan}\n\t\t\t\t\ttitle=\"Subtotal\"\n\t\t\t\t\tprice={Number.parseFloat(item.amountWithoutProration)}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t{proration !== 0 && <PriceItemRow title=\"Proration\" price={proration} currency={currency} />}\n\t\t\t{discount !== 0 && <PriceItemRow title=\"Discount\" price={-discount} currency={currency} />}\n\t\t\t{tax !== 0 && <PriceItemRow title=\"VAT\" price={tax} currency={currency} />}\n\t\t\t{creditedAmount > 0 ? (\n\t\t\t\t<PriceItemRow title=\"Credit\" price={creditedAmount} currency={currency} bold />\n\t\t\t) : credit < 0 ? (\n\t\t\t\t<>\n\t\t\t\t\t<PriceItemRow title=\"Applied Credit\" price={appliedCredit} currency={currency} />\n\t\t\t\t\t<PriceItemRow title=\"Pay Now\" price={totalWithCredit} currency={currency} bold />\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<PriceItemRow title=\"Pay Now\" price={total} currency={currency} bold />\n\t\t\t)}\n\t\t</PriceItemList>\n\t)\n}\n\nfunction showLoadErrorToast(error: PreviewTeamAiCreditsError) {\n\tconst base = { type: \"add\", variant: \"error\", key: errorToastKey, duration: 5000 } as const\n\tswitch (error.status) {\n\t\tcase PreviewTeamAiCreditsStatus.Unauthorized: {\n\t\t\tconst page = Pages.buyAiCreditsModalErrorUnauthorized\n\t\t\trecord(\"ui_impression\", { page })\n\t\t\treturn toast({\n\t\t\t\t...base,\n\t\t\t\tprimaryText: \"Unauthorized.\",\n\t\t\t\tsecondaryText: \"Contact your admin\",\n\t\t\t\taction: {\n\t\t\t\t\ttitle: Dictionary.Dismiss,\n\t\t\t\t\tonClick: () => record(\"ui_interaction\", { page, id: UIInteraction.dismiss }),\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tcase PreviewTeamAiCreditsStatus.NoActiveSubscription: {\n\t\t\tconst page = Pages.buyAiCreditsModalErrorNoActiveSubscription\n\t\t\trecord(\"ui_impression\", { page })\n\t\t\treturn toast({\n\t\t\t\t...base,\n\t\t\t\tprimaryText: \"Subscription required.\",\n\t\t\t\tsecondaryText: \"Upgrade your site\",\n\t\t\t\taction: {\n\t\t\t\t\ttitle: \"Upgrade\",\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.openUpgradePlan })\n\t\t\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.plans })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tcase PreviewTeamAiCreditsStatus.UnhandledError: {\n\t\t\tconst page = Pages.buyAiCreditsModalUnhandledError\n\t\t\trecord(\"ui_impression\", { page })\n\t\t\treturn toast({\n\t\t\t\t...base,\n\t\t\t\tprimaryText: \"Unexpected error.\",\n\t\t\t\taction: {\n\t\t\t\t\ttitle: \"Contact Support\",\n\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.contactSupport })\n\t\t\t\t\t\topenNewTab(contactSupportURL)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nfunction buyAiCreditsPaymentErrorPage(error: PaymentError): Pages {\n\tswitch (error.status) {\n\t\tcase PaymentErrorStatus.Unauthorized:\n\t\t\treturn Pages.buyAiCreditsModalErrorUnauthorized\n\t\tcase PaymentErrorStatus.PaymentDeclined:\n\t\t\treturn Pages.buyAiCreditsModalErrorPaymentDeclined\n\t\tcase PaymentErrorStatus.ActionRequiredError:\n\t\t\treturn Pages.buyAiCreditsModalErrorActionsRequired\n\t\tcase PaymentErrorStatus.TaxLocationInvalid:\n\t\t\treturn Pages.buyAiCreditsModalErrorTaxLocationInvalid\n\t\tcase PaymentErrorStatus.UnhandledError:\n\t\t\treturn Pages.buyAiCreditsModalUnhandledError\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nasync function runPostPurchasePoll(\n\tprojectId: string,\n\tpreviousMonthlyLimit: number | null,\n\tonSuccess: (() => void) | undefined,\n) {\n\tconst result = await pollProject(projectId, {\n\t\tintervalMillis: 3000,\n\t\tattempts: 10,\n\t\tstopCondition: project => {\n\t\t\tconst newLimit = project.settings.resourceLimits.aiCredits\n\t\t\tif (newLimit == null) return true\n\t\t\treturn newLimit !== previousMonthlyLimit\n\t\t},\n\t})\n\tswitch (result.status) {\n\t\tcase PollStatus.TimeoutError:\n\t\tcase PollStatus.UnhandledError:\n\t\t\tlog.error(\"Failed to poll project update\", result)\n\t\t\tbreak\n\t\tcase PollStatus.Success: {\n\t\t\tconst newLimit = result.project.settings.resourceLimits.aiCredits\n\t\t\tif (newLimit != null) {\n\t\t\t\tengine.stores.projectStore.updateAiCreditLimits({ aiCredits: newLimit })\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(result)\n\t}\n\tonSuccess?.()\n}\n", "import \"BuyAiCreditsModal.styles_1n5ihb3.wyw.css\"; export const rowLabel = \"rowLabel_r1ly4y3g\";\nexport const description = \"description_d1cpe9vz\";\nexport const quantityButton = \"quantityButton_qgl4ovl\";\nexport const segmented = \"segmented_s19orkkh\";\nexport const asterisk = \"asterisk_a15wk8pt\";\nexport const footnote = \"footnote_fqbg5is\";", "import { ApiError, HTTP_ERROR_CODES } from \"@framerjs/app-shared\"\nimport type { ProjectLicensePeriod, TeamAddOnLicenseType, TeamAddOnPlan } from \"@framerjs/app-shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"previewTeamAddOn\")\n\nexport enum PreviewTeamAiCreditsStatus {\n\tSuccess,\n\tAborted,\n\tUnauthorized,\n\tNoActiveSubscription,\n\tUnhandledError,\n}\n\nexport interface TeamAddOnItem {\n\tplan: TeamAddOnPlan\n\tlicenseType: TeamAddOnLicenseType\n\tunitAmount: string\n\tquantity: number\n\tamountWithoutProration: string\n}\n\nexport interface TeamAddOnPreview {\n\ttotal: string\n\tsubtotal: string\n\t/** This is all credits the user has, negated */\n\tcredit: string\n\ttotalWithCredit: string\n\ttax: string | null\n\tdiscount?: string\n\tcurrency: string\n\tperiod: ProjectLicensePeriod\n\titems: TeamAddOnItem[]\n\tnextBillDate?: string\n\tprorationDate?: string\n\tprorationAmount?: string\n}\n\nexport type PreviewTeamAiCreditsError =\n\t| { status: PreviewTeamAiCreditsStatus.Unauthorized }\n\t| { status: PreviewTeamAiCreditsStatus.NoActiveSubscription }\n\t| { status: PreviewTeamAiCreditsStatus.UnhandledError }\n\ntype PreviewTeamAiCreditsResponse =\n\t| { status: PreviewTeamAiCreditsStatus.Success; preview: TeamAddOnPreview }\n\t| { status: PreviewTeamAiCreditsStatus.Aborted }\n\t| PreviewTeamAiCreditsError\n\nexport interface TeamAiCreditsAddOnRequest {\n\tplan: TeamAddOnPlan\n\tquantity: number\n}\n\nexport async function postTeamAddOnPreview(\n\tteamId: string,\n\taddOn: TeamAiCreditsAddOnRequest,\n\tsignal?: AbortSignal,\n): Promise<PreviewTeamAiCreditsResponse> {\n\ttry {\n\t\tconst preview: TeamAddOnPreview = await apiFetcher.post(\n\t\t\t`/web/v2/teams/${teamId}/subscription/addons/preview`,\n\t\t\t{ addOns: [addOn] },\n\t\t\tsignal,\n\t\t)\n\t\treturn { status: PreviewTeamAiCreditsStatus.Success, preview }\n\t} catch (error) {\n\t\t// Aborted requests are expected when the caller fires a newer preview;\n\t\t// surface them as a status so callers can short-circuit, not as a failure.\n\t\tif (isAbortError(error)) return { status: PreviewTeamAiCreditsStatus.Aborted }\n\n\t\tif (error instanceof ApiError) {\n\t\t\tif (error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\t\treturn { status: PreviewTeamAiCreditsStatus.Unauthorized }\n\t\t\t}\n\t\t\tif (isNoActiveSubscriptionError(error)) {\n\t\t\t\treturn { status: PreviewTeamAiCreditsStatus.NoActiveSubscription }\n\t\t\t}\n\t\t}\n\n\t\tlog.reportError(error)\n\t\treturn { status: PreviewTeamAiCreditsStatus.UnhandledError }\n\t}\n}\n\nfunction isNoActiveSubscriptionError(error: ApiError): boolean {\n\treturn error.data.reason === \"team_license_not_found\" || error.data.reason === \"team_stripe_subscription_not_found\"\n}\n", "import { ProjectLicensePeriod, TeamAddOnPlan } from \"@framerjs/app-shared\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { PaymentError } from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport {\n\tGetTeamSubscriptionStatus,\n\ttype TeamCurrentAddOn,\n\tgetTeamSubscription,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/teamSubscription.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { GetTeamAddOnPlanStatus, type CurrentTeamAddOnSubscription, getTeamAddOnPlan } from \"./api/getTeamAddOnPlan.ts\"\nimport {\n\tPreviewTeamAiCreditsStatus,\n\ttype PreviewTeamAiCreditsError,\n\ttype TeamAddOnPreview,\n\tpostTeamAddOnPreview,\n} from \"./api/previewTeamAddOn.ts\"\nimport { PutTeamAddOnStatus, putTeamAddOn } from \"./api/putTeamAddOn.ts\"\n\nconst defaultQuantity = 5_000\nconst defaultPeriod = ProjectLicensePeriod.Month\n\nexport const creditPackOptions: readonly number[] = [5_000, 10_000, 20_000, 50_000, 100_000, 200_000, 400_000]\n\n/** Returns the next available credit pack tier above `current`, or `current` if already at the max. */\nfunction nextCreditPackOption(current: number): number {\n\tconst index = creditPackOptions.indexOf(current)\n\tif (index === -1 || index === creditPackOptions.length - 1) return current\n\treturn creditPackOptions[index + 1] ?? current\n}\n\nfunction planForPeriod(period: ProjectLicensePeriod): TeamAddOnPlan {\n\treturn period === ProjectLicensePeriod.Year ? TeamAddOnPlan.AiCreditsYearly : TeamAddOnPlan.AiCreditsMonthly\n}\n\nfunction matchesAddOn(\n\taddOn: TeamCurrentAddOn | null,\n\tquantity: number,\n\tperiod: ProjectLicensePeriod,\n): addOn is TeamCurrentAddOn {\n\treturn addOn?.quantity === quantity && addOn?.period === period\n}\n\nexport enum BuyAiCreditsStatus {\n\tLoading,\n\tPreview,\n\tNoChanges,\n\tUpdating,\n\tUpdateSuccess,\n\tLoadError,\n\tPaymentError,\n}\n\ninterface FormFields {\n\tquantity: number\n\tperiod: ProjectLicensePeriod\n\tcurrentAddOn: TeamCurrentAddOn | null\n}\n\nexport type BuyAiCreditsState =\n\t| (FormFields & { status: BuyAiCreditsStatus.Loading })\n\t| (FormFields & { status: BuyAiCreditsStatus.Preview; preview: TeamAddOnPreview })\n\t| (FormFields & { status: BuyAiCreditsStatus.NoChanges; subscription: CurrentTeamAddOnSubscription | null })\n\t| (FormFields & { status: BuyAiCreditsStatus.Updating })\n\t| { status: BuyAiCreditsStatus.UpdateSuccess; isFirstPurchase: boolean }\n\t| (FormFields & { status: BuyAiCreditsStatus.LoadError; error: PreviewTeamAiCreditsError })\n\t| (FormFields & { status: BuyAiCreditsStatus.PaymentError; error: PaymentError })\n\nfunction hasFormFields(\n\tstate: BuyAiCreditsState,\n): state is Exclude<BuyAiCreditsState, { status: BuyAiCreditsStatus.UpdateSuccess }> {\n\treturn state.status !== BuyAiCreditsStatus.UpdateSuccess\n}\n\nconst initialStatus: BuyAiCreditsState = {\n\tstatus: BuyAiCreditsStatus.Loading,\n\tquantity: defaultQuantity,\n\tperiod: defaultPeriod,\n\tcurrentAddOn: null,\n}\n\nexport function useBuyAiCredits({ teamId }: { teamId: string }): {\n\tstate: BuyAiCreditsState\n\tselectQuantity: (next: number) => void\n\tselectPeriod: (next: ProjectLicensePeriod) => void\n\tconfirm: () => void\n} {\n\tconst [state, setState] = useState<BuyAiCreditsState>(initialStatus)\n\tconst requestAbortController = useRef<AbortController | undefined>(undefined)\n\n\tconst handlePreview = useCallback(\n\t\tasync (quantity: number, period: ProjectLicensePeriod) => {\n\t\t\trequestAbortController.current?.abort()\n\t\t\tconst controller = new AbortController()\n\t\t\trequestAbortController.current = controller\n\t\t\tconst addOnPayload = { plan: planForPeriod(period), quantity }\n\t\t\tconst response = await postTeamAddOnPreview(teamId, addOnPayload, controller.signal)\n\t\t\t// A newer request is already in flight; let it own the next state transition.\n\t\t\tif (response.status === PreviewTeamAiCreditsStatus.Aborted) return\n\t\t\tsetState(prev => {\n\t\t\t\tif (!hasFormFields(prev)) return prev\n\t\t\t\tconst { quantity, period, currentAddOn } = prev\n\t\t\t\tif (response.status === PreviewTeamAiCreditsStatus.Success) {\n\t\t\t\t\treturn { status: BuyAiCreditsStatus.Preview, quantity, period, currentAddOn, preview: response.preview }\n\t\t\t\t}\n\t\t\t\treturn { status: BuyAiCreditsStatus.LoadError, quantity, period, currentAddOn, error: response }\n\t\t\t})\n\t\t},\n\t\t[teamId],\n\t)\n\n\tconst handleNoChanges = useCallback(async () => {\n\t\trequestAbortController.current?.abort()\n\t\tconst controller = new AbortController()\n\t\trequestAbortController.current = controller\n\t\tconst subscription = await loadCurrentSubscription(teamId, controller.signal)\n\t\t// A newer request is already in flight; let it own the next state transition.\n\t\tif (controller.signal.aborted) return\n\t\tsetState(prev => {\n\t\t\tif (!hasFormFields(prev)) return prev\n\t\t\tconst { quantity, period, currentAddOn } = prev\n\t\t\treturn { status: BuyAiCreditsStatus.NoChanges, quantity, period, currentAddOn, subscription }\n\t\t})\n\t}, [teamId])\n\n\tconst selectQuantity = useCallback(\n\t\t(next: number) => {\n\t\t\tif (!hasFormFields(state) || state.quantity === next) return\n\t\t\tconst { period, currentAddOn } = state\n\t\t\tsetState({ status: BuyAiCreditsStatus.Loading, quantity: next, period, currentAddOn })\n\t\t\tif (matchesAddOn(currentAddOn, next, period)) {\n\t\t\t\tvoid handleNoChanges()\n\t\t\t} else {\n\t\t\t\tvoid handlePreview(next, period)\n\t\t\t}\n\t\t},\n\t\t[state, handlePreview, handleNoChanges],\n\t)\n\n\tconst selectPeriod = useCallback(\n\t\t(next: ProjectLicensePeriod) => {\n\t\t\tif (!hasFormFields(state) || state.period === next) return\n\t\t\tconst { quantity, currentAddOn } = state\n\t\t\tsetState({ status: BuyAiCreditsStatus.Loading, quantity, period: next, currentAddOn })\n\t\t\tif (matchesAddOn(currentAddOn, quantity, next)) {\n\t\t\t\tvoid handleNoChanges()\n\t\t\t} else {\n\t\t\t\tvoid handlePreview(quantity, next)\n\t\t\t}\n\t\t},\n\t\t[state, handlePreview, handleNoChanges],\n\t)\n\n\tconst confirm = useCallback(() => {\n\t\tconst canConfirm = state.status === BuyAiCreditsStatus.Preview || state.status === BuyAiCreditsStatus.PaymentError\n\t\tif (!canConfirm) return\n\t\tconst { period, quantity, currentAddOn } = state\n\t\tconst fields = { quantity, period, currentAddOn }\n\t\tsetState({ status: BuyAiCreditsStatus.Updating, ...fields })\n\t\tconst addOnPayload = { plan: planForPeriod(period), quantity }\n\t\tvoid putTeamAddOn(teamId, addOnPayload).then(response => {\n\t\t\tif (response.status === PutTeamAddOnStatus.Success) {\n\t\t\t\tsetState({ status: BuyAiCreditsStatus.UpdateSuccess, isFirstPurchase: currentAddOn == null })\n\t\t\t} else {\n\t\t\t\tsetState({ status: BuyAiCreditsStatus.PaymentError, ...fields, error: response.error })\n\t\t\t}\n\t\t})\n\t}, [state, teamId])\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController()\n\t\tvoid (async () => {\n\t\t\tconst response = await getTeamSubscription(teamId, controller.signal)\n\t\t\tswitch (response.status) {\n\t\t\t\tcase GetTeamSubscriptionStatus.Success: {\n\t\t\t\t\tconst currentAddOn = response.currentAddOns.find(addOn => addOn.licenseType === \"aiCredits\") ?? null\n\t\t\t\t\tconst quantity = currentAddOn ? nextCreditPackOption(currentAddOn.quantity) : defaultQuantity\n\t\t\t\t\tconst period = currentAddOn ? currentAddOn.period : defaultPeriod\n\t\t\t\t\tsetState({ status: BuyAiCreditsStatus.Loading, quantity, period, currentAddOn })\n\t\t\t\t\tif (matchesAddOn(currentAddOn, quantity, period)) {\n\t\t\t\t\t\treturn handleNoChanges()\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn handlePreview(quantity, period)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcase GetTeamSubscriptionStatus.Aborted:\n\t\t\t\t\treturn\n\t\t\t\tcase GetTeamSubscriptionStatus.Unauthorized:\n\t\t\t\t\treturn setState(prev =>\n\t\t\t\t\t\thasFormFields(prev)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t\t\t\tstatus: BuyAiCreditsStatus.LoadError,\n\t\t\t\t\t\t\t\t\terror: { status: PreviewTeamAiCreditsStatus.Unauthorized },\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: prev,\n\t\t\t\t\t)\n\t\t\t\tcase GetTeamSubscriptionStatus.UnhandledError:\n\t\t\t\t\treturn setState(prev =>\n\t\t\t\t\t\thasFormFields(prev)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...prev,\n\t\t\t\t\t\t\t\t\tstatus: BuyAiCreditsStatus.LoadError,\n\t\t\t\t\t\t\t\t\terror: { status: PreviewTeamAiCreditsStatus.UnhandledError },\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: prev,\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(response)\n\t\t\t}\n\t\t})()\n\t\treturn () => controller.abort()\n\t}, [teamId, handlePreview, handleNoChanges])\n\n\treturn { state, selectQuantity, selectPeriod, confirm }\n}\n\nasync function loadCurrentSubscription(\n\tteamId: string,\n\tsignal: AbortSignal,\n): Promise<CurrentTeamAddOnSubscription | null> {\n\tconst response = await getTeamAddOnPlan(teamId, signal)\n\tswitch (response.status) {\n\t\tcase GetTeamAddOnPlanStatus.Success:\n\t\t\treturn response.subscription\n\t\tcase GetTeamAddOnPlanStatus.Aborted:\n\t\tcase GetTeamAddOnPlanStatus.UnhandledError:\n\t\t\t// The breakdown is informational \u2014 fall back to hiding the section if we can't load it.\n\t\t\treturn null\n\t\tdefault:\n\t\t\tassertNever(response)\n\t}\n}\n", "import type { ProjectLicensePeriod, TeamAddOnLicenseType, TeamAddOnPlan } from \"@framerjs/app-shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"getTeamAddOnPlan\")\n\ninterface TeamAddOnPlanItem {\n\tplan: TeamAddOnPlan\n\tlicenseType: TeamAddOnLicenseType\n\tquantity: number\n\tamount: string\n\tcurrency: string\n\tperiod: ProjectLicensePeriod\n}\n\n/** Top-level `teamAddOnPlan` field returned alongside the regular team plans. */\nexport interface TeamAddOnCurrentPlan {\n\tteamId: string\n\tsubscriptionStatus: string\n\tperiod: ProjectLicensePeriod\n\tnextBillDate: string\n\tcurrency: string\n\t/** Subtotal for the add-on subscription, excluding VAT (matches the workspace plan convention). */\n\tamount: string\n\taddOns: TeamAddOnPlanItem[]\n}\n\n/** The fields we read from `/web/v2/teams/:teamId/subscription/plans` \u2014 typed as a focused subset. */\ninterface TeamPlansResponse {\n\tincludesVat: boolean\n\tvatPercentage: number | null\n\tteamAddOnPlan?: TeamAddOnCurrentPlan | null\n}\n\nexport interface CurrentTeamAddOnSubscription {\n\tplan: TeamAddOnCurrentPlan\n\tincludesVat: boolean\n\tvatPercentage: number | null\n}\n\nexport enum GetTeamAddOnPlanStatus {\n\tSuccess,\n\tAborted,\n\tUnhandledError,\n}\n\ntype GetTeamAddOnPlanResponse =\n\t| { status: GetTeamAddOnPlanStatus.Success; subscription: CurrentTeamAddOnSubscription | null }\n\t| { status: GetTeamAddOnPlanStatus.Aborted }\n\t| { status: GetTeamAddOnPlanStatus.UnhandledError }\n\nexport async function getTeamAddOnPlan(teamId: string, signal?: AbortSignal): Promise<GetTeamAddOnPlanResponse> {\n\ttry {\n\t\tconst res: TeamPlansResponse = await apiFetcher.get(\n\t\t\t`/web/v2/teams/${teamId}/subscription/overview`,\n\t\t\tundefined,\n\t\t\tsignal,\n\t\t)\n\t\tconst plan = res.teamAddOnPlan ?? null\n\t\treturn {\n\t\t\tstatus: GetTeamAddOnPlanStatus.Success,\n\t\t\tsubscription: plan ? { plan, includesVat: res.includesVat, vatPercentage: res.vatPercentage } : null,\n\t\t}\n\t} catch (error) {\n\t\tif (isAbortError(error)) return { status: GetTeamAddOnPlanStatus.Aborted }\n\t\tlog.reportError(error)\n\t\treturn { status: GetTeamAddOnPlanStatus.UnhandledError }\n\t}\n}\n", "import { assertNever, getLogger } from \"@framerjs/shared\"\nimport {\n\tPaymentErrorStatus,\n\tclassifyPaymentError,\n\thandleRequiredAction,\n\ttype PaymentError,\n\ttype PutSubscriptionResponseAction,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport type { TeamAiCreditsAddOnRequest } from \"./previewTeamAddOn.ts\"\n\nconst log = getLogger(\"putTeamAddOn\")\n\nexport enum PutTeamAddOnStatus {\n\tSuccess,\n\tPaymentError,\n}\n\nenum TeamAddOnSubscriptionResults {\n\tSuccess = \"success\",\n\tActionRequired = \"action_required\",\n}\n\ntype TeamAddOnSubscriptionApiResponse =\n\t| { result: TeamAddOnSubscriptionResults.Success }\n\t| { result: TeamAddOnSubscriptionResults.ActionRequired; action: PutSubscriptionResponseAction }\n\ntype PutTeamAddOnResponse =\n\t| { status: PutTeamAddOnStatus.Success }\n\t| { status: PutTeamAddOnStatus.PaymentError; error: PaymentError }\n\nexport async function putTeamAddOn(teamId: string, addOn: TeamAiCreditsAddOnRequest): Promise<PutTeamAddOnResponse> {\n\ttry {\n\t\tconst response: TeamAddOnSubscriptionApiResponse = await apiFetcher.put(\n\t\t\t`/web/v2/teams/${teamId}/subscription/addons`,\n\t\t\t{ addOns: [addOn] },\n\t\t)\n\t\tswitch (response.result) {\n\t\t\tcase TeamAddOnSubscriptionResults.Success:\n\t\t\t\treturn { status: PutTeamAddOnStatus.Success }\n\t\t\tcase TeamAddOnSubscriptionResults.ActionRequired: {\n\t\t\t\tconst error = await handleRequiredAction(response.action)\n\t\t\t\treturn error ? { status: PutTeamAddOnStatus.PaymentError, error } : { status: PutTeamAddOnStatus.Success }\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(response, \"Unexpected team add-on subscription response\")\n\t\t}\n\t} catch (error) {\n\t\tconst paymentError = classifyPaymentError(error)\n\t\tif (paymentError) return { status: PutTeamAddOnStatus.PaymentError, error: paymentError }\n\t\tlog.reportError(error)\n\t\treturn {\n\t\t\tstatus: PutTeamAddOnStatus.PaymentError,\n\t\t\terror: { status: PaymentErrorStatus.UnhandledError },\n\t\t}\n\t}\n}\n", "import { InputWrapper, Modal, TextInput, modalStyles } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport { createSmartComponent } from \"document/components/utils/createSmartComponent.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { getNormalizedAssetNamePath } from \"document/utils/getNormalizedAssetNamePath.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\nexport function ComponentCreationModal({ onSuccess }: ModalProps<ModalType.CreateComponent>) {\n\tconst [name, setName] = React.useState<string>(() => {\n\t\tconst nodes = engine.stores.selectionStore.nodes\n\t\tconst singleNode = nodes.length === 1 ? nodes[0] : null\n\t\tconst name = singleNode?.resolveValue(\"name\")\n\t\tif (!singleNode || !name) return \"\"\n\t\tconst canConvertNodeToComponent = ContextAction.canConvertNodeToSmartComponentPrimaryVariant(\n\t\t\tengine.tree,\n\t\t\tsingleNode,\n\t\t)\n\t\treturn canConvertNodeToComponent ? name : \"\"\n\t})\n\n\tconst submitHandler = useEngineCallback(() => {\n\t\tif (!name) return\n\n\t\tconst normalizedName = getNormalizedAssetNamePath(name)\n\t\tif (!normalizedName) return\n\n\t\tlet selectedNode: CanvasNode | null = null\n\n\t\tif (engine.stores.selectionStore.nodes.length === 1) {\n\t\t\tconst singleNode = engine.stores.selectionStore.nodes[0]\n\t\t\tif (singleNode && ContextAction.canConvertNodeToSmartComponentPrimaryVariant(engine.tree, singleNode)) {\n\t\t\t\tselectedNode = singleNode\n\t\t\t}\n\t\t}\n\n\t\tconst { node } = createSmartComponent({ engine, name: normalizedName, selectedNode })\n\n\t\tengine.stores.chromeStore.componentsExpanded = true\n\t\tonSuccess?.(node)\n\t\tengine.stores.modalStore.dismiss()\n\t}, [name, onSuccess])\n\n\tconst submitEnabled = getNormalizedAssetNamePath(name).length > 0\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tonConfirm={submitHandler}\n\t\t\tclassName={modalStyles.container}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header>{Dictionary.NewComponent}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput value={name} placeholder={Dictionary.Title} onChange={setName} constantChange autoFocus />\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tComponents can be edited in their own canvas. Double-click on any instance to add visual variants and\n\t\t\t\t\tinteractions.\n\t\t\t\t</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={submitEnabled}>\n\t\t\t\t\t{Dictionary.Create}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { CheckBox, Modal, Scroll, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens/dimensions\"\nimport { assertNever, ReadonlySet } from \"@framerjs/shared\"\nimport { Mixed } from \"@framerjs/shared/src/Mixed.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Locale, LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { ActiveModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { AnimatePresence, motion } from \"framer-motion\"\nimport React, { useMemo } from \"react\"\nimport {\n\tgetSourceAndTranslationInfoForLayers,\n\tgetBatchTranslatableKeyPaths,\n\tshowBatchTranslateAllModal,\n\tshowBatchTranslateLayersModal,\n} from \"../localization/batchTranslateUtils.ts\"\nimport { useLocales } from \"../localization/useLocales.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as batchTranslateModalStyles from \"./BatchTranslateModal.styles.ts\"\nimport { CollapseIndicator } from \"./CollapseIndicator.tsx\"\nimport * as styles from \"./ConfirmBatchTranslateAllModal.styles.ts\"\n\nfunction createInitialSelectedLocaleIds(translatableLocales: readonly Locale[]): ReadonlySet<LocaleId> {\n\treturn new Set(translatableLocales.map(locale => locale.id))\n}\n\nexport function ConfirmBatchTranslateAllModal({\n\tactiveLocale,\n\tsource,\n}: ActiveModalProps<ModalType.ConfirmBatchTranslateAll>) {\n\tconst localizationAiUpdateExperimentEnabled = useExperimentIsOn(\n\t\t\"localizationAiUpdate\",\n\t\tengine.stores.previewStore.framerSiteId,\n\t)\n\tconst allLocales = useLocales()\n\n\tconst locales = useMemo(() => {\n\t\tif (localizationAiUpdateExperimentEnabled) return allLocales\n\n\t\treturn [activeLocale]\n\t}, [allLocales, activeLocale, localizationAiUpdateExperimentEnabled])\n\n\tconst filteredGroupsAndSources = engine.stores.localizationStore.useState(state => state.filteredGroupsAndSources)\n\n\tconst calculateAnythingToTranslate = React.useCallback(\n\t\t(selectedLocales: readonly Locale[]) => {\n\t\t\tif (!filteredGroupsAndSources || selectedLocales.length === 0) return false\n\n\t\t\tfor (const locale of selectedLocales) {\n\t\t\t\tconst count = getBatchTranslatableKeyPaths(locale, filteredGroupsAndSources).size ?? 0\n\t\t\t\tif (count > 0) return true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\t[filteredGroupsAndSources],\n\t)\n\n\tconst startBatchTranslation = React.useCallback(\n\t\t(selectedLocales: Locale[]) => showBatchTranslateAllModal(selectedLocales, source),\n\t\t[source],\n\t)\n\n\treturn (\n\t\t<ConfirmBatchTranslateModal\n\t\t\tcontext=\"localizationTable\"\n\t\t\tlocales={locales}\n\t\t\tcalculateAnythingToTranslate={calculateAnythingToTranslate}\n\t\t\tstartBatchTranslation={startBatchTranslation}\n\t\t/>\n\t)\n}\n\nexport function ConfirmBatchTranslateLayersModal({\n\tnodeIds,\n\tsource,\n}: ActiveModalProps<ModalType.ConfirmBatchTranslateLayers>) {\n\tconst allLocales = useLocales()\n\tconst nodes = useEngineState(() => engine.tree.getNodes(nodeIds), [nodeIds], [EngineChange.Tree])\n\n\tconst calculateAnythingToTranslate = React.useCallback(\n\t\t(selectedLocales: readonly Locale[]) =>\n\t\t\tgetSourceAndTranslationInfoForLayers(nodes, selectedLocales).sourcesHaveAnythingToTranslate,\n\t\t[nodes],\n\t)\n\n\tconst startBatchTranslation = React.useCallback(\n\t\t(selectedLocales: Locale[]) => showBatchTranslateLayersModal(selectedLocales, nodes, source),\n\t\t[source, nodes],\n\t)\n\n\treturn (\n\t\t<ConfirmBatchTranslateModal\n\t\t\tcontext=\"canvas\"\n\t\t\tlocales={allLocales}\n\t\t\tcalculateAnythingToTranslate={calculateAnythingToTranslate}\n\t\t\tstartBatchTranslation={startBatchTranslation}\n\t\t/>\n\t)\n}\n\nfunction ConfirmBatchTranslateModal({\n\tcontext,\n\tlocales,\n\tcalculateAnythingToTranslate,\n\tstartBatchTranslation,\n}: {\n\tcontext: \"localizationTable\" | \"canvas\"\n\tlocales: readonly Locale[]\n\tcalculateAnythingToTranslate: (selectedLocales: readonly Locale[]) => boolean\n\tstartBatchTranslation: (selectedLocales: readonly Locale[]) => void\n}) {\n\tconst localizationAiUpdateExperimentEnabled = useExperimentIsOn(\n\t\t\"localizationAiUpdate\",\n\t\tengine.stores.previewStore.framerSiteId,\n\t)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst [expanded, setExpanded] = React.useState(false)\n\n\tconst [selectedLocaleIds, setSelectedLocaleIds] = React.useState<ReadonlySet<string>>(() =>\n\t\tcreateInitialSelectedLocaleIds(locales),\n\t)\n\n\tconst selectedLocales = useMemo(\n\t\t() => locales.filter(locale => selectedLocaleIds.has(locale.id)),\n\t\t[locales, selectedLocaleIds],\n\t)\n\n\tconst anythingToTranslate = React.useMemo(\n\t\t() => calculateAnythingToTranslate(selectedLocales),\n\t\t[calculateAnythingToTranslate, selectedLocales],\n\t)\n\n\tconst allItemsCheckboxValue: boolean | Mixed | undefined = React.useMemo(() => {\n\t\tconst noneSelected = selectedLocaleIds.size === 0\n\t\tif (noneSelected) return false\n\t\tconst allSelected = locales.every(locale => selectedLocaleIds.has(locale.id))\n\t\tif (allSelected) return true\n\t\treturn Mixed\n\t}, [locales, selectedLocaleIds])\n\n\tconst buttonText = React.useMemo(() => {\n\t\tconst noLocalesSelected = selectedLocales.length === 0\n\t\tconst allLocalesSelected = selectedLocales.length === locales.length\n\t\tconst someLocalesSelected = !noLocalesSelected && !allLocalesSelected\n\t\tconst defaultText = primaryActionText(context)\n\n\t\tif (noLocalesSelected) return defaultText\n\n\t\tif (allLocalesSelected) {\n\t\t\tif (anythingToTranslate) return defaultText\n\t\t\treturn `${Dictionary.All} ${Dictionary.Locales} ${Dictionary.Translated}`\n\t\t}\n\n\t\tif (someLocalesSelected) {\n\t\t\tif (anythingToTranslate) return `${Dictionary.Translate} Selected`\n\t\t\treturn `${Dictionary.Locales} Already ${Dictionary.Translated}`\n\t\t}\n\n\t\treturn defaultText\n\t}, [locales, selectedLocales, anythingToTranslate, context])\n\n\tfunction toggleLocale(locale: Locale) {\n\t\tsetSelectedLocaleIds(ReadonlySet.toggle(selectedLocaleIds, locale.id))\n\t}\n\n\tfunction toggleAll() {\n\t\tconst allTranslatableSelected = selectedLocaleIds.size === locales.length\n\n\t\tif (allTranslatableSelected) {\n\t\t\tsetSelectedLocaleIds(new Set())\n\t\t} else {\n\t\t\tsetSelectedLocaleIds(createInitialSelectedLocaleIds(locales))\n\t\t}\n\t}\n\n\tfunction handleTranslate() {\n\t\tif (!anythingToTranslate) return\n\t\tstartBatchTranslation(selectedLocales)\n\t}\n\n\tif (!localizationAiUpdateExperimentEnabled) {\n\t\treturn (\n\t\t\t<Modal.Root onDismiss={engine.stores.modalStore.dismiss} onConfirm={handleTranslate} {...modalThemeProps}>\n\t\t\t\t<Modal.Header closeButton>{`${Dictionary.Translate} All`}</Modal.Header>\n\n\t\t\t\t<Modal.Content>\n\t\t\t\t\t<Modal.Text>{`Batch AI Translate all \"new\" items in the Localization Table with a single click.`}</Modal.Text>\n\t\t\t\t</Modal.Content>\n\n\t\t\t\t<Modal.Footer>\n\t\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={anythingToTranslate}>\n\t\t\t\t\t\t{anythingToTranslate ? `${Dictionary.Translate} Items` : \"All Items Translated\"}\n\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t</Modal.Footer>\n\t\t\t</Modal.Root>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Modal.Root onDismiss={engine.stores.modalStore.dismiss} onConfirm={handleTranslate} {...modalThemeProps}>\n\t\t\t<Modal.Header closeButton className={styles.batchTranslateModalHeader}>\n\t\t\t\t{primaryActionText(context)}\n\t\t\t</Modal.Header>\n\n\t\t\t<Scroll className={styles.batchTranslateModalContent}>\n\t\t\t\t<Modal.Content>\n\t\t\t\t\t<Modal.Text className={batchTranslateModalStyles.modalText}>{modalBodyText(context)}</Modal.Text>\n\n\t\t\t\t\t<div className={styles.localeListGrid}>\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={5}>\n\t\t\t\t\t\t\t<CollapseIndicator\n\t\t\t\t\t\t\t\twithMargin={false}\n\t\t\t\t\t\t\t\tcollapsed={!expanded}\n\t\t\t\t\t\t\t\tvisible={true}\n\t\t\t\t\t\t\t\tclassName={styles.collapseIndicator}\n\t\t\t\t\t\t\t\tonMouseDown={() => setExpanded(previous => !previous)}\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<CheckBox\n\t\t\t\t\t\t\t\tvalue={allItemsCheckboxValue}\n\t\t\t\t\t\t\t\tenabled={locales.length > 0}\n\t\t\t\t\t\t\t\tonChange={toggleAll}\n\t\t\t\t\t\t\t\tid=\"toggle-all-locales\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<label htmlFor=\"toggle-all-locales\" className={styles.selectAllLocalesLabel}>\n\t\t\t\t\t\t\tAll Locales\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<AnimatePresence initial={false}>\n\t\t\t\t\t\t\t{expanded && (\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tkey=\"locales-list\"\n\t\t\t\t\t\t\t\t\tclassName={styles.localeListGridLocalesContainer}\n\t\t\t\t\t\t\t\t\tinitial={{ height: 0, paddingTop: 0 }}\n\t\t\t\t\t\t\t\t\tanimate={{ height: \"auto\", paddingTop: dimensions.css.modalPadding }}\n\t\t\t\t\t\t\t\t\texit={{ height: 0, paddingTop: 0 }}\n\t\t\t\t\t\t\t\t\ttransition={{ duration: 0.2, ease: [0.2, 0, 0, 1] }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{locales.map(locale => {\n\t\t\t\t\t\t\t\t\t\tconst isSelected = selectedLocaleIds.has(locale.id)\n\t\t\t\t\t\t\t\t\t\tconst checkboxId = `toggle-${locale.id}`\n\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Stack direction=\"row\" key={checkboxId} gap={0}>\n\t\t\t\t\t\t\t\t\t\t\t\t<div className={styles.localeCheckboxContainer}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<CheckBox id={checkboxId} value={isSelected} onChange={() => toggleLocale(locale)} />\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<label htmlFor={checkboxId} className={styles.localeLabel}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{locale.name}\n\t\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t</div>\n\t\t\t\t</Modal.Content>\n\t\t\t</Scroll>\n\n\t\t\t<Modal.Footer className={styles.batchTranslateModalFooter} separator>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={anythingToTranslate}>\n\t\t\t\t\t{buttonText}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\nfunction primaryActionText(context: \"localizationTable\" | \"canvas\"): string {\n\tif (context === \"canvas\") return `${Dictionary.Translate} ${Dictionary.Content}`\n\tif (context === \"localizationTable\") return `${Dictionary.Translate} ${Dictionary.All}`\n\tassertNever(context)\n}\n\nfunction modalBodyText(context: \"localizationTable\" | \"canvas\"): string {\n\tif (context === \"canvas\") {\n\t\treturn \"Translate all selected content with AI. You can pick your preferred AI model for each locale in the localization settings.\"\n\t}\n\tif (context === \"localizationTable\") {\n\t\treturn \"Batch Translate with AI all \u201Cnew\u201C items currently visible in the localization view. You can pick your preferred translation model for each locale in settings.\"\n\t}\n\tassertNever(context)\n}\n", "import \"ConfirmBatchTranslateAllModal.styles_1b9i4uh.wyw.css\"; export const batchTranslateModalContent = \"batchTranslateModalContent_b1io10xk\";\nexport const batchTranslateModalHeader = \"batchTranslateModalHeader_bpkq2ys\";\nexport const batchTranslateModalFooter = \"batchTranslateModalFooter_bbuuju8\";\nexport const localeListGrid = \"localeListGrid_lodidp9\";\nexport const collapseIndicator = \"collapseIndicator_ceyl43l\";\nexport const localeListGridLocalesContainer = \"localeListGridLocalesContainer_lnrzize\";\nexport const selectAllLocalesLabel = \"selectAllLocalesLabel_s1w25lv5\";\nexport const localeLabel = \"localeLabel_l13k381a\";\nexport const localeCheckboxContainer = \"localeCheckboxContainer_lg2c6bf\";", "import { Modal } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport { LocaleSelector } from \"./LocaleSelector.tsx\"\nimport type { LocaleCode } from \"./locales.ts\"\n\nfunction dismiss() {\n\tengine.stores.modalStore.dismiss()\n}\n\nexport function ConfirmDefaultLanguageModal({ onConfirm }: ModalProps<ModalType.ConfirmDefaultLanguage>) {\n\tconst [locale, setLocale] = React.useState<LocaleCode | \"\">(\"\")\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst updateSiteLanguage = useEngineCallback(() => {\n\t\tif (!locale) return\n\n\t\tconst currentWebMetadata = engine.tree.root.webMetadata\n\t\tconst webMetadata = currentWebMetadata ? { ...currentWebMetadata } : {}\n\t\twebMetadata.language = locale\n\n\t\tengine.tree.root.set({ webMetadata })\n\n\t\tdismiss()\n\t\tonConfirm()\n\t}, [locale, onConfirm])\n\n\treturn (\n\t\t<Modal.Root onDismiss={dismiss} onConfirm={updateSiteLanguage} {...modalThemeProps}>\n\t\t\t<Modal.Header>Set Default Language</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<LocaleSelector\n\t\t\t\t\tautoFocus\n\t\t\t\t\tvalue={locale}\n\t\t\t\t\topenOnFocus={false}\n\t\t\t\t\tonChange={setLocale}\n\t\t\t\t\tplaceholder=\"Default Language\"\n\t\t\t\t/>\n\t\t\t\t<Modal.Text>{`Confirm the default language of your site before setting up ${Dictionary.Localization}.`}</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton>Cancel</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={Boolean(locale)}>\n\t\t\t\t\tConfirm\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "/** Simple detection of titles, the goal isn't to be perfect. */\nexport function detectNaturalLanguageTitleFromValue(_value: string, defaultName = \"Title\") {\n\tconst value = _value.toLowerCase().trim()\n\tif (value === \"\") return \"Title\"\n\tif (isMultiline(value)) return \"Text\"\n\tconst segments = value.split(\" \")\n\tconst segmentCount = segments.length\n\tif (segmentCount > 5) return \"Text\"\n\n\tif (isCity(value)) return \"City\"\n\tif (isCountry(value)) return \"Country\"\n\tif (isMonth(value)) return \"Month\"\n\tif (isDate(segments)) return \"Date\"\n\tif (includesCurrency(value, segmentCount)) return \"Price\"\n\tif (isEmail(value, segmentCount)) return \"Email\"\n\tif (isNumber(value)) {\n\t\tif (isFloat(value)) return \"Number\"\n\t\tif (isYear(value)) return \"Year\"\n\t\treturn \"Amount\"\n\t}\n\treturn defaultName\n}\n\nexport function isMultiline(value: string): boolean {\n\treturn value.includes(\"\\n\")\n}\n\nfunction isCity(value: string): boolean {\n\treturn capitalCities.has(value)\n}\n\nfunction isCountry(value: string): boolean {\n\treturn countries.has(value)\n}\n\nfunction isMonth(value: string): boolean {\n\treturn months.has(value)\n}\n\nfunction includesCurrency(value: string, segmentCount: number): boolean {\n\tif (segmentCount > 2) return false\n\treturn currencySymbols.some(currency => value.includes(currency))\n}\n\nfunction isEmail(value: string, segmentCount: number): boolean {\n\tif (segmentCount !== 1) return false\n\treturn /\\S[^\\s@]*@\\S+\\.\\S+/.test(value)\n}\n\nfunction isNumber(value: string): boolean {\n\treturn !Number.isNaN(value) && !Number.isNaN(parseFloat(value))\n}\n\nfunction isFloat(value: string): boolean {\n\tconst floatValue = parseFloat(value)\n\tif (Number.isNaN(floatValue)) return false\n\treturn floatValue % 1 !== 0\n}\n\nfunction isYear(value: string): boolean {\n\tconst integerValue = parseInt(value)\n\tif (Number.isNaN(integerValue)) return false\n\treturn integerValue >= 1900 && integerValue <= 2100\n}\n\nfunction isDate(segments: string[]): boolean {\n\treturn segments.some(segment => {\n\t\tif (months.has(segment)) return true\n\t\tif (monthsShort.has(segment)) return true\n\t\tif (dateSnippets.has(segment)) return true\n\t\treturn false\n\t})\n}\n\nconst dateSnippets = new Set([\"hour\", \"hours\", \"min\", \"minutes\", \"sec\", \"seconds\"])\n\nconst months = new Set([\n\t\"january\",\n\t\"february\",\n\t\"march\",\n\t\"april\",\n\t\"may\",\n\t\"june\",\n\t\"july\",\n\t\"august\",\n\t\"september\",\n\t\"october\",\n\t\"november\",\n\t\"december\",\n])\n\nconst monthsShort = new Set([\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"aug\", \"sep\", \"oct\", \"nov\", \"dec\"])\n\nconst currencySymbols = [\"\u20AC\", \"\u00A3\", \"\u20BE\", \"\u20BD\", \"\u20BA\", \"\u20B4\", \"\u20AA\", \"$\", \"\u20A9\", \"\u0E3F\", \"\u20BF\", \"\u00A5\"]\n\nconst countries = new Set([\n\t\"abkhazia\",\n\t\"afghanistan\",\n\t\"albania\",\n\t\"algeria\",\n\t\"america\",\n\t\"andorra\",\n\t\"angola\",\n\t\"anguilla\",\n\t\"argentina\",\n\t\"armenia\",\n\t\"aruba\",\n\t\"australia\",\n\t\"austria\",\n\t\"azerbaijan\",\n\t\"bahamas\",\n\t\"bahrain\",\n\t\"bangladesh\",\n\t\"barbados\",\n\t\"belarus\",\n\t\"belgium\",\n\t\"belize\",\n\t\"benin\",\n\t\"bermuda\",\n\t\"bhutan\",\n\t\"bolivia\",\n\t\"bolivia\",\n\t\"bosnia\",\n\t\"herzegovina\",\n\t\"botswana\",\n\t\"brazil\",\n\t\"virgin islands\",\n\t\"brunei\",\n\t\"bulgaria\",\n\t\"burkina faso\",\n\t\"burundi\",\n\t\"cambodia\",\n\t\"cameroon\",\n\t\"canada\",\n\t\"cape verde\",\n\t\"cayman islands\",\n\t\"central african republic\",\n\t\"chad\",\n\t\"chile\",\n\t\"china\",\n\t\"christmas island\",\n\t\"colombia\",\n\t\"comoros\",\n\t\"congo\",\n\t\"cook islands\",\n\t\"costa rica\",\n\t\"croatia\",\n\t\"cuba\",\n\t\"cura\u00E7ao\",\n\t\"cyprus\",\n\t\"czech republic\",\n\t\"c\u00F4te d'ivoire\",\n\t\"denmark\",\n\t\"djibouti\",\n\t\"dominica\",\n\t\"dominican republic\",\n\t\"east timor\",\n\t\"easter island\",\n\t\"ecuador\",\n\t\"egypt\",\n\t\"el salvador\",\n\t\"england\",\n\t\"equatorial guinea\",\n\t\"eritrea\",\n\t\"estonia\",\n\t\"ethiopia\",\n\t\"falkland islands\",\n\t\"faroe islands\",\n\t\"micronesia\",\n\t\"fiji\",\n\t\"finland\",\n\t\"france\",\n\t\"french guiana\",\n\t\"french polynesia\",\n\t\"gabon\",\n\t\"gambia\",\n\t\"georgia\",\n\t\"germany\",\n\t\"ghana\",\n\t\"gibraltar\",\n\t\"greece\",\n\t\"greenland\",\n\t\"grenada\",\n\t\"guam\",\n\t\"guatemala\",\n\t\"guernsey\",\n\t\"guinea\",\n\t\"guinea-bissau\",\n\t\"guyana\",\n\t\"haiti\",\n\t\"honduras\",\n\t\"hungary\",\n\t\"iceland\",\n\t\"india\",\n\t\"indonesia\",\n\t\"iran\",\n\t\"iraq\",\n\t\"ireland\",\n\t\"israel\",\n\t\"italy\",\n\t\"jamaica\",\n\t\"japan\",\n\t\"jersey\",\n\t\"jordan\",\n\t\"kazakhstan\",\n\t\"kenya\",\n\t\"kiribati\",\n\t\"kosovo\",\n\t\"kuwait\",\n\t\"kyrgyzstan\",\n\t\"laos\",\n\t\"latvia\",\n\t\"lebanon\",\n\t\"lesotho\",\n\t\"liberia\",\n\t\"libya\",\n\t\"liechtenstein\",\n\t\"lithuania\",\n\t\"los angeles\",\n\t\"luxembourg\",\n\t\"macedonia\",\n\t\"madagascar\",\n\t\"malawi\",\n\t\"malaysia\",\n\t\"maldives\",\n\t\"mali\",\n\t\"malta\",\n\t\"marshall islands\",\n\t\"mauritania\",\n\t\"mauritius\",\n\t\"mexico\",\n\t\"moldova\",\n\t\"monaco\",\n\t\"mongolia\",\n\t\"montenegro\",\n\t\"montserrat\",\n\t\"morocco\",\n\t\"mozambique\",\n\t\"myanmar\",\n\t\"nagorno-karabakh\",\n\t\"namibia\",\n\t\"nauru\",\n\t\"nepal\",\n\t\"netherlands\",\n\t\"new caledonia\",\n\t\"new york\",\n\t\"new zealand\",\n\t\"nicaragua\",\n\t\"niger\",\n\t\"nigeria\",\n\t\"niue\",\n\t\"norfolk island\",\n\t\"north korea\",\n\t\"norway\",\n\t\"oman\",\n\t\"pakistan\",\n\t\"palau\",\n\t\"palestine\",\n\t\"panama\",\n\t\"papua new guinea\",\n\t\"paraguay\",\n\t\"peru\",\n\t\"philippines\",\n\t\"pitcairn islands\",\n\t\"poland\",\n\t\"portugal\",\n\t\"puerto rico\",\n\t\"qatar\",\n\t\"romania\",\n\t\"russia\",\n\t\"rwanda\",\n\t\"saint barth\u00E9lemy\",\n\t\"saint helena\",\n\t\"saint lucia\",\n\t\"saint martin\",\n\t\"samoa\",\n\t\"san francisco\",\n\t\"san marino\",\n\t\"saudi arabia\",\n\t\"scotland\",\n\t\"senegal\",\n\t\"serbia\",\n\t\"seychelles\",\n\t\"sierra leone\",\n\t\"singapore\",\n\t\"sint maarten\",\n\t\"slovakia\",\n\t\"slovenia\",\n\t\"solomon islands\",\n\t\"somalia\",\n\t\"somaliland\",\n\t\"south africa\",\n\t\"south korea\",\n\t\"south ossetia\",\n\t\"south sudan\",\n\t\"spain\",\n\t\"sri lanka\",\n\t\"sudan\",\n\t\"suriname\",\n\t\"swaziland\",\n\t\"sweden\",\n\t\"switzerland\",\n\t\"syria\",\n\t\"taiwan\",\n\t\"tajikistan\",\n\t\"tanzania\",\n\t\"thailand\",\n\t\"togo\",\n\t\"tonga\",\n\t\"transnistria\",\n\t\"trinidad and tobago\",\n\t\"tristan da cunha\",\n\t\"tunisia\",\n\t\"turkey\",\n\t\"turkmenistan\",\n\t\"tuvalu\",\n\t\"uganda\",\n\t\"ukraine\",\n\t\"united arab emirates\",\n\t\"united kingdom\",\n\t\"united states\",\n\t\"uruguay\",\n\t\"uzbekistan\",\n\t\"vanuatu\",\n\t\"vatican city\",\n\t\"venezuela\",\n\t\"vietnam\",\n\t\"wales\",\n\t\"wallis and futuna\",\n\t\"western sahara\",\n\t\"yemen\",\n\t\"zambia\",\n\t\"zimbabwe\",\n])\n\nconst capitalCities = new Set([\n\t\"abu dhabi\",\n\t\"abuja\",\n\t\"accra\",\n\t\"adamstown\",\n\t\"addis ababa\",\n\t\"algiers\",\n\t\"alofi\",\n\t\"amman\",\n\t\"amsterdam\",\n\t\"andorra la vella\",\n\t\"ankara\",\n\t\"antananarivo\",\n\t\"apia\",\n\t\"ashgabat\",\n\t\"asmara\",\n\t\"astana\",\n\t\"asunci\u00F3n\",\n\t\"athens\",\n\t\"avarua\",\n\t\"baghdad\",\n\t\"baku\",\n\t\"bamako\",\n\t\"bandar seri begawan\",\n\t\"bangkok\",\n\t\"bangui\",\n\t\"banjul\",\n\t\"basseterre\",\n\t\"beijing\",\n\t\"beirut\",\n\t\"belfast\",\n\t\"belgrade\",\n\t\"belmopan\",\n\t\"berlin\",\n\t\"bern\",\n\t\"bishkek\",\n\t\"bissau\",\n\t\"bogot\u00E1\",\n\t\"bras\u00EDlia\",\n\t\"bratislava\",\n\t\"brazzaville\",\n\t\"bridgetown\",\n\t\"brussels\",\n\t\"bucharest\",\n\t\"budapest\",\n\t\"buenos aires\",\n\t\"bujumbura\",\n\t\"cairo\",\n\t\"canberra\",\n\t\"caracas\",\n\t\"cardiff\",\n\t\"castries\",\n\t\"cayenne\",\n\t\"charlotte amalie\",\n\t\"chisinau\",\n\t\"cockburn town\",\n\t\"conakry\",\n\t\"copenhagen\",\n\t\"dakar\",\n\t\"damascus\",\n\t\"dhaka\",\n\t\"dili\",\n\t\"djibouti\",\n\t\"dodoma\",\n\t\"doha\",\n\t\"douglas\",\n\t\"dublin\",\n\t\"dushanbe\",\n\t\"edinburgh\",\n\t\"el aai\u00FAn\",\n\t\"episkopi cantonment\",\n\t\"flying fish cove\",\n\t\"freetown\",\n\t\"funafuti\",\n\t\"gaborone\",\n\t\"george town\",\n\t\"georgetown\",\n\t\"georgetown\",\n\t\"gibraltar\",\n\t\"grytviken\",\n\t\"guatemala city\",\n\t\"gustavia\",\n\t\"hag\u00E5t\u00F1a\",\n\t\"hamilton\",\n\t\"hanga roa\",\n\t\"hanoi\",\n\t\"harare\",\n\t\"hargeisa\",\n\t\"havana\",\n\t\"helsinki\",\n\t\"honiara\",\n\t\"islamabad\",\n\t\"istanbul\",\n\t\"jakarta\",\n\t\"jamestown\",\n\t\"jerusalem\",\n\t\"jerusalem\",\n\t\"juba\",\n\t\"kabul\",\n\t\"kampala\",\n\t\"kathmandu\",\n\t\"khartoum\",\n\t\"kiev\",\n\t\"kigali\",\n\t\"kingston\",\n\t\"kingston\",\n\t\"kingstown\",\n\t\"kinshasa\",\n\t\"kuala lumpur\",\n\t\"kuwait city\",\n\t\"la paz\",\n\t\"libreville\",\n\t\"lilongwe\",\n\t\"lima\",\n\t\"lisbon\",\n\t\"ljubljana\",\n\t\"lom\u00E9\",\n\t\"london\",\n\t\"luanda\",\n\t\"lusaka\",\n\t\"luxembourg\",\n\t\"madrid\",\n\t\"majuro\",\n\t\"malabo\",\n\t\"mal\u00E9\",\n\t\"managua\",\n\t\"manama\",\n\t\"manila\",\n\t\"maputo\",\n\t\"marigot\",\n\t\"maseru\",\n\t\"mata-utu\",\n\t\"mbabane\",\n\t\"mexico city\",\n\t\"minsk\",\n\t\"mogadishu\",\n\t\"monaco\",\n\t\"monrovia\",\n\t\"montevideo\",\n\t\"moroni\",\n\t\"moscow\",\n\t\"muscat\",\n\t\"n'djamena\",\n\t\"nairobi\",\n\t\"nassau\",\n\t\"naypyidaw\",\n\t\"new delhi\",\n\t\"ngerulmud\",\n\t\"niamey\",\n\t\"nicosia\",\n\t\"nicosia\",\n\t\"nouakchott\",\n\t\"noum\u00E9a\",\n\t\"nuku\u02BBalofa\",\n\t\"nuuk\",\n\t\"oranjestad\",\n\t\"oslo\",\n\t\"ottawa\",\n\t\"ouagadougou\",\n\t\"pago pago\",\n\t\"palikir\",\n\t\"panama city\",\n\t\"papeete\",\n\t\"paramaribo\",\n\t\"paris\",\n\t\"philipsburg\",\n\t\"phnom penh\",\n\t\"plymouth\",\n\t\"podgorica\",\n\t\"port louis\",\n\t\"port moresby\",\n\t\"port of spain\",\n\t\"port vila\",\n\t\"port-au-prince\",\n\t\"porto-novo\",\n\t\"prague\",\n\t\"praia\",\n\t\"pretoria\",\n\t\"pristina\",\n\t\"pyongyang\",\n\t\"quito\",\n\t\"rabat\",\n\t\"reykjav\u00EDk\",\n\t\"riga\",\n\t\"riyadh\",\n\t\"road town\",\n\t\"rome\",\n\t\"roseau\",\n\t\"saipan\",\n\t\"san jos\u00E9\",\n\t\"san juan\",\n\t\"san marino\",\n\t\"san salvador\",\n\t\"sana\u00E1\",\n\t\"santiago\",\n\t\"santo domingo\",\n\t\"s\u00E3o tom\u00E9\",\n\t\"sarajevo\",\n\t\"seoul\",\n\t\"singapore\",\n\t\"skopje\",\n\t\"sofia\",\n\t\"sri jayawardenapura kotte\",\n\t\"st. george's\",\n\t\"st. helier\",\n\t\"st. john's\",\n\t\"st. peter port\",\n\t\"st. pierre\",\n\t\"stanley\",\n\t\"stepanakert\",\n\t\"stockholm\",\n\t\"sucre\",\n\t\"sukhumi\",\n\t\"suva\",\n\t\"taipei\",\n\t\"tallinn\",\n\t\"tarawa\",\n\t\"tashkent\",\n\t\"tbilisi\",\n\t\"tegucigalpa\",\n\t\"tehran\",\n\t\"the valley\",\n\t\"thimphu\",\n\t\"tirana\",\n\t\"tiraspol\",\n\t\"tokyo\",\n\t\"t\u00F3rshavn\",\n\t\"tripoli\",\n\t\"tskhinvali\",\n\t\"tunis\",\n\t\"ulaanbaatar\",\n\t\"vaduz\",\n\t\"valletta\",\n\t\"vatican city\",\n\t\"victoria\",\n\t\"vienna\",\n\t\"vientiane\",\n\t\"vilnius\",\n\t\"warsaw\",\n\t\"washington\",\n\t\"wellington\",\n\t\"west island\",\n\t\"willemstad\",\n\t\"windhoek\",\n\t\"yamoussoukro\",\n\t\"yaound\u00E9\",\n\t\"yaren\",\n\t\"yerevan\",\n\t\"zagreb\",\n])\n", "import { InputWrapper, Modal, PopupButton, PopupButtonItem, Stack, Text, TextInput } from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, ModuleType, unhandledError } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { detectNaturalLanguageTitleFromValue } from \"document/components/utils/getNaturalLanguageTitleForValue.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { FrameNode, NodeID, RichTextNode, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { AnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport {\n\tisDataRepeater,\n\tisFrameNode,\n\tisRichTextNode,\n\tisTextNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { CollectionVariableDefinition } from \"document/models/CanvasTree/traits/CollectionVariableDefinition.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasImageFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { HTMLTextTag } from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { SlugVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { migrateTextToRichTextNode } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { createEditorState } from \"prosemirror/editorState.ts\"\nimport { fullSchemaParams, makeSchema } from \"prosemirror/schema/index.ts\"\nimport { serializeRichText } from \"prosemirror/serialization/dom.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { createRouteSegment } from \"../Pages/utils/createRouteSegment.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"../Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { createContentManagementNodeIfNeeded } from \"../contentManagement/utils/createContentManagementNodeIfNeeded.ts\"\nimport { createVariable } from \"../properties/utils/createVariable.ts\"\nimport { hostnamePlaceholder } from \"../siteSettings/metadataPlaceholders.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./ConvertToCMSPageModal.styles.ts\"\n\nfunction getChanceOfBeingPageTitle(tags: HTMLTextTag[]): number {\n\tif (tags.length !== 1) return 0\n\tconst tag = tags[0]\n\tswitch (tag) {\n\t\tcase \"h1\":\n\t\t\treturn 10\n\t\tcase \"h2\":\n\t\t\treturn 9\n\t\tcase \"h3\":\n\t\t\treturn 8\n\t\tcase \"h4\":\n\t\t\treturn 7\n\t\tcase \"h5\":\n\t\t\treturn 6\n\t\tcase \"h6\":\n\t\t\treturn 5\n\t\tdefault:\n\t\t\treturn 1\n\t}\n}\n\nfunction orderPlainTextNodesByHeading(plainTextNodes: AnyTextNode[]): AnyTextNode[] {\n\tconst nodesMap = new Map<NodeID, AnyTextNode>()\n\tplainTextNodes.forEach(node => nodesMap.set(node.id, node))\n\n\tconst textNodesByHeadingChance = plainTextNodes.map(node => {\n\t\tif (isTextNode(node)) return { id: node.id, headingChance: 0 }\n\t\tconst tags = node.getTextBlockTags(false)\n\t\treturn { id: node.id, headingChance: getChanceOfBeingPageTitle(tags) }\n\t})\n\n\ttextNodesByHeadingChance.sort(({ headingChance: headingChanceA }, { headingChance: headingChanceB }) => {\n\t\treturn headingChanceB - headingChanceA\n\t})\n\n\treturn textNodesByHeadingChance.map(({ id }) => {\n\t\tconst node = nodesMap.get(id)\n\t\tassert(node, \"plain text node should exist\")\n\t\treturn node\n\t})\n}\n\nfunction getAllTextAndImageNodes(source: NodeID): {\n\twebPage: WebPageNode | null\n\tplainTextNodes: AnyTextNode[]\n\tformattedTextNodes: AnyTextNode[]\n\timageNodes: FrameNode[]\n} {\n\tconst plainTextNodes: AnyTextNode[] = []\n\tconst formattedTextNodes: AnyTextNode[] = []\n\tconst imageNodes: FrameNode[] = []\n\n\tconst webPage = engine.tree.getNode(source)\n\tif (!isWebPageNode(webPage)) {\n\t\treturn {\n\t\t\twebPage: null,\n\t\t\tplainTextNodes,\n\t\t\tformattedTextNodes,\n\t\t\timageNodes,\n\t\t}\n\t}\n\t// TODO Check and handle shallow/fully loaded scope state\n\tassert(webPage.isLoaded(), \"web page should be fully loaded\")\n\n\tfor (const { node, skipChildren } of webPage.loaded.walkWithSkipChildren()) {\n\t\t// Don't walk deeper into data repeaters or replicas.\n\t\tif (isDataRepeater(node) || isReplicaOrReplicaChild(node)) {\n\t\t\tskipChildren()\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isTextNode(node)) {\n\t\t\tif (node.text.length > 60) {\n\t\t\t\tformattedTextNodes.push(node)\n\t\t\t} else {\n\t\t\t\tplainTextNodes.push(node)\n\t\t\t}\n\t\t} else if (isRichTextNode(node)) {\n\t\t\tconst textContentValue = node.getTextContent()\n\t\t\tconst hasMultipleNodes = node.getNodeCount() > 1\n\t\t\tconst hasMoreThan60Characters = textContentValue.length > 60\n\t\t\tconst isNamedContent =\n\t\t\t\tnode.resolveValue(\"name\")?.toLowerCase() === \"content\" || textContentValue.toLowerCase() === \"content\"\n\n\t\t\tif (hasMultipleNodes || hasMoreThan60Characters || isNamedContent) {\n\t\t\t\tformattedTextNodes.push(node)\n\t\t\t} else {\n\t\t\t\tplainTextNodes.push(node)\n\t\t\t}\n\t\t} else if (isFrameNode(node) && hasImageFill(node)) {\n\t\t\timageNodes.push(node)\n\t\t}\n\t}\n\n\treturn { webPage, plainTextNodes: orderPlainTextNodesByHeading(plainTextNodes), formattedTextNodes, imageNodes }\n}\n\nfunction useAllTextAndImageNodes(source: NodeID) {\n\treturn useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\treturn getAllTextAndImageNodes(source)\n\t})\n}\n\nfunction useExistingCollectionNodeNames(): Set<string> {\n\treturn useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\t\tconst contentManagementNode = getContentManagementNode(engine.tree)?.loaded\n\t\tif (!contentManagementNode) return new Set()\n\n\t\treturn new Set(\n\t\t\tcontentManagementNode?.children.map(node => node.resolveValue(\"name\")?.toLowerCase()).filter(isString),\n\t\t)\n\t})\n}\n\nfunction getTextValue(node: AnyTextNode): string {\n\tif (isTextNode(node)) return node.text\n\treturn node.getTextContent()\n}\n\nfunction addEllipsisIfLong(value: string): string {\n\tif (value.length < 40) return value\n\treturn value.substring(0, 40) + \"\u2026\"\n}\n\nfunction convertNewLinesToParagraphs(value: string): string {\n\treturn value\n\t\t.split(\"\\n\")\n\t\t.map(paragraphContent => `<p>${paragraphContent}</p>`)\n\t\t.join(\"\\n\")\n}\n\nfunction removeSuffixUnlessEmptyString(path: string, suffix: string): string {\n\tconst withoutSuffix = path.slice(0, -suffix.length)\n\treturn withoutSuffix.length > 0 ? withoutSuffix : path\n}\n\nexport function removeSlugFromPathIfRepeated(path: string, slug: string): string {\n\tconst slugWithSlashPrefix = \"/\" + slug\n\tif (path.endsWith(slugWithSlashPrefix)) {\n\t\treturn removeSuffixUnlessEmptyString(path, slugWithSlashPrefix)\n\t}\n\n\tconst slugWithSlashPrefixAndSuffix = slugWithSlashPrefix + \"/\"\n\tif (path.endsWith(slugWithSlashPrefixAndSuffix)) {\n\t\treturn removeSuffixUnlessEmptyString(path, slugWithSlashPrefixAndSuffix)\n\t}\n\n\treturn path\n}\n\nexport function addSlugVariableId(pagePath: string, slugValue: string, slugVariable: SlugVariableDefinition): string {\n\tconst addTrailingSlash = pagePath.endsWith(\"/\")\n\tpagePath = removeSlugFromPathIfRepeated(pagePath, slugValue)\n\tif (!pagePath.endsWith(\"/\")) pagePath += \"/\"\n\tpagePath += `:${slugVariable.id}`\n\tif (addTrailingSlash) pagePath += \"/\"\n\treturn pagePath\n}\n\nfunction useURLPreview(webPage: WebPageNode | null, pageTitle: string): string {\n\tconst { defaultHostname, customHostname } = engine.stores.publishStore.useState()\n\tif (!webPage) return \"\"\n\n\tconst hostBase = customHostname?.hostname || defaultHostname?.hostname\n\n\tconst slugValue = slugify(pageTitle)\n\n\tconst pagePath = getRawWebPagePath(engine.tree, webPage) ?? \"\"\n\tlet url = (hostBase ?? hostnamePlaceholder) + pagePath\n\turl = removeSlugFromPathIfRepeated(url, slugValue)\n\tif (!url.endsWith(\"/\")) url += \"/\"\n\turl += slugValue\n\n\treturn url\n}\n\nfunction clearStylesFromHTML(html: string): string {\n\tconst schema = makeSchema({ ...fullSchemaParams, supportsStyles: false })\n\tconst state = createEditorState(html, schema)\n\treturn serializeRichText(state.doc, schema)\n}\n\ninterface ConvertWebPageToCMSPageOptions {\n\twebPageId: NodeID\n\tcollectionName: string\n\tpageTitleNodeId: NodeID | undefined\n\tcustomTitle: string\n}\n\nconst scopeType = \"collection\"\n\nconst convertWebPageToCMSPage = engine.scheduler.wrapHandler(\n\t({ webPageId, collectionName, pageTitleNodeId, customTitle }: ConvertWebPageToCMSPageOptions) => {\n\t\tconst { webPage, plainTextNodes, formattedTextNodes, imageNodes } = getAllTextAndImageNodes(webPageId)\n\t\tif (!webPage) return\n\n\t\tconst contentManagementNode = createContentManagementNodeIfNeeded(engine.tree)\n\t\tengine.stores.scopeStore.select(contentManagementNode.id, { keepHistory: false })\n\n\t\tconst collectionItemNode = CollectionItemNode.create()\n\n\t\tconst variables: CollectionVariableDefinition[] = []\n\n\t\tconst titleVariable = createVariable(\n\t\t\t{\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tname: \"Title\",\n\t\t\t\tinitialValue: \"\",\n\t\t\t},\n\t\t\tscopeType,\n\t\t)\n\n\t\tconst slugVariable = createVariable(\n\t\t\t{\n\t\t\t\ttype: \"slug\",\n\t\t\t\tname: \"Slug\",\n\t\t\t\tinitialValue: \"\",\n\t\t\t\tassociatedStringVariable: titleVariable.id,\n\t\t\t},\n\t\t\tscopeType,\n\t\t)\n\n\t\tconst usedNames = new Set([titleVariable.name, slugVariable.name])\n\n\t\tvariables.push(titleVariable, slugVariable)\n\n\t\tlet slugValue: string\n\n\t\tconst activePageTitleNode = plainTextNodes.find(node => node.id === pageTitleNodeId)\n\t\tif (activePageTitleNode) {\n\t\t\tconst textValue = getTextValue(activePageTitleNode)\n\t\t\tcollectionItemNode.setControlProp(titleVariable.id, { type: ControlType.String, value: textValue })\n\t\t\tslugValue = slugify(textValue)\n\t\t\tcollectionItemNode.setControlProp(slugVariable.id, { type: ControlType.String, value: slugValue })\n\n\t\t\tactivePageTitleNode.set({\n\t\t\t\ttextContent: createVariableReference(titleVariable.id, webPage.id),\n\t\t\t})\n\t\t} else {\n\t\t\tslugValue = slugify(customTitle)\n\t\t\tcollectionItemNode.setControlProp(titleVariable.id, { type: ControlType.String, value: customTitle })\n\t\t\tcollectionItemNode.setControlProp(slugVariable.id, {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: slugValue,\n\t\t\t})\n\t\t}\n\n\t\tplainTextNodes.forEach(plainTextNode => {\n\t\t\tif (activePageTitleNode && activePageTitleNode.id === plainTextNode.id) return\n\n\t\t\tconst textValue = getTextValue(plainTextNode)\n\t\t\tconst suggestedName = detectNaturalLanguageTitleFromValue(textValue)\n\t\t\tconst name = uniqueName(suggestedName, usedNames)\n\t\t\tusedNames.add(name)\n\n\t\t\tconst plainTextVariable = createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tname,\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t\tvariables.push(plainTextVariable)\n\t\t\tcollectionItemNode.setControlProp(plainTextVariable.id, { type: ControlType.String, value: textValue })\n\n\t\t\tplainTextNode.set({\n\t\t\t\ttextContent: createVariableReference(plainTextVariable.id, webPage.id),\n\t\t\t})\n\t\t})\n\n\t\timageNodes.forEach(imageNode => {\n\t\t\tif (!isString(imageNode.fillImage)) return\n\n\t\t\tconst name = uniqueName(\"Image\", usedNames)\n\t\t\tusedNames.add(name)\n\n\t\t\tconst imageVariable = createVariable({ type: ControlType.Image, name, initialValue: undefined }, scopeType)\n\t\t\tvariables.push(imageVariable)\n\n\t\t\tcollectionItemNode.setControlProp(imageVariable.id, {\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tvalue: imageNode.fillImage,\n\t\t\t})\n\n\t\t\timageNode.set({\n\t\t\t\tfillImage: createVariableReference(imageVariable.id, webPage.id),\n\t\t\t})\n\t\t})\n\n\t\tformattedTextNodes.forEach(textNode => {\n\t\t\tconst name = uniqueName(\"Content\", usedNames)\n\t\t\tusedNames.add(name)\n\n\t\t\tconst richTextVariable = createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\tname,\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t\tvariables.push(richTextVariable)\n\n\t\t\tcollectionItemNode.setControlProp(richTextVariable.id, {\n\t\t\t\ttype: ControlType.RichText,\n\t\t\t\tvalue: isRichTextNode(textNode)\n\t\t\t\t\t? clearStylesFromHTML(textNode.html)\n\t\t\t\t\t: convertNewLinesToParagraphs(textNode.text),\n\t\t\t})\n\n\t\t\tconst htmlContent = createVariableReference(richTextVariable.id, webPage.id)\n\n\t\t\tif (isRichTextNode(textNode)) {\n\t\t\t\ttextNode.set({ htmlContent })\n\t\t\t} else {\n\t\t\t\tconst migration = migrateTextToRichTextNode(engine, textNode)\n\t\t\t\tassert(migration, \"Deprecated text should be converted to rich text node\")\n\t\t\t\tengine.tree.get<RichTextNode>(migration.richTextNode.id)?.set({ htmlContent })\n\t\t\t}\n\t\t})\n\n\t\tconst collection = new CollectionNode({ name: collectionName, variables })\n\t\tcollection.addChild(collectionItemNode)\n\t\trecord(\"collection_record_create\", { source: \"convert_to_cms_page_modal\" })\n\n\t\tconst rawPagePath = getRawWebPagePath(engine.tree, webPage) ?? \"\"\n\t\tconst pathWithPathVariable = addSlugVariableId(rawPagePath, slugValue, slugVariable)\n\t\tengine.tree.get<WebPageNode>(webPageId)?.set({\n\t\t\tdataIdentifier: collection.instanceIdentifier,\n\t\t\tpagePath: pathWithPathVariable,\n\t\t})\n\n\t\tengine.stores.scopeStore.insertNode(collection)\n\t\tengine.stores.selectionStore.set(collectionItemNode.id)\n\t\tengine.stores.codeGenerationStore\n\t\t\t.createModuleFromComponentSource(collection.draftOrCurrent())\n\t\t\t.then(modules => {\n\t\t\t\tmodules?.forEach(module => {\n\t\t\t\t\tif (module?.type !== ModuleType.Collection) return\n\t\t\t\t\trecord(\"collection_create\", {\n\t\t\t\t\t\tmoduleId: module?.id,\n\t\t\t\t\t\trecordCount: collection.getItemCount(),\n\t\t\t\t\t\trecordSource: \"converted_web_page\",\n\t\t\t\t\t\tsource: \"convert_to_cms_page_modal\",\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\n\t\tupdateRouteSegmentsAfterConversion(webPage, collection.instanceIdentifier, pathWithPathVariable)\n\t},\n)\n\nfunction updateRouteSegmentsAfterConversion(\n\twebPage: WebPageNode,\n\tdataIdentifier: ModuleExportIdentifierString,\n\tfullPath: string,\n) {\n\tconst routeSegmentNode = getRouteSegmentNodeByWebPageId(engine.tree, webPage.id)\n\tassert(routeSegmentNode, \"An existing web page should have an associated route segment\", webPage.id)\n\n\t// Create a new route segment node to hold the slug variable.\n\tcreateRouteSegment(engine.tree, engine.componentLoader, webPage, dataIdentifier, fullPath)\n\t// webPageId is moved to the tip\n\trouteSegmentNode.set({\n\t\twebPageId: undefined,\n\t})\n}\n\nexport function ConvertToCMSPageModal({ webPageId }: ModalProps<ModalType.ConvertToCMSPage>) {\n\tconst collectionNameRef = React.useRef<HTMLInputElement>(null)\n\tconst { webPage, plainTextNodes } = useAllTextAndImageNodes(webPageId)\n\tconst existingCollectionNames = useExistingCollectionNodeNames()\n\n\tconst hasPlainTextNodes = plainTextNodes.length > 0\n\n\tconst [collectionName, setCollectionName] = React.useState(\"\")\n\tconst [pageTitleNodeId, setPageTitleNodeId] = React.useState<string | undefined>(\n\t\thasPlainTextNodes ? plainTextNodes[0]?.id : undefined,\n\t)\n\tconst [customTitle, setCustomTitle] = React.useState(\"\")\n\n\tconst activePageTitleNode = plainTextNodes.find(node => node.id === pageTitleNodeId)\n\tconst customTitleActive = !activePageTitleNode\n\tconst pageTitle = activePageTitleNode ? getTextValue(activePageTitleNode) : customTitle\n\n\tconst collectionNameIsUnique = !existingCollectionNames.has(collectionName.trim().toLowerCase())\n\n\tconst convertEnabled = collectionName.trim().length > 0 && pageTitle.trim().length > 0 && collectionNameIsUnique\n\n\tReact.useEffect(() => {\n\t\tconst collectionNameInput = collectionNameRef.current\n\t\tif (!collectionNameInput) return\n\t\tif (collectionNameIsUnique) {\n\t\t\tcollectionNameInput.setCustomValidity(\"\")\n\t\t} else {\n\t\t\tcollectionNameInput.setCustomValidity(\"Collection name already exists\")\n\t\t\tcollectionNameInput.reportValidity()\n\t\t}\n\t}, [collectionNameIsUnique])\n\n\tconst handleConfirm = () => {\n\t\tif (!convertEnabled) return\n\n\t\tengine.stores.modalStore.dismiss()\n\t\tconvertWebPageToCMSPage({ webPageId, collectionName, pageTitleNodeId, customTitle })\n\t}\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tif (!webPage) {\n\t\tengine.stores.modalStore.dismiss()\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<Modal.Root largeModal onDismiss={engine.stores.modalStore.dismiss} onConfirm={handleConfirm} {...modalThemeProps}>\n\t\t\t<Modal.Header separator>Convert to CMS Page</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>\n\t\t\t\t\tA new Collection will be made. Your content will be used to fill in the first item. When adding entries after\n\t\t\t\t\tthat, new pages will be made automatically.\n\t\t\t\t</Modal.Text>\n\n\t\t\t\t<Modal.Separator />\n\n\t\t\t\t<Stack>\n\t\t\t\t\t<Text size={fonts.size.base} className={styles.subTitle}>\n\t\t\t\t\t\tCollection Name\n\t\t\t\t\t</Text>\n\t\t\t\t\t<InputWrapper large>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tref={collectionNameRef}\n\t\t\t\t\t\t\tvalue={collectionName}\n\t\t\t\t\t\t\tonChange={setCollectionName}\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack>\n\t\t\t\t\t<Text size={fonts.size.base} className={styles.subTitle}>\n\t\t\t\t\t\tPage Title\n\t\t\t\t\t</Text>\n\t\t\t\t\t{hasPlainTextNodes && (\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t{plainTextNodes.map(node => (\n\t\t\t\t\t\t\t\t<PopupButtonItem<string>\n\t\t\t\t\t\t\t\t\tkey={node.id}\n\t\t\t\t\t\t\t\t\tidentifier={node.id}\n\t\t\t\t\t\t\t\t\tonSelect={setPageTitleNodeId}\n\t\t\t\t\t\t\t\t\ttitle={addEllipsisIfLong(getTextValue(node))}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t<PopupButtonItem type=\"divider\" />\n\t\t\t\t\t\t\t<PopupButtonItem<undefined> identifier={undefined} onSelect={setPageTitleNodeId} title=\"Custom\" />\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t)}\n\t\t\t\t\t{customTitleActive && (\n\t\t\t\t\t\t<InputWrapper large>\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tvalue={customTitle}\n\t\t\t\t\t\t\t\tplaceholder={hasPlainTextNodes ? \"Page Title\" : undefined}\n\t\t\t\t\t\t\t\tonChange={setCustomTitle}\n\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton>Cancel</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={convertEnabled}>\n\t\t\t\t\tConvert\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import \"ConvertToCMSPageModal.styles_drfqqa.wyw.css\"; export const modal = \"modal_m7opc2h\";\nexport const subTitle = \"subTitle_s97glzf\";\nexport const secondaryText = \"secondaryText_sfecskx\";", "import { ConfirmationModal } from \"@framerjs/fresco\"\nimport { assert, delay, unhandledError } from \"@framerjs/shared\"\nimport { createBlankKitPage } from \"app/ai/utils/kitProject.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { log } from \"code-editor/logger.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { createWebPageWithoutTemplate } from \"document/components/utils/createWebPage.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { startTransition, useState } from \"react\"\nimport { removeEmptySegmentsRecursive } from \"../Pages/utils/commons.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"../Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { ProgressModal } from \"./ProgressModal.tsx\"\n\ninterface ProgressState {\n\tfinished: number\n\ttotal: number\n}\n\nexport function ConvertToKitPageModal({\n\twebPageIds,\n\tcreateBlankKitPage: shouldCreateBlankKitPage = false,\n}: ModalProps<ModalType.ConvertToKitPage>) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst [progressState, setProgressState] = useState<ProgressState | undefined>(undefined)\n\tconst [shouldCreateBlankOnDismiss, setShouldCreateBlankOnDismiss] = useState(shouldCreateBlankKitPage)\n\n\tconst handleDismiss = useEngineCallback(async () => {\n\t\tengine.stores.modalStore.dismiss()\n\n\t\tif (shouldCreateBlankOnDismiss) {\n\t\t\t// Create a new empty kit page.\n\t\t\tawait createBlankKitPage(engine)\n\t\t}\n\t}, [shouldCreateBlankOnDismiss])\n\n\tconst handleConvert = useEngineCallback(async () => {\n\t\tif (progressState !== undefined || webPageIds.length === 0) return\n\n\t\tstartTransition(() => {\n\t\t\tsetShouldCreateBlankOnDismiss(false)\n\t\t\tsetProgressState({ finished: 0, total: webPageIds.length })\n\t\t})\n\n\t\ttry {\n\t\t\tawait convertToKitPages(engine, webPageIds, finished => {\n\t\t\t\tsetProgressState(current => (current ? { ...current, finished } : undefined))\n\t\t\t})\n\n\t\t\t// Dismiss the modal after the process is complete. Wait for a second to ensure the completed bar state\n\t\t\t// is visible.\n\t\t\tvoid waitBrieflyWhenDone().then(() => engine.stores.modalStore.dismiss())\n\t\t} catch (error) {\n\t\t\tunhandledError(error)\n\n\t\t\tstartTransition(() => {\n\t\t\t\tsetShouldCreateBlankOnDismiss(shouldCreateBlankKitPage)\n\t\t\t\tsetProgressState(undefined)\n\t\t\t})\n\t\t}\n\t}, [webPageIds, shouldCreateBlankKitPage, progressState])\n\n\tconst isConverting = progressState !== undefined\n\tif (isConverting) {\n\t\tassert(progressState.total > 0, \"Total pages to process is required\")\n\t\tconst progressValue = progressState.finished / progressState.total\n\n\t\treturn (\n\t\t\t<ProgressModal\n\t\t\t\ttitle=\"Converting Pages\"\n\t\t\t\tdescription=\"Converting\u2026 please keep the project open until the process is complete.\"\n\t\t\t\thasBackdrop\n\t\t\t\tfinishedCount={progressState.finished}\n\t\t\t\ttotalCount={progressState.total}\n\t\t\t\tprogress={progressValue}\n\t\t\t\t// We will dismiss the modal automatically when the process is complete.\n\t\t\t\t// Don't show the done button.\n\t\t\t\tcompleted={false}\n\t\t\t\tonComplete={handleDismiss}\n\t\t\t\tonCancel={handleDismiss}\n\t\t\t\tonDismiss={handleDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"primary\"\n\t\t\ttitle=\"Convert Pages\"\n\t\t\tdescription=\"Turn your Web Pages into Kit Pages. Each top-level layer in a Breakpoint becomes a Section to prompt with.\"\n\t\t\tconfirmLabel=\"Convert\"\n\t\t\tcancelLabel=\"Dismiss\"\n\t\t\thasBackdrop\n\t\t\tonConfirm={handleConvert}\n\t\t\tcancelButtonEnabled\n\t\t\tonCancel={handleDismiss}\n\t\t\tonDismiss={handleDismiss}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\n/**\n * Function that delays a brief period of time to be used to ensure the progress bar is visible.\n *\n * @returns A promise that resolves after the brief delay.\n */\nfunction waitBrieflyWhenDone(): Promise<void> {\n\treturn delay(1500)\n}\n\n/**\n * Convert the given web page IDs to kit pages. This process requires updating the web page nodes to kit pages,\n * detaching route segments, deleting empty segments, code generating, and generating section customizations\n * and screenshots.\n * Important: If we are converting the home page, we will create a new home page. We always need a home page.\n * Note: We immediately select the first page to focus the user on the new kit pages.\n *\n * @param engine - The Vekter engine instance.\n * @param webPageIds - The IDs of the web pages to convert.\n * @param onProgress - A callback function to update the progress state.\n */\nasync function convertToKitPages(\n\tengine: VekterEngine,\n\twebPageIds: NodeID[],\n\tonProgress: (processed: number) => void,\n): Promise<void> {\n\tconst homePageId = engine.tree.root.homePageNodeId\n\tif (homePageId && webPageIds.includes(homePageId)) {\n\t\tcreateNewHomePage(engine)\n\t}\n\n\t// Convert all web page nodes to kit pages.\n\tfor (const id of webPageIds) {\n\t\tconst page = engine.tree.getNodeWithTrait(id, isWebPageNode)\n\t\tassert(page, \"Page should be a web page node\")\n\n\t\t// Detach route segment and delete empty segments.\n\t\tconst routeSegment = getRouteSegmentNodeByWebPageId(engine.tree, page.id)\n\n\t\t// For home pages, there is no route segment.\n\t\tif (routeSegment) {\n\t\t\t// Detach the route segment from the web page.\n\t\t\trouteSegment.set({ webPageId: undefined, dataIdentifier: undefined })\n\n\t\t\t// Delete the route segment and any empty ancestors.\n\t\t\tremoveEmptySegmentsRecursive(routeSegment.id, engine.tree)\n\t\t}\n\n\t\t// Convert page to kit page.\n\t\tpage.set({\n\t\t\tkitPage: true,\n\t\t\tpagePath: undefined,\n\t\t})\n\t}\n\n\tconst firstPageId = webPageIds[0]\n\tassert(firstPageId, \"First page ID is required\")\n\n\t// Expand the kit pages to show the new kit pages.\n\tengine.stores.chromeStore.kitPagesExpanded = true\n\n\t// Immediately select the first page to focus the user on the new kit pages.\n\tengine.stores.scopeStore.select(firstPageId, { keepHistory: false })\n\n\t// Ensure the code generation is up to date for each of the newly converted kit pages.\n\tconst codeGeneratedPages = await updateComponents(engine, webPageIds)\n\n\t// Generate the section customizations and screenshots for each of the newly converted kit pages.\n\tlet completedCount: number = webPageIds.length - codeGeneratedPages.length\n\tawait Promise.all(\n\t\tcodeGeneratedPages.map(id =>\n\t\t\tengine.stores.kitScreenshotStore.updatePage(id).then(() => onProgress(++completedCount)),\n\t\t),\n\t)\n}\n\n/**\n * Creates a new home page and sets the new ID in the root node.\n *\n * @param engine - The Vekter engine instance.\n */\nfunction createNewHomePage(engine: VekterEngine) {\n\tconst page = createWebPageWithoutTemplate({ engine, name: Dictionary.Home, pagePath: undefined })\n\tengine.tree.root.set({ homePageNodeId: page.id })\n}\n\nasync function updateComponents(engine: VekterEngine, webPageIds: NodeID[]) {\n\tconst codeGeneratedPages: NodeID[] = []\n\tawait Promise.all(\n\t\twebPageIds.map(async id => {\n\t\t\ttry {\n\t\t\t\tawait engine.stores.codeGenerationStore.updateComponent(id)\n\t\t\t\tcodeGeneratedPages.push(id)\n\t\t\t} catch (error) {\n\t\t\t\tlog.error(\"Error updating component\", id, error)\n\t\t\t\tunhandledError(error)\n\t\t\t}\n\t\t}),\n\t)\n\n\treturn codeGeneratedPages\n}\n", "import { InputWrapper, Modal, TextInput, modalStyles } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getNormalizedAssetNamePath } from \"document/utils/getNormalizedAssetNamePath.ts\"\nimport {\n\tgetInfoForWebPagesInheritingLayoutTemplate,\n\tgetLayoutTemplateIncompatibleShallowWebPageNodes,\n} from \"export/exportLayoutTemplates.ts\"\nimport React, { useEffect } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\nconst defaultInfo = { incompatible: new Set<NodeID>(), shallow: new Set<NodeID>() }\n\nexport function CreateLayoutTemplateModal({\n\twebPage,\n\tonConfirm,\n}: {\n\twebPage?: WebPageNode\n\tonConfirm: (name: string) => void\n}) {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\t// Determine the number of pages that will be unable to inherit the Layout\n\t// Template when creating a new Layout Template for the Home Page.\n\tconst info = useConstant(() =>\n\t\twebPage?.id === engine.tree.root.homePageNodeId ? getInfoForWebPagesInheritingLayoutTemplate(engine) : defaultInfo,\n\t)\n\n\tconst description = useEngineState(\n\t\t() => {\n\t\t\tif (!webPage) return \"Select a Breakpoint to apply.\"\n\n\t\t\tif (webPage?.id === engine.tree.root.homePageNodeId) {\n\t\t\t\tif (info.shallow.size) return \"Will apply to compatible Pages.\"\n\n\t\t\t\tlet numPagesWithOverrides = 0\n\t\t\t\tlet numWebPages = 0\n\n\t\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\t\tif (!isWebPageNode(node)) continue\n\t\t\t\t\tnumWebPages++\n\n\t\t\t\t\tif (isUndefined(node.layoutTemplateIdentifierOverride) && !info.incompatible.has(node.id)) continue\n\t\t\t\t\tnumPagesWithOverrides++\n\t\t\t\t}\n\n\t\t\t\tif (numPagesWithOverrides === 0 && numWebPages > 0 && info.shallow.size === 0) {\n\t\t\t\t\treturn \"Will be applied to all Pages.\"\n\t\t\t\t} else if (numPagesWithOverrides > 0) {\n\t\t\t\t\tconst count = numWebPages - numPagesWithOverrides\n\t\t\t\t\tif (count > 1) return `Will be applied to ${count} Pages.`\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn \"Will be applied to this Page.\"\n\t\t},\n\t\t[info],\n\t\t[engine.stores.scopeStore, EngineChange.Tree],\n\t)\n\n\tconst shallowInheritingPages = info.shallow\n\tuseEffect(() => {\n\t\tif (!shallowInheritingPages.size) return\n\n\t\t// Kick off a background task to shallow load pages that may be\n\t\t// inheriting the Layout Template.\n\t\tvoid getLayoutTemplateIncompatibleShallowWebPageNodes(engine, shallowInheritingPages)\n\t}, [shallowInheritingPages])\n\n\tconst [name, setName] = React.useState<string>(() => Dictionary.Template)\n\n\tconst submitHandler = useEngineCallback(() => {\n\t\tconst normalizedName = getNormalizedAssetNamePath(name)\n\t\tonConfirm(normalizedName || Dictionary.Template)\n\t\tengine.stores.modalStore.dismiss()\n\t}, [name, onConfirm])\n\n\tconst submitEnabled = getNormalizedAssetNamePath(name).length > 0\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tonConfirm={submitHandler}\n\t\t\tclassName={modalStyles.container}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header>{Dictionary.NewTemplate}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput value={name} placeholder={Dictionary.Title} onChange={setName} constantChange autoFocus />\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Modal.Text>\n\t\t\t\t\t{`Create a new Layout Template for reusable navigations, footers, and more. ${description}`}\n\t\t\t\t</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={submitEnabled}>\n\t\t\t\t\t{Dictionary.Create}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { Modal, NumberInput, Stack, TextInput, modalStyles } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { rightSideOf } from \"document/components/tools/utils/FramesHelper.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport { withBreakpointVariants } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\nexport const CustomBreakpointModal = ({\n\tactionType,\n\tbaseNodeId,\n\tname,\n\twidth,\n}: ModalProps<ModalType.CustomBreakpoint>) => {\n\tconst handleConfirm = useEngineCallback(\n\t\t(name: string, width: number) => {\n\t\t\tengine.stores.modalStore.dismiss()\n\n\t\t\tconst baseNode = engine.tree.getNode(baseNodeId)\n\t\t\tif (!baseNode || !ContextAction.canCreateBreakpoint(baseNode)) return null\n\n\t\t\tconst scope = engine.tree.getScopeNodeFor(baseNode)\n\t\t\tif (!withBreakpointVariants(scope)) return\n\n\t\t\tif (actionType === \"add\") {\n\t\t\t\tconst baseNodeRect = engine.tree.getRect(baseNode)\n\t\t\t\tconst newBreakpointRect: Rect | null = rightSideOf(engine.tree, scope, baseNode, baseNodeRect)\n\n\t\t\t\tContextAction.createBreakpoint(engine, baseNode, scope, newBreakpointRect, width, name)\n\t\t\t\trecord(\"ui_interaction\", { page: MetricsInteractionViews.CANVAS, id: \"add-custom-breakpoint\" })\n\t\t\t} else {\n\t\t\t\tbaseNode.set({ name, width })\n\t\t\t}\n\t\t},\n\t\t[actionType, baseNodeId],\n\t)\n\n\treturn (\n\t\t<CustomBreakpointModalInner\n\t\t\ttitle={`${actionType === \"add\" ? \"New\" : \"Edit\"} ${Dictionary.Breakpoint}`}\n\t\t\tdescription={\n\t\t\t\tactionType === \"add\"\n\t\t\t\t\t? \"Add a new Breakpoint that you can reuse on any Page. If you want to update it, simply change its width.\"\n\t\t\t\t\t: \"After editing this Breakpoint, you will be able to add it to all of your Web Pages.\"\n\t\t\t}\n\t\t\tdefaultName={name}\n\t\t\tdefaultWidth={width}\n\t\t\tconfirmText={capitalizeFirstLetter(actionType)}\n\t\t\tonConfirm={handleConfirm}\n\t\t/>\n\t)\n}\n\ninterface InnerProps {\n\ttitle: string\n\tdescription: string\n\tdefaultName?: string\n\tdefaultWidth?: number\n\tconfirmText?: string\n\tonConfirm: (name: string, width: number) => void\n}\n\nconst CustomBreakpointModalInner = React.memo(\n\t({ title, description, defaultName, defaultWidth, confirmText = \"Confirm\", onConfirm }: InnerProps) => {\n\t\tconst [name, setName] = React.useState<string>(defaultName ?? \"\")\n\t\tconst [width, setWidth] = React.useState<number | undefined>(defaultWidth)\n\n\t\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\t\tconst handleConfirm = () => {\n\t\t\tif (width === undefined) return\n\t\t\tonConfirm(name, width)\n\t\t}\n\n\t\tconst handleWidthChange = (value: number | string) => {\n\t\t\tconst numericValue = isNumber(value) ? value : parseInt(value)\n\t\t\tsetWidth(numericValue)\n\t\t}\n\n\t\tconst canConfirm = () => {\n\t\t\treturn name.trim().length > 0 && isNumber(width)\n\t\t}\n\n\t\treturn (\n\t\t\t<Modal.Root\n\t\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\t\tonConfirm={handleConfirm}\n\t\t\t\tclassName={modalStyles.container}\n\t\t\t\t{...modalThemeProps}\n\t\t\t>\n\t\t\t\t<Modal.Header>{title}</Modal.Header>\n\n\t\t\t\t<Modal.Content>\n\t\t\t\t\t<Stack direction=\"row\" gap={10}>\n\t\t\t\t\t\t<TextInput value={name} placeholder=\"Name\" onChange={setName} constantChange autoFocus />\n\t\t\t\t\t\t<NumberInput\n\t\t\t\t\t\t\tvalue={width}\n\t\t\t\t\t\t\tplaceholder=\"Width\"\n\t\t\t\t\t\t\tonChange={handleWidthChange}\n\t\t\t\t\t\t\tonDisplayValueChange={handleWidthChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<Modal.Text>{description}</Modal.Text>\n\t\t\t\t</Modal.Content>\n\t\t\t\t<Modal.Footer>\n\t\t\t\t\t<Modal.CancelButton>Cancel</Modal.CancelButton>\n\t\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={canConfirm()}>\n\t\t\t\t\t\t{confirmText}\n\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t</Modal.Footer>\n\t\t\t</Modal.Root>\n\t\t)\n\t},\n)\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useState } from \"react\"\n\nexport function DeleteEntityFolderModal({\n\tpath,\n\tonConfirm,\n\tcanDeleteFolder,\n}: ModalProps<ModalType.DeleteEntityFolder>) {\n\tconst [onDeletedPromise, setOnDeletedPromise] = useState<null | Promise<void>>(null)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tuseEffect(() => {\n\t\tif (!onDeletedPromise) return\n\t\tvoid onDeletedPromise.finally(() => setOnDeletedPromise(null))\n\t}, [onDeletedPromise])\n\n\tfunction confirmationHandler() {\n\t\tsetOnDeletedPromise(onConfirm())\n\t}\n\n\tconst content = !canDeleteFolder ? (\n\t\t<>\n\t\t\t<T>The folder</T> <b>{path}</b> <T>cannot be deleted because has component which is currently in use.</T>\n\t\t</>\n\t) : (\n\t\t<>\n\t\t\t<T>Deleting this folder will remove its contents permanently from your project. This cannot be undone.</T>\n\t\t</>\n\t)\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle=\"Delete Folder\"\n\t\t\tdescription={content}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonConfirm={confirmationHandler}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonEnabled={canDeleteFolder}\n\t\t\tconfirmButtonLoading={!!onDeletedPromise}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useState } from \"react\"\n\nexport function DeleteMultipleCodeFilesModal({\n\tpaths,\n\tcanDeleteAll,\n\tonConfirm,\n}: ModalProps<ModalType.DeleteMultipleCodeFiles>) {\n\tconst [onDeletedPromise, setOnDeletedPromise] = useState<null | Promise<void>>(null)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tuseEffect(() => {\n\t\tif (!onDeletedPromise) return\n\t\tvoid onDeletedPromise.finally(() => setOnDeletedPromise(null))\n\t}, [onDeletedPromise])\n\n\tfunction confirmationHandler() {\n\t\tsetOnDeletedPromise(onConfirm())\n\t}\n\n\tconst itemCount = paths.length\n\n\tconst description = !canDeleteAll\n\t\t? \"Some of the selected files cannot be deleted because they are currently in use. Please make sure to first delete all uses of components or overrides from these files.\"\n\t\t: `You are about to delete ${itemCount.toString()} files. They will be removed permanently from your project. This cannot be undone.`\n\n\tconst content = <T>{description}</T>\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={`Delete ${itemCount} Files`}\n\t\t\tdescription={content}\n\t\t\tconfirmLabel={Dictionary.Delete}\n\t\t\tonConfirm={confirmationHandler}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonEnabled={canDeleteAll}\n\t\t\tconfirmButtonLoading={!!onDeletedPromise}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useEffect, useState } from \"react\"\n\nexport function DeleteMultipleEntityFoldersModal({\n\tpaths,\n\tcanDeleteAll,\n\tonConfirm,\n}: ModalProps<ModalType.DeleteMultipleEntityFolders>) {\n\tconst [onDeletedPromise, setOnDeletedPromise] = useState<null | Promise<void>>(null)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tuseEffect(() => {\n\t\tif (!onDeletedPromise) return\n\t\tvoid onDeletedPromise.finally(() => setOnDeletedPromise(null))\n\t}, [onDeletedPromise])\n\n\tfunction confirmationHandler() {\n\t\tsetOnDeletedPromise(onConfirm())\n\t}\n\n\tconst itemCount = paths.length\n\n\tconst description = !canDeleteAll\n\t\t? \"Some of the selected folders cannot be deleted because they contain assets which are currently in use.\"\n\t\t: `Deleting these ${itemCount.toString()} folders will remove their contents permanently from your project. This cannot be undone.`\n\n\tconst content = <T>{description}</T>\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle={`Delete ${itemCount} Folders`}\n\t\t\tdescription={content}\n\t\t\tconfirmLabel={Dictionary.Delete}\n\t\t\tonConfirm={confirmationHandler}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonEnabled={canDeleteAll}\n\t\t\tconfirmButtonLoading={!!onDeletedPromise}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { Button, CustomModal, Stack, Text, modalStyles } from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever, getNewProjectURL } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { accessTokenRefresher } from \"web/lib/accessTokenRefresherWeb.ts\"\nimport { xRequestedByHeader } from \"web/lib/xRequestedByHeader.ts\"\nimport { RelativeTime } from \"../siteSettings/RelativeTime.tsx\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\ntype State = { status: \"loading\" } | { status: \"ok\"; history: TreeOperation[] } | { status: \"error\"; error: unknown }\n\nexport function DuplicateProjectWithVersionModal() {\n\tconst [state, setState] = useState<State>({ status: \"loading\" })\n\tconst [toVersion, setToVersion] = useState<number | undefined>(undefined)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tuseEffect(() => {\n\t\tlet active = true\n\n\t\tgetHistory(toVersion)\n\t\t\t.then(history => {\n\t\t\t\tif (!active) return\n\t\t\t\tsetState({ status: \"ok\", history })\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tif (!active) return\n\t\t\t\tsetState({ status: \"error\", error })\n\t\t\t})\n\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [toVersion])\n\n\tlet content: JSX.Element\n\tswitch (state.status) {\n\t\tcase \"loading\":\n\t\t\tcontent = (\n\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\tPlease wait while version history is loading\u2026\n\t\t\t\t</Text>\n\t\t\t)\n\t\t\tbreak\n\t\tcase \"error\":\n\t\t\tcontent = (\n\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\tAn error occurred loading the version history: {String(state.error)}\n\t\t\t\t</Text>\n\t\t\t)\n\t\t\tbreak\n\t\tcase \"ok\": {\n\t\t\tconst snapshots = state.history.filter(isSnapshotOperation)\n\t\t\tconst nextVersion = (snapshots.at(-1)?.version ?? 0) - 1\n\t\t\tcontent = (\n\t\t\t\t<>\n\t\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\t\tPick a version below to duplicate.\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Stack className={modalStyles.content} direction=\"column\">\n\t\t\t\t\t\t{snapshots.map((snapshot, i) => {\n\t\t\t\t\t\t\treturn <SnapshotRow key={i} snapshot={snapshot} />\n\t\t\t\t\t\t})}\n\t\t\t\t\t\t{nextVersion > 0 && nextVersion !== toVersion && (\n\t\t\t\t\t\t\t<Stack direction=\"row\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ttitle=\"Load older versions\u2026\"\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetState({ status: \"loading\" })\n\t\t\t\t\t\t\t\t\t\tsetToVersion(nextVersion)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tclassName={modalStyles.grow}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t</>\n\t\t\t)\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(state)\n\t}\n\n\treturn (\n\t\t<CustomModal\n\t\t\tvisible\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tclassName={modalStyles.container}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Stack gap={20}>\n\t\t\t\t<Text className={modalStyles.title}>Duplicate project</Text>\n\t\t\t\t{content}\n\t\t\t\t<Stack direction=\"row\">\n\t\t\t\t\t<Button title=\"Close\" onClick={engine.stores.modalStore.dismiss} className={modalStyles.grow} />\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</CustomModal>\n\t)\n}\n\ninterface SnapshotRowProps {\n\tsnapshot: SnapshotOperation\n}\n\nfunction SnapshotRow({ snapshot }: SnapshotRowProps) {\n\tconst duplicateVersion = useCallback(() => {\n\t\tconst projectId = engine.remoteDocument?.projectId\n\t\tassert(projectId, \"missing project id\")\n\t\topenNewTab(getNewProjectURL({ duplicateFrom: projectId, duplicateVersion: snapshot.version }))\n\t}, [snapshot.version])\n\n\treturn (\n\t\t<Stack direction=\"row\" alignItems=\"center\">\n\t\t\t<Stack direction=\"column\" className={modalStyles.grow} gap={8}>\n\t\t\t\t<Text size={fonts.size.base} className={modalStyles.title}>\n\t\t\t\t\tVersion {snapshot.version.toLocaleString(\"en-US\")}\n\t\t\t\t</Text>\n\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\t<RelativeTime timestamp={snapshot.timestamp} />\n\t\t\t\t</Text>\n\t\t\t</Stack>\n\t\t\t<Button onClick={duplicateVersion}>Duplicate</Button>\n\t\t</Stack>\n\t)\n}\n\ninterface SnapshotMetadata {\n\tfromVersion: number\n\ttoVersion: number\n\tupdatesFile: string\n}\n\ntype ReplaceMetadata =\n\t| {\n\t\t\treason: \"new\"\n\t  }\n\t| {\n\t\t\treason: \"migration\"\n\t\t\tfromSchema: number\n\t\t\ttoSchema: number\n\t  }\n\ninterface TreeOperationBase {\n\tid: string\n\ttreeId: string\n\ttimestamp: string\n\tschema: number\n\tversion: number\n\toperation: \"replace\" | \"snapshot\"\n\tmetadata: SnapshotMetadata | ReplaceMetadata\n}\n\ninterface ReplaceOperation extends TreeOperationBase {\n\toperation: \"replace\"\n\tmetadata: ReplaceMetadata\n}\n\ninterface SnapshotOperation extends TreeOperationBase {\n\toperation: \"snapshot\"\n\tmetadata: SnapshotMetadata\n}\n\ntype TreeOperation = ReplaceOperation | SnapshotOperation\n\nfunction isSnapshotOperation(item: TreeOperation): item is SnapshotOperation {\n\treturn item.operation === \"snapshot\"\n}\n\nasync function getHistory(to?: number): Promise<TreeOperation[]> {\n\tconst projectId = engine.remoteDocument?.projectId\n\tassert(projectId, \"cannot load project history without project id\")\n\n\tconst historyURL = new URL(engine.stores.treeStore.serverHistoryURL, window.location.origin)\n\tif (to) {\n\t\tconst from = Math.max(1, to - 5000) // We snapshot every ~500 changes, so this should give ~100 results\n\t\thistoryURL.searchParams.set(\"from\", from.toString())\n\t\thistoryURL.searchParams.set(\"to\", to.toString())\n\t}\n\n\tconst res = await fetch(\n\t\thistoryURL,\n\t\tawait accessTokenRefresher.withAuthorizationHeader({\n\t\t\tmethod: \"GET\",\n\t\t\tcredentials: \"include\",\n\t\t\theaders: xRequestedByHeader,\n\t\t}),\n\t)\n\n\tconst { data } = await res.json()\n\tassert(Array.isArray(data), \"expected a response value with a data array\")\n\treturn data\n}\n", "import { InputWrapper, Modal, Text, TextInput, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { valueToPath } from \"document/components/utils/valueToPath.ts\"\nimport engine from \"document/engine.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { duplicateWebPage } from \"../Pages/utils/duplicatePage.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./DuplicateWebPageModal.styles.ts\"\n\nexport function DuplicateWebPageModal({ duplicateFromId }: ModalProps<ModalType.DuplicateWebPage>) {\n\tconst [name, setName] = React.useState(\"\")\n\tconst [isSubmitting, setIsSubmitting] = React.useState(false)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst submitHandler = () => {\n\t\tif (!name || isSubmitting) return\n\n\t\tconst maybeSource = engine.tree.getNode(duplicateFromId)\n\t\tif (!isWebPageNode(maybeSource)) return\n\n\t\tsetIsSubmitting(true)\n\t\tengine.loadScopesThenProcess([maybeSource], ([source]) => {\n\t\t\tif (source) {\n\t\t\t\tduplicateWebPage(engine, source, source.getPrimaryVariant(), name)\n\t\t\t}\n\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t\tsetIsSubmitting(false)\n\t\t})\n\t}\n\n\treturn (\n\t\t<Modal.Root onDismiss={engine.stores.modalStore.dismiss} onConfirm={submitHandler} {...modalThemeProps}>\n\t\t\t<Modal.Header>{`Duplicate ${Dictionary.WebPage}`}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput value={name} placeholder=\"Name\" onChange={setName} constantChange autoFocus />\n\t\t\t\t\t{name && (\n\t\t\t\t\t\t<Text size={fonts.size.base} disableSpacingCorrection className={cx(truncateWithEllipsis, styles.pathName)}>\n\t\t\t\t\t\t\t{valueToPath(name)}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t)}\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Modal.Text>Duplicate your page, including all of its components and breakpoints.</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={name.length > 0 && !isSubmitting}>\n\t\t\t\t\tDuplicate\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import \"DuplicateWebPageModal.styles_11jfilx.wyw.css\"; export const pathName = \"pathName_poxlc6r\";", "import \"UnlinkComponentModal.styles_ty3qr0.wyw.css\"; export const container = \"container_c118by9r\";", "import { Button, CustomModal, Stack, T, modalStyles } from \"@framerjs/fresco\"\nimport { goToLocalSourceNode } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./UnlinkComponentModal.styles.ts\"\n\nexport function EditVectorModal({\n\tvectorSetNodeId,\n\tmoduleId,\n\titemCount,\n\tinstanceNodeId,\n}: ModalProps<ModalType.EditVector>) {\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst onUnlink = (replaceAll: boolean) => {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.VectorSetUnlink,\n\t\t\tsource: \"edit_action\",\n\t\t\tvectorSetNodeId,\n\t\t\titemCount,\n\t\t\tmoduleId,\n\t\t\tinstanceNodeId,\n\t\t\treplaceAll,\n\t\t\tonSuccess: (vectorSet, localVectorId) => {\n\t\t\t\tgoToLocalSourceNode(vectorSet.id, engine, localVectorId, { keepHistory: false })\n\t\t\t},\n\t\t})\n\t}\n\n\treturn (\n\t\t<CustomModal visible onDismiss={engine.stores.modalStore.dismiss} className={styles.container} {...modalThemeProps}>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<T className={modalStyles.title}>Edit Vector Set</T>\n\t\t\t\t<T className={modalStyles.secondaryText}>\n\t\t\t\t\tThis vector set is linked to an external project. Unlink to edit locally.\n\t\t\t\t</T>\n\t\t\t\t<Stack direction=\"column\">\n\t\t\t\t\t<Button onClick={() => onUnlink(false)}>Unlink Instance</Button>\n\t\t\t\t\t<Button variant=\"primary\" onClick={() => onUnlink(true)}>\n\t\t\t\t\t\tUnlink & Replace All\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</CustomModal>\n\t)\n}\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useState } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { uploadService } from \"web/pages/project/lib/UploadService.ts\"\n\nexport const DeleteCustomFontModal = ({ assetKeysToDelete }: ModalProps<ModalType.DeleteCustomFont>) => {\n\tconst [isDeleting, setIsDeleting] = useState(false)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst deleteFontFamily = async () => {\n\t\tsetIsDeleting(true)\n\t\ttry {\n\t\t\tawait uploadService.deleteAssets({ keys: assetKeysToDelete })\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\tkey: \"fontDeletedSuccess\",\n\t\t\t\tprimaryText: \"Custom font\",\n\t\t\t\tsecondaryText: \"deleted.\",\n\t\t\t\ticon: \"success\",\n\t\t\t\tshowCloseButton: \"never\",\n\t\t\t})\n\t\t} catch (error) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tkey: \"fontDeletedError\",\n\t\t\t\tprimaryText: \"Failed to delete\",\n\t\t\t\tsecondaryText: \"custom font.\",\n\t\t\t\ticon: \"error\",\n\t\t\t})\n\t\t} finally {\n\t\t\tsetIsDeleting(false)\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t}\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle=\"Delete Font\"\n\t\t\tdescription={\n\t\t\t\t<T>\n\t\t\t\t\tDeleting this font means the font won\u2019t display for anyone viewing your project unless they have it installed\n\t\t\t\t\tlocally.\n\t\t\t\t</T>\n\t\t\t}\n\t\t\tconfirmLabel=\"Delete\"\n\t\t\tonConfirm={deleteFontFamily}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tconfirmButtonLoading={isDeleting}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { delay } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport {\n\ttype RegenerationProgress,\n\tgetWebPageModulesToRegenerate,\n\tinterruptLayoutTemplateFlowEffectRegeneration,\n\tregenerateModulesForLayoutTemplateFlowEffect,\n} from \"../properties/utils/regenerateModulesForLayoutTemplateFlowEffect.ts\"\nimport { ProgressModal } from \"./ProgressModal.tsx\"\n\nexport function LayoutTemplateFlowEffectRegenerationModal({\n\tonSuccess,\n}: ModalProps<ModalType.LayoutTemplateFlowEffectRegeneration>) {\n\tconst [progress, setProgress] = React.useState<RegenerationProgress | undefined>(undefined)\n\tconst start = useConstant(() => performance.now())\n\n\tconst dismissModal = React.useCallback(() => {\n\t\tif (engine.stores.modalStore.active.type === ModalType.LayoutTemplateFlowEffectRegeneration) {\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t}\n\t}, [])\n\n\tconst cancelRegeneration = React.useCallback(() => {\n\t\trecord(\"flow_effect_regeneration_cancel\", {\n\t\t\ttotal: progress?.total ?? 0,\n\t\t\tregenerated: progress?.completed ?? 0,\n\t\t\tduration: performance.now() - start,\n\t\t})\n\t\tinterruptLayoutTemplateFlowEffectRegeneration()\n\t\tdismissModal()\n\t}, [dismissModal, progress])\n\n\tconst startRegeneration = React.useCallback(async () => {\n\t\tconst { stats } = getWebPageModulesToRegenerate(engine.stores.modulesStore, engine.stores.treeStore)\n\n\t\trecord(\"flow_effect_regeneration_start\", { total: stats.modulesToRegenerate })\n\n\t\tconst completed = await regenerateModulesForLayoutTemplateFlowEffect(engine.stores, {\n\t\t\tonProgress: setProgress,\n\t\t})\n\t\tif (!completed) return\n\n\t\trecord(\"flow_effect_regeneration_success\", {\n\t\t\ttotal: stats.modulesToRegenerate,\n\t\t\tregenerated: stats.modulesToRegenerate,\n\t\t\tduration: performance.now() - start,\n\t\t})\n\n\t\tawait delay(1000) // Keep the modal open for a short moment after completion to show 100% progress\n\t\tonSuccess?.()\n\t\tdismissModal()\n\t}, [dismissModal, onSuccess])\n\n\tReact.useEffect(() => {\n\t\tvoid startRegeneration()\n\t\treturn interruptLayoutTemplateFlowEffectRegeneration\n\t}, [startRegeneration])\n\n\tif (isUndefined(progress)) return null\n\n\tconst progressFraction = progress.total > 0 ? progress.completed / progress.total : 0\n\n\treturn (\n\t\t<ProgressModal\n\t\t\ttitle=\"Updating Pages\"\n\t\t\tdescription=\"Adding Flow Effect support\u2026 please keep the project open until complete.\"\n\t\t\tfinishedCount={progress.completed}\n\t\t\ttotalCount={progress.total}\n\t\t\tprogress={progressFraction}\n\t\t\tcompleted={progressFraction === 1}\n\t\t\tonComplete={dismissModal}\n\t\t\tonCancel={cancelRegeneration}\n\t\t\tonDismiss={cancelRegeneration}\n\t\t/>\n\t)\n}\n", "import { Modal, Progress } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { DocumentLoader } from \"document/loader/DocumentLoader.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport { DelayMountOrUnmount } from \"./DelayUnmount.tsx\"\nimport * as styles from \"./ProgressModal.styles.ts\"\n\nconst minimumVisibleMillis = 1000\nconst showDelayMillis = 100\n\ninterface CloseModalParams {\n\tstart: number\n\tdone: boolean\n}\n\n// A modal dialog that we show if we are editing while loading, but some task or operation got\n// started that needs the full document available, if that takes a while, we show this modal.\nfunction closeModal(state: CloseModalParams) {\n\tif (state.done) return\n\tstate.done = true\n\n\t// We delay showing the dialog with DelayMountOrUnmount, if we are well below that time, we just close the modal.\n\tconst wasVisibleMillis = performance.now() - state.start\n\tif (wasVisibleMillis < minimumVisibleMillis - 50) {\n\t\tengine.stores.modalStore.dismissModal(ModalType.LoadingFullDocument)\n\t\treturn\n\t}\n\n\t// If the modal was already open for quite a while, we can close it.\n\tconst millisRemaining = minimumVisibleMillis + showDelayMillis - wasVisibleMillis\n\tif (millisRemaining < 0) {\n\t\tengine.stores.modalStore.dismissModal(ModalType.LoadingFullDocument)\n\t\treturn\n\t}\n\n\t// Otherwise, keep it open for a bit longer, so we don't flicker in and out unreadable dialogs.\n\tsetTimeout(() => {\n\t\tengine.stores.modalStore.dismissModal(ModalType.LoadingFullDocument)\n\t}, millisRemaining)\n}\n\nexport interface LoadingFullDocumentModalProps {\n\ttitle?: string\n\tdescription?: React.ReactNode\n\tincludeLocalizationState?: boolean\n\tonCancel?: () => void\n}\n\n/**\n * A modal to indicate that the document is loading. It will only be visible after a small delay,\n * and will stay visible for a minimum amount of time. The modal will dismiss itself when done.\n */\nexport function LoadingFullDocumentModal({\n\ttitle,\n\tdescription,\n\tincludeLocalizationState = false,\n\tonCancel,\n}: LoadingFullDocumentModalProps) {\n\tconst closeModalParams = React.useRef<CloseModalParams>({\n\t\tstart: performance.now(),\n\t\tdone: false,\n\t})\n\n\tconst hasCalculatedLocalizationState = engine.stores.localizationStore.useState(state => {\n\t\treturn state.hasCalculatedLocalizationState\n\t})\n\n\tconst loader = engine.tree.getService(\"loader\")\n\tassert(!loader || loader instanceof DocumentLoader, \"Loader service must be a document loader\")\n\n\tconst [progress, setProgress] = React.useState(() => ({\n\t\ttodo: loader?.numberOfScopesToLoad() ?? 0,\n\t\ttotal: engine.tree.root.children.length,\n\t}))\n\n\tReact.useEffect(() => {\n\t\tif (didFinishLoading({ includeLocalizationState, hasCalculatedLocalizationState, loader })) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tcloseModal(closeModalParams.current)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (!loader) return\n\n\t\tconst update = () => {\n\t\t\tconst todo = loader.numberOfScopesToLoad()\n\t\t\tconst total = engine.tree.root.children.length\n\t\t\tsetProgress({ todo, total })\n\n\t\t\tif (didFinishLoading({ loader, includeLocalizationState, hasCalculatedLocalizationState })) {\n\t\t\t\tcloseModal(closeModalParams.current)\n\t\t\t}\n\t\t}\n\n\t\tloader.on(\"loadedScope\", update)\n\t\tloader.on(\"loadedAllData\", update)\n\n\t\treturn () => {\n\t\t\tloader.off(\"loadedScope\", update)\n\t\t\tloader.off(\"loadedAllData\", update)\n\t\t}\n\t}, [loader, includeLocalizationState, hasCalculatedLocalizationState])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst text = progress.todo > 0 ? (title ?? \"Loading All Project Data\u2026\") : \"Loading Done. Processing\u2026\"\n\tconst loaded = progress.total - progress.todo\n\tconst total = progress.total\n\n\treturn (\n\t\t<DelayMountOrUnmount visible={true} mountDelay={showDelayMillis}>\n\t\t\t<Modal.Root hasBackdrop {...modalThemeProps}>\n\t\t\t\t<Modal.Header\n\t\t\t\t\tseparator={false}\n\t\t\t\t\taccessory={\n\t\t\t\t\t\ttotal > 0 ? (\n\t\t\t\t\t\t\t<span className={styles.label}>\n\t\t\t\t\t\t\t\t{loaded} / {total}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{text}\n\t\t\t\t</Modal.Header>\n\n\t\t\t\t<Modal.Content>\n\t\t\t\t\t<Progress value={loaded} max={total} />\n\t\t\t\t\t{description ? <Modal.Text>{description}</Modal.Text> : null}\n\t\t\t\t</Modal.Content>\n\n\t\t\t\t{onCancel ? (\n\t\t\t\t\t<Modal.Footer>\n\t\t\t\t\t\t<Modal.CancelButton onClick={onCancel}>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t\t</Modal.Footer>\n\t\t\t\t) : null}\n\t\t\t</Modal.Root>\n\t\t</DelayMountOrUnmount>\n\t)\n}\n\nfunction didFinishLoading({\n\tloader,\n\tincludeLocalizationState,\n\thasCalculatedLocalizationState,\n}: {\n\tloader: DocumentLoader | undefined\n\tincludeLocalizationState: boolean\n\thasCalculatedLocalizationState: boolean\n}) {\n\tif (includeLocalizationState) return hasCalculatedLocalizationState\n\tif (!loader) return true\n\treturn loader.numberOfScopesToLoad() === 0\n}\n", "import type { Locale, LocaleId } from \"../WithLocales.ts\"\n\ntype LocaleByLocaleId = ReadonlyMap<LocaleId, Locale>\n\nfunction getLocaleByLocaleId(locales: readonly Locale[]): LocaleByLocaleId {\n\tconst localeByLocaleId: Map<LocaleId, Locale> = new Map()\n\n\tfor (const locale of locales) {\n\t\tlocaleByLocaleId.set(locale.id, locale)\n\t}\n\n\treturn localeByLocaleId\n}\n\nfunction isCircularFallback(\n\tcurrentLocale: Locale,\n\tproposedFallback: Locale,\n\tlocaleByLocaleId: LocaleByLocaleId,\n): boolean {\n\tif (proposedFallback.id === currentLocale.id) return true\n\tif (!proposedFallback.fallback) return false\n\n\tconst seenFallbacks = new Set<LocaleId>()\n\tseenFallbacks.add(currentLocale.id)\n\n\tlet fallbackLocale: Locale | undefined = proposedFallback\n\n\twhile (fallbackLocale) {\n\t\tif (seenFallbacks.has(fallbackLocale.id)) return true\n\t\tseenFallbacks.add(fallbackLocale.id)\n\t\tif (!fallbackLocale.fallback) return false\n\t\tfallbackLocale = localeByLocaleId.get(fallbackLocale.fallback)\n\t}\n\n\treturn false\n}\n\n/** Only includes locales that don't reference the current locale as their fallback. */\nexport function getFallbackOptionsForLocale(currentLocale: Locale, locales: readonly Locale[]): readonly Locale[] {\n\tconst localeByLocaleId = getLocaleByLocaleId(locales)\n\treturn locales.filter(locale => {\n\t\treturn !isCircularFallback(currentLocale, locale, localeByLocaleId)\n\t})\n}\n", "import { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tButton,\n\tCenterChild,\n\tCheckBox,\n\tComboBox,\n\ttype ComboBoxListItemOption,\n\tIconDragHandle,\n\tIconSettings,\n\tReadOnlyContext,\n\tSortableVirtualList,\n\tStack,\n\ttype StickyHeaderLevel,\n\tTranslatable as T,\n\tTextArea,\n\tTextInput,\n\tThemeOverride,\n\tToggle,\n\ttruncateWithEllipsis,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport type { HTMLButtonMouseEvent } from \"@framerjs/fresco/components/types.ts\"\nimport { dimensions } from \"@framerjs/fresco/tokens/dimensions\"\nimport { assert, List, type Prettify, assertNever, emptyArray } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { isAiDisabled, showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport type { LanguageModel } from \"app/ai/languageModels.ts\"\nimport { modelNames, userSelectableLocalizationModels } from \"app/ai/models.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { Locale, LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { type WebMetadata, initialWebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport type { OptionalToUndefined } from \"document/models/CanvasTree/traits/utils/OptionalToUndefined.ts\"\nimport { getFallbackOptionsForLocale } from \"document/models/CanvasTree/traits/utils/getFallbackOptionsForLocale.ts\"\nimport type { ActiveModal } from \"document/stores/ModalStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { motion, type Transition } from \"framer-motion\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { defaultLocaleId } from \"library/router/types.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { shouldEnableDraftStatusForNewEntity } from \"utils/shouldEnableDraftStatusForNewEntity.ts\"\nimport { isFunction, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getBatchTranslatableKeyPaths } from \"../localization/batchTranslateUtils.ts\"\nimport { deleteLocaleWithConfirmation } from \"../localization/createLocale.tsx\"\nimport { dismissMatchingItemsToast } from \"../localization/dismissMatchingItemsToast.ts\"\nimport { useTranslationLimits } from \"../localization/getTranslationLimits.ts\"\nimport { useNameForDefaultLocale } from \"../localization/useNameForDefaultLocale.ts\"\nimport { IconSectionHeaderPlus } from \"../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { PanelRow } from \"../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../properties/utils/doubleColumn.styles.ts\"\nimport { showAiCreditLimitModalIfReached } from \"../shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport { useMetadataUpdateHandler } from \"../siteSettings/useMetadataUpdateHandler.ts\"\nimport { LocaleSelector } from \"./LocaleSelector.tsx\"\nimport * as styles from \"./LocaleSettingsModal.styles.ts\"\nimport { ModalWithSidebar } from \"./ModalWithSidebar.tsx\"\nimport { suggestLocaleName, suggestLocaleSlug } from \"./localeSuggestions.ts\"\nimport type { LocaleCode, LocaleLanguageCode, LocaleRegionCode } from \"./locales.ts\"\nimport { isLocaleCode, isLocaleLanguageCode, isLocaleRegionCode, parseLocaleLanguageAndRegion } from \"./locales.ts\"\n\nconst maxAIStyleCharacterCount = 250\n\nfunction isAIStyleTextTooLong(text: string | undefined): boolean {\n\treturn isString(text) && text.length > maxAIStyleCharacterCount\n}\n\ntype EditableLocaleAttributes = Prettify<\n\tOptionalToUndefined<\n\t\tPick<Locale, \"code\" | \"slug\" | \"name\" | \"customAiInstructions\" | \"fallback\" | \"aiModel\" | \"managedByAI\">\n\t>\n>\n\ntype NonEditableLocaleAttributes = Omit<Locale, keyof EditableLocaleAttributes>\n\nfunction localeToEditableAttributes(locale: Locale): EditableLocaleAttributes {\n\treturn {\n\t\tcode: locale.code,\n\t\tslug: locale.slug,\n\t\tname: locale.name,\n\t\tcustomAiInstructions: locale.customAiInstructions,\n\t\tfallback: locale.fallback,\n\t\taiModel: locale.aiModel,\n\t\tmanagedByAI: locale.managedByAI,\n\t}\n}\n\nfunction createNewEditedLocale(initialLanguageCode?: LocaleCode): EditedNewLocale {\n\treturn {\n\t\ttype: \"new\",\n\t\tattributes: {\n\t\t\tcode: initialLanguageCode || \"\",\n\t\t\tslug: \"\",\n\t\t\tname: \"\",\n\t\t\tcustomAiInstructions: undefined,\n\t\t\tfallback: undefined,\n\t\t\taiModel: undefined,\n\t\t\tmanagedByAI: undefined,\n\t\t},\n\t}\n}\n\ninterface EditedExistingLocale {\n\ttype: \"existing\"\n\tid: LocaleId\n\tattributes: EditableLocaleAttributes\n}\n\ninterface EditedNewLocale {\n\ttype: \"new\"\n\tattributes: EditableLocaleAttributes\n}\n\ntype ExistingOrNewLocale = EditedExistingLocale | EditedNewLocale\n\ninterface Taken {\n\tslugs: ReadonlySet<string>\n\tnames: ReadonlySet<string>\n\tcodes: ReadonlySet<LocaleCode>\n\tregions: ReadonlySet<LocaleRegionCode>\n}\n\nfunction getEditedLocaleWithSuggestions(\n\teditedLocale: ExistingOrNewLocale,\n\ttaken: Taken,\n\tvalidLocaleFallbackOptions: readonly Locale[],\n): ExistingOrNewLocale {\n\tconst editedAttributes = editedLocale.attributes\n\n\tconst localeFallbackIsValid =\n\t\t!editedAttributes.fallback ||\n\t\tvalidLocaleFallbackOptions.some(validFallback => {\n\t\t\treturn validFallback.id === editedAttributes.fallback\n\t\t})\n\n\tconst nameOrSuggestion = editedAttributes.name || suggestLocaleName(editedAttributes.code, taken.names) || \"\"\n\tconst slugOrSuggestion = editedAttributes.slug || suggestLocaleSlug(editedAttributes.code, taken.slugs) || \"\"\n\tconst validFallback = localeFallbackIsValid ? editedAttributes.fallback : undefined\n\n\tif (\n\t\tnameOrSuggestion === editedAttributes.name &&\n\t\tslugOrSuggestion === editedAttributes.slug &&\n\t\tvalidFallback === editedAttributes.fallback\n\t) {\n\t\treturn editedLocale\n\t}\n\n\treturn {\n\t\t...editedLocale,\n\t\tattributes: {\n\t\t\t...editedAttributes,\n\t\t\tname: nameOrSuggestion,\n\t\t\tslug: slugOrSuggestion,\n\t\t\tfallback: validFallback,\n\t\t},\n\t}\n}\n\nfunction hasEditedChanges(\n\teditedLocaleWithSuggestions: ExistingOrNewLocale | null,\n\toriginalVersionOfEditedLocale: Locale | undefined,\n): boolean {\n\tif (!editedLocaleWithSuggestions) return false\n\n\tif (editedLocaleWithSuggestions.type === \"new\") {\n\t\tlet key: keyof EditableLocaleAttributes\n\t\tfor (key in editedLocaleWithSuggestions.attributes) {\n\t\t\tconst value = editedLocaleWithSuggestions.attributes[key]\n\t\t\tif (isUndefined(value)) continue\n\t\t\tif (isString(value) && value.length === 0) continue\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\tif (!originalVersionOfEditedLocale) return true\n\tconst currentLocaleAttributes = localeToEditableAttributes(originalVersionOfEditedLocale)\n\treturn !isEqual(editedLocaleWithSuggestions.attributes, currentLocaleAttributes)\n}\n\nfunction conditionallyShowAutoTranslateDecisionModal(locale: Locale, originalLocale: Locale | undefined) {\n\tif (locale.managedByAI !== true) return\n\t// The locale is already being managed by AI, the user hasn't changed that\n\tif (originalLocale?.managedByAI === true) return\n\n\t// If the locale is at 100% we definitely don't need to translate\n\tconst localeProgress = engine.stores.localizationStore.progressPerLocale[locale.id] ?? 0\n\tif (localeProgress === 1) return\n\n\tconst filteredGroupsAndSources = engine.stores.localizationStore.filteredGroupsAndSources\n\tif (!filteredGroupsAndSources) return\n\n\t// If not at 100% we still may or may not need to show the modal, depending on the AI translation rules for the untranslated items\n\tconst keyPaths = getBatchTranslatableKeyPaths(locale, filteredGroupsAndSources)\n\n\tif (keyPaths.size === 0) return\n\n\tif (showModalIfAiDisabled(engine, \"automatic\")) return\n\tif (showAiCreditLimitModalIfReached(engine, \"automatic\")) return\n\n\tengine.stores.modalStore.push({\n\t\ttype: ModalType.Confirmation,\n\t\ttitle: \"Auto Translate\",\n\t\tdescription:\n\t\t\t\"Auto Translate will only apply to new or updated content. Translate existing content to keep the locale consistent.\",\n\t\tconfirmLabel: \"Translate All Content\",\n\t\tcancelLabel: \"Skip For Now\",\n\t\tbuttonDirection: \"column-reverse\",\n\t\tavoidDismissOnConfirm: true,\n\t\tonConfirm: () => {\n\t\t\tconst freshKeyPaths = getBatchTranslatableKeyPaths(\n\t\t\t\tlocale,\n\t\t\t\tengine.stores.localizationStore.filteredGroupsAndSources,\n\t\t\t)\n\n\t\t\t// Dismiss this decision modal before opening progress UI.\n\t\t\tengine.stores.modalStore.dismiss()\n\n\t\t\tif (freshKeyPaths.size === 0) return\n\n\t\t\tengine.stores.modalStore.push({\n\t\t\t\ttype: ModalType.BatchTranslate,\n\t\t\t\tlocalesWithKeyPaths: [{ locale, keyPaths: freshKeyPaths }],\n\t\t\t\tsource: \"automatic\",\n\t\t\t})\n\t\t},\n\t\tsource: \"automatic\",\n\t})\n}\n\nfunction changesAreValid(editedLocaleWithSuggestions: ExistingOrNewLocale | null, taken: Taken): boolean {\n\tif (!editedLocaleWithSuggestions) return false\n\tconst attributes = editedLocaleWithSuggestions.attributes\n\tif (!isLocaleCode(attributes.code)) return false\n\tif (taken.codes.has(attributes.code)) return false\n\tif (attributes.name.length === 0) return false\n\tif (attributes.slug.length === 0) return false\n\tif (taken.slugs.has(attributes.slug)) return false\n\tif (isAIStyleTextTooLong(attributes.customAiInstructions)) return false\n\treturn true\n}\n\nfunction uniqueContentKey(editedLocale: ExistingOrNewLocale | null, selectedLocaleId: LocaleId | undefined): React.Key {\n\tif (!editedLocale) return selectedLocaleId ?? \"none\"\n\tif (editedLocale.type === \"new\") return \"new\"\n\tif (editedLocale.type === \"existing\") return editedLocale.id\n\tassertNever(editedLocale)\n}\n\ntype SettingView = \"generalSettings\"\n\ntype Panel = SettingView | \"locale\"\n\ninterface SettingItem {\n\ttype: \"settingItem\"\n\tlabel: string\n\ticon: JSX.Element\n\tview: SettingView\n}\n\nconst localeHeaderSlot = Symbol(\"localeHeader\")\nconst spacerSlot = Symbol(\"spacer\")\nconst newLocaleSlot = Symbol(\"newLocale\")\n\nconst SlotType = {\n\tLocaleHeader: localeHeaderSlot,\n\tSpacer: spacerSlot,\n\tNewLocale: newLocaleSlot,\n} as const\n\ntype SlotType = (typeof SlotType)[keyof typeof SlotType]\n\nconst slotTypes = new Set(Object.values(SlotType))\n\ntype ModalProps<T extends ModalType> = Omit<Extract<ActiveModal, { type: T }>, \"type\">\n\nfunction useLocaleSettings({\n\tinitialLocaleId,\n\tinitialNewLocale,\n\tinitialLanguageCode,\n}: ModalProps<ModalType.LocaleSettings>) {\n\tconst slugInput = useRef<HTMLInputElement | null>(null)\n\tconst aiStyleTextArea = useRef<HTMLTextAreaElement | null>(null)\n\n\tconst defaultLocaleCode = useDeprecatedEngineState(EngineChange.Tree, () => engine.tree.root.getDefaultLocaleCode())\n\tconst defaultLocaleName = useNameForDefaultLocale()\n\tconst locales = useDeprecatedEngineState<readonly Locale[]>(EngineChange.Tree, () => {\n\t\treturn engine.tree.root.locales ?? emptyArray()\n\t})\n\n\tconst [selectedLocaleId, setSelectedLocaleId] = useState(initialLocaleId ?? locales?.[0]?.id)\n\n\tconst selectedLocale = useMemo(() => {\n\t\tif (!selectedLocaleId) return undefined\n\t\treturn locales.find(({ id }) => id === selectedLocaleId)\n\t}, [selectedLocaleId, locales])\n\n\t// Auto select first locale if none is selected.\n\tconst firstLocale = locales[0]\n\tif (!selectedLocale && firstLocale) {\n\t\tsetSelectedLocaleId(firstLocale.id)\n\t}\n\n\tconst { canUseCustomAiInstructions, canUseCustomLocaleRegions } = useTranslationLimits()\n\tuseEffect(dismissMatchingItemsToast, [])\n\n\tconst readOnly = useIsViewOnly(\"canEditLocales\")\n\tconst remoteDispatch = useRemoteDispatch()\n\n\t// The raw edited locale doesn't include auto completed suggestions for name and slug and the\n\t// fallback might be invalid.\n\tconst [rawEditedLocale, setRawEditedLocale] = useState<ExistingOrNewLocale | null>(\n\t\tinitialNewLocale ? createNewEditedLocale(initialLanguageCode) : null,\n\t)\n\n\tconst originalVersionOfEditedLocale = useMemo(() => {\n\t\tif (rawEditedLocale?.type !== \"existing\") return undefined\n\t\treturn locales.find(({ id }) => id === rawEditedLocale.id)\n\t}, [rawEditedLocale, locales])\n\n\tconst originalVersionOfEditedLocaleIsDraft = originalVersionOfEditedLocale?.draft ?? false\n\n\tfunction updateEditedLocale(\n\t\tupdate:\n\t\t\t| ((locale: EditableLocaleAttributes) => Partial<EditableLocaleAttributes>)\n\t\t\t| Partial<EditableLocaleAttributes>,\n\t) {\n\t\tsetRawEditedLocale(current => {\n\t\t\tlet existingOrNewLocale: ExistingOrNewLocale\n\n\t\t\tif (current) {\n\t\t\t\texistingOrNewLocale = current\n\t\t\t} else if (selectedLocale) {\n\t\t\t\texistingOrNewLocale = {\n\t\t\t\t\ttype: \"existing\",\n\t\t\t\t\tid: selectedLocale.id,\n\t\t\t\t\tattributes: localeToEditableAttributes(selectedLocale),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst currentAttributes = existingOrNewLocale.attributes\n\t\t\tlet updatedAttributes: EditableLocaleAttributes\n\n\t\t\tif (isFunction(update)) {\n\t\t\t\tupdatedAttributes = {\n\t\t\t\t\t...currentAttributes,\n\t\t\t\t\t...update(currentAttributes),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tupdatedAttributes = {\n\t\t\t\t\t...currentAttributes,\n\t\t\t\t\t...update,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isEqual(updatedAttributes, currentAttributes)) {\n\t\t\t\treturn current\n\t\t\t}\n\n\t\t\treturn { ...existingOrNewLocale, attributes: updatedAttributes }\n\t\t})\n\t}\n\n\tconst localeCode = rawEditedLocale ? rawEditedLocale.attributes.code : (selectedLocale?.code ?? \"\")\n\n\tfunction setLocaleCode(getUpdate: (code: LocaleCode) => LocaleCode) {\n\t\tupdateEditedLocale(current => {\n\t\t\tconst updatedLocaleCode = getUpdate(current.code)\n\t\t\treturn { code: updatedLocaleCode }\n\t\t})\n\t}\n\n\tconst setLocaleLanguageCode = (languageCode: LocaleLanguageCode | \"\") => {\n\t\tsetLocaleCode(current => {\n\t\t\tconst [, regionCode] = parseLocaleLanguageAndRegion(current)\n\t\t\tif (!regionCode) return languageCode\n\t\t\tconst newCode = `${languageCode}-${regionCode}`\n\t\t\tassert(isLocaleCode(newCode))\n\t\t\treturn newCode\n\t\t})\n\t}\n\tconst setLocaleRegionCode = (regionCode: LocaleRegionCode | \"\") => {\n\t\tsetLocaleCode(current => {\n\t\t\tif (!current) return \"\"\n\t\t\tconst [languageCode] = parseLocaleLanguageAndRegion(current)\n\t\t\tif (!languageCode) return \"\"\n\t\t\tif (!regionCode) return languageCode\n\t\t\tconst newCode = `${languageCode}-${regionCode}`\n\t\t\tassert(isLocaleCode(newCode))\n\t\t\treturn newCode\n\t\t})\n\t}\n\n\tfunction setName(newName: string) {\n\t\tupdateEditedLocale({ name: newName })\n\t}\n\n\tfunction setSlug(newSlug: string) {\n\t\tupdateEditedLocale({ slug: newSlug })\n\t}\n\n\tfunction setFallback(newFallback: LocaleId | undefined) {\n\t\tupdateEditedLocale({ fallback: newFallback })\n\t}\n\n\tfunction setAiModel(newAiModel: LanguageModel | undefined) {\n\t\tupdateEditedLocale({ aiModel: newAiModel })\n\t}\n\n\tfunction setCustomAiInstructions(newCustomAiInstructions: string | undefined) {\n\t\tupdateEditedLocale({\n\t\t\tcustomAiInstructions: newCustomAiInstructions === \"\" ? undefined : newCustomAiInstructions,\n\t\t})\n\n\t\tconst aiStyleTextAreaElement = aiStyleTextArea.current\n\t\tif (!aiStyleTextAreaElement) return\n\n\t\taiStyleTextAreaElement.scrollIntoView({ block: \"nearest\" })\n\n\t\tconst isTextTooLong = isAIStyleTextTooLong(newCustomAiInstructions)\n\t\tif (isTextTooLong) {\n\t\t\taiStyleTextAreaElement.setCustomValidity(`Max length is ${maxAIStyleCharacterCount} characters`)\n\t\t\taiStyleTextAreaElement.reportValidity()\n\t\t} else {\n\t\t\taiStyleTextAreaElement.setCustomValidity(\"\")\n\t\t}\n\t}\n\n\tfunction setManagedByAI(newManagedByAI: boolean | undefined) {\n\t\t// If the unsaved locale is undefined and the user toggles on then back off, reset to undefined\n\t\tconst shouldRestoreToUndefined = selectedLocale && selectedLocale.managedByAI === undefined\n\t\tconst newValue = newManagedByAI === false && shouldRestoreToUndefined ? undefined : newManagedByAI\n\t\tupdateEditedLocale({ managedByAI: newValue })\n\t}\n\n\tconst handleSlugChange = (rawSlug: string) => {\n\t\tconst newSlug = slugify(rawSlug)\n\t\tsetSlug(newSlug)\n\n\t\tconst slugInputElement = slugInput.current\n\t\tif (!slugInputElement) return\n\n\t\tif (taken.slugs.has(newSlug)) {\n\t\t\tslugInputElement.setCustomValidity(\"This slug is already used\")\n\t\t\tslugInputElement.reportValidity()\n\t\t} else {\n\t\t\tslugInputElement.setCustomValidity(\"\")\n\t\t}\n\t}\n\n\tconst [rawLanguageCode, rawRegionCode] = parseLocaleLanguageAndRegion(localeCode)\n\tconst languageCode: LocaleLanguageCode | \"\" = isLocaleLanguageCode(rawLanguageCode) ? rawLanguageCode : \"\"\n\tconst regionCode: LocaleRegionCode | \"\" = isLocaleRegionCode(rawRegionCode) ? rawRegionCode : \"\"\n\n\tconst taken = useMemo<Taken>(() => {\n\t\tconst slugs = new Set<string>()\n\t\tconst names = new Set<string>()\n\t\tconst codes = new Set<LocaleCode>()\n\t\tconst regions = new Set<LocaleRegionCode>()\n\n\t\tfunction addTakenLocaleCode(code: string) {\n\t\t\tif (!isLocaleCode(code)) return\n\t\t\tcodes.add(code)\n\n\t\t\tconst [parsedLanguageCode, parsedRegionCode] = parseLocaleLanguageAndRegion(code)\n\t\t\tif (parsedRegionCode && languageCode === parsedLanguageCode) {\n\t\t\t\tregions.add(parsedRegionCode)\n\t\t\t}\n\t\t}\n\n\t\tif (isLocaleCode(defaultLocaleCode)) {\n\t\t\taddTakenLocaleCode(defaultLocaleCode)\n\t\t}\n\n\t\tlet activeLocale: Locale | undefined\n\t\tif (rawEditedLocale) {\n\t\t\tactiveLocale = originalVersionOfEditedLocale\n\t\t} else {\n\t\t\tactiveLocale = selectedLocale\n\t\t}\n\n\t\tfor (const locale of locales) {\n\t\t\tif (locale.id === activeLocale?.id) continue\n\n\t\t\tslugs.add(locale.slug)\n\t\t\tnames.add(locale.name)\n\t\t\taddTakenLocaleCode(locale.code)\n\t\t}\n\n\t\t// Make sure currently selected locale and region codes are still visible, even if they\n\t\t// collide with another locale.\n\t\tconst currentLocaleCode = activeLocale?.code\n\t\tif (isLocaleCode(currentLocaleCode)) {\n\t\t\tcodes.delete(currentLocaleCode)\n\n\t\t\tconst [parsedLanguageCode, parsedRegionCode] = parseLocaleLanguageAndRegion(currentLocaleCode)\n\t\t\tif (parsedRegionCode && languageCode === parsedLanguageCode) {\n\t\t\t\tregions.delete(parsedRegionCode)\n\t\t\t}\n\t\t}\n\n\t\treturn { slugs, names, codes, regions }\n\t}, [defaultLocaleCode, rawEditedLocale, selectedLocale, originalVersionOfEditedLocale, languageCode, locales])\n\n\tconst validLocaleFallbackOptions = useMemo<readonly Locale[]>(() => {\n\t\tif (!locales) return emptyArray()\n\t\tif (!rawEditedLocale) {\n\t\t\tif (!selectedLocale) return emptyArray()\n\t\t\treturn getFallbackOptionsForLocale(selectedLocale, locales)\n\t\t}\n\t\tif (!originalVersionOfEditedLocale) return locales\n\t\treturn getFallbackOptionsForLocale(originalVersionOfEditedLocale, locales)\n\t}, [originalVersionOfEditedLocale, selectedLocale, rawEditedLocale, locales])\n\n\tconst editedLocale = useMemo(() => {\n\t\tif (!rawEditedLocale) return rawEditedLocale\n\t\treturn getEditedLocaleWithSuggestions(rawEditedLocale, taken, validLocaleFallbackOptions)\n\t}, [rawEditedLocale, taken, validLocaleFallbackOptions])\n\n\tconst editedAttributes = editedLocale?.attributes\n\n\tconst rawName = rawEditedLocale ? rawEditedLocale.attributes.name : (selectedLocale?.name ?? \"\")\n\tconst rawSlug = rawEditedLocale ? rawEditedLocale.attributes.slug : (selectedLocale?.slug ?? \"\")\n\tconst name = editedAttributes ? editedAttributes.name : rawName\n\tconst slug = editedAttributes ? editedAttributes.slug : rawSlug\n\tconst fallback = editedAttributes ? editedAttributes.fallback : selectedLocale?.fallback\n\tconst aiModel = editedAttributes ? editedAttributes.aiModel : selectedLocale?.aiModel\n\tconst customAiInstructions = editedAttributes\n\t\t? editedAttributes.customAiInstructions\n\t\t: (selectedLocale?.customAiInstructions ?? \"\")\n\tconst managedByAI = editedAttributes ? editedAttributes.managedByAI : selectedLocale?.managedByAI\n\n\tconst hasChanges = useMemo(() => {\n\t\treturn hasEditedChanges(editedLocale, originalVersionOfEditedLocale)\n\t}, [editedLocale, originalVersionOfEditedLocale])\n\n\tconst hasContent = Boolean(editedLocale || selectedLocale)\n\tconst isEditingLocale = !!editedLocale\n\tconst sortingEnabled = !readOnly && locales.length > 1 && !isEditingLocale\n\tconst canCommitChanges = !readOnly && hasChanges && changesAreValid(editedLocale, taken)\n\n\tconst hasNonEditingUIBeenShown = useRef(!isEditingLocale)\n\tuseEffect(() => {\n\t\thasNonEditingUIBeenShown.current = hasNonEditingUIBeenShown.current || !isEditingLocale\n\t}, [isEditingLocale])\n\n\tconst commitChanges = useCallback(() => {\n\t\tif (!editedLocale) return\n\t\tif (!canCommitChanges) return\n\n\t\tconst currentLocales = engine.tree.root.locales ?? []\n\t\tconst attributes = editedLocale.attributes\n\t\tconst isNew = editedLocale.type === \"new\"\n\n\t\tconst nonEditableAttributes: NonEditableLocaleAttributes = {\n\t\t\tid: isNew ? randomID() : editedLocale.id,\n\t\t\tdraft: isNew ? shouldEnableDraftStatusForNewEntity(engine) : originalVersionOfEditedLocaleIsDraft,\n\t\t}\n\n\t\tconst updatedLocale: Locale = {\n\t\t\t...nonEditableAttributes,\n\t\t\tcode: attributes.code,\n\t\t\tname: attributes.name,\n\t\t\tslug: attributes.slug,\n\t\t\tmanagedByAI: attributes.managedByAI,\n\t\t}\n\n\t\tif (attributes.fallback) {\n\t\t\tupdatedLocale.fallback = attributes.fallback\n\t\t}\n\n\t\tif (attributes.customAiInstructions) {\n\t\t\tupdatedLocale.customAiInstructions = attributes.customAiInstructions\n\t\t}\n\n\t\tif (attributes.aiModel) {\n\t\t\tupdatedLocale.aiModel = attributes.aiModel\n\t\t}\n\n\t\tif (editedLocale.type === \"existing\") {\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tconst index = currentLocales.findIndex(({ id }) => id === editedLocale.id)\n\t\t\t\tconst newLocales = List.replace(currentLocales, index, updatedLocale)\n\t\t\t\tengine.tree.root.set({ locales: newLocales })\n\n\t\t\t\tsetRawEditedLocale(null)\n\n\t\t\t\trecord(\"locale_update\", {\n\t\t\t\t\tcode: updatedLocale.code,\n\t\t\t\t\tname: updatedLocale.name,\n\t\t\t\t\tslug: updatedLocale.slug,\n\t\t\t\t\tdraft: updatedLocale.draft,\n\t\t\t\t\thasFallback: Boolean(attributes.fallback),\n\t\t\t\t\tsource: \"locale_modal\",\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\t\tconditionallyShowAutoTranslateDecisionModal(updatedLocale, originalVersionOfEditedLocale)\n\t\t\t})\n\t\t} else {\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tconst currentLocaleIds = currentLocales.map(locale => locale.id)\n\t\t\t\tconst newLocaleIsUnique = !currentLocaleIds.includes(updatedLocale.id)\n\t\t\t\tassert(newLocaleIsUnique, \"New locale must not have the same ID as an existing locale\")\n\n\t\t\t\tconst newLocales = List.push(currentLocales, updatedLocale)\n\n\t\t\t\tengine.tree.root.set({ locales: newLocales })\n\t\t\t\tengine.stores.localizationStore.selectedLocaleId = updatedLocale.id\n\n\t\t\t\t// When a locale is added from within the modal we keep it open, otherwise we\n\t\t\t\t// dismiss it. That way it's less blocking for the user.\n\t\t\t\tif (hasNonEditingUIBeenShown.current) {\n\t\t\t\t\tsetSelectedLocaleId(updatedLocale.id)\n\t\t\t\t\tsetRawEditedLocale(null)\n\t\t\t\t} else {\n\t\t\t\t\tengine.stores.modalStore.dismissModal(ModalType.LocaleSettings)\n\t\t\t\t}\n\n\t\t\t\trecord(\"locale_create\", {\n\t\t\t\t\tcode: updatedLocale.code,\n\t\t\t\t\tname: updatedLocale.name,\n\t\t\t\t\tslug: updatedLocale.slug,\n\t\t\t\t\tdraft: updatedLocale.draft,\n\t\t\t\t\thasFallback: Boolean(attributes.fallback),\n\t\t\t\t\tsource: \"locale_modal\",\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\t\tconditionallyShowAutoTranslateDecisionModal(updatedLocale, undefined)\n\t\t\t})\n\t\t}\n\t}, [editedLocale, canCommitChanges, originalVersionOfEditedLocale, originalVersionOfEditedLocaleIsDraft])\n\n\tconst moveLocale = useEngineCallback(\n\t\t(from: number, to: number) => {\n\t\t\tengine.tree.root.set({ locales: List.move(locales, from, to) })\n\t\t},\n\t\t[locales],\n\t)\n\n\tconst cancelOrDismiss = useEngineCallback(() => {\n\t\tif (isEditingLocale && locales.length > 0 && hasNonEditingUIBeenShown.current) {\n\t\t\t// Make sure the `onChange` handler is called before we\n\t\t\t// clear the edited locale. Prevents a race condition.\n\t\t\trequestAnimationFrame(() => setRawEditedLocale(null))\n\t\t} else {\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t}\n\t}, [locales.length, isEditingLocale])\n\n\treturn {\n\t\taiModel,\n\t\taiStyleTextArea,\n\t\tcancelOrDismiss,\n\t\tcanCommitChanges,\n\t\tcanUseCustomAiInstructions,\n\t\tcanUseCustomLocaleRegions,\n\t\tcommitChanges,\n\t\tcustomAiInstructions,\n\t\tdefaultLocaleCode,\n\t\tdefaultLocaleName,\n\t\teditedLocale,\n\t\tfallback,\n\t\thandleSlugChange,\n\t\thasContent,\n\t\tisEditingLocale,\n\t\tlanguageCode,\n\t\tlocales,\n\t\tmoveLocale,\n\t\tname,\n\t\trawEditedLocale,\n\t\trawName,\n\t\trawSlug,\n\t\treadOnly,\n\t\tregionCode,\n\t\tremoteDispatch,\n\t\tselectedLocaleId,\n\t\tsetAiModel,\n\t\tsetCustomAiInstructions,\n\t\tsetFallback,\n\t\tsetLocaleLanguageCode,\n\t\tsetLocaleRegionCode,\n\t\tsetManagedByAI,\n\t\tsetName,\n\t\tsetRawEditedLocale,\n\t\tsetSelectedLocaleId,\n\t\tmanagedByAI,\n\t\tslug,\n\t\tslugInput,\n\t\tsortingEnabled,\n\t\ttaken,\n\t\tvalidLocaleFallbackOptions,\n\t}\n}\n\nfunction useSiteSettings() {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst webMetadata = useEngineState(() => engine.tree.root.webMetadata, [], [EngineChange.Tree])\n\tconst { hasMetadataChanges, metadataChanges } = engine.stores.siteSettingsStore.useState()\n\tconst isSitePublished = engine.stores.publishStore.useState(state => state.defaultHostname?.isPublished ?? false)\n\n\t// Reset the form state when changes are cancelled\n\tconst [resetCounter, setResetCounter] = useState(1)\n\n\tconst initialValues = React.useMemo<WebMetadata>(() => {\n\t\treturn {\n\t\t\ttranslatePagePaths: webMetadata?.translatePagePaths ?? initialWebMetadata.translatePagePaths,\n\t\t\ttranslatePagePathsWithAI: webMetadata?.translatePagePathsWithAI ?? initialWebMetadata.translatePagePathsWithAI,\n\t\t\tautomaticLocale: webMetadata?.automaticLocale ?? initialWebMetadata.automaticLocale,\n\t\t}\n\t}, [webMetadata])\n\n\tconst currentAutomaticLocale = metadataChanges.automaticLocale ?? initialValues.automaticLocale\n\tconst currentTranslatePagePaths = metadataChanges.translatePagePaths ?? initialValues.translatePagePaths\n\tconst currentTranslatePagePathsWithAI =\n\t\tmetadataChanges.translatePagePathsWithAI ?? initialValues.translatePagePathsWithAI\n\n\tconst handleUpdateAutomaticLocale = useMetadataUpdateHandler(engine, \"automaticLocale\", initialValues)\n\tconst handleUpdateTranslatePagePaths = useMetadataUpdateHandler(engine, \"translatePagePaths\", initialValues)\n\tconst handleUpdateTranslatePagePathsWithAI = useMetadataUpdateHandler(\n\t\tengine,\n\t\t\"translatePagePathsWithAI\",\n\t\tinitialValues,\n\t)\n\n\tconst handleUpdateTranslatePagePathsWithConfirmation = useCallback(\n\t\t(value: boolean) => {\n\t\t\t// If enabling translated page paths on a site that has already been published, redirects\n\t\t\t// are not generated automatically for the new localized slugs. Warn the user so they can\n\t\t\t// plan to add the redirects themselves before publishing.\n\t\t\tif (value && isSitePublished && !currentTranslatePagePaths) {\n\t\t\t\tengine.stores.modalStore.push({\n\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\tvariant: \"destructive\",\n\t\t\t\t\ttitle: \"Translate Page Paths\",\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Your site has already been published. Enabling translated page paths changes the URLs of localized pages, which can break existing links and SEO. Visitors with the old URLs will see 404 pages unless you add redirects. Do you want to continue?\",\n\t\t\t\t\tconfirmLabel: \"Enable\",\n\t\t\t\t\tcancelLabel: Dictionary.Cancel,\n\t\t\t\t\tonConfirm: () => {\n\t\t\t\t\t\thandleUpdateTranslatePagePaths(true)\n\t\t\t\t\t},\n\t\t\t\t\tsource: \"settings\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\thandleUpdateTranslatePagePaths(value)\n\n\t\t\tif (!value) {\n\t\t\t\thandleUpdateTranslatePagePathsWithAI(false)\n\t\t\t}\n\t\t},\n\t\t[isSitePublished, currentTranslatePagePaths, handleUpdateTranslatePagePaths, handleUpdateTranslatePagePathsWithAI],\n\t)\n\n\tconst commitChanges = useCallback(() => {\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tconst metadataUpdate = engine.stores.siteSettingsStore.getMetadataUpdate()\n\t\t\tengine.tree.root.set({ webMetadata: { ...webMetadata, ...metadataUpdate.metadata } })\n\n\t\t\tif (metadataUpdate.metadata?.automaticLocale) {\n\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\tpage: Pages.siteSettingsAutomaticLocale,\n\t\t\t\t\tid: !currentAutomaticLocale ? UIInteraction.enableAutomaticLocale : UIInteraction.disableAutomaticLocale,\n\t\t\t\t})\n\t\t\t}\n\t\t\tengine.stores.siteSettingsStore.clearMetadataChanges()\n\t\t})\n\t}, [webMetadata, currentAutomaticLocale])\n\n\tconst dismiss = useCallback(() => {\n\t\tif (hasMetadataChanges) return\n\n\t\tengine.stores.modalStore.dismiss()\n\t}, [hasMetadataChanges])\n\n\tconst cancel = useCallback(() => {\n\t\tengine.stores.siteSettingsStore.clearMetadataChanges()\n\t\tsetResetCounter(value => value + 1)\n\t}, [])\n\n\treturn {\n\t\tisViewOnly,\n\t\tcurrentTranslatePagePaths,\n\t\thandleUpdateTranslatePagePaths: handleUpdateTranslatePagePathsWithConfirmation,\n\t\tcurrentTranslatePagePathsWithAI,\n\t\thandleUpdateTranslatePagePathsWithAI,\n\t\tcurrentAutomaticLocale,\n\t\thandleUpdateAutomaticLocale,\n\t\thasMetadataChanges,\n\t\tcancel,\n\t\tdismiss,\n\t\tuniqueKey: resetCounter.toString(),\n\t\tcommitChanges,\n\t}\n}\n\nconst settingsItems: [SettingItem] = [\n\t{\n\t\ttype: \"settingItem\",\n\t\tlabel: \"General\",\n\t\ticon: <IconSettings />,\n\t\tview: \"generalSettings\",\n\t},\n]\n\nfunction IconAgentLocaleSettingsGeneral(props: React.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\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\nconst fixedListItems: [SettingItem, SlotType, SlotType] = [...settingsItems, SlotType.Spacer, SlotType.LocaleHeader]\n\nconst minDragDropIndex = fixedListItems.length\n\nfunction isSlotType(item: unknown): item is SlotType {\n\treturn slotTypes.has(item as SlotType)\n}\n\nfunction isNotSlotType<T>(item: T | SlotType): item is T {\n\treturn !slotTypes.has(item as SlotType)\n}\n\nfunction isSettingItem(item: Locale | SettingItem | SlotType): item is SettingItem {\n\tconst typeKey: keyof SettingItem = \"type\"\n\tconst typeValue: SettingItem[\"type\"] = \"settingItem\"\n\treturn isNotSlotType(item) && typeKey in item && item[typeKey] === typeValue\n}\n\nfunction isLocaleItem(item: Locale | SettingItem | SlotType): item is Locale {\n\tif (isSlotType(item)) return false\n\tif (isSettingItem(item)) return false\n\n\tconst codeKey: keyof Locale = \"code\"\n\tif (codeKey in item) return true\n\n\tassertNever(item)\n}\n\nfunction keyForItem(item: Locale | SettingItem | SlotType) {\n\tif (isSlotType(item)) return item.toString()\n\tif (isSettingItem(item)) return item.view\n\treturn item.id\n}\n\nfunction heightForItem(\n\tlocalesHeaderWrapperHeight: number,\n\tedgePaddingHeight: number,\n\titem: Locale | SettingItem | SlotType,\n) {\n\tif (isNotSlotType(item) || item === SlotType.NewLocale) return styles.rowWrapperHeight\n\tif (item === SlotType.Spacer) return edgePaddingHeight + styles.spacerBorderHeight\n\tif (item === SlotType.LocaleHeader) return localesHeaderWrapperHeight\n\n\tassertNever(item)\n}\n\nfunction stickyHeaderLevelForItem(item: Locale | SettingItem | SlotType): StickyHeaderLevel {\n\tif (isSlotType(item) && item === SlotType.LocaleHeader) return \"primary\"\n\treturn \"off\"\n}\n\nfunction marginTopForItem(edgePaddingHeight: number, _item: Locale | SettingItem | SlotType, index: number): number {\n\treturn index === 0 ? edgePaddingHeight : 0\n}\n\nfunction isLocaleSelected(\n\tlocale: Locale,\n\teditedLocale: ExistingOrNewLocale | null,\n\tselectedLocaleId: LocaleId | undefined,\n) {\n\tlet isSelected = false\n\n\tif (editedLocale) {\n\t\tisSelected = editedLocale.type === \"existing\" && editedLocale.id === locale.id\n\t} else {\n\t\tisSelected = selectedLocaleId === locale.id\n\t}\n\n\treturn isSelected\n}\n\nconst getCurrentItemIndex = (\n\tselectedPanel: Panel,\n\tlistItems: (Locale | SettingItem | SlotType)[],\n\tlocaleSettings: ReturnType<typeof useLocaleSettings>,\n) => {\n\tif (selectedPanel === \"locale\" && localeSettings.editedLocale?.type === \"new\") {\n\t\t// Search from the end of the list as the new locale option is added there\n\t\tconst newLocaleIndex = listItems.findLastIndex(item => item === SlotType.NewLocale)\n\t\treturn newLocaleIndex === -1 ? undefined : newLocaleIndex\n\t}\n\n\tif (selectedPanel === \"locale\") {\n\t\tconst matchingLocaleIndex = listItems.findIndex(\n\t\t\titem =>\n\t\t\t\tisLocaleItem(item) && isLocaleSelected(item, localeSettings.editedLocale, localeSettings.selectedLocaleId),\n\t\t)\n\t\treturn matchingLocaleIndex === -1 ? undefined : matchingLocaleIndex\n\t}\n\n\tconst matchingSettingIndex = listItems.findIndex(item => isSettingItem(item) && item.view === selectedPanel)\n\treturn matchingSettingIndex === -1 ? undefined : matchingSettingIndex\n}\n\nfunction isTheSameItem(item1: Locale | SettingItem | SlotType, item2: Locale | SettingItem | SlotType): boolean {\n\tif (isSlotType(item1)) return item1 === item2\n\tif (isSettingItem(item1)) return isSettingItem(item2) && item1.view === item2.view\n\tif (isLocaleItem(item1)) return isLocaleItem(item2) && item1.id === item2.id\n\tassertNever(item1)\n}\n\nfunction useScrollToIndex(\n\tselectedPanel: Panel,\n\tlistItems: (Locale | SettingItem | SlotType)[],\n\tlocaleSettings: ReturnType<typeof useLocaleSettings>,\n) {\n\tconst [currentItem, setCurrentItem] = useState<\n\t\t{ item: Locale | SettingItem | SlotType; index: number | undefined; shouldScrollToIndex: boolean } | undefined\n\t>(undefined)\n\n\tconst scrollToIndex = currentItem?.shouldScrollToIndex ? currentItem.index : undefined\n\n\tconst previouslySelectedItem = currentItem\n\tconst newlySelectedItemIndex = getCurrentItemIndex(selectedPanel, listItems, localeSettings)\n\n\tif (newlySelectedItemIndex === undefined) return scrollToIndex\n\n\tconst newlySelectedItem = listItems[newlySelectedItemIndex]\n\tif (!newlySelectedItem) return scrollToIndex\n\n\t// If the selected item's index changes because of another user's action, we deliberately retain\n\t// the same item (as determined by isTheSameItem) and do not update the index. This ensures that\n\t// scrolling is not affected by actions from other users.\n\tif (previouslySelectedItem && isTheSameItem(newlySelectedItem, previouslySelectedItem.item)) return scrollToIndex\n\n\tlet shouldScrollToNewIndex = false\n\n\tif (\n\t\t!previouslySelectedItem ||\n\t\tnewlySelectedItem === SlotType.NewLocale ||\n\t\tpreviouslySelectedItem.item === SlotType.NewLocale\n\t) {\n\t\tshouldScrollToNewIndex = true\n\t}\n\n\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\tsetCurrentItem({\n\t\titem: newlySelectedItem,\n\t\tindex: newlySelectedItemIndex,\n\t\tshouldScrollToIndex: shouldScrollToNewIndex,\n\t})\n\n\treturn scrollToIndex\n}\n\nexport function LocaleSettingsModal({\n\tinitialLocaleId,\n\tinitialNewLocale,\n\tinitialLanguageCode,\n\tsource,\n}: ModalProps<ModalType.LocaleSettings>) {\n\tconst localeSettings = useLocaleSettings({\n\t\tinitialLocaleId,\n\t\tinitialNewLocale,\n\t\tinitialLanguageCode,\n\t\tsource,\n\t})\n\n\tconst siteSettings = useSiteSettings()\n\n\tconst modalPadding = useDimensionValue(\"modalPadding\")\n\tconst footerHeight = modalPadding * 2 + dimensions.values.inputHeight\n\tconst edgePaddingHeight = modalPadding - styles.rowMargin\n\tconst localesHeaderWrapperHeight = styles.localesHeaderHeight + styles.localesHeaderPaddingBottom + modalPadding\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\n\tconst [selectedPanel, setSelectedPanel] = useState<Panel>(() => {\n\t\tif (source !== \"toolbar\") return \"locale\"\n\t\treturn settingsItems[0]?.view ?? \"locale\"\n\t})\n\n\tconst handleConfirm = () => {\n\t\tif (selectedPanel === \"locale\") {\n\t\t\tlocaleSettings.commitChanges()\n\t\t\treturn\n\t\t}\n\t\tif (selectedPanel === \"generalSettings\") {\n\t\t\tsiteSettings.commitChanges()\n\t\t\treturn\n\t\t}\n\t\tassertNever(selectedPanel)\n\t}\n\n\tconst handleDismiss = () => {\n\t\tif (selectedPanel === \"locale\") {\n\t\t\tlocaleSettings.cancelOrDismiss()\n\t\t\treturn\n\t\t}\n\t\tif (selectedPanel === \"generalSettings\") {\n\t\t\tsiteSettings.dismiss()\n\t\t\treturn\n\t\t}\n\t\tassertNever(selectedPanel)\n\t}\n\n\tconst handleCancel = () => {\n\t\tif (selectedPanel === \"locale\") {\n\t\t\tlocaleSettings.cancelOrDismiss()\n\t\t\treturn\n\t\t}\n\t\tif (selectedPanel === \"generalSettings\") {\n\t\t\tsiteSettings.cancel()\n\t\t\treturn\n\t\t}\n\t\tassertNever(selectedPanel)\n\t}\n\n\tconst confirmEnabled = useMemo(() => {\n\t\tif (selectedPanel === \"locale\") return localeSettings.canCommitChanges\n\t\tif (selectedPanel === \"generalSettings\") return siteSettings.hasMetadataChanges\n\t\tassertNever(selectedPanel)\n\t}, [selectedPanel, localeSettings.canCommitChanges, siteSettings.hasMetadataChanges])\n\n\tconst showFooter = useMemo(() => {\n\t\tif (selectedPanel === \"locale\") return !!localeSettings.rawEditedLocale\n\t\tif (selectedPanel === \"generalSettings\") return siteSettings.hasMetadataChanges\n\t\tassertNever(selectedPanel)\n\t}, [selectedPanel, localeSettings.rawEditedLocale, siteSettings.hasMetadataChanges])\n\n\tconst disableSidebarInteractions = useMemo(() => {\n\t\tif (selectedPanel === \"locale\") return localeSettings.isEditingLocale\n\t\tif (selectedPanel === \"generalSettings\") return siteSettings.hasMetadataChanges\n\t\tassertNever(selectedPanel)\n\t}, [selectedPanel, localeSettings.isEditingLocale, siteSettings.hasMetadataChanges])\n\n\tconst listItems = useMemo(() => {\n\t\tconst showNewItem = localeSettings.editedLocale?.type === \"new\"\n\t\tconst items: (Locale | SettingItem | SlotType)[] = [...fixedListItems, ...localeSettings.locales]\n\t\tif (showNewItem) {\n\t\t\titems.push(SlotType.NewLocale)\n\t\t}\n\t\treturn items\n\t}, [localeSettings.locales, localeSettings.editedLocale?.type])\n\n\tconst scrollIndex = useScrollToIndex(selectedPanel, listItems, localeSettings)\n\n\tconst moveItem = useCallback(\n\t\t(from: number, to: number) => localeSettings.moveLocale(from - minDragDropIndex, to - minDragDropIndex),\n\t\t[localeSettings.moveLocale],\n\t)\n\n\treturn (\n\t\t<ModalWithSidebar\n\t\t\tmodalTitle=\"Settings\"\n\t\t\tonDismiss={handleDismiss}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tconfirmEnabled={confirmEnabled}\n\t\t\tthemeOverrideMode=\"darkOnDarkModal\"\n\t\t\tscrollableSidebar={false}\n\t\t\tpreferredContentHeight={agentExperimentIsOn ? 538 : 548}\n\t\t\tsidebarContent={\n\t\t\t\t<SortableVirtualList\n\t\t\t\t\tclassName={styles.list}\n\t\t\t\t\titems={listItems}\n\t\t\t\t\tkeyForItem={keyForItem}\n\t\t\t\t\tmarginTopForItem={(item, index) => marginTopForItem(edgePaddingHeight, item, index)}\n\t\t\t\t\tscrollToIndex={scrollIndex}\n\t\t\t\t\tscrollPaddingBottom={edgePaddingHeight}\n\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\tdraggingEnabledForItem={isLocaleItem}\n\t\t\t\t\theightForItem={item => heightForItem(localesHeaderWrapperHeight, edgePaddingHeight, item)}\n\t\t\t\t\tsortingEnabled={localeSettings.sortingEnabled && !disableSidebarInteractions}\n\t\t\t\t\tminDropIndex={minDragDropIndex}\n\t\t\t\t\tstickyHeaderLevelForItem={stickyHeaderLevelForItem}\n\t\t\t\t>\n\t\t\t\t\t{({ item }) => {\n\t\t\t\t\t\tif (item === SlotType.LocaleHeader) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LocaleHeaderRow\n\t\t\t\t\t\t\t\t\tinteractionsBlocked={disableSidebarInteractions}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetSelectedPanel(\"locale\")\n\t\t\t\t\t\t\t\t\t\tlocaleSettings.setRawEditedLocale(createNewEditedLocale(initialLanguageCode))\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\n\t\t\t\t\t\tif (item === SlotType.Spacer) {\n\t\t\t\t\t\t\treturn <div className={styles.spacerRow} />\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (item === SlotType.NewLocale) {\n\t\t\t\t\t\t\tassert(localeSettings.editedLocale)\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LocaleRow\n\t\t\t\t\t\t\t\t\tselected\n\t\t\t\t\t\t\t\t\tinteractionsBlocked\n\t\t\t\t\t\t\t\t\tsortingEnabled={false}\n\t\t\t\t\t\t\t\t\tname={localeSettings.editedLocale.attributes.name || \"New Locale\"}\n\t\t\t\t\t\t\t\t\tcode={localeSettings.editedLocale.attributes.code}\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\n\t\t\t\t\t\tif (isSettingItem(item)) {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<SettingRow\n\t\t\t\t\t\t\t\t\tkey={item.view}\n\t\t\t\t\t\t\t\t\tlabel={item.label}\n\t\t\t\t\t\t\t\t\tselected={selectedPanel === item.view}\n\t\t\t\t\t\t\t\t\tinteractionsBlocked={disableSidebarInteractions}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetSelectedPanel(item.view)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\ticon={agentExperimentIsOn ? <IconAgentLocaleSettingsGeneral /> : item.icon}\n\t\t\t\t\t\t\t\t\ticonContainerClassName={agentExperimentIsOn ? styles.agentRowIconContainer : 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}\n\n\t\t\t\t\t\tif (isLocaleItem(item)) {\n\t\t\t\t\t\t\tconst locale = item\n\t\t\t\t\t\t\tconst isSelected = isLocaleSelected(locale, localeSettings.editedLocale, localeSettings.selectedLocaleId)\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LocaleRow\n\t\t\t\t\t\t\t\t\tname={locale.name}\n\t\t\t\t\t\t\t\t\tcode={locale.code}\n\t\t\t\t\t\t\t\t\tselected={selectedPanel === \"locale\" && isSelected}\n\t\t\t\t\t\t\t\t\tsortingEnabled={localeSettings.sortingEnabled}\n\t\t\t\t\t\t\t\t\tinteractionsBlocked={disableSidebarInteractions}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\tsetSelectedPanel(\"locale\")\n\t\t\t\t\t\t\t\t\t\tlocaleSettings.setSelectedLocaleId(locale.id)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonContextMenu={event => {\n\t\t\t\t\t\t\t\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled: !localeSettings.readOnly,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdeleteLocaleWithConfirmation(locale.id, \"locale_options\", localeSettings.remoteDispatch),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t\t\t\t\t\t\t\t)\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\n\t\t\t\t\t\tassertNever(item)\n\t\t\t\t\t}}\n\t\t\t\t</SortableVirtualList>\n\t\t\t}\n\t\t>\n\t\t\t<Stack gap={0} className={styles.contentContainer}>\n\t\t\t\t<Stack gap={0} className={cx(styles.content, selectedPanel === \"locale\" && styles.localeContent)}>\n\t\t\t\t\t{selectedPanel === \"locale\" && localeSettings.hasContent && <LocaleSettingsContent {...localeSettings} />}\n\t\t\t\t\t{selectedPanel === \"generalSettings\" && <GeneralSettingsContent {...siteSettings} />}\n\t\t\t\t</Stack>\n\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName={styles.stickyFooter}\n\t\t\t\t\tinitial={false}\n\t\t\t\t\tanimate={{ height: showFooter ? footerHeight : 0 }}\n\t\t\t\t\ttransition={footerTransition}\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={false}\n\t\t\t\t\t\tanimate={{ transform: `translateY(${showFooter ? 0 : 100}%)` }}\n\t\t\t\t\t\ttransition={footerTransition}\n\t\t\t\t\t\tclassName={cx(styles.footer, showFooter && styles.footerVisible)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className={styles.footerDividerTop} />\n\t\t\t\t\t\t<Button bold className={styles.footerButton} onClick={handleCancel}>\n\t\t\t\t\t\t\t<T>{Dictionary.Cancel}</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button bold type=\"submit\" variant=\"primary\" enabled={confirmEnabled} className={styles.footerButton}>\n\t\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t\t{selectedPanel === \"generalSettings\"\n\t\t\t\t\t\t\t\t\t? Dictionary.Save\n\t\t\t\t\t\t\t\t\t: selectedPanel === \"locale\" && localeSettings.rawEditedLocale?.type === \"new\"\n\t\t\t\t\t\t\t\t\t\t? Dictionary.Add\n\t\t\t\t\t\t\t\t\t\t: Dictionary.Update}\n\t\t\t\t\t\t\t</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\t\t\t\t</motion.div>\n\t\t\t</Stack>\n\t\t</ModalWithSidebar>\n\t)\n}\n\nconst footerTransition: Transition = {\n\tduration: 0.2,\n\tease: \"easeInOut\",\n}\n\nconst defaultAiModelValue = \"\"\nconst defaultAiModelTitle = \"Auto\"\n\nfunction AiModelDropdown({\n\taiModel,\n\tsetAiModel,\n\tallowUserSelectableModels,\n\treadOnly,\n}: {\n\taiModel: LanguageModel | undefined\n\tsetAiModel: (model: string | undefined) => void\n\tallowUserSelectableModels: boolean\n\treadOnly?: boolean\n}) {\n\tconst displayTitle = allowUserSelectableModels && aiModel ? modelNames[aiModel] : defaultAiModelTitle\n\tconst selectableModels = allowUserSelectableModels ? userSelectableLocalizationModels : emptyArray<LanguageModel>()\n\n\tconst listItems = useMemo(() => {\n\t\tconst items: ComboBoxListItemOption[] = [\n\t\t\t{\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: defaultAiModelValue,\n\t\t\t\ttitle: defaultAiModelTitle,\n\t\t\t\tdescription:\n\t\t\t\t\t\"We choose the best model for each translation. The specific model used will vary based on the content and new releases.\",\n\t\t\t},\n\t\t\t...selectableModels.map(\n\t\t\t\t(model): ComboBoxListItemOption => ({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: model,\n\t\t\t\t\ttitle: modelNames[model],\n\t\t\t\t}),\n\t\t\t),\n\t\t]\n\n\t\t// The locale is using a model that we no longer allow them to choose, but need to show until a different one is selected\n\t\tif (allowUserSelectableModels && aiModel && !selectableModels.includes(aiModel)) {\n\t\t\titems.push({\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: aiModel,\n\t\t\t\ttitle: modelNames[aiModel],\n\t\t\t\tlabel: \"Legacy\",\n\t\t\t\tenabled: false,\n\t\t\t})\n\t\t}\n\n\t\treturn items\n\t}, [aiModel, selectableModels, allowUserSelectableModels])\n\n\treturn (\n\t\t<ComboBox\n\t\t\titems={listItems}\n\t\t\tvalue={displayTitle}\n\t\t\tonChange={(newValue, _final, reset) => {\n\t\t\t\tif (newValue === defaultAiModelValue) {\n\t\t\t\t\tsetAiModel(undefined)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (selectableModels.some(model => model === newValue)) {\n\t\t\t\t\tsetAiModel(newValue)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treset()\n\t\t\t}}\n\t\t\tcheckedItems={aiModel ? [aiModel] : [defaultAiModelValue]}\n\t\t\tenabled={!readOnly && allowUserSelectableModels}\n\t\t\treadOnly={readOnly || !allowUserSelectableModels}\n\t\t\twrapperClassName={doubleColumnClass}\n\t\t\tmenuMinWidth={0}\n\t\t\trightChevron\n\t\t\tmenuWidth=\"input-width\"\n\t\t\topenOnFocus\n\t\t\tshowAllWhenOpened\n\t\t/>\n\t)\n}\n\nfunction FallbackDropdown({\n\tfallback,\n\tsetFallback,\n\treadOnly,\n\tvalidLocaleFallbackOptions,\n\tdefaultLocaleName,\n}: {\n\tfallback: LocaleId | undefined\n\tsetFallback: (fallback: LocaleId | undefined) => void\n\treadOnly?: boolean\n\tvalidLocaleFallbackOptions: readonly Locale[]\n\tdefaultLocaleName: string\n}) {\n\tconst fallbackOptions = useMemo(() => {\n\t\tconst items: ComboBoxListItemOption[] = [\n\t\t\t{\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: defaultLocaleId,\n\t\t\t\ttitle: defaultLocaleName,\n\t\t\t\tlabel: Dictionary.Default,\n\t\t\t},\n\t\t\t...validLocaleFallbackOptions.map(\n\t\t\t\t(fallbackOption): ComboBoxListItemOption => ({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: fallbackOption.id,\n\t\t\t\t\ttitle: fallbackOption.name,\n\t\t\t\t}),\n\t\t\t),\n\t\t]\n\n\t\treturn items\n\t}, [validLocaleFallbackOptions, defaultLocaleName])\n\n\tconst currentFallbackLocaleName = useMemo(() => {\n\t\tconst fallbackLocale = validLocaleFallbackOptions.find(({ id }) => id === fallback)\n\t\tif (fallbackLocale) return fallbackLocale.name\n\n\t\treturn defaultLocaleName\n\t}, [validLocaleFallbackOptions, fallback, defaultLocaleName])\n\n\treturn (\n\t\t<ComboBox\n\t\t\titems={fallbackOptions}\n\t\t\tvalue={currentFallbackLocaleName}\n\t\t\tonChange={(newValue, _final, reset) => {\n\t\t\t\tif (newValue === defaultLocaleId) {\n\t\t\t\t\tsetFallback(undefined)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst fallbackOption = validLocaleFallbackOptions.find(({ id }) => id === newValue)\n\t\t\t\tif (fallbackOption) {\n\t\t\t\t\tsetFallback(fallbackOption.id)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Ignore non-ID values (e.g. display names on blur) and restore current selection.\n\t\t\t\treset()\n\t\t\t}}\n\t\t\tcheckedItems={fallback ? [fallback] : [defaultLocaleId]}\n\t\t\tenabled={!readOnly && validLocaleFallbackOptions.length > 0}\n\t\t\treadOnly={readOnly}\n\t\t\twrapperClassName={doubleColumnClass}\n\t\t\tmenuMinWidth={0}\n\t\t\trightChevron\n\t\t\tmenuWidth=\"input-width\"\n\t\t\topenOnFocus\n\t\t\tshowAllWhenOpened\n\t\t/>\n\t)\n}\n\nconst autoTranslateOptions: ComboBoxListItemOption[] = [\n\t{ type: \"option\", value: \"enabled\", title: Dictionary.Enabled },\n\t{ type: \"option\", value: \"disabled\", title: Dictionary.Disabled },\n]\n\nfunction LocaleSettingsContent({\n\taiModel,\n\taiStyleTextArea,\n\tcanUseCustomAiInstructions,\n\tcanUseCustomLocaleRegions,\n\tcustomAiInstructions,\n\tdefaultLocaleName,\n\teditedLocale,\n\tfallback,\n\thandleSlugChange,\n\tlanguageCode,\n\tmanagedByAI,\n\tname,\n\trawEditedLocale,\n\trawName,\n\trawSlug,\n\treadOnly,\n\tregionCode,\n\tselectedLocaleId,\n\tsetAiModel,\n\tsetCustomAiInstructions,\n\tsetFallback,\n\tsetLocaleLanguageCode,\n\tsetLocaleRegionCode,\n\tsetManagedByAI,\n\tsetName,\n\tslug,\n\tslugInput,\n\ttaken,\n\tvalidLocaleFallbackOptions,\n}: ReturnType<typeof useLocaleSettings>) {\n\tconst isEnterpriseProject = engine.stores.projectStore.useState(\n\t\tstate => state.projectLicenseType === ProjectLicenseType.EnterpriseSite,\n\t)\n\n\tconst localizationAiUpdateExperimentEnabled = useExperimentIsOn(\n\t\t\"localizationAiUpdate\",\n\t\tengine.stores.previewStore.framerSiteId,\n\t)\n\tconst showAiSettingsSection = localizationAiUpdateExperimentEnabled || canUseCustomAiInstructions\n\tconst autoTranslateValue = managedByAI ? \"enabled\" : \"disabled\"\n\tconst aiDisabled = isAiDisabled(engine)\n\n\treturn (\n\t\t<React.Fragment key={uniqueContentKey(rawEditedLocale, selectedLocaleId)}>\n\t\t\t<ReadOnlyContext.Provider value={readOnly}>\n\t\t\t\t<PanelRow title=\"Language\">\n\t\t\t\t\t<LocaleSelector\n\t\t\t\t\t\ttype=\"language\"\n\t\t\t\t\t\tvalue={languageCode}\n\t\t\t\t\t\tonChange={setLocaleLanguageCode}\n\t\t\t\t\t\tautoFocus={editedLocale?.type === \"new\"}\n\t\t\t\t\t\tclearingEnabled={false}\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\tmenuMinWidth={0}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title=\"Region\">\n\t\t\t\t\t<LocaleSelector\n\t\t\t\t\t\ttype=\"region\"\n\t\t\t\t\t\tvalue={regionCode}\n\t\t\t\t\t\tplaceholder={Dictionary.None}\n\t\t\t\t\t\texcluded={taken.regions}\n\t\t\t\t\t\tlanguageCode={languageCode}\n\t\t\t\t\t\tonChange={setLocaleRegionCode}\n\t\t\t\t\t\tupsellOtherRegions={!canUseCustomLocaleRegions}\n\t\t\t\t\t\tenabled={isLocaleLanguageCode(languageCode)}\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\tmenuMinWidth={0}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title=\"Name\">\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvalue={rawName}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tonChange={setName}\n\t\t\t\t\t\tplaceholder={name}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title=\"Slug\">\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvalue={rawSlug}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tref={slugInput}\n\t\t\t\t\t\tplaceholder={slug}\n\t\t\t\t\t\tonChange={handleSlugChange}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title={Dictionary.Fallback}>\n\t\t\t\t\t<FallbackDropdown\n\t\t\t\t\t\tfallback={fallback}\n\t\t\t\t\t\tsetFallback={setFallback}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tvalidLocaleFallbackOptions={validLocaleFallbackOptions}\n\t\t\t\t\t\tdefaultLocaleName={defaultLocaleName}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\n\t\t\t\t{showAiSettingsSection && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={styles.localeSettingDivider} />\n\t\t\t\t\t\t<div className={styles.localeSettingsHeader}>AI Settings</div>\n\n\t\t\t\t\t\t{aiDisabled && (\n\t\t\t\t\t\t\t<div className={styles.localeSettingsMessage}>\n\t\t\t\t\t\t\t\tAn admin in your workspace has disabled all AI features.\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{!aiDisabled && localizationAiUpdateExperimentEnabled && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<PanelRow title=\"Auto Translate\" titleTooltip=\"Automatically translate content with AI\">\n\t\t\t\t\t\t\t\t\t<Stack gap={5} className={doubleColumnClass}>\n\t\t\t\t\t\t\t\t\t\t<ComboBox\n\t\t\t\t\t\t\t\t\t\t\titems={autoTranslateOptions}\n\t\t\t\t\t\t\t\t\t\t\tvalue={autoTranslateValue === \"enabled\" ? \"Enabled\" : \"Disabled\"}\n\t\t\t\t\t\t\t\t\t\t\tonChange={(newValue, _final, reset) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (newValue === \"enabled\") {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetManagedByAI(true)\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tif (newValue === \"disabled\") {\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetManagedByAI(false)\n\t\t\t\t\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\treset()\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tcheckedItems={[autoTranslateValue]}\n\t\t\t\t\t\t\t\t\t\t\tenabled={!readOnly && !aiDisabled}\n\t\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\t\t\t\t\t\tmenuMinWidth={0}\n\t\t\t\t\t\t\t\t\t\t\trightChevron\n\t\t\t\t\t\t\t\t\t\t\tmenuWidth=\"input-width\"\n\t\t\t\t\t\t\t\t\t\t\topenOnFocus\n\t\t\t\t\t\t\t\t\t\t\tshowAllWhenOpened\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<div className={styles.settingsDescription}>\n\t\t\t\t\t\t\t\t\t\t\tAuto translate this locale when adding or updating content.\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t\t\t\t<PanelRow title=\"AI Model\">\n\t\t\t\t\t\t\t\t\t<AiModelDropdown\n\t\t\t\t\t\t\t\t\t\taiModel={aiModel}\n\t\t\t\t\t\t\t\t\t\tsetAiModel={setAiModel}\n\t\t\t\t\t\t\t\t\t\tallowUserSelectableModels={isEnterpriseProject}\n\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{!aiDisabled && canUseCustomAiInstructions && (\n\t\t\t\t\t\t\t<PanelRow title=\"Style\">\n\t\t\t\t\t\t\t\t<ThemeOverride mode={isAIStyleTextTooLong(customAiInstructions) ? \"warning\" : undefined}>\n\t\t\t\t\t\t\t\t\t<TextArea\n\t\t\t\t\t\t\t\t\t\tautoResize\n\t\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\t\tminRows={4}\n\t\t\t\t\t\t\t\t\t\tref={aiStyleTextArea}\n\t\t\t\t\t\t\t\t\t\tonChange={setCustomAiInstructions}\n\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.aiInstructionsTextArea, doubleColumnClass)}\n\t\t\t\t\t\t\t\t\t\tplaceholder=\"Translate content with a cheerful tone, intended for an audience of designers\u2026\"\n\t\t\t\t\t\t\t\t\t\tvalue={customAiInstructions ?? \"\"}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ThemeOverride>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</React.Fragment>\n\t)\n}\n\nfunction LocaleRow({\n\tname,\n\tcode,\n\tselected,\n\tsortingEnabled,\n\tinteractionsBlocked,\n\tonClick,\n\tonContextMenu,\n}: {\n\tname: string\n\tcode: LocaleCode\n\tselected: boolean\n\tsortingEnabled: boolean\n\tinteractionsBlocked: boolean\n\tonClick?: React.MouseEventHandler<HTMLDivElement>\n\tonContextMenu?: React.MouseEventHandler<HTMLDivElement>\n}) {\n\treturn (\n\t\t<div className={styles.rowWrapper}>\n\t\t\t<Stack\n\t\t\t\tgap={8}\n\t\t\t\tpaddingLeft={8}\n\t\t\t\tpaddingRight={9}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tonClick={interactionsBlocked ? undefined : onClick}\n\t\t\t\tonContextMenu={interactionsBlocked ? undefined : onContextMenu}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.row,\n\t\t\t\t\tselected && styles.selectedRow,\n\t\t\t\t\tinteractionsBlocked && !selected && styles.interactionsBlocked,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div className={styles.rowIconContainer}>\n\t\t\t\t\t<LocaleFlag localeCode={code} />\n\t\t\t\t</div>\n\t\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>{name}</div>\n\t\t\t\t<CenterChild\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.dragHandle,\n\t\t\t\t\t\t!sortingEnabled && styles.dragHandleDisabled,\n\t\t\t\t\t\tselected && styles.dragHandleSelected,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<IconDragHandle />\n\t\t\t\t</CenterChild>\n\t\t\t</Stack>\n\t\t</div>\n\t)\n}\n\nfunction LocaleHeaderRow({\n\tinteractionsBlocked,\n\tonClick,\n}: {\n\tinteractionsBlocked: boolean\n\tonClick: React.MouseEventHandler<HTMLButtonElement>\n}) {\n\treturn (\n\t\t<Stack direction=\"row\" justifyContent=\"space-between\" className={styles.localesHeader}>\n\t\t\t{Dictionary.Locales}\n\t\t\t<HandleClickOnClick>\n\t\t\t\t<AddLocaleButton enabled={!interactionsBlocked} onClick={onClick} />\n\t\t\t</HandleClickOnClick>\n\t\t</Stack>\n\t)\n}\n\nfunction SettingRow({\n\tlabel,\n\tselected,\n\tinteractionsBlocked,\n\tonClick,\n\ticon,\n\ticonContainerClassName,\n}: {\n\tlabel: string\n\tselected: boolean\n\tinteractionsBlocked: boolean\n\tonClick: React.MouseEventHandler<HTMLDivElement>\n\ticon: JSX.Element\n\ticonContainerClassName?: string\n}) {\n\treturn (\n\t\t<div className={cx(styles.rowWrapper)}>\n\t\t\t<Stack\n\t\t\t\tgap={8}\n\t\t\t\tpaddingLeft={8}\n\t\t\t\tpaddingRight={9}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tonClick={interactionsBlocked ? undefined : onClick}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.row,\n\t\t\t\t\tselected && styles.selectedRow,\n\t\t\t\t\tinteractionsBlocked && !selected && styles.interactionsBlocked,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div className={cx(styles.rowIconContainer, iconContainerClassName)}>{icon}</div>\n\t\t\t\t<div className={cx(styles.rowTitle)}>{label}</div>\n\t\t\t</Stack>\n\t\t</div>\n\t)\n}\n\ninterface AddLocaleButtonProps {\n\tonClick: (event?: HTMLButtonMouseEvent | undefined) => void\n\tenabled?: boolean\n}\n\nfunction AddLocaleButton({ enabled = true, onClick }: AddLocaleButtonProps) {\n\tconst isReadOnly = useReadOnly()\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"clean\"\n\t\t\tonClick={onClick}\n\t\t\ttitle={`Add ${Dictionary.Locale}`}\n\t\t\tenabled={enabled && !isReadOnly}\n\t\t\tclassName={styles.addLocaleButton}\n\t\t>\n\t\t\t<IconSectionHeaderPlus />\n\t\t</Button>\n\t)\n}\n\nfunction GeneralSettingsContent({\n\tisViewOnly,\n\tcurrentTranslatePagePaths,\n\thandleUpdateTranslatePagePaths,\n\tcurrentTranslatePagePathsWithAI,\n\thandleUpdateTranslatePagePathsWithAI,\n\tcurrentAutomaticLocale,\n\thandleUpdateAutomaticLocale,\n\tuniqueKey,\n}: ReturnType<typeof useSiteSettings>) {\n\treturn (\n\t\t<React.Fragment key={uniqueKey}>\n\t\t\t<Stack gap={15}>\n\t\t\t\t<Stack gap={5} className={styles.generalSettingsSection}>\n\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" gap={10}>\n\t\t\t\t\t\t<div className={styles.generalSettingsHeader}>Automatic Locale</div>\n\n\t\t\t\t\t\t<Toggle\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tvalue={!!currentAutomaticLocale}\n\t\t\t\t\t\t\tonChange={handleUpdateAutomaticLocale}\n\t\t\t\t\t\t\tsmall\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<div className={cx(styles.settingsDescription, styles.settingsDescriptionBalanced)}>\n\t\t\t\t\t\tAuto-redirect site visitors to a locale based on their browser language.\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack gap={15} className={styles.generalSettingsSection}>\n\t\t\t\t\t<Stack gap={5}>\n\t\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" gap={10}>\n\t\t\t\t\t\t\t<div className={styles.generalSettingsHeader}>Translate Page Paths</div>\n\t\t\t\t\t\t\t<Toggle\n\t\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\t\tvalue={!!currentTranslatePagePaths}\n\t\t\t\t\t\t\t\tonChange={handleUpdateTranslatePagePaths}\n\t\t\t\t\t\t\t\tsmall\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<div className={cx(styles.settingsDescription, styles.settingsDescriptionBalanced)}>\n\t\t\t\t\t\t\tAllow translating page paths like &quot;/about&quot; and include them in the localization view.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<SettingCheckbox\n\t\t\t\t\t\tlabel=\"Include when translating with AI\"\n\t\t\t\t\t\tenabled={!isViewOnly && !!currentTranslatePagePaths}\n\t\t\t\t\t\tchecked={currentTranslatePagePathsWithAI}\n\t\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\t\thandleUpdateTranslatePagePathsWithAI(value)\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</React.Fragment>\n\t)\n}\n\ninterface SettingCheckboxProps {\n\tlabel: string | React.ReactNode\n\tenabled?: boolean\n\tchecked?: boolean\n\tonChange: (value: boolean) => void\n}\n\nconst SettingCheckbox = ({ label, checked = false, enabled = true, onChange }: SettingCheckboxProps) => {\n\treturn (\n\t\t<label className={cx(styles.label, enabled === false && styles.labelDisabled)}>\n\t\t\t<CheckBox enabled={enabled} value={checked} onChange={() => onChange(!checked)} />\n\t\t\t<span className={styles.labelTitle}>{label}</span>\n\t\t</label>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { getNameForDefaultLocale } from \"./getNameForDefaultLocale.ts\"\n\nexport function useNameForDefaultLocale() {\n\treturn useDeprecatedEngineState(EngineChange.Tree, (): string => {\n\t\treturn getNameForDefaultLocale(engine.tree)\n\t})\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isVariableReference, isVariableReferenceEqual } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { useCallback } from \"react\"\n\nfunction isEqualValue(value: unknown, initialValue: unknown): boolean {\n\tif (isVariableReference(value)) return isVariableReferenceEqual(value, initialValue)\n\treturn value === initialValue\n}\n\nexport function useMetadataUpdateHandler<K extends keyof WebMetadata>(\n\tengine: VekterEngine,\n\tkey: K,\n\tinitialValues: WebMetadata,\n): (value: WebMetadata[K]) => void {\n\treturn useCallback(\n\t\t(value: WebMetadata[K]) => {\n\t\t\t// Often called from an unblur handler, in which case the engine is in rendering, and no\n\t\t\t// data changes are permitted. So we wrap this in processWhenReady.\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tconst initialValue = initialValues[key]\n\t\t\t\tconst update = isEqualValue(value, initialValue) ? null : value\n\t\t\t\tengine.stores.siteSettingsStore.updateMetadataValue(key, update)\n\t\t\t})\n\t\t},\n\t\t[engine, key, initialValues],\n\t)\n}\n", "import \"LocaleSettingsModal.styles_yf92zu.wyw.css\"; export const aiInstructionsTextArea = \"aiInstructionsTextArea_auns61k\";\nexport const contentContainer = \"contentContainer_cryi3yk\";\nexport const content = \"content_cozajlz\";\nexport const localeContent = \"localeContent_l166lxhr\";\nexport const stickyFooter = \"stickyFooter_swgkoao\";\nexport const footer = \"footer_f119f2cz\";\nexport const footerVisible = \"footerVisible_f969337\";\nexport const footerButton = \"footerButton_fe82zea\";\nexport const footerDividerTop = \"footerDividerTop_ft66jch\";\nexport const rowMargin = 2.5;\nconst rowHeight = 30;\nexport const list = \"list_l1lbrex0\";\nexport const row = \"row_r1svi5x3\";\nexport const rowWrapperHeight = rowHeight + rowMargin * 2;\nexport const rowWrapper = \"rowWrapper_r1os45az\";\nexport const interactionsBlocked = \"interactionsBlocked_i1lj5uzv\";\nexport const selectedRow = \"selectedRow_scggn03\";\nexport const rowTitle = \"rowTitle_r1d8wky\";\nexport const rowIconContainer = \"rowIconContainer_r69rtry\";\nexport const agentRowIconContainer = \"agentRowIconContainer_acra8ct\";\nexport const dragHandle = \"dragHandle_d12ch4eb\";\nexport const dragHandleSelected = \"dragHandleSelected_d1fc20w3\";\nexport const dragHandleDisabled = \"dragHandleDisabled_d7e7e0f\";\nexport const localesHeaderHeight = 20;\nexport const localesHeaderPaddingBottom = 10 + 3;\nexport const localesHeaderWrapper = \"localesHeaderWrapper_lurnbd0\";\nexport const localesHeader = \"localesHeader_l1tcidau\";\nexport const spacerBorderHeight = 1;\nexport const spacerRow = \"spacerRow_shcqp7d\";\nexport const addLocaleButton = \"addLocaleButton_a1gqeki5\";\nexport const generalSettingsSection = \"generalSettingsSection_g1jywv1q\";\nexport const generalSettingsHeader = \"generalSettingsHeader_gbtq8tt\";\nexport const settingsDescription = \"settingsDescription_s1akbz4p\";\nexport const settingsDescriptionBalanced = \"settingsDescriptionBalanced_sos6y0r\";\nexport const label = \"label_l1ysi2e8\";\nexport const labelDisabled = \"labelDisabled_liw0wql\";\nexport const labelTitle = \"labelTitle_l10kjgw9\";\nexport const localeSettingDivider = \"localeSettingDivider_li1zl4p\";\nexport const localeSettingsHeader = \"localeSettingsHeader_l1r7499g\";\nexport const localeSettingsMessage = \"localeSettingsMessage_l1d0103t\";", "import type { ModulesAPI } from \"@framerjs/framer-services\"\nimport {\n\tBadge,\n\tButton,\n\tCopyButton,\n\tCustomModal,\n\tPopupButton,\n\tPopupButtonItem,\n\tSpinner,\n\tStack,\n\tText,\n\tTextInput,\n\tmodalStyles,\n} from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { ModuleType, asLocalId, assertNever, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { isVectorSetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type { ModuleHandle, PersistedModule } from \"modules/ModulesStorage.ts\"\nimport {\n\tcomponentExportIdentifierForModule,\n\tgetModuleImportStatement,\n\tmoduleUrlWithExportSpecifierFragment,\n} from \"modules/utils.ts\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport type { ReleaseType } from \"semver\"\nimport { inc } from \"semver\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\nimport * as styles from \"./ModulePublishingModal.styles.ts\"\n\n/*\n * INTERNAL MODULE PUBLISHING MODAL\n * Currently behind the \"moduleTools\" employee setting\n */\n\ninterface ModalProps<T extends ModuleType> {\n\tmoduleHandle: ModuleHandle<T>\n}\n\ninterface PublishInfo {\n\tnamespaceId: string\n\tname: string\n\tversion: string\n\timportURL: string\n}\n\nconst releaseTypeOptions = [\"patch\", \"minor\", \"major\"]\n\nfunction isPublishableModuleType(type: ModuleType) {\n\tswitch (type) {\n\t\tcase ModuleType.Canvas:\n\t\tcase ModuleType.VectorSet:\n\t\tcase ModuleType.Code:\n\t\tcase ModuleType.Kit:\n\t\tcase ModuleType.Shader:\n\t\t\treturn true\n\t\tcase ModuleType.Vector:\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.LayoutTemplate:\n\t\tcase ModuleType.Localization:\n\t\tcase ModuleType.Design:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(type, \"Module is not publishable \" + type)\n\t}\n}\n\nfunction titleForModuleType(type: ModuleType) {\n\tswitch (type) {\n\t\tcase ModuleType.Canvas:\n\t\t\treturn Dictionary.Component\n\t\tcase ModuleType.VectorSet:\n\t\t\treturn Dictionary.VectorSet\n\t\tcase ModuleType.Code:\n\t\t\treturn Dictionary.Code\n\t\tdefault:\n\t\t\treturn\n\t}\n}\n\nfunction ModalInner<T extends ModuleType>({ moduleHandle }: ModalProps<T>) {\n\tconst persistedModule = engine.stores.modulesStore.getPersistedModuleByLocalId(moduleHandle.localId)\n\tconst [lastPublish, setLastPublish] = useState<ModulesAPI.Publish | null>(null)\n\tconst nameInput = useRef<HTMLInputElement>() as React.RefObject<HTMLInputElement>\n\n\t// Get information about the currently published module.\n\tconst namespaces = useNamespaces()\n\tconst publish = lastPublish ?? getPublishFromModule(persistedModule, namespaces) ?? null\n\n\tconst publishedNamespace = useMemo(() => {\n\t\treturn namespaces?.find(ns => ns.namespaceId === publish?.namespaceId)?.name\n\t}, [publish, namespaces])\n\n\t// Properties for the next publish.\n\tconst [nextName, setNextName] = useState(publish?.name ?? \"\")\n\tconst [error, setError] = useState<string | null>(null)\n\tconst [isLoading, setIsLoading] = useState(false)\n\tconst [namespace, setNamespace] = useState(\"framer\")\n\n\tconst currentVersion = publish?.version\n\tconst [nextVersion, setNextVersion] = useState<string>(\n\t\t() => (publish?.version && String(inc(publish.version, \"minor\"))) || \"0.1.0\",\n\t)\n\n\tconst { queueKey, didEnterCode, resetCodeEntry } = useKonamiCode()\n\n\tconst possibleNextVersions = useMemo(() => {\n\t\tif (!publish?.version) return [\"0.0.1\", \"0.1.0\", \"1.0.0\"]\n\t\treturn releaseTypeOptions.map((bump: ReleaseType) => String(inc(publish.version, bump)))\n\t}, [publish?.version])\n\n\tconst identifier = componentExportIdentifierForModule(engine.componentLoader, persistedModule)\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tuseEffect(() => {\n\t\tif (!identifier || isViewOnly || !isPublishableModuleType(identifier.type)) return\n\n\t\t// When publishing generated code, make sure all local modules are up to date on mount in\n\t\t// the background.\n\t\tengine.stores.codeGenerationStore.generateAndPersistAllQueuedComponents().catch(unhandledError)\n\t}, [identifier, isViewOnly])\n\n\tif (publishedNamespace && namespace !== publishedNamespace) setNamespace(publishedNamespace)\n\n\tconst handlePublish = useCallback(async () => {\n\t\ttry {\n\t\t\tsetIsLoading(true)\n\t\t\tif (identifier && moduleHandle.type === ModuleType.VectorSet) {\n\t\t\t\tconst node = engine.stores.treeStore.tree.getNodeWithTrait(identifier.localIdName, isVectorSetNode)\n\t\t\t\tif (!isVectorSetNode(node) || !node.isLoaded()) throw new Error(\"Vector set not found.\")\n\t\t\t\tconst didUpdate = await engine.stores.codeGenerationStore.createVersionedVectorSet(node)\n\t\t\t\tif (!didUpdate) throw new Error(\"Vector Set could not be updated.\")\n\t\t\t}\n\t\t\tconst newPublish = await moduleHandle.publish(namespace, nextName, nextVersion)\n\t\t\tsetLastPublish(newPublish)\n\t\t\tsetNextVersion(String(inc(newPublish.version, \"minor\")))\n\t\t\tresetCodeEntry()\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\tprimaryText: \"Published\",\n\t\t\t\tsecondaryText: `${nextName} v${nextVersion}.`,\n\t\t\t})\n\t\t} catch (err) {\n\t\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\t\tconsole.error(err)\n\t\t\tnameInput.current?.blur()\n\n\t\t\tif (err instanceof Error) {\n\t\t\t\tsetError(capitalizeFirstLetter(err.message))\n\t\t\t} else {\n\t\t\t\tsetError(\"Check console for error\")\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsLoading(false)\n\t\t}\n\t}, [moduleHandle, nextName, nextVersion, namespace, resetCodeEntry])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: This should be an if statement instead, probably\n\tuseEffect(() => {\n\t\tif (error) setError(null)\n\t}, [nextName])\n\n\tconst handlePublishInputKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === \"Enter\") {\n\t\t\tvoid handlePublish()\n\t\t}\n\t\tqueueKey(event.key)\n\t}\n\n\tconst handleURLInputKeyDown = (event: React.KeyboardEvent) => {\n\t\tqueueKey(event.key)\n\t}\n\n\tconst handleCopyPreviousPublish = useCallback(() => {\n\t\tif (!publish) return\n\t\tconst { importURL, version } = publish\n\n\t\tconst previousPublishURL = moduleUrlWithExportSpecifierFragment(\n\t\t\t`${importURL}@${version}`,\n\t\t\tidentifier?.exportSpecifier,\n\t\t)\n\t\tcopyText(previousPublishURL).catch(unhandledError)\n\t}, [identifier, publish])\n\n\tconst handleCopyPreviousPublishImport = useCallback(() => {\n\t\tif (!publish || !persistedModule) return\n\t\tconst { importURL, version } = publish\n\t\tconst { title, exports } = persistedModule\n\n\t\tconst previousPublishURL = `${importURL}@${version}`\n\n\t\tconst importStatement = getModuleImportStatement({\n\t\t\tkind: \"external\",\n\t\t\tspecifier: previousPublishURL,\n\t\t\ttitle,\n\t\t\texports,\n\t\t})\n\t\tcopyText(importStatement.toString()).catch(unhandledError)\n\t}, [persistedModule, publish])\n\n\tconst handleSelectVersion = useCallback((selectedVersion: string) => {\n\t\tsetNextVersion(selectedVersion)\n\t}, [])\n\n\tconst showUpdatingInterface = publish && !didEnterCode\n\n\treturn (\n\t\t<Stack gap={20}>\n\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\" className={styles.titleBar}>\n\t\t\t\t<Text className={modalStyles.title}>\n\t\t\t\t\t{showUpdatingInterface ? \"Update \" : \"Publish \"}\n\t\t\t\t\t{titleForModuleType(moduleHandle.type)}\n\t\t\t\t</Text>\n\t\t\t\t{currentVersion && <Badge>v{currentVersion}</Badge>}\n\t\t\t</Stack>\n\n\t\t\t{showUpdatingInterface ? (\n\t\t\t\t<>\n\t\t\t\t\t<Stack style={{ marginTop: 5 }}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tvalue={publish.importURL}\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\tkey=\"importURL\"\n\t\t\t\t\t\t\tonChange={() => {}}\n\t\t\t\t\t\t\tonKeyDown={handleURLInputKeyDown}\n\t\t\t\t\t\t\tautoFocus={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<CopyButton title=\"Copy Published URL\" onClick={handleCopyPreviousPublish} />\n\t\t\t\t\t\t<CopyButton title=\"Copy Import Statement\" onClick={handleCopyPreviousPublishImport} />\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\t\tPlease copy the published version above and regression test against the current local version before\n\t\t\t\t\t\tpublishing an update.{\" \"}\n\t\t\t\t\t\t<a className={modalStyles.link} href=\"https://bit.ly/publishing-framer-modules\" target=\"_blank\">\n\t\t\t\t\t\t\tRead Guide\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</Text>\n\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t<div className={styles.divider} />\n\t\t\t\t\t\t{error && <div className={styles.inputErrorText}>{error}</div>}\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t{possibleNextVersions.map(option => (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\t\ttitle={`Next Version: ${option}`}\n\t\t\t\t\t\t\t\t\tselected={nextVersion === option}\n\t\t\t\t\t\t\t\t\tonSelect={handleSelectVersion}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t\t<Button variant=\"primary\" onClick={handlePublish}>\n\t\t\t\t\t\t\t{isLoading ? <Spinner /> : Dictionary.Update}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Stack gap={10} style={{ marginTop: 5, marginBottom: 5 }}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tref={nameInput}\n\t\t\t\t\t\t\tvalue={nextName}\n\t\t\t\t\t\t\tplaceholder=\"Name\"\n\t\t\t\t\t\t\tkey=\"Name\"\n\t\t\t\t\t\t\tonChange={setNextName}\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t\tonKeyDown={handlePublishInputKeyDown}\n\t\t\t\t\t\t\tclassName={cx(error && styles.inputWithError)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{error && <div className={styles.inputErrorText}>{error}</div>}\n\t\t\t\t\t\t{didEnterCode && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tvalue={namespace}\n\t\t\t\t\t\t\t\t\tplaceholder=\"Namespace\"\n\t\t\t\t\t\t\t\t\tonChange={setNamespace}\n\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\tonKeyDown={handlePublishInputKeyDown}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tvalue={nextVersion}\n\t\t\t\t\t\t\t\t\tplaceholder=\"Version\"\n\t\t\t\t\t\t\t\t\tonChange={setNextVersion}\n\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\tonKeyDown={handlePublishInputKeyDown}\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</Stack>\n\t\t\t\t\t<Text size={fonts.size.base} className={modalStyles.secondaryText}>\n\t\t\t\t\t\t<span className={styles.emphasis}>[Internal]</span> Publishing a module adds version control and a unique\n\t\t\t\t\t\tname of your choice.{\" \"}\n\t\t\t\t\t\t<a className={modalStyles.link} href=\"https://bit.ly/publishing-framer-modules\" target=\"_blank\">\n\t\t\t\t\t\t\tRead Guide\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</Text>\n\t\t\t\t\t<Button variant=\"primary\" onClick={handlePublish}>\n\t\t\t\t\t\t{isLoading ? <Spinner /> : Dictionary.Publish}\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nexport function ModulePublishingModal() {\n\tconst { codeEditorStore, scopeStore, modulesStore, modalStore } = engine.stores\n\n\t// TODO: Don't infer what we're publishing from state, require it to be explicitly provided as a parameter.\n\tconst { currentCodeFileId } = codeEditorStore.useState()\n\tconst activeScopeNode = useDeprecatedEngineState([scopeStore, EngineChange.Tree], () => scopeStore.active)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst type = isVectorSetNode(activeScopeNode) ? ModuleType.VectorSet : ModuleType.Canvas\n\tconst moduleHandle = currentCodeFileId\n\t\t? modulesStore.forType(ModuleType.Code).getByLocalId(asLocalId(currentCodeFileId))\n\t\t: modulesStore.forType(type).getByStableName(activeScopeNode.id)\n\n\treturn (\n\t\t<CustomModal visible onDismiss={modalStore.dismiss} className={styles.modal} {...modalThemeProps}>\n\t\t\t<ModalInner moduleHandle={moduleHandle} />\n\t\t</CustomModal>\n\t)\n}\n\nfunction useNamespaces() {\n\tconst [namespaces, setNamespaces] = useState<ModulesAPI.Namespace[] | undefined>()\n\tuseEffect(() => {\n\t\tlet active = true\n\t\tengine.stores.modulesStore\n\t\t\t.listNamespaces()\n\t\t\t.then(response => {\n\t\t\t\tif (!active) return\n\t\t\t\tsetNamespaces(response.data as ModulesAPI.Namespace[])\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [])\n\treturn namespaces\n}\n\nfunction getPublishFromModule(\n\tmodule: PersistedModule | undefined,\n\tnamespaces: ModulesAPI.Namespace[] | undefined,\n): PublishInfo | undefined {\n\tif (!module || !module.lastPublish) return\n\tif (!namespaces) return module.lastPublish\n\tconst { namespaceId, name, version } = module.lastPublish\n\tlet { importURL } = module.lastPublish\n\t// Replace the namespace id with the nicer name.\n\t// TODO: The service should do this for us.\n\tconst namespace = namespaces.find(ns => ns.namespaceId === namespaceId)\n\tif (namespace) {\n\t\timportURL = importURL.replace(`/${namespaceId}/`, `/${namespace.name}/`)\n\t}\n\treturn { namespaceId, name, version, importURL }\n}\n\nconst konamiCode = [\n\t\"ArrowUp\",\n\t\"ArrowUp\",\n\t\"ArrowDown\",\n\t\"ArrowDown\",\n\t\"ArrowLeft\",\n\t\"ArrowRight\",\n\t\"ArrowLeft\",\n\t\"ArrowRight\",\n]\n\nfunction useKonamiCode() {\n\tconst [didEnterCode, setDidEnterCode] = useState(false)\n\tconst keyQueue = useRef<React.Key[]>([])\n\n\tconst queueKey = useCallback((key: React.Key) => {\n\t\tkeyQueue.current.push(key)\n\n\t\tif (keyQueue.current.length < konamiCode.length) return\n\t\tkeyQueue.current.splice(0, keyQueue.current.length - konamiCode.length)\n\t\tif (konamiCode.every((val, index) => val === keyQueue.current[index])) {\n\t\t\tsetDidEnterCode(true)\n\t\t}\n\t}, [])\n\n\tconst resetCodeEntry = useCallback(() => {\n\t\tsetDidEnterCode(false)\n\t\tkeyQueue.current = []\n\t}, [])\n\n\treturn { queueKey, didEnterCode, resetCodeEntry }\n}\n", "import \"ModulePublishingModal.styles_g0m2en.wyw.css\"; export const modal = \"modal_mzdzhfx\";\nexport const titleBar = \"titleBar_tifg07b\";\nexport const inputWithError = \"inputWithError_i1r9mi0f\";\nexport const inputErrorText = \"inputErrorText_ioaklsx\";\nexport const divider = \"divider_d1upr277\";\nexport const emphasis = \"emphasis_e8jmjpi\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport type { LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { LoadedRoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { ROUTES_NODE_ID } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { isRoutesNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\n\nfunction useLoadScope(scopeNodeID: NodeID): { isLoading: boolean; loadedScopeNode: LoadedScopeNode | null } {\n\tconst { scopeNode } = useEngineState(\n\t\t() => ({\n\t\t\tscopeNode: engine.tree.getNodeWithTrait(scopeNodeID, isScopeNode),\n\t\t}),\n\t\t[scopeNodeID],\n\t\t[EngineChange.Tree],\n\t)\n\n\tusePreloadedScope(scopeNodeID)\n\n\treturn {\n\t\tisLoading: !!scopeNode && !scopeNode.isLoaded(),\n\t\tloadedScopeNode: scopeNode?.isLoaded() ? scopeNode : null,\n\t}\n}\n\nexport function useLoadRoutesNode(): { isLoadingRoutesNode: boolean; loadedRoutesNode: LoadedRoutesNode | null } {\n\tconst { isLoading: isLoadingRoutesNode, loadedScopeNode } = useLoadScope(ROUTES_NODE_ID)\n\treturn {\n\t\tisLoadingRoutesNode,\n\t\tloadedRoutesNode: isRoutesNode(loadedScopeNode) ? loadedScopeNode : null,\n\t}\n}\n", "import { ConfirmationModal } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { ensureRedirectLimits } from \"document/components/chrome/siteSettings/Redirects/ensureRedirectLimits.ts\"\nimport engine from \"document/engine.ts\"\nimport { RoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { addRedirect } from \"document/models/CanvasTree/nodes/utils/routesNode.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { validateRouteNodePath } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { validateRedirectTo } from \"../siteSettings/Redirects/validateRedirects.ts\"\nimport { useLoadRoutesNode } from \"../utils/useLoadScope.ts\"\nimport { LimitError } from \"./utils/limitError.ts\"\n\nexport function RedirectsImportModal() {\n\tconst { isLoadingRoutesNode } = useLoadRoutesNode()\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Import Redirects\"\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<p>Copy a CSV with redirects into your clipboard, then proceed.</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tThe first column should be <em>from</em>, the second column <em>to</em>. Subsequent columns will be ignored.\n\t\t\t\t\t\tNo header row, please!\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\tWe\u2019ll attempt to convert some regex wildcards. Duplicates will be ignored, so it\u2019s safe to re-run the import\n\t\t\t\t\t\tif needed.\n\t\t\t\t\t</p>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmButtonLoading={isLoadingRoutesNode}\n\t\t\tconfirmLabel=\"Import\"\n\t\t\tonConfirm={importRedirectsFromClipboard}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\nasync function importRedirectsFromClipboard() {\n\t// Lazily import the parser\n\tconst { parse } = await import(\"csv-parse/browser/esm/sync\")\n\n\tconst csv = await navigator.clipboard.readText()\n\n\tlet redirects: string[][] = parse(csv, { skipEmptyLines: true })\n\tif (redirects[0] && redirects[0].length < 2) {\n\t\tredirects = parse(csv, { skipEmptyLines: true, delimiter: \";\" })\n\t}\n\n\tlet count = 0\n\tlet skipped = 0\n\tengine.scheduler.process(() => {\n\t\tconst routesNode = RoutesNode.ensure(engine.tree)\n\t\tassert(routesNode.isLoaded(), \"Routes node must be loaded\")\n\n\t\tconst existingRedirects = new Set<string>()\n\n\t\tfor (const redirectNode of routesNode.getRedirects()) {\n\t\t\texistingRedirects.add(redirectValue(redirectNode.path, redirectNode.to))\n\t\t}\n\n\t\tfor (const redirect of redirects) {\n\t\t\tlet [from, to] = redirect\n\t\t\tif (!from || !to) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst validatedFrom = validateRouteNodePath(\"redirect\", from)\n\t\t\t/** @todo: pass in validatedFrom.normalizedValue? */\n\t\t\tconst validatedTo = validateRedirectTo(engine.tree, to, undefined)\n\n\t\t\tif (validatedFrom.result !== \"ok\" || validatedTo.result !== \"ok\") {\n\t\t\t\tskipped++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfrom = from.replaceAll(\"(.+)\", \"*\").replaceAll(\"(.*)\", \"*\")\n\t\t\tto = to.replaceAll(/\\$(?=\\d+)/gu, \":\")\n\n\t\t\tif (existingRedirects.has(redirectValue(from, to))) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\taddRedirect(engine.stores.treeStore, from, to, () => ensureRedirectLimits(engine, \"add\"))\n\t\t\t\t++count\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof LimitError) {\n\t\t\t\t\tskipped++\n\t\t\t\t} else {\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\ttoast({\n\t\ttype: \"add\",\n\t\tkey: \"imported-redirects\",\n\t\tvariant: \"info\",\n\t\tprimaryText: `Imported ${count} redirects.`,\n\t\tsecondaryText: skipped > 0 ? `Skipped ${skipped}.` : undefined,\n\t})\n\tengine.stores.modalStore.dismiss()\n}\n\n/** Used for de-duplicating redirects. */\nfunction redirectValue(from: string | undefined, to: string | LinkToWebPage | undefined): string {\n\treturn JSON.stringify(from) + \"\\0\" + JSON.stringify(to)\n}\n", "import { ConfirmationModal, Translatable as T } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useState } from \"react\"\n\ninterface Props {\n\tonCancel: () => void\n\tonConfirm: () => void\n}\nexport function RemoveFromLibraryModal({ onCancel, onConfirm }: Props) {\n\tconst [removing, setRemoving] = useState(false)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handleConfirm = () => {\n\t\tsetRemoving(true)\n\t\tonConfirm()\n\t}\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Remove Component\"\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<T>The component will be removed from</T>\n\t\t\t\t\t<br />\n\t\t\t\t\t<T>the Library. The primary component</T>\n\t\t\t\t\t<br />\n\t\t\t\t\t<T>will remain in its original project.</T>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={onCancel}\n\t\t\tcancelButtonEnabled={!removing}\n\t\t\tconfirmLabel=\"Remove\"\n\t\t\tonConfirm={handleConfirm}\n\t\t\tvariant=\"destructive\"\n\t\t\tonDismiss={onCancel}\n\t\t\tconfirmButtonLoading={removing}\n\t\t\tconfirmButtonEnabled={!removing}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { ConfirmationModal, PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport { RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport { isTextStylePresetPrimaryNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetKey } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { useMemo, useState } from \"react\"\nimport { useTextStylePresets } from \"../properties/panels/utils/useTextStylePresets.tsx\"\n\nexport function replacePreset(engine: VekterEngine, fromPresetId: string, toPresetId: string) {\n\tif (engine.stores.toolStore.tool === Tools.RichTextEdit) {\n\t\tengine.exitTool()\n\t}\n\n\tconst dataTree = engine.stores.treeStore.getDataTree()\n\tif (dataTree) {\n\t\tengine.stores.modalStore.dismissModal(ModalType.ReplaceTextStylePreset)\n\n\t\tconst fromPreset = dataTree.getNodeWithTrait(fromPresetId, isTextStylePresetPrimaryNode)\n\t\tif (!fromPreset) return\n\n\t\tconst toPreset = dataTree.getNodeWithTrait(toPresetId, isTextStylePresetPrimaryNode)\n\t\tif (!toPreset) return\n\n\t\tconst toPresetKey = getTextStylePresetKey(toPreset.tag)\n\n\t\tconst iterator = engine.stores.treeStore.query().whereClass(RichTextNode).iterate()\n\t\tfor (const node of iterator) {\n\t\t\tif (node.html.includes(fromPresetId)) {\n\t\t\t\tnode.replaceTextStylePreset(fromPreset, toPreset)\n\t\t\t}\n\n\t\t\tif (fromPreset.tag === toPreset.tag && node[toPresetKey] === fromPresetId) {\n\t\t\t\tnode.set({ [toPresetKey]: toPresetId })\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tengine.runWithFullyLoadedTree(\n\t\t() => {\n\t\t\tengine.stores.modalStore.dismissModal(ModalType.ReplaceTextStylePreset)\n\n\t\t\tconst fromPreset = engine.tree.getNodeWithTrait(fromPresetId, isTextStylePresetPrimaryNode)\n\t\t\tif (!fromPreset) return\n\n\t\t\tconst toPreset = engine.tree.getNodeWithTrait(toPresetId, isTextStylePresetPrimaryNode)\n\t\t\tif (!toPreset) return\n\n\t\t\tconst toPresetKey = getTextStylePresetKey(toPreset.tag)\n\n\t\t\tconst treeIndexes = engine.stores.treeStore.getLoadedIndexes()\n\t\t\tfor (const node of treeIndexes.richTextNodes) {\n\t\t\t\tif (node.html.includes(fromPresetId)) {\n\t\t\t\t\tnode.replaceTextStylePreset(fromPreset, toPreset)\n\t\t\t\t}\n\n\t\t\t\tif (fromPreset.tag === toPreset.tag && node[toPresetKey] === fromPresetId) {\n\t\t\t\t\tnode.set({ [toPresetKey]: toPresetId })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{ name: \"Replace text style preset\" },\n\t)\n}\n\nexport function ReplaceTextStylePresetModal({ presetId }: ModalProps<ModalType.ReplaceTextStylePreset>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst presets = useTextStylePresets()\n\n\t// Start preloading the full document if there is a loader.\n\tReact.useEffect(() => {\n\t\tconst loader = engine.tree.getService(\"loader\")\n\t\tif (!loader) return\n\n\t\treturn loader.prioritizeLoadingAllData({ preload: true })\n\t}, [])\n\n\tconst preset = useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => engine.tree.getNodeWithTrait(presetId, isTextStylePresetPrimaryNode),\n\t\t[presetId],\n\t)\n\n\tconst replacementPresets = useMemo(() => {\n\t\t// We need to check if the preset exists, because it might have been\n\t\t// deleted but the modal is still open.\n\t\tif (!preset) return []\n\n\t\treturn presets.filter(child => child.id !== preset.id)\n\t}, [presets, preset])\n\n\tconst [selectedPresetId, setSelectedPresetId] = useState(replacementPresets[0].id)\n\n\tconst presetName = preset?.getName() ?? \"\"\n\n\tconst dismiss = React.useCallback(() => {\n\t\tengine.stores.modalStore.dismissModal(ModalType.ReplaceTextStylePreset)\n\t}, [])\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"primary\"\n\t\t\ttitle=\"Replace Text Style\"\n\t\t\tdescription={`All instances of ${presetName} will be updated to this text style.`}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={dismiss}\n\t\t\tonDismiss={dismiss}\n\t\t\tconfirmLabel=\"Replace\"\n\t\t\tonConfirm={engine.scheduler.wrapHandler(() => {\n\t\t\t\tif (!preset) return\n\t\t\t\treplacePreset(engine, preset.id, selectedPresetId)\n\t\t\t})}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t>\n\t\t\t<PopupButton>\n\t\t\t\t{replacementPresets.map(preset => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={preset.id}\n\t\t\t\t\t\tidentifier={preset.id}\n\t\t\t\t\t\ttitle={preset.getName()}\n\t\t\t\t\t\tselected={selectedPresetId === preset.id}\n\t\t\t\t\t\tonSelect={() => setSelectedPresetId(preset.id)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</ConfirmationModal>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport type { TextStylePresetPrimaryNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { RichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\n\nconst emptyResult: TextStylePresetPrimaryNode[] = []\n\nexport function useTextStylePresets(tag?: RichTextTag) {\n\treturn useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => {\n\t\t\tconst listNode = PresetsListNode.get(engine.tree)\n\t\t\tif (!listNode) return emptyResult\n\n\t\t\tconst presets = listNode.getTextStylePresets()\n\t\t\tif (tag) return presets.filter(preset => preset.tag === tag)\n\n\t\t\treturn presets\n\t\t},\n\t\ttag,\n\t)\n}\n", "import { ConfirmationModal, PopupButton, PopupButtonItem, Stack } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { RenamedIds, updateNodeConnections } from \"document/components/tools/utils/updateNodeConnections.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport { CanvasChildList } from \"document/models/CanvasTree/nodes/ChildList.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { AnyWebPageNode, ShallowWebPageNode, WebPageNode } from \"document/models/CanvasTree/nodes/WebPageNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { initialWebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { updateLinks } from \"utils/updateLinks.ts\"\nimport { isWithoutChildren } from \"../Pages/utils/commons.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"../Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport * as styles from \"./ReplaceWebPageModal.styles.ts\"\n\nexport function ReplaceWebPageModal({ oldNode }: { oldNode: AnyWebPageNode }) {\n\tconst oldNodeTitle = getWebPagePath(engine.tree, oldNode) || oldNode.resolveValue(\"name\") || Dictionary.Page\n\n\tconst { options, defaultOptionId } = getReplacementOptions(oldNode)\n\n\tconst [selectedNodeId, setSelectedNodeId] = React.useState<NodeID | undefined>(defaultOptionId || options[0]?.id)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Replace This Page\"\n\t\t\tconfirmLabel=\"Replace\"\n\t\t\tconfirmButtonEnabled={selectedNodeId !== undefined}\n\t\t\tonConfirm={engine.scheduler.wrapHandler(() => {\n\t\t\t\tengine.stores.modalStore.dismissModal(ModalType.ReplaceWebPage)\n\n\t\t\t\tif (!selectedNodeId) return\n\n\t\t\t\tconst oldWebPage = engine.tree.getNodeWithTrait(oldNode.id, isWebPageNode)\n\t\t\t\tconst newWebPage = engine.tree.getNodeWithTrait(selectedNodeId, isWebPageNode)\n\t\t\t\tif (!oldWebPage) return\n\t\t\t\tif (!newWebPage) return\n\n\t\t\t\tengine.runWithFullyLoadedTree(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tconst oldPageIsIndexed = oldWebPage.webMetadata?.noIndex !== true\n\t\t\t\t\t\tconst newPageIsIndexed = newWebPage.webMetadata?.noIndex !== true\n\n\t\t\t\t\t\treplaceWebPage(engine, oldNode.id, selectedNodeId)\n\n\t\t\t\t\t\tconst askIfNewPageShouldBeIndexed = oldPageIsIndexed && !newPageIsIndexed\n\t\t\t\t\t\tif (!askIfNewPageShouldBeIndexed) return\n\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\t\t\ttitle: \"Hidden from Search\",\n\t\t\t\t\t\t\tdescription: \"The previous page appeared in search results. Should this one be visible too?\",\n\t\t\t\t\t\t\tconfirmLabel: \"Enable Indexing\",\n\t\t\t\t\t\t\tcancelLabel: \"Keep Disabled\",\n\t\t\t\t\t\t\tonConfirm: () => {\n\t\t\t\t\t\t\t\t// When replacing web pages the new page is getting the old page's\n\t\t\t\t\t\t\t\t// ID assigned. So we need to retrieve the latest version of the web\n\t\t\t\t\t\t\t\t// page using the old page's ID.\n\t\t\t\t\t\t\t\tconst latestWebPageNode = engine.tree.getNodeWithTrait(oldNode.id, isWebPageNode)\n\t\t\t\t\t\t\t\tif (!latestWebPageNode) return\n\n\t\t\t\t\t\t\t\tconst webMetadata = latestWebPageNode.webMetadata\n\t\t\t\t\t\t\t\t\t? { ...latestWebPageNode.webMetadata }\n\t\t\t\t\t\t\t\t\t: { ...initialWebMetadata }\n\n\t\t\t\t\t\t\t\twebMetadata.noIndex = false\n\t\t\t\t\t\t\t\tlatestWebPageNode.set({ webMetadata })\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsource: \"confirmation_modal\",\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\tname: \"ReplaceWebPageModal\",\n\t\t\t\t\t\tmodalTitle: \"Replacing The Page\u2026\",\n\t\t\t\t\t\tcancellable: true,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t})}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t>\n\t\t\t<Stack gap={15}>\n\t\t\t\t<div className={styles.description}>\n\t\t\t\t\tSelect a page to replace <span className={styles.pageTitle}>{oldNodeTitle}</span> with.\n\t\t\t\t</div>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t{options.map(({ id, title }) => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={id}\n\t\t\t\t\t\t\tidentifier={id}\n\t\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\t\tselected={id === selectedNodeId}\n\t\t\t\t\t\t\tonSelect={setSelectedNodeId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</Stack>\n\t\t</ConfirmationModal>\n\t)\n}\n\nexport function canReplaceWebPage(oldNode: ShallowWebPageNode) {\n\tconst { options } = getReplacementOptions(oldNode)\n\treturn options.length > 0\n}\n\nfunction getReplacementOptions(oldNode: AnyWebPageNode) {\n\tconst homePageNodeId = engine.tree.root.homePageNodeId\n\n\tlet defaultOptionId: NodeID | undefined\n\tconst options: { id: NodeID; title: string }[] = []\n\n\tfor (const node of engine.stores.scopeStore.getWebPageNodes()) {\n\t\t// The target/selected page will get deleted, so we should not allow to choose the home page.\n\t\tif (node.id === oldNode.id || node.id === homePageNodeId) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Don't allow replacing pages with A/B testing page variants\n\t\tif (node.abTestingParentId) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Don't allow replacing CMS pages with non-CMS pages, or vice versa, or CMS pages with different collections.\n\t\tif (node.dataIdentifier !== oldNode.dataIdentifier) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst path = getWebPagePath(engine.tree, node)\n\t\tif (!path) {\n\t\t\tcontinue\n\t\t}\n\n\t\toptions.push({ id: node.id, title: path })\n\n\t\t// Default the selection to the first duplicate of the node that we want to replace.\n\t\tif (!defaultOptionId && node.duplicatedFrom?.includes(oldNode.id)) {\n\t\t\tdefaultOptionId = node.id\n\t\t}\n\t}\n\n\treturn { options, defaultOptionId }\n}\n\nexport function replaceWebPage(engine: VekterEngine, oldNodeId: NodeID, newNodeId: NodeID) {\n\tconst oldNode = engine.tree.get(oldNodeId)\n\tconst newNode = engine.tree.get(newNodeId)\n\tif (!isWebPageNode(oldNode)) return\n\tif (!isWebPageNode(newNode)) return\n\tassert(oldNode?.isLoaded() && newNode?.isLoaded(), \"Both nodes must be fully loaded\")\n\tassert(!engine.stores.treeStore.tree.getService(\"loader\"), \"Tree should be fully loaded\")\n\n\t// Update the links first, while we still have the old node in the tree.\n\tfor (const node of engine.tree.root.walk()) {\n\t\tupdateLinks(engine.tree, node, link => {\n\t\t\t// We only need to update scroll targets, since we're gonna re-use the old node's ID for the new node.\n\t\t\tif (!isLinkToWebPage(link) || !link.hash || link.webPageId !== oldNodeId) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tconst updatedLink: LinkToWebPage = {\n\t\t\t\t...link,\n\t\t\t\t// If the new scroll target is not found, the hash will be unset.\n\t\t\t\thash: getNewScrollTargetId(link.hash, newNode),\n\t\t\t}\n\t\t\treturn updatedLink\n\t\t})\n\t}\n\n\t// Prepare a clone of the new node, with the same ID as the old node.\n\tconst newNodeClone = newNode.loaded.clone({\n\t\tid: oldNode.id,\n\t\tname: oldNode.name,\n\t\tpagePath: oldNode.pagePath,\n\t\tisDraft: oldNode.isDraft,\n\t\tchildren: new CanvasChildList(),\n\t})\n\n\t// Remove the old node's A/B testing variants\n\tconst oldAbTestingChildren = oldNode.getAbTestingChildren(engine.tree)\n\tif (oldAbTestingChildren) {\n\t\tfor (const variant of oldAbTestingChildren) {\n\t\t\tengine.tree.remove(variant.id)\n\t\t}\n\t}\n\n\t// Remove the old node and insert the new node's clone in its place.\n\tconst oldNodeParent = oldNode.parentid\n\tconst oldNodePosition = engine.tree.root.children.findIndex(node => node.id === oldNode.id)\n\tengine.tree.remove(oldNode.id)\n\tengine.tree.insertNode(newNodeClone, oldNodeParent, oldNodePosition)\n\n\t// Now that the new node's clone is in the tree, we can move children from the original new node to its clone,\n\t// move its A/B testing variants, and then remove the original new node.\n\tfor (const child of newNode.loaded.children) {\n\t\tengine.tree.moveNode(child, newNodeClone.id)\n\t}\n\tconst newAbTestingChildren = newNode.getAbTestingChildren(engine.tree)\n\tif (newAbTestingChildren) {\n\t\tfor (const variant of newAbTestingChildren) {\n\t\t\tvariant.set({ abTestingParentId: newNodeClone.id })\n\t\t}\n\t}\n\tengine.deleteNode(newNode.id)\n\n\t// Since we changed the new node's ID, we need to update any connections that still point to the old ID.\n\tconst renamedIds = new RenamedIds()\n\trenamedIds.set(newNode.id, newNodeClone.id)\n\tupdateNodeConnections(engine.tree, engine.componentLoader, newNodeClone, renamedIds, false)\n\n\tconst routeSegmentToRemove = getRouteSegmentNodeByWebPageId(engine.tree, newNode.id)\n\tassert(routeSegmentToRemove, \"Web page route segment to remove not found\")\n\n\tif (engine.tree.root.homePageNodeId === oldNode.id) {\n\t\t// Home page node doesn't have a route segment, so we need to update the root node directly.\n\t\tengine.tree.root.set({ homePageNodeId: newNodeClone.id })\n\t} else {\n\t\t// Otherwise, we need to update the route segment to point to the new node.\n\t\tconst routeSegmentToUpdate = getRouteSegmentNodeByWebPageId(engine.tree, oldNode.id)\n\t\tassert(routeSegmentToUpdate, \"Web page route segment to update not found\")\n\t\trouteSegmentToUpdate.set({ webPageId: newNodeClone.id })\n\t}\n\n\tif (isWithoutChildren(routeSegmentToRemove)) {\n\t\tengine.deleteNode(routeSegmentToRemove.id)\n\t} else {\n\t\trouteSegmentToRemove.set({ webPageId: undefined })\n\t}\n}\n\nfunction getNewScrollTargetId(scrollTargetId: NodeID, newNode: WebPageNode) {\n\tconst oldScrollTarget = engine.tree.get(scrollTargetId)\n\tif (!oldScrollTarget || !withScrollTarget(oldScrollTarget) || !oldScrollTarget.elementId) {\n\t\treturn\n\t}\n\n\tconst newScrollTarget = newNode.find(node => {\n\t\treturn withScrollTarget(node) && node.elementId === oldScrollTarget.elementId\n\t})\n\treturn newScrollTarget?.id\n}\n", "import \"ReplaceWebPageModal.styles_1gfgqo1.wyw.css\"; export const description = \"description_dxgaggt\";\nexport const pageTitle = \"pageTitle_p4pxol6\";", "import { ApiError } from \"@framerjs/app-shared\"\nimport { ConfirmationModal, Link } from \"@framerjs/fresco\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { startTransition } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\n\nconst log = getLogger(\"Project\")\n\nexport function RequestControlModal({ onConfirm }: ModalProps<ModalType.RequestControl>) {\n\tconst [confirmButtonLoading, setConfirmButtonLoading] = React.useState<boolean>(false)\n\tconst activePopover = engine.stores.popoverStore.useState(state => state.active)\n\tconst isPopoverOpen = activePopover === PopoverType.Invite\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handleConfirm = engine.scheduler.wrapHandler(async () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.requestControlModal,\n\t\t\tid: UIInteraction.requestControl,\n\t\t})\n\t\tsetConfirmButtonLoading(true)\n\t\ttry {\n\t\t\tawait onConfirm()\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t\tsetConfirmButtonLoading(false)\n\t\t} catch (error) {\n\t\t\tif (error instanceof ApiError && error.status === 401) {\n\t\t\t\twindow.location.href = \"/login\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tkey: \"request-control-error\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Failed to take control.\",\n\t\t\t\tsecondaryText: \"Please try again.\",\n\t\t\t\tduration: 5000,\n\t\t\t})\n\t\t\tlog.error(\"Failed to request control:\", error)\n\t\t\tsetConfirmButtonLoading(false)\n\t\t}\n\t})\n\n\tconst handleInviteClick = () => {\n\t\tstartTransition(() => {\n\t\t\tengine.stores.popoverStore.active = PopoverType.Invite\n\t\t})\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.requestControlModal,\n\t\t\tid: \"open-invite-popover\",\n\t\t})\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Request Control\"\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\tThis account is now active on another device. Request control to log out other devices and continue editing\n\t\t\t\t\there. You can <Link onClick={handleInviteClick}>invite your team</Link> to collaborate.\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmLabel=\"Request Control\"\n\t\t\tonConfirm={handleConfirm}\n\t\t\tconfirmButtonLoading={confirmButtonLoading}\n\t\t\thasBackdrop\n\t\t\tfocusTrapEnabled={!isPopoverOpen}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { type TeamLicenseType, getProjectLicenseName, getTeamLicenseName } from \"@framerjs/app-shared\"\nimport {\n\ttype AddOnLicenseType,\n\ttype TeamAddOnLicenseType,\n\tgetAddOnLicenseTypeName,\n\tgetTeamAddOnLicenseTypeName,\n} from \"@framerjs/app-shared/src/AddOnPlan.ts\"\nimport type { TeamSubscriptionSyncAction } from \"@framerjs/app-shared/src/ProjectState.ts\"\nimport { Modal, Spinner } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport {\n\ttype PaymentError,\n\tPaymentErrorStatus,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { InlineError } from \"document/components/chrome/siteSettings/Plans/Stripe/components/InlineError.tsx\"\nimport { InlinePaymentError } from \"document/components/chrome/siteSettings/Plans/Stripe/components/InlinePaymentError.tsx\"\nimport engine from \"document/engine.ts\"\n\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport pluralize from \"pluralize\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { PriceItemList, PriceItemRow } from \"web/components/PriceItemRow.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport type { CheckoutPreview } from \"../../siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\nimport { SubscriptionNotInOrderInitialModal } from \"./components/SubscriptionNotInOrderInitialModal.tsx\"\nimport {\n\ttype SubscriptionNotInOrderState,\n\tSubscriptionNotInOrderErrorType,\n\tSubscriptionNotInOrderStatus,\n\tuseSubscriptionSync,\n} from \"./useSubscriptionSync.ts\"\n\nconst subscriptionToastKey = \"subscription-not-in-order\"\n\ntype InlineSubscriptionError =\n\t| Extract<SubscriptionNotInOrderState, { status: SubscriptionNotInOrderStatus.Error }>[\"error\"]\n\t| Extract<SubscriptionNotInOrderState, { status: SubscriptionNotInOrderStatus.UpdateFailed }>[\"error\"]\n\ntype InlineSubscriptionErrorState = Extract<\n\tSubscriptionNotInOrderState,\n\t{ status: SubscriptionNotInOrderStatus.Error | SubscriptionNotInOrderStatus.UpdateFailed }\n>\n\ninterface InlineSubscriptionErrorContent {\n\tmessage: string\n\tprimaryAction?: { label: string; onClick: () => void }\n}\n\nfunction getSubscriptionNotInOrderErrorPage(error: PaymentError): Pages {\n\tswitch (error.status) {\n\t\tcase PaymentErrorStatus.PaymentDeclined:\n\t\t\treturn Pages.subscriptionNotInOrderErrorPaymentDeclined\n\t\tcase PaymentErrorStatus.ActionRequiredError:\n\t\t\treturn Pages.subscriptionNotInOrderErrorActionsRequired\n\t\tcase PaymentErrorStatus.TaxLocationInvalid:\n\t\t\treturn Pages.subscriptionNotInOrderErrorTaxLocationInvalid\n\t\tcase PaymentErrorStatus.Unauthorized:\n\t\t\treturn Pages.subscriptionNotInOrderErrorUnhandled\n\t\tcase PaymentErrorStatus.UnhandledError:\n\t\t\treturn Pages.subscriptionNotInOrderErrorUnhandled\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nexport function SubscriptionNotInOrderModal({\n\tteamId,\n\tteamSyncAction,\n\tisBillingV3,\n\tcanReactivate,\n}: {\n\tteamId: string\n\tteamSyncAction:\n\t\t| TeamSubscriptionSyncAction.Reactivate\n\t\t| TeamSubscriptionSyncAction.ChargeableSync\n\t\t| TeamSubscriptionSyncAction.CreateTeamSubscription\n\t\t| TeamSubscriptionSyncAction.SyncQuantity\n\tisBillingV3: boolean\n\tcanReactivate: boolean\n}) {\n\tconst [started, setStarted] = useState(false)\n\n\tif (!started) {\n\t\treturn (\n\t\t\t<Modal.Root visible onDismiss={noop}>\n\t\t\t\t<SubscriptionNotInOrderInitialModal\n\t\t\t\t\thandlePreview={() => setStarted(true)}\n\t\t\t\t\tcanReactivate={canReactivate}\n\t\t\t\t\tteamSyncAction={teamSyncAction}\n\t\t\t\t/>\n\t\t\t</Modal.Root>\n\t\t)\n\t}\n\n\treturn (\n\t\t<SubscriptionNotInOrderConfirmationModal\n\t\t\tteamId={teamId}\n\t\t\tteamSyncAction={teamSyncAction}\n\t\t\tisBillingV3={isBillingV3}\n\t\t\tonCancel={() => setStarted(false)}\n\t\t/>\n\t)\n}\n\nfunction SubscriptionNotInOrderConfirmationModal({\n\tteamId,\n\tteamSyncAction,\n\tisBillingV3,\n\tonCancel,\n}: {\n\tteamId: string\n\tteamSyncAction: TeamSubscriptionSyncAction\n\tisBillingV3: boolean\n\tonCancel: () => void\n}) {\n\tconst { state, handlePreview, handleReactivation, clearError } = useSubscriptionSync({\n\t\tteamId,\n\t\tteamSyncAction,\n\t\tisBillingV3,\n\t})\n\tconst preview = \"preview\" in state ? state.preview : undefined\n\tconst inlinePaymentError =\n\t\tstate.status === SubscriptionNotInOrderStatus.UpdateFailed &&\n\t\tstate.error.type === SubscriptionNotInOrderErrorType.PaymentError\n\t\t\t? state.error.error\n\t\t\t: null\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.subscriptionNotInOrderPreviewModal })\n\n\tconst dismissModal = useCallback(() => {\n\t\tengine.stores.loadingStore.blockedDueToInvalidSubscription = false\n\t\tengine.stores.modalStore.dismissModal(ModalType.SubscriptionNotInOrder)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (state.status !== SubscriptionNotInOrderStatus.SyncSuccess) return\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey: subscriptionToastKey,\n\t\t\tvariant: \"success\",\n\t\t\tprimaryText: \"Workspace\",\n\t\t\tsecondaryText: \"reactivated.\",\n\t\t})\n\t\tdismissModal()\n\t}, [state.status, dismissModal])\n\n\tuseEffect(() => {\n\t\tif (state.status !== SubscriptionNotInOrderStatus.Error) return\n\t\tif (\n\t\t\tstate.error.type !== SubscriptionNotInOrderErrorType.AlreadySyncedError &&\n\t\t\tstate.error.type !== SubscriptionNotInOrderErrorType.NoActiveProjectPlansError\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tdismissModal()\n\t}, [state, dismissModal])\n\n\tconst isLoading = state.status === SubscriptionNotInOrderStatus.Loading\n\tconst isReactivating = state.status === SubscriptionNotInOrderStatus.Reactivating\n\tconst confirmEnabled = preview !== undefined && !isLoading && !isReactivating\n\tconst hasInlineSubscriptionError = isInlineSubscriptionErrorState(state)\n\tconst canConfirm = confirmEnabled && !hasInlineSubscriptionError\n\tconst currency = preview?.currency ?? \"usd\"\n\n\tconst handleDismissInlineError = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.subscriptionNotInOrderPreviewModal,\n\t\t\tid: UIInteraction.dismiss,\n\t\t})\n\t\tif (state.status === SubscriptionNotInOrderStatus.UpdateFailed) {\n\t\t\tclearError()\n\t\t\treturn\n\t\t}\n\t\tonCancel()\n\t}, [clearError, onCancel, state.status])\n\n\tconst handleRetryPreview = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.subscriptionNotInOrderPreviewModal,\n\t\t\tid: UIInteraction.tryAgain,\n\t\t})\n\t\tvoid handlePreview()\n\t}, [handlePreview])\n\n\tconst handleConfirm = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.subscriptionNotInOrderPreviewModal,\n\t\t\tid: UIInteraction.reactivate,\n\t\t})\n\t\ttoast({ type: \"remove\", key: subscriptionToastKey })\n\t\tvoid handleReactivation()\n\t}\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={noop}\n\t\t\tonConfirm={canConfirm ? handleConfirm : undefined}\n\t\t\tkeyboardConfirmMode={canConfirm ? \"Enter\" : false}\n\t\t\tfixPositionAfterMount\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t>\n\t\t\t<Modal.Header separator={false}>Reactivate Workspace</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Separator height={1} />\n\t\t\t\t<LineItems preview={preview} currency={currency} />\n\t\t\t\t{preview && <Separator height={1} />}\n\t\t\t\t<PriceBreakdown preview={preview} currency={currency} isLoading={isLoading} />\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer>\n\t\t\t\t{inlinePaymentError ? (\n\t\t\t\t\t<InlinePaymentError\n\t\t\t\t\t\terror={inlinePaymentError}\n\t\t\t\t\t\tteamId={teamId}\n\t\t\t\t\t\tpage={Pages.subscriptionNotInOrderPreviewModal}\n\t\t\t\t\t\terrorPage={getSubscriptionNotInOrderErrorPage(inlinePaymentError)}\n\t\t\t\t\t\tonDismiss={clearError}\n\t\t\t\t\t\tonRetry={() => void handleReactivation()}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SubscriptionNotInOrderInlineError\n\t\t\t\t\t\tstate={state}\n\t\t\t\t\t\tonDismiss={handleDismissInlineError}\n\t\t\t\t\t\tonRetry={handleRetryPreview}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{!hasInlineSubscriptionError && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Modal.CancelButton title=\"Cancel\" onClick={onCancel} enabled={!isReactivating}>\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t</Modal.CancelButton>\n\t\t\t\t\t\t<Modal.ActionButton type=\"submit\" title=\"Confirm\" enabled={confirmEnabled}>\n\t\t\t\t\t\t\t{isReactivating ? <Spinner /> : \"Confirm\"}\n\t\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\nfunction isInlineSubscriptionErrorState(state: SubscriptionNotInOrderState): state is InlineSubscriptionErrorState {\n\tif (state.status === SubscriptionNotInOrderStatus.UpdateFailed) return true\n\tif (state.status !== SubscriptionNotInOrderStatus.Error) return false\n\n\tswitch (state.error.type) {\n\t\tcase SubscriptionNotInOrderErrorType.OverEditorLimit:\n\t\tcase SubscriptionNotInOrderErrorType.OverProjectEditorLimit:\n\t\tcase SubscriptionNotInOrderErrorType.UnauthorizedError:\n\t\tcase SubscriptionNotInOrderErrorType.UnhandledError:\n\t\t\treturn true\n\t\tcase SubscriptionNotInOrderErrorType.AlreadySyncedError:\n\t\tcase SubscriptionNotInOrderErrorType.NoActiveProjectPlansError:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(state.error)\n\t}\n}\n\nfunction SubscriptionNotInOrderInlineError({\n\tstate,\n\tonDismiss,\n\tonRetry,\n}: {\n\tstate: SubscriptionNotInOrderState\n\tonDismiss: () => void\n\tonRetry: () => void\n}) {\n\tif (!isInlineSubscriptionErrorState(state)) return null\n\n\tconst content = getInlineSubscriptionErrorContent(state.error, onRetry)\n\tif (!content) return null\n\n\treturn (\n\t\t<InlineError\n\t\t\tmessage={content.message}\n\t\t\tdismissLabel={Dictionary.Dismiss}\n\t\t\tonDismiss={onDismiss}\n\t\t\tprimaryAction={content.primaryAction}\n\t\t/>\n\t)\n}\n\nfunction getInlineSubscriptionErrorContent(\n\terror: InlineSubscriptionError,\n\tonRetry: () => void,\n): InlineSubscriptionErrorContent | null {\n\tswitch (error.type) {\n\t\tcase SubscriptionNotInOrderErrorType.PaymentError:\n\t\t\treturn null\n\t\tcase SubscriptionNotInOrderErrorType.UnauthorizedError:\n\t\t\treturn { message: \"Unauthorized. Contact your admin.\" }\n\t\tcase SubscriptionNotInOrderErrorType.OverEditorLimit:\n\t\tcase SubscriptionNotInOrderErrorType.OverProjectEditorLimit:\n\t\tcase SubscriptionNotInOrderErrorType.UnhandledError:\n\t\t\treturn {\n\t\t\t\tmessage: \"Something went wrong. Please try again later.\",\n\t\t\t\tprimaryAction: { label: Dictionary.TryAgain, onClick: onRetry },\n\t\t\t}\n\t\tcase SubscriptionNotInOrderErrorType.AlreadySyncedError:\n\t\tcase SubscriptionNotInOrderErrorType.NoActiveProjectPlansError:\n\t\t\treturn null\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nfunction LineItems({ preview, currency }: { preview?: Omit<CheckoutPreview, \"planId\">; currency: string }) {\n\tif (!preview) return null\n\n\tconst { items } = preview\n\n\treturn (\n\t\t<PriceItemList>\n\t\t\t{items.plan && (\n\t\t\t\t<PriceItemRow\n\t\t\t\t\ttitle={`${getProjectLicenseName(items.plan.licenseType)} Site`}\n\t\t\t\t\tprice={items.plan.totalAmount}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{items.editor && (\n\t\t\t\t<PriceItemRow\n\t\t\t\t\ttitle={getEditorTitle(items.editor.licenseType, items.editor.quantity)}\n\t\t\t\t\tprice={items.editor.totalAmount}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{items.addons?.map(addon => (\n\t\t\t\t<PriceItemRow\n\t\t\t\t\tkey={addon.licenseType}\n\t\t\t\t\ttitle={getAddOnTitle(addon.licenseType, addon.quantity)}\n\t\t\t\t\tprice={addon.totalAmount}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t{items.teamAddons?.map(addon => (\n\t\t\t\t<PriceItemRow\n\t\t\t\t\tkey={addon.licenseType}\n\t\t\t\t\ttitle={getTeamAddOnTitle(addon.licenseType, addon.quantity)}\n\t\t\t\t\tprice={addon.totalAmount}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</PriceItemList>\n\t)\n}\n\nfunction PriceBreakdown({\n\tpreview,\n\tcurrency,\n\tisLoading,\n}: {\n\tpreview?: Omit<CheckoutPreview, \"planId\">\n\tcurrency: string\n\tisLoading: boolean\n}) {\n\tconst { proration, subtotal, tax, totalWithCredit, appliedCredit, creditedAmount } = preview ?? {}\n\tconst displayProration = proration !== undefined && proration !== 0 ? proration : null\n\tconst displayTax = tax !== undefined && tax !== 0 ? tax : null\n\tconst displayAppliedCredit = appliedCredit !== undefined && appliedCredit < 0 ? appliedCredit : null\n\tconst isCredit = creditedAmount !== undefined && creditedAmount > 0\n\n\treturn (\n\t\t<PriceItemList isLoading={isLoading} disabled={!preview}>\n\t\t\t<PriceItemRow title=\"Proration\" price={displayProration} currency={currency} />\n\t\t\t<PriceItemRow title=\"Subtotal\" price={subtotal} currency={currency} />\n\t\t\t<PriceItemRow title=\"VAT\" price={displayTax} currency={currency} />\n\t\t\t{displayAppliedCredit !== null && (\n\t\t\t\t<PriceItemRow title=\"Credit\" price={displayAppliedCredit} currency={currency} />\n\t\t\t)}\n\t\t\t{isCredit ? (\n\t\t\t\t<PriceItemRow title=\"Credit\" price={creditedAmount} currency={currency} bold />\n\t\t\t) : (\n\t\t\t\t<PriceItemRow title=\"Pay Now\" price={totalWithCredit} currency={currency} bold />\n\t\t\t)}\n\t\t</PriceItemList>\n\t)\n}\n\nfunction getEditorTitle(licenseType: TeamLicenseType, quantity: number): string {\n\treturn `${quantity} \u00D7 ${getTeamLicenseName(licenseType)} ${pluralize(\"Editor\", quantity)}`\n}\n\nfunction getAddOnTitle(licenseType: AddOnLicenseType, quantity: number): string {\n\tconst name = getAddOnLicenseTypeName(licenseType)\n\treturn `${quantity} \u00D7 ${name}`\n}\n\nfunction getTeamAddOnTitle(licenseType: TeamAddOnLicenseType, quantity: number): string {\n\tconst name = getTeamAddOnLicenseTypeName(licenseType)\n\treturn `${quantity} \u00D7 ${pluralize(name, quantity)}`\n}\n", "import { TeamSubscriptionSyncAction } from \"@framerjs/app-shared/src/ProjectState.ts\"\nimport { Button, Link, Modal } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport React, { useMemo } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./SubscriptionNotInOrderInitialModal.styles.ts\"\n\nexport function SubscriptionNotInOrderInitialModal({\n\thandlePreview,\n\tcanReactivate,\n\tteamSyncAction,\n}: {\n\thandlePreview: () => void\n\tcanReactivate: boolean\n\tteamSyncAction:\n\t\t| TeamSubscriptionSyncAction.Reactivate\n\t\t| TeamSubscriptionSyncAction.ChargeableSync\n\t\t| TeamSubscriptionSyncAction.CreateTeamSubscription\n\t\t| TeamSubscriptionSyncAction.SyncQuantity\n}) {\n\tconst page = useMemo(() => {\n\t\tswitch (teamSyncAction) {\n\t\t\tcase TeamSubscriptionSyncAction.Reactivate:\n\t\t\t\treturn Pages.subscriptionNotInOrderReactivateModal\n\t\t\tcase TeamSubscriptionSyncAction.ChargeableSync:\n\t\t\tcase TeamSubscriptionSyncAction.CreateTeamSubscription:\n\t\t\tcase TeamSubscriptionSyncAction.SyncQuantity:\n\t\t\t\treturn Pages.subscriptionNotInOrderChargeableSyncModal\n\t\t\tdefault:\n\t\t\t\tassertNever(teamSyncAction)\n\t\t}\n\t}, [teamSyncAction])\n\n\tuseRecordEffect(\"ui_impression\", { page }, [page])\n\n\tconst handleReactivate = React.useCallback(async () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage,\n\t\t\tid: UIInteraction.reactivate,\n\t\t})\n\t\thandlePreview()\n\t}, [handlePreview, page])\n\n\tconst reactivationLabel = canReactivate\n\t\t? \"An active subscription for editors in this workspace is required. Reactivate your subscription to update your site again.\"\n\t\t: \"An active subscription for editors in this workspace is required. Please contact your workspace admin for reactivation.\"\n\n\treturn (\n\t\t<>\n\t\t\t<Modal.Header separator>Reactivate Your Workspace</Modal.Header>\n\n\t\t\t<Modal.Text>{reactivationLabel}</Modal.Text>\n\n\t\t\t<Modal.Footer>\n\t\t\t\t<Link\n\t\t\t\t\tvariant={undefined}\n\t\t\t\t\tclassName={styles.fullWidth}\n\t\t\t\t\thref=\"https://www.framer.com/help/articles/reactivate-workspace/\"\n\t\t\t\t\tbold\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tpage: \"subscription_not_in_order_modal\",\n\t\t\t\t\t\t\tid: \"subscription_not_in_order_modal_learn_more_link\",\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{Dictionary.LearnMore}\n\t\t\t\t</Link>\n\t\t\t\t{canReactivate ? (\n\t\t\t\t\t<Button bold variant=\"primary\" onClick={handleReactivate}>\n\t\t\t\t\t\tReactivate\n\t\t\t\t\t</Button>\n\t\t\t\t) : null}\n\t\t\t</Modal.Footer>\n\t\t</>\n\t)\n}\n", "import \"SubscriptionNotInOrderInitialModal.styles_1piqgov.wyw.css\"; export const fullWidth = \"fullWidth_f1aw5bm2\";\nexport const header = \"header_h14vdug\";", "import type { TeamSubscriptionSyncAction } from \"@framerjs/app-shared/src/ProjectState.ts\"\nimport { assertNever } from \"@framerjs/shared\"\nimport React from \"react\"\nimport type { CheckoutPreview } from \"../../siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\nimport { PaymentErrorStatus, type PaymentError } from \"../../siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport {\n\ttype PutReactivateSubscriptionResponse,\n\ttype SyncPreviewResponse,\n\tSyncPreviewStatus,\n\tSyncReactivationStatus,\n\treactivateSync,\n\tsyncPreview,\n} from \"./api/syncPreview.ts\"\n\nexport type SubscriptionNotInOrderState =\n\t| { status: SubscriptionNotInOrderStatus.Loading }\n\t| { status: SubscriptionNotInOrderStatus.Error; error: SubscriptionNotInOrderError }\n\t| { status: SubscriptionNotInOrderStatus.Preview; preview: Omit<CheckoutPreview, \"planId\"> }\n\t| { status: SubscriptionNotInOrderStatus.Reactivating; preview: Omit<CheckoutPreview, \"planId\"> }\n\t| {\n\t\t\tstatus: SubscriptionNotInOrderStatus.UpdateFailed\n\t\t\tpreview: Omit<CheckoutPreview, \"planId\">\n\t\t\terror: SubscriptionNotInOrderUpdateError\n\t  }\n\t| { status: SubscriptionNotInOrderStatus.SyncSuccess }\n\nexport enum SubscriptionNotInOrderStatus {\n\tPreview,\n\tLoading,\n\tReactivating,\n\tSyncSuccess,\n\tError,\n\tUpdateFailed,\n}\n\nexport enum SubscriptionNotInOrderErrorType {\n\tUnhandledError,\n\tPaymentError,\n\tOverEditorLimit,\n\tOverProjectEditorLimit,\n\tUnauthorizedError,\n\tAlreadySyncedError,\n\tNoActiveProjectPlansError,\n}\n\nexport type SubscriptionNotInOrderError =\n\t| { type: SubscriptionNotInOrderErrorType.OverEditorLimit; newLimit: number; currentEditorCount: number }\n\t| { type: SubscriptionNotInOrderErrorType.OverProjectEditorLimit; newLimit: number; currentEditorCount: number }\n\t| { type: SubscriptionNotInOrderErrorType.UnhandledError }\n\t| { type: SubscriptionNotInOrderErrorType.UnauthorizedError }\n\t| { type: SubscriptionNotInOrderErrorType.AlreadySyncedError }\n\t| { type: SubscriptionNotInOrderErrorType.NoActiveProjectPlansError }\n\ntype SubscriptionNotInOrderUpdateError =\n\t| { type: SubscriptionNotInOrderErrorType.PaymentError; error: PaymentError }\n\t| { type: SubscriptionNotInOrderErrorType.OverEditorLimit; newLimit: number; currentEditorCount: number }\n\t| { type: SubscriptionNotInOrderErrorType.OverProjectEditorLimit; newLimit: number; currentEditorCount: number }\n\t| { type: SubscriptionNotInOrderErrorType.UnauthorizedError }\n\nexport function useSubscriptionSync({\n\tteamId,\n\tteamSyncAction,\n\tisBillingV3,\n}: {\n\tteamId: string\n\tteamSyncAction: TeamSubscriptionSyncAction\n\tisBillingV3: boolean\n}) {\n\tconst [state, setState] = React.useState<SubscriptionNotInOrderState>({\n\t\tstatus: SubscriptionNotInOrderStatus.Loading,\n\t})\n\n\tconst handlePreview = React.useCallback(async () => {\n\t\tsetState({ status: SubscriptionNotInOrderStatus.Loading })\n\t\tconst response = await syncPreview(teamId, teamSyncAction, isBillingV3)\n\t\tsetState(getNextStateAfterPreview(response))\n\t}, [teamId, teamSyncAction, isBillingV3])\n\n\tconst handleReactivation = React.useCallback(async () => {\n\t\tif (\n\t\t\tstate.status !== SubscriptionNotInOrderStatus.Preview &&\n\t\t\tstate.status !== SubscriptionNotInOrderStatus.UpdateFailed\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tconst { preview } = state\n\t\tsetState({ status: SubscriptionNotInOrderStatus.Reactivating, preview })\n\n\t\tconst result = await reactivateSync(teamId, isBillingV3)\n\t\tsetState(getNextStateAfterReactivation(result, preview))\n\t}, [teamId, isBillingV3, state])\n\n\tconst clearError = React.useCallback(() => {\n\t\tif (state.status !== SubscriptionNotInOrderStatus.UpdateFailed) return\n\t\tsetState({ status: SubscriptionNotInOrderStatus.Preview, preview: state.preview })\n\t}, [state])\n\n\tReact.useEffect(() => {\n\t\tvoid handlePreview()\n\t}, [handlePreview])\n\n\treturn { state, handlePreview, handleReactivation, clearError }\n}\n\nfunction getNextStateAfterPreview(preview: SyncPreviewResponse): SubscriptionNotInOrderState {\n\tswitch (preview.status) {\n\t\tcase SyncPreviewStatus.Success:\n\t\t\treturn { status: SubscriptionNotInOrderStatus.Preview, preview: preview.preview }\n\t\tcase SyncPreviewStatus.OverEditorLimitError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.OverEditorLimit,\n\t\t\t\t\tnewLimit: preview.newLimit,\n\t\t\t\t\tcurrentEditorCount: preview.currentEditorCount,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncPreviewStatus.OverProjectEditorLimitError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.OverProjectEditorLimit,\n\t\t\t\t\tnewLimit: preview.newLimit,\n\t\t\t\t\tcurrentEditorCount: preview.currentEditorCount,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncPreviewStatus.UnauthorizedError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.UnauthorizedError,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncPreviewStatus.UnhandledError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.UnhandledError,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncPreviewStatus.AlreadySyncedError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.AlreadySyncedError,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncPreviewStatus.NoActiveProjectPlansError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.NoActiveProjectPlansError,\n\t\t\t\t},\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(preview)\n\t}\n}\n\nfunction getNextStateAfterReactivation(\n\tresult: PutReactivateSubscriptionResponse,\n\tpreview: Omit<CheckoutPreview, \"planId\">,\n): SubscriptionNotInOrderState {\n\tswitch (result.status) {\n\t\tcase SyncReactivationStatus.Success:\n\t\t\treturn { status: SubscriptionNotInOrderStatus.SyncSuccess }\n\t\tcase SyncReactivationStatus.PaymentError:\n\t\t\tif (result.error.status === PaymentErrorStatus.Unauthorized) {\n\t\t\t\treturn {\n\t\t\t\t\tstatus: SubscriptionNotInOrderStatus.UpdateFailed,\n\t\t\t\t\tpreview,\n\t\t\t\t\terror: { type: SubscriptionNotInOrderErrorType.UnauthorizedError },\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.UpdateFailed,\n\t\t\t\tpreview,\n\t\t\t\terror: { type: SubscriptionNotInOrderErrorType.PaymentError, error: result.error },\n\t\t\t}\n\t\tcase SyncReactivationStatus.OverEditorLimitError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.UpdateFailed,\n\t\t\t\tpreview,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.OverEditorLimit,\n\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncReactivationStatus.OverProjectEditorLimitError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.UpdateFailed,\n\t\t\t\tpreview,\n\t\t\t\terror: {\n\t\t\t\t\ttype: SubscriptionNotInOrderErrorType.OverProjectEditorLimit,\n\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t},\n\t\t\t}\n\t\tcase SyncReactivationStatus.AlreadySyncedError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: { type: SubscriptionNotInOrderErrorType.AlreadySyncedError },\n\t\t\t}\n\t\tcase SyncReactivationStatus.NoActiveProjectPlansError:\n\t\t\treturn {\n\t\t\t\tstatus: SubscriptionNotInOrderStatus.Error,\n\t\t\t\terror: { type: SubscriptionNotInOrderErrorType.NoActiveProjectPlansError },\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(result)\n\t}\n}\n", "import { ApiError, HTTP_ERROR_CODES } from \"@framerjs/app-shared\"\nimport { TeamSubscriptionSyncAction } from \"@framerjs/app-shared/src/ProjectState.ts\"\nimport { assertNever, getLogger } from \"@framerjs/shared\"\nimport {\n\ttype CheckoutPreview,\n\ttransformPreviewResponseBody,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/checkoutPreview.ts\"\nimport {\n\tisOverEditorLimitError,\n\tisOverProjectEditorLimitError,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/overEditorLimitError.ts\"\nimport {\n\tPaymentErrorStatus,\n\tclassifyPaymentError,\n\thandleRequiredAction,\n\ttype PaymentError,\n\ttype PutSubscriptionResponseAction,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/errors/paymentError.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"syncPreview\")\n\ntype PutSyncApiResponse = { result: \"success\" } | { result: \"action_required\"; action: PutSubscriptionResponseAction }\n\ninterface AlreadySyncedError extends ApiError {\n\tstatus: 409\n\tdata: {\n\t\treason: \"already_synced\"\n\t}\n}\n\nexport enum SyncPreviewStatus {\n\tSuccess,\n\tOverEditorLimitError,\n\tOverProjectEditorLimitError,\n\tUnauthorizedError,\n\tUnhandledError,\n\tAlreadySyncedError,\n\tNoActiveProjectPlansError,\n}\n\nexport enum SyncReactivationStatus {\n\tSuccess,\n\tOverEditorLimitError,\n\tOverProjectEditorLimitError,\n\tAlreadySyncedError,\n\tNoActiveProjectPlansError,\n\tPaymentError,\n}\n\nfunction isAlreadySyncedError(error: unknown): error is AlreadySyncedError {\n\tif (!(error instanceof ApiError)) return false\n\tif (error.status !== 409) return false\n\tif (error.data.reason !== \"already_synced\") return false\n\treturn true\n}\n\ninterface NoActiveProjectPlansError extends ApiError {\n\tstatus: 409\n\tdata: {\n\t\treason: \"no_active_project_plans\"\n\t}\n}\n\nfunction isNoActiveProjectPlansError(error: unknown): error is NoActiveProjectPlansError {\n\tif (!(error instanceof ApiError)) return false\n\tif (error.status !== 409) return false\n\tif (error.data.reason !== \"no_active_project_plans\") return false\n\treturn true\n}\n\nexport type SyncPreviewResponse =\n\t| { status: SyncPreviewStatus.Success; preview: Omit<CheckoutPreview, \"planId\"> }\n\t| {\n\t\t\tstatus: SyncPreviewStatus.OverEditorLimitError\n\t\t\t/** What the limit would be if previewed plan update was successful */\n\t\t\tnewLimit: number\n\t\t\tcurrentEditorCount: number\n\t  }\n\t| {\n\t\t\tstatus: SyncPreviewStatus.OverProjectEditorLimitError\n\t\t\tnewLimit: number\n\t\t\tcurrentEditorCount: number\n\t  }\n\t| { status: SyncPreviewStatus.UnauthorizedError }\n\t| { status: SyncPreviewStatus.UnhandledError }\n\t| { status: SyncPreviewStatus.AlreadySyncedError }\n\t| { status: SyncPreviewStatus.NoActiveProjectPlansError }\n\nexport async function syncPreview(\n\tteamId: string,\n\tteamSyncAction: TeamSubscriptionSyncAction,\n\tisBillingV3: boolean,\n): Promise<SyncPreviewResponse> {\n\ttry {\n\t\tconst omitFirstEditorFromCalculation = isBillingV3\n\t\t\t? teamSyncAction === TeamSubscriptionSyncAction.CreateTeamSubscription ||\n\t\t\t\tteamSyncAction === TeamSubscriptionSyncAction.SyncQuantity\n\t\t\t: teamSyncAction === TeamSubscriptionSyncAction.Reactivate\n\t\tconst syncPreviewUrl = isBillingV3\n\t\t\t? `/web/v3/teams/${teamId}/subscription/sync/preview`\n\t\t\t: `/web/v2/teams/${teamId}/subscription/sync/preview`\n\t\tconst response = isBillingV3 ? await apiFetcher.post(syncPreviewUrl, {}) : await apiFetcher.get(syncPreviewUrl)\n\n\t\treturn {\n\t\t\tstatus: SyncPreviewStatus.Success,\n\t\t\tpreview: transformPreviewResponseBody(response, { omitFirstEditorFromCalculation }),\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: SyncPreviewStatus.UnauthorizedError }\n\t\t}\n\n\t\tif (isAlreadySyncedError(error)) {\n\t\t\tlog.reportError(error, {\n\t\t\t\ttags: {\n\t\t\t\t\treason: \"already_synced\",\n\t\t\t\t},\n\t\t\t\textras: {\n\t\t\t\t\tteamId,\n\t\t\t\t\tteamSyncAction,\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn { status: SyncPreviewStatus.AlreadySyncedError }\n\t\t}\n\n\t\tif (isNoActiveProjectPlansError(error)) {\n\t\t\tlog.reportError(error, {\n\t\t\t\ttags: {\n\t\t\t\t\treason: \"no_active_project_plans\",\n\t\t\t\t},\n\t\t\t\textras: {\n\t\t\t\t\tteamId,\n\t\t\t\t\tteamSyncAction,\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn { status: SyncPreviewStatus.NoActiveProjectPlansError }\n\t\t}\n\n\t\tif (isOverEditorLimitError(error)) {\n\t\t\treturn {\n\t\t\t\tstatus: SyncPreviewStatus.OverEditorLimitError,\n\t\t\t\tnewLimit: error.data.limit,\n\t\t\t\tcurrentEditorCount: error.data.current,\n\t\t\t}\n\t\t}\n\n\t\tif (isOverProjectEditorLimitError(error)) {\n\t\t\treturn {\n\t\t\t\tstatus: SyncPreviewStatus.OverProjectEditorLimitError,\n\t\t\t\tnewLimit: error.data.limit,\n\t\t\t\tcurrentEditorCount: error.data.current,\n\t\t\t}\n\t\t}\n\n\t\tlog.reportError(error, {\n\t\t\textras: {\n\t\t\t\tteamId,\n\t\t\t\tteamSyncAction,\n\t\t\t},\n\t\t})\n\t\treturn { status: SyncPreviewStatus.UnhandledError }\n\t}\n}\n\nexport type PutReactivateSubscriptionResponse =\n\t| { status: SyncReactivationStatus.Success }\n\t| { status: SyncReactivationStatus.OverEditorLimitError; newLimit: number; currentEditorCount: number }\n\t| { status: SyncReactivationStatus.OverProjectEditorLimitError; newLimit: number; currentEditorCount: number }\n\t| { status: SyncReactivationStatus.AlreadySyncedError }\n\t| { status: SyncReactivationStatus.NoActiveProjectPlansError }\n\t| { status: SyncReactivationStatus.PaymentError; error: PaymentError }\n\nexport async function reactivateSync(teamId: string, isBillingV3: boolean): Promise<PutReactivateSubscriptionResponse> {\n\ttry {\n\t\tconst syncUrl = isBillingV3\n\t\t\t? `/web/v3/teams/${teamId}/subscription/sync`\n\t\t\t: `/web/v2/teams/${teamId}/subscription/sync`\n\t\tconst response: PutSyncApiResponse = isBillingV3 ? await apiFetcher.put(syncUrl, {}) : await apiFetcher.put(syncUrl)\n\t\tconst { result } = response\n\t\tif (result === \"success\") {\n\t\t\treturn { status: SyncReactivationStatus.Success }\n\t\t}\n\t\tif (result === \"action_required\") {\n\t\t\tconst error = await handleRequiredAction(response.action)\n\t\t\treturn error ? { status: SyncReactivationStatus.PaymentError, error } : { status: SyncReactivationStatus.Success }\n\t\t}\n\n\t\tassertNever(response, `Unexpected response`)\n\t} catch (error) {\n\t\tif (isAlreadySyncedError(error)) {\n\t\t\treturn { status: SyncReactivationStatus.AlreadySyncedError }\n\t\t}\n\n\t\tif (isNoActiveProjectPlansError(error)) {\n\t\t\treturn { status: SyncReactivationStatus.NoActiveProjectPlansError }\n\t\t}\n\n\t\tif (isOverEditorLimitError(error)) {\n\t\t\treturn {\n\t\t\t\tstatus: SyncReactivationStatus.OverEditorLimitError,\n\t\t\t\tnewLimit: error.data.limit,\n\t\t\t\tcurrentEditorCount: error.data.current,\n\t\t\t}\n\t\t}\n\n\t\tif (isOverProjectEditorLimitError(error)) {\n\t\t\treturn {\n\t\t\t\tstatus: SyncReactivationStatus.OverProjectEditorLimitError,\n\t\t\t\tnewLimit: error.data.limit,\n\t\t\t\tcurrentEditorCount: error.data.current,\n\t\t\t}\n\t\t}\n\n\t\tconst paymentError = classifyPaymentError(error)\n\t\tif (paymentError) return { status: SyncReactivationStatus.PaymentError, error: paymentError }\n\n\t\tlog.reportError(error)\n\t\treturn {\n\t\t\tstatus: SyncReactivationStatus.PaymentError,\n\t\t\terror: { status: PaymentErrorStatus.UnhandledError },\n\t\t}\n\t}\n}\n", "import { Button, Modal, Spinner } from \"@framerjs/fresco\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { unlinkAndReplaceAll, unlinkComponent } from \"document/components/unlinking/index.ts\"\nimport engine from \"document/engine.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { useEffect } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\nexport function UnlinkComponentModal({\n\tidentifier,\n\tmoduleType,\n\tnodeId,\n\tenterIsolation,\n\tcodeComponentIsolationMode,\n}: ModalProps<ModalType.UnlinkComponent>) {\n\tconst instance = useDeprecatedEngineState(EngineChange.TreeStore, () => {\n\t\tif (!nodeId) return\n\t\tconst node = engine.tree.getNode(nodeId)\n\t\tif (!node) return\n\t\tassert(isCodeComponentNode(node), \"You can only unlink code components\")\n\t\treturn node\n\t})\n\n\tconst canUnlink = isUndefined(nodeId) || instance?.codeComponentIdentifier === identifier.value\n\n\tuseEffect(() => {\n\t\tif (!canUnlink) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t})\n\t\t}\n\t}, [canUnlink])\n\n\tif (!canUnlink) {\n\t\treturn null\n\t}\n\n\tasync function handleUnlink() {\n\t\tawait unlinkComponent(engine, {\n\t\t\tidentifier,\n\t\t\tmoduleType,\n\t\t\tinstance,\n\t\t\tenterIsolation,\n\t\t\tcodeComponentIsolationMode,\n\t\t})\n\t}\n\n\tasync function handleUnlinkAndReplaceAll() {\n\t\tawait unlinkAndReplaceAll(engine, {\n\t\t\tidentifier,\n\t\t\tmoduleType,\n\t\t\tinstance,\n\t\t\tenterIsolation,\n\t\t\tcodeComponentIsolationMode,\n\t\t})\n\t}\n\n\treturn <UnlinkComponentModalInner handleUnlink={handleUnlink} handleUnlinkAndReplaceAll={handleUnlinkAndReplaceAll} />\n}\n\ninterface ComponentCreationModalInnerProps {\n\thandleUnlink(): Promise<void>\n\thandleUnlinkAndReplaceAll(): Promise<void>\n}\n\nfunction UnlinkComponentModalInner({ handleUnlink, handleUnlinkAndReplaceAll }: ComponentCreationModalInnerProps) {\n\tconst timeout = React.useRef<number | null>(null)\n\tconst [isUnlinking, setIsUnlinking] = React.useState(false)\n\tconst [isUnlinkingAll, setIsUnlinkingAll] = React.useState(false)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tif (timeout.current) {\n\t\t\t\tclearTimeout(timeout.current)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tconst onUnlink = React.useCallback(() => {\n\t\t// In most cases unlinking should be instant. If it takes a bit longer,\n\t\t// we show a spinner until it completes.\n\t\ttimeout.current = window.setTimeout(() => {\n\t\t\tsetIsUnlinking(true)\n\t\t}, 250)\n\n\t\thandleUnlink()\n\t\t\t.then(() => engine.stores.modalStore.dismiss())\n\t\t\t.catch(unhandledError)\n\t}, [handleUnlink])\n\n\tconst onUnlinkAll = React.useCallback(() => {\n\t\t// In most cases unlinking should be instant. If it takes a bit longer,\n\t\t// we show a spinner until it completes.\n\t\ttimeout.current = window.setTimeout(() => {\n\t\t\tsetIsUnlinkingAll(true)\n\t\t}, 250)\n\n\t\thandleUnlinkAndReplaceAll()\n\t\t\t.then(() => engine.stores.modalStore.dismiss())\n\t\t\t.catch(unhandledError)\n\t}, [handleUnlinkAndReplaceAll])\n\n\treturn (\n\t\t<Modal.Root onDismiss={engine.stores.modalStore.dismiss} {...modalThemeProps}>\n\t\t\t<Modal.Header closeButton>Edit Component</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>This component instance is linked to a primary component in another project.</Modal.Text>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer direction=\"column\">\n\t\t\t\t<Button enabled={!isUnlinking && !isUnlinkingAll} onClick={onUnlink}>\n\t\t\t\t\t{isUnlinking ? <Spinner /> : \"Unlink Instance\"}\n\t\t\t\t</Button>\n\t\t\t\t<Button variant=\"primary\" title=\"Unlink all\" onClick={onUnlinkAll} enabled={!isUnlinking && !isUnlinkingAll}>\n\t\t\t\t\t{isUnlinkingAll ? <Spinner /> : \"Unlink & Replace All\"}\n\t\t\t\t</Button>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import { ConfirmationModal } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\n\n/** @deprecated Use `Confirmation` directly instead. */\nexport function UnsavedChangesModal({ description, onConfirm }: ModalProps<ModalType.UnsavedChanges>) {\n\tconst onDiscard = () => onConfirm(\"discard\")\n\tconst onCancel = () => onConfirm(\"cancel\")\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle={Dictionary.UnsavedChanges}\n\t\t\tdescription={description}\n\t\t\tvariant=\"destructiveSecondary\"\n\t\t\tconfirmLabel={Dictionary.DiscardItem}\n\t\t\tonConfirm={onDiscard}\n\t\t\tdismissVariant=\"primary\"\n\t\t\tcancelLabel={Dictionary.ContinueEditing}\n\t\t\tonCancel={onCancel}\n\t\t\tonDismiss={onCancel}\n\t\t\tcancelOnEnter\n\t\t\tkeyboardConfirmMode={false}\n\t\t\tbuttonDirection=\"column\"\n\t\t/>\n\t)\n}\n", "import { Button, CustomModal, Progress, Stack, Translatable as T, Text, modalStyles } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\nimport * as styles from \"./UpgradeDocumentModal.styles.ts\"\n\nexport const UpgradeDocumentModal = () => {\n\tconst [running, setRunning] = React.useState(false)\n\tconst [progress, setProgress] = React.useState({ todo: 1, total: 1 })\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tReact.useEffect(() => {\n\t\tconst cleanup = engine.upgradeManager?.addProgressListener((running, todo, total) => {\n\t\t\tif (running) {\n\t\t\t\tsetRunning(true)\n\t\t\t}\n\t\t\tsetProgress({ todo, total })\n\t\t})\n\t\treturn cleanup\n\t}, [])\n\n\tlet inner: React.ReactNode = null\n\tif (!running) {\n\t\tinner = (\n\t\t\t<>\n\t\t\t\t<Text className={styles.title}>\n\t\t\t\t\t<T>Optimize Project</T>\n\t\t\t\t</Text>\n\t\t\t\t<Text className={modalStyles.secondaryText}>\n\t\t\t\t\t<T>We can make this project up to 30% faster, without changing any of your layers or content.</T>{\" \"}\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={modalStyles.link}\n\t\t\t\t\t\thref=\"https://www.framer.com/help/articles/optimizing-projects/\"\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<T>Learn more here.</T>\n\t\t\t\t\t</a>\n\t\t\t\t</Text>\n\t\t\t\t<Stack gap={10} direction=\"row\">\n\t\t\t\t\t<Button className={styles.button} onClick={engine.stores.modalStore.dismiss}>\n\t\t\t\t\t\t<T>Later</T>\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={styles.button}\n\t\t\t\t\t\tonClick={() => engine.upgradeManager?.startInForeground()}\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<T>Optimize</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t</>\n\t\t)\n\t} else {\n\t\tconst text = progress.todo > 0 ? \"Optimizing Project\u2026\" : \"Optimization Done\"\n\t\tinner = (\n\t\t\t<>\n\t\t\t\t<Text className={styles.title}>{text}</Text>\n\t\t\t\t<Progress value={progress.total - progress.todo} max={progress.total} />\n\t\t\t\t<Stack gap={10} direction=\"row\">\n\t\t\t\t\t<Button className={styles.button} onClick={engine.stores.modalStore.dismiss} enabled={progress.todo <= 0}>\n\t\t\t\t\t\t<T>Dismiss</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t</>\n\t\t)\n\t}\n\n\treturn (\n\t\t<CustomModal className={modalStyles.container} visible hasBackdrop onDismiss={() => {}} {...modalThemeProps}>\n\t\t\t<Stack gap={20} justifyContent=\"space-between\">\n\t\t\t\t{inner}\n\t\t\t</Stack>\n\t\t</CustomModal>\n\t)\n}\n", "import \"UpgradeDocumentModal.styles_4yc8kj.wyw.css\"; export const title = \"title_tmoyonw\";\nexport const button = \"button_bzp5l3u\";", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback } from \"react\"\nimport { enterpriseLearnMoreURL, enterpriseUpsellURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\nimport { EnterpriseUpsellModal } from \"./EnterpriseUpsellModal.tsx\"\n\nexport function UpsellEnterpriseModal({ description, upsell, upsellFeatures }: ModalProps<ModalType.UpsellEnterprise>) {\n\tuseRecordEffect(\"ui_impression\", { page: upsell }, [upsell])\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tconst handleConfirm = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: upsell,\n\t\t\tid: UpsellUIInteraction.confirmUpsell,\n\t\t})\n\t\tengine.stores.modalStore.dismiss()\n\t\t// We only want to schedule an appointment when the editor limit is reached\n\t\tconst isEditorLimitUpsell =\n\t\t\tupsell === UpsellType.enterpriseEditorLimitUpsell || upsell === UpsellType.projectEditorLimitEnterpriseUpsell\n\t\topenNewTab(isEditorLimitUpsell ? enterpriseUpsellURL : enterpriseLearnMoreURL)\n\t\treturn\n\t}, [upsell])\n\n\tconst handleDismiss = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: upsell, id: UpsellUIInteraction.cancelUpsell })\n\t\tengine.stores.modalStore.dismiss()\n\t}, [upsell])\n\n\treturn (\n\t\t<EnterpriseUpsellModal\n\t\t\tdescription={description}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonCancel={handleDismiss}\n\t\t\tupsellFeatures={upsellFeatures}\n\t\t\t{...modalThemeProps}\n\t\t/>\n\t)\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { Button, EmptyState, type ModalDismissType, ReadOnlyContext, type ThemeOverrideMode } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { isScopeUsingComponentTint } from \"document/components/utils/getThemeOverrideMode.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport { pathToName } from \"document/components/utils/pathToName.ts\"\nimport { getWebPageDisplayTitle } from \"document/components/utils/webPageTitles.ts\"\nimport engine from \"document/engine.ts\"\nimport { type CanvasNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionNode,\n\tisContentManagementNode,\n\tisLayoutTemplateNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getGeneratedValue } from \"document/models/CanvasTree/traits/Generated.ts\"\nimport { withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport {\n\ttype VariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype VariablesAndDividers,\n\ttype VariableType,\n\ttype WithVariables,\n\twithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { withFormInputEvents } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { SelectedVariablePath, TemporaryTarget } from \"document/stores/VariablesStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { NewIconEdit } from \"../../projectbar/icons/NewIconEdit.tsx\"\nimport { IconSectionHeaderPlus } from \"../../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { createVariableInScope } from \"../../properties/utils/createVariableInScope.ts\"\nimport { addActionToEventKey } from \"../../properties/utils/eventActions.ts\"\nimport { ModalWithSidebar } from \"../ModalWithSidebar.tsx\"\nimport { CheckingFieldUsage, DeleteFieldPrevention, type DeleteFieldPreventionData } from \"./DeleteFieldPrevention.tsx\"\nimport { ModalToolbarButton } from \"./ModalToolbarButton.tsx\"\nimport { VariableDetail } from \"./VariableDetail.tsx\"\nimport { VariableModalContextProvider } from \"./VariableModalContext.ts\"\nimport { rowHeight } from \"./VariableRow.styles.ts\"\nimport { EmptyVariableRow, VariableRow } from \"./VariableRow.tsx\"\nimport * as styles from \"./VariablesModal.styles.ts\"\nimport { getSelectedVariableInfo, type SelectedVariableInfo } from \"./getSelectedVariableInfo.ts\"\nimport { getVariableCreationMenuOptions } from \"./getVariableCreationMenuOptions.ts\"\nimport { useDeleteVariable } from \"./useDeleteVariable.ts\"\nimport { useSyncSelectedVariablePath } from \"./useSyncSelectedVariablePath.ts\"\nimport { useVariableActions } from \"./useVariableActions.ts\"\n\nconst { rowMargin } = styles\n\nconst onDismiss = (type: ModalDismissType) => {\n\tconst nodeWithVariables = getNodeWithVariables()\n\tconst { selectedVariablePath, temporaryVariable } = engine.stores.variablesStore\n\tconst selectedVariableInfo = getSelectedVariableInfo(nodeWithVariables, selectedVariablePath, temporaryVariable)\n\n\tif (type === \"escapeKey\" && selectedVariableInfo?.selectedVariableParent) {\n\t\tconst parentVariableId = selectedVariableInfo.selectedVariableParent.id\n\t\tassert(parentVariableId, \"Parent variable ID is required\")\n\t\tengine.stores.variablesStore.selectedVariablePath = [parentVariableId]\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.dismiss()\n\tengine.stores.variablesStore.clearTemporaryVariable()\n}\n\nfunction getNodeWithVariables(): (CanvasNode & WithVariables) | null {\n\tconst activeScope = engine.stores.scopeStore.active\n\tif (withVariables(activeScope)) {\n\t\treturn activeScope\n\t}\n\tif (isContentManagementNode(activeScope)) {\n\t\tconst firstSelectedNodeId = engine.stores.selectionStore.ids[0]\n\t\tif (!firstSelectedNodeId) return null\n\t\tconst node = engine.tree.getNode(firstSelectedNodeId)\n\t\tif (!node) return null\n\t\tconst groundNode = engine.tree.getGroundNodeFor(node)\n\t\tif (isCollectionNode(groundNode)) {\n\t\t\treturn groundNode\n\t\t}\n\t}\n\treturn null\n}\n\nexport function useNodeWithVariables(): (CanvasNode & WithVariables) | null {\n\tconst { scopeStore, selectionStore } = engine.stores\n\treturn useEngineState(getNodeWithVariables, [], [scopeStore, selectionStore, EngineChange.Tree])\n}\n\nfunction getModalContentHeight(variableCount: number): number {\n\tconst rowContainerMargin = dimensions.values.inputSpacing * 2\n\tconst totalRowHeight = variableCount * rowHeight\n\tconst totalRowMargin = variableCount * 2 /* sides */ * rowMargin\n\tconst collapsingMargin = (variableCount + 1) * rowMargin\n\treturn styles.headerHeight + totalRowHeight + rowContainerMargin + totalRowMargin - collapsingMargin\n}\n\n/**\n * Returns the list of variables to render, optionally including a temporary\n * variable that only exists in the UI during the creation flow (e.g.\n * Interactions panel > new event \u2014 the variable isn\u2019t persisted until the user\n * confirms with \u201CAdd\u201D).\n *\n * @param options.skipItemVariables - When `true`, the hook won\u2019t return\n *   `selectedVariableParent.itemVariables` even if a parent is selected. This\n *   is useful for the fields list, which always must show the top-level variables and all the children.\n */\nfunction useIncludeTemporaryVariableIfNeeded(\n\tvariables: VariablesAndDividers | undefined,\n\tselectedVariableInfo: SelectedVariableInfo | null,\n\ttemporaryVariable: VariableDefinition | null,\n\t{ skipItemVariables = false }: { skipItemVariables?: boolean } = {},\n) {\n\treturn useMemo((): VariablesAndDividers => {\n\t\tif (!variables) return emptyArray()\n\n\t\tif (!skipItemVariables && selectedVariableInfo?.selectedVariableParent) {\n\t\t\treturn selectedVariableInfo.selectedVariableParent.itemVariables\n\t\t}\n\n\t\tif (!temporaryVariable) return variables\n\t\treturn [...variables, temporaryVariable]\n\t}, [variables, selectedVariableInfo, temporaryVariable, skipItemVariables])\n}\n\nexport function VariablesModal() {\n\tconst nodeWithVariables = useNodeWithVariables()\n\tconst { selectedVariablePath, temporaryVariable, temporaryTarget } = engine.stores.variablesStore.useState()\n\tconst [deleteFieldPreventionData, setDeleteFieldPreventionData] = useState<DeleteFieldPreventionData | null>(null)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst selectedVariableInfo = useMemo(\n\t\t() => getSelectedVariableInfo(nodeWithVariables, selectedVariablePath, temporaryVariable),\n\t\t[nodeWithVariables, selectedVariablePath, temporaryVariable],\n\t)\n\n\tconst selectedVariableId = selectedVariableInfo?.selectedVariable?.id\n\n\t// Track the initial mount of the sidebar to ensure only animating scroll after the first mount\n\tconst isInitialModalMount = useRef(true)\n\tconst animateToSelection = !isInitialModalMount.current\n\n\tuseEffect(() => {\n\t\tisInitialModalMount.current = false\n\t}, [])\n\n\t// Clear prevention data when the user navigates to a different variable.\n\tuseEffect(() => {\n\t\tif (!deleteFieldPreventionData) return\n\t\tif (isEqual(selectedVariablePath, deleteFieldPreventionData.variableToDeletePath)) return\n\t\tsetDeleteFieldPreventionData(null)\n\t}, [deleteFieldPreventionData, selectedVariablePath])\n\n\tuseSyncSelectedVariablePath(selectedVariableInfo, selectedVariablePath, temporaryVariable)\n\n\tconst isManagedByPlugin = isCollectionNode(nodeWithVariables) && Boolean(nodeWithVariables.managedByPlugin)\n\n\tconst isReadOnly = useIsViewOnly(\"canEditVariables\") || isManagedByPlugin\n\n\tconst variables = useIncludeTemporaryVariableIfNeeded(\n\t\tnodeWithVariables?.variables,\n\t\tselectedVariableInfo,\n\t\ttemporaryVariable,\n\t)\n\n\tconst selectedVariable = variables.find(variable => variable.id === selectedVariableId)\n\n\tconst isCMSOrLocalization = engine.stores.chromeStore.useState(state => {\n\t\tconst { mainView } = state\n\t\treturn mainView === ActiveMainView.ContentManagement || mainView === ActiveMainView.Localizations\n\t})\n\n\tconst { moveVariable, selectVariable, duplicateVariable, updateVariable } = useVariableActions({\n\t\tnodeWithVariablesId: nodeWithVariables?.id ?? null,\n\t\tisReadOnly,\n\t})\n\n\tconst handleUpdateVariable = useCallback(\n\t\t(getUpdate: (current: VariableOrDivider) => VariableOrDivider) => {\n\t\t\tassert(selectedVariablePath, \"Selected variable path is required\")\n\t\t\tupdateVariable(getUpdate, selectedVariablePath)\n\t\t},\n\t\t[updateVariable, selectedVariablePath],\n\t)\n\n\tconst onPreventDeleteVariable = useCallback(\n\t\t(\n\t\t\tpreventionData: DeleteFieldPreventionData,\n\t\t\tvariableToDelete: VariableDefinition,\n\t\t\tparentVariableId: VariableID | undefined,\n\t\t) => {\n\t\t\tselectVariable(variableToDelete, parentVariableId)\n\t\t\tsetDeleteFieldPreventionData(preventionData)\n\t\t},\n\t\t[selectVariable],\n\t)\n\n\tconst {\n\t\thandleDeleteVariable: performDeleteWithCheck,\n\t\tvariablePendingDeletionPath,\n\t\tabortDeleteVariableUsageCheck,\n\t\tisPreventionEnabled,\n\t} = useDeleteVariable({\n\t\tnodeWithVariables,\n\t\tisReadOnly,\n\t\tonPreventDeleteVariable,\n\t})\n\n\tconst isCheckingFieldUsage = variablePendingDeletionPath !== null\n\n\tconst handleMoveVariable = useCallback(\n\t\t(fromIndex: number, toIndex: number) =>\n\t\t\tmoveVariable(fromIndex, toIndex, selectedVariableInfo?.selectedVariableParent?.id),\n\t\t[moveVariable, selectedVariableInfo],\n\t)\n\n\tconst handleGoBack = useMemo<VoidFunction | undefined>(() => {\n\t\tconst selectedParentVariableId = selectedVariableInfo?.selectedVariableParent?.id\n\t\tif (!selectedParentVariableId) return\n\n\t\treturn engine.scheduler.wrapHandler(() => {\n\t\t\tengine.stores.variablesStore.selectedVariablePath = [selectedParentVariableId]\n\t\t})\n\t}, [selectedVariableInfo])\n\n\tif (!nodeWithVariables) return null\n\n\tconst addVariable = engine.scheduler.wrapHandler((newVariable: VariableDefinition) => {\n\t\tif (isReadOnly) return\n\t\tif (!temporaryTarget) return\n\n\t\tconst { id, prop } = temporaryTarget\n\t\tconst node = engine.tree.get(id)\n\t\tif (!node) return\n\n\t\tswitch (newVariable.type) {\n\t\t\tcase ControlType.EventHandler: {\n\t\t\t\tif (!withFrameEvents(node) && !withFormInputEvents(node) && !isCodeComponentNode(node)) return\n\t\t\t\tconst triggerEventAction = engine.componentLoader.componentForIdentifier(\n\t\t\t\t\tHardCodedCodeIdentifier.triggerEventAction,\n\t\t\t\t)\n\t\t\t\tif (!triggerEventAction) return\n\n\t\t\t\tcreateVariableInScope({\n\t\t\t\t\tengine,\n\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\tshowEditor: true,\n\t\t\t\t\t...newVariable,\n\t\t\t\t})\n\t\t\t\taddActionToEventKey(engine.tree, engine.componentLoader, node, prop, triggerEventAction, {\n\t\t\t\t\tid: { type: ControlType.String, value: newVariable.id },\n\t\t\t\t})\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\n\t\tengine.stores.variablesStore.clearTemporaryVariable()\n\t})\n\n\tconst handleDeleteVariable = async (variableToDelete: VariableDefinition) => {\n\t\tif (isReadOnly) return\n\t\tconst parentId = selectedVariableInfo?.selectedVariableParent?.id\n\t\tif (isPreventionEnabled) {\n\t\t\tsetDeleteFieldPreventionData(null)\n\t\t\tselectVariable(variableToDelete, parentId)\n\t\t}\n\n\t\tawait performDeleteWithCheck(variableToDelete, parentId)\n\t}\n\n\tconst handleSelectVariable = (variable: VariableOrDivider) => {\n\t\t// Ensure we abort any in-flight delete usage check when the user selects a variable.\n\t\tabortDeleteVariableUsageCheck()\n\t\tselectVariable(variable, selectedVariableInfo?.selectedVariableParent?.id)\n\t}\n\n\tconst handleDuplicateVariable = (variableId: VariableID) =>\n\t\tduplicateVariable(variableId, selectedVariableInfo?.selectedVariableParent?.id)\n\n\tconst displayComponentTint = isScopeNode(nodeWithVariables) && isScopeUsingComponentTint(nodeWithVariables)\n\tconst type = getEmptyDetailType(nodeWithVariables)\n\n\tconst scopeType = engine.stores.scopeStore.scopeType\n\n\tconst variableCount = variables.length\n\tconst sortingEnabled = !temporaryVariable && variableCount > 1 && !isReadOnly\n\n\tconst variableEntityName = type === \"cms\" ? Dictionary.Field : Dictionary.Variable\n\n\t// CMS and Localization views use the same theme override mode.\n\t// Component tint takes precedence over CMS/Localization styling.\n\tlet themeOverrideMode: ThemeOverrideMode | undefined\n\n\tif (displayComponentTint) {\n\t\tthemeOverrideMode = \"component\"\n\t} else if (isCMSOrLocalization) {\n\t\tthemeOverrideMode = \"darkOnDarkModal\"\n\t}\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={isReadOnly}>\n\t\t\t<ModalWithSidebar\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t\tmodalTitle={getModalTitle(type, nodeWithVariables, selectedVariableInfo)}\n\t\t\t\tonBack={handleGoBack}\n\t\t\t\tpreferredContentHeight={getModalContentHeight(variableCount)}\n\t\t\t\tthemeOverrideMode={themeOverrideMode}\n\t\t\t\thideSidebar={agentExperimentEnabled && !variableCount}\n\t\t\t\ttoolbarActions={\n\t\t\t\t\t<ModalToolbarButton\n\t\t\t\t\t\ttitle={`Add ${variableEntityName}`}\n\t\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\t\tif (selectedVariableId && selectedVariableId === temporaryVariable?.id) {\n\t\t\t\t\t\t\t\tengine.stores.variablesStore.clearTemporaryVariable()\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t\t\t\t\tgetVariableCreationMenuOptions({\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t\t\t\t\t\tselectedVariableInfo,\n\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\t\tlocation: {\n\t\t\t\t\t\t\t\t\t\tx: event.clientX,\n\t\t\t\t\t\t\t\t\t\ty: event.currentTarget.getBoundingClientRect().bottom + 4,\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\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t</ModalToolbarButton>\n\t\t\t\t}\n\t\t\t\tsidebarContent={\n\t\t\t\t\tvariableCount ? (\n\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\tenabled={sortingEnabled}\n\t\t\t\t\t\t\titems={variables}\n\t\t\t\t\t\t\tmoveItem={handleMoveVariable}\n\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\tclassName={styles.list}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{({ item: variable, isDragEnabled }) => (\n\t\t\t\t\t\t\t\t<VariableRow\n\t\t\t\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t\t\t\t\treadOnly={isReadOnly}\n\t\t\t\t\t\t\t\t\tdisplayDragHandle={isDragEnabled}\n\t\t\t\t\t\t\t\t\tselected={variable.id === selectedVariableId}\n\t\t\t\t\t\t\t\t\tthemeOverrideMode={themeOverrideMode}\n\t\t\t\t\t\t\t\t\tonDelete={handleDeleteVariable}\n\t\t\t\t\t\t\t\t\tonSelect={handleSelectVariable}\n\t\t\t\t\t\t\t\t\tonDuplicate={handleDuplicateVariable}\n\t\t\t\t\t\t\t\t\tanimateToSelection={animateToSelection}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Sortable>\n\t\t\t\t\t) : agentExperimentEnabled ? null : (\n\t\t\t\t\t\temptyStateRows\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<VariablesModalDetail\n\t\t\t\t\tselectedVariable={selectedVariable ?? null}\n\t\t\t\t\tselectedVariablePath={selectedVariablePath}\n\t\t\t\t\tdeleteFieldPreventionData={deleteFieldPreventionData}\n\t\t\t\t\tisCheckingFieldUsage={isCheckingFieldUsage}\n\t\t\t\t\tthemeOverrideMode={themeOverrideMode}\n\t\t\t\t\tonDismissDeleteFieldPrevention={() => setDeleteFieldPreventionData(null)}\n\t\t\t\t\tisReadOnly={isReadOnly}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tvariables={variables}\n\t\t\t\t\ttemporaryTarget={temporaryTarget}\n\t\t\t\t\taddVariable={addVariable}\n\t\t\t\t\tupdateVariable={handleUpdateVariable}\n\t\t\t\t\ttype={type}\n\t\t\t\t\tnodeWithVariables={nodeWithVariables}\n\t\t\t\t/>\n\t\t\t</ModalWithSidebar>\n\t\t</ReadOnlyContext.Provider>\n\t)\n}\n\ninterface VariablesModalDetailProps {\n\tselectedVariable: VariableOrDivider | null\n\tselectedVariablePath: SelectedVariablePath | null\n\tdeleteFieldPreventionData: DeleteFieldPreventionData | null\n\tisCheckingFieldUsage: boolean\n\tthemeOverrideMode: ThemeOverrideMode | undefined\n\tonDismissDeleteFieldPrevention: () => void\n\tisReadOnly: boolean\n\tscopeType: ScopeType\n\tvariables: VariablesAndDividers\n\ttemporaryTarget: TemporaryTarget | null\n\taddVariable: (variable: VariableDefinition) => void\n\tupdateVariable: (\n\t\tgetUpdate: (current: VariableOrDivider) => VariableOrDivider,\n\t\tvariableToUpdatePath: SelectedVariablePath,\n\t) => void\n\ttype: VariablesModalType\n\tnodeWithVariables: (CanvasNode & WithVariables) | null\n}\n\nfunction VariablesModalDetail({\n\tselectedVariable,\n\tselectedVariablePath,\n\tdeleteFieldPreventionData,\n\tisCheckingFieldUsage,\n\tthemeOverrideMode,\n\tonDismissDeleteFieldPrevention,\n\tisReadOnly,\n\tscopeType,\n\tvariables,\n\ttemporaryTarget,\n\taddVariable,\n\tupdateVariable,\n\ttype,\n\tnodeWithVariables,\n}: VariablesModalDetailProps) {\n\tconst handleUpdateVariable = useCallback(\n\t\t(getUpdate: (current: VariableOrDivider) => VariableOrDivider) => {\n\t\t\tassert(selectedVariablePath, \"Selected variable path is required\")\n\t\t\tupdateVariable(getUpdate, selectedVariablePath)\n\t\t},\n\t\t[updateVariable, selectedVariablePath],\n\t)\n\n\tif (!selectedVariable || !selectedVariablePath) return <EmptyDetail type={type} />\n\n\tif (isCheckingFieldUsage) {\n\t\treturn <CheckingFieldUsage />\n\t}\n\n\tif (deleteFieldPreventionData) {\n\t\treturn (\n\t\t\t<DeleteFieldPrevention\n\t\t\t\tdeleteFieldPreventionData={deleteFieldPreventionData}\n\t\t\t\tnodeWithVariables={nodeWithVariables}\n\t\t\t\tthemeOverrideMode={themeOverrideMode}\n\t\t\t\tonDismiss={onDismissDeleteFieldPrevention}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<VariableModalContextProvider value={true}>\n\t\t\t<VariableDetail\n\t\t\t\treadOnly={isReadOnly}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tvariable={selectedVariable}\n\t\t\t\tvariables={variables}\n\t\t\t\tisTemporary={!!temporaryTarget}\n\t\t\t\tthemeOverrideMode={themeOverrideMode}\n\t\t\t\tonAdd={addVariable}\n\t\t\t\tonUpdate={handleUpdateVariable}\n\t\t\t/>\n\t\t</VariableModalContextProvider>\n\t)\n}\n\nfunction getEntityName(\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tselectedVariableInfo: SelectedVariableInfo | null,\n): string | null {\n\tif (selectedVariableInfo?.selectedVariableParent) {\n\t\treturn selectedVariableInfo.selectedVariableParent.name\n\t}\n\n\tif (isWebPageNode(nodeWithVariables)) {\n\t\tconst data = nodeWithVariables.dataIdentifier\n\t\t\t? engine.componentLoader.dataForIdentifier(nodeWithVariables.dataIdentifier)\n\t\t\t: null\n\n\t\tif (data) {\n\t\t\treturn `${data.name} ${Dictionary.Page}`\n\t\t}\n\n\t\tconst webPagePath = getWebPageDisplayTitle(engine.tree, nodeWithVariables, data)\n\t\treturn `${pathToName(webPagePath)} ${Dictionary.Page}`\n\t}\n\n\tconst name = getGeneratedValue(nodeWithVariables.name)\n\tconst fallbackName = getDefaultName(engine.componentLoader, nodeWithVariables)\n\n\treturn name || fallbackName\n}\n\nfunction getModalTitle(\n\ttype: VariablesModalType,\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tselectedVariableInfo: SelectedVariableInfo | null,\n): string {\n\tconst title = getEntityName(nodeWithVariables, selectedVariableInfo)\n\tconst variableEntityNamePlural = type === \"cms\" ? Dictionary.Fields : Dictionary.Variables\n\treturn `${title} ${variableEntityNamePlural}`\n}\n\nconst emptyStateVariables: VariableType[] = [\n\tControlType.String,\n\tControlType.Color,\n\tControlType.Image,\n\tControlType.Number,\n\tControlType.Boolean,\n]\n\nconst emptyStateRows = emptyStateVariables.map((type: VariableType, idx) => (\n\t<EmptyVariableRow key={type} type={type} index={idx} />\n))\n\ntype VariablesModalType = \"web-page\" | \"layout-template\" | \"cms\" | \"smart-component\"\n\nfunction getEmptyDetailType(nodeWithVariables: CanvasNode & WithVariables): VariablesModalType {\n\tif (isCollectionNode(nodeWithVariables)) {\n\t\t/** Originally the slug field was optional, so old documents might still need an empty state. */\n\t\treturn \"cms\"\n\t}\n\n\tif (isWebPageNode(nodeWithVariables)) return \"web-page\"\n\n\tif (isLayoutTemplateNode(nodeWithVariables)) return \"layout-template\"\n\n\treturn \"smart-component\"\n}\n\ninterface EmptyDetailProps {\n\ttype: VariablesModalType\n}\n\nconst emptyDetailLearnMoreLinks: Partial<Record<VariablesModalType, string>> = {\n\t\"layout-template\": \"https://www.framer.com/academy/lessons/framer-fundamentals-layout-templates\",\n\t\"smart-component\": \"https://www.framer.com/learn/component-variants/\",\n}\n\nfunction EmptyDetail({ type }: EmptyDetailProps) {\n\tconst learnMoreLink = emptyDetailLearnMoreLinks[type]\n\n\treturn (\n\t\t<EmptyState\n\t\t\tcenter\n\t\t\ticonLarge\n\t\t\ticon={NewIconEdit}\n\t\t\ticonColor={colors.tint}\n\t\t\ticonBackgroundColor={colors.tintDimmed}\n\t\t\tclassName={learnMoreLink ? styles.emptyDetailWithButton : undefined}\n\t\t\ttitle=\"Customize with variables\"\n\t\t\tbody={\n\t\t\t\t<>\n\t\t\t\t\tCreate variables of values\n\t\t\t\t\t<br />\n\t\t\t\t\tlike colors and text. These\n\t\t\t\t\t<br />\n\t\t\t\t\tbecome editable controls.\n\t\t\t\t</>\n\t\t\t}\n\t\t\tbutton={\n\t\t\t\tlearnMoreLink ? (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tbold\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\ttitle={Dictionary.LearnMore}\n\t\t\t\t\t\tonClick={() => openNewTab(learnMoreLink)}\n\t\t\t\t\t\tstyle={{ width: 90 }}\n\t\t\t\t\t/>\n\t\t\t\t) : undefined\n\t\t\t}\n\t\t/>\n\t)\n}\n", "export function NewIconEdit() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\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=\"2\"\n\t\t\t\td=\"M6 2.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6M14 11.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6\"\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\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"M17 5.5H9M11 14.5H3\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import {\n\tButton,\n\tIconLayerComponent,\n\tIconLayoutTemplate,\n\tIconPage,\n\tIconSidebarCollection,\n\tIconWebPageHome,\n\tSpinner,\n\tStack,\n\tText,\n\tThemeOverride,\n\ttype ThemeOverrideMode,\n} from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { waitForMeasuredRectWithTimeout } from \"document/components/utils/isWaitingForMeasuredRect.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport { showCanvasNode } from \"document/components/utils/showCanvasNode.ts\"\nimport { getWebPageDisplayTitle } from \"document/components/utils/webPageTitles.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tAnyDesignPageNode,\n\tAnyLayoutTemplateNode,\n\tAnySmartComponentNode,\n\tAnyWebPageNode,\n\tCanvasNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tisDesignPageNode,\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getGeneratedValue } from \"document/models/CanvasTree/traits/Generated.ts\"\nimport type { WithVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport pluralize from \"pluralize\"\nimport { useEffect, useMemo } from \"react\"\nimport { entries } from \"utils/entries.ts\"\nimport { ButtonSheet, ButtonSheetItem } from \"../../contentManagement/utils/ButtonSheet.tsx\"\nimport type { PagesUsingVariable } from \"../../properties/utils/deleteVariable.ts\"\nimport * as styles from \"./VariablesModal.styles.ts\"\nimport { getSelectedVariableInfo } from \"./getSelectedVariableInfo.ts\"\n\nexport interface PagesPreventionData {\n\ttype: \"pages\"\n\tpagesUsingVariables: PagesUsingVariable\n\tvariableToDeletePath: SelectedVariablePath\n}\n\nexport interface ScopePreventionData {\n\ttype: \"scope\"\n\tnodeIdsUsingVariable: Set<NodeID>\n\tvariableToDeletePath: SelectedVariablePath\n}\n\nexport type DeleteFieldPreventionData = PagesPreventionData | ScopePreventionData\n\nconst MAX_ITEMS_TO_SHOW = 5\n\nexport function getPreventionDescription(data: DeleteFieldPreventionData, variableName: string): string {\n\tif (data.type === \"pages\") {\n\t\tconst count = Object.keys(data.pagesUsingVariables).length\n\t\tconst pagesLabel = pluralize(\"pages\", count)\n\t\tconst usageDescription =\n\t\t\tcount > MAX_ITEMS_TO_SHOW\n\t\t\t\t? `The ${variableName} field is currently used in ${count} ${pagesLabel}, including those listed below.`\n\t\t\t\t: `The ${variableName} field is currently used in the ${pagesLabel} listed below.`\n\t\treturn `${usageDescription} Make sure to remove any connected fields in all pages before removing it.`\n\t}\n\n\tconst count = data.nodeIdsUsingVariable.size\n\tconst elementsLabel = pluralize(\"elements\", count)\n\tconst usageDescription =\n\t\tcount > MAX_ITEMS_TO_SHOW\n\t\t\t? `The ${variableName} variable is currently used by ${count} ${elementsLabel}, including those listed below.`\n\t\t\t: `The ${variableName} variable is currently used by the ${elementsLabel} listed below.`\n\treturn `${usageDescription} Make sure to remove any connected variable before removing it.`\n}\n\nexport function CheckingFieldUsage() {\n\treturn (\n\t\t<div className={styles.checkingFieldUsageContainer}>\n\t\t\t<Spinner size=\"medium\" inline className={styles.checkingFieldUsageSpinner} />\n\t\t\t<span className={styles.checkingFieldUsageText}>Checking where the field is used across the project...</span>\n\t\t</div>\n\t)\n}\n\ninterface DeleteFieldPreventionProps {\n\tdeleteFieldPreventionData: DeleteFieldPreventionData\n\tnodeWithVariables: (CanvasNode & WithVariables) | null\n\tthemeOverrideMode: ThemeOverrideMode | undefined\n\tonDismiss: () => void\n}\n\nexport function DeleteFieldPrevention({\n\tdeleteFieldPreventionData,\n\tnodeWithVariables,\n\tthemeOverrideMode,\n\tonDismiss,\n}: DeleteFieldPreventionProps) {\n\tconst selectedVariable = useMemo(() => {\n\t\tif (!deleteFieldPreventionData) return null\n\t\tconst selectedVariableInfo = getSelectedVariableInfo(\n\t\t\tnodeWithVariables,\n\t\t\tdeleteFieldPreventionData.variableToDeletePath,\n\t\t\tnull,\n\t\t)\n\t\treturn selectedVariableInfo?.selectedVariable\n\t}, [nodeWithVariables, deleteFieldPreventionData])\n\n\tif (!selectedVariable) return null\n\n\tconst entityName = deleteFieldPreventionData.type === \"pages\" ? \"field\" : \"variable\"\n\n\treturn (\n\t\t<ThemeOverride mode={themeOverrideMode}>\n\t\t\t<Stack gap={0} justifyContent=\"space-between\" padding={30} className={styles.deleteFieldPreventionContainer}>\n\t\t\t\t<Stack gap={20}>\n\t\t\t\t\t<Stack gap={15}>\n\t\t\t\t\t\t<Text size={fonts.size.base} className={styles.deleteFieldPreventionTitle}>\n\t\t\t\t\t\t\t{`${selectedVariable.name} ${entityName} in use`}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<Text size={fonts.size.base} className={styles.deleteFieldPreventionDescription} lineHeight={1.6}>\n\t\t\t\t\t\t\t{getPreventionDescription(deleteFieldPreventionData, selectedVariable.name)}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t{deleteFieldPreventionData.type === \"pages\" ? (\n\t\t\t\t\t\t<PagesUsingVariableLinksList\n\t\t\t\t\t\t\tpagesUsingVariables={deleteFieldPreventionData.pagesUsingVariables}\n\t\t\t\t\t\t\tmaxPagesToShow={MAX_ITEMS_TO_SHOW}\n\t\t\t\t\t\t\tonDismiss={onDismiss}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<NodesUsingVariableLinksList\n\t\t\t\t\t\t\tnodeIdsUsingVariable={deleteFieldPreventionData.nodeIdsUsingVariable}\n\t\t\t\t\t\t\tmaxNodesToShow={MAX_ITEMS_TO_SHOW}\n\t\t\t\t\t\t\tonDismiss={onDismiss}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t\t<Button variant=\"default\" onClick={onDismiss}>\n\t\t\t\t\t{Dictionary.Dismiss}\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</ThemeOverride>\n\t)\n}\n\nfunction iconForScope(\n\tnode: AnyWebPageNode | AnySmartComponentNode | AnyDesignPageNode | AnyLayoutTemplateNode,\n): React.ComponentType {\n\tif (isDesignPageNode(node)) return IconPage\n\tif (isSmartComponentNode(node, true)) return IconLayerComponent\n\tif (isLayoutTemplateNode(node)) return IconLayoutTemplate\n\tif (engine.tree.root.homePageNodeId === node.id) return IconWebPageHome\n\tif (node.dataIdentifier) return IconSidebarCollection\n\treturn IconPage\n}\n\nasync function navigateToNode(nodeIds: Set<NodeID>) {\n\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\tfor (const nodeId of nodeIds) {\n\t\tconst node = tree.getNode(nodeId)\n\t\tif (!node) continue\n\n\t\tconst scope = tree.getScopeNodeFor(node)\n\t\tif (!scope) continue\n\t\tengine.stores.scopeStore.select(scope.id, { keepHistory: false })\n\t\tengine.stores.modalStore.dismiss()\n\n\t\tif (isWebPageNode(node)) {\n\t\t\tengine.stores.siteSettingsStore\n\t\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.page, id: node.id })\n\t\t\t\t.catch(unhandledError)\n\t\t\treturn\n\t\t}\n\n\t\tawait waitForMeasuredRectWithTimeout(engine, node)\n\n\t\tshowCanvasNode(engine, node, true)\n\t\treturn\n\t}\n}\n\ninterface PagesRenderData {\n\tpage: AnyWebPageNode | AnySmartComponentNode | AnyDesignPageNode | AnyLayoutTemplateNode\n\tnodeIdsReferencingVariable: Set<NodeID>\n\ttitle: string\n}\n\ntype ButtonSheetVariant = \"plain\" | \"filled\"\n\ninterface PagesUsingVariableLinksListProps {\n\tpagesUsingVariables: PagesUsingVariable\n\tmaxPagesToShow: number\n\t/** Called if the pages using the variable are not found anymore.\n\t * This happens if ALL pages using the variable are deleted between the initial\n\t * pagesUsingVariables object definition and the current render */\n\tonDismiss: () => void\n\tvariant?: ButtonSheetVariant\n}\n\nexport function PagesUsingVariableLinksList({\n\tpagesUsingVariables,\n\tmaxPagesToShow,\n\tonDismiss,\n\tvariant = \"plain\",\n}: PagesUsingVariableLinksListProps) {\n\tconst pagesRenderData = useDeprecatedEngineState([EngineChange.Tree, EngineChange.ActiveBundle], () => {\n\t\tconst result: PagesRenderData[] = []\n\n\t\tconst pagesUsingVariablesEntries = entries(pagesUsingVariables)\n\n\t\tfor (const [scopeId, nodeIdsReferencingVariable] of pagesUsingVariablesEntries.slice(0, maxPagesToShow)) {\n\t\t\tconst scopeNode = engine.tree.getNode(scopeId)\n\n\t\t\tif (isSmartComponentNode(scopeNode, true)) {\n\t\t\t\tconst name = scopeNode.resolveValue(\"name\")\n\t\t\t\tresult.push({\n\t\t\t\t\tpage: scopeNode,\n\t\t\t\t\tnodeIdsReferencingVariable,\n\t\t\t\t\ttitle: name ?? getDefaultName(engine.componentLoader, scopeNode),\n\t\t\t\t})\n\t\t\t} else if (isWebPageNode(scopeNode, true)) {\n\t\t\t\tconst data = engine.componentLoader.dataForIdentifier(scopeNode.dataIdentifier)\n\t\t\t\tresult.push({\n\t\t\t\t\tpage: scopeNode,\n\t\t\t\t\tnodeIdsReferencingVariable,\n\t\t\t\t\ttitle: getWebPageDisplayTitle(engine.tree, scopeNode, data ?? null),\n\t\t\t\t})\n\t\t\t} else if (isDesignPageNode(scopeNode)) {\n\t\t\t\tresult.push({\n\t\t\t\t\tpage: scopeNode,\n\t\t\t\t\tnodeIdsReferencingVariable,\n\t\t\t\t\ttitle: scopeNode.resolveValue(\"name\") ?? Dictionary.Design,\n\t\t\t\t})\n\t\t\t} else if (isLayoutTemplateNode(scopeNode)) {\n\t\t\t\tresult.push({\n\t\t\t\t\tpage: scopeNode,\n\t\t\t\t\tnodeIdsReferencingVariable,\n\t\t\t\t\ttitle: scopeNode.resolveValue(\"name\") ?? Dictionary.Layout,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn result\n\t})\n\n\tuseEffect(() => {\n\t\tif (pagesRenderData.length === 0) {\n\t\t\tonDismiss()\n\t\t}\n\t}, [pagesRenderData.length, onDismiss])\n\n\tif (pagesRenderData.length === 0) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<ButtonSheet variant={variant}>\n\t\t\t{pagesRenderData.map(({ page, nodeIdsReferencingVariable, title }) => {\n\t\t\t\tconst Icon = iconForScope(page)\n\n\t\t\t\treturn (\n\t\t\t\t\t<ButtonSheetItem\n\t\t\t\t\t\tvariant=\"plain\"\n\t\t\t\t\t\tkey={page.id}\n\t\t\t\t\t\tstartIcon={<Icon />}\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\tonClick={() => void navigateToNode(nodeIdsReferencingVariable)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</ButtonSheet>\n\t)\n}\n\ninterface NodeRenderData {\n\tnodeId: NodeID\n\tname: string\n}\n\ninterface NodesUsingVariableLinksListProps {\n\tnodeIdsUsingVariable: Set<NodeID>\n\tmaxNodesToShow: number\n\tonDismiss: () => void\n\tvariant?: ButtonSheetVariant\n}\n\nexport function NodesUsingVariableLinksList({\n\tnodeIdsUsingVariable,\n\tmaxNodesToShow,\n\tonDismiss,\n\tvariant = \"plain\",\n}: NodesUsingVariableLinksListProps) {\n\tconst nodesRenderData = useDeprecatedEngineState([EngineChange.Tree], () => {\n\t\tconst result: NodeRenderData[] = []\n\n\t\tfor (const nodeId of nodeIdsUsingVariable) {\n\t\t\tif (result.length >= maxNodesToShow) break\n\n\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\tif (!node) continue\n\n\t\t\tconst name = getGeneratedValue(node.name) || getDefaultName(engine.componentLoader, node)\n\t\t\tresult.push({ nodeId, name })\n\t\t}\n\t\treturn result\n\t})\n\n\tuseEffect(() => {\n\t\tif (nodesRenderData.length === 0) {\n\t\t\tonDismiss()\n\t\t}\n\t}, [nodesRenderData.length, onDismiss])\n\n\tif (nodesRenderData.length === 0) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<ButtonSheet variant={variant}>\n\t\t\t{nodesRenderData.map(({ nodeId, name }) => (\n\t\t\t\t<ButtonSheetItem\n\t\t\t\t\tvariant=\"plain\"\n\t\t\t\t\tkey={nodeId}\n\t\t\t\t\tstartIcon={null}\n\t\t\t\t\ttitle={name}\n\t\t\t\t\tonClick={() => void navigateToNode(new Set([nodeId]))}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</ButtonSheet>\n\t)\n}\n", "import \"VariablesModal.styles_1ymn61f.wyw.css\"; export const headerHeight = 52;\nexport const rowMargin = 2.5;\nexport const list = \"list_l1sv956b\";\nexport const emptyDetailWithButton = \"emptyDetailWithButton_eozccmn\";\nexport const deleteFieldPreventionTitle = \"deleteFieldPreventionTitle_dtdt6k8\";\nexport const deleteFieldPreventionContainer = \"deleteFieldPreventionContainer_d1blco74\";\nexport const deleteFieldPreventionDescription = \"deleteFieldPreventionDescription_d16tjva\";\nexport const checkingFieldUsageContainer = \"checkingFieldUsageContainer_c1j579r6\";\nexport const checkingFieldUsageSpinner = \"checkingFieldUsageSpinner_c1niwepz\";\nexport const checkingFieldUsageText = \"checkingFieldUsageText_cylngjo\";", "import {\n\tButton,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n\tTextArea,\n\tTextInput,\n\tThemeOverride,\n\ttype ThemeOverrideMode,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VariableOrDivider, VariablesAndDividers } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisOptionalVariable,\n\tisRequiredVariable,\n\tisVariableWithoutDescription,\n\twithOptional,\n\twithQueryParam,\n\twithRequired,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { EventHandlerHint } from \"./EventHandlerHint.tsx\"\nimport { QueryParamRow } from \"./QueryParamRow.tsx\"\nimport * as styles from \"./VariableDetail.styles.ts\"\nimport { VariableDetailArray } from \"./VariableDetailArray.tsx\"\nimport { VariableDetailBoolean } from \"./VariableDetailBoolean.tsx\"\nimport { VariableDetailBorder } from \"./VariableDetailBorder.tsx\"\nimport { VariableDetailBorderRadius } from \"./VariableDetailBorderRadius.tsx\"\nimport { VariableDetailBoxShadow } from \"./VariableDetailBoxShadow.tsx\"\nimport { VariableDetailCollectionReference } from \"./VariableDetailCollectionReference.tsx\"\nimport { VariableDetailColor } from \"./VariableDetailColor.tsx\"\nimport { VariableDetailControlReference } from \"./VariableDetailControlReference.tsx\"\nimport { VariableDetailCursor } from \"./VariableDetailCursor.tsx\"\nimport { VariableDetailDate } from \"./VariableDetailDate.tsx\"\nimport { VariableDetailEnum } from \"./VariableDetailEnum.tsx\"\nimport { VariableDetailFile } from \"./VariableDetailFile.tsx\"\nimport { VariableDetailGap } from \"./VariableDetailGap.tsx\"\nimport { VariableDetailImage } from \"./VariableDetailImage.tsx\"\nimport { VariableDetailLinkRelValues } from \"./VariableDetailLinkRelValues.tsx\"\nimport { VariableDetailLocation } from \"./VariableDetailLocation.tsx\"\nimport { VariableDetailMultiCollectionReference } from \"./VariableDetailMultiCollectionReference.tsx\"\nimport { VariableDetailNumber } from \"./VariableDetailNumber.tsx\"\nimport { VariableDetailPadding } from \"./VariableDetailPadding.tsx\"\nimport { VariableDetailRichText } from \"./VariableDetailRichText.tsx\"\nimport { VariableDetailSlug } from \"./VariableDetailSlug.tsx\"\nimport { VariableDetailString } from \"./VariableDetailString.tsx\"\nimport { VariableDetailTransition } from \"./VariableDetailTransition.tsx\"\nimport { VariableDetailVectorSetItem } from \"./VariableDetailVectorSetItem.tsx\"\nimport { createFinalName } from \"./createFinalName.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\nfunction getVariableNameLabel(variable: VariableOrDivider): string {\n\tif (variable.type === \"divider\") {\n\t\treturn \"Section Title\"\n\t}\n\n\treturn Dictionary.Name\n}\n\nfunction getVariablePlaceholder(variable: VariableOrDivider): string | undefined {\n\tif (variable.type === \"divider\") {\n\t\treturn Dictionary.None\n\t}\n\n\treturn undefined\n}\n\nfunction getVariableTypeOptions({ variable, variables, scopeType, onUpdate }: Props) {\n\tswitch (variable.type) {\n\t\tcase ControlType.Number:\n\t\t\treturn <VariableDetailNumber variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.String:\n\t\t\treturn (\n\t\t\t\t<VariableDetailString variable={variable} variables={variables} scopeType={scopeType} onUpdate={onUpdate} />\n\t\t\t)\n\t\tcase ControlType.Boolean:\n\t\t\treturn <VariableDetailBoolean variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.Color:\n\t\t\treturn <VariableDetailColor variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Date:\n\t\t\treturn <VariableDetailDate variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.Gap:\n\t\t\treturn <VariableDetailGap variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Padding:\n\t\t\treturn <VariableDetailPadding variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn <VariableDetailBorderRadius variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.RichText:\n\t\t\treturn <VariableDetailRichText variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.Image:\n\t\t\treturn <VariableDetailImage variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase \"controlReference\":\n\t\tcase \"nodePropertyControlReference\":\n\t\t\treturn <VariableDetailControlReference variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.EventHandler:\n\t\t\treturn <EventHandlerHint />\n\t\tcase ControlType.Enum:\n\t\t\treturn <VariableDetailEnum variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.Cursor:\n\t\t\treturn <VariableDetailCursor variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Transition:\n\t\t\treturn <VariableDetailTransition variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.File:\n\t\t\treturn <VariableDetailFile variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Border:\n\t\t\treturn <VariableDetailBorder variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn <VariableDetailBoxShadow variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Array:\n\t\t\treturn <VariableDetailArray variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn <VariableDetailCollectionReference variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn <VariableDetailMultiCollectionReference variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase \"slug\":\n\t\t\treturn <VariableDetailSlug variable={variable} variables={variables} onUpdate={onUpdate} />\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn <VariableDetailVectorSetItem variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn <VariableDetailLinkRelValues variable={variable} onUpdate={onUpdate} />\n\t\tcase ControlType.Location:\n\t\t\treturn <VariableDetailLocation variable={variable} onUpdate={onUpdate} scopeType={scopeType} />\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.TrackingId:\n\t\tcase ControlType.ScrollSectionRef:\n\t\tcase ControlType.Link:\n\t\tcase \"divider\":\n\t\t\treturn null\n\t\tdefault:\n\t\t\tshouldBeNever(variable)\n\t\t\treturn null\n\t}\n}\n\ninterface Props {\n\treadOnly: boolean\n\tvariable: VariableOrDivider\n\tvariables: VariablesAndDividers\n\tisTemporary: boolean\n\tthemeOverrideMode?: ThemeOverrideMode\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n\tonAdd?: (variable: VariableOrDivider) => void\n}\n\nexport const VariableDetail = React.memo(function VariableDetail(props: Props) {\n\tconst { variable, isTemporary, onUpdate, onAdd, scopeType, readOnly, themeOverrideMode } = props\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\t// We use the temporary variable name as the placeholder, and this state to\n\t// check if a valid name is provided.\n\tconst [newName, setNewName] = React.useState<string>(\"\")\n\n\tconst hasNewName = newName.trim().length > 0\n\n\tconst nameInputRef = React.useRef<HTMLInputElement>(null)\n\n\tconst showDescriptionField = !isVariableWithoutDescription(variable)\n\n\t// We are using an effect instead of the autoFocus property because since Safari 14.1 the\n\t// focus property breaks rendering of other elements inside of the variables modal. We found\n\t// out that these broken elements are rendered inside of an element that uses display contents.\n\t// More info: https://github.com/framer/company/issues/22331\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We want the input to be focussed on variable selection change.\n\tReact.useEffect(() => {\n\t\tif (readOnly) return\n\n\t\tconst inputElement = nameInputRef.current\n\t\tif (inputElement instanceof HTMLInputElement) {\n\t\t\tinputElement.focus()\n\t\t}\n\t}, [props.variable.id, readOnly])\n\n\tconst updateName = (name: string, final: boolean, reset: () => void) => {\n\t\tsetNewName(name)\n\n\t\tconst allowEmptyName = variable.type === \"divider\"\n\n\t\tif (isTemporary) {\n\t\t\tif (final) {\n\t\t\t\tconst finalName = createFinalName(props.variables, variable, name)\n\t\t\t\tif (finalName.length < 1 && !allowEmptyName) return\n\t\t\t\tassert(onAdd, \"onAdd must be provided for temporary variables\")\n\t\t\t\tonAdd({ ...variable, name: finalName })\n\t\t\t} else {\n\t\t\t\tupdateVariable({ name })\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif (final) {\n\t\t\tconst finalName = createFinalName(props.variables, variable, name)\n\t\t\t// If the useable name hasn't changed then it is important that we call reset. Otherwise\n\t\t\t// React won't update the value in the input field back to the correct value. e.g. If the\n\t\t\t// user changes from \"Title (1)\" to \"Title\" (when there is already a \"Title\" variable in\n\t\t\t// use) then the input field needs to be reset to \"Title (1)\" once the user presses enter.\n\t\t\tif ((finalName.length < 1 && !allowEmptyName) || finalName === variable.name) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tupdateVariable({ name: finalName })\n\t\t}\n\t}\n\n\tconst onSave = () => {\n\t\tif (!isTemporary || !hasNewName) return\n\t\tassert(onAdd, \"onAdd must be provided for temporary variables\")\n\t\tonAdd(variable)\n\t}\n\n\tconst updateRequired = (required: boolean) => {\n\t\tupdateVariable(current => {\n\t\t\tassert(withRequired(current), \"Can't update required on variables that don't support it\")\n\n\t\t\tif (current.type === ControlType.Array) {\n\t\t\t\tif (required && !isNumber(current?.minCount)) {\n\t\t\t\t\treturn { ...current, minCount: 1, required }\n\t\t\t\t} else if (!required && current?.minCount === 1) {\n\t\t\t\t\treturn { ...current, minCount: undefined, required }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { ...current, required }\n\t\t})\n\t}\n\n\tconst updateOptional = (optional: boolean) => {\n\t\tupdateVariable(current => {\n\t\t\tassert(withOptional(current, scopeType), \"Can't update optional on variables that don't support it\")\n\t\t\treturn { ...current, optional }\n\t\t})\n\t}\n\n\tconst updateDescription = (description: string) => {\n\t\tupdateVariable({ description })\n\t}\n\n\tconst inputInset = `calc(${dimensions.css.inputSpacing} / 2)`\n\n\t// ThemeOverride is required in order for popout style overrides to work.\n\treturn (\n\t\t<ThemeOverride mode={themeOverrideMode}>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpadding={`calc(${dimensions.css.modalPadding} - ${inputInset})`}\n\t\t\t\tpaddingRight={dimensions.css.modalPadding}\n\t\t\t\tclassName={styles.container}\n\t\t\t>\n\t\t\t\t<PanelRow title={getVariableNameLabel(variable)}>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tref={nameInputRef}\n\t\t\t\t\t\tvalue={isTemporary ? newName : variable.name}\n\t\t\t\t\t\tplaceholder={isTemporary ? variable.name : getVariablePlaceholder(variable)}\n\t\t\t\t\t\tchangeOnBlur={!isTemporary}\n\t\t\t\t\t\tblurOnEnter={isTemporary && hasNewName}\n\t\t\t\t\t\tonChange={updateName}\n\t\t\t\t\t\tclassName={isTemporary ? undefined : doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t\t{isTemporary && (\n\t\t\t\t\t\t<Button variant=\"primary\" enabled={hasNewName} onClick={onSave}>\n\t\t\t\t\t\t\tAdd\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t\t{showDescriptionField && (\n\t\t\t\t\t<PanelRow title=\"Description\">\n\t\t\t\t\t\t<TextArea\n\t\t\t\t\t\t\tvalue={variable.description ?? \"\"}\n\t\t\t\t\t\t\tconstantChange={false}\n\t\t\t\t\t\t\tonChange={updateDescription}\n\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{scopeType === ScopeType.ContentManagement && withRequired(variable) && (\n\t\t\t\t\t<PanelRow title=\"Required\">\n\t\t\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\t\tselected={isRequiredVariable(variable)}\n\t\t\t\t\t\t\t\tonSelect={updateRequired}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\t\tselected={!isRequiredVariable(variable)}\n\t\t\t\t\t\t\t\tonSelect={updateRequired}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{withOptional(variable, scopeType) && (\n\t\t\t\t\t<PanelRow title=\"Optional\">\n\t\t\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\t\tselected={isOptionalVariable(variable, scopeType)}\n\t\t\t\t\t\t\t\tonSelect={updateOptional}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\t\tselected={!isOptionalVariable(variable, scopeType)}\n\t\t\t\t\t\t\t\tonSelect={updateOptional}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{getVariableTypeOptions(props)}\n\t\t\t\t{scopeType === ScopeType.WebPage && withQueryParam(variable) && (\n\t\t\t\t\t<QueryParamRow\n\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t\tvariables={props.variables}\n\t\t\t\t\t\tonUpdate={queryParam => updateVariable(current => ({ ...current, queryParam }))}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</ThemeOverride>\n\t)\n})\n", "import \"EventHandlerHint.styles_11gepr4.wyw.css\"; export const container = \"container_cb6ttlm\";\nexport const agentContainer = \"agentContainer_a10dujj1\";\nexport const link = \"link_lpkznjd\";\nexport const icon = \"icon_i1dq8n8y\";", "import { CenterChild, EmptyState, IconLightning, Translatable as T, Text } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport * as styles from \"./EventHandlerHint.styles.ts\"\n\nconst IconEventVariable = () => {\n\treturn (\n\t\t<div className={styles.icon}>\n\t\t\t<CenterChild>\n\t\t\t\t<IconLightning />\n\t\t\t</CenterChild>\n\t\t</div>\n\t)\n}\n\nexport function EventHandlerHint() {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<EmptyState\n\t\t\tclassName={agentExperimentEnabled ? styles.agentContainer : styles.container}\n\t\t\ticonLarge={!agentExperimentEnabled}\n\t\t\ticon={agentExperimentEnabled ? undefined : IconEventVariable}\n\t\t\ticonColor={agentExperimentEnabled ? undefined : \"white\"}\n\t\t\ttitle=\"Events\"\n\t\t\tbody={\n\t\t\t\t<Text>\n\t\t\t\t\t<T>Trigger custom interactions from any layer within your component. </T>\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"https://www.framer.com/support/using-framer/event-variables/\"\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\tclassName={styles.link}\n\t\t\t\t\t>\n\t\t\t\t\t\t<T>Read more.</T>\n\t\t\t\t\t</a>\n\t\t\t\t</Text>\n\t\t\t}\n\t\t\tmaxBodyWidth={180}\n\t\t\tcenter\n\t\t/>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport {\n\tgenerateQueryParamNameForVariableName,\n\tgetQueryParamNameOfVariable,\n} from \"document/components/chrome/properties/utils/getQueryParamNameOfVariable.ts\"\nimport type {\n\tVariableDefinition,\n\tVariablesAndDividers,\n\tWithQueryParam,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isVariableDefinition, withQueryParam } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useMemo, useState } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { WithWarningTintAndMessage } from \"../WithWarningTintAndMessage.tsx\"\nimport * as styles from \"./QueryParamRow.styles.ts\"\n\nconst QUERY_PARAM_REGEX = /^[\\w.~-]+$/u\n\nfunction isValidQueryParam(value: string): boolean {\n\treturn value === \"\" || QUERY_PARAM_REGEX.test(value)\n}\n\nfunction QueryParamRowInner({\n\tonUpdate,\n\ttakenQueryParams,\n\tvariable,\n}: {\n\tonUpdate: (queryParam: string | undefined) => void\n\ttakenQueryParams: Map<string, string>\n\tvariable: VariableDefinition & WithQueryParam\n}) {\n\tconst [queryParamInput, setQueryParamInput] = useState(variable.queryParam ?? \"\")\n\tconst conflictingVariableName = takenQueryParams.get(queryParamInput)\n\tconst isDuplicate = !isUndefined(conflictingVariableName)\n\n\treturn (\n\t\t<PanelRow title=\"Query Param\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<WithWarningTintAndMessage\n\t\t\t\t\twarningVisible={isDuplicate}\n\t\t\t\t\twarningMessage={\n\t\t\t\t\t\tconflictingVariableName\n\t\t\t\t\t\t\t? `This query param is already used by the \u201C${conflictingVariableName}\u201D variable.`\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tshowWarningTint={isDuplicate}\n\t\t\t\t\ttruncateWarningMessage={false}\n\t\t\t\t\twarningMessageClassName={styles.warningMessage}\n\t\t\t\t>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tvalue={queryParamInput}\n\t\t\t\t\t\tplaceholder={generateQueryParamNameForVariableName(variable.name)}\n\t\t\t\t\t\tonChange={(newValue, _, reset) => {\n\t\t\t\t\t\t\tconst normalized = newValue.toLowerCase().trim()\n\n\t\t\t\t\t\t\tif (isValidQueryParam(normalized)) {\n\t\t\t\t\t\t\t\tsetQueryParamInput(normalized)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treset()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\tif (isDuplicate) return\n\t\t\t\t\t\t\tonUpdate(queryParamInput)\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ width: \"100%\" }}\n\t\t\t\t\t/>\n\t\t\t\t</WithWarningTintAndMessage>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\nexport function QueryParamRow({\n\tvariable,\n\tvariables,\n\tonUpdate,\n}: {\n\tvariable: VariableDefinition & WithQueryParam\n\tvariables: VariablesAndDividers\n\tonUpdate: (queryParam: string | undefined) => void\n}) {\n\tconst takenQueryParams = useMemo(() => {\n\t\tconst map = new Map<string, string>()\n\t\tfor (const otherVariable of variables) {\n\t\t\tif (!isVariableDefinition(otherVariable) || otherVariable.id === variable.id) continue\n\t\t\tif (!withQueryParam(otherVariable)) continue\n\t\t\tconst queryParam = getQueryParamNameOfVariable(otherVariable)\n\t\t\tmap.set(queryParam, otherVariable.name)\n\t\t}\n\t\treturn map\n\t}, [variables, variable.id])\n\n\treturn (\n\t\t<QueryParamRowInner\n\t\t\tkey={\n\t\t\t\t// Reset the internal state if we switch to another variable\n\t\t\t\tvariable.id\n\t\t\t}\n\t\t\tvariable={variable}\n\t\t\ttakenQueryParams={takenQueryParams}\n\t\t\tonUpdate={onUpdate}\n\t\t/>\n\t)\n}\n", "import \"QueryParamRow.styles_gyssyp.wyw.css\"; export const warningMessage = \"warningMessage_w17miurf\";", "import \"VariableDetail.styles_hqxt8p.wyw.css\"; export const container = \"container_cx1oloe\";", "import { Button, NumberInputWithTicker, useReadOnly } from \"@framerjs/fresco\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tArrayVariableDefinition,\n\tArrayVariableOptions,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ArrayControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getArrayControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport {\n\ttype ReducedArrayControlProp,\n\tgetReducedControlPropForControl,\n\treduceControlProp,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { isNumber, isReadonlyArray } from \"utils/typeChecks.ts\"\nimport { GalleryInput } from \"../../contentManagement/GalleryInput.tsx\"\nimport { isGalleryControl } from \"../../contentManagement/utils/arrayGalleryUtils.ts\"\nimport { ArrayControlPropRow } from \"../../properties/codeComponentRows/ArrayControlPropRow.tsx\"\nimport { ControlPropRow } from \"../../properties/codeComponentRows/ControlPropRow.tsx\"\nimport type { ControlPropChangeHandler } from \"../../properties/codeComponentRows/ControlPropRowChangeHandler.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: ArrayVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n\tscopeType: ScopeType\n}\n\nexport function VariableDetailArray({ variable, onUpdate, scopeType }: Props) {\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\tconst isReadOnly = useReadOnly()\n\tconst control = useMemo(\n\t\t() => controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t[variable, scopeType],\n\t)\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst controlWithDefaultTitle = useMemo(() => ({ ...control, title: Dictionary.Default }), [control])\n\tconst isGallery = isGalleryControl(control)\n\n\tconst getNormalizedControlProp = useCallback(\n\t\t(initialValue: ArrayVariableDefinition[\"initialValue\"] | undefined): ArrayControlProp => {\n\t\t\tconst value = initialValue ?? emptyArray()\n\t\t\t// If the user has previously added more default images than the current maximum, we want to\n\t\t\t// display the full array so they can see all of their items and potentially remove some\n\t\t\tconst ignoreMaxCount = true\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: getArrayControlPropValue(\n\t\t\t\t\tcontrol,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: ControlType.Array,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tignoreMaxCount,\n\t\t\t\t),\n\t\t\t}\n\t\t},\n\t\t[control],\n\t)\n\n\tconst normalizedControlProp = useMemo<ArrayControlProp>(() => {\n\t\t// If the user has previously added more default images than the current maximum, we want to\n\t\t// display the full array so they can see all of their items and potentially remove some\n\t\treturn getNormalizedControlProp(variable.initialValue)\n\t}, [getNormalizedControlProp, variable.initialValue])\n\n\tconst reducedControlProp = useMemo<ReducedArrayControlProp>(() => {\n\t\tconst reduced = getReducedControlPropForControl(control)\n\t\tassert(reduced && reduced.type === ControlType.Array)\n\t\treduceControlProp(reduced, normalizedControlProp, control)\n\t\treturn reduced\n\t}, [control, normalizedControlProp])\n\n\tconst update = useCallback(\n\t\t(getUpdatedArrayControlProp: (current: ArrayControlProp) => ArrayControlProp) => {\n\t\t\tupdateVariable(current => {\n\t\t\t\tconst newControlProp = getUpdatedArrayControlProp(getNormalizedControlProp(current.initialValue))\n\n\t\t\t\tassert(isReadonlyArray(newControlProp.value))\n\n\t\t\t\treturn { initialValue: newControlProp.value }\n\t\t\t})\n\t\t},\n\t\t[getNormalizedControlProp, updateVariable],\n\t)\n\n\tconst updateControlRow = useCallback<ControlPropChangeHandler<ControlType.Array>>(\n\t\t(_controlKey, getUpdatedArrayControlProp, _nodeIds) => {\n\t\t\tupdate(getUpdatedArrayControlProp)\n\t\t},\n\t\t[update],\n\t)\n\n\tconst updateOptionHandler = (optionKey: keyof ArrayVariableOptions) => {\n\t\treturn (value: number) => {\n\t\t\tupdateVariable(current => {\n\t\t\t\tlet required = current.required\n\t\t\t\t// When minCount is being set to 1 it is conceptually identical to \"required\" so we\n\t\t\t\t// enable required in this case\n\t\t\t\tif (optionKey === \"minCount\" && value === 1) {\n\t\t\t\t\trequired = true\n\t\t\t\t}\n\t\t\t\treturn { ...current, required, [optionKey]: value }\n\t\t\t})\n\t\t}\n\t}\n\n\tconst clearOptionHandler = (optionKey: keyof ArrayVariableOptions) => {\n\t\treturn () => {\n\t\t\tupdateVariable(current => {\n\t\t\t\tlet required = current.required\n\t\t\t\t// When minCount is being cleared, if the previous value was \"1\", which is conceptually\n\t\t\t\t// identical to \"required\", we disable required to match\n\t\t\t\tif (optionKey === \"minCount\" && current.minCount === 1) {\n\t\t\t\t\trequired = false\n\t\t\t\t}\n\t\t\t\treturn { ...current, required, [optionKey]: undefined }\n\t\t\t})\n\t\t}\n\t}\n\n\tconst selectArrayItemField = () => {\n\t\tconst firstItemVariable = variable.itemVariables.at(0)\n\n\t\tengine.stores.variablesStore.selectedVariablePath = [variable.id, firstItemVariable?.id ?? null]\n\t}\n\n\tconst { minCount, maxCount } = variable\n\n\t// We currently only support the minCount and maxCount constraints in the CMS because to support\n\t// it correctly for components we would need to check the array length at runtime. That's\n\t// because components can have array variables assigned. And also component instances aren't\n\t// recompiled when the control description changes with a component update.\n\tconst supportsMinAndMaxCount = scopeType === ScopeType.ContentManagement\n\tconst supportsDefaultValue = scopeType === ScopeType.SmartComponent\n\n\treturn (\n\t\t<>\n\t\t\t{supportsDefaultValue ? (\n\t\t\t\tisGallery ? (\n\t\t\t\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t\t\t\t<GalleryInput\n\t\t\t\t\t\t\tcompact\n\t\t\t\t\t\t\tvariant=\"legacy\"\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\t\tvalue={isReadonlyArray(reducedControlProp.value) ? reducedControlProp.value : emptyArray()}\n\t\t\t\t\t\t\tautoRemoveEmptyPlaceholder={false}\n\t\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t) : (\n\t\t\t\t\t<ArrayControlPropRow\n\t\t\t\t\t\tnodeIds={[]}\n\t\t\t\t\t\tcontrolKey={variable.id}\n\t\t\t\t\t\tcontrol={controlWithDefaultTitle}\n\t\t\t\t\t\tcontrolPath={variable.id}\n\t\t\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\t\t\tonChange={updateControlRow}\n\t\t\t\t\t\thiddenControlsByNodeId={undefined}\n\t\t\t\t\t\tControlPropRow={ControlPropRow}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tsupportsVariables={false}\n\t\t\t\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) : null}\n\t\t\t{supportsMinAndMaxCount ? (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title={Dictionary.Min}>\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={minCount}\n\t\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\t\tmax={maxCount}\n\t\t\t\t\t\t\tonChange={updateOptionHandler(\"minCount\")}\n\t\t\t\t\t\t\tonClear={clearOptionHandler(\"minCount\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttitle={Dictionary.Clear}\n\t\t\t\t\t\t\tenabled={isNumber(minCount) && !isReadOnly}\n\t\t\t\t\t\t\tonClick={clearOptionHandler(\"minCount\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title={Dictionary.Max}>\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={maxCount}\n\t\t\t\t\t\t\tmin={minCount ?? 1}\n\t\t\t\t\t\t\tonChange={updateOptionHandler(\"maxCount\")}\n\t\t\t\t\t\t\tonClear={clearOptionHandler(\"maxCount\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttitle={Dictionary.Clear}\n\t\t\t\t\t\t\tenabled={isNumber(maxCount) && !isReadOnly}\n\t\t\t\t\t\t\tonClick={clearOptionHandler(\"maxCount\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t\t{isWithinVariableModal && (\n\t\t\t\t<Experiment isOn=\"arrays\">\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttitle={isReadOnly ? \"View Item Fields\" : \"Edit Item Fields\"}\n\t\t\t\t\t\t\tonClick={selectArrayItemField}\n\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Experiment>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport type { VerifiedArrayControlDescription } from \"@framerjs/framer-runtime\"\nimport {\n\tButton,\n\tIconArray,\n\tIconVariableGallery,\n\tLegacyIconVariableGallery,\n\tScroll,\n\tStack,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, List, ModuleType, assertNever, isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { HiddenStateByNodeId } from \"canvas-sandbox/ControlsVisibility.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isFetchDataValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { createArrayToArrayComputedValue } from \"document/models/CanvasTree/traits/utils/valueTransformUtils.ts\"\nimport type {\n\tArrayControlProp,\n\tArrayControlPropValue,\n\tArrayValue,\n\tControlProp,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProp } from \"document/models/controlProps/getControlProps.ts\"\nimport type { ReducedArrayControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { updateImageControlPropWithNewImage } from \"document/models/controlProps/updateImageControlPropWithNewImage.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport pluralize from \"pluralize\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { moduleTypeForIdentifier } from \"utils/moduleTypeForIdentifier.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isArray, isBoolean, isNumber, isReadonlyArray, isString } from \"utils/typeChecks.ts\"\nimport { isGalleryControl } from \"../../contentManagement/utils/arrayGalleryUtils.ts\"\nimport { colorFillDisplayValue } from \"../../shared/ColorPicker/utils.ts\"\nimport { GalleryPopoutContent } from \"../../shared/GalleryPopoutContent.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutContext } from \"../../shared/PopoutContext.ts\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport * as styles from \"./ArrayControlPropRow.styles.ts\"\nimport type { ControlPropRowProps } from \"./ControlPropRow.tsx\"\nimport type { ControlPropChangeHandler } from \"./ControlPropRowChangeHandler.ts\"\nimport { ControlPropRowContext, useControlPropRows } from \"./ControlPropRowContext.tsx\"\nimport { scroll as scrollStyle } from \"./ObjectControlPropRow.styles.ts\"\nimport { controlPropRowNeedsHiddenState } from \"./utils/controlPropRowNeedsHiddenState.ts\"\n\nfunction popoutButtonTitle(\n\tcontrol: VerifiedArrayControlDescription,\n\tvalue: ReducedArrayControlProp,\n\tisGallery: boolean,\n): string {\n\tassert(!isDynamicValue(value.value))\n\tconst items = value.value\n\tassert(isFound(items))\n\n\tif (isMixed(items)) return Dictionary.Mixed\n\n\tif (isGallery) return `${items.length} ${pluralize(Dictionary.Image, items.length)}`\n\n\tif (items.length === 0) {\n\t\treturn \"0 Items\"\n\t}\n\n\tconst titleComponents: string[] = []\n\n\tfunction addTitleComponent(reducedValue: unknown) {\n\t\tif (isString(reducedValue)) {\n\t\t\ttitleComponents.push(reducedValue)\n\t\t\treturn\n\t\t}\n\t\tif (isNumber(reducedValue)) {\n\t\t\ttitleComponents.push(reducedValue.toString())\n\t\t\treturn\n\t\t}\n\t\tif (isBoolean(reducedValue)) {\n\t\t\ttitleComponents.push(reducedValue ? Dictionary.Yes : Dictionary.No)\n\t\t}\n\t\tif (isMixed(reducedValue)) {\n\t\t\ttitleComponents.push(Dictionary.Mixed)\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor (const item of items) {\n\t\tswitch (item.type) {\n\t\t\tcase ControlType.Boolean:\n\t\t\tcase ControlType.String:\n\t\t\tcase ControlType.Number:\n\t\t\t\taddTitleComponent(item.value)\n\t\t\t\tbreak\n\t\t\tcase ControlType.Color:\n\t\t\t\tif (!isString(item.value)) {\n\t\t\t\t\taddTitleComponent(item.value)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\taddTitleComponent(colorFillDisplayValue(item.value, engine).title)\n\t\t\t\tbreak\n\t\t\tcase ControlType.Enum: {\n\t\t\t\tconst itemControl = control.control\n\t\t\t\tassert(itemControl.type === ControlType.Enum)\n\t\t\t\tif (!isString(item.value)) {\n\t\t\t\t\taddTitleComponent(item.value)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tconst index = itemControl.options.indexOf(item.value)\n\t\t\t\tconst optionTitle = itemControl.optionTitles?.[index] ?? fallbackTitleForOption(item.value)\n\t\t\t\taddTitleComponent(optionTitle)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif (titleComponents.length) {\n\t\treturn titleComponents.join(\", \")\n\t}\n\n\treturn `${items.length} Item${items.length === 1 ? \"\" : \"s\"}`\n}\n\ntype ArrayItemChangeHandler<T extends ControlType = ControlType> = (\n\tgetUpdate: (current: ControlProp & { type: T }) => ControlProp & { type: T },\n\tnodeIds: NodeID[],\n\tindex: number,\n) => void\n\ninterface ArrayItemControlRowProps extends Omit<\n\tControlPropRowProps,\n\t\"onContextMenu\" | \"onChange\" | \"onImageUpload\" | \"onClear\"\n> {\n\tindex: number\n\tscopeType: ScopeType\n\tonChange: ArrayItemChangeHandler\n\tonImageUpload: (upload: Promise<AssetReference | null>, index: number) => void\n\tonContextMenu(event: React.MouseEvent, index: number): void\n\tControlPropRow: React.FunctionComponent<ControlPropRowProps>\n}\n\nconst ArrayItemControlRow = React.memo<ArrayItemControlRowProps>(function ArrayItemControlRow({\n\tindex,\n\tonContextMenu,\n\tonChange,\n\tonImageUpload,\n\tControlPropRow,\n\t...props\n}) {\n\t// No need for useCallback because component is already memoized\n\tconst contextMenuHandler = (event: React.MouseEvent) => onContextMenu(event, index)\n\tconst changeHandler = (_controlKey: string, getUpdate: (current: ControlProp) => ControlProp, nodeIds: NodeID[]) =>\n\t\tonChange(getUpdate, nodeIds, index)\n\tconst imageUploadHandler = (upload: Promise<AssetReference | null>) => onImageUpload(upload, index)\n\n\treturn (\n\t\t<ControlPropRow\n\t\t\t{...props}\n\t\t\tonContextMenu={contextMenuHandler}\n\t\t\tonChange={changeHandler}\n\t\t\tonImageUpload={imageUploadHandler}\n\t\t/>\n\t)\n})\n\ninterface ArrayContentPopoutProps extends Omit<ArrayControlPropRowProps, \"onChange\" | \"supportsVariables\"> {\n\tisGallery: boolean\n\tarrayTitle: string\n\tcanAddItems: boolean\n\taddItem: () => void\n\tremoveAll: () => void\n\tremoveItemAtIndex: (index: number) => void\n\tmoveItem: (fromIndex: number, toIndex: number) => void\n\tonImageUpload: (upload: Promise<AssetReference | null>, index: number) => void\n\tonChangeItem: ArrayItemChangeHandler\n\tonChange: ControlPropChangeHandler<ControlType.Array>\n}\n\nfunction ArrayContentPopout({\n\tisGallery,\n\tarrayTitle,\n\tnodeIds,\n\tcontrol,\n\tcontrolPath,\n\tcontrolProp,\n\tcontrolKey,\n\thiddenControlsByNodeId,\n\tscopeType,\n\tcanAddItems,\n\taddItem,\n\tonChange,\n\tonChangeItem,\n\tonImageUpload,\n\tremoveAll,\n\tremoveItemAtIndex,\n\tmoveItem,\n\tControlPropRow,\n\tallowP3,\n}: ArrayContentPopoutProps) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst controlPropRowContext = useControlPropRows()\n\n\tconst items = isReadonlyArray(controlProp.value) ? controlProp.value : []\n\n\tconst itemControl = useMemo(() => {\n\t\tif (control.control.title) return control.control\n\t\treturn { ...control.control, title: `${arrayTitle} Item` }\n\t}, [arrayTitle, control])\n\n\tconst galleryUpdateHandler = useCallback(\n\t\t(getUpdate: (current: ArrayControlProp) => ArrayControlProp) => {\n\t\t\tonChange(controlKey, getUpdate, nodeIds)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tif (isGallery) {\n\t\treturn (\n\t\t\t<GalleryPopoutContent\n\t\t\t\tcontrol={control}\n\t\t\t\tvalue={items}\n\t\t\t\tonChange={galleryUpdateHandler}\n\t\t\t\taddButtonEnabled={!isReadOnly && canAddItems}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Scroll direction=\"vertical\" className={scrollStyle}>\n\t\t\t<Stack padding={0} paddingTop={dimensions.css.inputSpacing} gap={0}>\n\t\t\t\t<Sortable\n\t\t\t\t\titems={items}\n\t\t\t\t\tremoveItem={removeItemAtIndex}\n\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.leftAndRightPanelPadding,\n\t\t\t\t\t\tstyles.sortable,\n\t\t\t\t\t\titems.length > 0 && styles.sortableMinHeight,\n\t\t\t\t\t\t!canAddItems && styles.sortableWithoutFooter,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{({ item, index }) => {\n\t\t\t\t\t\tconst displayContextMenu = (event: React.MouseEvent) => {\n\t\t\t\t\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\t\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t\t\t\t\t\t\tclick: () => removeItemAtIndex(index),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: Dictionary.RemoveAll,\n\t\t\t\t\t\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t\t\t\t\t\t\tclick: removeAll,\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\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// As we are using a custom drag preview, we need to add the control prop row context to the\n\t\t\t\t\t\t// item control row. This is because the custom drag preview is rendered in a template new root.\n\t\t\t\t\t\t// Performance wise should be ok to always add the control prop row context so we don't need to\n\t\t\t\t\t\t// check if it's a drag preview or not.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ControlPropRowContext.Provider value={controlPropRowContext}>\n\t\t\t\t\t\t\t\t<ArrayItemControlRow\n\t\t\t\t\t\t\t\t\tsortable\n\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\t\tpopoutId={item.id}\n\t\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\t\tcontrolProp={item}\n\t\t\t\t\t\t\t\t\tonChange={onChangeItem}\n\t\t\t\t\t\t\t\t\tonImageUpload={onImageUpload}\n\t\t\t\t\t\t\t\t\tcontrolKey={controlKey}\n\t\t\t\t\t\t\t\t\t// The [index] suffix is used by the hidden state of object controls\n\t\t\t\t\t\t\t\t\tcontrolPath={controlPath + `[${index}]`}\n\t\t\t\t\t\t\t\t\tcontrol={itemControl}\n\t\t\t\t\t\t\t\t\tonContextMenu={displayContextMenu}\n\t\t\t\t\t\t\t\t\thiddenControlsByNodeId={\n\t\t\t\t\t\t\t\t\t\tcontrolPropRowNeedsHiddenState(control.control.type) ? hiddenControlsByNodeId : undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tControlPropRow={ControlPropRow}\n\t\t\t\t\t\t\t\t\tallowP3={allowP3}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ControlPropRowContext.Provider>\n\t\t\t\t\t\t)\n\t\t\t\t\t}}\n\t\t\t\t</Sortable>\n\t\t\t\t{canAddItems && (\n\t\t\t\t\t<div className={styles.bottomFooter}>\n\t\t\t\t\t\t<PanelRow\n\t\t\t\t\t\t\ttitle={undefined}\n\t\t\t\t\t\t\twithReorderControl\n\t\t\t\t\t\t\treorderControlHidden\n\t\t\t\t\t\t\tclassName={styles.leftAndRightPanelPadding}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button onClick={addItem} enabled={!isReadOnly}>\n\t\t\t\t\t\t\t\tAdd\u2026\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Scroll>\n\t)\n}\n\nfunction isFramerCompiledComponent(controlSourceIdentifier: string | undefined): boolean {\n\tif (!controlSourceIdentifier) return false\n\n\tconst moduleType = moduleTypeForIdentifier(controlSourceIdentifier, engine.tree)\n\treturn moduleType === ModuleType.Canvas\n}\n\ninterface ArrayControlPropRowProps {\n\tnodeIds: NodeID[]\n\tcontrolKey: string\n\tcontrol: VerifiedArrayControlDescription\n\tcontrolPath: string\n\tcontrolProp: ReducedArrayControlProp\n\tonChange: ControlPropChangeHandler<ControlType.Array>\n\tonContextMenu?(event: React.MouseEvent<HTMLElement>): void\n\tControlPropRow: React.FunctionComponent<ControlPropRowProps>\n\thiddenControlsByNodeId: HiddenStateByNodeId | undefined\n\ttraitTypeKeys?: string[]\n\tscopeType: ScopeType\n\tsupportsVariables: boolean | undefined\n\tcontrolSourceIdentifier?: string\n\tdisplayInPopover?: boolean\n\tallowP3?: boolean\n}\n\nexport function ArrayControlPropRow({\n\tnodeIds,\n\tcontrol,\n\tcontrolKey,\n\tcontrolPath,\n\tcontrolProp,\n\tonChange,\n\tonContextMenu,\n\tControlPropRow,\n\thiddenControlsByNodeId,\n\ttraitTypeKeys,\n\tscopeType,\n\tcontrolSourceIdentifier,\n\tdisplayInPopover,\n\tsupportsVariables: externalSupportsVariables,\n\tallowP3,\n}: ArrayControlPropRowProps) {\n\tconst popoutNavigation = React.useContext(PopoutContext)\n\tconst isFramerCompiled = isFramerCompiledComponent(controlSourceIdentifier)\n\tconst isGallery = isGalleryControl(control)\n\n\t// We only want to support this for our own generated components and not user code. Otherwise\n\t// gallery controls could be changed into another array shape via a component update. While we\n\t// do want to support that in the future it requires extra work which is out of scope for now.\n\tconst supportsVariables = externalSupportsVariables === true && isGallery && isFramerCompiled\n\n\t// FIXME: should getControlProps be responsible for this instead? Single source of truth.\n\tconst maxCount = isNumber(control.maxCount) ? control.maxCount : Infinity\n\tconst itemCount = isArray(controlProp.value) ? controlProp.value.length : 0\n\tconst canAddItems = itemCount < maxCount\n\n\tconst title = control.title || titleCase(controlKey)\n\n\tconst changeHandler = useCallback(\n\t\t(getUpdate: (current: ControlProp) => ControlProp, nodesToUpdate: NodeID[], index: number) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tassert(isReadonlyArray(currentControlProp.value))\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Array,\n\t\t\t\t\t\tvalue: List.update(currentControlProp.value, index, currentItem => {\n\t\t\t\t\t\t\tconst updatedItem = getUpdate(currentItem)\n\t\t\t\t\t\t\tassert(currentItem.type === updatedItem.type)\n\t\t\t\t\t\t\t// Make sure we keep using the same id for the item\n\t\t\t\t\t\t\treturn { ...getUpdate(currentItem), id: currentItem.id ?? randomID() } as ArrayValue\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodesToUpdate,\n\t\t\t)\n\t\t},\n\t\t[onChange, controlKey],\n\t)\n\n\tconst hasMixedItemLength = isMixed(controlProp.value)\n\n\tconst addItem = useCallback(() => {\n\t\tconst newItem = getControlProp(control.control, undefined) as ArrayValue\n\t\tnewItem.id = randomID()\n\n\t\tonChange(\n\t\t\tcontrolKey,\n\t\t\tcurrentControlProp => {\n\t\t\t\tif (hasMixedItemLength) {\n\t\t\t\t\treturn { type: ControlType.Array, value: [newItem] }\n\t\t\t\t}\n\t\t\t\tassert(isReadonlyArray(currentControlProp.value))\n\t\t\t\treturn { type: ControlType.Array, value: List.push(currentControlProp.value, newItem) }\n\t\t\t},\n\t\t\tnodeIds,\n\t\t)\n\n\t\tswitch (control.control.type) {\n\t\t\tcase ControlType.Object:\n\t\t\tcase ControlType.Transition:\n\t\t\tcase ControlType.Color:\n\t\t\tcase ControlType.Image:\n\t\t\t\tpopoutNavigation?.presentPopoutOnRegistration(newItem.id)\n\t\t\t\tbreak\n\t\t}\n\t}, [onChange, controlKey, control, nodeIds, hasMixedItemLength, popoutNavigation])\n\n\tconst moveItem = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tassert(isReadonlyArray(currentControlProp.value))\n\t\t\t\t\treturn { type: ControlType.Array, value: List.move(currentControlProp.value, from, to) }\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst removeItemAtIndex = useCallback(\n\t\t(index: number) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tassert(isReadonlyArray(currentControlProp.value))\n\t\t\t\t\treturn { type: ControlType.Array, value: List.remove(currentControlProp.value, index) }\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst setEmptyArray = useCallback(() => {\n\t\tonChange(controlKey, () => ({ type: ControlType.Array, value: [] }), nodeIds)\n\t}, [onChange, controlKey, nodeIds])\n\n\tconst removeDynamicValue = useCallback(() => {\n\t\tonChange(\n\t\t\tcontrolKey,\n\t\t\t() => {\n\t\t\t\t// By returning an invalid control prop, the control default will be computed, which\n\t\t\t\t// we want when clearing a dynamic value.\n\t\t\t\treturn {} as ArrayControlProp\n\t\t\t},\n\t\t\tnodeIds,\n\t\t)\n\t}, [onChange, controlKey, nodeIds])\n\n\tconst uploadHandler = useCallback(\n\t\tasync (upload: Promise<AssetReference | null>, index: number) => {\n\t\t\t// Get nodes before starting the upload.\n\t\t\tconst nodeIdsToUpdate = nodeIds\n\n\t\t\t// Wait for upload to finish.\n\t\t\tconst reference = await upload\n\t\t\tif (!reference) return\n\n\t\t\t// Update the nodes after the image is uploaded.\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tassert(currentControlProp.type === ControlType.Array)\n\t\t\t\t\tif (!isReadonlyArray(currentControlProp.value)) return currentControlProp\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Array,\n\t\t\t\t\t\tvalue: List.update(currentControlProp.value, index, currentItem => {\n\t\t\t\t\t\t\tif (currentItem.type === ControlType.Image) {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t...updateImageControlPropWithNewImage(currentItem, reference),\n\t\t\t\t\t\t\t\t\tid: currentItem.id,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn { id: randomID(), type: ControlType.Image, value: reference }\n\t\t\t\t\t\t}),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodeIdsToUpdate,\n\t\t\t)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst onChangeValue = useCallback(\n\t\t(value: ArrayControlPropValue) => {\n\t\t\tonChange(controlKey, () => ({ type: ControlType.Array, value }), nodeIds)\n\t\t},\n\t\t[controlKey, nodeIds, onChange],\n\t)\n\n\tconst onSelectVariable = useCallback(\n\t\t(variableReference: VariableReference) => {\n\t\t\tconst computedValue = createArrayToArrayComputedValue({\n\t\t\t\tengine,\n\t\t\t\tsourceArrayReference: variableReference,\n\t\t\t\ttargetArrayControl: control,\n\t\t\t})\n\t\t\tif (!computedValue) return\n\t\t\tonChangeValue(computedValue)\n\t\t},\n\t\t[onChangeValue, control],\n\t)\n\n\t// We get the array variable reference from the computed value, because we don't want to show\n\t// the computed value UI.\n\tconst arrayVariable = isDynamicValue(controlProp.value)\n\t\t? getVariableReferenceFromComputedValue(controlProp.value)\n\t\t: null\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tvariableType={ControlType.Array}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tonCreateVariable={undefined}\n\t\t\tonSelectVariable={onSelectVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={arrayVariable}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t{isVariableReference(arrayVariable) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\texpectedType={ControlType.Array}\n\t\t\t\t\treference={arrayVariable}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tdisplayInPopover={displayInPopover}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<ArrayContentPopout\n\t\t\t\t\t\t\tisGallery={isGallery}\n\t\t\t\t\t\t\tarrayTitle={title}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\taddItem={addItem}\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tremoveAll={setEmptyArray}\n\t\t\t\t\t\t\tcontrolKey={controlKey}\n\t\t\t\t\t\t\tonChangeItem={changeHandler}\n\t\t\t\t\t\t\tcontrolPath={controlPath}\n\t\t\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\t\t\tcanAddItems={canAddItems}\n\t\t\t\t\t\t\tonImageUpload={uploadHandler}\n\t\t\t\t\t\t\tremoveItemAtIndex={removeItemAtIndex}\n\t\t\t\t\t\t\tControlPropRow={ControlPropRow}\n\t\t\t\t\t\t\thiddenControlsByNodeId={hiddenControlsByNodeId}\n\t\t\t\t\t\t\tallowP3={allowP3}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tnavigationTitle={title}\n\t\t\t\t\ttitle={popoutButtonTitle(control, controlProp, isGallery)}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t{arrayControlPreviewIcon(isGallery, agentExperimentEnabled)}\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction arrayControlPreviewIcon(isGallery: boolean, agentExperimentEnabled: boolean) {\n\tif (!isGallery) return <IconArray />\n\tif (agentExperimentEnabled) return <IconVariableGallery background=\"transparent\" />\n\treturn <LegacyIconVariableGallery background=\"transparent\" />\n}\n\nfunction getVariableReferenceFromComputedValue(value: ComputedValue): VariableReference {\n\tassert(!isFetchDataValue(value.startValue), \"Arrays don't support fetched data\")\n\tif (isVariableReference(value.startValue)) return value.startValue\n\tassertNever(value.startValue)\n}\n", "import type { VerifiedArrayControlDescription } from \"@framerjs/framer-runtime\"\nimport { EmptyState, Scroll, T } from \"@framerjs/fresco\"\nimport { List } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { ArrayControlProp, ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type {\n\tReducedArrayItemControlProp,\n\tReducedResponsiveImageControlProp,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { getReducedResponsiveImageControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNumber, isReadonlyArray, isString } from \"utils/typeChecks.ts\"\nimport { useResponsiveCollectionImagePopoutProps } from \"../contentManagement/CollectionImagePopout.tsx\"\nimport { GalleryInput } from \"../contentManagement/GalleryInput.tsx\"\nimport { createGalleryItem, getImageControlKeyAndDescription } from \"../contentManagement/utils/arrayGalleryUtils.ts\"\nimport { getUpdatedImageControlProp } from \"../contentManagement/utils/getUpdatedFieldControlProp.ts\"\nimport * as styles from \"./GalleryPopoutContent.styles.ts\"\nimport { ImagePopout } from \"./ImagePopout.tsx\"\nimport { PopoutButton } from \"./PopoutButton.tsx\"\nimport { useDirectionalFocusNavigation } from \"./useDirectionalFocusNavigation.ts\"\n\ninterface GalleryPopoutContentProps {\n\tcontrol: VerifiedArrayControlDescription\n\tvalue: readonly ReducedArrayItemControlProp[]\n\tonChange: (getUpdate: (current: ArrayControlProp) => ArrayControlProp) => void\n\taddButtonEnabled: boolean\n}\n\nexport function getMaxExtraImages({\n\tmaxCount,\n\titemCount,\n\tdraftItemId,\n}: {\n\tmaxCount: number | undefined\n\titemCount: number\n\tdraftItemId: string | null\n}): number | undefined {\n\tif (!isNumber(maxCount)) return undefined\n\n\treturn Math.max(maxCount - itemCount - (draftItemId ? 0 : 1), 0)\n}\n\nexport function GalleryPopoutContent({ control, value, onChange, addButtonEnabled }: GalleryPopoutContentProps) {\n\tconst containerRef = React.useRef<HTMLDivElement>(null)\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst [imageKey, imageControl] = getImageControlKeyAndDescription(control)\n\n\tconst [draftItemId, setDraftItemId] = React.useState<string | null>(null)\n\tconst maxExtraImages = getMaxExtraImages({ maxCount: control.maxCount, itemCount: value.length, draftItemId })\n\n\tconst [draftControlProp, setDraftControlProp] = React.useState<ReducedResponsiveImageControlProp>(() => {\n\t\treturn getReducedResponsiveImageControlProp(undefined, imageControl)\n\t})\n\n\tconst { handleNavigationKeyDown } = useDirectionalFocusNavigation({\n\t\tcontainerRef,\n\t\taxis: \"vertical\",\n\t})\n\n\tconst resetDraftControlProp = React.useCallback(() => {\n\t\tsetDraftItemId(null)\n\t\tsetDraftControlProp(getReducedResponsiveImageControlProp(undefined, imageControl))\n\t}, [imageControl])\n\n\tconst applyDraftImageUpdate = React.useCallback(\n\t\t(\n\t\t\tgetUpdate: (value: ImageControlProp | undefined) => ImageControlProp,\n\t\t\textraImages: ImageControlProp[] | undefined,\n\t\t) => {\n\t\t\tconst nextImageControlProp = getUpdate(draftItemId ? getDraftImageControlProp(draftControlProp) : undefined)\n\t\t\tsetDraftControlProp(getReducedResponsiveImageControlProp(nextImageControlProp, imageControl))\n\n\t\t\tif (!isString(nextImageControlProp.value)) return\n\n\t\t\tconst currentDraftItemId = draftItemId ?? randomID()\n\t\t\tonChange(currentControlProp => {\n\t\t\t\treturn upsertGalleryItems({\n\t\t\t\t\tcurrentControlProp,\n\t\t\t\t\treducedArray: value,\n\t\t\t\t\titemId: currentDraftItemId,\n\t\t\t\t\timageKey,\n\t\t\t\t\tfirstImage: nextImageControlProp,\n\t\t\t\t\textraImages,\n\t\t\t\t})\n\t\t\t})\n\t\t\tif (!draftItemId) {\n\t\t\t\tsetDraftItemId(currentDraftItemId)\n\t\t\t}\n\t\t},\n\t\t[draftControlProp, draftItemId, imageControl, imageKey, onChange, value],\n\t)\n\n\tconst handleRemoveImage = React.useCallback(() => {\n\t\tif (!draftItemId) {\n\t\t\tresetDraftControlProp()\n\t\t\treturn\n\t\t}\n\n\t\tonChange(currentControlProp => removeGalleryItem(currentControlProp, draftItemId))\n\t\tresetDraftControlProp()\n\t}, [draftItemId, onChange, resetDraftControlProp])\n\n\tconst imagePopoutProps = useResponsiveCollectionImagePopoutProps({\n\t\tcontrolProp: draftControlProp,\n\t\tonChange: applyDraftImageUpdate,\n\t\tonRemove: handleRemoveImage,\n\t\tmaxExtraImages,\n\t\tmultiple: true,\n\t})\n\n\treturn (\n\t\t// biome-ignore lint/nursery/noStaticElementInteractions: container listens for bubbled arrow-key navigation.\n\t\t<div\n\t\t\tref={containerRef}\n\t\t\tclassName={cx(styles.galleryPopoutContentShell, !isAgentExperimentOn && styles.galleryPopoutContentShellLegacy)}\n\t\t\tonKeyDown={handleNavigationKeyDown}\n\t\t>\n\t\t\t<Scroll direction=\"vertical\" className={styles.galleryPopoutContentScroll}>\n\t\t\t\t{value.length === 0 ? (\n\t\t\t\t\t<EmptyState center body={<T>No Images</T>} />\n\t\t\t\t) : (\n\t\t\t\t\t<GalleryInput\n\t\t\t\t\t\tcompact\n\t\t\t\t\t\tvariant=\"plain\"\n\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tshowInlineAddButton={false}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Scroll>\n\t\t\t<div className={styles.galleryPopoutContentFooter}>\n\t\t\t\t<PopoutButton\n\t\t\t\t\tuseFrescoButton\n\t\t\t\t\tenabled={addButtonEnabled}\n\t\t\t\t\tpopout={<ImagePopout {...imagePopoutProps} />}\n\t\t\t\t\tnavigationTitle=\"Add Image\"\n\t\t\t\t\tclassName={styles.galleryPopoutContentFooterButton}\n\t\t\t\t\tonDismiss={resetDraftControlProp}\n\t\t\t\t>\n\t\t\t\t\tAdd Image\n\t\t\t\t</PopoutButton>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction upsertGalleryItems({\n\tcurrentControlProp,\n\treducedArray,\n\titemId,\n\timageKey,\n\tfirstImage,\n\textraImages,\n}: {\n\tcurrentControlProp: ArrayControlProp\n\treducedArray: readonly ReducedArrayItemControlProp[]\n\titemId: string\n\timageKey: string\n\tfirstImage: ImageControlProp\n\textraImages?: readonly ImageControlProp[]\n}): ArrayControlProp {\n\tconst newItems = [createGalleryItem({ itemId, imageKey, imageControlProp: firstImage })]\n\n\tif (extraImages) {\n\t\tfor (const imageControlProp of extraImages) {\n\t\t\tnewItems.push(createGalleryItem({ itemId: randomID(), imageKey, imageControlProp }))\n\t\t}\n\t}\n\n\tif (reducedArray.length === 0) return { type: ControlType.Array, value: [...newItems] }\n\n\tconst currentList = isReadonlyArray(currentControlProp.value) ? currentControlProp.value : []\n\tconst currentItemIndex = currentList.findIndex(item => item.id === itemId)\n\tif (currentItemIndex === -1) {\n\t\treturn { type: ControlType.Array, value: [...currentList, ...newItems] }\n\t}\n\n\treturn { type: ControlType.Array, value: List.replace(currentList, currentItemIndex, newItems) }\n}\n\nfunction getDraftImageControlProp(controlProp: ReducedResponsiveImageControlProp): ImageControlProp | undefined {\n\tif (!isString(controlProp.value)) return undefined\n\n\tconst imageControlProp = getUpdatedImageControlProp(undefined, { value: controlProp.value })\n\tif (isString(controlProp.alt)) imageControlProp.alt = controlProp.alt\n\tif (isString(controlProp.positionX)) imageControlProp.positionX = controlProp.positionX\n\tif (isString(controlProp.positionY)) imageControlProp.positionY = controlProp.positionY\n\treturn imageControlProp\n}\n\nfunction removeGalleryItem(currentControlProp: ArrayControlProp, itemId: string): ArrayControlProp {\n\tconst currentList = isReadonlyArray(currentControlProp.value) ? currentControlProp.value : []\n\treturn {\n\t\ttype: ControlType.Array,\n\t\tvalue: currentList.filter(item => item.id !== itemId),\n\t}\n}\n", "import \"GalleryPopoutContent.styles_e416p8.wyw.css\"; export const galleryPopoutContentShell = \"galleryPopoutContentShell_gj59rs5\";\nexport const galleryPopoutContentShellLegacy = \"galleryPopoutContentShellLegacy_g1fgpp12\";\nexport const galleryPopoutContentScroll = \"galleryPopoutContentScroll_gs5sgps\";\nexport const galleryPopoutContentFooter = \"galleryPopoutContentFooter_gxnw7gi\";\nexport const galleryPopoutContentFooterButton = \"galleryPopoutContentFooterButton_g1ytjren\";", "import \"ArrayControlPropRow.styles_1ilqg2i.wyw.css\"; export const bottomFooter = \"bottomFooter_bu6twdm\";\nexport const leftAndRightPanelPadding = \"leftAndRightPanelPadding_l10kfgzc\";\nexport const sortable = \"sortable_s1x6gspv\";\nexport const sortableWithoutFooter = \"sortableWithoutFooter_s1j5muy7\";\nexport const sortableMinHeight = \"sortableMinHeight_srs44bt\";", "import \"ObjectControlPropRow.styles_7hizvf.wyw.css\"; export const scroll = \"scroll_sfde1p6\";", "import { ControlType } from \"library/render/types/PropertyControls.ts\"\n\n/**\n * The hidden state changes quite often and breaks memoization of rows that don't even need this\n * property. It can for example cause the segmented control selection animation of the enum row to\n * stop, which is caused by a hidden state change of an unrelated row.\n */\nexport function controlPropRowNeedsHiddenState(type: ControlType): boolean {\n\treturn type === ControlType.Object || type === ControlType.Array\n}\n", "import { createContext, useContext } from \"react\"\n\nconst VariableModalContext = createContext(false)\nVariableModalContext.displayName = \"IsInVariableModalContext\"\n\nexport const VariableModalContextProvider = VariableModalContext.Provider\n\nexport function useIsWithinVariableModal(): boolean {\n\treturn useContext(VariableModalContext)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useCallback } from \"react\"\nimport { isFunction } from \"utils/typeChecks.ts\"\n\nfunction isVariableOfType<\n\tT extends VariableOrDivider[\"type\"],\n\tVariable extends Extract<VariableOrDivider, { type: T }>,\n>(variable: VariableOrDivider, variableType: T): variable is Variable {\n\treturn variable.type === variableType\n}\n\nexport function useUpdateVariableOfType<\n\tT extends VariableOrDivider[\"type\"],\n\tVariable extends Extract<VariableOrDivider, { type: T }>,\n>(\n\tvariableType: T,\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void,\n): <K extends keyof Variable>(update: ((current: Variable) => Pick<Variable, K>) | Pick<Variable, K>) => void {\n\treturn useCallback(\n\t\tupdate => {\n\t\t\tonUpdate(current => {\n\t\t\t\tassert(isVariableOfType<T, Variable>(current, variableType), \"Expected a variable of type \" + variableType)\n\t\t\t\tconst partial = isFunction(update) ? update(current) : update\n\t\t\t\treturn { ...current, ...partial }\n\t\t\t})\n\t\t},\n\t\t[variableType, onUpdate],\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype BooleanVariableDefinition,\n\ttype VariableOrDivider,\n\tcontrolDescriptionFromVariable,\n\tisOptionalVariable,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { BooleanControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { BooleanControlPropRow } from \"../../properties/codeComponentRows/BooleanControlPropRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: BooleanVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailBoolean({ variable, scopeType, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\tif (isOptional) return null\n\n\tconst updateInitialValue = (controlProp: BooleanControlProp) => {\n\t\tconst initialValue = controlProp.value\n\t\tassert(!isDynamicValue(initialValue), \"Dynamic values are not supported as variable defaults\")\n\t\tassert(!isNull(initialValue), \"Boolean variable can't be set to null\")\n\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<BooleanControlPropRow\n\t\t\tcontrolKey={Dictionary.Default}\n\t\t\tnodeIds={[]}\n\t\t\tcontrolProp={{ type: ControlType.Boolean, value: variable.initialValue }}\n\t\t\tcontrol={{\n\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\ttitle: Dictionary.Default,\n\t\t\t}}\n\t\t\tonChange={updateInitialValue}\n\t\t/>\n\t)\n}\n", "import type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport type { BorderVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { borderValueDefaults } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport { BorderValuesRows } from \"../../properties/panels/BorderValuesRows.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: BorderVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailBorder({ variable, onUpdate }: Props) {\n\tconst values = variable.initialValue ?? borderValueDefaults\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (getUpdatedBorderValues: (current: BorderValues) => BorderValues) => {\n\t\tupdateVariable(current => {\n\t\t\tconst updatedBorderValues = getUpdatedBorderValues(current.initialValue ?? borderValueDefaults)\n\t\t\treturn { ...current, initialValue: updatedBorderValues }\n\t\t})\n\t}\n\n\treturn <BorderValuesRows {...values} nodeIds={[]} displayColorPopoutInPopover onChange={updateInitialValue} />\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { RelativeOrFourPixelNumberShorthand } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type {\n\tBorderRadiusVariableDefinition,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { NumberShorthandInput } from \"../../properties/inputs/NumberShorthandInput.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: BorderRadiusVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailBorderRadius({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (initialValue: RelativeOrFourPixelNumberShorthand) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<NumberShorthandInput variant=\"borderRadius\" value={variable.initialValue} onChange={updateInitialValue} />\n\t\t</PanelRow>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { BoxShadowVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { boxShadowControlDescription } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { reduceShadowList } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { BoxShadowControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedBoxShadowControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { BoxShadowControlPropRow } from \"../../properties/codeComponentRows/BoxShadowControlPropRow.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: BoxShadowVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailBoxShadow({ variable, onUpdate }: Props) {\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst control = React.useMemo(() => {\n\t\tconst controlDescription = boxShadowControlDescription(variable)\n\t\treturn { ...controlDescription, title: Dictionary.Default }\n\t}, [variable])\n\n\tconst controlProp = React.useMemo(() => {\n\t\tconst reduced = reduceShadowList(variable.initialValue, NotFound)\n\t\tconst reducedBoxShadow: ReducedBoxShadowControlProp = {\n\t\t\ttype: ControlType.BoxShadow,\n\t\t\tvalue: reduced,\n\t\t}\n\t\treturn reducedBoxShadow\n\t}, [variable.initialValue])\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (\n\t\t_controlKey: string,\n\t\tgetUpdatedBoxShadowControlProp: (current: BoxShadowControlProp) => BoxShadowControlProp,\n\t) => {\n\t\tupdateVariable(current => {\n\t\t\tconst updatedControlProp = getUpdatedBoxShadowControlProp({\n\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\tvalue: current.initialValue,\n\t\t\t})\n\t\t\tassert(!isDynamicValue(updatedControlProp.value))\n\t\t\treturn { ...current, initialValue: updatedControlProp.value }\n\t\t})\n\t}\n\n\treturn (\n\t\t<BoxShadowControlPropRow\n\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\tonChange={updateInitialValue}\n\t\t\tcontrol={control}\n\t\t\tcontrolKey={variable.id}\n\t\t\tcontrolProp={controlProp}\n\t\t\tnodeIds={[]}\n\t\t/>\n\t)\n}\n", "import { NavigationStackItemContext, Stack } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/src/layout-transitions\"\nimport { List, isMixed } from \"@framerjs/shared\"\nimport type { PanelRowResetReplicaOverridesOptions } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { createBoxShadow, getUpdatedShadow } from \"document/models/Shadow.ts\"\nimport { getBoxShadowFromControlDefault } from \"document/models/controlProps/BoxShadowControlPropValue.ts\"\nimport type { BoxShadowControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedBoxShadowControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type { BoxShadowControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonBackgroundPreview } from \"../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { buttonTitleForShadow } from \"../panels/ShadowPanel.tsx\"\nimport { ShadowPopout, fallbackShadowColor } from \"../panels/ShadowPopout.tsx\"\nimport { getInitialBoxShadowValueFromReducedShadows } from \"../panels/getInitialBoxShadowValueFromReducedShadows.ts\"\nimport { shadowDefaultsForIndex } from \"../panels/utils/addShadowForNodes.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { getVariableFromInfo } from \"../useVariableProviderInfo.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as classes from \"./BoxShadowControlPropRow.styles.ts\"\nimport type { ControlPropChangeHandler } from \"./ControlPropRowChangeHandler.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\ninterface Props extends PanelRowResetReplicaOverridesOptions {\n\tcontrolKey: string\n\tcontrol: BoxShadowControlDescription\n\tcontrolProp: ReducedBoxShadowControlProp\n\tpopoutId?: string\n\tonChange: ControlPropChangeHandler<ControlType.BoxShadow>\n\tnodeIds: string[]\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n\tdisplayInPopover?: boolean\n\tsupportsVariables?: boolean\n\tonCopy?: () => void\n\tonPaste?: () => void\n\tpasteEnabled?: boolean | (() => Promise<boolean>)\n\tcopyEnabled?: boolean | (() => boolean)\n}\n\nexport function BoxShadowControlPropRow({\n\tcontrol,\n\tcontrolKey,\n\tcontrolProp,\n\tpopoutId,\n\tonContextMenu,\n\tonChange,\n\ttraitTypes,\n\ttraitTypeKeys,\n\tnodeIds,\n\tdisplayInPopover,\n\tonCopy,\n\tonPaste,\n\tcopyEnabled,\n\tpasteEnabled,\n\tsupportsVariables = false,\n}: Props) {\n\tconst outsideNavigationStack = React.useContext(NavigationStackItemContext) === null\n\n\tconst defaultValue = React.useMemo(() => {\n\t\treturn getBoxShadowFromControlDefault(control.defaultValue)\n\t}, [control.defaultValue])\n\n\tconst resetToDefaultEnabled = React.useMemo(\n\t\t() => !isEqual(defaultValue, controlProp.value, true),\n\t\t[controlProp.value, defaultValue],\n\t)\n\n\tconst removeItem = React.useCallback(\n\t\t(index: number) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrent => {\n\t\t\t\t\tif (isDynamicValue(current.value)) return current\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...current,\n\t\t\t\t\t\tvalue: List.remove(current.value, index),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[controlKey, onChange, nodeIds],\n\t)\n\n\tconst moveItem = React.useCallback(\n\t\t(from: number, to: number) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrent => {\n\t\t\t\t\tif (isDynamicValue(current.value)) return current\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...controlProp,\n\t\t\t\t\t\tvalue: List.move(current.value, from, to),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[controlKey, controlProp, nodeIds, onChange],\n\t)\n\n\tconst addItem = React.useCallback(() => {\n\t\tonChange(\n\t\t\tcontrolKey,\n\t\t\tcurrent => {\n\t\t\t\tconst shadowCount = isArray(current.value) ? current.value.length : 0\n\t\t\t\tconst shadowSettings = { id: randomID(), ...shadowDefaultsForIndex(shadowCount) }\n\t\t\t\tconst newBoxShadow = createBoxShadow(shadowSettings)\n\t\t\t\tconst newShadows =\n\t\t\t\t\tisDynamicValue(current.value) || isMixed(controlProp.value)\n\t\t\t\t\t\t? [newBoxShadow]\n\t\t\t\t\t\t: [...current.value, newBoxShadow]\n\t\t\t\treturn {\n\t\t\t\t\t...current,\n\t\t\t\t\tvalue: newShadows,\n\t\t\t\t}\n\t\t\t},\n\t\t\tnodeIds,\n\t\t)\n\t}, [controlKey, controlProp, nodeIds, onChange])\n\n\tconst resetToDefault = React.useCallback(() => {\n\t\treturn onChange(\n\t\t\tcontrolKey,\n\t\t\tcurrent => {\n\t\t\t\treturn {\n\t\t\t\t\t...current,\n\t\t\t\t\tvalue: defaultValue,\n\t\t\t\t}\n\t\t\t},\n\t\t\tnodeIds,\n\t\t)\n\t}, [onChange, controlKey, nodeIds, defaultValue])\n\n\tconst onChangeShadow = React.useCallback(\n\t\t<K extends keyof BoxShadow>(key: K, index: number) => {\n\t\t\treturn (value: BoxShadow[K]) => {\n\t\t\t\tonChange(\n\t\t\t\t\tcontrolKey,\n\t\t\t\t\tcurrent => {\n\t\t\t\t\t\tif (isDynamicValue(current.value)) return current\n\t\t\t\t\t\tconst shadow = current.value[index]\n\t\t\t\t\t\tif (!shadow) return current\n\t\t\t\t\t\tconst updatedShadow = getUpdatedShadow(shadow, { [key]: value })\n\t\t\t\t\t\tconst updatedShadows = List.replace(current.value, index, updatedShadow)\n\t\t\t\t\t\treturn { ...current, value: updatedShadows }\n\t\t\t\t\t},\n\t\t\t\t\tnodeIds,\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst onChangeShadowType = React.useCallback(\n\t\t(index: number, type: BoxShadow[\"type\"], update: Partial<BoxShadow>) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrent => {\n\t\t\t\t\tif (isDynamicValue(current.value)) return current\n\t\t\t\t\tconst shadow = current.value[index]\n\t\t\t\t\tconst newDefaults = type === \"box\" ? shadowDefaultsForIndex(index) : { y: 10, diffusion: 0.25 }\n\t\t\t\t\tif (!shadow) return current\n\t\t\t\t\tconst updatedShadow = getUpdatedShadow(shadow, { type, ...newDefaults, ...update })\n\t\t\t\t\tconst updatedShadows = List.replace(current.value, index, updatedShadow)\n\t\t\t\t\treturn { ...current, value: updatedShadows }\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst updateValue = React.useCallback(\n\t\t(value: BoxShadowControlPropValue) => {\n\t\t\tonChange(controlKey, current => ({ ...current, value }), nodeIds)\n\t\t},\n\t\t[onChange, controlKey, nodeIds],\n\t)\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst name = control.title || titleCase(controlKey)\n\t\t\tconst initialValue = getInitialBoxShadowValueFromReducedShadows(controlProp.value)\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\tname,\n\t\t\t\tinitialValue,\n\t\t\t})\n\t\t\tif (variableRef) {\n\t\t\t\tupdateValue(variableRef)\n\t\t\t}\n\t\t},\n\t\t[control, controlKey, controlProp, updateValue],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tconst { value } = controlProp\n\t\tif (!isVariableReference(value)) return\n\n\t\tconst variable = getVariableFromInfo(value, engine.stores.treeStore.variableProviderInfo)\n\t\tupdateValue(variable?.type === ControlType.BoxShadow ? variable.initialValue : [])\n\t})\n\n\tconst shadowCount = isArray(controlProp.value) ? controlProp.value.length : 0\n\tconst anyShadow = shadowCount > 0\n\tconst canSortShadows = shadowCount > 1\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={control.title || titleCase(controlKey)}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonResetToDefault={resetToDefault}\n\t\t\tresetToDefaultEnabled={resetToDefaultEnabled}\n\t\t\ttraitTypes={traitTypes}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\tvariableType={supportedVariableTypesByControlType[ControlType.BoxShadow]}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(controlProp.value) ? controlProp.value : null}\n\t\t\tonSelectVariable={updateValue}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t>\n\t\t\t{isVariableReference(controlProp.value) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[ControlType.BoxShadow]}\n\t\t\t\t\treference={controlProp.value}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t\t{anyShadow && (\n\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\tenabled={canSortShadows}\n\t\t\t\t\t\t\tclassName={classes.sortable}\n\t\t\t\t\t\t\titems={isArray(controlProp.value) ? controlProp.value : []}\n\t\t\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\tremoveItem={removeItem}\n\t\t\t\t\t\t\tonDragStart={outsideNavigationStack && !displayInPopover ? popoutWindow.close : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{({ item: shadow, index }) => (\n\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\tid={popoutId}\n\t\t\t\t\t\t\t\t\tkey={shadow.id}\n\t\t\t\t\t\t\t\t\ttitle={buttonTitleForShadow(shadow)}\n\t\t\t\t\t\t\t\t\tnavigationTitle=\"Shadow\"\n\t\t\t\t\t\t\t\t\tdisplayInPopover={displayInPopover}\n\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t<ShadowPopout\n\t\t\t\t\t\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={true}\n\t\t\t\t\t\t\t\t\t\t\tanyShapeNode={false}\n\t\t\t\t\t\t\t\t\t\t\twithSpread\n\t\t\t\t\t\t\t\t\t\t\twithInset\n\t\t\t\t\t\t\t\t\t\t\ttype={shadow.type}\n\t\t\t\t\t\t\t\t\t\t\tcolor={shadow.color}\n\t\t\t\t\t\t\t\t\t\t\tx={shadow.x}\n\t\t\t\t\t\t\t\t\t\t\ty={shadow.y}\n\t\t\t\t\t\t\t\t\t\t\tblur={shadow.blur}\n\t\t\t\t\t\t\t\t\t\t\tinset={shadow.inset}\n\t\t\t\t\t\t\t\t\t\t\tspread={shadow.spread}\n\t\t\t\t\t\t\t\t\t\t\tdiffusion={shadow.diffusion}\n\t\t\t\t\t\t\t\t\t\t\tfocus={shadow.focus}\n\t\t\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\t\t\tonChange={onChangeShadow}\n\t\t\t\t\t\t\t\t\t\t\tonChangeType={onChangeShadowType}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\tonDelete={() => removeItem(index)}\n\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t<PopoutButtonBackgroundPreview\n\t\t\t\t\t\t\t\t\t\t\tbackground={isString(shadow.color) ? shadow.color : fallbackShadowColor}\n\t\t\t\t\t\t\t\t\t\t/>\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</Sortable>\n\t\t\t\t\t)}\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"shadow\" onClick={addItem} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { toast } from \"web/lib/toaster.ts\"\nimport { ToastKey } from \"./ToastKey.ts\"\n\nexport function toastIncompatibleStrokWidthAndShadows() {\n\ttoast({\n\t\tkey: ToastKey.IncompatibleStrokeWidthAndShadows,\n\t\ttype: \"add\",\n\t\tvariant: \"info\",\n\t\tprimaryText: \"Shadows incompatible\",\n\t\tsecondaryText: \"with Stroke Width Variables.\",\n\t\tduration: 5000,\n\t\tshowCloseButton: \"always\",\n\t})\n}\n", "import { Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { List, isMixed } 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 type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { supportsBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { hasDynamicStrokeWidth } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedShadow, ReducedShadows } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport { isOptionalShadowVisible, isShadowOptional } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { getDuplicatedShadow, getUpdatedShadow } from \"document/models/Shadow.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { toastIncompatibleStrokWidthAndShadows } from \"document/utils/toastIncompatibleStrokeWidthAndShadows.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { containsMixedValue } from \"utils/containsMixedValue.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { isArray, isNumber, isString } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { PopoutButtonBackgroundPreview } from \"../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { getVariableFromInfo } from \"../useVariableProviderInfo.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { ShadowPopout } from \"./ShadowPopout.tsx\"\nimport { getInitialBoxShadowValueFromReducedShadows } from \"./getInitialBoxShadowValueFromReducedShadows.ts\"\nimport * as classes from \"./sortablePanelRows.styles.ts\"\nimport { addShadowForNodes, shadowDefaultsForIndex } from \"./utils/addShadowForNodes.ts\"\nimport { useCopyPasteArrayProperty } from \"./utils/useCopyPasteArrayProperty.ts\"\n\nconst shadowTraitTypes = [TraitType.Shadows]\n\ninterface Props extends ReducedShadows {\n\texpandedSelectionForShapeStylesIds: NodeID[]\n\tonlyBreakpointNodes: boolean\n\tonlyShapeNodes: boolean\n\tanyShapeNode: boolean\n\tdismissPopoutOnDrag?: boolean\n}\n\nconst popoutId = \"shadows-popout\"\n\nexport const ShadowPanel = React.memo(function ShadowPanel(props: Props) {\n\tconst {\n\t\tonlyBreakpointNodes,\n\t\tonlyShapeNodes,\n\t\texpandedSelectionForShapeStylesIds,\n\t\tanyNodesWithShadows,\n\t\tonlyNodesSupportingShadowSpread,\n\t\tonlyNodesSupportingShadowInset,\n\t\tanyShapeNode,\n\t\tshadows,\n\t\tonlyNodesSupportingRealisticShadows,\n\t\tdismissPopoutOnDrag = true,\n\t} = props\n\n\tconst isReadOnly = useReadOnly()\n\tconst canCopyShadow = useCallback(() => {\n\t\tif (!isClipboardSupported()) return false\n\t\tif (!isArray(shadows) || shadows.length === 0) return false\n\t\treturn !containsMixedValue(shadows)\n\t}, [shadows])\n\n\tconst canCopySingleShadow = useCallback(\n\t\t(index: number) => {\n\t\t\tif (!isClipboardSupported()) return false\n\t\t\tif (!isArray(shadows) || shadows.length === 0) return false\n\t\t\tconst shadow = shadows[index]\n\t\t\tif (!shadow) return false\n\t\t\treturn !containsMixedValue(shadow)\n\t\t},\n\t\t[shadows],\n\t)\n\n\tconst [canPasteShadow, pasteAllShadows, pasteShadow, copyAllShadows, copyShadow, clipboardItemsLength] =\n\t\tuseCopyPasteArrayProperty(\n\t\t\tTraitType.Shadows,\n\t\t\tprops.expandedSelectionForShapeStylesIds,\n\t\t\tcanCopyShadow,\n\t\t\tcanCopySingleShadow,\n\t\t)\n\n\tconst updateDynamicBoxShadows = useEngineCallback(\n\t\t(value: DynamicValue | undefined) => {\n\t\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\t\tlet anyNodesWithDynamicStrokeWidth: boolean = false\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, supportsBoxShadow)) {\n\t\t\t\tnode.set({ boxShadows: value })\n\t\t\t\tanyNodesWithDynamicStrokeWidth ||= hasDynamicStrokeWidth(node)\n\t\t\t}\n\n\t\t\tif (anyNodesWithDynamicStrokeWidth) {\n\t\t\t\ttoastIncompatibleStrokWidthAndShadows()\n\t\t\t}\n\t\t},\n\t\t[props.expandedSelectionForShapeStylesIds],\n\t)\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: getInitialBoxShadowValueFromReducedShadows(shadows),\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\tname: Dictionary.Shadow,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicBoxShadows(variableRef)\n\t\t},\n\t\t[updateDynamicBoxShadows, shadows],\n\t)\n\n\tconst onRemoveDynamicValue = useEngineCallback(() => {\n\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, supportsBoxShadow)\n\t\tfor (const node of nodes) {\n\t\t\tconst value = node.boxShadows\n\t\t\tif (!isDynamicValue(value)) continue\n\n\t\t\tif (isComputedValue(value)) {\n\t\t\t\tnode.set({ boxShadows: [] })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isVariableReference(value)) {\n\t\t\t\tconst variable = getVariableFromInfo(value, engine.stores.treeStore.variableProviderInfo)\n\t\t\t\tnode.set({ boxShadows: variable?.type === ControlType.BoxShadow ? variable.initialValue : [] })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvalue satisfies never\n\t\t}\n\t}, [props.expandedSelectionForShapeStylesIds])\n\n\tconst onSelectComputedValue = useEngineCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tupdateDynamicBoxShadows(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[updateDynamicBoxShadows],\n\t)\n\n\tconst getPasteTitle = React.useCallback(async () => {\n\t\tconst length = await clipboardItemsLength()\n\t\treturn length > 1 ? \"Paste All\" : \"Paste\"\n\t}, [clipboardItemsLength])\n\n\tif (!anyNodesWithShadows) return null\n\tif (isShadowOptional(shadows, onlyBreakpointNodes, onlyShapeNodes) && !isOptionalShadowVisible(shadows)) return null\n\n\tconst canRemoveShadows = (): boolean => {\n\t\treturn isMixed(shadows) || (isArray(shadows) && shadows.length > 0)\n\t}\n\n\tconst removeAll = engine.scheduler.wrapHandler(() => {\n\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\t\tnodes.forEach(node => {\n\t\t\tif (supportsBoxShadow(node)) {\n\t\t\t\tnode.set({ boxShadows: undefined })\n\t\t\t}\n\t\t\tif (withShadow(node)) {\n\t\t\t\tnode.set({ shadows: undefined })\n\t\t\t}\n\t\t})\n\t})\n\n\tconst removeItem = engine.scheduler.wrapHandler((index: number) => {\n\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\t\tnodes.forEach(node => {\n\t\t\tif (supportsBoxShadow(node) && !isDynamicValue(node.boxShadows)) {\n\t\t\t\tif (!node.boxShadows) return\n\t\t\t\tnode.set({ boxShadows: List.remove(node.boxShadows, index) })\n\t\t\t}\n\t\t\tif (withShadow(node)) {\n\t\t\t\tif (!node.shadows) return\n\t\t\t\tnode.set({ shadows: List.remove(node.shadows, index) })\n\t\t\t}\n\t\t})\n\t})\n\n\tconst moveItem = engine.scheduler.wrapHandler((from: number, to: number) => {\n\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\t\tnodes.forEach(node => {\n\t\t\tif (supportsBoxShadow(node) && node.boxShadows && !isDynamicValue(node.boxShadows)) {\n\t\t\t\tnode.set({ boxShadows: List.move(node.boxShadows, from, to) })\n\t\t\t}\n\t\t\tif (withShadow(node) && node.shadows) {\n\t\t\t\tnode.set({ shadows: List.move(node.shadows, from, to) })\n\t\t\t}\n\t\t})\n\t})\n\n\tconst addItem = engine.scheduler.wrapHandler(() => {\n\t\taddShadowForNodes(engine, expandedSelectionForShapeStylesIds, shadows)\n\t})\n\n\tconst onChange = <K extends keyof BoxShadow>(key: K, index: number) => {\n\t\treturn engine.scheduler.wrapHandler((value: BoxShadow[K]) => {\n\t\t\tconst nodes = engine.tree.getNodes(expandedSelectionForShapeStylesIds)\n\t\t\tlet anyNodesWithDynamicStrokeWidth: boolean = false\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tif (supportsBoxShadow(node) && node.boxShadows && !isDynamicValue(node.boxShadows)) {\n\t\t\t\t\tconst shadow = node.boxShadows[index]\n\t\t\t\t\tif (!shadow) return\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tboxShadows: List.replace(node.boxShadows, index, getUpdatedShadow(shadow, { [key]: value })),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tif (withShadow(node) && node.shadows) {\n\t\t\t\t\tswitch (key) {\n\t\t\t\t\t\tcase \"inset\":\n\t\t\t\t\t\tcase \"spread\":\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tconst shadow = node.shadows[index]\n\t\t\t\t\tif (!shadow) return\n\t\t\t\t\tnode.set({ shadows: List.replace(node.shadows, index, getUpdatedShadow(shadow, { [key]: value })) })\n\t\t\t\t}\n\n\t\t\t\tanyNodesWithDynamicStrokeWidth ||= hasDynamicStrokeWidth(node)\n\t\t\t})\n\n\t\t\tif (anyNodesWithDynamicStrokeWidth) {\n\t\t\t\ttoastIncompatibleStrokWidthAndShadows()\n\t\t\t}\n\t\t})\n\t}\n\n\tconst onChangeShadowType = engine.scheduler.wrapHandler(\n\t\t(index: number, type: BoxShadow[\"type\"], update: Partial<BoxShadow>) => {\n\t\t\tconst nodes = engine.tree.getNodes(expandedSelectionForShapeStylesIds)\n\t\t\tlet anyNodesWithDynamicStrokeWidth: boolean = false\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tif (!supportsBoxShadow(node) || !node.boxShadows || isDynamicValue(node.boxShadows)) return\n\t\t\t\tconst shadow = node.boxShadows[index]\n\t\t\t\tif (!shadow) return\n\n\t\t\t\tconst newDefaults = type === \"box\" ? shadowDefaultsForIndex(index) : { y: 10, diffusion: 0.25 }\n\n\t\t\t\tnode.set({\n\t\t\t\t\tboxShadows: List.replace(\n\t\t\t\t\t\tnode.boxShadows || [],\n\t\t\t\t\t\tindex,\n\t\t\t\t\t\tgetUpdatedShadow(shadow, {\n\t\t\t\t\t\t\t...newDefaults,\n\t\t\t\t\t\t\t...update,\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t})\n\n\t\t\t\tanyNodesWithDynamicStrokeWidth ||= hasDynamicStrokeWidth(node)\n\t\t\t})\n\n\t\t\tif (anyNodesWithDynamicStrokeWidth) {\n\t\t\t\ttoastIncompatibleStrokWidthAndShadows()\n\t\t\t}\n\t\t},\n\t)\n\n\tconst displayContextMenuForItem = async (event: React.MouseEvent, index: number) => {\n\t\t// Prevent native context menu from showing up\n\t\tevent.preventDefault()\n\n\t\t// Prevent row context menu from showing up\n\t\tevent.stopPropagation()\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Copy\",\n\t\t\t\t\tclick: () => copyShadow(index),\n\t\t\t\t\tenabled: !isReadOnly && canCopySingleShadow(index),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: await getPasteTitle(),\n\t\t\t\t\tclick: () => pasteShadow(index),\n\t\t\t\t\tenabled: !isReadOnly && (await canPasteShadow()),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodeIds = props.expandedSelectionForShapeStylesIds\n\t\t\t\t\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tif (supportsBoxShadow(node) && node.boxShadows && !isDynamicValue(node.boxShadows)) {\n\t\t\t\t\t\t\t\tconst shadow = node.boxShadows[index]\n\t\t\t\t\t\t\t\tif (!shadow) return\n\t\t\t\t\t\t\t\tnode.set({\n\t\t\t\t\t\t\t\t\tboxShadows: List.insert(node.boxShadows, index, getDuplicatedShadow(shadow)),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (withShadow(node) && node.shadows) {\n\t\t\t\t\t\t\t\tconst shadow = node.shadows[index]\n\t\t\t\t\t\t\t\tif (!shadow) return\n\t\t\t\t\t\t\t\tnode.set({ shadows: List.insert(node.shadows, index, getDuplicatedShadow(shadow)) })\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\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tclick: () => removeItem(index),\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\tconst shadowCount = isArray(shadows) ? shadows.length : 0\n\tconst anyShadow = shadowCount > 0 || isDynamicValue(shadows)\n\tconst canSort = shadowCount > 1\n\n\tconst supportsVariables = onlyNodesSupportingRealisticShadows\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Shadows\"\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tsupportsComputedValues={supportsVariables}\n\t\t\tdynamicValue={isDynamicValue(shadows) ? shadows : null}\n\t\t\tvariableType={ControlType.BoxShadow}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={updateDynamicBoxShadows}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonAdd={addItem}\n\t\t\tonDelete={removeAll}\n\t\t\tdeleteEnabled={canRemoveShadows()}\n\t\t\tonCopy={copyAllShadows}\n\t\t\tcopyEnabled={canCopyShadow}\n\t\t\tcopyTitle={shadowCount > 1 ? \"Copy All\" : \"Copy\"}\n\t\t\tonPaste={pasteAllShadows}\n\t\t\tpasteEnabled={canPasteShadow}\n\t\t\tpasteTitle={getPasteTitle}\n\t\t\tdeleteTitle={shadowCount > 1 ? \"Remove All\" : Dictionary.Remove}\n\t\t\ttraitTypes={shadowTraitTypes}\n\t\t>\n\t\t\t{isDynamicValue(shadows) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Shadows\"\n\t\t\t\t\tvalue={shadows}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.BoxShadow}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicBoxShadows}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t\t{anyShadow && (\n\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\tenabled={canSort}\n\t\t\t\t\t\t\tclassName={classes.sortable}\n\t\t\t\t\t\t\titems={isArray(shadows) ? shadows : []}\n\t\t\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\tremoveItem={removeItem}\n\t\t\t\t\t\t\tonDragStart={dismissPopoutOnDrag ? popoutWindow.close : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{({ item: shadow, index }) => (\n\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\tid={shadow.id}\n\t\t\t\t\t\t\t\t\tkey={shadow.id}\n\t\t\t\t\t\t\t\t\ttitle={buttonTitleForShadow(shadow)}\n\t\t\t\t\t\t\t\t\tnavigationTitle={Dictionary.Shadow}\n\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t<ShadowPopout\n\t\t\t\t\t\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={onlyNodesSupportingRealisticShadows}\n\t\t\t\t\t\t\t\t\t\t\tanyShapeNode={anyShapeNode}\n\t\t\t\t\t\t\t\t\t\t\ttype={shadow.type}\n\t\t\t\t\t\t\t\t\t\t\tcolor={shadow.color}\n\t\t\t\t\t\t\t\t\t\t\tx={shadow.x}\n\t\t\t\t\t\t\t\t\t\t\ty={shadow.y}\n\t\t\t\t\t\t\t\t\t\t\tblur={shadow.blur}\n\t\t\t\t\t\t\t\t\t\t\tinset={shadow.inset}\n\t\t\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\t\t\tspread={shadow.spread}\n\t\t\t\t\t\t\t\t\t\t\tdiffusion={shadow.diffusion}\n\t\t\t\t\t\t\t\t\t\t\tfocus={shadow.focus}\n\t\t\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t\t\t\twithSpread={onlyNodesSupportingShadowSpread}\n\t\t\t\t\t\t\t\t\t\t\twithInset={onlyNodesSupportingShadowInset}\n\t\t\t\t\t\t\t\t\t\t\tonChangeType={onChangeShadowType}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\tonDelete={() => removeItem(index)}\n\t\t\t\t\t\t\t\t\tonContextMenu={event => displayContextMenuForItem(event, index)}\n\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t<PopoutButtonBackgroundPreview background={isString(shadow.color) ? shadow.color : \"white\"} />\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</Sortable>\n\t\t\t\t\t)}\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"shadow\" onClick={addItem} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n\nexport function buttonTitleForShadow(shadow: ReducedShadow) {\n\tif (shadow.type === \"realistic\") {\n\t\treturn \"Realistic\"\n\t} else if (isNotFound(shadow.type) || shadow.type === \"box\") {\n\t\tif (isNumber(shadow.x) && isNumber(shadow.y) && isNumber(shadow.blur)) {\n\t\t\tconst simpleShadow = `${shadow.x}, ${shadow.y}, ${shadow.blur}`\n\t\t\treturn isNumber(shadow.spread) && shadow.spread !== 0 ? `${simpleShadow}, ${shadow.spread}` : simpleShadow\n\t\t}\n\t}\n\n\treturn Dictionary.Mixed\n}\n", "import {\n\tNumberInputWithTicker,\n\tNumberInputWithTickerAndStepper,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tSlider,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport { isColorStyleTokenNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isFound, isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedShadow } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport { isTokenCSSVariable, tokenIdFromCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport React from \"react\"\nimport { isBoolean, isNumber, isString } from \"utils/typeChecks.ts\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface ShadowPopoutProps extends Omit<ReducedShadow, \"id\"> {\n\twithSpread: boolean\n\twithInset: boolean\n\tonlyNodesSupportingRealisticShadows: boolean\n\tanyShapeNode: boolean\n\tonChange: <K extends keyof BoxShadow>(key: K, index: number) => (value: BoxShadow[K]) => void\n\tonChangeType: (index: number, type: BoxShadow[\"type\"], update: Partial<BoxShadow>) => void\n\tindex: number\n}\n\ninterface ShadowSettings {\n\trealistic: Partial<BoxShadow>\n\tbox: Partial<BoxShadow>\n}\n\nexport const fallbackShadowColor = \"rgba(0,0,0,.5)\"\n\nexport const ShadowPopout = React.memo(function ShadowPopout({\n\ttype,\n\tcolor: reducedColor,\n\tx,\n\ty,\n\tblur,\n\tinset,\n\tspread,\n\tfocus = 0.5,\n\tdiffusion = 0.5,\n\tonlyNodesSupportingRealisticShadows,\n\tanyShapeNode,\n\twithSpread,\n\twithInset,\n\tonChange,\n\tonChangeType,\n\tindex,\n}: ShadowPopoutProps) {\n\t/**\n\t * Keeps the current settings in memory so we can restore the\n\t * other shadow's settings when we switch back and forth\n\t */\n\tconst suspendedShadowSettings = React.useRef<ShadowSettings>({\n\t\trealistic: {},\n\t\tbox: {},\n\t})\n\n\tconst isNotRealisticShadow = type !== \"realistic\"\n\n\tconst color = isFoundAndNotUndefined(reducedColor) ? reducedColor : fallbackShadowColor\n\n\tconst updateX = onChange(\"x\", index)\n\tconst updateY = onChange(\"y\", index)\n\tconst updateBlur = onChange(\"blur\", index)\n\tconst updateSpread = onChange(\"spread\", index)\n\tconst updateDiffusion = onChange(\"diffusion\", index)\n\tconst updateFocus = onChange(\"focus\", index)\n\tconst updateInset = onChange(\"inset\", index)\n\tconst updateColor = onChange(\"color\", index)\n\n\tconst changeShadowType = engine.scheduler.wrapHandler((newType: BoxShadow[\"type\"]) => {\n\t\tif (newType === type) return\n\t\tlet nextColor = isString(color) ? color : fallbackShadowColor\n\t\tif (newType === \"realistic\" && isTokenCSSVariable(color)) {\n\t\t\tconst colorStyle = engine.tree.get(tokenIdFromCSSVariable(color))\n\t\t\tif (isColorStyleTokenNode(colorStyle)) nextColor = colorStyle.light\n\t\t}\n\n\t\tonChangeType(index, newType, {\n\t\t\t...suspendedShadowSettings.current[newType],\n\t\t\tinset: isBoolean(inset) ? inset : false,\n\t\t\tcolor: nextColor,\n\t\t})\n\n\t\tif (type) {\n\t\t\tsuspendedShadowSettings.current[type] = {\n\t\t\t\tx: isNumber(x) ? x : undefined,\n\t\t\t\ty: isNumber(y) ? y : undefined,\n\t\t\t\tblur: isNumber(blur) ? blur : undefined,\n\t\t\t\tspread: isNumber(spread) ? spread : undefined,\n\t\t\t\tfocus: isNumber(focus) ? focus : undefined,\n\t\t\t\tdiffusion: isNumber(diffusion) ? diffusion : undefined,\n\t\t\t}\n\t\t}\n\t})\n\n\treturn (\n\t\t<Stack gap={0} padding={`${dimensions.css.inputSpacing} ${dimensions.css.popoverPadding}`}>\n\t\t\t{onlyNodesSupportingRealisticShadows && (\n\t\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem<BoxShadow[\"type\"]>\n\t\t\t\t\t\t\ttitle=\"Box\"\n\t\t\t\t\t\t\tidentifier=\"box\"\n\t\t\t\t\t\t\tselected={type === \"box\"}\n\t\t\t\t\t\t\tonSelect={changeShadowType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem<BoxShadow[\"type\"]>\n\t\t\t\t\t\t\ttitle=\"Realistic\"\n\t\t\t\t\t\t\tidentifier=\"realistic\"\n\t\t\t\t\t\t\tselected={type === \"realistic\"}\n\t\t\t\t\t\t\tonSelect={changeShadowType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{withInset && isFound(inset) && (\n\t\t\t\t<PanelRow title=\"Position\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle=\"Outside\"\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\tselected={inset === false}\n\t\t\t\t\t\t\tonSelect={updateInset}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem title=\"Inside\" identifier selected={inset === true} onSelect={updateInset} />\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t<PanelRow title=\"Color\">\n\t\t\t\t<ColorPopoutButton\n\t\t\t\t\tnavigationTitle=\"Color\"\n\t\t\t\t\tvalue={color}\n\t\t\t\t\tonChange={updateColor}\n\t\t\t\t\tallowColorStyles={type === \"box\" && !anyShapeNode}\n\t\t\t\t\tshowAlphaInButton\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"X\">\n\t\t\t\t<NumberInputWithTickerAndStepper value={isFound(x) ? x : 0} onChange={updateX} defaultValue={0} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Y\">\n\t\t\t\t<NumberInputWithTickerAndStepper value={isFound(y) ? y : 0} onChange={updateY} defaultValue={0} />\n\t\t\t</PanelRow>\n\t\t\t{isNotRealisticShadow ? (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"Blur\">\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tvalue={isFound(blur) ? blur : 0}\n\t\t\t\t\t\t\tonChange={updateBlur}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t{withSpread && (\n\t\t\t\t\t\t<PanelRow title=\"Spread\">\n\t\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\t\tvalue={isFound(spread) ? spread : 0}\n\t\t\t\t\t\t\t\tonChange={updateSpread}\n\t\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"Diffusion\">\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={isFound(diffusion) ? diffusion : 0}\n\t\t\t\t\t\t\tonChange={updateDiffusion}\n\t\t\t\t\t\t\tdefaultValue={0.5}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tmax={1}\n\t\t\t\t\t\t\tstep={0.05}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Slider value={isFound(diffusion) ? diffusion : 0} onChange={updateDiffusion} min={0} max={1} step={0.05} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Focus\">\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={isFound(focus) ? focus : 0}\n\t\t\t\t\t\t\tonChange={updateFocus}\n\t\t\t\t\t\t\tdefaultValue={0.5}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tmax={1}\n\t\t\t\t\t\t\tstep={0.05}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Slider value={isFound(focus) ? focus : 0} onChange={updateFocus} min={0} max={1} step={0.05} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n", "import \"sortablePanelRows.styles_157jqa2.wyw.css\"; export const sortable = \"sortable_s4wmu4g\";", "import type { Writeable } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { supportsBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { hasDynamicStrokeWidth } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport type { ReducedShadowList } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { BoxShadow, Shadow } from \"document/models/Shadow.ts\"\nimport { createBoxShadow, createShadow } from \"document/models/Shadow.ts\"\nimport { toastIncompatibleStrokWidthAndShadows } from \"document/utils/toastIncompatibleStrokeWidthAndShadows.ts\"\nimport { isArray, isNumber } from \"utils/typeChecks.ts\"\n\nexport function shadowDefaultsForIndex(index: number): Writeable<Partial<BoxShadow & Shadow>> {\n\treturn {\n\t\ty: Math.pow(2, index),\n\t\tblur: Math.pow(2, index + 1),\n\t}\n}\n\nexport const addShadowForNodes = (engine: VekterEngine, nodeIds: NodeID[], shadows: ReducedShadowList) => {\n\tlet anyNodesWithDynamicStrokeWidth: boolean = false\n\n\tconst nodes = engine.tree.getNodes(nodeIds)\n\t// We create a new shadow list when the amount of shadows is unequal among nodes\n\tconst shadowCount = isArray(shadows) ? shadows.length : 0\n\tconst shouldCreateNewList = shadowCount === 0\n\tconst id = randomID()\n\tconst shadowSettings = { id, ...shadowDefaultsForIndex(isNumber(shadowCount) ? shadowCount : 0) }\n\n\tconst tree = engine.tree\n\tfor (const node of nodes) {\n\t\tif (supportsBoxShadow(node)) {\n\t\t\tconst shadow = createBoxShadow(shadowSettings)\n\t\t\tconst boxShadows =\n\t\t\t\tshouldCreateNewList || isDynamicValue(node.boxShadows) || !node.boxShadows\n\t\t\t\t\t? [shadow]\n\t\t\t\t\t: node.boxShadows.concat(shadow)\n\t\t\tnode.set({ boxShadows }, tree)\n\t\t}\n\t\tif (withShadow(node)) {\n\t\t\tconst shadow = createShadow(shadowSettings)\n\t\t\tconst shadows = shouldCreateNewList || !node.shadows ? [shadow] : node.shadows.concat(shadow)\n\t\t\tnode.set({ shadows }, tree)\n\t\t}\n\n\t\tanyNodesWithDynamicStrokeWidth ||= hasDynamicStrokeWidth(node)\n\t}\n\tif (anyNodesWithDynamicStrokeWidth) {\n\t\ttoastIncompatibleStrokWidthAndShadows()\n\t}\n\n\tpopoutWindow.navigation.presentPopoutOnRegistration(id)\n}\n", "import \"BoxShadowControlPropRow.styles_1dh6tks.wyw.css\"; export const sortable = \"sortable_slge2ga\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport {\n\ttype CollectionReferenceVariableDefinition,\n\tisOptionalVariable,\n\ttype VariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { CollectionReferenceInput } from \"../../contentManagement/CollectionReferenceInput.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: CollectionReferenceVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailCollectionReference({ variable, scopeType, onUpdate }: Props) {\n\tconst dataDefinition = engine.componentLoader.dataForIdentifier(variable.dataIdentifier)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tfunction updateInitialValue(initialValue: string | undefined) {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title={Dictionary.Collection}>\n\t\t\t\t<PopupButton enabled={false} wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem selected title={dataDefinition?.name ?? Dictionary.Unknown} />\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\n\t\t\t{!isOptional && (\n\t\t\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t\t\t<CollectionReferenceInput\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\tdataIdentifier={variable.dataIdentifier}\n\t\t\t\t\t\tvalue={variable.initialValue}\n\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t\toptional={variable.optional}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { ColorVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { ColorPopoutButton } from \"../ColorPicker/ColorPopoutButton.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: ColorVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailColor({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst updateInitialValue = (initialValue: string) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<ColorPopoutButton\n\t\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\t\tnavigationTitle=\"Value\"\n\t\t\t\tvalue={variable.initialValue}\n\t\t\t\tonChange={updateInitialValue}\n\t\t\t\tshowAlphaInButton\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tControlReferenceVariableDefinition,\n\tNodePropertyControlReferenceVariableDefinition,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable, isOptionalVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp, EnumControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { EnumControlPropRow } from \"../../properties/codeComponentRows/EnumControlPropRow.tsx\"\nimport { FileControlPropRow } from \"../../properties/codeComponentRows/FileControlPropRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: ControlReferenceVariableDefinition | NodePropertyControlReferenceVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailControlReference({ variable, scopeType, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst updateInitialValue = ({ value }: ControlProp) => {\n\t\tupdateVariable({ initialValue: value })\n\t}\n\n\tassert(\n\t\tvariable.expectedType === ControlType.Enum ||\n\t\t\tvariable.expectedType === ControlType.SegmentedEnum ||\n\t\t\tvariable.expectedType === ControlType.File,\n\t\t\"only enum and file variable references are supported for now\",\n\t)\n\n\tconst control = controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType)\n\n\tif (!control) {\n\t\treturn <PanelRow title=\"Enum definition can't be found\" />\n\t}\n\n\tif (isOptional) {\n\t\treturn null\n\t}\n\n\tswitch (control.type) {\n\t\tcase ControlType.Enum:\n\t\t\treturn (\n\t\t\t\t<EnumControlPropRow\n\t\t\t\t\tcontrolKey={Dictionary.Default}\n\t\t\t\t\tcontrolProp={{ type: ControlType.Enum, value: variable.initialValue as EnumControlPropValue }}\n\t\t\t\t\tcontrol={{ ...control, title: Dictionary.Default }}\n\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.File:\n\t\t\treturn (\n\t\t\t\t<FileControlPropRow\n\t\t\t\t\tcontrolKey={Dictionary.Default}\n\t\t\t\t\tcontrol={{ ...control, title: Dictionary.Default }}\n\t\t\t\t\tcontrolProp={{\n\t\t\t\t\t\ttype: ControlType.File,\n\t\t\t\t\t\tvalue: isString(variable.initialValue) ? variable.initialValue : undefined,\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t/>\n\t\t\t)\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n", "import { Scroll, useReadOnly } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { CSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { cssCursors } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React, { memo, useEffect, useRef } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { CursorIcon } from \"../panels/cursorIcons/CursorIcon.tsx\"\nimport * as styles from \"./CursorPopout.styles.ts\"\n\ninterface Props {\n\tpopoutId: string\n\ttitle?: string\n\tcursor: Reduced<CSSCursor | undefined>\n\tonChange: (cursor: CSSCursor) => void\n\tonDelete?: () => void\n\tdisplayInPopover?: boolean\n}\n\nexport const CursorPopoutButton = memo(\n\t({ popoutId, cursor, title, onChange, onDelete, displayInPopover = false }: Props) => {\n\t\treturn (\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={popoutId}\n\t\t\t\tpopout={<WebCursorPopout selectedCursor={cursor} onChange={onChange} />}\n\t\t\t\tnavigationTitle={title || Dictionary.Cursor}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={<div className={styles.container}>{hasCSSCursor(cursor) && <CursorIcon cursor={cursor} />}</div>}\n\t\t\t\ttitle={getTitle(cursor)}\n\t\t\t\tdisplayInPopover={displayInPopover}\n\t\t\t\tdisplayDivider\n\t\t\t/>\n\t\t)\n\t},\n)\n\ninterface WebCursorPopoutProps {\n\tselectedCursor: Reduced<CSSCursor | undefined>\n\tonChange: (cursor: CSSCursor) => void\n}\n\nconst WebCursorPopout = React.memo(function WebCursorPopout({ selectedCursor, onChange }: WebCursorPopoutProps) {\n\tconst isReadOnly = useReadOnly()\n\tconst cursorRefs = useRef<{ [key: string]: HTMLDivElement | null }>({})\n\n\tuseEffect(() => {\n\t\tif (selectedCursor && cursorRefs.current[String(selectedCursor)]) {\n\t\t\tcursorRefs.current[String(selectedCursor)]?.scrollIntoView({\n\t\t\t\tbehavior: \"smooth\",\n\t\t\t\tblock: \"nearest\",\n\t\t\t\tinline: \"start\",\n\t\t\t})\n\t\t}\n\t}, [selectedCursor])\n\n\treturn (\n\t\t<Scroll className={styles.panelContent}>\n\t\t\t<div className={cx(styles.grid, isReadOnly && styles.gridDisabled)}>\n\t\t\t\t{cssCursors.map(cursor => (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={cursor}\n\t\t\t\t\t\ttitle={cursor}\n\t\t\t\t\t\tclassName={cx(styles.cell, cursor === selectedCursor && styles.selected)}\n\t\t\t\t\t\tref={el => (cursorRefs.current[cursor] = el)}\n\t\t\t\t\t\tonClick={() => onChange(cursor)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className={styles.icon}>\n\t\t\t\t\t\t\t<CursorIcon cursor={cursor} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</Scroll>\n\t)\n})\n\nfunction hasCSSCursor(cursor: Reduced<CSSCursor | DynamicValue | undefined>): cursor is CSSCursor {\n\treturn isString(cursor) && cssCursors.includes(cursor)\n}\n\nfunction getTitle(cursor: Reduced<CSSCursor | DynamicValue | undefined>) {\n\tif (isMixed(cursor)) return Dictionary.Mixed\n\tif (isUndefined(cursor)) return Dictionary.Auto\n\tif (hasCSSCursor(cursor)) return titleCase(cursor)\n\n\treturn \"\"\n}\n", "export const AliasCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\">\n\t\t\t<path\n\t\t\t\tfill=\"#231F20\"\n\t\t\t\td=\"M15.486 23.995c-.17 0-.284-.076-.492-.397-.719-1.117-1.173-2.498-1.173-3.766 0-1.91.53-3.368 2.48-5.373l2.553 2.63c-2.422 1.986-3.065 3.52-2.97 6.452.018.303-.17.454-.398.454Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tstroke=\"#FFF\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"M15.486 23.995c-.17 0-.284-.076-.492-.397-.719-1.117-1.173-2.498-1.173-3.766 0-1.91.53-3.368 2.48-5.373l2.553 2.63c-2.422 1.986-3.065 3.52-2.97 6.452.018.303-.17.454-.398.454Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"m19.73 19.887-6.28-6.28c-.962-.962-.28-2.607 1.08-2.607h6.24c.865 0 1.568.702 1.568 1.569v6.238c0 1.361-1.646 2.042-2.608 1.08Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#030404\"\n\t\t\t\td=\"m20.484 19.08-6.227-6.227a.5.5 0 0 1 .354-.853h6.127a.6.6 0 0 1 .6.6v6.126a.5.5 0 0 1-.854.354Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#030404\"\n\t\t\t\td=\"M15.486 23.995c-.17 0-.284-.076-.492-.397-.719-1.117-1.173-2.498-1.173-3.766 0-1.91.53-3.368 2.48-5.373l2.553 2.63c-2.422 1.986-3.065 3.52-2.97 6.452.018.303-.17.454-.398.454Z\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "export const CellCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M19.5 21.978c0 .668-.032 1.222-.442 1.755-.368.48-.95.767-1.558.767-.608 0-1.19-.287-1.558-.767-.41-.533-.442-1.087-.442-1.755v-8.957c0-.668.032-1.221.442-1.755.368-.48.95-.766 1.558-.766.608 0 1.19.286 1.558.766.41.534.442 1.087.442 1.755v8.957Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M13.022 19.5c-.668 0-1.222-.032-1.755-.442A1.974 1.974 0 0 1 10.5 17.5c0-.608.287-1.19.767-1.558.533-.41 1.087-.442 1.755-.442h8.957c.668 0 1.221.032 1.755.442.48.368.766.95.766 1.558 0 .608-.286 1.19-.766 1.558-.534.41-1.087.442-1.755.442h-8.957Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M12.761 18.5c-.334 0-.61-.016-.878-.221a.986.986 0 0 1 0-1.558c.267-.205.544-.221.878-.221h9.478c.334 0 .611.016.878.22a.986.986 0 0 1 0 1.559c-.267.205-.544.22-.878.22h-9.478Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M18.5 22.239c0 .334-.016.61-.22.878a.986.986 0 0 1-1.559 0c-.205-.267-.22-.544-.22-.878V12.76c0-.334.015-.611.22-.878a.986.986 0 0 1 1.558 0c.205.267.221.544.221.878v9.478Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "// From macOS Tahoe resizeleftright.svg (30x24), centered in 35x35\n// Same as ResizeEastWestCursor\nexport const ColResizeCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(2.5, 5.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 15 19 C 13.898438 19 13 18.101562 13 17 L 13 7 C 13 5.898438 13.898438 5 15 5 C 16.101562 5 17 5.898438 17 7 L 17 17 C 17 18.101562 16.101562 19 15 19\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 15 18 C 14.449219 18 14 17.550781 14 17 L 14 7 C 14 6.449219 14.449219 6 15 6 C 15.550781 6 16 6.449219 16 7 L 16 17 C 16 17.550781 15.550781 18 15 18\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 20.382812 15.785156 C 19.621094 15.785156 19 15.164062 19 14.402344 L 19 9.636719 C 19 8.875 19.621094 8.253906 20.382812 8.253906 C 20.597656 8.253906 20.8125 8.304688 21 8.402344 L 25.761719 10.785156 C 26.234375 11.019531 26.527344 11.492188 26.527344 12.019531 C 26.527344 12.546875 26.234375 13.019531 25.761719 13.257812 L 21 15.640625 C 20.808594 15.734375 20.597656 15.785156 20.382812 15.785156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 25.316406 11.675781 L 20.554688 9.296875 C 20.300781 9.167969 20 9.351562 20 9.636719 L 20 14.402344 C 20 14.6875 20.300781 14.871094 20.554688 14.746094 L 25.316406 12.363281 C 25.597656 12.21875 25.597656 11.820312 25.316406 11.675781\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 9.617188 15.785156 C 9.40625 15.785156 9.191406 15.734375 9 15.640625 L 4.238281 13.257812 C 3.765625 13.019531 3.472656 12.546875 3.472656 12.019531 C 3.472656 11.492188 3.765625 11.019531 4.238281 10.785156 L 9 8.402344 C 9.191406 8.304688 9.402344 8.253906 9.617188 8.253906 C 10.378906 8.253906 11 8.875 11 9.636719 L 11 14.402344 C 11 14.78125 10.851562 15.136719 10.578125 15.398438 C 10.316406 15.648438 9.976562 15.785156 9.617188 15.785156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.683594 12.363281 L 9.445312 14.742188 C 9.699219 14.871094 10 14.6875 10 14.402344 L 10 9.636719 C 10 9.351562 9.699219 9.167969 9.445312 9.296875 L 4.683594 11.679688 C 4.402344 11.820312 4.402344 12.222656 4.683594 12.363281\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "export const ContextMenuCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fillRule=\"evenodd\" clipPath=\"url(#contextmenu-a)\" clipRule=\"evenodd\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"m9.642 2.284 9.169 9.19c1.151 1.154.334 3.125-1.296 3.125l-3.77-.001-2.7 2.39C9.863 18.033 8 17.195 8 15.615V2.964c0-.858 1.036-1.287 1.642-.68Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M9.093 3.673V15.59a.75.75 0 0 0 1.246.561l2.991-2.648 4.157.001a.75.75 0 0 0 .53-1.278l-8.65-8.668a.16.16 0 0 0-.274.114Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M24.285 33.192h-8.509a2.308 2.308 0 0 1-2.307-2.309V19.095a2.308 2.308 0 0 1 2.307-2.309h8.509a2.309 2.309 0 0 1 2.308 2.309v11.788a2.309 2.309 0 0 1-2.308 2.31Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M24.132 32.099H15.93a1.368 1.368 0 0 1-1.367-1.368V19.247c0-.755.613-1.367 1.367-1.367h8.203c.755 0 1.367.612 1.367 1.367V30.73c0 .755-.612 1.367-1.367 1.367Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M22.765 21.161h-5.469a.547.547 0 0 1 0-1.094h5.47a.547.547 0 0 1 0 1.094ZM22.765 29.911h-5.469a.547.547 0 0 1 0-1.094h5.47a.547.547 0 0 1 0 1.094ZM23.379 26.63h-6.697c-.567 0-1.026-.46-1.026-1.027v-1.228c0-.567.46-1.026 1.026-1.026h6.697c.567 0 1.027.459 1.027 1.026v1.228c0 .567-.46 1.027-1.027 1.027Z\"\n\t\t\t/>\n\t\t\t<path fill=\"#000\" d=\"M20.578 25.536h-3.282a.547.547 0 0 1 0-1.094h3.282a.547.547 0 0 1 0 1.094Z\" />\n\t\t</g>\n\t\t<defs>\n\t\t\t<clipPath id=\"contextmenu-a\">\n\t\t\t\t<path fill=\"#fff\" d=\"M0 0h18.593v31.192H0z\" transform=\"translate(8 2)\" />\n\t\t\t</clipPath>\n\t\t</defs>\n\t</svg>\n)\n", "export const CopyCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<defs>\n\t\t\t\t<linearGradient id=\"copy-gradient\" x1=\"50%\" x2=\"50%\" y1=\"0%\" y2=\"100%\">\n\t\t\t\t\t<stop offset=\"0%\" stopColor=\"#5BD230\" />\n\t\t\t\t\t<stop offset=\"100%\" stopColor=\"#068B03\" />\n\t\t\t\t</linearGradient>\n\t\t\t</defs>\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path fill=\"url(#copy-gradient)\" d=\"M9 24a9 9 0 1 0 18.001-.001A9 9 0 0 0 9 24Z\" />\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M22 23h-3v-3a1 1 0 0 0-2 0v3h-3a1 1 0 0 0 0 2h3v3a1 1 0 0 0 2 0v-3h3a1 1 0 0 0 0-2Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"m9.502 1.742 8.382 8.4c1.053 1.056.306 2.859-1.184 2.859l-3.447-.002-2.469 2.185C9.704 16.142 8 15.374 8 13.93V2.363c0-.784.947-1.176 1.502-.621Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M9 3.01v10.898c0 .59.697.904 1.139.513L12.874 12h3.8c.61 0 .916-.736.485-1.168L9.251 2.907A.147.147 0 0 0 9 3.01Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const CrosshairCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M18.047 9.844c.905 0 1.64.735 1.64 1.64v4.922h4.922c.853 0 1.554.651 1.633 1.483l.008.158c0 .905-.735 1.64-1.64 1.64h-4.922v4.922c0 .853-.652 1.554-1.483 1.633l-.158.008c-.906 0-1.64-.735-1.64-1.64v-4.922h-4.923a1.642 1.642 0 0 1-1.633-1.483l-.007-.158c0-.906.735-1.64 1.64-1.64h4.922v-4.923c0-.852.651-1.553 1.483-1.633l.158-.007Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#232020\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M18.047 10.938c.302 0 .547.244.547.546V17.5h6.015c.269 0 .492.194.538.449l.01.098a.547.547 0 0 1-.548.547h-6.015v6.015a.547.547 0 0 1-.449.538l-.098.01a.547.547 0 0 1-.547-.548v-6.015h-6.016a.547.547 0 0 1-.538-.449l-.008-.098c0-.302.244-.547.546-.547H17.5v-6.016c0-.268.194-.491.449-.538l.098-.008Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const DefaultCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"m13.642 8.284 9.169 9.19c1.151 1.154.334 3.125-1.296 3.125h-1.34l1.33 3.158a2.24 2.24 0 0 1 .01 1.723 2.25 2.25 0 0 1-4.163.023l-1.397-3.323-.91.808C13.863 24.033 12 23.195 12 21.615V8.964c0-.858 1.036-1.287 1.642-.68Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M13.093 9.673a.16.16 0 0 1 .275-.114l8.65 8.668a.75.75 0 0 1-.531 1.278l-2.958-.001 1.968 4.676a1.158 1.158 0 0 1-2.136.9l-1.988-4.73-2.034 1.802a.75.75 0 0 1-1.238-.45l-.008-.11V9.671Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const GrabCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M18.396 27.168c-1.02 0-1.954-.184-2.776-.546-.828-.366-1.573-.93-2.212-1.676-.624-.727-1.175-1.658-1.64-2.765l-2.091-5.146c-.154-.373-.172-.73-.052-1.059.132-.353.392-.604.755-.725.131-.047.278-.074.423-.074.18 0 .354.04.519.12.273.133.5.37.674.707l1.735 3.127c.114.197.2.269.23.29a.256.256 0 0 0 .154.045c.073 0 .118-.02.169-.077.02-.024.051-.128.013-.354L13.09 11.34c-.083-.483.064-.818.203-1.013a1.249 1.249 0 0 1 1.021-.532A1.307 1.307 0 0 1 15.61 10.9l1.19 5.613.066-6.594c0-.373.124-.703.36-.953.243-.258.569-.394.94-.394.373 0 .704.132.954.384.252.25.384.585.384.966l-.038 6.618 1.036-5.738c.052-.357.23-.664.512-.873a1.236 1.236 0 0 1 .97-.235c.355.054.658.233.866.513.149.199.308.541.22 1.038l-.946 5.814 1.335-3.792c.11-.345.299-.614.558-.785a1.246 1.246 0 0 1 .887-.201c.36.062.642.241.832.522.184.274.25.6.196.967l-1.246 7.192c-.35 2.02-1.022 3.569-2 4.6-1.006 1.065-2.45 1.605-4.29 1.605Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"m24.15 20.87 1.245-7.18c.033-.23-.003-.425-.11-.582a.658.658 0 0 0-.455-.289.717.717 0 0 0-.512.115c-.154.103-.27.273-.347.513l-1.306 3.718a.66.66 0 0 1-.251.345.505.505 0 0 1-.377.065.548.548 0 0 1-.34-.211.521.521 0 0 1-.11-.392l.95-5.82c.042-.247.002-.455-.123-.621a.761.761 0 0 0-.518-.3.698.698 0 0 0-.558.134.77.77 0 0 0-.301.531l-1.026 5.807a.517.517 0 0 1-.199.339.483.483 0 0 1-.39.084c-.171-.026-.297-.09-.379-.192a.624.624 0 0 1-.121-.398l.038-6.614a.79.79 0 0 0-.224-.583.777.777 0 0 0-.57-.224.715.715 0 0 0-.545.224.817.817 0 0 0-.212.583l-.038 6.665a.514.514 0 0 1-.16.385.528.528 0 0 1-.378.154.523.523 0 0 1-.366-.135.674.674 0 0 1-.199-.366L15.076 11a.77.77 0 0 0-.314-.52.782.782 0 0 0-.558-.134.697.697 0 0 0-.467.295c-.116.162-.152.368-.11.615l1.206 7.691c.06.359.012.626-.14.8a.736.736 0 0 1-.578.265.793.793 0 0 1-.46-.142c-.137-.094-.271-.252-.399-.474l-1.742-3.14c-.12-.231-.264-.388-.43-.469a.66.66 0 0 0-.532-.02.634.634 0 0 0-.416.399c-.074.196-.058.418.044.666l2.09 5.14c.444 1.06.96 1.933 1.55 2.621.59.688 1.263 1.199 2.02 1.531.755.334 1.607.5 2.556.5 1.692 0 2.991-.478 3.897-1.435.905-.957 1.525-2.396 1.858-4.319Zm-12.932 1.472L9.181 17.32a2.176 2.176 0 0 1-.173-1.026 1.66 1.66 0 0 1 .307-.847c.175-.238.395-.426.66-.563.264-.13.553-.188.865-.18.312.008.614.098.903.27.291.17.535.43.731.782l1.013 1.936c.026.05.06.072.103.063.042-.009.06-.043.051-.103l-1.09-6.204c-.077-.4-.06-.76.052-1.076.11-.316.29-.573.538-.769.247-.197.534-.32.859-.372.325-.05.636-.02.935.097.3.115.556.305.77.57.213.264.363.594.448.986l.154.834V9.922c0-.564.176-1.025.526-1.384.35-.359.794-.538 1.333-.538.563 0 1.018.184 1.365.551.346.368.518.841.518 1.422l-.025.551c.12-.511.37-.894.75-1.147a1.73 1.73 0 0 1 1.275-.262c.325.05.613.175.865.371.252.197.44.451.564.763.124.311.16.67.11 1.07l-.11 1.015c-.02-.097.096-.223.352-.38a1.794 1.794 0 0 1 1.27-.237c.299.06.561.181.788.365.226.184.392.43.5.737.107.307.125.657.058 1.051l-1.154 7.114c-.36 2.214-1.107 3.903-2.244 5.07-1.136 1.165-2.699 1.75-4.69 1.75-1.684 0-3.106-.46-4.269-1.379-1.162-.918-2.12-2.28-2.87-4.083Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const GrabbingCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M24.185 13.345C23.8 13.0639 23.3713 12.9545 22.8977 13.0191C22.6702 13.0497 22.482 13.1164 22.3256 13.2094C22.3311 13.0355 22.318 12.8703 22.2786 12.715C22.1966 12.3902 22.0434 12.1233 21.8192 11.9133C21.595 11.7033 21.3259 11.5523 21.012 11.4594C20.7277 11.3741 20.4378 11.3489 20.1425 11.385C19.8461 11.4211 19.5814 11.5217 19.3463 11.6891C19.2697 11.7438 19.2128 11.8138 19.1516 11.8805C19.1089 11.805 19.0695 11.7273 19.0094 11.6573C18.8278 11.4473 18.597 11.2855 18.3159 11.1717C18.0348 11.058 17.7363 11 17.4234 11C17.103 11 16.8011 11.058 16.5211 11.1717C16.24 11.2855 16.0081 11.4473 15.8266 11.6573C15.7675 11.7252 15.7303 11.8017 15.6866 11.8761C15.6461 11.8302 15.6122 11.7777 15.5652 11.7372C15.3727 11.5731 15.1463 11.4616 14.8859 11.4003C14.6267 11.3402 14.3653 11.3314 14.1017 11.3741C13.767 11.4233 13.4663 11.5491 13.1983 11.7481C12.9314 11.9472 12.7345 12.2163 12.6055 12.5542C12.4863 12.8703 12.472 13.2444 12.5453 13.6633C11.9219 13.5867 11.3422 13.7683 10.8117 14.22C10.2638 14.687 9.9925 15.422 10.0002 16.4261C10.0067 18.0492 10.3152 19.4908 10.9233 20.7519C11.5325 22.0119 12.3889 22.9973 13.4925 23.705C14.5961 24.4138 15.8747 24.7681 17.3272 24.7681C18.6517 24.7681 19.7838 24.5352 20.7244 24.0681C21.6639 23.6022 22.4252 22.9273 23.0048 22.0436C23.5845 21.162 24.0067 20.0683 24.2703 18.7645C24.4125 18.0755 24.5241 17.3973 24.6072 16.7356C24.6892 16.0728 24.7373 15.3728 24.7505 14.6313C24.7581 14.0548 24.5689 13.6261 24.185 13.345Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M12.7491 14.8337L13.0181 16.2228C13.0684 16.4864 13.1997 16.6548 13.413 16.7248C13.6274 16.797 13.8209 16.762 13.9959 16.6231C14.1699 16.4842 14.2289 16.2873 14.172 16.0303L13.6164 13.3714C13.5519 13.0936 13.6328 12.8693 13.857 12.6987C14.0813 12.5281 14.3295 12.4636 14.6041 12.5062C14.8786 12.5489 15.0547 12.7096 15.1334 12.9875L15.2931 13.5639C15.35 13.7848 15.4834 13.9237 15.6934 13.9806C15.9045 14.0375 16.1047 14.0123 16.2972 13.9062C16.4897 13.799 16.5859 13.6426 16.5859 13.4359V12.6987C16.5859 12.5062 16.6658 12.352 16.8266 12.2339C16.9863 12.1168 17.1809 12.0578 17.4084 12.0578C17.6294 12.0578 17.8197 12.1168 17.9805 12.2339C18.1402 12.352 18.22 12.5062 18.22 12.6987V13.4359C18.22 13.635 18.3163 13.7903 18.5088 13.9007C18.7013 14.0112 18.9014 14.0375 19.1125 13.9806C19.3225 13.9237 19.4559 13.7848 19.5128 13.5639L19.6834 12.9656C19.7556 12.702 19.9263 12.5489 20.1964 12.5062C20.4666 12.4636 20.7149 12.5281 20.9391 12.6987C21.1633 12.8693 21.2464 13.0936 21.1895 13.3714L21.0189 14.3328C20.9686 14.5887 21.0189 14.7889 21.1688 14.9311C21.3175 15.0732 21.4991 15.1411 21.7134 15.1334C21.9267 15.1268 22.0875 15.0481 22.1936 14.8982L22.4714 14.4498C22.5709 14.3 22.7197 14.2136 22.9144 14.1884C23.1102 14.1632 23.2863 14.2037 23.4438 14.3109C23.6002 14.4181 23.6789 14.5712 23.6789 14.7703C23.6789 15.362 23.6363 15.9286 23.5499 16.4689C23.4645 17.0103 23.3399 17.6326 23.1769 18.3381L23.1124 18.6367C22.8641 19.7479 22.5064 20.6634 22.0449 21.382C21.5822 22.1017 20.9675 22.6442 20.2019 23.0106C19.4363 23.3781 18.4902 23.5607 17.3658 23.5607C16.1189 23.5607 15.0263 23.2556 14.0867 22.642C13.1461 22.0306 12.4231 21.1775 11.9178 20.0837C11.4125 18.9911 11.1599 17.7475 11.1599 16.3507C11.1599 15.8531 11.2681 15.4703 11.4858 15.2034C11.7024 14.9354 11.9627 14.7911 12.2656 14.7648C12.4439 14.7506 12.6014 14.7801 12.7491 14.8337Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const HelpCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M14.315 11.881c.606-.488 1.73-.875 2.686-.88 1.514-.01 2.31.455 3.026 1.15.688.67 1.004 1.352.953 2.4-.041.853-.267 1.348-.604 1.811-.198.281-.577.641-1.138 1.078l-.533.43c-.33.32-.474.463-.6.82-.094.266-.116.506-.121.922h-1.977c-.003-1.016-.02-1.375.09-1.813.107-.426.502-.734 1.063-1.17l.568-.447c.188-.14.494-.414.608-.58.208-.287.334-.683.35-1.026a1.53 1.53 0 0 0-.343-1.027c-.312-.39-.703-.638-1.465-.604a2.014 2.014 0 0 0-1.342.622c-.33.34-.474.904-.498 1.35H13.06c.062-1.484.354-2.312 1.254-3.036Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tstroke=\"#FFF\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\td=\"M14.315 11.881c.606-.488 1.73-.875 2.686-.88 1.514-.01 2.31.455 3.026 1.15.688.67 1.004 1.352.953 2.4-.041.853-.267 1.348-.604 1.811-.198.281-.577.641-1.138 1.078l-.533.43c-.33.32-.474.463-.6.82-.094.266-.116.506-.121.922h-1.977c-.003-1.016-.02-1.375.09-1.813.107-.426.502-.734 1.063-1.17l.568-.447c.188-.14.494-.414.608-.58.208-.287.334-.683.35-1.026a1.53 1.53 0 0 0-.343-1.027c-.312-.39-.703-.638-1.465-.604a2.014 2.014 0 0 0-1.342.622c-.33.34-.474.904-.498 1.35H13.06c.062-1.484.354-2.312 1.254-3.036Z\"\n\t\t\t/>\n\t\t\t<path fill=\"#FFF\" d=\"M15.751 20.803h2.474v2.395h-2.474v-2.395Z\" />\n\t\t\t<path stroke=\"#FFF\" strokeWidth=\"1.5\" d=\"M15.751 20.803h2.474v2.395h-2.474v-2.395Z\" />\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M14.515 11.861c.697-.449 1.342-.794 2.426-.794 1.617 0 1.983.242 2.812.904.75.6 1.207 1.376 1.207 2.48 0 .677-.364 1.408-.702 1.871-.197.281-.459.56-1.02.998l-.612.47c-.3.234-.598.588-.697.9-.062.198-.058.623-.062 1.04h-1.86c.031-.88.034-1.606.169-1.942.135-.336.483-.723 1.044-1.16l.547-.446c.187-.14.475-.354.589-.52.208-.287.389-.702.389-1.046 0-.396.022-.676-.209-1.002-.27-.378-.516-.794-1.678-.814-.905-.016-1.291.447-1.542.847-.252.402-.338.858-.338 1.29H13c.063-1.484.541-2.456 1.515-3.076ZM16.012 20.956h1.98v1.984h-1.98v-1.984Z\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe move.svg (24x24), centered in 35x35\nexport const MoveCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(5.5, 5.5)\">\n\t\t\t<path fill=\"#FFF\" d=\"M 14 17 L 10 17 L 10 7 L 14 7 Z M 14 17\" />\n\t\t\t<path fill=\"#FFF\" d=\"M 7 10 L 17 10 L 17 14 L 7 14 Z M 7 10\" />\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 20.492188 11.078125 L 12.921875 3.507812 C 12.414062 3 11.585938 3 11.078125 3.507812 L 3.507812 11.078125 C 3 11.585938 3 12.414062 3.507812 12.921875 L 11.078125 20.492188 C 11.585938 21 12.414062 21 12.921875 20.492188 L 20.492188 12.921875 C 21 12.414062 21 11.585938 20.492188 11.078125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 12.40625 19.59375 L 15.183594 16.816406 C 15.484375 16.515625 15.269531 16 14.84375 16 L 9.15625 16 C 8.730469 16 8.515625 16.515625 8.816406 16.816406 L 11.59375 19.59375 C 11.820312 19.816406 12.183594 19.816406 12.40625 19.59375\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.40625 12.40625 L 7.183594 15.183594 C 7.484375 15.484375 8 15.269531 8 14.84375 L 8 9.15625 C 8 8.730469 7.484375 8.515625 7.183594 8.816406 L 4.40625 11.59375 C 4.183594 11.820312 4.183594 12.183594 4.40625 12.40625\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 16 9.15625 L 16 14.84375 C 16 15.269531 16.515625 15.484375 16.816406 15.183594 L 19.59375 12.40625 C 19.816406 12.179688 19.816406 11.816406 19.59375 11.59375 L 16.816406 8.816406 C 16.515625 8.515625 16 8.730469 16 9.15625\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 11.59375 4.40625 L 8.816406 7.183594 C 8.515625 7.484375 8.730469 8 9.15625 8 L 14.84375 8 C 15.269531 8 15.484375 7.484375 15.183594 7.183594 L 12.40625 4.40625 C 12.179688 4.183594 11.816406 4.183594 11.59375 4.40625\"\n\t\t\t/>\n\t\t\t<path fill=\"#000\" d=\"M 13 17 L 11 17 L 11 7 L 13 7 Z M 13 17\" />\n\t\t\t<path fill=\"#000\" d=\"M 7 11 L 17 11 L 17 13 L 7 13 Z M 7 11\" />\n\t\t</g>\n\t</svg>\n)\n", "export const NoDropCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 35 35\">\n\t\t<g clipPath=\"url(#nodrop-a)\">\n\t\t\t<g clipPath=\"url(#nodrop-b)\">\n\t\t\t\t<mask\n\t\t\t\t\tid=\"nodrop-c\"\n\t\t\t\t\twidth=\"18\"\n\t\t\t\t\theight=\"18\"\n\t\t\t\t\tx=\"9\"\n\t\t\t\t\ty=\"15\"\n\t\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t\t>\n\t\t\t\t\t<path fill=\"#fff\" d=\"M9 24a9 9 0 1 0 18.001-.001A9 9 0 0 0 9 24Z\" />\n\t\t\t\t</mask>\n\t\t\t\t<g mask=\"url(#nodrop-c)\">\n\t\t\t\t\t<path fill=\"url(#nodrop-d)\" d=\"M9 15h18v18H9z\" />\n\t\t\t\t</g>\n\t\t\t\t<mask\n\t\t\t\t\tid=\"nodrop-e\"\n\t\t\t\t\twidth=\"28\"\n\t\t\t\t\theight=\"40\"\n\t\t\t\t\tx=\"4\"\n\t\t\t\t\ty=\"-2\"\n\t\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t\t>\n\t\t\t\t\t<path fill=\"#fff\" d=\"M4-2h28v40H4V-2Z\" />\n\t\t\t\t</mask>\n\t\t\t\t<g mask=\"url(#nodrop-e)\">\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#fff\"\n\t\t\t\t\t\td=\"m9.502 1.742 8.382 8.4c1.053 1.056.306 2.859-1.184 2.859l-3.447-.002-2.469 2.185C9.704 16.142 8 15.374 8 13.93V2.363c0-.784.947-1.176 1.502-.621Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\t\td=\"M9 3.01v10.898c0 .59.697.904 1.139.513L12.874 12h3.8c.61 0 .916-.736.485-1.168L9.251 2.907A.147.147 0 0 0 9 3.01Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#fff\"\n\t\t\t\t\t\td=\"M18 28.498a4.498 4.498 0 1 1 0-8.996 4.498 4.498 0 0 1 0 8.996ZM18 18a6 6 0 1 0 0 12 6 6 0 0 0 0-12Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path fill=\"#fff\" d=\"m21.378 28.622-8-8 1.244-1.244 8 8-1.244 1.244Z\" />\n\t\t\t\t</g>\n\t\t\t</g>\n\t\t</g>\n\t\t<defs>\n\t\t\t<clipPath id=\"nodrop-a\">\n\t\t\t\t<path fill=\"#fff\" d=\"M0 0h35v35H0z\" />\n\t\t\t</clipPath>\n\t\t\t<clipPath id=\"nodrop-b\">\n\t\t\t\t<path fill=\"#fff\" d=\"M0 0h28v40H0z\" transform=\"translate(4 -2)\" />\n\t\t\t</clipPath>\n\t\t\t<pattern id=\"nodrop-d\" width=\"1\" height=\"1\" patternContentUnits=\"objectBoundingBox\">\n\t\t\t\t<use xlinkHref=\"#nodrop-f\" transform=\"scale(.05556)\" />\n\t\t\t</pattern>\n\t\t\t<image\n\t\t\t\txlinkHref=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAaElEQVR4nK3DUQ6CMABEwb3/DyFIUxCpCFjEptETPi6xk4xq/eOoUn446jwrjjqOgqNy/uKoff/gqHXNOGpZ3jgqpQ1HzfMLR03TE0eNY8JRMT5wVAh3HNX3A47quoij2jbgqKa54XgBif6iRtkl/u0AAAAASUVORK5CYII=\"\n\t\t\t\tid=\"nodrop-f\"\n\t\t\t\twidth=\"18\"\n\t\t\t\theight=\"18\"\n\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t/>\n\t\t</defs>\n\t</svg>\n)\n", "import { colors } from \"@framerjs/fresco/tokens\"\n\nexport function NoneCursor() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 34 34\" style={{ color: colors.popoutButtonCursorIcon }}>\n\t\t\t<path\n\t\t\t\td=\"M 11 16.474 C 7.979 16.47 5.53 14.021 5.526 11 C 5.526 9.973 5.81 8.987 6.352 8.119 L 13.881 15.648 C 13.017 16.189 12.019 16.475 11 16.474 Z M 8.143 6.337 C 9.001 5.805 9.991 5.525 11 5.526 C 14.018 5.526 16.474 7.982 16.474 11 C 16.475 12.009 16.195 12.999 15.663 13.857 Z M 11 3 C 6.589 3 3 6.589 3 11 C 3 15.411 6.589 19 11 19 C 15.411 19 19 15.411 19 11 C 19 6.589 15.411 3 11 3 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\ttransform=\"translate(6, 7)\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export const NotAllowedCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 35 35\">\n\t\t<g clipPath=\"url(#notallowed-a)\">\n\t\t\t<g clipPath=\"url(#notallowed-b)\">\n\t\t\t\t<mask\n\t\t\t\t\tid=\"notallowed-c\"\n\t\t\t\t\twidth=\"18\"\n\t\t\t\t\theight=\"18\"\n\t\t\t\t\tx=\"9\"\n\t\t\t\t\ty=\"15\"\n\t\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t\t>\n\t\t\t\t\t<path fill=\"#fff\" d=\"M9 24a9 9 0 1 0 18.001-.001A9 9 0 0 0 9 24Z\" />\n\t\t\t\t</mask>\n\t\t\t\t<g mask=\"url(#notallowed-c)\">\n\t\t\t\t\t<path fill=\"url(#notallowed-d)\" d=\"M9 15h18v18H9z\" />\n\t\t\t\t</g>\n\t\t\t\t<mask\n\t\t\t\t\tid=\"notallowed-e\"\n\t\t\t\t\twidth=\"28\"\n\t\t\t\t\theight=\"40\"\n\t\t\t\t\tx=\"4\"\n\t\t\t\t\ty=\"-2\"\n\t\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t\t>\n\t\t\t\t\t<path fill=\"#fff\" d=\"M4-2h28v40H4V-2Z\" />\n\t\t\t\t</mask>\n\t\t\t\t<g mask=\"url(#notallowed-e)\">\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#fff\"\n\t\t\t\t\t\td=\"m9.502 1.742 8.382 8.4c1.053 1.056.306 2.859-1.184 2.859l-3.447-.002-2.469 2.185C9.704 16.142 8 15.374 8 13.93V2.363c0-.784.947-1.176 1.502-.621Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\t\td=\"M9 3.01v10.898c0 .59.697.904 1.139.513L12.874 12h3.8c.61 0 .916-.736.485-1.168L9.251 2.907A.147.147 0 0 0 9 3.01Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfill=\"#fff\"\n\t\t\t\t\t\td=\"M18 28.498a4.498 4.498 0 1 1 0-8.996 4.498 4.498 0 0 1 0 8.996ZM18 18a6 6 0 1 0 0 12 6 6 0 0 0 0-12Z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path fill=\"#fff\" d=\"m21.378 28.622-8-8 1.244-1.244 8 8-1.244 1.244Z\" />\n\t\t\t\t</g>\n\t\t\t</g>\n\t\t</g>\n\t\t<defs>\n\t\t\t<clipPath id=\"notallowed-a\">\n\t\t\t\t<path fill=\"#fff\" d=\"M0 0h35v35H0z\" />\n\t\t\t</clipPath>\n\t\t\t<clipPath id=\"notallowed-b\">\n\t\t\t\t<path fill=\"#fff\" d=\"M0 0h28v40H0z\" transform=\"translate(4 -2)\" />\n\t\t\t</clipPath>\n\t\t\t<pattern id=\"notallowed-d\" width=\"1\" height=\"1\" patternContentUnits=\"objectBoundingBox\">\n\t\t\t\t<use xlinkHref=\"#notallowed-f\" transform=\"scale(.05556)\" />\n\t\t\t</pattern>\n\t\t\t<image\n\t\t\t\txlinkHref=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAaElEQVR4nK3DUQ6CMABEwb3/DyFIUxCpCFjEptETPi6xk4xq/eOoUn446jwrjjqOgqNy/uKoff/gqHXNOGpZ3jgqpQ1HzfMLR03TE0eNY8JRMT5wVAh3HNX3A47quoij2jbgqKa54XgBif6iRtkl/u0AAAAASUVORK5CYII=\"\n\t\t\t\tid=\"notallowed-f\"\n\t\t\t\twidth=\"18\"\n\t\t\t\theight=\"18\"\n\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t/>\n\t\t</defs>\n\t</svg>\n)\n", "export const PointerCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M19.08 26.364c1.156 0 2.163-.24 3.016-.723.855-.483 1.516-1.188 1.98-2.12.466-.932.7-2.072.7-3.422v-1.805c0-.839-.132-1.483-.394-1.936-.263-.452-.641-.678-1.132-.678v1.197c0 .166-.056.3-.166.399a.541.541 0 0 1-.373.148.552.552 0 0 1-.384-.148.511.511 0 0 1-.166-.4V15.39c0-.298-.076-.53-.228-.693-.154-.163-.37-.244-.65-.244-.219 0-.435.047-.647.14v1.895a.528.528 0 0 1-.165.41.542.542 0 0 1-.375.148.551.551 0 0 1-.384-.149.524.524 0 0 1-.165-.409v-2.195c0-.292-.077-.524-.234-.693-.156-.17-.367-.255-.633-.255-.226 0-.446.05-.658.15v2.614a.535.535 0 0 1-.55.549.54.54 0 0 1-.54-.549V8.906c.001-.246-.066-.444-.203-.594-.136-.15-.32-.224-.554-.224a.742.742 0 0 0-.563.225c-.143.15-.214.347-.214.593v10.146a.743.743 0 0 1-.19.524.628.628 0 0 1-.479.203.843.843 0 0 1-.463-.129c-.137-.086-.252-.246-.345-.479l-1.336-3.052c-.167-.4-.417-.599-.749-.599a.693.693 0 0 0-.718.698c0 .16.03.32.09.48l1.786 5.027c.584 1.63 1.396 2.809 2.433 3.542 1.038.731 2.256 1.097 3.652 1.097Zm-.04 1.157c-1.704 0-3.152-.456-4.346-1.366-1.194-.911-2.106-2.265-2.738-4.061l-1.787-5.038a3.402 3.402 0 0 1-.169-.967c0-.52.173-.92.52-1.207a1.85 1.85 0 0 1 1.216-.43c.34 0 .645.1.918.295.273.196.492.491.659.883l.787 1.946c.02.045.05.068.09.068.054 0 .08-.03.08-.088v-8.58c0-.606.18-1.086.54-1.442.358-.356.813-.534 1.365-.534.546 0 .997.178 1.352.534.356.356.534.836.534 1.441v3.403c.26-.073.512-.11.759-.11.425 0 .788.111 1.087.334.299.223.509.527.63.913.304-.106.604-.16.897-.16.411 0 .76.105 1.041.315.284.209.478.493.584.853.904.006 1.605.326 2.1.957.496.632.744 1.52.744 2.663v2.086c0 1.542-.29 2.858-.868 3.945-.579 1.088-1.384 1.916-2.414 2.49-1.032.571-2.225.857-3.581.857Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M19.08 26.364c1.156 0 2.163-.24 3.016-.723.855-.483 1.516-1.188 1.98-2.12.466-.932.7-2.072.7-3.422v-1.805c0-.839-.132-1.483-.394-1.936-.263-.452-.641-.678-1.132-.678v1.197c0 .166-.056.3-.166.399a.542.542 0 0 1-.373.148.552.552 0 0 1-.384-.148.511.511 0 0 1-.166-.4V15.39c0-.298-.076-.53-.228-.693-.154-.163-.37-.244-.65-.244-.219 0-.435.047-.647.14v1.895a.529.529 0 0 1-.165.41.542.542 0 0 1-.375.148.552.552 0 0 1-.384-.149.525.525 0 0 1-.165-.409v-2.195c0-.292-.077-.524-.234-.693-.156-.17-.367-.255-.633-.255-.226 0-.446.05-.659.15v2.614a.535.535 0 0 1-.549.549.54.54 0 0 1-.54-.549V8.906c.001-.246-.066-.444-.203-.593-.136-.15-.32-.225-.554-.225a.742.742 0 0 0-.563.225c-.143.15-.214.347-.214.593v10.146a.743.743 0 0 1-.19.524.628.628 0 0 1-.479.203.843.843 0 0 1-.463-.129c-.137-.086-.252-.246-.345-.479l-1.336-3.052c-.167-.4-.417-.599-.749-.599a.692.692 0 0 0-.718.698c0 .16.03.32.09.48l1.786 5.027c.584 1.63 1.396 2.809 2.433 3.542 1.038.731 2.256 1.097 3.652 1.097Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export const ProgressCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 35 35\">\n\t\t<path fill=\"#00C0ED\" d=\"M27.002 24.519a9 9 0 0 1-9 9 9 9 0 0 1-9-9 9 9 0 0 1 9-9 9 9 0 0 1 9 9Z\" />\n\t\t<path\n\t\t\tfill=\"#0098F6\"\n\t\t\td=\"M13 21.99c2.166-.049 4.246 1.296 5.002 2.528 1.232-.756 2.53-2.164 2.53-4.65 0-2.489-1.77-4.267-2.53-4.35a9 9 0 0 0-9 9c.084-.76 1.834-2.479 3.999-2.528ZM23.003 27.047c-2.165.049-4.245-1.296-5-2.528-1.233.756-2.532 2.164-2.532 4.65 0 2.489 1.77 4.267 2.531 4.35a9 9 0 0 0 9-9c-.084.76-1.834 2.479-3.999 2.528Z\"\n\t\t/>\n\t\t<path\n\t\t\tfill=\"#FFF\"\n\t\t\td=\"m9.501 2.26 8.383 8.401c1.053 1.056.306 2.858-1.185 2.858h-3.447l-2.468 2.184C9.703 16.66 8 15.893 8 14.448V2.881c0-.784.947-1.176 1.501-.62Z\"\n\t\t/>\n\t\t<path\n\t\t\tfill=\"#000\"\n\t\t\td=\"M9 3.53v10.896c0 .59.697.904 1.139.513l2.735-2.42h3.8c.61 0 .916-.737.485-1.169L9.25 3.425A.147.147 0 0 0 9 3.53Z\"\n\t\t/>\n\t\t<mask\n\t\t\tid=\"progress-a\"\n\t\t\twidth=\"19\"\n\t\t\theight=\"19\"\n\t\t\tx=\"9\"\n\t\t\ty=\"15\"\n\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t>\n\t\t\t<path fill=\"#fff\" d=\"M9.001 24.519a9 9 0 1 0 18 0 9 9 0 0 0-18 0Z\" />\n\t\t</mask>\n\t\t<g mask=\"url(#progress-a)\" opacity=\".4\" style={{ mixBlendMode: \"overlay\" }}>\n\t\t\t<mask\n\t\t\t\tid=\"progress-b\"\n\t\t\t\twidth=\"19\"\n\t\t\t\theight=\"19\"\n\t\t\t\tx=\"8\"\n\t\t\t\ty=\"15\"\n\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t>\n\t\t\t\t<path fill=\"#fff\" d=\"M9 33.519h18v-18H9v18Z\" />\n\t\t\t</mask>\n\t\t\t<g mask=\"url(#progress-b)\">\n\t\t\t\t<mask\n\t\t\t\t\tid=\"progress-c\"\n\t\t\t\t\twidth=\"19\"\n\t\t\t\t\theight=\"19\"\n\t\t\t\t\tx=\"8\"\n\t\t\t\t\ty=\"15\"\n\t\t\t\t\tmaskUnits=\"userSpaceOnUse\"\n\t\t\t\t\tstyle={{ maskType: \"luminance\" }}\n\t\t\t\t>\n\t\t\t\t\t<path fill=\"#fff\" d=\"M27 33.519H9v-18h18v18Z\" />\n\t\t\t\t</mask>\n\t\t\t\t<g mask=\"url(#progress-c)\">\n\t\t\t\t\t<path fill=\"url(#progress-d)\" d=\"M9 15.519h18v18H9z\" />\n\t\t\t\t</g>\n\t\t\t</g>\n\t\t</g>\n\t\t<defs>\n\t\t\t<pattern id=\"progress-d\" width=\"1\" height=\"1\" patternContentUnits=\"objectBoundingBox\">\n\t\t\t\t<use xlinkHref=\"#progress-e\" transform=\"scale(.05556)\" />\n\t\t\t</pattern>\n\t\t\t<image\n\t\t\t\txlinkHref=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAa0lEQVR4nK3D0RQAIQBE0THIYAkyiCCCDCLIIIIQIohgDZYggwj6nJV495wrQ3TvNVHnHBO19zZR3/eZqPd9TdRay0TNOU3UGMNE9d5NVGvNRNVaTVQpxUTlnE1USslExRhN1PM8JiqEYOIPN4xO4mbj1IoAAAAASUVORK5CYII=\"\n\t\t\t\tid=\"progress-e\"\n\t\t\t\twidth=\"18\"\n\t\t\t\theight=\"18\"\n\t\t\t\tpreserveAspectRatio=\"none\"\n\t\t\t/>\n\t\t</defs>\n\t</svg>\n)\n", "// From macOS Tahoe resizeeast.svg (24x18), centered in 35x35\n// Solid arrow pointing E, dimmed arrow pointing W\nexport const ResizeEastCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(5.5, 8.5)\">\n\t\t\t{/* Dimmed W arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 7.539062 9.214844 C 7.3125 9.214844 7.085938 9.160156 6.886719 9.0625 L 1.378906 6.304688 C 0.878906 6.058594 0.570312 5.554688 0.570312 5 C 0.570312 4.441406 0.878906 3.941406 1.378906 3.691406 L 6.886719 0.9375 C 7.085938 0.835938 7.3125 0.78125 7.539062 0.78125 C 8.34375 0.78125 9 1.4375 9 2.242188 L 9 7.753906 C 9 8.152344 8.839844 8.527344 8.554688 8.804688 C 8.28125 9.070312 7.917969 9.214844 7.539062 9.214844\"\n\t\t\t\t\ttransform=\"translate(1, 4)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 0.824219 4.410156 L 6.332031 7.164062 C 6.640625 7.320312 7 7.097656 7 6.753906 L 7 1.242188 C 7 0.902344 6.640625 0.679688 6.332031 0.832031 L 0.824219 3.585938 C 0.484375 3.757812 0.484375 4.242188 0.824219 4.410156\"\n\t\t\t\t\ttransform=\"translate(2, 5)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid E arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 15.460938 13.214844 C 14.65625 13.214844 14 12.558594 14 11.753906 L 14 6.242188 C 14 5.4375 14.65625 4.78125 15.460938 4.78125 C 15.6875 4.78125 15.910156 4.835938 16.113281 4.9375 L 21.621094 7.691406 C 22.117188 7.941406 22.429688 8.441406 22.429688 9 C 22.429688 9.554688 22.117188 10.058594 21.621094 10.304688 L 16.113281 13.0625 C 15.914062 13.160156 15.6875 13.214844 15.460938 13.214844\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 21.171875 8.585938 L 15.667969 5.832031 C 15.359375 5.679688 15 5.902344 15 6.242188 L 15 11.753906 C 15 12.097656 15.359375 12.320312 15.667969 12.167969 L 21.171875 9.410156 C 21.511719 9.242188 21.511719 8.757812 21.171875 8.585938\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizeleftright.svg (30x24), centered in 35x35\nexport const ResizeEastWestCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(2.5, 5.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 15 19 C 13.898438 19 13 18.101562 13 17 L 13 7 C 13 5.898438 13.898438 5 15 5 C 16.101562 5 17 5.898438 17 7 L 17 17 C 17 18.101562 16.101562 19 15 19\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 15 18 C 14.449219 18 14 17.550781 14 17 L 14 7 C 14 6.449219 14.449219 6 15 6 C 15.550781 6 16 6.449219 16 7 L 16 17 C 16 17.550781 15.550781 18 15 18\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 20.382812 15.785156 C 19.621094 15.785156 19 15.164062 19 14.402344 L 19 9.636719 C 19 8.875 19.621094 8.253906 20.382812 8.253906 C 20.597656 8.253906 20.8125 8.304688 21 8.402344 L 25.761719 10.785156 C 26.234375 11.019531 26.527344 11.492188 26.527344 12.019531 C 26.527344 12.546875 26.234375 13.019531 25.761719 13.257812 L 21 15.640625 C 20.808594 15.734375 20.597656 15.785156 20.382812 15.785156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 25.316406 11.675781 L 20.554688 9.296875 C 20.300781 9.167969 20 9.351562 20 9.636719 L 20 14.402344 C 20 14.6875 20.300781 14.871094 20.554688 14.746094 L 25.316406 12.363281 C 25.597656 12.21875 25.597656 11.820312 25.316406 11.675781\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 9.617188 15.785156 C 9.40625 15.785156 9.191406 15.734375 9 15.640625 L 4.238281 13.257812 C 3.765625 13.019531 3.472656 12.546875 3.472656 12.019531 C 3.472656 11.492188 3.765625 11.019531 4.238281 10.785156 L 9 8.402344 C 9.191406 8.304688 9.402344 8.253906 9.617188 8.253906 C 10.378906 8.253906 11 8.875 11 9.636719 L 11 14.402344 C 11 14.78125 10.851562 15.136719 10.578125 15.398438 C 10.316406 15.648438 9.976562 15.785156 9.617188 15.785156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.683594 12.363281 L 9.445312 14.742188 C 9.699219 14.871094 10 14.6875 10 14.402344 L 10 9.636719 C 10 9.351562 9.699219 9.167969 9.445312 9.296875 L 4.683594 11.679688 C 4.402344 11.820312 4.402344 12.222656 4.683594 12.363281\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenorth.svg (18x28), centered in 35x35\n// Solid arrow pointing N, dimmed arrow pointing S\nexport const ResizeNorthCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(8.5, 3.5)\">\n\t\t\t{/* Dimmed S arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 9.21875 1.460938 C 9.214844 1.683594 9.164062 1.910156 9.0625 2.113281 L 6.308594 7.621094 C 6.058594 8.121094 5.558594 8.429688 5 8.429688 C 4.441406 8.429688 3.941406 8.121094 3.691406 7.621094 L 0.9375 2.113281 C 0.835938 1.910156 0.78125 1.683594 0.78125 1.460938 C 0.78125 0.652344 1.4375 0 2.246094 0 L 7.753906 0 C 8.15625 0 8.53125 0.15625 8.804688 0.445312 C 9.070312 0.71875 9.21875 1.082031 9.21875 1.460938\"\n\t\t\t\t\ttransform=\"translate(4, 16)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 4.414062 6.175781 L 7.167969 0.667969 C 7.320312 0.359375 7.097656 0 6.753906 0 L 1.246094 0 C 0.902344 0 0.679688 0.359375 0.832031 0.667969 L 3.585938 6.175781 C 3.757812 6.515625 4.242188 6.515625 4.414062 6.175781\"\n\t\t\t\t\ttransform=\"translate(5, 17)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid N arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 13.214844 10.535156 C 13.214844 11.34375 12.5625 12 11.753906 12 L 6.246094 12 C 5.4375 12 4.78125 11.34375 4.78125 10.535156 C 4.78125 10.3125 4.835938 10.085938 4.9375 9.882812 L 7.691406 4.378906 C 7.941406 3.882812 8.441406 3.570312 9 3.570312 C 9.558594 3.570312 10.058594 3.882812 10.308594 4.378906 L 13.0625 9.882812 C 13.164062 10.085938 13.214844 10.3125 13.214844 10.535156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 8.585938 4.824219 L 5.832031 10.332031 C 5.679688 10.636719 5.902344 11 6.246094 11 L 11.753906 11 C 12.097656 11 12.320312 10.636719 12.167969 10.332031 L 9.414062 4.824219 C 9.242188 4.484375 8.757812 4.484375 8.585938 4.824219\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenortheast.svg (22x22), centered in 35x35\n// Solid arrow pointing NE, dimmed arrow pointing SW\nexport const ResizeNorthEastCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t{/* Dimmed SW arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 8.535156 6.429688 C 8.375 6.585938 8.179688 6.710938 7.964844 6.78125 L 2.121094 8.726562 C 1.59375 8.902344 1.019531 8.769531 0.625 8.375 C 0.230469 7.980469 0.0976562 7.40625 0.273438 6.878906 L 2.21875 1.035156 C 2.289062 0.820312 2.414062 0.625 2.570312 0.464844 C 3.140625 -0.105469 4.066406 -0.105469 4.636719 0.464844 L 8.535156 4.363281 C 8.816406 4.644531 8.96875 5.019531 8.960938 5.417969 C 8.957031 5.800781 8.804688 6.160156 8.535156 6.429688\"\n\t\t\t\t\ttransform=\"translate(3, 10)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 0.804688 6.777344 L 6.648438 4.832031 C 6.972656 4.722656 7.070312 4.3125 6.828125 4.070312 L 2.929688 0.171875 C 2.691406 -0.0703125 2.277344 0.0273438 2.167969 0.351562 L 0.222656 6.195312 C 0.101562 6.554688 0.445312 6.898438 0.804688 6.777344\"\n\t\t\t\t\ttransform=\"translate(4, 11)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid NE arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 16.429688 11.53125 C 15.859375 12.101562 14.933594 12.101562 14.363281 11.53125 L 10.46875 7.636719 C 9.898438 7.066406 9.898438 6.140625 10.46875 5.570312 C 10.625 5.410156 10.824219 5.289062 11.039062 5.21875 L 16.878906 3.273438 C 17.40625 3.097656 17.980469 3.230469 18.375 3.625 C 18.769531 4.019531 18.902344 4.59375 18.726562 5.121094 L 16.78125 10.960938 C 16.710938 11.175781 16.589844 11.375 16.429688 11.53125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 17.195312 4.222656 L 11.355469 6.167969 C 11.03125 6.273438 10.933594 6.6875 11.175781 6.929688 L 15.070312 10.824219 C 15.3125 11.066406 15.726562 10.96875 15.832031 10.644531 L 17.777344 4.804688 C 17.898438 4.445312 17.554688 4.101562 17.195312 4.222656\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenortheastsouthwest.svg (22x22), centered in 35x35\nexport const ResizeNorthEastSouthWestCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 11.535156 16.429688 C 11.375 16.585938 11.179688 16.710938 10.964844 16.78125 L 5.121094 18.726562 C 4.59375 18.902344 4.019531 18.769531 3.625 18.375 C 3.230469 17.980469 3.097656 17.40625 3.273438 16.878906 L 5.21875 11.035156 C 5.289062 10.820312 5.414062 10.625 5.570312 10.464844 C 6.140625 9.894531 7.066406 9.894531 7.636719 10.464844 L 11.535156 14.363281 C 11.816406 14.644531 11.96875 15.019531 11.960938 15.417969 C 11.957031 15.800781 11.804688 16.160156 11.535156 16.429688\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.804688 17.777344 L 10.648438 15.832031 C 10.972656 15.722656 11.070312 15.3125 10.828125 15.070312 L 6.929688 11.171875 C 6.691406 10.929688 6.277344 11.027344 6.167969 11.351562 L 4.222656 17.195312 C 4.101562 17.554688 4.445312 17.898438 4.804688 17.777344\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 16.429688 11.53125 C 15.859375 12.101562 14.933594 12.101562 14.363281 11.53125 L 10.46875 7.636719 C 9.898438 7.066406 9.898438 6.140625 10.46875 5.570312 C 10.625 5.410156 10.824219 5.289062 11.039062 5.21875 L 16.878906 3.273438 C 17.40625 3.097656 17.980469 3.230469 18.375 3.625 C 18.769531 4.019531 18.902344 4.59375 18.726562 5.121094 L 16.78125 10.960938 C 16.710938 11.175781 16.589844 11.375 16.429688 11.53125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 17.195312 4.222656 L 11.355469 6.167969 C 11.03125 6.273438 10.933594 6.6875 11.175781 6.929688 L 15.070312 10.824219 C 15.3125 11.066406 15.726562 10.96875 15.832031 10.644531 L 17.777344 4.804688 C 17.898438 4.445312 17.554688 4.101562 17.195312 4.222656\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenorthsouth.svg (18x28), centered in 35x35\nexport const ResizeNorthSouthCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(8.5, 3.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 13.21875 17.460938 C 13.214844 17.683594 13.164062 17.910156 13.0625 18.113281 L 10.308594 23.621094 C 10.058594 24.121094 9.558594 24.429688 9 24.429688 C 8.441406 24.429688 7.941406 24.121094 7.691406 23.621094 L 4.9375 18.113281 C 4.835938 17.910156 4.78125 17.683594 4.78125 17.460938 C 4.78125 16.652344 5.4375 16 6.246094 16 L 11.753906 16 C 12.15625 16 12.53125 16.15625 12.804688 16.445312 C 13.070312 16.71875 13.21875 17.082031 13.21875 17.460938\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 9.414062 23.175781 L 12.167969 17.667969 C 12.320312 17.359375 12.097656 17 11.753906 17 L 6.246094 17 C 5.902344 17 5.679688 17.359375 5.832031 17.667969 L 8.585938 23.175781 C 8.757812 23.515625 9.242188 23.515625 9.414062 23.175781\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 13.214844 10.535156 C 13.214844 11.34375 12.5625 12 11.753906 12 L 6.246094 12 C 5.4375 12 4.78125 11.34375 4.78125 10.535156 C 4.78125 10.3125 4.835938 10.085938 4.9375 9.882812 L 7.691406 4.378906 C 7.941406 3.882812 8.441406 3.570312 9 3.570312 C 9.558594 3.570312 10.058594 3.882812 10.308594 4.378906 L 13.0625 9.882812 C 13.164062 10.085938 13.214844 10.3125 13.214844 10.535156\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 8.585938 4.824219 L 5.832031 10.332031 C 5.679688 10.636719 5.902344 11 6.246094 11 L 11.753906 11 C 12.097656 11 12.320312 10.636719 12.167969 10.332031 L 9.414062 4.824219 C 9.242188 4.484375 8.757812 4.484375 8.585938 4.824219\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenorthwest.svg (22x22), centered in 35x35\n// Solid arrow pointing NW, dimmed arrow pointing SE\nexport const ResizeNorthWestCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t{/* Dimmed SE arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 0.464844 6.429688 C 0.625 6.585938 0.820312 6.710938 1.035156 6.78125 L 6.878906 8.726562 C 7.40625 8.902344 7.980469 8.769531 8.375 8.375 C 8.769531 7.980469 8.902344 7.40625 8.726562 6.878906 L 6.78125 1.035156 C 6.710938 0.820312 6.585938 0.625 6.429688 0.464844 C 5.859375 -0.105469 4.933594 -0.105469 4.363281 0.464844 L 0.464844 4.363281 C 0.183594 4.644531 0.03125 5.019531 0.0390625 5.417969 C 0.0429688 5.800781 0.195312 6.160156 0.464844 6.429688\"\n\t\t\t\t\ttransform=\"translate(10, 10)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 6.195312 6.777344 L 0.351562 4.832031 C 0.0273438 4.722656 -0.0703125 4.3125 0.171875 4.070312 L 4.070312 0.171875 C 4.308594 -0.0703125 4.722656 0.0273438 4.832031 0.351562 L 6.777344 6.195312 C 6.898438 6.554688 6.554688 6.898438 6.195312 6.777344\"\n\t\t\t\t\ttransform=\"translate(11, 11)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid NW arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 5.570312 11.53125 C 6.140625 12.101562 7.066406 12.101562 7.636719 11.53125 L 11.53125 7.636719 C 12.101562 7.066406 12.101562 6.140625 11.53125 5.570312 C 11.375 5.410156 11.175781 5.289062 10.960938 5.21875 L 5.121094 3.273438 C 4.59375 3.097656 4.019531 3.230469 3.625 3.625 C 3.230469 4.019531 3.097656 4.59375 3.273438 5.121094 L 5.21875 10.960938 C 5.289062 11.175781 5.410156 11.375 5.570312 11.53125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.804688 4.222656 L 10.644531 6.167969 C 10.96875 6.273438 11.070312 6.6875 10.824219 6.929688 L 6.929688 10.824219 C 6.6875 11.066406 6.273438 10.96875 6.167969 10.644531 L 4.222656 4.804688 C 4.101562 4.445312 4.445312 4.101562 4.804688 4.222656\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizenorthwestsoutheast.svg (22x22), centered in 35x35\nexport const ResizeNorthWestSouthEastCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 10.464844 16.429688 C 10.625 16.585938 10.820312 16.710938 11.035156 16.78125 L 16.878906 18.726562 C 17.40625 18.902344 17.980469 18.769531 18.375 18.375 C 18.769531 17.980469 18.902344 17.40625 18.726562 16.878906 L 16.78125 11.035156 C 16.710938 10.820312 16.585938 10.625 16.429688 10.464844 C 15.859375 9.894531 14.933594 9.894531 14.363281 10.464844 L 10.464844 14.363281 C 10.183594 14.644531 10.03125 15.019531 10.039062 15.417969 C 10.042969 15.800781 10.195312 16.160156 10.464844 16.429688\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 17.195312 17.777344 L 11.351562 15.832031 C 11.027344 15.722656 10.929688 15.3125 11.171875 15.070312 L 15.070312 11.171875 C 15.308594 10.929688 15.722656 11.027344 15.832031 11.351562 L 17.777344 17.195312 C 17.898438 17.554688 17.554688 17.898438 17.195312 17.777344\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 5.570312 11.53125 C 6.140625 12.101562 7.066406 12.101562 7.636719 11.53125 L 11.53125 7.636719 C 12.101562 7.066406 12.101562 6.140625 11.53125 5.570312 C 11.375 5.410156 11.175781 5.289062 10.960938 5.21875 L 5.121094 3.273438 C 4.59375 3.097656 4.019531 3.230469 3.625 3.625 C 3.230469 4.019531 3.097656 4.59375 3.273438 5.121094 L 5.21875 10.960938 C 5.289062 11.175781 5.410156 11.375 5.570312 11.53125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.804688 4.222656 L 10.644531 6.167969 C 10.96875 6.273438 11.070312 6.6875 10.824219 6.929688 L 6.929688 10.824219 C 6.6875 11.066406 6.273438 10.96875 6.167969 10.644531 L 4.222656 4.804688 C 4.101562 4.445312 4.445312 4.101562 4.804688 4.222656\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizeupdown.svg (24x28), centered in 35x35\nexport const ResizeRowCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(5.5, 3.5)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 19 14 C 19 15.101562 18.101562 16 17 16 L 7 16 C 5.898438 16 5 15.101562 5 14 C 5 12.898438 5.898438 12 7 12 L 17 12 C 18.101562 12 19 12.898438 19 14\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 18 14 C 18 14.550781 17.550781 15 17 15 L 7 15 C 6.449219 15 6 14.550781 6 14 C 6 13.449219 6.449219 13 7 13 L 17 13 C 17.550781 13 18 13.449219 18 14\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 15.785156 8.617188 C 15.785156 9.378906 15.164062 10 14.402344 10 L 9.636719 10 C 8.875 10 8.253906 9.378906 8.253906 8.617188 C 8.253906 8.402344 8.304688 8.1875 8.402344 8 L 10.785156 3.238281 C 11.019531 2.765625 11.492188 2.472656 12.019531 2.472656 C 12.546875 2.472656 13.019531 2.765625 13.257812 3.238281 L 15.640625 8 C 15.734375 8.191406 15.785156 8.402344 15.785156 8.617188\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 11.675781 3.683594 L 9.296875 8.445312 C 9.167969 8.699219 9.351562 9 9.636719 9 L 14.402344 9 C 14.6875 9 14.871094 8.699219 14.746094 8.445312 L 12.363281 3.683594 C 12.21875 3.402344 11.820312 3.402344 11.675781 3.683594\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 15.785156 19.382812 C 15.785156 19.59375 15.734375 19.808594 15.640625 20 L 13.257812 24.761719 C 13.019531 25.234375 12.546875 25.527344 12.019531 25.527344 C 11.492188 25.527344 11.019531 25.234375 10.785156 24.761719 L 8.402344 20 C 8.304688 19.808594 8.253906 19.597656 8.253906 19.382812 C 8.253906 18.621094 8.875 18 9.636719 18 L 14.402344 18 C 14.78125 18 15.136719 18.148438 15.398438 18.421875 C 15.648438 18.683594 15.785156 19.023438 15.785156 19.382812\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 12.363281 24.316406 L 14.742188 19.554688 C 14.871094 19.300781 14.6875 19 14.402344 19 L 9.636719 19 C 9.351562 19 9.167969 19.300781 9.296875 19.554688 L 11.679688 24.316406 C 11.820312 24.597656 12.222656 24.597656 12.363281 24.316406\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizesouth.svg (18x28), centered in 35x35\n// Solid arrow pointing S, dimmed arrow pointing N\nexport const ResizeSouthCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(8.5, 3.5)\">\n\t\t\t{/* Dimmed N arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 9.214844 7.535156 C 9.214844 8.34375 8.5625 9 7.753906 9 L 2.246094 9 C 1.4375 9 0.78125 8.34375 0.78125 7.535156 C 0.78125 7.3125 0.835938 7.085938 0.9375 6.882812 L 3.691406 1.378906 C 3.941406 0.882812 4.441406 0.570312 5 0.570312 C 5.558594 0.570312 6.058594 0.882812 6.308594 1.378906 L 9.0625 6.882812 C 9.164062 7.085938 9.214844 7.3125 9.214844 7.535156\"\n\t\t\t\t\ttransform=\"translate(4, 3)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 3.585938 0.824219 L 0.832031 6.332031 C 0.679688 6.636719 0.902344 7 1.246094 7 L 6.753906 7 C 7.097656 7 7.320312 6.636719 7.167969 6.332031 L 4.414062 0.824219 C 4.242188 0.484375 3.757812 0.484375 3.585938 0.824219\"\n\t\t\t\t\ttransform=\"translate(5, 4)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid S arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 13.21875 17.460938 C 13.214844 17.683594 13.164062 17.910156 13.0625 18.113281 L 10.308594 23.621094 C 10.058594 24.121094 9.558594 24.429688 9 24.429688 C 8.441406 24.429688 7.941406 24.121094 7.691406 23.621094 L 4.9375 18.113281 C 4.835938 17.910156 4.78125 17.683594 4.78125 17.460938 C 4.78125 16.652344 5.4375 16 6.246094 16 L 11.753906 16 C 12.15625 16 12.53125 16.15625 12.804688 16.445312 C 13.070312 16.71875 13.21875 17.082031 13.21875 17.460938\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 9.414062 23.175781 L 12.167969 17.667969 C 12.320312 17.359375 12.097656 17 11.753906 17 L 6.246094 17 C 5.902344 17 5.679688 17.359375 5.832031 17.667969 L 8.585938 23.175781 C 8.757812 23.515625 9.242188 23.515625 9.414062 23.175781\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizesoutheast.svg (22x22), centered in 35x35\n// Solid arrow pointing SE, dimmed arrow pointing NW\nexport const ResizeSouthEastCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t{/* Dimmed NW arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 2.570312 8.53125 C 3.140625 9.101562 4.066406 9.101562 4.636719 8.53125 L 8.53125 4.636719 C 9.101562 4.066406 9.101562 3.140625 8.53125 2.570312 C 8.375 2.410156 8.175781 2.289062 7.960938 2.21875 L 2.121094 0.273438 C 1.59375 0.0976562 1.019531 0.230469 0.625 0.625 C 0.230469 1.019531 0.0976562 1.59375 0.273438 2.121094 L 2.21875 7.960938 C 2.289062 8.175781 2.410156 8.375 2.570312 8.53125\"\n\t\t\t\t\ttransform=\"translate(3, 3)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 0.804688 0.222656 L 6.644531 2.167969 C 6.96875 2.273438 7.070312 2.6875 6.824219 2.929688 L 2.929688 6.824219 C 2.6875 7.066406 2.273438 6.96875 2.167969 6.644531 L 0.222656 0.804688 C 0.101562 0.445312 0.445312 0.101562 0.804688 0.222656\"\n\t\t\t\t\ttransform=\"translate(4, 4)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid SE arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 10.464844 16.429688 C 10.625 16.585938 10.820312 16.710938 11.035156 16.78125 L 16.878906 18.726562 C 17.40625 18.902344 17.980469 18.769531 18.375 18.375 C 18.769531 17.980469 18.902344 17.40625 18.726562 16.878906 L 16.78125 11.035156 C 16.710938 10.820312 16.585938 10.625 16.429688 10.464844 C 15.859375 9.894531 14.933594 9.894531 14.363281 10.464844 L 10.464844 14.363281 C 10.183594 14.644531 10.03125 15.019531 10.039062 15.417969 C 10.042969 15.800781 10.195312 16.160156 10.464844 16.429688\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 17.195312 17.777344 L 11.351562 15.832031 C 11.027344 15.722656 10.929688 15.3125 11.171875 15.070312 L 15.070312 11.171875 C 15.308594 10.929688 15.722656 11.027344 15.832031 11.351562 L 17.777344 17.195312 C 17.898438 17.554688 17.554688 17.898438 17.195312 17.777344\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizesouthwest.svg (22x22), centered in 35x35\n// Solid arrow pointing SW, dimmed arrow pointing NE\nexport const ResizeSouthWestCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 6.5)\">\n\t\t\t{/* Dimmed NE arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 6.429688 8.53125 C 5.859375 9.101562 4.933594 9.101562 4.363281 8.53125 L 0.46875 4.636719 C -0.101562 4.066406 -0.101562 3.140625 0.46875 2.570312 C 0.625 2.410156 0.824219 2.289062 1.039062 2.21875 L 6.878906 0.273438 C 7.40625 0.0976562 7.980469 0.230469 8.375 0.625 C 8.769531 1.019531 8.902344 1.59375 8.726562 2.121094 L 6.78125 7.960938 C 6.710938 8.175781 6.589844 8.375 6.429688 8.53125\"\n\t\t\t\t\ttransform=\"translate(10, 3)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 6.195312 0.222656 L 0.355469 2.167969 C 0.03125 2.273438 -0.0664062 2.6875 0.175781 2.929688 L 4.070312 6.824219 C 4.3125 7.066406 4.726562 6.96875 4.832031 6.644531 L 6.777344 0.804688 C 6.898438 0.445312 6.554688 0.101562 6.195312 0.222656\"\n\t\t\t\t\ttransform=\"translate(11, 4)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid SW arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 11.535156 16.429688 C 11.375 16.585938 11.179688 16.710938 10.964844 16.78125 L 5.121094 18.726562 C 4.59375 18.902344 4.019531 18.769531 3.625 18.375 C 3.230469 17.980469 3.097656 17.40625 3.273438 16.878906 L 5.21875 11.035156 C 5.289062 10.820312 5.414062 10.625 5.570312 10.464844 C 6.140625 9.894531 7.066406 9.894531 7.636719 10.464844 L 11.535156 14.363281 C 11.816406 14.644531 11.96875 15.019531 11.960938 15.417969 C 11.957031 15.800781 11.804688 16.160156 11.535156 16.429688\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 4.804688 17.777344 L 10.648438 15.832031 C 10.972656 15.722656 11.070312 15.3125 10.828125 15.070312 L 6.929688 11.171875 C 6.691406 10.929688 6.277344 11.027344 6.167969 11.351562 L 4.222656 17.195312 C 4.101562 17.554688 4.445312 17.898438 4.804688 17.777344\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "// From macOS Tahoe resizewest.svg (24x18), centered in 35x35\n// Solid arrow pointing W, dimmed arrow pointing E\nexport const ResizeWestCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(5.5, 8.5)\">\n\t\t\t{/* Dimmed E arrow */}\n\t\t\t<g opacity=\"0.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\td=\"M 2.460938 0.78125 C 2.683594 0.78125 2.910156 0.835938 3.113281 0.9375 L 8.621094 3.691406 C 9.117188 3.941406 9.429688 4.441406 9.429688 5 C 9.429688 5.554688 9.117188 6.058594 8.621094 6.304688 L 3.113281 9.0625 C 2.910156 9.160156 2.683594 9.214844 2.460938 9.214844 C 1.652344 9.214844 0.996094 8.558594 0.996094 7.753906 L 0.996094 2.242188 C 0.996094 1.84375 1.15625 1.46875 1.445312 1.191406 C 1.71875 0.925781 2.078125 0.78125 2.460938 0.78125\"\n\t\t\t\t\ttransform=\"translate(13, 4)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<g opacity=\"0.25\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\td=\"M 7.171875 3.585938 L 1.664062 0.832031 C 1.359375 0.679688 0.996094 0.902344 0.996094 1.246094 L 0.996094 6.753906 C 0.996094 7.097656 1.359375 7.320312 1.664062 7.167969 L 7.171875 4.410156 C 7.511719 4.242188 7.511719 3.757812 7.171875 3.585938\"\n\t\t\t\t\ttransform=\"translate(14, 5)\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t{/* Solid W arrow */}\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 8.535156 4.78125 C 9.339844 4.78125 9.996094 5.4375 9.996094 6.246094 L 9.996094 11.753906 C 9.996094 12.558594 9.34375 13.214844 8.535156 13.214844 C 8.3125 13.214844 8.085938 13.160156 7.882812 13.0625 L 2.378906 10.304688 C 1.878906 10.058594 1.570312 9.554688 1.570312 9 C 1.570312 8.441406 1.878906 7.941406 2.378906 7.691406 L 7.882812 4.9375 C 8.085938 4.835938 8.3125 4.78125 8.535156 4.78125\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 2.824219 9.410156 L 8.328125 12.167969 C 8.636719 12.320312 8.996094 12.097656 8.996094 11.753906 L 8.996094 6.246094 C 8.996094 5.902344 8.636719 5.679688 8.328125 5.832031 L 2.824219 8.585938 C 2.484375 8.757812 2.484375 9.242188 2.824219 9.410156\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "export const TextCursor = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t\t<g fill=\"none\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#FFF\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M22.22 8.208c0 .814-.609 1.514-1.414 1.629a1.334 1.334 0 0 0-1.136 1.314v11.19c0 .657.488 1.222 1.134 1.315a1.653 1.653 0 0 1 1.412 1.629 1.647 1.647 0 0 1-1.883 1.625 4.596 4.596 0 0 1-2.307-1.033 4.612 4.612 0 0 1-2.312 1.034 1.64 1.64 0 0 1-1.878-1.619c0-.82.608-1.522 1.413-1.637a1.335 1.335 0 0 0 1.14-1.315V11.151c0-.656-.49-1.221-1.138-1.314a1.653 1.653 0 0 1-1.41-1.629 1.646 1.646 0 0 1 1.644-1.644h.089l.165.021a4.56 4.56 0 0 1 2.29 1.031 4.611 4.611 0 0 1 2.313-1.034c.454-.074.937.064 1.306.38.361.314.568.765.572 1.239v.007Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"#000\"\n\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\td=\"M15.408 8.753a2.433 2.433 0 0 1 2.076 2.398V22.34a2.435 2.435 0 0 1-2.08 2.397.554.554 0 0 0-.474.547c0 .16.07.31.19.416.121.102.28.15.44.128a3.55 3.55 0 0 0 2.466-1.59 3.551 3.551 0 0 0 2.468 1.59.552.552 0 0 0 .155-1.09 2.43 2.43 0 0 1-2.072-2.398V11.15c0-1.196.893-2.227 2.076-2.397a.554.554 0 0 0 .474-.547.559.559 0 0 0-.191-.415.547.547 0 0 0-.44-.128 3.557 3.557 0 0 0-2.467 1.59 3.555 3.555 0 0 0-2.466-1.59.553.553 0 0 0-.629.545c0 .272.204.507.474.545Z\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "// From macOS Tahoe ibeamvertical.svg (22x21), centered in 35x35\nexport const VerticalTextCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\" transform=\"translate(6.5, 7)\">\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\td=\"M 18.804688 14.332031 C 18.0625 14.332031 17.421875 13.777344 17.316406 13.039062 C 17.230469 12.449219 16.714844 12 16.113281 12 L 5.882812 12 C 5.285156 12 4.765625 12.445312 4.679688 13.039062 C 4.578125 13.773438 3.9375 14.328125 3.191406 14.328125 C 2.75 14.328125 2.335938 14.136719 2.054688 13.804688 C 1.769531 13.476562 1.640625 13.039062 1.707031 12.605469 C 1.820312 11.824219 2.148438 11.09375 2.652344 10.5 C 2.148438 9.898438 1.820312 9.171875 1.707031 8.382812 C 1.640625 7.957031 1.769531 7.519531 2.054688 7.191406 C 2.339844 6.859375 2.753906 6.671875 3.183594 6.667969 C 3.9375 6.667969 4.578125 7.222656 4.683594 7.960938 C 4.765625 8.554688 5.285156 9 5.882812 9 L 16.113281 9 C 16.714844 9 17.230469 8.554688 17.316406 7.960938 C 17.421875 7.226562 18.0625 6.671875 18.804688 6.671875 C 19.246094 6.671875 19.660156 6.863281 19.945312 7.195312 C 20.175781 7.464844 20.308594 7.8125 20.308594 8.175781 L 20.308594 8.257812 L 20.289062 8.40625 C 20.179688 9.179688 19.847656 9.90625 19.347656 10.5 C 19.847656 11.101562 20.179688 11.828125 20.292969 12.613281 C 20.359375 13.03125 20.234375 13.472656 19.945312 13.808594 C 19.65625 14.140625 19.246094 14.328125 18.8125 14.332031 Z M 18.804688 14.332031\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\td=\"M 18.308594 8.105469 C 18.152344 9.1875 17.207031 10 16.113281 10 L 5.882812 10 C 4.789062 10 3.847656 9.183594 3.691406 8.101562 C 3.65625 7.851562 3.441406 7.667969 3.191406 7.667969 C 3.046875 7.667969 2.910156 7.730469 2.8125 7.839844 C 2.71875 7.953125 2.675781 8.097656 2.695312 8.242188 C 2.828125 9.164062 3.367188 9.996094 4.148438 10.496094 C 3.367188 11 2.828125 11.832031 2.695312 12.753906 C 2.675781 12.894531 2.71875 13.042969 2.8125 13.152344 C 2.910156 13.265625 3.046875 13.328125 3.191406 13.328125 C 3.441406 13.328125 3.65625 13.144531 3.691406 12.894531 C 3.847656 11.816406 4.789062 11 5.882812 11 L 16.113281 11 C 17.207031 11 18.152344 11.816406 18.308594 12.898438 C 18.339844 13.148438 18.558594 13.332031 18.808594 13.332031 C 18.953125 13.332031 19.089844 13.269531 19.1875 13.15625 C 19.28125 13.046875 19.328125 12.902344 19.304688 12.757812 C 19.171875 11.835938 18.632812 11.003906 17.851562 10.5 C 18.632812 9.996094 19.171875 9.167969 19.304688 8.246094 C 19.308594 8.222656 19.308594 8.199219 19.308594 8.175781 C 19.308594 8.054688 19.265625 7.9375 19.1875 7.847656 C 19.089844 7.734375 18.953125 7.671875 18.804688 7.671875 C 18.558594 7.671875 18.339844 7.855469 18.308594 8.105469\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "export const ZoomInCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\">\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M23.313 15.656a7.656 7.656 0 1 1-15.313 0 7.656 7.656 0 0 1 15.313 0Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M21.402 15.656a5.746 5.746 0 1 1-11.491 0 5.746 5.746 0 0 1 11.49 0Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M15.656 19.484c-.604 0-1.094-.49-1.094-1.093v-5.47a1.094 1.094 0 0 1 2.188 0v5.47c0 .603-.49 1.093-1.094 1.093Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M11.828 15.656c0-.604.49-1.094 1.094-1.094h5.469a1.094 1.094 0 0 1 0 2.188h-5.47c-.603 0-1.093-.49-1.093-1.094ZM26.519 26.519a1.094 1.094 0 0 0 0-1.547l-5.187-5.186-1.546 1.546 5.186 5.187c.427.427 1.12.427 1.547 0Z\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "export const ZoomOutCursor = () => (\n\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 35 35\">\n\t\t<g fill=\"none\">\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M23.313 15.656a7.656 7.656 0 1 1-15.313 0 7.656 7.656 0 0 1 15.313 0Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#FFF\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M21.402 15.656a5.746 5.746 0 1 1-11.491 0 5.746 5.746 0 0 1 11.49 0Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"#000\"\n\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\td=\"M11.828 15.656c0-.604.49-1.094 1.094-1.094h5.469a1.094 1.094 0 0 1 0 2.188h-5.47c-.603 0-1.093-.49-1.093-1.094Zm14.69 10.863a1.094 1.094 0 0 0 0-1.547l-5.186-5.186-1.546 1.546 5.186 5.187c.427.427 1.12.427 1.547 0Z\"\n\t\t\t/>\n\t\t</g>\n\t</svg>\n)\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { AliasCursor } from \"./AliasCursor.tsx\"\nimport { CellCursor } from \"./CellCursor.tsx\"\nimport { ColResizeCursor } from \"./ColResizeCursor.tsx\"\nimport { ContextMenuCursor } from \"./ContextMenuCursor.tsx\"\nimport { CopyCursor } from \"./CopyCursor.tsx\"\nimport { CrosshairCursor } from \"./CrosshairCursor.tsx\"\nimport { DefaultCursor } from \"./DefaultCursor.tsx\"\nimport { GrabCursor } from \"./GrabCursor.tsx\"\nimport { GrabbingCursor } from \"./GrabbingCursor.tsx\"\nimport { HelpCursor } from \"./HelpCursor.tsx\"\nimport { MoveCursor } from \"./MoveCursor.tsx\"\nimport { NoDropCursor } from \"./NoDropCursor.tsx\"\nimport { NoneCursor } from \"./NoneCursor.tsx\"\nimport { NotAllowedCursor } from \"./NotAllowedCursor.tsx\"\nimport { PointerCursor } from \"./PointerCursor.tsx\"\nimport { ProgressCursor } from \"./ProgressCursor.tsx\"\nimport { ResizeEastCursor } from \"./ResizeEastCursor.tsx\"\nimport { ResizeEastWestCursor } from \"./ResizeEastWestCursor.tsx\"\nimport { ResizeNorthCursor } from \"./ResizeNorthCursor.tsx\"\nimport { ResizeNorthEastCursor } from \"./ResizeNorthEastCursor.tsx\"\nimport { ResizeNorthEastSouthWestCursor } from \"./ResizeNorthEastSouthWestCursor.tsx\"\nimport { ResizeNorthSouthCursor } from \"./ResizeNorthSouthCursor.tsx\"\nimport { ResizeNorthWestCursor } from \"./ResizeNorthWestCursor.tsx\"\nimport { ResizeNorthWestSouthEastCursor } from \"./ResizeNorthWestSouthEastCursor.tsx\"\nimport { ResizeRowCursor } from \"./ResizeRowCursor.tsx\"\nimport { ResizeSouthCursor } from \"./ResizeSouthCursor.tsx\"\nimport { ResizeSouthEastCursor } from \"./ResizeSouthEastCursor.tsx\"\nimport { ResizeSouthWestCursor } from \"./ResizeSouthWestCursor.tsx\"\nimport { ResizeWestCursor } from \"./ResizeWestCursor.tsx\"\nimport { TextCursor } from \"./TextCursor.tsx\"\nimport { VerticalTextCursor } from \"./VerticalTextCursor.tsx\"\nimport { ZoomInCursor } from \"./ZoomInCursor.tsx\"\nimport { ZoomOutCursor } from \"./ZoomOutCursor.tsx\"\n\nexport function CursorIcon({ cursor }: { cursor: CSSCursor }) {\n\tswitch (cursor) {\n\t\tcase \"alias\":\n\t\t\treturn <AliasCursor />\n\t\tcase \"cell\":\n\t\t\treturn <CellCursor />\n\t\tcase \"col-resize\":\n\t\t\treturn <ColResizeCursor />\n\t\tcase \"copy\":\n\t\t\treturn <CopyCursor />\n\t\tcase \"context-menu\":\n\t\t\treturn <ContextMenuCursor />\n\t\tcase \"crosshair\":\n\t\t\treturn <CrosshairCursor />\n\t\tcase \"e-resize\":\n\t\t\treturn <ResizeEastCursor />\n\t\tcase \"ew-resize\":\n\t\t\treturn <ResizeEastWestCursor />\n\t\tcase \"grab\":\n\t\t\treturn <GrabCursor />\n\t\tcase \"grabbing\":\n\t\t\treturn <GrabbingCursor />\n\t\tcase \"help\":\n\t\t\treturn <HelpCursor />\n\t\tcase \"move\":\n\t\t\treturn <MoveCursor />\n\t\tcase \"none\":\n\t\t\treturn <NoneCursor />\n\t\tcase \"no-drop\":\n\t\t\treturn <NoDropCursor />\n\t\tcase \"not-allowed\":\n\t\t\treturn <NotAllowedCursor />\n\t\tcase \"n-resize\":\n\t\t\treturn <ResizeNorthCursor />\n\t\tcase \"ne-resize\":\n\t\t\treturn <ResizeNorthEastCursor />\n\t\tcase \"ns-resize\":\n\t\t\treturn <ResizeNorthSouthCursor />\n\t\tcase \"nesw-resize\":\n\t\t\treturn <ResizeNorthEastSouthWestCursor />\n\t\tcase \"nwse-resize\":\n\t\t\treturn <ResizeNorthWestSouthEastCursor />\n\t\tcase \"nw-resize\":\n\t\t\treturn <ResizeNorthWestCursor />\n\t\tcase \"pointer\":\n\t\t\treturn <PointerCursor />\n\t\tcase \"progress\":\n\t\t\treturn <ProgressCursor />\n\t\tcase \"row-resize\":\n\t\t\treturn <ResizeRowCursor />\n\t\tcase \"s-resize\":\n\t\t\treturn <ResizeSouthCursor />\n\t\tcase \"se-resize\":\n\t\t\treturn <ResizeSouthEastCursor />\n\t\tcase \"sw-resize\":\n\t\t\treturn <ResizeSouthWestCursor />\n\t\tcase \"text\":\n\t\t\treturn <TextCursor />\n\t\tcase \"vertical-text\":\n\t\t\treturn <VerticalTextCursor />\n\t\tcase \"w-resize\":\n\t\t\treturn <ResizeWestCursor />\n\t\tcase \"zoom-in\":\n\t\t\treturn <ZoomInCursor />\n\t\tcase \"zoom-out\":\n\t\t\treturn <ZoomOutCursor />\n\t\tcase \"default\":\n\t\t\treturn <DefaultCursor />\n\t\tdefault:\n\t\t\tassertNever(cursor)\n\t}\n}\n", "import \"CursorPopout.styles_1i23svp.wyw.css\"; export const grid = \"grid_gf68mj\";\nexport const gridDisabled = \"gridDisabled_gd7443f\";\nexport const cell = \"cell_c23ti3g\";\nexport const icon = \"icon_i1i484n0\";\nexport const selected = \"selected_sxseuh9\";\nexport const panelContent = \"panelContent_pofunbk\";\nexport const container = \"container_c1n5qyyn\";", "import { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { CSSCursor, WithCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { fallbackCursor, isCSSCursor, withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedCursor } from \"document/models/CanvasTree/traits/utils/reduceCursor.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React, { useCallback } from \"react\"\nimport {\n\tcanReadClipboardWithoutPromptingUser,\n\tclipboardReadType,\n\tisClipboardSupported,\n} from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { CursorPopoutButton } from \"./CursorPopout.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nexport const CURSOR_POPOUT_ID = \"cursor-popout\"\n\nconst cursorTraitTypes: (keyof WithCursor)[] = [\"cursor\"]\n\ninterface Props extends Pick<ReducedCursor, \"cursor\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const CursorRow = React.memo(function WebCursorRow({ cursor, nodeIds }: Props) {\n\tconst canCopyCursor = !isMixed(cursor) && !isNotFound(cursor)\n\n\tconst canPasteCursor = React.useCallback(async () => {\n\t\tif (!isClipboardSupported()) return false\n\t\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\t\tconst cursors = await clipboardReadType(\"application/x-framer-cursors\")\n\t\treturn isObject(cursors) && isCSSCursor(cursors.cursor)\n\t}, [])\n\n\tconst copyCursor = React.useCallback(async () => {\n\t\tif (isMixed(cursor) || isNotFound(cursor)) return\n\t\tawait Clipboard.copyCursors({ cursor: cursor })\n\t}, [cursor])\n\n\tconst pasteCursor = React.useCallback(async () => {\n\t\tconst cursors = await clipboardReadType(\"application/x-framer-cursors\")\n\t\tif (!isObject(cursors)) return false\n\t\tconst { cursor: clipboardCursor } = cursors\n\t\tif (!isCSSCursor(clipboardCursor)) return false\n\t\tengine.tree.getNodesWithTrait(nodeIds, withCursor).forEach(node => {\n\t\t\tnode.set({ cursor: clipboardCursor })\n\t\t})\n\t}, [nodeIds])\n\n\tconst updateCursor = useEngineCallback(\n\t\t(value: CSSCursor | DynamicValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withCursor)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tnode.set({ cursor: value })\n\t\t\t\trecord(\"css_cursor_create\", {})\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeCursor = useCallback(() => {\n\t\tupdateCursor(undefined)\n\t}, [updateCursor])\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isCSSCursor(cursor) ? cursor : fallbackCursor,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Cursor,\n\t\t\t\tname: \"cursor\",\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateCursor(variableRef)\n\t\t},\n\t\t[cursor, updateCursor],\n\t)\n\n\tconst onSelectComputedValue = useCallback(\n\t\t(computedValue: DynamicValue) => {\n\t\t\tupdateCursor(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(CURSOR_POPOUT_ID)\n\t\t},\n\t\t[updateCursor],\n\t)\n\n\tconst onRemoveDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tif (!isDynamicValue(node.cursor)) continue\n\n\t\t\tconst cursorValue = isVariableReference(cursor) ? (getVariableValue(engine, cursor) as CSSCursor) : node.cursor\n\n\t\t\tnode.set({ cursor: cursorValue ?? undefined })\n\t\t}\n\t}, [nodeIds, cursor])\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Web\"\n\t\t\ttraitTypeKeys={cursorTraitTypes}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(cursor) ? cursor : null}\n\t\t\tvariableType={ControlType.Cursor}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={updateCursor}\n\t\t\tcomputedValuePopoutId={CURSOR_POPOUT_ID}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonDelete={removeCursor}\n\t\t\tonCopy={copyCursor}\n\t\t\tonPaste={pasteCursor}\n\t\t\tcopyEnabled={canCopyCursor}\n\t\t\tpasteEnabled={canPasteCursor}\n\t\t>\n\t\t\t{isDynamicValue(cursor) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Cursor\"\n\t\t\t\t\tvalue={cursor}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Cursor}\n\t\t\t\t\tonChangeDynamicValue={updateCursor}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tpopoutId={CURSOR_POPOUT_ID}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<CursorPopoutButton title=\"Cursor\" cursor={cursor} onChange={updateCursor} popoutId={CURSOR_POPOUT_ID} />\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { type CSSCursor, fallbackCursor, isCSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { CursorVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { CursorPopoutButton } from \"../../properties/rows/CursorPopout.tsx\"\nimport { CURSOR_POPOUT_ID } from \"../../properties/rows/CursorRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: CursorVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailCursor({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst updateInitialValue = (initialValue: CSSCursor) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<CursorPopoutButton\n\t\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\t\tpopoutId={`${CURSOR_POPOUT_ID}-variable-detail`}\n\t\t\t\tcursor={isCSSCursor(variable.initialValue) ? variable.initialValue : fallbackCursor}\n\t\t\t\tonChange={updateInitialValue}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem, TimeInput } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { DateVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable, isOptionalVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { DateControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { DateControlPropRow } from \"../../properties/codeComponentRows/DateControlPropRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: DateVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n\tscopeType: ScopeType\n}\n\nexport function VariableDetailDate({ variable, onUpdate, scopeType }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst updateInitialValue = (initialValue: string | undefined) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\tconst updateDate = (controlProp: DateControlProp) => {\n\t\tconst initialValue = controlProp.value\n\t\tassert(!isDynamicValue(initialValue), \"Dynamic values are not supported as variable defaults\")\n\t\tupdateInitialValue(initialValue)\n\t}\n\n\tconst updateDisplayTime = (displayTime: boolean) => {\n\t\tupdateVariable(current => ({ options: { ...current.options, displayTime } }))\n\t}\n\n\tconst displayTime = variable.options?.displayTime ?? false\n\tconst isCmsScope = scopeType === ScopeType.ContentManagement\n\tconst showDefaultValueInput = !isCmsScope && !isOptional\n\n\treturn (\n\t\t<>\n\t\t\t{showDefaultValueInput && (\n\t\t\t\t<DateControlPropRow\n\t\t\t\t\tpreserveTime={displayTime}\n\t\t\t\t\tcontrolKey={Dictionary.Default}\n\t\t\t\t\tcontrolProp={{ type: ControlType.Date, value: variable.initialValue }}\n\t\t\t\t\tcontrol={{\n\t\t\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\t\t\tdisplayTime: false, // Time is shown separately, with the display time control in between.\n\t\t\t\t\t\ttitle: Dictionary.Default,\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={updateDate}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<PanelRow title=\"Time\">\n\t\t\t\t<SegmentedControl direction=\"horizontal\" className={doubleColumnClass}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\tonSelect={updateDisplayTime}\n\t\t\t\t\t\ttitle={Dictionary.Show}\n\t\t\t\t\t\tselected={displayTime}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\tonSelect={updateDisplayTime}\n\t\t\t\t\t\ttitle={Dictionary.Hide}\n\t\t\t\t\t\tselected={!displayTime}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{displayTime && showDefaultValueInput && (\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<TimeInput\n\t\t\t\t\t\tvalue={isString(variable.initialValue) ? variable.initialValue : undefined}\n\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\trequired={variable.optional !== true}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import {\n\tButton,\n\tCenterChild,\n\tIconDragHandle,\n\tInputWrapper,\n\tPopupButton,\n\tPopupButtonItem,\n\tStack,\n\tTextInput,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert, List } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { EnumVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isOptionalVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport React from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { scrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport * as styles from \"./VariableDetailEnum.styles.ts\"\nimport { VariableDetailLocalizationRow } from \"./VariableDetailLocalizationRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: EnumVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailEnum({ variable, onUpdate, scopeType }: Props) {\n\tconst isReadOnly = useReadOnly()\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (initialValue: string) => {\n\t\tupdateVariable(current => {\n\t\t\tassert(\n\t\t\t\tcurrent.cases.some(({ id }) => id === initialValue),\n\t\t\t\t\"Enum case option should exist\",\n\t\t\t)\n\t\t\treturn { initialValue }\n\t\t})\n\t}\n\n\tconst noDefaultSelected = variable.cases.every(caseOption => caseOption.id !== variable.initialValue)\n\n\treturn (\n\t\t<>\n\t\t\t{!isOptional && (\n\t\t\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\ttitle={Dictionary.SelectEllipsis}\n\t\t\t\t\t\t\tvisible={noDefaultSelected}\n\t\t\t\t\t\t\tselected={noDefaultSelected}\n\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{variable.cases.map(caseOption => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={caseOption.id}\n\t\t\t\t\t\t\t\tidentifier={caseOption.id}\n\t\t\t\t\t\t\t\ttitle={caseOption.name}\n\t\t\t\t\t\t\t\tselected={variable.initialValue === caseOption.id}\n\t\t\t\t\t\t\t\tonSelect={updateInitialValue}\n\t\t\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{scopeType === ScopeType.ContentManagement && (\n\t\t\t\t<VariableDetailLocalizationRow\n\t\t\t\t\tpreventLocalization={variable.preventLocalization}\n\t\t\t\t\tupdateVariable={updateVariable}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<VariableDetailEnumOptions variable={variable} isReadOnly={isReadOnly} updateVariable={updateVariable} />\n\t\t</>\n\t)\n}\n\ninterface VariableDetailEnumOptionsProps {\n\tisReadOnly: boolean\n\tvariable: EnumVariableDefinition\n\tupdateVariable: <K extends keyof EnumVariableDefinition>(\n\t\tgetUpdate: (current: EnumVariableDefinition) => Pick<EnumVariableDefinition, K>,\n\t) => void\n}\n\nconst VariableDetailEnumOptions = (props: VariableDetailEnumOptionsProps) => {\n\tconst newlyCreatedItemId = React.useRef<string | null>(null)\n\tconst { variable, isReadOnly, updateVariable } = props\n\n\tconst focusNewlyCreatedItem = (input: HTMLInputElement | null) => {\n\t\tif (!input) return\n\t\tinput.focus()\n\t\tscrollIntoView(input, { block: \"nearest\", scrollMode: \"if-needed\" })\n\t\tnewlyCreatedItemId.current = null\n\t}\n\n\tconst updateNameOfItem = (name: string, id: string) => {\n\t\tupdateVariable(current => {\n\t\t\tconst cases = current.cases.map(caseOption => {\n\t\t\t\tif (caseOption.id !== id) return caseOption\n\t\t\t\treturn { ...caseOption, name }\n\t\t\t})\n\t\t\treturn { cases }\n\t\t})\n\t}\n\n\tconst displayMenuForItem = (event: React.MouseEvent, id: string) => {\n\t\tif (event.target instanceof HTMLInputElement) return\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tenabled: variable.cases.length > 1 && !isReadOnly,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tupdateVariable(current => {\n\t\t\t\t\t\t\tconst cases = current.cases.filter(caseOption => {\n\t\t\t\t\t\t\t\treturn caseOption.id !== id\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn { cases }\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\tconst moveItem = (from: number, to: number) => {\n\t\tupdateVariable(current => {\n\t\t\tconst cases = List.move(current.cases, from, to)\n\t\t\treturn { cases }\n\t\t})\n\t}\n\n\tconst addItem = () => {\n\t\tupdateVariable(current => {\n\t\t\tconst existingNames = new Set(current.cases.map(option => option.name))\n\t\t\tconst name = uniqueName(Dictionary.Option, existingNames, {\n\t\t\t\tstartIndex: existingNames.size + 1,\n\t\t\t\tomitCountIfFirst: false,\n\t\t\t})\n\t\t\tconst newItemId = randomID()\n\t\t\tconst cases = [...current.cases, { id: newItemId, name }]\n\t\t\tnewlyCreatedItemId.current = newItemId\n\t\t\treturn { cases }\n\t\t})\n\t}\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Options\" className={styles.list}>\n\t\t\t\t<Stack direction=\"column\" gap={0} className={doubleColumnClass}>\n\t\t\t\t\t<Sortable items={variable.cases} moveItem={moveItem} keyForItem={getId}>\n\t\t\t\t\t\t{({ item }) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\tclassName={styles.caseRow}\n\t\t\t\t\t\t\t\t\tonContextMenu={event => displayMenuForItem(event, item.id)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<InputWrapper className={styles.inputWrapper} draggable={undefined}>\n\t\t\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t\t\tref={item.id === newlyCreatedItemId.current ? focusNewlyCreatedItem : null}\n\t\t\t\t\t\t\t\t\t\t\tvalue={item.name}\n\t\t\t\t\t\t\t\t\t\t\tonChange={value => updateNameOfItem(value, item.id)}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{!isReadOnly && (\n\t\t\t\t\t\t\t\t\t\t\t<CenterChild className={styles.dragHandle}>\n\t\t\t\t\t\t\t\t\t\t\t\t<IconDragHandle />\n\t\t\t\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}}\n\t\t\t\t\t</Sortable>\n\t\t\t\t</Stack>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<Button title={Dictionary.Add} onClick={addItem} enabled={!isReadOnly} className={doubleColumnClass} />\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n", "import \"VariableDetailEnum.styles_1j72kfb.wyw.css\"; export const list = \"list_l1v9maea\";\nexport const caseRow = \"caseRow_ckbojee\";\nexport const inputWrapper = \"inputWrapper_iqjlhtn\";\nexport const dragHandle = \"dragHandle_dv88g5b\";", "import { ReadOnlyContext, SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { VariablesSupportingPreventLocalization } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\n\n/**\n * Unlike other variable attributes, `ignoreLocalization` is allowed to be set for collections which\n * are managed by a plugin.\n */\nexport function getIgnoreLocalizationIsReadOnly(): boolean {\n\treturn getIsViewOnly(engine, \"canEditVariables\")\n}\n\n/**\n * Unlike other variable attributes, `ignoreLocalization` is allowed to be set for collections which\n * are managed by a plugin.\n */\nexport function useIgnoreLocalizationIsReadOnly(): boolean {\n\treturn useIsViewOnly(\"canEditVariables\")\n}\n\ninterface Props {\n\tpreventLocalization?: boolean\n\tupdateVariable: (update: Pick<VariablesSupportingPreventLocalization, \"preventLocalization\">) => void\n\tonDelete?: () => void\n}\n\nexport function VariableDetailLocalizationRow({ preventLocalization, updateVariable, onDelete }: Props) {\n\tconst ignoreLocalizationIsReadOnly = useIgnoreLocalizationIsReadOnly()\n\tconst updatePreventLocalization = (nextPreventLocalization: boolean) => {\n\t\tupdateVariable({ preventLocalization: nextPreventLocalization })\n\t}\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={ignoreLocalizationIsReadOnly}>\n\t\t\t<PanelRow\n\t\t\t\ttitle={Dictionary.Localization}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tdeleteTitle={onDelete ? Dictionary.Remove : undefined}\n\t\t\t>\n\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.On}\n\t\t\t\t\t\tselected={!preventLocalization}\n\t\t\t\t\t\tonSelect={updatePreventLocalization}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Off}\n\t\t\t\t\t\tselected={preventLocalization === true}\n\t\t\t\t\t\tonSelect={updatePreventLocalization}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t</ReadOnlyContext.Provider>\n\t)\n}\n", "import \"VariableDetailFile.styles_w6vtmb.wyw.css\"; export const inputWrapper = \"inputWrapper_i1lwzfxc\";\nexport const deleteButton = \"deleteButton_ds2l385\";", "import { Button, IconInputClose, InputWrapper, Stack, TextInput, useReadOnly } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type {\n\tFileVariableDefinition,\n\tFileVariableExtension,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { lookup as lookupMediaType } from \"mrmime\"\nimport { DescriptionRow } from \"../../properties/codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport * as styles from \"./VariableDetailFile.styles.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: FileVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nfunction parseExtensionValue(rawExtension: string) {\n\tconst value = rawExtension.trim()\n\t// Allow explicitly entering an extension for users who might be confused by media types\n\tif (value.startsWith(\".\")) {\n\t\tif (value === \".*\") return \"*\"\n\t\telse return value\n\t}\n\t// Try to convert everything else to a media type\n\treturn lookupMediaType(value) || value\n}\n\nfunction removeAllowedFileType(idToDelete: string, allowedFileTypes: FileVariableExtension[]): FileVariableExtension[] {\n\t// You can't remove the last allowed file type\n\tif (allowedFileTypes.length < 2) return allowedFileTypes\n\treturn allowedFileTypes.filter(({ id }) => idToDelete !== id)\n}\n\nexport function VariableDetailFile({ variable, onUpdate }: Props) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst removeFileType = (fileTypeId: string) => {\n\t\tupdateVariable(current => {\n\t\t\tconst allowedFileTypes = removeAllowedFileType(fileTypeId, current.allowedFileTypes)\n\t\t\treturn { allowedFileTypes }\n\t\t})\n\t}\n\n\tconst addFileType = () => {\n\t\tupdateVariable(current => {\n\t\t\tconst newAllowedFileType = { id: randomID(), extension: \"\" }\n\t\t\tconst allowedFileTypes = [...current.allowedFileTypes, newAllowedFileType]\n\t\t\treturn { allowedFileTypes }\n\t\t})\n\t}\n\n\tconst updateExtension = (newValue: string, fileTypeId: string, reset: () => void) => {\n\t\tupdateVariable(current => {\n\t\t\tconst value = parseExtensionValue(newValue)\n\n\t\t\t// Handle deleting the content of the field\n\t\t\tif (!value && current.allowedFileTypes.length > 1) {\n\t\t\t\tconst allowedFileTypes = removeAllowedFileType(fileTypeId, current.allowedFileTypes)\n\t\t\t\treturn { allowedFileTypes }\n\t\t\t}\n\n\t\t\tconst allowedFileTypes = current.allowedFileTypes.map(fileType => {\n\t\t\t\tif (fileTypeId !== fileType.id) return fileType\n\n\t\t\t\t// If the value didn't change, reset the input to avoid showing a non-canonical value (e.g. \"png\" instead of \"image/png\")\n\t\t\t\tif (fileType.extension === value) {\n\t\t\t\t\treset()\n\t\t\t\t\treturn fileType\n\t\t\t\t}\n\n\t\t\t\treturn { extension: value, id: fileType.id }\n\t\t\t})\n\n\t\t\treturn { allowedFileTypes }\n\t\t})\n\t}\n\n\tconst allExtensionsHaveValues = variable.allowedFileTypes.every(\n\t\t({ extension }) => parseExtensionValue(extension).length > 0,\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"File types\">\n\t\t\t\t<Stack direction=\"column\" gap={dimensions.css.inputSpacing} className={doubleColumnClass}>\n\t\t\t\t\t{variable.allowedFileTypes.map(({ id, extension }) => (\n\t\t\t\t\t\t<InputWrapper key={id} className={styles.inputWrapper}>\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tplaceholder=\".mp4\"\n\t\t\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t\t\t\tvalue={extension}\n\t\t\t\t\t\t\t\tonChange={(value, _final, reset) => {\n\t\t\t\t\t\t\t\t\tupdateExtension(value, id, reset)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{!isReadOnly && variable.allowedFileTypes.length > 1 && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName={styles.deleteButton}\n\t\t\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t\t\t\tonClick={() => removeFileType(id)}\n\t\t\t\t\t\t\t\t\ttitle={Dictionary.Remove}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<Button\n\t\t\t\t\ttitle=\"Add file type\"\n\t\t\t\t\tonClick={addFileType}\n\t\t\t\t\tenabled={!isReadOnly && allExtensionsHaveValues}\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow description=\"File types must match the file property of the component where the variable is assigned.\" />\n\t\t</>\n\t)\n}\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport {\n\ttype TwoPixelNumberShorthand,\n\tgetNumericColumnGapFromShorthand,\n\tgetNumericRowGapFromShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { GapAxis } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\n\ninterface GapInputProps {\n\t/** Used to focus the input when the user clicks on the gap handle. */\n\tidForFocus?: string\n\tcolumnGap: Reduced<number>\n\trowGap: Reduced<number>\n\tactiveGapAxis: GapAxis\n\tonChange: (update: (current: TwoPixelNumberShorthand) => TwoPixelNumberShorthand) => void\n\tcolumnGapTestId?: string\n}\n\nexport function GapInput({ idForFocus, columnGap, rowGap, activeGapAxis, onChange, columnGapTestId }: GapInputProps) {\n\tconst updateGap = (newNumericGap: number, axis: \"x\" | \"y\") => {\n\t\tonChange(currentGap => {\n\t\t\tconst currentRowGap = getNumericRowGapFromShorthand(currentGap)\n\t\t\tconst currentColumnGap = getNumericColumnGapFromShorthand(currentGap)\n\n\t\t\tif (activeGapAxis !== \"both\" && currentRowGap === currentColumnGap) {\n\t\t\t\treturn `${newNumericGap}px`\n\t\t\t}\n\n\t\t\tconst newRowGap = axis === \"x\" ? newNumericGap : currentRowGap\n\t\t\tconst newColumnGap = axis === \"y\" ? newNumericGap : currentColumnGap\n\t\t\treturn `${newColumnGap}px ${newRowGap}px`\n\t\t})\n\t}\n\n\tconst updateColumnGap = (newColumnGap: number) => {\n\t\tupdateGap(newColumnGap, \"y\")\n\t}\n\n\tconst updateRowGap = (newRowGap: number) => {\n\t\tupdateGap(newRowGap, \"x\")\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{activeGapAxis !== \"y\" && (\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tid={idForFocus}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tvalue={notFoundToUndefined(rowGap)}\n\t\t\t\t\tonChange={updateRowGap}\n\t\t\t\t\tlabel={activeGapAxis === \"both\" ? \"X\" : undefined}\n\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{activeGapAxis !== \"x\" && (\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tid={idForFocus}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tvalue={notFoundToUndefined(columnGap)}\n\t\t\t\t\tonChange={updateColumnGap}\n\t\t\t\t\tlabel={activeGapAxis === \"both\" ? \"Y\" : undefined}\n\t\t\t\t\tdata-testid={columnGapTestId}\n\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{activeGapAxis !== \"both\" && (\n\t\t\t\t<Slider\n\t\t\t\t\tmin={0}\n\t\t\t\t\tvalue={notFoundToUndefined(activeGapAxis === \"x\" ? rowGap : columnGap)}\n\t\t\t\t\tonChange={activeGapAxis === \"x\" ? updateRowGap : updateColumnGap}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport {\n\ttype TwoPixelNumberShorthand,\n\tgetNumericColumnGapFromShorthand,\n\tgetNumericRowGapFromShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { GapVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { GapInput } from \"../../properties/inputs/GapInput.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: GapVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailGap({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (getUpdatedGap: (current: TwoPixelNumberShorthand) => TwoPixelNumberShorthand) => {\n\t\tupdateVariable(current => {\n\t\t\tconst updatedGap = getUpdatedGap(current.initialValue)\n\t\t\treturn { initialValue: updatedGap }\n\t\t})\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<GapInput\n\t\t\t\tactiveGapAxis=\"both\"\n\t\t\t\trowGap={getNumericRowGapFromShorthand(variable.initialValue)}\n\t\t\t\tcolumnGap={getNumericColumnGapFromShorthand(variable.initialValue)}\n\t\t\t\tonChange={updateInitialValue}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ImageVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type {\n\tReducedImageControlProp,\n\tReducedResponsiveImageControlProp,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useMemo } from \"react\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ImageControlPropRow } from \"../../properties/codeComponentRows/ImageControlPropRow.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: ImageVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailImage({ variable, scopeType, onUpdate }: Props) {\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst currentDefaultValue = useMemo<ImageControlProp>(() => {\n\t\tif (isString(variable.initialValue) || isUndefined(variable.initialValue)) {\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tvalue: isString(variable.initialValue) ? variable.initialValue : undefined,\n\t\t\t}\n\t\t}\n\t\treturn variable.initialValue\n\t}, [variable.initialValue])\n\n\tconst reducedDefaultValue = useMemo<ReducedImageControlProp | ReducedResponsiveImageControlProp>(() => {\n\t\tconst hasImage = isString(currentDefaultValue.value)\n\t\treturn {\n\t\t\ttype: ControlType.ResponsiveImage,\n\t\t\tvalue: currentDefaultValue.value,\n\t\t\t// These are disabled when the image is not set, so let's make sure no value is shown.\n\t\t\talt: hasImage ? (currentDefaultValue.alt ?? \"\") : \"\",\n\t\t\tpositionX: hasImage ? currentDefaultValue.positionX : undefined,\n\t\t\tpositionY: hasImage ? currentDefaultValue.positionY : undefined,\n\t\t}\n\t}, [currentDefaultValue])\n\n\tconst updateInitialValue = (\n\t\t_controlKey: string,\n\t\tgetUpdate: (currentControlProp: ImageControlProp) => ImageControlProp,\n\t) => {\n\t\tconst currentControlProp: ImageControlProp = {\n\t\t\ttype: ControlType.Image,\n\t\t\tvalue: currentDefaultValue.value,\n\t\t}\n\n\t\tif (isString(currentDefaultValue.alt)) currentControlProp.alt = currentDefaultValue.alt\n\t\tif (isString(currentDefaultValue.positionX)) currentControlProp.positionX = currentDefaultValue.positionX\n\t\tif (isString(currentDefaultValue.positionY)) currentControlProp.positionY = currentDefaultValue.positionY\n\n\t\tconst controlProp = getUpdate(currentControlProp)\n\t\tassert(!isDynamicValue(controlProp.value))\n\n\t\tupdateVariable({ initialValue: controlProp })\n\t}\n\n\tconst handleUpload = async (upload: Promise<AssetReference | null>) => {\n\t\tconst reference = await upload\n\t\tif (!reference) return\n\n\t\tupdateVariable({ initialValue: reference })\n\t}\n\n\treturn (\n\t\t<ImageControlPropRow\n\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\tnodeIds={[]}\n\t\t\tcontrolKey={Dictionary.Default}\n\t\t\tcontrolProp={reducedDefaultValue}\n\t\t\tcontrol={{\n\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\ttitle: Dictionary.Default,\n\t\t\t\t// We clear the default asset reference and default image because otherwise the UI\n\t\t\t\t// would allow you to reset to the default, which doesn't make sense for the default\n\t\t\t\t// value input.\n\t\t\t\t__defaultAssetReference: undefined,\n\t\t\t\t__vekterDefault: undefined,\n\t\t\t}}\n\t\t\tonChange={updateInitialValue}\n\t\t\tonUpload={handleUpload}\n\t\t/>\n\t)\n}\n", "import { Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type {\n\tLinkRelValuesVariableDefinition,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SupportedLinkRelValue } from \"document/models/SupportedRelValue.ts\"\nimport { LinkRelValueList } from \"../../properties/panels/LinkRelValuesRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: LinkRelValuesVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailLinkRelValues({ variable, onUpdate }: Props) {\n\tconst isReadOnly = useReadOnly()\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (initialValue: readonly SupportedLinkRelValue[] | undefined) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<Stack className={doubleColumnClass}>\n\t\t\t\t<LinkRelValueList\n\t\t\t\t\treadOnly={isReadOnly}\n\t\t\t\t\tvalue={variable.initialValue}\n\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\tsupportsAdd\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</PanelRow>\n\t)\n}\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype ControlProp,\n\ttype LocationControlPropValue,\n\tisCoordinate,\n\tisLocation,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedLocationControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type { LocationControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\nconst controlType = ControlType.Location\n\ninterface Props {\n\tcontrolKey: string\n\tcontrol: LocationControlDescription\n\tcontrolProp: ReducedLocationControlProp\n\tonChange(value: ControlProp, prop: string): void\n\tonContextMenu?(event: React.MouseEvent<HTMLElement>): void\n\ttraitTypeKeys?: string[]\n\tsupportsVariables?: boolean\n}\n\nexport function LocationControlPropRow({\n\tcontrolKey,\n\tcontrol,\n\tcontrolProp,\n\tonChange,\n\tonContextMenu,\n\ttraitTypeKeys,\n\tsupportsVariables = false,\n}: Props) {\n\tconst engine = useBaseEngine()\n\n\tconst { value } = controlProp\n\tconst coordinate = isCoordinate(value) ? value : undefined\n\tconst defaultCoordinate = control.defaultValue?.coordinate\n\n\tconst latitude = coordinate?.latitude\n\tconst longitude = coordinate?.longitude\n\n\tconst title = control.title ?? titleCase(controlKey)\n\n\tconst changeValue = useCallback(\n\t\t(newValue: LocationControlPropValue) => {\n\t\t\t// TODO: We currently clear the title and address which is fine because it probably\n\t\t\t// doesn't make sense for the new coordinates. In a future iteration we should\n\t\t\t// automatically set title and address based on a Geocoding API.\n\t\t\tonChange({ type: ControlType.Location, value: newValue }, controlKey)\n\t\t},\n\t\t[onChange, controlKey],\n\t)\n\n\tconst onLatitudeChange = useCallback(\n\t\t(newLatitude: number) => {\n\t\t\tchangeValue({\n\t\t\t\tlatitude: newLatitude,\n\t\t\t\tlongitude: coordinate?.longitude ?? defaultCoordinate?.longitude ?? 0,\n\t\t\t})\n\t\t},\n\t\t[changeValue, coordinate, defaultCoordinate],\n\t)\n\n\tconst onLongitudeChange = useCallback(\n\t\t(newLongitude: number) => {\n\t\t\tchangeValue({\n\t\t\t\tlatitude: coordinate?.latitude ?? defaultCoordinate?.latitude ?? 0,\n\t\t\t\tlongitude: newLongitude,\n\t\t\t})\n\t\t},\n\t\t[changeValue, coordinate, defaultCoordinate],\n\t)\n\n\tconst resetToDefault = useCallback(() => {\n\t\tchangeValue(defaultCoordinate)\n\t}, [changeValue, defaultCoordinate])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst name = control.title || titleCase(controlKey)\n\t\t\tconst initialCoordinate = coordinate ?? defaultCoordinate\n\t\t\tconst initialValue = initialCoordinate ? { coordinate: initialCoordinate } : undefined\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: controlType,\n\t\t\t\tname,\n\t\t\t\tinitialValue,\n\t\t\t})\n\t\t\tif (variableRef) changeValue(variableRef)\n\t\t},\n\t\t[changeValue, controlKey, control, coordinate, defaultCoordinate],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isVariableReference(value)) return\n\n\t\tconst variableValue = getVariableValue(engine, value)\n\t\tconst newValue = isLocation(variableValue) ? variableValue.coordinate : undefined\n\t\tchangeValue(newValue)\n\t}, [changeValue, value])\n\n\tconst resetEnabled = !isUndefined(coordinate) && !isEqual(coordinate, defaultCoordinate)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\ttitle={title}\n\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\t\tonResetToDefault={resetToDefault}\n\t\t\t\tresetToDefaultEnabled={resetEnabled}\n\t\t\t\t// Variables\n\t\t\t\tsupportsVariables={supportsVariables}\n\t\t\t\tvariableType={supportedVariableTypesByControlType[controlType]}\n\t\t\t\tdynamicValue={isVariableReference(value) ? value : null}\n\t\t\t\tonSelectVariable={changeValue}\n\t\t\t\tonCreateVariable={createVariable}\n\t\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\t>\n\t\t\t\t{isVariableReference(value) ? (\n\t\t\t\t\t<VariableReferenceButton\n\t\t\t\t\t\texpectedType={supportedVariableTypesByControlType[controlType]}\n\t\t\t\t\t\treference={value}\n\t\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isMixed(value) ? undefined : latitude}\n\t\t\t\t\t\tonChange={onLatitudeChange}\n\t\t\t\t\t\tmin={-90}\n\t\t\t\t\t\tmax={90}\n\t\t\t\t\t\tstep={0.01}\n\t\t\t\t\t\tlabel=\"Lat\"\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t{!isVariableReference(value) && (\n\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isMixed(value) ? undefined : longitude}\n\t\t\t\t\t\tonChange={onLongitudeChange}\n\t\t\t\t\t\tmin={-180}\n\t\t\t\t\t\tmax={180}\n\t\t\t\t\t\tstep={0.01}\n\t\t\t\t\t\tlabel=\"Long\"\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { LocationVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { type ControlProp, isCoordinate } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { LocationControlPropRow } from \"../../properties/codeComponentRows/LocationControlPropRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: LocationVariableDefinition\n\tonUpdate(getUpdate: (current: VariableOrDivider) => VariableOrDivider): void\n\tscopeType: ScopeType\n}\n\nexport function VariableDetailLocation({ variable, onUpdate, scopeType }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (controlProp: ControlProp) => {\n\t\tassert(controlProp.type === ControlType.Location, \"Expected location control prop\")\n\t\tconst value = controlProp.value\n\t\tassert(!isDynamicValue(value), \"Dynamic values are not supported as variable defaults\")\n\n\t\tconst initialValue = isCoordinate(value) ? { coordinate: value } : undefined\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<LocationControlPropRow\n\t\t\tcontrolKey=\"default\"\n\t\t\tcontrolProp={{\n\t\t\t\ttype: ControlType.Location,\n\t\t\t\tvalue: variable.initialValue?.coordinate,\n\t\t\t\ttitle: undefined,\n\t\t\t\taddress: undefined,\n\t\t\t}}\n\t\t\tcontrol={{\n\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\ttitle: Dictionary.Default,\n\t\t\t}}\n\t\t\tonChange={updateInitialValue}\n\t\t/>\n\t)\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport {\n\ttype MultiCollectionReferenceVariableDefinition,\n\ttype VariableOrDivider,\n\tisOptionalVariable,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { MultiCollectionReferenceInput } from \"../../contentManagement/MultiCollectionReferenceInput.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: MultiCollectionReferenceVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailMultiCollectionReference({ variable, scopeType, onUpdate }: Props) {\n\tconst dataDefinition = useDataForIdentifier(variable.dataIdentifier)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst value = variable.initialValue ?? []\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tfunction updateInitialValue(initialValue: string[] | undefined) {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title={Dictionary.Collection}>\n\t\t\t\t<PopupButton enabled={false} wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem selected title={dataDefinition?.name ?? Dictionary.Unknown} />\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t{!isOptional && (\n\t\t\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t\t\t<MultiCollectionReferenceInput\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t\tdataIdentifier={variable.dataIdentifier}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { Button, NumberInputWithTicker, Slider, Stepper, useReadOnly } from \"@framerjs/fresco\"\nimport { assert, isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { createComputedValue, isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { createFetchDataValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { NumberControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedNumberControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { NumberControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\nconst controlType = ControlType.Number\n\nfunction getPopoutId(prop: string): string {\n\treturn `number-input-row-popout-${prop}`\n}\n\ninterface Props {\n\tcontrolProp: ReducedNumberControlProp\n\tcontrolKey: string\n\tcontrol: NumberControlDescription\n\tonChange: (value: NumberControlProp, prop: string) => void\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n\tsortable?: boolean\n\ttraitTypeKeys?: string[]\n\tsupportsVariables?: boolean\n\tsupportsComputedValues?: boolean\n\tsupportsFetchDataValues?: boolean\n\tnodeIds: NodeID[]\n}\n\nexport function NumberControlPropRow({\n\tcontrolProp,\n\tcontrolKey,\n\tcontrol,\n\tonChange,\n\tonContextMenu,\n\tsortable,\n\ttraitTypeKeys,\n\tsupportsVariables = false,\n\tsupportsComputedValues = false,\n\tsupportsFetchDataValues = false,\n\tnodeIds,\n}: Props) {\n\tconst readOnly = useReadOnly()\n\tconst popoutId = getPopoutId(controlKey)\n\tconst { value } = controlProp\n\n\tconst defaultValue = isNumber(control.defaultValue) ? control.defaultValue : undefined\n\tconst numberValue = isNumber(value) ? value : (defaultValue ?? 0)\n\n\tconst step = control.step || \"nudge\"\n\n\tconst title = sortable ? undefined : control.title || titleCase(controlKey)\n\n\tconst changeValue = useCallback(\n\t\t(newValue: number | null | DynamicValue) => {\n\t\t\tonChange({ type: control.type, value: newValue }, controlKey)\n\t\t},\n\t\t[onChange, control, controlKey],\n\t)\n\n\tconst clearValue = useCallback(() => {\n\t\tassert(control.optional, \"Only optional controls can be cleared\")\n\t\tchangeValue(null)\n\t}, [changeValue, control])\n\n\tconst changeRound = useCallback(\n\t\t(newValue: number) => {\n\t\t\tchangeValue(Math.round(newValue))\n\t\t},\n\t\t[changeValue],\n\t)\n\n\tconst resetToDefault = useCallback(() => {\n\t\tif (isNumber(defaultValue)) {\n\t\t\tchangeValue(defaultValue)\n\t\t}\n\t}, [changeValue, defaultValue])\n\n\tconst selectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tchangeValue(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[changeValue, popoutId],\n\t)\n\n\tconst selectFetchDataValue = useCallback(() => {\n\t\tconst fetchDataValue = createFetchDataValue({\n\t\t\ttype: ControlType.Number,\n\t\t\tvalue: isNumber(value) ? value : 0,\n\t\t})\n\t\tconst computedValue = createComputedValue(ControlType.Number, fetchDataValue, [])\n\n\t\tselectComputedValue(computedValue)\n\n\t\treturn computedValue\n\t}, [selectComputedValue, value])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst name = control.title || titleCase(controlKey)\n\t\t\tconst initialValue = isNumber(value) ? value : (defaultValue ?? 0)\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: controlType,\n\t\t\t\tname,\n\t\t\t\tinitialValue,\n\t\t\t\toptions: {\n\t\t\t\t\tmin: control.min,\n\t\t\t\t\tmax: control.max,\n\t\t\t\t\tstep: control.step,\n\t\t\t\t\tdisplayStepper: control.displayStepper,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (variableRef) changeValue(variableRef)\n\t\t},\n\t\t[changeValue, value, defaultValue, control, controlKey],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(value)) return\n\n\t\tif (isVariableReference(value)) {\n\t\t\tconst variableValue = getVariableValue(engine, value)\n\t\t\tconst newValue = isNumber(variableValue) ? variableValue : (defaultValue ?? 0)\n\t\t\tchangeValue(newValue)\n\t\t} else if (isComputedValue(value)) {\n\t\t\tchangeValue(defaultValue ?? 0)\n\t\t} else {\n\t\t\tshouldBeNever(value)\n\t\t}\n\t}, [changeValue, value, defaultValue])\n\n\tconst changeInputValue = isNumber(step) && step >= 1 ? changeRound : changeValue\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonResetToDefault={!sortable ? resetToDefault : undefined}\n\t\t\tresetToDefaultEnabled={isNumber(defaultValue) && defaultValue !== value}\n\t\t\tvariableType={supportedVariableTypesByControlType[controlType]}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\tonSelectVariable={changeValue}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\twithReorderControl={sortable}\n\t\t\treorderColumnCount={2}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tsupportsComputedValues={supportsComputedValues}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t\tsupportsFetchDataValues={supportsFetchDataValues}\n\t\t\tonSelectFetchDataValue={selectFetchDataValue}\n\t\t\tdeleteEnabled={control.optional === true && value !== null}\n\t\t\tdeleteTitle={Dictionary.Clear}\n\t\t\tonDelete={clearValue}\n\t\t>\n\t\t\t{isDynamicValue(value) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={control}\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[controlType]}\n\t\t\t\t\tonChangeDynamicValue={changeValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tsupportsFetchDataValues={supportsFetchDataValues}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isNumber(value) || isMixed(value) ? value : undefined}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t\tonChange={changeInputValue}\n\t\t\t\t\t\tmin={control.min}\n\t\t\t\t\t\tmax={control.max}\n\t\t\t\t\t\tunit={control.unit}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t/>\n\t\t\t\t\t{control.optional ? (\n\t\t\t\t\t\t<Button enabled={!readOnly && value !== null} onClick={clearValue}>\n\t\t\t\t\t\t\t{Dictionary.Clear}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{control.displayStepper ? (\n\t\t\t\t\t\t\t\t<Stepper\n\t\t\t\t\t\t\t\t\tvalue={numberValue}\n\t\t\t\t\t\t\t\t\tmin={control.min}\n\t\t\t\t\t\t\t\t\tmax={control.max}\n\t\t\t\t\t\t\t\t\tonChange={changeInputValue}\n\t\t\t\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Slider\n\t\t\t\t\t\t\t\t\tvalue={numberValue}\n\t\t\t\t\t\t\t\t\tmin={control.min}\n\t\t\t\t\t\t\t\t\tmax={control.max}\n\t\t\t\t\t\t\t\t\tonChange={changeInputValue}\n\t\t\t\t\t\t\t\t\tstep={step}\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</PanelRow>\n\t)\n}\n", "import {\n\tButton,\n\tIconMinus,\n\tIconPlus,\n\tNumberInputWithTicker,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type {\n\tNumberVariableDefinition,\n\tNumberVariableOptions,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { controlDescriptionFromVariable, isOptionalVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { NumberControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isNull, isNumber } from \"utils/typeChecks.ts\"\nimport { NumberControlPropRow } from \"../../properties/codeComponentRows/NumberControlPropRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: NumberVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailNumber({ variable, scopeType, onUpdate }: Props) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst shouldDisplayControlOption = scopeType !== ScopeType.ContentManagement && scopeType !== ScopeType.WebPage\n\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\n\tconst updateInitialValue = ({ value }: NumberControlProp) => {\n\t\tconst initialValue = value\n\t\tassert(!isDynamicValue(initialValue), \"Dynamic values are not supported as variable defaults\")\n\t\tassert(!isNull(initialValue), \"Number variable can't be set to null\")\n\n\t\tupdateVariable({ initialValue })\n\t}\n\n\tconst optionUpdateHandler = (optionKey: \"min\" | \"max\" | \"step\") => {\n\t\treturn (value: number) => {\n\t\t\tlet initialValue = variable.initialValue\n\t\t\tif (isNumber(initialValue)) {\n\t\t\t\tswitch (optionKey) {\n\t\t\t\t\tcase \"min\":\n\t\t\t\t\t\tinitialValue = Math.max(initialValue, value)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"max\":\n\t\t\t\t\t\tinitialValue = Math.min(initialValue, value)\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tupdateVariable(current => {\n\t\t\t\tconst options = { ...current.options, [optionKey]: value }\n\t\t\t\treturn { initialValue, options }\n\t\t\t})\n\t\t}\n\t}\n\n\tconst increaseStepHandler = (increase: boolean) => {\n\t\tconst currentStep = variable.options?.step ?? 1\n\t\tconst newStep = increase ? currentStep * 10 : currentStep * 0.1\n\t\tconst factor = 10 ** 7 // 32 bit precision\n\t\tconst step = Math.round(newStep * factor) / factor\n\t\tupdateVariable(current => ({ options: { ...current.options, step } }))\n\t}\n\n\tconst displayStepperHandler = (displayStepper: NumberVariableOptions[\"displayStepper\"]) => {\n\t\tupdateVariable(current => ({ options: { ...current.options, displayStepper } }))\n\t}\n\n\tconst unitTypeHandler = (unit: NumberVariableOptions[\"unit\"]) => {\n\t\tupdateVariable(current => ({ options: { ...current.options, unit } }))\n\t}\n\n\tconst clearOptionHandler = (optionKey: keyof NumberVariableOptions) => {\n\t\treturn () => {\n\t\t\tupdateVariable(current => {\n\t\t\t\tconst options = { ...current.options, [optionKey]: undefined }\n\t\t\t\treturn { options }\n\t\t\t})\n\t\t}\n\t}\n\n\tconst { displayStepper = false, step = 1, min, max, unit } = variable.options || {}\n\n\treturn (\n\t\t<>\n\t\t\t{!isOptional && (\n\t\t\t\t<NumberControlPropRow\n\t\t\t\t\tcontrolKey={Dictionary.Default}\n\t\t\t\t\tnodeIds={[]}\n\t\t\t\t\tcontrolProp={{ type: ControlType.Number, value: variable.initialValue }}\n\t\t\t\t\tcontrol={{\n\t\t\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\t\t\ttitle: Dictionary.Default,\n\t\t\t\t\t}}\n\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<PanelRow title={Dictionary.Min}>\n\t\t\t\t<NumberInputWithTicker value={min} onChange={optionUpdateHandler(\"min\")} onClear={clearOptionHandler(\"min\")} />\n\t\t\t\t<Button title={Dictionary.Clear} enabled={isNumber(min) && !isReadOnly} onClick={clearOptionHandler(\"min\")} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Max}>\n\t\t\t\t<NumberInputWithTicker value={max} onChange={optionUpdateHandler(\"max\")} onClear={clearOptionHandler(\"max\")} />\n\t\t\t\t<Button title={Dictionary.Clear} enabled={isNumber(max) && !isReadOnly} onClick={clearOptionHandler(\"max\")} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Step}>\n\t\t\t\t<NumberInputWithTicker value={step} onChange={optionUpdateHandler(\"step\")} />\n\t\t\t\t<SegmentedControl>\n\t\t\t\t\t<SegmentedControlItem title=\"Decrease\" selected={false} identifier={false} onSelect={increaseStepHandler}>\n\t\t\t\t\t\t<IconMinus />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem title=\"Increase\" selected={false} identifier={true} onSelect={increaseStepHandler}>\n\t\t\t\t\t\t<IconPlus />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Unit\">\n\t\t\t\t<PopupButton wrapperStyle={doubleColumn}>\n\t\t\t\t\t<PopupButtonItem title={Dictionary.None} selected={!unit} onSelect={clearOptionHandler(\"unit\")} />\n\t\t\t\t\t<PopupButtonItem<NumberVariableOptions[\"unit\"]>\n\t\t\t\t\t\ttitle=\"Percent %\"\n\t\t\t\t\t\tidentifier=\"%\"\n\t\t\t\t\t\tselected={unit === \"%\"}\n\t\t\t\t\t\tonSelect={unitTypeHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem<NumberVariableOptions[\"unit\"]>\n\t\t\t\t\t\ttitle=\"Degrees \u00B0\"\n\t\t\t\t\t\tidentifier=\"\u00B0\"\n\t\t\t\t\t\tselected={unit === \"\u00B0\"}\n\t\t\t\t\t\tonSelect={unitTypeHandler}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t{shouldDisplayControlOption && (\n\t\t\t\t<PanelRow title=\"Control\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle=\"Slider\"\n\t\t\t\t\t\t\tselected={!displayStepper}\n\t\t\t\t\t\t\tonSelect={displayStepperHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\ttitle=\"Stepper\"\n\t\t\t\t\t\t\tselected={displayStepper}\n\t\t\t\t\t\t\tonSelect={displayStepperHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { FourPixelNumberShorthand } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { PaddingVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { NumberShorthandInput } from \"../../properties/inputs/NumberShorthandInput.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: PaddingVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailPadding({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (initialValue: FourPixelNumberShorthand) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<NumberShorthandInput variant=\"padding\" value={variable.initialValue} onChange={updateInitialValue} />\n\t\t</PanelRow>\n\t)\n}\n", "import { Button, NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\n\ninterface Props {\n\tmaxLength: number | undefined\n\tonChange: (maxLength: number | undefined) => void\n}\n\nexport function MaxLengthRowContent({ maxLength, onChange }: Props) {\n\tconst clearHandler = () => onChange(undefined)\n\n\treturn (\n\t\t<>\n\t\t\t<NumberInputWithTicker precision={0} min={1} value={maxLength} onChange={onChange} onClear={clearHandler} />\n\t\t\t<Button title={Dictionary.Clear} enabled={isNumber(maxLength)} onClick={clearHandler} />\n\t\t</>\n\t)\n}\n\nexport function MaxLengthRow({ maxLength, onChange }: Props) {\n\treturn (\n\t\t<PanelRow title={Dictionary.MaxLength}>\n\t\t\t<MaxLengthRowContent maxLength={maxLength} onChange={onChange} />\n\t\t</PanelRow>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { RichTextVariableDefinition, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { makeSchema, smartComponentVariableSchemaParams } from \"prosemirror/schema/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { RichTextEditorWithToolbar } from \"../../richTextEditor/RichTextEditorWithToolbar.tsx\"\nimport { MaxLengthRow } from \"./MaxLengthRow.tsx\"\nimport { VariableDetailLocalizationRow } from \"./VariableDetailLocalizationRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\n// TODO: implement placeholder within rich text editor\n// More info: https://discuss.prosemirror.net/t/how-to-input-like-placeholder-behavior/705\nconst shouldRenderPlaceholder = false\n\ninterface Props {\n\tvariable: RichTextVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailRichText({ variable, scopeType, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst updateInitialValue = (initialValue: string) => {\n\t\tif (!isString(initialValue)) return\n\t\tupdateVariable({ initialValue })\n\t}\n\n\tconst updatePlaceholder = (placeholder: string) => {\n\t\tupdateVariable(current => ({ options: { ...current.options, placeholder } }))\n\t}\n\n\tconst updateMaxLength = (maxLength: number | undefined) => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tupdateVariable(current => ({ options: { ...current.options, maxLength } }))\n\t}\n\n\tconst { placeholder, maxLength } = variable.options || {}\n\n\tconst isInCMS = scopeType === ScopeType.ContentManagement\n\n\tconst schema = useConstant(() => makeSchema(smartComponentVariableSchemaParams))\n\n\treturn (\n\t\t<>\n\t\t\t{isInCMS && <MaxLengthRow maxLength={maxLength} onChange={updateMaxLength} />}\n\t\t\t{shouldRenderPlaceholder && (\n\t\t\t\t<PanelRow title={Dictionary.Placeholder}>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\tvalue={placeholder ?? \"\"}\n\t\t\t\t\t\tplaceholder={Dictionary.None}\n\t\t\t\t\t\tonChange={updatePlaceholder}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{!isInCMS && (\n\t\t\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t\t\t<RichTextEditorWithToolbar\n\t\t\t\t\t\tvariant=\"legacyCompact\"\n\t\t\t\t\t\tschema={schema}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tdefaultValue={variable.initialValue}\n\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{isInCMS && (\n\t\t\t\t<VariableDetailLocalizationRow\n\t\t\t\t\tpreventLocalization={variable.preventLocalization}\n\t\t\t\t\tupdateVariable={updateVariable}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport {\n\ttype SlugVariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype VariablesAndDividers,\n\tisStringVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { DescriptionRow } from \"../../properties/codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: SlugVariableDefinition\n\tvariables: VariablesAndDividers\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailSlug({ variable, variables, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\n\tconst onUpdateBasedOn = (value: VariableID | undefined) => {\n\t\tconst associatedStringVariable: SlugVariableDefinition[\"associatedStringVariable\"] = value ?? null\n\t\tupdateVariable({ associatedStringVariable })\n\t}\n\n\tconst options = variables.filter(isStringVariableDefinition)\n\n\tconst associatedStringVariable = variable.associatedStringVariable\n\n\tconst hasAssociatedStringVariableSelected = Boolean(\n\t\tvariable.associatedStringVariable && options.some(stringVariable => stringVariable.id === associatedStringVariable),\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Based on\">\n\t\t\t\t<PopupButton wrapperStyle={doubleColumn}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={options.length === 0 ? \"No string variables available\" : Dictionary.None}\n\t\t\t\t\t\tidentifier={undefined}\n\t\t\t\t\t\tselected={!hasAssociatedStringVariableSelected}\n\t\t\t\t\t\tonSelect={onUpdateBasedOn}\n\t\t\t\t\t/>\n\t\t\t\t\t{options.map(stringVariable => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={stringVariable.id}\n\t\t\t\t\t\t\ttitle={stringVariable.name}\n\t\t\t\t\t\t\tidentifier={stringVariable.id}\n\t\t\t\t\t\t\tselected={stringVariable.id === associatedStringVariable}\n\t\t\t\t\t\t\tonSelect={onUpdateBasedOn}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow description=\"e.g. /blog/*post-title*/\" />\n\t\t</>\n\t)\n}\n", "import {\n\tPopupButton,\n\tPopupButtonItem,\n\tReadOnlyContext,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tTextInput,\n\tuseReadOnly,\n} from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type {\n\tStringVariableDefinition,\n\tVariableID,\n\tVariableOrDivider,\n\tVariablesAndDividers,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tcontrolDescriptionFromVariable,\n\tisOptionalVariable,\n\tisStringVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNull, isNullish } from \"utils/typeChecks.ts\"\nimport type { ControlPropChangeHandler } from \"../../properties/codeComponentRows/ControlPropRowChangeHandler.ts\"\nimport { StringControlPropRow } from \"../../properties/codeComponentRows/StringControlPropRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../PopoutButtonWithPreviewSuggestion.tsx\"\nimport { MaxLengthRowContent } from \"./MaxLengthRow.tsx\"\nimport { VariableDetailLocalizationRow, useIgnoreLocalizationIsReadOnly } from \"./VariableDetailLocalizationRow.tsx\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: StringVariableDefinition\n\tscopeType: ScopeType\n\tvariables: VariablesAndDividers\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailString({ variable, variables, scopeType, onUpdate }: Props) {\n\tconst shouldUseAdditiveCmsStringOptions = scopeType === ScopeType.ContentManagement\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\tconst readOnly = useReadOnly()\n\tconst additiveCmsStringOptionsState = useAdditiveCmsStringOptionsState(variable, variables, scopeType)\n\tconst additiveCmsStringOptionsVisibilityState = useAdditiveCmsStringOptionsVisibilityState({\n\t\tvariable,\n\t\tscopeType,\n\t\tonUpdate,\n\t\tisReadOnly: readOnly,\n\t\tshouldUseAdditiveCmsStringOptions,\n\t\toptions: additiveCmsStringOptionsState,\n\t})\n\n\tconst updateInitialValue: ControlPropChangeHandler<ControlType.String> = (_controlKey, getUpdate) => {\n\t\tconst controlProp = getUpdate({\n\t\t\ttype: ControlType.String,\n\t\t\tvalue: variable.initialValue ?? null,\n\t\t})\n\n\t\tconst initialValue = controlProp.value\n\t\tassert(!isDynamicValue(initialValue), \"Dynamic values are not supported as variable defaults\")\n\t\tassert(!isNull(initialValue), \"String variable can't be set to null\")\n\n\t\tupdateVariable({ initialValue, fallbackValue: \"initialValue\" })\n\t}\n\n\tconst updatePlaceholder = (placeholder: string) => {\n\t\tupdateVariable(current => ({\n\t\t\toptions: {\n\t\t\t\t...current.options,\n\t\t\t\tplaceholder: shouldUseAdditiveCmsStringOptions ? placeholder || undefined : placeholder,\n\t\t\t},\n\t\t}))\n\t}\n\n\tconst updateDisplayTextArea = (displayTextArea: boolean) => {\n\t\tupdateVariable(current => ({ options: { ...current.options, displayTextArea } }))\n\t}\n\n\tconst updateMaxLength = (maxLength: number | undefined) => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tupdateVariable(current => ({ options: { ...current.options, maxLength } }))\n\t}\n\n\tconst updateFallbackValue = (fallbackValue: StringVariableDefinition[\"fallbackValue\"]) => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tupdateVariable({ fallbackValue })\n\t}\n\n\tconst updateAssociatedStringVariable = (associatedStringVariable: VariableID) => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tupdateVariable({ associatedStringVariable })\n\t}\n\n\tconst { fallbackValue = \"initialValue\", associatedStringVariable } = variable\n\tconst { placeholder, displayTextArea = false, maxLength } = variable.options || {}\n\tconst { basedOnOptions, shouldDisplayBasedOnOptions } = additiveCmsStringOptionsState\n\tconst canDeleteAdditiveOptions = shouldUseAdditiveCmsStringOptions && !readOnly\n\n\treturn (\n\t\t<>\n\t\t\t{scopeType !== ScopeType.WebPage && (\n\t\t\t\t<PanelRow title=\"Text Area\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={displayTextArea}\n\t\t\t\t\t\t\tonSelect={updateDisplayTextArea}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={!displayTextArea}\n\t\t\t\t\t\t\tonSelect={updateDisplayTextArea}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{additiveCmsStringOptionsVisibilityState.shouldShowDefaultRow && !isOptional && (\n\t\t\t\t<>\n\t\t\t\t\t{!shouldDisplayBasedOnOptions && (\n\t\t\t\t\t\t<StringControlPropRow\n\t\t\t\t\t\t\tnodeIds={[]}\n\t\t\t\t\t\t\tcontrolKey={Dictionary.Default}\n\t\t\t\t\t\t\tcontrolProp={{ type: ControlType.String, value: variable.initialValue }}\n\t\t\t\t\t\t\tcontrol={{\n\t\t\t\t\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\t\t\t\t\ttitle: Dictionary.Default,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t\t\trowDelete={\n\t\t\t\t\t\t\t\tshouldUseAdditiveCmsStringOptions\n\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\tonDelete: additiveCmsStringOptionsVisibilityState.removeDefaultRow,\n\t\t\t\t\t\t\t\t\t\t\tenabled: canDeleteAdditiveOptions,\n\t\t\t\t\t\t\t\t\t\t\ttitle: Dictionary.Remove,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t: undefined\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{shouldDisplayBasedOnOptions && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PanelRow\n\t\t\t\t\t\t\t\ttitle={Dictionary.Default}\n\t\t\t\t\t\t\t\tonDelete={\n\t\t\t\t\t\t\t\t\tshouldUseAdditiveCmsStringOptions\n\t\t\t\t\t\t\t\t\t\t? additiveCmsStringOptionsVisibilityState.removeDefaultRow\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdeleteEnabled={canDeleteAdditiveOptions}\n\t\t\t\t\t\t\t\tdeleteTitle={Dictionary.Remove}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t\t\t\t<SegmentedControlItem<StringVariableDefinition[\"fallbackValue\"]>\n\t\t\t\t\t\t\t\t\t\ttitle={Dictionary.Value}\n\t\t\t\t\t\t\t\t\t\tidentifier=\"initialValue\"\n\t\t\t\t\t\t\t\t\t\tselected={fallbackValue === \"initialValue\"}\n\t\t\t\t\t\t\t\t\t\tonSelect={updateFallbackValue}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<SegmentedControlItem<StringVariableDefinition[\"fallbackValue\"]>\n\t\t\t\t\t\t\t\t\t\ttitle=\"Based on\"\n\t\t\t\t\t\t\t\t\t\tidentifier=\"associatedVariable\"\n\t\t\t\t\t\t\t\t\t\tselected={fallbackValue === \"associatedVariable\"}\n\t\t\t\t\t\t\t\t\t\tonSelect={updateFallbackValue}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t\t{fallbackValue === \"initialValue\" && (\n\t\t\t\t\t\t\t\t<StringControlPropRow\n\t\t\t\t\t\t\t\t\tnodeIds={[]}\n\t\t\t\t\t\t\t\t\tcontrolKey={basedOnOptions.length > 0 ? \"\" : Dictionary.Default}\n\t\t\t\t\t\t\t\t\tcontrolProp={{ type: ControlType.String, value: variable.initialValue }}\n\t\t\t\t\t\t\t\t\tcontrol={{\n\t\t\t\t\t\t\t\t\t\t...controlDescriptionFromVariable(engine.tree, engine.componentLoader, variable, scopeType),\n\t\t\t\t\t\t\t\t\t\ttitle: \"\",\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonChange={updateInitialValue}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{fallbackValue === \"associatedVariable\" && (\n\t\t\t\t\t\t\t\t<PanelRow title=\"\">\n\t\t\t\t\t\t\t\t\t<PopupButton wrapperStyle={doubleColumn}>\n\t\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\t\ttitle=\"Choose Field\u2026\"\n\t\t\t\t\t\t\t\t\t\t\tidentifier={undefined}\n\t\t\t\t\t\t\t\t\t\t\tselected\n\t\t\t\t\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t\t\t\t\t\tvisible={basedOnOptions.every(option => option.id !== associatedStringVariable)}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{basedOnOptions.map(stringVariable => (\n\t\t\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\t\t\tkey={stringVariable.id}\n\t\t\t\t\t\t\t\t\t\t\t\ttitle={stringVariable.name}\n\t\t\t\t\t\t\t\t\t\t\t\tidentifier={stringVariable.id}\n\t\t\t\t\t\t\t\t\t\t\t\tselected={stringVariable.id === associatedStringVariable}\n\t\t\t\t\t\t\t\t\t\t\t\tonSelect={updateAssociatedStringVariable}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t\t\t\t</PanelRow>\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\t{additiveCmsStringOptionsVisibilityState.shouldShowPlaceholderRow && (\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle={Dictionary.Placeholder}\n\t\t\t\t\tonDelete={\n\t\t\t\t\t\tshouldUseAdditiveCmsStringOptions ? additiveCmsStringOptionsVisibilityState.removePlaceholderRow : undefined\n\t\t\t\t\t}\n\t\t\t\t\tdeleteEnabled={canDeleteAdditiveOptions}\n\t\t\t\t\tdeleteTitle={Dictionary.Remove}\n\t\t\t\t>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\tvalue={placeholder ?? \"\"}\n\t\t\t\t\t\tplaceholder={Dictionary.None}\n\t\t\t\t\t\tonChange={updatePlaceholder}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{additiveCmsStringOptionsVisibilityState.shouldShowMaxLengthRow && (\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle={Dictionary.MaxLength}\n\t\t\t\t\tonDelete={\n\t\t\t\t\t\tshouldUseAdditiveCmsStringOptions ? additiveCmsStringOptionsVisibilityState.removeMaxLengthRow : undefined\n\t\t\t\t\t}\n\t\t\t\t\tdeleteEnabled={canDeleteAdditiveOptions}\n\t\t\t\t\tdeleteTitle={Dictionary.Remove}\n\t\t\t\t>\n\t\t\t\t\t<MaxLengthRowContent maxLength={maxLength} onChange={updateMaxLength} />\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{additiveCmsStringOptionsVisibilityState.shouldShowLocalizationRow && (\n\t\t\t\t<VariableDetailLocalizationRow\n\t\t\t\t\tpreventLocalization={variable.preventLocalization}\n\t\t\t\t\tupdateVariable={updateVariable}\n\t\t\t\t\tonDelete={\n\t\t\t\t\t\tshouldUseAdditiveCmsStringOptions\n\t\t\t\t\t\t\t? additiveCmsStringOptionsVisibilityState.removeLocalizationRow\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{shouldUseAdditiveCmsStringOptions && (\n\t\t\t\t<VariableDetailAddSettingsRow visibilityOptions={additiveCmsStringOptionsVisibilityState.visibilityOptions} />\n\t\t\t)}\n\t\t</>\n\t)\n}\n\ninterface AdditiveCmsStringOptionsState {\n\tbasedOnOptions: readonly StringVariableDefinition[]\n\tshouldDisplayBasedOnOptions: boolean\n\tsupportsPlaceholder: boolean\n\tdefaultValueIsNonDefault: boolean\n\tplaceholderIsNonDefault: boolean\n\tmaxLengthIsNonDefault: boolean\n}\n\nfunction useAdditiveCmsStringOptionsState(\n\tvariable: StringVariableDefinition,\n\tvariables: VariablesAndDividers,\n\tscopeType: ScopeType,\n): AdditiveCmsStringOptionsState {\n\tconst basedOnOptions = React.useMemo((): StringVariableDefinition[] => {\n\t\tif (scopeType !== ScopeType.ContentManagement) return []\n\t\treturn variables.filter((availableVariable): availableVariable is StringVariableDefinition => {\n\t\t\treturn isStringVariableDefinition(availableVariable) && availableVariable.id !== variable.id\n\t\t})\n\t}, [scopeType, variable.id, variables])\n\n\tconst { fallbackValue = \"initialValue\", associatedStringVariable } = variable\n\tconst { placeholder, maxLength } = variable.options || {}\n\tconst shouldDisplayBasedOnOptions = scopeType === ScopeType.ContentManagement && basedOnOptions.length > 0\n\tconst supportsPlaceholder = !shouldDisplayBasedOnOptions || fallbackValue !== \"associatedVariable\"\n\tconst hasAssociatedStringVariable = !isNullish(associatedStringVariable)\n\n\treturn {\n\t\tbasedOnOptions,\n\t\tshouldDisplayBasedOnOptions,\n\t\tsupportsPlaceholder,\n\t\tdefaultValueIsNonDefault:\n\t\t\tvariable.initialValue !== \"\" || fallbackValue !== \"initialValue\" || hasAssociatedStringVariable,\n\t\tplaceholderIsNonDefault: Boolean(placeholder),\n\t\tmaxLengthIsNonDefault: maxLength !== undefined,\n\t}\n}\n\ninterface VariableDetailAddSettingsRowProps {\n\tvisibilityOptions: readonly MenuItemOptions[]\n}\n\nfunction VariableDetailAddSettingsRow({ visibilityOptions }: VariableDetailAddSettingsRowProps) {\n\tconst displayVisibilityMenu = React.useCallback(\n\t\t(target: HTMLDivElement) => {\n\t\t\tif (visibilityOptions.length === 0) return\n\n\t\t\tconst clientRect = target.getBoundingClientRect()\n\t\t\tengine.stores.contextMenuStore.show(visibilityOptions, {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: clientRect.left,\n\t\t\t\t\ty: clientRect.top,\n\t\t\t\t\twidth: clientRect.width,\n\t\t\t\t\theight: clientRect.height,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[visibilityOptions],\n\t)\n\n\tconst handleMouseDown = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tdisplayVisibilityMenu(event.currentTarget)\n\t\t},\n\t\t[displayVisibilityMenu],\n\t)\n\n\tconst handleKeyDown = React.useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (event.key !== \"Enter\" && event.key !== \" \") return\n\t\t\tevent.preventDefault()\n\t\t\tdisplayVisibilityMenu(event.currentTarget)\n\t\t},\n\t\t[displayVisibilityMenu],\n\t)\n\n\tif (visibilityOptions.length === 0) return null\n\n\treturn (\n\t\t<PanelRow>\n\t\t\t<ReadOnlyContext.Provider value={false}>\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"stringVariableOptions\"\n\t\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t\taria-label=\"Add Setting\"\n\t\t\t\t\ttooltipTitle=\"Add Setting\"\n\t\t\t\t/>\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</PanelRow>\n\t)\n}\n\ninterface AdditiveCmsStringOptionsVisibilityState {\n\tshouldShowDefaultRow: boolean\n\tshouldShowPlaceholderRow: boolean\n\tshouldShowMaxLengthRow: boolean\n\tshouldShowLocalizationRow: boolean\n\tremoveDefaultRow: () => void\n\tremovePlaceholderRow: () => void\n\tremoveMaxLengthRow: () => void\n\tremoveLocalizationRow: () => void\n\tvisibilityOptions: readonly MenuItemOptions[]\n}\n\ninterface UseAdditiveCmsStringOptionsVisibilityStateProps {\n\tvariable: StringVariableDefinition\n\tscopeType: ScopeType\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n\tisReadOnly: boolean\n\tshouldUseAdditiveCmsStringOptions: boolean\n\toptions: AdditiveCmsStringOptionsState\n}\n\nfunction useAdditiveCmsStringOptionsVisibilityState({\n\tvariable,\n\tscopeType,\n\tonUpdate,\n\tisReadOnly,\n\tshouldUseAdditiveCmsStringOptions,\n\toptions,\n}: UseAdditiveCmsStringOptionsVisibilityStateProps): AdditiveCmsStringOptionsVisibilityState {\n\tconst updateVariable = useUpdateVariableOfType(ControlType.String, onUpdate)\n\tconst isOptional = isOptionalVariable(variable, scopeType)\n\tconst ignoreLocalizationIsReadOnly = useIgnoreLocalizationIsReadOnly()\n\tconst { supportsPlaceholder, defaultValueIsNonDefault, placeholderIsNonDefault, maxLengthIsNonDefault } = options\n\tconst [defaultRowVisible, setDefaultRowVisible] = React.useState(defaultValueIsNonDefault)\n\tconst [placeholderRowVisible, setPlaceholderRowVisible] = React.useState(placeholderIsNonDefault)\n\tconst [maxLengthRowVisible, setMaxLengthRowVisible] = React.useState(maxLengthIsNonDefault)\n\tconst [localizationRowVisible, setLocalizationRowVisible] = React.useState(variable.preventLocalization === true)\n\n\tconst [previousVariableId, setPreviousVariableId] = React.useState(variable.id)\n\tif (previousVariableId !== variable.id) {\n\t\t// Reset synchronously on variable switches so the next variable never renders with the previous row visibility state.\n\t\tsetPreviousVariableId(variable.id)\n\t\tsetDefaultRowVisible(defaultValueIsNonDefault)\n\t\tsetPlaceholderRowVisible(placeholderIsNonDefault)\n\t\tsetMaxLengthRowVisible(maxLengthIsNonDefault)\n\t\tsetLocalizationRowVisible(variable.preventLocalization === true)\n\t}\n\n\tconst shouldShowDefaultRow = !shouldUseAdditiveCmsStringOptions || defaultRowVisible || defaultValueIsNonDefault\n\tconst shouldShowPlaceholderRow =\n\t\tscopeType !== ScopeType.WebPage &&\n\t\tsupportsPlaceholder &&\n\t\t(shouldUseAdditiveCmsStringOptions ? placeholderRowVisible || placeholderIsNonDefault : true)\n\tconst shouldShowMaxLengthRow =\n\t\tscopeType === ScopeType.ContentManagement &&\n\t\t(!shouldUseAdditiveCmsStringOptions || maxLengthRowVisible || maxLengthIsNonDefault)\n\tconst shouldShowLocalizationRow =\n\t\tscopeType === ScopeType.ContentManagement &&\n\t\t(!shouldUseAdditiveCmsStringOptions || variable.preventLocalization === true || localizationRowVisible)\n\n\tconst removeDefaultRow = React.useCallback(() => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tsetDefaultRowVisible(false)\n\t\tif (!defaultValueIsNonDefault) return\n\t\tupdateVariable({\n\t\t\tinitialValue: \"\",\n\t\t\tfallbackValue: \"initialValue\",\n\t\t\tassociatedStringVariable: null,\n\t\t})\n\t}, [defaultValueIsNonDefault, scopeType, updateVariable])\n\n\tconst removePlaceholderRow = React.useCallback(() => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tsetPlaceholderRowVisible(false)\n\t\tif (!placeholderIsNonDefault) return\n\t\tupdateVariable(current => ({\n\t\t\toptions: {\n\t\t\t\t...current.options,\n\t\t\t\tplaceholder: undefined,\n\t\t\t},\n\t\t}))\n\t}, [placeholderIsNonDefault, scopeType, updateVariable])\n\n\tconst removeMaxLengthRow = React.useCallback(() => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tsetMaxLengthRowVisible(false)\n\t\tif (!maxLengthIsNonDefault) return\n\t\tupdateVariable(current => ({\n\t\t\toptions: {\n\t\t\t\t...current.options,\n\t\t\t\tmaxLength: undefined,\n\t\t\t},\n\t\t}))\n\t}, [maxLengthIsNonDefault, scopeType, updateVariable])\n\n\tconst removeLocalizationRow = React.useCallback(() => {\n\t\tassert(scopeType === ScopeType.ContentManagement)\n\t\tsetLocalizationRowVisible(false)\n\t\tif (variable.preventLocalization !== true) return\n\t\tupdateVariable({ preventLocalization: false })\n\t}, [scopeType, updateVariable, variable.preventLocalization])\n\n\tconst visibilityOptions = React.useMemo((): readonly MenuItemOptions[] => {\n\t\tif (!shouldUseAdditiveCmsStringOptions) return []\n\n\t\tconst options: MenuItemOptions[] = []\n\n\t\tif (!isOptional && !shouldShowDefaultRow) {\n\t\t\toptions.push({\n\t\t\t\tlabel: Dictionary.Default,\n\t\t\t\tenabled: !isReadOnly && !defaultValueIsNonDefault,\n\t\t\t\tclick: () => setDefaultRowVisible(!shouldShowDefaultRow),\n\t\t\t})\n\t\t}\n\n\t\tif (supportsPlaceholder && !shouldShowPlaceholderRow) {\n\t\t\toptions.push({\n\t\t\t\tlabel: Dictionary.Placeholder,\n\t\t\t\tenabled: !isReadOnly && !placeholderIsNonDefault,\n\t\t\t\tclick: () => setPlaceholderRowVisible(!shouldShowPlaceholderRow),\n\t\t\t})\n\t\t}\n\n\t\tif (!shouldShowMaxLengthRow) {\n\t\t\toptions.push({\n\t\t\t\tlabel: Dictionary.MaxLength,\n\t\t\t\tenabled: !isReadOnly && !maxLengthIsNonDefault,\n\t\t\t\tclick: () => setMaxLengthRowVisible(!shouldShowMaxLengthRow),\n\t\t\t})\n\t\t}\n\n\t\tif (!shouldShowLocalizationRow) {\n\t\t\toptions.push({\n\t\t\t\tlabel: Dictionary.Localization,\n\t\t\t\tenabled: !ignoreLocalizationIsReadOnly && variable.preventLocalization !== true,\n\t\t\t\tclick: () => setLocalizationRowVisible(!shouldShowLocalizationRow),\n\t\t\t})\n\t\t}\n\n\t\treturn options\n\t}, [\n\t\tdefaultValueIsNonDefault,\n\t\tignoreLocalizationIsReadOnly,\n\t\tisOptional,\n\t\tisReadOnly,\n\t\tmaxLengthIsNonDefault,\n\t\tplaceholderIsNonDefault,\n\t\tshouldShowDefaultRow,\n\t\tshouldShowLocalizationRow,\n\t\tshouldShowMaxLengthRow,\n\t\tshouldShowPlaceholderRow,\n\t\tsupportsPlaceholder,\n\t\tshouldUseAdditiveCmsStringOptions,\n\t\tvariable.preventLocalization,\n\t])\n\n\treturn {\n\t\tshouldShowDefaultRow,\n\t\tshouldShowPlaceholderRow,\n\t\tshouldShowMaxLengthRow,\n\t\tshouldShowLocalizationRow,\n\t\tremoveDefaultRow,\n\t\tremovePlaceholderRow,\n\t\tremoveMaxLengthRow,\n\t\tremoveLocalizationRow,\n\t\tvisibilityOptions,\n\t}\n}\n", "import { assert, assertNever, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withTransition } from \"document/models/CanvasTree/traits/WithTransition.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { withFormBooleanInputType } from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport { withFormInputFocusedStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTransition } from \"document/models/CanvasTree/traits/utils/reduceTransition.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport {\n\tdefaultDurationBasedSpringTransition,\n\tisPartialTransition,\n\ttoVekterTransition,\n} from \"document/models/Transition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { TransitionPopoutButton } from \"../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ntype TransitionTraitType =\n\t| TraitType.Transition\n\t| TraitType.FormInputFocusedTransition\n\t| TraitType.FormBooleanInputCheckedEffect\n\nexport const allTransitionShowTypes: readonly Transition[\"type\"][] = [false, \"spring\", \"tween\"]\n\nfunction getAllowedTransitionShowTypes(traitType: TransitionTraitType): readonly Transition[\"type\"][] {\n\tswitch (traitType) {\n\t\tcase TraitType.Transition:\n\t\t\treturn allTransitionShowTypes\n\t\tcase TraitType.FormInputFocusedTransition:\n\t\tcase TraitType.FormBooleanInputCheckedEffect:\n\t\t\treturn [\"tween\"]\n\t\tdefault:\n\t\t\tassertNever(traitType)\n\t}\n}\n\nfunction getVekterTransitionFromDynamicValue(currentValue: DynamicValue): Transition | undefined {\n\tif (!isVariableReference(currentValue)) return undefined\n\n\tconst variableValue = getVariableValue(engine, currentValue)\n\tif (!isPartialTransition(variableValue)) return\n\n\treturn toVekterTransition(variableValue)\n}\n\nfunction updateNodeWithTransition(\n\tnode: CanvasNode,\n\ttransition: Transition | DynamicValue | undefined,\n\ttraitType: TransitionTraitType,\n) {\n\tswitch (traitType) {\n\t\tcase TraitType.Transition:\n\t\t\tif (isVariant(node)) {\n\t\t\t\tnode.set({ variantTransition: transition })\n\t\t\t} else if (withTransition(node)) {\n\t\t\t\tnode.set({ transition })\n\t\t\t}\n\t\t\tbreak\n\t\tcase TraitType.FormInputFocusedTransition:\n\t\t\tif (withFormInputFocusedStyles(node)) {\n\t\t\t\tassert(!isDynamicValue(transition))\n\t\t\t\tnode.set({ formInputFocusedTransition: transition })\n\t\t\t}\n\t\t\tbreak\n\t\tcase TraitType.FormBooleanInputCheckedEffect:\n\t\t\tif (withFormBooleanInputType(node)) {\n\t\t\t\tassert(!isDynamicValue(transition))\n\t\t\t\tnode.set({ formBooleanInputCheckedTransition: transition })\n\t\t\t}\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(traitType)\n\t}\n}\n\nexport const transitionPopoutId = \"transition-popout\"\n\ninterface Props extends Omit<ReducedTransition, \"onlyNodesWithTransition\"> {\n\tnodeIds: NodeID[]\n\ttraitType: TransitionTraitType\n\tonlyGroundNodeDescendants?: boolean\n\tonAdd?: () => void\n}\n\nexport function TransitionRow({ nodeIds, transition, traitType, onlyGroundNodeDescendants = false, onAdd }: Props) {\n\tconst supportsDynamicValues = traitType === TraitType.Transition\n\n\tconst traitTypeList = useMemo(() => [traitType], [traitType])\n\n\tconst transitionShowTypes = useMemo(() => getAllowedTransitionShowTypes(traitType), [traitType])\n\n\tconst canCopy = !isMixed(transition) && !isUndefined(transition)\n\tconst [canPaste, paste, copy] = useCopyAndPasteSingleProperty(traitType, nodeIds, canCopy)\n\n\tconst updateTransition = useEngineCallback(\n\t\t(value: Transition | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodes(nodeIds)) {\n\t\t\t\tupdateNodeWithTransition(node, value, traitType)\n\t\t\t}\n\t\t},\n\t\t[traitType, nodeIds],\n\t)\n\n\tconst removeTransition = useCallback(() => {\n\t\tupdateTransition(undefined)\n\t}, [updateTransition])\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst initialValue = isPartialTransition(transition)\n\t\t\t\t? toVekterTransition(transition)\n\t\t\t\t: defaultDurationBasedSpringTransition\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\ttype: ControlType.Transition,\n\t\t\t\tinitialValue,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\tname: \"transition\",\n\t\t\t})\n\n\t\t\tif (!variableRef) return\n\t\t\tupdateTransition(variableRef)\n\t\t},\n\t\t[updateTransition, transition],\n\t)\n\n\tconst onSelectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tupdateTransition(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(transitionPopoutId)\n\t\t},\n\t\t[updateTransition],\n\t)\n\n\tconst onRemoveDynamicValue = useEngineCallback(() => {\n\t\tassert(traitType === TraitType.Transition, \"Only transition and variant transition support dynamic values\")\n\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTransition)\n\t\tfor (const node of nodes) {\n\t\t\tconst currentValue = isVariant(node) ? node.variantTransition : node.transition\n\t\t\tif (!isDynamicValue(currentValue)) continue\n\n\t\t\tconst newValue = getVekterTransitionFromDynamicValue(currentValue)\n\t\t\tupdateNodeWithTransition(node, newValue, traitType)\n\t\t}\n\t}, [nodeIds, traitType])\n\n\tlet rowContent: React.ReactNode\n\n\tif (isDynamicValue(transition)) {\n\t\trowContent = (\n\t\t\t<DynamicValueButton\n\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\tvalue={transition}\n\t\t\t\tsupportsComputedValues={supportsDynamicValues}\n\t\t\t\texpectedType={ControlType.Transition}\n\t\t\t\tonChangeDynamicValue={updateTransition}\n\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\tpopoutId={transitionPopoutId}\n\t\t\t\toutputControl={undefined}\n\t\t\t/>\n\t\t)\n\t} else if (isFoundAndNotUndefined(transition)) {\n\t\trowContent = (\n\t\t\t<TransitionPopoutButton\n\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\ttransition={transition}\n\t\t\t\tpopoutId={transitionPopoutId}\n\t\t\t\tonChange={updateTransition}\n\t\t\t\tshowType={transitionShowTypes}\n\t\t\t/>\n\t\t)\n\t} else if (onAdd) {\n\t\trowContent = <PopoutButtonWithPreviewSuggestion type=\"transition\" onClick={onAdd} />\n\t} else {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Transition}\n\t\t\ttraitTypes={traitTypeList}\n\t\t\tsupportsVariables={supportsDynamicValues}\n\t\t\tsupportsComputedValues={supportsDynamicValues}\n\t\t\tdynamicValue={isDynamicValue(transition) ? transition : null}\n\t\t\tvariableType={ControlType.Transition}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={updateTransition}\n\t\t\tcomputedValuePopoutId={transitionPopoutId}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonDelete={!isUndefined(transition) && onlyGroundNodeDescendants === true ? removeTransition : undefined}\n\t\t\tonCopy={copy}\n\t\t\tonPaste={paste}\n\t\t\tcopyEnabled={canCopy}\n\t\t\tpasteEnabled={canPaste}\n\t\t>\n\t\t\t{rowContent}\n\t\t</PanelRow>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type {\n\tTransitionVariableDefinition,\n\tVariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { type Transition, fallbackPhysicsBasedSpringTransition, isTransition } from \"document/models/Transition.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { allTransitionShowTypes } from \"../../properties/rows/TransitionRow.tsx\"\nimport { TransitionPopoutButton } from \"../TransitionEditor/TransitionPopout.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: TransitionVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nexport function VariableDetailTransition({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst updateInitialValue = (initialValue: Transition) => {\n\t\tupdateVariable({ initialValue })\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Default}>\n\t\t\t<TransitionPopoutButton\n\t\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\t\ttitle=\"Value\"\n\t\t\t\tonChange={updateInitialValue}\n\t\t\t\tshowType={allTransitionShowTypes}\n\t\t\t\ttransition={isTransition(variable.initialValue) ? variable.initialValue : fallbackPhysicsBasedSpringTransition}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import {\n\tassert,\n\ttype ModuleExportIdentifierString,\n\tModuleType,\n\tassertNever,\n\tisExternalModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tVariableOrDivider,\n\tVectorSetItemVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useCallback } from \"react\"\nimport { VectorSetItemPopoutButton } from \"../../properties/codeComponentRows/VectorSetItemControlPropRow.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useIsWithinVariableModal } from \"./VariableModalContext.ts\"\nimport { useUpdateVariableOfType } from \"./useUpdateVariableOfType.ts\"\n\ninterface Props {\n\tvariable: VectorSetItemVariableDefinition\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n}\n\nfunction moduleIdForModuleIdentifierString(identifier: ModuleExportIdentifierString) {\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (isExternalModuleIdentifier(parsed)) {\n\t\treturn parsed.moduleId\n\t} else if (isLocalModuleIdentifier(parsed)) {\n\t\treturn engine.stores.modulesStore.forType(ModuleType.Vector).getByStableName(parsed.localIdName).id\n\t}\n\n\tassertNever(parsed)\n}\n\nexport function VariableDetailVectorSetItem({ variable, onUpdate }: Props) {\n\tconst updateVariable = useUpdateVariableOfType(variable.type, onUpdate)\n\tconst isWithinVariableModal = useIsWithinVariableModal()\n\n\tconst updateInitialValue = useCallback(\n\t\t(identifier: ModuleExportIdentifierString) => {\n\t\t\tconst moduleId = moduleIdForModuleIdentifierString(identifier)\n\t\t\tupdateVariable({ initialValue: { identifier, moduleId } })\n\t\t},\n\t\t[updateVariable],\n\t)\n\n\tconst identifier = variable.initialValue.identifier\n\tassert(isModuleExportIdentifier(identifier), \"VectorSetItem initialValue must be a module export identifier.\")\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Icon}>\n\t\t\t<VectorSetItemPopoutButton\n\t\t\t\tonChange={updateInitialValue}\n\t\t\t\tidentifier={identifier}\n\t\t\t\tdefaultIdentifier={identifier}\n\t\t\t\tpopoutId=\"icon-variable-detail\"\n\t\t\t\tdisplayInPopover={isWithinVariableModal}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import type { VariableOrDivider, VariablesAndDividers } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { uniqueVariableName } from \"document/utils/uniqueName.ts\"\n\nexport function createFinalName(variables: VariablesAndDividers, variable: VariableOrDivider, name: string) {\n\tconst existingNames = new Set<string>()\n\tfor (const variableToCheck of variables) {\n\t\tif (variableToCheck.id !== variable.id && variableToCheck.type !== \"divider\") {\n\t\t\texistingNames.add(variableToCheck.name)\n\t\t}\n\t}\n\n\treturn uniqueVariableName(name, existingNames, { isDivider: variable.type === \"divider\" })\n}\n", "import \"VariableRow.styles_ywoicv.wyw.css\"; export const rowHeight = 30;\nexport const themeOverride = \"themeOverride_t1al7nzk\";\nexport const row = \"row_r1dim83o\";\nexport const selectedRow = \"selectedRow_sirqio6\";\nexport const rowTitle = \"rowTitle_r1r4dfvm\";\nexport const iconWrapper = \"iconWrapper_i106w2s\";\nexport const iconWrapperEmpty = \"iconWrapperEmpty_i1pwmq9\";\nexport const dragHandle = \"dragHandle_dfephmj\";\nexport const dragHandleSelected = \"dragHandleSelected_d1dt3oe6\";\nexport const emptyRow = \"emptyRow_eu016vi\";\nexport const dividerContainer = \"dividerContainer_d1w87scl\";\nexport const divider = \"divider_dmobspr\";\nexport const dividerSelected = \"dividerSelected_dfljvkz\";\nexport const dividerTitle = \"dividerTitle_d1l80aum\";\nexport const dividerTitleSelected = \"dividerTitleSelected_d157918m\";", "import {\n\tCenterChild,\n\tIconDragHandle,\n\tStack,\n\tThemeOverride,\n\ttype ThemeOverrideMode,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { VariableID, VariableOrDivider, VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { variableTypeTitle } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type React from \"react\"\nimport { useLayoutEffect, useRef } from \"react\"\nimport { iconForVariable, iconForVariableType } from \"../utils/iconForVariable.tsx\"\nimport * as styles from \"./VariableRow.styles.ts\"\n\ninterface Props {\n\tvariable: VariableOrDivider\n\tselected: boolean\n\treadOnly: boolean\n\tdisplayDragHandle: boolean\n\tthemeOverrideMode?: ThemeOverrideMode\n\tonSelect: (variable: VariableOrDivider) => void\n\tonDelete: (variable: VariableOrDivider) => void\n\tonDuplicate: (variableId: VariableID) => void\n\tanimateToSelection: boolean\n}\n\nexport function VariableRow({\n\tvariable,\n\tselected,\n\treadOnly,\n\tdisplayDragHandle,\n\tthemeOverrideMode,\n\tonDelete,\n\tonSelect,\n\tonDuplicate,\n\tanimateToSelection,\n}: Props) {\n\tconst rowRef = useRef<HTMLDivElement>(null)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tuseLayoutEffect(() => {\n\t\tif (selected) {\n\t\t\tconst behavior = animateToSelection ? \"smooth\" : \"auto\"\n\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tif (!rowRef.current) return\n\t\t\t\trowRef.current.scrollIntoView({ behavior, block: \"nearest\" })\n\t\t\t})\n\t\t}\n\t}, [selected, animateToSelection])\n\n\tfunction displayContextMenu({ clientX, clientY }: React.MouseEvent) {\n\t\tconst isSlug = variable.type === \"slug\"\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tenabled: !isSlug && !readOnly,\n\t\t\t\t\tclick: () => onDuplicate(variable.id),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tenabled: !isSlug && !readOnly,\n\t\t\t\t\tclick: () => onDelete(variable),\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: clientX, y: clientY } },\n\t\t)\n\t}\n\n\tfunction select(event: React.MouseEvent) {\n\t\tevent.stopPropagation()\n\t\tonSelect(variable)\n\t}\n\n\tconst isDivider = variable.type === \"divider\"\n\tconst agentIconForeground = selected ? colors.quickActionsIconComponentTintActive : colors.inputPlaceholder\n\tconst agentIconBackground = selected ? colors.tint : colors.inputBackground\n\n\treturn (\n\t\t// To make the theme override work while dragging, we add another theme override as part of the item\n\t\t<ThemeOverride mode={themeOverrideMode} className={styles.themeOverride}>\n\t\t\t<Stack\n\t\t\t\tref={rowRef}\n\t\t\t\tclassName={cx(styles.row, selected && styles.selectedRow)}\n\t\t\t\talignItems=\"center\"\n\t\t\t\tdirection=\"row\"\n\t\t\t\tpaddingLeft={isDivider ? dimensions.values.variableRowDividerGap : dimensions.values.variableRowPaddingLeft}\n\t\t\t\tpaddingRight={dimensions.values.variableRowPaddingRight}\n\t\t\t\tgap={isDivider ? dimensions.values.variableRowDividerGap : undefined}\n\t\t\t\tonContextMenu={displayContextMenu}\n\t\t\t\tonClick={select}\n\t\t\t>\n\t\t\t\t{isDivider ? (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={styles.dividerContainer}\n\t\t\t\t\t\tgap={dimensions.values.variableRowDividerGap}\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<hr className={cx(styles.divider, selected && styles.dividerSelected)} />\n\t\t\t\t\t\t{variable.name && (\n\t\t\t\t\t\t\t<div className={cx(styles.dividerTitle, selected && styles.dividerTitleSelected)}>{variable.name}</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CenterChild\n\t\t\t\t\t\t\tclassName={styles.iconWrapper}\n\t\t\t\t\t\t\tstyle={agentExperimentEnabled ? { color: agentIconBackground } : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{iconForVariable(variable, {\n\t\t\t\t\t\t\t\tforeground: agentExperimentEnabled ? agentIconForeground : undefined,\n\t\t\t\t\t\t\t\tcompactStringIcon: agentExperimentEnabled,\n\t\t\t\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>{variable.name}</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{displayDragHandle && (\n\t\t\t\t\t<CenterChild className={cx(styles.dragHandle, selected && styles.dragHandleSelected)}>\n\t\t\t\t\t\t<IconDragHandle />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</ThemeOverride>\n\t)\n}\n\ninterface EmptyVariableRowProps {\n\ttype: VariableType\n\tindex: number\n}\n\nexport function EmptyVariableRow({ type, index }: EmptyVariableRowProps) {\n\tconst opacity = Math.max(0, 100 - index * 20) / 100\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName={cx(styles.row, styles.emptyRow)}\n\t\t\tstyle={{ opacity }}\n\t\t\talignItems=\"center\"\n\t\t\tdirection=\"row\"\n\t\t\tpaddingLeft={dimensions.values.variableRowEmptyPadding}\n\t\t\tpaddingRight={dimensions.values.variableRowEmptyPadding}\n\t\t>\n\t\t\t<CenterChild className={cx(styles.iconWrapper, styles.iconWrapperEmpty)}>\n\t\t\t\t{iconForVariableType(type, { agentExperimentEnabled })}\n\t\t\t</CenterChild>\n\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>{variableTypeTitle(type)}</div>\n\t\t</Stack>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { getSelectedCollectionId } from \"utils/collectionUtils.ts\"\n\nexport function useSelectedCollectionId(): MaybeNodeID {\n\treturn useDeprecatedEngineState([engine.stores.selectionStore, EngineChange.Tree], () =>\n\t\tgetSelectedCollectionId(engine),\n\t)\n}\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype WithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { useSelectedCollectionId } from \"document/utils/useSelectedCollectionId.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport {\n\tdeleteVariable,\n\tgetNodeIdsReferencingVariableInScope,\n\tgetPagesUsingVariable,\n} from \"../../properties/utils/deleteVariable.ts\"\nimport { promptIfTriggerEventActionIsUsed } from \"../../properties/utils/eventActions.ts\"\nimport type { DeleteFieldPreventionData } from \"./DeleteFieldPrevention.tsx\"\n\ninterface UseDeleteVariableOptions {\n\tnodeWithVariables: (CanvasNode & WithVariables) | null\n\tisReadOnly: boolean\n\tonPreventDeleteVariable: (\n\t\tdata: DeleteFieldPreventionData,\n\t\tvariableToDelete: VariableDefinition,\n\t\tparentVariableId: VariableID | undefined,\n\t) => void\n}\n\ninterface UseDeleteVariableResult {\n\thandleDeleteVariable: (variableToDelete: VariableOrDivider, parentVariableId?: VariableID) => Promise<void>\n\tvariablePendingDeletionPath: SelectedVariablePath | null\n\tabortDeleteVariableUsageCheck: () => void\n\tisPreventionEnabled: boolean\n}\n\nexport function useDeleteVariable({\n\tnodeWithVariables,\n\tisReadOnly,\n\tonPreventDeleteVariable,\n}: UseDeleteVariableOptions): UseDeleteVariableResult {\n\tconst engine = useAndAssertVekterEngine()\n\tconst selectedCollectionId = useSelectedCollectionId()\n\tconst isPreventionEnabled = useExperimentIsOn(\"preventVariableDeletion\")\n\tconst [variablePendingDeletionPath, setVariablePendingDeletionPath] = useState<SelectedVariablePath | null>(null)\n\tconst deleteCheckAbortController = useRef<AbortController | null>(null)\n\tconst stableOnPreventDeleteVariable = useStableCallback(onPreventDeleteVariable)\n\n\tconst abortDeleteVariableUsageCheck = useCallback(() => {\n\t\tdeleteCheckAbortController.current?.abort()\n\t\tdeleteCheckAbortController.current = null\n\t\tsetVariablePendingDeletionPath(null)\n\t}, [])\n\n\tconst abortOnUnmount = useCallback(() => {\n\t\tdeleteCheckAbortController.current?.abort()\n\t\tdeleteCheckAbortController.current = null\n\t}, [])\n\n\tuseEffect(() => abortOnUnmount, [abortOnUnmount])\n\n\tconst handleDeleteVariable = useCallback(\n\t\tasync (variableToDelete: VariableOrDivider, parentVariableId?: VariableID) => {\n\t\t\tif (isReadOnly || !nodeWithVariables) return\n\n\t\t\tconst performDelete = () => {\n\t\t\t\tif (isVariableDefinition(variableToDelete)) {\n\t\t\t\t\tvoid promptIfTriggerEventActionIsUsed(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tvariableToDelete,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\tengine.scheduler.processWhenReady(() =>\n\t\t\t\t\t\t\t\tdeleteVariable(engine, nodeWithVariables, variableToDelete, parentVariableId),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\"variables\",\n\t\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tengine.scheduler.processWhenReady(() =>\n\t\t\t\t\tdeleteVariable(engine, nodeWithVariables, variableToDelete, parentVariableId),\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (!isPreventionEnabled || variableToDelete.type === \"divider\") {\n\t\t\t\tperformDelete()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst variableToDeletePath: SelectedVariablePath = parentVariableId\n\t\t\t\t? [parentVariableId, variableToDelete.id]\n\t\t\t\t: [variableToDelete.id]\n\n\t\t\tlet preventionData: DeleteFieldPreventionData | null = null\n\n\t\t\tif (isCollectionNode(nodeWithVariables)) {\n\t\t\t\tdeleteCheckAbortController.current?.abort()\n\t\t\t\tconst abortController = new AbortController()\n\t\t\t\tdeleteCheckAbortController.current = abortController\n\n\t\t\t\tconst collectionNode = engine.tree.get(selectedCollectionId)\n\t\t\t\tif (!isCollectionNode(collectionNode)) return\n\n\t\t\t\tengine.stores.variablesStore.selectedVariablePath = variableToDeletePath\n\t\t\t\tsetVariablePendingDeletionPath(variableToDeletePath)\n\n\t\t\t\ttry {\n\t\t\t\t\tconst pagesUsingVariables = await getPagesUsingVariable(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tvariableToDelete.id,\n\t\t\t\t\t\tcollectionNode.instanceIdentifier,\n\t\t\t\t\t\tabortController.signal,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t)\n\n\t\t\t\t\tif (abortController.signal.aborted) return\n\n\t\t\t\t\tif (!isEmptyObject(pagesUsingVariables)) {\n\t\t\t\t\t\tpreventionData = { type: \"pages\", pagesUsingVariables, variableToDeletePath }\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\tif (deleteCheckAbortController.current === abortController) {\n\t\t\t\t\t\tdeleteCheckAbortController.current = null\n\t\t\t\t\t\tsetVariablePendingDeletionPath(null)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst nodeIdsUsingVariable = getNodeIdsReferencingVariableInScope(\n\t\t\t\t\tengine,\n\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\tvariableToDelete.id,\n\t\t\t\t)\n\n\t\t\t\tif (nodeIdsUsingVariable.size > 0) {\n\t\t\t\t\tpreventionData = { type: \"scope\", nodeIdsUsingVariable, variableToDeletePath }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (preventionData) {\n\t\t\t\tstableOnPreventDeleteVariable(preventionData, variableToDelete, parentVariableId)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tperformDelete()\n\t\t},\n\t\t[nodeWithVariables, isReadOnly, isPreventionEnabled, selectedCollectionId],\n\t)\n\n\treturn {\n\t\thandleDeleteVariable,\n\t\tvariablePendingDeletionPath,\n\t\tabortDeleteVariableUsageCheck,\n\t\tisPreventionEnabled,\n\t}\n}\n", "import { triggerVariableDeleteEvent } from \"@framerjs/framer-events\"\nimport { type ModuleExportIdentifierString, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { ensureModulesAreLoaded } from \"code-generation/components/helpers/ensureModulesAreLoaded.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { type CanvasNode, type NodeID, type WebPageNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\tisVariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype WithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { yieldToMain } from \"library/index.ts\"\nimport { forEachVariableReferenceOfNode } from \"utils/updateDynamicValues.ts\"\nimport {\n\tgetVariableListFromVariableParent,\n\tupdateVariableListInVariableParent,\n} from \"../../shared/VariablesModal/getSelectedVariableInfo.ts\"\n\nexport function deleteVariable(\n\tengine: VekterEngine,\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tvariableToDelete: VariableOrDivider,\n\tparentVariableId: VariableID | undefined,\n) {\n\tif (parentVariableId) {\n\t\tconst arrayVariables = getVariableListFromVariableParent(nodeWithVariables, parentVariableId)\n\t\tif (!arrayVariables) return\n\n\t\tconst newArrayVariables = arrayVariables.filter(variable => variable.id !== variableToDelete.id)\n\t\tupdateVariableListInVariableParent(nodeWithVariables, parentVariableId, newArrayVariables)\n\t} else {\n\t\tconst variables = nodeWithVariables.variables.filter(variable => variable.id !== variableToDelete.id)\n\t\tengine.tree.current(nodeWithVariables)?.set({ variables })\n\t}\n\n\tif (isVariableDefinition(variableToDelete)) {\n\t\ttriggerVariableDeleteEvent({ type: variableToDelete.type, variableId: variableToDelete.id })\n\t}\n}\n\nexport type PagesUsingVariable = Record<NodeID, Set<NodeID>>\n\nexport async function getPagesUsingVariable(\n\tengine: VekterEngine,\n\tvariableId: VariableID,\n\tcollectionDataIdentifier: ModuleExportIdentifierString | undefined,\n\tabortSignal: AbortSignal,\n\tfindOneNodePerPage: boolean,\n): Promise<PagesUsingVariable> {\n\tconst YIELD_EVERY_N_NODES = 10\n\t// This is to ensure the web page nodes are loaded before we check for pages using the variable.\n\t// We run in background to avoid showing the default full-document loading modal,\n\t// since the caller handles showing its own loading state.\n\n\tif (!engine.stores.treeStore.getDataTree()) {\n\t\tawait engine.runWithFullyLoadedTreeAsync(() => {}, {\n\t\t\tname: \"load_shallow_scopes_before_delete_collection\",\n\t\t\trunInBackground: true,\n\t\t})\n\t\tif (abortSignal.aborted) return {}\n\t}\n\n\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\tconst nodesUsingCollection = engine.stores.treeStore\n\t\t.query()\n\t\t.partial(true)\n\t\t.wherePropertyEquals(\"dataIdentifier\", collectionDataIdentifier)\n\t\t.iterate()\n\n\t// Use the tree index to only check nodes connected to a collection,\n\t// rather than traversing all web pages and their descendants.\n\tconst pagesUsingVariables: PagesUsingVariable = {}\n\n\tlet nodesProcessed = 0\n\n\tfor (const node of nodesUsingCollection) {\n\t\tif (!hasCollectionDataSource(node)) continue\n\t\tconst pageIdForNode = tree.getScopeNodeFor(node)?.id\n\n\t\tif (!pageIdForNode) continue\n\n\t\t// If we are only looking for one node per page, and the page already has a node referencing the variable, skip it.\n\t\tif (findOneNodePerPage && pagesUsingVariables[pageIdForNode] && pagesUsingVariables[pageIdForNode].size > 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\tnodesProcessed++\n\n\t\t// Yield to the main thread every YIELD_EVERY_N_NODES so the browser can render without freezing the UI on large operations. (e.g. the checking spinner)\n\t\tif (nodesProcessed % YIELD_EVERY_N_NODES === 0) {\n\t\t\tawait yieldToMain()\n\t\t\tif (abortSignal.aborted) return {}\n\t\t}\n\n\t\tfor (const candidate of node.walk()) {\n\t\t\t// Code components use lazy loading, so their definitions might not\n\t\t\t// be in the component loader yet. Ensure them before checking refs otherwise we will get a false negative.\n\t\t\tif (isCodeComponentNode(candidate) && isModuleExportIdentifier(candidate.codeComponentIdentifier)) {\n\t\t\t\ttry {\n\t\t\t\t\tawait ensureModulesAreLoaded(\n\t\t\t\t\t\t[candidate.codeComponentIdentifier],\n\t\t\t\t\t\tengine.stores.modulesStore,\n\t\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\t)\n\t\t\t\t} catch {\n\t\t\t\t\t// Timeout is non-fatal: proceed with whatever definitions are available.\n\t\t\t\t}\n\t\t\t\tif (abortSignal.aborted) return {}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!isNodeReferencingVariable(engine, candidate, variableId, engine.stores.treeStore.getDataTreeOrLoadedTree())\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpagesUsingVariables[pageIdForNode] ??= new Set()\n\t\t\tpagesUsingVariables[pageIdForNode].add(candidate.id)\n\n\t\t\t// If we are only looking for one node per page, break the loop once we have found a node referencing the variable.\n\t\t\tif (findOneNodePerPage) break\n\t\t}\n\t}\n\n\treturn pagesUsingVariables\n}\n\nfunction isNodeReferencingVariable(\n\tengine: VekterEngine,\n\tnode: CanvasNode,\n\tvariableId: VariableID,\n\ttree = engine.tree,\n): boolean {\n\tconst useRawNodeData = tree !== engine.tree\n\tlet found = false\n\n\tconst callback = (variableReference: { id: VariableID }) => {\n\t\tif (variableReference.id === variableId) {\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif (useRawNodeData) {\n\t\tforEachVariableReferenceOfNode(tree, node, \"excludeInherited\", \"readsRawNodeData\", undefined, callback)\n\t} else {\n\t\tforEachVariableReferenceOfNode(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\t\"excludeInherited\",\n\t\t\t\"readsEditableNodeData\",\n\t\t\tengine.componentLoader,\n\t\t\tcallback,\n\t\t)\n\t}\n\n\treturn found\n}\n\nfunction getNodeIdsReferencingVariable(\n\tengine: VekterEngine,\n\twebPageNode: WebPageNode,\n\tvariableId: VariableID,\n\ttree = engine.tree,\n): Set<NodeID> {\n\tconst nodeIdsReferencingVariable: Set<NodeID> = new Set()\n\n\tfor (const node of webPageNode.descendants()) {\n\t\tif (isNodeReferencingVariable(engine, node, variableId, tree)) {\n\t\t\tnodeIdsReferencingVariable.add(node.id)\n\t\t}\n\t}\n\n\treturn nodeIdsReferencingVariable\n}\n\nexport function getNodeIdsReferencingVariableInScope(\n\tengine: VekterEngine,\n\tnodeWithVariables: CanvasNode & WithVariables,\n\tvariableId: VariableID,\n): Set<NodeID> {\n\tconst nodeIdsReferencingVariable: Set<NodeID> = new Set()\n\n\tconst walkableNode = isScopeNode(nodeWithVariables) ? nodeWithVariables.loaded : nodeWithVariables\n\tif (!walkableNode) return nodeIdsReferencingVariable\n\n\tfor (const descendant of walkableNode.descendants()) {\n\t\tif (isNodeReferencingVariable(engine, descendant, variableId)) {\n\t\t\tnodeIdsReferencingVariable.add(descendant.id)\n\t\t}\n\t}\n\n\treturn nodeIdsReferencingVariable\n}\n", "import type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { useEffect } from \"react\"\nimport { isShallowArrayEqual } from \"utils/isShallowEqual.ts\"\nimport { type SelectedVariableInfo, getSelectedVariablePathFromInfo } from \"./getSelectedVariableInfo.ts\"\n\n/**\n * Syncs the resolved selected-variable path back to the store so that other\n * consumers (e.g. moveVariable) always see the up-to-date selection, even\n * when the variable list is reordered or modified by other users.\n */\nexport function useSyncSelectedVariablePath(\n\tselectedVariableInfo: SelectedVariableInfo | null,\n\tselectedVariablePath: SelectedVariablePath | null,\n\ttemporaryVariable: VariableDefinition | null,\n) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tuseEffect(() => {\n\t\tif (temporaryVariable) return\n\t\tif (!selectedVariableInfo) return\n\n\t\tconst pathFromInfo = getSelectedVariablePathFromInfo(selectedVariableInfo)\n\t\tif (!pathFromInfo) return\n\n\t\tif (selectedVariablePath && isShallowArrayEqual(pathFromInfo, selectedVariablePath)) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.variablesStore.selectedVariablePath = pathFromInfo\n\t\t})\n\t}, [selectedVariableInfo, selectedVariablePath, temporaryVariable])\n}\n", "import { List, assert } from \"@framerjs/shared\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableID, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\n\nexport function duplicateVariableWithinArray<T extends VariableOrDivider>(\n\tcurrentVariables: readonly T[],\n\tvariableId: VariableID,\n): readonly T[] | null {\n\tconst index = currentVariables.findIndex(variable => variable.id === variableId)\n\tconst variableToDuplicate = currentVariables[index]\n\tif (!variableToDuplicate) return null\n\n\tassert(variableToDuplicate.type !== \"slug\", \"Slug variables should never be duplicated\")\n\n\tconst existingVariableNames = new Set(currentVariables.map(({ name }) => name))\n\tconst name = uniqueName(variableToDuplicate.name, existingVariableNames)\n\tconst variable = {\n\t\t...variableToDuplicate,\n\t\tid: randomID(),\n\t\tname: variableToDuplicate.type === \"divider\" && !variableToDuplicate.name ? \"\" : name,\n\t}\n\treturn List.insert(currentVariables, index + 1, variable)\n}\n", "import { assert, List } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisArrayItemVariableDefinition,\n\tisVariableDefinition,\n\twithPreventLocalization,\n\twithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { isShallowArrayEqual } from \"utils/isShallowEqual.ts\"\nimport { getIgnoreLocalizationIsReadOnly } from \"./VariableDetailLocalizationRow.tsx\"\nimport { duplicateVariableWithinArray } from \"./duplicateVariable.ts\"\nimport { getVariableListFromVariableParent, updateVariableListInVariableParent } from \"./getSelectedVariableInfo.ts\"\n\ninterface UseVariableActionsOptions {\n\tnodeWithVariablesId: NodeID | null\n\tisReadOnly: boolean\n}\n\nexport function useVariableActions({ nodeWithVariablesId, isReadOnly }: UseVariableActionsOptions) {\n\tconst moveVariable = useEngineCallback(\n\t\t(fromIndex: number, toIndex: number, parentVariableId?: VariableID) => {\n\t\t\tif (isReadOnly) return\n\t\t\tif (!nodeWithVariablesId) return\n\n\t\t\tconst currentNode = engine.tree.getNodeWithTrait(nodeWithVariablesId, withVariables)\n\t\t\tif (!currentNode) return\n\n\t\t\tif (parentVariableId) {\n\t\t\t\tconst arrayVariables = getVariableListFromVariableParent(currentNode, parentVariableId)\n\t\t\t\tif (!arrayVariables) return\n\n\t\t\t\tconst updatedArrayVariables = List.move(arrayVariables, fromIndex, toIndex)\n\t\t\t\tupdateVariableListInVariableParent(currentNode, parentVariableId, updatedArrayVariables)\n\t\t\t} else {\n\t\t\t\tconst updatedVariables = List.move(currentNode.variables, fromIndex, toIndex)\n\t\t\t\tcurrentNode.set({ variables: updatedVariables })\n\t\t\t}\n\t\t},\n\t\t[nodeWithVariablesId, isReadOnly],\n\t)\n\n\tconst selectVariable = useEngineCallback((variable: VariableOrDivider, parentVariableId?: VariableID) => {\n\t\tconst updatedPath: SelectedVariablePath = parentVariableId ? [parentVariableId, variable.id] : [variable.id]\n\n\t\tconst currentSelectedVariablePath = engine.stores.variablesStore.selectedVariablePath\n\t\tif (currentSelectedVariablePath && isShallowArrayEqual(updatedPath, currentSelectedVariablePath)) return\n\n\t\tengine.stores.variablesStore.selectedVariablePath = updatedPath\n\n\t\tengine.stores.variablesStore.clearTemporaryVariable()\n\t}, [])\n\n\tconst duplicateVariable = useEngineCallback(\n\t\t(variableId: VariableID, parentVariableId?: VariableID) => {\n\t\t\tif (isReadOnly) return\n\t\t\tif (!nodeWithVariablesId) return\n\n\t\t\tconst node = engine.tree.getNodeWithTrait(nodeWithVariablesId, withVariables)\n\t\t\tif (!node) return\n\n\t\t\tif (parentVariableId) {\n\t\t\t\tconst arrayVariables = getVariableListFromVariableParent(node, parentVariableId)\n\t\t\t\tif (!arrayVariables) return\n\n\t\t\t\tconst updatedArrayVariables = duplicateVariableWithinArray(arrayVariables, variableId)\n\t\t\t\tif (!updatedArrayVariables) return\n\n\t\t\t\tengine.scheduler.process(() => {\n\t\t\t\t\tupdateVariableListInVariableParent(node, parentVariableId, updatedArrayVariables)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tconst updatedVariables = duplicateVariableWithinArray(node.variables, variableId)\n\t\t\t\tif (!updatedVariables) return\n\n\t\t\t\tengine.scheduler.process(() => {\n\t\t\t\t\tnode.set({ variables: updatedVariables })\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeWithVariablesId, isReadOnly],\n\t)\n\n\tconst updateVariable = useEngineCallback(\n\t\t(getUpdate: (current: VariableOrDivider) => VariableOrDivider, variableToUpdatePath: SelectedVariablePath) => {\n\t\t\tif (!nodeWithVariablesId) return\n\n\t\t\tconst currentNode = engine.tree.getNodeWithTrait(nodeWithVariablesId, withVariables)\n\t\t\tif (!currentNode) return\n\n\t\t\tconst [firstId, secondId] = variableToUpdatePath\n\t\t\tconst targetVariableId = secondId ?? firstId\n\t\t\tconst targetParentVariableId = secondId ? firstId : undefined\n\n\t\t\tlet currentVariable: VariableOrDivider | undefined\n\n\t\t\tif (targetVariableId && targetVariableId === engine.stores.variablesStore.temporaryVariable?.id) {\n\t\t\t\tcurrentVariable = engine.stores.variablesStore.temporaryVariable\n\t\t\t} else if (targetParentVariableId) {\n\t\t\t\tconst arrayVariables = getVariableListFromVariableParent(currentNode, targetParentVariableId)\n\t\t\t\tcurrentVariable = arrayVariables?.find(({ id }) => id === targetVariableId)\n\t\t\t} else {\n\t\t\t\tcurrentVariable = currentNode.variables.find(({ id }) => id === targetVariableId)\n\t\t\t}\n\n\t\t\tif (!currentVariable) return\n\n\t\t\tconst updatedVariable = getUpdate(currentVariable)\n\t\t\tassert(updatedVariable.id === currentVariable.id, \"Variable id must not change\")\n\n\t\t\tif (isEqual(currentVariable, updatedVariable, true)) return\n\n\t\t\tif (\n\t\t\t\tcurrentVariable &&\n\t\t\t\twithPreventLocalization(currentVariable) &&\n\t\t\t\twithPreventLocalization(updatedVariable) &&\n\t\t\t\tupdatedVariable.preventLocalization !== currentVariable.preventLocalization\n\t\t\t) {\n\t\t\t\tif (getIgnoreLocalizationIsReadOnly()) return\n\t\t\t} else {\n\t\t\t\tif (isReadOnly) return\n\t\t\t}\n\n\t\t\t// Update the temporary variable\n\t\t\tif (updatedVariable.id === engine.stores.variablesStore.temporaryVariable?.id) {\n\t\t\t\tassert(isVariableDefinition(updatedVariable), \"Temporary variable must not be a divider\")\n\t\t\t\tengine.stores.variablesStore.temporaryVariable = updatedVariable\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Update the actual variable in the scope\n\t\t\tif (targetParentVariableId) {\n\t\t\t\tconst arrayVariables = getVariableListFromVariableParent(currentNode, targetParentVariableId)\n\t\t\t\tif (!arrayVariables) return\n\n\t\t\t\tconst indexOfItemVariable = arrayVariables.findIndex(({ id }) => id === updatedVariable.id)\n\t\t\t\tif (indexOfItemVariable < 0) return\n\n\t\t\t\tassert(isArrayItemVariableDefinition(updatedVariable), \"Updated variable must be an array item variable\")\n\t\t\t\tconst newItemVariables = List.replace(arrayVariables, indexOfItemVariable, updatedVariable)\n\n\t\t\t\tupdateVariableListInVariableParent(currentNode, targetParentVariableId, newItemVariables)\n\t\t\t} else {\n\t\t\t\tconst indexOfVariable = currentNode.variables.findIndex(({ id }) => id === updatedVariable.id)\n\t\t\t\tif (indexOfVariable < 0) return\n\n\t\t\t\tconst newVariables = List.replace(currentNode.variables, indexOfVariable, updatedVariable)\n\t\t\t\tcurrentNode.set({ variables: newVariables })\n\t\t\t}\n\t\t},\n\t\t[nodeWithVariablesId, isReadOnly],\n\t)\n\n\treturn {\n\t\tmoveVariable,\n\t\tselectVariable,\n\t\tduplicateVariable,\n\t\tupdateVariable,\n\t}\n}\n", "import type { CanvasTree, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport { VECTOR_SET_COLUMNS } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\n\n// VECTOR @TODO: Don't overlap existing vectors, start columns from existing rows.\nexport function spaceOutShapeContainers(\n\ttree: CanvasTree,\n\tshapeContainers: ShapeContainerNode[],\n\tgap?: number | undefined,\n) {\n\tlet offsetX = 0\n\tlet offsetY = 0\n\tfor (let i = 0; i < shapeContainers.length; i++) {\n\t\tconst shape = shapeContainers[i]\n\t\tif (!shape) continue\n\t\tconst latest = tree.get<ShapeContainerNode>(shape.id) ?? shape\n\n\t\tconst { left, width, height } = latest\n\t\tif (i === 0) {\n\t\t\toffsetX = (left ?? 0) + width + (gap ?? width)\n\t\t\toffsetY = latest.top ?? 0\n\t\t\tcontinue\n\t\t}\n\n\t\tif (i % VECTOR_SET_COLUMNS === 0) {\n\t\t\toffsetX = 0\n\t\t\toffsetY += height + (gap ?? height)\n\t\t}\n\n\t\tlatest.set({ left: offsetX, top: offsetY })\n\t\toffsetX = offsetX + width + (gap ?? width)\n\t}\n}\n", "import { assert, assertNever, delay } from \"@framerjs/shared\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport { spaceOutShapeContainers } from \"document/components/utils/spaceOutShapeContainers.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport { isVectorSetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { type WithOptionalFill, withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { IsVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport React from \"react\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { ProgressModal } from \"./ProgressModal.tsx\"\nimport { VectorImport, type VectorImportResult, vectorImportBatchSize } from \"./VectorImport.ts\"\n\ninterface State {\n\tphase: ImportPhase\n\timported: number\n\tbatches: number\n\tserialized: number\n\tpersisted: number\n}\n\nfunction initialState(svgs: number): State {\n\treturn {\n\t\tphase: ImportPhase.Importing,\n\t\timported: 0,\n\t\tbatches: Math.ceil(svgs / vectorImportBatchSize(svgs)),\n\t\tserialized: 0,\n\t\tpersisted: 0,\n\t}\n}\n\nconst waitOneSecondFromStart = () => delay(1000)\nconst waitBrieflyWhenDone = () => delay(1500)\n\nenum ImportPhase {\n\tImporting,\n\tSerializing,\n\tPersisting,\n}\n\nfunction labelsFromState(\n\timportState: State,\n\tcount: number,\n): {\n\ttitle: string\n\tprogress: number\n\ttotalCount?: number\n\tfinishedCount?: number\n} {\n\tswitch (importState.phase) {\n\t\tcase ImportPhase.Importing:\n\t\t\treturn {\n\t\t\t\ttitle: \"Importing Vectors\",\n\t\t\t\ttotalCount: count,\n\t\t\t\tfinishedCount: importState.imported,\n\t\t\t\tprogress: importState.imported / count / 3,\n\t\t\t}\n\t\tcase ImportPhase.Serializing:\n\t\t\treturn {\n\t\t\t\ttitle: \"Creating Vectors\",\n\t\t\t\ttotalCount: count,\n\t\t\t\tfinishedCount: importState.serialized,\n\t\t\t\tprogress: importState.serialized / count / 3 + 1 / 3,\n\t\t\t}\n\t\tcase ImportPhase.Persisting:\n\t\t\treturn {\n\t\t\t\ttitle: \"Uploading Set\",\n\t\t\t\tprogress: importState.persisted / importState.batches / 3 + 2 / 3,\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(importState.phase)\n\t}\n}\n\nexport function VectorImportModal({\n\tsvgsToImport,\n\tscopeId,\n\tcurrentVectorLayout,\n\tonSuccess,\n\tonCreateVectorSet,\n}: ModalProps<ModalType.VectorImport>) {\n\tconst count = svgsToImport.length\n\tconst start = useConstant(() => performance.now())\n\tconst [importState, setImportState] = React.useState<State>(() => initialState(count))\n\n\tconst reportProgress = React.useCallback(\n\t\t({ finishedCount }: { finishedCount: number }) => {\n\t\t\tsetImportState(state => ({\n\t\t\t\t...state,\n\t\t\t\timported: finishedCount,\n\t\t\t\tphase: finishedCount === count ? ImportPhase.Serializing : ImportPhase.Importing,\n\t\t\t}))\n\t\t},\n\t\t[count],\n\t)\n\n\tconst reportCodeGeneration = React.useCallback((phase: \"serializing\" | \"persisting\", index: number) => {\n\t\tswitch (phase) {\n\t\t\tcase \"serializing\":\n\t\t\t\tsetImportState(state => ({\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: ImportPhase.Serializing,\n\t\t\t\t\tserialized: index + 1,\n\t\t\t\t}))\n\t\t\t\tbreak\n\t\t\tcase \"persisting\":\n\t\t\t\tsetImportState(state => ({\n\t\t\t\t\t...state,\n\t\t\t\t\tphase: ImportPhase.Persisting,\n\t\t\t\t\tpersisted: index + 1,\n\t\t\t\t}))\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(phase)\n\t\t}\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\trecord(\"vector_import_batch_start\", { count: svgsToImport.length })\n\n\t\tconst vectorImport = new VectorImport(reportProgress, async results => {\n\t\t\tconst { vectors, vectorSet } = await insertImportedVectors(results, onCreateVectorSet)\n\t\t\tawait engine.stores.codeGenerationStore.createVectorSet(vectors, reportCodeGeneration)\n\n\t\t\tengine.stores.selectionStore.set(vectors)\n\t\t\tengine.stores.chromeStore.layersExpanded = true\n\t\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Layers\n\n\t\t\trecord(\"vector_import_batch_success\", { count: vectors.length, duration: performance.now() - start })\n\n\t\t\tonSuccess?.(vectorSet)\n\t\t})\n\n\t\t// Make sure modal is at least visible for one second after opening, and wait a tiny\n\t\t// bit when complete to see the progress bar complete.\n\t\tvoid Promise.allSettled([\n\t\t\twaitOneSecondFromStart(),\n\t\t\tvectorImport.import(svgsToImport, scopeId, currentVectorLayout),\n\t\t\twaitBrieflyWhenDone(),\n\t\t]).finally(dismiss)\n\n\t\treturn () => {\n\t\t\tif (vectorImport.status !== \"done\") {\n\t\t\t\trecord(\"vector_import_batch_cancel\", { count, duration: performance.now() - start })\n\t\t\t}\n\t\t\tvectorImport.cancel()\n\t\t}\n\t}, [svgsToImport, scopeId, currentVectorLayout, reportProgress, reportCodeGeneration, onCreateVectorSet, onSuccess])\n\n\tconst { title, finishedCount, totalCount, progress } = labelsFromState(importState, count)\n\n\treturn (\n\t\t<ProgressModal\n\t\t\ttitle={title}\n\t\t\tdescription=\"Importing\u2026 please keep the project open until the process is complete.\"\n\t\t\tfinishedCount={finishedCount}\n\t\t\ttotalCount={totalCount}\n\t\t\tprogress={progress}\n\t\t\t// Never show the done button. We will automatically dismiss it.\n\t\t\tcompleted={false}\n\t\t\tonComplete={dismiss}\n\t\t\tonCancel={dismiss}\n\t\t\tonDismiss={dismiss}\n\t\t/>\n\t)\n}\n\nfunction dismiss() {\n\tif (engine.stores.modalStore.active.type === ModalType.VectorImport) {\n\t\tengine.stores.modalStore.dismiss()\n\t}\n}\n\nfunction fillUpdateForImportedVectorSetItems(scopeId: NodeID): Partial<WithOptionalFill> | undefined {\n\tconst defaultVectorSetItem = engine.tree.get(scopeId)?.children?.find(child => isVectorSetItem(child))\n\t// If there is no Vector Set, or its empty, use a white fill.\n\tif (!defaultVectorSetItem) {\n\t\treturn {\n\t\t\tfillType: \"color\",\n\t\t\tfillColor: \"#FFF\",\n\t\t\tfillEnabled: true,\n\t\t}\n\t}\n\n\t// Otherwise if their is a Vector Set, but the first item doesn't have a fill, or is not\n\t// enabled, do nothing.\n\tif (!withOptionalFill(defaultVectorSetItem) || !defaultVectorSetItem.fillEnabled) {\n\t\treturn\n\t}\n\n\t// Otherwise use the first item's fill.\n\treturn {\n\t\tfillType: defaultVectorSetItem.fillType,\n\t\tfillColor: defaultVectorSetItem.fillColor,\n\t\tfillEnabled: true,\n\t}\n}\n\nfunction insertImportedVectors(\n\t{ scopeId, vectors, targetLayout }: VectorImportResult,\n\tcreateVectorSet?: (id: NodeID, itemsCount: number) => VectorSetNode,\n) {\n\treturn new Promise<{ vectors: (ShapeContainerNode & IsVectorSetItem)[]; vectorSet: VectorSetNode }>(resolve => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst vectorSet =\n\t\t\t\tcreateVectorSet?.(scopeId, vectors.length) ?? engine.tree.getNodeWithTrait(scopeId, isVectorSetNode)\n\t\t\tassert(vectorSet?.isLoaded(), \"Vector set not found.\")\n\n\t\t\tconst fillUpdate = fillUpdateForImportedVectorSetItems(vectorSet.id)\n\n\t\t\tconst nodes: (ShapeContainerNode & IsVectorSetItem)[] = []\n\t\t\tconst sizeMap = new Map<NodeID, Size>()\n\n\t\t\tvectors.forEach(({ node, size }) => {\n\t\t\t\t// importSVG pulls the imported nodes through an empty tree (with the correct parentid),\n\t\t\t\t// clone them into the current tree.\n\t\t\t\tconst clone = engine.cloneNode(node, false, false)\n\t\t\t\tif (fillUpdate) clone.set(fillUpdate)\n\t\t\t\tassert(isVectorSetItem(clone), \"Clone is not a vector set item.\")\n\n\t\t\t\tnodes.push(clone)\n\t\t\t\tsizeMap.set(clone.id, size)\n\t\t\t})\n\n\t\t\tengine.tree.insertNodes(nodes)\n\n\t\t\t// Scale the new vectors after inserting them into the tree.\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst size = sizeMap.get(node.id)\n\t\t\t\tif (!size) return\n\n\t\t\t\t// If there's already a vector in the set, scale the new ones to the same size.\n\t\t\t\t// Otherwise scale it back to the size defined in the SVG.\n\t\t\t\tContextAction.scaleVector(engine, node.id, {\n\t\t\t\t\twidth: targetLayout?.width ?? size.width,\n\t\t\t\t\theight: targetLayout?.height ?? size.height,\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tspaceOutShapeContainers(engine.tree, nodes, targetLayout?.width)\n\n\t\t\tresolve({ vectors: nodes, vectorSet })\n\t\t})\n\t})\n}\n", "import { InputWrapper, Modal, TextInput, modalStyles } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { getNormalizedAssetNamePath } from \"document/utils/getNormalizedAssetNamePath.ts\"\nimport React from \"react\"\nimport { useModalThemeOnActiveView } from \"../utils/useModalTheme.ts\"\n\nexport function VectorSetCreationModal({ onConfirm }: ModalProps<ModalType.VectorSetCreation>) {\n\tconst [name, setName] = React.useState<string>(Dictionary.IconSet)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst submitHandler = useEngineCallback(() => {\n\t\tif (!name) return\n\t\tonConfirm?.(name)\n\t}, [name, onConfirm])\n\n\tconst submitEnabled = getNormalizedAssetNamePath(name).length > 0\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\tonConfirm={submitHandler}\n\t\t\tclassName={modalStyles.container}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header>{`New ${Dictionary.VectorSet}`}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput value={name} placeholder={Dictionary.Title} onChange={setName} constantChange autoFocus />\n\t\t\t\t</InputWrapper>\n\t\t\t\t<Modal.Text>{`Design icons sets and illustrations on a canvas with dedicated vector tools.`}</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton type=\"submit\" enabled={submitEnabled}>\n\t\t\t\t\t{Dictionary.Create}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n", "import type { GlobalModuleId } from \"@framerjs/shared\"\nimport { assertNever, delay, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isExternalModuleNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport type { ExternalToLocalIdentifiers, UnlinkProgress } from \"../../unlinking/VectorSetUnlink.ts\"\nimport { VectorSetUnlink } from \"../../unlinking/VectorSetUnlink.ts\"\nimport { ProgressModal } from \"./ProgressModal.tsx\"\n\ninterface State {\n\tphase: UnlinkProgress[\"phase\"]\n\tfetched: number\n\tserialized: number\n\tpersisted: number\n\treplaced: number\n\ttotal: number\n\tbatches: number\n\treplaceTotal: number\n}\n\nfunction initialState(itemCount: number): State {\n\tconst batchSize = Math.ceil(itemCount / Math.ceil(itemCount / 100))\n\treturn {\n\t\tphase: \"fetching\",\n\t\tfetched: 0,\n\t\tserialized: 0,\n\t\tpersisted: 0,\n\t\treplaced: 0,\n\t\ttotal: itemCount,\n\t\tbatches: Math.max(1, Math.ceil(itemCount / batchSize)),\n\t\treplaceTotal: 0,\n\t}\n}\n\nconst waitBrieflyWhenDone = () => delay(1000)\n\n/** Given an external vector nodeId, find the corresponding local vector ID from the mapping. */\nfunction getLocalVectorId(\n\tmoduleId: GlobalModuleId | undefined,\n\texternalToLocalIdentifiers: ExternalToLocalIdentifiers | undefined,\n): NodeID | undefined {\n\tif (!moduleId || !externalToLocalIdentifiers) return undefined\n\n\tconst externalModule = engine.tree.getNodeWithTrait(moduleId, isExternalModuleNode)\n\tconst externalIdentifier = externalModule?.codeComponentIdentifier\n\tif (!externalIdentifier) return undefined\n\n\tconst localIdentifier = externalToLocalIdentifiers.get(externalIdentifier)\n\tif (!localIdentifier) return undefined\n\n\tconst moduleIdentifier = parseModuleIdentifier(localIdentifier)\n\treturn moduleIdentifier && isLocalModuleIdentifier(moduleIdentifier) ? moduleIdentifier.localIdName : undefined\n}\n\nfunction labelsFromState(\n\tstate: State,\n\tphases: number,\n): { title: string; progress: number; totalCount?: number; finishedCount?: number } {\n\tswitch (state.phase) {\n\t\tcase \"fetching\":\n\t\t\treturn {\n\t\t\t\ttitle: \"Downloading Vectors\",\n\t\t\t\tprogress: state.fetched / state.total / phases,\n\t\t\t}\n\t\tcase \"serializing\":\n\t\t\treturn {\n\t\t\t\ttitle: \"Creating Vectors\",\n\t\t\t\ttotalCount: state.total,\n\t\t\t\tfinishedCount: state.serialized,\n\t\t\t\tprogress: state.serialized / state.total / phases + 1 / phases,\n\t\t\t}\n\t\tcase \"persisting\":\n\t\t\treturn {\n\t\t\t\ttitle: \"Uploading Set\",\n\t\t\t\tprogress: state.persisted / state.batches / phases + 2 / phases,\n\t\t\t}\n\t\tcase \"replacing\":\n\t\t\treturn {\n\t\t\t\ttitle: state.replaceTotal > 1 ? \"Replacing Instances\" : \"Replacing Instance\",\n\t\t\t\ttotalCount: state.replaceTotal,\n\t\t\t\tfinishedCount: state.replaced,\n\t\t\t\tprogress: state.replaceTotal > 0 ? state.replaced / state.replaceTotal / phases + 3 / phases : 3 / phases,\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(state.phase)\n\t}\n}\n\nexport function VectorSetUnlinkModal({\n\tvectorSetNodeId,\n\titemCount,\n\treplaceAll = false,\n\tmoduleId,\n\tinstanceNodeId,\n\tonSuccess,\n}: ModalProps<ModalType.VectorSetUnlink>) {\n\tconst [state, setState] = React.useState<State>(() => initialState(itemCount))\n\tconst shouldReplace = replaceAll || !!instanceNodeId\n\tconst phases = shouldReplace ? 4 : 3\n\n\tconst reportProgress = React.useCallback((progress: UnlinkProgress) => {\n\t\tsetState(prev => {\n\t\t\tswitch (progress.phase) {\n\t\t\t\tcase \"fetching\":\n\t\t\t\t\treturn { ...prev, phase: \"fetching\", fetched: progress.fetched, total: progress.total }\n\t\t\t\tcase \"serializing\":\n\t\t\t\t\treturn { ...prev, phase: \"serializing\", serialized: progress.index + 1, total: progress.total }\n\t\t\t\tcase \"persisting\":\n\t\t\t\t\treturn { ...prev, phase: \"persisting\", persisted: progress.index + 1 }\n\t\t\t\tcase \"replacing\":\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...prev,\n\t\t\t\t\t\tphase: \"replacing\",\n\t\t\t\t\t\treplaced: progress.replaced,\n\t\t\t\t\t\treplaceTotal: progress.total,\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(progress)\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\tconst vectorSetUnlink = new VectorSetUnlink(reportProgress, async result => {\n\t\t\t// No replacement when unlinking from asset panel\n\t\t\tif (shouldReplace) {\n\t\t\t\tawait vectorSetUnlink.replaceInstances(instanceNodeId, replaceAll, (replaced, total) => {\n\t\t\t\t\tif (vectorSetUnlink.status === \"cancelled\") return\n\t\t\t\t\treportProgress({ phase: \"replacing\", replaced, total })\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tawait waitBrieflyWhenDone()\n\n\t\t\tif (result?.vectorSetNode) {\n\t\t\t\tconst localVectorId = getLocalVectorId(moduleId, result.externalToLocalIdentifiers)\n\t\t\t\tonSuccess?.(result.vectorSetNode, localVectorId)\n\t\t\t}\n\n\t\t\tdismiss()\n\t\t})\n\n\t\tvoid vectorSetUnlink.unlink(vectorSetNodeId)\n\n\t\treturn () => {\n\t\t\tif (vectorSetUnlink.status !== \"done\") {\n\t\t\t\tvectorSetUnlink.cancel()\n\t\t\t}\n\t\t}\n\t}, [vectorSetNodeId, shouldReplace, replaceAll, instanceNodeId, moduleId, onSuccess, reportProgress])\n\n\tconst { title, finishedCount, totalCount, progress } = labelsFromState(state, phases)\n\n\treturn (\n\t\t<ProgressModal\n\t\t\ttitle={title}\n\t\t\tdescription=\"Unlinking\u2026 please keep the project open until the process is complete.\"\n\t\t\tfinishedCount={finishedCount}\n\t\t\ttotalCount={totalCount}\n\t\t\tprogress={progress}\n\t\t\tcompleted={false}\n\t\t\tonComplete={dismiss}\n\t\t\tonCancel={dismiss}\n\t\t\tonDismiss={dismiss}\n\t\t/>\n\t)\n}\n\nfunction dismiss() {\n\tif (engine.stores.modalStore.active.type === ModalType.VectorSetUnlink) {\n\t\tengine.stores.modalStore.dismiss()\n\t}\n}\n", "import { migrateDocument } from \"@framerjs/document-migrations\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type {\n\tExternalModuleExportIdentifierString,\n\tGlobalModuleId,\n\tLocalModuleExportIdentifierString,\n} from \"@framerjs/shared\"\nimport {\n\tassert,\n\tModuleType,\n\tasGlobalId,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tlocalModuleIdentifierForStableName,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport type { FramerVectorSetInfo } from \"code-generation/utils/annotations.ts\"\nimport { isFramerVectorSetInfo } from \"code-generation/utils/annotations.ts\"\nimport { getRelatedReplicaNodes } from \"code-generation/utils/isOnlyVisibleInCurrentVariant.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport { spaceOutShapeContainers } from \"document/components/utils/spaceOutShapeContainers.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, CodeComponentNode, NodeID, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport { canvasNodeFromValue } from \"document/models/CanvasTree/nodes/canvasNodeFromValue.ts\"\nimport {\n\tisCodeComponentNode,\n\tisExternalModuleNode,\n\tisShapeContainerNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport type { VariableDefinition, VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { IsVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { generateVariableReferenceUpdateForNode } from \"utils/updateDynamicValues.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { isReplicaOrReplicaChild } from \"../../models/CanvasTree/traits/WithTemplate.ts\"\nimport { RenamedIds } from \"../tools/utils/updateNodeConnections.ts\"\nimport { fetchTreeJSON } from \"./utils.ts\"\n\n// Tree version fallback for older modules that don't have __treeSerializationVersion\nconst DEFAULT_TREE_VERSION = 75\n\n// How many vector tree.jsons to fetch concurrently\nconst TREE_FETCHING_CONCURRENCY = 20\n\nexport type UnlinkProgress =\n\t| { phase: \"fetching\"; fetched: number; total: number }\n\t| { phase: \"serializing\"; index: number; total: number }\n\t| { phase: \"persisting\"; index: number; total: number }\n\t| { phase: \"replacing\"; replaced: number; total: number }\n\nexport type ExternalToLocalIdentifiers = Map<ExternalModuleExportIdentifierString, LocalModuleExportIdentifierString>\ntype ExternalModuleIdToExternalIdentifier = Map<GlobalModuleId, ExternalModuleExportIdentifierString>\ntype ExternalModuleIdToLocalNodeId = Map<GlobalModuleId, NodeID>\ntype CollectedVariables = Map<VariableID, VariableDefinition>\n\ninterface VectorSetUnlinkResult {\n\tvectorSetNode: Loaded<VectorSetNode>\n\texternalToLocalIdentifiers: ExternalToLocalIdentifiers\n}\n\ntype VectorSetUnlinkStatus = \"unlinking\" | \"done\" | \"cancelled\"\ntype VectorSetUnlinkReportProgressCallback = (progress: UnlinkProgress) => void\ntype VectorSetUnlinkOnDoneCallback = (result: VectorSetUnlinkResult) => Promise<void>\n\ninterface FetchedVectorItemsResult {\n\tvectorItemNodes: (ShapeContainerNode & IsVectorSetItem)[]\n\tcollectedVariables: CollectedVariables\n\t/** external module ID \u2192 external code component identifier - used to build replacement map */\n\texternalModuleIdToExternalIdentifier: ExternalModuleIdToExternalIdentifier\n\t/** external module ID \u2192 local node ID - of cloned item, used to generate local identifier for replacement */\n\texternalModuleIdToLocalNodeId: ExternalModuleIdToLocalNodeId\n}\n\nexport class VectorSetUnlink {\n\tstatus: VectorSetUnlinkStatus | null = null\n\tresults: VectorSetUnlinkResult | undefined\n\n\treadonly onProgress: VectorSetUnlinkReportProgressCallback\n\treadonly onDone: VectorSetUnlinkOnDoneCallback\n\n\tconstructor(onProgress: VectorSetUnlinkReportProgressCallback, onDone: VectorSetUnlinkOnDoneCallback) {\n\t\tthis.onProgress = onProgress\n\t\tthis.onDone = onDone\n\t}\n\n\t/**\n\t * Unlink an external Vector Set into a local VectorSetNode with vector items as children.\n\t * - Fetch tree.json for each Vector in the set\n\t * - Grab variables from each tree json\n\t * - Insert vectors as children of a new local VectorSetNode\n\t * - Space out the items in a grid and trigger code-generation for the new set\n\t */\n\tasync unlink(id: NodeID): Promise<VectorSetUnlinkResult | undefined> {\n\t\tthis.status = \"unlinking\"\n\t\tthis.results = undefined\n\n\t\tconst externalSetNode = engine.tree.getNodeWithTrait(id, isExternalModuleNode)\n\t\tif (!externalSetNode || externalSetNode.type !== ModuleType.VectorSet) {\n\t\t\treturn\n\t\t}\n\n\t\tconst setInfo = externalSetNode.annotation(AnnotationKey.FramerVectorSet)\n\t\tif (!isFramerVectorSetInfo(setInfo)) return\n\n\t\t// Step 1: Fetch and prepare vector items\n\t\tconst fetchedItems = await this.fetchVectorItems(setInfo)\n\t\tif (!fetchedItems) return\n\n\t\tif (!fetchedItems.vectorItemNodes.length) {\n\t\t\tthis.showFailureToast()\n\t\t\treturn\n\t\t}\n\n\t\t// Step 2: Apply tree changes and generate code\n\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\tengine.beginUndoGroup()\n\t\t})\n\n\t\ttry {\n\t\t\tconst result = await this.applyTreeChanges(setInfo, fetchedItems)\n\n\t\t\tthis.results = result\n\t\t\tawait this.done()\n\t\t\treturn result\n\t\t} catch (error) {\n\t\t\tif (this.isCanceled) {\n\t\t\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\t\t\tengine.endUndoGroup()\n\t\t\t\t\tengine.undo()\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tunhandledError(error)\n\t\t\tthis.showFailureToast()\n\t\t\treturn\n\t\t} finally {\n\t\t\t// Only end the undo group if we haven't already handled it in the catch block\n\t\t\tif (!this.isCanceled) {\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tengine.endUndoGroup()\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Fetch tree.json for each vector item, extract variables, and prepare cloned nodes.\n\t */\n\tprivate async fetchVectorItems(setInfo: FramerVectorSetInfo): Promise<FetchedVectorItemsResult | undefined> {\n\t\tconst vectorItemNodes: (ShapeContainerNode & IsVectorSetItem)[] = []\n\t\tconst collectedVariables: CollectedVariables = new Map()\n\t\tconst externalModuleIdToExternalIdentifier: ExternalModuleIdToExternalIdentifier = new Map()\n\t\tconst externalModuleIdToLocalNodeId: ExternalModuleIdToLocalNodeId = new Map()\n\t\tconst renamedIds = new RenamedIds()\n\n\t\tconst totalItems = setInfo.items.length\n\t\tlet fetchedCount = 0\n\n\t\tconst incrementProgress = () => {\n\t\t\tfetchedCount++\n\t\t\tif (!this.isCanceled) {\n\t\t\t\tthis.onProgress({ phase: \"fetching\", fetched: fetchedCount, total: totalItems })\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < totalItems; i += TREE_FETCHING_CONCURRENCY) {\n\t\t\tif (this.status !== \"unlinking\") return\n\n\t\t\tconst batch = setInfo.items.slice(i, i + TREE_FETCHING_CONCURRENCY)\n\n\t\t\tconst batchResults = await Promise.all(\n\t\t\t\tbatch.map(async item => {\n\t\t\t\t\tconst moduleId = asGlobalId(item.moduleId)\n\n\t\t\t\t\t// Get saveId from the ExternalModuleNode in the tree, falling back to annotation.\n\t\t\t\t\t// External sets from other projects may not have saveId in the annotation.\n\t\t\t\t\tconst vectorNode = engine.tree.getNodeWithTrait(moduleId, isExternalModuleNode)\n\t\t\t\t\tconst codeComponentIdentifier = vectorNode?.codeComponentIdentifier\n\t\t\t\t\tconst saveId = codeComponentIdentifier ? parseModuleIdentifier(codeComponentIdentifier)?.saveId : item.saveId\n\n\t\t\t\t\tif (!saveId) {\n\t\t\t\t\t\tincrementProgress()\n\t\t\t\t\t\treturn undefined\n\t\t\t\t\t}\n\n\t\t\t\t\t// Track the external identifier for later mapping\n\t\t\t\t\tif (codeComponentIdentifier) {\n\t\t\t\t\t\texternalModuleIdToExternalIdentifier.set(item.moduleId, codeComponentIdentifier)\n\t\t\t\t\t}\n\n\t\t\t\t\tconst treeJSON = await fetchTreeJSON({ moduleId, saveId })\n\n\t\t\t\t\tincrementProgress()\n\n\t\t\t\t\treturn { externalModuleId: item.moduleId, treeJSON }\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (this.isCanceled) return\n\n\t\t\t// Collect variables from each vector tree.json, then migrate and clone the node\n\t\t\tfor (const result of batchResults) {\n\t\t\t\tif (!result?.treeJSON) continue\n\n\t\t\t\tconst { externalModuleId, treeJSON: vectorTreeJSON } = result\n\n\t\t\t\tconst vectorSetVariables = vectorTreeJSON.__vectorSetVariables as VariableDefinition[] | undefined\n\t\t\t\tif (vectorSetVariables) {\n\t\t\t\t\tfor (const variable of vectorSetVariables) {\n\t\t\t\t\t\tif (!collectedVariables.has(variable.id)) {\n\t\t\t\t\t\t\tcollectedVariables.set(variable.id, variable)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst { __treeSerializationVersion, __vectorSetVariables: _, ...vectorRoot } = vectorTreeJSON\n\t\t\t\tconst version = __treeSerializationVersion || DEFAULT_TREE_VERSION\n\t\t\t\tconst { root: migratedRoot } = migrateDocument({ root: vectorRoot, version })\n\n\t\t\t\tconst rootNode = canvasNodeFromValue(migratedRoot)\n\t\t\t\tif (!rootNode) continue\n\n\t\t\t\tconst itemNode = findVectorSetItemNode(rootNode)\n\t\t\t\tif (!itemNode) continue\n\n\t\t\t\tconst clonedItem = itemNode.cloneWithRenamedIds(renamedIds)\n\t\t\t\tvectorItemNodes.push(clonedItem)\n\n\t\t\t\t// Map the external module id to the local node id for later replacement\n\t\t\t\texternalModuleIdToLocalNodeId.set(externalModuleId, clonedItem.id)\n\t\t\t}\n\t\t}\n\n\t\t// Final check before returning\n\t\tif (this.status !== \"unlinking\") return\n\n\t\treturn {\n\t\t\tvectorItemNodes,\n\t\t\tcollectedVariables,\n\t\t\texternalModuleIdToExternalIdentifier,\n\t\t\texternalModuleIdToLocalNodeId,\n\t\t}\n\t}\n\n\t/**\n\t * Create the local VectorSetNode, insert items, update connections, and run code generation.\n\t */\n\tprivate async applyTreeChanges(\n\t\tsetInfo: FramerVectorSetInfo,\n\t\tfetchedItems: FetchedVectorItemsResult,\n\t): Promise<VectorSetUnlinkResult> {\n\t\tconst { vectorItemNodes, collectedVariables, externalModuleIdToExternalIdentifier, externalModuleIdToLocalNodeId } =\n\t\t\tfetchedItems\n\n\t\tconst newVectorSet = await engine.scheduler.processWhenReadyAsync((): Loaded<VectorSetNode> => {\n\t\t\tthis.endIfCanceled()\n\n\t\t\tconst newVectorSet = ContextAction.createVectorSet(\n\t\t\t\tengine,\n\t\t\t\tsetInfo.name,\n\t\t\t\tfalse,\n\t\t\t\tnull,\n\t\t\t\tundefined,\n\t\t\t\t\"import\",\n\t\t\t\tvectorItemNodes.length,\n\t\t\t)\n\n\t\t\tconst tree = engine.tree\n\t\t\tconst newVectorSetId = newVectorSet.id\n\n\t\t\t// Set variables on the new VectorSetNode and update references in new vector nodes\n\t\t\tif (collectedVariables.size > 0) {\n\t\t\t\tnewVectorSet.set({ variables: Array.from(collectedVariables.values()) })\n\t\t\t}\n\t\t\tfor (const item of vectorItemNodes) {\n\t\t\t\tfor (const node of item.walk()) {\n\t\t\t\t\tconst nodeUpdate = generateVariableReferenceUpdateForNode(tree, node, variableReference =>\n\t\t\t\t\t\tcreateVariableReference(variableReference.id, newVectorSetId),\n\t\t\t\t\t)\n\t\t\t\t\tif (nodeUpdate) node.set(nodeUpdate)\n\t\t\t\t}\n\n\t\t\t\ttree.insertNode(item, newVectorSetId)\n\t\t\t}\n\n\t\t\tspaceOutShapeContainers(tree, vectorItemNodes)\n\n\t\t\treturn newVectorSet\n\t\t})\n\n\t\tthis.endIfCanceled()\n\n\t\t// Build external->local mapping for replace all\n\t\tconst externalToLocalIdentifiers: ExternalToLocalIdentifiers = new Map()\n\t\tfor (const [extModuleId, localNodeId] of externalModuleIdToLocalNodeId) {\n\t\t\tconst externalIdentifier = externalModuleIdToExternalIdentifier.get(extModuleId)\n\t\t\tconst localIdentifier = localModuleIdentifierForStableName(ModuleType.Vector, localNodeId, \"default\")?.value\n\n\t\t\tassert(\n\t\t\t\texternalIdentifier && localIdentifier,\n\t\t\t\t\"External and local identifiers must be set\",\n\t\t\t\texternalIdentifier,\n\t\t\t\tlocalIdentifier,\n\t\t\t)\n\t\t\texternalToLocalIdentifiers.set(externalIdentifier, localIdentifier)\n\t\t}\n\n\t\tconst total = vectorItemNodes.length\n\t\tawait engine.stores.codeGenerationStore.createVectorSet(vectorItemNodes, (phase, index) => {\n\t\t\tif (this.isCanceled) return\n\t\t\tthis.onProgress({ phase, index, total })\n\t\t})\n\n\t\tthis.endIfCanceled()\n\n\t\treturn { vectorSetNode: newVectorSet, externalToLocalIdentifiers }\n\t}\n\n\t/**\n\t * Replace external vector instances with their local equivalents.\n\t * - If `instanceNodeId` is provided, replace only that instance.\n\t * - If `isReplaceAll` is true, replace all instances.\n\t */\n\treplaceInstances(\n\t\tinstanceNodeId: NodeID | undefined,\n\t\tisReplaceAll: boolean,\n\t\tonProgress: (replaced: number, total: number) => void,\n\t): Promise<void> {\n\t\tconst externalToLocalIdentifiers = this.results?.externalToLocalIdentifiers\n\t\tif (!externalToLocalIdentifiers) return Promise.reject()\n\n\t\treturn engine.scheduler.processWhenReadyAsync(() => {\n\t\t\tconst tree = engine.tree\n\t\t\tconst codeComponentNodeIds = engine.stores.treeStore.treeIndex.codeComponentNodeIds\n\t\t\tconst nodesToReplace = new Map<NodeID, LocalModuleExportIdentifierString>()\n\n\t\t\t// No replacements will be made when unlinking the set from the assets panel. Otherwise, a node ID\n\t\t\t// is provided when pressing \"unlink instance\" in the edit vector modal.\n\t\t\tconst isReplaceInstance = Boolean(instanceNodeId && !isReplaceAll)\n\t\t\tconst nodeIds = isReplaceInstance ? [instanceNodeId] : isReplaceAll ? codeComponentNodeIds : []\n\n\t\t\t// Build the map of nodes to replace so that total can be shown.\n\t\t\tfor (const id of nodeIds) {\n\t\t\t\tconst node = tree.getNodeWithTrait(id, isCodeComponentNode)\n\t\t\t\tif (!node) continue\n\n\t\t\t\t// Initially exclude replica nodes, adding them later if the codeComponentIdentifier is different.\n\t\t\t\tconst primaryNode = getPrimaryNode(tree, node, isReplaceInstance)\n\t\t\t\tif (!primaryNode) continue\n\n\t\t\t\tconst primaryIdentifier = primaryNode.codeComponentIdentifier\n\t\t\t\tif (!isModuleExportIdentifier(primaryIdentifier)) continue\n\t\t\t\tconst parsedPrimaryIdentifier = parseModuleIdentifier(primaryIdentifier)\n\t\t\t\tif (!isExternalModuleIdentifier(parsedPrimaryIdentifier)) continue\n\n\t\t\t\tconst primaryTarget = externalToLocalIdentifiers.get(parsedPrimaryIdentifier.value)\n\t\t\t\tif (!primaryTarget) continue\n\n\t\t\t\tnodesToReplace.set(primaryNode.id, primaryTarget)\n\n\t\t\t\tfor (const replica of getRelatedReplicaNodes(tree, primaryNode)) {\n\t\t\t\t\tconst replicaIdentifier = replica.relatedNode.codeComponentIdentifier\n\t\t\t\t\tif (replicaIdentifier === primaryIdentifier) continue\n\t\t\t\t\tif (!isModuleExportIdentifier(replicaIdentifier)) continue\n\t\t\t\t\tconst parsedReplicaIdentifier = parseModuleIdentifier(replicaIdentifier)\n\t\t\t\t\tif (!isExternalModuleIdentifier(parsedReplicaIdentifier)) continue\n\n\t\t\t\t\tconst replicaTarget = externalToLocalIdentifiers.get(parsedReplicaIdentifier.value)\n\t\t\t\t\tif (!replicaTarget) continue\n\n\t\t\t\t\tnodesToReplace.set(replica.relatedNode.id, replicaTarget)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst total = nodesToReplace.size\n\t\t\tif (total === 0) return\n\n\t\t\t// Then actually perform the replacements and report progress.\n\t\t\tlet replaced = 0\n\t\t\tfor (const [nodeId, targetIdentifier] of nodesToReplace) {\n\t\t\t\tconst targetNode = tree.getNodeWithTrait(nodeId, isCodeComponentNode)\n\t\t\t\tif (!targetNode) continue\n\t\t\t\ttargetNode.set({ codeComponentIdentifier: targetIdentifier })\n\t\t\t\treplaced++\n\t\t\t\tonProgress(replaced, total)\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate endIfCanceled() {\n\t\tif (this.isCanceled) {\n\t\t\tthrow new Error(\"Unlink cancelled\")\n\t\t}\n\t}\n\n\tprivate showFailureToast() {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"error\",\n\t\t\tprimaryText: \"Failed to unlink\",\n\t\t\tsecondaryText: \"vector set.\",\n\t\t\tkey: \"vector-set-unlink-exception\",\n\t\t\ticon: \"error\",\n\t\t})\n\t}\n\n\tcancel() {\n\t\tthis.status = \"cancelled\"\n\t}\n\n\tprivate get isCanceled(): boolean {\n\t\treturn this.status === \"cancelled\"\n\t}\n\n\tprivate async done() {\n\t\tif (this.results) {\n\t\t\tawait this.onDone(this.results)\n\t\t}\n\t\tthis.status = \"done\"\n\t}\n}\n\nfunction findVectorSetItemNode(root: CanvasNode): (ShapeContainerNode & IsVectorSetItem) | undefined {\n\tif (isVectorSetItem(root) && isShapeContainerNode(root)) {\n\t\treturn root\n\t}\n\n\tfor (const node of root.walk()) {\n\t\tif (isVectorSetItem(node) && isShapeContainerNode(node)) {\n\t\t\treturn node\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nfunction getPrimaryNode(\n\ttree: CanvasTree,\n\tnode: CodeComponentNode,\n\tisReplaceInstance: boolean,\n): CodeComponentNode | undefined {\n\tif (!isReplaceInstance) {\n\t\treturn !isReplicaOrReplicaChild(node) ? node : undefined\n\t}\n\n\treturn tree.getNodeWithTrait(node.originalid ?? node.id, isCodeComponentNode) ?? undefined\n}\n", "import type { ExtraValidator } from \"./types.ts\"\n\nexport type { ValidationSeverity } from \"./browserErrors.ts\"\nexport { ExtraValidator } from \"./types.ts\"\n\nexport async function parseAndValidateHTML(html: string, rootTag: string, extraValidators: ExtraValidator[] = []) {\n\tconst { BrowserValidationErrorBuilder } = await import(\"./browserErrors.ts\")\n\tconst { parseAndValidateHTML: baseParseAndValidateHTML } = await import(\"./validateHTML.ts\")\n\n\tconst errorBuilder = new BrowserValidationErrorBuilder()\n\treturn baseParseAndValidateHTML(html, rootTag, errorBuilder, extraValidators)\n}\n", "import type * as monaco from \"monaco-editor\"\nimport React from \"react\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport { FallbackTextArea } from \"./CodeEditorMinimalFallback.tsx\"\nimport type { EditorError } from \"./editorError.ts\"\nimport type { EditorMinimalProps, EditorMinimalRef, EditorMinimalVariant } from \"./entryMinimal.tsx\"\n\nlet Editor: React.LazyExoticComponent<typeof import(\"./entryMinimal.tsx\").default>\ninvalidateCodeEditorManager()\n\n// By default, React.lazy doesn\u2019t support retries. If you render a lazy component,\n// and its loading fails, there\u2019s no way to re-invoke the loading function and re-download\n// the component \u2013 even if you unmount and remount it.\n//\n// So, to implement retrying, we regenerate the component completely\n// every time we want to retry loading.\nfunction invalidateCodeEditorManager() {\n\tEditor = React.lazy(() => import(\"./entryMinimal.tsx\"))\n}\n\ninterface Props {\n\tcustomHTMLKey: string\n\thasError: boolean\n\thasWarning?: boolean\n\tlineNumbers?: EditorMinimalProps[\"lineNumbers\"]\n\tisViewOnly: boolean\n\tplaceholder?: string\n\tmaxNumberOfCharacters: number\n\tonValidate: (key: string, value: string, characterCount?: number) => void\n\tonChange: (key: string, value: string, changeEvent?: monaco.editor.IModelContentChangedEvent) => void\n\tonFocus?: () => void\n\tonBlur?: () => void\n\tonKeyDown?: (event: KeyboardEvent & React.KeyboardEvent<HTMLTextAreaElement>) => void\n\tvalue: string\n\tpaddingTop?: number\n\tpaddingBottom?: number\n\terrors?: EditorError[]\n\tvariant?: EditorMinimalVariant\n\tresizable?: boolean\n\tminHeight?: number\n}\n\nexport const CodeEditorMinimal = React.memo(\n\tReact.forwardRef<EditorMinimalRef, Props>(function CodeEditorMinimal(\n\t\t{\n\t\t\tcustomHTMLKey,\n\t\t\thasError,\n\t\t\thasWarning,\n\t\t\tisViewOnly,\n\t\t\tplaceholder,\n\t\t\tmaxNumberOfCharacters,\n\t\t\tonChange,\n\t\t\tonValidate,\n\t\t\tlineNumbers,\n\t\t\tonFocus,\n\t\t\tonBlur,\n\t\t\tonKeyDown,\n\t\t\tvalue,\n\t\t\tpaddingTop,\n\t\t\tpaddingBottom,\n\t\t\terrors,\n\t\t\tvariant,\n\t\t\tresizable,\n\t\t\tminHeight,\n\t\t},\n\t\tref,\n\t) {\n\t\tconst handleValidate = React.useCallback(\n\t\t\t(v: string, charCount?: number) => {\n\t\t\t\tonValidate(customHTMLKey, v, charCount)\n\t\t\t},\n\t\t\t[customHTMLKey, onValidate],\n\t\t)\n\n\t\tconst handleOnChange = React.useCallback(\n\t\t\t(v: string, changeEvent?: monaco.editor.IModelContentChangedEvent) => {\n\t\t\t\tonChange(customHTMLKey, v, changeEvent)\n\t\t\t},\n\t\t\t[customHTMLKey, onChange],\n\t\t)\n\n\t\tconst hasDarkAppearance = useDarkMode()\n\n\t\treturn (\n\t\t\t<React.Suspense\n\t\t\t\tfallback={\n\t\t\t\t\t<FallbackTextArea\n\t\t\t\t\t\thasError={hasError}\n\t\t\t\t\t\thasWarning={hasWarning}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tmaxNumberOfCharacters={maxNumberOfCharacters}\n\t\t\t\t\t\tonChange={handleOnChange}\n\t\t\t\t\t\tonValidate={handleValidate}\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tpaddingTop={paddingTop}\n\t\t\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\tminHeight={minHeight}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<Editor\n\t\t\t\t\tref={ref}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonValueChange={handleOnChange}\n\t\t\t\t\thasDarkAppearance={hasDarkAppearance.isDarkMode}\n\t\t\t\t\thasError={hasError}\n\t\t\t\t\thasWarning={hasWarning}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tonValidateHTML={handleValidate}\n\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\tlineNumbers={lineNumbers}\n\t\t\t\t\tpaddingTop={paddingTop}\n\t\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\t\terrors={errors}\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tresizable={resizable}\n\t\t\t\t\tminHeight={minHeight}\n\t\t\t\t/>\n\t\t\t</React.Suspense>\n\t\t)\n\t}),\n)\n", "import \"CodeEditorMinimalFallback.styles_1q8x2au.wyw.css\"; export const fallbackEditor = \"fallbackEditor_f16o1h1u\";\nexport const insideModal = \"insideModal_ijaguix\";\nexport const fallbackEditorHasError = \"fallbackEditorHasError_f19ra3c\";\nexport const fallbackEditorHasWarning = \"fallbackEditorHasWarning_f4tkqno\";", "import { TextArea } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport * as styles from \"./CodeEditorMinimalFallback.styles.ts\"\nimport type { EditorMinimalVariant } from \"./entryMinimal.tsx\"\n\nexport function FallbackTextArea({\n\tenabled,\n\thasError,\n\thasWarning,\n\tplaceholder,\n\tmaxNumberOfCharacters,\n\tonChange,\n\tonValidate,\n\tonFocus,\n\tonBlur,\n\tvalue,\n\tpaddingTop,\n\tpaddingBottom,\n\tvariant = \"default\",\n\tminHeight = 150,\n\tonKeyDown,\n}: {\n\tenabled: boolean\n\thasError: boolean\n\thasWarning?: boolean\n\tplaceholder?: string\n\tmaxNumberOfCharacters: number\n\tonChange: (value: string) => void\n\tonValidate: (value: string) => void\n\tonFocus?: () => void\n\tonBlur?: () => void\n\tvalue: string\n\tpaddingTop?: number\n\tpaddingBottom?: number\n\tvariant?: EditorMinimalVariant\n\tminHeight?: number\n\tonKeyDown?: React.KeyboardEventHandler<HTMLTextAreaElement>\n}) {\n\tfunction handleOnBlur(event: React.FocusEvent<HTMLTextAreaElement>) {\n\t\tvalue = event.target.value\n\t\tonValidate(value)\n\t\tonBlur?.()\n\t}\n\n\tconst warning = !hasError && hasWarning\n\n\treturn (\n\t\t<TextArea\n\t\t\tenabled={enabled}\n\t\t\tvalue={value}\n\t\t\tplaceholder={placeholder}\n\t\t\tonChange={onChange}\n\t\t\tonFocus={onFocus}\n\t\t\tonBlur={handleOnBlur}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.fallbackEditor,\n\t\t\t\tvariant === \"insideModal\" && styles.insideModal,\n\t\t\t\thasError && styles.fallbackEditorHasError,\n\t\t\t\twarning && styles.fallbackEditorHasWarning,\n\t\t\t)}\n\t\t\tmaxLength={maxNumberOfCharacters}\n\t\t\tstyle={{ paddingTop, paddingBottom, minHeight: `${minHeight}px` }}\n\t\t/>\n\t)\n}\n", "import { IconInfo, Modal, Stack, T, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { ExtraValidator, parseAndValidateHTML } from \"@framerjs/html-validation/browser\"\nimport { assert, debounce, isCommandKeyPressed } from \"@framerjs/shared\"\nimport { getTemplateVariableNameRegex } from \"@framerjs/shared/src/custom-code/templateVariableRegexes.ts\"\nimport type { CustomCodeLoadMode, CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { CodeEditorMinimal } from \"code-editor/CodeEditorMinimal.tsx\"\nimport type { EditorError } from \"code-editor/editorError.ts\"\nimport { ValidationSeverity } from \"code-editor/editorError.ts\"\nimport type { EditorMinimalRef } from \"code-editor/entryMinimal.tsx\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CustomCodeNode, CustomCodeScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCustomCodeNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type * as monaco from \"monaco-editor\"\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\"\nimport { structuredDataSEOArticleURL } from \"utils/staticURLs.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { DropdownMenuButton } from \"../../analytics/components/DropdownMenuButton.tsx\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\nimport { ClickableVariables } from \"../ClickableVariables.tsx\"\nimport { SettingInput } from \"../SettingInput.tsx\"\nimport {\n\tconvertTemplateVariableIdsToNames,\n\tconvertTemplateVariableNamesToIds,\n\twrapInTemplateVariable,\n} from \"../templateVariables.ts\"\nimport { useAvailableFields } from \"../useAvailableFields.ts\"\nimport * as styles from \"./EditCustomCodeModal.styles.ts\"\nimport { PagesSelectionComboBox } from \"./PagesSelectionComboBox.tsx\"\nimport { useCustomCodeNameSuggestion } from \"./useCustomCodeNameSuggestion.ts\"\nimport { convertTemplateVariables } from \"./utils/convertTemplateVariables.ts\"\nimport { getCustomCodeName, getCustomCodePlacementLabel, getLoadModeLabel } from \"./utils/labels.ts\"\n\nconst maxModalHeight = 770\n\nconst maxNumberOfCharacters = 5000 // The same as the max number of characters in the site settings\nconst extraValidatorsBySection: Record<CustomCodePlacement, ExtraValidator[]> = {\n\theadStart: [ExtraValidator.RenderBlockingScript],\n\theadEnd: [ExtraValidator.RenderBlockingScript],\n\tbodyStart: [ExtraValidator.RenderBlockingScript],\n\tbodyEnd: [],\n}\n\ntype ErrorType = { type: \"none\" } | { type: \"exceededLimit\"; max: number }\n\nfunction getCopyForErrorType(error: ErrorType): React.ReactNode {\n\tswitch (error.type) {\n\t\tcase \"exceededLimit\":\n\t\t\treturn <T className={styles.error}>Custom code must be less than {error.max.toString()} characters.</T>\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nexport function EditCustomCodeModal({ customCodeId, initialPageId }: ModalProps<ModalType.EditCustomCode>) {\n\tconst { customCode, code } = useEngineState(\n\t\t() => {\n\t\t\tconst customCode = engine.tree.getNodeWithTrait(customCodeId, isCustomCodeNode)\n\t\t\tif (!customCode) return { customCode: null, code: null }\n\n\t\t\tconst pageId = customCode.pageIds?.[0]\n\t\t\tconst code = pageId\n\t\t\t\t? convertTemplateVariables(customCode.code, pageId, convertTemplateVariableIdsToNames)\n\t\t\t\t: customCode.code\n\n\t\t\treturn { customCode, code }\n\t\t},\n\t\t[customCodeId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tuseEffect(() => {\n\t\tif (customCodeId && !customCode) {\n\t\t\treturn engine.stores.modalStore.dismiss()\n\t\t}\n\t}, [customCodeId, customCode])\n\n\tif (customCodeId && !customCode) return null\n\n\treturn (\n\t\t<EditCustomCodeModalInner\n\t\t\tcustomCodeId={customCodeId}\n\t\t\tinitialPageId={initialPageId}\n\t\t\tname={getCustomCodeName(customCode)}\n\t\t\tloadMode={customCode?.loadMode ?? \"once\"}\n\t\t\tplacement={customCode?.placement ?? \"bodyEnd\"}\n\t\t\tcode={code ?? \"\"}\n\t\t\tpageIds={customCode?.pageIds ?? []}\n\t\t/>\n\t)\n}\n\ninterface EditCustomCodeModalProps extends ModalProps<ModalType.EditCustomCode> {\n\tname: string\n\tloadMode: CustomCodeLoadMode\n\tplacement: CustomCodePlacement\n\tcode: string\n\tpageIds: NodeID[]\n}\n\nfunction EditCustomCodeModalInner({ customCodeId, initialPageId, ...props }: EditCustomCodeModalProps) {\n\tconst modalRef = useRef<HTMLDivElement>(null)\n\tconst codeEditorRef = useRef<EditorMinimalRef>(null)\n\tconst [codeEditorMinHeight, setCodeEditorMinHeight] = useState(0)\n\n\tconst nameInputRef = useRef<HTMLInputElement>(null)\n\n\tconst isCreating = customCodeId === null\n\tconst { nameSuggestion, requestNameSuggestionDebounced } = useCustomCodeNameSuggestion({\n\t\tenabled: isCreating,\n\t\tinitialCode: props.code,\n\t})\n\n\tconst [name, setName] = useState(props.name)\n\tconst [loadMode, setLoadMode] = useState(props.loadMode)\n\tconst [placement, setPlacement] = useState(props.placement)\n\tconst [code, setCode] = useState(props.code)\n\tconst [pageIds, setPageIds] = useState(() => {\n\t\tif (isCreating && initialPageId) return [initialPageId]\n\t\treturn props.pageIds\n\t})\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tconst isChanged = useMemo(\n\t\t() =>\n\t\t\tname !== props.name ||\n\t\t\tloadMode !== props.loadMode ||\n\t\t\tplacement !== props.placement ||\n\t\t\tcode !== props.code ||\n\t\t\t!isEqual(pageIds, props.pageIds),\n\t\t[name, loadMode, placement, code, pageIds, props.name, props.loadMode, props.placement, props.code, props.pageIds],\n\t)\n\n\tconst [codeValidationErrors, setCodeValidationErrors] = useState<ErrorType>({ type: \"none\" })\n\tconst [codeParsingErrors, setCodeParsingErrors] = useState<EditorError[]>([])\n\n\tconst page = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(pageIds[0], isWebPageNode),\n\t\t[pageIds],\n\t\t[EngineChange.Tree],\n\t)\n\tconst collectionData = useDataForIdentifier(page?.dataIdentifier)\n\tconst availablePlainTextFields = useAvailableFields(engine.componentLoader, collectionData, \"customHtml\")\n\n\tconst [hasTemplateVariables, setHasTemplateVariables] = useState(false)\n\t// Template variables can only be used in a single page and it must be a CMS page\n\tconst hasInvalidPagesSelection = hasTemplateVariables && (pageIds.length > 1 || !collectionData)\n\n\tconst handleValidateCode = useCallback(async (currentPlacement: CustomCodePlacement, value: string) => {\n\t\tlet error: ErrorType = { type: \"none\" }\n\t\tif (value.length > maxNumberOfCharacters) {\n\t\t\terror = { type: \"exceededLimit\", max: maxNumberOfCharacters }\n\t\t}\n\n\t\tconst rootTag = currentPlacement === \"headStart\" || currentPlacement === \"headEnd\" ? \"head\" : \"body\"\n\t\tconst extraValidators = extraValidatorsBySection[currentPlacement]\n\t\tconst result = await parseAndValidateHTML(value, rootTag, extraValidators)\n\n\t\tsetCodeValidationErrors(error)\n\t\tsetCodeParsingErrors(result.errors)\n\n\t\tconst templateVariableNameRegex = getTemplateVariableNameRegex()\n\t\tconst matches = templateVariableNameRegex.test(value)\n\t\tsetHasTemplateVariables(matches)\n\t}, [])\n\n\tconst handlePageIdsChange = useCallback(\n\t\t(value: string[]) => {\n\t\t\tsetPageIds(value)\n\t\t\tvoid handleValidateCode(placement, code)\n\t\t},\n\t\t[code, placement, handleValidateCode],\n\t)\n\n\tconst handlePlacementChange = useCallback(\n\t\t(value: CustomCodePlacement) => {\n\t\t\tsetPlacement(value)\n\t\t\tvoid handleValidateCode(value, code)\n\t\t},\n\t\t[code, handleValidateCode],\n\t)\n\n\tconst handleValidateCodeDebounced = useConstant(() => debounce(handleValidateCode, 500))\n\n\tconst handleOnCodeChange = useCallback(\n\t\t(key: string, value: string, changeEvent?: monaco.editor.IModelContentChangedEvent) => {\n\t\t\tsetCode(value)\n\t\t\thandleValidateCodeDebounced(key as CustomCodePlacement, value)\n\t\t\t// Trigger the suggestion immediately on paste; it\u2019s possible the user pasted a snippet like GTM\n\t\t\t// and will make no further changes to the code, so it\u2019s useful to suggest the name ASAP\n\t\t\t// and not make them wait.\n\t\t\tconst isLikelyPaste = changeEvent?.changes.some(change => change.text.length > 1)\n\t\t\trequestNameSuggestionDebounced(value, { immediate: isLikelyPaste })\n\t\t},\n\t\t[requestNameSuggestionDebounced],\n\t)\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\thandleValidateCodeDebounced.cancel()\n\t\t}\n\t}, [])\n\n\tconst handleConfirm = useCallback(() => {\n\t\tconst effectiveName = name.trim() || nameSuggestion || \"Script\"\n\n\t\tif (codeValidationErrors.type !== \"none\") return\n\t\tif (codeParsingErrors.some(error => error.severity === ValidationSeverity.Error)) return\n\t\tif (hasInvalidPagesSelection) return\n\n\t\tconst eventProps = { headStart: false, headEnd: false, bodyStart: false, bodyEnd: false }\n\t\teventProps[placement] = true\n\t\tif (!pageIds || pageIds.length === 0) {\n\t\t\trecord(\"site_custom_code_change\", eventProps)\n\t\t} else {\n\t\t\trecord(\"page_custom_code_change\", eventProps)\n\t\t}\n\n\t\tsaveCustomCode(customCodeId, { name: effectiveName, loadMode, placement, code, pageIds })\n\t\tengine.stores.modalStore.dismiss()\n\t}, [\n\t\tname,\n\t\tnameSuggestion,\n\t\tloadMode,\n\t\tplacement,\n\t\tcode,\n\t\tpageIds,\n\t\tcustomCodeId,\n\t\tcodeValidationErrors,\n\t\tcodeParsingErrors,\n\t\thasInvalidPagesSelection,\n\t])\n\n\tconst handleClose = useCallback(() => {\n\t\tif (!isChanged) engine.stores.modalStore.dismiss()\n\t}, [isChanged])\n\n\tconst handleOnCodeKeyDown = useCallback(\n\t\t(event: KeyboardEvent & React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\tif (!(event.key === \"Enter\" && isCommandKeyPressed(event))) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\thandleConfirm()\n\t\t},\n\t\t[handleConfirm],\n\t)\n\n\tconst handleVariableClick = (variable: string) => {\n\t\tconst editor = codeEditorRef.current\n\t\tif (editor) {\n\t\t\teditor.replaceTextAtSelection(wrapInTemplateVariable(variable))\n\t\t}\n\t}\n\n\tconst placementOptions = useMemo(\n\t\t() =>\n\t\t\t([\"headStart\", \"headEnd\", \"bodyStart\", \"bodyEnd\"] as const).map(\n\t\t\t\tplacementItem =>\n\t\t\t\t\t({\n\t\t\t\t\t\tlabel: getCustomCodePlacementLabel(placementItem),\n\t\t\t\t\t\tclick: () => handlePlacementChange(placementItem),\n\t\t\t\t\t\tchecked: placement === placementItem,\n\t\t\t\t\t}) satisfies MenuItemOptions,\n\t\t\t),\n\t\t[placement, handlePlacementChange],\n\t)\n\n\tconst loadModeOptions = useMemo(\n\t\t() =>\n\t\t\t([\"once\", \"always\"] as const).map(\n\t\t\t\tloadModeItem =>\n\t\t\t\t\t({\n\t\t\t\t\t\tlabel: getLoadModeLabel(loadModeItem),\n\t\t\t\t\t\tclick: () => setLoadMode(loadModeItem),\n\t\t\t\t\t\tchecked: loadMode === loadModeItem,\n\t\t\t\t\t}) satisfies MenuItemOptions,\n\t\t\t),\n\t\t[loadMode],\n\t)\n\n\tconst initialModalHeight = useRef(0)\n\n\tconst updateCodeEditorHeight = useCallback(() => {\n\t\tif (!modalRef.current) return\n\n\t\tconst idealHeight = Math.max(0, Math.floor(window.innerHeight * 0.8 - initialModalHeight.current))\n\t\tconst height = Math.min(idealHeight, maxModalHeight - initialModalHeight.current)\n\n\t\tcodeEditorRef.current?.setHeight(height)\n\n\t\t// We need to update the minHeight as in the first render the codeEditorRef is null\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect -- We need to update the height\n\t\tsetCodeEditorMinHeight(height)\n\t}, [])\n\n\tuseLayoutEffect(() => {\n\t\tif (!modalRef.current) return\n\n\t\t// This height is the modal height when the code editor isn't in its full size (initially minHeight is 0px)\n\t\t//\n\t\t// Allowing us to know what is the modal height without it,\n\t\t// then properly calculate the available height for the code editor\n\t\tinitialModalHeight.current = modalRef.current.clientHeight\n\t\tupdateCodeEditorHeight()\n\n\t\twindow.addEventListener(\"resize\", updateCodeEditorHeight)\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"resize\", updateCodeEditorHeight)\n\t\t}\n\t}, [updateCodeEditorHeight])\n\n\tconst title = customCodeId ? \"Edit Script\" : \"Add Script\"\n\tconst confirmLabel = customCodeId ? Dictionary.Save : Dictionary.Add\n\n\tconst infoboxText = hasInvalidPagesSelection ? (\n\t\t<>This code uses CMS variables, which aren\u2019t supported across multiple pages or on non-CMS pages.</>\n\t) : placement !== \"bodyEnd\" ? (\n\t\t<>\n\t\t\tPlace <code>&lt;script&gt;</code> tags in \u201CEnd of &lt;body&gt;\u201D for faster page loading.\n\t\t</>\n\t) : undefined\n\n\tconst showCMSVariables = pageIds.length === 1 && collectionData && availablePlainTextFields.length > 0\n\n\tconst codeLabel = (\n\t\t<div className={styles.codeLabel}>\n\t\t\t<T>{Dictionary.Code}</T>\n\t\t\t{showCMSVariables && (\n\t\t\t\t<>\n\t\t\t\t\t{\" \u00B7 \"}\n\t\t\t\t\t<T>Supported CMS Variables:</T>{\" \"}\n\t\t\t\t\t<ClickableVariables variables={availablePlainTextFields} onVariableClick={handleVariableClick} />{\" \"}\n\t\t\t\t\t<a className={styles.link} target=\"_blank\" href={structuredDataSEOArticleURL}>\n\t\t\t\t\t\t<T>Learn more</T>\n\t\t\t\t\t</a>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t)\n\n\treturn (\n\t\t<Modal.Root\n\t\t\tvisible\n\t\t\tonDismiss={handleClose}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tkeyboardConfirmMode=\"CmdOrCtrl+Enter\"\n\t\t\tclassName={styles.container}\n\t\t\tref={modalRef}\n\t\t\t{...modalThemeProps}\n\t\t>\n\t\t\t<Modal.Header>{title}</Modal.Header>\n\n\t\t\t<Stack paddingTop={dimensions.css.modalPadding} gap={20}>\n\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.inputSpacing}>\n\t\t\t\t\t<SettingInput name=\"name\" label=\"Name\" variant=\"legacy\">\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tref={nameInputRef}\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tonChange={setName}\n\t\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\t\tplaceholder={nameSuggestion || \"Script\"}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SettingInput>\n\n\t\t\t\t\t<SettingInput name=\"placement\" label=\"Placement\" variant=\"legacy\">\n\t\t\t\t\t\t<DropdownMenuButton items={placementOptions} label={getCustomCodePlacementLabel(placement)} align=\"left\" />\n\t\t\t\t\t</SettingInput>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack>\n\t\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.inputSpacing}>\n\t\t\t\t\t\t<SettingInput name=\"pageIds\" label={Dictionary.Page} variant=\"legacy\">\n\t\t\t\t\t\t\t<PagesSelectionComboBox value={pageIds} onChange={handlePageIdsChange} />\n\t\t\t\t\t\t</SettingInput>\n\n\t\t\t\t\t\t<SettingInput name=\"loadMode\" label=\"Run\" variant=\"legacy\">\n\t\t\t\t\t\t\t<DropdownMenuButton items={loadModeOptions} label={getLoadModeLabel(loadMode)} align=\"left\" />\n\t\t\t\t\t\t</SettingInput>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack>\n\t\t\t\t\t<SettingInput name=\"code\" label={codeLabel} variant=\"legacy\">\n\t\t\t\t\t\t<div className={styles.codeEditorContainer}>\n\t\t\t\t\t\t\t<CodeEditorMinimal\n\t\t\t\t\t\t\t\tref={codeEditorRef}\n\t\t\t\t\t\t\t\tvariant=\"insideModal\"\n\t\t\t\t\t\t\t\tminHeight={codeEditorMinHeight}\n\t\t\t\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\t\t\t\tplaceholder=\"<script>\u2026</script>\"\n\t\t\t\t\t\t\t\tvalue={code}\n\t\t\t\t\t\t\t\tonChange={handleOnCodeChange}\n\t\t\t\t\t\t\t\tonKeyDown={handleOnCodeKeyDown}\n\t\t\t\t\t\t\t\thasError={\n\t\t\t\t\t\t\t\t\tcodeValidationErrors.type !== \"none\" ||\n\t\t\t\t\t\t\t\t\tcodeParsingErrors.some(error => error.severity === ValidationSeverity.Error) ||\n\t\t\t\t\t\t\t\t\thasInvalidPagesSelection\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thasWarning={codeParsingErrors.some(error => error.severity === ValidationSeverity.Warning)}\n\t\t\t\t\t\t\t\tcustomHTMLKey={placement}\n\t\t\t\t\t\t\t\tmaxNumberOfCharacters={maxNumberOfCharacters}\n\t\t\t\t\t\t\t\tonValidate={handleValidateCode}\n\t\t\t\t\t\t\t\terrors={codeParsingErrors}\n\t\t\t\t\t\t\t\tresizable={false}\n\t\t\t\t\t\t\t\tpaddingTop={8}\n\t\t\t\t\t\t\t\tpaddingBottom={8}\n\t\t\t\t\t\t\t\tlineNumbers=\"off\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</SettingInput>\n\t\t\t\t\t{getCopyForErrorType(codeValidationErrors)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t{infoboxText ? (\n\t\t\t\t\t<Stack direction=\"row\" gap={10} alignItems=\"center\" className={styles.infobox}>\n\t\t\t\t\t\t<IconInfo />\n\t\t\t\t\t\t<div>{infoboxText}</div>\n\t\t\t\t\t</Stack>\n\t\t\t\t) : (\n\t\t\t\t\t<div />\n\t\t\t\t)}\n\n\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.inputSpacing}>\n\t\t\t\t\t<Modal.CancelButton onClick={engine.stores.modalStore.dismiss} className={styles.modalActionButton}>\n\t\t\t\t\t\tCancel\n\t\t\t\t\t</Modal.CancelButton>\n\t\t\t\t\t<Modal.ActionButton onClick={handleConfirm} className={styles.modalActionButton}>\n\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t</Modal.ActionButton>\n\t\t\t\t</Stack>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\nconst saveCustomCode = engine.scheduler.wrapHandler(\n\t(id: NodeID | null, data: Pick<CustomCodeNode, \"name\" | \"loadMode\" | \"placement\" | \"code\" | \"pageIds\">) => {\n\t\tconst customCodeScope = CustomCodeScopeNode.ensure(engine.tree)\n\t\tassert(customCodeScope.isLoaded(), \"CustomCodeScopeNode should be loaded\")\n\n\t\tconst pageId = data.pageIds?.[0]\n\t\tconst code = convertTemplateVariables(data.code, pageId, convertTemplateVariableNamesToIds)\n\n\t\tdata = { ...data, code }\n\n\t\tif (id) {\n\t\t\tconst node = customCodeScope.children.find(customCodeNode => customCodeNode.id === id)\n\t\t\tassert(node, `CustomCodeNode not found: ${id}`)\n\n\t\t\tnode.set(data)\n\t\t} else {\n\t\t\tconst newCustomCode = CustomCodeNode.create(data)\n\t\t\tengine.tree.insertNode(newCustomCode, customCodeScope.id)\n\t\t}\n\t},\n)\n", "import { Button } from \"@framerjs/fresco\"\nimport { Fragment, memo } from \"react\"\nimport * as styles from \"./ClickableVariable.styles.ts\"\n\ninterface ClickableVariableProps {\n\tvariable: string\n\tonClick: (variable: string) => void\n}\n\nconst ClickableVariable = memo(function ClickableVariable({ variable, onClick }: ClickableVariableProps) {\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"link\"\n\t\t\tclassName={styles.button}\n\t\t\tdraggable\n\t\t\tonMouseUp={() => onClick(variable)}\n\t\t\tonTouchEnd={() => onClick(variable)}\n\t\t\tonDragStart={event => {\n\t\t\t\tevent.dataTransfer.setData(\"text/plain\", `{{${variable}}}`)\n\t\t\t}}\n\t\t\taria-label={`Insert ${variable} variable`}\n\t\t>\n\t\t\t{variable}\n\t\t</Button>\n\t)\n})\n\ninterface ClickableVariablesProps {\n\tvariables: string[]\n\tonVariableClick: (variable: string) => void\n}\n\nexport function ClickableVariables({ variables, onVariableClick }: ClickableVariablesProps) {\n\treturn variables.map((variable, index) => (\n\t\t<Fragment key={variable}>\n\t\t\t<span className={styles.variableContainer}>\n\t\t\t\t<ClickableVariable variable={variable} onClick={onVariableClick} />\n\t\t\t\t{index < variables.length - 1 ? \",\" : \".\"}\n\t\t\t</span>\n\t\t\t{index < variables.length - 1 && \" \"}\n\t\t</Fragment>\n\t))\n}\n", "import \"ClickableVariable.styles_1bm5eel.wyw.css\"; export const button = \"button_bmhswzo\";\nexport const variableContainer = \"variableContainer_v4tdoxb\";", "import { Stack, Translatable as T, TextInput } from \"@framerjs/fresco\"\nimport type React from \"react\"\nimport { forwardRef } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { WithWarningTintAndMessage } from \"../shared/WithWarningTintAndMessage.tsx\"\nimport * as styles from \"./SettingInput.styles.ts\"\nimport * as siteSettingStyles from \"./SiteSettings.styles.ts\"\nimport {\n\ttype ReplaceTextAtSelectionImperativeHandle,\n\tuseReplaceTextAtSelectionImperativeHandle,\n} from \"./useReplaceTextAtSelectionImperativeHandle.ts\"\n\ntype SettingInputVariant = \"legacy\" | \"redesign\"\n\ninterface Props {\n\t/* Unique prop/name that will be used as the input id and the form value key */\n\tname: string\n\t/* Displayed label for the input */\n\tlabel: string | JSX.Element\n\tlabelAction?: React.ReactNode\n\t/* If children is provided, it will render the children instead of the default input.\n    This can be used to render custom components while reusing the same styles/layout for the label.\n    Note that all other props below will be ignored, you will need to handle logics like onChange or enabled yourself on the custom component. */\n\tchildren?: React.ReactNode\n\t/* Enabled by default */\n\tenabled?: boolean\n\tdefaultValue?: string\n\tplaceholder?: string\n\tdescription?: JSX.Element | null\n\tvariant?: SettingInputVariant\n\tmaxLength?: number\n\tonChange?: (value: string, final: boolean, reset: () => void) => void\n\twarning?: string\n\tonFocus?: () => void\n\t\"aria-describedby\"?: string\n}\n\nexport type SettingInputRef = ReplaceTextAtSelectionImperativeHandle\n\n/**\n * A text input that takes up 1fr width by default\n */\nexport const SettingInput = forwardRef<SettingInputRef, Props>(function SettingInput(\n\t{\n\t\tname,\n\t\tlabel,\n\t\tlabelAction,\n\t\tenabled = true,\n\t\tchildren,\n\t\tdefaultValue = \"\",\n\t\tplaceholder,\n\t\tdescription,\n\t\tvariant = \"redesign\",\n\t\tmaxLength,\n\t\tonChange,\n\t\twarning,\n\t\tonFocus,\n\t\t\"aria-describedby\": ariaDescribedBy,\n\t},\n\tref,\n) {\n\tconst inputRef = useReplaceTextAtSelectionImperativeHandle<HTMLInputElement>(ref)\n\n\tconst handleChange = (value: string, final: boolean, reset: () => void) => {\n\t\tonChange?.(value, final, reset)\n\t}\n\n\tconst isRedesign = variant === \"redesign\"\n\tconst labelClassName = isRedesign ? siteSettingStyles.settingTitle : styles.label\n\tconst descriptionClassName = isRedesign ? siteSettingStyles.settingDescription : styles.description\n\n\treturn (\n\t\t<Stack gap={10} className={styles.wrapper}>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\">\n\t\t\t\t<label htmlFor={name} className={labelClassName}>\n\t\t\t\t\t{isString(label) ? <T>{label}</T> : label}\n\t\t\t\t</label>\n\t\t\t\t{labelAction ? labelAction : null}\n\t\t\t</Stack>\n\t\t\t<WithWarningTintAndMessage\n\t\t\t\twarningMessage={warning}\n\t\t\t\twarningMessageClassName={styles.warningMessage}\n\t\t\t\tclassName={styles.warningWrapper}\n\t\t\t>\n\t\t\t\t{children ?? (\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\tid={name}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\tvalue={defaultValue}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tmaxLength={maxLength}\n\t\t\t\t\t\tchangeOnBlur={false}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</WithWarningTintAndMessage>\n\t\t\t{description && <p className={descriptionClassName}>{description}</p>}\n\t\t</Stack>\n\t)\n})\n", "import \"SettingInput.styles_1ip7wfi.wyw.css\"; export const wrapper = \"wrapper_wqz1civ\";\nexport const warningWrapper = \"warningWrapper_wr0eak3\";\nexport const label = \"label_l1rtl0mi\";\nexport const labelDisabled = \"labelDisabled_l9v6aj7\";\nexport const description = \"description_dc4czda\";\nexport const warningMessage = \"warningMessage_w79nlv\";\nexport const toggleRow = \"toggleRow_t6vgmod\";", "import { type ForwardedRef, useImperativeHandle, useRef } from \"react\"\n\nexport interface ReplaceTextAtSelectionImperativeHandle {\n\treplaceTextAtSelection: (text: string) => void\n}\n\nexport function useReplaceTextAtSelectionImperativeHandle<T extends HTMLInputElement | HTMLTextAreaElement>(\n\tforwardedRef: ForwardedRef<ReplaceTextAtSelectionImperativeHandle>,\n) {\n\tconst inputRef = useRef<T>(null)\n\n\tuseImperativeHandle(forwardedRef, () => ({\n\t\treplaceTextAtSelection: (text: string) => {\n\t\t\tconst input = inputRef.current\n\t\t\tif (!input) return\n\n\t\t\tconst startPosition = input.selectionStart ?? 0\n\n\t\t\tinput.focus()\n\n\t\t\t// execCommand is deprecated, but there's no alternative that would preserve the\n\t\t\t// browser's native undo stack, and without that the UX is quite bad.\n\t\t\t// Ideally, this would become a ProseMirror input where we can show custom completion UI.\n\t\t\tdocument.execCommand(\"insertText\", false, text)\n\n\t\t\tconst newPosition = startPosition + text.length\n\t\t\tsetTimeout(() => {\n\t\t\t\tinput.setSelectionRange(newPosition, newPosition)\n\t\t\t}, 0)\n\t\t},\n\t}))\n\n\treturn inputRef\n}\n", "import \"EditCustomCodeModal.styles_17r3bby.wyw.css\"; export const container = \"container_c1gxe3vv\";\nexport const codeEditorContainer = \"codeEditorContainer_c1hesrk1\";\nexport const infobox = \"infobox_itkx8km\";\nexport const error = \"error_ejsgi5d\";\nexport const modalActionButton = \"modalActionButton_m1x8k74y\";\nexport const pagesSelectionWrapper = \"pagesSelectionWrapper_pbo7et0\";\nexport const codeLabel = \"codeLabel_c1ynyge3\";\nexport const link = \"link_l15j9ur3\";", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { Button, IconInputClose, IconInputDropdown, InputWrapper, Stack, TextInput } from \"@framerjs/fresco\"\nimport { ComboBoxCommon, keepInputFieldFocusedWhenClickedOnSideSlots } from \"@framerjs/fresco/components/ComboBox\"\nimport { List } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { FALLBACK_PATH, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, ShallowWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport * as styles from \"./PagesSelectionComboBox.styles.ts\"\n\ninterface PagesSelectionComboBoxProps {\n\tvalue: string[]\n\tonChange: (value: string[]) => void\n}\n\nexport function PagesSelectionComboBox({\n\tvalue: selectedItems,\n\tonChange: onSelectedItemsChange,\n}: PagesSelectionComboBoxProps) {\n\tconst options = usePageOptions()\n\n\tconst itemLookupMap = useMemo(() => {\n\t\tconst map = new Map<NodeID, ComboBoxListItem>()\n\t\toptions.forEach(item => map.set(item.value, item))\n\t\treturn map\n\t}, [options])\n\n\tconst validSelectedItems = useMemo(\n\t\t() => selectedItems.filter(item => itemLookupMap.has(item)),\n\t\t[itemLookupMap, selectedItems],\n\t)\n\n\tconst toggleItem = useCallback(\n\t\t(value: string) => {\n\t\t\tconst item = itemLookupMap.get(value)\n\t\t\tif (!item) return\n\n\t\t\tconst index = validSelectedItems.indexOf(value)\n\t\t\tif (index > -1) {\n\t\t\t\tconst newSelectedItems = List.remove(validSelectedItems, index) as string[] // remove readonly\n\t\t\t\tonSelectedItemsChange(newSelectedItems)\n\t\t\t} else {\n\t\t\t\tconst newSelectedItems = List.push(validSelectedItems, value) as string[] // remove readonly\n\t\t\t\tonSelectedItemsChange(newSelectedItems)\n\t\t\t}\n\t\t},\n\t\t[itemLookupMap, onSelectedItemsChange, validSelectedItems],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(value: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\t\t\treset()\n\n\t\t\ttoggleItem(value)\n\t\t},\n\t\t[toggleItem],\n\t)\n\n\tconst onKeyDownCapture = useCallback(\n\t\t(event: React.KeyboardEvent, internalValue: string) => {\n\t\t\tif (event.key === \"Backspace\" && internalValue === \"\") {\n\t\t\t\tconst newSelectedItems = List.pop(validSelectedItems) as string[] // remove readonly\n\t\t\t\tonSelectedItemsChange(newSelectedItems)\n\t\t\t}\n\t\t},\n\t\t[onSelectedItemsChange, validSelectedItems],\n\t)\n\n\treturn (\n\t\t<ComboBoxCommon\n\t\t\tconstantChange\n\t\t\tvalue=\"\"\n\t\t\tonChange={onChange}\n\t\t\titems={options}\n\t\t\tclearSelectionOnEmptySearch\n\t\t\tcloseAutoCompleteOnSelect={false}\n\t\t\tcheckedItems={validSelectedItems}\n\t\t\trenderInput={renderProps => {\n\t\t\t\tconst enabled = renderProps.enabled\n\n\t\t\t\treturn (\n\t\t\t\t\t<InputWrapper\n\t\t\t\t\t\tref={renderProps.inputWrapperRef}\n\t\t\t\t\t\tonClick={renderProps.clickHandler}\n\t\t\t\t\t\tonMouseDown={keepInputFieldFocusedWhenClickedOnSideSlots}\n\t\t\t\t\t\tmultiline\n\t\t\t\t\t\tclassName={styles.inputWrapper}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack direction=\"row\" gap={3} wrap=\"wrap\" className={styles.inputContent}>\n\t\t\t\t\t\t\t{validSelectedItems.map(item => (\n\t\t\t\t\t\t\t\t<OptionChip\n\t\t\t\t\t\t\t\t\tkey={item}\n\t\t\t\t\t\t\t\t\tvalue={item}\n\t\t\t\t\t\t\t\t\ttitle={itemLookupMap.get(item)?.title ?? item}\n\t\t\t\t\t\t\t\t\tonRemove={toggleItem}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\t// The native browser autocomplete UI interferes with the combobox dropdown\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\taria-expanded={renderProps.isOpen}\n\t\t\t\t\t\t\t\taria-controls={renderProps.listBoxId}\n\t\t\t\t\t\t\t\taria-activedescendant={renderProps.highlightedItemId}\n\t\t\t\t\t\t\t\tvalue={renderProps.internalValue}\n\t\t\t\t\t\t\t\ttitle={renderProps.internalValue}\n\t\t\t\t\t\t\t\tonChange={renderProps.changeHandler}\n\t\t\t\t\t\t\t\tonFocus={renderProps.focusHandler}\n\t\t\t\t\t\t\t\tonBlur={renderProps.blurHandler}\n\t\t\t\t\t\t\t\tonKeyDownCapture={(event: React.KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\tonKeyDownCapture(event, renderProps.internalValue)\n\t\t\t\t\t\t\t\t\trenderProps.keydownHandler(event)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\t\t{...renderProps.inputProps}\n\t\t\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\t\t\t// Because ComboboxCommon is a forwardRef, we cannot use Generics on the component props.\n\t\t\t\t\t\t\t\t// so we need a typecast\n\t\t\t\t\t\t\t\tref={renderProps.ref as (ref: HTMLInputElement) => void}\n\t\t\t\t\t\t\t\tplaceholder={validSelectedItems.length === 0 ? Dictionary.All : undefined}\n\t\t\t\t\t\t\t\tstopUpDownKeyPropagation={false}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t<div className={styles.chevron}>\n\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t)\n\t\t\t}}\n\t\t/>\n\t)\n}\n\ninterface OptionChipProps {\n\tvalue: string\n\ttitle: string\n\tonRemove: (value: string) => void\n}\n\nfunction OptionChip({ value, title, onRemove }: OptionChipProps) {\n\treturn (\n\t\t<div\n\t\t\t// biome-ignore lint/a11y/useSemanticElements: intentional\n\t\t\trole=\"button\"\n\t\t\tclassName={styles.optionChip}\n\t\t\ttabIndex={0}\n\t\t>\n\t\t\t<div>{title}</div>\n\t\t\t<Button className={styles.closeButton} onClick={() => onRemove(value)} title={Dictionary.Remove} variant=\"clean\">\n\t\t\t\t<IconInputClose />\n\t\t\t</Button>\n\t\t</div>\n\t)\n}\n\nfunction usePageOptions() {\n\tconst { routeMap, homePageNodeId } = useEngineState(\n\t\t() => {\n\t\t\tconst routeSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\n\t\t\treturn {\n\t\t\t\trouteMap: routeSegmentRootNode.getWebPageIdToRawPathMap(engine.tree),\n\t\t\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\treturn useMemo(() => {\n\t\tconst result: ComboBoxListItem[] = []\n\n\t\trouteMap.forEach((_path, pageId) => {\n\t\t\tconst webPage = engine.tree.get<ShallowWebPageNode>(pageId)\n\t\t\tif (!webPage) return\n\n\t\t\tconst isHomePage = pageId === homePageNodeId\n\t\t\tconst title = isHomePage ? Dictionary.Home : getWebPagePath(engine.tree, webPage) || FALLBACK_PATH\n\n\t\t\tresult.push({\n\t\t\t\ttype: \"option\",\n\t\t\t\tvalue: pageId,\n\t\t\t\ttitle,\n\t\t\t})\n\n\t\t\tconst abVariants = webPage.getAbTestingChildren(engine.tree)\n\t\t\tif (!abVariants) return\n\n\t\t\tfor (const abVariant of abVariants) {\n\t\t\t\tconst name = abVariant.resolveValue(\"name\")\n\t\t\t\tconst variantTitle = `${title} \u00B7 ${name || Dictionary.Variant}`\n\n\t\t\t\tresult.push({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: abVariant.id,\n\t\t\t\t\ttitle: variantTitle,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\treturn result\n\t}, [routeMap, homePageNodeId])\n}\n", "import \"PagesSelectionComboBox.styles_1rpb4mn.wyw.css\"; export const searchIcon = \"searchIcon_s1efdy5x\";\nexport const inputWrapper = \"inputWrapper_i45k7hs\";\nexport const inputContent = \"inputContent_i12yo7i0\";\nexport const chipsContainer = \"chipsContainer_cq1gl22\";\nexport const closeButton = \"closeButton_c1xo0jwu\";\nexport const input = \"input_ih8q5th\";\nexport const optionChip = \"optionChip_ojn4cct\";\nexport const chevron = \"chevron_c1nx50xt\";", "import { debounce, unhandledError } from \"@framerjs/shared\"\nimport { Output, generateText } from \"ai\"\nimport { isAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport { createVekterOpenRouterExtraBody, openRouter } from \"app/ai/config/openRouter.ts\"\nimport { LanguageModel } from \"app/ai/languageModels.ts\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport { z } from \"zod\"\n\ninterface UseCustomCodeNameSuggestionOptions {\n\tenabled: boolean\n\tinitialCode: string\n}\n\nconst customCodeNameSchema = z\n\t.object({\n\t\tname: z\n\t\t\t.string()\n\t\t\t.describe(\n\t\t\t\t\"A short, human-readable name for the HTML snippet (e.g. 'Google Tag Manager', 'Facebook Pixel', 'Cookie Consent Banner')\",\n\t\t\t),\n\t})\n\t.strict()\n\nexport function useCustomCodeNameSuggestion({ enabled, initialCode }: UseCustomCodeNameSuggestionOptions) {\n\tconst [nameSuggestion, setSuggestion] = useState(\"\")\n\tconst nameSuggestionAbortController = useRef<AbortController | null>(null)\n\n\tconst suggestNameDebounced = useConstant(() =>\n\t\tdebounce((codeValue: string, signal: AbortSignal) => {\n\t\t\tif (!codeValue.trim()) {\n\t\t\t\tsetSuggestion(\"\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tvoid suggestCustomCodeName(codeValue, signal)\n\t\t\t\t.then(suggested => setSuggestion(suggested))\n\t\t\t\t.catch(error => {\n\t\t\t\t\tif (!isAbortError(error)) unhandledError(error)\n\t\t\t\t})\n\t\t}, 1000),\n\t)\n\n\tconst requestNameSuggestionDebounced = useCallback(\n\t\t(codeValue: string, { immediate }: { immediate?: boolean } = {}) => {\n\t\t\tif (!enabled || isAiDisabled(engine)) return\n\n\t\t\tnameSuggestionAbortController.current?.abort()\n\t\t\tconst abortController = new AbortController()\n\t\t\tnameSuggestionAbortController.current = abortController\n\n\t\t\tsuggestNameDebounced(codeValue, abortController.signal)\n\t\t\tif (immediate) suggestNameDebounced.flush()\n\t\t},\n\t\t[enabled],\n\t)\n\n\tuseEffect(() => {\n\t\tif (!enabled) return\n\t\trequestNameSuggestionDebounced(initialCode)\n\t}, [enabled, initialCode, requestNameSuggestionDebounced])\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tsuggestNameDebounced.cancel()\n\t\t\tnameSuggestionAbortController.current?.abort()\n\t\t}\n\t}, [])\n\n\treturn {\n\t\tnameSuggestion,\n\t\t/** Requests a name suggestion for the given code value. Set `immediate` to skip the debounce. */\n\t\trequestNameSuggestionDebounced,\n\t}\n}\n\nasync function suggestCustomCodeName(codeContent: string, signal: AbortSignal): Promise<string> {\n\tconst { output } = await generateText({\n\t\tmodel: openRouter(LanguageModel.Gemini3Flash, {\n\t\t\textraBody: createVekterOpenRouterExtraBody({\n\t\t\t\tfeatureCategory: \"canvas\",\n\t\t\t\tfeatureName: \"custom-code-name\",\n\t\t\t\tstep: \"suggest\",\n\t\t\t\tsessionId: crypto.randomUUID(),\n\t\t\t}),\n\t\t}),\n\t\toutput: Output.object({ schema: customCodeNameSchema }),\n\t\tmessages: [\n\t\t\t{\n\t\t\t\trole: \"user\",\n\t\t\t\tcontent: `Given this HTML snippet, suggest a short descriptive name for it (2-4 words max). If it's a known third-party service (like Google Tag Manager, Facebook Pixel, Hotjar, etc.), use the service name. Otherwise, describe what the snippet does.\\n\\n\\`\\`\\`html\\n${codeContent}\\n\\`\\`\\``,\n\t\t\t},\n\t\t],\n\t\t// Make the output as deterministic as possible\n\t\ttemperature: 0,\n\t\tabortSignal: signal,\n\t})\n\n\treturn output.name\n}\n", "import type { ComponentLoader, DataDefinition } from \"@framerjs/framer-runtime\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\ntype VariableConverter = (\n\tvalue: string,\n\tcollectionData: DataDefinition | null,\n\tcomponentLoader: ComponentLoader,\n) => string\n\nexport function convertTemplateVariables(\n\tcode: string,\n\tpageId: NodeID | undefined,\n\tvariableConverter: VariableConverter,\n): string {\n\tconst page = engine.tree.getNodeWithTrait(pageId, isWebPageNode)\n\tif (!page) return code\n\n\tconst collectionData = engine.componentLoader.dataForIdentifier(page.dataIdentifier)\n\tif (!collectionData) return code\n\n\treturn variableConverter(code, collectionData, engine.componentLoader)\n}\n", "import type { CustomCodeLoadMode, CustomCodePlacement } from \"@framerjs/shared/src/custom-code/types.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { CustomCodeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport function getCustomCodeName(customCode: CustomCodeNode | null) {\n\tconst name = customCode?.resolveValue(\"name\") ?? \"\"\n\n\t// The migration (V116) performed the migration with the node name as \"Custom Code (Legacy)\"\n\t// After some feedback, we decided to render it as \"Custom Code\" instead.\n\treturn customCode?.id.startsWith(\"legacy-\") && name === \"Custom Code (Legacy)\" ? \"Custom Code\" : name\n}\n\nconst placementLabelMap: Record<CustomCodePlacement, string> = {\n\tbodyEnd: \"End of <body>\",\n\theadEnd: \"End of <head>\",\n\theadStart: \"Start of <head>\",\n\tbodyStart: \"Start of <body>\",\n}\n\nexport function getCustomCodePlacementLabel(placement: CustomCodePlacement) {\n\treturn placementLabelMap[placement]\n}\n\nexport function getLoadModeLabel(loadMode: CustomCodeLoadMode) {\n\treturn loadMode === \"once\" ? \"Once\" : \"On Every Page Visit\"\n}\n\nexport function getCustomCodeTypeLabel(customCode: CustomCodeNode) {\n\tif (customCode.managedByPlugin) return \"Plugin\"\n\treturn Dictionary.Custom\n}\n\nexport function getCustomCodePages(customCode: CustomCodeNode, routeMap: Map<NodeID, string>) {\n\tif (!customCode.pageIds) return Dictionary.All\n\n\tlet result = \"\"\n\tfor (const pageId of customCode.pageIds) {\n\t\tconst path = routeMap.get(pageId)\n\t\tif (path) {\n\t\t\tresult += `${path}, `\n\t\t}\n\t}\n\n\tif (result.length === 0) return Dictionary.All\n\treturn result.substring(0, result.length - 2)\n}\n", "import { Button, CenterChild, CustomModal, IconClose, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { CodeEditorMinimal } from \"code-editor/CodeEditorMinimal.tsx\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CustomCodeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCustomCodeNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { PluginStore } from \"document/stores/PluginStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\nimport { PluginIcon } from \"plugins/PluginIcon.tsx\"\nimport { getPluginIcon } from \"plugins/plugins.ts\"\nimport { useEffect } from \"react\"\nimport { useModalThemeOnActiveView } from \"../../utils/useModalTheme.ts\"\nimport { convertTemplateVariableIdsToNames } from \"../templateVariables.ts\"\nimport { CustomCodeIcon } from \"./CustomCodeIcon.tsx\"\nimport * as styles from \"./ViewCustomCodeModal.styles.ts\"\nimport { convertTemplateVariables } from \"./utils/convertTemplateVariables.ts\"\nimport { getCustomCodeName, getCustomCodePlacementLabel } from \"./utils/labels.ts\"\n\nexport function ViewCustomCodeModal({ customCodeId }: ModalProps<ModalType.ViewCustomCode>) {\n\tconst { modalStore, pluginStore } = engine.stores\n\n\tconst { customCode, code, icon, name } = useEngineState(\n\t\t() => {\n\t\t\tconst customCode = engine.tree.getNodeWithTrait(customCodeId, isCustomCodeNode)\n\t\t\tif (!customCode) return { customCode: null, code: null, icon: null, name: \"\" }\n\n\t\t\tconst { icon, name } = getCustomCodeIconAndName(customCode, pluginStore)\n\n\t\t\tconst pageId = customCode.pageIds?.[0]\n\t\t\tconst code = pageId\n\t\t\t\t? convertTemplateVariables(customCode.code, pageId, convertTemplateVariableIdsToNames)\n\t\t\t\t: customCode.code\n\n\t\t\treturn { customCode, code, icon, name }\n\t\t},\n\t\t[customCodeId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tuseEffect(() => {\n\t\tif (!customCode) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tmodalStore.dismiss()\n\t\t\t})\n\t\t}\n\t}, [customCode, modalStore])\n\n\tif (!customCode) return null\n\n\treturn (\n\t\t<CustomModal visible onDismiss={modalStore.dismiss} title={name} className={styles.modal} {...modalThemeProps}>\n\t\t\t<Header icon={icon} name={name} subtitle={getCustomCodePlacementLabel(customCode.placement)} />\n\n\t\t\t<Stack\n\t\t\t\tdirection=\"column\"\n\t\t\t\tgap={8}\n\t\t\t\tpaddingLeft={dimensions.css.modalPadding}\n\t\t\t\tpaddingRight={dimensions.css.modalPadding}\n\t\t\t\tpaddingBottom={dimensions.css.modalPadding}\n\t\t\t>\n\t\t\t\t<div className={styles.codeEditorContainer}>\n\t\t\t\t\t<CodeEditorMinimal\n\t\t\t\t\t\tvariant=\"insideModal\"\n\t\t\t\t\t\tminHeight={470}\n\t\t\t\t\t\tisViewOnly\n\t\t\t\t\t\tvalue={code}\n\t\t\t\t\t\tcustomHTMLKey={customCode.placement}\n\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\tonValidate={noop}\n\t\t\t\t\t\thasError={false}\n\t\t\t\t\t\tmaxNumberOfCharacters={5000}\n\t\t\t\t\t\tpaddingTop={8}\n\t\t\t\t\t\tpaddingBottom={8}\n\t\t\t\t\t\tlineNumbers=\"off\"\n\t\t\t\t\t\tresizable={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t</CustomModal>\n\t)\n}\n\nfunction getCustomCodeIconAndName(customCode: CustomCodeNode, pluginStore: PluginStore) {\n\tif (customCode.managedByPlugin) {\n\t\tconst pluginManifest = pluginStore.manifestById.get(customCode.managedByPlugin)\n\t\tif (pluginManifest) {\n\t\t\treturn { icon: getPluginIcon(pluginManifest), name: pluginManifest.name }\n\t\t}\n\t}\n\n\treturn { icon: null, name: getCustomCodeName(customCode) }\n}\n\ninterface HeaderProps {\n\tname: string\n\tsubtitle?: string\n\ticon?: string | null\n}\n\nfunction Header({ name, subtitle, icon }: HeaderProps) {\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tpaddingLeft={dimensions.css.modalPadding}\n\t\t\tpaddingRight={4}\n\t\t\tclassName={styles.header}\n\t\t>\n\t\t\t{icon ? (\n\t\t\t\t<CenterChild className={styles.iconWrapper}>\n\t\t\t\t\t<PluginIcon src={icon} size=\"small\" />\n\t\t\t\t</CenterChild>\n\t\t\t) : (\n\t\t\t\t<CustomCodeIcon />\n\t\t\t)}\n\t\t\t<span className={styles.title}>\n\t\t\t\t<span className={cx(truncateWithEllipsis, styles.titleText)}>{name}</span>\n\t\t\t\t{subtitle && <span className={styles.subtitle}>{` \u00B7 ${subtitle}`}</span>}\n\t\t\t</span>\n\t\t\t<Button\n\t\t\t\tvariant=\"clean\"\n\t\t\t\ttitle=\"Close Plugin\"\n\t\t\t\tclassName={cx(styles.closeIcon, styles.headerIcon)}\n\t\t\t\tonClick={engine.stores.modalStore.dismiss}\n\t\t\t>\n\t\t\t\t<IconClose />\n\t\t\t</Button>\n\t\t</Stack>\n\t)\n}\n", "import \"CustomCodeIcon.styles_1ics1tx.wyw.css\"; export const customCodeIcon = \"customCodeIcon_c1hla1n3\";", "import * as styles from \"./CustomCodeIcon.styles.ts\"\n\nexport function CustomCodeIcon() {\n\treturn (\n\t\t<div className={styles.customCodeIcon}>\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"6\" fill=\"none\" overflow=\"visible\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 3 0 L 0 3 L 3 6 M 7 0 L 10 3 L 7 6\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstroke=\"#999999\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t></path>\n\t\t\t</svg>\n\t\t</div>\n\t)\n}\n", "import \"ViewCustomCodeModal.styles_fwosjm.wyw.css\"; export const modal = \"modal_m1f08isp\";\nexport const codeEditorContainer = \"codeEditorContainer_c1tok0nd\";\nexport const header = \"header_hntcony\";\nexport const iconWrapper = \"iconWrapper_iuuodru\";\nexport const headerIcon = \"headerIcon_hfpchop\";\nexport const closeIcon = \"closeIcon_ccx5b8u\";\nexport const title = \"title_t1as4pg8\";\nexport const titleText = \"titleText_tfjalwr\";\nexport const subtitle = \"subtitle_skqg77r\";\nexport const menu = \"menu_m1l1it0s\";", "import { CustomModal, Spinner } from \"@framerjs/fresco\"\nimport type { ModalThemeProps } from \"@framerjs/fresco/components/CustomModal\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useModalTheme } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { useIsBillingV3 } from \"../hooks/useIsBillingV3.ts\"\nimport * as styles from \"./AcquireAddOnModal.styles.ts\"\nimport { AcquireAddOnModalInner, trackingPages } from \"./AcquireAddOnModalInner.tsx\"\nimport { useAddonPurchaseInfo } from \"./useAddonPurchaseInfo.ts\"\n\nexport function AcquireAddOnModal({ onSuccess, addonInfo }: ModalProps<ModalType.AcquireAddonModal>) {\n\tconst addonPurchaseInfo = useAddonPurchaseInfo(addonInfo, engine)\n\tconst isBillingV3 = useIsBillingV3()\n\tuseRecordEffect(\"ui_impression\", { page: trackingPages.base })\n\n\tconst modalThemeProps: ModalThemeProps = useModalTheme(\"default\")\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst runAfterReady = useCallback((callback: () => void) => {\n\t\tengine.scheduler.processWhenReady(callback)\n\t}, [])\n\n\tfunction onCancelOrDismiss() {\n\t\trecord(\"ui_interaction\", { page: trackingPages.base, id: UIInteraction.dismiss })\n\t\tengine.stores.modalStore.dismissModal(ModalType.AcquireAddonModal)\n\t}\n\n\t// TODO: why is this not one of the error cases but a separate confirmation modal?\n\t// https://github.com/framer/company/issues/31265\n\tconst onSitePlanCancelled = useCallback(() => {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\tsource: \"localization_sidebar\",\n\t\t\ttitle: \"Not supported\",\n\t\t\tdescription:\n\t\t\t\t\"Your site needs to be on an active plan to add add-ons. Please reactivate your subscription or contact support.\",\n\t\t\tconfirmLabel: \"View Plans\",\n\t\t\tcancelLabel: Dictionary.Cancel,\n\t\t\tonConfirm: () => {\n\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\tpage: Pages.acquireAddOnModal,\n\t\t\t\t\tid: UIInteraction.openSiteSettingsPlans,\n\t\t\t\t})\n\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.plans })\n\t\t\t},\n\t\t})\n\t}, [])\n\n\treturn (\n\t\t<CustomModal visible onDismiss={onCancelOrDismiss} className={styles.modal} {...modalThemeProps}>\n\t\t\t{addonPurchaseInfo ? (\n\t\t\t\t<AcquireAddOnModalInner\n\t\t\t\t\tdismissFn={() => engine.stores.modalStore.dismissModal(ModalType.AcquireAddonModal)}\n\t\t\t\t\tonCancelOrDismiss={onCancelOrDismiss}\n\t\t\t\t\tonSuccess={onSuccess}\n\t\t\t\t\taddonPurchaseInfo={addonPurchaseInfo}\n\t\t\t\t\tisBillingV3={isBillingV3}\n\t\t\t\t\trunAfterReady={runAfterReady}\n\t\t\t\t\tonSitePlanCancelled={onSitePlanCancelled}\n\t\t\t\t\ttree={engine.tree}\n\t\t\t\t\tusageData={engine.stores.projectStore.usageData}\n\t\t\t\t\tpollProject={remoteDispatch?.pollProject}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Spinner data-testid=\"preview-spinner\" />\n\t\t\t)}\n\t\t</CustomModal>\n\t)\n}\n", "import { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { shouldUseBillingV3 } from \"../api/billingV3.ts\"\n\nexport function useIsBillingV3(): boolean {\n\tconst billingV3ExperimentOn = useExperimentIsOn(\"billingV3\")\n\tconst teamLicenseType = engine.stores.projectStore.useState(s => s.project?.teamLicenseType ?? null)\n\tconst teamLicenseVersion = engine.stores.projectStore.useState(s => s.project?.teamLicenseVersion ?? null)\n\treturn shouldUseBillingV3({ billingV3ExperimentOn, teamLicenseType, teamLicenseVersion })\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { ConfirmationModal } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\n\nexport const ConfirmAcquireAddOnModal = (\n\tprops: ModalProps<ModalType.ConfirmAcquireAddOn> & { source: ModalOpenSource },\n) => {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst { title, description, addonInfo, source } = props\n\n\tconst handleConfirm = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: \"confirm-acquire-add-on\",\n\t\t\tid: UpsellUIInteraction.confirmUpsell,\n\t\t})\n\t\tengine.stores.modalStore.dismissModal(ModalType.ConfirmAcquireAddOn)\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.AcquireAddonModal,\n\t\t\taddonInfo,\n\t\t\tsource,\n\t\t})\n\t}\n\n\tconst handleCancel = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: \"confirm-acquire-add-on\",\n\t\t\tid: UpsellUIInteraction.cancelUpsell,\n\t\t})\n\t\tengine.stores.modalStore.dismissModal(ModalType.ConfirmAcquireAddOn)\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tconfirmLabel={`Buy ${Dictionary.AddOn}`}\n\t\t\tcancelLabel={Dictionary.MaybeLater}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonCancel={handleCancel}\n\t\t\tonDismiss={handleCancel}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { UpsellType } from \"@framerjs/events\"\nimport { ConfirmationModal } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { UpsellFeature } from \"../utils/upsell.ts\"\n\nconst UPSELL_ID_MAP: Record<UpsellFeature, UpsellType> = {\n\t[UpsellFeature.fileUploadLimitInMB]: UpsellType.fileLimitUpsell,\n\t[UpsellFeature.pages]: UpsellType.pageLimitUpsell,\n\t[UpsellFeature.canUseEditorPermissions]: UpsellType.projectPermissionsUpsell,\n\t[UpsellFeature.cmsCollections]: UpsellType.cmsCollectionsUpsell,\n\t[UpsellFeature.cmsItems]: UpsellType.cmsItemsUpsell,\n\t[UpsellFeature.customDomainRecoverUpsell]: UpsellType.customDomainRecoverUpsell,\n\t[UpsellFeature.domainToBuyUpsell]: UpsellType.domainToBuyUpsell,\n\t[UpsellFeature.canPublishToCustomDomain]: UpsellType.customDomainUpsell,\n\t[UpsellFeature.canInviteEditors]: UpsellType.teamEditorLimitUpsell,\n\t[UpsellFeature.canInviteProjectEditors]: UpsellType.projectEditorLimitUpsell,\n\t[UpsellFeature.localeAddon]: UpsellType.localeAddonUpsell,\n\t[UpsellFeature.translatableWords]: UpsellType.translationLimitUpsell,\n\t[UpsellFeature.canUseUTMTracking]: UpsellType.useUTMTrackingUpsell,\n\t[UpsellFeature.abTests]: UpsellType.abTestsUpsell,\n\t[UpsellFeature.canUseFunnels]: UpsellType.funnelsUpsell,\n\t[UpsellFeature.canUseTriggers]: UpsellType.triggersUpsell,\n\t[UpsellFeature.trackingEventsLimit]: UpsellType.trackingEventsLimitUpsell,\n\t[UpsellFeature.canUseRedirects]: UpsellType.redirectsUpsell,\n\t[UpsellFeature.canUseCustomCanonicalUrl]: UpsellType.customProxyUpsell,\n\t[UpsellFeature.canUseCustomLocaleRegions]: UpsellType.customLocaleRegionsUpsell,\n\t[UpsellFeature.canUseBatchAITranslation]: UpsellType.batchAITranslationUpsell,\n\t[UpsellFeature.canUsePasswordProtection]: UpsellType.passwordUpsell,\n\t[UpsellFeature.canUseStagingEnvironment]: UpsellType.stagingUpsell,\n\t[UpsellFeature.canUseWellKnown]: UpsellType.wellKnownUpsell,\n\t[UpsellFeature.analyticsRangeInDays]: UpsellType.analyticsRangeInDaysLimitUpsell,\n\t[UpsellFeature.bandwidthInGB]: UpsellType.bandwidthUpsell,\n\t[UpsellFeature.aiCredits]: UpsellType.aiCreditsUpsell,\n}\n\nexport const UpsellFeatureModal = (props: ModalProps<ModalType.UpsellFeature>) => {\n\tconst { upsellFeature, title, description } = props\n\tconst upsell = UPSELL_ID_MAP[upsellFeature]\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\tuseRecordEffect(\"ui_impression\", { page: upsell }, [upsell])\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handleConfirm = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: upsell,\n\t\t\tid: UpsellUIInteraction.confirmUpsell,\n\t\t})\n\t\tengine.stores.modalStore.dismissModal(ModalType.UpsellFeature)\n\t\tconst { project } = engine.stores.projectStore\n\t\tconst licenseTypes = project\n\t\t\t? {\n\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\tsite: project.license.type,\n\t\t\t\t\tteam: project.teamLicenseType,\n\t\t\t\t}\n\t\t\t: null\n\t\tif (licenseTypes) updatePurchaseOrigin(upsell, licenseTypes, null)\n\n\t\tengine.stores.siteSettingsStore\n\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.plans, upsellFeature })\n\t\t\t.catch(unhandledError)\n\t}\n\n\tconst handleCancel = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: upsell,\n\t\t\tid: UpsellUIInteraction.cancelUpsell,\n\t\t})\n\t\tengine.stores.modalStore.dismissModal(ModalType.UpsellFeature)\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle={title}\n\t\t\tdescription={description}\n\t\t\tconfirmLabel=\"View Plans\"\n\t\t\tcancelLabel={Dictionary.MaybeLater}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonCancel={handleCancel}\n\t\t\tonDismiss={handleCancel}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import type { PaidProjectLicenseType } from \"@framerjs/app-shared\"\nimport { ProjectLicenseType, getProjectLicenseName } from \"@framerjs/app-shared\"\nimport {\n\tConfirmationModal,\n\tLink,\n\tRadioButton,\n\tRadioButtonGroup,\n\tStack,\n\tTranslatable as T,\n\tTextInput,\n} from \"@framerjs/fresco\"\nimport { assert, assertNever, getLogger, hostInfo } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { format } from \"date-fns\"\nimport { useIsBillingV3 } from \"document/components/chrome/siteSettings/Plans/Stripe/hooks/useIsBillingV3.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { contactSupportURL } from \"utils/staticURLs.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { trackGTMEvent } from \"web/lib/useTrackPurchaseSuccess.tsx\"\nimport { PollStatus } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { isPlanCancelled, isPlanCancelledAndExpired } from \"../../utils/isPlanCancelled.ts\"\nimport { CancelProjectSubscriptionStatus, cancelProjectSubscription } from \"../api/cancelProjectSubscription.ts\"\nimport * as styles from \"./PlanModals.styles.ts\"\nimport { PlanModalsFeatureList } from \"./PlanModalsFeatureList.tsx\"\n\nconst log = getLogger(\"PlanCancellationModal\")\n\ninterface Props {\n\tprojectId: string\n\trefreshSubscriptions: () => Promise<void>\n\tcurrentProjectLicenseType: PaidProjectLicenseType\n\tnextBillDate: Date\n\tprice: string\n\tcurrency: string\n}\n\nenum ModalSteps {\n\tFeedback,\n\tConfirmation,\n}\n\nexport function PlanCancellationModal({\n\tprojectId,\n\trefreshSubscriptions,\n\tnextBillDate,\n\tcurrentProjectLicenseType,\n\tprice,\n\tcurrency,\n}: Props) {\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst [currentStep, setCurrentStep] = React.useState<ModalSteps>(ModalSteps.Feedback)\n\tconst [feedback, setFeedback] = React.useState<Feedback>({})\n\tconst [isSubmitting, setIsSubmitting] = React.useState(false)\n\n\tconst isFeedbackValid = Boolean((feedback.reason && feedback.reason !== reasonSpecify) || feedback.text?.length)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst isBillingV3 = useIsBillingV3()\n\n\tconst gotoPrevious = () => setCurrentStep(ModalSteps.Feedback)\n\tconst gotoNext = () => setCurrentStep(ModalSteps.Confirmation)\n\n\tconst onDismiss = () => {\n\t\tif (!isSubmitting) {\n\t\t\tengine.stores.modalStore.dismissModal(ModalType.PlanCancellation)\n\t\t}\n\t}\n\n\tconst onConfirm = React.useCallback(async () => {\n\t\tif (!remoteDispatch) return\n\n\t\tsetIsSubmitting(true)\n\t\tconst response = await cancelProjectSubscription(projectId, isBillingV3)\n\t\tif (response.status !== CancelProjectSubscriptionStatus.Success) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Error cancelling\",\n\t\t\t\tsecondaryText: \"your plan.\",\n\t\t\t})\n\t\t\treturn setIsSubmitting(false)\n\t\t}\n\n\t\tconst planName = getProjectLicenseName(currentProjectLicenseType)\n\t\tconst expirationDate = format(nextBillDate, \"MMMM do, yyyy\")\n\n\t\t// Feedback has low priority, we wont await nor block the cancellation if it fails\n\t\tsubmitFeedback(feedback, projectId, planName, expirationDate).catch(() => {})\n\n\t\tconst pollResult = await remoteDispatch.pollProject({\n\t\t\tintervalMillis: 3000,\n\t\t\tattempts: 10,\n\t\t\tstopCondition: project => isPlanCancelled(project.license),\n\t\t})\n\t\tswitch (pollResult.status) {\n\t\t\tcase PollStatus.TimeoutError:\n\t\t\tcase PollStatus.UnhandledError:\n\t\t\t\tlog.error(\"Failed to poll project when cancelling subscription\", pollResult)\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: \"Couldn\u2019t refresh project\",\n\t\t\t\t\tsecondaryText: \"after cancellation.\",\n\t\t\t\t})\n\t\t\t\treturn engine.stores.modalStore.dismissModal(ModalType.PlanCancellation)\n\t\t\tcase PollStatus.Success:\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(pollResult)\n\t\t}\n\n\t\tawait refreshSubscriptions()\n\n\t\tconst project = engine.stores.projectStore.project\n\t\tassert(project, \"Project should exist\")\n\t\tconst isImmediatellyCancelled =\n\t\t\tisPlanCancelledAndExpired(project.license) || project.license.type === ProjectLicenseType.FreeSite\n\t\tconst user = engine.stores.sessionStore.user\n\n\t\ttrackGTMEvent(\"cancel\", {\n\t\t\toldTier: currentProjectLicenseType,\n\t\t\tnewTier: ProjectLicenseType.FreeSite,\n\t\t\temail: user.email,\n\t\t\tname: user.name,\n\t\t\tlicenseId: project.license.id,\n\t\t\tuserId: user.id,\n\t\t\tvalue: 0 - parseFloat(price),\n\t\t\tcurrency,\n\t\t})\n\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"success\",\n\t\t\ttext: isImmediatellyCancelled\n\t\t\t\t? `Your ${planName} plan has been cancelled`\n\t\t\t\t: `Your ${planName} plan will expire on ${expirationDate}`,\n\t\t})\n\t\tengine.stores.modalStore.dismissModal(ModalType.PlanCancellation)\n\t}, [\n\t\tremoteDispatch,\n\t\tfeedback,\n\t\tprojectId,\n\t\tcurrentProjectLicenseType,\n\t\tnextBillDate,\n\t\trefreshSubscriptions,\n\t\tprice,\n\t\tcurrency,\n\t\tisBillingV3,\n\t])\n\n\tif (currentStep === ModalSteps.Confirmation) {\n\t\treturn (\n\t\t\t<ConfirmationModal\n\t\t\t\tappearance=\"large\"\n\t\t\t\ttitle=\"Cancel Plan\"\n\t\t\t\tvariant=\"destructive\"\n\t\t\t\tdescription={<ConfirmationView />}\n\t\t\t\tconfirmLabel=\"Cancel Plan\"\n\t\t\t\tonConfirm={onConfirm}\n\t\t\t\tconfirmButtonLoading={isSubmitting}\n\t\t\t\tcancelLabel={Dictionary.Previous}\n\t\t\t\tonCancel={gotoPrevious}\n\t\t\t\tcancelButtonEnabled={!isSubmitting}\n\t\t\t\tconfirmButtonEnabled={isFeedbackValid}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t\tlegacy={!isAgentExperimentOn}\n\t\t\t/>\n\t\t)\n\t}\n\n\t// Feedback\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tappearance=\"large\"\n\t\t\ttitle=\"Cancel Plan\"\n\t\t\tvariant=\"primary\"\n\t\t\tdescription={<FeedbackView feedback={feedback} onFeedback={setFeedback} />}\n\t\t\tconfirmLabel={Dictionary.Next}\n\t\t\tonConfirm={gotoNext}\n\t\t\tconfirmButtonLoading={isSubmitting}\n\t\t\tcancelLabel=\"Dismiss\"\n\t\t\tonCancel={onDismiss}\n\t\t\tcancelButtonEnabled={!isSubmitting}\n\t\t\tconfirmButtonEnabled={isFeedbackValid}\n\t\t\tonDismiss={onDismiss}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\nconst minHeight = \"287px\" // prevent modal changing size between feedback and confirmation steps\n\ninterface Feedback {\n\treason?: string\n\ttext?: string\n}\n\nconst reasonSpecify = \"Other (Please specify)\"\n\nconst feedbackOptions = [\n\t\"No longer need a website\",\n\t\"Lack of functionality\",\n\t\"Too expensive\",\n\t\"Found another tool\",\n\t\"Purchased accidentally\",\n\treasonSpecify,\n]\n\nfunction FeedbackView({ feedback, onFeedback }: { feedback: Feedback; onFeedback: (props: Feedback) => void }) {\n\tconst setPartialFeedback = (newProps: Partial<Feedback>) => {\n\t\tonFeedback({ ...feedback, ...newProps })\n\t}\n\n\tconst specifyOther = () => {\n\t\tsetPartialFeedback({ reason: reasonSpecify })\n\t}\n\n\treturn (\n\t\t<Stack gap={15} style={{ minHeight }}>\n\t\t\t<T>\n\t\t\t\tThank you for choosing Framer. We\u2019re sorry to see you go. Before you cancel, please select a reason from the\n\t\t\t\toptions.\n\t\t\t</T>\n\t\t\t<Stack gap={5}>\n\t\t\t\t<RadioButtonGroup>\n\t\t\t\t\t{feedbackOptions.map(reason => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\tkey={reason}\n\t\t\t\t\t\t\t\tidentifier={reason}\n\t\t\t\t\t\t\t\ttitle={reason}\n\t\t\t\t\t\t\t\tselected={reason === feedback.reason}\n\t\t\t\t\t\t\t\tonSelect={() => setPartialFeedback({ reason })}\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</RadioButtonGroup>\n\t\t\t\t<TextInput\n\t\t\t\t\tvalue={feedback.text ?? \"\"}\n\t\t\t\t\tplaceholder=\"Reason for cancellation\u2026\"\n\t\t\t\t\tonChange={text => setPartialFeedback({ text })}\n\t\t\t\t\tonFocus={specifyOther}\n\t\t\t\t\tconstantChange\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nconst features = [\n\t`Your custom domain will be disconnected`,\n\t`A Framer banner will be shown on your site`,\n\t`All CMS limits will be reapplied`,\n\t`You\u2019ll lose access to paid features`,\n\t`All locale limits will be reapplied`,\n]\n\nfunction ConfirmationView() {\n\treturn (\n\t\t<Stack gap={15} style={{ minHeight }}>\n\t\t\t<span>\n\t\t\t\t<T>Please don\u2019t hesitate to</T>{\" \"}\n\t\t\t\t<Link href={contactSupportURL} className={styles.link}>\n\t\t\t\t\t<T>contact us</T>\n\t\t\t\t</Link>{\" \"}\n\t\t\t\t<T>if we can do anything to keep Framer in your workflow. Please keep in mind that if you cancel:</T>\n\t\t\t</span>\n\t\t\t<PlanModalsFeatureList icon=\"no-entry\" features={features} />\n\t\t</Stack>\n\t)\n}\n\nconst formsparkFormId = hostInfo.isProduction ? \"tPvNTLft\" : \"CR7CNj6j\"\n\nasync function submitFeedback(feedback: Feedback, projectId: string, planName: string, expirationDate: string) {\n\tconst { publishStore, sessionStore } = engine.stores\n\tconst { customHostname, defaultHostname } = publishStore\n\tconst hostname = customHostname?.hostname ?? defaultHostname?.hostname\n\tconst siteUrl = hostname ? `https://${hostname}` : undefined\n\tconst email = sessionStore.user.email\n\tconst [_, profileDomain] = email.split(\"@\")\n\n\tawait fetch(`https://submit-form.com/${formsparkFormId}`, {\n\t\tmethod: \"POST\",\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAccept: \"application/json\",\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\tprofileDomain,\n\t\t\tprojectId,\n\t\t\tsiteUrl,\n\t\t\tplanName,\n\t\t\texpirationDate,\n\t\t\t...feedback,\n\t\t}),\n\t})\n}\n", "import type { TeamLicenseType } from \"@framerjs/app-shared\"\nimport { ProjectLicensePeriod, ProjectLicenseType } from \"@framerjs/app-shared\"\nimport type {\n\tLicenseSettings,\n\tPlanPrices,\n} from \"document/components/chrome/siteSettings/Plans/Stripe/api/licenseSettings.ts\"\nimport engine from \"document/engine.ts\"\nimport { getEngine } from \"document/getEngine.ts\"\nimport { useEffect } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, record } from \"./tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"./usePurchaseOriginLocalStorage.ts\"\n\nexport function trackGTMEvent(\n\tevent: string,\n\tdata:\n\t\t| {\n\t\t\t\toldTier: ProjectLicenseType\n\t\t\t\tnewTier: ProjectLicenseType\n\t\t\t\tvalue: number\n\t\t\t\tcurrency: string\n\t\t\t\temail: string\n\t\t\t\tname: string\n\t\t\t\tlicenseId: string\n\t\t\t\tuserId: string\n\t\t\t\toldBillingCycle: ProjectLicensePeriod | \"\"\n\t\t\t\tnewBillingCycle: ProjectLicensePeriod | \"\"\n\t\t  }\n\t\t| {\n\t\t\t\toldTier: ProjectLicenseType\n\t\t\t\tnewTier: ProjectLicenseType.FreeSite\n\t\t\t\temail: string\n\t\t\t\tname: string\n\t\t\t\tlicenseId: string\n\t\t\t\tuserId: string\n\t\t\t\tvalue: number\n\t\t\t\tcurrency: string\n\t\t  },\n) {\n\t;(window as any).dataLayer?.push({\n\t\tevent,\n\t\t...data,\n\t})\n}\n\nexport const useTrackPurchaseSuccess = (params: {\n\tpaidEditors: number\n\tpreviousSitePlanType: ProjectLicenseType\n\tsitePlan: ProjectLicenseType\n\tteamPlan: TeamLicenseType\n\tbillingPeriod?: ProjectLicensePeriod\n\tlicensesSettings: LicenseSettings[]\n\tpreviousProjectPeriod?: ProjectLicensePeriod\n}) => {\n\tconst { data, origin, eraseAllPurchaseOriginData } = usePurchaseOriginLocalStorage()\n\tconst { projectStore, sessionStore } = engine.stores\n\tconst project = projectStore.useState(state => state.project)\n\tconst user = sessionStore.user\n\tuseRecordEffect(\"ui_impression\", { page: Pages.siteSettingsPlansSuccess })\n\n\tconst licenseTypes = data ? data.licenseTypes : null\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: Does this really not need exhaustive deps?\n\tuseEffect(() => {\n\t\tif (getEngine()?.isRemountingUI()) return\n\t\tconst sendPurchaseSuccessGTMEvent = () => {\n\t\t\tconst { oldSitePlanPrice, newSitePlanPrice } = getPlanPrices({\n\t\t\t\tlicensesSettings: params.licensesSettings,\n\t\t\t\tpreviousSitePlanType: params.previousSitePlanType,\n\t\t\t\tpreviousProjectPeriod: params.previousProjectPeriod,\n\t\t\t\tsitePlan: params.sitePlan,\n\t\t\t\tselectedPlanPeriod: params.billingPeriod,\n\t\t\t})\n\n\t\t\tconst oldSitePlanPriceAmount = parseFloat(oldSitePlanPrice?.amount ?? \"0\")\n\t\t\tconst newSitePlanPriceAmount = parseFloat(newSitePlanPrice?.amount ?? \"0\")\n\t\t\tconst priceDifferenceFromOldToNewAmount = newSitePlanPriceAmount - oldSitePlanPriceAmount\n\t\t\tconst isPriceUpgrade = priceDifferenceFromOldToNewAmount > 0\n\n\t\t\tif (project?.license && isPriceUpgrade) {\n\t\t\t\ttrackGTMEvent(\"upgrade\", {\n\t\t\t\t\toldTier: params.previousSitePlanType,\n\t\t\t\t\tnewTier: params.sitePlan,\n\t\t\t\t\tvalue: priceDifferenceFromOldToNewAmount,\n\t\t\t\t\tcurrency: newSitePlanPrice?.currency ?? oldSitePlanPrice?.currency ?? \"\",\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tname: user.name,\n\t\t\t\t\tlicenseId: project?.license?.id,\n\t\t\t\t\tuserId: user.id,\n\t\t\t\t\toldBillingCycle: params.previousProjectPeriod ?? \"\",\n\t\t\t\t\tnewBillingCycle: params.billingPeriod ?? \"\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Hack to prevent double tracking of the event\n\t\tlet ignore = false\n\t\tif (ignore) {\n\t\t\treturn\n\t\t}\n\n\t\t// We can't calculate prices without licensesSettings\n\t\tif (params.licensesSettings) {\n\t\t\tsendPurchaseSuccessGTMEvent()\n\t\t}\n\n\t\tif (!licenseTypes) {\n\t\t\trecord(\"plan_purchase_success_page_shown\", {\n\t\t\t\torigin,\n\t\t\t\tbillingPeriod: params.billingPeriod,\n\t\t\t\ttoSitePlan: params.sitePlan,\n\t\t\t\ttoTeamPlan: params.teamPlan,\n\t\t\t\tpaidEditors: params.paidEditors,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\trecord(\"plan_purchase_success_page_shown\", {\n\t\t\torigin,\n\t\t\tbillingPeriod: params.billingPeriod,\n\t\t\ttoSitePlan: params.sitePlan,\n\t\t\ttoTeamPlan: params.teamPlan,\n\t\t\t//\n\t\t\tfromSitePlan: licenseTypes.site,\n\t\t\tfromTeamPlan: licenseTypes.team ?? undefined,\n\t\t\tpaidEditors: params.paidEditors,\n\t\t})\n\t\t// Send the event exactly once\n\t\teraseAllPurchaseOriginData()\n\t\treturn () => {\n\t\t\tignore = true\n\t\t}\n\t}, [])\n}\n\nfunction getPlanPrices({\n\tlicensesSettings,\n\tpreviousSitePlanType,\n\tpreviousProjectPeriod,\n\tsitePlan,\n\tselectedPlanPeriod,\n}: {\n\tlicensesSettings: LicenseSettings[]\n\tpreviousSitePlanType: ProjectLicenseType\n\tpreviousProjectPeriod?: ProjectLicensePeriod\n\tsitePlan: ProjectLicenseType\n\tselectedPlanPeriod?: \"month\" | \"year\"\n}) {\n\tlet oldSitePlanPrice: PlanPrices[\"month\"] | PlanPrices[\"year\"] | undefined\n\tlet newSitePlanPrice: PlanPrices[\"month\"] | PlanPrices[\"year\"] | undefined\n\n\tconst isValidPlanType = (planType: ProjectLicenseType) =>\n\t\tplanType !== ProjectLicenseType.FreeSite && planType !== ProjectLicenseType.EnterpriseSite\n\n\tlicensesSettings.forEach(license => {\n\t\tif (isValidPlanType(previousSitePlanType) && license.licenseType === previousSitePlanType && \"prices\" in license) {\n\t\t\toldSitePlanPrice =\n\t\t\t\tpreviousProjectPeriod === ProjectLicensePeriod.Month ? license.prices.month : license.prices.year\n\t\t}\n\n\t\tif (isValidPlanType(sitePlan) && license.licenseType === sitePlan && \"prices\" in license) {\n\t\t\tnewSitePlanPrice = selectedPlanPeriod === ProjectLicensePeriod.Month ? license.prices.month : license.prices.year\n\t\t}\n\t})\n\n\treturn { oldSitePlanPrice, newSitePlanPrice }\n}\n", "import type { ProjectLicense } from \"@framerjs/app-shared\"\n\n// subscriptionIsActive is true:\n//   - Paid plan that subscription will renew\n// subscriptionIsActive is false:\n//   - Free Plan\n//   - Paid plan that is cancelled, but not expired (expirationDate > now)\n//   - Paid plan that is cancelled and expired (expirationDate > now)\n\nexport function isPlanCancelledAndOngoing(license: ProjectLicense): boolean {\n\treturn (\n\t\t!license.subscriptionIsActive &&\n\t\tlicense.expirationDate !== null &&\n\t\tDate.now() < new Date(license.expirationDate).getTime()\n\t)\n}\n\nexport function isPlanCancelledAndExpired(license: ProjectLicense): boolean {\n\treturn (\n\t\t!license.subscriptionIsActive &&\n\t\tlicense.expirationDate !== null &&\n\t\tDate.now() >= new Date(license.expirationDate).getTime()\n\t)\n}\n\nexport function isPlanCancelled(license: ProjectLicense): boolean {\n\treturn isPlanCancelledAndOngoing(license) || isPlanCancelledAndExpired(license)\n}\n", "import { ApiError, HTTP_ERROR_CODES } from \"@framerjs/app-shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"cancelProjectSubscription\")\n\nexport enum CancelProjectSubscriptionStatus {\n\tSuccess,\n\tUnauthorizedError,\n\tUnhandledError,\n}\n\ninterface CancelProjectSubscriptionResponse {\n\tstatus: CancelProjectSubscriptionStatus\n}\n\nexport async function cancelProjectSubscription(\n\tprojectId: string,\n\tisBillingV3: boolean,\n): Promise<CancelProjectSubscriptionResponse> {\n\ttry {\n\t\tconst url = isBillingV3\n\t\t\t? `/web/v4/projects/${projectId}/subscription`\n\t\t\t: `/web/v3/projects/${projectId}/subscription`\n\t\tawait apiFetcher.delete(url)\n\t\treturn { status: CancelProjectSubscriptionStatus.Success }\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: CancelProjectSubscriptionStatus.UnauthorizedError }\n\t\t}\n\t\tlog.reportError(error)\n\t\treturn { status: CancelProjectSubscriptionStatus.UnhandledError }\n\t}\n}\n", "import \"PlanModals.styles_1rtchnc.wyw.css\"; export const textHighlight = \"textHighlight_trsfuxq\";\nexport const link = \"link_l1kohnea\";\nexport const checkmark = \"checkmark_c1wnmunn\";", "import { IconCheckmark, IconNoEntry, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport type React from \"react\"\nimport * as styles from \"./PlanModals.styles.ts\"\n\nexport const PlanModalsFeatureList = ({\n\tfeatures,\n\ticon,\n}: {\n\tfeatures: React.ReactNode[]\n\ticon?: \"checkmark\" | \"no-entry\"\n}) => {\n\treturn (\n\t\t<Stack gap={10}>\n\t\t\t{features.map((feature, i) => (\n\t\t\t\t<Stack key={i} gap={10} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t{icon === \"no-entry\" ? <IconNoEntry /> : <IconCheckmark animate={false} className={styles.checkmark} />}\n\t\t\t\t\t<span>{typeof feature === \"string\" ? <T>{feature}</T> : feature}</span>\n\t\t\t\t</Stack>\n\t\t\t))}\n\t\t</Stack>\n\t)\n}\n", "import { ConfirmationModal, Link, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ModalProps } from \"document/stores/ModalStore.ts\"\nimport type { ModalType } from \"document/utils/ModalType.ts\"\n\nexport function OverrideFileModal({ onConfirm }: ModalProps<ModalType.OverrideFile>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"destructive\"\n\t\t\ttitle=\"Existing File\"\n\t\t\tdescription={<T>A file with this name already exists in your project. Do you want to replace it?</T>}\n\t\t\tconfirmLabel=\"Replace\"\n\t\t\tonConfirm={onConfirm}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\thasBackdrop\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\nexport function UnsupportedFileSizeModal({ maxSizeInKB, onRetry }: ModalProps<ModalType.UnsupportedFileSize>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"primary\"\n\t\t\ttitle=\"File Too Large\"\n\t\t\tdescription={<T>Maximum file size is {`${maxSizeInKB}`}&nbsp;kB. Upload a smaller file to continue.</T>}\n\t\t\tconfirmLabel={Dictionary.Upload}\n\t\t\tonConfirm={onRetry}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\thasBackdrop\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\nexport function UnsupportedFileTypeModal({ extension, helpUrl, onRetry }: ModalProps<ModalType.UnsupportedFileType>) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn (\n\t\t<ConfirmationModal\n\t\t\tvariant=\"primary\"\n\t\t\ttitle=\"Unsupported File Format\"\n\t\t\tdescription={\n\t\t\t\t<>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tThe &lsquo;{extension}&rsquo; file format is not supported for Well Known Files. Learn more about which file\n\t\t\t\t\t\tformats are supported\n\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t<Link href={helpUrl} style={{ display: \"inline\" }}>\n\t\t\t\t\t\t<T>here</T>\n\t\t\t\t\t</Link>\n\t\t\t\t\t.\n\t\t\t\t</>\n\t\t\t}\n\t\t\tconfirmLabel={\"Try Another\"}\n\t\t\tonConfirm={onRetry}\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={engine.stores.modalStore.dismiss}\n\t\t\tonDismiss={engine.stores.modalStore.dismiss}\n\t\t\thasBackdrop\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { ThemeOverride } from \"@framerjs/fresco\"\nimport { ZIndex, dimensions } from \"@framerjs/fresco/tokens\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ActiveOverlay } from \"document/utils/ActiveEditorType.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { useEffect, useLayoutEffect, useRef } from \"react\"\nimport { usePreviousValue } from \"utils/usePreviousValue.ts\"\nimport { useShouldShowCmsAgentChatPanelForOverlay } from \"./contentManagement/CmsAgentChatPanel.tsx\"\nimport { getCollectionItemOverlayReservedWidth } from \"./shared/EditorOverlay.styles.ts\"\nimport { popoutWindow } from \"./shared/PopoutWindow.tsx\"\n\n/** Handles the engine part of the popout window. */\nexport function PopoutWindowManager() {\n\tconst isInFront = engine.stores.chromeStore.floatingWindowInFront === \"popout\"\n\tconst zIndex = isInFront ? ZIndex.floatingWindowFront : ZIndex.floatingWindow\n\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst { mainView, overlay, contentManagementOverlayStack } = engine.stores.chromeStore.useState()\n\tconst canvasIsVisible = mainView === ActiveMainView.Canvas\n\tconst analyticsIsVisible = mainView === ActiveMainView.Analytics\n\tconst contentManagementIsVisible = mainView === ActiveMainView.ContentManagement\n\tconst activeContentManagementOverlay = contentManagementOverlayStack.at(-1)\n\tconst reserveCmsAgentPanelWidth = useShouldShowCmsAgentChatPanelForOverlay(activeContentManagementOverlay)\n\n\tconst previousMainView = usePreviousValue(mainView)\n\tconst contentManagementOverlayStackLength = contentManagementOverlayStack.length\n\tconst previousContentManagementOverlayStackLengthRef = useRef(contentManagementOverlayStackLength)\n\n\tuseLayoutEffect(() => {\n\t\tif (previousMainView === mainView) return\n\t\tif (!popoutWindow.isOpen()) return\n\t\tpopoutWindow.close()\n\t}, [mainView, previousMainView])\n\n\tuseLayoutEffect(() => {\n\t\tconst previousContentManagementOverlayStackLength = previousContentManagementOverlayStackLengthRef.current\n\t\tpreviousContentManagementOverlayStackLengthRef.current = contentManagementOverlayStackLength\n\n\t\tif (mainView !== ActiveMainView.ContentManagement) return\n\t\tif (previousContentManagementOverlayStackLength !== 0) return\n\t\tif (contentManagementOverlayStackLength === 0) return\n\t\tif (!popoutWindow.isOpen()) return\n\n\t\tpopoutWindow.close()\n\t}, [contentManagementOverlayStackLength, mainView])\n\n\tuseEffect(() => {\n\t\tlet popoutWasOpen = popoutWindow.isOpen()\n\n\t\tconst handlePopoutChange = () => {\n\t\t\tconst isOpen = popoutWindow.isOpen()\n\t\t\tif (popoutWasOpen === isOpen) return\n\n\t\t\tpopoutWasOpen = isOpen\n\t\t\tif (isOpen) {\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tengine.stores.chromeStore.floatingWindowInFront = \"popout\"\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tengine.floatingWindowPopoutNavigation = popoutWindow.navigation\n\t\tpopoutWindow.navigation.addListener(handlePopoutChange)\n\n\t\treturn () => {\n\t\t\tengine.floatingWindowPopoutNavigation = undefined\n\t\t\tpopoutWindow.navigation.removeListener(handlePopoutChange)\n\t\t}\n\t}, [])\n\n\tconst handlePointerDownCapture = useEngineCallback(() => {\n\t\tengine.stores.chromeStore.floatingWindowInFront = \"popout\"\n\t}, [])\n\n\treturn (\n\t\t<ThemeOverride mode={contentManagementIsVisible && !agentExperimentOn && \"darkOnDarkPopoutWindow\"}>\n\t\t\t<popoutWindow.Component\n\t\t\t\tvisible={canvasIsVisible || analyticsIsVisible || contentManagementIsVisible}\n\t\t\t\tzIndex={analyticsIsVisible ? ZIndex.floatingWindowOnTopOfAnalytics : zIndex}\n\t\t\t\trightInsetOverride={getPopoutWindowRightInsetOverride(\n\t\t\t\t\tmainView,\n\t\t\t\t\toverlay,\n\t\t\t\t\tcontentManagementOverlayStackLength,\n\t\t\t\t\treserveCmsAgentPanelWidth,\n\t\t\t\t)}\n\t\t\t\trequiredContentWidth={getPopoutWindowRequiredContentWidth(mainView, overlay)}\n\t\t\t\tonPointerDownCapture={handlePointerDownCapture}\n\t\t\t/>\n\t\t</ThemeOverride>\n\t)\n}\n\nfunction getPopoutWindowRightInsetOverride(\n\tmainView: ActiveMainView,\n\toverlay: ActiveOverlay | null,\n\tstackSize: number,\n\treserveCmsAgentPanelWidth: boolean,\n): string | undefined {\n\tif (mainView !== ActiveMainView.ContentManagement) return undefined\n\tif (overlay?.type !== \"collectionItem\") return undefined\n\treturn getCollectionItemOverlayReservedWidth(stackSize, reserveCmsAgentPanelWidth)\n}\n\nfunction getPopoutWindowRequiredContentWidth(\n\tmainView: ActiveMainView,\n\toverlay: ActiveOverlay | null,\n): string | undefined {\n\tif (mainView !== ActiveMainView.ContentManagement) return undefined\n\tif (overlay?.type !== \"collectionItem\") return undefined\n\treturn dimensions.css.popoverWidth\n}\n", "import { useState } from \"react\"\n\n/** Returns the previous value once it has changed, otherwise returns the initial value. */\nexport function usePreviousValue<T>(value: T): T {\n\tconst [current, setCurrent] = useState(value)\n\tconst [previous, setPrevious] = useState(value)\n\n\tif (value !== current) {\n\t\tsetCurrent(value)\n\t\tsetPrevious(current)\n\t\treturn current\n\t}\n\n\treturn previous\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { type CmsMetadataColumn, isCmsMetadataColumn } from \"app/agent/editor/agentInputSchema.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { OverlayStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { useEffect, useMemo } from \"react\"\nimport { useDebounce } from \"web/lib/useDebounce.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { AgentChatPanel, type AgentSelectionMode } from \"../agentPanel/AgentChatPanel.tsx\"\nimport { ResizeZone } from \"../shared/ResizeZone.tsx\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { useShouldShowCmsAgentChatPanel } from \"./useShouldShowCmsAgentChatPanel.ts\"\n\nconst setPanelWidth = engine.scheduler.wrapHandler((width: number) => {\n\tengine.stores.layoutState.setPropertyPanelWidth(width)\n})\n\nconst getPanelWidth = () => engine.stores.layoutState.getCurrentPropertyPanelWidth()\n\nexport function overlaySupportsCmsAgentChatPanel(activeOverlay: OverlayStackElement | null | undefined): boolean {\n\tif (!activeOverlay) return false\n\n\tswitch (activeOverlay.type) {\n\t\tcase \"existing\":\n\t\tcase \"privateDraft\":\n\t\t\treturn true\n\t\tcase \"temporary\":\n\t\t\treturn false\n\t\tcase \"arrayItem\":\n\t\t\t// CMS array items are still experimental, so keep their agent context support explicit and deferred.\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(activeOverlay)\n\t}\n}\n\nexport function useShouldShowCmsAgentChatPanelForOverlay(\n\tactiveOverlay: OverlayStackElement | null | undefined,\n): boolean {\n\treturn useShouldShowCmsAgentChatPanel() && overlaySupportsCmsAgentChatPanel(activeOverlay)\n}\n\nexport interface CmsAgentChatSelectionSnapshot {\n\tcollectionId: NodeID\n\tcollectionName: string\n\tcollectionItemIds: readonly NodeID[]\n\tvariableColumnIds: readonly VariableID[]\n\tmetadataColumnIds: readonly CmsMetadataColumn[]\n}\n\nexport function buildCmsAgentChatSelectionSnapshot(\n\tcollectionId: NodeID,\n\tcollectionName: string,\n\tselectedCells: readonly CellIdentifier[],\n): CmsAgentChatSelectionSnapshot {\n\tconst collectionItemIds = new Set<string>()\n\tconst variableColumnIds = new Set<VariableID>()\n\tconst metadataColumnIds = new Set<CmsMetadataColumn>()\n\n\tfor (const cell of selectedCells) {\n\t\tcollectionItemIds.add(cell.rowId)\n\t\tif (isCmsMetadataColumn(cell.columnId)) {\n\t\t\tmetadataColumnIds.add(cell.columnId)\n\t\t} else {\n\t\t\tvariableColumnIds.add(cell.columnId)\n\t\t}\n\t}\n\n\treturn {\n\t\tcollectionId,\n\t\tcollectionName,\n\t\tcollectionItemIds: [...collectionItemIds],\n\t\tvariableColumnIds: [...variableColumnIds],\n\t\tmetadataColumnIds: [...metadataColumnIds],\n\t}\n}\n\nfunction useCmsAgentChatTableSelection({\n\tcollectionId,\n\tcollectionName,\n\tselectedCells,\n}: {\n\tcollectionId?: NodeID\n\tcollectionName?: string\n\tselectedCells?: readonly CellIdentifier[]\n}): AgentSelectionMode | undefined {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst shouldShowCmsAgentChatPanel = useShouldShowCmsAgentChatPanel()\n\tconst agentSelectionModeEnabled = engine.stores.contentManagementStore.useState(\n\t\tstate => state.isAgentSelectionModeActive,\n\t)\n\n\tconst canUseAgentSelectionMode = !!collectionId && !isViewOnly && shouldShowCmsAgentChatPanel\n\tconst setAgentSelectionModeEnabled = useEngineCallback(\n\t\t(enabled: boolean) => {\n\t\t\tif (!enabled) {\n\t\t\t\tengine.stores.contentManagementStore.exitAgentSelectionMode()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!canUseAgentSelectionMode) return\n\n\t\t\tengine.stores.contentManagementStore.enterAgentSelectionMode()\n\t\t},\n\t\t[canUseAgentSelectionMode],\n\t)\n\n\tuseEffect(() => {\n\t\tif (!canUseAgentSelectionMode && agentSelectionModeEnabled) {\n\t\t\tsetAgentSelectionModeEnabled(false)\n\t\t}\n\t}, [canUseAgentSelectionMode, agentSelectionModeEnabled, setAgentSelectionModeEnabled])\n\n\tconst selectionSnapshot = useMemo(() => {\n\t\tif (!agentSelectionModeEnabled) return null\n\t\tif (!collectionId || !collectionName || !selectedCells) return null\n\t\treturn buildCmsAgentChatSelectionSnapshot(collectionId, collectionName, selectedCells)\n\t}, [collectionId, collectionName, selectedCells, agentSelectionModeEnabled])\n\n\tconst debouncedSelectionSnapshot = useDebounce(selectionSnapshot, 60)\n\n\tuseEffect(() => {\n\t\tif (!canUseAgentSelectionMode || !agentSelectionModeEnabled || !debouncedSelectionSnapshot) return\n\t\tif (debouncedSelectionSnapshot.collectionItemIds.length === 0) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.agentStore.enqueueSelection({\n\t\t\t\ttype: \"cmsSelection\",\n\t\t\t\t...debouncedSelectionSnapshot,\n\t\t\t\tfocusInput: false,\n\t\t\t})\n\t\t})\n\t}, [canUseAgentSelectionMode, debouncedSelectionSnapshot, agentSelectionModeEnabled])\n\n\treturn useMemo<AgentSelectionMode | undefined>(() => {\n\t\tif (!collectionId) return undefined\n\t\treturn { enabled: agentSelectionModeEnabled, setEnabled: setAgentSelectionModeEnabled }\n\t}, [agentSelectionModeEnabled, collectionId, setAgentSelectionModeEnabled])\n}\n\ninterface CmsAgentChatPanelProps {\n\tcollectionId?: NodeID\n\tcollectionName?: string\n\tselectedCells?: readonly CellIdentifier[]\n}\n\nexport function CmsAgentChatPanel({ collectionId, collectionName, selectedCells }: CmsAgentChatPanelProps = {}) {\n\tconst selectionMode = useCmsAgentChatTableSelection({\n\t\tcollectionId,\n\t\tcollectionName,\n\t\tselectedCells,\n\t})\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.contentManagementStore.exitAgentSelectionMode()\n\t\t\t})\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<div className={styles.agentChatPanelContainer}>\n\t\t\t<div className={styles.agentChatPanelTitle}>{Dictionary.Agent}</div>\n\t\t\t<AgentChatPanel selectionMode={selectionMode} />\n\t\t\t<ResizeZone\n\t\t\t\tside=\"left\"\n\t\t\t\tminSize={engine.stores.layoutState.minWidth}\n\t\t\t\tmaxSize={engine.stores.layoutState.maxWidth}\n\t\t\t\tdefaultSize={engine.stores.layoutState.defaultTabContentWidth}\n\t\t\t\tgetSize={getPanelWidth}\n\t\t\t\tsetSize={setPanelWidth}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n", "import \"VirtualCollectionItemTable.styles_l4ezt3.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const cellBorderWidth = 1;\nexport const galleryBodyCellLeftPadding = dimensions.values.panelPadding;\nexport const container = \"container_c1mbi600\";\nexport const tableWithSidePanel = \"tableWithSidePanel_t13y28rq\";\nexport const tableColumn = \"tableColumn_t1fec87h\";\nexport const agentChatPanelContainer = \"agentChatPanelContainer_a1myarns\";\nexport const agentChatPanelTitle = \"agentChatPanelTitle_azcuw3d\";\nexport const tableContainer = \"tableContainer_t3megqf\";\nexport const tableInteractionCursorLayer = \"tableInteractionCursorLayer_t9y90rs\";\nexport const table = \"table_t16oh7i5\";\nexport const bodyCell = \"bodyCell_b1hu8fdh\";\nexport const bodyCellFirstColumn = \"bodyCellFirstColumn_bmommdk\";\nexport const bodyCellDate = \"bodyCellDate_bwrusdv\";\nexport const bodyCellGallery = \"bodyCellGallery_bpfwkdn\";\nexport const bodyCellHideRightDivider = \"bodyCellHideRightDivider_b1skaxsq\";\nexport const bodyCellSelectedInnerRightEdge = \"bodyCellSelectedInnerRightEdge_bo8pgcq\";\nexport const bodyCellSelectedInnerBottomEdge = \"bodyCellSelectedInnerBottomEdge_b1utd0ff\";\nexport const bodyCellFiller = \"bodyCellFiller_b8teygn\";\nexport const bodyCellContentPreview = \"bodyCellContentPreview_b1mw6f90\";\nexport const readOnlyContent = \"readOnlyContent_rfwjn3g\";\nexport const bodyCellSelectedEditable = \"bodyCellSelectedEditable_b1igmaou\";\nexport const bodyCellSelectedRange = \"bodyCellSelectedRange_b31hd6v\";\nexport const bodyCellSelectedIcon = \"bodyCellSelectedIcon_b11ncsit\";\nexport const bodyCellRowHighlighted = \"bodyCellRowHighlighted_b1o1faj2\";\nexport const bodyCellEditing = \"bodyCellEditing_b1lqnro6\";\nexport const bodyCellEditingPopout = \"bodyCellEditingPopout_b1k8j6o6\";\nexport const bodyCellComboBox = \"bodyCellComboBox_b6xje63\";\nexport const bodyCellBooleanToggle = \"bodyCellBooleanToggle_b1ethqhv\";\nexport const bodyCellBooleanToggleVisual = \"bodyCellBooleanToggleVisual_bgtt54t\";\nexport const bodyCellBooleanToggleHitbox = \"bodyCellBooleanToggleHitbox_br5pv0x\";\nexport const bodyCellPreviewHitbox = \"bodyCellPreviewHitbox_b1cxke03\";\nexport const bodyCellTextPreviewHitbox = \"bodyCellTextPreviewHitbox_bvzoixj\";\nexport const bodyCellPopoverTrigger = \"bodyCellPopoverTrigger_bkshdsq\";\nexport const bodyCellComboBoxSingleValueTrigger = \"bodyCellComboBoxSingleValueTrigger_bz7bgtj\";\nexport const bodyCellRowReorderDragged = \"bodyCellRowReorderDragged_bhv8pz5\";\nexport const bodyCellEditor = \"bodyCellEditor_b1izq4jc\";\nexport const bodyCellDateEditor = \"bodyCellDateEditor_b1bhlr1m\";\nexport const bodyCellDatePreview = \"bodyCellDatePreview_b16b6lpy\";\nexport const bodyCellPopoutButton = \"bodyCellPopoutButton_b1qqnxi9\";\nexport const bodyCellTextPopoutButton = \"bodyCellTextPopoutButton_bjsfg7a\";\nexport const bodyCellGalleryPopoutButton = \"bodyCellGalleryPopoutButton_by5bfyt\";\nexport const bodyCellTextAreaPreview = \"bodyCellTextAreaPreview_bgb2zzc\";\nexport const bodyCellTextAreaPopover = \"bodyCellTextAreaPopover_be33s23\";\nexport const bodyCellTextAreaEditor = \"bodyCellTextAreaEditor_br86hg0\";\nexport const bodyCellTextAreaEditorLayer = \"bodyCellTextAreaEditorLayer_b1j1wffm\";\nexport const bodyCellTextAreaMirror = \"bodyCellTextAreaMirror_bg9dy6s\";\nexport const bodyCellTextAreaInput = \"bodyCellTextAreaInput_b1b636q\";\nexport const bodyCellOverlayButton = \"bodyCellOverlayButton_b14r26on\";\nexport const bodyCellSelectionOverlayRange = \"bodyCellSelectionOverlayRange_b1r2x02a\";\nexport const bodyCellSelectionOverlayRangeHideRightSeam = \"bodyCellSelectionOverlayRangeHideRightSeam_bp4k1yp\";\nexport const bodyCellSelectionOverlayRangeHideLeftSeam = \"bodyCellSelectionOverlayRangeHideLeftSeam_b5ougej\";\nexport const bodyCellSelectedAnchorOverlay = \"bodyCellSelectedAnchorOverlay_bgl77k1\";\nexport const bodyCellStickySelectionBoundary = \"bodyCellStickySelectionBoundary_b5ucjco\";\nexport const rowReorderInsertionIndicator = \"rowReorderInsertionIndicator_rp01mca\";\nexport const rowReorderInsertionIndicatorLayer = \"rowReorderInsertionIndicatorLayer_r1focsp4\";\nexport const columnReorderInsertionIndicator = \"columnReorderInsertionIndicator_cvlsf3h\";\nexport const columnReorderPreviewLayer = \"columnReorderPreviewLayer_c18ofnto\";\nexport const columnReorderPreviewBodyLayer = \"columnReorderPreviewBodyLayer_c6wogzg\";\nexport const columnReorderPreviewCell = \"columnReorderPreviewCell_cek2hht\";\nexport const rowReorderPreviewCellContainer = \"rowReorderPreviewCellContainer_r1rknu5b\";\nexport const rowReorderPreviewRowHeaderContainer = \"rowReorderPreviewRowHeaderContainer_rzxplvn\";\nexport const columnHeaderResizeHandle = \"columnHeaderResizeHandle_c1ai35nq\";\nexport const columnHeaderCell = \"columnHeaderCell_c1863o6\";\nexport const columnHeaderCellInner = \"columnHeaderCellInner_c1aunw43\";\nexport const columnHeaderSortIcon = \"columnHeaderSortIcon_c1l9k78f\";\nexport const columnHeaderSortIconFlipped = \"columnHeaderSortIconFlipped_caxjjr1\";\nexport const columnHeaderCellActive = \"columnHeaderCellActive_c1wd557p\";\nexport const columnHeaderCellFiller = \"columnHeaderCellFiller_c1e6kh22\";\nexport const rowHeaderCell = \"rowHeaderCell_r1i6l02h\";\nexport const rowHeaderReorderIndicator = \"rowHeaderReorderIndicator_r1ijiuls\";\nexport const rowHeaderReorderIndicatorActive = \"rowHeaderReorderIndicatorActive_r1dy6ta9\";\nexport const rowHeaderCellSelected = \"rowHeaderCellSelected_r1g9xu2m\";\nexport const rowHeaderCellRowReorderDragged = \"rowHeaderCellRowReorderDragged_rk1mf81\";\nexport const rowHeaderCheckbox = \"rowHeaderCheckbox_rm9zv7h\";\nexport const cornerCell = \"cornerCell_c1hmg1of\";\nexport const cornerCheckbox = \"cornerCheckbox_c382a56\";\nexport const emptyStateContainer = \"emptyStateContainer_e14xw2vn\";", "import { noop } from \"@framerjs/shared/src/noop.ts\"\nimport type { Agent } from \"app/ai/agents/Agent.ts\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useSyncExternalStore } from \"react\"\n\n/**\n * Subscribe to the active agent and derive a value from it. Re-renders only when `getSnapshot`\n * returns a value that differs by `Object.is` from the previous one.\n */\nexport function useAgentSnapshot<T>(getSnapshot: (agent: Agent | undefined) => T): T {\n\tconst activeAgentId = engine.stores.agentStore.useState(state => state.activeChatAgentId)\n\tconst activeAgent = activeAgentId ? engine.stores.agentStore.getAgent(activeAgentId) : undefined\n\n\tconst subscribe = useCallback((cb: () => void) => activeAgent?.subscribe(cb) ?? noop, [activeAgent])\n\treturn useSyncExternalStore(subscribe, () => getSnapshot(activeAgent))\n}\n", "import { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useAgentSnapshot } from \"./useAgentSnapshot.ts\"\n\n/**\n * Whether the current user is allowed to open the agent tab.\n *\n * View-only users (lacking the `canDesign` permission) are blocked from starting a new\n * conversation, but can still see the panel if a conversation already exists in the active chat so\n * they can read prior messages and the chat doesn't disappear if permissions are temporarily lost\n * due to connectivity issues.\n *\n * See `getCanViewAgent` for the imperative version used in\n * non-React contexts. Keep the two implementations in sync.\n */\nexport function useCanViewAgent(): boolean {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst hasMessages = useAgentSnapshot(agent => (agent?.userMessageCount ?? 0) > 0)\n\treturn !isViewOnly || hasMessages\n}\n", "import { collapsedViewBreakpoint } from \"utils/chromeBreakpoints.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\n\nconst collapsedViewQuery = `(max-width: ${collapsedViewBreakpoint}px)`\n\nexport function useIsCollapsedContentManagementView() {\n\treturn useMediaQuery(collapsedViewQuery)\n}\n\nexport function getIsCollapsedContentManagementView(): boolean {\n\treturn window.matchMedia(collapsedViewQuery).matches\n}\n", "import { getCanViewAgent } from \"app/agent/canViewAgent.ts\"\nimport { useCanViewAgent } from \"app/agent/hooks/useCanViewAgent.ts\"\nimport { experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport {\n\tgetIsCollapsedContentManagementView,\n\tuseIsCollapsedContentManagementView,\n} from \"./useIsCollapsedContentManagementView.ts\"\n\nexport function useShouldShowCmsAgentChatPanel(): boolean {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst canViewAgent = useCanViewAgent()\n\tconst isCollapsedContentManagementView = useIsCollapsedContentManagementView()\n\n\treturn agentExperimentEnabled && !isCollapsedContentManagementView && canViewAgent\n}\n\nexport function getShouldShowCmsAgentChatPanel(): boolean {\n\treturn experiments.isOn(\"agent\") && !getIsCollapsedContentManagementView() && getCanViewAgent(engine)\n}\n", "import \"EditorOverlay.styles_1qr3ie2.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const maxEditorOverlayPeekDepth = 3;\nexport const viewportContainer = \"viewportContainer_vxx7uyk\";\nexport const backdrop = \"backdrop_b1rash1j\";\nexport const blockingBackdrop = \"blockingBackdrop_b17wkcc3\";\nexport const dialog = \"dialog_d1g6ok3e\";\nconst preferredOverlayMinWidth = 660;\nconst preferredOverlayMaxWidth = 880;\nconst collectionItemOverlayWidth = `clamp(min(${preferredOverlayMinWidth}px, 100vw), 50vw, ${preferredOverlayMaxWidth}px)`;\nconst rightSidePanelWidth = \"var(--framerInternalUI-propertyPanelWidth)\";\nfunction getCollectionItemOverlayWidth(reservedRightSidePanelWidth) {\n  if (!reservedRightSidePanelWidth) return collectionItemOverlayWidth;\n  return `clamp(min(${preferredOverlayMinWidth}px, calc(100vw - ${reservedRightSidePanelWidth})), min(50vw, calc(100vw - ${reservedRightSidePanelWidth})), ${preferredOverlayMaxWidth}px)`;\n}\nexport function getCollectionItemOverlayReservedWidth(stackSize, reserveRightSidePanelWidth) {\n  const visiblePeekDepth = Math.min(Math.max(stackSize - 1, 0), maxEditorOverlayPeekDepth);\n  const overlayWidth = getCollectionItemOverlayWidth(reserveRightSidePanelWidth ? rightSidePanelWidth : void 0);\n  const reservedPanelWidth = reserveRightSidePanelWidth ? ` + ${rightSidePanelWidth}` : \"\";\n  return `calc(${overlayWidth} + ${dimensions.css.editorOverlayPeekOffset} * ${visiblePeekDepth}${reservedPanelWidth})`;\n}\nexport const overlayContainer = \"overlayContainer_o1hvxawm\";\nexport const overlayContainerReservedForRightSidePanel = \"overlayContainerReservedForRightSidePanel_o2mtzdp\";\nexport const overlayContainerBacking = \"overlayContainerBacking_ol5fs2l\";\nexport const overlayInner = \"overlayInner_o1dxsoxw\";\nexport const header = \"header_h1w7aj3a\";\nexport const headerLegacy = \"headerLegacy_hz1g1ua\";\nexport const headerDividerEndFlush = \"headerDividerEndFlush_hch00i5\";\nexport const closeIconWrapper = \"closeIconWrapper_co6m06k\";\nexport const saveButton = \"saveButton_s1tsfopx\";\nexport const toolbarRight = \"toolbarRight_tmcmuhl\";", "import { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { ResizeZone } from \"../shared/ResizeZone.tsx\"\nimport { AgentChatPanel } from \"./AgentChatPanel.tsx\"\nimport * as styles from \"./CodeEditorAgentPanel.styles.ts\"\nimport { useShouldShowCodeAgentPanel } from \"./useShouldShowCodeAgentPanel.ts\"\n\nconst setPanelWidth = engine.scheduler.wrapHandler((width: number) => {\n\tengine.stores.layoutState.setPropertyPanelWidth(width)\n})\n\nconst getPanelWidth = () => engine.stores.layoutState.getCurrentPropertyPanelWidth()\n\nexport const CodeEditorAgentPanel = React.memo(function CodeEditorAgentPanel() {\n\tconst enabled = useShouldShowCodeAgentPanel()\n\n\tif (!enabled) return null\n\n\treturn (\n\t\t<div className={cx(styles.panel, appPointerEvents)}>\n\t\t\t<ResizeZone\n\t\t\t\tside=\"left\"\n\t\t\t\tminSize={engine.stores.layoutState.minWidth}\n\t\t\t\tmaxSize={engine.stores.layoutState.maxWidth}\n\t\t\t\tdefaultSize={engine.stores.layoutState.defaultTabContentWidth}\n\t\t\t\tgetSize={getPanelWidth}\n\t\t\t\tsetSize={setPanelWidth}\n\t\t\t/>\n\t\t\t<AgentChatPanel />\n\t\t</div>\n\t)\n})\n", "import \"CodeEditorAgentPanel.styles_v1vpwp.wyw.css\"; export const panel = \"panel_p1g5pw4v\";", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { useCanViewAgent } from \"app/agent/hooks/useCanViewAgent.ts\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\n\nfunction getAvailableEditorWidth(targetEngine: VekterEngine, panelPadding: number): number {\n\tconst { chromeStore, layoutState } = targetEngine.stores\n\tconst previewWidth = chromeStore.codeEditorPreviewVisible ? dimensions.values.panelMinWidth + panelPadding : 0\n\treturn (\n\t\twindow.innerWidth - layoutState.currentChromeMarginLeft - layoutState.getCurrentPropertyPanelWidth() - previewWidth\n\t)\n}\n\nfunction shouldHideCodeAgentPanel(targetEngine: VekterEngine, panelPadding: number): boolean {\n\treturn getAvailableEditorWidth(targetEngine, panelPadding) <= dimensions.values.codeEditorMinWidth\n}\n\nexport function useShouldShowCodeAgentPanel(): boolean {\n\tconst panelPadding = useDimensionValue(\"panelPadding\")\n\tconst layoutAllowsAgentPanel = useEngineState(\n\t\t() =>\n\t\t\tengine.stores.chromeStore.mainView === ActiveMainView.CodeEditor &&\n\t\t\t!shouldHideCodeAgentPanel(engine, panelPadding),\n\t\t[panelPadding],\n\t\t[engine.stores.chromeStore, EngineChange.PropertyPanelWidth, EngineChange.TabContentWidth],\n\t)\n\tconst canViewAgent = useCanViewAgent()\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn layoutAllowsAgentPanel && canViewAgent && isAgentExperimentOn\n}\n", "import { Button, IconNavigationStackBack, IconSend, Scroll, Stack, TextArea } from \"@framerjs/fresco\"\nimport { DefaultKit } from \"app/ai/kits/DefaultKit.ts\"\nimport type { Suggestion } from \"app/ai/types/AIChatHistory.ts\"\nimport type { WireframerKitListItem } from \"app/ai/utils/wireframerKit.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useProjectFeatureIsOn } from \"app/projectFeatures.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { isDesignPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { KitManifest } from \"document/models/CanvasTree/traits/WithKitManifest.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ActiveLeftPanel } from \"document/utils/ActiveEditorType.ts\"\nimport { cx } from \"library/modules/cx.ts\"\nimport { memo, startTransition, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { EscapePrecedence, useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\nimport * as sidebarStyles from \"../insertSidebar/InsertSidebar.styles.ts\"\nimport * as leftPanelStyles from \"../leftPanel/LeftPanel.styles.ts\"\nimport { LeftPanel } from \"../leftPanel/LeftPanel.tsx\"\nimport * as styles from \"./AiSidebar.styles.ts\"\nimport { AssistantMessage } from \"./components/AssistantMessage.tsx\"\nimport { WireframerIcon } from \"./components/KitIcon.tsx\"\nimport { KitPicker } from \"./components/KitPicker.tsx\"\nimport { PromptPresetButton } from \"./components/PromptPresetButton.tsx\"\nimport { UserMessage } from \"./components/UserMessage.tsx\"\nimport { getPromptPresets } from \"./constants/promptPresets.ts\"\nimport { useChat } from \"./hooks/useChat.ts\"\n\nconst MIN_ROWS = 2\nconst MAX_ROWS = 22\n\nexport const AiSidebar = memo(function InsertSidebar() {\n\tconst engine = useAndAssertVekterEngine()\n\tconst { chromeStore } = engine.stores\n\tconst { leftPanel, chromeIsVisible } = chromeStore.useState()\n\n\tconst visible = leftPanel === ActiveLeftPanel.Ai && chromeIsVisible\n\n\treturn (\n\t\t<LeftPanel hiddenWithoutUnmounting={!visible}>\n\t\t\t{/* when we clear the experiment, we should still use that component,\n            but remove the export and only use this component as the entry point */}\n\t\t\t<AiSidebarContent visible={visible} />\n\t\t</LeftPanel>\n\t)\n})\n\ninterface AiSidebarContentProps {\n\tvisible: boolean\n}\n\ninterface Kits {\n\tlist: readonly WireframerKitListItem[] | null\n\tselected: WireframerKitListItem\n}\n\nfunction createLocalKit(kitManifest: KitManifest): WireframerKitListItem {\n\treturn {\n\t\tid: kitManifest?.id,\n\t\ttitle: kitManifest?.title,\n\t\ticon: kitManifest?.icon,\n\t\tmoduleId: undefined,\n\t\tsaveId: undefined,\n\t\tversion: undefined,\n\t}\n}\n\nconst wireframerKit: WireframerKitListItem = {\n\tid: DefaultKit.id,\n\ttitle: \"Wireframer\",\n\ticon: WireframerIcon,\n\tmoduleId: undefined,\n\tsaveId: undefined,\n\tversion: undefined,\n}\nObject.freeze(wireframerKit)\n\nfunction useKits(): Kits {\n\tconst engine = useAndAssertVekterEngine()\n\tconst hasKitFeature = useProjectFeatureIsOn(\"kit\")\n\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst remoteKits = engine.stores.aiGenerationStore.kits ?? []\n\t\t\tconst list: WireframerKitListItem[] = [...remoteKits, wireframerKit]\n\t\t\tconst localKit =\n\t\t\t\thasKitFeature && engine.tree.root.kitManifest ? createLocalKit(engine.tree.root.kitManifest) : undefined\n\n\t\t\tif (localKit) list.unshift(localKit)\n\n\t\t\tconst defaultKit = list[0] ?? wireframerKit\n\n\t\t\treturn {\n\t\t\t\tlist,\n\t\t\t\tselected: list.find(k => k.id === engine.stores.aiGenerationStore.selectedKitId) ?? defaultKit,\n\t\t\t}\n\t\t},\n\t\t[hasKitFeature],\n\t\t[engine.stores.aiGenerationStore, EngineChange.Tree],\n\t\t{ deepEqual: true },\n\t)\n}\n\nexport function AiSidebarContent({ visible }: AiSidebarContentProps) {\n\tconst kitsEnabled = useExperimentIsOn(\"wireframerKits\")\n\tconst engine = useAndAssertVekterEngine()\n\tconst { activeScopeId, isDesignPage } = engine.stores.scopeStore.useState(state => ({\n\t\tactiveScopeId: state.active.id,\n\t\tisDesignPage: isDesignPageNode(state.active),\n\t}))\n\tconst cmsEnabled = !isDesignPage\n\n\tuseOnEscape({\n\t\tname: \"AiSidebar\",\n\t\tprecedence: EscapePrecedence.sidebar,\n\t\tenabled: () => visible,\n\t\thandler: engine.scheduler.wrapHandler(() => engine.stores.chromeStore.hideAiSidebar()),\n\t})\n\n\t/**\n\t * Can be used to control an alternative placeholder for the message input, such as on hovering over a prompt.\n\t */\n\tconst [messagePromptPlaceholder, setMessagePromptPlaceholder] = useState<string | null>(null)\n\tconst { messages, currentInput, isGenerating, setCurrentInput, generate } = useChat()\n\n\tconst kits = useKits()\n\n\tconst messagesEndRef = useRef<HTMLDivElement>(null)\n\tconst inputRef = useRef<HTMLTextAreaElement>(null)\n\n\tconst isNewChat = messages.length === 0\n\tconst canSend = !isGenerating && currentInput.trim().length > 0\n\n\tconst messagePlaceholder = useMemo(() => {\n\t\tif (isGenerating) return \"Generating\u2026\"\n\t\tif (!isNewChat) return \"Ask Framer\u2026\"\n\n\t\treturn messagePromptPlaceholder ?? \"Create a landing page for\u2026\"\n\t}, [messagePromptPlaceholder, isGenerating, isNewChat])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We want isGenerating to trigger the scroll to bottom.\n\tuseEffect(() => {\n\t\tif (messages.length === 0) return\n\n\t\t// Reset the input height to 2 rows after the first message as we disable auto-resize from this point on.\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.rows = MIN_ROWS\n\t\t}\n\n\t\tmessagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" })\n\t}, [messages, isGenerating])\n\n\tuseEffect(() => {\n\t\tif (!visible) return\n\n\t\tinputRef.current?.focus()\n\n\t\t// When the sidebar is visible, scroll to the bottom of the messages.\n\t\tmessagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" })\n\n\t\trecord(\"ai_v2_panel_open\", {})\n\t}, [visible])\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\t\tif (event.key === \"Tab\") {\n\t\t\t\tevent.preventDefault()\n\t\t\t} else if (event.key === \"Escape\") {\n\t\t\t\tevent.preventDefault()\n\n\t\t\t\tengine.stores.chromeStore.hideAiSidebar()\n\t\t\t} else if (event.key === \"Enter\" && !event.shiftKey) {\n\t\t\t\tif (isGenerating) return\n\n\t\t\t\tevent.preventDefault()\n\n\t\t\t\tvoid generate()\n\t\t\t} else if (event.key === \"ArrowUp\" && !currentInput) {\n\t\t\t\tconst lastUserMessage = [...messages].findLast(msg => msg.role === \"user\")\n\n\t\t\t\tif (lastUserMessage) {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tsetCurrentInput(lastUserMessage.content)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[generate, isGenerating, messages, currentInput, setCurrentInput],\n\t)\n\n\tconst presetButtonEnterTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\tconst presetButtonLeaveTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n\tconst handlePromptPresetHoverIn = useCallback((prompt: string) => {\n\t\t// If we hovered another preset button and there was a leave scheduled, cancel it.\n\t\tif (presetButtonLeaveTimeoutRef.current) {\n\t\t\tclearTimeout(presetButtonLeaveTimeoutRef.current)\n\t\t\tpresetButtonLeaveTimeoutRef.current = null\n\t\t}\n\n\t\tif (presetButtonEnterTimeoutRef.current) clearTimeout(presetButtonEnterTimeoutRef.current)\n\n\t\tpresetButtonEnterTimeoutRef.current = setTimeout(() => {\n\t\t\tsetMessagePromptPlaceholder(prompt)\n\t\t\tpresetButtonEnterTimeoutRef.current = null\n\t\t}, 80)\n\t}, [])\n\n\tconst handlePromptPresetHoverOut = useCallback(() => {\n\t\tif (presetButtonEnterTimeoutRef.current) {\n\t\t\tclearTimeout(presetButtonEnterTimeoutRef.current)\n\t\t\tpresetButtonEnterTimeoutRef.current = null\n\t\t}\n\n\t\tif (presetButtonLeaveTimeoutRef.current) clearTimeout(presetButtonLeaveTimeoutRef.current)\n\n\t\tpresetButtonLeaveTimeoutRef.current = setTimeout(() => {\n\t\t\tsetMessagePromptPlaceholder(null)\n\t\t\tpresetButtonLeaveTimeoutRef.current = null\n\t\t}, 100)\n\t}, [])\n\n\tuseEffect(() => {\n\t\t// Clean up the timeouts when the component unmounts.\n\t\treturn () => {\n\t\t\tif (presetButtonEnterTimeoutRef.current) clearTimeout(presetButtonEnterTimeoutRef.current)\n\t\t\tif (presetButtonLeaveTimeoutRef.current) clearTimeout(presetButtonLeaveTimeoutRef.current)\n\t\t}\n\t}, [])\n\n\tconst handlePromptPresetClick = useCallback(\n\t\t(prompt: string) => {\n\t\t\tsetCurrentInput(prompt)\n\n\t\t\tif (!inputRef.current) return\n\n\t\t\tinputRef.current.focus()\n\n\t\t\tsetTimeout(() => inputRef.current?.setSelectionRange(prompt.length, prompt.length), 5)\n\n\t\t\tsetMessagePromptPlaceholder(null)\n\t\t},\n\t\t[setCurrentInput],\n\t)\n\n\tconst handleBackButtonClick = () => {\n\t\tif (getIsViewOnly(engine, \"canDesign\")) {\n\t\t\tengine.stores.chromeStore.hideInsertSidebar()\n\t\t}\n\n\t\tengine.stores.insertSidebarStore.activeCategoryType = null\n\t}\n\n\tconst handleSuggestionClick = useCallback(\n\t\t(suggestion: Suggestion) => {\n\t\t\tif (isGenerating) return\n\t\t\tswitch (suggestion.variant) {\n\t\t\t\tcase \"prompt\":\n\t\t\t\t\tvoid generate(suggestion.prompt, true)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"resource\":\n\t\t\t\t\twindow.open(suggestion.url, \"_blank\", \"noopener,noreferrer\")\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t},\n\t\t[generate, isGenerating],\n\t)\n\n\tconst handleSendClick = useCallback(() => {\n\t\tif (!canSend) return\n\n\t\tvoid generate()\n\t}, [canSend, generate])\n\n\tconst handleSendKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (e.key === \"Enter\") {\n\t\t\t\te.preventDefault()\n\n\t\t\t\tif (!canSend) return\n\n\t\t\t\tvoid generate()\n\t\t\t}\n\t\t},\n\t\t[canSend, generate],\n\t)\n\n\tconst onChangeKitId = useEngineCallback((id: string) => {\n\t\tengine.stores.aiGenerationStore.selectedKitId = id\n\t}, [])\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tsidebarStyles.categoryContent,\n\t\t\t\tstyles.categoryContent,\n\t\t\t\t!visible && leftPanelStyles.leftPanelHidden,\n\t\t\t\tappPointerEvents,\n\t\t\t)}\n\t\t>\n\t\t\t<Stack gap={0} className={cx(styles.chatContainer, kitsEnabled && styles.chatContainerWithKits)}>\n\t\t\t\t{kitsEnabled && isNewChat && kits.list && kits.list.length > 1 && (\n\t\t\t\t\t<div className={styles.kitPickerContainer}>\n\t\t\t\t\t\t<KitPicker selected={kits.selected} kits={kits.list} onChange={onChangeKitId} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{!kitsEnabled && (\n\t\t\t\t\t<Button variant=\"clean\" title=\"Back\" onClick={handleBackButtonClick}>\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tgap={5}\n\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\tclassName={cx(styles.chatHeader, !isNewChat && styles.chatContainerWithContent)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<IconNavigationStackBack />\n\t\t\t\t\t\t\t<span className={styles.chatTitle}>{Dictionary.Wireframer}</span>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\n\t\t\t\t{!isNewChat && (\n\t\t\t\t\t<Scroll>\n\t\t\t\t\t\t<Stack gap={30}>\n\t\t\t\t\t\t\t{messages.map((message, index) => {\n\t\t\t\t\t\t\t\tconst isLastMessage = index === messages.length - 1\n\t\t\t\t\t\t\t\tconst { role, timestamp, content } = message\n\n\t\t\t\t\t\t\t\tif (role === \"user\") {\n\t\t\t\t\t\t\t\t\treturn <UserMessage key={`user-${timestamp}`} message={content} />\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (role === \"assistant\") {\n\t\t\t\t\t\t\t\t\tconst suggestionTargetPageId = content.suggestions?.targetPageId\n\t\t\t\t\t\t\t\t\tconst isSuggestionTargetPage = !suggestionTargetPageId || suggestionTargetPageId === activeScopeId\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<AssistantMessage\n\t\t\t\t\t\t\t\t\t\t\tkey={`assistant-${timestamp}`}\n\t\t\t\t\t\t\t\t\t\t\tisGenerating={isGenerating && isLastMessage}\n\t\t\t\t\t\t\t\t\t\t\tisMultiStepPlan={content.multiStepPlan}\n\t\t\t\t\t\t\t\t\t\t\tmessage={content.message}\n\t\t\t\t\t\t\t\t\t\t\tsuggestions={isLastMessage && isSuggestionTargetPage ? content.suggestions?.options : undefined}\n\t\t\t\t\t\t\t\t\t\t\tsteps={content.steps}\n\t\t\t\t\t\t\t\t\t\t\tonSuggestionClick={handleSuggestionClick}\n\t\t\t\t\t\t\t\t\t\t\tselectedKit={kits.selected}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn null\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t<div ref={messagesEndRef} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Scroll>\n\t\t\t\t)}\n\n\t\t\t\t<Stack className={cx(!isNewChat && styles.inputContainer)}>\n\t\t\t\t\t<div className={styles.inputWrapper}>\n\t\t\t\t\t\t<TextArea\n\t\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\t\tclassName={cx(styles.input, isNewChat && styles.newChatInput)}\n\t\t\t\t\t\t\tplaceholder={messagePlaceholder}\n\t\t\t\t\t\t\tmaxRows={isNewChat ? MAX_ROWS : undefined}\n\t\t\t\t\t\t\tautoResize={isNewChat}\n\t\t\t\t\t\t\tvalue={currentInput}\n\t\t\t\t\t\t\tonChange={value => startTransition(() => setCurrentInput(value))}\n\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className={styles.toolbar}>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tclassName={cx(styles.sendButton, !canSend && styles.sendButtonDisabled)}\n\t\t\t\t\t\t\t\tonClick={handleSendClick}\n\t\t\t\t\t\t\t\tonKeyDown={handleSendKeyDown}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<IconSend />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{isNewChat && (\n\t\t\t\t\t\t<Stack direction=\"row\" gap={10} wrap=\"wrap\">\n\t\t\t\t\t\t\t{getPromptPresets(cmsEnabled).map(promptPreset => (\n\t\t\t\t\t\t\t\t<PromptPresetButton\n\t\t\t\t\t\t\t\t\tkey={promptPreset.name}\n\t\t\t\t\t\t\t\t\tpromptPreset={promptPreset}\n\t\t\t\t\t\t\t\t\tonClick={handlePromptPresetClick}\n\t\t\t\t\t\t\t\t\tonMouseEnter={handlePromptPresetHoverIn}\n\t\t\t\t\t\t\t\t\tonMouseLeave={handlePromptPresetHoverOut}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</div>\n\t)\n}\n", "import { activeElementIsWithinModal, activeElementIsWithinPopover } from \"@framerjs/fresco\"\nimport { warnOnce } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport { useEffect } from \"react\"\n\nexport enum EscapePrecedence {\n\tscopeExit = 10,\n\tsidebar = 20,\n\tpanelSelection = 50,\n\tagentSelectionMode = 80,\n\toverlay = 90,\n\tpopout = 100,\n}\n\ninterface BaseEscapeHandlerOptions {\n\tname: string\n\thandler: () => void\n\tenabled?: (event: KeyboardEvent) => boolean\n}\n\ninterface StoppingEscapeHandlerOptions {\n\tprecedence: EscapePrecedence\n\tstopPropagation?: true\n}\n\ninterface FallthroughEscapeHandlerOptions {\n\tstopPropagation: false\n\tprecedence?: undefined\n}\n\ntype EscapeHandlerOptions = BaseEscapeHandlerOptions & (StoppingEscapeHandlerOptions | FallthroughEscapeHandlerOptions)\n\ntype EscapeHandler = Required<BaseEscapeHandlerOptions> & { precedence: EscapePrecedence; stopPropagation: boolean }\n\nconst escapeHandlers = new Set<EscapeHandler>()\n\nlet activeElementDuringCapturePhase: Element | null = null\nlet isListening = false\n\nfunction keydownCaptureHandler(event: KeyboardEvent) {\n\tif (event.key !== \"Escape\") return\n\tactiveElementDuringCapturePhase = document.activeElement\n}\n\nfunction keydownHandler(event: KeyboardEvent) {\n\tif (event.key !== \"Escape\") return\n\n\tif (activeElementDuringCapturePhase !== document.activeElement) return\n\tif (activeElementIsWithinModal()) return\n\tif (activeElementIsWithinPopover()) return\n\tif (engine.stores.contextMenuStore.isOpen) return\n\n\tlet handled: EscapePrecedence | null = null\n\tfor (const handler of [...escapeHandlers].sort((a, b) => b.precedence - a.precedence)) {\n\t\tif (!handler.enabled(event)) continue\n\n\t\tif (handled !== null) {\n\t\t\tif (handler.precedence === handled) {\n\t\t\t\twarnOnce(\n\t\t\t\t\t`Multiple final escape handlers with the same precedence (${handler.precedence}) were triggered. This can lead to unpredictable behavior.`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\thandler.handler()\n\n\t\tif (handler.stopPropagation) {\n\t\t\thandled = handler.precedence\n\t\t}\n\t}\n}\n\nfunction updateEscapeListeners() {\n\tconst shouldListen = escapeHandlers.size > 0\n\tif (shouldListen === isListening) return\n\n\tif (shouldListen) {\n\t\twindow.addEventListener(\"keydown\", keydownCaptureHandler, true)\n\t\twindow.addEventListener(\"keydown\", keydownHandler)\n\t\tisListening = true\n\t\treturn\n\t}\n\n\twindow.removeEventListener(\"keydown\", keydownCaptureHandler, true)\n\twindow.removeEventListener(\"keydown\", keydownHandler)\n\tactiveElementDuringCapturePhase = null\n\tisListening = false\n}\n\nexport function useOnEscape(options: EscapeHandlerOptions) {\n\tconst stableHandler = useStableCallback(options.handler)\n\tconst stableEnabled = useStableCallback((event: KeyboardEvent) => {\n\t\treturn options.enabled?.(event) ?? true\n\t})\n\n\tuseEffect(() => {\n\t\tconst escapeHandler: EscapeHandler = {\n\t\t\tname: options.name,\n\t\t\tprecedence: options.precedence ?? Number.POSITIVE_INFINITY,\n\t\t\tenabled: stableEnabled,\n\t\t\thandler: stableHandler,\n\t\t\tstopPropagation: options.stopPropagation ?? true,\n\t\t}\n\n\t\tescapeHandlers.add(escapeHandler)\n\t\tupdateEscapeListeners()\n\n\t\treturn () => {\n\t\t\tescapeHandlers.delete(escapeHandler)\n\t\t\tupdateEscapeListeners()\n\t\t}\n\t}, [options.name, options.precedence, options.stopPropagation, stableHandler, stableEnabled])\n}\n", "import \"LeftPanel.styles_1i06egj.wyw.css\"; export const leftPanel = \"leftPanel_l1e98qil\";\nexport const leftPanelInWrapper = \"leftPanelInWrapper_l12f9pw2\";\nexport const leftPanelHidden = \"leftPanelHidden_lhm822x\";\nexport const responsiveLeftPanel = \"responsiveLeftPanel_rzyadi5\";\nexport const mobileOverlayLeftPanel = \"mobileOverlayLeftPanel_mamibox\";", "import { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { MouseEventHandler } from \"react\"\nimport React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { collapsedViewBreakpoint } from \"utils/chromeBreakpoints.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { PanelContext } from \"../PanelTooltip.tsx\"\nimport { ResizeZone } from \"../shared/ResizeZone.tsx\"\nimport { dataIsLeftPanelDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport * as styles from \"./LeftPanel.styles.ts\"\n\nconst setTabContentWidth = engine.scheduler.wrapHandler((width: number) =>\n\tengine.stores.layoutState.setTabContentWidth(width),\n)\n\ntype Props = React.PropsWithChildren<{\n\tonContextMenu?: MouseEventHandler<HTMLElement>\n\thiddenWithoutUnmounting?: boolean\n\t/** Base the sidebar size and state on the window rather than device type. Hide on mobile with a toggle to open */\n\tresponsive?: boolean\n\t/** When true, uses relative positioning (for when inside a fixed wrapper like AgentContentPanel) */\n\tinWrapper?: boolean\n}> &\n\tReact.HTMLAttributes<HTMLDivElement>\n\nexport function LeftPanel({ hiddenWithoutUnmounting, children, onContextMenu, responsive, inWrapper, ...rest }: Props) {\n\tconst ref = React.useRef(null)\n\tconst { layoutState, chromeStore } = engine.stores\n\tconst isCollapsedView = useMediaQuery(`(max-width: ${collapsedViewBreakpoint}px)`)\n\tconst isLeftPanelOpenOnMobile = chromeStore.useState(state => state.isLeftPanelOpenOnMobile)\n\tconst shouldHideLeftPanel = responsive && isCollapsedView && !isLeftPanelOpenOnMobile\n\tconst isMobileLeftPanelOverlayOpen = responsive && isCollapsedView && isLeftPanelOpenOnMobile\n\n\tif (shouldHideLeftPanel) return null\n\n\treturn (\n\t\t<PanelContext.Provider value={ref}>\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tappPointerEvents,\n\t\t\t\t\tstyles.leftPanel,\n\t\t\t\t\tinWrapper && styles.leftPanelInWrapper,\n\t\t\t\t\tresponsive && styles.responsiveLeftPanel,\n\t\t\t\t\tisMobileLeftPanelOverlayOpen && styles.mobileOverlayLeftPanel,\n\t\t\t\t\thiddenWithoutUnmounting && styles.leftPanelHidden,\n\t\t\t\t)}\n\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t{...{ [dataIsLeftPanelDataAttribute]: \"true\" }}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<ResizeZone\n\t\t\t\t\tside=\"right\"\n\t\t\t\t\tminSize={layoutState.minWidth}\n\t\t\t\t\tmaxSize={layoutState.maxWidth}\n\t\t\t\t\tdefaultSize={layoutState.defaultTabContentWidth}\n\t\t\t\t\tgetSize={layoutState.getCurrentTabContentWidth}\n\t\t\t\t\tsetSize={setTabContentWidth}\n\t\t\t\t\tonResizeEnd={layoutState.saveToUserDefaults}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</PanelContext.Provider>\n\t)\n}\n", "import \"shared.styles_15jqje2.wyw.css\"; export const assistantAvatarSize = 20;\nexport const messageText = \"messageText_m1kf8u71\";\nexport const buttonOverride = \"buttonOverride_b1t6kyd0\";\nexport const userMessageContainerBase = \"userMessageContainerBase_u1slu4to\";", "import \"AiSidebar.styles_a36nlk.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { buttonOverride } from \"./styles/shared.styles.ts\";\nexport const categoryContent = \"categoryContent_c146lg1q\";\nexport const chatContainer = \"chatContainer_c1mjee1u\";\nexport const chatContainerWithKits = \"chatContainerWithKits_ck04vxy\";\nexport const chatHeader = \"chatHeader_c4ckflz\";\nexport const chatContainerWithContent = \"chatContainerWithContent_c1szkge9\";\nexport const kitPickerContainer = \"kitPickerContainer_ku6pekt\";\nexport const chatTitle = \"chatTitle_cg08lgs\";\nexport const inputContainer = \"inputContainer_i1nt7w9x\";\nexport const inputWrapper = \"inputWrapper_ikavvml\";\nexport const input = \"input_i81a0t5\";\nexport const newChatInput = \"newChatInput_n1afdikb\";\nexport const toolbar = \"toolbar_tgh1zoo\";\nexport const sendButton = cx(buttonOverride, \"sendButton_suwx6xm\");\nexport const sendButtonDisabled = \"sendButtonDisabled_s1o5fdg6\";", "import { Stack } from \"@framerjs/fresco\"\nimport { isDefaultKit } from \"app/ai/kits/DefaultKit.ts\"\nimport type { Step, Suggestion } from \"app/ai/types/AIChatHistory.ts\"\nimport type { WireframerKitListItem } from \"app/ai/utils/wireframerKit.ts\"\nimport { cx } from \"library/modules/cx.ts\"\nimport { memo, useState } from \"react\"\nimport { useTypewriter } from \"../hooks/useTypewriter.ts\"\nimport * as styles from \"./AssistantMessage.styles.ts\"\nimport { KitIcon } from \"./KitIcon.tsx\"\nimport { PendingMessage } from \"./PendingMessage.tsx\"\nimport { StepsList } from \"./StepsList.tsx\"\nimport { SuggestionButton } from \"./SuggestionButton.tsx\"\n\ninterface AssistantMessageProps {\n\tisGenerating: boolean\n\tisMultiStepPlan?: boolean\n\tmessage: string\n\tsuggestions?: Suggestion[]\n\tsteps?: Step[]\n\tselectedKit: WireframerKitListItem\n\tshouldAnimateInitial?: boolean\n\tonSuggestionClick: (suggestion: Suggestion) => void\n}\n\nconst typingSpeed = 5\n\nexport const AssistantMessage = memo(function AssistantMessage({\n\tisGenerating,\n\tisMultiStepPlan,\n\tmessage,\n\tsuggestions,\n\tsteps,\n\tselectedKit,\n\tshouldAnimateInitial = false,\n\tonSuggestionClick,\n}: AssistantMessageProps) {\n\tconst [prevMessage, setPrevMessage] = useState(message)\n\tconst [shouldAnimate, setShouldAnimate] = useState(shouldAnimateInitial && message.length > 0)\n\tconst [hasSettled, setHasSettled] = useState(!shouldAnimateInitial)\n\n\tif (prevMessage !== message) {\n\t\tsetPrevMessage(message)\n\t\tsetShouldAnimate(message.length > 0)\n\t\tsetHasSettled(false)\n\t}\n\n\tconst { value: typedText } = useTypewriter({\n\t\ttext: message,\n\t\tshouldAnimate,\n\t\ttypingSpeed,\n\t\tonComplete: () => setShouldAnimate(false),\n\t})\n\n\tconst hasSteps = !!steps?.length\n\tconst hasSuggestions = !!suggestions?.length\n\tconst hasResourceSuggestion = hasSuggestions && suggestions.some(option => option.variant === \"resource\")\n\tconst showVideoLink = !hasSteps && hasSettled && hasResourceSuggestion\n\n\tconst lastIndex = message.length - 1\n\n\treturn (\n\t\t<Stack gap={10}>\n\t\t\t<Stack gap={10} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<KitIcon\n\t\t\t\t\ticon={selectedKit.icon}\n\t\t\t\t\ttitle={selectedKit.title}\n\t\t\t\t\tsize={styles.assistantIconSize}\n\t\t\t\t\tradii={styles.assistantIconRadii}\n\t\t\t\t/>\n\t\t\t\t<span className={styles.assistantName}>{suffixKitTitle(selectedKit)}</span>\n\t\t\t</Stack>\n\n\t\t\t{isGenerating && !message && !hasSteps && <PendingMessage message=\"Thinking\" />}\n\n\t\t\t{message && (\n\t\t\t\t<div className={styles.assistantMessage}>\n\t\t\t\t\t{message.split(\"\").map((char, i) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={`assistant-message-char-${i}-${char}`}\n\t\t\t\t\t\t\tclassName={cx(styles.messageChar, i < typedText.length && styles.messageCharVisible)}\n\t\t\t\t\t\t\tstyle={{ transitionDelay: `${i * typingSpeed}ms` }}\n\t\t\t\t\t\t\tonTransitionEnd={i === lastIndex ? () => setHasSettled(true) : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{char}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t))}\n\n\t\t\t\t\t{showVideoLink && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{` Learn more on the `}\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName={styles.videoLink}\n\t\t\t\t\t\t\t\thref=\"https://www.framer.com/academy?utm_source=wireframer\"\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tAcademy\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{hasSteps && <StepsList isMultiStepPlan={isMultiStepPlan} steps={steps} />}\n\n\t\t\t{hasSuggestions && (\n\t\t\t\t<Stack className={cx(styles.suggestions, hasSettled && styles.suggestionsVisible)} direction=\"column\" gap={5}>\n\t\t\t\t\t{suggestions.map((suggestion, index) => (\n\t\t\t\t\t\t<SuggestionButton key={index} suggestion={suggestion} onAction={onSuggestionClick} />\n\t\t\t\t\t))}\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n\nfunction suffixKitTitle(kit: WireframerKitListItem) {\n\tif (isDefaultKit(kit)) return kit.title\n\tconst title = kit.title\n\tif (title.toLowerCase().includes(\"kit\")) return title\n\treturn `${title} Kit`\n}\n", "// useTypewriter.ts\nimport { type MutableRefObject, useEffect, useLayoutEffect, useRef, useState } from \"react\"\n\ninterface UseTypewriterOptions {\n\ttext: string\n\tshouldAnimate: boolean\n\ttypingSpeed?: number\n\tonComplete?: () => void\n}\n\ninterface UseTypewriterResult {\n\tvalue: string\n\tisComplete: boolean\n}\n\n/**\n * A hook that animates the typing of a text.\n *\n * @param options - The options for the typing effect.\n * @returns The value and the completion status of the typing effect.\n */\nexport function useTypewriter({\n\ttext,\n\tshouldAnimate,\n\ttypingSpeed = 12,\n\tonComplete,\n}: UseTypewriterOptions): UseTypewriterResult {\n\tconst [value, setValue] = useState(shouldAnimate ? \"\" : text)\n\tconst [isComplete, setIsComplete] = useState(!shouldAnimate)\n\n\tconst previousText = useRef(text)\n\tconst previousShouldAnimate = useRef(shouldAnimate)\n\tconst onCompleteRef = useRef(onComplete)\n\tconst timeoutRef = useRef<number | null>(null)\n\n\tuseEffect(() => {\n\t\tonCompleteRef.current = onComplete\n\t}, [onComplete])\n\n\tuseLayoutEffect(() => {\n\t\tconst wasAnimating = previousShouldAnimate.current\n\t\tpreviousShouldAnimate.current = shouldAnimate\n\n\t\tif (!shouldAnimate) {\n\t\t\tclearTick(timeoutRef)\n\t\t\tpreviousText.current = text\n\t\t\tsetValue(text)\n\t\t\tsetIsComplete(true)\n\t\t\treturn\n\t\t}\n\n\t\tconst textChanged = previousText.current !== text\n\t\tconst shouldRestart = textChanged || !wasAnimating\n\t\tif (!shouldRestart && timeoutRef.current !== null) return\n\n\t\tclearTick(timeoutRef)\n\n\t\tpreviousText.current = text\n\n\t\tstartTyping({\n\t\t\ttext,\n\t\t\ttypingSpeed,\n\t\t\tsetValue,\n\t\t\tsetIsComplete,\n\t\t\tonComplete: onCompleteRef.current ?? undefined,\n\t\t\ttimerRef: timeoutRef,\n\t\t})\n\n\t\treturn () => clearTick(timeoutRef)\n\t}, [text, shouldAnimate, typingSpeed])\n\n\treturn { value, isComplete }\n}\n\n/**\n * Start the typing effect. It uses set timeout instead of set interval to avoid flickering because the latter runs\n * the callback every N milliseconds, regardless of how long the callback itself takes.\n *\n * @param settings - The settings for the typing effect, including appropriate callback functions.\n */\nfunction startTyping(settings: {\n\ttext: string\n\ttypingSpeed: number\n\tsetValue: (value: string) => void\n\tsetIsComplete: (value: boolean) => void\n\tonComplete?: () => void\n\ttimerRef: MutableRefObject<number | null>\n}) {\n\tconst { text, typingSpeed, setValue, setIsComplete, onComplete, timerRef } = settings\n\n\tsetValue(\"\")\n\n\tif (text.length === 0) {\n\t\tsetIsComplete(true)\n\t\tonComplete?.()\n\t\treturn\n\t}\n\n\tsetIsComplete(false)\n\n\tlet index = 0\n\tconst tick = () => {\n\t\tindex += 1\n\t\tsetValue(text.slice(0, index))\n\t\tif (index < text.length) {\n\t\t\ttimerRef.current = window.setTimeout(tick, typingSpeed)\n\t\t} else {\n\t\t\ttimerRef.current = null\n\t\t\tsetIsComplete(true)\n\t\t\tonComplete?.()\n\t\t}\n\t}\n\n\ttimerRef.current = window.setTimeout(tick, typingSpeed)\n}\n\n/**\n * Clear the tick.\n *\n * @param timerRef - The timer reference.\n */\nfunction clearTick(timerRef: MutableRefObject<number | null>) {\n\tif (timerRef.current !== null) {\n\t\tclearTimeout(timerRef.current)\n\t\ttimerRef.current = null\n\t}\n}\n", "import \"AssistantMessage.styles_vet0ta.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { assistantAvatarSize, messageText } from \"../styles/shared.styles.ts\";\nexport const assistantIconSize = assistantAvatarSize;\nexport const assistantIconRadii = 5;\nexport const assistantName = \"assistantName_aqs38uu\";\nexport const assistantMessage = cx(messageText, \"assistantMessage_a13m5676\");\nexport const videoLink = \"videoLink_vtqjxp2\";\nexport const messageChar = \"messageChar_m4t5xrr\";\nexport const messageCharVisible = \"messageCharVisible_m4rfg3y\";\nexport const suggestions = \"suggestions_s12xec9c\";\nexport const suggestionsVisible = \"suggestionsVisible_sfxmhou\";", "import \"KitIcon.styles_1dkhwgi.wyw.css\"; export const iconContainerBase = \"iconContainerBase_i1nggpgl\";\nexport const fallbackIconContainer = \"fallbackIconContainer_f6xzhc0\";\nexport const wireframerIconContainer = \"wireframerIconContainer_waab5ls\";\nexport const icon = \"icon_i1wazlc\";", "import { IconDefaultKit, IconFramerLogo } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport * as styles from \"./KitIcon.styles.ts\"\n\nexport const WireframerIcon = \"wireframer-icon\" as const\ntype Icon = typeof WireframerIcon | string | undefined\n\ntype Props = {\n\ticon: Icon\n\ttitle: string\n\tradii: number\n\tsize: number\n}\n\nexport const KitIcon = ({ icon, title, size, radii }: Props) => {\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(styles.iconContainerBase, getIconContainerClass(icon))}\n\t\t\tstyle={{ borderRadius: radii, width: size, height: size }}\n\t\t>\n\t\t\t{getIcon(icon, title)}\n\t\t</div>\n\t)\n}\n\nfunction getIcon(icon: Icon, title: string) {\n\tif (icon === WireframerIcon) return <IconFramerLogo />\n\tif (isUndefined(icon)) return <IconDefaultKit />\n\n\treturn <img decoding=\"async\" src={resolveImage(icon)} alt={`${title} icon`} className={styles.icon} />\n}\n\nfunction getIconContainerClass(icon: Icon) {\n\tif (icon === WireframerIcon) return styles.wireframerIconContainer\n\tif (isUndefined(icon)) return styles.fallbackIconContainer\n\treturn undefined\n}\n", "import * as chatStyles from \"document/components/utils/chat.styles.ts\"\nimport { useState } from \"react\"\nimport { useTypewriter } from \"../hooks/useTypewriter.ts\"\nimport * as styles from \"./PendingMessage.styles.ts\"\n\ninterface PendingMessageProps {\n\tmessage: string\n\tanimate?: boolean\n\ttypingSpeed?: number\n}\n\nexport const PendingMessage = ({ message, animate = false, typingSpeed = 20 }: PendingMessageProps) => {\n\tconst [enableAnimation, setEnableAnimation] = useState(animate)\n\tconst [prevMessage, setPrevMessage] = useState(message)\n\tconst [shouldAnimate, setShouldAnimate] = useState(false)\n\n\tif (enableAnimation !== animate) {\n\t\tsetEnableAnimation(animate)\n\t}\n\n\tif (prevMessage !== message && enableAnimation) {\n\t\tsetPrevMessage(message)\n\t\tsetShouldAnimate(message.length > 0)\n\t}\n\n\tconst { value, isComplete } = useTypewriter({\n\t\ttext: message,\n\t\tshouldAnimate,\n\t\ttypingSpeed,\n\t\tonComplete: () => setShouldAnimate(false),\n\t})\n\n\tconst display = animate ? value : message\n\tconst showDots = !animate || isComplete\n\n\treturn (\n\t\t<div className={styles.assistantMessage}>\n\t\t\t{display}\n\t\t\t{showDots && <span className={chatStyles.loadingDots} />}\n\t\t</div>\n\t)\n}\n", "import \"PendingMessage.styles_xj4d7a.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { messageText } from \"../styles/shared.styles.ts\";\nexport const assistantMessage = cx(messageText, \"assistantMessage_ap3yzcc\");", "import { Stack } from \"@framerjs/fresco\"\nimport type { Step } from \"app/ai/types/AIChatHistory.ts\"\nimport { StepStatus } from \"app/ai/types/AIChatHistory.ts\"\nimport { cx } from \"library/modules/cx.ts\"\nimport { memo, useState } from \"react\"\nimport { useTypewriter } from \"../hooks/useTypewriter.ts\"\nimport { PendingMessage } from \"./PendingMessage.tsx\"\nimport { StepStatusIcon } from \"./StepStatusIcon.tsx\"\nimport * as styles from \"./StepsList.styles.ts\"\n\nconst typingSpeed = 20\n\ninterface StepsListProps {\n\tisMultiStepPlan?: boolean\n\tsteps: Step[]\n}\n\nexport const StepsList = memo(function StepsList({ isMultiStepPlan, steps }: StepsListProps) {\n\t// For a single-step plan, show a simplified message.\n\tif (!isMultiStepPlan && steps.length === 1) {\n\t\tconst [step] = steps\n\t\tconst shouldAnimate = step?.status === StepStatus.Loading\n\t\treturn (\n\t\t\t<PendingMessage message={step?.description ?? \"Updating\"} animate={shouldAnimate} typingSpeed={typingSpeed} />\n\t\t)\n\t}\n\n\treturn (\n\t\t<div className={styles.steps}>\n\t\t\t{steps.map((step, index) => (\n\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: Keeping index for stable keys\n\t\t\t\t<StepRow key={index} step={step} />\n\t\t\t))}\n\t\t</div>\n\t)\n})\n\ninterface StepRowProps {\n\tstep: Step\n\ttypingSpeed?: number\n}\n\nconst StepRow = memo(function StepRow({ step }: StepRowProps) {\n\tconst { status, description } = step\n\tconst isActive = status === StepStatus.Loading\n\tconst isDisabled = status === StepStatus.Pending\n\n\tconst [prevDescription, setPrevDescription] = useState(description)\n\tconst [shouldAnimate, setShouldAnimate] = useState(false)\n\n\t// Update state during render when description changes\n\tif (description !== prevDescription) {\n\t\tsetPrevDescription(description)\n\t\tsetShouldAnimate(description.length > 0)\n\t}\n\n\tconst { value: animatedDescription } = useTypewriter({\n\t\ttext: description,\n\t\tshouldAnimate,\n\t\ttypingSpeed,\n\t})\n\n\treturn (\n\t\t<Stack gap={10} direction=\"row\" alignItems=\"center\" className={styles.stepItem}>\n\t\t\t<div className={styles.stepStatus}>\n\t\t\t\t<StepStatusIcon status={status} />\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.stepDescription,\n\t\t\t\t\tisActive && styles.activeStepDescription,\n\t\t\t\t\tisDisabled && styles.disabledStepDescription,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{animatedDescription}\n\t\t\t</div>\n\t\t</Stack>\n\t)\n})\n", "import { IconCheckmarkWireframer, IconCrossCircleWireframer, Spinner } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/src/tokens/colors\"\nimport { StepStatus } from \"app/ai/types/AIChatHistory.ts\"\nimport { memo } from \"react\"\n\ninterface StepStatusIconProps {\n\tstatus: StepStatus\n}\n\nexport const StepStatusIcon = memo(function StepStatusIcon({ status }: StepStatusIconProps) {\n\tswitch (status) {\n\t\tcase StepStatus.Pending:\n\t\t\treturn null\n\t\tcase StepStatus.Loading:\n\t\t\treturn <Spinner inline style={{ backgroundColor: colors.wireframerAssistantPlan }} />\n\t\tcase StepStatus.Done:\n\t\t\treturn <IconCheckmarkWireframer style={{ color: colors.wireframerAssistantPlan }} />\n\t\tcase StepStatus.Error:\n\t\t\treturn <IconCrossCircleWireframer style={{ color: colors.errorTint }} />\n\t\tdefault:\n\t\t\treturn null\n\t}\n})\n", "import \"StepsList.styles_17xsuib.wyw.css\"; export const steps = \"steps_s1nv2eip\";\nexport const stepItem = \"stepItem_st2z17w\";\nexport const stepStatus = \"stepStatus_s1dcy453\";\nexport const stepDescription = \"stepDescription_sdqi61c\";\nexport const activeStepDescription = \"activeStepDescription_a4phdp6\";\nexport const disabledStepDescription = \"disabledStepDescription_d1swjwro\";", "import { cx } from \"@linaria/core\"\nimport type { Suggestion, SuggestionVariant } from \"app/ai/types/AIChatHistory.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { useCallback } from \"react\"\nimport { WireframerIcon } from \"../../insertSidebar/dataSources/icons/WireframerIcon.tsx\"\nimport { WireframerResourceIcon } from \"../../insertSidebar/dataSources/icons/WireframerResourceIcon.tsx\"\nimport { buttonOverride, messageText } from \"../styles/shared.styles.ts\"\nimport {\n\tresourceSuggestionText,\n\tsuggestionButtonBase,\n\tsuggestionButtonText,\n\tsuggestionIcon,\n} from \"./SuggestionButton.styles.ts\"\n\ntype SuggestionButtonProps = {\n\tsuggestion: Suggestion\n\tonAction: (suggestion: Suggestion) => void\n}\n\nexport function SuggestionButton({ suggestion, onAction }: SuggestionButtonProps) {\n\tconst handleAction = useCallback(() => onAction(suggestion), [onAction, suggestion])\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\t\te.preventDefault()\n\t\t\t\thandleAction()\n\t\t\t}\n\t\t},\n\t\t[handleAction],\n\t)\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cx(buttonOverride, messageText, suggestionButtonBase)}\n\t\t\tonClick={handleAction}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\taria-label={getAriaLabel(suggestion)}\n\t\t>\n\t\t\t<span className={suggestionIcon}>{getIcon(suggestion.variant)}</span>\n\t\t\t<span className={cx(suggestionButtonText, suggestion.variant === \"resource\" && resourceSuggestionText)}>\n\t\t\t\t{suggestion.text}\n\t\t\t</span>\n\t\t</button>\n\t)\n}\n\nconst ariaLabel: Record<SuggestionVariant, string> = {\n\tprompt: \"Select suggestion\",\n\tresource: \"Open resource\",\n}\n\nfunction getAriaLabel(suggestion: Suggestion) {\n\treturn `${ariaLabel[suggestion.variant]}: ${suggestion.text}`\n}\n\nfunction getIcon(variant: SuggestionVariant) {\n\tswitch (variant) {\n\t\tcase \"prompt\":\n\t\t\treturn <WireframerIcon fill=\"currentColor\" />\n\t\tcase \"resource\":\n\t\t\treturn <WireframerResourceIcon fill=\"currentColor\" />\n\t\tdefault:\n\t\t\tassertNever(variant, \"Unknown suggestion variant\")\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\n\nexport function WireframerResourceIcon({ fill = colors.insertPanelNeutralIconForeground }) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Wireframer Resource</title>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 10 4 C 11.381 4 12.5 6.686 12.5 10 C 12.5 13.314 11.381 16 10 16 C 8.619 16 7.5 13.314 7.5 10 C 7.5 6.686 8.619 4 10 4 Z\"\n\t\t\t\t\t\tid=\"a1000z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1001z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1000z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use xlinkHref=\"#a1000z\" fill=\"transparent\" clipPath=\"url(#a1001z)\" strokeWidth=\"2\" stroke={fill} />\n\t\t\t</g>\n\t\t\t<path d=\"M 5 10 L 15 10\" fill=\"transparent\" stroke={fill} />\n\t\t\t<path\n\t\t\t\td=\"M 4.5 10 C 4.5 6.962 6.962 4.5 10 4.5 L 10 4.5 C 13.038 4.5 15.5 6.962 15.5 10 L 15.5 10 C 15.5 13.038 13.038 15.5 10 15.5 L 10 15.5 C 6.962 15.5 4.5 13.038 4.5 10 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke={fill}\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"SuggestionButton.styles_mrrgdb.wyw.css\"; export const suggestionButtonBase = \"suggestionButtonBase_sa2gmgn\";\nexport const suggestionButtonText = \"suggestionButtonText_so6fhdb\";\nexport const resourceSuggestionText = \"resourceSuggestionText_r7n1def\";\nexport const suggestionIcon = \"suggestionIcon_sn7pl4d\";", "import { IconInputDropdown } from \"@framerjs/fresco\"\nimport { Popover } from \"@framerjs/fresco/src/components/Popover\"\nimport type { WireframerKitListItem } from \"app/ai/utils/wireframerKit.ts\"\nimport { cx } from \"library/modules/cx.ts\"\nimport { memo, useRef, useState } from \"react\"\nimport { KitIcon } from \"./KitIcon.tsx\"\nimport * as styles from \"./KitPicker.styles.ts\"\n\ninterface KitPickerProps {\n\tselected: WireframerKitListItem\n\tonChange?: (id: string) => void\n\tkits: readonly WireframerKitListItem[] | null\n}\n\nconst popoverOffset = { x: 0, y: 5 }\nconst popoverWithin = { left: 10 }\n\nexport const KitPicker = memo(function KitPicker({ selected, onChange, kits }: KitPickerProps) {\n\tconst triggerRef = useRef<HTMLButtonElement | null>(null)\n\tconst [open, setOpen] = useState(false)\n\n\tfunction toggleOpen() {\n\t\tsetOpen(prev => !prev)\n\t}\n\n\tfunction handleKeyDown(e: React.KeyboardEvent<HTMLButtonElement>) {\n\t\tif (e.key === \"Enter\") setOpen(true)\n\t}\n\n\tfunction handleSelect(id: string) {\n\t\tonChange?.(id)\n\t\tsetOpen(false)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<button\n\t\t\t\tref={triggerRef}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={toggleOpen}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\taria-expanded={open}\n\t\t\t\tclassName={styles.button}\n\t\t\t>\n\t\t\t\t<KitIcon\n\t\t\t\t\ticon={selected.icon}\n\t\t\t\t\ttitle={selected.title}\n\t\t\t\t\tsize={styles.iconSize}\n\t\t\t\t\tradii={styles.buttonIconContainerRadii}\n\t\t\t\t/>\n\n\t\t\t\t<span className={styles.title}>{selected.title}</span>\n\n\t\t\t\t<div className={cx(styles.chevron)}>\n\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t</div>\n\t\t\t</button>\n\n\t\t\t{open && kits && (\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={triggerRef.current}\n\t\t\t\t\talignSelf=\"center\"\n\t\t\t\t\tattachTo=\"bottom\"\n\t\t\t\t\toffset={popoverOffset}\n\t\t\t\t\twithin={popoverWithin}\n\t\t\t\t\tonClose={toggleOpen}\n\t\t\t\t\tshowArrow={false}\n\t\t\t\t\tfocusTrapEnabled={false}\n\t\t\t\t\tclassName={styles.list}\n\t\t\t\t>\n\t\t\t\t\t{kits.map(kit => (\n\t\t\t\t\t\t<button key={kit.id} type=\"button\" className={styles.row} onMouseDown={() => handleSelect(kit.id)}>\n\t\t\t\t\t\t\t<KitIcon icon={kit.icon} title={kit.title} size={styles.iconSize} radii={styles.rowIconContainerRadii} />\n\t\t\t\t\t\t\t<span className={styles.title}>{kit.title}</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t</Popover>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import \"KitPicker.styles_1bjvqw3.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const iconSize = 30;\nconst buttonHeight = 40;\nexport const button = \"button_bfnrw7h\";\nexport const title = \"title_t12mvah0\";\nexport const chevron = \"chevron_c10coj09\";\nconst listPadding = 5;\nexport const list = \"list_ljqkjdx\";\nconst rowPadding = 5;\nexport const row = \"row_r6o8poh\";\nconst rowBorderRadius = dimensions.values.popoverRadius - listPadding;\nexport const buttonIconContainerRadii = dimensions.values.inputRadiusLarge - (buttonHeight - iconSize) / 2;\nexport const rowIconContainerRadii = rowBorderRadius - rowPadding;", "import { useCallback } from \"react\"\nimport * as styles from \"./PromptPresetButton.styles.ts\"\n\nexport interface PromptPreset {\n\tname: string\n\tprompt: string\n}\n\ninterface PromptPresetButtonProps {\n\tpromptPreset: PromptPreset\n\tonMouseEnter: (prompt: string) => void\n\tonMouseLeave: () => void\n\tonClick: (prompt: string) => void\n}\n\nexport function PromptPresetButton({ promptPreset, onClick, onMouseEnter, onMouseLeave }: PromptPresetButtonProps) {\n\tconst handleMouseEnter = useCallback(() => {\n\t\tonMouseEnter(promptPreset.prompt)\n\t}, [onMouseEnter, promptPreset])\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\t\t\te.preventDefault()\n\n\t\t\t\tonClick(promptPreset.prompt)\n\t\t\t}\n\t\t},\n\t\t[onClick, promptPreset],\n\t)\n\n\tconst handleClick = useCallback(() => onClick(promptPreset.prompt), [onClick, promptPreset])\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={styles.promptPresetButton}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonMouseLeave={onMouseLeave}\n\t\t>\n\t\t\t{promptPreset.name}\n\t\t</button>\n\t)\n}\n", "import \"PromptPresetButton.styles_1pkm16m.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { buttonOverride, userMessageContainerBase } from \"../styles/shared.styles.ts\";\nexport const promptPresetButton = cx(buttonOverride, userMessageContainerBase, \"promptPresetButton_p1rk6w0r\");", "import { memo } from \"react\"\nimport * as styles from \"./UserMessage.styles.ts\"\n\ninterface UserMessageProps {\n\tmessage: string\n}\n\nexport const UserMessage = memo(function UserMessage({ message }: UserMessageProps) {\n\treturn <div className={styles.userMessage}>{message}</div>\n})\n", "import \"UserMessage.styles_k7q1zk.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { messageText, userMessageContainerBase } from \"../styles/shared.styles.ts\";\nexport const userMessage = cx(messageText, userMessageContainerBase, \"userMessage_uhi6bcj\");", "import type { PromptPreset } from \"../components/PromptPresetButton.tsx\"\n\nconst cmsPresets = [\n\t{\n\t\tname: \"Blog Posts\",\n\t\tprompt:\n\t\t\t\"Make a blog about Framer. Keep the titles short and sweet. Use about three paragraphs per post and only add subtitles above a few of those.\",\n\t},\n\t{\n\t\tname: \"Changelog Page\",\n\t\tprompt:\n\t\t\t\"Make a changelog about 3 Framer updates. Keep body copy in each post to 1 single paragraph of like 6-8 lines. Make the title say Updates. Make the subtitle say Latest. Keep titles of each post short and sweet.\",\n\t},\n]\n\nconst nonCmsPresets = [\n\t{\n\t\tname: \"About Page\",\n\t\tprompt:\n\t\t\t\"Create a simple about page for my design studio called Rover. In dark mode. We do apps, sites, and videos.\",\n\t},\n\t{\n\t\tname: \"Featured Project\",\n\t\tprompt:\n\t\t\t\"Create a page where I can showcase my projects with bold typography and inline previews. Feature one of the projects. End with a footer.\",\n\t},\n]\n\nexport function getPromptPresets(cmsEnabled: boolean): PromptPreset[] {\n\treturn [\n\t\t{\n\t\t\tname: \"Personal Page\",\n\t\t\tprompt:\n\t\t\t\t\"Create a simple personal page with a list of projects, starting from 2020, ending at 2025. In dark mode.\",\n\t\t},\n\t\t{\n\t\t\tname: \"Landing Page\",\n\t\t\tprompt:\n\t\t\t\t\"Create a landing page for my design startup. I would like a hero with a banner, a logo string, some features, and a newsletter section.\",\n\t\t},\n\t\t...(cmsEnabled ? cmsPresets : nonCmsPresets),\n\t\t{\n\t\t\tname: \"Teaser\",\n\t\t\tprompt:\n\t\t\t\t\"Create a simple teaser page where I can capture signups for my upcoming mobile app. My app is called Contour.\",\n\t\t},\n\t\t{\n\t\t\tname: \"Resume\",\n\t\t\tprompt: \"Create a simple resume page where I can highlight all of my web design experience.\",\n\t\t},\n\t\t{\n\t\t\tname: \"Portfolio\",\n\t\t\tprompt: \"Create a personal portfolio for me with an intro and a grid with project titles and dates.\",\n\t\t},\n\t]\n}\n", "import { showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback, useState } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\n\nexport function useChat() {\n\tconst [currentInput, setCurrentInput] = useState<string>(\"\")\n\n\tconst { aiGenerationStore } = engine.stores\n\n\tconst { isGenerating, messages } = useEngineState(\n\t\t() => {\n\t\t\treturn {\n\t\t\t\tisGenerating: aiGenerationStore.isGenerating,\n\t\t\t\tmessages: aiGenerationStore.getChatHistory(),\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[aiGenerationStore],\n\t\t{ deepEqual: true },\n\t)\n\n\tconst generate = useCallback(\n\t\tasync (prompt?: string, isSuggestion = false) => {\n\t\t\tconst normalizedInput = prompt ?? currentInput.trim()\n\t\t\tif (!normalizedInput) return\n\t\t\tif (showModalIfAiDisabled(engine, \"agent_panel\")) return\n\n\t\t\tsetCurrentInput(\"\")\n\n\t\t\tconst handleError = () => {\n\t\t\t\ttoast({\n\t\t\t\t\tkey: \"ai-generation-error\",\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tprimaryText: \"Generation failed.\",\n\t\t\t\t\tsecondaryText: \"Please retry.\",\n\t\t\t\t\tduration: 30_000,\n\t\t\t\t\tvariant: \"info\",\n\t\t\t\t\tshowCloseButton: \"auto\",\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tawait aiGenerationStore.generate(engine, normalizedInput, \"panel\", isSuggestion, handleError)\n\t\t},\n\t\t[currentInput],\n\t)\n\n\treturn {\n\t\tmessages,\n\t\tcurrentInput,\n\t\tisGenerating,\n\t\tsetCurrentInput,\n\t\tgenerate,\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\n\ninterface FirstPublishState {\n\tisFirstPublish: boolean\n\tisCheckingFirstPublish: boolean\n}\n\n/**\n * Determines if the site has never been published before.\n *\n * We check `defaultHostname?.isPublished` because it's stable during re-publish,\n * unlike versions which get reset (causing `hasNoVersions` to be temporarily true).\n */\nexport function useIsFirstPublish(): FirstPublishState {\n\tconst { publishStatus, didLoadInitialVersionDeployments, hasNoVersions, isPublished } =\n\t\tengine.stores.publishStore.useState(state => ({\n\t\t\tpublishStatus: state.publishStatus,\n\t\t\tdidLoadInitialVersionDeployments: state.didLoadInitialVersionDeployments,\n\t\t\thasNoVersions: state.versions?.length === 0,\n\t\t\tisPublished: state.defaultHostname?.isPublished,\n\t\t}))\n\n\tconst isFirstPublish = hasNoVersions && publishStatus !== PublishStatus.Published && !isPublished\n\tconst isCheckingFirstPublish =\n\t\tisFirstPublish && publishStatus === PublishStatus.Unpublished && !didLoadInitialVersionDeployments\n\n\treturn { isFirstPublish, isCheckingFirstPublish }\n}\n", "import { Spinner } from \"@framerjs/fresco\"\nimport { assertNever, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useIsFirstPublish } from \"document/components/chrome/siteSettings/useIsFirstPublish.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport { ANALYTICS_SCOPE_ID } from \"document/models/CanvasTree/nodes/AnalyticsScopeNode.ts\"\nimport type { AnalyticsTab } from \"document/stores/AnalyticsStore.ts\"\nimport { AnalyticsTabNames, analyticsImpressionTrackingPages } from \"document/stores/AnalyticsStore.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { EscapePrecedence, useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\nimport { dataIsAnalyticsDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport * as styles from \"./Analytics.styles.ts\"\nimport * as unpublishedStyles from \"./components/UnpublishedState.styles.ts\"\nimport { UnpublishedState } from \"./components/UnpublishedState.tsx\"\nimport { AbTestOverview } from \"./tabs/AbTestOverview.tsx\"\nimport { AnalyticsOverview } from \"./tabs/AnalyticsOverview.tsx\"\nimport { FunnelOverview } from \"./tabs/FunnelOverview.tsx\"\n\ninterface AnalyticsContentProps {\n\tactive: AnalyticsTab\n}\n\nfunction AnalyticsContent({ active }: AnalyticsContentProps) {\n\tusePreloadedScope(ANALYTICS_SCOPE_ID)\n\n\tReact.useEffect(() => {\n\t\tif (engine.isRemountingUI()) return\n\t\tconst page = analyticsImpressionTrackingPages[active.tab]\n\t\tif (!page) return\n\t\trecord(\"ui_impression\", { page })\n\t}, [active.tab])\n\n\tReact.useEffect(() => {\n\t\tengine.stores.publishStore.loadVersions().catch(unhandledError)\n\t}, [])\n\n\tuseOnEscape({\n\t\tname: \"Analytics\",\n\t\tprecedence: EscapePrecedence.scopeExit,\n\t\thandler: engine.scheduler.wrapHandler(() => {\n\t\t\tengine.stores.analyticsStore.close()\n\t\t}),\n\t})\n\n\tconst { isFirstPublish, isCheckingFirstPublish } = useIsFirstPublish()\n\tif (isCheckingFirstPublish) {\n\t\treturn (\n\t\t\t<div className={unpublishedStyles.unpublishedStateContainer}>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tif (isFirstPublish) return <UnpublishedState />\n\n\tswitch (active.tab) {\n\t\tcase AnalyticsTabNames.overview:\n\t\t\treturn <AnalyticsOverview />\n\t\tcase AnalyticsTabNames.funnel:\n\t\t\treturn <FunnelOverview id={active.id} />\n\t\tcase AnalyticsTabNames.abtest:\n\t\t\treturn <AbTestOverview funnelId={active.id} />\n\t\tdefault:\n\t\t\tassertNever(active)\n\t}\n}\n\nexport const Analytics = React.memo(function Analytics() {\n\tconst mainView = engine.stores.chromeStore.useState(state => state.mainView)\n\tconst { active, isRightPanelVisible } = engine.stores.analyticsStore.useState(analytics => ({\n\t\tisRightPanelVisible: analytics.isRightPanelVisible,\n\t\tactive: analytics.active,\n\t}))\n\n\tif (mainView !== ActiveMainView.Analytics) return null\n\tif (!active) return null\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(styles.wrapper, styles.withLeftPanel, isRightPanelVisible && styles.withRightPanel)}\n\t\t\t{...{ [dataIsAnalyticsDataAttribute]: \"true\" }}\n\t\t>\n\t\t\t<div className={styles.scrollContainer}>\n\t\t\t\t<AnalyticsContent active={active} />\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n", "import \"Analytics.styles_bqdl3h.wyw.css\"; export const wrapper = \"wrapper_w6top3y\";\nexport const withLeftPanel = \"withLeftPanel_w2taue3\";\nexport const withRightPanel = \"withRightPanel_w1fwcje5\";\nexport const scrollContainer = \"scrollContainer_s1ejzji\";\nexport const rowsContainer = \"rowsContainer_r1e72lnp\";", "import \"UnpublishedState.styles_etxrlw.wyw.css\"; export const unpublishedStateContainer = \"unpublishedStateContainer_u4fcdhv\";\nexport const emptyStateTitle = \"emptyStateTitle_eptdvnk\";\nexport const unpublishedStateText = \"unpublishedStateText_u1e4me5d\";", "import { Stack } from \"@framerjs/fresco\"\nimport React from \"react\"\nimport * as styles from \"./UnpublishedState.styles.ts\"\n\nexport const UnpublishedState = React.memo(function UnpublishedState() {\n\treturn (\n\t\t<Stack gap={15} className={styles.unpublishedStateContainer}>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<span className={styles.emptyStateTitle}>Analytics</span>\n\t\t\t\t<span className={styles.unpublishedStateText}>\n\t\t\t\t\tPublish your website to <br />\n\t\t\t\t\ttrack and view insights.\n\t\t\t\t</span>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import { Stack } from \"@framerjs/fresco\"\nimport { 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 { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useEffect, useMemo, useState } from \"react\"\nimport { getAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { AbTestHeader } from \"../components/AbTestHeader.tsx\"\nimport { AbTestTable } from \"../components/AbTestTable.tsx\"\nimport { AnalyticsEventsUpsellState, EmptyFunnelState } from \"../components/AnalyticsStateMessages.tsx\"\nimport { FunnelDropOffBars } from \"../components/FunnelDropOffBars.tsx\"\nimport type { AbTestDropOffStep } from \"../utils/funnel-stats/getFunnelDropOffs.ts\"\nimport { getAbTestQuery } from \"../utils/getAbTestQuery.ts\"\nimport { useAbTestVariantsWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport * as analyticsStyles from \"./AnalyticsOverview.styles.ts\"\n\nconst AbTestConversionRateChart = React.lazy(() => import(\"../section/AbTestConversionRateChart.tsx\"))\n\nexport const AbTestOverview = React.memo(function AbTestOverview({ funnelId }: { funnelId: NodeID }) {\n\tconst { abTestStats, abTestStatsLoading, abTestConversionRate, abTestConversionRateLoading } =\n\t\tengine.stores.analyticsStore.useState(state => ({\n\t\t\tabTestStats: state.abTestStats,\n\t\t\tabTestStatsLoading: state.abTestStatsLoading,\n\t\t\tabTestConversionRate: state.abTestConversionRate ?? emptyArray(),\n\t\t\tabTestConversionRateLoading: state.abTestConversionRateLoading,\n\t\t}))\n\n\tconst abTestFunnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\n\t// Memoize abTestQuery to avoid unnecessary refetches\n\tconst abTestQuery = useEngineState(() => getAbTestQuery(funnelId, engine), [funnelId], [EngineChange.Tree], {\n\t\tdeepEqual: true,\n\t})\n\tuseEffect(\n\t\t() =>\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tif (!abTestQuery) return\n\t\t\t\t// Setting abTestQuery would fetch the data\n\t\t\t\tengine.stores.analyticsStore.abTestQuery = abTestQuery\n\t\t\t}),\n\t\t[abTestQuery],\n\t)\n\n\t// Reset the hovered variant when the id changes\n\tconst [hoveredVariant, setHoveredVariant] = useState<string | null>(null)\n\tconst [previousId, setPreviousId] = useState(funnelId)\n\tif (funnelId !== previousId) {\n\t\tsetPreviousId(funnelId)\n\t\tsetHoveredVariant(null)\n\t}\n\tconst activeVariant = hoveredVariant ?? abTestFunnel?.abTestingParentId ?? null\n\n\tconst activeFunnelData: readonly AbTestDropOffStep[] = useMemo(() => {\n\t\tif (!activeVariant) return emptyArray()\n\t\treturn abTestStats?.dropOff.get(activeVariant) ?? emptyArray()\n\t}, [abTestStats, activeVariant])\n\n\tconst currentMetrics = abTestStatsLoading ? undefined : abTestStats?.metrics\n\tconst abVariantsWithMetrics = useAbTestVariantsWithMetrics(funnelId, currentMetrics)\n\n\t// Block the page if the user is over the events limit\n\tconst eventsUpsell = useEngineState(\n\t\t() => getAnalyticsEventsUpsell(engine.stores.projectStore),\n\t\t[],\n\t\t[engine.stores.projectStore],\n\t)\n\tif (eventsUpsell) return <AnalyticsEventsUpsellState upsell={eventsUpsell} />\n\n\tif (!abTestFunnel || !abVariantsWithMetrics) return null\n\n\tif (abTestFunnel.status === FunnelStatus.Initial) {\n\t\treturn (\n\t\t\t<EmptyFunnelState\n\t\t\t\ttitle={Dictionary.AbTest}\n\t\t\t\tdescription={\"Add a conversion step to\\nset up and start your test.\"}\n\t\t\t\tlearnMoreUrl=\"https://framer.com/help/articles/how-to-run-an-a-b-test-on-your-framer-site/\"\n\t\t\t\tfunnelId={abTestFunnel.id}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={30} className={analyticsStyles.container}>\n\t\t\t<AbTestHeader\n\t\t\t\tabTestStatsLoading={abTestStatsLoading}\n\t\t\t\tfunnelId={funnelId}\n\t\t\t\tabVariantsWithMetrics={abVariantsWithMetrics}\n\t\t\t\thoveredVariant={hoveredVariant}\n\t\t\t/>\n\t\t\t<FunnelDropOffBars node={abTestFunnel} dropOffData={activeFunnelData} isLoading={abTestStatsLoading} />\n\t\t\t<AbTestTable\n\t\t\t\tfunnelId={funnelId}\n\t\t\t\tabVariantsWithMetrics={abVariantsWithMetrics}\n\t\t\t\tonVariantHover={setHoveredVariant}\n\t\t\t\thoveredVariant={activeVariant}\n\t\t\t/>\n\t\t\t{abTestConversionRate.length >= 2 && (\n\t\t\t\t<React.Suspense fallback={null}>\n\t\t\t\t\t<AbTestConversionRateChart\n\t\t\t\t\t\tabVariantsWithMetrics={abVariantsWithMetrics}\n\t\t\t\t\t\tisLoading={abTestConversionRateLoading}\n\t\t\t\t\t\tabTestResults={abTestConversionRate}\n\t\t\t\t\t/>\n\t\t\t\t</React.Suspense>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n", "import { DeploymentStrategy } from \"@framerjs/app-shared\"\nimport type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { Button, Link, Stack, T } from \"@framerjs/fresco\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport pluralize from \"pluralize\"\nimport type React from \"react\"\nimport { whyIAmNotSeeingAbTestResultsURL } from \"utils/staticURLs.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { AnalyticsTitle } from \"../components/AnalyticsTitle.tsx\"\nimport { formatPercentage } from \"../utils/formatUtils.ts\"\nimport { getAbTestStats } from \"../utils/getAbTestStats.ts\"\nimport { getVariantNameById } from \"../utils/getVariantNameById.ts\"\nimport { promptDeleteAbTest } from \"../utils/promptDeleteAbTest.ts\"\nimport { promptStartAbTest } from \"../utils/promptStartAbTest.ts\"\nimport { promptStopAbTest } from \"../utils/promptStopAbTest.ts\"\nimport type { AbVariantWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport * as styles from \"./AbTestHeader.styles.ts\"\nimport { ScreenshotDiff } from \"./ScreenshotDiff.tsx\"\n\ninterface StatusProps {\n\tfunnelId: NodeID\n\tabVariantsWithMetrics: readonly AbVariantWithMetrics[]\n\thoveredVariant: NodeID | null\n\tabTestStatsLoading: boolean\n}\n\nexport function AbTestHeader({ funnelId, hoveredVariant, abVariantsWithMetrics, abTestStatsLoading }: StatusProps) {\n\tconst canStartStopAbTest = !useIsViewOnly(\"canEditAnalytics\")\n\tconst abTestFunnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\tconst { hasStaging, hasCustomCanonicalUrl, deployedAbTestIds, isPublishing } = engine.stores.publishStore.useState(\n\t\tstate => ({\n\t\t\thasStaging: state.deploymentStrategy === DeploymentStrategy.Manual,\n\t\t\thasCustomCanonicalUrl: state.canonicalURL.type === \"custom\" && !!state.canonicalURL.url,\n\t\t\tdeployedAbTestIds: (state.customHostnameDeployment || state.defaultHostnameDeployment)?.abTestIds,\n\t\t\tisPublishing: state.publishStatus !== PublishStatus.Published,\n\t\t}),\n\t)\n\tconst isAbTestDeployed = Boolean(deployedAbTestIds?.includes(funnelId))\n\n\tlet status: React.ReactNode | null = null\n\tlet isActive = false\n\tlet winner = \"\"\n\tlet summary = \"\"\n\tlet button: JSX.Element | null = null\n\n\tif (!abTestFunnel) return null\n\n\tswitch (abTestFunnel.status) {\n\t\tcase FunnelStatus.Initial:\n\t\t\tstatus = \"Pending Configuration\"\n\t\t\twinner = \"Pending\"\n\t\t\tsummary =\n\t\t\t\t\"This A/B test needs to be configured. Add a conversion step in the sidebar, then publish your page with its variants to start the test.\"\n\t\t\tbutton = (\n\t\t\t\t<Button className={styles.analyticsCTAButton} enabled={false}>\n\t\t\t\t\tStart Test\n\t\t\t\t</Button>\n\t\t\t)\n\t\t\tbreak\n\t\tcase FunnelStatus.Configured:\n\t\t\tstatus = \"Pending\"\n\t\t\twinner = \"Pending\"\n\t\t\tsummary =\n\t\t\t\t\"This A/B test is currently not running. To begin, start the test and publish your site to direct traffic to the different variants and measure the results.\"\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tclassName={styles.analyticsCTAButton}\n\t\t\t\t\tonClick={() => promptStartAbTest(engine, funnelId, \"ab_test_page\" as ModalOpenSource)}\n\t\t\t\t\tenabled={canStartStopAbTest}\n\t\t\t\t>\n\t\t\t\t\tStart Test\n\t\t\t\t</Button>\n\t\t\t)\n\t\t\tbreak\n\t\tcase FunnelStatus.Started: {\n\t\t\tif (abTestStatsLoading) break\n\n\t\t\tconst abTestStats = getAbTestStats(abVariantsWithMetrics)\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tclassName={styles.analyticsCTAButton}\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tabTestStats\n\t\t\t\t\t\t\t? () => promptStopAbTest(engine, abTestFunnel.id, \"ab_test_page\" as ModalOpenSource)\n\t\t\t\t\t\t\t: () => promptDeleteAbTest(engine, abTestFunnel.id, \"ab_test_page\" as ModalOpenSource)\n\t\t\t\t\t}\n\t\t\t\t\tenabled={canStartStopAbTest}\n\t\t\t\t>\n\t\t\t\t\tStop Test\n\t\t\t\t</Button>\n\t\t\t)\n\n\t\t\tif (!abTestStats) {\n\t\t\t\tif (!isAbTestDeployed && !isPublishing) {\n\t\t\t\t\tstatus = hasStaging ? (\n\t\t\t\t\t\t// We always publish when starting a test, but when the user uses staging, they don't\n\t\t\t\t\t\t// get the test on the live site yet.\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\tYour test has started, but it hasn\u2019t been deployed to your live site yet.{\" \"}\n\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\tclassName={styles.inlineLink}\n\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab({\n\t\t\t\t\t\t\t\t\t\ttab: SiteSettingsTabNames.versions,\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\t\tDeploy the latest version\n\t\t\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t\t\tto start seeing results.\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// It is possible to have a started test without a published site.\n\t\t\t\t\t\t// When the staging is off, and the user who started the test doesn't have permission to publish.\n\t\t\t\t\t\t// But this is a narrow use case, that we don't want to handle to avoid blinking, because we cannot\n\t\t\t\t\t\t// reliably derive the publishing and refetching the hostnames status.\n\t\t\t\t\t\t\"Active\"\n\t\t\t\t\t)\n\t\t\t\t} else if (hasCustomCanonicalUrl && !isPublishing) {\n\t\t\t\t\t// If there is no data and the site has a canonical URL set, we show\n\t\t\t\t\t// a warning that the test may not be working as expected because of a reverse proxy\n\t\t\t\t\tstatus = (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\tYour site seems to be behind a reverse proxy, which may affect A/B tests.{\" \"}\n\t\t\t\t\t\t\t<Link className={styles.inlineLink} href={whyIAmNotSeeingAbTestResultsURL} target=\"_blank\">\n\t\t\t\t\t\t\t\tCheck this guide\n\t\t\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t\t\tto verify your setup.\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tstatus = \"Active\"\n\t\t\t\t}\n\n\t\t\t\twinner = \"Pending\"\n\t\t\t\tsummary =\n\t\t\t\t\t\"This A/B test has just started. We are now collecting data to start measuring the performance of all variants.\"\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tassert(abTestFunnel.abTestingParentId, \"A/B testing funnel should have the control page ID\")\n\t\t\tconst { best, daysLeft } = abTestStats\n\n\t\t\tconst variants = abTestFunnel.getAbVariants(engine.tree, engine.componentLoader)\n\t\t\tconst bestVariant = variants.find(v => v.id === best.abVariantId)\n\t\t\tconst name = bestVariant?.name ?? getVariantNameById(best.abVariantId, abTestFunnel.abTestingParentId)\n\n\t\t\tconst nameText = name === \"Control\" ? \"control\" : `\u2018${name}\u2019`\n\t\t\tconst probabilityText = formatPercentage(best.probabilityOfBeingBest)\n\n\t\t\tconst estimatedUpliftText = best.lift ? `an estimated ${formatPercentage(best.lift)} uplift` : \"\"\n\t\t\tconst andUpliftText = best.lift ? ` and ${estimatedUpliftText}` : \"\"\n\t\t\tconst withUpliftText = best.lift ? `, with ${estimatedUpliftText}` : \"\"\n\n\t\t\tif (daysLeft > 0) {\n\t\t\t\tconst daysText = `${daysLeft} ${pluralize(\"day\", daysLeft)}`\n\t\t\t\tstatus = \"Active\"\n\t\t\t\twinner = `${daysText} left until a winner can be determined`\n\t\t\t\tsummary = `There\u2019s a ${probabilityText} chance the ${nameText} variant is performing the best${withUpliftText}. At the current traffic rate, enough data to reach a conclusion is expected in ${daysText}.`\n\t\t\t} else {\n\t\t\t\tstatus = \"Complete\"\n\t\t\t\tif (abTestStats.bestIsWinner) {\n\t\t\t\t\twinner = name\n\t\t\t\t\tsummary = `Based on the data, the ${nameText} variant is the winner, with a ${probabilityText} chance of performing best${andUpliftText}.`\n\t\t\t\t} else {\n\t\t\t\t\twinner = \"No clear winner\"\n\t\t\t\t\tsummary = `There\u2019s a ${probabilityText} chance the ${nameText} variant is performing the best${withUpliftText}. There isn\u2019t enough data to declare a clear winner. You can continue testing to gain clearer insights.`\n\t\t\t\t}\n\t\t\t}\n\t\t\tisActive = true\n\t\t\tbreak\n\t\t}\n\t\tcase FunnelStatus.Stopped: {\n\t\t\tif (isAbTestDeployed && !isPublishing) {\n\t\t\t\t// After stopping the test, the user needs to deploy the latest version to remove it from the site.\n\t\t\t\tstatus = hasStaging ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\tYour test was stopped, but this change hasn\u2019t been deployed to your live site yet. Publish and{\" \"}\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tclassName={styles.inlineLink}\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab({\n\t\t\t\t\t\t\t\t\ttab: SiteSettingsTabNames.versions,\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\t\tdeploy the latest version\n\t\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t\tto stop the test completely.\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\tYour test was stopped, but this change hasn\u2019t been deployed to your live site yet.{\" \"}\n\t\t\t\t\t\t<Link className={styles.inlineLink} onClick={() => void engine.stores.publishStore.publish()}>\n\t\t\t\t\t\t\tPublish your site\n\t\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t\tto stop the test completely.\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tstatus = \"Stopped\"\n\t\t\t}\n\n\t\t\tif (abTestStatsLoading) break\n\n\t\t\tconst abTestStats = getAbTestStats(abVariantsWithMetrics)\n\n\t\t\tif (abTestStats === null) {\n\t\t\t\tsummary = \"Not enough data was collected.\"\n\t\t\t\twinner = \"No winner\"\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tassert(abTestFunnel.abTestingParentId, \"A/B testing funnel should have the control page ID\")\n\t\t\tconst { best, daysLeft } = abTestStats\n\n\t\t\tconst variants = abTestFunnel.getAbVariants(engine.tree, engine.componentLoader)\n\t\t\tconst bestVariant = variants.find(v => v.id === best.abVariantId)\n\t\t\tconst name = bestVariant?.name ?? getVariantNameById(best.abVariantId, abTestFunnel.abTestingParentId)\n\n\t\t\tconst nameText = name === \"Control\" ? \"control\" : `\u2018${name}\u2019`\n\t\t\tconst probabilityText = formatPercentage(best.probabilityOfBeingBest)\n\n\t\t\tconst estimatedUpliftText = best.lift ? `an estimated ${formatPercentage(best.lift)} uplift` : \"\"\n\t\t\tconst andUpliftText = best.lift ? ` and ${estimatedUpliftText}` : \"\"\n\t\t\tconst withUpliftText = best.lift ? `, with ${estimatedUpliftText}` : \"\"\n\n\t\t\tif (daysLeft > 0) {\n\t\t\t\twinner = \"No clear winner\"\n\t\t\t\tsummary = `When the test stopped, the ${nameText} variant had a ${probabilityText} chance of performing best${withUpliftText}.`\n\t\t\t} else if (abTestStats.bestIsWinner) {\n\t\t\t\twinner = name\n\t\t\t\tsummary = `Based on the data, the ${nameText} variant was the winner, with a ${probabilityText} chance of performing best${andUpliftText}.`\n\t\t\t} else {\n\t\t\t\twinner = \"No clear winner\"\n\t\t\t\tsummary = `When the test stopped, the ${nameText} variant had a ${probabilityText} chance of performing best${withUpliftText}. There wasn\u2019t enough data to declare a clear winner.`\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(abTestFunnel.status)\n\t}\n\n\treturn (\n\t\t<Stack direction=\"column\" gap={30}>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" className={styles.headerWrapper}>\n\t\t\t\t<AnalyticsTitle\n\t\t\t\t\ttitle={abTestFunnel.resolveValue(\"name\") || getDefaultName(engine.componentLoader, abTestFunnel)}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"row\" gap={30} alignItems=\"center\" className={styles.headerWrapper}>\n\t\t\t\t<div className={styles.equalColumn}>\n\t\t\t\t\t<ScreenshotDiff\n\t\t\t\t\t\tabVariantsWithMetrics={abVariantsWithMetrics}\n\t\t\t\t\t\tfunnelId={funnelId}\n\t\t\t\t\t\thoveredVariant={hoveredVariant}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<Stack className={styles.equalColumn} direction=\"column\" alignItems=\"flex-start\" gap={30}>\n\t\t\t\t\t{status && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap={5}>\n\t\t\t\t\t\t\t\t<div className={styles.statusHeader}>\n\t\t\t\t\t\t\t\t\t<T>Status</T>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\ttypeof status !== \"string\"\n\t\t\t\t\t\t\t\t\t\t\t? styles.statusMessage\n\t\t\t\t\t\t\t\t\t\t\t: cx(styles.status, isActive && styles.activeStatus),\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\t\t{status}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap={5}>\n\t\t\t\t\t\t\t\t<div className={styles.statusHeader}>\n\t\t\t\t\t\t\t\t\t<T>Winner</T>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className={styles.statusMessage}>{winner}</div>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t<Stack direction=\"column\" gap={5}>\n\t\t\t\t\t\t\t\t<div className={styles.statusHeader}>\n\t\t\t\t\t\t\t\t\t<T>Summary</T>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div className={styles.statusMessage}>{summary}</div>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t<div>{button}</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import \"AnalyticsTitle.styles_85ra1.wyw.css\"; export const title = \"title_txekoz3\";", "import { truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./AnalyticsTitle.styles.ts\"\n\nconst arrowRegex = /->/gu\n\nexport const AnalyticsTitle = ({ title }: { title: string | null }) => (\n\t// Replace two symbols with a single symbol\n\t// Ligatures are disabled in Chrome because of letter spacing\n\t<div className={cx(styles.title, truncateWithEllipsis)} title={title?.replace(arrowRegex, \"\u2192\")}>\n\t\t{title?.replace(arrowRegex, \"\u2192\")}\n\t</div>\n)\n", "import { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport { AnalyticsTabNames } from \"document/stores/AnalyticsStore.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\n/**\n * Deletes a funnel and its reference node.\n * @param funnelId - The ID of the funnel to delete.\n * @param tab - The tab to check if the active tab is the same as the funnel tab.\n * If it is, it will set the active tab to the overview tab.\n */\nexport function deleteFunnel(funnelId: NodeID, tab: AnalyticsTabNames.funnel | AnalyticsTabNames.abtest) {\n\t// Delete both the FunnelNode and its EntityReferenceNode to avoid orphaned references\n\tconst referenceId = buildEntityReferenceNodeId(funnelId)\n\tconst referenceNode = engine.tree.get(referenceId)\n\tif (referenceNode) {\n\t\tengine.tree.removeNode(referenceNode)\n\t}\n\tengine.deleteNode(funnelId)\n\trecord(\"funnel_delete\", { funnelId })\n\tif (engine.stores.analyticsStore.active?.tab === tab && funnelId === engine.stores.analyticsStore.active?.id) {\n\t\tengine.stores.analyticsStore.setActiveTab({ tab: AnalyticsTabNames.overview }).catch(unhandledError)\n\t}\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { AnalyticsTabNames } from \"document/stores/AnalyticsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { deleteFunnel } from \"./deleteFunnel.ts\"\n\nexport function promptDeleteAbTest(engine: VekterEngine, funnelId: string, source: ModalOpenSource) {\n\tconst onConfirm = engine.scheduler.wrapHandler(() => deleteFunnel(funnelId, AnalyticsTabNames.abtest))\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\tvariant: \"destructive\",\n\t\ttitle: \"Stop A/B Test\",\n\t\tdescription:\n\t\t\t\"Not enough data was collected during the test, so it will be deleted. The page variants won't be affected or deleted.\",\n\t\tconfirmLabel: \"Confirm\",\n\t\tsource,\n\t\tonConfirm,\n\t})\n}\n", "import { DeploymentStrategy } from \"@framerjs/app-shared\"\nimport type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\n\nexport function promptStartAbTest(engine: VekterEngine, abTestingFunnelId: NodeID, source: ModalOpenSource) {\n\t// An async function is used to show a spinner\n\tconst onConfirm = engine.scheduler.wrapHandler(async () => {\n\t\tconst funnel = engine.tree.getNodeWithTrait(abTestingFunnelId, isFunnelNode)\n\t\tif (!funnel || !funnel.abTestingParentId) return\n\t\tfunnel.set({ startedAt: new Date().toISOString() })\n\t\trecord(\"ab_test_start\", { abTestId: funnel.id, abTestingParentId: funnel.abTestingParentId })\n\n\t\tconst publishPermission =\n\t\t\tengine.stores.publishStore.deploymentStrategy === DeploymentStrategy.Manual ? \"canPublishToStaging\" : \"canPublish\"\n\n\t\tif (getIsViewOnly(engine, publishPermission)) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"info\",\n\t\t\t\tprimaryText: \"Test started.\",\n\t\t\t\tsecondaryText: \"Publish to see results.\",\n\t\t\t\tkey: \"ab-test-publish-site\",\n\t\t\t})\n\t\t} else {\n\t\t\tawait engine.stores.publishStore.publish()\n\t\t}\n\t})\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.ConfirmPublishAbTest,\n\t\tinteractionRequired: true,\n\t\tsource,\n\t\ttitle: \"Publish and Start A/B Test\",\n\t\tdescription: \"Publish your site to start your A/B test and direct traffic to all different variants.\",\n\t\tconfirmLabel: \"Publish\",\n\t\tonConfirm,\n\t})\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport type { AbVariant } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { RoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { isFunnelNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { DAYS } from \"history/dataProcessing.ts\"\nimport { updateLinks } from \"utils/updateLinks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"../../Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\n\nexport function promptStopAbTest(engine: VekterEngine, funnelId: string, source: ModalOpenSource) {\n\tconst currentFunnel = engine.tree.getNodeWithTrait(funnelId, isFunnelNode)\n\tif (!currentFunnel) return\n\n\tconst isStarted = currentFunnel.status === FunnelStatus.Started\n\tif (!isStarted) return\n\tassert(\n\t\tcurrentFunnel.abTestingParentId && currentFunnel.startedAt,\n\t\t\"Started A/B test should have abTestingParentId and startedAt\",\n\t)\n\tconst abTestingParentId = currentFunnel.abTestingParentId\n\tconst startedAt = new Date(currentFunnel.startedAt)\n\n\tconst webPage = engine.tree.getNodeWithTrait(abTestingParentId, isWebPageNode)\n\tif (webPage) {\n\t\t// Show a modal that lets the user select the winning variant\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.StopAbTest,\n\t\t\tsource,\n\t\t\tfunnelId,\n\t\t\tonConfirm: (params: StopAbTestParams) => stopAbTest(engine, funnelId, startedAt, params),\n\t\t})\n\t} else {\n\t\t// If the funnel is still valid but the web page is not because it was deleted, we stop the funnel immediately\n\t\tengine.scheduler.process(() => {\n\t\t\tconst stoppedAt = new Date()\n\t\t\tcurrentFunnel.set({ stoppedAt: stoppedAt.toISOString() })\n\t\t\trecord(\"ab_test_stop\", {\n\t\t\t\tabTestId: currentFunnel.id,\n\t\t\t\tabTestingParentId,\n\t\t\t\tdurationInDays: getDurationInDays(startedAt, stoppedAt),\n\t\t\t})\n\t\t})\n\t}\n}\n\nfunction getDurationInDays(startedAt: Date, stoppedAt: Date) {\n\treturn Math.round((stoppedAt.getTime() - startedAt.getTime()) / DAYS)\n}\n\ninterface StopAbTestParams {\n\tvariantId: NodeID\n\tlift: number | undefined\n\tabVariantsSnapshot: readonly AbVariant[]\n\tdeleteOtherVariants: boolean\n}\n\nasync function stopAbTest(\n\tengine: VekterEngine,\n\tfunnelId: NodeID,\n\tstartedAt: Date,\n\t{ variantId, lift, abVariantsSnapshot, deleteOtherVariants }: StopAbTestParams,\n) {\n\tconst funnel = engine.tree.getNodeWithTrait(funnelId, isFunnelNode)\n\tif (!funnel) return\n\tconst oldControlPage = engine.tree.getNodeWithTrait(funnel.abTestingParentId, isWebPageNode)\n\tconst newControlPage = engine.tree.getNodeWithTrait(variantId, isWebPageNode)\n\tif (!oldControlPage || !newControlPage) return\n\n\t// Replace control with the selected variant (if differs)\n\tif (oldControlPage.id !== newControlPage.id) {\n\t\tawait engine.runWithFullyLoadedTreeAsync(\n\t\t\t() => {\n\t\t\t\tswapVariants(engine, oldControlPage.id, newControlPage.id)\n\t\t\t\trecord(\"ab_variant_replace\", { pageId: newControlPage.id, abTestingParentId: oldControlPage.id })\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: \"StopAbTest\",\n\t\t\t\trunInBackground: true,\n\t\t\t},\n\t\t)\n\t}\n\n\t// Stop the A/B Test and snapshot the variant names\n\tconst stoppedAt = new Date()\n\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\tconst currentFunnel = engine.tree.current(funnel)\n\t\tif (!currentFunnel) return\n\n\t\tconst { distributions } = currentFunnel.getAbVariantDistributionsPpm(engine.tree, engine.componentLoader)\n\t\tconst percentageById = new Map(distributions.map(d => [d.id, d.distributionPercentagePpm ?? 0]))\n\t\tconst snapshotWithPercentages: AbVariant[] = abVariantsSnapshot.map(variant => ({\n\t\t\t...variant,\n\t\t\tdistributionPercentagePpm: percentageById.get(variant.id),\n\t\t}))\n\t\tcurrentFunnel.set({\n\t\t\tstoppedAt: stoppedAt.toISOString(),\n\t\t\tabVariantsSnapshot: snapshotWithPercentages,\n\t\t})\n\t})\n\n\tif (deleteOtherVariants) {\n\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\tfor (const variant of abVariantsSnapshot) {\n\t\t\t\t// keep the new control page\n\t\t\t\tif (variant.id === variantId) continue\n\n\t\t\t\t// skip if the page doesn't exist\n\t\t\t\tif (!engine.tree.getNodeWithTrait(variant.id, isWebPageNode)) continue\n\n\t\t\t\tengine.deleteNode(variant.id)\n\n\t\t\t\trecord(\"ab_variant_delete\", { pageId: variant.id, abTestingParentId: oldControlPage.id })\n\t\t\t}\n\t\t})\n\t}\n\n\trecord(\"ab_test_stop\", {\n\t\tabTestId: funnel.id,\n\t\tabTestingParentId: oldControlPage.id,\n\t\tdurationInDays: getDurationInDays(startedAt, stoppedAt),\n\t\tliftPercentage: lift !== undefined ? lift * 100 : undefined,\n\t\tvariantId,\n\t})\n}\n\nfunction swapVariants(engine: VekterEngine, oldNodeId: NodeID, newNodeId: NodeID) {\n\tconst oldNode = engine.tree.getNodeWithTrait(oldNodeId, isWebPageNode)\n\tif (!oldNode) return\n\n\tconst newNode = engine.tree.getNodeWithTrait(newNodeId, isWebPageNode)\n\tif (!newNode) return\n\tassert(newNode.isLoaded(), \"Node should be loaded\")\n\n\tassert(!engine.tree.getService(\"loader\"), \"Tree should be fully loaded\")\n\tfor (const node of engine.tree.root.walk()) {\n\t\tupdateLinks(\n\t\t\tengine.tree,\n\t\t\tnode,\n\t\t\tlink => {\n\t\t\t\tif (!isLinkToWebPage(link) || link.webPageId !== oldNode.id) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\n\t\t\t\tconst updatedLink: LinkToWebPage = {\n\t\t\t\t\t...link,\n\t\t\t\t\twebPageId: newNode.id,\n\t\t\t\t\t// If the new scroll target is not found, the hash will be unset.\n\t\t\t\t\thash: link.hash ? getNewScrollTargetId(engine, link.hash, newNode) : undefined,\n\t\t\t\t}\n\t\t\t\treturn updatedLink\n\t\t\t},\n\t\t\t{ updateUpstream: false },\n\t\t)\n\t}\n\n\t// Update redirect nodes that point to the old web page.\n\tconst routesNode = RoutesNode.get(engine.tree)\n\tif (routesNode) {\n\t\tassert(routesNode.isLoaded(), \"Routes node should be loaded\")\n\t\tfor (const redirectNode of routesNode.getRedirects()) {\n\t\t\tconst redirect = engine.tree.current(redirectNode)\n\t\t\tif (!redirect) continue\n\t\t\tif (!isLinkToWebPage(redirect.to) || redirect.to.webPageId !== oldNode.id) continue\n\n\t\t\tredirect.set({\n\t\t\t\tto: {\n\t\t\t\t\t...redirect.to,\n\t\t\t\t\twebPageId: newNode.id,\n\t\t\t\t\thash: redirect.to.hash ? getNewScrollTargetId(engine, redirect.to.hash, newNode) : undefined,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tconst oldAbTestingChildren = oldNode.getAbTestingChildren(engine.tree)\n\tif (oldAbTestingChildren) {\n\t\tfor (const variant of oldAbTestingChildren) {\n\t\t\tif (variant.id === newNode.id || variant.id === oldNode.id) continue\n\t\t\tvariant.set({ abTestingParentId: newNodeId })\n\t\t}\n\t}\n\n\tnewNode.set({ abTestingParentId: undefined, name: \"Control\" })\n\toldNode.set({ abTestingParentId: newNode.id, name: \"Control (old)\" })\n\tengine.stores.scopeStore.select(newNode.id, { keepHistory: false })\n\n\tif (engine.tree.root.homePageNodeId === oldNode.id) {\n\t\t// Home page node doesn't have a route segment, so we need to update the root node directly.\n\t\tengine.tree.root.set({ homePageNodeId: newNode.id })\n\t} else {\n\t\t// Otherwise, we need to update the route segment to point to the new node.\n\t\tconst routeSegment = getRouteSegmentNodeByWebPageId(engine.tree, oldNode.id)\n\t\tassert(routeSegment, \"Web page route segment to update not found\")\n\t\trouteSegment.set({ webPageId: newNode.id })\n\t}\n}\n\nfunction getNewScrollTargetId(engine: VekterEngine, scrollTargetId: NodeID, newNode: WebPageNode) {\n\tconst oldScrollTarget = engine.tree.get(scrollTargetId)\n\tif (!oldScrollTarget || !withScrollTarget(oldScrollTarget) || !oldScrollTarget.elementId) {\n\t\treturn\n\t}\n\n\tconst newScrollTarget = newNode.find(node => {\n\t\treturn withScrollTarget(node) && node.elementId === oldScrollTarget.elementId\n\t})\n\treturn newScrollTarget?.id\n}\n", "import \"AbTestHeader.styles_17mtfe9.wyw.css\"; export const headerWrapper = \"headerWrapper_h1hkfwjg\";\nexport const equalColumn = \"equalColumn_e80iqsv\";\nexport const statusHeader = \"statusHeader_ser33j1\";\nexport const statusMessage = \"statusMessage_s172rul\";\nexport const status = \"status_s1dft2pw\";\nexport const activeStatus = \"activeStatus_a1tpt939\";\nexport const analyticsCTAButton = \"analyticsCTAButton_a1yhi5tn\";\nexport const inlineLink = \"inlineLink_ivppx5t\";", "import { IconFramerLogo, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { getServiceMap } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useEffect, useMemo, useState } from \"react\"\nimport { accessTokenRefresher } from \"web/lib/accessTokenRefresherWeb.ts\"\nimport type { AbVariantWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport { getVariantColorToken } from \"../utils/variantColorToken.ts\"\nimport * as styles from \"./ScreenshotDiff.styles.ts\"\n\ninterface ScreenshotDiffProps {\n\tfunnelId: NodeID\n\tabVariantsWithMetrics: readonly AbVariantWithMetrics[]\n\thoveredVariant: NodeID | null\n}\n\nexport function ScreenshotDiff({ funnelId, abVariantsWithMetrics, hoveredVariant }: ScreenshotDiffProps) {\n\tconst [coverSrc, variantSrcMap] = useExistingImages(funnelId, abVariantsWithMetrics)\n\n\tconst hoveredVariantInfo = useMemo(\n\t\t() => abVariantsWithMetrics.find(({ id }) => id === hoveredVariant) ?? null,\n\t\t[abVariantsWithMetrics, hoveredVariant],\n\t)\n\n\tconst backgroundImage =\n\t\thoveredVariant === null\n\t\t\t? coverSrc\n\t\t\t\t? `url(${coverSrc})`\n\t\t\t\t: undefined\n\t\t\t: variantSrcMap[hoveredVariant]\n\t\t\t\t? `url(${variantSrcMap[hoveredVariant]})`\n\t\t\t\t: undefined\n\n\treturn (\n\t\t<div className={styles.diffContainer} style={{ backgroundImage }}>\n\t\t\t{backgroundImage && <div className={styles.coverImageBorder} />}\n\t\t\t{!backgroundImage && <IconFramerLogo className={styles.coverImagePlaceholder} />}\n\t\t\t{hoveredVariantInfo && (\n\t\t\t\t<Stack direction=\"row\" gap={5} className={styles.activeVariant} alignItems=\"center\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={styles.variantCircle}\n\t\t\t\t\t\tstyle={{ backgroundColor: getVariantColorToken(hoveredVariantInfo.index) }}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className={truncateWithEllipsis}>{hoveredVariantInfo.name}</div>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction useExistingImages(\n\tfunnelId: NodeID,\n\tabVariantsWithMetrics: readonly AbVariantWithMetrics[],\n): [string | undefined, Record<string, string | undefined>] {\n\tconst [coverSrc, setCoverSrc] = useState<string>()\n\tconst [variantSrcMap, setVariantSrcMap] = useState<Record<string, string | undefined>>({})\n\tconst projectId = engine.stores.projectStore.projectId\n\n\t// Preload cover image\n\tuseEffect(() => {\n\t\tlet ignore = false\n\t\tlet coverImage: string | undefined\n\t\tvoid (async () => {\n\t\t\tsetCoverSrc(undefined)\n\t\t\tcoverImage = await loadHTMLImage({ projectId, abTestId: funnelId })\n\t\t\tif (!ignore) setCoverSrc(coverImage)\n\t\t})()\n\t\treturn () => {\n\t\t\tignore = true\n\t\t\tif (coverImage) URL.revokeObjectURL(coverImage)\n\t\t}\n\t}, [projectId, funnelId])\n\n\t// Preload other images\n\tuseEffect(() => {\n\t\tlet ignore = false\n\t\tconst imageMap: Record<string, string | undefined> = {}\n\t\tvoid (async () => {\n\t\t\tsetVariantSrcMap({})\n\t\t\tconst images = await Promise.all(\n\t\t\t\tabVariantsWithMetrics.map(({ id }) =>\n\t\t\t\t\tloadHTMLImage({ projectId, abTestId: funnelId, pageId: id }).then(src => ({ id, src })),\n\t\t\t\t),\n\t\t\t)\n\t\t\tfor (const { id, src } of images) {\n\t\t\t\timageMap[id] = src\n\t\t\t}\n\t\t\tif (!ignore) setVariantSrcMap(imageMap)\n\t\t})()\n\t\treturn () => {\n\t\t\tfor (const src of Object.values(imageMap)) {\n\t\t\t\tif (src) URL.revokeObjectURL(src)\n\t\t\t}\n\t\t\tignore = true\n\t\t}\n\t}, [projectId, funnelId, abVariantsWithMetrics])\n\n\treturn [coverSrc, variantSrcMap]\n}\n\nconst loadHTMLImage = async (params: {\n\tprojectId: string\n\tabTestId: string\n\tpageId?: string\n}): Promise<string | undefined> => {\n\tconst url = `${getServiceMap().api}/web/projects/${params.projectId}/assets/screenshots/ab-tests/${params.abTestId}/${params.pageId ?? \"cover\"}.png`\n\tconst initWithAuthHeaders = await accessTokenRefresher.withAuthorizationHeader({})\n\tconst res = await fetch(url, initWithAuthHeaders)\n\tif (!res.ok) return\n\n\tconst blob = await res.blob()\n\treturn URL.createObjectURL(blob)\n}\n", "import \"ScreenshotDiff.styles_156o5w0.wyw.css\"; export const diffContainer = \"diffContainer_d149odwv\";\nexport const coverImageBorder = \"coverImageBorder_c1mq6zg9\";\nexport const variantCircle = \"variantCircle_v1m4xv4g\";\nexport const activeVariant = \"activeVariant_a170kqpr\";\nexport const coverImagePlaceholder = \"coverImagePlaceholder_c7ob20d\";", "import { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { FRAMER_VARIANT_KEY } from \"document/components/utils/siteParameters.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { FunnelStatus, convertPpmDistributionToPercentage } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport type { AbDistributionMode } from \"document/models/CanvasTree/nodes/abTestDistribution.ts\"\nimport { isFunnelNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { getSamplePathVariablesForCMSPage } from \"utils/collectionUtils.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { IconLinkFilledArrow } from \"../icons.tsx\"\nimport type { AbTestVariantMetrics } from \"../utils/fetchUtils.ts\"\nimport { formatNumberCommaSeparatorNotation, formatPercentage } from \"../utils/formatUtils.ts\"\nimport { getAbTestStats } from \"../utils/getAbTestStats.ts\"\nimport type { AbVariantWithMetrics } from \"../utils/useAbTestVariantsWithMetrics.ts\"\nimport { getVariantColorToken, getVariantDimmedColorToken } from \"../utils/variantColorToken.ts\"\nimport * as abTestStyles from \"./AbTestTable.styles.ts\"\n\nconst VariantTableRow = function VariantTableRow({\n\tid,\n\tname,\n\tmetrics,\n\tonVariantHover,\n\tvariantIndex,\n\tisWinner,\n\tisHovered,\n\tshouldLinkToVariants,\n\tabDistributionMode,\n\tdistributionPercentage,\n}: {\n\tid: NodeID\n\tname: string\n\tmetrics: AbTestVariantMetrics | undefined\n\tonVariantHover: (variant: string | null) => void\n\tvariantIndex: number\n\tisWinner: boolean\n\tisHovered: boolean\n\tshouldLinkToVariants: boolean\n\tabDistributionMode: AbDistributionMode\n\tdistributionPercentage?: number\n}) {\n\tconst variantPreviewUrl = useEngineState(\n\t\t() => {\n\t\t\tconst isDocumentLoaded = engine.stores.loadingStore.documentLoaded\n\t\t\tconst canonicalURL = engine.stores.publishStore.canonicalURL.url\n\t\t\tconst page = engine.tree.getNodeWithTrait(id, isWebPageNode)\n\t\t\tif (!shouldLinkToVariants || !isDocumentLoaded || !canonicalURL || !page) return\n\n\t\t\tconst samplePathVariables = hasCollectionDataSource(page)\n\t\t\t\t? getSamplePathVariablesForCMSPage(engine.tree, page)\n\t\t\t\t: undefined\n\n\t\t\tconst path = getWebPagePath(engine.tree, page, defaultLocaleId, samplePathVariables)\n\t\t\tif (!path) return\n\n\t\t\ttry {\n\t\t\t\tconst url = new URL(path, canonicalURL)\n\t\t\t\turl.searchParams.set(FRAMER_VARIANT_KEY, id)\n\t\t\t\treturn url.href\n\t\t\t} catch {}\n\t\t},\n\t\t[id, shouldLinkToVariants],\n\t\t[EngineChange.Tree, engine.stores.loadingStore, engine.stores.publishStore],\n\t)\n\n\tconst variantColor = getVariantColorToken(variantIndex)\n\tconst variantColorDimmed = getVariantDimmedColorToken(variantIndex)\n\n\tconst onVariantClick = useEngineCallback(() => {\n\t\tif (engine.tree.getNodeWithTrait(id, isWebPageNode)) {\n\t\t\tengine.stores.scopeStore.selectByNode(id)\n\t\t\tvoid engine.stores.analyticsStore.setActiveTab(null)\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: \"This page\",\n\t\t\t\tsecondaryText: \"doesn\u2019t exist.\",\n\t\t\t\tkey: \"page-variant-not-found\",\n\t\t\t\ticon: \"error\",\n\t\t\t\tduration: 2000,\n\t\t\t})\n\t\t}\n\t}, [id])\n\n\treturn (\n\t\t<tr\n\t\t\tonClick={onVariantClick}\n\t\t\tonMouseEnter={() => onVariantHover(id)}\n\t\t\tonMouseLeave={() => onVariantHover(null)}\n\t\t\tclassName={cx(isHovered && abTestStyles.hoveredRow)}\n\t\t>\n\t\t\t<td className={abTestStyles.variantNameColumn}>\n\t\t\t\t<div className={abTestStyles.variantCircle} style={{ backgroundColor: getVariantColorToken(variantIndex) }} />\n\t\t\t\t<span>{name}</span>\n\t\t\t\t{isWinner && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={abTestStyles.winnerBadge}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackgroundColor: variantColorDimmed,\n\t\t\t\t\t\t\tcolor: variantColor,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tWinner\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{variantPreviewUrl && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={variantPreviewUrl}\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\tclassName={abTestStyles.openVariantButton}\n\t\t\t\t\t\tonClick={e => e.stopPropagation()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconLinkFilledArrow />\n\t\t\t\t\t</a>\n\t\t\t\t)}\n\t\t\t</td>\n\t\t\t{abDistributionMode === \"custom\" && (\n\t\t\t\t<td className={abTestStyles.variantDataColumn}>\n\t\t\t\t\t{distributionPercentage ? `${distributionPercentage.toFixed(0)}%` : \"\u2014\"}\n\t\t\t\t</td>\n\t\t\t)}\n\t\t\t<td className={abTestStyles.variantDataColumn}>\n\t\t\t\t{metrics !== undefined ? formatNumberCommaSeparatorNotation(metrics.startCount) : \"\u2014\"}\n\t\t\t</td>\n\t\t\t<td className={abTestStyles.variantDataColumn}>\n\t\t\t\t{metrics !== undefined ? formatNumberCommaSeparatorNotation(metrics.finalCount) : \"\u2014\"}\n\t\t\t</td>\n\t\t\t<td className={abTestStyles.variantDataColumn}>\n\t\t\t\t{metrics?.conversionRate ? formatPercentage(metrics.conversionRate) : \"\u2014\"}\n\t\t\t</td>\n\t\t\t<td className={abTestStyles.variantDataColumn}>{metrics?.lift ? formatPercentage(metrics.lift) : \"\u2014\"}</td>\n\t\t\t<td className={abTestStyles.variantDataColumn}>\n\t\t\t\t{metrics?.probabilityOfBeingBest ? formatPercentage(metrics.probabilityOfBeingBest) : \"\u2014\"}\n\t\t\t</td>\n\t\t</tr>\n\t)\n}\n\nexport const AbTestTable = function AbTestTable({\n\tfunnelId,\n\tabVariantsWithMetrics,\n\tonVariantHover,\n\thoveredVariant,\n}: {\n\tfunnelId: NodeID\n\tabVariantsWithMetrics: readonly AbVariantWithMetrics[]\n\tonVariantHover: (variant: string | null) => void\n\thoveredVariant: string | null\n}) {\n\tconst funnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst shouldLinkToVariants = funnel?.status === FunnelStatus.Started\n\tconst abDistributionMode = funnel?.abDistributionMode ?? \"even\"\n\n\tconst stats = React.useMemo(() => getAbTestStats(abVariantsWithMetrics), [abVariantsWithMetrics])\n\tconst isWinner = React.useCallback(\n\t\t(variantId: NodeID) => stats?.best.abVariantId === variantId && stats.bestIsWinner,\n\t\t[stats],\n\t)\n\n\treturn (\n\t\t<table className={abTestStyles.abTestTable}>\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th className={abTestStyles.variantNameColumn}>Variant</th>\n\t\t\t\t\t{abDistributionMode === \"custom\" && <th className={abTestStyles.variantDataColumn}>Distribution</th>}\n\t\t\t\t\t<th className={abTestStyles.variantDataColumn}>Views</th>\n\t\t\t\t\t<th className={abTestStyles.variantDataColumn}>Events</th>\n\t\t\t\t\t<th className={abTestStyles.variantDataColumn}>Conversion</th>\n\t\t\t\t\t<th className={abTestStyles.variantDataColumn}>Lift</th>\n\t\t\t\t\t<th className={abTestStyles.variantDataColumn}>Best</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t{convertPpmDistributionToPercentage(abVariantsWithMetrics).map(variant => (\n\t\t\t\t\t<VariantTableRow\n\t\t\t\t\t\tkey={variant.id}\n\t\t\t\t\t\tid={variant.id}\n\t\t\t\t\t\tname={variant.name}\n\t\t\t\t\t\tmetrics={variant.metrics}\n\t\t\t\t\t\tabDistributionMode={abDistributionMode}\n\t\t\t\t\t\tdistributionPercentage={variant.percentage}\n\t\t\t\t\t\tonVariantHover={onVariantHover}\n\t\t\t\t\t\tvariantIndex={variant.index}\n\t\t\t\t\t\tisHovered={hoveredVariant === variant.id}\n\t\t\t\t\t\tisWinner={isWinner(variant.id)}\n\t\t\t\t\t\tshouldLinkToVariants={shouldLinkToVariants}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</tbody>\n\t\t</table>\n\t)\n}\n", "import \"AbTestTable.styles_1iuog8r.wyw.css\"; export const openVariantButton = \"openVariantButton_o1n5y4gd\";\nexport const abTestTable = \"abTestTable_a1oh2v9h\";\nexport const variantNameColumn = \"variantNameColumn_v1sv5m2z\";\nexport const variantDataColumn = \"variantDataColumn_v1759hvg\";\nexport const hoveredRow = \"hoveredRow_hcghmai\";\nexport const winnerBadge = \"winnerBadge_w1wkvcd5\";\nexport const variantCircle = \"variantCircle_v19tia76\";", "import { AddOnLicenseType, getAddOnLicenseTypeName, openNewTab } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { Button, Stack } from \"@framerjs/fresco\"\nimport { assert, assertNever, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\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 { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useCallback } from \"react\"\nimport { abTestArticleURL, enterpriseUpsellURL } from \"utils/staticURLs.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport {\n\tAnalyticsEventsUpsellAction,\n\ttype AnalyticsEventsUpsellResult,\n\tshowAnalyticsEventsUpsell,\n} from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { UpsellFeature } from \"../../siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport { IconAnalytics } from \"../icons.tsx\"\nimport { createFunnelStep } from \"../utils/createFunnelStep.ts\"\nimport { formatNumberCommaSeparatorNotation } from \"../utils/formatUtils.ts\"\nimport * as styles from \"./AnalyticsStateMessages.styles.ts\"\n\nexport function EmptyFunnelState({\n\tfunnelId,\n\tlearnMoreUrl,\n\t...props\n}: {\n\ttitle: string\n\tdescription: string\n\tlearnMoreUrl: string\n\tfunnelId: NodeID\n}) {\n\tconst funnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\tassert(funnel, \"Funnel node should be available\")\n\n\tconst isViewOnly = useIsViewOnly(\"canEditAnalytics\")\n\n\tconst onClick = useCallback(() => {\n\t\tcreateFunnelStep(funnel.id, \"click\")\n\t}, [funnel])\n\n\tconst onLearnMoreClick = useCallback(() => {\n\t\topenNewTab(learnMoreUrl)\n\t}, [learnMoreUrl])\n\n\treturn (\n\t\t<AnalyticsStateMessage\n\t\t\t{...props}\n\t\t\tisViewOnly={isViewOnly}\n\t\t\tprimaryText=\"Add Step\"\n\t\t\tonPrimaryClick={onClick}\n\t\t\tsecondaryText={Dictionary.LearnMore}\n\t\t\tonSecondaryClick={onLearnMoreClick}\n\t\t/>\n\t)\n}\n\nexport function AnalyticsEventsUpsellState({ upsell }: { upsell: AnalyticsEventsUpsellResult }) {\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\n\t// Instead of handling the upsell result, opens the plans page directly\n\tconst onUpgradePlanClick = useCallback(async () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: UpsellType.trackingEventsLimitUpsell,\n\t\t\tid: UpsellUIInteraction.confirmUpsell,\n\t\t})\n\t\tconst { project } = engine.stores.projectStore\n\t\tconst licenseTypes = project\n\t\t\t? {\n\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\tsite: project.license.type,\n\t\t\t\t\tteam: project.teamLicenseType,\n\t\t\t\t}\n\t\t\t: null\n\t\tif (licenseTypes) updatePurchaseOrigin(UpsellType.trackingEventsLimitUpsell, licenseTypes, null)\n\n\t\tengine.stores.siteSettingsStore\n\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.plans, upsellFeature: UpsellFeature.trackingEventsLimit })\n\t\t\t.catch(unhandledError)\n\t}, [updatePurchaseOrigin])\n\n\tconst onUpsellClick = useCallback(() => {\n\t\tshowAnalyticsEventsUpsell(engine, \"analytics_sidebar\")\n\t}, [])\n\n\tconst onContactUsClick = useCallback(() => {\n\t\topenNewTab(enterpriseUpsellURL)\n\t}, [])\n\n\tconst onLearnMoreClick = useCallback(() => {\n\t\topenNewTab(`${abTestArticleURL}#pricing`)\n\t}, [])\n\n\tswitch (upsell.action) {\n\t\tcase AnalyticsEventsUpsellAction.Upgrade:\n\t\t\treturn (\n\t\t\t\t<AnalyticsStateMessage\n\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\ttitle={getAddOnLicenseTypeName(AddOnLicenseType.AdvancedAnalytics)}\n\t\t\t\t\tdescription={`Upgrade your site and add the ${getAddOnLicenseTypeName(AddOnLicenseType.AdvancedAnalytics)} add-on to start improving your site with conversion funnels and A/B testing.`}\n\t\t\t\t\tonPrimaryClick={onUpgradePlanClick}\n\t\t\t\t\tprimaryText=\"Upgrade\"\n\t\t\t\t\tsecondaryText={Dictionary.LearnMore}\n\t\t\t\t\tonSecondaryClick={onLearnMoreClick}\n\t\t\t\t\tclassName={styles.upgradePlanSiteState}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase AnalyticsEventsUpsellAction.AddOn:\n\t\t\treturn upsell.trackingEventsLimit === 0 ? (\n\t\t\t\t<AnalyticsStateMessage\n\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\ttitle=\"Expired Subscription\"\n\t\t\t\t\tdescription=\"Reactivate the add-on to view your funnels and A/B Tests.\"\n\t\t\t\t\tprimaryText=\"Reactivate\"\n\t\t\t\t\tonPrimaryClick={onUpsellClick}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<AnalyticsStateMessage\n\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\ttitle=\"Over Limit\"\n\t\t\t\t\tdescription={`You\u2019ve had ${formatNumberCommaSeparatorNotation(upsell.eventsUsage)} analytics events in the past month. Please upgrade your add-on to increase your limits.`}\n\t\t\t\t\tprimaryText={`Upgrade ${Dictionary.AddOn}`}\n\t\t\t\t\tonPrimaryClick={onUpsellClick}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase AnalyticsEventsUpsellAction.Contact:\n\t\t\treturn (\n\t\t\t\t<AnalyticsStateMessage\n\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\tclassName={styles.upgradeUsageState}\n\t\t\t\t\ttitle=\"Over Limit\"\n\t\t\t\t\tdescription={`You\u2019ve had ${formatNumberCommaSeparatorNotation(upsell.eventsUsage)} analytics events in the past month. Please contact your account manager to increase your limits.`}\n\t\t\t\t\tprimaryText={Dictionary.ContactUs}\n\t\t\t\t\tonPrimaryClick={onContactUsClick}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase AnalyticsEventsUpsellAction.UpgradeToEnterprise:\n\t\t\treturn (\n\t\t\t\t<AnalyticsStateMessage\n\t\t\t\t\tisViewOnly={false}\n\t\t\t\t\tclassName={styles.upgradeUsageState}\n\t\t\t\t\ttitle=\"Over Limit\"\n\t\t\t\t\tdescription={`You\u2019ve had ${formatNumberCommaSeparatorNotation(upsell.eventsUsage)} analytics events in the past month. Upgrade to an Enterprise plan to increase your limit.`}\n\t\t\t\t\tprimaryText=\"Upgrade\"\n\t\t\t\t\tonPrimaryClick={onUpsellClick}\n\t\t\t\t/>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(upsell.action)\n\t}\n}\n\nconst AnalyticsStateMessage = React.memo(function AnalyticsState({\n\ttitle,\n\tdescription,\n\tisViewOnly,\n\tprimaryText,\n\tonPrimaryClick,\n\tsecondaryText,\n\tonSecondaryClick,\n\tclassName,\n}: {\n\ttitle: string\n\tdescription: string\n\tisViewOnly: boolean\n\tprimaryText: string\n\tonPrimaryClick: () => void\n\tsecondaryText?: string\n\tonSecondaryClick?: () => void\n\tclassName?: string\n}) {\n\treturn (\n\t\t<Stack gap={15} alignItems=\"center\" justifyContent=\"center\" className={cx(styles.emptyStateWrapper, className)}>\n\t\t\t<Stack alignItems=\"center\" justifyContent=\"center\" className={styles.emptyStateIconWrapper} padding={5}>\n\t\t\t\t<IconAnalytics />\n\t\t\t</Stack>\n\t\t\t<Stack gap={10}>\n\t\t\t\t<span className={styles.emptyStateTitle}>{title}</span>\n\t\t\t\t<span className={styles.emptyStateText}>{description}</span>\n\t\t\t</Stack>\n\t\t\t<Stack gap={10} className={styles.emptyStateButtonWrapper}>\n\t\t\t\t{primaryText && onPrimaryClick && (\n\t\t\t\t\t<Button variant=\"primary\" onClick={onPrimaryClick} enabled={!isViewOnly}>\n\t\t\t\t\t\t{primaryText}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t{secondaryText && onSecondaryClick && (\n\t\t\t\t\t<Button variant=\"default\" onClick={onSecondaryClick} enabled={!isViewOnly}>\n\t\t\t\t\t\t{secondaryText}\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { FunnelStepActionNode, type TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { FunnelStepNode } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\n\nexport const funnelStepPopoutId = (nodeId: NodeID) => `funnelStep-${nodeId}`\n\nexport const createFunnelStep = engine.scheduler.wrapHandler(\n\t(funnelId: NodeID, trackingEventType: TrackingEventType) => {\n\t\tif (!funnelId) return\n\t\tconst newStep = new FunnelStepNode()\n\t\tconst newTrackingEvent = new FunnelStepActionNode({ trackingEventType })\n\t\tnewStep.addChild(newTrackingEvent)\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(funnelStepPopoutId(newStep.id))\n\t\tengine.tree.insertNode(newStep, funnelId)\n\t\trecord(\"funnel_step_create\", { funnelId, stepId: newStep.id, eventType: trackingEventType, actionCount: 0 })\n\t},\n)\n", "import \"AnalyticsStateMessages.styles_vfpoam.wyw.css\"; export const emptyStateWrapper = \"emptyStateWrapper_egzx77u\";\nexport const emptyStateIconWrapper = \"emptyStateIconWrapper_evnjv2j\";\nexport const emptyStateTitle = \"emptyStateTitle_e17meeu4\";\nexport const emptyStateText = \"emptyStateText_ex0eorj\";\nexport const upgradeUsageState = \"upgradeUsageState_u1b1rvo4\";\nexport const upgradePlanSiteState = \"upgradePlanSiteState_unawtc8\";\nexport const emptyStateButtonWrapper = \"emptyStateButtonWrapper_e8fn6ha\";", "import { Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { tabularNumbers } from \"app/styles/typography.styles.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { FunnelNode } from \"document/models/CanvasTree/index.ts\"\nimport type { FunnelStepNode } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport { AnalyticsSummaryValue } from \"../section/AnalyticsSummaryValue.tsx\"\nimport * as analyticsStyles from \"../tabs/AnalyticsOverview.styles.ts\"\nimport { formatNumberCompactNotation, formatPercentage } from \"../utils/formatUtils.ts\"\nimport type { FunnelDropOffStep } from \"../utils/funnel-stats/getFunnelDropOffs.ts\"\nimport * as funnelStyles from \"./FunnelDropOffBars.styles.ts\"\n\nconst BAR_MAX_HEIGHT = 100 // px\nconst BAR_FILLED_MIN_HEIGHT = 2 // px\n\nconst FunnelStepDetails = React.memo(function FunnelStepDetails({\n\tstep,\n\tcount,\n\tretentionRate,\n\tmaxHeight,\n\tisLoading,\n\tshowPercentage = true,\n}: {\n\tstep: string\n\tmaxHeight: number\n\tcount: number\n\tretentionRate: number\n\tisLoading?: boolean\n\tshowPercentage?: boolean\n}) {\n\treturn (\n\t\t<Stack direction=\"column\" gap={15} justifyContent=\"space-between\" style={{ width: \"100%\" }}>\n\t\t\t<Stack direction=\"row\" gap={15} justifyContent=\"space-between\" style={{ width: \"100%\" }}>\n\t\t\t\t<AnalyticsSummaryValue\n\t\t\t\t\ttitle={step}\n\t\t\t\t\tvalue={count ? formatNumberCompactNotation(count) : \"\u2014\"}\n\t\t\t\t\tisLoading={!!isLoading}\n\t\t\t\t\tisEmpty={!count}\n\t\t\t\t/>\n\t\t\t\t{showPercentage && (\n\t\t\t\t\t<div className={cx(funnelStyles.funnelStepDropOff, tabularNumbers)}>{formatPercentage(retentionRate)}</div>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t\t<div className={funnelStyles.funnelBarWrapper}>\n\t\t\t\t<motion.div\n\t\t\t\t\tinitial={{ height: 0 }}\n\t\t\t\t\tanimate={{ height: `${maxHeight * 100}%` }}\n\t\t\t\t\ttransition={{ type: \"spring\", duration: 0.4, bounce: 0.2 }}\n\t\t\t\t\tclassName={funnelStyles.funnelBar}\n\t\t\t\t/>\n\t\t\t\t<motion.div\n\t\t\t\t\tinitial={{ height: 0 }}\n\t\t\t\t\tanimate={{\n\t\t\t\t\t\theight: retentionRate === 0 ? 0 : `max(${retentionRate * 100}%, ${BAR_FILLED_MIN_HEIGHT}px)`,\n\t\t\t\t\t}}\n\t\t\t\t\ttransition={{ type: \"spring\", duration: 0.4, bounce: 0.2 }}\n\t\t\t\t\tclassName={funnelStyles.funnelBarFill}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n})\n\ninterface FunnelDropOffBarsProps {\n\tnode: FunnelNode\n\tdropOffData?: readonly FunnelDropOffStep[]\n\tisLoading: boolean\n}\n\nexport const FunnelDropOffBars = React.memo(function FunnelDropOffBars({\n\tnode,\n\tdropOffData,\n\tisLoading,\n}: FunnelDropOffBarsProps) {\n\tlet previousRetentionRate = 1\n\tlet barHeight = BAR_MAX_HEIGHT\n\tconst loadingBarHeightDecrement = 0.8\n\n\treturn (\n\t\t<div className={funnelStyles.funnelSectionWrapper}>\n\t\t\t{node.children.map((step: FunnelStepNode, i) => {\n\t\t\t\tconst divider = node.children.length - 1 !== i && <div className={analyticsStyles.divider} />\n\n\t\t\t\tlet maxHeight: number\n\t\t\t\tlet count: number\n\t\t\t\tlet retentionRate: number\n\t\t\t\tlet showPercentage: boolean\n\n\t\t\t\tif (isLoading && !dropOffData) {\n\t\t\t\t\tmaxHeight = barHeight / 100\n\t\t\t\t\tbarHeight *= loadingBarHeightDecrement\n\t\t\t\t\tcount = 0\n\t\t\t\t\tretentionRate = 0\n\t\t\t\t\tshowPercentage = false\n\t\t\t\t} else {\n\t\t\t\t\tconst stepDropOff =\n\t\t\t\t\t\t// Ensure that all the steps have drop off data\n\t\t\t\t\t\tdropOffData?.length === node.children.length ? dropOffData[i] : undefined\n\n\t\t\t\t\tif (!stepDropOff || stepDropOff.count === 0) {\n\t\t\t\t\t\tmaxHeight = 1\n\t\t\t\t\t\tcount = 0\n\t\t\t\t\t\tretentionRate = 0\n\t\t\t\t\t\tshowPercentage = false\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst { count: dropOffCount, cumulativeDropOff } = stepDropOff\n\t\t\t\t\t\tmaxHeight = previousRetentionRate\n\t\t\t\t\t\tcount = dropOffCount\n\t\t\t\t\t\tretentionRate = cumulativeDropOff !== undefined ? 1 - cumulativeDropOff : 0\n\t\t\t\t\t\tpreviousRetentionRate = retentionRate\n\t\t\t\t\t\tshowPercentage = i !== 0\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<React.Fragment key={step.id}>\n\t\t\t\t\t\t<div className={funnelStyles.funnelStepWrapper}>\n\t\t\t\t\t\t\t<FunnelStepDetails\n\t\t\t\t\t\t\t\tstep={step.resolveValue(\"name\") || getDefaultName(engine.componentLoader, step)}\n\t\t\t\t\t\t\t\tcount={count}\n\t\t\t\t\t\t\t\tretentionRate={retentionRate}\n\t\t\t\t\t\t\t\tmaxHeight={maxHeight}\n\t\t\t\t\t\t\t\tshowPercentage={showPercentage}\n\t\t\t\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{divider}\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t)\n\t\t\t})}\n\t\t</div>\n\t)\n})\n", "import \"AnalyticsSummaryValue.styles_pvyosl.wyw.css\"; export const summaryValueContainer = \"summaryValueContainer_s1ljefj6\";\nexport const summarySectionTitle = \"summarySectionTitle_s14o0e6m\";\nexport const summaryValueWrapper = \"summaryValueWrapper_sanlofm\";\nexport const summarySectionValue = \"summarySectionValue_s1ia86oa\";\nexport const summarySectionValueEmpty = \"summarySectionValueEmpty_s1i3r86e\";\nexport const loadingPlaceholder = \"loadingPlaceholder_l4t3dw4\";\nexport const liveIndicatorWrapper = \"liveIndicatorWrapper_l1xlcdka\";\nexport const liveIndicatorDot = \"liveIndicatorDot_lbavmq5\";\nexport const liveIndicatorRing = \"liveIndicatorRing_l1buptf\";", "import { Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { tabularNumbers } from \"app/styles/typography.styles.ts\"\nimport { AnimatePresence, motion } from \"framer-motion\"\nimport { fadeTransition } from \"../utils/animations.ts\"\nimport * as styles from \"./AnalyticsSummaryValue.styles.ts\"\n\nfunction AnalyticsLiveIndicator() {\n\treturn (\n\t\t<div className={styles.liveIndicatorWrapper}>\n\t\t\t<div className={styles.liveIndicatorDot} />\n\t\t\t<motion.div\n\t\t\t\tclassName={styles.liveIndicatorRing}\n\t\t\t\tanimate={{\n\t\t\t\t\tscale: [0, 1, 4],\n\t\t\t\t\topacity: [0, 0.6, 0],\n\t\t\t\t}}\n\t\t\t\ttransition={{\n\t\t\t\t\tduration: 2,\n\t\t\t\t\trepeatDelay: 1,\n\t\t\t\t\trepeat: Infinity,\n\t\t\t\t\tease: \"easeOut\",\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport function AnalyticsSummaryValue({\n\ttitle,\n\tvalue,\n\tisLoading,\n\tshowLiveIndicator = false,\n\tisEmpty = false,\n}: {\n\ttitle: string\n\tvalue: number | string\n\tisLoading: boolean\n\tshowLiveIndicator?: boolean\n\tisEmpty?: boolean\n}) {\n\treturn (\n\t\t<Stack gap={5} className={styles.summaryValueContainer} shrink={1}>\n\t\t\t<Stack direction=\"row\" gap={5} alignItems=\"center\" className={styles.summarySectionTitle}>\n\t\t\t\t<span className={truncateWithEllipsis}>{title}</span> {showLiveIndicator && <AnalyticsLiveIndicator />}\n\t\t\t</Stack>\n\n\t\t\t<div className={styles.summaryValueWrapper}>\n\t\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tkey=\"loading\"\n\t\t\t\t\t\t\tclassName={styles.loadingPlaceholder}\n\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\ttransition={fadeTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tkey=\"value\"\n\t\t\t\t\t\t\tclassName={cx(isEmpty ? styles.summarySectionValueEmpty : styles.summarySectionValue, tabularNumbers)}\n\t\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t\t\ttransition={fadeTransition}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{value}\n\t\t\t\t\t\t</motion.span>\n\t\t\t\t\t)}\n\t\t\t\t</AnimatePresence>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n", "import \"FunnelDropOffBars.styles_pkj36f.wyw.css\"; export const funnelSectionWrapper = \"funnelSectionWrapper_fzdfzj5\";\nexport const funnelStepWrapper = \"funnelStepWrapper_fx30og5\";\nexport const funnelStepDropOff = \"funnelStepDropOff_f4u66ru\";\nexport const funnelBarWrapper = \"funnelBarWrapper_fd9k2j\";\nexport const funnelBar = \"funnelBar_f4udjtq\";\nexport const funnelBarFill = \"funnelBarFill_flt7qnb\";", "import { ScrollWithGradient, Stack } from \"@framerjs/fresco\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useInterval } from \"web/lib/useInterval.ts\"\nimport { useVisibleAndFocused } from \"web/lib/useVisibleAndFocused.ts\"\nimport { AnalyticsSelectedFilter } from \"../components/AnalyticsSelectedFilter.tsx\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport { AnalyticsTitle } from \"../components/AnalyticsTitle.tsx\"\nimport { DateRangePicker } from \"../components/DateRangePicker.tsx\"\nimport { DateRangePresets } from \"../components/DateRangePresets.tsx\"\nimport { IconPageOther } from \"../icons.tsx\"\nimport { AnalyticsDevicesSection } from \"../section/AnalyticsDevicesSection.tsx\"\nimport { AnalyticsGeographySection } from \"../section/AnalyticsGeographySection.tsx\"\nimport { AnalyticsPagesSection, normalizePagesData } from \"../section/AnalyticsPagesSection.tsx\"\nimport { AnalyticsSourcesSection } from \"../section/AnalyticsSourcesSection.tsx\"\nimport { AnalyticsSummaryValue } from \"../section/AnalyticsSummaryValue.tsx\"\nimport { AnalyticsTrackingIdsSection } from \"../section/AnalyticsTrackingIdsSection.tsx\"\nimport type {\n\tAnalyticsSectionFilter,\n\tAnalyticsSectionFilterOption,\n\tAnalyticsTableData,\n\tDevicesSectionKeys,\n\tGeographySectionKeys,\n\tPagesSectionKeys,\n\tSourcesSectionKeys,\n\tTrackingIdsSectionKeys,\n} from \"../types.ts\"\nimport type { DateRangePreset } from \"../utils/dateRangePreset.ts\"\nimport { filterLabels } from \"../utils/filters.ts\"\nimport { formatAverageSession, formatNumberCompactNotation, formatPercentage } from \"../utils/formatUtils.ts\"\nimport * as styles from \"./AnalyticsOverview.styles.ts\"\n\nconst AnalyticsChart = React.lazy(() => import(\"../section/AnalyticsChart.tsx\"))\n\nconst setPreset = (preset: DateRangePreset | undefined) => (engine.stores.analyticsStore.preset = preset)\nconst setFromDay = (fromDay: string) => (engine.stores.analyticsStore.fromDay = fromDay)\nconst setToDay = (toDay: string) => (engine.stores.analyticsStore.toDay = toDay)\nconst setSourcesSelectedFacet = (facet: SourcesSectionKeys) =>\n\t(engine.stores.analyticsStore.sourcesSelectedFacet = facet)\nconst setDevicesSelectedFacet = (facet: DevicesSectionKeys) =>\n\t(engine.stores.analyticsStore.devicesSelectedFacet = facet)\nconst setGeographySelectedFacet = (facet: GeographySectionKeys) =>\n\t(engine.stores.analyticsStore.geographySelectedFacet = facet)\nconst setPagesSelectedFacet = (facet: PagesSectionKeys) => (engine.stores.analyticsStore.pagesSelectedFacet = facet)\nconst setTrackingIdsSelectedFacet = (facet: TrackingIdsSectionKeys) =>\n\t(engine.stores.analyticsStore.trackingIdsSelectedFacet = facet)\n\nexport const AnalyticsOverview = React.memo(function AnalyticsOverview() {\n\tconst { preset, fromDay, toDay, minDay, maxDay, filters, ...data } = engine.stores.analyticsStore.useState()\n\n\tconst isFilteredByTrackingId = Boolean(filters.trackingId)\n\tconst isFilteredByPage = Boolean(filters.pathname || filters.routePath)\n\n\tconst [isVisibleAndFocused, setIsVisibleAndFocused] = React.useState(true)\n\tuseVisibleAndFocused(setIsVisibleAndFocused)\n\tuseInterval(() => void engine.stores.analyticsStore.fetchLiveVisitors(), isVisibleAndFocused ? 15_000 : null)\n\n\tconst filterNodes = React.useMemo(() => {\n\t\tconst nodes: React.ReactNode[] = []\n\t\tlet key: AnalyticsSectionFilterOption\n\t\tfor (key in filters) {\n\t\t\tconst filter = filters[key]\n\t\t\tif (!filter) continue\n\t\t\tnodes.push(\n\t\t\t\t<AnalyticsSelectedFilter\n\t\t\t\t\tkey={key}\n\t\t\t\t\tlabel={filterLabels[key]}\n\t\t\t\t\tvalue={filter.valueLabel}\n\t\t\t\t\tonRemove={() => {\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tpage: Pages.analyticsOverview,\n\t\t\t\t\t\t\tid: UIInteraction.removeFilter,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tengine.stores.analyticsStore.removeFilter(key)\n\t\t\t\t\t}}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\t\treturn nodes\n\t}, [filters])\n\n\tconst liveVisitors = (data.liveVisitors ?? 0).toString()\n\tconst totalUniques = formatNumberCompactNotation(data.siteStats?.totalUniques ?? 0)\n\tconst totalPageviews = formatNumberCompactNotation(data.siteStats?.totalPageviews ?? 0)\n\tconst bounceRate = formatPercentage(data.session?.bounceRate ?? null)\n\tconst averageSession = formatAverageSession(data.session?.avgTimeOnPageSeconds ?? null)\n\n\t// When filtering by route path or collection item ID,\n\t// show custom placeholder sections, because otherwise\n\t// the filtered pathnames may be wrong\n\tconst pagesSection: JSX.Element = (() => {\n\t\tif (filters.routePath) {\n\t\t\treturn (\n\t\t\t\t<AnalyticsRoutePathSection\n\t\t\t\t\tisLoading={data.siteStatsLoading}\n\t\t\t\t\ttotalNumberOfVisits={data.siteStats?.totalUniques}\n\t\t\t\t\troutePath={filters.routePath}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t\tif (filters.collectionItemId) {\n\t\t\treturn (\n\t\t\t\t<AnalyticsCollectionItemSection\n\t\t\t\t\tisLoading={data.siteStatsLoading}\n\t\t\t\t\ttotalNumberOfVisits={data.siteStats?.totalUniques}\n\t\t\t\t\tcollectionItemId={filters.collectionItemId}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<AnalyticsPagesSection\n\t\t\t\tdata={data.pages}\n\t\t\t\tisLoading={data.pagesLoading}\n\t\t\t\tonAddFilter={addAnalyticsFilter}\n\t\t\t\tselectedFacet={\n\t\t\t\t\tisFilteredByTrackingId && (data.pagesSelectedFacet === \"entryPage\" || data.pagesSelectedFacet === \"exitPage\")\n\t\t\t\t\t\t? \"pathname\"\n\t\t\t\t\t\t: data.pagesSelectedFacet\n\t\t\t\t}\n\t\t\t\tonChangeFacet={setPagesSelectedFacet}\n\t\t\t\thideEntryExit={isFilteredByTrackingId}\n\t\t\t/>\n\t\t)\n\t})()\n\n\treturn (\n\t\t<Stack gap={30} className={styles.container}>\n\t\t\t<div className={styles.headerWrapper}>\n\t\t\t\t<AnalyticsTitle title={Dictionary.Analytics} />\n\n\t\t\t\t{filterNodes.length > 0 && (\n\t\t\t\t\t<div className={styles.scrollWrapper}>\n\t\t\t\t\t\t<ScrollWithGradient\n\t\t\t\t\t\t\tclassName={styles.selectedFiltersWrapper}\n\t\t\t\t\t\t\torientation=\"horizontal\"\n\t\t\t\t\t\t\tdirection=\"both\"\n\t\t\t\t\t\t\tdragToScroll\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{filterNodes}\n\t\t\t\t\t\t</ScrollWithGradient>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\n\t\t\t\t<div className={styles.dateRangeWrapper}>\n\t\t\t\t\t<DateRangePresets preset={preset} onSelectPreset={setPreset} />\n\t\t\t\t\t<DateRangePicker\n\t\t\t\t\t\tfromDay={fromDay}\n\t\t\t\t\t\tfromDayOnChange={setFromDay}\n\t\t\t\t\t\tfromDayMin={minDay}\n\t\t\t\t\t\tfromDayMax={toDay}\n\t\t\t\t\t\ttoDay={toDay}\n\t\t\t\t\t\ttoDayOnChange={setToDay}\n\t\t\t\t\t\ttoDayMin={fromDay}\n\t\t\t\t\t\ttoDayMax={maxDay}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div className={styles.summarySectionWrapper}>\n\t\t\t\t<AnalyticsSummaryValue\n\t\t\t\t\ttitle=\"Live Visitors\"\n\t\t\t\t\tvalue={liveVisitors}\n\t\t\t\t\tisLoading={data.liveVisitorsLoading}\n\t\t\t\t\tshowLiveIndicator\n\t\t\t\t/>\n\t\t\t\t<AnalyticsSummaryValue title=\"Unique Visitors\" value={totalUniques} isLoading={data.siteStatsLoading} />\n\t\t\t\t<AnalyticsSummaryValue\n\t\t\t\t\ttitle=\"Total Pageviews\"\n\t\t\t\t\tvalue={isFilteredByTrackingId ? \"\u2014\" : totalPageviews}\n\t\t\t\t\tisLoading={!isFilteredByTrackingId && data.siteStatsLoading}\n\t\t\t\t\tisEmpty={isFilteredByTrackingId}\n\t\t\t\t/>\n\t\t\t\t<AnalyticsSummaryValue\n\t\t\t\t\ttitle=\"Bounce Rate\"\n\t\t\t\t\tvalue={isFilteredByTrackingId ? \"\u2014\" : bounceRate}\n\t\t\t\t\tisLoading={!isFilteredByTrackingId && data.sessionLoading}\n\t\t\t\t\tisEmpty={isFilteredByTrackingId}\n\t\t\t\t/>\n\t\t\t\t<AnalyticsSummaryValue\n\t\t\t\t\ttitle={isFilteredByPage ? \"Time on Page\" : \"Average Session\"}\n\t\t\t\t\tvalue={isFilteredByTrackingId ? \"\u2014\" : averageSession}\n\t\t\t\t\tisLoading={!isFilteredByTrackingId && data.sessionLoading}\n\t\t\t\t\tisEmpty={isFilteredByTrackingId}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className={styles.chartSectionWrapper}>\n\t\t\t\t<React.Suspense fallback={null}>\n\t\t\t\t\t<AnalyticsChart\n\t\t\t\t\t\tfromDay={data.siteStats?.fromDay ?? fromDay}\n\t\t\t\t\t\ttoDay={data.siteStats?.toDay ?? toDay}\n\t\t\t\t\t\tvisitors={data.siteStats?.stats ?? []}\n\t\t\t\t\t\tisLoading={data.siteStatsLoading}\n\t\t\t\t\t\tshowPageviews={!isFilteredByTrackingId}\n\t\t\t\t\t/>\n\t\t\t\t</React.Suspense>\n\t\t\t</div>\n\t\t\t<div className={styles.splitSectionWrapper}>\n\t\t\t\t<AnalyticsSourcesSection\n\t\t\t\t\tdata={data.sources}\n\t\t\t\t\tisLoading={data.sourcesLoading}\n\t\t\t\t\tonAddFilter={addAnalyticsFilter}\n\t\t\t\t\tselectedFacet={data.sourcesSelectedFacet}\n\t\t\t\t\tonChangeFacet={setSourcesSelectedFacet}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.divider} />\n\t\t\t\t{pagesSection}\n\t\t\t</div>\n\t\t\t<div className={styles.splitSectionWrapper}>\n\t\t\t\t<AnalyticsGeographySection\n\t\t\t\t\tdata={data.geography}\n\t\t\t\t\tisLoading={data.geographyLoading}\n\t\t\t\t\tonAddFilter={addAnalyticsFilter}\n\t\t\t\t\tselectedFacet={data.geographySelectedFacet}\n\t\t\t\t\tonChangeFacet={setGeographySelectedFacet}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.divider} />\n\t\t\t\t<AnalyticsDevicesSection\n\t\t\t\t\tdata={data.devices}\n\t\t\t\t\tisLoading={data.devicesLoading}\n\t\t\t\t\tonAddFilter={addAnalyticsFilter}\n\t\t\t\t\tselectedFacet={data.devicesSelectedFacet}\n\t\t\t\t\tonChangeFacet={setDevicesSelectedFacet}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className={styles.splitSectionWrapper}>\n\t\t\t\t<AnalyticsTrackingIdsSection\n\t\t\t\t\tdata={data.trackingIds}\n\t\t\t\t\tisLoading={data.trackingIdsLoading}\n\t\t\t\t\tonAddFilter={addAnalyticsFilter}\n\t\t\t\t\tselectedFacet={data.trackingIdsSelectedFacet}\n\t\t\t\t\tonChangeFacet={setTrackingIdsSelectedFacet}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n})\n\nfunction addAnalyticsFilter(key: AnalyticsSectionFilterOption, value: string, valueLabel: string) {\n\trecord(\"ui_interaction\", {\n\t\tpage: Pages.analyticsOverview,\n\t\tid: UIInteraction.addFilter,\n\t})\n\tengine.stores.analyticsStore.addFilter(key, value, valueLabel)\n}\n\nfunction AnalyticsRoutePathSection({\n\tisLoading,\n\ttotalNumberOfVisits,\n\troutePath,\n}: {\n\tisLoading: boolean\n\ttotalNumberOfVisits: number | undefined\n\troutePath: AnalyticsSectionFilter\n}) {\n\tconst canonicalURL = engine.stores.publishStore.useState(state => state.canonicalURL.url)\n\tconst placeholderData: readonly AnalyticsTableData[] = React.useMemo(() => {\n\t\treturn normalizePagesData(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tvalue: routePath.value,\n\t\t\t\t\tcount: totalNumberOfVisits ?? 0,\n\t\t\t\t\tpercentage: 100,\n\t\t\t\t},\n\t\t\t],\n\t\t\tcanonicalURL,\n\t\t)\n\t}, [canonicalURL, routePath, totalNumberOfVisits])\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle={Dictionary.Pages}\n\t\t\tdata={placeholderData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter=\"routePath\"\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={noop}\n\t\t/>\n\t)\n}\n\nfunction AnalyticsCollectionItemSection({\n\tisLoading,\n\ttotalNumberOfVisits,\n\tcollectionItemId,\n}: {\n\tisLoading: boolean\n\ttotalNumberOfVisits: number | undefined\n\tcollectionItemId: AnalyticsSectionFilter\n}) {\n\tconst canonicalURL = engine.stores.publishStore.useState(state => state.canonicalURL.url)\n\n\tconst placeholderData: readonly AnalyticsTableData[] = React.useMemo(() => {\n\t\tconst collectionItem = engine.tree.getNodeWithTrait(collectionItemId.value, isCollectionItemNode)\n\t\tconst collection = engine.tree.getNodeWithTrait(collectionItem?.parentid, isCollectionNode)\n\t\tconst associatedWebPageNode = engine.stores.scopeStore\n\t\t\t.getWebPageNodes()\n\t\t\t.find(node => collection && node.dataIdentifier === collection.instanceIdentifier)\n\n\t\tlet href: string | undefined\n\t\tif (collectionItem && collection && associatedWebPageNode) {\n\t\t\t// Find the slug variable in the collection\n\t\t\tconst slugVariable = collection.getSlugVariable()\n\t\t\tif (slugVariable) {\n\t\t\t\t// Get the slug value from the collection item\n\t\t\t\tconst slugControlProp = collectionItem.getControlProp(slugVariable.id)\n\t\t\t\tif (slugControlProp?.type === \"string\" && isString(slugControlProp.value)) {\n\t\t\t\t\t// Construct the page path with the slug\n\t\t\t\t\tconst pagePath = getWebPagePath(\n\t\t\t\t\t\tengine.tree,\n\t\t\t\t\t\tassociatedWebPageNode,\n\t\t\t\t\t\tdefaultLocaleId,\n\t\t\t\t\t\t{ [slugVariable.id]: slugControlProp.value },\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t)\n\t\t\t\t\tif (pagePath && canonicalURL) {\n\t\t\t\t\t\thref = canonicalURL + pagePath\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: collectionItemId.valueLabel,\n\t\t\t\tfilterValue: collectionItemId.value,\n\t\t\t\tcount: totalNumberOfVisits ?? 0,\n\t\t\t\tpercentage: 100,\n\t\t\t\thref,\n\t\t\t\ticon: <IconPageOther />,\n\t\t\t},\n\t\t]\n\t}, [collectionItemId, totalNumberOfVisits, canonicalURL])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle={Dictionary.Cms}\n\t\t\tdata={placeholderData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter=\"collectionItemId\"\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={noop}\n\t\t/>\n\t)\n}\n", "import { useEffect, useRef } from \"react\"\n\ntype Callback = () => void\n\nexport function useInterval(callback: Callback, delay: number | null) {\n\tconst savedCallback = useRef<Callback | null>(null)\n\n\tuseEffect(() => {\n\t\tsavedCallback.current = callback\n\t}, [callback])\n\n\tuseEffect(() => {\n\t\tfunction tick() {\n\t\t\tsavedCallback.current?.()\n\t\t}\n\t\tif (delay !== null) {\n\t\t\tconst id = setInterval(tick, delay)\n\t\t\treturn () => clearInterval(id)\n\t\t}\n\t}, [delay])\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { useRef, useState } from \"react\"\nimport { getDayAsMidnightLocal } from \"../utils/getDayAsMidnightLocal.ts\"\nimport * as styles from \"./DateRangePicker.styles.ts\"\n\n/**\n * All dates are \"yyyy-MM-dd\" strings.\n */\ninterface Props {\n\tfromDay: string\n\tfromDayOnChange: (date: string) => void\n\tfromDayMin?: string\n\tfromDayMax?: string\n\n\ttoDay: string\n\ttoDayOnChange: (date: string) => void\n\ttoDayMin?: string\n\ttoDayMax?: string\n}\n\n/**\n * Date-range picker which pretends to be a single \"input\" on desktop. You pick the \"from\" part by clicking on the left\n * side of the picker, and the \"to\" part by clicking on the right side.\n *\n * We achieve this (see {@link DatePicker}) by using an invisible date input positioned exactly under the respective hot\n * area, and triggering the picker programmatically via showPicker. In Safari < 17.4, which doesn't support showPicker\n * for date inputs, we instead make the invisible input respond to pointer events, which means when you attempt to click\n * the hot area, you'll actually click the input, which will then show the picker.\n *\n * On mobile, we instead render two regular-looking date inputs.\n */\nexport function DateRangePicker({\n\tfromDay,\n\tfromDayOnChange,\n\tfromDayMin,\n\tfromDayMax,\n\ttoDay,\n\ttoDayOnChange,\n\ttoDayMin,\n\ttoDayMax,\n}: Props) {\n\treturn (\n\t\t<div className={styles.dateRangePicker}>\n\t\t\t<DatePicker\n\t\t\t\tvalue={fromDay}\n\t\t\t\tonChange={fromDayOnChange}\n\t\t\t\tmin={fromDayMin}\n\t\t\t\tmax={fromDayMax}\n\t\t\t\tclassName={styles.fromPicker}\n\t\t\t/>\n\t\t\t<div className={styles.separatorDash}>{\" \u2014 \"}</div>\n\t\t\t<ArrowIcon className={styles.separatorArrow} />\n\t\t\t<DatePicker value={toDay} onChange={toDayOnChange} min={toDayMin} max={toDayMax} className={styles.toPicker} />\n\t\t</div>\n\t)\n}\n\nconst hasShowPicker = \"showPicker\" in HTMLInputElement.prototype\n\ninterface DatePickerProps {\n\tvalue: string\n\tonChange: (date: string) => void\n\tmin?: string\n\tmax?: string\n\tclassName?: string\n}\n\nfunction DatePicker({ value, onChange, min, max, className }: DatePickerProps) {\n\t// Capture the initial value as the default value.\n\tconst [defaultValue] = useState(value)\n\n\tconst ref = useRef<HTMLInputElement>(null)\n\n\tconst showPicker = () => {\n\t\t// iOS Safari requires the input to be focused for showPicker to work.\n\t\tref.current?.focus()\n\t\tref.current?.showPicker()\n\t}\n\n\treturn (\n\t\t<div className={cx(styles.datePicker, className)} onClick={hasShowPicker ? showPicker : undefined}>\n\t\t\t<input\n\t\t\t\tref={ref}\n\t\t\t\ttype=\"date\"\n\t\t\t\tclassName={cx(styles.datePickerInput, hasShowPicker && styles.datePickerInputWithShowPicker)}\n\t\t\t\tvalue={value}\n\t\t\t\t// e.target.value will be an empty string if user chooses the \"clear\" option in the picker, in which\n\t\t\t\t// case we'll \"clear\" it back to the default value.\n\t\t\t\tonChange={e => onChange(e.target.value || defaultValue)}\n\t\t\t\t// The input is invisible, but still receives focus and thus can be typed into, so let's prevent that.\n\t\t\t\tonKeyDown={e => e.preventDefault()}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t/>\n\t\t\t<Stack direction=\"row\" alignItems=\"center\" className={styles.datePickerLabel}>\n\t\t\t\t<DatePickerIcon />\n\t\t\t\t{getDayAsMidnightLocal(value).toLocaleDateString(\"en-US\", { month: \"short\", day: \"numeric\" })}\n\t\t\t</Stack>\n\t\t</div>\n\t)\n}\n\nfunction DatePickerIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" className={styles.datePickerIcon}>\n\t\t\t<path fill=\"currentColor\" d=\"M2 4a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2H2Z\" opacity=\".3\" />\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=\"M2.25 4.25a2 2 0 0 1 2-2h5.5a2 2 0 0 1 2 2v5.5a2 2 0 0 1-2 2h-5.5a2 2 0 0 1-2-2ZM2 5.75h9.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction ArrowIcon({ className }: { className?: string }) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" className={className}>\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=\"m6.5 10 4-4-3-3-1-1M10 6H1.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"DateRangePicker.styles_1eg5dkj.wyw.css\"; export const dateRangePicker = \"dateRangePicker_d3mhsir\";\nexport const separatorDash = \"separatorDash_sget8z4\";\nexport const separatorArrow = \"separatorArrow_s1smn7ai\";\nexport const datePicker = \"datePicker_d1rhv2qg\";\nexport const fromPicker = \"fromPicker_f123k1z2\";\nexport const toPicker = \"toPicker_tbo7zlk\";\nexport const datePickerInput = \"datePickerInput_d1sw40kv\";\nexport const datePickerInputWithShowPicker = \"datePickerInputWithShowPicker_d12vm52s\";\nexport const datePickerIcon = \"datePickerIcon_d1i932dq\";\nexport const datePickerLabel = \"datePickerLabel_d1wr9cis\";", "import type { MenuItemOptions } from \"app/menu.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useMemo } from \"react\"\nimport type { DateRangePreset } from \"../utils/dateRangePreset.ts\"\nimport { dateRangePresets } from \"../utils/dateRangePreset.ts\"\nimport * as styles from \"./DateRangePresets.styles.ts\"\nimport { DropdownMenuButton } from \"./DropdownMenuButton.tsx\"\n\ninterface Props {\n\tpreset: DateRangePreset | undefined\n\tonSelectPreset: (preset: DateRangePreset) => void\n}\n\nconst defaultAnalyticsRangeInDays = 30\n\nexport function DateRangePresets({ preset, onSelectPreset }: Props) {\n\tconst analyticsRangeInDays = engine.stores.projectStore.useState(state => state.resourceLimits?.analyticsRangeInDays)\n\n\tconst items = useMemo(() => {\n\t\tconst items: MenuItemOptions[] = []\n\t\tconst effectiveRange =\n\t\t\tanalyticsRangeInDays === null ? Infinity : (analyticsRangeInDays ?? defaultAnalyticsRangeInDays)\n\n\t\tfor (const [label, days] of Object.entries(dateRangePresets)) {\n\t\t\tconst isUpsell = days > effectiveRange\n\n\t\t\titems.push({\n\t\t\t\tlabel,\n\t\t\t\tbadge: isUpsell ? \"Upgrade\" : undefined,\n\t\t\t\tbadgeClassName: isUpsell ? styles.upgradeBadge : undefined,\n\t\t\t\tclick: isUpsell\n\t\t\t\t\t? () => {\n\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\tsource: \"analytics_overview\",\n\t\t\t\t\t\t\t\ttype: ModalType.UpsellFeature,\n\t\t\t\t\t\t\t\tupsellFeature: UpsellFeature.analyticsRangeInDays,\n\t\t\t\t\t\t\t\ttitle: \"Extended History\",\n\t\t\t\t\t\t\t\tdescription: \"Upgrade your site to access extended analytics history and higher limits.\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t: () => onSelectPreset(label as DateRangePreset),\n\t\t\t})\n\t\t}\n\t\treturn items\n\t}, [analyticsRangeInDays, onSelectPreset])\n\n\treturn <DropdownMenuButton label={preset ?? \"Custom\"} items={items} className={styles.dateRangePresets} />\n}\n", "import \"DateRangePresets.styles_18erwvt.wyw.css\"; export const dateRangePresets = \"dateRangePresets_d1uvn2m0\";\nexport const upgradeBadge = \"upgradeBadge_ua6twwg\";", "import { Dictionary } from \"app/dictionary.ts\"\nimport { defaultDevicesFacet } from \"document/stores/AnalyticsStore.ts\"\nimport React from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport type { SectionOptions } from \"../components/SectionPicker.tsx\"\nimport { SectionPicker } from \"../components/SectionPicker.tsx\"\nimport {\n\tIconAndroid,\n\tIconDesktop,\n\tIconIos,\n\tIconLinux,\n\tIconMacOs,\n\tIconMobile,\n\tIconOtherBrowser,\n\tIconOtherDevice,\n\tIconTablet,\n\tIconWindows,\n} from \"../icons.tsx\"\nimport iconChrome from \"../images/icon-chrome.png\"\nimport iconEdge from \"../images/icon-edge.png\"\nimport iconFirefox from \"../images/icon-firefox.png\"\nimport iconIE from \"../images/icon-ie.png\"\nimport iconOpera from \"../images/icon-opera.png\"\nimport iconSafari from \"../images/icon-safari.png\"\nimport type {\n\tAnalyticsTableData,\n\tDevicesData,\n\tDevicesSectionKeys,\n\tFacetedAnalyticsSectionProps,\n\tTopFieldRow,\n} from \"../types.ts\"\n\nconst sectionOptions: SectionOptions<DevicesSectionKeys> = [\n\t[Dictionary.Type, \"device\"],\n\t[\"Browser\", \"browser\"],\n\t[\"OS\", \"os\"],\n]\n\nconst placeholders: Record<DevicesSectionKeys, { value: string; count?: number; percentage?: number }[]> = {\n\tdevice: [{ value: \"desktop\" }, { value: \"mobile\" }, { value: \"tablet\" }, { value: \"other\" }],\n\tbrowser: [\n\t\t{ value: \"chrome\" },\n\t\t{ value: \"firefox\" },\n\t\t{ value: \"edge\" },\n\t\t{ value: \"safari\" },\n\t\t{ value: \"ie\" },\n\t\t{ value: \"opera\" },\n\t\t{ value: \"other\" },\n\t],\n\tos: [{ value: \"windows\" }, { value: \"macos\" }, { value: \"ios\" }, { value: \"android\" }, { value: \"linux\" }],\n}\n\nconst specialCasedNames: Record<string, string> = {\n\tie: \"Internet Explorer\",\n\tios: \"iOS\",\n\tmacos: \"macOS\",\n}\n\nconst BrowserIcon = ({ altText, iconPath }: { altText: string; iconPath: string }) => {\n\treturn (\n\t\t<img src={iconPath} alt={altText} width={12} height={12} style={{ verticalAlign: \"middle\" }} decoding=\"async\" />\n\t)\n}\n\nconst icons: Record<DevicesSectionKeys, Record<string, React.ReactElement>> = {\n\tdevice: {\n\t\tmobile: <IconMobile />,\n\t\tdesktop: <IconDesktop />,\n\t\ttablet: <IconTablet />,\n\t\tother: <IconOtherDevice />,\n\t},\n\tbrowser: {\n\t\tchrome: <BrowserIcon altText=\"Chrome\" iconPath={iconChrome} />,\n\t\tfirefox: <BrowserIcon altText=\"Firefox\" iconPath={iconFirefox} />,\n\t\tsafari: <BrowserIcon altText=\"Safari\" iconPath={iconSafari} />,\n\t\tedge: <BrowserIcon altText=\"Edge\" iconPath={iconEdge} />,\n\t\topera: <BrowserIcon altText=\"Opera\" iconPath={iconOpera} />,\n\t\tie: <BrowserIcon altText=\"IE\" iconPath={iconIE} />,\n\t\tother: <IconOtherBrowser />,\n\t},\n\tos: {\n\t\tios: <IconIos />,\n\t\tmacos: <IconMacOs />,\n\t\tandroid: <IconAndroid />,\n\t\twindows: <IconWindows />,\n\t\tlinux: <IconLinux />,\n\t\tother: <IconOtherDevice />,\n\t},\n}\n\nfunction normalizeData(dataResponse: TopFieldRow[] | undefined, dataFacet: DevicesSectionKeys) {\n\tconst data = dataResponse?.length ? dataResponse : placeholders[dataFacet]\n\treturn data.map(({ value, count, percentage }): AnalyticsTableData => {\n\t\treturn {\n\t\t\tname: specialCasedNames[value] || capitalizeFirstLetter(value),\n\t\t\tfilterValue: value,\n\t\t\ticon: icons[dataFacet][value],\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t}\n\t})\n}\n\nexport const AnalyticsDevicesSection = React.memo(function AnalyticsDevicesSection({\n\tdata,\n\tisLoading,\n\tonAddFilter,\n\tselectedFacet,\n\tonChangeFacet,\n}: FacetedAnalyticsSectionProps<DevicesSectionKeys, DevicesData>) {\n\tconst normalizedData = React.useMemo(() => {\n\t\treturn normalizeData(data?.data, data?.facet ?? defaultDevicesFacet)\n\t}, [data])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle=\"Devices\"\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter={data?.facet ?? defaultDevicesFacet}\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={onAddFilter}\n\t\t\taction={\n\t\t\t\t<SectionPicker<DevicesSectionKeys>\n\t\t\t\t\tenabled={true}\n\t\t\t\t\tselectedSection={selectedFacet}\n\t\t\t\t\tonChangeSection={onChangeFacet}\n\t\t\t\t\tsectionOptions={sectionOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t)\n})\n", "import { CustomButton, IconInputDropdown, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { motion } from \"framer-motion\"\nimport React from \"react\"\nimport * as styles from \"../tabs/AnalyticsOverview.styles.ts\"\n\nexport type SectionOptions<T extends string> = [label: string, value: T | SectionOptions<T>][]\n\n// We have to cast to preserve the generic type.\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37087#issuecomment-656596623\nexport const SectionPicker = React.memo(SectionPickerInner) as typeof SectionPickerInner\n\nfunction SectionPickerInner<T extends string>({\n\tenabled = true,\n\tselectedSection,\n\tonChangeSection,\n\tsectionOptions,\n}: {\n\tenabled: boolean\n\tselectedSection: T\n\tonChangeSection: (section: T) => void\n\tsectionOptions: SectionOptions<T>\n}) {\n\treturn (\n\t\t<Stack direction=\"row\" style={{ position: \"relative\" }}>\n\t\t\t<CustomButton\n\t\t\t\tclassName={styles.sectionFilterButton}\n\t\t\t\tas={motion.button}\n\t\t\t\tvariant=\"link\"\n\t\t\t\tenabled={enabled}\n\t\t\t\tonClick={async (e: React.MouseEvent<HTMLElement>) => {\n\t\t\t\t\tconst elementBounds = e.currentTarget.getBoundingClientRect()\n\n\t\t\t\t\tengine.stores.contextMenuStore.show(buildMenu(sectionOptions), {\n\t\t\t\t\t\tlocation: { x: elementBounds.right, y: elementBounds.bottom },\n\t\t\t\t\t\tplacement: \"bottom-end\",\n\t\t\t\t\t\tonSelect: (_, selected) => {\n\t\t\t\t\t\t\tonChangeSection(selected.key as 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\t\t<T>{getSelectedSectionLabel(selectedSection, sectionOptions) ?? \"\"}</T>\n\t\t\t\t<IconInputDropdown />\n\t\t\t</CustomButton>\n\t\t</Stack>\n\t)\n}\n\nfunction buildMenu<T extends string>(sectionOptions: SectionOptions<T>): MenuItemOptions[] {\n\tconst menu: MenuItemOptions[] = []\n\tfor (const [label, value] of sectionOptions) {\n\t\tif (typeof value === \"string\") {\n\t\t\tmenu.push({ label, key: value })\n\t\t} else {\n\t\t\tmenu.push({ label, submenu: buildMenu(value) })\n\t\t}\n\t}\n\treturn menu\n}\n\nfunction getSelectedSectionLabel<T extends string>(\n\tselectedSection: T,\n\tsectionOptions: SectionOptions<T>,\n): string | undefined {\n\tfor (const [label, value] of sectionOptions) {\n\t\tif (typeof value === \"string\") {\n\t\t\tif (value === selectedSection) return label\n\t\t} else {\n\t\t\tconst subLabel = getSelectedSectionLabel(selectedSection, value)\n\t\t\tif (subLabel) return `${label} ${subLabel}`\n\t\t}\n\t}\n}\n", "import { Emoji, T } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { defaultGeographyFacet } from \"document/stores/AnalyticsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { getNameForLocaleCode } from \"utils/getNameForLocaleCode.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getFlagEmojiForLocaleCode } from \"../../shared/getFlagEmojiForLocaleCode.ts\"\nimport { parseLocaleLanguageAndRegion } from \"../../shared/locales.ts\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport { CreateLocaleButton } from \"../components/CreateLocaleButton.tsx\"\nimport type { SectionOptions } from \"../components/SectionPicker.tsx\"\nimport { SectionPicker } from \"../components/SectionPicker.tsx\"\nimport { ViewLocaleButton } from \"../components/ViewLocaleButton.tsx\"\nimport { IconGlobe } from \"../icons.tsx\"\nimport * as styles from \"../tabs/AnalyticsOverview.styles.ts\"\nimport type {\n\tAnalyticsTableData,\n\tFacetedAnalyticsSectionProps,\n\tGeographyData,\n\tGeographySectionKeys,\n\tTopFieldRow,\n} from \"../types.ts\"\n\nconst defaultOptions: SectionOptions<GeographySectionKeys> = [\n\t[\"Countries\", \"countryCode\"],\n\t[\"System Languages\", \"locale\"],\n]\n\nconst countryCodePlaceholders: { value: string; count?: number; percentage?: number }[] = [\n\t{ value: \"US\" },\n\t{ value: \"GB\" },\n\t{ value: \"NL\" },\n\t{ value: \"FR\" },\n\t{ value: \"DE\" },\n]\n\nconst localePlaceholders: { value: string; count?: number; percentage?: number }[] = [\n\t{ value: \"en-US\" },\n\t{ value: \"en-GB\" },\n\t{ value: \"nl-NL\" },\n\t{ value: \"fr-FR\" },\n\t{ value: \"de-DE\" },\n]\n\nconst countryNames = new Intl.DisplayNames(\"en\", { type: \"region\" })\n\nfunction normalizeCountriesData(data: TopFieldRow[] | undefined): AnalyticsTableData[] {\n\tconst locations = data?.length ? data : countryCodePlaceholders\n\treturn locations.map(({ count, value: countryCode, percentage }): AnalyticsTableData => {\n\t\tconst flagEmoji = getFlagEmojiForLocaleCode(countryCode)\n\t\treturn {\n\t\t\tname: countryNames.of(countryCode) ?? countryCode,\n\t\t\tfilterValue: countryCode,\n\t\t\ticon: flagEmoji ? <Emoji emojiClassName={styles.locationIcon}>{flagEmoji}</Emoji> : <IconGlobe />,\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t}\n\t})\n}\n\nfunction normalizeSystemLanguagesData(data: TopFieldRow[]): AnalyticsTableData[] {\n\tconst locales = data.length ? data : localePlaceholders\n\treturn locales.map(\n\t\t({ count, value, percentage }): AnalyticsTableData => ({\n\t\t\tname: getNameForLocaleCode(value, { includeParenthesis: true }) ?? `${Dictionary.Unknown} (${value})`,\n\t\t\tfilterValue: value,\n\t\t\ticon: <LocaleFlag size=\"tiny\" localeCode={value} emojiClassName={styles.locationIcon} />,\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t}),\n\t)\n}\n\nfunction normalizeLocalesData(data: TopFieldRow[]): AnalyticsTableData[] {\n\tconst locales = data.length ? data : localePlaceholders\n\treturn locales.map(({ count, value, percentage }): AnalyticsTableData => {\n\t\tlet name: string\n\t\tif (value === engine.tree.root.webMetadata?.language && engine.tree.root.webMetadata?.languageTitle) {\n\t\t\t// Use the languageTitle for the default language\n\t\t\tname = engine.tree.root.webMetadata.languageTitle\n\t\t} else {\n\t\t\t// Try to find the locale in engine.tree.root.locales\n\t\t\tconst locale = engine.tree.root.locales?.find(({ code }) => code === value)\n\t\t\tname =\n\t\t\t\tlocale?.name ??\n\t\t\t\t// Fallback to the original behavior\n\t\t\t\tgetNameForLocaleCode(value, { includeParenthesis: true }) ??\n\t\t\t\t`${Dictionary.Unknown} (${value})`\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\tfilterValue: value,\n\t\t\ticon: <LocaleFlag size=\"tiny\" localeCode={value} emojiClassName={styles.locationIcon} />,\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t}\n\t})\n}\n\nfunction normalizeData(data: GeographyData | undefined): AnalyticsTableData[] {\n\tif (!data) {\n\t\treturn normalizeCountriesData(undefined)\n\t}\n\n\tswitch (data.facet) {\n\t\tcase \"countryCode\":\n\t\t\treturn normalizeCountriesData(data.data)\n\t\tcase \"locale\":\n\t\t\treturn normalizeSystemLanguagesData(data.data)\n\t\tcase \"framerLocale\":\n\t\t\treturn normalizeLocalesData(data.data)\n\t\tdefault:\n\t\t\tassertNever(data.facet)\n\t}\n}\n\nexport const AnalyticsGeographySection = React.memo(function AnalyticsGeographySection({\n\tdata,\n\tisLoading,\n\tonAddFilter,\n\tselectedFacet,\n\tonChangeFacet,\n}: FacetedAnalyticsSectionProps<GeographySectionKeys, GeographyData>) {\n\tconst normalizedData = React.useMemo(() => normalizeData(data), [data])\n\n\t// Only show the locales section when the locales are configured in the project\n\tconst isLocaleConfigured = useEngineState(\n\t\t() => Boolean(engine.tree.root.locales && engine.tree.root.locales.length > 0),\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\tconst sectionOptions: SectionOptions<GeographySectionKeys> = React.useMemo(\n\t\t() => (isLocaleConfigured ? [...defaultOptions, [Dictionary.Locales, \"framerLocale\"]] : defaultOptions),\n\t\t[isLocaleConfigured],\n\t)\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle=\"Geography\"\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter={data?.facet ?? defaultGeographyFacet}\n\t\t\tonClickRow={onAddFilter}\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\taction={\n\t\t\t\t<SectionPicker<GeographySectionKeys>\n\t\t\t\t\tenabled={true}\n\t\t\t\t\tselectedSection={selectedFacet}\n\t\t\t\t\tonChangeSection={onChangeFacet}\n\t\t\t\t\tsectionOptions={sectionOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tButtonOnHover={\n\t\t\t\tselectedFacet === \"locale\" || selectedFacet === \"framerLocale\" ? LocaleHoverActionComponent : undefined\n\t\t\t}\n\t\t/>\n\t)\n})\n\nfunction LocaleHoverActionComponent({ value: localeCode }: { value: string }) {\n\tconst isViewOnly = useIsViewOnly(\"canEditLocales\")\n\n\t// Check if there's a corresponding Framer locale\n\tconst matchingLocale = engine.tree.root.locales?.find(({ code }) => languageMatchesLocale(localeCode, code))\n\tif (matchingLocale) {\n\t\treturn (\n\t\t\t<ViewLocaleButton localeId={matchingLocale.id}>\n\t\t\t\t<T>View {Dictionary.Locale}</T>\n\t\t\t</ViewLocaleButton>\n\t\t)\n\t}\n\n\t// Check if it matches the default project language\n\tif (\n\t\tengine.tree.root.webMetadata?.language &&\n\t\tlanguageMatchesLocale(localeCode, engine.tree.root.webMetadata?.language)\n\t) {\n\t\treturn (\n\t\t\t<ViewLocaleButton>\n\t\t\t\t<T>Site Language</T>\n\t\t\t</ViewLocaleButton>\n\t\t)\n\t}\n\n\t// No matching locale exists, show \"Add Locale\" button\n\treturn (\n\t\t<CreateLocaleButton disabled={isViewOnly} languageCode={localeCode}>\n\t\t\t<T>Add {Dictionary.Locale}</T>\n\t\t</CreateLocaleButton>\n\t)\n}\n\n/**\n * Check if a system language is covered by a locale.\n */\nfunction languageMatchesLocale(systemLanguage: string, localeCode: string): boolean {\n\t// Exact match (e.g., \"en-US\" === \"en-US\")\n\tif (localeCode === systemLanguage) return true\n\n\t// Match the language base (e.g. `en-US` and `en-GB` are covered by `en`)\n\tconst [systemLanguageBase] = parseLocaleLanguageAndRegion(systemLanguage)\n\tconst [localeLanguageBase] = parseLocaleLanguageAndRegion(localeCode)\n\treturn localeLanguageBase === localeCode && systemLanguageBase === localeLanguageBase\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { useCallback } from \"react\"\nimport { createLocale } from \"../../localization/createLocale.tsx\"\nimport { buttonNoWrap } from \"./Buttons.styles.ts\"\n\ninterface CreateLocaleButtonProps {\n\tlanguageCode: string\n\tdisabled: boolean\n\tchildren: React.ReactNode\n}\n\nexport function CreateLocaleButton({ languageCode, disabled, children }: CreateLocaleButtonProps) {\n\tconst handleCreateLocale = useCallback(() => {\n\t\tengine.stores.chromeStore.setLocalizationsVisible(true, () => {\n\t\t\tengine.stores.analyticsStore.close()\n\t\t\tcreateLocale(\"analytics_overview\", languageCode)\n\t\t})\n\t}, [languageCode])\n\n\treturn (\n\t\t<Button variant=\"default\" enabled={!disabled} onClick={handleCreateLocale} className={buttonNoWrap}>\n\t\t\t{children}\n\t\t</Button>\n\t)\n}\n", "import \"Buttons.styles_1cchxnq.wyw.css\"; export const buttonNoWrap = \"buttonNoWrap_b1t0q1ki\";", "import { Button } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useCallback } from \"react\"\nimport { buttonNoWrap } from \"./Buttons.styles.ts\"\n\ninterface ViewLocaleButtonProps {\n\t/** When not set, redirects to site settings */\n\tlocaleId?: LocaleId\n\tchildren: React.ReactNode\n}\n\nexport function ViewLocaleButton({ localeId, children }: ViewLocaleButtonProps) {\n\tconst handleViewLocale = useCallback(() => {\n\t\tif (localeId) {\n\t\t\t// Navigate to localization page with preselected locale\n\t\t\tengine.stores.analyticsStore.close()\n\t\t\tengine.stores.chromeStore.setLocalizationsVisible(true)\n\t\t\tengine.stores.localizationStore.selectedLocaleId = localeId\n\t\t} else {\n\t\t\t// Navigate to site settings for default language\n\t\t\tengine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.project }).catch(unhandledError)\n\t\t}\n\t}, [localeId])\n\n\treturn (\n\t\t<Button variant=\"default\" onClick={handleViewLocale} className={buttonNoWrap}>\n\t\t\t{children}\n\t\t</Button>\n\t)\n}\n", "import { T } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useFeatureIsOn } from \"app/features.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport { RoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { isRedirectRouteNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport React from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getPathForDisplay } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { useLoadRoutesNode } from \"../../utils/useLoadScope.ts\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport { CreateRedirectButton } from \"../components/CreateRedirectButton.tsx\"\nimport { SearchRedirectsButton } from \"../components/SearchRedirectsButton.tsx\"\nimport type { SectionOptions } from \"../components/SectionPicker.tsx\"\nimport { SectionPicker } from \"../components/SectionPicker.tsx\"\nimport { IconPageHome, IconPageOther } from \"../icons.tsx\"\nimport type {\n\tAnalyticsTableData,\n\tFacetedAnalyticsSectionProps,\n\tPagesData,\n\tPagesSectionKeys,\n\tTopFieldRow,\n} from \"../types.ts\"\n\nconst sectionOptions: SectionOptions<PagesSectionKeys> = [\n\t[Dictionary.All, \"pathname\"],\n\t[\"Entry\", \"entryPage\"],\n\t[\"Exit\", \"exitPage\"],\n\t[\"404\", \"notFoundPage\"],\n]\n\nconst sectionOptionsWithoutEntryExit: SectionOptions<PagesSectionKeys> = [\n\t[Dictionary.All, \"pathname\"],\n\t[\"404\", \"notFoundPage\"],\n]\n\nfunction getPathnamesPlaceholder() {\n\tconst pathnames: { value: string; count?: number; percentage?: number }[] = []\n\tconst pageNodes = engine.stores.scopeStore.getWebPageNodes()\n\tfor (const pageNode of pageNodes) {\n\t\tconst pathname = getWebPagePath(engine.tree, pageNode)\n\t\tif (pathname) pathnames.push({ value: pathname })\n\t}\n\treturn pathnames\n}\n\nexport function normalizePagesData(\n\tpagesResponse: TopFieldRow[] | undefined,\n\tcanonicalURL: string | undefined,\n): AnalyticsTableData[] {\n\tconst pages = pagesResponse?.length ? pagesResponse : getPathnamesPlaceholder()\n\treturn pages.map(({ value: pathname, count, percentage }) => {\n\t\tconst isRootPath = pathname === \"/\"\n\t\tconst displayPathname = isRootPath ? pathname : getPathForDisplay(pathname)\n\t\tconst row: AnalyticsTableData = {\n\t\t\ticon: isRootPath ? <IconPageHome /> : <IconPageOther />,\n\t\t\tname: isRootPath ? Dictionary.Home : displayPathname,\n\t\t\tfilterValue: pathname,\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t\thref: undefined,\n\t\t}\n\t\tif (canonicalURL) {\n\t\t\t// Remove the trailing slash if exists, so that we don't end up with double slashes in the URL\n\t\t\tconst baseUrl = canonicalURL.endsWith(\"/\") ? canonicalURL.slice(0, -1) : canonicalURL\n\t\t\trow.href = baseUrl + displayPathname\n\t\t}\n\t\treturn row\n\t})\n}\n\nexport const AnalyticsPagesSection = React.memo(function AnalyticsPagesSection({\n\tdata,\n\tisLoading,\n\tonAddFilter,\n\tselectedFacet,\n\tonChangeFacet,\n\thideEntryExit,\n}: FacetedAnalyticsSectionProps<PagesSectionKeys, PagesData> & { hideEntryExit?: boolean }) {\n\tconst documentLoaded = engine.stores.loadingStore.useState(state => state.documentLoaded)\n\n\tconst { isLoadingRoutesNode } = useLoadRoutesNode()\n\n\tconst canonicalURL = engine.stores.publishStore.useState(state => state.canonicalURL.url)\n\n\tconst normalizedData = React.useMemo(() => {\n\t\tif (!documentLoaded) return []\n\t\treturn normalizePagesData(data?.data, canonicalURL)\n\t}, [documentLoaded, data, canonicalURL])\n\n\tconst canUseRedirects = useFeatureIsOn(\"canUseRedirects\")\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle={Dictionary.Pages}\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={!documentLoaded || isLoading}\n\t\t\tsectionFilter=\"pathname\"\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={onAddFilter}\n\t\t\taction={\n\t\t\t\t<SectionPicker<PagesSectionKeys>\n\t\t\t\t\tenabled={true}\n\t\t\t\t\tselectedSection={selectedFacet}\n\t\t\t\t\tonChangeSection={onChangeFacet}\n\t\t\t\t\tsectionOptions={hideEntryExit ? sectionOptionsWithoutEntryExit : sectionOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tButtonOnHover={\n\t\t\t\tcanUseRedirects && selectedFacet === \"notFoundPage\" && !isLoadingRoutesNode\n\t\t\t\t\t? RedirectHoverActionComponent\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t/>\n\t)\n})\n\nfunction RedirectHoverActionComponent({ value: path }: { value: string }) {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\n\tif (redirectExists(path)) {\n\t\treturn (\n\t\t\t<SearchRedirectsButton searchTerm={path}>\n\t\t\t\t<T>View Redirect</T>\n\t\t\t</SearchRedirectsButton>\n\t\t)\n\t} else {\n\t\treturn (\n\t\t\t<CreateRedirectButton path={path} disabled={isViewOnly}>\n\t\t\t\t<T>Add Redirect</T>\n\t\t\t</CreateRedirectButton>\n\t\t)\n\t}\n}\n\nfunction redirectExists(path: string): boolean {\n\tconst routesNode = RoutesNode.get(engine.tree)\n\tif (!routesNode) return false\n\n\tassert(routesNode.isLoaded(), \"Routes node must be loaded\")\n\n\tfor (const redirectNode of routesNode.walk()) {\n\t\tif (!isRedirectRouteNode(redirectNode) || !redirectNode.path) {\n\t\t\tcontinue\n\t\t}\n\t\tif (redirectNode.path === path) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { SiteSettingsTabNames, newRedirect } from \"document/stores/SiteSettingsStore.ts\"\nimport { useCallback } from \"react\"\nimport { buttonNoWrap } from \"./Buttons.styles.ts\"\n\ninterface CreateRedirectButtonProps {\n\tpath: string\n\tdisabled: boolean\n\tchildren: React.ReactNode\n}\n\nexport function CreateRedirectButton({ path, children, disabled }: CreateRedirectButtonProps) {\n\tconst handleCreateRedirect = useCallback(async () => {\n\t\t// Navigate to the redirects page\n\t\tawait engine.stores.siteSettingsStore.setActiveTab({\n\t\t\ttab: SiteSettingsTabNames.redirects,\n\t\t})\n\n\t\t// Prepopulate the redirect form with the path\n\t\tengine.stores.siteSettingsStore.updateRedirectDraft(newRedirect, {\n\t\t\tfrom: path,\n\t\t})\n\t}, [path])\n\n\treturn (\n\t\t<Button variant=\"default\" enabled={!disabled} onClick={handleCreateRedirect} className={buttonNoWrap}>\n\t\t\t{children}\n\t\t</Button>\n\t)\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useCallback } from \"react\"\nimport { buttonNoWrap } from \"./Buttons.styles.ts\"\n\ninterface SearchRedirectsButtonProps {\n\tsearchTerm: string\n\tchildren: React.ReactNode\n}\n\nexport function SearchRedirectsButton({ searchTerm, children }: SearchRedirectsButtonProps) {\n\tconst handleSearchRedirects = useCallback(async () => {\n\t\t// Navigate to the redirects page\n\t\tawait engine.stores.siteSettingsStore.setActiveTab({\n\t\t\ttab: SiteSettingsTabNames.redirects,\n\t\t})\n\n\t\t// Set the search term in the store\n\t\tengine.stores.siteSettingsStore.redirectsSearchTerm = searchTerm\n\t}, [searchTerm])\n\n\treturn (\n\t\t<Button variant=\"default\" onClick={handleSearchRedirects} className={buttonNoWrap}>\n\t\t\t{children}\n\t\t</Button>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { defaultSourcesFacet } from \"document/stores/AnalyticsStore.ts\"\nimport React from \"react\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport type { SectionOptions } from \"../components/SectionPicker.tsx\"\nimport { SectionPicker } from \"../components/SectionPicker.tsx\"\nimport { IconGlobe, IconUtm } from \"../icons.tsx\"\nimport iconBing from \"../images/icon-bing.png\"\nimport iconFramer from \"../images/icon-framer.png\"\nimport * as styles from \"../tabs/AnalyticsOverview.styles.ts\"\nimport type {\n\tAnalyticsTableData,\n\tFacetedAnalyticsSectionProps,\n\tSourcesData,\n\tSourcesSectionKeys,\n\tTopFieldRow,\n} from \"../types.ts\"\n\nconst customIcons: Record<string, string> = {\n\t\"framer.com\": iconFramer,\n\t\"bing.com\": iconBing,\n}\n\nfunction getSafeHostname(originalReferrer: string) {\n\ttry {\n\t\tconst url = new URL(originalReferrer)\n\t\treturn url.hostname\n\t} catch {\n\t\treturn null\n\t}\n}\n\nconst getCustomIcon = (originalReferrer: string) => {\n\tconst referrerHostname = getSafeHostname(originalReferrer)\n\n\tfor (const domain in customIcons) {\n\t\tif (referrerHostname === domain || referrerHostname?.endsWith(\".\" + domain)) {\n\t\t\treturn (\n\t\t\t\t<img\n\t\t\t\t\tsrc={customIcons[domain]}\n\t\t\t\t\talt={originalReferrer}\n\t\t\t\t\twidth={12}\n\t\t\t\t\theight={12}\n\t\t\t\t\tclassName={styles.sourceIcon}\n\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t}\n\n\treturn null\n}\n\nconst sectionOptions: SectionOptions<SourcesSectionKeys> = [\n\t[\"Referrer\", \"referrer\"],\n\t[\n\t\t\"UTM\",\n\t\t[\n\t\t\t[\"Campaign\", \"utmCampaign\"],\n\t\t\t[Dictionary.Source, \"utmSource\"],\n\t\t\t[Dictionary.Content, \"utmContent\"],\n\t\t\t[\"Term\", \"utmTerm\"],\n\t\t\t[\"Medium\", \"utmMedium\"],\n\t\t],\n\t],\n]\n\nconst referrersPlaceholder: { value: string; originalReferrer?: string; count?: number; percentage?: number }[] = [\n\t{ value: \"https://google.com\" },\n\t{ value: \"https://twitter.com\" },\n\t{ value: \"https://facebook.com/share\" },\n\t{ value: \"https://linkedin.com\" },\n\t{ value: \"https://framer.com\" },\n]\n\nconst URL_NORMALIZE_REGEX = /^(?:https?:\\/\\/)?(?:www\\.)?/u\n\nfunction normalizeUrl(referrer: string) {\n\treturn referrer.replace(URL_NORMALIZE_REGEX, \"\")\n}\n\nfunction normalizeReferrerData(data: TopFieldRow[] | undefined): AnalyticsTableData[] {\n\tconst referrers = data?.length ? data : referrersPlaceholder\n\treturn referrers.map(({ value, originalReferrer, count, percentage }) => ({\n\t\tname: normalizeUrl(value),\n\t\tfilterValue: value,\n\t\thref: originalReferrer,\n\t\ticon: <SourceIcon referrer={value} originalReferrer={originalReferrer} />,\n\t\tcount,\n\t\tpercentage,\n\t}))\n}\n\nfunction normalizeUtmSourcesData(data: TopFieldRow[] | undefined): AnalyticsTableData[] {\n\tif (!data) return []\n\treturn data.map(({ value, count, percentage }) => ({\n\t\tname: value,\n\t\tfilterValue: value,\n\t\tcount,\n\t\tpercentage,\n\t\ticon: <IconUtm />,\n\t}))\n}\n\nconst SourceIcon = ({ referrer, originalReferrer }: { referrer: string; originalReferrer?: string }) => {\n\tconst [shouldShowDefaultIcon, setShouldShowDefaultIcon] = React.useState<boolean>(false)\n\tconst [imageFinishedLoading, setImageFinishedLoading] = React.useState<boolean>(false)\n\n\tif (originalReferrer) {\n\t\tconst customIcon = getCustomIcon(originalReferrer)\n\t\tif (customIcon) return customIcon\n\t}\n\n\treturn shouldShowDefaultIcon ? (\n\t\t<span className={styles.defaultSourceIcon}>\n\t\t\t<IconGlobe />\n\t\t</span>\n\t) : (\n\t\t<img\n\t\t\tsrc={`https://www.google.com/s2/favicons?domain=${referrer}&sz=128`}\n\t\t\talt={referrer}\n\t\t\twidth={12}\n\t\t\theight={12}\n\t\t\tclassName={styles.sourceIcon}\n\t\t\tstyle={{ visibility: imageFinishedLoading ? \"visible\" : \"hidden\" }}\n\t\t\tonLoad={e => {\n\t\t\t\tconst img = e.target as HTMLImageElement\n\t\t\t\tif (img.naturalWidth <= 16 || img.naturalHeight <= 16) {\n\t\t\t\t\tsetShouldShowDefaultIcon(true)\n\t\t\t\t}\n\t\t\t\tsetImageFinishedLoading(true)\n\t\t\t}}\n\t\t\tonError={() => {\n\t\t\t\tsetShouldShowDefaultIcon(true)\n\t\t\t\tsetImageFinishedLoading(true)\n\t\t\t}}\n\t\t\tdecoding=\"async\"\n\t\t/>\n\t)\n}\n\nexport const AnalyticsSourcesSection = function AnalyticsSourcesSection({\n\tdata,\n\tisLoading,\n\tonAddFilter,\n\tselectedFacet,\n\tonChangeFacet,\n}: FacetedAnalyticsSectionProps<SourcesSectionKeys, SourcesData>) {\n\tconst normalizedData = React.useMemo(() => {\n\t\tif (!data) {\n\t\t\treturn defaultSourcesFacet === \"referrer\" ? normalizeReferrerData(undefined) : normalizeUtmSourcesData(undefined)\n\t\t} else if (data.facet === \"referrer\") {\n\t\t\treturn normalizeReferrerData(data.data)\n\t\t} else {\n\t\t\treturn normalizeUtmSourcesData(data.data)\n\t\t}\n\t}, [data])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle=\"Sources\"\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter={data?.facet ?? defaultSourcesFacet}\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={onAddFilter}\n\t\t\taction={\n\t\t\t\t<SectionPicker<SourcesSectionKeys>\n\t\t\t\t\tenabled={true}\n\t\t\t\t\tselectedSection={selectedFacet}\n\t\t\t\t\tonChangeSection={onChangeFacet}\n\t\t\t\t\tsectionOptions={sectionOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport React from \"react\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../components/AnalyticsTable.tsx\"\nimport type { SectionOptions } from \"../components/SectionPicker.tsx\"\nimport { SectionPicker } from \"../components/SectionPicker.tsx\"\nimport type { AnalyticsTableData, FacetedAnalyticsSectionProps, TopFieldRow, TrackingIdsSectionKeys } from \"../types.ts\"\nimport { getTrackingEventTypeIcon } from \"../utils/trackingEventTypes.tsx\"\n\nconst sectionOptions: SectionOptions<TrackingIdsSectionKeys> = [\n\t[\"Uniques\", \"trackingId\"],\n\t[\"Totals\", \"trackingIdTotal\"],\n]\n\nfunction normalizeData(dataResponse: TopFieldRow[]) {\n\tif (!dataResponse) return []\n\n\treturn dataResponse.map(({ value, count, percentage, eventType }): AnalyticsTableData => {\n\t\treturn {\n\t\t\tname: value,\n\t\t\tfilterValue: value,\n\t\t\ticon: eventType ? getTrackingEventTypeIcon(eventType) : undefined,\n\t\t\tcount,\n\t\t\tpercentage,\n\t\t}\n\t})\n}\n\nexport const AnalyticsTrackingIdsSection = React.memo(function AnalyticsTrackingIdsSection({\n\tdata,\n\tisLoading,\n\tonAddFilter,\n\tselectedFacet,\n\tonChangeFacet,\n}: FacetedAnalyticsSectionProps<TrackingIdsSectionKeys, TopFieldRow[]>) {\n\tconst normalizedData = React.useMemo(() => {\n\t\treturn data?.length ? normalizeData(data) : []\n\t}, [data])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle={Dictionary.Tracking}\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter=\"trackingId\"\n\t\t\tkind={AnalyticsTableKind.Analytics}\n\t\t\tonClickRow={onAddFilter}\n\t\t\taction={\n\t\t\t\t<SectionPicker<TrackingIdsSectionKeys>\n\t\t\t\t\tenabled={true}\n\t\t\t\t\tselectedSection={selectedFacet}\n\t\t\t\t\tonChangeSection={onChangeFacet}\n\t\t\t\t\tsectionOptions={sectionOptions}\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t)\n})\n", "import { IconInteraction } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport type { ReactElement, SVGProps } from \"react\"\nimport { IconAgentCode } from \"../../agentPanel/components/IconAgentCode.tsx\"\nimport { IconAgentHome } from \"../../agentPanel/components/IconAgentHome.tsx\"\nimport { IconAgentPage } from \"../../agentPanel/components/IconAgentPage.tsx\"\nimport { IconAgentLayerForm } from \"../../layers/AgentLayerIcons.tsx\"\nimport { IconPageOther, IconTrackingClick, IconTrackingCustom, IconTrackingForm } from \"../icons.tsx\"\n\n/** Used in the event type dropdown */\nconst trackingEventTypes: Record<TrackingEventType, string> = {\n\tpageview: \"Pageview\",\n\tclick: Dictionary.Click,\n\tform_submit: \"Form Submit\",\n\tcustom: Dictionary.Custom,\n\ttrigger_invoke: Dictionary.Trigger,\n}\n\nconst allTrackingEventTypes = Object.keys(trackingEventTypes) as TrackingEventType[]\n\nexport function getTrackingEventTypeTitle(type: TrackingEventType): string {\n\treturn trackingEventTypes[type]\n}\n\n/** Used in step labels */\nconst trackingEventLabels: Record<TrackingEventType, string> = {\n\tpageview: Dictionary.Page,\n\tclick: Dictionary.Click,\n\tform_submit: Dictionary.Form,\n\tcustom: Dictionary.Custom,\n\ttrigger_invoke: Dictionary.Trigger,\n}\n\nexport function getTrackingEventTypeLabel(type: TrackingEventType): string {\n\treturn trackingEventLabels[type]\n}\n\nconst trackingEventIcons: Record<TrackingEventType, ReactElement> = {\n\tpageview: <IconPageOther />,\n\tclick: <IconTrackingClick />,\n\tform_submit: <IconTrackingForm />,\n\tcustom: <IconTrackingCustom />,\n\ttrigger_invoke: <IconInteraction />,\n}\n\nconst agentTrackingEventIcons: Record<TrackingEventType, ReactElement> = {\n\tpageview: <IconAgentPage />,\n\tclick: <IconAgentTrackingClick />,\n\tform_submit: <IconAgentLayerForm />,\n\tcustom: <IconAgentCode />,\n\ttrigger_invoke: <IconAgentTrackingTrigger />,\n}\n\ninterface TrackingEventTypeIconOptions {\n\tagentExperimentEnabled?: boolean\n\ttrackingRoutePath?: string\n}\n\nexport function getTrackingEventTypeIcon(\n\ttype: TrackingEventType,\n\toptions: TrackingEventTypeIconOptions = {},\n): ReactElement {\n\tif (type === \"pageview\" && options.agentExperimentEnabled) {\n\t\treturn options.trackingRoutePath === \"/\" ? <IconAgentHome /> : <IconAgentPage />\n\t}\n\n\tif (options.agentExperimentEnabled) return agentTrackingEventIcons[type]\n\n\treturn trackingEventIcons[type]\n}\n\nexport function getSupportedTrackingEventTypes() {\n\treturn allTrackingEventTypes\n}\n\nfunction IconAgentTrackingClick(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\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=\"m5 7 2-2M4.75 2.279A3.515 3.515 0 0 1 9.721 7.25M7.25 9.721A3.515 3.515 0 0 1 2.279 4.75\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentTrackingTrigger(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\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=\"M6 1.25 2.75 6.75h3l-.75 4 4.25-5.5H6.5Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { FunnelFilterKey } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport type { AnalyticsFunnelFilterOption, AnalyticsSectionFilterOption } from \"../types.ts\"\n\nexport const filterLabels: Record<AnalyticsSectionFilterOption, string> = {\n\tpathname: \"Page\",\n\troutePath: \"Page\",\n\tcollectionItemId: \"Item\",\n\treferrer: \"Source\",\n\tutmCampaign: \"UTM Campaign\",\n\tutmSource: \"UTM Source\",\n\tutmContent: \"UTM Content\",\n\tutmTerm: \"UTM Term\",\n\tutmMedium: \"UTM Medium\",\n\tdevice: \"Device\",\n\tos: \"OS\",\n\tbrowser: \"Browser\",\n\tcountryCode: \"Country\",\n\tlocale: \"System Language\",\n\tframerLocale: \"Locale\",\n\ttrackingId: \"Tracking\",\n}\n\ninterface FunnelFilterItem {\n\ttype: \"dropdown\" | \"text\" | \"region\"\n\toptions?: Record<string, string>\n\tlabel: string\n}\n\nexport const funnelFilters: Record<AnalyticsFunnelFilterOption, FunnelFilterItem> = {\n\tdevice: {\n\t\ttype: \"dropdown\",\n\t\toptions: {\n\t\t\tdesktop: \"Desktop\",\n\t\t\tmobile: \"Mobile\",\n\t\t\ttablet: \"Tablet\",\n\t\t},\n\t\tlabel: \"Device\",\n\t},\n\tos: {\n\t\ttype: \"dropdown\",\n\t\toptions: {\n\t\t\tmacos: \"macOS\",\n\t\t\twindows: \"Windows\",\n\t\t\tlinux: \"Linux\",\n\t\t\tios: \"iOS\",\n\t\t\tandroid: \"Android\",\n\t\t},\n\t\tlabel: \"OS\",\n\t},\n\tbrowser: {\n\t\ttype: \"dropdown\",\n\t\toptions: {\n\t\t\tchrome: \"Chrome\",\n\t\t\tfirefox: \"Firefox\",\n\t\t\tsafari: \"Safari\",\n\t\t\tedge: \"Edge\",\n\t\t\topera: \"Opera\",\n\t\t},\n\t\tlabel: \"Browser\",\n\t},\n\tcountryCode: { type: \"region\", label: \"Country\" },\n\tutmCampaign: { type: \"text\", label: \"Campaign\" },\n\tutmSource: { type: \"text\", label: \"Source\" },\n\tutmContent: { type: \"text\", label: \"Content\" },\n\tutmTerm: { type: \"text\", label: \"Term\" },\n\tutmMedium: { type: \"text\", label: \"Medium\" },\n\tlocale: { type: \"text\", label: \"System Language\" },\n\tframerLocale: { type: \"text\", label: \"Locale\" },\n}\n\nexport const funnelFilterMap: Record<FunnelFilterKey, AnalyticsFunnelFilterOption> = {\n\tfilterByDevice: \"device\",\n\tfilterByOs: \"os\",\n\tfilterByBrowser: \"browser\",\n\tfilterByCountryCode: \"countryCode\",\n\tfilterByUtmCampaign: \"utmCampaign\",\n\tfilterByUtmSource: \"utmSource\",\n\tfilterByUtmContent: \"utmContent\",\n\tfilterByUtmTerm: \"utmTerm\",\n\tfilterByUtmMedium: \"utmMedium\",\n} as const\n\nexport interface FilterMenuOption<T extends string> {\n\t[label: string]: T | FilterMenuOption<T>\n}\n\nexport const filterMenuOptions: FilterMenuOption<AnalyticsFunnelFilterOption> = {\n\tDevice: \"device\",\n\tOS: \"os\",\n\tBrowser: \"browser\",\n\tCountry: \"countryCode\",\n\tUTM: {\n\t\tCampaign: \"utmCampaign\",\n\t\tSource: \"utmSource\",\n\t\tContent: \"utmContent\",\n\t\tTerm: \"utmTerm\",\n\t\tMedium: \"utmMedium\",\n\t},\n}\n\nexport const getFilterLabel = (filter: FunnelFilterKey): string => {\n\tconst filterItem = funnelFilters[funnelFilterMap[filter]]\n\tif (!filterItem) return \"\"\n\treturn filterItem.label\n}\n\nexport const getFilterOptionLabel = (filter: FunnelFilterKey, value: string): string => {\n\tconst filterItem = funnelFilters[funnelFilterMap[filter]]\n\tif (!filterItem) return value\n\tif (filterItem.type === \"dropdown\") {\n\t\treturn filterItem.options?.[value] || value\n\t}\n\treturn value\n}\n\nexport const getDefaultFilterValue = (filter: FunnelFilterKey): string => {\n\tconst filterItem = funnelFilters[funnelFilterMap[filter]]\n\tif (!filterItem) return \"\"\n\n\tif (filterItem.type === \"dropdown\" && filterItem.options) {\n\t\tconst allOptions = Object.keys(filterItem.options)\n\t\treturn allOptions[0] || \"\"\n\t}\n\n\treturn \"\"\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useEffect } from \"react\"\nimport { getAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { AnalyticsEventsUpsellState, EmptyFunnelState } from \"../components/AnalyticsStateMessages.tsx\"\nimport { AnalyticsTitle } from \"../components/AnalyticsTitle.tsx\"\nimport { DateRangePicker } from \"../components/DateRangePicker.tsx\"\nimport { DateRangePresets } from \"../components/DateRangePresets.tsx\"\nimport { FunnelDropOffBars } from \"../components/FunnelDropOffBars.tsx\"\nimport type { DateRangePreset } from \"../utils/dateRangePreset.ts\"\nimport { getFunnelQuery } from \"../utils/getFunnelQuery.ts\"\nimport * as analyticsStyles from \"./AnalyticsOverview.styles.ts\"\n\nconst FunnelConversionRateChart = React.lazy(() => import(\"../section/FunnelConversionRateChart.tsx\"))\n\nconst setPreset = (preset: DateRangePreset | undefined) => (engine.stores.analyticsStore.preset = preset)\nconst setFromDay = (fromDay: string) => (engine.stores.analyticsStore.fromDay = fromDay)\nconst setToDay = (toDay: string) => (engine.stores.analyticsStore.toDay = toDay)\n\nexport const FunnelOverview = React.memo(function FunnelOverview({ id }: { id: NodeID }) {\n\tconst {\n\t\tpreset,\n\t\tfromDay,\n\t\ttoDay,\n\t\tminDay,\n\t\tmaxDay,\n\t\tfunnelDropOff,\n\t\tfunnelDropOffLoading,\n\t\tfunnelConversionRateLoading,\n\t\tfunnelConversionRate,\n\t} = engine.stores.analyticsStore.useState(state => ({\n\t\tpreset: state.preset,\n\t\tfromDay: state.fromDay,\n\t\ttoDay: state.toDay,\n\t\tminDay: state.minDay,\n\t\tmaxDay: state.maxDay,\n\t\tfunnelDropOff: state.funnelDropOff,\n\t\tfunnelDropOffLoading: state.funnelDropOffLoading,\n\t\tfunnelConversionRateLoading: state.funnelConversionRateLoading,\n\t\tfunnelConversionRate: state.funnelConversionRate ?? [],\n\t}))\n\n\tconst funnel = useEngineState(() => engine.tree.getNodeWithTrait(id, isFunnelNode), [id], [EngineChange.Tree])\n\n\t// Memoize funnelQuery to avoid unnecessary refetches\n\tconst funnelQuery = useEngineState(() => getFunnelQuery(id, engine), [id], [EngineChange.Tree], { deepEqual: true })\n\tuseEffect(\n\t\t() =>\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tif (!funnelQuery) return\n\t\t\t\t// Setting funnelQuery would fetch the data\n\t\t\t\tengine.stores.analyticsStore.funnelQuery = funnelQuery\n\t\t\t}),\n\t\t[funnelQuery],\n\t)\n\n\t// Block the page if the user is over the events limit\n\tconst eventsUpsell = useEngineState(\n\t\t() => getAnalyticsEventsUpsell(engine.stores.projectStore),\n\t\t[],\n\t\t[engine.stores.projectStore],\n\t)\n\tif (eventsUpsell) return <AnalyticsEventsUpsellState upsell={eventsUpsell} />\n\n\tif (!funnel) return null\n\n\tif (funnel.children.length <= 1) {\n\t\treturn (\n\t\t\t<EmptyFunnelState\n\t\t\t\ttitle={Dictionary.Funnel}\n\t\t\t\tdescription=\"Add a conversion step to set up and analyze your funnel.\"\n\t\t\t\tlearnMoreUrl=\"https://framer.com/help/articles/how-to-set-up-a-funnel/\"\n\t\t\t\tfunnelId={funnel.id}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={30} className={analyticsStyles.container}>\n\t\t\t<div className={analyticsStyles.headerWrapper}>\n\t\t\t\t<AnalyticsTitle title={funnel.resolveValue(\"name\") || getDefaultName(engine.componentLoader, funnel)} />\n\t\t\t\t<div className={analyticsStyles.dateRangeWrapper}>\n\t\t\t\t\t<DateRangePresets preset={preset} onSelectPreset={setPreset} />\n\t\t\t\t\t<DateRangePicker\n\t\t\t\t\t\tfromDay={fromDay}\n\t\t\t\t\t\tfromDayOnChange={setFromDay}\n\t\t\t\t\t\tfromDayMin={minDay}\n\t\t\t\t\t\tfromDayMax={toDay}\n\t\t\t\t\t\ttoDay={toDay}\n\t\t\t\t\t\ttoDayOnChange={setToDay}\n\t\t\t\t\t\ttoDayMin={fromDay}\n\t\t\t\t\t\ttoDayMax={maxDay}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<FunnelDropOffBars node={funnel} dropOffData={funnelDropOff} isLoading={funnelDropOffLoading} />\n\t\t\t{funnelConversionRate.length >= 2 && (\n\t\t\t\t<React.Suspense fallback={null}>\n\t\t\t\t\t<FunnelConversionRateChart\n\t\t\t\t\t\tfunnel={funnel}\n\t\t\t\t\t\tisLoading={funnelConversionRateLoading}\n\t\t\t\t\t\tfunnelConversionRate={funnelConversionRate}\n\t\t\t\t\t/>\n\t\t\t\t</React.Suspense>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n", "import { ReadOnlyContext, Scroll, SearchBar, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { AnalyticsScopeNode, type NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tAbTestsEntityTypeRootNode,\n\tFunnelsEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { FunnelNode } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { FunnelStepNode } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { AnalyticsTabNames } from \"document/stores/AnalyticsStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { memo, useCallback, useMemo, useState } from \"react\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { useDebounce } from \"web/lib/useDebounce.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { IconAgentHome } from \"../../agentPanel/components/IconAgentHome.tsx\"\nimport type { AssetRow } from \"../../assets/utils/useAssetPanelEntityRows.ts\"\nimport { useAssetPanelEntityRows } from \"../../assets/utils/useAssetPanelEntityRows.ts\"\nimport { ContentPanelHeader } from \"../../contentPanel/ContentPanelHeader.tsx\"\nimport { LeftPanel } from \"../../leftPanel/LeftPanel.tsx\"\nimport * as agentSearchBarStyles from \"../../shared/AgentSearchBar.styles.ts\"\nimport { dataIsAnalyticsDataAttribute } from \"../../shared/chromeHitTargets.ts\"\nimport * as styles from \"../Analytics.styles.ts\"\nimport { IconAnalyticsWithBackground } from \"../icons.tsx\"\nimport { createAbTest } from \"../utils/createAbTest.ts\"\nimport { createFunnel } from \"../utils/createFunnel.ts\"\nimport { AnalyticsSidebarEntityLists, resolveEntityIdFromRowId } from \"./AnalyticsSidebarEntityLists.tsx\"\nimport { AnalyticsSidebarRow } from \"./AnalyticsSidebarRow.tsx\"\nimport { AnalyticsSidebarUsage } from \"./AnalyticsSidebarUsage.tsx\"\n\nexport const AnalyticsSidebar = memo(function AnalyticsSidebar() {\n\tconst mainView = engine.stores.chromeStore.useState(state => state.mainView)\n\tconst active = engine.stores.analyticsStore.useState(state => state.active)\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst isViewOnly = useIsViewOnly(\"canEditAnalytics\")\n\n\tconst allFunnels = useEngineState(\n\t\t() => AnalyticsScopeNode.get(engine.tree)?.loaded?.children || emptyArray<FunnelNode>(),\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst [funnels, abTests] = useMemo(() => {\n\t\treturn [allFunnels.filter(node => !node.abTestingParentId), allFunnels.filter(node => node.abTestingParentId)]\n\t}, [allFunnels])\n\n\tconst [searchValue, setSearchValue] = useState(\"\")\n\tconst debouncedSearchValue = useDebounce(searchValue, searchValue ? 200 : 0)\n\n\t// Expanded state (shared across all entity types)\n\tconst expandedAssetEntityIds = useEngineState(\n\t\t() => engine.stores.chromeStore.expandedAssetEntityIds(false),\n\t\t[],\n\t\tengine.stores.chromeStore,\n\t)\n\n\t// Root nodes may be null if not yet created\n\tconst funnelsRoot = useEngineState(() => FunnelsEntityTypeRootNode.get(engine.tree), [], [EngineChange.Tree])\n\tconst abTestsRoot = useEngineState(() => AbTestsEntityTypeRootNode.get(engine.tree), [], [EngineChange.Tree])\n\n\t// NOTE: Lazy reference creation happens on user actions (move, reorder, create folder, sort),\n\t// This is handled by:\n\t// - createAndRenameFolderNode (via ensureEntityTypeRootNode)\n\t// - sortEntityAssetsAlphabetically (via referenceUnreferencedNodesByTypeRoot)\n\t// - DraggableEntityItem handleDrop (via referenceUnreferencedNodesByTypeRoot)\n\n\t// Helper to check if a funnel/test matches the search query (including step names)\n\tconst matchesFunnelSearch = useCallback((node: FunnelNode, query: string): boolean => {\n\t\tconst name = node.resolveValue(\"name\") || getDefaultName(engine.componentLoader, node)\n\t\tif (matchSubstring(query, name)) return true\n\t\t// Check step names\n\t\tfor (const step of node.children) {\n\t\t\tif (!(step instanceof FunnelStepNode)) continue\n\t\t\tconst stepName = step.resolveValue(\"name\") || \"\"\n\t\t\tif (matchSubstring(query, stepName)) return true\n\t\t}\n\t\treturn false\n\t}, [])\n\n\t// Compute unreferenced entities (shown when no root exists OR when items have no reference)\n\tconst unreferencedFunnelRows = useMemo(\n\t\t() => buildUnreferencedEntityRows(funnels, debouncedSearchValue, matchesFunnelSearch),\n\t\t[funnels, debouncedSearchValue, matchesFunnelSearch],\n\t)\n\n\tconst unreferencedAbTestRows = useMemo(\n\t\t() => buildUnreferencedEntityRows(abTests, debouncedSearchValue, matchesFunnelSearch),\n\t\t[abTests, debouncedSearchValue, matchesFunnelSearch],\n\t)\n\n\t// Get rows for funnels (when root exists)\n\tconst [funnelsStateFromHook, toggleFunnelsCollapse] = useAssetPanelEntityRows(\n\t\tdebouncedSearchValue,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t_initialCtx => {\n\t\t\t\t// Return null when no root exists - we'll use unreferencedFunnelRows directly\n\t\t\t\tif (!funnelsRoot) return null\n\n\t\t\t\tconst allowList = new Set<string>()\n\t\t\t\tfor (const funnel of funnels) {\n\t\t\t\t\tallowList.add(funnel.id)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tentityRootNode: funnelsRoot,\n\t\t\t\t\tunreferenced: unreferencedFunnelRows,\n\t\t\t\t\tallowList,\n\t\t\t\t\tincludeRoot: false,\n\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\tskipFolders: false, // Show empty folders\n\t\t\t\t}\n\t\t\t},\n\t\t\t[funnels, funnelsRoot, unreferencedFunnelRows],\n\t\t),\n\t\t[EngineChange.Tree],\n\t)\n\n\t// Get rows for A/B tests (when root exists)\n\tconst [abTestsStateFromHook, toggleAbTestsCollapse] = useAssetPanelEntityRows(\n\t\tdebouncedSearchValue,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t_initialCtx => {\n\t\t\t\t// Return null when no root exists - we'll use unreferencedAbTestRows directly\n\t\t\t\tif (!abTestsRoot) return null\n\n\t\t\t\tconst allowList = new Set<string>()\n\t\t\t\tfor (const abTest of abTests) {\n\t\t\t\t\tallowList.add(abTest.id)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tentityRootNode: abTestsRoot,\n\t\t\t\t\tunreferenced: unreferencedAbTestRows,\n\t\t\t\t\tallowList,\n\t\t\t\t\tincludeRoot: false,\n\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\tskipFolders: false, // Show empty folders\n\t\t\t\t}\n\t\t\t},\n\t\t\t[abTests, abTestsRoot, unreferencedAbTestRows],\n\t\t),\n\t\t[EngineChange.Tree],\n\t)\n\n\t// Combine hook state with fallback unreferenced rows when no root exists\n\tconst funnelsState = useMemo(\n\t\t() => ({\n\t\t\trows: funnelsRoot ? funnelsStateFromHook.rows : unreferencedFunnelRows,\n\t\t\thasUnreferencedItems: unreferencedFunnelRows.length > 0,\n\t\t}),\n\t\t[funnelsRoot, funnelsStateFromHook.rows, unreferencedFunnelRows],\n\t)\n\n\tconst abTestsState = useMemo(\n\t\t() => ({\n\t\t\trows: abTestsRoot ? abTestsStateFromHook.rows : unreferencedAbTestRows,\n\t\t\thasUnreferencedItems: unreferencedAbTestRows.length > 0,\n\t\t}),\n\t\t[abTestsRoot, abTestsStateFromHook.rows, unreferencedAbTestRows],\n\t)\n\n\tconst handleCreateFunnel = useEngineCallback(() => createFunnel(engine), [])\n\n\tconst handleCreateAbTest = useEngineCallback(() => createAbTest(engine, \"analytics_sidebar\"), [])\n\n\tconst handleSelectFunnel = useEngineCallback(createSelectAnalyticsItemHandler(AnalyticsTabNames.funnel), [])\n\n\tconst handleSelectAbTest = useEngineCallback(createSelectAnalyticsItemHandler(AnalyticsTabNames.abtest), [])\n\n\tif (!active || mainView !== ActiveMainView.Analytics) return null\n\n\treturn (\n\t\t<LeftPanel {...{ [dataIsAnalyticsDataAttribute]: \"true\" }}>\n\t\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t\t<Scroll direction=\"vertical\">\n\t\t\t\t\t<Stack gap={isAgentExperimentOn ? 0 : 4} padding={isAgentExperimentOn ? dimensions.css.panelPadding : 16}>\n\t\t\t\t\t\t<SearchBar\n\t\t\t\t\t\t\tvalue={searchValue}\n\t\t\t\t\t\t\tclassName={isAgentExperimentOn ? agentSearchBarStyles.agentInputWrapper : undefined}\n\t\t\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\tonChange={setSearchValue}\n\t\t\t\t\t\t\tshowClearButton={true}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<ContentPanelHeader title={Dictionary.Analytics} toggleExpanded={noop} enabled={false} isViewOnly={true} />\n\t\t\t\t\t<Stack gap={isAgentExperimentOn ? 0 : 4} className={styles.rowsContainer}>\n\t\t\t\t\t\t<AnalyticsSidebarRow\n\t\t\t\t\t\t\ttitle=\"Overview\"\n\t\t\t\t\t\t\tIcon={isAgentExperimentOn ? IconAgentHome : IconAnalyticsWithBackground}\n\t\t\t\t\t\t\ttab={{ tab: AnalyticsTabNames.overview }}\n\t\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<AnalyticsSidebarEntityLists\n\t\t\t\t\t\tactive={active}\n\t\t\t\t\t\tfunnels={{\n\t\t\t\t\t\t\trows: funnelsState.rows,\n\t\t\t\t\t\t\thasUnreferencedItems: funnelsState.hasUnreferencedItems,\n\t\t\t\t\t\t\ttoggleCollapse: toggleFunnelsCollapse,\n\t\t\t\t\t\t\thandleSelect: handleSelectFunnel,\n\t\t\t\t\t\t\thandleCreate: handleCreateFunnel,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tabTests={{\n\t\t\t\t\t\t\trows: abTestsState.rows,\n\t\t\t\t\t\t\thasUnreferencedItems: abTestsState.hasUnreferencedItems,\n\t\t\t\t\t\t\ttoggleCollapse: toggleAbTestsCollapse,\n\t\t\t\t\t\t\thandleSelect: handleSelectAbTest,\n\t\t\t\t\t\t\thandleCreate: handleCreateAbTest,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</Scroll>\n\t\t\t\t<AnalyticsSidebarUsage />\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</LeftPanel>\n\t)\n})\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n// Helper to build unreferenced entity rows (shared between funnels and A/B tests)\nfunction buildUnreferencedEntityRows(\n\tentities: FunnelNode[],\n\tsearchQuery: string,\n\tmatchesSearch: (node: FunnelNode, query: string) => boolean,\n): AssetRow[] {\n\tconst rows: AssetRow[] = []\n\tfor (const entity of entities) {\n\t\tconst referenceId = buildEntityReferenceNodeId(entity.id)\n\t\tif (engine.tree.has(referenceId)) continue\n\n\t\tconst entityName = entity.resolveValue(\"name\") || getDefaultName(engine.componentLoader, entity)\n\t\tif (searchQuery && !matchesSearch(entity, searchQuery)) continue\n\n\t\trows.push({\n\t\t\ttype: \"reference\",\n\t\t\tid: entity.id,\n\t\t\tdepth: 0,\n\t\t\ttitle: entityName,\n\t\t})\n\t}\n\treturn rows\n}\n\n// Factory to create a selection handler for analytics items\nfunction createSelectAnalyticsItemHandler(tabName: AnalyticsTabNames.funnel | AnalyticsTabNames.abtest) {\n\treturn (id: NodeID) => {\n\t\tconst entityId = resolveEntityIdFromRowId(id)\n\t\tconst entity = engine.tree.getNodeWithTrait(entityId, isFunnelNode)\n\t\tif (entity) {\n\t\t\tvoid engine.stores.analyticsStore.setActiveTab({ tab: tabName, id: entity.id })\n\t\t}\n\t}\n}\n", "import type React from \"react\"\nimport { useCallback } from \"react\"\nimport { PanelSectionHeader } from \"../properties/panels/PanelSectionHeader.tsx\"\nimport * as styles from \"./ContentPanelHeader.styles.ts\"\n\ninterface Props {\n\ttitle: string | JSX.Element\n\tisFirstSection?: boolean\n\theaderActionItem?: React.ReactNode\n\ttoggleExpanded: (event?: React.MouseEvent) => void\n\tonRightClick?: (event?: React.MouseEvent) => void\n\tisViewOnly: boolean\n\tenabled?: boolean\n\tinTabbedPanel?: boolean\n\tcreateAction?: (event?: React.MouseEvent) => void\n\thasItems?: boolean\n\ticon?: JSX.Element\n}\n\nexport function ContentPanelHeader({\n\ttitle,\n\tisFirstSection,\n\theaderActionItem,\n\ttoggleExpanded,\n\tonRightClick,\n\tisViewOnly,\n\tenabled,\n\tinTabbedPanel = false,\n\thasItems = true,\n\tcreateAction,\n\ticon,\n}: Props) {\n\t// In the tabbedLeftPanel, the header is already padded by the container\n\tconst wrapperClass = inTabbedPanel ? styles.tabbedHeaderWrapper : styles.headerWrapper\n\tconst shouldCreate = createAction && !isViewOnly && !hasItems\n\n\tconst handleMouseDown = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tswitch (event.button) {\n\t\t\t\tcase 0:\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tif (shouldCreate) {\n\t\t\t\t\t\tcreateAction(event)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\ttoggleExpanded(event)\n\t\t\t\t\treturn\n\t\t\t\tcase 2:\n\t\t\t\t\tonRightClick?.(event)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t},\n\t\t[onRightClick, createAction, shouldCreate, toggleExpanded],\n\t)\n\n\treturn (\n\t\t<div className={wrapperClass}>\n\t\t\t<PanelSectionHeader\n\t\t\t\ttitle={title}\n\t\t\t\ticon={icon}\n\t\t\t\tpanelDivider={!isFirstSection}\n\t\t\t\tonMouseDown={handleMouseDown}\n\t\t\t\tenabled={enabled}\n\t\t\t\tclickable={hasItems || !isViewOnly}\n\t\t\t>\n\t\t\t\t{headerActionItem}\n\t\t\t</PanelSectionHeader>\n\t\t</div>\n\t)\n}\n", "import \"ContentPanelHeader.styles_1tzfwoo.wyw.css\"; export const headerWrapper = \"headerWrapper_h10ktbz2\";\nexport const tabbedHeaderWrapper = \"tabbedHeaderWrapper_thjfhup\";", "import { Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\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 { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tAB_TESTS_ENTITY_TYPE_ROOT_ID,\n\tFUNNELS_ENTITY_TYPE_ROOT_ID,\n\tensureEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isEntityReferenceNode, isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { type AnalyticsTab, AnalyticsTabNames } from \"document/stores/AnalyticsStore.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { IconAgentFolder } from \"../../Pages/icons/IconAgentFolder.tsx\"\nimport { EntityRow } from \"../../assets/EntityRow.tsx\"\nimport { createAndRenameFolderNode } from \"../../assets/actions/create.ts\"\nimport { sortEntityAssetsAlphabetically } from \"../../assets/actions/sort.ts\"\nimport type { AssetRow } from \"../../assets/utils/useAssetPanelEntityRows.ts\"\nimport { ContentPanelHeader } from \"../../contentPanel/ContentPanelHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"../../properties/panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport * as styles from \"../Analytics.styles.ts\"\nimport { IconABTest, IconFunnel } from \"../icons.tsx\"\n\ninterface EntityListSectionProps {\n\trows: readonly AssetRow[]\n\thasUnreferencedItems: boolean\n\ttoggleCollapse: (id: NodeID) => void\n\thandleSelect: (id: NodeID) => void\n\thandleCreate: (event?: React.MouseEvent) => void\n}\n\ninterface AnalyticsSidebarEntityListsProps {\n\tactive: AnalyticsTab\n\tfunnels: EntityListSectionProps\n\tabTests: EntityListSectionProps\n}\n\nexport function AnalyticsSidebarEntityLists({ active, funnels, abTests }: AnalyticsSidebarEntityListsProps) {\n\tconst isViewOnly = useReadOnly()\n\n\t// Row selection helper\n\tconst isRowSelected = useCallback(\n\t\t(rowId: NodeID, rowType: \"folder\" | \"reference\", expectedTabType: \"funnel\" | \"abtest\"): boolean => {\n\t\t\tif (!active || active.tab === AnalyticsTabNames.overview) return false\n\t\t\tif (rowType === \"folder\") return false\n\n\t\t\tconst node = engine.tree.get(rowId)\n\t\t\tconst actualNodeId: NodeID = isEntityReferenceNode(node) ? node.referenceId : rowId\n\n\t\t\tif (expectedTabType === \"funnel\") {\n\t\t\t\treturn active.tab === AnalyticsTabNames.funnel && active.id === actualNodeId\n\t\t\t}\n\t\t\tif (expectedTabType === \"abtest\") {\n\t\t\t\treturn active.tab === AnalyticsTabNames.abtest && active.id === actualNodeId\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\t[active],\n\t)\n\n\tconst isFunnelRowSelected = useCallback(\n\t\t(rowId: NodeID, rowType: \"folder\" | \"reference\") => isRowSelected(rowId, rowType, \"funnel\"),\n\t\t[isRowSelected],\n\t)\n\n\tconst isAbTestRowSelected = useCallback(\n\t\t(rowId: NodeID, rowType: \"folder\" | \"reference\") => isRowSelected(rowId, rowType, \"abtest\"),\n\t\t[isRowSelected],\n\t)\n\n\t// Context menu items for funnels and A/B tests\n\tconst createFunnelContextMenuItems = useMemo(\n\t\t() => createAnalyticsItemContextMenuItems(AnalyticsTabNames.funnel, isViewOnly),\n\t\t[isViewOnly],\n\t)\n\n\tconst createAbTestContextMenuItems = useMemo(\n\t\t() => createAnalyticsItemContextMenuItems(AnalyticsTabNames.abtest, isViewOnly),\n\t\t[isViewOnly],\n\t)\n\n\t// Menu items for Funnels section\n\tconst getFunnelsSectionMenuItems = useCallback(\n\t\t(): MenuItemOptions[] => [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewFunnel,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => funnels.handleCreate(),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst root = ensureEntityTypeRootNode(engine.tree, FUNNELS_ENTITY_TYPE_ROOT_ID)\n\t\t\t\t\tcreateAndRenameFolderNode(engine, root.id, false)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\t\tvisible: funnels.rows.length > 0,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, FUNNELS_ENTITY_TYPE_ROOT_ID),\n\t\t\t},\n\t\t],\n\t\t[isViewOnly, funnels.rows.length, funnels.handleCreate],\n\t)\n\n\tconst createFunnelsSectionContextMenu = useMemo(\n\t\t() => createSectionContextMenuHandler(getFunnelsSectionMenuItems),\n\t\t[getFunnelsSectionMenuItems],\n\t)\n\n\t// Menu items for A/B Tests section\n\tconst getAbTestsSectionMenuItems = useCallback(\n\t\t(): MenuItemOptions[] => [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewABTestEllipsis,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => abTests.handleCreate(),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst root = ensureEntityTypeRootNode(engine.tree, AB_TESTS_ENTITY_TYPE_ROOT_ID)\n\t\t\t\t\tcreateAndRenameFolderNode(engine, root.id, false)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\t\tvisible: abTests.rows.length > 0,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, AB_TESTS_ENTITY_TYPE_ROOT_ID),\n\t\t\t},\n\t\t],\n\t\t[isViewOnly, abTests.rows.length, abTests.handleCreate],\n\t)\n\n\tconst createAbTestsSectionContextMenu = useMemo(\n\t\t() => createSectionContextMenuHandler(getAbTestsSectionMenuItems),\n\t\t[getAbTestsSectionMenuItems],\n\t)\n\n\t// Callback for tracking funnel entity actions (rename via inline editing)\n\t// Note: Delete tracking is handled in createAnalyticsItemContextMenuItems\n\tconst handleFunnelEntityAction = useCallback((action: string, id: NodeID) => {\n\t\tif (action === \"rename\" && isFunnelNode(engine.tree.get(id))) {\n\t\t\trecord(\"funnel_rename\", { funnelId: id })\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<>\n\t\t\t<AnalyticsEntitySection\n\t\t\t\ttitle={Dictionary.Funnels}\n\t\t\t\ttypeRootId={FUNNELS_ENTITY_TYPE_ROOT_ID}\n\t\t\t\ticon={<IconFunnel />}\n\t\t\t\theaderActionTitle=\"Add Funnel, Folder, or Sort\"\n\t\t\t\trows={funnels.rows}\n\t\t\t\thasUnreferencedItems={funnels.hasUnreferencedItems}\n\t\t\t\ttoggleCollapse={funnels.toggleCollapse}\n\t\t\t\tonSelectItem={funnels.handleSelect}\n\t\t\t\tonCreateEntity={funnels.handleCreate}\n\t\t\t\tcreateContextMenuItems={createFunnelContextMenuItems}\n\t\t\t\tgetSectionMenuItems={getFunnelsSectionMenuItems}\n\t\t\t\tcreateSectionContextMenu={createFunnelsSectionContextMenu}\n\t\t\t\tisRowSelected={isFunnelRowSelected}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tonEntityAction={handleFunnelEntityAction}\n\t\t\t/>\n\t\t\t<AnalyticsEntitySection\n\t\t\t\ttitle={Dictionary.AbTests}\n\t\t\t\ttypeRootId={AB_TESTS_ENTITY_TYPE_ROOT_ID}\n\t\t\t\ticon={<IconABTest />}\n\t\t\t\theaderActionTitle=\"Add A/B Test, Folder, or Sort\"\n\t\t\t\trows={abTests.rows}\n\t\t\t\thasUnreferencedItems={abTests.hasUnreferencedItems}\n\t\t\t\ttoggleCollapse={abTests.toggleCollapse}\n\t\t\t\tonSelectItem={abTests.handleSelect}\n\t\t\t\tonCreateEntity={abTests.handleCreate}\n\t\t\t\tcreateContextMenuItems={createAbTestContextMenuItems}\n\t\t\t\tgetSectionMenuItems={getAbTestsSectionMenuItems}\n\t\t\t\tcreateSectionContextMenu={createAbTestsSectionContextMenu}\n\t\t\t\tisRowSelected={isAbTestRowSelected}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tonEntityAction={handleFunnelEntityAction}\n\t\t\t/>\n\t\t</>\n\t)\n}\n\n// =====================\n// Supporting Components\n// =====================\n\ninterface AnalyticsHeaderActionItemProps {\n\ttitle: string\n\tisViewOnly: boolean\n\tgetMenuItems: () => MenuItemOptions[]\n}\n\nfunction AnalyticsHeaderActionItem({ title, isViewOnly, getMenuItems }: AnalyticsHeaderActionItemProps) {\n\tconst handleClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\t\t\tconst menuItems = getMenuItems()\n\t\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: { x: bounds.left, y: bounds.bottom + 4 },\n\t\t\t})\n\t\t},\n\t\t[getMenuItems],\n\t)\n\n\tif (isViewOnly) return null\n\n\treturn (\n\t\t<PanelSectionHeaderButton onClick={handleClick} title={title}>\n\t\t\t<IconSectionHeaderPlus />\n\t\t</PanelSectionHeaderButton>\n\t)\n}\n\ninterface AnalyticsEntitySectionProps {\n\ttitle: string\n\ttypeRootId: typeof FUNNELS_ENTITY_TYPE_ROOT_ID | typeof AB_TESTS_ENTITY_TYPE_ROOT_ID\n\ticon: React.ReactNode\n\theaderActionTitle: string\n\trows: readonly AssetRow[]\n\thasUnreferencedItems: boolean\n\ttoggleCollapse: (id: NodeID) => void\n\tonSelectItem: (id: NodeID) => void\n\tonCreateEntity: (event?: React.MouseEvent) => void\n\tcreateContextMenuItems: (id: NodeID, options: { startRenaming: () => void; hasSearch: boolean }) => MenuItemOptions[]\n\tgetSectionMenuItems: () => MenuItemOptions[]\n\tcreateSectionContextMenu: (event?: React.MouseEvent) => void\n\tisRowSelected: (rowId: NodeID, rowType: \"folder\" | \"reference\") => boolean\n\tisViewOnly: boolean\n\tonEntityAction?: (action: string, id: NodeID, metadata?: Record<string, unknown>) => void\n}\n\nfunction AnalyticsEntitySection({\n\ttitle,\n\ttypeRootId,\n\ticon,\n\theaderActionTitle,\n\trows,\n\thasUnreferencedItems,\n\ttoggleCollapse,\n\tonSelectItem,\n\tonCreateEntity,\n\tcreateContextMenuItems,\n\tgetSectionMenuItems,\n\tcreateSectionContextMenu,\n\tisRowSelected,\n\tisViewOnly,\n\tonEntityAction,\n}: AnalyticsEntitySectionProps) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tif (rows.length === 0 && !hasUnreferencedItems && isViewOnly) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle={title}\n\t\t\t\ttoggleExpanded={noop}\n\t\t\t\thasItems={rows.length > 0}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tcreateAction={onCreateEntity}\n\t\t\t\tonRightClick={createSectionContextMenu}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<AnalyticsHeaderActionItem\n\t\t\t\t\t\ttitle={headerActionTitle}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tgetMenuItems={getSectionMenuItems}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{rows.length > 0 && (\n\t\t\t\t<Stack gap={0} className={styles.rowsContainer}>\n\t\t\t\t\t{rows.map(row => {\n\t\t\t\t\t\tconst rawName = engine.tree.getNode(row.id)?.resolveValue(\"name\")\n\t\t\t\t\t\tconst rowTitle = rawName ?? row.title\n\t\t\t\t\t\tconst rowIcon = row.type === \"folder\" ? isAgentExperimentOn ? <IconAgentFolder /> : undefined : icon\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\ttypeRootId={typeRootId}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\ttitle={rowTitle}\n\t\t\t\t\t\t\t\tselected={isRowSelected(row.id, row.type)}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\tcolor={colors.layerItemIcon}\n\t\t\t\t\t\t\t\tinteractionBorderColor={colors.inputBorderActive}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\t\tonSelectItem={onSelectItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={hasUnreferencedItems}\n\t\t\t\t\t\t\t\ticon={rowIcon}\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={createContextMenuItems}\n\t\t\t\t\t\t\t\tonEntityAction={onEntityAction}\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</Stack>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\n// ================\n// Helper Functions\n// ================\n\n// Helper to resolve the actual entity ID from a row ID (handles reference nodes)\nexport function resolveEntityIdFromRowId(rowId: NodeID): NodeID {\n\tconst refNode = engine.tree.get(rowId)\n\tif (isEntityReferenceNode(refNode)) {\n\t\treturn refNode.referenceId\n\t}\n\treturn rowId\n}\n\n// Factory to create context menu items for analytics items (funnels or A/B tests)\nfunction createAnalyticsItemContextMenuItems(\n\ttabName: AnalyticsTabNames.funnel | AnalyticsTabNames.abtest,\n\tisViewOnly: boolean,\n) {\n\treturn (id: NodeID, options: { startRenaming: () => void; hasSearch: boolean }): MenuItemOptions[] => {\n\t\tconst entityId = resolveEntityIdFromRowId(id)\n\t\tconst entity = engine.tree.getNodeWithTrait(entityId, isFunnelNode)\n\t\tif (!entity) return []\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Rename,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: options.startRenaming,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\t// Delete both the FunnelNode and its EntityReferenceNode to avoid orphaned references\n\t\t\t\t\tconst referenceId = buildEntityReferenceNodeId(entityId)\n\t\t\t\t\tconst referenceNode = engine.tree.get(referenceId)\n\t\t\t\t\tif (referenceNode) {\n\t\t\t\t\t\tengine.tree.removeNode(referenceNode)\n\t\t\t\t\t}\n\t\t\t\t\tengine.deleteNode(entityId)\n\t\t\t\t\trecord(\"funnel_delete\", { funnelId: entityId })\n\t\t\t\t\tif (\n\t\t\t\t\t\tengine.stores.analyticsStore.active?.tab === tabName &&\n\t\t\t\t\t\tentityId === engine.stores.analyticsStore.active?.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tvoid engine.stores.analyticsStore.setActiveTab({ tab: AnalyticsTabNames.overview })\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\t}\n}\n\n// Factory to create a section context menu handler\nfunction createSectionContextMenuHandler(getMenuItems: () => MenuItemOptions[]) {\n\treturn (event?: React.MouseEvent) => {\n\t\tif (!event) return\n\t\tevent.preventDefault()\n\t\tengine.stores.contextMenuStore.show(getMenuItems(), {\n\t\t\tlocation: {\n\t\t\t\tx: event.clientX,\n\t\t\t\ty: event.clientY,\n\t\t\t},\n\t\t})\n\t}\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentFolder(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\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\td=\"M1.25 4.25v4.5a2 2 0 0 0 2 2h5.5a2 2 0 0 0 2-2V5.75a1.5 1.5 0 0 0-1.5-1.5H8a1 1 0 0 1-1-1v-.5a1.5 1.5 0 0 0-1.5-1.5H2.75a1.5 1.5 0 0 0-1.5 1.5Z\"\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 d=\"M8.5 4.25h-7\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t)\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { AnalyticsTab } from \"document/stores/AnalyticsStore.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport type React from \"react\"\nimport { CollapsibleRow } from \"../../shared/CollapsibleRow.tsx\"\n\ninterface Props {\n\ttitle: string\n\tIcon: React.FunctionComponent | React.ReactNode\n\ttab: AnalyticsTab\n\tselectedTab: AnalyticsTab\n}\n\nexport const AnalyticsSidebarRow = ({ title, Icon, tab, selectedTab }: Props) => {\n\tconst isSelected = isEqual(tab, selectedTab)\n\n\tconst updateTab = () => {\n\t\tif (isSelected) return\n\t\tengine.stores.analyticsStore.setActiveTab(tab).catch(unhandledError)\n\t}\n\n\treturn (\n\t\t<CollapsibleRow\n\t\t\tid={tab.tab}\n\t\t\ttitle={title}\n\t\t\tIcon={Icon}\n\t\t\tisSelected={isSelected}\n\t\t\tonSelect={updateTab}\n\t\t\tisEditable={false}\n\t\t\twithCollapse\n\t\t\tdepth={0}\n\t\t\tisCollapsible={false}\n\t\t/>\n\t)\n}\n", "import { Button, Progress, Stack, T } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo, useCallback } from \"react\"\nimport {\n\tgetAnalyticsEventsUpsell,\n\tshowAnalyticsEventsUpsell,\n} from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport * as styles from \"./AnalyticsSidebarUsage.styles.ts\"\n\nconst EVENTS_LIMIT_WARNING_THRESHOLD = 0.95\n\nexport const AnalyticsSidebarUsage = memo(function AnalyticsSidebarUsage() {\n\tconst { usageCurrentMonth, trackingEventsLimit } = engine.stores.projectStore.useState(state => ({\n\t\tusageCurrentMonth: state.usageData?.advancedAnalytics?.currentMonth ?? 0,\n\t\ttrackingEventsLimit: state.resourceLimits?.trackingEventsLimit ?? Infinity,\n\t}))\n\n\tconst isOverLimit = useEngineState(\n\t\t() => Boolean(getAnalyticsEventsUpsell(engine.stores.projectStore)),\n\t\t[],\n\t\t[engine.stores.projectStore],\n\t)\n\n\tconst handleUpgrade = useCallback(() => showAnalyticsEventsUpsell(engine, \"analytics_sidebar\"), [])\n\n\t// Unlimited events or no add-on, shouldn't show the meter at all\n\tif (!Number.isFinite(trackingEventsLimit) || trackingEventsLimit <= 1) {\n\t\treturn null\n\t}\n\n\tconst showWarning = usageCurrentMonth / EVENTS_LIMIT_WARNING_THRESHOLD >= trackingEventsLimit\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tdirection=\"column\"\n\t\t\tclassName={styles.borderTop}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.panelPadding}\n\t\t>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={styles.header}>\n\t\t\t\t<T>Events</T>\n\t\t\t\t<span className={cx(styles.label, showWarning && styles.warningTint)}>\n\t\t\t\t\t{usageCurrentMonth.toLocaleString()} / {trackingEventsLimit.toLocaleString()}\n\t\t\t\t</span>\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"column\" gap={dimensions.css.panelGap}>\n\t\t\t\t<Progress value={usageCurrentMonth} max={trackingEventsLimit} tint={showWarning ? \"warning\" : undefined} />\n\t\t\t\t{isOverLimit && (\n\t\t\t\t\t<Button bold onClick={handleUpgrade}>\n\t\t\t\t\t\tUpgrade\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import \"AnalyticsSidebarUsage.styles_1knaa02.wyw.css\"; export const borderTop = \"borderTop_b14nnse6\";\nexport const header = \"header_heodw72\";\nexport const label = \"label_lgcxa6y\";\nexport const warningTint = \"warningTint_wc30fcr\";", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport {\n\ta11yStyles,\n\tIconChevronLeft,\n\tReadOnlyContext,\n\tScrollWithOffsetRestoration,\n\tSpacer,\n\tStack,\n\ttruncateWithEllipsis,\n\tuseScrollOffsetRestorationCache,\n} from \"@framerjs/fresco\"\nimport { assert, assertNever, emptyArray, isCommandKeyPressed, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { CmsMetadataColumn } from \"app/agent/editor/agentInputSchema.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { switchCollectionItemOnCanvas } from \"document/components/utils/switchCollectionItemOnCanvas.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport { isCollectionNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isArrayVariable, isRequiredVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type {\n\tCollectionArrayControlDescription,\n\tCollectionControlDescription,\n} from \"document/models/controlProps/CollectionControlDescription.ts\"\nimport { isCollectionControlDescription } from \"document/models/controlProps/CollectionControlDescription.ts\"\nimport type {\n\tCollectionArrayControlProp,\n\tCollectionArrayControlPropValue,\n\tCollectionControlProp,\n} from \"document/models/controlProps/CollectionControlProp.ts\"\nimport { isStaticArrayControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type {\n\tOverlayStackElement,\n\tTemporaryCollectionStackElement,\n} from \"document/utils/contentManagementOverlayStack.ts\"\nimport { getItemNodeFromStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport React, { useCallback, useEffect, useMemo } from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { scrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport { isObject, isReadonlyArray } from \"utils/typeChecks.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { EditorOverlay, EditorOverlayToolbar, editorOverlayTransitionTimeInSeconds } from \"../shared/EditorOverlay.tsx\"\nimport { getValuePopoutButtonElementWithin } from \"../shared/PopoutButton.tsx\"\nimport { FlashElementStyle } from \"../shared/utils/flashElement.ts\"\nimport { flashPanelRow } from \"../shared/utils/flashPanelRow.ts\"\nimport { CmsAgentChatPanel, useShouldShowCmsAgentChatPanelForOverlay } from \"./CmsAgentChatPanel.tsx\"\nimport { CollectionItemFixedToolbarTopRight } from \"./CollectionItemFixedToolbarTopRight.tsx\"\nimport * as styles from \"./CollectionItemOverlay.styles.ts\"\nimport { CollectionItemSharedLinkDataProvider } from \"./CollectionItemSharedLinkDataProvider.tsx\"\nimport { CollectionItemStatusRow, getCollectionItemOverlayRowIds } from \"./CollectionItemStatusRow.tsx\"\nimport { LargeControlRow } from \"./LargeControlRow.tsx\"\nimport { LargeDividerRow } from \"./LargeDividerRow.tsx\"\nimport { getLargePanelRowId } from \"./LargePanelRow.tsx\"\nimport { LargeSlugInputRow } from \"./LargeSlugInputRow.tsx\"\nimport { LargeStringInputRow } from \"./LargeStringInputRow.tsx\"\nimport { ManagedCollectionItemHeader } from \"./ManagedCollectionItemHeader.tsx\"\nimport { RevampedCmsPopoutThemeOverride } from \"./RevampedCmsPopoutThemeOverride.tsx\"\nimport { IsWithinCollectionItemProvider } from \"./useIsWithinCollectionItem.tsx\"\nimport { useTakenSlugs } from \"./useTakenSlugs.ts\"\nimport type { CollectionItemChangeHandler } from \"./utils/CollectionItemChangeHandler.ts\"\nimport { closeCollectionItems } from \"./utils/closeCollectionItems.tsx\"\nimport { getAssociatedVariableStringValue } from \"./utils/getAssociatedVariableStringValue.ts\"\nimport { saveActivePrivateDraftCollectionItem } from \"./utils/saveActivePrivateDraftCollectionItem.ts\"\nimport { useActiveCollection } from \"./utils/useActiveCollection.ts\"\nimport { useInvalidFieldIds } from \"./utils/useInvalidFieldIds.ts\"\nimport { EscapePrecedence, useOnEscape } from \"./utils/useOnEscape.ts\"\nimport { useShowErrorsOnActiveCollectionItem } from \"./utils/useShowErrorsOnActiveCollectionItem.tsx\"\nimport { validateControlPropReference } from \"./utils/validateControlPropReference.ts\"\n\nconst collectionItemOverlayMetadataColumnIds: readonly CmsMetadataColumn[] = [collectionItemTableStatusColumnKey]\n\nexport function CollectionItemOverlay() {\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\tconst { collection, collectionItem, isPrivateDraftCollectionItem, isNested } = useActiveCollection(engine)\n\n\tif (!collection) return null\n\tif (!collectionItem) return null\n\n\treturn (\n\t\t<CollectionItemOverlayInner\n\t\t\tcollection={collection}\n\t\t\tcollectionItem={collectionItem}\n\t\t\tisViewOnly={isViewOnly}\n\t\t\tisNested={isNested}\n\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t/>\n\t)\n}\n\ninterface CollectionItemOverlayInnerProps {\n\tisViewOnly: boolean\n\tcollection: CollectionNode\n\tcollectionItem: CollectionItemNode\n\tisNested: boolean\n\tisPrivateDraftCollectionItem: boolean\n}\n\nfunction CollectionItemOverlayInner({\n\tisViewOnly,\n\tcollection,\n\tcollectionItem,\n\tisNested,\n\tisPrivateDraftCollectionItem,\n}: CollectionItemOverlayInnerProps) {\n\tconst isManagedByPlugin = Boolean(collection.managedByPlugin)\n\tconst isQuickActionsVisible = engine.stores.modalStore.useState(state => state.active.type === ModalType.QuickActions)\n\n\tconst collectionItems = collection.getSortedChildren(\"public-only\", \"group-drafts\")\n\tconst collectionPropertyControls = collection.getPropertyControls(engine.tree, engine.componentLoader)\n\n\tconst { contentManagementOverlayStack } = engine.stores.chromeStore.useState()\n\tconst { collectionItemControlToHighlight } = engine.stores.contentManagementStore.useState()\n\tconst showErrorsOnCollectionItem = useShowErrorsOnActiveCollectionItem()\n\tconst scrollRestorationCache = useStackedScrollRestorationCache(contentManagementOverlayStack)\n\tconst takenSlugs = useTakenSlugs(collection, collectionItem)\n\n\tconst invalidFieldIds = useInvalidFieldIds(\n\t\tcollectionItem,\n\t\tcollection.variables,\n\t\tcollectionPropertyControls,\n\t\ttakenSlugs,\n\t)\n\n\tconst activeOverlay = contentManagementOverlayStack.at(-1)\n\tconst activeArrayItemOverlay = activeOverlay?.type === \"arrayItem\" ? activeOverlay : null\n\tconst isArrayItemOverlayActive = !!activeArrayItemOverlay\n\tconst showAgentChatPanel = useShouldShowCmsAgentChatPanelForOverlay(activeOverlay)\n\tconst hasTemporaryCollectionItem = contentManagementOverlayStack.some(element => element.type === \"temporary\")\n\tconst showShowInvalidFieldErrorToast =\n\t\t!isArrayItemOverlayActive && !isViewOnly && showErrorsOnCollectionItem && !isPrivateDraftCollectionItem\n\n\tconst arrayFieldId = activeArrayItemOverlay?.arrayFieldId\n\tconst arrayItemId = activeArrayItemOverlay?.arrayItemId\n\tconst arrayParentItemId = activeArrayItemOverlay?.collectionItemId\n\tconst arrayVariable = arrayFieldId ? collection.getVariable(arrayFieldId) : null\n\tconst arrayControl = getCollectionArrayControl(collectionPropertyControls, arrayFieldId)\n\tconst activeItemId = isArrayItemOverlayActive ? arrayItemId : collectionItem.id\n\n\tconst controls = isArrayItemOverlayActive ? arrayControl?.control.controls : collectionPropertyControls\n\n\tconst variables = useMemo(() => {\n\t\tif (activeArrayItemOverlay) {\n\t\t\tif (!arrayVariable || !isArrayVariable(arrayVariable)) return null\n\t\t\treturn arrayVariable.itemVariables\n\t\t}\n\t\treturn collection.variables\n\t}, [collection, activeArrayItemOverlay, arrayVariable])\n\n\tconst arrayItems = useMemo<CollectionArrayControlPropValue>(() => {\n\t\tif (!arrayFieldId) return emptyArray()\n\t\tconst arrayControlProp = collectionItem.getControlProp(arrayFieldId)\n\t\tif (!arrayControlProp || !isStaticArrayControlProp(arrayControlProp)) return emptyArray()\n\t\tif (!isReadonlyArray(arrayControlProp.value)) return emptyArray()\n\t\treturn arrayControlProp.value\n\t}, [arrayFieldId, collectionItem])\n\n\tconst currentIndex = useMemo(() => {\n\t\tif (isArrayItemOverlayActive) {\n\t\t\treturn arrayItems.findIndex(item => item.id === arrayItemId)\n\t\t}\n\t\treturn collectionItems.findIndex(item => item.id === collectionItem.id)\n\t}, [isArrayItemOverlayActive, arrayItems, collectionItems, collectionItem.id, arrayItemId])\n\n\tReact.useEffect(() => {\n\t\tif (!showShowInvalidFieldErrorToast || invalidFieldIds.size === 0) return\n\n\t\tconst key = \"missing-field-errors\"\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey,\n\t\t\tvariant: \"warning\",\n\t\t\tprimaryText: \"Collection item\",\n\t\t\tsecondaryText: \"has invalid fields.\",\n\t\t\tduration: Infinity,\n\t\t})\n\n\t\treturn () => {\n\t\t\ttoast({\n\t\t\t\ttype: \"remove\",\n\t\t\t\tkey,\n\t\t\t})\n\t\t}\n\t}, [invalidFieldIds, showShowInvalidFieldErrorToast])\n\n\tReact.useEffect(() => {\n\t\tif (!collectionItemControlToHighlight) return\n\n\t\tconst panelId = getLargePanelRowId(collectionItemControlToHighlight)\n\t\tconst panelElement = document.getElementById(panelId)\n\n\t\tif (!(panelElement instanceof HTMLDivElement)) return\n\n\t\t// Adding a timeout because PromiseMirror is loaded async, its height will change pushing elements down.\n\t\tconst timeout = setTimeout(() => {\n\t\t\tconst focusableTextElement = panelElement.querySelector<HTMLInputElement | HTMLTextAreaElement>(\n\t\t\t\t\"input,textarea,[contenteditable=true]\",\n\t\t\t)\n\n\t\t\tscrollIntoView(panelElement, {\n\t\t\t\tscrollMode: \"if-needed\",\n\n\t\t\t\t// Scrolling to the start of the block ensures that the field title is always visible, which is most\n\t\t\t\t// effective on very tall fields with lots of content.\n\t\t\t\tblock: \"start\",\n\t\t\t})\n\t\t\tconst highlightingInvalidField =\n\t\t\t\t!isArrayItemOverlayActive && invalidFieldIds.has(collectionItemControlToHighlight)\n\t\t\tconst flashStyle = highlightingInvalidField ? FlashElementStyle.Warning : FlashElementStyle.Default\n\n\t\t\tflashPanelRow(panelElement, flashStyle)\n\n\t\t\tconst propertyControlToHighlight = controls?.[collectionItemControlToHighlight]\n\n\t\t\tif (propertyControlToHighlight?.type !== \"multicollectionreference\") {\n\t\t\t\tfocusableTextElement?.focus()\n\t\t\t}\n\n\t\t\t// For RichText we don't want to show the property controls popout\n\t\t\t// of module nodes inside RichText.\n\t\t\tif (propertyControlToHighlight?.type !== ControlType.RichText) {\n\t\t\t\tconst popoutButton = getValuePopoutButtonElementWithin(panelElement)\n\t\t\t\tpopoutButton?.click()\n\t\t\t}\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.contentManagementStore.clearCollectionItemControlToHighlight()\n\t\t\t})\n\t\t}, editorOverlayTransitionTimeInSeconds * 1000)\n\n\t\treturn () => {\n\t\t\tclearTimeout(timeout)\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tconst highlightingSameCollectionItem =\n\t\t\t\t\tengine.stores.contentManagementStore.collectionItemControlToHighlight === collectionItemControlToHighlight\n\t\t\t\tif (highlightingSameCollectionItem) {\n\t\t\t\t\tengine.stores.contentManagementStore.clearCollectionItemControlToHighlight()\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}, [isArrayItemOverlayActive, collectionItemControlToHighlight, invalidFieldIds, controls])\n\n\tuseRecordEffect(\"ui_impression\", { page: \"collection_item_details\" })\n\n\tuseOnEscape({\n\t\tname: \"CollectionItemOverlay\",\n\t\tprecedence: EscapePrecedence.overlay,\n\t\thandler: closeThisItem,\n\t})\n\n\tReact.useEffect(() => {\n\t\tif (!hasTemporaryCollectionItem) return\n\n\t\tconst handleBeforeUnload = (event: BeforeUnloadEvent) => {\n\t\t\tif (!engine.stores.contentManagementStore.hasAnyUnsavedTemporaryCollectionItem()) return\n\n\t\t\tevent.preventDefault()\n\t\t\t// Chrome requires returnValue to be set. This text is not\n\t\t\t// actually presented in the modal, instead browser will show\n\t\t\t// some generic copy.\n\t\t\tevent.returnValue = \"Changes that you have not saved will be discarded.\"\n\t\t}\n\t\twindow.addEventListener(\"beforeunload\", handleBeforeUnload)\n\t\treturn () => window.removeEventListener(\"beforeunload\", handleBeforeUnload)\n\t}, [hasTemporaryCollectionItem])\n\n\tconst navigate = useEngineCallback(\n\t\t(index: number) => {\n\t\t\tif (isArrayItemOverlayActive) {\n\t\t\t\tconst nextArrayItem = arrayItems[index]\n\t\t\t\tif (!nextArrayItem) return\n\t\t\t\tengine.stores.contentManagementStore.replaceActiveArrayItemOverlay(nextArrayItem.id)\n\t\t\t} else {\n\t\t\t\tconst nextItem = collectionItems[index]\n\t\t\t\tif (!nextItem) return\n\n\t\t\t\tconst activeScope = engine.stores.scopeStore.active\n\n\t\t\t\tif (isWebPageNode(activeScope)) {\n\t\t\t\t\tswitchCollectionItemOnCanvas(engine.stores, nextItem.id)\n\t\t\t\t} else {\n\t\t\t\t\tengine.stores.selectionStore.set(nextItem)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[collectionItems, arrayItems, isArrayItemOverlayActive],\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent | KeyboardEvent) => {\n\t\t\tif (event.repeat) return\n\n\t\t\t// Note: these arrow actions require the event to be in the bubbling phase, because the\n\t\t\t// text editor needs to get the opportunity to stop propagation.\n\t\t\tconst canNavigate = (!isNested && !isPrivateDraftCollectionItem) || isArrayItemOverlayActive\n\t\t\tif (canNavigate && isCommandKeyPressed(event) && event.key === \"ArrowUp\") {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tblurActiveInput()\n\t\t\t\tnavigate(currentIndex - 1)\n\t\t\t}\n\n\t\t\tif (canNavigate && isCommandKeyPressed(event) && event.key === \"ArrowDown\") {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tblurActiveInput()\n\t\t\t\tnavigate(currentIndex + 1)\n\t\t\t}\n\n\t\t\tif (isCommandKeyPressed(event) && event.key === \"s\") {\n\t\t\t\tblurActiveInput()\n\n\t\t\t\tif (engine.stores.contentManagementStore.hasActivePrivateDraftCollectionItem()) {\n\t\t\t\t\tvoid saveActivePrivateDraftCollectionItem(engine)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Allow quick actions menu to open while an input is focused\n\t\t\tif (isCommandKeyPressed(event) && event.key === \"k\" && !isQuickActionsVisible) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\t\tsource: \"shortcut\",\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[currentIndex, navigate, isArrayItemOverlayActive, isNested, isPrivateDraftCollectionItem, isQuickActionsVisible],\n\t)\n\n\tReact.useEffect(() => {\n\t\tconst abortController = new AbortController()\n\t\twindow.addEventListener(\"keydown\", handleKeyDown, {\n\t\t\tcapture: false,\n\t\t\tsignal: abortController.signal,\n\t\t})\n\t\treturn () => {\n\t\t\tabortController.abort()\n\t\t}\n\t}, [handleKeyDown])\n\n\tconst updateArrayItemField = useCallback(\n\t\t(\n\t\t\tfieldId: VariableID,\n\t\t\titemId: NodeID,\n\t\t\tgetUpdate: (current: CollectionControlProp | undefined) => CollectionControlProp | undefined,\n\t\t) => {\n\t\t\tif (!arrayFieldId || !arrayParentItemId) return\n\n\t\t\tupdateControlPropComparingLatestControlProp(\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tif (currentControlProp?.type !== ControlType.Array || !isReadonlyArray(currentControlProp.value)) {\n\t\t\t\t\t\treturn { type: ControlType.Array, value: [] } satisfies CollectionArrayControlProp\n\t\t\t\t\t}\n\n\t\t\t\t\tconst nextItems = currentControlProp.value.map(item => {\n\t\t\t\t\t\tif (item.id !== itemId || item.type !== ControlType.Object) return item\n\n\t\t\t\t\t\tconst itemValue = isObject(item.value) ? item.value : {}\n\t\t\t\t\t\tconst itemFieldControlProp = itemValue[fieldId]\n\t\t\t\t\t\tconst updatedItemFieldControlProp = getUpdate(itemFieldControlProp)\n\t\t\t\t\t\tif (!updatedItemFieldControlProp) {\n\t\t\t\t\t\t\tconst { [fieldId]: _, ...rest } = itemValue\n\t\t\t\t\t\t\treturn { ...item, value: rest }\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn { ...item, value: { ...itemValue, [fieldId]: updatedItemFieldControlProp } }\n\t\t\t\t\t})\n\n\t\t\t\t\treturn { type: ControlType.Array, value: nextItems }\n\t\t\t\t},\n\t\t\t\tarrayFieldId,\n\t\t\t\tarrayParentItemId,\n\t\t\t)\n\t\t},\n\t\t[arrayFieldId, arrayParentItemId],\n\t)\n\n\tconst handleArrayItemChange = useCallback(\n\t\t(value: CollectionControlProp, fieldId: VariableID, itemId: NodeID) => {\n\t\t\tupdateArrayItemField(fieldId, itemId, () => value)\n\t\t},\n\t\t[updateArrayItemField],\n\t)\n\n\tconst handleArrayItemChangeComparingLatest = useCallback(\n\t\t(getUpdate: CollectionItemChangeHandler, fieldId: VariableID, itemId: NodeID) => {\n\t\t\tupdateArrayItemField(fieldId, itemId, current => getUpdate(current))\n\t\t},\n\t\t[updateArrayItemField],\n\t)\n\n\tconst handleArrayItemReset = useCallback(\n\t\t(fieldId: VariableID, itemId: NodeID) => {\n\t\t\tupdateArrayItemField(fieldId, itemId, () => undefined)\n\t\t},\n\t\t[updateArrayItemField],\n\t)\n\n\tconst activeArrayItem: CollectionArrayControlPropValue[number] | null = arrayItems?.[currentIndex] ?? null\n\n\tconst getControlProp = (variableId: VariableID, control: VerifiedControlDescription) => {\n\t\tif (isArrayItemOverlayActive) {\n\t\t\tif (!activeArrayItem) return undefined\n\t\t\treturn isObject(activeArrayItem.value) ? activeArrayItem.value[variableId] : undefined\n\t\t}\n\n\t\treturn validateControlPropReference(\n\t\t\tengine.tree,\n\t\t\tassertCollectionControl(control),\n\t\t\tcollectionItem.getControlProp(variableId),\n\t\t)\n\t}\n\n\tconst { overlayRowIds, variablesById } = useMemo(() => {\n\t\tconst variableIds: readonly VariableID[] = variables?.map(getId) ?? emptyArray()\n\t\tconst showStatusRow = !isArrayItemOverlayActive\n\t\treturn {\n\t\t\toverlayRowIds: getCollectionItemOverlayRowIds(variableIds, showStatusRow),\n\t\t\tvariablesById: new Map(variables?.map(variable => [variable.id, variable])),\n\t\t}\n\t}, [variables, isArrayItemOverlayActive])\n\n\tconst collectionName = collection.resolveValue(\"name\") ?? Dictionary.Collection\n\n\tif (!variables) return null\n\tif (!activeItemId) return null\n\tif (!controls) return null\n\n\tconst onChange = isArrayItemOverlayActive ? handleArrayItemChange : updateControlProp\n\tconst onChangeComparingLatestControlProp = isArrayItemOverlayActive\n\t\t? handleArrayItemChangeComparingLatest\n\t\t: updateControlPropComparingLatestControlProp\n\tconst arrayVariableName = arrayVariable?.name ?? Dictionary.Unknown\n\tconst labelledById = isArrayItemOverlayActive ? \"array_item_overlay_heading\" : \"collection_item_overlay_heading\"\n\n\treturn (\n\t\t<IsWithinCollectionItemProvider value={true}>\n\t\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t\t<ReadOnlyContext.Provider value={isViewOnly || isManagedByPlugin}>\n\t\t\t\t\t<CollectionItemSharedLinkDataProvider>\n\t\t\t\t\t\t<EditorOverlay\n\t\t\t\t\t\t\tariaLabelledBy={labelledById}\n\t\t\t\t\t\t\tstackSize={contentManagementOverlayStack.length}\n\t\t\t\t\t\t\tdismiss={closeAllItems}\n\t\t\t\t\t\t\tblockingBackdrop={false}\n\t\t\t\t\t\t\trightSidePanel={\n\t\t\t\t\t\t\t\tshowAgentChatPanel && (\n\t\t\t\t\t\t\t\t\t<div className={cx(styles.agentChatPanelOverlay, appPointerEvents)}>\n\t\t\t\t\t\t\t\t\t\t<CmsAgentChatPanel />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttoolbar={\n\t\t\t\t\t\t\t\t<EditorOverlayToolbar\n\t\t\t\t\t\t\t\t\tcloseIcon={isNested || isArrayItemOverlayActive ? <IconChevronLeft /> : undefined /* use default */}\n\t\t\t\t\t\t\t\t\tcloseButtonVariant=\"clean\"\n\t\t\t\t\t\t\t\t\tdividerEndFlush={showAgentChatPanel}\n\t\t\t\t\t\t\t\t\tdismiss={closeThisItem}\n\t\t\t\t\t\t\t\t\tvariant=\"plain\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<OverlayHeading\n\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t\t\tvisible={isNested || isArrayItemOverlayActive}\n\t\t\t\t\t\t\t\t\t\tlabelledById={labelledById}\n\t\t\t\t\t\t\t\t\t\tisArrayItemOverlayActive={isArrayItemOverlayActive}\n\t\t\t\t\t\t\t\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t\t\t\t\t\t\t\t\tcollectionName={collectionName}\n\t\t\t\t\t\t\t\t\t\tarrayVariableName={arrayVariableName}\n\t\t\t\t\t\t\t\t\t\tcurrentIndex={currentIndex}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Spacer flex />\n\t\t\t\t\t\t\t\t</EditorOverlayToolbar>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ScrollWithOffsetRestoration\n\t\t\t\t\t\t\t\tshowScrollbar\n\t\t\t\t\t\t\t\tclassName={styles.scroll}\n\t\t\t\t\t\t\t\trestorationID={activeItemId}\n\t\t\t\t\t\t\t\trestorationCache={scrollRestorationCache}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\t\tclassName={styles.collectionItem}\n\t\t\t\t\t\t\t\t\t// We are setting the key to make sure inner input fields don't share state when changing the selection\n\t\t\t\t\t\t\t\t\tkey={activeItemId}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{!isArrayItemOverlayActive && (\n\t\t\t\t\t\t\t\t\t\t<ManagedCollectionItemHeader collection={collection} collectionItem={collectionItem} />\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{overlayRowIds.map(rowId => {\n\t\t\t\t\t\t\t\t\t\tif (rowId === collectionItemTableStatusColumnKey) {\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<CollectionItemStatusRow\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={rowId}\n\t\t\t\t\t\t\t\t\t\t\t\t\titemId={collectionItem.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisDraft={collectionItem.isDraft}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst variable = variablesById.get(rowId)\n\t\t\t\t\t\t\t\t\t\tassert(variable, \"expected variable in overlay to be found\")\n\n\t\t\t\t\t\t\t\t\t\tif (variable.type === \"divider\") {\n\t\t\t\t\t\t\t\t\t\t\treturn <LargeDividerRow key={variable.id} divider={variable} />\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tconst isRowReadOnly = isViewOnly || (isManagedByPlugin && variable.userEditable !== true)\n\n\t\t\t\t\t\t\t\t\t\tconst control = controls[variable.id]\n\t\t\t\t\t\t\t\t\t\tif (!control) return <React.Fragment key={variable.id} />\n\n\t\t\t\t\t\t\t\t\t\tconst controlProp = getControlProp(variable.id, control)\n\n\t\t\t\t\t\t\t\t\t\tswitch (variable.type) {\n\t\t\t\t\t\t\t\t\t\t\tcase \"slug\": {\n\t\t\t\t\t\t\t\t\t\t\t\tconst takenSlugsForVariable = takenSlugs.get(variable.id)\n\t\t\t\t\t\t\t\t\t\t\t\tassert(takenSlugsForVariable, \"takenSlugsForVariable is required for slug fields\")\n\t\t\t\t\t\t\t\t\t\t\t\tassert(control.type === ControlType.String, \"slug control must be a string\")\n\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ReadOnlyContext.Provider key={variable.id} value={isRowReadOnly}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LargeSlugInputRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollection={collection}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollectionItem={collectionItem}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfieldId={variable.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttakenSlugs={takenSlugsForVariable}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbasedOnVariableValue={getAssociatedVariableStringValue(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollection.variables,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollectionItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase ControlType.String:\n\t\t\t\t\t\t\t\t\t\t\t\tassert(control.type === ControlType.String, \"string control must be a string\")\n\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ReadOnlyContext.Provider key={variable.id} value={isRowReadOnly}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LargeStringInputRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbasedOnVariableValue={getAssociatedVariableStringValue(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollection.variables,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollectionItem,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tconstantChange={isPrivateDraftCollectionItem}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfallbackValueType={variable.fallbackValue}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfieldId={variable.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titemId={activeItemId}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired={isRequiredVariable(variable)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treset={isArrayItemOverlayActive ? handleArrayItemReset : resetControlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<ReadOnlyContext.Provider key={variable.id} value={isRowReadOnly}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<LargeControlRow\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcollectionId={collection.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfieldId={variable.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titemId={activeItemId}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChangeComparingLatestControlProp={onChangeComparingLatestControlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tonUnsavedChange={onUnsavedChange}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired={isRequiredVariable(variable)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treset={isArrayItemOverlayActive ? handleArrayItemReset : resetControlProp}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t</ScrollWithOffsetRestoration>\n\t\t\t\t\t\t</EditorOverlay>\n\t\t\t\t\t</CollectionItemSharedLinkDataProvider>\n\t\t\t\t\t<CollectionItemFixedToolbarTopRight\n\t\t\t\t\t\tcollection={collection}\n\t\t\t\t\t\tcollectionItem={collectionItem}\n\t\t\t\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t\t\t\t/>\n\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t</RevampedCmsPopoutThemeOverride>\n\t\t</IsWithinCollectionItemProvider>\n\t)\n}\n\nfunction OverlayHeading({\n\tvisible,\n\tisArrayItemOverlayActive,\n\tisPrivateDraftCollectionItem,\n\tisViewOnly,\n\tarrayVariableName,\n\tcurrentIndex,\n\tcollectionName,\n\tlabelledById,\n}: {\n\tvisible: boolean\n\tisArrayItemOverlayActive: boolean\n\tisPrivateDraftCollectionItem: boolean\n\tisViewOnly: boolean\n\tarrayVariableName: string\n\tcurrentIndex: number\n\tcollectionName: string\n\tlabelledById: string\n}) {\n\tlet title: string | undefined\n\tlet subTitle: string | undefined\n\n\tif (isArrayItemOverlayActive) {\n\t\ttitle = arrayVariableName\n\t\tsubTitle = `${Dictionary.Item} ${currentIndex + 1}`\n\t} else {\n\t\tif (isPrivateDraftCollectionItem) {\n\t\t\ttitle = Dictionary.NewItem\n\t\t} else if (isViewOnly) {\n\t\t\ttitle = Dictionary.Item\n\t\t} else {\n\t\t\ttitle = Dictionary.EditingItem\n\t\t}\n\t\tsubTitle = `in ${collectionName}`\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tclassName={visible ? cx(styles.overlayHeading, truncateWithEllipsis) : a11yStyles.screenReaderOnly}\n\t\t\tid={labelledById}\n\t\t>\n\t\t\t<span className={styles.overlayHeadingHighlight}>{title}</span>\n\t\t\t{` ${subTitle}`}\n\t\t</span>\n\t)\n}\n\nfunction useStackedScrollRestorationCache(contentManagementOverlayStack: readonly OverlayStackElement[]) {\n\tconst scrollRestorationCache = useScrollOffsetRestorationCache()\n\n\tuseEffect(\n\t\t// We only want to cache the scroll offset of overlay items that exist in the stack.\n\t\tfunction cleanupStackedScrollRestorationCache() {\n\t\t\tconst scrollRestorationIds: Set<NodeID> = new Set()\n\t\t\tfor (const element of contentManagementOverlayStack) {\n\t\t\t\tswitch (element.type) {\n\t\t\t\t\tcase \"existing\":\n\t\t\t\t\tcase \"temporary\":\n\t\t\t\t\tcase \"privateDraft\":\n\t\t\t\t\t\tscrollRestorationIds.add(element.itemId)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"arrayItem\":\n\t\t\t\t\t\tscrollRestorationIds.add(element.arrayItemId)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(element)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const key of scrollRestorationCache.keys()) {\n\t\t\t\tif (!scrollRestorationIds.has(key)) {\n\t\t\t\t\tscrollRestorationCache.delete(key)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[contentManagementOverlayStack, scrollRestorationCache],\n\t)\n\n\treturn scrollRestorationCache\n}\n\nfunction assertCollectionControlDescription(\n\tcontrol: VerifiedControlDescription,\n): asserts control is CollectionControlDescription {\n\tassert(isCollectionControlDescription(control), \"Expected collection control description\")\n}\n\nfunction assertCollectionControl(control: VerifiedControlDescription): CollectionControlDescription {\n\tassertCollectionControlDescription(control)\n\treturn control\n}\n\n/**\n * Trigger blur event so input state is saved. For all non-input and\n * non-textarea fields except rich text, the value is persisted on change. Rich\n * text is handled locally in `createRichTextEditorView.ts`.\n */\nfunction blurActiveInput() {\n\tconst activeElement = document.activeElement\n\n\tif (activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement) {\n\t\tactiveElement.blur()\n\t}\n}\n\nfunction updateActiveCollectionItem(getUpdate: CollectionItemChangeHandler, variableId: VariableID, id: NodeID) {\n\tconst { chromeStore, contentManagementStore, codeGenerationStore, treeStore } = engine.stores\n\tconst collectionItem = treeStore.tree.getNode<CollectionItemNode>(id)\n\t// Apply update to selected node that's already in the tree\n\tif (collectionItem) {\n\t\tconst update = getCollectionItemUpdate(collectionItem, variableId, getUpdate)\n\n\t\tif (!update) return\n\n\t\tcollectionItem.set(update)\n\n\t\tif (chromeStore.mainView === ActiveMainView.Canvas) {\n\t\t\t// On the canvas we want to regenerate the collection immediately so the values become visible in the design\n\t\t\tconst collection = treeStore.tree.getParent(id)\n\t\t\tif (isCollectionNode(collection)) {\n\t\t\t\tcodeGenerationStore.updateComponent(collection.id).catch(unhandledError)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Try to apply update to a temporary collection item node that still needs to be inserted into the tree\n\tconst temporaryCollectionStackElement = chromeStore.contentManagementOverlayStack.find(\n\t\t(element): element is TemporaryCollectionStackElement => element.type === \"temporary\" && element.itemId === id,\n\t)\n\tconst temporaryCollectionItem = getItemNodeFromStackElement({\n\t\ttreeStore,\n\t\tcontentManagementStore,\n\t\tstackElement: temporaryCollectionStackElement,\n\t})\n\tif (!temporaryCollectionItem) return\n\n\tconst update = getCollectionItemUpdate(temporaryCollectionItem, variableId, getUpdate)\n\tif (!update) return\n\n\ttemporaryCollectionItem.set(update)\n\tcontentManagementStore.didUpdateTemporaryCollectionItem()\n}\n\nfunction getCollectionItemUpdate(\n\tcollectionItem: CollectionItemNode,\n\tvariableId: VariableID,\n\tgetUpdate: CollectionItemChangeHandler,\n): Partial<CollectionItemNode> | null {\n\tconst currentControlProp = collectionItem.getControlProp(variableId)\n\tconst newControlProp = getUpdate(currentControlProp)\n\n\tconst { contentManagementStore } = engine.stores\n\n\tif (newControlProp?.type === ControlType.RichText && contentManagementStore.richTextEditorHasUnsavedChanges) {\n\t\tcontentManagementStore.richTextEditorHasUnsavedChanges = false\n\t}\n\n\tif (isEqual(currentControlProp, newControlProp)) return null\n\n\treturn prefixControlProps({ [variableId]: newControlProp })\n}\n\nconst updateControlProp = engine.scheduler.wrapHandler(\n\t(controlProp: CollectionControlProp, variableId: VariableID, id: NodeID) => {\n\t\tupdateActiveCollectionItem(() => controlProp, variableId, id)\n\t},\n)\n\n/**\n * A more advanced version of the updateControlProp function for situations which need the getUpdate\n * pattern to access the latest control prop\n */\nconst updateControlPropComparingLatestControlProp = engine.scheduler.wrapHandler(\n\t(getUpdate: CollectionItemChangeHandler, variableId: VariableID, id: NodeID) => {\n\t\tupdateActiveCollectionItem(getUpdate, variableId, id)\n\t},\n)\n\nconst resetControlProp = engine.scheduler.wrapHandler((variableId: VariableID, id: NodeID) => {\n\tupdateActiveCollectionItem(() => undefined, variableId, id)\n})\n\nconst onUnsavedChange = () => {\n\tconst { contentManagementStore } = engine.stores\n\tif (!contentManagementStore.richTextEditorHasUnsavedChanges) {\n\t\tcontentManagementStore.richTextEditorHasUnsavedChanges = true\n\t}\n}\n\nconst closeDetail = engine.scheduler.wrapHandler(\n\t({ closeAll, actionDiscard = false }: { closeAll: boolean; actionDiscard?: boolean }) => {\n\t\tvoid closeCollectionItems({\n\t\t\tengine,\n\t\t\ttarget: closeAll ? \"all\" : \"active\",\n\t\t\taction: actionDiscard ? \"discard\" : \"save\",\n\t\t})\n\t},\n)\n\nconst closeThisItem = () => {\n\tcloseDetail({ closeAll: false })\n}\n\nconst closeAllItems = () => {\n\tcloseDetail({ closeAll: true })\n}\n\nfunction getCollectionArrayControl(\n\tcollectionPropertyControls: Record<VariableID, VerifiedControlDescription>,\n\tarrayFieldId: VariableID | undefined,\n): CollectionArrayControlDescription | undefined {\n\tif (!arrayFieldId) return undefined\n\tconst control = collectionPropertyControls[arrayFieldId]\n\treturn control?.type === ControlType.Array && isCollectionControlDescription(control) ? control : undefined\n}\n", "import { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport type { ButtonProps } from \"@framerjs/fresco\"\nimport { Button, IconClose, IconCloseLarge, ProjectBarButton, Spacer, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport type { ContentManagementFieldVariant } from \"../contentManagement/fieldVariant.ts\"\nimport { stopPropagation } from \"../properties/rows/utils/stopPropagation.ts\"\nimport * as styles from \"./EditorOverlay.styles.ts\"\nimport { dataIsEditorOverlayDataAttribute } from \"./chromeHitTargets.ts\"\n\nexport const editorOverlayTransitionTimeInSeconds = 0.4\n\ninterface EditorOverlayProps {\n\tariaLabelledBy?: string\n\tclassName?: string\n\tdismiss: () => void\n\tblockingBackdrop: boolean\n\ttoolbar: React.ReactNode\n\tchildren: React.ReactNode\n\tstackSize?: number\n\trightSidePanel?: React.ReactNode\n}\n\nexport function EditorOverlay({\n\tariaLabelledBy,\n\tclassName,\n\tdismiss,\n\tblockingBackdrop,\n\ttoolbar,\n\tchildren,\n\trightSidePanel,\n\tstackSize = 0,\n}: EditorOverlayProps) {\n\tconst hasRightSidePanel = !!rightSidePanel\n\n\treturn (\n\t\t<Stack direction=\"row\" gap={0} className={styles.viewportContainer}>\n\t\t\t<div\n\t\t\t\trole=\"presentation\"\n\t\t\t\tclassName={cx(styles.backdrop, blockingBackdrop && styles.blockingBackdrop, appPointerEvents)}\n\t\t\t\tonClick={dismiss}\n\t\t\t/>\n\t\t\t<PeekingStack stackSize={stackSize} hasRightSidePanel={hasRightSidePanel} />\n\t\t\t<div\n\t\t\t\taria-labelledby={ariaLabelledBy}\n\t\t\t\t// biome-ignore lint/a11y/useSemanticElements: not worth it as the dialog element needs risky CSS changes\n\t\t\t\trole=\"dialog\"\n\t\t\t\t// Technically, when we're on the canvas, this is not a modal because you can pan the canvas\n\t\t\t\t// But to a screen reader this doesn't make a practical difference \u261D\uFE0F\uD83E\uDD13\n\t\t\t\taria-modal=\"true\"\n\t\t\t\tclassName={styles.dialog}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tkey={stackSize}\n\t\t\t\t\t{...{ [dataIsEditorOverlayDataAttribute]: true }}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\tstyles.overlayContainer,\n\t\t\t\t\t\thasRightSidePanel && styles.overlayContainerReservedForRightSidePanel,\n\t\t\t\t\t\tappPointerEvents,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Stack direction=\"column\" gap={0} onClick={stopPropagation} className={cx(styles.overlayInner)}>\n\t\t\t\t\t\t{toolbar}\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\t\t\t\t{rightSidePanel}\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n\ninterface PeekingStackProps {\n\tstackSize: number\n\thasRightSidePanel: boolean\n}\n\nfunction PeekingStack({ stackSize, hasRightSidePanel }: PeekingStackProps) {\n\tif (stackSize === 0) return null\n\n\tconst items: React.ReactNode[] = []\n\n\tfor (let overlayIndex = 0; overlayIndex < stackSize; overlayIndex++) {\n\t\tif (overlayIndex === 0) continue\n\n\t\tconst stackDepth = stackSize - overlayIndex\n\t\tif (stackDepth > styles.maxEditorOverlayPeekDepth) continue\n\n\t\tconst overlayTransform = calculatePeekTransform(stackDepth)\n\n\t\t// Make sure the peek preview never shows any content behind it\n\t\tif (overlayIndex === 1 && stackDepth <= 1) {\n\t\t\titems.push(\n\t\t\t\t<div\n\t\t\t\t\tkey=\"backing\"\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.overlayContainer,\n\t\t\t\t\t\thasRightSidePanel && styles.overlayContainerReservedForRightSidePanel,\n\t\t\t\t\t\tstyles.overlayContainerBacking,\n\t\t\t\t\t\tappPointerEvents,\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ transform: overlayTransform }}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\titems.push(\n\t\t\t<div\n\t\t\t\tkey={overlayIndex}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.overlayContainer,\n\t\t\t\t\thasRightSidePanel && styles.overlayContainerReservedForRightSidePanel,\n\t\t\t\t\tappPointerEvents,\n\t\t\t\t)}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: overlayTransform,\n\t\t\t\t}}\n\t\t\t/>,\n\t\t)\n\t}\n\n\treturn items\n}\n\nfunction calculatePeekTransform(stackDepth: number) {\n\tconst peekOffset = dimensions.values.editorOverlayPeekOffset\n\tconst offset = stackDepth < 0 ? 30 : -peekOffset * stackDepth\n\treturn `translateX(${offset}px)`\n}\n\ninterface EditorOverlayToolbarProps {\n\tdismiss: () => void\n\tchildren: React.ReactNode\n\tcloseIcon?: React.ReactNode\n\tcloseButtonVariant?: \"default\" | \"clean\"\n\tdividerEndFlush?: boolean\n\tvariant?: ContentManagementFieldVariant\n}\n\nexport function EditorOverlayToolbar({\n\tdismiss,\n\tchildren,\n\tcloseIcon,\n\tcloseButtonVariant = \"default\",\n\tdividerEndFlush = false,\n\tvariant = \"legacy\",\n}: EditorOverlayToolbarProps) {\n\tconst isLegacy = variant === \"legacy\"\n\n\tconst FallbackCloseIcon = isLegacy ? IconClose : IconCloseLarge\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\tjustifyContent=\"flex-start\"\n\t\t\talignItems=\"center\"\n\t\t\tpaddingLeft={isLegacy ? dimensions.css.panelPadding : 10}\n\t\t\tpaddingRight={isLegacy ? dimensions.css.panelPadding : 10}\n\t\t\tclassName={cx(styles.header, isLegacy && styles.headerLegacy, dividerEndFlush && styles.headerDividerEndFlush)}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<HandleClickOnClick>\n\t\t\t\t<ProjectBarButton onClick={dismiss} round variant={closeButtonVariant} className={styles.closeIconWrapper}>\n\t\t\t\t\t{closeIcon ?? <FallbackCloseIcon />}\n\t\t\t\t</ProjectBarButton>\n\t\t\t</HandleClickOnClick>\n\n\t\t\t<Spacer size={dimensions.css.inputSpacing} />\n\t\t\t<Stack direction=\"row\" justifyContent=\"end\" alignItems=\"center\" className={styles.toolbarRight}>\n\t\t\t\t{children}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nexport function EditorOverlaySaveButton({\n\ttitle,\n\tenabled,\n\tonClick,\n}: Pick<ButtonProps, \"title\" | \"enabled\" | \"onClick\">) {\n\treturn (\n\t\t<Button bold title={title} variant=\"default\" enabled={enabled} onClick={onClick} className={styles.saveButton} />\n\t)\n}\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { agentDimensionTokenOverrides } from \"app/agent/utils/dimensions.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { FlashElementStyle, flashElement, type FlashElementInset } from \"./flashElement.ts\"\n\nexport function flashPanelRow(element: HTMLDivElement, style: FlashElementStyle = FlashElementStyle.Default) {\n\tflashElement(element, {\n\t\tstyle,\n\t\tinset: getInset(),\n\t})\n}\n\nfunction getInset(): FlashElementInset {\n\tconst agentOn = experiments.isOn(\"agent\")\n\n\tconst panelPadding = agentOn ? agentDimensionTokenOverrides.panelPadding : dimensions.values.panelPadding\n\tconst plainInsetRight = -panelPadding\n\tconst plainInsetLeft = -20\n\n\t// The extra inset is added so the flash happens entirely within the panel and doesn't overlap\n\t// with the top and bottom borders of the row.\n\tconst extraInset = 2\n\n\treturn {\n\t\ttop: extraInset,\n\t\tright: plainInsetRight + extraInset,\n\t\tleft: plainInsetLeft + extraInset,\n\t\tbottom: extraInset,\n\t}\n}\n", "import { Button, IconDots, IconProjectBarPreview, ProjectBarButton, Stack, TooltipComponent } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { privateDraftCollectionItemHasUserData } from \"document/models/CanvasTree/nodes/utils/privateDraftCollectionItemHasUserData.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport React, { useCallback } from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { PublishToolbarItem } from \"../projectbar/PublishToolbarItem.tsx\"\nimport { NewIconProjectBarPreview } from \"../projectbar/icons/NewIconProjectBarPreview.tsx\"\nimport * as styles from \"./CollectionItemOverlay.styles.ts\"\nimport { getCollectionItemMenuOptions } from \"./utils/getCollectionItemMenuOptions.ts\"\nimport { saveActivePrivateDraftCollectionItem } from \"./utils/saveActivePrivateDraftCollectionItem.ts\"\n\nasync function handlePreviewClick(collection: CollectionNode) {\n\tconst { scopeStore } = engine.stores\n\tconst webPageNode = scopeStore.getWebPageNodes().find(node => node.dataIdentifier === collection.instanceIdentifier)\n\tif (webPageNode && !webPageNode.isLoaded()) {\n\t\tawait webPageNode.load()\n\t}\n\ttogglePreviewVisible(engine, { source: \"cms\" })\n}\n\ninterface Props {\n\tcollection: CollectionNode\n\tcollectionItem: CollectionItemNode\n\tisPrivateDraftCollectionItem: boolean\n}\n\nexport function CollectionItemFixedToolbarTopRight({\n\tcollection,\n\tcollectionItem,\n\tisPrivateDraftCollectionItem,\n}: Props) {\n\tconst moreOptionsButtonRef = React.useRef<HTMLButtonElement>(null)\n\tconst isPreviewEnabled = usePreviewEnabled(collectionItem?.id, isPrivateDraftCollectionItem)\n\n\tconst showOptions = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tconst template = getCollectionItemMenuOptions({\n\t\t\t\tengine,\n\t\t\t\tcollectionId: collection.id,\n\t\t\t\tcollectionItemId: collectionItem.id,\n\t\t\t\ttrackingPage: \"collection_record_menu\",\n\t\t\t})\n\t\t\tlet { clientX: x, clientY: y } = event\n\t\t\tconst buttonElement = moreOptionsButtonRef.current\n\t\t\tif (buttonElement) {\n\t\t\t\tconst buttonBounds = buttonElement.getBoundingClientRect()\n\t\t\t\tx = buttonBounds.left\n\t\t\t\ty = buttonBounds.bottom + dimensions.values.inputSpacing\n\t\t\t}\n\t\t\tengine.stores.contextMenuStore.show(template, { location: { x, y } })\n\t\t},\n\t\t[collection.id, collectionItem.id],\n\t)\n\n\treturn (\n\t\t<Stack direction=\"row\" padding={dimensions.css.panelPadding} className={styles.fixedToolbarTopRight}>\n\t\t\t<ProjectBarButton ref={moreOptionsButtonRef} className={styles.toolbarButton} onMouseDown={showOptions}>\n\t\t\t\t<IconDots />\n\t\t\t</ProjectBarButton>\n\t\t\t{engine.stores.chromeStore.displayMinimalUI ? null : (\n\t\t\t\t<PreviewButton\n\t\t\t\t\tenabled={isPreviewEnabled}\n\t\t\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t\t\t\tonPreviewClick={() => handlePreviewClick(collection)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<SaveButton\n\t\t\t\tcollection={collection}\n\t\t\t\tisPrivateDraftCollectionItem={isPrivateDraftCollectionItem}\n\t\t\t\tcollectionItem={collectionItem}\n\t\t\t/>\n\t\t\t<PublishToolbarItem />\n\t\t</Stack>\n\t)\n}\n\nfunction usePreviewEnabled(collectionItemId: NodeID | undefined, isPrivateDraftCollectionItem: boolean) {\n\tconst { previewStore } = engine.stores\n\tconst hasPreviewItem = useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => !!collectionItemId && !!previewStore.getWebPageNodeForCollectionItem(collectionItemId),\n\t\t[collectionItemId],\n\t)\n\treturn hasPreviewItem && !isPrivateDraftCollectionItem\n}\n\nfunction savePrivateDraftItem() {\n\tvoid saveActivePrivateDraftCollectionItem(engine)\n}\n\nfunction onSave() {\n\tengine.stores.contentManagementStore.richTextEditorHasUnsavedChanges = false\n}\n\nfunction PreviewButton({\n\tenabled,\n\tisPrivateDraftCollectionItem,\n\tonPreviewClick,\n}: {\n\tenabled?: boolean\n\tisPrivateDraftCollectionItem: boolean\n\tonPreviewClick: () => Promise<void>\n}) {\n\tconst ref = React.useRef<HTMLButtonElement>(null)\n\tconst arrowPosition = React.useRef<string>()\n\tconst [showTooltip, setShowTooltip] = React.useState(false)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst onMouseEnter = enabled\n\t\t? undefined\n\t\t: () => {\n\t\t\t\tsetShowTooltip(true)\n\t\t\t}\n\tconst onMouseLeave = enabled ? undefined : () => setShowTooltip(false)\n\n\treturn (\n\t\t<div className={styles.previewTooltipContainer} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n\t\t\t<ProjectBarButton\n\t\t\t\tref={ref}\n\t\t\t\tround\n\t\t\t\tvariant=\"default\"\n\t\t\t\tenabled={enabled}\n\t\t\t\tonClick={() => void onPreviewClick()}\n\t\t\t\tstyle={enabled ? undefined : { pointerEvents: \"none\" }}\n\t\t\t\tclassName={styles.toolbarButton}\n\t\t\t>\n\t\t\t\t{agentExperimentEnabled ? <NewIconProjectBarPreview /> : <IconProjectBarPreview />}\n\t\t\t</ProjectBarButton>\n\t\t\t{showTooltip && (\n\t\t\t\t<TooltipComponent\n\t\t\t\t\thideArrow={agentExperimentEnabled}\n\t\t\t\t\tarrowPosition={arrowPosition.current}\n\t\t\t\t\tclassName={styles.previewTooltip}\n\t\t\t\t\ttint={colors.popoverBackground}\n\t\t\t\t\ttooltip={<PreviewTooltip isPrivateDraftCollectionItem={isPrivateDraftCollectionItem} />}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction PreviewTooltip({ isPrivateDraftCollectionItem }: { isPrivateDraftCollectionItem: boolean }) {\n\tconst tooltipText = isPrivateDraftCollectionItem\n\t\t? \"To preview a new CMS item, fill in some content and save it with the button above.\"\n\t\t: \"To preview, add a new CMS Page in the canvas, pick your collection, then Detail Page.\"\n\n\tconst tooltipHeader = isPrivateDraftCollectionItem ? \"Save to Preview\" : \"Add CMS Page\"\n\n\tconst tooltipImage = cx(\n\t\tstyles.baseImageStyle,\n\t\tisPrivateDraftCollectionItem ? styles.previewItemSaveImage : styles.previewItemPageImage,\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<div className={tooltipImage} />\n\t\t\t<div className={styles.previewTooltipHeader}>{tooltipHeader}</div>\n\t\t\t<div>{tooltipText}</div>\n\t\t</>\n\t)\n}\n\nfunction SaveButton({\n\tcollection,\n\tisPrivateDraftCollectionItem,\n\tcollectionItem,\n}: {\n\tcollection: CollectionNode\n\tisPrivateDraftCollectionItem: boolean\n\tcollectionItem: CollectionItemNode\n}) {\n\tconst richTextEditorHasUnsavedChanges = engine.stores.contentManagementStore.useState(\n\t\tstate => state.richTextEditorHasUnsavedChanges,\n\t)\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\tconst privateDraftItemHasUserData =\n\t\tisPrivateDraftCollectionItem &&\n\t\tprivateDraftCollectionItemHasUserData({\n\t\t\tcollection,\n\t\t\tcollectionItem,\n\t\t})\n\tconst saveActionEnabled = !isViewOnly && (privateDraftItemHasUserData || richTextEditorHasUnsavedChanges)\n\tconst saveButtonAction = saveActionEnabled || isPrivateDraftCollectionItem ? Dictionary.Save : \"Saved\"\n\tconst saveButtonTitle = collectionItem.isDraft ? `${saveButtonAction} ${Dictionary.Draft}` : saveButtonAction\n\n\treturn (\n\t\t<Button\n\t\t\tbold\n\t\t\ttitle={saveButtonTitle}\n\t\t\tvariant=\"default\"\n\t\t\tenabled={saveActionEnabled}\n\t\t\tonClick={isPrivateDraftCollectionItem ? savePrivateDraftItem : onSave}\n\t\t\tclassName={collectionItem.isDraft ? styles.saveCollectionDraftItemButton : styles.saveCollectionItemButton}\n\t\t/>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getSelectedCollectionItem } from \"document/components/utils/collectionItemUtils.ts\"\nimport type { CollectionItemNode, MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\nfunction getActiveCollectionItemNodeId(engine: VekterEngine): MaybeNodeID {\n\t// Check if a collection item is shown in the content management overlay.\n\tconst activeStackElement = engine.stores.chromeStore.contentManagementOverlayStack.at(-1)\n\tif (activeStackElement) {\n\t\tif (activeStackElement.type !== \"existing\") return null\n\t\treturn activeStackElement.itemId\n\t}\n\n\t// Otherwise, check if we are viewing a CMS collection page.\n\tconst activeScope = engine.stores.scopeStore.active\n\tif (\n\t\tisWebPageNode(activeScope) &&\n\t\twithCollectionDataSource(activeScope) &&\n\t\tengine.stores.chromeStore.mainView === ActiveMainView.Canvas\n\t) {\n\t\tconst selectedItemInfo = getSelectedCollectionItem(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tactiveScope.dataIdentifier,\n\t\t\tengine.stores.scopeStore.getSelectedCollectionItemForWebPage(activeScope),\n\t\t)\n\t\treturn selectedItemInfo?.id\n\t}\n}\n\n/**\n * If the active CMS item is a draft, show a confirmation modal to the user and undraft the CMS item\n * if the user confirms.\n */\nexport async function confirmUndraftActiveCollectionItem(engine: VekterEngine): Promise<void> {\n\tconst activeCollectionItemNodeId = getActiveCollectionItemNodeId(engine)\n\tconst activeCollectionItemNode = engine.tree.getNodeWithTrait(activeCollectionItemNodeId, isCollectionItemNode)\n\tif (!activeCollectionItemNode) return\n\n\tconst isDraft = activeCollectionItemNode.isDraft === true\n\tif (!isDraft) return\n\n\tconst hasCollectionParent = isString(activeCollectionItemNode.parentid)\n\tif (!hasCollectionParent) return\n\n\tawait new Promise<void>(resolve => {\n\t\t// An async function is used to show a spinner while waiting for the codegen to finish\n\t\tconst onConfirm = (itemNode => async () => {\n\t\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\t\trecord(\"collection_record_undraft\", { source: \"confirm_publish_draft_collection_item\" })\n\t\t\t\tconst node = engine.tree.current<CollectionItemNode>(itemNode)\n\t\t\t\tnode?.set({ isDraft: undefined })\n\t\t\t})\n\n\t\t\t// Trigger the codegen for the whole collection and wait for it to finish\n\t\t\t// this makes sure the undrafted page can be published\n\t\t\tassert(itemNode.parentid, \"Collection item must have a parent\")\n\t\t\tawait engine.stores.codeGenerationStore.forceComponentUpdate(itemNode.parentid)\n\n\t\t\t// Resolve the top level promise to unblock the publish flow\n\t\t\tresolve()\n\t\t})(activeCollectionItemNode)\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.ConfirmPublishDraftCollectionItem,\n\t\t\tinteractionRequired: true,\n\t\t\tsource: \"automatic\",\n\t\t\ttitle: \"Undraft Item\",\n\t\t\tdescription: \"Would you like to keep this item as a draft, or is it ready to be published?\",\n\t\t\tconfirmLabel: \"Undraft\",\n\t\t\tcancelLabel: \"Keep Draft\",\n\t\t\tonCancel: resolve,\n\t\t\tonConfirm,\n\t\t})\n\t})\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\n/** If the active locale is a draft, show a confirmation modal to the user\n * and undraft the locale if the user confirms.\n */\nexport async function confirmUndraftActiveLocale(engine: VekterEngine): Promise<void> {\n\tlet activeLocaleId: LocaleId | null | undefined\n\tif (\n\t\tengine.stores.chromeStore.mainView === ActiveMainView.Canvas ||\n\t\tengine.stores.chromeStore.mainView === ActiveMainView.Preview\n\t) {\n\t\tactiveLocaleId = engine.stores.chromeStore.canvasLocaleId\n\t} else if (engine.stores.chromeStore.mainView === ActiveMainView.Localizations) {\n\t\tactiveLocaleId = engine.stores.localizationStore.selectedLocaleId\n\t}\n\n\tconst activeLocaleIsDraft = activeLocaleId\n\t\t? engine.tree.root.getNonDefaultLocale(activeLocaleId)?.draft === true\n\t\t: false\n\n\tif (activeLocaleId && activeLocaleIsDraft) {\n\t\tawait new Promise<void>(resolve => {\n\t\t\t// An async function is used to show a spinner while waiting for the codegen to finish\n\t\t\tconst onConfirm = ((localeId: LocaleId) => async () => {\n\t\t\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\t\t\tconst locales = engine.tree.root.locales\n\t\t\t\t\tif (!locales) return\n\t\t\t\t\tconst newLocales = locales.map(locale => {\n\t\t\t\t\t\tif (locale.id !== localeId) return locale\n\t\t\t\t\t\trecord(\"locale_update\", {\n\t\t\t\t\t\t\tdraft: false,\n\t\t\t\t\t\t\tcode: locale.code,\n\t\t\t\t\t\t\tname: locale.name,\n\t\t\t\t\t\t\tslug: locale.slug,\n\t\t\t\t\t\t\thasFallback: Boolean(locale.fallback),\n\t\t\t\t\t\t\tsource: \"confirm_publish_draft_locale\",\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn { ...locale, draft: false }\n\t\t\t\t\t})\n\t\t\t\t\tengine.tree.root.set({ locales: newLocales })\n\t\t\t\t})\n\n\t\t\t\t// Trigger the codegen and wait for it to finish\n\t\t\t\t// this makes sure the undrafted locale can be published\n\t\t\t\tawait engine.stores.codeGenerationStore.forceComponentUpdate(engine.tree.root.id)\n\n\t\t\t\t// Resolve the top level promise to unblock the publish flow\n\t\t\t\tresolve()\n\t\t\t})(activeLocaleId)\n\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConfirmPublishDraftLocale,\n\t\t\t\tinteractionRequired: true,\n\t\t\t\tsource: \"automatic\",\n\t\t\t\ttitle: \"Undraft Locale\",\n\t\t\t\tdescription: \"Would you like to keep this locale as a draft, or is it ready to be published?\",\n\t\t\t\tconfirmLabel: \"Undraft\",\n\t\t\t\tcancelLabel: \"Keep Draft\",\n\t\t\t\tonCancel: resolve,\n\t\t\t\tonConfirm,\n\t\t\t})\n\t\t})\n\t}\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\nexport function undraftPage(\n\tengine: VekterEngine,\n\twebPageId: NodeID,\n\tsource: \"context_menu\" | \"confirm_publish_draft_page\",\n) {\n\tconst setDraftStatus = engine.scheduler.wrapHandler(() => {\n\t\trecord(\"site_page_undraft\", { pageId: webPageId, source })\n\t\tconst node = engine.tree.get<WebPageNode>(webPageId)\n\t\tif (node) {\n\t\t\tnode.set({ isDraft: undefined })\n\t\t}\n\t})\n\tsetDraftStatus()\n}\n\nexport function undraftPages(engine: VekterEngine, webPageIds: NodeID[]) {\n\tengine.scheduler.process(() => {\n\t\twebPageIds.forEach(webPageId => {\n\t\t\tconst node = engine.tree.get<WebPageNode>(webPageId)\n\t\t\tif (node) {\n\t\t\t\tnode.set({ isDraft: undefined })\n\t\t\t}\n\t\t})\n\t\trecord(\"site_page_bulk_undraft\", getBulkDraftData(webPageIds))\n\t})\n}\n\nexport function markPageAsDraftWithConfirmation(engine: VekterEngine, webPageId: NodeID) {\n\tconst setDraftStatus = engine.scheduler.wrapHandler(() => {\n\t\trecord(\"site_page_draft\", { pageId: webPageId, source: \"context_menu\" })\n\t\tconst node = engine.tree.get<WebPageNode>(webPageId)\n\t\tif (node) {\n\t\t\tnode.set({ isDraft: true })\n\t\t}\n\t})\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.ConfirmCollectionItemStatusChange,\n\t\tvariant: \"destructive\",\n\t\ttitle: Dictionary.MarkAsDraft,\n\t\tdescription: \"Your page will be removed from your website after you publish your changes.\",\n\t\tconfirmLabel: \"Confirm\",\n\t\tonConfirm: setDraftStatus,\n\t\tsource: \"context_menu\",\n\t})\n}\n\nexport function markPagesAsDraftWithConfirmation(engine: VekterEngine, webPageIds: NodeID[]) {\n\tconst setDraftStatus = engine.scheduler.wrapHandler(() => {\n\t\twebPageIds.forEach(webPageId => {\n\t\t\tconst node = engine.tree.get<WebPageNode>(webPageId)\n\t\t\tif (node) {\n\t\t\t\tnode.set({ isDraft: true })\n\t\t\t}\n\t\t})\n\t\trecord(\"site_page_bulk_draft\", getBulkDraftData(webPageIds))\n\t})\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.ConfirmCollectionItemStatusChange,\n\t\tvariant: \"destructive\",\n\t\ttitle: Dictionary.MarkAsDraft,\n\t\tdescription: `Your ${webPageIds.length} page${webPageIds.length > 1 ? \"s\" : \"\"} will be removed from your website after you publish your changes.`,\n\t\tconfirmLabel: Dictionary.Confirm,\n\t\tonConfirm: setDraftStatus,\n\t\tsource: \"context_menu\",\n\t})\n}\n\nfunction getBulkDraftData(webPageIds: NodeID[]): { pageIds: string; source: \"context_menu\" } {\n\treturn {\n\t\tpageIds: webPageIds.join(\",\"),\n\t\tsource: \"context_menu\",\n\t}\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { undraftPage } from \"document/components/chrome/Pages/utils/setPageDraftStatus.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\n\n/** If the active page is a draft, show a confirmation modal to the user\n * and undraft the page if the user confirms.\n */\nexport async function confirmUndraftActivePage(engine: VekterEngine): Promise<void> {\n\tconst activePageNode =\n\t\tengine.stores.chromeStore.mainView === ActiveMainView.Canvas ||\n\t\tengine.stores.chromeStore.mainView === ActiveMainView.Preview\n\t\t\t? engine.stores.scopeStore.active\n\t\t\t: undefined\n\tif (isWebPageNode(activePageNode) && activePageNode.isDraft) {\n\t\tawait new Promise<void>(resolve => {\n\t\t\t// An async function is used to show a spinner while waiting for the codegen to finish\n\t\t\tconst onConfirm = ((pageNodeId: NodeID) => async () => {\n\t\t\t\tundraftPage(engine, pageNodeId, \"confirm_publish_draft_page\")\n\n\t\t\t\t// Trigger the codegen and wait for it to finish\n\t\t\t\t// this makes sure the undrafted page can be published\n\t\t\t\tawait engine.stores.codeGenerationStore.forceComponentUpdate(pageNodeId)\n\n\t\t\t\t// Resolve the top level promise to unblock the publish flow\n\t\t\t\tresolve()\n\t\t\t})(activePageNode.id)\n\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConfirmPublishDraftPage,\n\t\t\t\tinteractionRequired: true,\n\t\t\t\tsource: \"automatic\",\n\t\t\t\ttitle: \"Undraft Page\",\n\t\t\t\tdescription: \"Would you like to keep this page as a draft, or is it ready to be published?\",\n\t\t\t\tconfirmLabel: \"Undraft\",\n\t\t\t\tcancelLabel: \"Keep Draft\",\n\t\t\t\tonCancel: resolve,\n\t\t\t\tonConfirm,\n\t\t\t})\n\t\t})\n\t}\n}\n", "import { Button, FixedPositionTooltip, Spinner, Stack, Translatable as T, useTooltip } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { confirmUndraftActiveCollectionItem } from \"publishing/confirmUndraftActiveCollectionItem.ts\"\nimport { confirmUndraftActiveLocale } from \"publishing/confirmUndraftActiveLocale.ts\"\nimport { confirmUndraftActivePage } from \"publishing/confirmUndraftActivePage.ts\"\nimport React from \"react\"\nimport { useSingleButtonEnabled } from \"utils/projectToolbarHooks.tsx\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { usePublishableCollectionItemId } from \"web/pages/project/components/PublishPopover/utils/usePublishableCollectionItemId.ts\"\nimport { useProjectPermissions } from \"web/pages/project/permissions/useProjectPermissions.ts\"\nimport { useActiveCollection } from \"../contentManagement/utils/useActiveCollection.ts\"\nimport { type PublishLimitUpsell, getPublishBlockingUpsell } from \"../shared/UpsellModal/getUpsell.tsx\"\nimport * as styles from \"./ProjectBar.styles.ts\"\nimport { PublishLimitsTooltip } from \"./PublishLimitsTooltip.tsx\"\n\nconst displayPublishPopover = (isFullsizePreviewDisplayed: boolean) => {\n\tengine.stores.popoverStore.active = PopoverType.Publish\n\trecord(\"ui_interaction\", {\n\t\tpage: isFullsizePreviewDisplayed\n\t\t\t? MetricsInteractionViews.PREVIEW_TOOLBAR\n\t\t\t: MetricsInteractionViews.PROJECT_MENU_BAR,\n\t\tid: \"publish\",\n\t})\n}\n\nexport const PublishToolbarItem = React.memo(function PublishToolbarItem() {\n\tconst permissions = useProjectPermissions()\n\tconst publishLimitUpsell = useEngineState(\n\t\t() =>\n\t\t\tgetPublishBlockingUpsell({\n\t\t\t\tprojectStore: engine.stores.projectStore,\n\t\t\t\ttree: engine.tree,\n\t\t\t\tpublishStore: engine.stores.publishStore,\n\t\t\t}),\n\t\t[],\n\t\t[engine.stores.projectStore, engine.stores.publishStore, EngineChange.Tree],\n\t)\n\n\tconst { publishStore, chromeStore, loadingStore, popoverStore } = engine.stores\n\n\tconst { publishStatus, customHostname, isLoadingBranchPublishContext } = publishStore.useState(state => ({\n\t\tpublishStatus: state.publishStatus,\n\t\tcustomHostname: state.customHostname,\n\t\tisLoadingBranchPublishContext: state.isLoadingBranchPublishContext,\n\t}))\n\tconst readyToPublish = useDeprecatedEngineState(\n\t\t[\n\t\t\tpublishStore,\n\t\t\t// readyToPublish also depends on these:\n\t\t\tchromeStore,\n\t\t\tloadingStore,\n\t\t\tEngineChange.TreeStore,\n\t\t],\n\t\t() => publishStore.readyToPublish,\n\t)\n\n\tconst { active: activePopover } = popoverStore.useState()\n\tconst mainView = chromeStore.useState(state => state.mainView)\n\tconst isViewingBranchFromOtherUser = chromeStore.useState(state => state.isViewingBranchFromOtherUser)\n\tconst isFullsizePreviewDisplayed = mainView === ActiveMainView.Preview\n\tconst singleButtonEnabled = useSingleButtonEnabled(mainView)\n\n\tconst handlePublish = React.useCallback(async () => {\n\t\t// While the branch hostname is still loading, keep the button visually\n\t\t// unchanged but make the click a no-op instead of dimming it.\n\t\tif (isLoadingBranchPublishContext) return\n\n\t\tif (activePopover === PopoverType.Publish) {\n\t\t\tpopoverStore.active = PopoverType.None\n\t\t\treturn\n\t\t}\n\n\t\tawait confirmUndraftActiveCollectionItem(engine)\n\n\t\t// Undraft the active page if it is a draft\n\t\tawait confirmUndraftActivePage(engine)\n\n\t\t// Undraft the active locale if it is a draft\n\t\tawait confirmUndraftActiveLocale(engine)\n\n\t\tif (publishStatus !== PublishStatus.Unpublished) {\n\t\t\tdisplayPublishPopover(isFullsizePreviewDisplayed)\n\t\t\treturn\n\t\t}\n\n\t\tawait publishStore.publish()\n\t}, [publishStatus, isFullsizePreviewDisplayed, customHostname, activePopover, isLoadingBranchPublishContext])\n\n\tconst isPublishing = publishStatus === PublishStatus.Publishing\n\tconst isPublishingFromPopover = activePopover === PopoverType.Publish && isPublishing\n\n\tconst prevPublishStatus = React.useRef(publishStatus)\n\n\tReact.useEffect(() => {\n\t\tif (engine.stores.publishStore.shouldShowPublishSheetOnPublish(prevPublishStatus.current)) {\n\t\t\tengine.scheduler.processWhenReady(() => displayPublishPopover(isFullsizePreviewDisplayed))\n\t\t}\n\n\t\t// Keep track of whether the site was published or unpublished,\n\t\t// so we can automatically open the publish layer when it goes from\n\t\t// unpublished -> published.\n\t\t// Also track Unknown so that branch switches (which set status to\n\t\t// Unknown before fetching hostname data) reset the ref and don't\n\t\t// appear as an unpublished -> published transition.\n\t\tif (publishStatus !== PublishStatus.Publishing) {\n\t\t\tprevPublishStatus.current = publishStatus\n\t\t}\n\t}, [publishStatus, isFullsizePreviewDisplayed])\n\n\tconst disabledDueToLimit = publishLimitUpsell && publishStatus === PublishStatus.Unpublished\n\n\tconst disableDueToPermissions =\n\t\t!permissions.canPublish &&\n\t\t// If the site is already published, the denial permission to deploy\n\t\t// will be handled inside the popover.\n\t\tpublishStatus === PublishStatus.Unpublished\n\n\tconst { isPrivateDraftCollectionItem } = useActiveCollection(engine)\n\n\tconst isPublishEnabled =\n\t\t// Treat branch-context loading as visually enabled so the button doesn't dim\n\t\t// while fetching the hostname; the click handler no-ops in that window.\n\t\t(readyToPublish || isLoadingBranchPublishContext) &&\n\t\t!disableDueToPermissions &&\n\t\t!disabledDueToLimit &&\n\t\t!isViewingBranchFromOtherUser &&\n\t\t!isPrivateDraftCollectionItem &&\n\t\t(!isPublishing || isPublishingFromPopover) &&\n\t\t!singleButtonEnabled\n\n\tconst tooltipConfig = getTooltipConfig(readyToPublish, publishLimitUpsell, disableDueToPermissions, publishStatus)\n\n\tconst triggerRef = React.useRef<HTMLDivElement>(null)\n\tconst { triggerProps, tooltipProps } = useTooltip({\n\t\tclassName: tooltipConfig?.innerClassName,\n\t\tdisabled: !tooltipConfig,\n\t\ttriggerRef,\n\t\ttint: tooltipConfig?.tint,\n\t\tinteractive: tooltipConfig?.interactive,\n\t\tmode: tooltipConfig?.mode,\n\t\talignSelf: \"right\",\n\t\toffset: dimensions.values.popoverOffsetY,\n\t})\n\n\tconst publishableCollectionItemId = usePublishableCollectionItemId()\n\n\tconst showCenteredSpinner = isPublishing && !isPublishingFromPopover\n\tconst buttonLabel = publishableCollectionItemId ? \"Publish Item\" : \"Publish\"\n\tconst buttonAriaLabel = isPublishing ? \"Publishing\" : buttonLabel\n\n\tconst button = (\n\t\t<Button\n\t\t\taria-label={buttonAriaLabel}\n\t\t\tid=\"toolbar-publish-button\"\n\t\t\tvariant=\"withDepthPrimary\"\n\t\t\tonClick={handlePublish}\n\t\t\tenabled={isPublishEnabled}\n\t\t\tclassName={cx(styles.publishButton, showCenteredSpinner && styles.publishButtonPublishing)}\n\t\t>\n\t\t\t<div className={styles.publishButtonContentWrapper}>\n\t\t\t\t<Stack\n\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap={8}\n\t\t\t\t\tclassName={showCenteredSpinner ? styles.hidden : undefined}\n\t\t\t\t>\n\t\t\t\t\t<T>{buttonLabel}</T>\n\t\t\t\t</Stack>\n\t\t\t\t{showCenteredSpinner && <Spinner aria-hidden=\"true\" />}\n\t\t\t</div>\n\t\t</Button>\n\t)\n\n\treturn (\n\t\t<div ref={triggerRef} {...triggerProps}>\n\t\t\t{button}\n\t\t\t<FixedPositionTooltip {...tooltipProps} showArrow={false} tint={tooltipConfig?.tint}>\n\t\t\t\t{tooltipConfig?.content}\n\t\t\t</FixedPositionTooltip>\n\t\t</div>\n\t)\n})\n\ninterface TooltipConfig {\n\ttint: string\n\tinnerClassName?: string\n\tclassName?: string\n\tcontent: React.ReactNode\n\tinteractive?: boolean\n\tmode?: \"popover\"\n}\n\nfunction getTooltipConfig(\n\treadyToPublish: boolean,\n\tpublishLimitUpsell: PublishLimitUpsell | null,\n\tdisableDueToPermissions: boolean,\n\tpublishStatus: PublishStatus,\n): TooltipConfig | undefined {\n\tif (disableDueToPermissions) {\n\t\treturn {\n\t\t\ttint: colors.tint,\n\t\t\tinnerClassName: cx(styles.tooltip, styles.tooltipPublishInfo, styles.tooltipPublishInfoNarrow),\n\t\t\tcontent: \"You do not have permission to deploy the site.\",\n\t\t}\n\t}\n\n\tif (!readyToPublish) {\n\t\treturn\n\t}\n\n\tif (publishLimitUpsell && publishStatus === PublishStatus.Unpublished) {\n\t\treturn {\n\t\t\ttint: colors.popoverBackground,\n\t\t\tinnerClassName: cx(styles.tooltip, styles.tooltipPublishInstantly),\n\t\t\tcontent: <PublishLimitsTooltip upsell={publishLimitUpsell} />,\n\t\t\tinteractive: true,\n\t\t\tmode: \"popover\",\n\t\t}\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { collapsedViewBreakpoint } from \"./chromeBreakpoints.ts\"\nimport { useMediaQuery } from \"./useMediaQuery.ts\"\n\n/** If there is a value here then only that button in the toolbar should be highlighted/active */\nexport const useSingleButtonEnabled = (mainView: ActiveMainView): \"collectionSelectionButton\" | undefined => {\n\tconst isCollapsedView = useMediaQuery(`(max-width: ${collapsedViewBreakpoint}px)`)\n\tconst isLeftPanelOpenOnMobile = engine.stores.chromeStore.useState(state => state.isLeftPanelOpenOnMobile)\n\n\tif (mainView === ActiveMainView.ContentManagement && isCollapsedView && isLeftPanelOpenOnMobile) {\n\t\treturn \"collectionSelectionButton\"\n\t}\n\n\treturn undefined\n}\n", "import { DeploymentStrategy } from \"@framerjs/app-shared\"\nimport { useExperimentIs } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { getActiveCollectionStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\n\nexport function usePublishableCollectionItemId() {\n\tconst isPublishCollectionsExperimentOn = useExperimentIs(\"patching\", \"collections\")\n\tconst { chromeStore, publishStore } = engine.stores\n\n\treturn useEngineState(\n\t\t() => {\n\t\t\tif (!isPublishCollectionsExperimentOn) return\n\n\t\t\tif (chromeStore.mainView !== ActiveMainView.ContentManagement) return\n\t\t\tif (publishStore.publishStatus === PublishStatus.Unpublished) return\n\t\t\tif (publishStore.publishStatus === PublishStatus.Unknown) return\n\t\t\tif (publishStore.deploymentStrategy !== DeploymentStrategy.Manual) return\n\n\t\t\tconst deployment = publishStore.customHostnameDeployment ?? publishStore.defaultHostnameDeployment\n\t\t\tif (deployment?.treeState?.frontier === undefined) return\n\n\t\t\tconst element = getActiveCollectionStackElement(chromeStore.contentManagementOverlayStack)\n\t\t\tif (element?.type !== \"existing\") return\n\n\t\t\treturn element.itemId\n\t\t},\n\t\t[isPublishCollectionsExperimentOn],\n\t\t[chromeStore, publishStore],\n\t)\n}\n", "import type { ACLPermissions } from \"@framerjs/app-shared\"\nimport engine from \"document/engine.ts\"\nimport { ExtendedPermissions, getACLPermissions } from \"./projectPermissions.ts\"\n\n/**\n * Get extended permissions (see comments in ExtendedPermissions)\n * - Use it to evaluate wether a feature or option is available for current user; E.g. Changing site settings\n */\n\nexport function useProjectPermissions(): ExtendedPermissions {\n\tconst aclPermissions = useProjectACLPermissions()\n\tconst extendedPermissions = new ExtendedPermissions(aclPermissions)\n\treturn extendedPermissions\n}\n\n/**\n * Get only the (native) ACL permissions assigned to the user in current project\n * - Use it if you need to evaluate the user permissions as they exist in the ACL (database)\n */\n\nexport function useProjectACLPermissions(): ACLPermissions {\n\tconst { chromeStore, sessionStore, projectStore } = engine.stores\n\tconst userIsViewer = chromeStore.useState(state => state.userIsViewer)\n\tconst acl = projectStore.useState(state => state.acl)\n\tconst userId = sessionStore.useState(state => state.user?.id)\n\n\tconst aclPermissions = getACLPermissions({ userIsViewer, acl, userId })\n\n\treturn aclPermissions\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport type { OverlayStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport {\n\tgetActiveCollectionStackElement,\n\tgetCollectionNodeFromStackElement,\n\tgetCollectionStackDepth,\n\tgetItemNodeFromStackElement,\n\tisNewCollectionItemStackElement,\n} from \"document/utils/contentManagementOverlayStack.ts\"\n\ninterface ActiveCollectionResult {\n\tcollection: CollectionNode | null\n\tcollectionItem: CollectionItemNode | null\n\tisPrivateDraftCollectionItem: boolean\n\tisNested: boolean\n\tcontentManagementOverlayStack: readonly OverlayStackElement[]\n}\n\nexport function useActiveCollection(engine: VekterEngine): Readonly<ActiveCollectionResult> {\n\tconst { chromeStore, selectionStore, contentManagementStore, treeStore } = engine.stores\n\treturn useEngineState(\n\t\t(): ActiveCollectionResult => {\n\t\t\tconst { mainView, contentManagementOverlayStack } = chromeStore\n\t\t\tconst { ids } = selectionStore\n\t\t\tconst activeOverlayStackElement = contentManagementOverlayStack.at(-1)\n\t\t\tconst activeCollectionStackElement = getActiveCollectionStackElement(contentManagementOverlayStack)\n\t\t\tconst collectionStackDepth = getCollectionStackDepth(contentManagementOverlayStack)\n\t\t\tconst canvasVisible = mainView === ActiveMainView.Canvas\n\t\t\tconst mainViewSupportsOverlay = mainView === ActiveMainView.ContentManagement || canvasVisible\n\n\t\t\tif (activeOverlayStackElement && activeCollectionStackElement && mainViewSupportsOverlay) {\n\t\t\t\treturn {\n\t\t\t\t\tcollection: getCollectionNodeFromStackElement({\n\t\t\t\t\t\tstackElement: activeCollectionStackElement,\n\t\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\t}),\n\t\t\t\t\tcollectionItem: getItemNodeFromStackElement({\n\t\t\t\t\t\ttreeStore,\n\t\t\t\t\t\tcontentManagementStore,\n\t\t\t\t\t\tstackElement: activeCollectionStackElement,\n\t\t\t\t\t}),\n\t\t\t\t\tisPrivateDraftCollectionItem: isNewCollectionItemStackElement(activeCollectionStackElement),\n\t\t\t\t\tisNested: collectionStackDepth > 1,\n\t\t\t\t\tcontentManagementOverlayStack,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet firstNode: CanvasNode | null = null\n\n\t\t\tif (mainView === ActiveMainView.ContentManagement) {\n\t\t\t\tfirstNode = treeStore.tree.getNode(ids[0])\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcollection: isCollectionNode(firstNode) ? firstNode : null,\n\t\t\t\tcollectionItem: null,\n\t\t\t\tisPrivateDraftCollectionItem: false,\n\t\t\t\tisNested: false,\n\t\t\t\tcontentManagementOverlayStack,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[selectionStore, contentManagementStore, chromeStore, EngineChange.Tree],\n\t)\n}\n", "import \"ProjectBar.styles_u59c12.wyw.css\"; export const container = \"container_c1o4y51r\";\nexport const mobileBorderlessContainer = \"mobileBorderlessContainer_moyb5xl\";\nexport const tooltip = \"tooltip_to687bd\";\nexport const tooltipPublishInfo = \"tooltipPublishInfo_t5s0l8l\";\nexport const tooltipPublishInfoNarrow = \"tooltipPublishInfoNarrow_t19l9l4o\";\nexport const tooltipPublishInstantly = \"tooltipPublishInstantly_t9yymgt\";\nexport const tooltipLimits = \"tooltipLimits_t1ji8r1y\";\nexport const buttonFramerLogo = \"buttonFramerLogo_b1hqw1h1\";\nexport const framerIconButtonAsTitle = \"framerIconButtonAsTitle_f7t99wh\";\nexport const publishButton = \"publishButton_p1e61bgz\";\nexport const publishButtonPublishing = \"publishButtonPublishing_pp4nbmq\";\nexport const publishButtonContentWrapper = \"publishButtonContentWrapper_pa28x9p\";\nexport const cmsNewItemButton = \"cmsNewItemButton_c1n6cndv\";\nexport const centerBar = \"centerBar_cqltms2\";\nexport const framerIconOffset = \"framerIconOffset_f12n3i5o\";\nexport const dropdownIcon = \"dropdownIcon_dsodh5o\";\nexport const side = \"side_s1q7cda7\";\nexport const rightSide = \"rightSide_r13hmv48\";\nexport const hidden = \"hidden_h1r6nrlm\";\nexport const previewBar = \"previewBar_pe5qeq8\";\nexport const previewBarHidden = \"previewBarHidden_p1rpnece\";\nexport const previewBackButton = \"previewBackButton_p1sdp2db\";\nexport const previewBackButtonIcon = \"previewBackButtonIcon_p14hub08\";\nexport const sectionFilterButton = \"sectionFilterButton_sg5476x\";\nexport const activeSectionFilterButton = \"activeSectionFilterButton_a1k7k5uv\";\nexport const sectionFilterButtonText = \"sectionFilterButtonText_snovbpa\";\nexport const sectionFilterButtonDropdownIcon = \"sectionFilterButtonDropdownIcon_scnfuag\";\nexport const alignButtonsToSidebar = \"alignButtonsToSidebar_a7i9o0z\";", "import { AddOnLicenseType, openNewTab } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { Button, CustomButton, Modal } from \"@framerjs/fresco\"\nimport { assertNever, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport pluralize from \"pluralize\"\nimport React from \"react\"\nimport { contactSupportURL, enterpriseUpsellURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport * as styles from \"web/pages/project/components/PublishPopover/PublishPopover.styles.ts\"\nimport type { PublishLimitUpsell } from \"../shared/UpsellModal/getUpsell.tsx\"\nimport { getBandwidthAddonQuantity } from \"../siteSettings/Plans/Stripe/addOns/bandwidthAddonUtils.ts\"\nimport { UpsellAction, UpsellFeature } from \"../siteSettings/Plans/Stripe/utils/upsell.ts\"\n\nconst upsellTypeByFeature: Record<PublishLimitUpsell[\"feature\"], UpsellType> = {\n\t[UpsellFeature.pages]: UpsellType.pageLimitUpsell,\n\t[UpsellFeature.cmsCollections]: UpsellType.cmsLimitOnPublishUpsell,\n\t[UpsellFeature.cmsItems]: UpsellType.cmsItemsLimitOnPublishUpsell,\n\t[UpsellFeature.localeAddon]: UpsellType.localesLimitOnPublishUpsell,\n\t[UpsellFeature.bandwidthInGB]: UpsellType.bandwidthLimitOnPublishUpsell,\n\t[UpsellFeature.customDomainRecoverUpsell]: UpsellType.customDomainRecoverUpsell,\n}\n\nexport function getUpsellType(feature: PublishLimitUpsell[\"feature\"]): UpsellType {\n\treturn upsellTypeByFeature[feature]\n}\n\nconst titleByFeature: Record<PublishLimitUpsell[\"feature\"], string> = {\n\t[UpsellFeature.pages]: \"Page limit reached\",\n\t[UpsellFeature.cmsCollections]: \"Collection limit reached\",\n\t[UpsellFeature.cmsItems]: \"Item limit reached\",\n\t[UpsellFeature.localeAddon]: \"Locale limit reached\",\n\t[UpsellFeature.bandwidthInGB]: \"Bandwidth limit reached\",\n\t[UpsellFeature.customDomainRecoverUpsell]: \"Custom domain required\",\n}\n\nexport function getUpsellCtaLabel(upsell: PublishLimitUpsell): string {\n\tif (upsell.feature === UpsellFeature.customDomainRecoverUpsell) return \"Upgrade\"\n\n\tswitch (upsell.action) {\n\t\tcase UpsellAction.AddOn:\n\t\t\treturn `Buy ${Dictionary.AddOn}`\n\t\tcase UpsellAction.Contact:\n\t\t\treturn \"Contact Us\"\n\t\tcase UpsellAction.Upgrade:\n\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\treturn \"Upgrade\"\n\t\tdefault:\n\t\t\tassertNever(upsell.action)\n\t}\n}\n\nfunction DeleteLink({ onClick, label, className }: { onClick: () => void; label: string; className: string }) {\n\treturn (\n\t\t<CustomButton\n\t\t\tvariant=\"link\"\n\t\t\ttarget=\"_self\"\n\t\t\tonClick={(e: React.MouseEvent) => {\n\t\t\t\te.preventDefault()\n\t\t\t\tonClick()\n\t\t\t}}\n\t\t\taria-label={label}\n\t\t\tclassName={className}\n\t\t>\n\t\t\tdelete\n\t\t</CustomButton>\n\t)\n}\n\nexport function useUpsellDescription(upsell: PublishLimitUpsell): React.ReactNode {\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\n\treturn React.useMemo(() => {\n\t\tconst linkClassName = cx(styles.upsellDescriptionLink, agentExperimentIsOn && styles.upsellDescriptionLinkAgent)\n\n\t\tconst navigateToCms = engine.scheduler.wrapHandler(() => {\n\t\t\tif (engine.stores.chromeStore.mainView !== ActiveMainView.ContentManagement) {\n\t\t\t\tContextAction.toggleContentManagementScope(engine)\n\t\t\t}\n\t\t})\n\n\t\tconst navigateToLocalization = engine.scheduler.wrapHandler(() => {\n\t\t\tif (engine.stores.chromeStore.mainView !== ActiveMainView.Localizations) {\n\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(true)\n\t\t\t}\n\t\t})\n\n\t\tconst navigateToUsage = engine.scheduler.wrapHandler(() => {\n\t\t\tengine.stores.popoverStore.active = PopoverType.None\n\t\t\tvoid engine.stores.siteSettingsStore\n\t\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.usage, usageType: \"bandwidth\" })\n\t\t\t\t.catch(unhandledError)\n\t\t})\n\n\t\tswitch (upsell.feature) {\n\t\t\tcase UpsellFeature.pages: {\n\t\t\t\tconst base = `You've exceeded the ${upsell.pagesLimit} page limit on your plan`\n\t\t\t\tswitch (upsell.action) {\n\t\t\t\t\tcase UpsellAction.Contact:\n\t\t\t\t\t\treturn `${base}. Contact us to purchase more pages.`\n\t\t\t\t\tcase UpsellAction.AddOn:\n\t\t\t\t\t\treturn `${base}. To continue, purchase an add-on or delete some pages.`\n\t\t\t\t\tcase UpsellAction.Upgrade:\n\t\t\t\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\t\t\t\treturn `${base}. Upgrade your plan or delete some pages to continue.`\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(upsell.action)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase UpsellFeature.cmsCollections: {\n\t\t\t\tconst limit = upsell.cmsCollectionsLimit\n\t\t\t\tconst base = `You've exceeded the ${limit} CMS ${pluralize(\"collection\", limit)} limit on your plan`\n\t\t\t\tconst del = (\n\t\t\t\t\t<DeleteLink onClick={navigateToCms} label=\"Navigate to CMS to delete collections\" className={linkClassName} />\n\t\t\t\t)\n\t\t\t\tswitch (upsell.action) {\n\t\t\t\t\tcase UpsellAction.Contact:\n\t\t\t\t\t\treturn `${base}. Contact us to get more collections.`\n\t\t\t\t\tcase UpsellAction.AddOn:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. To continue, purchase an add-on or {del} some collections.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tcase UpsellAction.Upgrade:\n\t\t\t\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. Upgrade your plan or {del} some collections to continue.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(upsell.action)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase UpsellFeature.cmsItems: {\n\t\t\t\tconst limit = upsell.cmsItemsLimit\n\t\t\t\tconst base = `You've exceeded the ${limit} CMS ${pluralize(\"item\", limit)} limit on your plan`\n\t\t\t\tconst del = (\n\t\t\t\t\t<DeleteLink onClick={navigateToCms} label=\"Navigate to CMS to delete items\" className={linkClassName} />\n\t\t\t\t)\n\t\t\t\tswitch (upsell.action) {\n\t\t\t\t\tcase UpsellAction.Contact:\n\t\t\t\t\t\treturn `${base}. Contact us to get more items.`\n\t\t\t\t\tcase UpsellAction.AddOn:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. To continue, purchase an add-on or {del} some items.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tcase UpsellAction.Upgrade:\n\t\t\t\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. Upgrade your plan or {del} some items to continue.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(upsell.action)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase UpsellFeature.localeAddon: {\n\t\t\t\tconst base = \"You've exceeded the number of locales included in your plan\"\n\t\t\t\tconst del = (\n\t\t\t\t\t<DeleteLink\n\t\t\t\t\t\tonClick={navigateToLocalization}\n\t\t\t\t\t\tlabel=\"Navigate to localization to delete a locale\"\n\t\t\t\t\t\tclassName={linkClassName}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t\tswitch (upsell.action) {\n\t\t\t\t\tcase UpsellAction.Contact:\n\t\t\t\t\t\treturn `${base}. Contact us to get more locales.`\n\t\t\t\t\tcase UpsellAction.AddOn:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. To publish again, purchase an add-on or {del} a locale.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tcase UpsellAction.Upgrade:\n\t\t\t\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{base}. Upgrade your plan or {del} a locale to publish again.\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(upsell.action)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase UpsellFeature.bandwidthInGB: {\n\t\t\t\tconst limitLink = (\n\t\t\t\t\t<CustomButton\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\ttarget=\"_self\"\n\t\t\t\t\t\tonClick={(e: React.MouseEvent) => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tnavigateToUsage()\n\t\t\t\t\t\t}}\n\t\t\t\t\t\taria-label=\"Navigate to Usage page\"\n\t\t\t\t\t\tclassName={linkClassName}\n\t\t\t\t\t>\n\t\t\t\t\t\t{upsell.bandwidthLimit} GB bandwidth limit\n\t\t\t\t\t</CustomButton>\n\t\t\t\t)\n\t\t\t\tconst base = <>You&apos;ve exceeded the {limitLink} for the past two months</>\n\t\t\t\tswitch (upsell.action) {\n\t\t\t\t\tcase UpsellAction.Contact:\n\t\t\t\t\t\treturn <>{base}. Contact us to get more bandwidth.</>\n\t\t\t\t\tcase UpsellAction.AddOn:\n\t\t\t\t\t\treturn <>{base}. Purchase an add-on to publish changes again.</>\n\t\t\t\t\tcase UpsellAction.Upgrade:\n\t\t\t\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\t\t\t\treturn <>{base}. Upgrade your plan to publish changes again.</>\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(upsell.action)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcase UpsellFeature.customDomainRecoverUpsell:\n\t\t\t\treturn \"Your site has a custom domain, which is a paid feature. Upgrade your plan or remove the domain to publish again.\"\n\n\t\t\tdefault:\n\t\t\t\tassertNever(upsell)\n\t\t}\n\t}, [upsell, agentExperimentIsOn])\n}\n\ntype UpsellWithAction = Exclude<PublishLimitUpsell, { feature: UpsellFeature.customDomainRecoverUpsell }>\n\ninterface ActionHandlerConfig {\n\taddonLicenseType: AddOnLicenseType\n\tenterpriseDescription: string\n\tenterpriseUpsellType: UpsellType\n\tenterpriseFeatures: string[]\n\tcontactUrl: string\n}\n\nconst enterpriseSignUpPrefix = \"Sign up for an Enterprise plan to\"\n\nconst defaultEnterpriseFeatures = [\n\t\"Custom Limits\",\n\t\"Custom Hosting\",\n\t\"Custom Proxy Support\",\n\t\"Enterprise Security\",\n\t\"Dedicated Support\",\n]\n\nconst actionConfigByFeature: Record<UpsellWithAction[\"feature\"], ActionHandlerConfig> = {\n\t[UpsellFeature.pages]: {\n\t\taddonLicenseType: AddOnLicenseType.Pages,\n\t\tenterpriseDescription: `${enterpriseSignUpPrefix} increase your pages limit and unlock other powerful features.`,\n\t\tenterpriseUpsellType: UpsellType.pageLimitEnterpriseUpsell,\n\t\tenterpriseFeatures: defaultEnterpriseFeatures,\n\t\tcontactUrl: contactSupportURL,\n\t},\n\t[UpsellFeature.cmsCollections]: {\n\t\taddonLicenseType: AddOnLicenseType.CmsCollections,\n\t\tenterpriseDescription: `${enterpriseSignUpPrefix} increase your CMS collections limit and unlock other powerful features.`,\n\t\tenterpriseUpsellType: UpsellType.cmsCollectionsEnterpriseUpsell,\n\t\tenterpriseFeatures: defaultEnterpriseFeatures,\n\t\tcontactUrl: contactSupportURL,\n\t},\n\t[UpsellFeature.cmsItems]: {\n\t\taddonLicenseType: AddOnLicenseType.CmsItems,\n\t\tenterpriseDescription: `${enterpriseSignUpPrefix} increase your CMS items limit and unlock other powerful features.`,\n\t\tenterpriseUpsellType: UpsellType.cmsItemsEnterpriseUpsell,\n\t\tenterpriseFeatures: defaultEnterpriseFeatures,\n\t\tcontactUrl: contactSupportURL,\n\t},\n\t[UpsellFeature.localeAddon]: {\n\t\taddonLicenseType: AddOnLicenseType.Locale,\n\t\tenterpriseDescription: `${enterpriseSignUpPrefix} have more locales with unlimited translations and powerful features that will speed up your workflow.`,\n\t\tenterpriseUpsellType: UpsellType.localizationEnterpriseUpsell,\n\t\tenterpriseFeatures: [\n\t\t\t\"Unlimited Locales\",\n\t\t\t\"Unlimited Words\",\n\t\t\t\"One-Click Site Translation\",\n\t\t\t\"Localized Components\",\n\t\t\t\"Image Localization\",\n\t\t\t\"Visibility Logic\",\n\t\t],\n\t\tcontactUrl: enterpriseUpsellURL,\n\t},\n\t[UpsellFeature.bandwidthInGB]: {\n\t\taddonLicenseType: AddOnLicenseType.Bandwidth,\n\t\tenterpriseDescription: `${enterpriseSignUpPrefix} get custom bandwidth limits and access to other powerful features.`,\n\t\tenterpriseUpsellType: UpsellType.bandwidthEnterpriseUpsell,\n\t\tenterpriseFeatures: [\n\t\t\t\"Custom Bandwidth Limits\",\n\t\t\t\"Custom Hosting\",\n\t\t\t\"Custom Proxy Support\",\n\t\t\t\"Enterprise Security\",\n\t\t\t\"Dedicated Support\",\n\t\t],\n\t\tcontactUrl: contactSupportURL,\n\t},\n}\n\nfunction getAddonInfo(upsell: UpsellWithAction) {\n\tswitch (upsell.feature) {\n\t\tcase UpsellFeature.pages:\n\t\t\treturn { addonLicenseType: AddOnLicenseType.Pages, quantity: upsell.pagesCount } as const\n\t\tcase UpsellFeature.cmsCollections:\n\t\t\treturn { addonLicenseType: AddOnLicenseType.CmsCollections, quantity: upsell.cmsCollectionsCount } as const\n\t\tcase UpsellFeature.cmsItems:\n\t\t\treturn { addonLicenseType: AddOnLicenseType.CmsItems, quantity: upsell.cmsItemsCount } as const\n\t\tcase UpsellFeature.localeAddon:\n\t\t\treturn { addonLicenseType: AddOnLicenseType.Locale } as const\n\t\tcase UpsellFeature.bandwidthInGB:\n\t\t\treturn {\n\t\t\t\taddonLicenseType: AddOnLicenseType.Bandwidth,\n\t\t\t\tquantity: getBandwidthAddonQuantity(upsell.bandwidthUsage),\n\t\t\t} as const\n\t\tdefault:\n\t\t\tassertNever(upsell)\n\t}\n}\n\nexport function handleUpsellAction(\n\tvekterEngine: VekterEngine,\n\tupsell: UpsellWithAction,\n\thandleUpgrade: () => void,\n): void {\n\tconst config = actionConfigByFeature[upsell.feature]\n\n\tswitch (upsell.action) {\n\t\tcase UpsellAction.AddOn:\n\t\t\tvekterEngine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.AcquireAddonModal,\n\t\t\t\tsource: \"toolbar\",\n\t\t\t\taddonInfo: getAddonInfo(upsell),\n\t\t\t})\n\t\t\treturn\n\n\t\tcase UpsellAction.Upgrade:\n\t\t\thandleUpgrade()\n\t\t\treturn\n\n\t\tcase UpsellAction.UpgradeToEnterprise:\n\t\t\tvekterEngine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.UpsellEnterprise,\n\t\t\t\tsource: \"toolbar\",\n\t\t\t\tdescription: config.enterpriseDescription,\n\t\t\t\tupsell: config.enterpriseUpsellType,\n\t\t\t\tupsellFeatures: config.enterpriseFeatures,\n\t\t\t})\n\t\t\treturn\n\n\t\tcase UpsellAction.Contact:\n\t\t\topenNewTab(config.contactUrl)\n\t\t\treturn\n\n\t\tdefault:\n\t\t\tassertNever(upsell.action)\n\t}\n}\n\nexport function useUpsellCtaHandler(upsell: PublishLimitUpsell | null): (() => void) | undefined {\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\tconst licenseTypes = engine.stores.projectStore.useState(\n\t\t({ project }) =>\n\t\t\t(project && { projectId: project.id, site: project.license.type, team: project.teamLicenseType }) ?? null,\n\t)\n\n\treturn React.useMemo(() => {\n\t\tif (!upsell) return undefined\n\n\t\tconst upsellType = getUpsellType(upsell.feature)\n\n\t\tconst handleUpgrade = (): void => {\n\t\t\tupdatePurchaseOrigin(upsellType, licenseTypes, null)\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: upsellType,\n\t\t\t\tid: UpsellUIInteraction.navigateToPlans,\n\t\t\t})\n\n\t\t\treturn void engine.stores.siteSettingsStore\n\t\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.plans, upsellFeature: upsell.feature })\n\t\t\t\t.catch(unhandledError)\n\t\t}\n\n\t\tif (upsell.feature === UpsellFeature.customDomainRecoverUpsell) return handleUpgrade\n\n\t\treturn () => handleUpsellAction(engine, upsell, handleUpgrade)\n\t}, [upsell, licenseTypes, updatePurchaseOrigin])\n}\n\nexport function PublishLimitsTooltip({ upsell }: { upsell: PublishLimitUpsell }) {\n\tconst upsellType = getUpsellType(upsell.feature)\n\tconst title = titleByFeature[upsell.feature]\n\tconst description = useUpsellDescription(upsell)\n\tconst ctaLabel = getUpsellCtaLabel(upsell)\n\tconst ctaOnClick = useUpsellCtaHandler(upsell)\n\n\tuseRecordEffect(\"ui_impression\", { page: upsellType }, [upsellType])\n\n\t/**\n\t * Despite the fact this is going to be used inside a fixed position tooltip or popover we want\n\t * the content to be displayed like in a modal and to follow the modal components styles.\n\t */\n\treturn (\n\t\t<div className={styles.upsellTooltip}>\n\t\t\t<Modal.Header>{title}</Modal.Header>\n\t\t\t<Modal.Content>\n\t\t\t\t<Modal.Text>{description}</Modal.Text>\n\t\t\t</Modal.Content>\n\t\t\t<Modal.Footer>\n\t\t\t\t<Button className={cx(styles.button, styles.secondaryButton)} onClick={ctaOnClick}>\n\t\t\t\t\t{ctaLabel}\n\t\t\t\t</Button>\n\t\t\t</Modal.Footer>\n\t\t</div>\n\t)\n}\n", "import \"PublishPopover.styles_145qsw5.wyw.css\"; export const container = \"container_c70v5i5\";\nexport const backButton = \"backButton_b1m6d3um\";\nexport const backButtonVisible = \"backButtonVisible_ba9eeph\";\nexport const panel = \"panel_pklurhb\";\nexport const mainContent = \"mainContent_mg8hahu\";\nexport const hideMainContent = \"hideMainContent_h7ed8wv\";\nexport const secondaryPanel = \"secondaryPanel_s42o8li\";\nexport const hideSecondaryPanel = \"hideSecondaryPanel_h1agk2wg\";\nexport const button = \"button_b1854po0\";\nexport const secondaryButton = \"secondaryButton_s1p0yt0i\";\nexport const buttonWithCheckmark = \"buttonWithCheckmark_bshjax2\";\nexport const progressCount = \"progressCount_p1gzj9e3\";\nexport const tooltip = \"tooltip_t15kuguu\";\nexport const hostname = \"hostname_h1q39ypx\";\nexport const description = \"description_d1exh9nz\";\nexport const link = \"link_ltq4iqk\";\nexport const warning = \"warning_wrnc4ju\";\nexport const divider = \"divider_d16wl99r\";\nexport const error = \"error_e1kdm6pf\";\nexport const optimizedSiteColor = \"optimizedSiteColor_o104bm00\";\nexport const upsellDescription = \"upsellDescription_ug5h9ni\";\nexport const upsellTitle = \"upsellTitle_ufjhid9\";\nexport const upsellContent = \"upsellContent_u1fpmfy7\";\nexport const upsellTooltip = \"upsellTooltip_uce1a85\";\nexport const upsellDescriptionLink = \"upsellDescriptionLink_uunk52c\";\nexport const upsellDescriptionLinkAgent = \"upsellDescriptionLinkAgent_u1k56088\";", "import { MAX_BANDWIDTH_WITH_ADDONS_GB } from \"../../../Usage/constants.ts\"\n\n/**\n * Calculates the bandwidth addon quantity needed, capped at the maximum allowed.\n * Takes the current usage and returns the minimum of usage and max bandwidth.\n *\n * We cap at 2TB rather than blocking or requiring Enterprise immediately because:\n * - Bandwidth usage is driven by visitors, not by site building (unlike pages/CMS)\n * - Usage can spike unexpectedly while the user isn't actively in Framer\n * - Allowing users to purchase up to the maximum addon capacity (2TB on Scale)\n *   provides a grace period and ensures we charge for what we can while they\n *   upgrade or decide if Enterprise is right for them\n * - The alternative (blocking the site or requiring immediate Enterprise upgrade)\n *   would hurt accidental spikes more than help intentional high-usage cases\n */\nexport function getBandwidthAddonQuantity(usageInGB: number): number {\n\treturn Math.min(Math.ceil(usageInGB), MAX_BANDWIDTH_WITH_ADDONS_GB)\n}\n", "export function NewIconProjectBarPreview() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path\n\t\t\t\td=\"M6.272 2.863A1.5 1.5 0 0 0 4 4.149v9.702a1.5 1.5 0 0 0 2.272 1.286l8.084-4.851a1.5 1.5 0 0 0 0-2.572Z\"\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=\"2\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"CollectionItemOverlay.styles_1w2yjmm.wyw.css\"; import { popoverInset } from \"@framerjs/fresco\";\nimport { cx } from \"@linaria/core\";\nexport const overlayHeading = \"overlayHeading_o1s1o1na\";\nexport const fixedToolbarTopRight = \"fixedToolbarTopRight_fcytzn5\";\nexport const scroll = \"scroll_s63bkl5\";\nexport const agentChatPanelOverlay = \"agentChatPanelOverlay_aibhli\";\nexport const overlayHeadingHighlight = \"overlayHeadingHighlight_oiyeexj\";\nexport const previewTooltipContainer = \"previewTooltipContainer_p1teh0ce\";\nexport const toolbarButton = \"toolbarButton_t1es9x9o\";\nexport const previewTooltip = cx(popoverInset, \"previewTooltip_patr55r\");\nexport const previewTooltipHeader = \"previewTooltipHeader_pjqm0uw\";\nexport const baseImageStyle = \"baseImageStyle_b64qmp6\";\nexport const previewItemPageImage = \"previewItemPageImage_p1wjl2co\";\nexport const previewItemSaveImage = \"previewItemSaveImage_p1ik2g36\";\nexport const saveCollectionItemButton = \"saveCollectionItemButton_sggdms4\";\nexport const saveCollectionDraftItemButton = \"saveCollectionDraftItemButton_s13k1bqb\";\nexport const collectionItem = \"collectionItem_cqf4vu0\";", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { ReactNode } from \"react\"\nimport { LinkInputSharedDataProvider } from \"../shared/LinkInputSharedData.tsx\"\n\nexport function CollectionItemSharedLinkDataProvider({ children }: { children: ReactNode }) {\n\tconst engine = useBaseEngine()\n\tconst tree = useEngineState(() => engine.tree, [], EngineChange.Tree)\n\n\treturn (\n\t\t<LinkInputSharedDataProvider tree={tree} variableInfo={null}>\n\t\t\t{children}\n\t\t</LinkInputSharedDataProvider>\n\t)\n}\n", "import { PopupButton, PopupButtonItem, Stack } from \"@framerjs/fresco\"\nimport { List } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport React from \"react\"\nimport * as booleanRowStyles from \"./LargeBooleanInputRows.styles.ts\"\nimport { collectionInputTextOffsetPaddingLeft } from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport {\n\tcollectionItemTableDraftStatus,\n\tcollectionItemTableLiveStatus,\n\tcollectionItemTableStatusControl,\n\tgetCollectionItemTableStatusPillTone,\n\tgetCollectionItemTableStatusValue,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\nimport { setCollectionItemsStatusWithConfirmation } from \"./utils/contentManagementActions.tsx\"\n\nexport function getCollectionItemOverlayRowIds(\n\tvariableIds: readonly VariableID[],\n\tshowStatusRow: boolean,\n): readonly string[] {\n\tif (!showStatusRow) return variableIds\n\n\tconst insertionIndex = Math.min(2, variableIds.length)\n\treturn List.insert(variableIds, insertionIndex, collectionItemTableStatusColumnKey)\n}\n\ninterface CollectionItemStatusRowProps {\n\titemId: NodeID\n\tisDraft: true | undefined\n}\n\nexport const CollectionItemStatusRow = React.memo(function CollectionItemStatusRow({\n\titemId,\n\tisDraft,\n}: CollectionItemStatusRowProps) {\n\tconst statusValue = getCollectionItemTableStatusValue({ isDraft })\n\tconst statusTone = getCollectionItemTableStatusPillTone(statusValue)\n\n\tfunction handleStatusChange(newDraftStatus: true | undefined) {\n\t\tsetCollectionItemsStatusWithConfirmation(engine, [itemId], newDraftStatus, \"collection_item_overlay\")\n\t}\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={undefined}\n\t\t\teditFieldEnabled={false}\n\t\t\tfieldId={collectionItemTableStatusColumnKey}\n\t\t\ttitle={collectionItemTableStatusControl.title}\n\t\t>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={cx(booleanRowStyles.inputHeight, collectionInputTextOffsetPaddingLeft)}\n\t\t\t>\n\t\t\t\t<PopupButton aria-label={collectionItemTableStatusControl.title} variant=\"pill\" pillTone={statusTone}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={collectionItemTableDraftStatus}\n\t\t\t\t\t\tselected={statusValue === collectionItemTableDraftStatus}\n\t\t\t\t\t\tonSelect={() => handleStatusChange(true)}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={collectionItemTableLiveStatus}\n\t\t\t\t\t\tselected={statusValue === collectionItemTableLiveStatus}\n\t\t\t\t\t\tonSelect={() => handleStatusChange(undefined)}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t</Stack>\n\t\t</LargePanelRow>\n\t)\n})\n", "import { Button, truncateWithEllipsis, useReadOnly } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableID, VariableOrDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isArrayVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getCollectionNodeFromStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { useCallback } from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useVariableActions } from \"../shared/VariablesModal/useVariableActions.ts\"\nimport { FieldSettingsPopout } from \"./FieldSettingsPopout.tsx\"\nimport * as styles from \"./LargePanelRow.styles.ts\"\nimport { useIsEditFieldsUseableInScreen } from \"./utils/screenFeatureUtils.ts\"\n\ninterface OverlayFieldTitlePopoutProps {\n\tfieldId: VariableID\n\ttitle: string\n\t/** Whether the parent opts this field into the \"Edit Field\" feature (opens the settings popout). */\n\teditFieldEnabled: boolean\n\tisDivider?: boolean\n}\n\nexport function OverlayFieldTitlePopout({ fieldId, title, editFieldEnabled, isDivider }: OverlayFieldTitlePopoutProps) {\n\t// Fresco surface-level read-only context; drives the muted title styling.\n\tconst isReadOnly = useReadOnly()\n\t// Screen is wide enough to support the field editing UI.\n\tconst isEditFieldsUseableInScreen = useIsEditFieldsUseableInScreen()\n\t// Current user's role does not grant permission to edit collection variables.\n\tconst userCannotEditVariables = useIsViewOnly(\"canEditVariables\")\n\n\tconst isContentManagementScope = engine.stores.scopeStore.useState(\n\t\tstate => state.scopeType === ScopeType.ContentManagement,\n\t)\n\n\tconst { variable, variables, isManagedByPlugin, parentVariableId, nodeWithVariablesId } = useEngineState(\n\t\t() => getFieldInfo(fieldId),\n\t\t[fieldId],\n\t\t[engine.stores.scopeStore, engine.stores.selectionStore, engine.stores.chromeStore, EngineChange.Tree],\n\t)\n\n\tconst fieldIsReadOnly = userCannotEditVariables || isManagedByPlugin\n\n\tconst { updateVariable } = useVariableActions({\n\t\tnodeWithVariablesId,\n\t\tisReadOnly: fieldIsReadOnly,\n\t})\n\n\tconst handleUpdateVariable = useCallback(\n\t\t(getUpdate: (current: VariableOrDivider) => VariableOrDivider) => {\n\t\t\tassert(variable, \"Variable is required\")\n\n\t\t\tconst variableToUpdatePath: SelectedVariablePath = parentVariableId\n\t\t\t\t? [parentVariableId, variable.id]\n\t\t\t\t: [variable.id]\n\t\t\tupdateVariable(getUpdate, variableToUpdatePath)\n\t\t},\n\t\t[updateVariable, parentVariableId, variable],\n\t)\n\n\tif (!nodeWithVariablesId) return null\n\n\tconst canOpenFieldSettings = Boolean(\n\t\tvariable && variables && editFieldEnabled && isEditFieldsUseableInScreen && isContentManagementScope,\n\t)\n\n\tconst titleButton = (\n\t\t<Button\n\t\t\ttabIndex={-1}\n\t\t\ttitle={title}\n\t\t\tvariant=\"clean\"\n\t\t\tenabled={canOpenFieldSettings}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.largeControlRowTitle,\n\t\t\t\tstyles.largeControlRowTitleInsetMobile,\n\t\t\t\tisDivider && styles.largeControlRowTitleDivider,\n\t\t\t\ttruncateWithEllipsis,\n\t\t\t\tisReadOnly && styles.largeControlRowTitleReadOnly,\n\t\t\t)}\n\t\t>\n\t\t\t{title}\n\t\t</Button>\n\t)\n\n\tif (!canOpenFieldSettings) {\n\t\treturn titleButton\n\t}\n\n\tassert(variable, \"Variable is required\")\n\tassert(variables, \"Variables are required\")\n\n\treturn (\n\t\t<FieldSettingsPopout\n\t\t\tvariable={variable}\n\t\t\tvariables={variables}\n\t\t\treadOnly={fieldIsReadOnly}\n\t\t\tonUpdate={handleUpdateVariable}\n\t\t>\n\t\t\t{titleButton}\n\t\t</FieldSettingsPopout>\n\t)\n}\n\nfunction getArrayFieldIdFromOverlayStack(): VariableID | undefined {\n\tconst stack = engine.stores.chromeStore.contentManagementOverlayStack\n\tconst activeOverlay = stack.at(-1)\n\tif (activeOverlay?.type === \"arrayItem\") return activeOverlay.arrayFieldId\n\treturn undefined\n}\n\ninterface FieldInfo {\n\tvariable: VariableOrDivider | null\n\tvariables: readonly VariableOrDivider[] | null\n\tisManagedByPlugin: boolean\n\tparentVariableId?: VariableID\n\tnodeWithVariablesId: CollectionNode[\"id\"] | null\n}\n\nconst emptyFieldInfo: FieldInfo = {\n\tvariable: null,\n\tvariables: null,\n\tisManagedByPlugin: false,\n\tparentVariableId: undefined,\n\tnodeWithVariablesId: null,\n}\n\nfunction getFieldInfo(fieldId: VariableID): FieldInfo {\n\tconst collectionNode = getCollectionNodeForFieldLookup()\n\tif (!collectionNode) return emptyFieldInfo\n\n\tconst managed = Boolean(collectionNode.managedByPlugin)\n\tconst arrayFieldId = getArrayFieldIdFromOverlayStack()\n\n\tif (arrayFieldId) {\n\t\tconst parentVariable = collectionNode.getVariable(arrayFieldId)\n\t\tif (!parentVariable || !isArrayVariable(parentVariable)) {\n\t\t\treturn { ...emptyFieldInfo, isManagedByPlugin: managed, nodeWithVariablesId: collectionNode.id }\n\t\t}\n\t\tconst itemVariable = parentVariable.itemVariables.find(variable => variable.id === fieldId)\n\t\treturn {\n\t\t\tvariable: itemVariable ?? null,\n\t\t\tvariables: parentVariable.itemVariables,\n\t\t\tisManagedByPlugin: managed,\n\t\t\tparentVariableId: parentVariable.id,\n\t\t\tnodeWithVariablesId: collectionNode.id,\n\t\t}\n\t}\n\n\tconst foundVariable = collectionNode.variables.find(variable => variable.id === fieldId)\n\treturn {\n\t\tvariable: foundVariable ?? null,\n\t\tvariables: collectionNode.variables,\n\t\tisManagedByPlugin: managed,\n\t\tparentVariableId: undefined,\n\t\tnodeWithVariablesId: collectionNode.id,\n\t}\n}\n\nfunction getCollectionNodeForFieldLookup(): CollectionNode | null {\n\tconst activeOverlay = engine.stores.chromeStore.contentManagementOverlayStack.at(-1) ?? null\n\tconst collectionNodeFromOverlay = getCollectionNodeFromStackElement({\n\t\tstackElement: activeOverlay,\n\t\ttree: engine.tree,\n\t})\n\tif (collectionNodeFromOverlay) {\n\t\treturn collectionNodeFromOverlay\n\t}\n\n\tconst [firstSelectedNodeId] = engine.stores.selectionStore.ids\n\tif (!firstSelectedNodeId) return null\n\n\tconst selectedNode = engine.tree.getNode(firstSelectedNodeId)\n\tif (!selectedNode) return null\n\n\tconst groundNode = engine.tree.getGroundNodeFor(selectedNode)\n\treturn isCollectionNode(groundNode) ? groundNode : null\n}\n", "import \"CollectionFieldsPanel.styles_jfacyb.wyw.css\"; export const fieldsPanelScroll = \"fieldsPanelScroll_f1xo4xfe\";\nexport const popoutScroll = \"popoutScroll_phtn6\";\nexport const list = \"list_l1bk8p3m\";\nexport const emptyStateContainer = \"emptyStateContainer_e1yhbta6\";\nexport const emptyRow = \"emptyRow_eq1rsoj\";\nexport const emptyRowIconWrapper = \"emptyRowIconWrapper_e11l4rwm\";\nexport const disabled = \"disabled_d1xor31i\";\nexport const addArrayItemFieldButton = \"addArrayItemFieldButton_a2wo33m\";\nexport const popoutButton = \"popoutButton_p2oz18b\";\nexport const divider = \"divider_d1uh5ehk\";", "import { Scroll } from \"@framerjs/fresco\"\nimport {\n\tisVariableDefinition,\n\tvariableTypeTitle,\n\ttype VariableOrDivider,\n\ttype VariablesAndDividers,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type React from \"react\"\nimport { fieldSettingsPopoutDataAttribute, PopoutButton } from \"../shared/PopoutButton.tsx\"\nimport type { PopoutId } from \"../shared/PopoutNavigation.tsx\"\nimport { VariableDetail } from \"../shared/VariablesModal/VariableDetail.tsx\"\nimport * as styles from \"./CollectionFieldsPanel.styles.ts\"\n\ninterface FieldSettingsPopoutProps {\n\tvariable: VariableOrDivider\n\tvariables: VariablesAndDividers\n\treadOnly: boolean\n\tonUpdate: (getUpdate: (current: VariableOrDivider) => VariableOrDivider) => void\n\tonPresent?: () => void\n\tchildren: React.ReactNode\n\tid?: PopoutId\n}\n\nexport function FieldSettingsPopout({\n\tvariable,\n\tvariables,\n\treadOnly,\n\tonUpdate,\n\tonPresent,\n\tchildren,\n\tid,\n}: FieldSettingsPopoutProps) {\n\treturn (\n\t\t<PopoutButton\n\t\t\tid={id}\n\t\t\tclassName={styles.popoutButton}\n\t\t\twithoutStyles\n\t\t\tnavigationTitle={getNavigationTitle(variable)}\n\t\t\tdisplayDivider\n\t\t\tonPresent={onPresent}\n\t\t\ttabIndex={-1}\n\t\t\t{...{ [fieldSettingsPopoutDataAttribute]: true }}\n\t\t\tpopout={\n\t\t\t\t<Scroll className={styles.popoutScroll}>\n\t\t\t\t\t<VariableDetail\n\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tvariables={variables}\n\t\t\t\t\t\tisTemporary={false}\n\t\t\t\t\t\tscopeType={ScopeType.ContentManagement}\n\t\t\t\t\t\tonUpdate={onUpdate}\n\t\t\t\t\t/>\n\t\t\t\t</Scroll>\n\t\t\t}\n\t\t>\n\t\t\t{children}\n\t\t</PopoutButton>\n\t)\n}\n\nfunction getNavigationTitle(variable: VariableOrDivider): string {\n\tif (variable.type === \"divider\") return \"Divider\"\n\tif (variable.name.length > 0) return variable.name\n\tif (isVariableDefinition(variable)) return variableTypeTitle(variable.type)\n\treturn \"Variable\"\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { isNewCollectionItemStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\n\nexport function shouldShowErrorsOnActiveCollectionItem(engine: VekterEngine) {\n\tconst activeElement = engine.stores.contentManagementStore.getActiveCollectionStackElement()\n\tif (!activeElement) return false\n\tif (isNewCollectionItemStackElement(activeElement)) return activeElement.showErrors\n\treturn true\n}\n\nexport function useShowErrorsOnActiveCollectionItem() {\n\tconst { contentManagementStore } = engine.stores\n\treturn useDeprecatedEngineState([contentManagementStore, EngineChange.Tree], () => {\n\t\treturn shouldShowErrorsOnActiveCollectionItem(engine)\n\t})\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type React from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport type { WithWarningTintAndMessageProps } from \"../shared/WithWarningTintAndMessage.tsx\"\nimport { WithWarningTintAndMessage } from \"../shared/WithWarningTintAndMessage.tsx\"\nimport * as styles from \"./LargePanelRow.styles.ts\"\nimport { OverlayFieldTitlePopout } from \"./OverlayFieldTitlePopout.tsx\"\nimport { useShowErrorsOnActiveCollectionItem } from \"./utils/useShowErrorsOnActiveCollectionItem.tsx\"\n\ntype Props = React.PropsWithChildren<{\n\tdescription: string | undefined\n\teditFieldEnabled?: boolean\n\tfieldId: VariableID\n\tisDivider?: boolean\n\ttitle: string\n}> &\n\tPick<WithWarningTintAndMessageProps, \"warningMessage\" | \"showWarningTint\">\n\nexport function getLargePanelRowId(prop: VariableID): string {\n\treturn `large-panel-row-${prop}`\n}\n\nexport function LargePanelRow({\n\tchildren,\n\tdescription,\n\teditFieldEnabled = true,\n\tfieldId,\n\tshowWarningTint,\n\ttitle,\n\twarningMessage,\n\tisDivider = false,\n}: Props) {\n\tconst showErrorsOnCollectionItem = useShowErrorsOnActiveCollectionItem()\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\n\treturn (\n\t\t<Stack id={getLargePanelRowId(fieldId)} direction=\"column\" className={styles.largeControlRow}>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\">\n\t\t\t\t<OverlayFieldTitlePopout\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\ttitle={title}\n\t\t\t\t\teditFieldEnabled={editFieldEnabled}\n\t\t\t\t\tisDivider={isDivider}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t\t<WithWarningTintAndMessage\n\t\t\t\tgap={0}\n\t\t\t\twarningVisible={!isViewOnly && showErrorsOnCollectionItem}\n\t\t\t\twarningMessage={warningMessage}\n\t\t\t\twarningMessageClassName={cx(styles.warningMessagePlain, styles.collectionInputMessageHeight)}\n\t\t\t\tshowWarningTint={showWarningTint}\n\t\t\t\tafterWarningMessage={\n\t\t\t\t\t!!description && (\n\t\t\t\t\t\t<div className={cx(styles.description, styles.descriptionPlain, styles.overlayInputTextOffsetLeft)}>\n\t\t\t\t\t\t\t{description}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</WithWarningTintAndMessage>\n\t\t</Stack>\n\t)\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { CollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { LargeArrayInputRow } from \"./LargeArrayInputRow.tsx\"\nimport { LargeBooleanInputRow } from \"./LargeBooleanInputRows.tsx\"\nimport { LargeCollectionReferenceInputRow } from \"./LargeCollectionReferenceInputRow.tsx\"\nimport { LargeColorInputRow } from \"./LargeColorInputRow.tsx\"\nimport { LargeDateInputRow } from \"./LargeDateInputRow.tsx\"\nimport { LargeEnumInputRow } from \"./LargeEnumInputRow.tsx\"\nimport { LargeFileInputRow } from \"./LargeFileInputRow.tsx\"\nimport { LargeImageInputRow } from \"./LargeImageInputRow.tsx\"\nimport { LargeLinkInputRow } from \"./LargeLinkInputRow.tsx\"\nimport { LargeMultiCollectionReferenceInputRow } from \"./LargeMultiCollectionReferenceInputRow.tsx\"\nimport { LargeNumberInputRow } from \"./LargeNumberInputRow.tsx\"\nimport { LargeRichTextInputRow } from \"./LargeRichTextInputRow.tsx\"\nimport { LargeVectorSetItemInputRow } from \"./LargeVectorSetItemInputRow.tsx\"\nimport type { CollectionItemChangeHandler } from \"./utils/CollectionItemChangeHandler.ts\"\n\ninterface Props {\n\tcollectionId: NodeID\n\tcontrol: VerifiedControlDescription\n\tcontrolProp: CollectionControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChangeComparingLatestControlProp: (getUpdate: CollectionItemChangeHandler, fieldId: VariableID, id: NodeID) => void\n\tonChange: (value: CollectionControlProp, fieldId: VariableID, id: NodeID) => void\n\tonUnsavedChange?: () => void\n\trequired: boolean\n\treset: (fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeControlRow = React.memo(function CollectionItemRow({\n\tcollectionId,\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChangeComparingLatestControlProp,\n\tonChange,\n\tonUnsavedChange,\n\trequired,\n\treset,\n}: Props) {\n\tswitch (control.type) {\n\t\tcase ControlType.RichText:\n\t\t\treturn (\n\t\t\t\t<LargeRichTextInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\tonUnsavedChange={onUnsavedChange}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Number:\n\t\t\treturn (\n\t\t\t\t<LargeNumberInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn (\n\t\t\t\t<LargeImageInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChangeComparingLatestControlProp={onChangeComparingLatestControlProp}\n\t\t\t\t\treset={reset}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Boolean:\n\t\t\treturn (\n\t\t\t\t<LargeBooleanInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn (\n\t\t\t\t<LargeCollectionReferenceInputRow\n\t\t\t\t\tcollectionId={collectionId}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\tid={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn (\n\t\t\t\t<LargeMultiCollectionReferenceInputRow\n\t\t\t\t\tcollectionId={collectionId}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\tid={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Color:\n\t\t\treturn (\n\t\t\t\t<LargeColorInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Link: {\n\t\t\treturn (\n\t\t\t\t<LargeLinkInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\treset={reset}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Date:\n\t\t\treturn (\n\t\t\t\t<LargeDateInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\trequired={required}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Enum:\n\t\t\treturn (\n\t\t\t\t<LargeEnumInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn (\n\t\t\t\t<LargeVectorSetItemInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.File:\n\t\t\treturn (\n\t\t\t\t<LargeFileInputRow\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\trequired={required}\n\t\t\t\t\treset={reset}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Array:\n\t\t\treturn (\n\t\t\t\t<LargeArrayInputRow\n\t\t\t\t\tcollectionId={collectionId}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChangeComparingLatestControlProp}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t)\n\t\tdefault:\n\t\t\treturn null\n\t}\n})\n", "import type { VerifiedArrayControlDescription } from \"@framerjs/framer-runtime\"\nimport { useReadOnly } from \"@framerjs/fresco\"\nimport { List, emptyArray } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { CollectionControlDescription } from \"document/models/controlProps/CollectionControlDescription.ts\"\nimport type {\n\tCollectionArrayControlPropValue,\n\tCollectionControlProp,\n\tCollectionObjectControlProp,\n} from \"document/models/controlProps/CollectionControlProp.ts\"\nimport {\n\ttype ArrayValue,\n\ttype StaticArrayControlProp,\n\tisStaticArrayControlProp,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { ArrayItemStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { isNumber, isReadonlyArray } from \"utils/typeChecks.ts\"\nimport { ArrayItemsTable } from \"./ArrayItemsTable.tsx\"\nimport { GalleryInputRow } from \"./GalleryInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport type { CollectionItemChangeHandler } from \"./utils/CollectionItemChangeHandler.ts\"\nimport { isGalleryControl } from \"./utils/arrayGalleryUtils.ts\"\nimport {\n\tgetArrayMinAndMaxErrorMessage,\n\tgetMessageFromWarning,\n\tgetRequiredAndMissingErrorMessage,\n} from \"./utils/fieldValidationHelpers.ts\"\n\ninterface Props {\n\tcollectionId: NodeID\n\tcontrol: VerifiedArrayControlDescription\n\tcontrolProp: CollectionControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (getUpdate: CollectionItemChangeHandler, fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n}\n\nexport const LargeArrayInputRow = React.memo(function LargeArrayInputRow({\n\tcollectionId,\n\tcontrol,\n\tfieldId,\n\tcontrolProp,\n\titemId,\n\tonChange,\n\trequired,\n}: Props) {\n\tassert(!controlProp || isStaticArrayControlProp(controlProp))\n\n\tconst requiredMessage = getRequiredAndMissingErrorMessage(\n\t\tcontrolProp,\n\t\tcontrol as CollectionControlDescription,\n\t\trequired,\n\t)\n\tconst minAndMaxMessage = getArrayMinAndMaxErrorMessage(controlProp, control as CollectionControlDescription, required)\n\tconst warning = requiredMessage ?? minAndMaxMessage\n\tconst warningMessage = getMessageFromWarning(warning, control as CollectionControlDescription)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={warningMessage}\n\t\t>\n\t\t\t{isGalleryControl(control) ? (\n\t\t\t\t<GalleryInputRow\n\t\t\t\t\tvariant=\"plain\"\n\t\t\t\t\tcollectionId={collectionId}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\trequired={required}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<ArrayInputRow\n\t\t\t\t\tcollectionId={collectionId}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tfieldId={fieldId}\n\t\t\t\t\tcontrolProp={controlProp}\n\t\t\t\t\titemId={itemId}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</LargePanelRow>\n\t)\n})\n\ninterface ArrayInputRowProps extends Omit<Props, \"required\" | \"controlProp\"> {\n\tcontrolProp: StaticArrayControlProp | undefined\n}\n\nfunction ArrayInputRow({ collectionId, control, fieldId, controlProp, itemId, onChange }: ArrayInputRowProps) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst isReadOnly = useReadOnly()\n\n\tconst items = useMemo<CollectionArrayControlPropValue>(() => {\n\t\tif (controlProp) return controlProp.value as CollectionArrayControlPropValue\n\t\treturn emptyArray()\n\t}, [controlProp])\n\n\tconst itemCount = items.length\n\tconst maxCount = isNumber(control.maxCount) ? control.maxCount : Infinity\n\tconst canAddItems = itemCount < maxCount\n\n\tconst addItem = useCallback(() => {\n\t\tif (isReadOnly || !canAddItems) return\n\n\t\tconst newItemId = randomID()\n\t\tconst newItem: CollectionObjectControlProp & ArrayValue = {\n\t\t\tid: newItemId,\n\t\t\ttype: ControlType.Object,\n\t\t\tvalue: {},\n\t\t}\n\n\t\tonChange(\n\t\t\tcurrentControlProp => {\n\t\t\t\tconst currentItems = getArrayControlPropValue(currentControlProp)\n\t\t\t\tconst newItems = List.push(currentItems, newItem)\n\t\t\t\treturn { type: ControlType.Array, value: newItems }\n\t\t\t},\n\t\t\tfieldId,\n\t\t\titemId,\n\t\t)\n\n\t\tconst nextOverlay: ArrayItemStackElement = {\n\t\t\tcollectionId,\n\t\t\tcollectionItemId: itemId,\n\t\t\tarrayFieldId: fieldId,\n\t\t\tarrayItemId: newItemId,\n\t\t\ttype: \"arrayItem\",\n\t\t}\n\n\t\tconst { chromeStore } = engine.stores\n\t\tchromeStore.setContentManagementOverlayStack(List.push(chromeStore.contentManagementOverlayStack, nextOverlay))\n\t}, [canAddItems, collectionId, fieldId, isReadOnly, itemId, onChange])\n\n\tconst selectItem = useCallback(\n\t\t(arrayItemId: NodeID) => {\n\t\t\tconst nextOverlay: ArrayItemStackElement = {\n\t\t\t\tcollectionId,\n\t\t\t\tcollectionItemId: itemId,\n\t\t\t\tarrayFieldId: fieldId,\n\t\t\t\tarrayItemId,\n\t\t\t\ttype: \"arrayItem\",\n\t\t\t}\n\t\t\tconst { chromeStore } = engine.stores\n\t\t\tchromeStore.setContentManagementOverlayStack(List.push(chromeStore.contentManagementOverlayStack, nextOverlay))\n\t\t},\n\t\t[collectionId, fieldId, itemId],\n\t)\n\n\tconst removeItem = useCallback(\n\t\t(arrayItemId: NodeID) => {\n\t\t\tif (isReadOnly) return\n\n\t\t\tonChange(\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tconst currentItems = getArrayControlPropValue(currentControlProp)\n\t\t\t\t\treturn { type: ControlType.Array, value: currentItems.filter(item => item.id !== arrayItemId) }\n\t\t\t\t},\n\t\t\t\tfieldId,\n\t\t\t\titemId,\n\t\t\t)\n\t\t},\n\t\t[fieldId, isReadOnly, itemId, onChange],\n\t)\n\n\tconst moveItem = useCallback(\n\t\t(fromIndex: number, toIndex: number) => {\n\t\t\tif (isReadOnly) return\n\n\t\t\tonChange(\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tconst currentItems = getArrayControlPropValue(currentControlProp)\n\t\t\t\t\treturn { type: ControlType.Array, value: List.move(currentItems, fromIndex, toIndex) }\n\t\t\t\t},\n\t\t\t\tfieldId,\n\t\t\t\titemId,\n\t\t\t)\n\t\t},\n\t\t[fieldId, isReadOnly, itemId, onChange],\n\t)\n\n\treturn (\n\t\t<ArrayItemsTable\n\t\t\tfieldId={fieldId}\n\t\t\tcontrol={control}\n\t\t\titems={items}\n\t\t\tonAddItem={addItem}\n\t\t\tonSelectItem={selectItem}\n\t\t\tonRemoveItem={removeItem}\n\t\t\tonMoveItem={moveItem}\n\t\t\tcanAddItems={canAddItems}\n\t\t/>\n\t)\n}\n\nfunction getArrayControlPropValue(controlProp: CollectionControlProp | undefined): CollectionArrayControlPropValue {\n\tif (controlProp?.type === ControlType.Array && isReadonlyArray(controlProp.value)) {\n\t\treturn controlProp.value\n\t}\n\n\treturn emptyArray()\n}\n", "import type {\n\tVerifiedArrayControlDescription,\n\tVerifiedObjectPropertyControlDescription,\n} from \"@framerjs/framer-runtime\"\nimport { Button, EmptyState, T, useReadOnly } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { CollectionArrayControlPropValue } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport {\n\tgetBooleanControlPropValue,\n\tgetColorControlPropValue,\n\tgetControlProp,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { memo, useCallback, useMemo, useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport * as styles from \"./ArrayItemsTable.styles.ts\"\nimport { BooleanCellValue, ColorCellValue, ImageCellValue, TextCellValue } from \"./TableCellPreviews.tsx\"\nimport { useIsEditFieldsUseableInScreen } from \"./utils/screenFeatureUtils.ts\"\n\nconst maxColumnCount = 6\n\ninterface Props {\n\tfieldId: VariableID\n\tcontrol: VerifiedArrayControlDescription\n\titems: CollectionArrayControlPropValue\n\tonAddItem: () => void\n\tonSelectItem: (itemId: NodeID) => void\n\tonRemoveItem: (itemId: NodeID) => void\n\tonMoveItem: (fromIndex: number, toIndex: number) => void\n\tcanAddItems: boolean\n}\n\nexport function ArrayItemsTable({\n\tfieldId,\n\tcontrol,\n\titems,\n\tonAddItem,\n\tonSelectItem,\n\tonRemoveItem,\n\tonMoveItem,\n\tcanAddItems,\n}: Props) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst columns = useMemo(() => getColumns(control), [control])\n\n\tconst isEditFieldsUsableInScreen = useIsEditFieldsUseableInScreen()\n\n\tconst isRootOverlayInCMS = useEngineState(\n\t\t() =>\n\t\t\tengine.stores.scopeStore.scopeType === ScopeType.ContentManagement &&\n\t\t\tengine.stores.chromeStore.contentManagementOverlayStack.length === 1,\n\t\t[],\n\t\t[engine.stores.scopeStore, engine.stores.chromeStore],\n\t)\n\n\tconst canEditFields = isRootOverlayInCMS && isEditFieldsUsableInScreen\n\n\tconst openArrayItemField = useCallback(\n\t\t(itemFieldId: VariableID) => {\n\t\t\tif (!canEditFields) return\n\t\t\tengine.stores.modalStore.set({ type: ModalType.Variables, source: \"collection_item_overlay\" })\n\t\t\tengine.stores.variablesStore.selectedVariablePath = [fieldId, itemFieldId]\n\t\t},\n\t\t[fieldId, canEditFields],\n\t)\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Sortable\n\t\t\t\titems={items}\n\t\t\t\tenabled={items.length > 1}\n\t\t\t\tmoveItem={onMoveItem}\n\t\t\t\tkeyForItem={getId}\n\t\t\t\tclassName={styles.table}\n\t\t\t\theader={\n\t\t\t\t\t<div className={styles.headerRow}>\n\t\t\t\t\t\t{columns.map(column => (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tkey={column.id}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\t\t\tclassName={styles.headerButton}\n\t\t\t\t\t\t\t\tonClick={() => openArrayItemField(column.id)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<span className={styles.cell}>{column.title}</span>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\titems.length === 0 && (\n\t\t\t\t\t\t<div className={styles.emptyStateContainer}>\n\t\t\t\t\t\t\t<EmptyState center body={<T>No Items</T>} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{({ item }) => (\n\t\t\t\t\t<ArrayItemRow\n\t\t\t\t\t\titem={item}\n\t\t\t\t\t\tcolumns={columns}\n\t\t\t\t\t\tisReadOnly={isReadOnly}\n\t\t\t\t\t\tonSelectItem={onSelectItem}\n\t\t\t\t\t\tonRemoveItem={onRemoveItem}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Sortable>\n\t\t\t<div className={styles.footerRow}>\n\t\t\t\t<Button bold onClick={onAddItem} enabled={canAddItems && !isReadOnly}>\n\t\t\t\t\t<T>{Dictionary.NewItem}</T>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\ninterface ArrayItemRowProps {\n\titem: CollectionArrayControlPropValue[number]\n\tcolumns: ColumnDefinition[]\n\tisReadOnly: boolean\n\tonSelectItem: (itemId: NodeID) => void\n\tonRemoveItem: (itemId: NodeID) => void\n}\n\nconst ArrayItemRow = memo(function ArrayItemRow({\n\titem,\n\tcolumns,\n\tisReadOnly,\n\tonSelectItem,\n\tonRemoveItem,\n}: ArrayItemRowProps) {\n\tconst [menuIsOpen, setMenuIsOpen] = useState(false)\n\n\tconst showContextMenu = (event: React.MouseEvent) => {\n\t\tsetMenuIsOpen(true)\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: isReadOnly ? Dictionary.View : Dictionary.Edit,\n\t\t\t\t\tclick: () => onSelectItem(item.id),\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.Delete,\n\t\t\t\t\tclick: () => onRemoveItem(item.id),\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t\tonDone: () => setMenuIsOpen(false),\n\t\t\t},\n\t\t)\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tdata-allow-drag\n\t\t\ttype=\"button\"\n\t\t\tvariant=\"clean\"\n\t\t\tclassName={cx(styles.rowButton, menuIsOpen && styles.rowButtonWithOpenMenu)}\n\t\t\tonClick={() => onSelectItem(item.id)}\n\t\t\tonContextMenu={showContextMenu}\n\t\t\taria-label=\"Edit item\"\n\t\t>\n\t\t\t{columns.map(column => (\n\t\t\t\t<div key={column.id} className={styles.cell}>\n\t\t\t\t\t{renderCellValue(column.control, item.value?.[column.id])}\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</Button>\n\t)\n})\n\ninterface ColumnDefinition {\n\tid: VariableID\n\ttitle: string\n\tcontrol: VerifiedObjectPropertyControlDescription\n}\n\nfunction getColumns(control: VerifiedArrayControlDescription): ColumnDefinition[] {\n\tconst itemControls = control.control.type === ControlType.Object ? control.control.controls : {}\n\tconst columns: ColumnDefinition[] = []\n\n\tfor (const itemControlId in itemControls) {\n\t\tconst itemControl = itemControls[itemControlId]\n\t\tif (!itemControl) continue\n\n\t\tcolumns.push({\n\t\t\tid: itemControlId,\n\t\t\ttitle: itemControl.title ?? Dictionary.Unknown,\n\t\t\tcontrol: itemControl,\n\t\t})\n\n\t\tif (columns.length >= maxColumnCount) break\n\t}\n\n\treturn columns\n}\n\nfunction renderCellValue(control: VerifiedObjectPropertyControlDescription, controlProp: ControlProp | undefined) {\n\tswitch (control.type) {\n\t\tcase ControlType.String: {\n\t\t\tconst value = getControlProp(control, controlProp)?.value\n\t\t\treturn isString(value) ? <TextCellValue value={value} /> : null\n\t\t}\n\t\tcase ControlType.Number: {\n\t\t\tconst value = getControlProp(control, controlProp)?.value\n\t\t\treturn isNumber(value) ? <TextCellValue value={String(value)} /> : null\n\t\t}\n\t\tcase ControlType.Boolean: {\n\t\t\tconst isTrue = getBooleanControlPropValue(control, controlProp) === true\n\t\t\treturn <BooleanCellValue value={isTrue} />\n\t\t}\n\t\tcase ControlType.Color: {\n\t\t\tconst value = getColorControlPropValue(control, controlProp)\n\t\t\tconst backgroundColor = isString(value) ? value : \"transparent\"\n\t\t\treturn <ColorCellValue value={backgroundColor} size=\"legacy\" />\n\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn <ImageCellValue control={control} rawControlProp={controlProp} size=\"legacy\" />\n\t\t}\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n", "import \"ArrayItemsTable.styles_1bkpzqu.wyw.css\"; export const container = \"container_c1c8e7qe\";\nexport const table = \"table_t1fmvoss\";\nexport const headerRow = \"headerRow_h1ay1eyl\";\nexport const headerButton = \"headerButton_h1vpvirl\";\nexport const rowButton = \"rowButton_r1tixba6\";\nexport const rowButtonWithOpenMenu = \"rowButtonWithOpenMenu_rz0lnwl\";\nexport const cell = \"cell_c540576\";\nexport const footerRow = \"footerRow_fyehaa5\";\nexport const emptyStateContainer = \"emptyStateContainer_en9k3yq\";", "import type { VerifiedArrayControlDescription } from \"@framerjs/framer-runtime\"\nimport { IconControlTypeFile, IconControlTypeImage, IconControlTypeVideo, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { assert, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useBaseEngine, type BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ControlProp, VectorSetItemControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { hasControlFocalPoint } from \"document/models/controlProps/WithControlFocalPoint.ts\"\nimport {\n\tgetArrayControlPropValue,\n\tgetDateControlPropValue,\n\tgetImageControlProp,\n\tgetVectorSetItemControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport {\n\tControlType,\n\ttype DateControlDescription,\n\ttype ImageControlDescription,\n\ttype ResponsiveImageControlDescription,\n\ttype VectorSetItemControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport type React from \"react\"\nimport { useMemo } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { type VectorSetListItem, vectorSetInfoForPopout } from \"utils/vectorSets.ts\"\nimport { useSubscribeToColorStyles, useSubscribeToFillValue } from \"../properties/utils/useSubscribeToFillValue.ts\"\nimport { colorFillDisplayValue } from \"../shared/ColorPicker/utils.ts\"\nimport { imagePreviewThumbnail as imagePreviewThumbnailStyles } from \"../shared/ImagePreviewThumbnail.styles.ts\"\nimport { ImagePreviewThumbnail } from \"../shared/ImagePreviewThumbnail.tsx\"\nimport { VectorSetIcon, useVectorThumbnail } from \"../shared/VectorSetPreview.tsx\"\nimport * as styles from \"./TableCellPreviews.styles.ts\"\nimport * as tableStyles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { type FileCellKind, getFileCellDisplayInfo } from \"./fileCellDisplayInfo.ts\"\nimport { getImageControlKeyAndDescription, getImageControlPropFromArrayItem } from \"./utils/arrayGalleryUtils.ts\"\nimport { getDateInputDisplayValue, getDateTimeInputDisplayValue } from \"./utils/dateInputValue.ts\"\n\ninterface TextCellValueProps {\n\tvalue: string | undefined\n}\n\nexport function TextCellValue({ value }: TextCellValueProps) {\n\treturn (\n\t\t<span className={truncateWithEllipsis} title={value}>\n\t\t\t{value}\n\t\t</span>\n\t)\n}\n\nfunction FileCellIcon({ kind }: { kind: FileCellKind }) {\n\tswitch (kind) {\n\t\tcase \"file\":\n\t\t\treturn <IconControlTypeFile />\n\t\tcase \"image\":\n\t\t\treturn <IconControlTypeImage />\n\t\tcase \"video\":\n\t\t\treturn <IconControlTypeVideo />\n\t}\n}\n\ninterface FileCellValueProps {\n\tvalue: string\n\tisSelected: boolean\n}\n\nexport function FileCellValue({ value, isSelected }: FileCellValueProps) {\n\tconst { fileName, kind } = useMemo(() => getFileCellDisplayInfo(value), [value])\n\tif (!fileName) return null\n\n\treturn (\n\t\t<span className={styles.fileCellPreview}>\n\t\t\t<span\n\t\t\t\tclassName={cx(styles.fileCellPreviewIcon, isSelected && tableStyles.bodyCellSelectedIcon)}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t>\n\t\t\t\t<FileCellIcon kind={kind} />\n\t\t\t</span>\n\t\t\t<TextCellValue value={fileName} />\n\t\t</span>\n\t)\n}\n\ninterface DateCellValueProps {\n\tcontrol: DateControlDescription\n\tcontrolProp: ControlProp | undefined\n\tariaLabel?: string\n}\n\nexport function DateCellValue({ control, controlProp, ariaLabel }: DateCellValueProps) {\n\tconst value = getDateControlPropValue(control, controlProp)\n\tassert(!isDynamicValue(value), \"Dynamic values are not supported within the CMS.\")\n\tconst displayTime = control.displayTime === true\n\n\tconst displayValue = useMemo(() => {\n\t\tif (!isString(value)) return \"\"\n\t\treturn displayTime ? getDateTimeInputDisplayValue(value) : getDateInputDisplayValue(value)\n\t}, [displayTime, value])\n\n\tif (!displayValue) return null\n\n\treturn (\n\t\t<input\n\t\t\ttype={displayTime ? \"datetime-local\" : \"date\"}\n\t\t\tdisabled\n\t\t\ttabIndex={-1}\n\t\t\taria-label={ariaLabel ?? control.title ?? \"Date\"}\n\t\t\tclassName={tableStyles.bodyCellDatePreview}\n\t\t\tvalue={displayValue}\n\t\t/>\n\t)\n}\n\ninterface BooleanCellValueProps {\n\tvalue: boolean | null | undefined\n}\n\nexport function BooleanCellValue({ value }: BooleanCellValueProps) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.cellTokenLegacy,\n\t\t\t\tstyles.cellTokenCenteredText,\n\t\t\t\tvalue === true ? styles.booleanTrueCellToken : styles.booleanFalseCellToken,\n\t\t\t)}\n\t\t>\n\t\t\t{value === true ? Dictionary.Yes : Dictionary.No}\n\t\t</div>\n\t)\n}\n\ninterface ColorCellValueProps {\n\tvalue: string\n\tsize: \"default\" | \"legacy\"\n}\n\nexport function ColorCellValue({ value, size }: ColorCellValueProps) {\n\tif (size === \"default\") {\n\t\treturn <DefaultColorCellValue value={value} />\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ backgroundColor: value }}\n\t\t\tclassName={cx(styles.colorCellToken, styles.colorCellTokenLegacy, styles.cellTokenInsetBorder)}\n\t\t/>\n\t)\n}\n\nfunction DefaultColorCellValue({ value }: { value: string }) {\n\tconst engine = useBaseEngine()\n\tconst latestToken = useSubscribeToFillValue(value)\n\tconst background = latestToken?.value ?? value\n\tconst title = useMemo(\n\t\t() => latestToken?.name ?? colorFillDisplayValue(value, engine).title,\n\t\t[value, latestToken?.name],\n\t)\n\n\treturn (\n\t\t<div className={styles.colorCellPreview}>\n\t\t\t<div style={{ backgroundColor: background }} className={styles.colorCellValueSwatch} />\n\t\t\t<TextCellValue value={title} />\n\t\t</div>\n\t)\n}\n\ninterface ImageCellValueProps {\n\tcontrol: ImageControlDescription | ResponsiveImageControlDescription\n\trawControlProp: ControlProp | undefined\n\tstyle?: React.CSSProperties\n\tsize: \"default\" | \"legacy\"\n}\n\nexport function ImageCellValue({ control, rawControlProp, style, size }: ImageCellValueProps) {\n\tconst controlProp = getImageControlProp(control, rawControlProp)\n\tconst src = isString(controlProp.value) ? controlProp.value : \"\"\n\n\tlet backgroundPositionX: string | undefined\n\tlet backgroundPositionY: string | undefined\n\n\tif (hasControlFocalPoint(controlProp)) {\n\t\tbackgroundPositionX = controlProp.positionX\n\t\tbackgroundPositionY = controlProp.positionY\n\t}\n\n\treturn (\n\t\t<ImagePreviewThumbnail\n\t\t\tsrc={src}\n\t\t\tbackgroundPositionX={backgroundPositionX}\n\t\t\tbackgroundPositionY={backgroundPositionY}\n\t\t\tclassName={cx(styles.imagePreviewThumbnail, size === \"legacy\" && styles.imagePreviewThumbnailLegacy)}\n\t\t\tstyle={style}\n\t\t/>\n\t)\n}\n\ninterface VectorSetItemCellValueProps {\n\tcontrol: VectorSetItemControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfallbackTitle?: string\n\tisSelected?: boolean\n}\n\nfunction VectorSetItemPreviewIcon({ icon, isSelected }: { icon: string; isSelected: boolean }) {\n\tconst colorStyles = useSubscribeToColorStyles()\n\n\treturn (\n\t\t<VectorSetIcon\n\t\t\ticon={icon}\n\t\t\tclassName={cx(styles.vectorSetItemPreviewIcon, isSelected && tableStyles.bodyCellSelectedIcon)}\n\t\t\tstyle={colorStyles}\n\t\t/>\n\t)\n}\n\nfunction getVectorSetItemPreviewInfo(\n\tidentifier: VectorSetItemControlPropValue,\n\tengine: BaseEngine,\n): VectorSetListItem | undefined {\n\tif (!isString(identifier) || !isModuleExportIdentifier(identifier)) return undefined\n\n\tconst info = vectorSetInfoForPopout(\n\t\tidentifier,\n\t\tidentifier,\n\t\tengine.tree,\n\t\tengine.stores.modulesStore,\n\t\tengine.stores.vectorsStore,\n\t)\n\t// `selectedItem` preserves a readable fallback when the previously selected vector is no longer\n\t// present in the current set items, for example after the source set changed.\n\treturn info?.vectorSet.items[identifier] ?? info?.selectedItem\n}\n\nexport function useVectorSetItemPreviewData({\n\tcontrol,\n\tcontrolProp,\n\tfallbackTitle,\n}: Pick<VectorSetItemCellValueProps, \"control\" | \"controlProp\" | \"fallbackTitle\">) {\n\tconst engine = useBaseEngine()\n\tconst identifier = getVectorSetItemControlPropValue(control, controlProp)\n\tconst info = useEngineState(\n\t\t() => getVectorSetItemPreviewInfo(identifier, engine),\n\t\t[identifier],\n\t\t[EngineChange.Tree, engine.stores.modulesStore, engine.stores.vectorsStore],\n\t\t{ deepEqual: true },\n\t)\n\tconst thumbnail = useVectorThumbnail({ moduleId: info?.moduleId, saveId: info?.saveId })\n\tconst title = info?.name ?? fallbackTitle ?? \"\"\n\n\treturn { identifier, thumbnail, title }\n}\n\nexport function VectorSetItemCellValueContent({\n\tidentifier,\n\tthumbnail,\n\ttitle,\n\tisSelected = false,\n}: {\n\tidentifier: VectorSetItemControlPropValue\n\tthumbnail: ReturnType<typeof useVectorThumbnail>\n\ttitle: string\n\tisSelected?: boolean\n}) {\n\tif (!title && !identifier) return null\n\n\treturn (\n\t\t<div className={styles.vectorSetItemPreview}>\n\t\t\t{identifier && thumbnail?.svg && <VectorSetItemPreviewIcon icon={thumbnail.svg} isSelected={isSelected} />}\n\t\t\t<TextCellValue value={title} />\n\t\t</div>\n\t)\n}\n\nexport function VectorSetItemCellValue({\n\tcontrol,\n\tcontrolProp,\n\tfallbackTitle,\n\tisSelected = false,\n}: VectorSetItemCellValueProps) {\n\tconst { identifier, thumbnail, title } = useVectorSetItemPreviewData({ control, controlProp, fallbackTitle })\n\n\treturn (\n\t\t<VectorSetItemCellValueContent\n\t\t\tidentifier={identifier}\n\t\t\tthumbnail={thumbnail}\n\t\t\ttitle={title}\n\t\t\tisSelected={isSelected}\n\t\t/>\n\t)\n}\n\ninterface GalleryArrayCellContentProps {\n\tcontrol: VerifiedArrayControlDescription\n\tcontrolProp: ControlProp | undefined\n}\n\nfunction getMaxVisibleGalleryPreviewItems({\n\tcolumnWidth,\n\titemCount,\n}: {\n\tcolumnWidth: number\n\titemCount: number\n}): number {\n\tif (itemCount === 0) return 0\n\n\tconst contentWidth = columnWidth - tableStyles.galleryBodyCellLeftPadding - tableStyles.cellBorderWidth\n\tif (contentWidth <= 0) return 1\n\n\tconst previewSlotWidth = styles.galleryPreviewImageWidth + styles.galleryPreviewGap\n\tconst visibleItemCount = Math.ceil((contentWidth + styles.galleryPreviewGap) / previewSlotWidth)\n\n\treturn Math.min(itemCount, Math.max(1, visibleItemCount))\n}\n\nexport function GalleryArrayCellValue({\n\tcontrol,\n\tcontrolProp,\n\tcolumnWidth,\n}: GalleryArrayCellContentProps & { columnWidth: number }) {\n\tassert(!controlProp || controlProp.type === ControlType.Array)\n\n\tconst [imageKey, imageControl] = useMemo(() => getImageControlKeyAndDescription(control), [control])\n\tconst value = getArrayControlPropValue(control, controlProp)\n\tassert(!isDynamicValue(value))\n\tconst maxVisibleItemCount = getMaxVisibleGalleryPreviewItems({ columnWidth, itemCount: value.length })\n\n\tconst previewItems: React.ReactNode[] = []\n\n\tfor (let index = 0; index < maxVisibleItemCount; index++) {\n\t\tconst item = value[index]\n\t\tif (!item) continue\n\n\t\tconst imageControlProp = getImageControlPropFromArrayItem(imageKey, item)\n\t\tif (!imageControlProp) continue\n\n\t\tpreviewItems.push(\n\t\t\t<ImageCellValue key={item.id} control={imageControl} rawControlProp={imageControlProp} size=\"default\" />,\n\t\t)\n\t}\n\n\tif (previewItems.length === 0) {\n\t\tpreviewItems.push(\n\t\t\t<div key=\"placeholder\" className={cx(styles.imagePreviewThumbnail, styles.emptyImagePreviewThumbnail)} />,\n\t\t)\n\t}\n\n\treturn <div className={styles.galleryPreviewRow}>{previewItems}</div>\n}\n\n/**\n * Renders the \"Gallery\" array control type. This is a special case when the array control only has\n * a single item which is an Image.\n */\nexport function GalleryArrayCellContent({ control, controlProp }: GalleryArrayCellContentProps) {\n\tassert(!controlProp || controlProp.type === ControlType.Array)\n\n\tconst [imageKey, imageControl] = useMemo(() => getImageControlKeyAndDescription(control), [control])\n\tconst value = getArrayControlPropValue(control, controlProp)\n\tassert(!isDynamicValue(value))\n\n\tconst previews: React.ReactNode[] = []\n\n\tconst maxIndex = styles.numberOfImagesInGalleryStack - 1\n\t// Run through the images in reverse order so that the first one sits on top in the DOM\n\tfor (let index = maxIndex; index >= 0; index--) {\n\t\tconst item = value[index]\n\t\tconst key = `placeholder-${index}`\n\t\tconst cssVars: React.CSSProperties = {\n\t\t\t\"--image-preview-index\": index + 1,\n\t\t}\n\n\t\tconst imageControlProp = item ? getImageControlPropFromArrayItem(imageKey, item) : undefined\n\n\t\tif (imageControlProp?.value) {\n\t\t\tpreviews.push(\n\t\t\t\t<ImageCellValue\n\t\t\t\t\tkey={key}\n\t\t\t\t\tcontrol={imageControl}\n\t\t\t\t\trawControlProp={imageControlProp}\n\t\t\t\t\tstyle={cssVars}\n\t\t\t\t\tsize=\"legacy\"\n\t\t\t\t/>,\n\t\t\t)\n\t\t} else {\n\t\t\tpreviews.push(\n\t\t\t\t<div key={key} className={cx(imagePreviewThumbnailStyles, styles.emptyCellTokenLegacy)} style={cssVars} />,\n\t\t\t)\n\t\t}\n\t}\n\n\treturn <div className={cx(styles.cellTokenLegacy, styles.arrayGalleryStack)}>{previews}</div>\n}\n", "import \"ImagePreviewThumbnail.styles_tjkkdo.wyw.css\"; export const imagePreviewThumbnail = \"imagePreviewThumbnail_i1hb6dzk\";\nexport const insertBorder = \"insertBorder_ie1hjhl\";", "import { cx } from \"@linaria/core\"\nimport { useResolvedImageThumbnail } from \"document/components/utils/useResolvedImageThumbnail.ts\"\nimport type React from \"react\"\nimport * as styles from \"./ImagePreviewThumbnail.styles.ts\"\n\ninterface ImagePreviewThumbnail {\n\tclassName?: string\n\tsrc: string\n\tbackgroundPositionX?: React.CSSProperties[\"backgroundPositionX\"]\n\tbackgroundPositionY?: React.CSSProperties[\"backgroundPositionY\"]\n\tstyle?: React.CSSProperties\n}\n\nexport function ImagePreviewThumbnail({\n\tclassName,\n\tsrc,\n\tbackgroundPositionX,\n\tbackgroundPositionY,\n\tstyle,\n}: ImagePreviewThumbnail) {\n\tconst resolvedImageThumbnail = useResolvedImageThumbnail(src)\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{ ...style, backgroundImage: resolvedImageThumbnail, backgroundPositionX, backgroundPositionY }}\n\t\t\tclassName={cx(styles.imagePreviewThumbnail, src && styles.insertBorder, className)}\n\t\t/>\n\t)\n}\n", "import \"TableCellPreviews.styles_1xmhsli.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const cellTokenWidthLegacy = 50;\nexport const cellTokenLegacy = \"cellTokenLegacy_c1ro1x6u\";\nexport const colorCellToken = \"colorCellToken_c1u0v1q7\";\nexport const colorCellPreview = \"colorCellPreview_capyvkd\";\nexport const fileCellPreview = \"fileCellPreview_f1bsnbev\";\nexport const fileCellPreviewIcon = \"fileCellPreviewIcon_f1to9oja\";\nexport const colorCellValueSwatch = \"colorCellValueSwatch_ccm4ocw\";\nexport const colorCellTokenLegacy = \"colorCellTokenLegacy_c15rmsj5\";\nexport const cellTokenInsetBorder = \"cellTokenInsetBorder_c11nbpau\";\nexport const cellTokenCenteredText = \"cellTokenCenteredText_cgwsbsb\";\nexport const booleanTrueCellToken = \"booleanTrueCellToken_bx6zi5s\";\nexport const booleanFalseCellToken = \"booleanFalseCellToken_bsatzjg\";\nexport const imagePreviewThumbnail = \"imagePreviewThumbnail_ibrohfy\";\nexport const imagePreviewThumbnailLegacy = \"imagePreviewThumbnailLegacy_iz4caqs\";\nexport const emptyCellTokenLegacy = \"emptyCellTokenLegacy_e1shk4pr\";\nexport const emptyImagePreviewThumbnail = \"emptyImagePreviewThumbnail_e1j8va2w\";\nexport const galleryPreviewGap = 10;\nexport const galleryPreviewImageWidth = dimensions.values.cmsTablePreviewWidth;\nexport const galleryPreviewRow = \"galleryPreviewRow_gv5jnlg\";\nexport const vectorSetItemPreview = \"vectorSetItemPreview_v1mge9ff\";\nexport const vectorSetItemPreviewIcon = \"vectorSetItemPreviewIcon_v1nl6rvw\";\nexport const numberOfImagesInGalleryStack = 4;\nexport const arrayGalleryStack = \"arrayGalleryStack_a17kmmis\";", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { lookup as lookupMediaType } from \"mrmime\"\n\nexport type FileCellKind = \"file\" | \"image\" | \"video\"\n\ninterface FileCellDisplayInfo {\n\tfileName: string\n\tkind: FileCellKind\n}\n\nfunction decodeFileName(value: string): string {\n\ttry {\n\t\treturn decodeURIComponent(value)\n\t} catch {\n\t\treturn value\n\t}\n}\n\nfunction getFileExtension(fileName: string): string | null {\n\tconst lastDotIndex = fileName.lastIndexOf(\".\")\n\tif (lastDotIndex <= 0 || lastDotIndex === fileName.length - 1) return null\n\n\tconst extension = fileName.slice(lastDotIndex + 1).toLowerCase()\n\tif (!extension) return null\n\treturn extension\n}\n\nexport function getFileDisplayValue(value: string): string {\n\tconst assetReference = parseAssetReference(value)\n\tif (assetReference?.originalFilename) return assetReference.originalFilename\n\tif (assetReference?.identifier) return decodeFileName(assetReference.identifier)\n\n\tconst [valueWithoutQuery] = value.split(\"?\")\n\tif (!valueWithoutQuery) return \"\"\n\n\tconst encodedFilename = valueWithoutQuery.split(\"/\").at(-1)\n\tif (!encodedFilename) return \"\"\n\n\treturn decodeFileName(encodedFilename)\n}\n\nfunction getFileKind(fileName: string): FileCellKind {\n\tconst extension = getFileExtension(fileName)\n\tconst mimeType = extension ? lookupMediaType(extension) : null\n\tif (mimeType?.startsWith(\"image/\")) return \"image\"\n\tif (mimeType?.startsWith(\"video/\")) return \"video\"\n\treturn \"file\"\n}\n\nexport function getFileCellDisplayInfo(value: string): FileCellDisplayInfo {\n\tconst fileName = getFileDisplayValue(value)\n\treturn {\n\t\tfileName,\n\t\tkind: getFileKind(fileName),\n\t}\n}\n", "import {\n\tconvertDateValueToHoursMinutesFormat,\n\tconvertDateValueToYearMonthDayFormat,\n\tisValidDate,\n} from \"@framerjs/fresco/components/dateUtils.ts\"\n\nexport function getDateInputDisplayValue(value: string): string {\n\tif (!value) return \"\"\n\treturn convertDateValueToYearMonthDayFormat(value)\n}\n\nexport function getDateTimeInputDisplayValue(value: string): string {\n\tif (!value) return \"\"\n\n\tconst yearMonthDay = convertDateValueToYearMonthDayFormat(value)\n\tconst hoursMinutes = convertDateValueToHoursMinutesFormat(value)\n\tif (!yearMonthDay || !hoursMinutes) return \"\"\n\n\treturn `${yearMonthDay}T${hoursMinutes}`\n}\n\nexport function getDateControlValueForInputValue(value: string, displayTime = false): string | undefined {\n\tif (!value) return undefined\n\n\tif (!displayTime) {\n\t\t// Native date inputs emit `YYYY-MM-DD`, which the Date constructor interprets as UTC.\n\t\t// Storing the result as ISO keeps the selected calendar day stable across time zones.\n\t\tconst date = new Date(value)\n\t\tif (!isValidDate(date)) return undefined\n\n\t\treturn date.toJSON()\n\t}\n\n\tconst [datePart, timePart] = value.split(\"T\")\n\tif (!datePart || !timePart) return undefined\n\n\tconst [yearString, monthString, dayString] = datePart.split(\"-\")\n\tconst [hourString, minuteString] = timePart.split(\":\")\n\tif (!yearString || !monthString || !dayString || !hourString || !minuteString) return undefined\n\n\tconst year = Number(yearString)\n\tconst month = Number(monthString)\n\tconst day = Number(dayString)\n\tconst hour = Number(hourString)\n\tconst minute = Number(minuteString)\n\tif (\n\t\t!Number.isInteger(year) ||\n\t\t!Number.isInteger(month) ||\n\t\t!Number.isInteger(day) ||\n\t\t!Number.isInteger(hour) ||\n\t\t!Number.isInteger(minute)\n\t) {\n\t\treturn undefined\n\t}\n\n\tconst date = new Date(Date.UTC(year, month - 1, day, hour, minute, 0, 0))\n\tif (!isValidDate(date)) return undefined\n\tif (\n\t\tdate.getUTCFullYear() !== year ||\n\t\tdate.getUTCMonth() !== month - 1 ||\n\t\tdate.getUTCDate() !== day ||\n\t\tdate.getUTCHours() !== hour ||\n\t\tdate.getUTCMinutes() !== minute\n\t) {\n\t\treturn undefined\n\t}\n\n\treturn date.toJSON()\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { BooleanControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { BooleanInputRow } from \"./BooleanInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\n\ninterface Props {\n\tcontrol: BooleanControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeBooleanInputRow = React.memo(function LargeBooleanInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n}: Props) {\n\treturn (\n\t\t<LargePanelRow description={undefined} fieldId={fieldId} title={control.title ?? \"\"}>\n\t\t\t<BooleanInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tdescription={control.description}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import { IconInputDropdown, PopoverComboBox, useReadOnly } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { type KeyboardEvent, useMemo } from \"react\"\nimport * as styles from \"./CollectionReferencePillInput.styles.ts\"\nimport { ReferenceCellPills } from \"./ReferenceCellPills.tsx\"\nimport { useCollectionReferenceInputOptions } from \"./useCollectionReferenceInputOptions.tsx\"\n\ninterface Props {\n\tdataIdentifier: ModuleExportIdentifierString\n\tvalue: Reduced<string | undefined>\n\tonChange: (value: string | undefined) => void\n\toptional?: boolean\n}\n\nexport function CollectionReferencePillInput({ dataIdentifier, value, onChange, optional = false }: Props) {\n\tconst readOnly = useReadOnly()\n\n\tconst { listItemsById, itemOptions } = useCollectionReferenceInputOptions(dataIdentifier)\n\n\tfunction handleChange(newValue: string, final: boolean, reset: () => void) {\n\t\tif (value === newValue || newValue === \"\") {\n\t\t\tonChange(undefined)\n\t\t} else if (newValue in listItemsById) {\n\t\t\tonChange(newValue)\n\t\t}\n\n\t\tif (final) {\n\t\t\treset()\n\t\t}\n\t}\n\n\tfunction handleKeyboardAction(\n\t\tevent: KeyboardEvent<HTMLButtonElement>,\n\t\topenPopup: () => void,\n\t\thighlightItemByValue: (value: string | undefined, scrollIntoView: boolean) => void,\n\t) {\n\t\tswitch (event.key) {\n\t\t\tcase \"ArrowDown\":\n\t\t\tcase \"ArrowUp\":\n\t\t\t\topenPopup()\n\t\t\t\thighlightItemByValue(selectedValue, true)\n\t\t\t\tbreak\n\t\t\tcase \"Delete\":\n\t\t\tcase \"Backspace\":\n\t\t\t\tif (event.currentTarget.getAttribute(\"aria-expanded\") === \"true\") {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tonChange(undefined)\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tconst selectedValue = useMemo(() => itemOptions.find(option => option.value === value)?.value, [itemOptions, value])\n\tconst checkedItems = selectedValue ? [selectedValue] : undefined\n\n\treturn (\n\t\t<div className={cx(styles.wrapper, !selectedValue && styles.noSelectionWrapper)}>\n\t\t\t<PopoverComboBox\n\t\t\t\tvalue=\"\"\n\t\t\t\tlarge={false}\n\t\t\t\titems={itemOptions}\n\t\t\t\tenabled={!readOnly}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tcheckedItems={checkedItems}\n\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\tmenuClassName={styles.menuOffset}\n\t\t\t\tselectedItemRemovable={optional}\n\t\t\t>\n\t\t\t\t{({ triggerRef, open, highlightItemByValue }) => (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\taria-label=\"Change collection\"\n\t\t\t\t\t\tdata-popout-hitbox\n\t\t\t\t\t\tclassName={styles.triggerButton}\n\t\t\t\t\t\ttabIndex={0}\n\t\t\t\t\t\tonClick={open}\n\t\t\t\t\t\tonKeyDown={event => handleKeyboardAction(event, open, highlightItemByValue)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{selectedValue ? (\n\t\t\t\t\t\t\t<ReferenceCellPills\n\t\t\t\t\t\t\t\tvalues={[selectedValue]}\n\t\t\t\t\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\t\t\t\t\ttrailingIcon={<IconInputDropdown />}\n\t\t\t\t\t\t\t\tpillClassName={styles.focusablePill}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className={styles.noSelectionTitle}>{Dictionary.AddEllipsis}</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</PopoverComboBox>\n\t\t</div>\n\t)\n}\n", "import \"CollectionReferencePillInput.styles_14qice8.wyw.css\"; export const menuOffset = \"menuOffset_m13obyl8\";\nexport const wrapper = \"wrapper_w8kwsxh\";\nexport const noSelectionWrapper = \"noSelectionWrapper_n84gi20\";\nexport const noSelectionTitle = \"noSelectionTitle_n1otssq\";\nexport const focusablePill = \"focusablePill_ft2vsdl\";\nexport const triggerButton = \"triggerButton_t16w1xlk\";", "import { assert, type ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport React, { useMemo } from \"react\"\nimport { type ComboBoxCellPillItem, ComboBoxCellPills } from \"./ComboBoxCellPills.tsx\"\nimport { useCollectionReferenceInputOptions } from \"./useCollectionReferenceInputOptions.tsx\"\n\ninterface ReferenceCellPillsProps {\n\tdataIdentifier: ModuleExportIdentifierString\n\tvalues: readonly string[]\n\ttrailingIcon?: React.ReactNode\n\ttextOverflow?: \"ellipsis\" | \"clip\"\n\tpillMinWidth?: \"default\" | \"min-content\"\n\tpillClassName?: string\n}\n\nexport function useReferenceCellPillItems(\n\tdataIdentifier: ModuleExportIdentifierString,\n\tvalues: readonly string[],\n): readonly ComboBoxCellPillItem[] {\n\tconst { itemOptionsById } = useCollectionReferenceInputOptions(dataIdentifier)\n\n\treturn useMemo(() => {\n\t\treturn values.flatMap(value => {\n\t\t\tif (!(value in itemOptionsById)) return []\n\n\t\t\tconst option = itemOptionsById[value]\n\t\t\tassert(option, \"Expected value to be present from filter above\")\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkey: option.value,\n\t\t\t\t\tlabel: option.title ?? option.value,\n\t\t\t\t\tdetails: option.selectedItemLabel,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\t}, [values, itemOptionsById])\n}\n\nexport const ReferenceCellPills = React.memo(function ReferenceCellPills({\n\tdataIdentifier,\n\tvalues,\n\ttrailingIcon,\n\tpillClassName,\n\ttextOverflow = \"ellipsis\",\n\tpillMinWidth = \"default\",\n}: ReferenceCellPillsProps) {\n\tconst displayValues = useReferenceCellPillItems(dataIdentifier, values)\n\n\treturn (\n\t\t<ComboBoxCellPills\n\t\t\titems={displayValues}\n\t\t\ttrailingIcon={trailingIcon}\n\t\t\ttextOverflow={textOverflow}\n\t\t\tpillMinWidth={pillMinWidth}\n\t\t\tpillClassName={pillClassName}\n\t\t/>\n\t)\n})\n", "import { type PillTone, pillToneVariablesClassName } from \"@framerjs/fresco\"\nimport * as pillStyles from \"@framerjs/fresco/src/components/PillTone.styles.ts\"\nimport { cx } from \"@linaria/core\"\nimport React, { type ReactNode } from \"react\"\nimport * as styles from \"./ReferenceCellPills.styles.ts\"\n\nexport const dataComboBoxCellPillAttribute = \"data-combo-box-cell-pill\"\n\nexport interface ComboBoxCellPillItem {\n\tkey: string\n\tlabel: string\n\ttone?: PillTone\n\t/* Optional details to append to the pill */\n\tdetails?: ReactNode\n}\n\ninterface ComboBoxCellPillsProps {\n\titems: readonly ComboBoxCellPillItem[]\n\ttrailingIcon?: React.ReactNode\n\ttextOverflow?: \"ellipsis\" | \"clip\"\n\tpillMinWidth?: \"default\" | \"min-content\"\n\tpillClassName?: string\n}\n\nexport const ComboBoxCellPills = React.memo(function ComboBoxCellPills({\n\titems,\n\ttrailingIcon,\n\ttextOverflow = \"ellipsis\",\n\tpillMinWidth = \"default\",\n\tpillClassName,\n}: ComboBoxCellPillsProps) {\n\tif (items.length === 0) return null\n\n\treturn (\n\t\t<div className={styles.pillsContainer}>\n\t\t\t{items.map(({ key, label, tone, details }, index) => {\n\t\t\t\tconst isLastPill = index === items.length - 1\n\t\t\t\tconst shouldRenderIcon = trailingIcon && isLastPill\n\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t{...{ [dataComboBoxCellPillAttribute]: \"true\" }}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tpillStyles.pill,\n\t\t\t\t\t\t\tpillClassName,\n\t\t\t\t\t\t\tpillToneVariablesClassName(tone),\n\t\t\t\t\t\t\tpillMinWidth === \"min-content\" && styles.pillMinContent,\n\t\t\t\t\t\t\tshouldRenderIcon && pillStyles.pillWithIcon,\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className={textOverflow === \"clip\" ? pillStyles.pillTextClip : pillStyles.pillText}>{label}</span>\n\t\t\t\t\t\t{details}\n\t\t\t\t\t\t{shouldRenderIcon ? (\n\t\t\t\t\t\t\t<span className={pillStyles.pillIcon} aria-hidden={true}>\n\t\t\t\t\t\t\t\t{trailingIcon}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t})}\n\t\t</div>\n\t)\n})\n", "import \"ReferenceCellPills.styles_2kqrd7.wyw.css\"; export const pillsContainer = \"pillsContainer_p1wmwusj\";\nexport const pillMinContent = \"pillMinContent_p1u7wpav\";", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { AddReferenceAction } from \"document/utils/contentManagementOverlayStack.ts\"\nimport type {\n\tCollectionReferenceControlDescription,\n\tMultiCollectionReferenceControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport { createCollectionItem } from \"utils/createCollectionItem.ts\"\n\nexport async function createNewItemInReferencedCollection({\n\tengine,\n\tsaveAction,\n\tcontrol,\n}: {\n\tengine: VekterEngine\n\tsaveAction: AddReferenceAction\n\tcontrol: CollectionReferenceControlDescription | MultiCollectionReferenceControlDescription\n}) {\n\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\t\tconst contentManagementNode = getContentManagementNode(engine.tree)?.loaded\n\t\tif (!contentManagementNode) return\n\n\t\tconst referencedCollection = contentManagementNode.children.find(\n\t\t\tcollection => collection.instanceIdentifier === control.dataIdentifier,\n\t\t)\n\t\tif (!referencedCollection) return\n\n\t\tcreateCollectionItem({\n\t\t\tcollectionId: referencedCollection.id,\n\t\t\tengine,\n\t\t\tsaveAction,\n\t\t\tsource: \"collection_item\",\n\t\t})\n\t})\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\n\nfunction useCollectionNode(collectionId: NodeID | null) {\n\tconst engine = useBaseEngine()\n\treturn useDeprecatedEngineState(\n\t\t[EngineChange.Tree],\n\t\t() => engine.tree.getNodeWithTrait(collectionId, isCollectionNode),\n\t\t[collectionId],\n\t)\n}\n\nexport function useCollectionDataIsViewOnly(collectionId: NodeID | null): boolean {\n\tconst collectionNode = useCollectionNode(collectionId)\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\n\tif (isViewOnly) return true\n\tif (!collectionNode) return true\n\n\treturn !!collectionNode.managedByPlugin\n}\n\nexport function useCollectionItemValuesAreViewOnly(collectionId: NodeID | null): boolean {\n\tconst collectionNode = useCollectionNode(collectionId)\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\treturn isViewOnly || !collectionNode\n}\n\nexport function useCollectionWithDataIdentifierIsViewOnly(dataIdentifier: ModuleExportIdentifierString): boolean {\n\tconst engine = useBaseEngine()\n\tconst collection = useDeprecatedEngineState(\n\t\t[EngineChange.Tree],\n\t\t() => getCollectionForIdentifier(engine.tree, dataIdentifier),\n\t\t[dataIdentifier],\n\t)\n\n\treturn useCollectionDataIsViewOnly(collection?.id ?? null)\n}\n\nexport function useCollectionVariablesAreViewOnly(collectionId: NodeID) {\n\tconst collectionNode = useCollectionNode(collectionId)\n\tconst isManagedByPlugin = Boolean(collectionNode?.managedByPlugin)\n\treturn useIsViewOnly(\"canEditVariables\") || isManagedByPlugin\n}\n", "import { Button, IconEditPencil, IconPlus, Stack } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getCollectionReferenceControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { CollectionReferenceControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { CollectionReferencePillInput } from \"./CollectionReferencePillInput.tsx\"\nimport * as controlRowStyles from \"./LargeControlRow.styles.ts\"\nimport { createNewItemInReferencedCollection } from \"./utils/createNewItemInReferencedCollection.ts\"\nimport { getUpdatedCollectionReferenceControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\nimport { useCollectionWithDataIdentifierIsViewOnly } from \"./utils/useCollectionIsViewOnly.ts\"\n\ninterface Props {\n\tcollectionId: NodeID\n\tcontrol: CollectionReferenceControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\tid: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n}\n\nexport function CollectionReferenceInputRow({\n\tcollectionId,\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\tid,\n\tonChange,\n\trequired,\n}: Props) {\n\tconst controlPropValue = getCollectionReferenceControlPropValue(control, controlProp)\n\tassert(!isVariableReference(controlPropValue), \"Variables are not supported\")\n\n\tconst referencedCollectionDataIdentifier = control.dataIdentifier as ModuleExportIdentifierString\n\tconst referencedCollectionIsViewOnly = useCollectionWithDataIdentifierIsViewOnly(referencedCollectionDataIdentifier)\n\n\tconst editEnabled = Boolean(controlPropValue) && !referencedCollectionIsViewOnly\n\tconst newItemEnabled = !referencedCollectionIsViewOnly\n\n\tfunction handleChange(value: string | undefined) {\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tonChange(getUpdatedCollectionReferenceControlProp(value), fieldId, id)\n\t\t})\n\t}\n\n\tconst handleEditItem = useEngineCallback(() => {\n\t\tconst referencedItemId = controlPropValue\n\t\tif (!isString(referencedItemId)) return\n\t\tengine.stores.contentManagementStore.pushExistingItemToOverlayStack(referencedItemId)\n\t}, [controlPropValue])\n\n\tfunction handleNewItem() {\n\t\tvoid createNewItemInReferencedCollection({\n\t\t\tengine,\n\t\t\tsaveAction: {\n\t\t\t\tparentItemCollectionId: collectionId,\n\t\t\t\tparentItemId: id,\n\t\t\t\tvariableId: fieldId,\n\t\t\t\ttype: \"add-reference\",\n\t\t\t},\n\t\t\tcontrol,\n\t\t})\n\t}\n\n\tconst buttonClassName = cx(controlRowStyles.squareButton, controlRowStyles.squareButtonGhostFocusOutline)\n\n\treturn (\n\t\t<Stack direction=\"row\">\n\t\t\t<CollectionReferencePillInput\n\t\t\t\toptional={!required}\n\t\t\t\tvalue={controlPropValue}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tdataIdentifier={referencedCollectionDataIdentifier}\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\ttitle={Dictionary.Edit}\n\t\t\t\tenabled={Boolean(controlPropValue) && !referencedCollectionIsViewOnly}\n\t\t\t\tonClick={handleEditItem}\n\t\t\t\ttabIndex={editEnabled ? 0 : -1}\n\t\t\t\tclassName={buttonClassName}\n\t\t\t>\n\t\t\t\t<IconEditPencil />\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\ttitle={Dictionary.NewItem}\n\t\t\t\tenabled={!referencedCollectionIsViewOnly}\n\t\t\t\tonClick={handleNewItem}\n\t\t\t\ttabIndex={newItemEnabled ? 0 : -1}\n\t\t\t\tclassName={buttonClassName}\n\t\t\t>\n\t\t\t\t<IconPlus />\n\t\t\t</Button>\n\t\t</Stack>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getCollectionReferenceControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { CollectionReferenceControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { CollectionReferenceInputRow } from \"./CollectionReferenceInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\n\ninterface Props {\n\tcollectionId: NodeID\n\tcontrol: CollectionReferenceControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\tid: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n}\n\nexport function LargeCollectionReferenceInputRow({\n\tcollectionId,\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\tid,\n\tonChange,\n\trequired,\n}: Props) {\n\tconst controlPropValue = getCollectionReferenceControlPropValue(control, controlProp)\n\tassert(!isVariableReference(controlPropValue), \"Variables are not supported\")\n\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<CollectionReferenceInputRow\n\t\t\t\tcollectionId={collectionId}\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\tid={id}\n\t\t\t\tonChange={onChange}\n\t\t\t\trequired={required}\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ColorControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { ColorPickerPopout } from \"../shared/ColorPicker/ColorPickerPopout.tsx\"\nimport { ColorInputRow } from \"./ColorInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\n\ninterface Props {\n\tcontrol: ColorControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: string\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeColorInputRow = React.memo(function LargeColorInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n}: Props) {\n\treturn (\n\t\t<LargePanelRow description={control.description} fieldId={fieldId} title={control.title ?? \"\"}>\n\t\t\t<ColorInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\tColorPickerPopoutComponent={ColorPickerPopout}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { DateControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { DateInputRow } from \"./DateInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\n\ninterface Props {\n\tcontrol: DateControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\trequired: boolean\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeDateInputRow = React.memo(function LargeDateInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\trequired,\n\tonChange,\n}: Props) {\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<DateInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\trequired={required}\n\t\t\t\tonChange={onChange}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { EnumControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { EnumInputRow } from \"./EnumInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\n\ninterface Props {\n\tcontrol: EnumControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeEnumInputRow = React.memo(function LargeEnumInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n}: Props) {\n\treturn (\n\t\t<LargePanelRow description={control.description} fieldId={fieldId} title={control.title ?? \"\"}>\n\t\t\t<EnumInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { FileControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { FileInputRow, checkIfIsValidFileType } from \"./FileInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\n\ninterface Props {\n\tcontrol: FileControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n\treset: (prop: string, id: NodeID) => void\n}\n\nexport const LargeFileInputRow = React.memo(function LargeFileInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n\trequired,\n\treset,\n}: Props) {\n\tconst isValidFileType = checkIfIsValidFileType(controlProp, control)\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\tshowWarningTint={!isValidFileType}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<FileInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\treset={reset}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ResponsiveImageControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ImageInputRow } from \"./ImageInputRow.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport type { CollectionItemChangeHandler } from \"./utils/CollectionItemChangeHandler.ts\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\n\nexport function LargeImageInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChangeComparingLatestControlProp,\n\treset,\n\trequired,\n}: {\n\tcontrol: ResponsiveImageControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChangeComparingLatestControlProp: (getUpdate: CollectionItemChangeHandler, fieldId: VariableID, id: NodeID) => void\n\treset: (fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n}) {\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<ImageInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChangeComparingLatestControlProp}\n\t\t\t\treset={reset}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n}\n", "import type { ComboBoxListItem, ComboBoxListItemOption, ComboBoxListItemSection, ComboBoxProps } from \"@framerjs/fresco\"\nimport { Button, ComboBox, IconInputClose, Stack } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { BaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { useWebPageScrollTargetOptions } from \"document/base-engine/BaseEngineStore.utils.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ScrollTargetOptions } from \"document/models/CanvasTree/traits/WithScrollTargetOptions.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tcreateLink,\n\tgetLinkHashVariable,\n\tisLinkToURL,\n\tisLinkToWebPage,\n\ttype Link,\n\ttype LinkToWebPage,\n\ttype LinkVariables,\n} from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getLinkControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { LinkControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport React, { useMemo, useState } from \"react\"\nimport { getItemToSlug } from \"utils/collectionSlugUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { usePageLinkPath } from \"../properties/panels/usePageLinkPath.ts\"\nimport { getSectionDataRepeaterIdentifierForTarget } from \"../properties/rows/EffectRows/shared/EffectScrollTargetRow.tsx\"\nimport * as inputStyles from \"../shared/LinkInput.styles.ts\"\nimport { LinkInput } from \"../shared/LinkInput.tsx\"\nimport { usePopoverWithinPadding } from \"../utils/usePopoverWithinPadding.ts\"\nimport { collectionInputFontSize, collectionInputPaddingInline } from \"./LargePanelRow.styles.ts\"\nimport { getUpdatedLinkControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\n\ninterface Props {\n\tcontrol: LinkControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\treset: (prop: string, id: NodeID) => void\n}\n\ninterface PageLinkTargetOption {\n\tdisplayValue: string\n\thash: NodeID\n\thashVariables: LinkVariables | undefined\n}\n\ninterface RepeaterSectionOptions {\n\tdataIdentifier: ModuleExportIdentifierString\n\titemToSlug: Record<string, string>\n\tslugKey: string\n}\n\nfunction preventInputFocus(event: React.MouseEvent) {\n\tevent.preventDefault()\n\tevent.stopPropagation()\n}\n\nfunction getCurrentValue(controlProp: ControlProp | undefined, control: LinkControlDescription): Link | undefined {\n\tconst value = getLinkControlPropValue(control, controlProp)\n\tassert(!isDynamicValue(value), \"Dynamic values are not supported within the CMS.\")\n\tif (isNotFound(value) || value == null) return undefined\n\treturn value\n}\n\nexport const CollectionItemPageLinkingRows = React.memo(function CollectionItemPageLinkingRows({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n\treset,\n}: Props) {\n\tconst engine = useBaseEngine()\n\tconst value = getCurrentValue(controlProp, control)\n\n\tconst tree = useEngineState(() => engine.tree, [], EngineChange.Tree)\n\n\tconst updateLinkValue = React.useCallback(\n\t\t(nextValue: Link | undefined) => {\n\t\t\tif (!nextValue || (isLinkToURL(nextValue) && nextValue.url === \"\")) {\n\t\t\t\treset(fieldId, itemId)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tonChange(getUpdatedLinkControlProp(controlProp, nextValue), fieldId, itemId)\n\t\t},\n\t\t[controlProp, fieldId, itemId, onChange, reset],\n\t)\n\n\tconst setPath = usePageLinkPath({ link: value, onChange: updateLinkValue })\n\tconst clearLink = React.useCallback(() => reset(fieldId, itemId), [fieldId, itemId, reset])\n\n\treturn (\n\t\t<Stack direction=\"column\">\n\t\t\t<LinkInput\n\t\t\t\ttree={tree}\n\t\t\t\tlink={value}\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tsupportsPageLinks\n\t\t\t\tsupportsVariables={false}\n\t\t\t\tonChange={setPath}\n\t\t\t\tautoFocus={false}\n\t\t\t\tvariableInfo={null}\n\t\t\t\taria-label=\"Page link\"\n\t\t\t\tonClear={value ? clearLink : undefined}\n\t\t\t\tinputClassName={cx(collectionInputFontSize, collectionInputPaddingInline)}\n\t\t\t/>\n\t\t\t{isLinkToWebPage(value) && <CollectionItemPageLinkScrollTargetInput link={value} onChange={updateLinkValue} />}\n\t\t</Stack>\n\t)\n})\n\nfunction CollectionItemPageLinkScrollTargetInput({\n\tlink,\n\tonChange,\n}: {\n\tlink: LinkToWebPage\n\tonChange: (value: Link | undefined) => void\n}) {\n\tconst engine = useBaseEngine()\n\tconst menuWithin = usePopoverWithinPadding()\n\tconst agentIsOn = useExperimentIsOn(\"agent\")\n\n\tconst scrollTargetOptions = useWebPageScrollTargetOptions(link.webPageId)\n\tconst selectedCollectionItem = getLinkHashVariable(link.hashVariables)\n\tconst repeaterSectionOptionsById = useRepeaterSectionOptionsById(engine, scrollTargetOptions)\n\tconst targetOptions = useMemo(\n\t\t() => getPageLinkTargetOptions(scrollTargetOptions, repeaterSectionOptionsById),\n\t\t[repeaterSectionOptionsById, scrollTargetOptions],\n\t)\n\n\tif (!scrollTargetOptions || scrollTargetOptions.size === 0) return null\n\n\tconst selectedValue = getSelectedPageLinkTargetValue(link.hash, selectedCollectionItem)\n\tconst selectedTargetOption = selectedValue ? targetOptions.optionByValue.get(selectedValue) : undefined\n\tconst inputValue =\n\t\tselectedTargetOption?.displayValue ?? getFallbackPageLinkTargetDisplayValue(link.hash, scrollTargetOptions) ?? \"\"\n\tconst pageLink = link\n\tconst clearScrollTarget = link.hash\n\t\t? () =>\n\t\t\t\tonChange(\n\t\t\t\t\tcreateLink({\n\t\t\t\t\t\twebPageId: pageLink.webPageId,\n\t\t\t\t\t\tpathVariables: pageLink.pathVariables,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t: undefined\n\n\tconst setScrollTarget: ComboBoxProps[\"onChange\"] = (value, final, reset) => {\n\t\tif (!final) return\n\n\t\tif (value === \"\" && clearScrollTarget) {\n\t\t\tclearScrollTarget()\n\t\t\treturn\n\t\t}\n\n\t\tconst nextTarget = targetOptions.optionByValue.get(value)\n\t\tif (!nextTarget) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tonChange(\n\t\t\tcreateLink({\n\t\t\t\twebPageId: pageLink.webPageId,\n\t\t\t\thash: nextTarget.hash,\n\t\t\t\tpathVariables: pageLink.pathVariables,\n\t\t\t\thashVariables: nextTarget.hashVariables,\n\t\t\t}),\n\t\t)\n\t}\n\n\treturn (\n\t\t<ComboBox\n\t\t\titems={targetOptions.items}\n\t\t\tvalue={inputValue}\n\t\t\tonChange={setScrollTarget}\n\t\t\taria-label=\"Scroll section\"\n\t\t\tclearSelectionOnEmptySearch\n\t\t\tplaceholder=\"Choose Scroll Section\u2026\"\n\t\t\tshowAllWhenOpened={Boolean(link.hash)}\n\t\t\tmenuWithin={menuWithin}\n\t\t\tunsaturated={agentIsOn}\n\t\t\tclassName={cx(collectionInputFontSize, collectionInputPaddingInline)}\n\t\t\twrapperClassName={cx(clearScrollTarget && inputStyles.ghostWrapper)}\n\t\t\tvariant=\"ghost\"\n\t\t\trightSlot={\n\t\t\t\tclearScrollTarget && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={cx(inputStyles.clearButton, inputStyles.clearButtonGhost)}\n\t\t\t\t\t\tonMouseDown={preventInputFocus}\n\t\t\t\t\t\tonClick={event => {\n\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\tclearScrollTarget()\n\t\t\t\t\t\t}}\n\t\t\t\t\t\taria-label=\"Clear scroll section\"\n\t\t\t\t\t\ttitle=\"Remove Scroll Section\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t</Button>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t)\n}\n\ntype RepeaterSectionOptionsById = Map<NodeID, RepeaterSectionOptions>\n\nfunction isRepeaterSectionOptionsByIdEqual(a: RepeaterSectionOptionsById, b: RepeaterSectionOptionsById) {\n\tif (a.size !== b.size) return false\n\n\tfor (const key of a.keys()) {\n\t\tconst aOptions = a.get(key)\n\t\tconst bOptions = b.get(key)\n\t\tif (!isShallowEqual(aOptions, bOptions)) return false\n\t}\n\n\treturn true\n}\n\nexport function useRepeaterSectionOptionsById(engine: BaseEngine, scrollTargetOptions: ScrollTargetOptions | null) {\n\tconst repeaterSectionOptionsById = useDeprecatedEngineState(\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle],\n\t\t() => getRepeaterSectionOptionsById(engine, scrollTargetOptions),\n\t\t[engine, scrollTargetOptions],\n\t\ttrue,\n\t)\n\n\tconst [stableRepeaterSectionOptionsById, setStableRepeaterSectionOptionsById] =\n\t\tuseState<RepeaterSectionOptionsById>(repeaterSectionOptionsById)\n\tconst [previousRepeaterSectionOptionsById, setPreviousRepeaterSectionOptionsById] =\n\t\tuseState<RepeaterSectionOptionsById>(repeaterSectionOptionsById)\n\n\tif (previousRepeaterSectionOptionsById !== repeaterSectionOptionsById) {\n\t\tsetPreviousRepeaterSectionOptionsById(repeaterSectionOptionsById)\n\n\t\tif (!isRepeaterSectionOptionsByIdEqual(stableRepeaterSectionOptionsById, repeaterSectionOptionsById)) {\n\t\t\tsetStableRepeaterSectionOptionsById(repeaterSectionOptionsById)\n\t\t\treturn repeaterSectionOptionsById\n\t\t}\n\t}\n\n\treturn stableRepeaterSectionOptionsById\n}\n\nfunction getRepeaterSectionOptionsById(engine: BaseEngine, scrollTargetOptions: ScrollTargetOptions | null) {\n\tconst result: RepeaterSectionOptionsById = new Map()\n\n\tif (!scrollTargetOptions) return result\n\n\tfor (const [targetId] of scrollTargetOptions) {\n\t\tconst dataIdentifier = getSectionDataRepeaterIdentifierForTarget(engine, targetId)\n\t\tif (!dataIdentifier) continue\n\n\t\tconst collection = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\t\tif (!collection) continue\n\n\t\tconst slugVariable = collection.getSlugVariable()\n\t\tif (!slugVariable) continue\n\n\t\tconst itemToSlug = getItemToSlug(engine.tree, engine.componentLoader, dataIdentifier)\n\t\tif (!itemToSlug) continue\n\n\t\tresult.set(targetId, {\n\t\t\tdataIdentifier,\n\t\t\titemToSlug,\n\t\t\tslugKey: slugVariable.id,\n\t\t})\n\t}\n\n\treturn result\n}\n\nfunction getSelectedPageLinkTargetValue(\n\tselectedScrollTarget: NodeID | undefined,\n\tselectedCollectionItem: ReturnType<typeof getLinkHashVariable>,\n) {\n\tif (!selectedScrollTarget) return undefined\n\n\tif (isResolvedCollectionItemSelector(selectedCollectionItem)) {\n\t\treturn createPageLinkTargetValue(selectedScrollTarget, selectedCollectionItem.collectionItemId)\n\t}\n\n\treturn createPageLinkTargetValue(selectedScrollTarget)\n}\n\nfunction getFallbackPageLinkTargetDisplayValue(\n\tselectedScrollTarget: NodeID | undefined,\n\tscrollTargetOptions: ScrollTargetOptions,\n) {\n\tif (!selectedScrollTarget) return undefined\n\n\tconst elementId = scrollTargetOptions.get(selectedScrollTarget)\n\tif (!elementId) return undefined\n\n\treturn getPageLinkSectionTitle(elementId)\n}\n\nfunction getPageLinkTargetOptions(\n\tscrollTargetOptions: ScrollTargetOptions | null,\n\trepeaterSectionOptionsById: RepeaterSectionOptionsById,\n) {\n\tconst items: ComboBoxListItem[] = []\n\tconst optionByValue = new Map<string, PageLinkTargetOption>()\n\tconst repeaterSections: ComboBoxListItemSection[] = []\n\n\tif (!scrollTargetOptions) return { items, optionByValue }\n\n\tfor (const [targetId, elementId] of scrollTargetOptions) {\n\t\tconst sectionTitle = getPageLinkSectionTitle(elementId)\n\t\tconst repeaterSectionOptions = repeaterSectionOptionsById.get(targetId)\n\t\tif (!repeaterSectionOptions) {\n\t\t\tconst value = createPageLinkTargetValue(targetId)\n\t\t\titems.push({ type: \"option\", value, title: sectionTitle })\n\t\t\toptionByValue.set(value, {\n\t\t\t\tdisplayValue: sectionTitle,\n\t\t\t\thash: targetId,\n\t\t\t\thashVariables: undefined,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tconst slugifiedElementId = slugify(elementId)\n\n\t\tconst sectionItems = Object.entries(repeaterSectionOptions.itemToSlug).map(\n\t\t\t([collectionItemId, slug]): ComboBoxListItemOption => {\n\t\t\t\tconst value = createPageLinkTargetValue(targetId, collectionItemId)\n\t\t\t\tconst selection: ResolvedCollectionItemSelector = {\n\t\t\t\t\tidentifier: repeaterSectionOptions.dataIdentifier,\n\t\t\t\t\tcollectionItemId,\n\t\t\t\t\tkey: repeaterSectionOptions.slugKey,\n\t\t\t\t\tvalue: slug,\n\t\t\t\t}\n\t\t\t\tconst displayValue = `#${slug}-${slugifiedElementId}`\n\t\t\t\toptionByValue.set(value, {\n\t\t\t\t\tdisplayValue,\n\t\t\t\t\thash: targetId,\n\t\t\t\t\thashVariables: { [selection.key]: selection },\n\t\t\t\t})\n\n\t\t\t\treturn { type: \"option\", value, title: displayValue }\n\t\t\t},\n\t\t)\n\n\t\tif (sectionItems.length === 0) continue\n\n\t\trepeaterSections.push({\n\t\t\ttype: \"section\",\n\t\t\tvalue: sectionTitle,\n\t\t\ttitle: sectionTitle,\n\t\t\titems: sectionItems,\n\t\t})\n\t}\n\n\titems.push(...repeaterSections)\n\treturn { items, optionByValue }\n}\n\nfunction createPageLinkTargetValue(targetId: NodeID, collectionItemId?: string) {\n\treturn collectionItemId ? `${targetId}:${collectionItemId}` : targetId\n}\n\nfunction getPageLinkSectionTitle(elementId: string) {\n\treturn `#${slugify(elementId)}`\n}\n\nexport const testing = {\n\tcreatePageLinkTargetValue,\n\tgetPageLinkTargetOptions,\n\tgetFallbackPageLinkTargetDisplayValue,\n\tgetSelectedPageLinkTargetValue,\n} as const\n", "import type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { LinkControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { CollectionItemPageLinkingRows } from \"./CollectionItemPageLinkingRows.tsx\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\n\ninterface Props {\n\tcontrol: LinkControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\treset: (prop: string, id: NodeID) => void\n\trequired: boolean\n}\n\nexport function LargeLinkInputRow({ control, controlProp, fieldId, itemId, onChange, reset, required }: Props) {\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<CollectionItemPageLinkingRows\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\treset={reset}\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n}\n", "import \"LargeMultiCollectionReferenceInputRow.styles_1xhhlj6.wyw.css\"; export const inputWrapper = \"inputWrapper_if9z2fd\";\nexport const tokens = \"tokens_twtqiu8\";\nexport const emptyTokens = \"emptyTokens_etl9cg1\";\nexport const tokenText = \"tokenText_te9uhnl\";\nexport const closeButton = \"closeButton_c1rfbmpo\";\nexport const token = \"token_t1qqzje0\";\nexport const inputWrapperGhostKeyboardFocusOutline = \"inputWrapperGhostKeyboardFocusOutline_ixsi3o1\";\nexport const emptyInputGhost = \"emptyInputGhost_eygk3wd\";\nexport const inputGhostWithTokens = \"inputGhostWithTokens_i1fvq343\";", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport const handleEditCollectionItem = (itemId: NodeID) => {\n\tengine.stores.contentManagementStore.pushExistingItemToOverlayStack(itemId)\n}\n", "import { Button, IconPlus, Stack } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getMultiCollectionReferenceControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { MultiCollectionReferenceControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport * as controlRowStyles from \"./LargeControlRow.styles.ts\"\nimport * as styles from \"./LargeMultiCollectionReferenceInputRow.styles.ts\"\nimport { collectionInputFontSize } from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { MultiCollectionReferenceInput } from \"./MultiCollectionReferenceInput.tsx\"\nimport { createNewItemInReferencedCollection } from \"./utils/createNewItemInReferencedCollection.ts\"\nimport { getMessageFromWarning, getRequiredAndMissingErrorMessage } from \"./utils/fieldValidationHelpers.ts\"\nimport { getUpdatedMultiCollectionReferenceControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\nimport { handleEditCollectionItem } from \"./utils/handleEditCollectionItem.ts\"\nimport { useCollectionWithDataIdentifierIsViewOnly } from \"./utils/useCollectionIsViewOnly.ts\"\n\ninterface Props {\n\tcollectionId: NodeID\n\tcontrol: MultiCollectionReferenceControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\tid: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\trequired: boolean\n}\n\nexport function LargeMultiCollectionReferenceInputRow({\n\tcollectionId,\n\tid,\n\tfieldId,\n\tcontrolProp,\n\tcontrol,\n\trequired,\n\tonChange,\n}: Props) {\n\tconst referencedCollectionDataIdentifier = control.dataIdentifier as ModuleExportIdentifierString\n\tconst referencedCollectionIsViewOnly = useCollectionWithDataIdentifierIsViewOnly(referencedCollectionDataIdentifier)\n\n\tconst newItemEnabled = !referencedCollectionIsViewOnly\n\n\tconst value = getMultiCollectionReferenceControlPropValue(control, controlProp) ?? []\n\tassert(!isDynamicValue(value), \"Dynamic values are not supported\")\n\n\tfunction handleChange(newValue: string[] | undefined) {\n\t\tonChange(getUpdatedMultiCollectionReferenceControlProp(newValue), fieldId, id)\n\t}\n\n\tconst errorMessage = getMessageFromWarning(getRequiredAndMissingErrorMessage(controlProp, control, required), control)\n\n\tconst handleCreateItem = () => {\n\t\tvoid createNewItemInReferencedCollection({\n\t\t\tengine,\n\t\t\tsaveAction: {\n\t\t\t\tparentItemCollectionId: collectionId,\n\t\t\t\tparentItemId: id,\n\t\t\t\tvariableId: fieldId,\n\t\t\t\ttype: \"add-reference\",\n\t\t\t},\n\t\t\tcontrol,\n\t\t})\n\t}\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<Stack direction=\"row\">\n\t\t\t\t<MultiCollectionReferenceInput\n\t\t\t\t\tlarge={false}\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tfullWidthTokensWhenSmall={false}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tcollectionInputFontSize,\n\t\t\t\t\t\tvalue.length === 0 && styles.emptyInputGhost,\n\t\t\t\t\t\tvalue.length > 0 && styles.inputGhostWithTokens,\n\t\t\t\t\t)}\n\t\t\t\t\twrapperClassName={cx(styles.inputWrapper, styles.inputWrapperGhostKeyboardFocusOutline)}\n\t\t\t\t\ttokensClassName={cx(styles.tokens, value.length === 0 && styles.emptyTokens)}\n\t\t\t\t\ttokenClassName={styles.token}\n\t\t\t\t\ttokenTextClassName={styles.tokenText}\n\t\t\t\t\ttokenCloseButtonClassName={styles.closeButton}\n\t\t\t\t\tonClickItem={handleEditCollectionItem}\n\t\t\t\t\tdataIdentifier={referencedCollectionDataIdentifier}\n\t\t\t\t/>\n\t\t\t\t<Button\n\t\t\t\t\ttitle={Dictionary.NewItem}\n\t\t\t\t\tenabled={newItemEnabled}\n\t\t\t\t\tonClick={handleCreateItem}\n\t\t\t\t\ttabIndex={newItemEnabled ? 0 : -1}\n\t\t\t\t\tclassName={cx(controlRowStyles.squareButton, controlRowStyles.squareButtonGhostFocusOutline)}\n\t\t\t\t>\n\t\t\t\t\t<IconPlus />\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</LargePanelRow>\n\t)\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { NumberControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { NumberInputRow } from \"./NumberInputRow.tsx\"\n\ninterface Props {\n\tcontrol: NumberControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nexport const LargeNumberInputRow = React.memo(function LargeNumberInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n}: Props) {\n\treturn (\n\t\t<LargePanelRow description={control.description} fieldId={fieldId} title={control.title ?? \"\"}>\n\t\t\t<NumberInputRow\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={controlProp}\n\t\t\t\tfieldId={fieldId}\n\t\t\t\titemId={itemId}\n\t\t\t\tonChange={onChange}\n\t\t\t\tvariant=\"plain\"\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import { useReadOnly } from \"@framerjs/fresco\"\nimport type { AttachmentEdgePreferences } from \"@framerjs/fresco/src/components/Popover\"\nimport { cx } from \"@linaria/core\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getRichTextControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { RichTextTreeValue } from \"document/models/richText/richTextStorage.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { RichTextControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { cmsSchemaParams, makeSchema } from \"prosemirror/schema/index.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport type { InsertButtonPopoverOptions } from \"../richTextEditor/RichTextEditorWithToolbar.tsx\"\nimport { RichTextEditorWithToolbarAndNodeViews } from \"../richTextEditor/RichTextEditorWithToolbarAndNodeViews.tsx\"\nimport * as styles from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport {\n\tgetExceedsMaxLengthErrorMessage,\n\tgetMessageFromWarning,\n\tgetRequiredAndMissingErrorMessage,\n} from \"./utils/fieldValidationHelpers.ts\"\nimport { getUpdatedRichTextControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\n\nfunction getCurrentValue(controlProp: ControlProp | undefined, control: RichTextControlDescription): RichTextTreeValue {\n\t// We have to include strings because CMS sample data was previously wrongly created with this type\n\tif (controlProp && controlProp.type === ControlType.String && isString(controlProp.value)) {\n\t\treturn controlProp.value\n\t}\n\tconst value = getRichTextControlPropValue(control, controlProp)\n\tif (isDynamicValue(value)) return \"\"\n\treturn value\n}\n\nfunction getErrorMessage(\n\tcontrolProp: ControlProp | undefined,\n\tcontrol: RichTextControlDescription,\n\trequired: boolean,\n): string | undefined {\n\tconst requiredErrorMessage = getRequiredAndMissingErrorMessage(controlProp, control, required)\n\tif (requiredErrorMessage) return getMessageFromWarning(requiredErrorMessage, control)\n\n\tconst maxLengthWarning = getExceedsMaxLengthErrorMessage(controlProp, control)\n\treturn getMessageFromWarning(maxLengthWarning, control)\n}\n\n// Defined outside the component to reduce renders\nconst popoverAttachmentEdge: AttachmentEdgePreferences = [\"left\", \"right\", \"auto-vertical\"]\n\nconst insertButtonPopoverOptions: InsertButtonPopoverOptions = {\n\tpopoverAttachmentEdge: [\"left\", \"auto-vertical\"],\n\tpopoverOffset: { x: 30, y: 0 },\n\tdisplayInPopover: true,\n\tshowArrow: false,\n}\n\ninterface Props {\n\tcontrol: RichTextControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\tonUnsavedChange?: () => void\n\trequired: boolean\n}\n\nexport const LargeRichTextInputRow = React.memo(function LargeRichTextInputRow({\n\tcontrol,\n\tcontrolProp,\n\tfieldId,\n\titemId,\n\tonChange,\n\tonUnsavedChange,\n\trequired,\n}: Props) {\n\tconst [errorMessage, setErrorMessage] = React.useState<string | undefined>()\n\tconst isReadOnly = useReadOnly()\n\n\tReact.useEffect(() => {\n\t\tconst message = getErrorMessage(controlProp, control, required)\n\t\tsetErrorMessage(message)\n\t}, [controlProp, control, required])\n\n\tconst value = getCurrentValue(controlProp, control)\n\n\tconst handleChange = React.useCallback(\n\t\t(html: string) => {\n\t\t\tonChange(getUpdatedRichTextControlProp(controlProp, html), fieldId, itemId)\n\t\t},\n\t\t[controlProp, fieldId, itemId, onChange],\n\t)\n\n\tconst handleUnsavedChange = React.useCallback(\n\t\t(html: string) => {\n\t\t\t// Use the new value to update the error message.\n\t\t\t// This should happen regardless of whether the change is persisted or not.\n\t\t\tconst newErrorMessage = getErrorMessage(\n\t\t\t\t{ ...controlProp, type: ControlType.RichText, value: html },\n\t\t\t\tcontrol,\n\t\t\t\trequired,\n\t\t\t)\n\t\t\tsetErrorMessage(newErrorMessage)\n\n\t\t\tonUnsavedChange?.()\n\t\t},\n\t\t[onUnsavedChange, controlProp, control, required],\n\t)\n\n\tconst schema = useConstant(() => makeSchema(cmsSchemaParams))\n\n\treturn (\n\t\t<LargePanelRow description={undefined} fieldId={fieldId} title={control.title ?? \"\"} warningMessage={errorMessage}>\n\t\t\t{control.description && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.description,\n\t\t\t\t\t\tstyles.descriptionPlain,\n\t\t\t\t\t\tstyles.overlayInputTextOffsetLeft,\n\t\t\t\t\t\tstyles.descriptionSpacingAfter,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{control.description}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<RichTextEditorWithToolbarAndNodeViews\n\t\t\t\tschema={schema}\n\t\t\t\tdefaultValue={value}\n\t\t\t\tenabled={!isReadOnly}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tvariant=\"minimal\"\n\t\t\t\tscopeType={ScopeType.ContentManagement}\n\t\t\t\tonUnsavedChange={handleUnsavedChange}\n\t\t\t\tpopoverAttachmentEdge={popoverAttachmentEdge}\n\t\t\t\tinsertButtonPopoverOptions={insertButtonPopoverOptions}\n\t\t\t\tfallbackToModalAppearance\n\t\t\t\tsaveOnMetaArrowNavigation\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n})\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType, type VectorSetItemControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useId } from \"react\"\nimport {\n\tVectorSetItemPopoutButton,\n\tuseDefaultVectorSetIdentifier,\n} from \"../properties/codeComponentRows/VectorSetItemControlPropRow.tsx\"\nimport { collectionInputFontSize } from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { getUpdatedVectorSetItemControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\n\ninterface Props {\n\tcontrol: VectorSetItemControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n}\n\nfunction getValue(controlProp: ControlProp | undefined): ModuleExportIdentifierString | undefined {\n\tif (controlProp?.type !== ControlType.VectorSetItem) return\n\tif (isVariableReference(controlProp.value)) return\n\treturn controlProp.value\n}\n\nexport function LargeVectorSetItemInputRow({ control, controlProp, fieldId, itemId, onChange }: Props) {\n\tconst popoutId = useId()\n\n\tconst update = useCallback(\n\t\t(identifier: ModuleExportIdentifierString) => {\n\t\t\tonChange(getUpdatedVectorSetItemControlProp(identifier), fieldId, itemId)\n\t\t},\n\t\t[onChange, fieldId, itemId],\n\t)\n\n\tconst defaultIdentifier = useDefaultVectorSetIdentifier(control)\n\tif (!defaultIdentifier) return null\n\n\treturn (\n\t\t<LargePanelRow description={control.description} fieldId={fieldId} title={control.title ?? \"\"}>\n\t\t\t<VectorSetItemPopoutButton\n\t\t\t\tlarge={false}\n\t\t\t\tdisplayInPopover\n\t\t\t\tonChange={update}\n\t\t\t\tpopoutId={popoutId}\n\t\t\t\tidentifier={getValue(controlProp) ?? defaultIdentifier}\n\t\t\t\tdefaultIdentifier={defaultIdentifier}\n\t\t\t\tclassName={collectionInputFontSize}\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tpreviewWithoutBackground\n\t\t\t/>\n\t\t</LargePanelRow>\n\t)\n}\n", "import type { VariableDivider } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\n\nexport function LargeDividerRow({ divider }: { divider: VariableDivider }) {\n\treturn <LargePanelRow isDivider description={divider.description} fieldId={divider.id} title={divider.name} />\n}\n", "import { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { InputMessage, Stack, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, assertNever, schedulerYield, unhandledError } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { waitForLoadingComponentsWithTimeout } from \"code-generation/utils/waitForLoadingComponentsWithTimeout.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tCollectionItemNode,\n\tCollectionNode,\n\tNodeID,\n\tSmartComponentNode,\n\tWebPageNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport { isSmartComponentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type { SlugVariableDefinition, VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { LinkVariables } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { ControlProp, StringControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { getDefaultSlug } from \"editorbar/canvas/OnPageSlugRow.tsx\"\nimport { roundedNumber } from \"library/index.ts\"\nimport { ControlType, type StringControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport React, { useEffect, useMemo } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { updateLinks } from \"utils/updateLinks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport {\n\tcollectionInputFontSize,\n\tcollectionInputMessageHeight,\n\tcollectionInputPaddingInline,\n} from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport { SlugPreviewLink } from \"./SlugPreviewLink.tsx\"\nimport { getMessageFromWarning, getValidationWarningForField } from \"./utils/fieldValidationHelpers.ts\"\nimport { getUpdatedStringControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\nimport { updateSlugEffectedLinksAndEffects } from \"./utils/updatePageLinksWithSlug.ts\"\n\nfunction createSlugInputId(id: VariableID): string {\n\treturn `slug-input-${id}`\n}\n\nconst updateOutdatedPageLinks = engine.scheduler.wrapHandler(\n\t(collectionId: NodeID, collectionItemId: NodeID, slugKey: string, slug: string) => {\n\t\tupdateSlugEffectedLinksAndEffects(engine, collectionId, collectionItemId, slugKey, slug)\n\t},\n)\n\ninterface UseStoreSlugDefaultOnUnmountOrSelectionChange {\n\tcollectionItemId: NodeID\n\tslug: string\n\tdefaultSlug: string\n\tchangeHandler: (slug: string, final: boolean, reset: () => void) => void\n}\n\nfunction useStoreSlugDefaultOnUnmountOrSelectionChange({\n\tcollectionItemId,\n\tslug,\n\tdefaultSlug,\n\tchangeHandler,\n}: UseStoreSlugDefaultOnUnmountOrSelectionChange) {\n\tconst slugRef = React.useRef({ slug, defaultSlug, changeHandler })\n\tReact.useEffect(() => {\n\t\tslugRef.current = { slug, defaultSlug, changeHandler }\n\t}, [slug, defaultSlug, changeHandler])\n\n\tconst [initialCollectionItemId] = React.useState(collectionItemId)\n\tassert(collectionItemId === initialCollectionItemId, \"collectionItemId should never change\")\n\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\t// Unmount. Means the collection item is no longer visible in the overlay. Store slug\n\t\t\t// value if we don't have one yet.\n\t\t\tconst { slug: lastSlug, defaultSlug: lastDefaultSlug, changeHandler: lastChangeHandler } = slugRef.current\n\t\t\tif (lastSlug.length > 0) return\n\t\t\tif (lastDefaultSlug.length === 0) return\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tlastChangeHandler(lastDefaultSlug, true, noop)\n\t\t\t})\n\t\t}\n\t}, [])\n}\n\nfunction getCurrentValue(controlProp: ControlProp | undefined): string {\n\tif (controlProp?.type === ControlType.String && isString(controlProp.value)) {\n\t\treturn controlProp.value\n\t}\n\treturn \"\"\n}\n\ninterface Props {\n\tcollection: CollectionNode\n\tcollectionItem: CollectionItemNode\n\tcontrolProp: ControlProp | undefined\n\tcontrol: StringControlDescription\n\tfieldId: VariableID\n\tisPrivateDraftCollectionItem: boolean\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\tonKeyDown: (event: React.KeyboardEvent) => void\n\tvariable: SlugVariableDefinition\n\ttakenSlugs: ReadonlySet<string>\n\tbasedOnVariableValue: string | undefined\n}\n\nexport function LargeSlugInputRow({\n\tcollection,\n\tcollectionItem,\n\tcontrolProp,\n\tcontrol,\n\tfieldId,\n\tisPrivateDraftCollectionItem,\n\tonChange,\n\tonKeyDown,\n\tvariable,\n\ttakenSlugs,\n\tbasedOnVariableValue,\n}: Props) {\n\tconst ref = React.useRef<HTMLInputElement>(null)\n\tconst slug = getCurrentValue(controlProp)\n\tconst defaultSlug = getDefaultSlug(variable, collectionItem)\n\tconst { publishStatus } = engine.stores.publishStore.useState()\n\n\tconst [initialSlug] = React.useState(slug)\n\tconst [initialWarningMessage] = React.useState(() => {\n\t\tconst initialControlProp: StringControlProp = {\n\t\t\t...controlProp,\n\t\t\ttype: ControlType.String,\n\t\t\tvalue: slugify(initialSlug),\n\t\t}\n\n\t\treturn getMessageFromWarning(\n\t\t\tgetValidationWarningForField(\n\t\t\t\t\"slug\",\n\t\t\t\tcontrol,\n\t\t\t\tinitialControlProp,\n\t\t\t\tbasedOnVariableValue,\n\t\t\t\tundefined,\n\t\t\t\tfalse,\n\t\t\t\ttakenSlugs,\n\t\t\t),\n\t\t\tcontrol,\n\t\t)\n\t})\n\tconst [previousExternalSlug, setPreviousExternalSlug] = React.useState(slug)\n\tconst [editedSlug, setEditedSlug] = React.useState(slug)\n\tconst latestExternalSlug = React.useRef(slug)\n\n\tconst editedSlugWarningMessage = useMemo(() => {\n\t\tconst editedControlProp: StringControlProp = {\n\t\t\t...controlProp,\n\t\t\ttype: ControlType.String,\n\t\t\tvalue: slugify(editedSlug),\n\t\t}\n\n\t\treturn getMessageFromWarning(\n\t\t\tgetValidationWarningForField(\n\t\t\t\t\"slug\",\n\t\t\t\tcontrol,\n\t\t\t\teditedControlProp,\n\t\t\t\tbasedOnVariableValue,\n\t\t\t\tundefined,\n\t\t\t\tfalse,\n\t\t\t\ttakenSlugs,\n\t\t\t),\n\t\t\tcontrol,\n\t\t)\n\t}, [control, controlProp, editedSlug, basedOnVariableValue, takenSlugs])\n\n\tconst displayChangedSlugWarning =\n\t\tpublishStatus === PublishStatus.Published &&\n\t\tinitialSlug.length > 0 &&\n\t\tinitialSlug !== editedSlug &&\n\t\t!initialWarningMessage\n\n\t// (External) slug change, like undo / redo\n\tif (previousExternalSlug !== slug) {\n\t\tsetPreviousExternalSlug(slug)\n\t\tsetEditedSlug(slug)\n\t}\n\n\tuseEffect(() => {\n\t\tlatestExternalSlug.current = previousExternalSlug\n\t}, [previousExternalSlug])\n\n\tconst changeHandler = React.useCallback(\n\t\t(newValue: string, final: boolean, reset: () => void) => {\n\t\t\tconst newSlug = slugify(newValue)\n\t\t\tsetEditedSlug(newSlug)\n\n\t\t\tif (newSlug.length > 0 && takenSlugs.has(newSlug)) {\n\t\t\t\tif (final) {\n\t\t\t\t\tsetEditedSlug(latestExternalSlug.current)\n\t\t\t\t\treset()\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Allow private draft items to clear the slug value so the value can be auto-generated again.\n\t\t\tif (newSlug.length === 0 && !isPrivateDraftCollectionItem) {\n\t\t\t\tif (final) reset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!final && !isPrivateDraftCollectionItem) return\n\n\t\t\tfunction updateSlug() {\n\t\t\t\tonChange(getUpdatedStringControlProp(controlProp, newSlug), fieldId, collectionItem.id)\n\t\t\t}\n\n\t\t\t// If this is a private draft item, page links do not need updating yet.\n\t\t\tif (isPrivateDraftCollectionItem) {\n\t\t\t\tupdateSlug()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Only update page links and such if the new slug is actually different from the current slug.\n\t\t\tif (newValue === latestExternalSlug.current) return\n\n\t\t\tconst allSlugsResolvedAtRuntime = engine.tree.root.allSlugsResolvedAtRuntime\n\t\t\trecord(\"slug_update\", { allSlugsResolvedAtRuntime })\n\n\t\t\tconst { codeGenerationStore } = engine.stores\n\n\t\t\tif (allSlugsResolvedAtRuntime) {\n\t\t\t\tupdateSlug()\n\t\t\t\tcodeGenerationStore.updateComponent(collection.id).catch(unhandledError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfunction fullyLoadedTreeOperation() {\n\t\t\t\tupdateSlug()\n\t\t\t\tupdateOutdatedPageLinks(collection.id, collectionItem.id, fieldId, newSlug)\n\t\t\t\tcodeGenerationStore.updateComponent(collection.id).catch(unhandledError)\n\t\t\t\tcheckIfTreeWalkIsNeeded().catch(unhandledError)\n\t\t\t}\n\n\t\t\tif (engine.stores.treeStore.getDataTree()) {\n\t\t\t\tfullyLoadedTreeOperation()\n\t\t\t} else {\n\t\t\t\tengine.runWithFullyLoadedTree(fullyLoadedTreeOperation, {\n\t\t\t\t\tname: \"collection_item_slug_edit\",\n\t\t\t\t\tmodalTitle: \"Updating Outdated Links\",\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[collection.id, collectionItem.id, controlProp, fieldId, isPrivateDraftCollectionItem, onChange, takenSlugs],\n\t)\n\n\tuseStoreSlugDefaultOnUnmountOrSelectionChange({\n\t\tcollectionItemId: collectionItem.id,\n\t\tslug,\n\t\tdefaultSlug,\n\t\tchangeHandler,\n\t})\n\n\tconst associatedWebPageNode = engine.stores.scopeStore\n\t\t.getWebPageNodes()\n\t\t.find(node => node.dataIdentifier === collection.instanceIdentifier)\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={variable.name}\n\t\t\twarningMessage={editedSlugWarningMessage}\n\t\t>\n\t\t\t<Stack direction=\"column\" gap={0}>\n\t\t\t\t<TextInput\n\t\t\t\t\tref={ref}\n\t\t\t\t\tvalue={slug}\n\t\t\t\t\tconstantChange\n\t\t\t\t\tonChange={changeHandler}\n\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\tplaceholder={getPlaceholder(slug, defaultSlug)}\n\t\t\t\t\tclassName={cx(collectionInputFontSize, collectionInputPaddingInline)}\n\t\t\t\t\tid={createSlugInputId(variable.id)}\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t/>\n\t\t\t\t<Stack paddingLeft={dimensions.values.cmsOverlayInputTextOffsetInline} gap={0}>\n\t\t\t\t\t<SlugPreviewLink\n\t\t\t\t\t\tassociatedWebPageNode={associatedWebPageNode}\n\t\t\t\t\t\tclickable={!isPrivateDraftCollectionItem}\n\t\t\t\t\t\tcollectionNode={collection}\n\t\t\t\t\t\tslug={editedSlug || defaultSlug}\n\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t/>\n\t\t\t\t\t{displayChangedSlugWarning && (\n\t\t\t\t\t\t<InputMessage\n\t\t\t\t\t\t\ttype=\"warning\"\n\t\t\t\t\t\t\ttitle=\"Editing the URL can break external links to this page\"\n\t\t\t\t\t\t\tclassName={collectionInputMessageHeight}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</LargePanelRow>\n\t)\n}\n\nfunction getPlaceholder(slug: string, defaultSlug: string): string | undefined {\n\treturn slug ? Dictionary.Empty : defaultSlug || Dictionary.Empty\n}\n\nfunction webPageOrSmartComponentCompilationState(\n\tinstanceIdentifier: LocalModuleExportIdentifierString,\n): \"not-in-component-loader\" | \"outdated\" | \"resolves-slugs-at-runtime\" {\n\tconst component = engine.componentLoader.componentForIdentifier(instanceIdentifier)\n\tif (!component?.annotations) return \"not-in-component-loader\"\n\tconst resolvesSlugsAtRuntime = Boolean(component.annotations[AnnotationKey.FramerComponentViewportWidth])\n\tif (resolvesSlugsAtRuntime) return \"resolves-slugs-at-runtime\"\n\treturn \"outdated\"\n}\n\nfunction linkVariablesContainSlug(pathVariables: LinkVariables): boolean {\n\tfor (const key in pathVariables) {\n\t\tconst value = pathVariables[key]\n\t\tif (isResolvedCollectionItemSelector(value)) return true\n\t}\n\treturn false\n}\n\nfunction containsLinkWithSlug(tree: CanvasTree, node: CanvasNode): boolean {\n\tlet foundLinkWithSlug = false\n\n\t// We are using the `updateLinks` function to traverse the tree and find all links with slugs.\n\t// By returning `null` from the callback, we make sure not to actually update any links.\n\tupdateLinks(tree, node, link => {\n\t\tif (foundLinkWithSlug) return null\n\t\tif (!isLinkToWebPage(link)) return null\n\n\t\tif (link.pathVariables) {\n\t\t\tfoundLinkWithSlug = linkVariablesContainSlug(link.pathVariables)\n\t\t\tif (foundLinkWithSlug) return null\n\t\t}\n\n\t\tif (link.hashVariables) {\n\t\t\tfoundLinkWithSlug = linkVariablesContainSlug(link.hashVariables)\n\t\t\tif (foundLinkWithSlug) return null\n\t\t}\n\n\t\treturn null\n\t})\n\n\treturn foundLinkWithSlug\n}\n\nfunction subTreeContainsLinkWithSlug(tree: CanvasTree, node: WebPageNode | SmartComponentNode): boolean {\n\tfor (const child of node.walk()) {\n\t\t// Data sources can contain unresolved links with slugs, we we return true.\n\t\tif (hasCollectionDataSource(child)) return true\n\t\tif (containsLinkWithSlug(tree, child)) return true\n\t}\n\treturn false\n}\n\nasync function checkIfTreeWalkIsNeeded() {\n\tif (!engine.stores.treeStore.getDataTree()) {\n\t\tassert(!engine.tree.getService(\"loader\"), \"Tree should be fully loaded\")\n\t}\n\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\n\tconst allWebPageAndSmartComponentInstanceIdentifiers: Set<LocalModuleExportIdentifierString> = new Set()\n\n\tfor (const node of tree.root.children) {\n\t\tif (isWebPageNode(node) || isSmartComponentNode(node)) {\n\t\t\tallWebPageAndSmartComponentInstanceIdentifiers.add(node.instanceIdentifier)\n\t\t}\n\t}\n\n\ttry {\n\t\t// Make sure all the web page and smart component modules are loaded.\n\t\tawait waitForLoadingComponentsWithTimeout(\n\t\t\tengine.componentLoader,\n\t\t\tArray.from(allWebPageAndSmartComponentInstanceIdentifiers),\n\t\t\tengine.stores.modulesStore,\n\t\t)\n\t} catch {\n\t\t// Ignore errors, we still want to track the totals.\n\t}\n\n\tlet totalWebPageAndSmartComponentCount = 0\n\tlet totalWebPageAndSmartComponentResolvingSlugAtRuntimeCount = 0\n\tlet notLoadedWebPageAndSmartComponentCount = 0\n\tlet totalOutdatedWebPageAndSmartComponentContainingSlugCount = 0\n\n\tfor (const node of tree.root.children) {\n\t\tif (!isWebPageNode(node) && !isSmartComponentNode(node)) continue\n\n\t\t// Newly added nodes will always be compatible.\n\t\tif (!allWebPageAndSmartComponentInstanceIdentifiers.has(node.instanceIdentifier)) continue\n\n\t\ttotalWebPageAndSmartComponentCount++\n\t\tconst state = webPageOrSmartComponentCompilationState(node.instanceIdentifier)\n\t\tif (state === \"not-in-component-loader\") {\n\t\t\tnotLoadedWebPageAndSmartComponentCount++\n\t\t} else if (state === \"resolves-slugs-at-runtime\") {\n\t\t\ttotalWebPageAndSmartComponentResolvingSlugAtRuntimeCount++\n\t\t} else if (state === \"outdated\") {\n\t\t\tassert(node.isLoaded(), \"Expected node to be loaded or be a data tree node\")\n\t\t\tif (subTreeContainsLinkWithSlug(tree, node)) {\n\t\t\t\ttotalOutdatedWebPageAndSmartComponentContainingSlugCount++\n\t\t\t}\n\t\t\tawait schedulerYield()\n\t\t} else {\n\t\t\tassertNever(state)\n\t\t}\n\t}\n\n\tconst total = totalWebPageAndSmartComponentCount\n\tconst totalAtRisk = notLoadedWebPageAndSmartComponentCount + totalOutdatedWebPageAndSmartComponentContainingSlugCount\n\tconst riskRatio = roundedNumber(totalAtRisk / (total || 1), 3)\n\n\trecord(\"slug_tree_walk\", {\n\t\ttotal,\n\t\ttotalAtRisk,\n\t\triskRatio,\n\t\ttotalResolvingSlugAtRuntime: totalWebPageAndSmartComponentResolvingSlugAtRuntimeCount,\n\t\ttotalNotLoaded: notLoadedWebPageAndSmartComponentCount,\n\t\ttotalOutdatedContainingSlug: totalOutdatedWebPageAndSmartComponentContainingSlugCount,\n\t})\n\n\tif (totalAtRisk === 0 && !tree.root.allSlugsResolvedAtRuntime) {\n\t\tengine.scheduler.scheduleDocumentUpdateIgnoringUndo(() => {\n\t\t\tengine.stores.treeStore.getDataTreeOrLoadedTree().root.set({ allSlugsResolvedAtRuntime: true })\n\t\t})\n\t}\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { withStyleAppearPageEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { withStyleTransformEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport { withVariantAppearPageEffect } from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\n\nexport function updateEffectCollectionItems(\n\tnode: CanvasNode,\n\tupdateCollectionItem: (collectionItem: ResolvedCollectionItemSelector) => ResolvedCollectionItemSelector | null,\n): void {\n\tif (\n\t\twithStyleAppearPageEffect(node) &&\n\t\tisResolvedCollectionItemSelector(node.styleAppearEffectScrollTargetCollectionItem)\n\t) {\n\t\tconst update = updateCollectionItem(node.styleAppearEffectScrollTargetCollectionItem)\n\t\tif (update) node.set({ styleAppearEffectScrollTargetCollectionItem: update })\n\t}\n\n\tif (withVariantAppearPageEffect(node) && node.appearEffectScrollTargets) {\n\t\tlet shouldUpdate = false\n\t\tconst appearEffectScrollTargets = node.appearEffectScrollTargets.map(effectTarget => {\n\t\t\tif (isResolvedCollectionItemSelector(effectTarget.collectionItem)) {\n\t\t\t\tconst collectionItem = updateCollectionItem(effectTarget.collectionItem)\n\t\t\t\tif (!collectionItem) return effectTarget\n\n\t\t\t\tshouldUpdate = true\n\n\t\t\t\treturn {\n\t\t\t\t\t...effectTarget,\n\t\t\t\t\tcollectionItem,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn effectTarget\n\t\t})\n\t\tif (shouldUpdate) node.set({ appearEffectScrollTargets })\n\t}\n\n\tif (withStyleTransformEffect(node) && node.styleTransformEffectScrollTargets) {\n\t\tlet shouldUpdate = false\n\n\t\tconst styleTransformEffectScrollTargets = node.styleTransformEffectScrollTargets.map(effectTarget => {\n\t\t\tif (isResolvedCollectionItemSelector(effectTarget.collectionItem)) {\n\t\t\t\tconst collectionItem = updateCollectionItem(effectTarget.collectionItem)\n\t\t\t\tif (!collectionItem) return effectTarget\n\n\t\t\t\tshouldUpdate = true\n\n\t\t\t\treturn {\n\t\t\t\t\t...effectTarget,\n\t\t\t\t\tcollectionItem,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn effectTarget\n\t\t})\n\t\tif (shouldUpdate) node.set({ styleTransformEffectScrollTargets })\n\t}\n}\n", "import { assert, ModuleType, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { LinkVariables } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { updateLinks } from \"utils/updateLinks.ts\"\nimport { updateEffectCollectionItems } from \"./updateEffectsWithSlug.ts\"\n\nfunction createLinkVariableUpdates(\n\tvariables: LinkVariables | undefined,\n\tcollectionId: NodeID,\n\tcollectionItemId: NodeID,\n\tslugKey: string,\n\tslug: string,\n) {\n\tconst updatedVariables: LinkVariables = { ...variables }\n\tlet hasUpdate = false\n\n\t// Iterate through all of the link variables. Any one could be a\n\t// resolved collection item selector that may need its resolved\n\t// value updated.\n\tfor (const key in variables) {\n\t\tconst variableValue = variables[key]\n\t\tif (!variableValue || isVariableReference(variableValue)) continue\n\n\t\tconst moduleIdentifier = parseModuleIdentifier(variableValue.identifier)\n\n\t\tif (\n\t\t\tmoduleIdentifier?.kind !== \"localModuleExport\" ||\n\t\t\tmoduleIdentifier.type !== ModuleType.Collection ||\n\t\t\tmoduleIdentifier.localIdName !== collectionId\n\t\t) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (variableValue.collectionItemId !== collectionItemId) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (variableValue.key !== slugKey) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst resolvedCollectionItem: ResolvedCollectionItemSelector = {\n\t\t\tidentifier: variableValue.identifier,\n\t\t\tcollectionItemId: variableValue.collectionItemId,\n\t\t\tkey: slugKey,\n\t\t\tvalue: slug,\n\t\t}\n\t\thasUpdate = true\n\t\tupdatedVariables[key] = resolvedCollectionItem\n\t}\n\n\tif (!hasUpdate) return undefined\n\n\treturn updatedVariables\n}\n\n/**\n * @FIXME - Rename this file to `updateSlugEffectedLinksAndEffects`.\n */\nexport const updateSlugEffectedLinksAndEffects = (\n\tengine: VekterEngine,\n\tcollectionId: NodeID,\n\tcollectionItemId: NodeID,\n\tslugKey: string,\n\tslug: string,\n) => {\n\tif (!engine.stores.treeStore.getDataTree()) {\n\t\tassert(!engine.tree.getService(\"loader\"), \"Tree should be fully loaded\")\n\t}\n\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\tfor (const node of tree.root.walk()) {\n\t\tupdateLinks(tree, node, link => {\n\t\t\t// If the link doesn't have variables, it cannot need its resolved\n\t\t\t// collection item selector slug value updated.\n\t\t\tif (!isLinkToWebPage(link)) return null\n\n\t\t\tconst updatedPathVariables = createLinkVariableUpdates(\n\t\t\t\tlink.pathVariables,\n\t\t\t\tcollectionId,\n\t\t\t\tcollectionItemId,\n\t\t\t\tslugKey,\n\t\t\t\tslug,\n\t\t\t)\n\n\t\t\tconst updatedHashVariables = createLinkVariableUpdates(\n\t\t\t\tlink.hashVariables,\n\t\t\t\tcollectionId,\n\t\t\t\tcollectionItemId,\n\t\t\t\tslugKey,\n\t\t\t\tslug,\n\t\t\t)\n\n\t\t\tif (!updatedHashVariables && !updatedPathVariables) return null\n\n\t\t\treturn createLink({\n\t\t\t\twebPageId: link.webPageId,\n\t\t\t\thash: link.hash,\n\t\t\t\tpathVariables: updatedPathVariables,\n\t\t\t\thashVariables: updatedHashVariables,\n\t\t\t})\n\t\t})\n\n\t\tupdateEffectCollectionItems(node, scrollTargetCollectionItem => {\n\t\t\tconst moduleIdentifier = parseModuleIdentifier(scrollTargetCollectionItem.identifier)\n\t\t\tif (\n\t\t\t\tmoduleIdentifier?.kind !== \"localModuleExport\" ||\n\t\t\t\tmoduleIdentifier.type !== ModuleType.Collection ||\n\t\t\t\tmoduleIdentifier.localIdName !== collectionId\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tscrollTargetCollectionItem.collectionItemId !== collectionItemId ||\n\t\t\t\tscrollTargetCollectionItem.key !== slugKey\n\t\t\t) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...scrollTargetCollectionItem,\n\t\t\t\tvalue: slug,\n\t\t\t}\n\t\t})\n\t}\n}\n", "import { Button, Stack, TextArea, TextInput, useReadOnly, type InputVariant } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { StringVariableDefinition, VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp, StringControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { StringControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useMemo } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { collectionInputFontSize, collectionInputPaddingInline } from \"./LargePanelRow.styles.ts\"\nimport { LargePanelRow } from \"./LargePanelRow.tsx\"\nimport * as styles from \"./LargeStringInputRow.styles.ts\"\nimport { getMessageFromWarning, getValidationWarningForField } from \"./utils/fieldValidationHelpers.ts\"\nimport { getUpdatedStringControlProp } from \"./utils/getUpdatedFieldControlProp.ts\"\n\ninterface Props {\n\tbasedOnVariableValue: string | undefined\n\tconstantChange: boolean\n\tcontrol: StringControlDescription\n\tcontrolProp: ControlProp | undefined\n\tfallbackValueType: StringVariableDefinition[\"fallbackValue\"] | undefined\n\tfieldId: VariableID\n\titemId: NodeID\n\tonChange: (value: ControlProp, fieldId: VariableID, id: NodeID) => void\n\tonKeyDown: (event: React.KeyboardEvent) => void\n\trequired: boolean\n\treset: (prop: string, id: NodeID) => void\n}\n\nexport const LargeStringInputRow = React.memo(function LargeStringInputRow({\n\tbasedOnVariableValue,\n\tconstantChange,\n\tcontrol,\n\tcontrolProp,\n\tfallbackValueType,\n\tfieldId,\n\titemId,\n\tonChange,\n\tonKeyDown,\n\trequired,\n\treset,\n}: Props) {\n\tconst isReadOnly = useReadOnly()\n\tconst inputVariant: InputVariant = \"ghost\"\n\n\tassert(!controlProp || !isDynamicValue(controlProp.value), \"Dynamic values are not supported within the CMS.\")\n\tconst controlPropValue = controlProp && isString(controlProp.value) ? controlProp.value : undefined\n\tconst isBasedOnVariableField = fallbackValueType === \"associatedVariable\"\n\t// Based-on fields treat the associated value as a placeholder, resolved during save. Keep the local value empty so clearing the override does not fall back to the control default.\n\tconst fallbackValue = isBasedOnVariableField ? \"\" : (control.defaultValue ?? \"\")\n\tconst value = controlPropValue ?? fallbackValue\n\tconst [previousExternalValue, setPreviousExternalValue] = React.useState<string>(value)\n\tconst [unsavedValue, setUnsavedValue] = React.useState<string>(value)\n\tconst editedControlProp = useMemo((): StringControlProp => {\n\t\treturn { ...controlProp, type: ControlType.String, value: unsavedValue }\n\t}, [unsavedValue, controlProp])\n\tconst validationControlProp =\n\t\tisBasedOnVariableField && !controlProp && unsavedValue === \"\" ? undefined : editedControlProp\n\n\tconst errorMessage = useMemo(() => {\n\t\tconst warning = getValidationWarningForField(\n\t\t\tControlType.String,\n\t\t\tcontrol,\n\t\t\tvalidationControlProp,\n\t\t\tbasedOnVariableValue,\n\t\t\tfallbackValueType,\n\t\t\trequired,\n\t\t\tundefined,\n\t\t)\n\n\t\treturn getMessageFromWarning(warning, control)\n\t}, [control, validationControlProp, basedOnVariableValue, fallbackValueType, required])\n\n\tconst placeholder = getPlaceholder(controlPropValue, basedOnVariableValue, isBasedOnVariableField, control)\n\n\tif (previousExternalValue !== value) {\n\t\tsetPreviousExternalValue(value)\n\t\tsetUnsavedValue(value)\n\t}\n\n\tconst resetHandler = () => {\n\t\treset(fieldId, itemId)\n\t\tsetUnsavedValue(fallbackValue)\n\t}\n\n\tconst changeHandler = (newValue: string, final: boolean) => {\n\t\tif (newValue.length === 0 && isBasedOnVariableField) {\n\t\t\tresetHandler()\n\t\t\treturn\n\t\t}\n\n\t\tsetUnsavedValue(newValue)\n\n\t\tif (constantChange || final) {\n\t\t\tonChange(getUpdatedStringControlProp(controlProp, newValue), fieldId, itemId)\n\t\t}\n\t}\n\n\tconst onBlurHandler = () => {\n\t\tif (unsavedValue.length === 0 && fallbackValue.length && required) {\n\t\t\tchangeHandler(fallbackValue, true)\n\t\t}\n\t}\n\n\treturn (\n\t\t<LargePanelRow\n\t\t\tdescription={control.description}\n\t\t\tfieldId={fieldId}\n\t\t\ttitle={control.title ?? \"\"}\n\t\t\twarningMessage={errorMessage}\n\t\t>\n\t\t\t<Stack direction=\"row\">\n\t\t\t\t{control.displayTextArea ? (\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tvariant={inputVariant}\n\t\t\t\t\t\tautoResize={inputVariant === \"ghost\"}\n\t\t\t\t\t\tkey={itemId} // Makes text areas resize to fit content on selection change\n\t\t\t\t\t\tvalue={unsavedValue}\n\t\t\t\t\t\tonBlur={onBlurHandler}\n\t\t\t\t\t\tonChange={changeHandler}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tminRows={inputVariant === \"ghost\" ? 1 : 10}\n\t\t\t\t\t\tmaxRows={30}\n\t\t\t\t\t\tclassName={cx(styles.textArea, styles.textAreaGhost)}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvariant={inputVariant}\n\t\t\t\t\t\ttype={control.obscured ? \"password\" : \"text\"}\n\t\t\t\t\t\tspellCheck={!control.obscured}\n\t\t\t\t\t\tvalue={unsavedValue}\n\t\t\t\t\t\tonBlur={onBlurHandler}\n\t\t\t\t\t\tonChange={changeHandler}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tclassName={cx(collectionInputFontSize, collectionInputPaddingInline)}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{isBasedOnVariableField && (\n\t\t\t\t\t<Button title={Dictionary.Reset} enabled={isString(controlPropValue) && !isReadOnly} onClick={resetHandler} />\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</LargePanelRow>\n\t)\n})\n\nfunction getPlaceholder(\n\tcontrolPropValue: string | undefined,\n\tbasedOnVariableValue: string | undefined,\n\tisBasedOnVariableField: boolean,\n\tcontrol: StringControlDescription,\n): string | undefined {\n\tif (isBasedOnVariableField) {\n\t\t// An empty string overrides the based-on value, so we use the empty string as the placeholder.\n\t\tif (isString(controlPropValue)) return Dictionary.Empty\n\t\treturn basedOnVariableValue || Dictionary.Empty\n\t}\n\n\treturn control.placeholder || Dictionary.Empty\n}\n", "import { CenterChild, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { PluginIcon } from \"plugins/PluginIcon.tsx\"\nimport { getPluginIcon } from \"plugins/plugins.ts\"\nimport { useEffect, useState } from \"react\"\nimport { entries } from \"utils/entries.ts\"\nimport * as styles from \"./ManagedCollectionItemHeader.styles.ts\"\n\ninterface Props {\n\tcollection: CollectionNode\n\tcollectionItem: CollectionItemNode\n}\n\nexport function ManagedCollectionItemHeader({ collection, collectionItem }: Props) {\n\tconst pluginManifest = engine.stores.pluginStore.useState(state => {\n\t\tif (!collection.managedByPlugin) return null\n\t\treturn state.manifestById.get(collection.managedByPlugin)\n\t})\n\n\tif (!pluginManifest) return null\n\n\treturn (\n\t\t<Stack direction=\"row\" className={styles.header}>\n\t\t\t<Stack direction=\"row\" className={styles.titleWrapper} gap=\"10px\">\n\t\t\t\t<CenterChild className={cx(styles.pluginIconWrapper, styles.pluginIconWrapperInset)}>\n\t\t\t\t\t<PluginIcon src={getPluginIcon(pluginManifest)} size=\"small\" />\n\t\t\t\t</CenterChild>\n\t\t\t\t<span className={cx(styles.title, truncateWithEllipsis)}>Synced via {pluginManifest.name}</span>\n\t\t\t</Stack>\n\t\t\t{collectionItem.updatedAtByPlugin && (\n\t\t\t\t<span className={styles.date}>\n\t\t\t\t\t<RelativeTime timestamp={collectionItem.updatedAtByPlugin} />\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction RelativeTime({ timestamp }: { timestamp: string }) {\n\tconst [time, setTime] = useState(() => getRelativeTime(timestamp))\n\n\tuseEffect(() => {\n\t\tconst tenSeconds = 10 * 1000\n\n\t\tconst interval = setInterval(() => {\n\t\t\tsetTime(getRelativeTime(timestamp))\n\t\t}, tenSeconds)\n\n\t\treturn () => clearInterval(interval)\n\t}, [timestamp])\n\n\treturn time\n}\n\nconst units = {\n\tyear: 31536000,\n\tmonth: 2592000,\n\tday: 86400,\n\thour: 3600,\n\tminute: 60,\n\tsecond: 1,\n} as const\n\nconst timeFormatter = new Intl.RelativeTimeFormat(\"en\", { numeric: \"auto\" })\n\nfunction getRelativeTimeString(seconds: number): string {\n\tfor (const [unit, secondsInUnit] of entries(units)) {\n\t\tif (Math.abs(seconds) >= secondsInUnit || unit === \"second\") {\n\t\t\tconst value = Math.round(seconds / secondsInUnit)\n\t\t\treturn timeFormatter.format(value * -1, unit)\n\t\t}\n\t}\n\n\tthrow Error(\"No relative time found, should not be possible\")\n}\n\nfunction getRelativeTime(timestamp: string): string {\n\tconst updatedAt = new Date(timestamp)\n\tconst now = new Date()\n\tconst diffInSeconds = (now.getTime() - updatedAt.getTime()) / 1000\n\n\tif (diffInSeconds < 60) return \"less than a minute ago\"\n\n\treturn getRelativeTimeString(diffInSeconds)\n}\n", "import \"ManagedCollectionItemHeader.styles_1gf57df.wyw.css\"; export const header = \"header_h4mri16\";\nexport const pluginIconWrapper = \"pluginIconWrapper_p1eapqr1\";\nexport const pluginIconWrapperInset = \"pluginIconWrapperInset_p1qr5d06\";\nexport const title = \"title_t10ufauj\";\nexport const date = \"date_d1251ddm\";\nexport const titleWrapper = \"titleWrapper_t1jde4j\";", "import { ThemeOverride, type ThemeOverrideMode } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type React from \"react\"\n\nfunction useRevampedCmsPopoutThemeOverrideMode(): ThemeOverrideMode | undefined {\n\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tif (!agentExperimentOn) {\n\t\treturn \"darkOnDarkPopoutWindow\"\n\t}\n\n\treturn undefined\n}\n\nexport function RevampedCmsPopoutThemeOverride({ children }: React.PropsWithChildren) {\n\tconst mode = useRevampedCmsPopoutThemeOverrideMode()\n\treturn <ThemeOverride mode={mode}>{children}</ThemeOverride>\n}\n", "import engine from \"document/engine.ts\"\nimport type { CollectionItemNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionPropertyControls } from \"document/models/CanvasTree/nodes/CollectionNodeCache.ts\"\nimport type { VariablesAndDividers } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport React from \"react\"\nimport { isShallowSetEqual } from \"utils/isShallowEqual.ts\"\nimport type { TakenSlugs } from \"../useTakenSlugs.ts\"\nimport { fieldHasValidationError } from \"./fieldValidationHelpers.ts\"\n\nfunction createSet() {\n\treturn new Set<string>()\n}\n\nexport function useInvalidFieldIds(\n\tcollectionItem: CollectionItemNode,\n\tvariables: VariablesAndDividers,\n\tpropertyControls: CollectionPropertyControls,\n\ttakenSlugs: TakenSlugs,\n): Set<string> {\n\tconst [invalidFieldIds, setInvalidFieldIds] = React.useState<Set<string>>(createSet)\n\tconst latestInvalidFieldIds = getInvalidFieldIds(collectionItem, variables, propertyControls, takenSlugs)\n\n\tif (!isShallowSetEqual(invalidFieldIds, latestInvalidFieldIds)) {\n\t\tsetInvalidFieldIds(latestInvalidFieldIds)\n\t}\n\n\treturn invalidFieldIds\n}\n\nfunction getInvalidFieldIds(\n\tcollectionItem: CollectionItemNode,\n\tvariables: VariablesAndDividers,\n\tpropertyControls: CollectionPropertyControls,\n\ttakenSlugs: TakenSlugs,\n): Set<string> {\n\tconst ids = new Set<string>()\n\tfor (const variable of variables) {\n\t\tif (variable.type === \"divider\") continue\n\n\t\tconst control = propertyControls[variable.id]\n\t\tif (!control) continue\n\n\t\tconst hasError = fieldHasValidationError(engine.tree, collectionItem, variable, variables, control, takenSlugs)\n\t\tif (!hasError) continue\n\n\t\tids.add(variable.id)\n\t}\n\treturn ids\n}\n", "import { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getActiveCollectionNode } from \"document/components/utils/collectionItemUtils.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { useEffect } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./CollectionItemTable.styles.ts\"\nimport { NoCollectionsEmptyState } from \"./NoCollectionsEmptyState.tsx\"\nimport { VirtualCollectionItemTable } from \"./VirtualCollectionItemTable.tsx\"\n\nfunction useCollectionNode(): CollectionNode | null {\n\tconst { scopeStore, selectionStore } = engine.stores\n\treturn useDeprecatedEngineState([scopeStore, selectionStore, EngineChange.Tree], () =>\n\t\tgetActiveCollectionNode(engine.stores),\n\t)\n}\n\nexport function CollectionItemsTable() {\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\tconst contentManagementContentIsVisible = engine.stores.chromeStore.useState(\n\t\tstate => state.mainView === ActiveMainView.ContentManagement,\n\t)\n\n\tconst contentManagementNode = useEngineState(\n\t\t() => getContentManagementNode(engine.tree)?.loaded,\n\t\t[],\n\t\tEngineChange.Tree,\n\t)\n\n\tuseEffect(() => {\n\t\tif (engine.isRemountingUI()) return\n\t\tif (!contentManagementContentIsVisible) return\n\t\trecord(\"ui_impression\", { page: \"collection_items_table\" })\n\t}, [contentManagementContentIsVisible])\n\n\tconst collectionNode = useCollectionNode()\n\n\tif (!contentManagementContentIsVisible) return null\n\n\tif (!collectionNode) {\n\t\tif (!contentManagementNode || contentManagementNode.children.length > 0) return null\n\t\treturn (\n\t\t\t<div className={styles.container}>\n\t\t\t\t<div className={styles.noCollectionEmptyStateContainer}>\n\t\t\t\t\t<NoCollectionsEmptyState type=\"noCollection\" secondaryActions={agentEnabled} />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn <VirtualCollectionItemTable key={collectionNode.id} collectionNode={collectionNode} />\n}\n", "import \"CollectionItemTable.styles_2qh00.wyw.css\"; export const container = \"container_czg2pif\";\nexport const noCollectionEmptyStateContainer = \"noCollectionEmptyStateContainer_ny34wr4\";", "import \"NoCollectionsEmptyState.styles_tomedi.wyw.css\"; export const button = \"button_bzl7mhf\";\nexport const buttonPrimary = \"buttonPrimary_b82cmc0\";", "import { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getLoadedWebPageTemplate } from \"document/components/utils/createWebPage.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { valueToPath } from \"document/components/utils/valueToPath.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { ActiveLeftPanel } from \"document/utils/ActiveEditorType.ts\"\nimport { createCollectionDetailPage, createCollectionIndexPage } from \"document/utils/contentCreationTemplates.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { createSampleCollection, loadSampleCollectionDependencies } from \"./createSampleCollection.ts\"\n\nexport const defaultBlogSampleCollectionPath = valueToPath(\"blog\")\n\nconst sampleToastKey = \"loading-sample-data\"\n\nfunction stopLoading(engine: VekterEngine) {\n\ttoast({ type: \"remove\", key: sampleToastKey })\n\tengine.stores.contentManagementStore.isLoadingSampleData = false\n}\n\nexport function createSampleCollectionWithPages(\n\tengine: VekterEngine,\n\tsource: string,\n\tisWireframerKitPage: boolean = false,\n) {\n\tengine.beginUndoGroup()\n\n\tengine.stores.contentManagementStore.isLoadingSampleData = true\n\n\tconst initialLoading: Promise<unknown>[] = [loadSampleCollectionDependencies(engine)]\n\n\tconst contentManagementNode = getContentManagementNode(engine.tree)\n\tif (contentManagementNode) {\n\t\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\t\tassert(contentManagementNode.isLoaded(), \"Content management node should be fully loaded\")\n\t}\n\n\tconst hasNoCollections = contentManagementNode ? contentManagementNode.loaded.children.length === 0 : true\n\n\t// Make sure loading the dependencies takes at least one second, unless we already have some collections\n\tif (hasNoCollections) {\n\t\tconst waitOneSecond = new Promise(resolve => {\n\t\t\tsetTimeout(resolve, 1000)\n\t\t})\n\t\tinitialLoading.push(waitOneSecond)\n\t}\n\n\tif (engine.stores.chromeStore.leftPanel !== ActiveLeftPanel.ContentManagement) {\n\t\t// We only display the toast when the empty state spinner isn't visible\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey: sampleToastKey,\n\t\t\tvariant: \"progress\",\n\t\t\tprimaryText: \"Adding sample content\",\n\t\t\tsecondaryText: \"to CMS\u2026\",\n\t\t\ticon: \"notifications\",\n\t\t\tduration: Infinity,\n\t\t\tpermanent: true,\n\t\t})\n\t}\n\n\tPromise.all(initialLoading)\n\t\t.then(async () => {\n\t\t\t// Make sure that the sample collection module has been generated before creating the sample pages\n\t\t\tconst collection = await createSampleCollection(engine, { source })\n\t\t\tstopLoading(engine)\n\t\t\treturn collection\n\t\t})\n\t\t.then(async collection => {\n\t\t\tconst loadedTemplate = await getLoadedWebPageTemplate(engine)\n\n\t\t\tconst dataIdentifier = collection.instanceIdentifier\n\n\t\t\tconst contentManagementActive = engine.stores.scopeStore.active.id === CONTENT_MANAGEMENT_ID\n\n\t\t\tconst slugId = collection.getSlugVariable()?.id\n\t\t\tassert(slugId, \"Slug must exist\")\n\n\t\t\tconst collectionName = collection.name ?? Dictionary.Unknown\n\n\t\t\tconst noExistingBlogPage = engine.stores.scopeStore.getWebPageNodes().every(webPage => {\n\t\t\t\tconst pagePath = getRawWebPagePath(engine.tree, webPage)\n\t\t\t\treturn pagePath !== defaultBlogSampleCollectionPath\n\t\t\t})\n\n\t\t\t// Only create sample pages if they don't exist yet\n\t\t\tif (noExistingBlogPage) {\n\t\t\t\tconst blogDetailPage = await createCollectionDetailPage({\n\t\t\t\t\tengine,\n\t\t\t\t\tslugId,\n\t\t\t\t\tidentifier: dataIdentifier,\n\t\t\t\t\tproperties: collection.getPropertyControlsIncludingAutoGenerated(engine.tree, engine.componentLoader),\n\t\t\t\t\tpreferredName: `${collectionName} Detail`,\n\t\t\t\t\tpath: defaultBlogSampleCollectionPath,\n\t\t\t\t\tstartEditingPageTitle: false,\n\t\t\t\t\tisForSample: true,\n\t\t\t\t\tisWireframerKitPage,\n\t\t\t\t})\n\n\t\t\t\tconst blogPage = await engine.scheduler.processWhenReadyAsync(() =>\n\t\t\t\t\tcreateCollectionIndexPage({\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tidentifier: dataIdentifier,\n\t\t\t\t\t\tslugId,\n\t\t\t\t\t\tproperties: collection.getPropertyControlsIncludingAutoGenerated(engine.tree, engine.componentLoader),\n\t\t\t\t\t\tpreferredName: \"Blog\",\n\t\t\t\t\t\tpath: defaultBlogSampleCollectionPath,\n\t\t\t\t\t\tdetailPageId: blogDetailPage.id,\n\t\t\t\t\t\tisForSample: true,\n\t\t\t\t\t\tloadedTemplate,\n\t\t\t\t\t\tisWireframerKitPage,\n\t\t\t\t\t}),\n\t\t\t\t)\n\n\t\t\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\t\t\t// Move overview before detail page\n\t\t\t\t\tconst parent = engine.tree.get(blogPage.parentid)\n\t\t\t\t\tassert(parent)\n\t\t\t\t\tassert(parent.children)\n\t\t\t\t\tengine.moveNode(blogPage.id, parent.id, parent.children.length - 2)\n\n\t\t\t\t\t// Inform user about sample pages\n\t\t\t\t\tengine.stores.contentManagementStore.didAddSampleDataPages(contentManagementActive)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// Creating web pages automatically makes them visible, if the user is stil in the CMS we don't want that\n\t\t\tif (contentManagementActive) {\n\t\t\t\tengine.stores.scopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\t}\n\t\t})\n\t\t.finally(() => {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.endUndoGroup()\n\t\t\t\tstopLoading(engine)\n\t\t\t})\n\t\t})\n\t\t.catch(unhandledError)\n}\n", "import { Button, EmptyState, Spinner } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport * as styles from \"./NoCollectionsEmptyState.styles.ts\"\nimport { createSampleCollectionWithPages } from \"./utils/createSampleCollectionWithPages.ts\"\n\nconst handleCreateSampleCollection = engine.scheduler.wrapHandler(() => {\n\tcreateSampleCollectionWithPages(engine, \"collection_panel_empty_state\")\n})\n\ntype NoCollectionsEmptyStateType = \"noCollection\" | \"noCollectionFields\"\n\ninterface NoCollectionsEmptyStateProps {\n\ttype: NoCollectionsEmptyStateType\n\tsecondaryActions?: boolean\n}\n\nexport function NoCollectionsEmptyState({ type, secondaryActions = false }: NoCollectionsEmptyStateProps) {\n\tif (type === \"noCollectionFields\") {\n\t\treturn (\n\t\t\t<EmptyState\n\t\t\t\tcenter\n\t\t\t\ticonLarge\n\t\t\t\tfullWidthButton={false}\n\t\t\t\ttitle={Dictionary.Collections}\n\t\t\t\tbody={\n\t\t\t\t\t<>\n\t\t\t\t\t\tContent fields can be\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\tused on detail pages\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<EmptyState\n\t\t\tcenter\n\t\t\ticonLarge\n\t\t\tfullWidthButton={false}\n\t\t\tbutton={<AddBlogButton secondary={secondaryActions} />}\n\t\t\tsecondaryButton={<PluginsButton />}\n\t\t\ttitle={Dictionary.Collections}\n\t\t\tbody={\n\t\t\t\t<>\n\t\t\t\t\tThis project doesn\u2019t have\n\t\t\t\t\t<br />\n\t\t\t\t\tany CMS collections yet.\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t)\n}\n\nfunction AddBlogButton({ secondary }: { secondary: boolean }) {\n\tconst { isLoadingSampleData } = engine.stores.contentManagementStore.useState()\n\tconst isViewOnly = useIsViewOnly(\"canAddCollections\")\n\n\treturn (\n\t\t<Button\n\t\t\tclassName={cx(styles.button, !secondary && styles.buttonPrimary)}\n\t\t\tvariant={secondary ? \"default\" : \"withDepthPrimary\"}\n\t\t\tonClick={handleCreateSampleCollection}\n\t\t\tenabled={!isLoadingSampleData && !isViewOnly}\n\t\t\tbold={secondary}\n\t\t>\n\t\t\t{isLoadingSampleData ? <Spinner /> : \"Add Sample\"}\n\t\t</Button>\n\t)\n}\n\nconst showManagedCollectionPlugins = engine.scheduler.wrapHandler(() => {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.QuickActions,\n\t\tsource: \"collections_sidebar\",\n\t\tinitialCategory: { type: QuickActionsCategoryType.ManagedCollectionPlugins },\n\t})\n})\n\nfunction PluginsButton() {\n\tconst { isLoadingSampleData } = engine.stores.contentManagementStore.useState()\n\tconst isViewOnly = useIsViewOnly(\"canAddCollections\")\n\n\treturn (\n\t\t<Button\n\t\t\tclassName={styles.button}\n\t\t\tvariant=\"default\"\n\t\t\tonClick={showManagedCollectionPlugins}\n\t\t\tenabled={!isLoadingSampleData && !isViewOnly}\n\t\t\tbold\n\t\t>\n\t\t\tImport\n\t\t</Button>\n\t)\n}\n", "import {\n\tCheckBox,\n\tStack,\n\tVirtualTable,\n\ttype VirtualTableCellPosition,\n\ttype VirtualTableRef,\n\ttype VirtualTableRenderColumnHeaderOptions,\n\ttype VirtualTableRenderOverlayLayerOptions,\n\ttype VirtualTableRenderRowHeaderOptions,\n\tuseMergeRefs,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever, isCommandKeyPressed, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport type React from \"react\"\nimport { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { BatchAssetUploader } from \"web/lib/BatchAssetUploader.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { useCopyAndCutHandler, usePasteHandler } from \"web/pages/project/lib/useWindowEventListeners.ts\"\nimport { dataIsCollectionTableDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport {\n\tbuildCmsAgentChatSelectionSnapshot,\n\tCmsAgentChatPanel,\n\toverlaySupportsCmsAgentChatPanel,\n} from \"./CmsAgentChatPanel.tsx\"\nimport { NoItemsEmptyState } from \"./NoItemsEmptyState.tsx\"\nimport { getCellIdentifierFromClientPoint as getCellFromClientPointLookup } from \"./VirtualCollectionItemTable.cellLookup.ts\"\nimport { getEnsureCellVisiblePlan } from \"./VirtualCollectionItemTable.cellVisibility.ts\"\nimport {\n\tcopyCollectionItemTableSelectionToClipboard,\n\tpasteCollectionItemTableSelectionFromClipboard,\n} from \"./VirtualCollectionItemTable.clipboard.ts\"\nimport {\n\tdefaultColumnWidth,\n\tgetColumnResizeCursor,\n\tgetColumnWidthForIndex,\n} from \"./VirtualCollectionItemTable.columnLayout.ts\"\nimport { useColumnReorderController } from \"./VirtualCollectionItemTable.columnReorderController.ts\"\nimport { useColumnWidthController } from \"./VirtualCollectionItemTable.columnWidthController.ts\"\nimport { useVirtualCollectionItemTableEditing } from \"./VirtualCollectionItemTable.editing.ts\"\nimport { isPopoverEditingSession } from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport {\n\tfocusElementWithoutAutoSelect,\n\tgetVirtualCollectionItemTableContainerTabIndex,\n} from \"./VirtualCollectionItemTable.focusNavigation.ts\"\nimport { getVirtualCollectionItemTableKeyboardAction } from \"./VirtualCollectionItemTable.keyboardNavigation.ts\"\nimport { openCollectionItemOverlayForCell as openCollectionItemOverlayForCellUtil } from \"./VirtualCollectionItemTable.openCollectionItemOverlay.ts\"\nimport { useRowReorderController } from \"./VirtualCollectionItemTable.rowReorderController.ts\"\nimport { getAllVisibleRowsCheckboxState } from \"./VirtualCollectionItemTable.rowSelectionState.ts\"\nimport {\n\ttype CellIdentifier,\n\ttype TabOrderDirection,\n\tcreateRowsAndColumnsSnapshot,\n\tgetCellKey,\n\tgetSingleSelectedColumnId,\n} from \"./VirtualCollectionItemTable.selection.ts\"\nimport { useClearVirtualCollectionItemTableSelectionOnChromeInteraction } from \"./VirtualCollectionItemTable.selectionClearing.ts\"\nimport {\n\tgetSelectionAnchorOverlayRect,\n\tgetSelectionBounds,\n\tgetSelectionInnerBorderVisibility,\n\tgetSelectionRangeOverlayRect,\n\tgetSelectionStickyBoundaryRect,\n\tisSelectionPartiallyVisible,\n} from \"./VirtualCollectionItemTable.selectionOverlay.ts\"\nimport {\n\tgetCellsInActivationColumn,\n\tgetSpreadsheetCellActionLabel,\n\tsupportsSpreadsheetCellAction,\n} from \"./VirtualCollectionItemTable.spreadsheetCellAction.ts\"\nimport { useStableRowIds } from \"./VirtualCollectionItemTable.stableRowIds.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { useVirtualCollectionItemTableViewport } from \"./VirtualCollectionItemTable.viewport.ts\"\nimport { VirtualCollectionItemTableBodyCell } from \"./VirtualCollectionItemTableBodyCell.tsx\"\nimport { VirtualCollectionItemTableColumnHeaderCell } from \"./VirtualCollectionItemTableColumnHeaderCell.tsx\"\nimport { VirtualCollectionItemTableInteractiveColumnHeaderCell } from \"./VirtualCollectionItemTableInteractiveColumnHeaderCell.tsx\"\nimport { VirtualCollectionItemTableRowHeaderCell } from \"./VirtualCollectionItemTableRowHeaderCell.tsx\"\nimport { VirtualCollectionItemTableToolbar } from \"./VirtualCollectionItemTableToolbar.tsx\"\nimport { useElementScrollCallbackRef } from \"./useElementScrollCallbackRef.ts\"\nimport { useIsCollapsedContentManagementView } from \"./useIsCollapsedContentManagementView.ts\"\nimport { useShouldShowCmsAgentChatPanel } from \"./useShouldShowCmsAgentChatPanel.ts\"\nimport { useVirtualCollectionItemTableFocusNavigation } from \"./useVirtualCollectionItemTableFocusNavigation.ts\"\nimport { useVirtualCollectionItemTableFocusRestoration } from \"./useVirtualCollectionItemTableFocusRestoration.ts\"\nimport { useVirtualCollectionItemTableKeyboardEntry } from \"./useVirtualCollectionItemTableKeyboardEntry.ts\"\nimport { useVirtualGridCellDragSelectionAutoScroll } from \"./useVirtualGridCellDragSelectionAutoScroll.ts\"\nimport { type SelectionAutoScrollBehavior, useVirtualGridCellSelection } from \"./useVirtualGridCellSelection.ts\"\nimport {\n\ttype VirtualGridInteractionState,\n\tuseVirtualGridInteractionMachine,\n} from \"./useVirtualGridInteractionMachine.ts\"\nimport { useVirtualGridRowSelection } from \"./useVirtualGridRowSelection.ts\"\nimport { closeCollectionItems } from \"./utils/closeCollectionItems.tsx\"\nimport type { CollectionItemTableColumn, ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\nimport { getCollectionItemRowContextMenuOptions } from \"./utils/getCollectionItemRowContextMenuOptions.ts\"\nimport { handleMoveCollectionItem } from \"./utils/handleMoveCollectionItem.ts\"\nimport { useCollectionFieldVisibility } from \"./utils/useCollectionFieldVisibility.ts\"\nimport { useCollectionDataIsViewOnly, useCollectionItemValuesAreViewOnly } from \"./utils/useCollectionIsViewOnly.ts\"\nimport { type FilteredCollectionItemsResult, useFilteredCollectionItems } from \"./utils/useFilteredCollectionItems.ts\"\nimport { EscapePrecedence, useOnEscape } from \"./utils/useOnEscape.ts\"\n\nconst rowHeaderWidth = 68\nconst tableRowHeight = dimensions.values.spreadsheetRowHeight\nconst selectionScrollPaddingY = dimensions.values.panelPadding * 2\nconst fillerColumnMinWidth = selectionScrollPaddingY\nconst selectionScrollPaddingX = dimensions.values.panelPadding * 2\nconst dragSelectionAutoScrollEdgeThreshold = 32\nconst dragSelectionAutoScrollMaxStep = 40\nconst rowReorderAutoScrollEdgeThreshold = 32\nconst rowReorderAutoScrollMaxStep = 40\nconst columnReorderAutoScrollEdgeThreshold = 40\nconst columnReorderAutoScrollMaxStep = 40\nconst rowReorderInsertionIndicatorOffset = 1\nconst columnReorderInsertionIndicatorOffset = 1\nconst fillerColumnId = \"__filler-column__\"\n\nexport interface RowContextMenuTarget {\n\trowId: NodeID\n\tcolumnId?: ColumnKey\n}\n\ninterface VirtualCollectionItemTableProps {\n\tcollectionNode: CollectionNode\n}\n\nexport function VirtualCollectionItemTable({ collectionNode }: VirtualCollectionItemTableProps) {\n\tconst { filteredItems, isFilterActive, rawSearchTerm, activeFilters, activeSortingRules } =\n\t\tuseFilteredCollectionItems(engine, collectionNode)\n\n\t// Extracted stable row ids into the outer component, because it updates React state at render\n\t// time any time the filtered items change. So we want this outer component to be cheap to re-render.\n\tconst rowIds = useStableRowIds(filteredItems)\n\n\treturn (\n\t\t<VirtualCollectionItemTableInner\n\t\t\tcollectionNode={collectionNode}\n\t\t\tfilteredItems={filteredItems}\n\t\t\trowIds={rowIds}\n\t\t\tisFilterActive={isFilterActive}\n\t\t\trawSearchTerm={rawSearchTerm}\n\t\t\tactiveFilters={activeFilters}\n\t\t\tactiveSortingRules={activeSortingRules}\n\t\t/>\n\t)\n}\n\ninterface VirtualCollectionItemTableInnerProps extends VirtualCollectionItemTableProps, FilteredCollectionItemsResult {\n\trowIds: readonly NodeID[]\n}\n\nconst VirtualCollectionItemTableInner = memo(function VirtualCollectionItemTableInner({\n\tcollectionNode,\n\tfilteredItems,\n\trowIds,\n\tisFilterActive,\n\trawSearchTerm,\n\tactiveFilters,\n\tactiveSortingRules,\n}: VirtualCollectionItemTableInnerProps) {\n\tconst multiSortEnabled = useExperimentIsOn(\"cmsMultiSort\")\n\tconst isCollapsedContentManagementView = useIsCollapsedContentManagementView()\n\tconst stickyColumnCount = isCollapsedContentManagementView ? 0 : 1\n\tconst showAgentChatPanel = useShouldShowCmsAgentChatPanel()\n\tconst activeContentManagementOverlay = engine.stores.chromeStore.useState(state =>\n\t\tstate.contentManagementOverlayStack.at(-1),\n\t)\n\tconst agentChatPanelIsOwnedByOverlay =\n\t\tshowAgentChatPanel && overlaySupportsCmsAgentChatPanel(activeContentManagementOverlay)\n\n\tconst tableContainerRef = useRef<HTMLDivElement>(null)\n\tconst tableScrollRef = useRef<HTMLDivElement>(null)\n\tconst virtualTableRef = useRef<VirtualTableRef | null>(null)\n\tconst richTextPasteAssetUploader = useConstant(() => new BatchAssetUploader(engine, { silent: true }))\n\tconst preserveSelectionOnNextTableBlurRef = useRef(false)\n\tconst skipAutoSelectOnNextTableFocusRef = useRef(false)\n\tconst lastValidCellRef = useRef<CellIdentifier | null>(null)\n\n\tconst [hoveredRowId, setHoveredRowId] = useState<NodeID | null>(null)\n\tconst [contextMenuOpenRowId, setContextMenuOpenRowId] = useState<NodeID | null>(null)\n\tconst [showOverlayButtonsFromMouse, setShowOverlayButtonsFromMouse] = useState(true)\n\tconst { interactionState, dispatchInteraction } = useVirtualGridInteractionMachine()\n\tconst selectedNodeId = engine.stores.selectionStore.useState(state => state.ids[0] ?? null)\n\n\tconst {\n\t\tvisibleColumns: columns,\n\t\tmoveVisibleColumn,\n\t\ttoggleVisibility,\n\t\tvisibilityOptions,\n\t} = useCollectionFieldVisibility(engine, collectionNode)\n\tconst dataIsViewOnly = useCollectionDataIsViewOnly(collectionNode.id)\n\tconst itemValuesAreViewOnly = useCollectionItemValuesAreViewOnly(collectionNode.id)\n\tconst { multiSelectedItems } = engine.stores.contentManagementStore.useState()\n\tconst hasOpenOverlay = engine.stores.chromeStore.useState(state => !!state.overlay)\n\tconst activeModalType = engine.stores.modalStore.useState(state => state.active.type)\n\tconst { tableViewportWidth, isHorizontallyScrolled, tableContainerCallbackRef, tableScrollCallbackRef } =\n\t\tuseVirtualCollectionItemTableViewport()\n\tconst tableScrollInteractionCallbackRef = useElementScrollCallbackRef<HTMLDivElement>({\n\t\tonScroll: () => {\n\t\t\tsetShowOverlayButtonsFromMouse(false)\n\t\t},\n\t})\n\n\tconst mergedTableContainerRef = useMergeRefs(tableContainerRef, tableContainerCallbackRef)\n\tconst mergedTableScrollRef = useMergeRefs(tableScrollRef, tableScrollCallbackRef, tableScrollInteractionCallbackRef)\n\n\tconst rowCount = filteredItems.length\n\tconst columnCount = columns.length\n\n\tconst columnIds = useMemo(() => columns.map(column => column.key), [columns])\n\tconst rowIndexById = useMemo(() => new Map(rowIds.map((rowId, index) => [rowId, index])), [rowIds])\n\tconst columnIndexById = useMemo(() => new Map(columnIds.map((columnId, index) => [columnId, index])), [columnIds])\n\n\tconst sortingOrderByColumnId = useMemo(\n\t\t() => new Map(activeSortingRules.map(sortingRule => [sortingRule.by, sortingRule.order] as const)),\n\t\t[activeSortingRules],\n\t)\n\n\tconst getRowId = useCallback(\n\t\t(rowIndex: number) => {\n\t\t\tconst rowId = rowIds[rowIndex]\n\t\t\tassert(rowId !== undefined, `Missing row id for row index ${rowIndex}`)\n\t\t\treturn rowId\n\t\t},\n\t\t[rowIds],\n\t)\n\tconst getColumnId = useCallback(\n\t\t(columnIndex: number) => {\n\t\t\tif (columnIndex === columnIds.length) return fillerColumnId\n\n\t\t\tconst columnId = columnIds[columnIndex]\n\t\t\tassert(columnId !== undefined, `Missing column id for column index ${columnIndex}`)\n\t\t\treturn columnId\n\t\t},\n\t\t[columnIds],\n\t)\n\n\tconst allVisibleRowsCheckboxState = useMemo(() => {\n\t\treturn getAllVisibleRowsCheckboxState({\n\t\t\trowIds,\n\t\t\tmultiSelectedItems,\n\t\t})\n\t}, [multiSelectedItems, rowIds])\n\n\tconst focusTable = useCallback(() => {\n\t\ttableContainerRef.current?.focus()\n\t}, [])\n\n\tconst focusTableWithoutAutoSelect = useCallback(() => {\n\t\tfocusElementWithoutAutoSelect({\n\t\t\telement: tableContainerRef.current,\n\t\t\tskipAutoSelectOnNextFocusRef: skipAutoSelectOnNextTableFocusRef,\n\t\t})\n\t}, [])\n\n\tconst preserveSelectionOnNextTableBlur = useCallback(() => {\n\t\tpreserveSelectionOnNextTableBlurRef.current = true\n\t}, [])\n\n\tuseVirtualCollectionItemTableFocusRestoration({\n\t\thasOpenOverlay,\n\t\tactiveModalType,\n\t\tfocusTableWithoutAutoSelect,\n\t})\n\n\tconst exitMultiSelectionMode = useCallback(() => {\n\t\tengine.stores.contentManagementStore.exitMultiSelectionMode()\n\t}, [])\n\n\tconst exitAgentSelectionMode = useCallback(() => {\n\t\tengine.stores.contentManagementStore.exitAgentSelectionMode()\n\t}, [])\n\n\tconst {\n\t\tselection,\n\t\tselectionAutoScrollBehaviorRef,\n\t\tselectCell,\n\t\tmoveSelection,\n\t\tmoveSelectionInTabOrder,\n\t\tbeginDragSelection,\n\t\textendDragSelection,\n\t\tstopDragSelection,\n\t\tclearSelection,\n\t\tselectFirstCell,\n\t\tselectLastCell,\n\t\tselectColumn,\n\t\tselectAllCells,\n\t\tactiveDragSelectionAnchorColumnId,\n\t} = useVirtualGridCellSelection({\n\t\trowIds,\n\t\tcolumnIds,\n\t\trowIndexById,\n\t\tcolumnIndexById,\n\t\tfocusTable,\n\t\tinteractionState,\n\t\tdispatchInteraction,\n\t})\n\n\tconst isCellDragSelecting = interactionState.kind === \"cellDragSelect\"\n\tconst selectedCellKeys = useMemo(() => new Set(selection.selectedCells.map(getCellKey)), [selection.selectedCells])\n\tconst hasCellSelection = selection.anchor !== null || selection.focus !== null\n\tconst collectionItemIdBasedOnCurrentSelection = selection.anchor?.rowId ?? null\n\n\tuseEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.contentManagementStore.setCollectionItemIdBasedOnCurrentSelection(\n\t\t\t\tcollectionItemIdBasedOnCurrentSelection,\n\t\t\t)\n\t\t})\n\t}, [collectionItemIdBasedOnCurrentSelection])\n\n\tconst collectionName = collectionNode.resolveValue(\"name\") || Dictionary.Collection\n\tconst fullSelectionBounds = useMemo(\n\t\t() =>\n\t\t\tgetSelectionBounds({\n\t\t\t\tselectedCells: selection.selectedCells,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tincludeColumnIndex: () => true,\n\t\t\t}),\n\t\t[columnIndexById, rowIndexById, selection.selectedCells],\n\t)\n\n\tconst isCellInCurrentTable = useCallback(\n\t\t(cell: CellIdentifier | null) => {\n\t\t\tif (!cell) return false\n\t\t\treturn rowIndexById.has(cell.rowId) && columnIndexById.has(cell.columnId)\n\t\t},\n\t\t[columnIndexById, rowIndexById],\n\t)\n\tconst hasValidSelection = isCellInCurrentTable(selection.anchor) || isCellInCurrentTable(selection.focus)\n\n\tuseEffect(() => {\n\t\tconst activeCell = selection.focus ?? selection.anchor\n\t\tif (!activeCell || !isCellInCurrentTable(activeCell)) return\n\n\t\tlastValidCellRef.current = activeCell\n\t}, [isCellInCurrentTable, selection.anchor, selection.focus])\n\n\tconst moveCollectionItem = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\thandleMoveCollectionItem({\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tcollectionNodeId: collectionNode.id,\n\t\t\t\tdraftStatus: undefined,\n\t\t\t\tdraftGrouping: \"preserve-order\",\n\t\t\t\tsortedItemIds: rowIds,\n\t\t\t\tactiveSortingRules,\n\t\t\t\tstoreManualSortingAsLocalOverride: multiSortEnabled,\n\t\t\t})\n\t\t},\n\t\t[activeSortingRules, collectionNode.id, multiSortEnabled, rowIds],\n\t)\n\n\tconst {\n\t\trowReorderingEnabled,\n\t\tisRowReordering,\n\t\tdraggedRowId,\n\t\tstartRowReorderDrag,\n\t\tcancelRowReorderDrag,\n\t\trowReorderPreviewRowIndex,\n\t\trowReorderPreviewTop,\n\t\trowReorderInsertionIndicatorTop,\n\t} = useRowReorderController({\n\t\tinteractionState,\n\t\tdispatchInteraction,\n\t\tisFilterActive,\n\t\tdataIsViewOnly,\n\t\trowIds,\n\t\tselectedRowCount: multiSelectedItems?.size ?? 0,\n\t\ttableScrollRef,\n\t\ttableRowHeight,\n\t\trowIndexById,\n\t\titems: filteredItems,\n\t\tstopDragSelection,\n\t\tfocusTableWithoutAutoSelect,\n\t\tonCommitMove: moveCollectionItem,\n\t\tautoScrollEdgeThreshold: rowReorderAutoScrollEdgeThreshold,\n\t\tautoScrollMaxStep: rowReorderAutoScrollMaxStep,\n\t})\n\n\tconst { columnWidths, columnLeftOffsets, isColumnResizing, startColumnResize, cancelColumnResize } =\n\t\tuseColumnWidthController({\n\t\t\tcollectionId: collectionNode.id,\n\t\t\tvisibleColumns: columns,\n\t\t\ttableViewportWidth,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnCount,\n\t\t\tfillerColumnMinWidth,\n\t\t\tdefaultColumnWidth,\n\t\t\tinteractionState,\n\t\t\tdispatchInteraction,\n\t\t\tfocusTableWithoutAutoSelect,\n\t\t})\n\n\tconst stickyColumnsWidth = columnWidths.slice(0, stickyColumnCount).reduce((sum, width) => sum + width, 0)\n\n\tconst getColumnWidth = useCallback(\n\t\t(columnIndex: number) => {\n\t\t\treturn getColumnWidthForIndex({ columnWidths, columnIndex, defaultColumnWidth })\n\t\t},\n\t\t[columnWidths],\n\t)\n\n\tconst {\n\t\tcolumnReorderingEnabled,\n\t\tisColumnReordering,\n\t\tdraggedColumnId,\n\t\tdraggedColumnIndex,\n\t\tstartColumnReorderDrag,\n\t\tcancelColumnReorderDrag,\n\t\tcolumnReorderPreviewLeft,\n\t\tcolumnReorderPreviewWidth,\n\t\tcolumnReorderPreviewTitle,\n\t\tcolumnReorderPreviewRows,\n\t\tcolumnReorderInsertionIndicatorLeft,\n\t} = useColumnReorderController({\n\t\tinteractionState,\n\t\tdispatchInteraction,\n\t\tcolumnReorderingIsViewOnly: itemValuesAreViewOnly,\n\t\tcolumns,\n\t\titemsLength: filteredItems.length,\n\t\ttableScrollRef,\n\t\tcolumnWidths,\n\t\tcolumnLeftOffsets,\n\t\trowHeaderWidth,\n\t\tstickyColumnCount,\n\t\tstickyColumnsWidth,\n\t\tdefaultColumnWidth,\n\t\tstopDragSelection,\n\t\tfocusTableWithoutAutoSelect,\n\t\tonCommitMove: moveVisibleColumn,\n\t\tautoScrollEdgeThreshold: columnReorderAutoScrollEdgeThreshold,\n\t\tautoScrollMaxStep: columnReorderAutoScrollMaxStep,\n\t\ttableRowHeight,\n\t})\n\tconst interactionCursor = getInteractionCursor({\n\t\tinteractionState,\n\t\tcolumns,\n\t\tcolumnWidths,\n\t\tstickyColumnCount,\n\t\ttableViewportWidth,\n\t\trowHeaderWidth,\n\t\tfillerColumnMinWidth,\n\t})\n\n\tconst ensureCellIsVisible = useCallback(\n\t\t(cell: CellIdentifier, selectionAutoScrollBehavior: SelectionAutoScrollBehavior = \"scroll\") => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return\n\t\t\tconst ensureVisiblePlan = getEnsureCellVisiblePlan({\n\t\t\t\tcell,\n\t\t\t\tselectionAutoScrollBehavior,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tstickyColumnCount,\n\t\t\t\tselectionScrollPaddingY,\n\t\t\t\tselectionScrollPaddingX,\n\t\t\t\tcurrentScrollLeft: scrollElement.scrollLeft,\n\t\t\t})\n\t\t\tif (!ensureVisiblePlan) return\n\n\t\t\tvirtualTableRef.current?.scrollToCell(ensureVisiblePlan.scrollToCellOptions)\n\n\t\t\tif (ensureVisiblePlan.shouldResetScrollLeft) {\n\t\t\t\tscrollElement.scrollLeft = 0\n\t\t\t}\n\t\t},\n\t\t[columnIndexById, rowIndexById, stickyColumnCount],\n\t)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: This effect reacts to selection changes; the ref value is intentionally read imperatively.\n\tuseLayoutEffect(() => {\n\t\tconst activeCell = selection.focus ?? selection.anchor\n\t\tif (!activeCell) {\n\t\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\t\t\treturn\n\t\t}\n\n\t\tconst selectionAutoScrollBehavior = selectionAutoScrollBehaviorRef.current\n\t\tensureCellIsVisible(activeCell, selectionAutoScrollBehavior)\n\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\t}, [ensureCellIsVisible, selection.anchor, selection.focus, selectionAutoScrollBehaviorRef])\n\n\tconst selectAndRevealDuplicateCell = useCallback(\n\t\t(rowId: NodeID) => {\n\t\t\tconst titleVariableId = collectionNode.getTitleVariable()?.id\n\t\t\tconst slugVariableId = collectionNode.getSlugVariable()?.id\n\t\t\tconst firstTitleOrSlugColumn = columns.find(({ key }) => key === titleVariableId || key === slugVariableId)\n\t\t\tconst targetColumn = firstTitleOrSlugColumn ?? columns[0]\n\t\t\tif (!targetColumn) return\n\n\t\t\t// We can immediately select the cell because the duplicate is created and rendered synchronously.\n\t\t\tselectCell({ rowId, columnId: targetColumn.key }, \"keyboard\")\n\t\t},\n\t\t[collectionNode, columns, selectCell],\n\t)\n\n\tconst getCellFromClientPoint = useCallback(\n\t\t(clientX: number, clientY: number): CellIdentifier | null => {\n\t\t\tconst getCellPositionFromClientPoint = virtualTableRef.current?.getCellFromClientPoint\n\t\t\tif (!getCellPositionFromClientPoint) return null\n\n\t\t\treturn getCellFromClientPointLookup({\n\t\t\t\tclientX,\n\t\t\t\tclientY,\n\t\t\t\titems: filteredItems,\n\t\t\t\tcolumns,\n\t\t\t\tgetCellPositionFromClientPoint,\n\t\t\t})\n\t\t},\n\t\t[columns, filteredItems],\n\t)\n\n\tuseVirtualGridCellDragSelectionAutoScroll({\n\t\tisCellDragSelecting,\n\t\tactiveDragAnchorColumnId: activeDragSelectionAnchorColumnId,\n\t\ttableScrollRef,\n\t\ttableRowHeight,\n\t\trowHeaderWidth,\n\t\tstickyColumnCount,\n\t\tstickyColumnsWidth,\n\t\tcolumnIndexById,\n\t\tautoScrollEdgeThreshold: dragSelectionAutoScrollEdgeThreshold,\n\t\tautoScrollMaxStep: dragSelectionAutoScrollMaxStep,\n\t\tgetCellFromClientPoint,\n\t\textendDragSelection,\n\t\tstopDragSelection,\n\t})\n\n\tconst clearCellSelectionForRowSelection = useCallback(() => {\n\t\tstopDragSelection()\n\t\tclearSelection()\n\t}, [clearSelection, stopDragSelection])\n\n\tuseOnEscape({\n\t\tname: \"VirtualCollectionItemTableAgentSelection\",\n\t\tprecedence: EscapePrecedence.agentSelectionMode,\n\t\tenabled: () => engine.stores.contentManagementStore.isAgentSelectionModeActive,\n\t\thandler: engine.scheduler.wrapHandler(exitAgentSelectionMode),\n\t})\n\tuseOnEscape({\n\t\tname: \"VirtualCollectionItemTableSelection\",\n\t\tprecedence: EscapePrecedence.panelSelection,\n\t\tenabled: () => engine.stores.contentManagementStore.isMultiSelectionModeActive,\n\t\thandler: engine.scheduler.wrapHandler(() => engine.stores.contentManagementStore.exitMultiSelectionMode()),\n\t})\n\tuseOnEscape({\n\t\tname: \"VirtualCollectionItemTable\",\n\t\tprecedence: EscapePrecedence.scopeExit,\n\t\thandler: engine.scheduler.wrapHandler(() => {\n\t\t\trecord(\"ui_interaction\", { id: \"exit_cms\", page: Pages.collectionPanel })\n\t\t\tengine.stores.scopeStore.selectPreviousActiveScope()\n\t\t}),\n\t})\n\n\tconst restoreMostRecentCellSelection = useCallback(\n\t\t(selectionAutoScrollBehavior: SelectionAutoScrollBehavior = \"keyboard\") => {\n\t\t\tconst lastValidCell = lastValidCellRef.current\n\t\t\tif (!lastValidCell || !isCellInCurrentTable(lastValidCell)) return false\n\n\t\t\tselectCell(lastValidCell, selectionAutoScrollBehavior)\n\t\t\treturn true\n\t\t},\n\t\t[isCellInCurrentTable, selectCell],\n\t)\n\n\tuseClearVirtualCollectionItemTableSelectionOnChromeInteraction({\n\t\thasCellSelection,\n\t\tclearSelection,\n\t})\n\n\tconst { handleRowCheckboxClick, handleAllRowsCheckboxChange } = useVirtualGridRowSelection({\n\t\trowIds,\n\t\tclearCellSelectionForRowSelection,\n\t})\n\n\tconst {\n\t\teditingSession,\n\t\teditingSessionKey,\n\t\tgetCellActionSupport,\n\t\tperformCellAction,\n\t\tupdateEditingSessionValue,\n\t\tfinishEditingSession,\n\t\tcancelEditingSession,\n\t\tactivateCells,\n\t\tgetSpreadsheetInlineEditAction,\n\t\tcanDeleteCells,\n\t\tdeleteCells,\n\t\tcommitBooleanCellValue,\n\t} = useVirtualCollectionItemTableEditing({\n\t\tcollectionNodeId: collectionNode.id,\n\t\tcolumns,\n\t\tdataIsViewOnly: itemValuesAreViewOnly,\n\t\tpreserveSelectionOnNextTableBlur,\n\t\tfocusTable,\n\t\tensureCellIsVisible,\n\t\tmoveSelection,\n\t\tmoveSelectionInTabOrder,\n\t\tselectCell,\n\t\tisRowReordering,\n\t\tisColumnReordering,\n\t\tisColumnResizing,\n\t})\n\n\t// Keep this derived flag outside the callback so drag-selection doesn't resubscribe on\n\t// every inline editing-session update.\n\tconst hasOpenPopoverEditor = isPopoverEditingSession(editingSession)\n\tconst keyboardInteractionBlocked = hasOpenOverlay || hasOpenPopoverEditor\n\tconst searchShortcutBlocked = hasOpenOverlay || activeModalType !== ModalType.None\n\tconst isClosingCollectionItemOverlayRef = useRef(false)\n\n\tconst tryCloseCollectionItemOverlay = useCallback(() => {\n\t\tconst hasOpenCollectionItemOverlay = engine.stores.chromeStore.overlay?.type === \"collectionItem\"\n\t\tif (!hasOpenCollectionItemOverlay || isClosingCollectionItemOverlayRef.current) return\n\n\t\tisClosingCollectionItemOverlayRef.current = true\n\t\tcloseCollectionItems({ engine, target: \"all\" })\n\t\t\t.catch(unhandledError)\n\t\t\t.finally(() => {\n\t\t\t\tisClosingCollectionItemOverlayRef.current = false\n\t\t\t})\n\t}, [])\n\n\tuseVirtualCollectionItemTableKeyboardEntry({\n\t\trowCount,\n\t\tcolumnCount,\n\t\thasValidSelection,\n\t\tkeyboardNavigationBlocked: keyboardInteractionBlocked,\n\t\tfocusTable,\n\t\tselectFirstCell,\n\t\tonCellInteraction: exitMultiSelectionMode,\n\t})\n\n\tconst handleBeginDragSelection = useCallback(\n\t\t(cell: CellIdentifier, shiftKey: boolean) => {\n\t\t\ttryCloseCollectionItemOverlay()\n\t\t\texitMultiSelectionMode()\n\n\t\t\tif (hasOpenPopoverEditor) {\n\t\t\t\t// Treat the first grid click while a popover-backed editor is open as a pure dismiss\n\t\t\t\t// action. Starting selection in the same event races with popover teardown and\n\t\t\t\t// feels like an unintended drag-selection gesture.\n\t\t\t\tfinishEditingSession({ type: \"focusCurrentCell\" })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfinishEditingSession()\n\t\t\tbeginDragSelection(cell, shiftKey)\n\t\t},\n\t\t[\n\t\t\tbeginDragSelection,\n\t\t\texitMultiSelectionMode,\n\t\t\tfinishEditingSession,\n\t\t\thasOpenPopoverEditor,\n\t\t\ttryCloseCollectionItemOverlay,\n\t\t],\n\t)\n\n\tconst { handleTableFocus, handleTableBlur, handleTableMouseDownCapture } =\n\t\tuseVirtualCollectionItemTableFocusNavigation({\n\t\t\tpreserveSelectionOnNextTableBlurRef,\n\t\t\tskipAutoSelectOnNextTableFocusRef,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\thasValidSelection,\n\t\t\thasCellSelection,\n\t\t\texitMultiSelectionMode,\n\t\t\trestoreMostRecentCellSelection,\n\t\t\tselectFirstCell,\n\t\t\tselectLastCell,\n\t\t\tstopDragSelection,\n\t\t\tclearSelection,\n\t\t})\n\n\tconst handleTableTabNavigation = useCallback(\n\t\t(direction: TabOrderDirection) => {\n\t\t\tsetShowOverlayButtonsFromMouse(false)\n\t\t\texitMultiSelectionMode()\n\n\t\t\tif (!hasValidSelection) {\n\t\t\t\tif (restoreMostRecentCellSelection(\"keyboard\")) {\n\t\t\t\t\tfocusTable()\n\t\t\t\t\treturn true\n\t\t\t\t}\n\n\t\t\t\tif (direction === \"previous\") return false\n\n\t\t\t\tconst selectedFirstCell = selectFirstCell(\"keyboard\")\n\t\t\t\tif (selectedFirstCell) {\n\t\t\t\t\tfocusTable()\n\t\t\t\t}\n\t\t\t\treturn selectedFirstCell\n\t\t\t}\n\n\t\t\tconst movedSelection = moveSelectionInTabOrder(direction, \"keyboard\")\n\t\t\tif (movedSelection) {\n\t\t\t\tfocusTable()\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// At the edge of the grid, leave focus movement to the browser's native Tab order.\n\t\t\treturn false\n\t\t},\n\t\t[\n\t\t\texitMultiSelectionMode,\n\t\t\tfocusTable,\n\t\t\thasValidSelection,\n\t\t\tmoveSelectionInTabOrder,\n\t\t\trestoreMostRecentCellSelection,\n\t\t\tselectFirstCell,\n\t\t],\n\t)\n\n\tconst handleTableKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (event.defaultPrevented) return\n\t\t\tif (keyboardInteractionBlocked) return\n\n\t\t\tif (event.key === \"Tab\") {\n\t\t\t\tif (isRowReordering || isColumnReordering || isColumnResizing) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst direction: TabOrderDirection = event.shiftKey ? \"previous\" : \"next\"\n\t\t\t\tconst handled = handleTableTabNavigation(direction)\n\t\t\t\tif (handled) {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst actionCell = selection.anchor\n\t\t\tconst targetCells = selection.selectedCells\n\t\t\tconst action = getVirtualCollectionItemTableKeyboardAction({\n\t\t\t\tkey: event.key,\n\t\t\t\tshiftKey: event.shiftKey,\n\t\t\t\tisCommandPressed: isCommandKeyPressed(event),\n\t\t\t\taltKey: event.altKey,\n\t\t\t\trowCount,\n\t\t\t\tcolumnCount,\n\t\t\t\tisRowReordering,\n\t\t\t\tisColumnReordering,\n\t\t\t\tisColumnResizing,\n\t\t\t\thasSelection: selection.anchor !== null,\n\t\t\t\tselectedCellActionSupport: getCellActionSupport(actionCell),\n\t\t\t\tselectedCellDeleteEnabled: canDeleteCells(targetCells),\n\t\t\t})\n\t\t\tif (!action) return\n\n\t\t\tevent.preventDefault()\n\t\t\tsetShowOverlayButtonsFromMouse(false)\n\n\t\t\tconst shouldExitAgentSelectionMode =\n\t\t\t\taction.type === \"startEditing\" || action.type === \"activateCell\" || action.type === \"openItemOverlay\"\n\n\t\t\tif (shouldExitAgentSelectionMode) {\n\t\t\t\texitAgentSelectionMode()\n\t\t\t}\n\t\t\texitMultiSelectionMode()\n\n\t\t\tif (action.type === \"startEditing\") {\n\t\t\t\tif (!actionCell) return\n\t\t\t\tperformCellAction(actionCell, action.initialValue)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tfocusTable()\n\n\t\t\tif (action.type === \"activateCell\") {\n\t\t\t\tif (!actionCell) return\n\t\t\t\tactivateCells(\n\t\t\t\t\tgetCellsInActivationColumn({\n\t\t\t\t\t\ttargetCell: actionCell,\n\t\t\t\t\t\tselectedCells: targetCells,\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 (action.type === \"deleteCellValue\") {\n\t\t\t\tdeleteCells(targetCells)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"openItemOverlay\") {\n\t\t\t\tif (!actionCell) return\n\t\t\t\topenCollectionItemOverlayForCellUtil({ engine, cell: actionCell })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"moveSelection\") {\n\t\t\t\tif (!hasValidSelection) {\n\t\t\t\t\tif (selectFirstCell(\"keyboard\")) return\n\t\t\t\t}\n\t\t\t\tmoveSelection(action.rowDelta, action.columnDelta, action.extendSelection, \"keyboard\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"clearSelection\") {\n\t\t\t\tstopDragSelection()\n\t\t\t\tclearSelection()\n\t\t\t\tevent.stopPropagation()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"selectAll\") {\n\t\t\t\tconst singleSelectedColumnId = getSingleSelectedColumnId(selection.anchor, selection.focus)\n\t\t\t\tconst shouldSelectSingleColumnOnSelectAll =\n\t\t\t\t\tsingleSelectedColumnId !== null && selection.selectedCells.length < rowCount\n\n\t\t\t\tif (shouldSelectSingleColumnOnSelectAll && singleSelectedColumnId) {\n\t\t\t\t\tselectColumn(singleSelectedColumnId)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tselectAllCells()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"cancelRowReorder\") {\n\t\t\t\tcancelRowReorderDrag()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"cancelColumnReorder\") {\n\t\t\t\tcancelColumnReorderDrag()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (action.type === \"cancelColumnResize\") {\n\t\t\t\tcancelColumnResize()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tassertNever(action, \"Unsupported keyboard action\")\n\t\t},\n\t\t[\n\t\t\tcancelColumnResize,\n\t\t\tcancelColumnReorderDrag,\n\t\t\tcancelRowReorderDrag,\n\t\t\tactivateCells,\n\t\t\tcanDeleteCells,\n\t\t\tcolumnCount,\n\t\t\tdeleteCells,\n\t\t\texitAgentSelectionMode,\n\t\t\texitMultiSelectionMode,\n\t\t\tfocusTable,\n\t\t\tgetCellActionSupport,\n\t\t\thandleTableTabNavigation,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\tisColumnResizing,\n\t\t\tisColumnReordering,\n\t\t\tisRowReordering,\n\t\t\tmoveSelection,\n\t\t\trowCount,\n\t\t\thasValidSelection,\n\t\t\tclearSelection,\n\t\t\tselection,\n\t\t\tselectAllCells,\n\t\t\tselectColumn,\n\t\t\tselectFirstCell,\n\t\t\tstopDragSelection,\n\t\t\tperformCellAction,\n\t\t],\n\t)\n\n\tconst handleTableMouseMove = useCallback((event: React.MouseEvent<HTMLDivElement>) => {\n\t\tsetShowOverlayButtonsFromMouse(true)\n\n\t\tconst target = event.target\n\t\tif (!(target instanceof HTMLElement)) return\n\n\t\tconst hoveredRowElement = target.closest<HTMLElement>(\"[data-row-id]\")\n\t\tconst nextHoveredRowId = hoveredRowElement?.dataset.rowId ?? null\n\t\tsetHoveredRowId(nextHoveredRowId)\n\t}, [])\n\n\tconst handleToggleCollectionItemOverlay = useCallback(\n\t\t(rowId: NodeID) => {\n\t\t\texitAgentSelectionMode()\n\t\t\texitMultiSelectionMode()\n\t\t\tfinishEditingSession()\n\n\t\t\tconst overlayVisible = engine.stores.selectionStore.ids.includes(rowId)\n\n\t\t\tcloseCollectionItems({\n\t\t\t\tengine,\n\t\t\t\ttarget: \"all\",\n\t\t\t})\n\t\t\t\t.then(({ userKeptEditing }) => {\n\t\t\t\t\tif (userKeptEditing) return\n\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tif (overlayVisible) {\n\t\t\t\t\t\t\tengine.stores.selectionStore.set(collectionNode.id)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tengine.stores.selectionStore.set(rowId)\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\t[collectionNode.id, exitAgentSelectionMode, exitMultiSelectionMode, finishEditingSession],\n\t)\n\n\tconst handleRowContextMenu = useCallback(\n\t\t({ rowId, columnId }: RowContextMenuTarget, event: React.MouseEvent<HTMLElement>) => {\n\t\t\tif (wantsNativeTextActions(event.target)) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tpreserveSelectionOnNextTableBlur()\n\n\t\t\tconst { contextMenuStore } = engine.stores\n\t\t\tconst targetCell: CellIdentifier | null = columnId ? { rowId, columnId } : null\n\t\t\tconst targetCellActionSupport = getCellActionSupport(targetCell)\n\t\t\tconst targetColumn = targetCell ? columns.find(column => column.key === targetCell.columnId) : undefined\n\t\t\tconst targetCellHasAction =\n\t\t\t\ttargetCell !== null && supportsSpreadsheetCellAction(targetCellActionSupport, targetColumn)\n\t\t\tconst spreadsheetCellActionLabel = getSpreadsheetCellActionLabel(targetColumn)\n\t\t\tconst inlineEditAction = getSpreadsheetInlineEditAction({\n\t\t\t\ttargetCell,\n\t\t\t\tselectedCells: selection.selectedCells,\n\t\t\t\tcolumn: targetColumn,\n\t\t\t})\n\t\t\tconst cmsAgentChatSelectionSnapshot = showAgentChatPanel\n\t\t\t\t? buildCmsAgentChatSelectionSnapshot(collectionNode.id, collectionName, selection.selectedCells)\n\t\t\t\t: undefined\n\t\t\tconst isContextMenuTargetCellInSelection = !!targetCell && selectedCellKeys.has(getCellKey(targetCell))\n\t\t\tconst menuOptions = getCollectionItemRowContextMenuOptions({\n\t\t\t\tengine,\n\t\t\t\tcollectionItemId: rowId,\n\t\t\t\tcontextMenuTargetCell: targetCell,\n\t\t\t\tselectedCells: selection.selectedCells,\n\t\t\t\tinlineEditEnabled: targetCellHasAction,\n\t\t\t\tspreadsheetCellActionLabel,\n\t\t\t\tinlineEditAction,\n\t\t\t\trowContextMenuSupport: {\n\t\t\t\t\tclearCellSelectionForRowSelection,\n\t\t\t\t\tfinishEditingSession,\n\t\t\t\t\texitAgentSelectionMode,\n\t\t\t\t\texitMultiSelectionMode,\n\t\t\t\t\tfocusTable,\n\t\t\t\t\tselectAndRevealDuplicateCell,\n\t\t\t\t},\n\t\t\t\tcmsAgentChatSelectionSnapshot,\n\t\t\t\tisContextMenuTargetCellInSelection,\n\t\t\t})\n\n\t\t\tsetContextMenuOpenRowId(rowId)\n\t\t\tcontextMenuStore.show(menuOptions, {\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t\tonDone: () => setContextMenuOpenRowId(null),\n\t\t\t})\n\t\t},\n\t\t[\n\t\t\tclearCellSelectionForRowSelection,\n\t\t\tcolumns,\n\t\t\tcollectionName,\n\t\t\tcollectionNode.id,\n\t\t\tgetCellActionSupport,\n\t\t\tgetSpreadsheetInlineEditAction,\n\t\t\tfinishEditingSession,\n\t\t\tfocusTable,\n\t\t\tpreserveSelectionOnNextTableBlur,\n\t\t\tselection.selectedCells,\n\t\t\tselectedCellKeys,\n\t\t\tselectAndRevealDuplicateCell,\n\t\t\tshowAgentChatPanel,\n\t\t\texitAgentSelectionMode,\n\t\t\texitMultiSelectionMode,\n\t\t],\n\t)\n\n\tconst handleStartEditingCell = useCallback(\n\t\t(cell: CellIdentifier) => {\n\t\t\ttryCloseCollectionItemOverlay()\n\t\t\texitAgentSelectionMode()\n\t\t\texitMultiSelectionMode()\n\t\t\tperformCellAction(cell)\n\t\t},\n\t\t[exitAgentSelectionMode, exitMultiSelectionMode, performCellAction, tryCloseCollectionItemOverlay],\n\t)\n\n\tconst handleCommitBooleanCellValue = useCallback(\n\t\t(cell: CellIdentifier, value: boolean) => {\n\t\t\ttryCloseCollectionItemOverlay()\n\t\t\texitAgentSelectionMode()\n\t\t\texitMultiSelectionMode()\n\t\t\tcommitBooleanCellValue(cell, value)\n\t\t},\n\t\t[commitBooleanCellValue, exitAgentSelectionMode, exitMultiSelectionMode, tryCloseCollectionItemOverlay],\n\t)\n\n\tconst dragMovedToAnotherCell = interactionState.kind === \"cellDragSelect\" && interactionState.dragMovedToAnotherCell\n\n\tconst isClipboardTargetActive = useCallback((event: ClipboardEvent) => {\n\t\tconst tableContainer = tableContainerRef.current\n\t\tif (!tableContainer) return false\n\t\tif (wantsNativeTextActions()) return false\n\n\t\tconst activeElement = document.activeElement\n\t\tif (activeElement instanceof Node && tableContainer.contains(activeElement)) return true\n\n\t\treturn event.target instanceof Node && tableContainer.contains(event.target)\n\t}, [])\n\n\tconst handleCopyAndCut = useCallback(\n\t\tasync (event: ClipboardEvent) => {\n\t\t\tif (!isClipboardTargetActive(event)) return\n\t\t\tif (event.type === \"cut\" && itemValuesAreViewOnly) return\n\t\t\tif (!hasValidSelection || keyboardInteractionBlocked) return\n\n\t\t\tconst snapshot = createRowsAndColumnsSnapshot(rowIds, columnIds, rowIndexById, columnIndexById)\n\n\t\t\tconst copied = await copyCollectionItemTableSelectionToClipboard({\n\t\t\t\tevent,\n\t\t\t\tcollectionNodeId: collectionNode.id,\n\t\t\t\titems: filteredItems,\n\t\t\t\tcolumns,\n\t\t\t\tsnapshot,\n\t\t\t\tselection: {\n\t\t\t\t\tanchor: selection.anchor,\n\t\t\t\t\tfocus: selection.focus,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tif (event.type === \"cut\" && copied) {\n\t\t\t\tdeleteCells(selection.selectedCells)\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tcollectionNode.id,\n\t\t\tcolumns,\n\t\t\tdeleteCells,\n\t\t\thasValidSelection,\n\t\t\titemValuesAreViewOnly,\n\t\t\tisClipboardTargetActive,\n\t\t\tfilteredItems,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\tselection,\n\t\t\trowIds,\n\t\t\tcolumnIds,\n\t\t\trowIndexById,\n\t\t\tcolumnIndexById,\n\t\t],\n\t)\n\n\tconst handlePaste = useCallback(\n\t\tasync (event: ClipboardEvent) => {\n\t\t\tif (!isClipboardTargetActive(event)) return\n\t\t\tif (keyboardInteractionBlocked) return\n\n\t\t\tlet pastedSelection = false\n\t\t\tif (hasValidSelection) {\n\t\t\t\texitAgentSelectionMode()\n\t\t\t\texitMultiSelectionMode()\n\t\t\t\tfinishEditingSession()\n\n\t\t\t\tconst snapshot = createRowsAndColumnsSnapshot(rowIds, columnIds, rowIndexById, columnIndexById)\n\n\t\t\t\tpastedSelection = await pasteCollectionItemTableSelectionFromClipboard({\n\t\t\t\t\tassetUploader: richTextPasteAssetUploader,\n\t\t\t\t\tevent,\n\t\t\t\t\tcollectionNodeId: collectionNode.id,\n\t\t\t\t\titems: filteredItems,\n\t\t\t\t\tcolumns,\n\t\t\t\t\tsnapshot,\n\t\t\t\t\tselection: {\n\t\t\t\t\t\tanchor: selection.anchor,\n\t\t\t\t\t\tfocus: selection.focus,\n\t\t\t\t\t},\n\t\t\t\t\tdataIsViewOnly: itemValuesAreViewOnly,\n\t\t\t\t})\n\t\t\t}\n\t\t\tif (pastedSelection || dataIsViewOnly) return\n\n\t\t\tawait Clipboard.pasteCollections(engine, event, collectionNode.id)\n\t\t},\n\t\t[\n\t\t\tcollectionNode.id,\n\t\t\tcolumns,\n\t\t\tdataIsViewOnly,\n\t\t\texitAgentSelectionMode,\n\t\t\texitMultiSelectionMode,\n\t\t\tfinishEditingSession,\n\t\t\thasValidSelection,\n\t\t\titemValuesAreViewOnly,\n\t\t\tisClipboardTargetActive,\n\t\t\tfilteredItems,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\tselection,\n\t\t\trowIds,\n\t\t\tcolumnIds,\n\t\t\trowIndexById,\n\t\t\tcolumnIndexById,\n\t\t],\n\t)\n\n\tuseCopyAndCutHandler(handleCopyAndCut)\n\tusePasteHandler(handlePaste)\n\n\tconst renderCell = useCallback(\n\t\t({\n\t\t\trowIndex,\n\t\t\tcolumnIndex,\n\t\t\tisRowReorderPreview = false,\n\t\t}: VirtualTableCellPosition & { isRowReorderPreview?: boolean }) => {\n\t\t\tconst item = filteredItems[rowIndex]\n\t\t\tconst column = columns[columnIndex]\n\t\t\tconst columnWidth = getColumnWidth(columnIndex)\n\t\t\tconst cell = item && column ? { rowId: item.id, columnId: column.key } : null\n\t\t\tconst cellKey = cell ? getCellKey(cell) : undefined\n\t\t\tconst isSelected = Boolean(cellKey && selectedCellKeys.has(cellKey))\n\t\t\tconst isSelectionAnchor =\n\t\t\t\tcell !== null && selection.anchor?.rowId === cell.rowId && selection.anchor.columnId === cell.columnId\n\n\t\t\t// Each cell renders borders only on its inner right and bottom edges to avoid double\n\t\t\t// borders between adjacent cells. Therefore, we only need to determine the visibility\n\t\t\t// of those inner right and bottom borders.\n\t\t\tlet showSelectedInnerRightBorder = false\n\t\t\tlet showSelectedInnerBottomBorder = false\n\n\t\t\tif (isSelected && fullSelectionBounds) {\n\t\t\t\tconst innerBorderVisibility = getSelectionInnerBorderVisibility({\n\t\t\t\t\tselectionBounds: fullSelectionBounds,\n\t\t\t\t\trowIndex,\n\t\t\t\t\tcolumnIndex,\n\t\t\t\t})\n\t\t\t\tshowSelectedInnerRightBorder = innerBorderVisibility.showRight\n\t\t\t\tshowSelectedInnerBottomBorder = innerBorderVisibility.showBottom\n\t\t\t}\n\t\t\tconst isRowHighlighted =\n\t\t\t\titem !== undefined &&\n\t\t\t\t(multiSelectedItems?.has(item.id) === true || selectedNodeId === item.id || contextMenuOpenRowId === item.id)\n\t\t\tconst isRowReorderPreviewDraggedRow = isRowReorderPreview && draggedRowId === item?.id\n\t\t\tconst cellEditingSession = cellKey && editingSessionKey === cellKey ? editingSession : null\n\n\t\t\tconst showCollectionItemOverlayButton: boolean =\n\t\t\t\tcolumnIndex === 0 &&\n\t\t\t\thoveredRowId === item?.id &&\n\t\t\t\tshowOverlayButtonsFromMouse &&\n\t\t\t\teditingSession === null &&\n\t\t\t\t!dragMovedToAnotherCell\n\n\t\t\treturn (\n\t\t\t\t<VirtualCollectionItemTableBodyCell\n\t\t\t\t\tcollectionNodeId={collectionNode.id}\n\t\t\t\t\titem={item}\n\t\t\t\t\tcolumn={column}\n\t\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\t\tdataIsViewOnly={itemValuesAreViewOnly}\n\t\t\t\t\tcolumnIndex={columnIndex}\n\t\t\t\t\tstickyColumnCount={stickyColumnCount}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\tisSelectionAnchor={isSelectionAnchor}\n\t\t\t\t\tshowSelectedInnerRightBorder={showSelectedInnerRightBorder}\n\t\t\t\t\tshowSelectedInnerBottomBorder={showSelectedInnerBottomBorder}\n\t\t\t\t\tisRowHighlighted={isRowHighlighted}\n\t\t\t\t\teditingSession={cellEditingSession}\n\t\t\t\t\tisRowReorderPreviewDraggedRow={isRowReorderPreviewDraggedRow}\n\t\t\t\t\tshowCollectionItemOverlayButton={showCollectionItemOverlayButton}\n\t\t\t\t\tonBeginDragSelection={handleBeginDragSelection}\n\t\t\t\t\tonExtendDragSelection={extendDragSelection}\n\t\t\t\t\tonStartEditing={handleStartEditingCell}\n\t\t\t\t\tonEditingValueChange={updateEditingSessionValue}\n\t\t\t\t\tonFinishEditing={cancelEditingSession}\n\t\t\t\t\tonCommitBooleanValue={handleCommitBooleanCellValue}\n\t\t\t\t\tonCommitEditing={finishEditingSession}\n\t\t\t\t\tonToggleCollectionItemOverlay={handleToggleCollectionItemOverlay}\n\t\t\t\t\tonContextMenu={handleRowContextMenu}\n\t\t\t\t/>\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tcancelEditingSession,\n\t\t\tcollectionNode.id,\n\t\t\tselection.anchor,\n\t\t\tcolumns,\n\t\t\tdraggedRowId,\n\t\t\teditingSession,\n\t\t\teditingSessionKey,\n\t\t\textendDragSelection,\n\t\t\thandleBeginDragSelection,\n\t\t\thandleCommitBooleanCellValue,\n\t\t\tfinishEditingSession,\n\t\t\thandleStartEditingCell,\n\t\t\thandleToggleCollectionItemOverlay,\n\t\t\thandleRowContextMenu,\n\t\t\titemValuesAreViewOnly,\n\t\t\tselectedNodeId,\n\t\t\tcontextMenuOpenRowId,\n\t\t\tdragMovedToAnotherCell,\n\t\t\tfullSelectionBounds,\n\t\t\tgetColumnWidth,\n\t\t\thoveredRowId,\n\t\t\tfilteredItems,\n\t\t\tmultiSelectedItems,\n\t\t\tshowOverlayButtonsFromMouse,\n\t\t\tselectedCellKeys,\n\t\t\tstickyColumnCount,\n\t\t\tupdateEditingSessionValue,\n\t\t],\n\t)\n\n\tconst renderSelectionOverlayLayer = useCallback(\n\t\t({\n\t\t\tvisibleRows,\n\t\t\tvisibleColumns,\n\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t}: VirtualTableRenderOverlayLayerOptions) => {\n\t\t\tconst overlayElements: React.ReactElement[] = []\n\t\t\tif (rowReorderPreviewRowIndex !== null && rowReorderPreviewTop !== null) {\n\t\t\t\tfor (let columnIndex = stickyColumnCount; columnIndex < overlayColumnWidths.length; columnIndex++) {\n\t\t\t\t\tconst left = rowHeaderWidth + (overlayColumnLeftOffsets[columnIndex] ?? 0)\n\t\t\t\t\tconst width = overlayColumnWidths[columnIndex] ?? defaultColumnWidth\n\t\t\t\t\toverlayElements.push(\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={`row-sort-preview-scrolling-${columnIndex}`}\n\t\t\t\t\t\t\tclassName={styles.rowReorderPreviewCellContainer}\n\t\t\t\t\t\t\tstyle={{ top: rowReorderPreviewTop, left, width, height: tableRowHeight }}\n\t\t\t\t\t\t\taria-hidden={true}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{renderCell({ rowIndex: rowReorderPreviewRowIndex, columnIndex, isRowReorderPreview: true })}\n\t\t\t\t\t\t</div>,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!visibleRows || !visibleColumns) return overlayElements.length === 0 ? null : overlayElements\n\n\t\t\tconst selectionBounds = getSelectionBounds({\n\t\t\t\tselectedCells: selection.selectedCells,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tincludeColumnIndex: columnIndex => columnIndex >= stickyColumnCount,\n\t\t\t})\n\t\t\tif (\n\t\t\t\tselectionBounds &&\n\t\t\t\tisSelectionPartiallyVisible({\n\t\t\t\t\tbounds: selectionBounds,\n\t\t\t\t\tvisibleRows,\n\t\t\t\t\tvisibleColumns,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tconst selectionRangeRect = getSelectionRangeOverlayRect({\n\t\t\t\t\tbounds: selectionBounds,\n\t\t\t\t\ttableRowHeight,\n\t\t\t\t\trowHeaderWidth,\n\t\t\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t\t\t\tdefaultColumnWidth,\n\t\t\t\t})\n\t\t\t\tconst selectionRangeBounds = fullSelectionBounds ?? selectionBounds\n\t\t\t\tconst { minColumnIndex, maxColumnIndex } = selectionRangeBounds\n\t\t\t\tconst selectionSpansStickyAndScrollingColumns =\n\t\t\t\t\tminColumnIndex < stickyColumnCount && maxColumnIndex >= stickyColumnCount\n\t\t\t\tconst selectionRangeOverlaySeamClassName = selectionSpansStickyAndScrollingColumns\n\t\t\t\t\t? styles.bodyCellSelectionOverlayRangeHideLeftSeam\n\t\t\t\t\t: null\n\t\t\t\toverlayElements.push(\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey=\"selection-range-overlay-scrolling\"\n\t\t\t\t\t\tclassName={cx(styles.bodyCellSelectionOverlayRange, selectionRangeOverlaySeamClassName)}\n\t\t\t\t\t\tstyle={selectionRangeRect}\n\t\t\t\t\t/>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst anchorRect = getSelectionAnchorOverlayRect({\n\t\t\t\tanchorCell: selection.anchor,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tincludeColumnIndex: columnIndex => columnIndex >= stickyColumnCount,\n\t\t\t\tvisibleRows,\n\t\t\t\tvisibleColumns,\n\t\t\t\ttableRowHeight,\n\t\t\t\trowHeaderWidth,\n\t\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t\t\tdefaultColumnWidth,\n\t\t\t})\n\t\t\tif (anchorRect) {\n\t\t\t\toverlayElements.push(\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey=\"selection-anchor-overlay-scrolling\"\n\t\t\t\t\t\tclassName={styles.bodyCellSelectedAnchorOverlay}\n\t\t\t\t\t\tstyle={anchorRect}\n\t\t\t\t\t/>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (overlayElements.length === 0) return null\n\t\t\treturn overlayElements\n\t\t},\n\t\t[\n\t\t\tcolumnIndexById,\n\t\t\tfullSelectionBounds,\n\t\t\trowIndexById,\n\t\t\trowReorderPreviewRowIndex,\n\t\t\trowReorderPreviewTop,\n\t\t\trenderCell,\n\t\t\tselection,\n\t\t\tstickyColumnCount,\n\t\t],\n\t)\n\n\tconst renderStickyColumnBorderOverlayLayer = useCallback(\n\t\t({\n\t\t\tvisibleRows,\n\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t}: VirtualTableRenderOverlayLayerOptions) => {\n\t\t\tif (!visibleRows || !fullSelectionBounds) return null\n\n\t\t\tconst { minColumnIndex, maxColumnIndex, minRowIndex, maxRowIndex } = fullSelectionBounds\n\n\t\t\tconst selectionSpansStickyAndScrollingColumns =\n\t\t\t\tminColumnIndex < stickyColumnCount && maxColumnIndex >= stickyColumnCount\n\t\t\tif (!selectionSpansStickyAndScrollingColumns) return null\n\n\t\t\tconst stickyBoundaryRect = getSelectionStickyBoundaryRect({\n\t\t\t\tbounds: {\n\t\t\t\t\tminRowIndex: fullSelectionBounds.minRowIndex,\n\t\t\t\t\tmaxRowIndex: fullSelectionBounds.maxRowIndex,\n\t\t\t\t\tminColumnIndex: stickyColumnCount - 1,\n\t\t\t\t\tmaxColumnIndex: stickyColumnCount - 1,\n\t\t\t\t},\n\t\t\t\tvisibleRows,\n\t\t\t\ttableRowHeight,\n\t\t\t\trowHeaderWidth: 0,\n\t\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t\t\tdefaultColumnWidth,\n\t\t\t})\n\t\t\tif (!stickyBoundaryRect) return null\n\n\t\t\treturn <div className={styles.bodyCellStickySelectionBoundary} style={stickyBoundaryRect} />\n\t\t},\n\t\t[fullSelectionBounds, stickyColumnCount],\n\t)\n\n\tconst renderStickySelectionOverlayLayer = useCallback(\n\t\t({\n\t\t\tvisibleRows,\n\t\t\tvisibleColumns,\n\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t}: VirtualTableRenderOverlayLayerOptions) => {\n\t\t\tconst overlayElements: React.ReactElement[] = []\n\t\t\tif (stickyColumnCount > 0 && rowReorderPreviewRowIndex !== null && rowReorderPreviewTop !== null) {\n\t\t\t\tfor (let columnIndex = 0; columnIndex < stickyColumnCount; columnIndex++) {\n\t\t\t\t\tconst left = overlayColumnLeftOffsets[columnIndex] ?? 0\n\t\t\t\t\tconst width = overlayColumnWidths[columnIndex] ?? defaultColumnWidth\n\t\t\t\t\toverlayElements.push(\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={`row-sort-preview-sticky-${columnIndex}`}\n\t\t\t\t\t\t\tclassName={styles.rowReorderPreviewCellContainer}\n\t\t\t\t\t\t\tstyle={{ top: rowReorderPreviewTop, left, width, height: tableRowHeight }}\n\t\t\t\t\t\t\taria-hidden={true}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{renderCell({ rowIndex: rowReorderPreviewRowIndex, columnIndex, isRowReorderPreview: true })}\n\t\t\t\t\t\t</div>,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!visibleRows || !visibleColumns) return overlayElements.length === 0 ? null : overlayElements\n\n\t\t\tconst selectionBounds = getSelectionBounds({\n\t\t\t\tselectedCells: selection.selectedCells,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tincludeColumnIndex: columnIndex => columnIndex < stickyColumnCount,\n\t\t\t})\n\t\t\tif (\n\t\t\t\tselectionBounds &&\n\t\t\t\tisSelectionPartiallyVisible({\n\t\t\t\t\tbounds: selectionBounds,\n\t\t\t\t\tvisibleRows,\n\t\t\t\t\tvisibleColumns,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tconst selectionRangeRect = getSelectionRangeOverlayRect({\n\t\t\t\t\tbounds: selectionBounds,\n\t\t\t\t\ttableRowHeight,\n\t\t\t\t\trowHeaderWidth: 0,\n\t\t\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t\t\t\tdefaultColumnWidth,\n\t\t\t\t})\n\t\t\t\tconst selectionRangeBounds = fullSelectionBounds ?? selectionBounds\n\t\t\t\tconst { minColumnIndex, maxColumnIndex } = selectionRangeBounds\n\t\t\t\tconst selectionSpansStickyAndScrollingColumns =\n\t\t\t\t\tminColumnIndex < stickyColumnCount && maxColumnIndex >= stickyColumnCount\n\t\t\t\tconst selectionRangeOverlaySeamClassName = selectionSpansStickyAndScrollingColumns\n\t\t\t\t\t? styles.bodyCellSelectionOverlayRangeHideRightSeam\n\t\t\t\t\t: null\n\t\t\t\toverlayElements.push(\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey=\"selection-range-overlay-sticky\"\n\t\t\t\t\t\tclassName={cx(styles.bodyCellSelectionOverlayRange, selectionRangeOverlaySeamClassName)}\n\t\t\t\t\t\tstyle={selectionRangeRect}\n\t\t\t\t\t/>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst anchorRect = getSelectionAnchorOverlayRect({\n\t\t\t\tanchorCell: selection.anchor,\n\t\t\t\trowIndexById,\n\t\t\t\tcolumnIndexById,\n\t\t\t\tincludeColumnIndex: columnIndex => columnIndex < stickyColumnCount,\n\t\t\t\tvisibleRows,\n\t\t\t\tvisibleColumns,\n\t\t\t\ttableRowHeight,\n\t\t\t\trowHeaderWidth: 0,\n\t\t\t\tcolumnLeftOffsets: overlayColumnLeftOffsets,\n\t\t\t\tcolumnWidths: overlayColumnWidths,\n\t\t\t\tdefaultColumnWidth,\n\t\t\t})\n\t\t\tif (anchorRect) {\n\t\t\t\toverlayElements.push(\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey=\"selection-anchor-overlay-sticky\"\n\t\t\t\t\t\tclassName={styles.bodyCellSelectedAnchorOverlay}\n\t\t\t\t\t\tstyle={anchorRect}\n\t\t\t\t\t/>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (overlayElements.length === 0) return null\n\t\t\treturn overlayElements\n\t\t},\n\t\t[\n\t\t\tcolumnIndexById,\n\t\t\tfullSelectionBounds,\n\t\t\trowIndexById,\n\t\t\trowReorderPreviewRowIndex,\n\t\t\trowReorderPreviewTop,\n\t\t\trenderCell,\n\t\t\tselection,\n\t\t\tstickyColumnCount,\n\t\t],\n\t)\n\n\tconst renderColumnHeader = useCallback(\n\t\t({ columnIndex }: VirtualTableRenderColumnHeaderOptions) => {\n\t\t\tconst isFillerColumn = columnIndex >= columns.length\n\t\t\tif (isFillerColumn) {\n\t\t\t\treturn <div className={cx(styles.columnHeaderCell, styles.columnHeaderCellFiller)} role=\"columnheader\" />\n\t\t\t}\n\n\t\t\tconst column = columns[columnIndex]\n\t\t\tassert(column, \"Column should be defined\")\n\n\t\t\treturn (\n\t\t\t\t<VirtualCollectionItemTableInteractiveColumnHeaderCell\n\t\t\t\t\tcollectionNodeId={collectionNode.id}\n\t\t\t\t\tactiveSortingRules={activeSortingRules}\n\t\t\t\t\tmultiSortEnabled={multiSortEnabled}\n\t\t\t\t\tcolumn={column}\n\t\t\t\t\tcolumnIndex={columnIndex}\n\t\t\t\t\tcolumnWidth={columnWidths[columnIndex] ?? defaultColumnWidth}\n\t\t\t\t\tresizeCursor={getColumnResizeCursor({\n\t\t\t\t\t\tcurrentWidth: columnWidths[columnIndex] ?? defaultColumnWidth,\n\t\t\t\t\t\tcolumnWidths,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\tvisibleColumns: columns,\n\t\t\t\t\t\tstickyColumnCount,\n\t\t\t\t\t\ttableViewportWidth,\n\t\t\t\t\t\trowHeaderWidth,\n\t\t\t\t\t\tfillerColumnMinWidth,\n\t\t\t\t\t})}\n\t\t\t\t\tdataIsViewOnly={itemValuesAreViewOnly}\n\t\t\t\t\tcolumnReorderingEnabled={columnReorderingEnabled}\n\t\t\t\t\tisDragInteractionInProgress={isRowReordering || isColumnReordering || isColumnResizing}\n\t\t\t\t\tisDraggedColumn={draggedColumnId === column.key}\n\t\t\t\t\ttableContainerRef={tableContainerRef}\n\t\t\t\t\ttoggleVisibility={toggleVisibility}\n\t\t\t\t\tclearCellSelectionForRowSelection={clearCellSelectionForRowSelection}\n\t\t\t\t\tstartColumnReorderDrag={startColumnReorderDrag}\n\t\t\t\t\tstartColumnResize={startColumnResize}\n\t\t\t\t/>\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tactiveSortingRules,\n\t\t\tclearCellSelectionForRowSelection,\n\t\t\tcollectionNode,\n\t\t\tcolumns,\n\t\t\tcolumnReorderingEnabled,\n\t\t\tcolumnWidths,\n\t\t\tdraggedColumnId,\n\t\t\titemValuesAreViewOnly,\n\t\t\tisColumnResizing,\n\t\t\tisColumnReordering,\n\t\t\tisRowReordering,\n\t\t\tmultiSortEnabled,\n\t\t\tstartColumnResize,\n\t\t\tstartColumnReorderDrag,\n\t\t\tstickyColumnCount,\n\t\t\ttableViewportWidth,\n\t\t\ttoggleVisibility,\n\t\t],\n\t)\n\n\tconst handleRowReorderHandleMouseDown = useCallback(\n\t\t(rowId: NodeID, event: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (event.button !== 0) return\n\t\t\tif (!rowReorderingEnabled) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tclearCellSelectionForRowSelection()\n\t\t\tstartRowReorderDrag(rowId, event.clientY)\n\t\t},\n\t\t[clearCellSelectionForRowSelection, rowReorderingEnabled, startRowReorderDrag],\n\t)\n\n\tconst renderRowHeader = useCallback(\n\t\t({ rowIndex }: VirtualTableRenderRowHeaderOptions) => {\n\t\t\tconst rowId = filteredItems[rowIndex]?.id\n\t\t\tconst isSelected = rowId ? multiSelectedItems?.has(rowId) === true : false\n\t\t\tconst isHighlighted = isSelected || rowId === selectedNodeId || rowId === contextMenuOpenRowId\n\t\t\tconst rowTitle = (rowIndex + 1).toLocaleString()\n\t\t\tconst isDraggedRow = rowId ? draggedRowId === rowId : false\n\t\t\tconst rowHeaderControlsEnabled = !dataIsViewOnly && !hasOpenPopoverEditor\n\t\t\treturn (\n\t\t\t\t<VirtualCollectionItemTableRowHeaderCell\n\t\t\t\t\trowId={rowId}\n\t\t\t\t\trowTitle={rowTitle}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\tisHighlighted={isHighlighted}\n\t\t\t\t\tisDraggedRow={isDraggedRow}\n\t\t\t\t\trowReorderingEnabled={rowReorderingEnabled}\n\t\t\t\t\tcontrolsEnabled={rowHeaderControlsEnabled}\n\t\t\t\t\tonRowReorderHandleMouseDown={handleRowReorderHandleMouseDown}\n\t\t\t\t\tonRowCheckboxClick={handleRowCheckboxClick}\n\t\t\t\t\tonContextMenu={handleRowContextMenu}\n\t\t\t\t/>\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tcontextMenuOpenRowId,\n\t\t\tdataIsViewOnly,\n\t\t\tdraggedRowId,\n\t\t\thandleRowCheckboxClick,\n\t\t\thandleRowContextMenu,\n\t\t\thandleRowReorderHandleMouseDown,\n\t\t\thasOpenPopoverEditor,\n\t\t\tfilteredItems,\n\t\t\tmultiSelectedItems,\n\t\t\tselectedNodeId,\n\t\t\trowReorderingEnabled,\n\t\t],\n\t)\n\n\tconst renderRowHeaderOverlayLayer = useCallback(\n\t\t(_: VirtualTableRenderOverlayLayerOptions) => {\n\t\t\tif (rowReorderPreviewRowIndex === null || rowReorderPreviewTop === null) return null\n\n\t\t\tconst previewRowId = filteredItems[rowReorderPreviewRowIndex]?.id\n\t\t\tconst previewRowTitle = (rowReorderPreviewRowIndex + 1).toLocaleString()\n\t\t\tconst isPreviewSelected = previewRowId ? multiSelectedItems?.has(previewRowId) === true : false\n\t\t\tconst isPreviewHighlighted = isPreviewSelected || previewRowId === selectedNodeId\n\t\t\tconst isPreviewDraggedRow = previewRowId ? draggedRowId === previewRowId : false\n\t\t\tconst rowHeaderControlsEnabled = !dataIsViewOnly && !hasOpenPopoverEditor\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclassName={styles.rowReorderPreviewRowHeaderContainer}\n\t\t\t\t\tstyle={{ top: rowReorderPreviewTop, left: 0, width: rowHeaderWidth, height: tableRowHeight }}\n\t\t\t\t\taria-hidden={true}\n\t\t\t\t>\n\t\t\t\t\t<VirtualCollectionItemTableRowHeaderCell\n\t\t\t\t\t\tisDragPreview\n\t\t\t\t\t\trowId={previewRowId}\n\t\t\t\t\t\trowTitle={previewRowTitle}\n\t\t\t\t\t\tisSelected={isPreviewSelected}\n\t\t\t\t\t\tisHighlighted={isPreviewHighlighted}\n\t\t\t\t\t\tisDraggedRow={isPreviewDraggedRow}\n\t\t\t\t\t\trowReorderingEnabled={rowReorderingEnabled}\n\t\t\t\t\t\tcontrolsEnabled={rowHeaderControlsEnabled}\n\t\t\t\t\t\tonRowReorderHandleMouseDown={handleRowReorderHandleMouseDown}\n\t\t\t\t\t\tonRowCheckboxClick={handleRowCheckboxClick}\n\t\t\t\t\t\tonContextMenu={undefined}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tdataIsViewOnly,\n\t\t\tdraggedRowId,\n\t\t\thandleRowCheckboxClick,\n\t\t\thandleRowReorderHandleMouseDown,\n\t\t\thasOpenPopoverEditor,\n\t\t\tfilteredItems,\n\t\t\tmultiSelectedItems,\n\t\t\tselectedNodeId,\n\t\t\trowReorderPreviewRowIndex,\n\t\t\trowReorderPreviewTop,\n\t\t\trowReorderingEnabled,\n\t\t],\n\t)\n\n\tconst renderCornerCell = useCallback(() => {\n\t\tconst cornerCheckboxEnabled = !dataIsViewOnly && !hasOpenPopoverEditor && rowCount > 0\n\t\treturn (\n\t\t\t<div className={styles.cornerCell}>\n\t\t\t\t<CheckBox\n\t\t\t\t\tid=\"virtual-cms-select-all-rows\"\n\t\t\t\t\tvalue={allVisibleRowsCheckboxState}\n\t\t\t\t\tonChange={handleAllRowsCheckboxChange}\n\t\t\t\t\tenabled={cornerCheckboxEnabled}\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tclassName={styles.cornerCheckbox}\n\t\t\t\t\ttitle=\"Select all rows\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t}, [allVisibleRowsCheckboxState, dataIsViewOnly, handleAllRowsCheckboxChange, hasOpenPopoverEditor, rowCount])\n\n\tconst draggedColumnKey = draggedColumnIndex !== null ? columns[draggedColumnIndex]?.key : undefined\n\tconst columnReorderPreviewSortingOrder =\n\t\tdraggedColumnKey === undefined ? undefined : sortingOrderByColumnId.get(draggedColumnKey)\n\n\treturn (\n\t\t<div className={cx(styles.container, appPointerEvents)} {...{ [dataIsCollectionTableDataAttribute]: \"true\" }}>\n\t\t\t<div className={styles.tableWithSidePanel}>\n\t\t\t\t<div className={styles.tableColumn}>\n\t\t\t\t\t<VirtualCollectionItemTableToolbar\n\t\t\t\t\t\tcollectionNode={collectionNode}\n\t\t\t\t\t\trawSearchTerm={rawSearchTerm}\n\t\t\t\t\t\tactiveFilters={activeFilters}\n\t\t\t\t\t\tmultiSelectedItems={multiSelectedItems}\n\t\t\t\t\t\tkeyboardInteractionBlocked={keyboardInteractionBlocked}\n\t\t\t\t\t\tsearchShortcutBlocked={searchShortcutBlocked}\n\t\t\t\t\t\tvisibilityOptions={visibilityOptions}\n\t\t\t\t\t\tdataIsViewOnly={dataIsViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t\t{filteredItems.length > 0 && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={mergedTableContainerRef}\n\t\t\t\t\t\t\tclassName={styles.tableContainer}\n\t\t\t\t\t\t\ttabIndex={getVirtualCollectionItemTableContainerTabIndex({\n\t\t\t\t\t\t\t\tkeyboardInteractionBlocked,\n\t\t\t\t\t\t\t\thasEditingSession: editingSession !== null,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t// biome-ignore lint/a11y/useSemanticElements: This is a virtualized grid, not a semantic table element.\n\t\t\t\t\t\t\trole=\"grid\"\n\t\t\t\t\t\t\taria-rowcount={rowCount}\n\t\t\t\t\t\t\taria-colcount={columnWidths.length}\n\t\t\t\t\t\t\taria-multiselectable={true}\n\t\t\t\t\t\t\tonFocus={handleTableFocus}\n\t\t\t\t\t\t\tonBlur={handleTableBlur}\n\t\t\t\t\t\t\tonMouseDownCapture={handleTableMouseDownCapture}\n\t\t\t\t\t\t\tonMouseLeave={() => setHoveredRowId(null)}\n\t\t\t\t\t\t\tonMouseMove={handleTableMouseMove}\n\t\t\t\t\t\t\tonKeyDown={handleTableKeyDown}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VirtualTable\n\t\t\t\t\t\t\t\tcontainOverscroll\n\t\t\t\t\t\t\t\tclassName={styles.table}\n\t\t\t\t\t\t\t\t// Prevent Chrome from treating the scrollable viewport as an extra tab stop\n\t\t\t\t\t\t\t\t// after the grid hands focus back to native tab order at the boundary.\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\tscrollRef={mergedTableScrollRef}\n\t\t\t\t\t\t\t\ttableRef={virtualTableRef}\n\t\t\t\t\t\t\t\trowCount={rowCount}\n\t\t\t\t\t\t\t\tcolumnCount={columnWidths.length}\n\t\t\t\t\t\t\t\trowHeight={tableRowHeight}\n\t\t\t\t\t\t\t\tgetColumnWidthForIndex={getColumnWidth}\n\t\t\t\t\t\t\t\tgetRowId={getRowId}\n\t\t\t\t\t\t\t\tgetColumnId={getColumnId}\n\t\t\t\t\t\t\t\tstickyColumnCount={stickyColumnCount}\n\t\t\t\t\t\t\t\trowHeaderWidth={rowHeaderWidth}\n\t\t\t\t\t\t\t\tcolumnHeaderHeight={tableRowHeight}\n\t\t\t\t\t\t\t\toverscanRowCount={4}\n\t\t\t\t\t\t\t\toverscanColumnCount={2}\n\t\t\t\t\t\t\t\tbottomPadding={selectionScrollPaddingY}\n\t\t\t\t\t\t\t\tshowScrollbar={true}\n\t\t\t\t\t\t\t\trenderCell={renderCell}\n\t\t\t\t\t\t\t\trenderOverlayLayer={renderSelectionOverlayLayer}\n\t\t\t\t\t\t\t\trenderStickyOverlayLayer={renderStickySelectionOverlayLayer}\n\t\t\t\t\t\t\t\trenderStickyColumnBorderOverlayLayer={renderStickyColumnBorderOverlayLayer}\n\t\t\t\t\t\t\t\trenderRowHeaderOverlayLayer={renderRowHeaderOverlayLayer}\n\t\t\t\t\t\t\t\tshowCornerRightBorder={stickyColumnCount === 0 && isHorizontallyScrolled}\n\t\t\t\t\t\t\t\tshowStickyColumnHeaderBoundary={isHorizontallyScrolled}\n\t\t\t\t\t\t\t\trenderColumnHeader={renderColumnHeader}\n\t\t\t\t\t\t\t\trenderRowHeader={renderRowHeader}\n\t\t\t\t\t\t\t\trenderCornerCell={renderCornerCell}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{rowReorderInsertionIndicatorTop !== null && (\n\t\t\t\t\t\t\t\t<div className={styles.rowReorderInsertionIndicatorLayer} aria-hidden={true}>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName={styles.rowReorderInsertionIndicator}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\ttop: rowReorderInsertionIndicatorTop - rowReorderInsertionIndicatorOffset,\n\t\t\t\t\t\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isColumnReordering && columnReorderPreviewLeft !== null && columnReorderPreviewWidth !== null && (\n\t\t\t\t\t\t\t\t<div className={styles.columnReorderPreviewLayer} aria-hidden={true}>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName={styles.columnReorderPreviewCell}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\t\t\t\tleft: columnReorderPreviewLeft,\n\t\t\t\t\t\t\t\t\t\t\twidth: columnReorderPreviewWidth,\n\t\t\t\t\t\t\t\t\t\t\theight: tableRowHeight,\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<VirtualCollectionItemTableColumnHeaderCell\n\t\t\t\t\t\t\t\t\t\t\ttitle={columnReorderPreviewTitle ?? \"\"}\n\t\t\t\t\t\t\t\t\t\t\tisSorted={columnReorderPreviewSortingOrder !== undefined}\n\t\t\t\t\t\t\t\t\t\t\tsortingOrder={columnReorderPreviewSortingOrder}\n\t\t\t\t\t\t\t\t\t\t\tisActive={false}\n\t\t\t\t\t\t\t\t\t\t\tisReadOnly={\n\t\t\t\t\t\t\t\t\t\t\t\tdraggedColumnIndex === null ||\n\t\t\t\t\t\t\t\t\t\t\t\t!columns[draggedColumnIndex]?.isValueEditable ||\n\t\t\t\t\t\t\t\t\t\t\t\titemValuesAreViewOnly\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t{draggedColumnIndex !== null && columnReorderPreviewRows && (\n\t\t\t\t\t\t\t\t\t\t<div className={styles.columnReorderPreviewBodyLayer}>\n\t\t\t\t\t\t\t\t\t\t\t{columnReorderPreviewRows.rowIndices.map(rowIndex => (\n\t\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={`column-sort-preview-row-${rowIndex}`}\n\t\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles.columnReorderPreviewCell}\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttop: rowIndex * tableRowHeight - columnReorderPreviewRows.scrollTop,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tleft: columnReorderPreviewLeft,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth: columnReorderPreviewWidth,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theight: tableRowHeight,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{renderCell({ rowIndex, columnIndex: draggedColumnIndex })}\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{columnReorderInsertionIndicatorLeft !== null && (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.columnReorderInsertionIndicator}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tleft: columnReorderInsertionIndicatorLeft - columnReorderInsertionIndicatorOffset,\n\t\t\t\t\t\t\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{filteredItems.length === 0 && (\n\t\t\t\t\t\t<Stack className={styles.emptyStateContainer}>\n\t\t\t\t\t\t\t<NoItemsEmptyState searchFilterActive={isFilterActive} collectionNode={collectionNode} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t{showAgentChatPanel && !agentChatPanelIsOwnedByOverlay && (\n\t\t\t\t\t<CmsAgentChatPanel\n\t\t\t\t\t\tcollectionId={collectionNode.id}\n\t\t\t\t\t\tcollectionName={collectionName}\n\t\t\t\t\t\tselectedCells={selection.selectedCells}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{interactionCursor && (\n\t\t\t\t<div className={styles.tableInteractionCursorLayer} style={{ cursor: interactionCursor }} aria-hidden={true} />\n\t\t\t)}\n\t\t</div>\n\t)\n})\n\nfunction getInteractionCursor({\n\tinteractionState,\n\tcolumns,\n\tcolumnWidths,\n\tstickyColumnCount,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tfillerColumnMinWidth,\n}: {\n\tinteractionState: VirtualGridInteractionState\n\tcolumns: readonly CollectionItemTableColumn[]\n\tcolumnWidths: readonly number[]\n\tstickyColumnCount: number\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tfillerColumnMinWidth: number\n}): React.CSSProperties[\"cursor\"] | null {\n\tswitch (interactionState.kind) {\n\t\tcase \"rowReorder\":\n\t\tcase \"columnReorder\":\n\t\t\treturn \"grabbing\"\n\t\tcase \"columnResize\": {\n\t\t\treturn getColumnResizeCursor({\n\t\t\t\tcurrentWidth: interactionState.columnResize.currentWidth,\n\t\t\t\tcolumnWidths,\n\t\t\t\tcolumnIndex: interactionState.columnResize.sourceColumnIndex,\n\t\t\t\tvisibleColumns: columns,\n\t\t\t\tstickyColumnCount,\n\t\t\t\ttableViewportWidth,\n\t\t\t\trowHeaderWidth,\n\t\t\t\tfillerColumnMinWidth,\n\t\t\t})\n\t\t}\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n", "import { assert, getLogger } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { isContentNode } from \"document/models/CanvasTree/nodes/TreeNode.ts\"\nimport { isCollectionItemNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { isExternalPluginManifestId, isLocalDevelopmentPluginManifestId } from \"./pluginManifestValidation.ts\"\nimport { getDefaultDevelopmentPluginManifest, promptForPluginURL } from \"./utils/getDefaultDevelopmentPluginManifest.ts\"\n\nconst logger = getLogger(\"plugins\")\n\nexport function editCollectionUsingPlugin(\n\tengine: VekterEngine,\n\tcollection: CollectionNode,\n\tmode: Extract<Mode, \"syncManagedCollection\" | \"configureManagedCollection\">,\n) {\n\tassert(collection.managedByPlugin, \"Collection is not managed by a plugin\")\n\n\tconst { pluginStore, selectionStore } = engine.stores\n\n\tassert(selectionStore.nodes.length === 1, \"Expected a single node to be selected\")\n\tconst [selectedNode] = selectionStore.nodes\n\tassert(isContentNode(selectedNode))\n\n\tif (isCollectionItemNode(selectedNode)) {\n\t\tassert(selectedNode.parentid, \"Expected a collection item to be selected\")\n\t\tselectionStore.set(selectedNode.parentid)\n\t}\n\n\tconst pluginManifest = pluginStore.manifestById.get(collection.managedByPlugin)\n\tif (pluginManifest) {\n\t\tvoid pluginStore.openPlugin(pluginManifest, engine, { mode })\n\t\treturn\n\t}\n\n\tif (isExternalPluginManifestId(collection.managedByPlugin)) {\n\t\tpromptForPluginURL(engine, \"collection_table\", loadedPluginManifest => {\n\t\t\tvoid pluginStore.openPlugin(loadedPluginManifest, engine, { mode })\n\t\t})\n\n\t\treturn\n\t}\n\n\tif (isLocalDevelopmentPluginManifestId(collection.managedByPlugin)) {\n\t\tgetDefaultDevelopmentPluginManifest(engine, \"collection_table\", developmentManifest => {\n\t\t\tvoid pluginStore.openPlugin(developmentManifest, engine, { mode })\n\t\t})\n\t\treturn\n\t}\n\n\tlogger.reportError(\"Could not find Plugin for collection\", {\n\t\tpluginId: collection.managedByPlugin,\n\t})\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"error\",\n\t\tkey: \"failed-to-edit-collection\",\n\t\tprimaryText: \"Failed to find plugin.\",\n\t\tsecondaryText: \"Possibly deleted.\",\n\t\ticon: \"error\",\n\t})\n}\n", "import \"NoItemsEmptyState.styles_1a8rrf6.wyw.css\"; export const iconBackground = \"iconBackground_ixvublg\";\nexport const button = \"button_bvdztuv\";", "import { HandleClickOnClick, buttonIsLeftClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, EmptyState, type EmptyStateProps } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useSelectedCollectionId } from \"document/utils/useSelectedCollectionId.ts\"\nimport { editCollectionUsingPlugin } from \"plugins/editCollectionUsingPlugin.ts\"\nimport { isApiManagedCollection } from \"plugins/plugins.ts\"\nimport { createCollectionItemWhenReady } from \"utils/createCollectionItem.ts\"\nimport { Pages } from \"web/lib/tracker.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getNoSearchResultProps } from \"../shared/utils/getNoSearchResultProps.ts\"\nimport * as styles from \"./NoItemsEmptyState.styles.ts\"\n\nfunction Icon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" aria-hidden=\"true\" className={styles.iconBackground}>\n\t\t\t<path d=\"M7 9a2 2 0 1 1 4 0 2 2 0 1 1-4 0Z\" fill=\"currentColor\" />\n\t\t\t<path d=\"M13 9c0-.6.4-1 1-1h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1-1-1Z\" fill=\"currentColor\" opacity=\".6\" />\n\t\t\t<path d=\"M7 15a2 2 0 1 1 4 0 2 2 0 1 1-4 0Z\" fill=\"currentColor\" />\n\t\t\t<path d=\"M13 15c0-.6.4-1 1-1h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1-1-1Z\" fill=\"currentColor\" opacity=\".6\" />\n\t\t\t<path d=\"M7 21a2 2 0 1 1 4 0 2 2 0 1 1-4 0Z\" fill=\"currentColor\" />\n\t\t\t<path d=\"M13 21c0-.6.4-1 1-1h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1-1-1Z\" fill=\"currentColor\" opacity=\".6\" />\n\t\t</svg>\n\t)\n}\n\nfunction useHasNewCollectionItemOverlayOpen() {\n\treturn useEngineState(\n\t\t() => {\n\t\t\treturn engine.stores.contentManagementStore.hasAnyPrivateDraftCollectionItem()\n\t\t},\n\t\t[],\n\t\t[engine.stores.chromeStore],\n\t)\n}\n\ninterface Props {\n\tsearchFilterActive: boolean\n\tcollectionNode: CollectionNode\n}\n\nexport function NoItemsEmptyState({ searchFilterActive, collectionNode }: Props) {\n\tconst dataIsViewOnly = useIsViewOnly(\"canEditContent\")\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst selectedCollectionId = useSelectedCollectionId()\n\n\tconst hasNewCollectionItemOverlayOpen = useHasNewCollectionItemOverlayOpen()\n\n\tconst canEditContent = !dataIsViewOnly && Boolean(selectedCollectionId)\n\n\tlet emptyStateProps: EmptyStateProps = {\n\t\ticon: <Icon />,\n\t\tbody: undefined,\n\t}\n\n\tif (searchFilterActive) {\n\t\temptyStateProps = getNoSearchResultProps()\n\t} else if (collectionNode.managedByPlugin && isApiManagedCollection(collectionNode)) {\n\t\temptyStateProps.body = \"Your collection is empty.\\nSync through the API to get started.\"\n\t} else if (collectionNode.managedByPlugin) {\n\t\temptyStateProps.body = \"Your collection is empty. \\n Sync to get started.\"\n\t\temptyStateProps.button = (\n\t\t\t<HandleClickOnClick>\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\ttitle=\"Sync\"\n\t\t\t\t\tenabled={canEditContent}\n\t\t\t\t\tvariant=\"withDepthPrimary\"\n\t\t\t\t\tclassName={styles.button}\n\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\tif (!buttonIsLeftClick(event.button)) return\n\n\t\t\t\t\t\teditCollectionUsingPlugin(engine, collectionNode, \"configureManagedCollection\")\n\t\t\t\t\t}}\n\t\t\t\t\tonClick={event => {\n\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</HandleClickOnClick>\n\t\t)\n\t} else {\n\t\temptyStateProps.icon = null\n\t\temptyStateProps.title = \"No Items\"\n\t\temptyStateProps.body = \"Your collection is empty. Add an item to get started.\"\n\t\temptyStateProps.button = (\n\t\t\t<HandleClickOnClick>\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\ttitle={Dictionary.NewItem}\n\t\t\t\t\tenabled={canEditContent && !hasNewCollectionItemOverlayOpen}\n\t\t\t\t\tvariant={agentExperimentEnabled ? \"default\" : \"withDepthPrimary\"}\n\t\t\t\t\tclassName={styles.button}\n\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\tif (!buttonIsLeftClick(event.button)) return\n\n\t\t\t\t\t\tcreateCollectionItemWhenReady({\n\t\t\t\t\t\t\tcollectionId: collectionNode.id,\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tsource: Pages.collectionPanel,\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t\tonClick={event => {\n\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</HandleClickOnClick>\n\t\t)\n\t}\n\n\treturn (\n\t\t<EmptyState\n\t\t\tcenter\n\t\t\ticonColor={colors.tint}\n\t\t\ticonLarge\n\t\t\tmaxBodyWidth={160}\n\t\t\tfullWidthButton={false}\n\t\t\t{...emptyStateProps}\n\t\t/>\n\t)\n}\n", "import type { VirtualTableCellPosition, VirtualTableGetCellFromClientPointOptions } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface Options {\n\tclientX: number\n\tclientY: number\n\titems: readonly { id: NodeID }[]\n\tcolumns: readonly { key: ColumnKey }[]\n\tgetCellPositionFromClientPoint: (\n\t\toptions: VirtualTableGetCellFromClientPointOptions,\n\t) => VirtualTableCellPosition | null\n}\n\nexport function getCellIdentifierFromClientPoint({\n\tclientX,\n\tclientY,\n\titems,\n\tcolumns,\n\tgetCellPositionFromClientPoint,\n}: Options): CellIdentifier | null {\n\tif (items.length === 0 || columns.length === 0) return null\n\n\tconst cellPosition = getCellPositionFromClientPoint({\n\t\tclientX,\n\t\tclientY,\n\t\tclampToGrid: true,\n\t})\n\tif (!cellPosition) return null\n\n\tconst rowIndex = Math.max(0, Math.min(items.length - 1, cellPosition.rowIndex))\n\tconst row = items[rowIndex]\n\tif (!row) return null\n\n\tconst columnIndex = Math.max(0, Math.min(columns.length - 1, cellPosition.columnIndex))\n\tconst column = columns[columnIndex]\n\tif (!column) return null\n\n\treturn {\n\t\trowId: row.id,\n\t\tcolumnId: column.key,\n\t}\n}\n", "import type { VirtualTableScrollToCellOptions } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { SelectionAutoScrollBehavior } from \"./useVirtualGridCellSelection.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface EnsureCellVisiblePlan {\n\tscrollToCellOptions: Required<VirtualTableScrollToCellOptions>\n\tshouldResetScrollLeft: boolean\n}\n\ninterface GetEnsureCellVisiblePlanOptions {\n\tcell: CellIdentifier\n\tselectionAutoScrollBehavior: SelectionAutoScrollBehavior\n\trowIndexById: ReadonlyMap<NodeID, number>\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n\tstickyColumnCount: number\n\tselectionScrollPaddingY: number\n\tselectionScrollPaddingX: number\n\tcurrentScrollLeft: number\n}\n\nexport function getEnsureCellVisiblePlan({\n\tcell,\n\tselectionAutoScrollBehavior,\n\trowIndexById,\n\tcolumnIndexById,\n\tstickyColumnCount,\n\tselectionScrollPaddingY,\n\tselectionScrollPaddingX,\n\tcurrentScrollLeft,\n}: GetEnsureCellVisiblePlanOptions): EnsureCellVisiblePlan | null {\n\tif (selectionAutoScrollBehavior === \"none\") return null\n\n\tconst rowIndex = rowIndexById.get(cell.rowId)\n\tconst columnIndex = columnIndexById.get(cell.columnId)\n\tif (rowIndex === undefined || columnIndex === undefined) return null\n\n\tconst isStickyColumn = columnIndex < stickyColumnCount\n\treturn {\n\t\tscrollToCellOptions: {\n\t\t\trowIndex,\n\t\t\tcolumnIndex,\n\t\t\talign: \"nearest\",\n\t\t\tpaddingY: selectionScrollPaddingY,\n\t\t\tpaddingX: isStickyColumn ? 0 : selectionScrollPaddingX,\n\t\t},\n\t\tshouldResetScrollLeft: isStickyColumn && selectionAutoScrollBehavior === \"keyboard\" && currentScrollLeft !== 0,\n\t}\n}\n", "import { assertNever, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { StringVariableDefinition, VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isStringVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isLinkToURL } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport {\n\tgetCollectionReferenceControlPropValue,\n\tgetColorControlPropValue,\n\tgetControlProp,\n\tgetDateControlPropValue,\n\tgetEnumControlPropValue,\n\tgetFileControlPropValue,\n\tgetLinkControlPropValue,\n\tgetMultiCollectionReferenceControlPropValue,\n\tgetNumberControlPropValue,\n\tgetRichTextControlPropValue,\n\tgetVectorSetItemControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport type {\n\tRichTextBlock,\n\tRichTextInline,\n\tRichTextListItem,\n\tRichTextTableCell,\n\tRichTextTableRow,\n} from \"document/models/richText/RichTextDocument.ts\"\nimport { isRichTextDocument } from \"document/models/richText/richTextStorage.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getCollectionItemName } from \"utils/collectionUtils.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getHTMLTextContentPreservingNewLinesCached } from \"utils/getHTMLTextContent.ts\"\nimport { getValidDate } from \"utils/getValidDate.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { vectorInfoForIdentifier } from \"utils/vectorSets.ts\"\nimport { getFileDisplayValue as getFileCellDisplayValue } from \"./fileCellDisplayInfo.ts\"\nimport type { ColumnControl } from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionItemTableStatusValue,\n\tisCollectionItemTableStatusColumn,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\nimport { getAssociatedVariableStringValue } from \"./utils/getAssociatedVariableStringValue.ts\"\n\ninterface VirtualCollectionItemTableTextColumn {\n\tcontrol: ColumnControl\n\tgetControlProp: (item: unknown) => unknown\n\tkey: string\n\tvariable: VariableDefinition | null\n}\n\ninterface BasedOnStringVariableInfo {\n\tcollection: CollectionNode\n\tvariable: StringVariableDefinition\n}\n\ninterface CellTextValueInfo {\n\tplainTextValue: string\n\tisInheritedValue: boolean\n}\n\nconst whitespaceCharacterPattern = /\\s/u\nconst whitespaceSequencePattern = /\\s+/gu\nconst sentenceClosingCharacters = new Set(['\"', \"'\", \")\", \"]\", \"}\", \"\\u2019\", \"\\u201d\"])\n\nexport function getStringControlPropOverrideValue(controlProp: unknown): string | undefined {\n\tif (!isRawControlProp(controlProp) || controlProp.type !== ControlType.String || !isString(controlProp.value)) {\n\t\treturn\n\t}\n\n\treturn controlProp.value\n}\n\nexport function getBasedOnStringVariableInfo(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\titem: CollectionItemNode,\n): BasedOnStringVariableInfo | null {\n\tif (column.control.type !== ControlType.String) return null\n\n\treturn getBasedOnStringVariableInfoForVariable(column.variable, item)\n}\n\nfunction getBasedOnStringVariableInfoForVariable(\n\tvariable: VariableDefinition | null,\n\titem: CollectionItemNode,\n): BasedOnStringVariableInfo | null {\n\tconst collection = engine.tree.getParent(item.id)\n\tif (!isCollectionNode(collection)) return null\n\n\tif (!variable || !isStringVariableDefinition(variable) || variable.fallbackValue !== \"associatedVariable\") {\n\t\treturn null\n\t}\n\n\treturn { collection, variable }\n}\n\nfunction formatDateForTableCell(dateString: string, includeTime: boolean): string {\n\tconst date = getValidDate(dateString)\n\tif (!date) return \"\"\n\n\treturn date.toLocaleString(undefined, {\n\t\ttimeZone: \"UTC\",\n\t\tdateStyle: \"short\",\n\t\ttimeStyle: includeTime ? \"short\" : undefined,\n\t})\n}\n\nfunction getEnumDisplayValue(column: VirtualCollectionItemTableTextColumn, controlProp: unknown): string {\n\tif (column.control.type !== ControlType.Enum) return \"\"\n\n\tconst value = getEnumControlPropValue(column.control, controlProp)\n\tif (isDynamicValue(value) || value === null || value === undefined) return \"\"\n\n\tif (column.control.optionTitles) {\n\t\tconst optionIndex = column.control.options.findIndex(option => option === value)\n\t\tif (optionIndex >= 0) {\n\t\t\treturn column.control.optionTitles[optionIndex] ?? fallbackTitleForOption(value)\n\t\t}\n\t}\n\n\treturn fallbackTitleForOption(value)\n}\n\nfunction isWhitespaceCharacter(character: string): boolean {\n\treturn whitespaceCharacterPattern.test(character)\n}\n\nfunction hasNonWhitespaceInRange(text: string, startIndex: number, endIndex: number): boolean {\n\tfor (let index = startIndex; index < endIndex; index++) {\n\t\tconst character = text[index]\n\t\tif (character && !isWhitespaceCharacter(character)) return true\n\t}\n\n\treturn false\n}\n\nfunction normalizeRichTextPreviewText(text: string): string {\n\treturn text.replace(whitespaceSequencePattern, \" \").trim()\n}\n\nfunction getFirstSentenceBoundary(text: string): number | null {\n\tfor (let index = 0; index < text.length; index++) {\n\t\tconst character = text[index]\n\t\tif (character !== \".\" && character !== \"!\" && character !== \"?\" && character !== \"\\u2026\") continue\n\n\t\tlet boundaryIndex = index + 1\n\t\twhile (boundaryIndex < text.length) {\n\t\t\tconst boundaryCharacter = text[boundaryIndex]\n\t\t\tif (!boundaryCharacter || !sentenceClosingCharacters.has(boundaryCharacter)) break\n\t\t\tboundaryIndex++\n\t\t}\n\n\t\tconst boundaryCharacter = text[boundaryIndex]\n\t\tif (boundaryIndex === text.length || (boundaryCharacter && isWhitespaceCharacter(boundaryCharacter))) {\n\t\t\treturn boundaryIndex\n\t\t}\n\t}\n\n\treturn null\n}\n\nfunction getFirstSentencePreview(text: string): string {\n\tconst normalizedText = normalizeRichTextPreviewText(text)\n\tif (!normalizedText) return \"\"\n\n\tconst sentenceBoundary = getFirstSentenceBoundary(normalizedText)\n\tif (sentenceBoundary === null) return normalizedText\n\treturn normalizedText.slice(0, sentenceBoundary).trim()\n}\n\nfunction getTextFromRichTextInline(inline: RichTextInline): string {\n\tswitch (inline.type) {\n\t\tcase \"text\":\n\t\t\treturn inline.text\n\t\tcase \"lineBreak\":\n\t\t\treturn \"\\n\"\n\t\tdefault:\n\t\t\treturn assertNever(inline)\n\t}\n}\n\nfunction getFirstNonEmptyTextFromBlocks(blocks: readonly RichTextBlock[]): string {\n\tfor (const block of blocks) {\n\t\tconst blockText = getTextFromRichTextBlock(block)\n\t\tconst normalizedBlockText = normalizeRichTextPreviewText(blockText)\n\t\tif (normalizedBlockText) return normalizedBlockText\n\t}\n\n\treturn \"\"\n}\n\nfunction getTextFromRichTextListItem(item: RichTextListItem): string {\n\treturn getFirstNonEmptyTextFromBlocks(item.children)\n}\n\nfunction getTextFromRichTextTableCell(cell: RichTextTableCell): string {\n\treturn getFirstNonEmptyTextFromBlocks(cell.children)\n}\n\nfunction getTextFromRichTextTableRow(row: RichTextTableRow): string {\n\tfor (const cell of row.children) {\n\t\tconst text = getTextFromRichTextTableCell(cell)\n\t\tif (text) return text\n\t}\n\n\treturn \"\"\n}\n\nfunction getTextFromRichTextBlock(block: RichTextBlock): string {\n\tswitch (block.type) {\n\t\tcase \"textBlock\": {\n\t\t\tconst inlineTexts = block.children.map(getTextFromRichTextInline)\n\t\t\treturn inlineTexts.join(\"\")\n\t\t}\n\t\tcase \"bulletedList\":\n\t\tcase \"numberedList\":\n\t\t\tfor (const item of block.children) {\n\t\t\t\tconst text = getTextFromRichTextListItem(item)\n\t\t\t\tif (text) return text\n\t\t\t}\n\t\t\treturn \"\"\n\t\tcase \"blockquote\":\n\t\t\treturn getFirstNonEmptyTextFromBlocks(block.children)\n\t\tcase \"table\":\n\t\t\tfor (const row of block.children) {\n\t\t\t\tconst text = getTextFromRichTextTableRow(row)\n\t\t\t\tif (text) return text\n\t\t\t}\n\t\t\treturn \"\"\n\t\tcase \"media\":\n\t\tcase \"module\":\n\t\t\treturn \"\"\n\t\tdefault:\n\t\t\treturn assertNever(block)\n\t}\n}\n\nfunction getFirstLineWithText(text: string): string {\n\tlet lineStartIndex = 0\n\n\tfor (let index = 0; index <= text.length; index++) {\n\t\tif (index < text.length && text[index] !== \"\\n\") continue\n\n\t\tif (hasNonWhitespaceInRange(text, lineStartIndex, index)) {\n\t\t\treturn text.slice(lineStartIndex, index)\n\t\t}\n\t\tlineStartIndex = index + 1\n\t}\n\n\treturn \"\"\n}\n\nfunction getRichTextDisplayValue(column: VirtualCollectionItemTableTextColumn, controlProp: unknown): string {\n\tif (column.control.type !== ControlType.RichText) return \"\"\n\n\tconst value = getRichTextControlPropValue(column.control, controlProp)\n\tif (isDynamicValue(value)) return \"\"\n\n\tif (isRichTextDocument(value)) {\n\t\tconst firstBlockText = getFirstNonEmptyTextFromBlocks(value.children)\n\t\treturn getFirstSentencePreview(firstBlockText)\n\t}\n\n\tif (isString(value)) {\n\t\tconst textContent = getHTMLTextContentPreservingNewLinesCached(value)\n\t\tconst firstLine = getFirstLineWithText(textContent)\n\t\treturn getFirstSentencePreview(firstLine)\n\t}\n\n\treturn \"\"\n}\n\nfunction getCollectionReferenceDisplayValue(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\tcontrolProp: unknown,\n): string {\n\tif (column.control.type !== ControlType.CollectionReference) return \"\"\n\n\tconst value = getCollectionReferenceControlPropValue(column.control, controlProp)\n\tif (!isString(value)) return \"\"\n\n\tconst collectionItem = engine.tree.getNodeWithTrait(value, isCollectionItemNode)\n\tif (!collectionItem) return \"\"\n\n\tconst collection = engine.tree.getNodeParent(collectionItem)\n\tif (!isCollectionNode(collection) || collection.instanceIdentifier !== column.control.dataIdentifier) return \"\"\n\n\treturn getCollectionItemName(collection, collectionItem)\n}\n\nfunction getBooleanDisplayValue(column: VirtualCollectionItemTableTextColumn, controlProp: unknown): string {\n\tif (column.control.type !== ControlType.Boolean) return \"\"\n\n\tconst value = getControlProp(column.control, controlProp)\n\tif (value?.type !== ControlType.Boolean) return \"\"\n\n\treturn value.value === true ? Dictionary.Yes : Dictionary.No\n}\n\nfunction getStringDisplayInfo(\n\tcontrol: Extract<ColumnControl, { type: ControlType.String }>,\n\tvariable: VariableDefinition | null,\n\titem: CollectionItemNode,\n\trawControlProp: unknown,\n): CellTextValueInfo {\n\tconst overrideValue = getStringControlPropOverrideValue(rawControlProp)\n\tif (overrideValue !== undefined) {\n\t\treturn { plainTextValue: overrideValue, isInheritedValue: false }\n\t}\n\n\tconst basedOnInfo = getBasedOnStringVariableInfoForVariable(variable, item)\n\tif (basedOnInfo) {\n\t\tconst associatedValue = getAssociatedVariableStringValue(\n\t\t\tbasedOnInfo.variable,\n\t\t\tbasedOnInfo.collection.variables,\n\t\t\titem,\n\t\t)\n\n\t\tif (associatedValue !== undefined) {\n\t\t\treturn { plainTextValue: associatedValue, isInheritedValue: true }\n\t\t}\n\t}\n\n\tconst controlProp = getControlProp(control, rawControlProp)\n\treturn { plainTextValue: isString(controlProp?.value) ? controlProp.value : \"\", isInheritedValue: false }\n}\n\nfunction getFileDisplayValue(column: VirtualCollectionItemTableTextColumn, controlProp: unknown): string {\n\tif (column.control.type !== ControlType.File) return \"\"\n\n\tconst value = getFileControlPropValue(column.control, controlProp)\n\tif (!isString(value)) return \"\"\n\n\treturn getFileCellDisplayValue(value)\n}\n\nfunction getMultiCollectionReferenceDisplayValue(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\tcontrolProp: unknown,\n): string {\n\tif (column.control.type !== ControlType.MultiCollectionReference) return \"\"\n\n\tconst value = getMultiCollectionReferenceControlPropValue(column.control, controlProp)\n\tif (!value || isDynamicValue(value)) return \"\"\n\n\tconst dataIdentifier = isModuleExportIdentifier(column.control.dataIdentifier)\n\t\t? column.control.dataIdentifier\n\t\t: undefined\n\tconst collection = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\tif (!collection) return \"\"\n\n\tconst collectionItems = engine.tree.getNodesWithTrait(value, isCollectionItemNode)\n\treturn collectionItems\n\t\t.filter(collectionItem => engine.tree.getNodeParent(collectionItem)?.id === collection.id)\n\t\t.map(collectionItem => getCollectionItemName(collection, collectionItem))\n\t\t.join(\", \")\n}\n\nfunction getVectorSetItemDisplayValue(column: VirtualCollectionItemTableTextColumn, controlProp: unknown): string {\n\tif (column.control.type !== ControlType.VectorSetItem) return \"\"\n\n\tconst value = getVectorSetItemControlPropValue(column.control, controlProp)\n\tif (!isString(value)) return \"\"\n\n\tconst info = vectorInfoForIdentifier(\n\t\tparseModuleIdentifier(value),\n\t\tengine.tree,\n\t\tengine.stores.modulesStore,\n\t\tengine.stores.vectorsStore,\n\t)\n\treturn info?.name ?? \"\"\n}\n\nexport function getCollectionItemTableColumnTitle(column: VirtualCollectionItemTableTextColumn): string {\n\treturn column.control.title ?? column.control.type\n}\n\nexport function getAccessibleLabelForCell(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\titem: CollectionItemNode,\n\tplainTextValue?: string,\n): string {\n\tconst title = getCollectionItemTableColumnTitle(column)\n\tconst value = plainTextValue ?? getPlainTextValueForCell(column, item)\n\treturn value ? `${title}: ${value}` : title\n}\n\nexport function getPlainTextValueForCell(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\titem: CollectionItemNode,\n): string {\n\treturn getTextValueInfoForCell(column, item).plainTextValue\n}\n\nexport function getTextValueInfoForCell(\n\tcolumn: VirtualCollectionItemTableTextColumn,\n\titem: CollectionItemNode,\n): CellTextValueInfo {\n\tif (isCollectionItemTableStatusColumn(column)) {\n\t\treturn { plainTextValue: getCollectionItemTableStatusValue(item), isInheritedValue: false }\n\t}\n\n\tconst controlProp = column.getControlProp(item)\n\n\tswitch (column.control.type) {\n\t\tcase ControlType.RichText:\n\t\t\treturn { plainTextValue: getRichTextDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.String:\n\t\t\treturn getStringDisplayInfo(column.control, column.variable, item, controlProp)\n\t\tcase ControlType.Number: {\n\t\t\tconst value = getNumberControlPropValue(column.control, controlProp)\n\t\t\tconst plainTextValue = isNumber(value) ? String(value) : \"\"\n\t\t\treturn { plainTextValue, isInheritedValue: false }\n\t\t}\n\t\tcase ControlType.Enum:\n\t\t\treturn { plainTextValue: getEnumDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.Date: {\n\t\t\tconst value = getDateControlPropValue(column.control, controlProp)\n\t\t\tconst textValue = isString(value) ? value : null\n\t\t\tconst plainTextValue = textValue ? formatDateForTableCell(textValue, column.control.displayTime === true) : \"\"\n\t\t\treturn { plainTextValue, isInheritedValue: false }\n\t\t}\n\t\tcase ControlType.Link: {\n\t\t\tconst value = getLinkControlPropValue(column.control, controlProp)\n\t\t\treturn { plainTextValue: isLinkToURL(value) ? value.url : \"\", isInheritedValue: false }\n\t\t}\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn { plainTextValue: getCollectionReferenceDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn { plainTextValue: getMultiCollectionReferenceDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn { plainTextValue: getVectorSetItemDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.Color: {\n\t\t\tconst value = getColorControlPropValue(column.control, controlProp)\n\t\t\tconst plainTextValue = isString(value) ? value : \"\"\n\t\t\treturn { plainTextValue, isInheritedValue: false }\n\t\t}\n\t\tcase ControlType.Boolean:\n\t\t\treturn { plainTextValue: getBooleanDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.File:\n\t\t\treturn { plainTextValue: getFileDisplayValue(column, controlProp), isInheritedValue: false }\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.Array:\n\t\t\treturn { plainTextValue: \"\", isInheritedValue: false }\n\t\tdefault:\n\t\t\treturn assertNever(column.control)\n\t}\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isCollectionNode, isCollectionItemNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\n\nexport function openCollectionItemOverlayForCell({ engine, cell }: { engine: VekterEngine; cell: CellIdentifier }) {\n\tengine.stores.agentStore.clearFollowMode()\n\n\tconst collectionItem = engine.tree.getNodeWithTrait(cell.rowId, isCollectionItemNode)\n\tconst collectionNode = engine.tree.getNodeWithTrait(collectionItem?.parentid, isCollectionNode)\n\tconst highlightField = collectionNode?.getVariable(cell.columnId)\n\n\tif (highlightField) {\n\t\tengine.stores.contentManagementStore.setCollectionItemControlToHighlight(cell.columnId)\n\t} else {\n\t\tengine.stores.contentManagementStore.clearCollectionItemControlToHighlight()\n\t}\n\tengine.stores.selectionStore.set(cell.rowId)\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport type { CollectionItemNode } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isGalleryControl } from \"./arrayGalleryUtils.ts\"\n\nexport type ColumnKey = string\n\nexport type ColumnControl = Extract<\n\tVerifiedControlDescription,\n\t{\n\t\ttype:\n\t\t\t| ControlType.String\n\t\t\t| ControlType.RichText\n\t\t\t| ControlType.Boolean\n\t\t\t| ControlType.Number\n\t\t\t| ControlType.Enum\n\t\t\t| ControlType.Color\n\t\t\t| ControlType.Image\n\t\t\t| ControlType.ResponsiveImage\n\t\t\t| ControlType.Link\n\t\t\t| ControlType.Date\n\t\t\t| ControlType.File\n\t\t\t| ControlType.CollectionReference\n\t\t\t| ControlType.MultiCollectionReference\n\t\t\t| ControlType.Array\n\t\t\t| ControlType.VectorSetItem\n\t}\n>\n\nexport interface CollectionItemTableColumn {\n\tcontrol: ColumnControl\n\tgetControlProp: (item: CollectionItemNode) => ControlProp | undefined\n\tisFieldEditable: boolean\n\tisValueEditable: boolean\n\tsupportsSorting: boolean\n\tvariable: VariableDefinition | null\n\tkey: ColumnKey\n}\n\ntype GalleryCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<ColumnControl, { type: ControlType.Array }>\n}\n\nexport function isColumnControlDescription(\n\tcontrol: VerifiedControlDescription,\n\trichTextEnabled: boolean,\n): control is ColumnControl {\n\tswitch (control.type) {\n\t\tcase ControlType.String:\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.Color:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Date:\n\t\tcase ControlType.File:\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn true\n\t\tcase ControlType.RichText:\n\t\t\treturn richTextEnabled\n\t\tcase ControlType.Array:\n\t\t\treturn isGalleryControl(control)\n\t}\n\treturn false\n}\n\nexport function isGalleryCollectionItemTableColumn(\n\tcolumn: CollectionItemTableColumn,\n): column is GalleryCollectionItemTableColumn {\n\treturn column.control.type === ControlType.Array && isGalleryControl(column.control)\n}\n\nexport function isSlugColumn(column: CollectionItemTableColumn): boolean {\n\treturn column.variable?.type === \"slug\"\n}\n", "import { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\n\nexport function getUniqueCollectionItemSlug(rawValue: string, takenSlugs: ReadonlySet<string>): string {\n\tconst baseSlug = slugify(rawValue)\n\tif (!baseSlug.length) return \"\"\n\n\treturn uniqueName(baseSlug, takenSlugs, { withDash: true })\n}\n", "import { createAssetReference } from \"@framerjs/assets\"\nimport { evalMath } from \"@framerjs/fresco/src/components/utils/evalMath\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assertNever, isSafari } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isStringVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type {\n\tCollectionArrayControlProp,\n\tCollectionControlProp,\n} from \"document/models/controlProps/CollectionControlProp.ts\"\nimport { isCollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport {\n\tgetArrayControlPropValue,\n\tgetBooleanControlPropValue,\n\tgetCollectionReferenceControlPropValue,\n\tgetDateControlPropValue,\n\tgetEnumControlPropValue,\n\tgetFileControlPropValue,\n\tgetImageControlProp,\n\tgetLinkControlPropValue,\n\tgetMultiCollectionReferenceControlPropValue,\n\tgetNumberControlPropValue,\n\tgetRichTextControlPropValue,\n\tgetVectorSetItemControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport { ControlType, type NumberControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { chooseFileService } from \"web/pages/project/lib/ChooseFileService.ts\"\nimport {\n\tgetBasedOnStringVariableInfo,\n\tgetPlainTextValueForCell,\n\tgetStringControlPropOverrideValue,\n} from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport type {\n\tCellAdapterContext,\n\tTextEditingState,\n\tVirtualCollectionItemTableCellAdapter,\n\tVirtualCollectionItemTableEditingSession,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport { openCollectionItemOverlayForCell } from \"./VirtualCollectionItemTable.openCollectionItemOverlay.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport { getTakenSlugs } from \"./useTakenSlugs.ts\"\nimport {\n\ttype CollectionItemTableColumn,\n\tisGalleryCollectionItemTableColumn,\n\tisSlugColumn,\n} from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionItemTableDraftValueForStatus,\n\tisCollectionItemTableStatusColumnKey,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\nimport { setCollectionItemsStatusWithConfirmation } from \"./utils/contentManagementActions.tsx\"\nimport { getAssociatedVariableStringValue } from \"./utils/getAssociatedVariableStringValue.ts\"\nimport { getUniqueCollectionItemSlug } from \"./utils/getUniqueCollectionItemSlug.ts\"\nimport {\n\tgetUpdatedBooleanControlProp,\n\tgetUpdatedCollectionReferenceControlProp,\n\tgetUpdatedColorControlProp,\n\tgetUpdatedDateControlProp,\n\tgetUpdatedEnumControlProp,\n\tgetUpdatedLinkControlProp,\n\tgetUpdatedMultiCollectionReferenceControlProp,\n\tgetUpdatedStringControlProp,\n\tgetUpdatedVectorSetItemControlProp,\n} from \"./utils/getUpdatedFieldControlProp.ts\"\nimport { updateSlugEffectedLinksAndEffects } from \"./utils/updatePageLinksWithSlug.ts\"\n\nfunction shouldClearStringCellControlProp(\n\tcollectionItem: CollectionItemNode,\n\tcolumnId: string,\n\tvalue: string,\n): boolean {\n\tif (value.length !== 0) return false\n\n\tconst collectionNode = engine.tree.getNodeParent(collectionItem)\n\tif (!isCollectionNode(collectionNode)) return false\n\n\tconst variable = collectionNode.getVariable(columnId)\n\tif (!variable || !isStringVariableDefinition(variable)) return false\n\n\treturn variable.fallbackValue === \"associatedVariable\"\n}\n\nfunction commitVirtualCollectionItemTableStringCell(rowId: NodeID, columnId: string, value: string) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return\n\n\tif (shouldClearStringCellControlProp(collectionItem, columnId, value)) {\n\t\tcollectionItem.clearControlProps([columnId])\n\t\treturn\n\t}\n\n\tcollectionItem.setControlProp(columnId, getUpdatedStringControlProp(collectionItem.getControlProp(columnId), value))\n}\n\nfunction clearVirtualCollectionItemTableStringCell(rowId: NodeID, columnId: string) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return\n\n\tif (shouldClearStringCellControlProp(collectionItem, columnId, \"\")) {\n\t\tcollectionItem.clearControlProps([columnId])\n\t\treturn\n\t}\n\n\tcollectionItem.setControlProp(columnId, {\n\t\ttype: ControlType.String,\n\t\tvalue: \"\",\n\t})\n}\n\nfunction commitVirtualCollectionItemTableNumberCell(rowId: NodeID, columnId: string, value: number) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return\n\n\tcollectionItem.setControlProp(columnId, {\n\t\ttype: ControlType.Number,\n\t\tvalue,\n\t})\n}\n\nfunction clearVirtualCollectionItemTableControlProp(rowId: NodeID, columnId: string) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return\n\n\tcollectionItem.clearControlProps([columnId])\n}\n\nfunction commitVirtualCollectionItemTableDateCell(rowId: NodeID, columnId: string, value: string | undefined) {\n\tif (value === undefined) {\n\t\tclearVirtualCollectionItemTableControlProp(rowId, columnId)\n\t\treturn\n\t}\n\n\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => getUpdatedDateControlProp(value))\n}\n\nfunction formatDateInputSegment(value: number): string {\n\treturn String(value).padStart(2, \"0\")\n}\n\nfunction getCurrentLocalDateInputValue(now = new Date()): string {\n\tconst year = now.getFullYear()\n\tconst month = formatDateInputSegment(now.getMonth() + 1)\n\tconst day = formatDateInputSegment(now.getDate())\n\treturn `${year}-${month}-${day}`\n}\n\nfunction getSafariInitialDateDraft(now = new Date()): string {\n\tconst localDateValue = getCurrentLocalDateInputValue(now)\n\tconst date = new Date(localDateValue)\n\treturn Number.isNaN(date.valueOf()) ? \"\" : date.toJSON()\n}\n\nfunction getSafariInitialDateTimeDraft(now = new Date()): string {\n\tconst year = now.getFullYear()\n\tconst month = now.getMonth()\n\tconst day = now.getDate()\n\tconst hours = now.getHours()\n\tconst minutes = now.getMinutes()\n\tconst date = new Date(Date.UTC(year, month, day, hours, minutes, 0, 0))\n\treturn Number.isNaN(date.valueOf()) ? \"\" : date.toJSON()\n}\n\nfunction getSafariInitialDateControlDraft({\n\tdisplayTime,\n\tnow = new Date(),\n}: {\n\tdisplayTime: boolean\n\tnow?: Date\n}): string {\n\tif (displayTime) return getSafariInitialDateTimeDraft(now)\n\treturn getSafariInitialDateDraft(now)\n}\n\nfunction updateVirtualCollectionItemTableControlProp(\n\trowId: NodeID,\n\tcolumnId: string,\n\tgetNextControlProp: (currentControlProp: CollectionControlProp | undefined) => CollectionControlProp,\n) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return\n\n\tconst currentControlProp = collectionItem.getControlProp(columnId)\n\tif (currentControlProp !== undefined && !isCollectionControlProp(currentControlProp)) return\n\n\tcollectionItem.setControlProp(columnId, getNextControlProp(currentControlProp))\n}\n\nfunction setVirtualCollectionItemTableControlProp(rowId: NodeID, columnId: string, controlProp: CollectionControlProp) {\n\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => controlProp)\n}\n\nfunction updateVirtualCollectionItemTableStatusCell(rowId: NodeID, value: string | undefined) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem || !value) return\n\n\tconst nextDraftStatus = getCollectionItemTableDraftValueForStatus(value)\n\tconst currentDraftStatus = collectionItem.isDraft\n\tif (currentDraftStatus === nextDraftStatus) return\n\n\tsetCollectionItemsStatusWithConfirmation(engine, [rowId], nextDraftStatus, \"collection_table\")\n}\n\nexport const updateVirtualCollectionItemTableColorCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: string) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => getUpdatedColorControlProp(value))\n\t},\n)\n\nexport const updateVirtualCollectionItemTableImageCell = engine.scheduler.wrapHandler(\n\t(\n\t\t_collectionId: NodeID,\n\t\trowId: NodeID,\n\t\tcolumnId: string,\n\t\tgetUpdate: (currentControlProp: ImageControlProp | undefined) => ImageControlProp,\n\t) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, currentControlProp => {\n\t\t\tconst currentImageControlProp = currentControlProp?.type === ControlType.Image ? currentControlProp : undefined\n\t\t\treturn getUpdate(currentImageControlProp)\n\t\t})\n\t},\n)\n\nexport const updateVirtualCollectionItemTableGalleryCell = engine.scheduler.wrapHandler(\n\t(\n\t\t_collectionId: NodeID,\n\t\trowId: NodeID,\n\t\tcolumnId: string,\n\t\tgetUpdate: (currentControlProp: CollectionArrayControlProp) => CollectionArrayControlProp,\n\t) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, currentControlProp => {\n\t\t\tconst currentArrayControlProp: CollectionArrayControlProp =\n\t\t\t\tcurrentControlProp?.type === ControlType.Array ? currentControlProp : { type: ControlType.Array, value: [] }\n\t\t\treturn getUpdate(currentArrayControlProp)\n\t\t})\n\t},\n)\n\nexport function getVirtualCollectionItemTableFileActivationAssignments<T>({\n\tcontexts,\n\treferences,\n}: {\n\tcontexts: readonly T[]\n\treferences: readonly (string | undefined)[]\n}): readonly { context: T; reference: string }[] {\n\tif (contexts.length === 0 || references.length === 0) return []\n\n\tif (references.length === 1) {\n\t\tconst reference = references[0]\n\t\tif (!reference) return []\n\n\t\t// Reuse the single uploaded file across every selected file cell.\n\t\treturn contexts.map(context => ({ context, reference }))\n\t}\n\n\treturn contexts.slice(0, references.length).flatMap((context, index) => {\n\t\tconst reference = references[index]\n\t\treturn reference ? [{ context, reference }] : []\n\t})\n}\n\nexport const updateVirtualCollectionItemTableLinkCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: Link | undefined) => {\n\t\tif (!value) {\n\t\t\tsetVirtualCollectionItemTableControlProp(rowId, columnId, {\n\t\t\t\ttype: ControlType.Link,\n\t\t\t\tvalue: undefined,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, currentControlProp =>\n\t\t\tgetUpdatedLinkControlProp(currentControlProp, value),\n\t\t)\n\t},\n)\n\nexport const clearVirtualCollectionItemTableImageCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string) => {\n\t\tsetVirtualCollectionItemTableControlProp(rowId, columnId, {\n\t\t\ttype: ControlType.Image,\n\t\t\tvalue: undefined,\n\t\t})\n\t},\n)\n\nexport const updateVirtualCollectionItemTableCollectionReferenceCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: string | undefined) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => getUpdatedCollectionReferenceControlProp(value))\n\t},\n)\n\nexport const updateVirtualCollectionItemTableMultiCollectionReferenceCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: readonly string[] | undefined) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () =>\n\t\t\tgetUpdatedMultiCollectionReferenceControlProp(value),\n\t\t)\n\t},\n)\n\nexport const updateVirtualCollectionItemTableEnumCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: string) => {\n\t\tif (isCollectionItemTableStatusColumnKey(columnId)) {\n\t\t\tupdateVirtualCollectionItemTableStatusCell(rowId, value)\n\t\t\treturn\n\t\t}\n\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => getUpdatedEnumControlProp(value))\n\t},\n)\n\nexport const updateVirtualCollectionItemTableVectorSetItemCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: ModuleExportIdentifierString) => {\n\t\tupdateVirtualCollectionItemTableControlProp(rowId, columnId, () => getUpdatedVectorSetItemControlProp(value))\n\t},\n)\n\nfunction commitVirtualCollectionItemTableSlugCell(\n\tcollectionId: NodeID,\n\trowId: NodeID,\n\tcolumnId: string,\n\tvalue: string,\n) {\n\tconst collectionNode = engine.tree.getNodeWithTrait(collectionId, isCollectionNode)\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionNode || !collectionItem) return\n\n\tconst currentControlProp = collectionItem.getControlProp(columnId)\n\tconst currentValue =\n\t\tcurrentControlProp?.type === ControlType.String && typeof currentControlProp.value === \"string\"\n\t\t\t? currentControlProp.value\n\t\t\t: \"\"\n\tconst takenSlugs = getTakenSlugs(collectionNode, collectionItem).get(columnId) ?? new Set<string>()\n\tconst nextSlug = getUniqueCollectionItemSlug(value, takenSlugs)\n\tif (!nextSlug.length || nextSlug === currentValue) return\n\n\tconst updateSlug = () => {\n\t\tcollectionItem.setControlProp(columnId, getUpdatedStringControlProp(currentControlProp, nextSlug))\n\t}\n\n\tif (engine.tree.root.allSlugsResolvedAtRuntime) {\n\t\tupdateSlug()\n\t\treturn\n\t}\n\n\tconst applySlugAndLinks = () => {\n\t\tupdateSlug()\n\t\tupdateSlugEffectedLinksAndEffects(engine, collectionNode.id, rowId, columnId, nextSlug)\n\t}\n\n\tif (engine.stores.treeStore.getDataTree()) {\n\t\tapplySlugAndLinks()\n\t} else {\n\t\tengine.runWithFullyLoadedTree(applySlugAndLinks, {\n\t\t\tname: \"collection_item_slug_edit\",\n\t\t\tmodalTitle: \"Updating Outdated Links\",\n\t\t})\n\t}\n}\n\nconst updateVirtualCollectionItemTableBooleanCell = engine.scheduler.wrapHandler(\n\t(_collectionId: NodeID, rowId: NodeID, columnId: string, value: boolean) => {\n\t\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\t\tif (!collectionItem) return\n\n\t\tcollectionItem.setControlProp(columnId, getUpdatedBooleanControlProp(value))\n\t},\n)\n\nfunction createStringLikeEditingSession<AdapterKind extends \"slug\" | \"string\" | \"multilineString\">(\n\tcontext: CellAdapterContext,\n\tinitialValue: string | null,\n\tadapterKind: AdapterKind,\n): Extract<VirtualCollectionItemTableEditingSession, { adapterKind: AdapterKind }> {\n\tconst textEditingState = context.getCurrentTextEditingState()\n\n\treturn {\n\t\tcell: context.cell,\n\t\tadapterKind,\n\t\tinitialValue: textEditingState.value,\n\t\tdraftValue: textEditingState.value,\n\t\tplaceholder: textEditingState.placeholder,\n\t\tpendingInsertedText: initialValue,\n\t} as Extract<VirtualCollectionItemTableEditingSession, { adapterKind: AdapterKind }>\n}\n\nfunction getCurrentTextEditingStateForCell(\n\tcolumn: CollectionItemTableColumn,\n\titem: CollectionItemNode,\n): TextEditingState {\n\tconst overrideValue = getStringControlPropOverrideValue(column.getControlProp(item))\n\tif (overrideValue !== undefined) {\n\t\treturn {\n\t\t\tvalue: overrideValue,\n\t\t\tplaceholder: undefined,\n\t\t}\n\t}\n\n\tconst info = getBasedOnStringVariableInfo(column, item)\n\tif (info) {\n\t\tconst associatedValue = getAssociatedVariableStringValue(info.variable, info.collection.variables, item)\n\t\tif (associatedValue !== undefined) return { value: \"\", placeholder: associatedValue }\n\t}\n\n\treturn {\n\t\tvalue: getPlainTextValueForCell(column, item),\n\t\tplaceholder: undefined,\n\t}\n}\n\nfunction getCurrentNumberValueForCell(column: CollectionItemTableColumn, item: CollectionItemNode): number | undefined {\n\tif (column.control.type !== ControlType.Number) return undefined\n\n\tconst value = getNumberControlPropValue(column.control, column.getControlProp(item))\n\treturn isNumber(value) ? value : undefined\n}\n\nfunction getCurrentDateValueForCell(column: CollectionItemTableColumn, item: CollectionItemNode): string | undefined {\n\tif (column.control.type !== ControlType.Date) return undefined\n\n\tconst value = getDateControlPropValue(column.control, column.getControlProp(item))\n\treturn typeof value === \"string\" ? value : undefined\n}\n\n/** Parse a display string into a number, returning `undefined` for empty or invalid input. */\nfunction parseNumberDisplayValue(displayValue: string): number | undefined {\n\tconst trimmed = displayValue.trim()\n\tif (!trimmed.length) return undefined\n\n\tconst exprValue = evalMath(trimmed)\n\tif (Number.isFinite(exprValue)) return exprValue\n\n\tconst parsedValue = Number.parseFloat(trimmed)\n\tif (Number.isFinite(parsedValue)) return parsedValue\n\n\treturn undefined\n}\n\nfunction clampNumberToControl(control: NumberControlDescription, value: number): number {\n\tlet result = value\n\tif (isNumber(control.step) && Number.isInteger(control.step)) {\n\t\tresult = Math.round(result)\n\t}\n\tif (isNumber(control.min)) {\n\t\tresult = Math.max(control.min, result)\n\t}\n\tif (isNumber(control.max)) {\n\t\tresult = Math.min(control.max, result)\n\t}\n\n\t// Round to 7 decimal places to avoid floating-point artifacts (e.g. 0.1 + 0.2 = 0.30000\u202604).\n\tconst factor = 10 ** 7\n\treturn Math.round(result * factor) / factor\n}\n\nexport function resolveNumberDisplayValue(\n\tcontrol: NumberControlDescription,\n\tdisplayValue: string,\n\tcurrentValue: number | undefined,\n): number | undefined {\n\tconst parsed = parseNumberDisplayValue(displayValue)\n\tif (parsed === undefined) return currentValue\n\treturn clampNumberToControl(control, parsed)\n}\n\nfunction getEditableStringControl(\n\tcolumn: CollectionItemTableColumn,\n): Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.String }> | null {\n\tconst { control, isValueEditable } = column\n\tif (!isValueEditable || control.type !== ControlType.String || control.obscured === true) return null\n\treturn control\n}\n\nfunction isEditableSingleLineStringContext(context: CellAdapterContext): boolean {\n\tconst control = getEditableStringControl(context.column)\n\tif (!control) return false\n\treturn control.displayTextArea !== true\n}\n\nfunction isEditableMultilineStringContext(context: CellAdapterContext): boolean {\n\tconst control = getEditableStringControl(context.column)\n\tif (!control) return false\n\treturn control.displayTextArea === true\n}\n\nconst slugCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"slug\",\n\tsupports: context => isSlugColumn(context.column) && isEditableSingleLineStringContext(context),\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => createStringLikeEditingSession(context, initialValue, \"slug\"),\n\tupdateSessionDraft: (_context, session, value) => {\n\t\tif (session.adapterKind !== \"slug\") return session\n\n\t\tconst nextDraftValue = slugify(value)\n\t\tif (nextDraftValue === session.draftValue) return session\n\n\t\treturn {\n\t\t\t...session,\n\t\t\tdraftValue: nextDraftValue,\n\t\t\tpendingInsertedText: null,\n\t\t}\n\t},\n\tcommitSession: (context, session) => {\n\t\tif (session.adapterKind !== \"slug\") return\n\t\tif (session.draftValue === session.initialValue) return\n\t\tcontext.commitSlugValue(session.draftValue)\n\t},\n}\n\nconst stringCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"string\",\n\tsupports: context => !isSlugColumn(context.column) && isEditableSingleLineStringContext(context),\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => createStringLikeEditingSession(context, initialValue, \"string\"),\n\tupdateSessionDraft: (_context, session, value) => {\n\t\tif (session.adapterKind !== \"string\") return session\n\t\tif (value === session.draftValue) return session\n\n\t\treturn {\n\t\t\t...session,\n\t\t\tdraftValue: value,\n\t\t\tpendingInsertedText: null,\n\t\t}\n\t},\n\tcommitSession: (context, session) => {\n\t\tif (session.adapterKind !== \"string\") return\n\t\tif (session.draftValue === session.initialValue) return\n\t\tcontext.commitTextValueSync(session.draftValue)\n\t},\n}\n\nconst multilineStringCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"multilineString\",\n\tsupports: context => !isSlugColumn(context.column) && isEditableMultilineStringContext(context),\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => createStringLikeEditingSession(context, initialValue, \"multilineString\"),\n\tupdateSessionDraft: (_context, session, value) => {\n\t\tif (session.adapterKind !== \"multilineString\") return session\n\t\tif (value === session.draftValue) return session\n\n\t\treturn {\n\t\t\t...session,\n\t\t\tdraftValue: value,\n\t\t\tpendingInsertedText: null,\n\t\t}\n\t},\n\tcommitSession: (context, session) => {\n\t\tif (session.adapterKind !== \"multilineString\") return\n\t\tif (session.draftValue === session.initialValue) return\n\t\tcontext.commitTextValueSync(session.draftValue)\n\t},\n}\n\nconst richTextCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"richText\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.RichText,\n\tgetActionSupport: () => \"activate\",\n\tactivate: context => {\n\t\topenCollectionItemOverlayForCell({ engine, cell: context.cell })\n\t},\n\tactivateMany: contexts => {\n\t\tconst firstContext = contexts[0]\n\t\tif (!firstContext) return\n\n\t\topenCollectionItemOverlayForCell({ engine, cell: firstContext.cell })\n\t},\n}\n\nconst numberCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"number\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Number,\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => {\n\t\tconst currentValue = context.getCurrentNumberValue()\n\n\t\treturn {\n\t\t\tcell: context.cell,\n\t\t\tadapterKind: \"number\",\n\t\t\tinitialValue: currentValue,\n\t\t\tdisplayValue: initialValue ?? (isNumber(currentValue) ? String(currentValue) : \"\"),\n\t\t\tpendingInsertedText: initialValue,\n\t\t}\n\t},\n\tupdateSessionDraft: (_context, session, value) => {\n\t\tif (session.adapterKind !== \"number\") return session\n\t\tif (value === session.displayValue && session.pendingInsertedText === null) return session\n\n\t\treturn {\n\t\t\t...session,\n\t\t\tdisplayValue: value,\n\t\t\tpendingInsertedText: null,\n\t\t}\n\t},\n\tcommitSession: (context, session) => {\n\t\tif (session.adapterKind !== \"number\") return\n\t\tif (context.column.control.type !== ControlType.Number) return\n\n\t\tconst nextValue = resolveNumberDisplayValue(context.column.control, session.displayValue, session.initialValue)\n\t\tif (!isNumber(nextValue) || nextValue === session.initialValue) return\n\t\tcontext.commitNumberValueSync(nextValue)\n\t},\n}\n\nconst dateCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"date\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Date,\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => {\n\t\tconst currentValue = context.getCurrentDateValue()\n\n\t\tlet autoFilledInitialDraftValue: string | undefined\n\t\tif (currentValue === undefined && isSafari() && context.column.control.type === ControlType.Date) {\n\t\t\tautoFilledInitialDraftValue = getSafariInitialDateControlDraft({\n\t\t\t\tdisplayTime: context.column.control.displayTime === true,\n\t\t\t})\n\t\t}\n\n\t\treturn {\n\t\t\tcell: context.cell,\n\t\t\tadapterKind: \"date\",\n\t\t\tinitialValue: currentValue ?? \"\",\n\t\t\tdraftValue: currentValue ?? autoFilledInitialDraftValue ?? \"\",\n\t\t\tautoFilledInitialDraftValue,\n\t\t}\n\t},\n\tupdateSessionDraft: (_context, session, value) => {\n\t\tif (session.adapterKind !== \"date\") return session\n\t\tif (value === session.draftValue) return session\n\n\t\treturn {\n\t\t\t...session,\n\t\t\tdraftValue: value,\n\t\t}\n\t},\n\tcommitSession: (context, session) => {\n\t\tif (session.adapterKind !== \"date\") return\n\n\t\tconst nextValue = session.draftValue || undefined\n\t\tconst initialValue = session.initialValue || undefined\n\t\tif (nextValue === initialValue) return\n\n\t\tcontext.commitDateValue(nextValue)\n\t},\n}\n\nconst booleanCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"boolean\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Boolean,\n\tgetActionSupport: () => \"activate\",\n\tactivate: context => {\n\t\tcontext.commitBooleanValue(!context.getCurrentBooleanValue())\n\t},\n\tactivateMany: contexts => {\n\t\tconst nextValue = contexts.some(context => context.getCurrentBooleanValue() !== true)\n\n\t\tfor (const context of contexts) {\n\t\t\tcontext.commitBooleanValue(nextValue)\n\t\t}\n\t},\n}\n\nconst colorCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"color\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Color,\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"color\",\n\t}),\n}\n\nconst imageCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"image\",\n\tsupports: context =>\n\t\tcontext.column.isValueEditable &&\n\t\t(context.column.control.type === ControlType.Image || context.column.control.type === ControlType.ResponsiveImage),\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"image\",\n\t}),\n}\n\nfunction getVirtualCollectionItemTableFileActivationContexts(contexts: readonly CellAdapterContext[]) {\n\tconst firstContext = contexts[0]\n\tif (!firstContext || firstContext.column.control.type !== ControlType.File) return null\n\tconst firstFileControl = firstContext.column.control\n\tconst matchingContexts = contexts.filter(context => context.cell.columnId === firstContext.cell.columnId)\n\tif (matchingContexts.length === 0) return null\n\n\treturn { firstFileControl, matchingContexts }\n}\n\nexport interface VirtualCollectionItemTableCanceledFileSelection {\n\tstatus: \"canceled\"\n}\n\nexport interface VirtualCollectionItemTablePickedFileSelection {\n\tstatus: \"picked\"\n\tfiles: File[]\n}\n\nexport type VirtualCollectionItemTableFileSelection =\n\t| VirtualCollectionItemTableCanceledFileSelection\n\t| VirtualCollectionItemTablePickedFileSelection\n\nexport async function pickVirtualCollectionItemTableFileCellFiles(\n\tcontexts: readonly CellAdapterContext[],\n): Promise<VirtualCollectionItemTableFileSelection | null> {\n\tconst activationContexts = getVirtualCollectionItemTableFileActivationContexts(contexts)\n\tif (!activationContexts) return null\n\n\tconst { firstFileControl, matchingContexts } = activationContexts\n\tconst files = await chooseFileService.pickFile({\n\t\tallowedFileTypes: firstFileControl.allowedFileTypes,\n\t\tmultiple: matchingContexts.length > 1,\n\t})\n\tif (!files?.length) return { status: \"canceled\" }\n\n\treturn { status: \"picked\", files }\n}\n\nexport const activateVirtualCollectionItemTableFileCells = async (\n\tcontexts: readonly CellAdapterContext[],\n\tpreparedSelection?: VirtualCollectionItemTableFileSelection | null,\n) => {\n\tconst activationContexts = getVirtualCollectionItemTableFileActivationContexts(contexts)\n\tif (!activationContexts) return\n\n\tconst { matchingContexts } = activationContexts\n\tlet selection = preparedSelection\n\tif (selection === undefined) {\n\t\tselection = await pickVirtualCollectionItemTableFileCellFiles(matchingContexts)\n\t}\n\n\tif (!selection || selection.status === \"canceled\") return\n\n\tconst fileInfos = await chooseFileService.uploadFiles(selection.files, {\n\t\tmaxUploads: matchingContexts.length,\n\t})\n\tif (fileInfos.every(fileInfo => !fileInfo)) return\n\n\tconst references = fileInfos.map(fileInfo =>\n\t\tfileInfo ? createAssetReference(fileInfo.filename, null, fileInfo.originalFilename) : undefined,\n\t)\n\tconst assignments = getVirtualCollectionItemTableFileActivationAssignments({\n\t\tcontexts: matchingContexts,\n\t\treferences,\n\t})\n\tif (assignments.length === 0) return\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tfor (const { context, reference } of assignments) {\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tvalue: reference,\n\t\t\t})\n\t\t}\n\t})\n}\n\nconst fileCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"file\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.File,\n\tgetActionSupport: () => \"activate\",\n\tactivate: context => {\n\t\tvoid activateVirtualCollectionItemTableFileCells([context])\n\t},\n\tactivateMany: contexts => {\n\t\tvoid activateVirtualCollectionItemTableFileCells(contexts)\n\t},\n}\n\nconst galleryCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"gallery\",\n\tsupports: context => context.column.isValueEditable && isGalleryCollectionItemTableColumn(context.column),\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"gallery\",\n\t}),\n}\n\nconst vectorSetItemCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"vectorSetItem\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.VectorSetItem,\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"vectorSetItem\",\n\t}),\n}\n\nconst linkCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"link\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Link,\n\tgetActionSupport: () => \"edit\",\n\tstartSession: context => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"link\",\n\t}),\n}\n\nconst enumCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"enum\",\n\tsupports: context => context.column.isValueEditable && context.column.control.type === ControlType.Enum,\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"enum\",\n\t\tinitialSearchValue: initialValue,\n\t}),\n}\n\nconst collectionReferenceCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"collectionReference\",\n\tsupports: context =>\n\t\tcontext.column.isValueEditable && context.column.control.type === ControlType.CollectionReference,\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"collectionReference\",\n\t\tinitialSearchValue: initialValue,\n\t}),\n}\n\nconst multiCollectionReferenceCellAdapter: VirtualCollectionItemTableCellAdapter = {\n\tkind: \"multiCollectionReference\",\n\tsupports: context =>\n\t\tcontext.column.isValueEditable && context.column.control.type === ControlType.MultiCollectionReference,\n\tgetActionSupport: () => \"editOnType\",\n\tstartSession: (context, initialValue) => ({\n\t\tcell: context.cell,\n\t\tadapterKind: \"multiCollectionReference\",\n\t\tinitialSearchValue: initialValue,\n\t}),\n}\n\nconst cellAdapters: readonly VirtualCollectionItemTableCellAdapter[] = [\n\tslugCellAdapter,\n\tstringCellAdapter,\n\tmultilineStringCellAdapter,\n\trichTextCellAdapter,\n\tnumberCellAdapter,\n\tdateCellAdapter,\n\tbooleanCellAdapter,\n\tcolorCellAdapter,\n\timageCellAdapter,\n\tfileCellAdapter,\n\tgalleryCellAdapter,\n\tvectorSetItemCellAdapter,\n\tlinkCellAdapter,\n\tenumCellAdapter,\n\tcollectionReferenceCellAdapter,\n\tmultiCollectionReferenceCellAdapter,\n]\n\nfunction getCurrentBooleanValueForCell(column: CollectionItemTableColumn, item: CollectionItemNode): boolean {\n\tif (column.control.type !== ControlType.Boolean) return false\n\n\treturn getBooleanControlPropValue(column.control, column.getControlProp(item)) === true\n}\n\nexport function createCellAdapterContext({\n\tcell,\n\tcollectionNodeId,\n\tdataIsViewOnly,\n\tcolumns,\n}: {\n\tcell: CellIdentifier\n\tcollectionNodeId: NodeID\n\tdataIsViewOnly: boolean\n\tcolumns: readonly CollectionItemTableColumn[]\n}): CellAdapterContext | null {\n\tif (dataIsViewOnly) return null\n\n\tconst item = engine.tree.getNodeWithTrait(cell.rowId, isCollectionItemNode)\n\tconst column = columns.find(({ key }) => key === cell.columnId)\n\tif (!item || !column) return null\n\n\treturn {\n\t\tcell,\n\t\titem,\n\t\tcolumn,\n\t\tgetCurrentTextValue: () => getPlainTextValueForCell(column, item),\n\t\tgetCurrentTextEditingState: () => getCurrentTextEditingStateForCell(column, item),\n\t\tgetCurrentControlProp: () => {\n\t\t\tconst controlProp = column.getControlProp(item)\n\t\t\treturn isCollectionControlProp(controlProp) ? controlProp : undefined\n\t\t},\n\t\tsetControlProp: controlProp => setVirtualCollectionItemTableControlProp(cell.rowId, cell.columnId, controlProp),\n\t\tcommitEnumValue: value =>\n\t\t\tupdateVirtualCollectionItemTableEnumCell(collectionNodeId, cell.rowId, cell.columnId, value),\n\t\tcommitTextValueSync: value => commitVirtualCollectionItemTableStringCell(cell.rowId, cell.columnId, value),\n\t\tcommitSlugValue: value =>\n\t\t\tcommitVirtualCollectionItemTableSlugCell(collectionNodeId, cell.rowId, cell.columnId, value),\n\t\tgetCurrentNumberValue: () => getCurrentNumberValueForCell(column, item),\n\t\tcommitNumberValueSync: value => commitVirtualCollectionItemTableNumberCell(cell.rowId, cell.columnId, value),\n\t\tgetCurrentDateValue: () => getCurrentDateValueForCell(column, item),\n\t\tcommitDateValue: value => commitVirtualCollectionItemTableDateCell(cell.rowId, cell.columnId, value),\n\t\tgetCurrentBooleanValue: () => getCurrentBooleanValueForCell(column, item),\n\t\tcommitBooleanValue: value =>\n\t\t\tupdateVirtualCollectionItemTableBooleanCell(collectionNodeId, cell.rowId, cell.columnId, value),\n\t}\n}\n\nexport function getCellAdapter(context: CellAdapterContext): VirtualCollectionItemTableCellAdapter | null {\n\treturn cellAdapters.find(adapter => adapter.supports(context)) ?? null\n}\n\nfunction getDeletionTargetControlProp(context: CellAdapterContext): CollectionControlProp | null {\n\tswitch (context.column.control.type) {\n\t\tcase ControlType.String:\n\t\t\tif (isSlugColumn(context.column)) return null\n\t\t\treturn {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: \"\",\n\t\t\t}\n\t\tcase ControlType.RichText:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.RichText,\n\t\t\t\tvalue: \"\",\n\t\t\t}\n\t\tcase ControlType.Number:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tvalue: getNumberControlPropValue(context.column.control, undefined),\n\t\t\t}\n\t\tcase ControlType.Boolean:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tvalue: false,\n\t\t\t}\n\t\tcase ControlType.Enum:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\tvalue: getEnumControlPropValue(context.column.control, undefined),\n\t\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.Link:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Link,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.Date:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.File:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tvalue: [],\n\t\t\t}\n\t\tcase ControlType.Array:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tvalue: [],\n\t\t\t}\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\tvalue: undefined,\n\t\t\t}\n\t\tcase ControlType.Color:\n\t\t\treturn null\n\t\tdefault:\n\t\t\tassertNever(context.column.control)\n\t}\n}\n\nfunction doesDeletingVirtualCollectionItemTableCellValueChange(context: CellAdapterContext): boolean {\n\tconst currentControlProp = context.column.getControlProp(context.item)\n\tconst deletionTargetControlProp = getDeletionTargetControlProp(context)\n\tif (!deletionTargetControlProp) return false\n\n\tswitch (context.column.control.type) {\n\t\tcase ControlType.String: {\n\t\t\tconst currentOverrideValue = getStringControlPropOverrideValue(currentControlProp)\n\t\t\tconst isBasedOnStringCell = getBasedOnStringVariableInfo(context.column, context.item) !== null\n\t\t\tif (isBasedOnStringCell) {\n\t\t\t\treturn currentOverrideValue !== undefined\n\t\t\t}\n\n\t\t\treturn context.getCurrentTextValue() !== \"\"\n\t\t}\n\t\tcase ControlType.RichText:\n\t\t\treturn !isEqual(\n\t\t\t\tgetRichTextControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetRichTextControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Number:\n\t\t\treturn (\n\t\t\t\tgetNumberControlPropValue(context.column.control, currentControlProp) !==\n\t\t\t\tgetNumberControlPropValue(context.column.control, deletionTargetControlProp)\n\t\t\t)\n\t\tcase ControlType.Boolean:\n\t\t\treturn context.getCurrentBooleanValue() !== false\n\t\tcase ControlType.Enum:\n\t\t\treturn !isEqual(\n\t\t\t\tgetEnumControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetEnumControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn !isEqual(\n\t\t\t\tgetImageControlProp(context.column.control, currentControlProp),\n\t\t\t\tgetImageControlProp(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Link:\n\t\t\treturn !isEqual(\n\t\t\t\tgetLinkControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetLinkControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Date:\n\t\t\treturn !isEqual(\n\t\t\t\tgetDateControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetDateControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.File:\n\t\t\treturn !isEqual(\n\t\t\t\tgetFileControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetFileControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn !isEqual(\n\t\t\t\tgetCollectionReferenceControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetCollectionReferenceControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn !isEqual(\n\t\t\t\tgetMultiCollectionReferenceControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetMultiCollectionReferenceControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Array:\n\t\t\treturn !isEqual(\n\t\t\t\tgetArrayControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetArrayControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn !isEqual(\n\t\t\t\tgetVectorSetItemControlPropValue(context.column.control, currentControlProp),\n\t\t\t\tgetVectorSetItemControlPropValue(context.column.control, deletionTargetControlProp),\n\t\t\t)\n\t\tcase ControlType.Color:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(context.column.control)\n\t}\n}\n\nexport function supportsDeletingVirtualCollectionItemTableCellValue(context: CellAdapterContext): boolean {\n\tif (!context.column.isValueEditable) return false\n\treturn doesDeletingVirtualCollectionItemTableCellValueChange(context)\n}\n\nexport function deleteVirtualCollectionItemTableCellValue(context: CellAdapterContext) {\n\tconst { rowId, columnId } = context.cell\n\tconst deletionTargetControlProp = getDeletionTargetControlProp(context)\n\tif (!deletionTargetControlProp || !doesDeletingVirtualCollectionItemTableCellValueChange(context)) return\n\n\tswitch (context.column.control.type) {\n\t\tcase ControlType.String:\n\t\t\tclearVirtualCollectionItemTableStringCell(rowId, columnId)\n\t\t\treturn\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.File:\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\tcase ControlType.Array:\n\t\tcase ControlType.VectorSetItem:\n\t\t\tsetVirtualCollectionItemTableControlProp(rowId, columnId, deletionTargetControlProp)\n\t\t\treturn\n\t\tcase ControlType.Enum:\n\t\t\tif (deletionTargetControlProp.type !== ControlType.Enum || typeof deletionTargetControlProp.value !== \"string\") {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcontext.commitEnumValue(deletionTargetControlProp.value)\n\t\t\treturn\n\t\tcase ControlType.Date:\n\t\t\tclearVirtualCollectionItemTableControlProp(rowId, columnId)\n\t\t\treturn\n\t\tcase ControlType.Color:\n\t\t\treturn\n\t\tdefault:\n\t\t\tassertNever(context.column.control)\n\t}\n}\n\nexport function getCellAdapterForSession(\n\tsession: VirtualCollectionItemTableEditingSession,\n): VirtualCollectionItemTableCellAdapter | null {\n\treturn cellAdapters.find(adapter => adapter.kind === session.adapterKind) ?? null\n}\n", "import type { VirtualTableIndexRange } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\nexport interface CellIdentifier {\n\trowId: NodeID\n\tcolumnId: ColumnKey\n}\n\nexport interface RowsAndColumnsSnapshot {\n\trowIds: readonly NodeID[]\n\tcolumnIds: readonly ColumnKey[]\n\trowIndexById: ReadonlyMap<NodeID, number>\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n}\n\nexport type TabOrderDirection = \"next\" | \"previous\"\n\ninterface TabOrderCellMovementResult {\n\ttype: \"cell\"\n\tcell: CellIdentifier\n}\n\ninterface TabOrderBoundaryMovementResult {\n\ttype: \"boundary\"\n}\n\ntype TabOrderMovementResult = TabOrderCellMovementResult | TabOrderBoundaryMovementResult\n\nfunction clamp(value: number, minimum: number, maximum: number): number {\n\treturn Math.min(Math.max(value, minimum), maximum)\n}\n\nexport function createRowsAndColumnsSnapshot(\n\trowIds: readonly NodeID[],\n\tcolumnIds: readonly ColumnKey[],\n\trowIndexById: ReadonlyMap<NodeID, number>,\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>,\n): RowsAndColumnsSnapshot {\n\treturn {\n\t\trowIds,\n\t\tcolumnIds,\n\t\trowIndexById,\n\t\tcolumnIndexById,\n\t}\n}\n\nexport function getCellsInRectangle(\n\tsnapshot: RowsAndColumnsSnapshot,\n\trowRange: VirtualTableIndexRange,\n\tcolumnRange: VirtualTableIndexRange,\n): CellIdentifier[] {\n\tconst selectedCells: CellIdentifier[] = []\n\n\tfor (let rowIndex = rowRange.start; rowIndex <= rowRange.end; rowIndex++) {\n\t\tconst rowId = snapshot.rowIds[rowIndex]\n\t\tif (!rowId) continue\n\n\t\tfor (let columnIndex = columnRange.start; columnIndex <= columnRange.end; columnIndex++) {\n\t\t\tconst columnId = snapshot.columnIds[columnIndex]\n\t\t\tif (!columnId) continue\n\n\t\t\tselectedCells.push({ rowId, columnId })\n\t\t}\n\t}\n\n\treturn selectedCells\n}\n\n/**\n * Returns the ranges (start and end indexes for rows and columns) of the selection.\n * Returns null if the selection is empty or invalid.\n */\nexport function getCellSelectionRanges(\n\tanchor: CellIdentifier | null,\n\tfocus: CellIdentifier | null,\n\tsnapshot: RowsAndColumnsSnapshot | null,\n): { rowRange: VirtualTableIndexRange; columnRange: VirtualTableIndexRange } | null {\n\tif (!snapshot || !focus || !anchor) return null\n\n\tif (snapshot.rowIds.length === 0 || snapshot.columnIds.length === 0) return null\n\n\tconst anchorRowIndex = snapshot.rowIndexById.get(anchor.rowId)\n\tconst anchorColumnIndex = snapshot.columnIndexById.get(anchor.columnId)\n\tconst focusRowIndex = snapshot.rowIndexById.get(focus.rowId)\n\tconst focusColumnIndex = snapshot.columnIndexById.get(focus.columnId)\n\n\tif (\n\t\tanchorRowIndex === undefined ||\n\t\tanchorColumnIndex === undefined ||\n\t\tfocusRowIndex === undefined ||\n\t\tfocusColumnIndex === undefined\n\t) {\n\t\treturn null\n\t}\n\n\treturn {\n\t\trowRange: {\n\t\t\tstart: Math.min(anchorRowIndex, focusRowIndex),\n\t\t\tend: Math.max(anchorRowIndex, focusRowIndex),\n\t\t},\n\t\tcolumnRange: {\n\t\t\tstart: Math.min(anchorColumnIndex, focusColumnIndex),\n\t\t\tend: Math.max(anchorColumnIndex, focusColumnIndex),\n\t\t},\n\t}\n}\n\nexport function getIdsInRange(ids: readonly string[], range: VirtualTableIndexRange): string[] {\n\treturn ids.slice(range.start, range.end + 1)\n}\n\nexport function getCellKey({ rowId, columnId }: CellIdentifier): string {\n\treturn `${rowId}::${columnId}`\n}\n\nexport function getCellsInColumn(cells: readonly CellIdentifier[], columnId: ColumnKey): CellIdentifier[] {\n\treturn cells.filter(cell => cell.columnId === columnId)\n}\n\nexport function getSingleSelectedColumnId(\n\tanchor: CellIdentifier | null,\n\tfocus: CellIdentifier | null,\n): ColumnKey | null {\n\tif (!anchor || !focus) return null\n\treturn anchor.columnId === focus.columnId ? anchor.columnId : null\n}\n\nexport function moveCellInOrder(\n\tcell: CellIdentifier,\n\tsnapshot: RowsAndColumnsSnapshot,\n\trowDelta: number,\n\tcolumnDelta: number,\n): CellIdentifier | null {\n\tconst rowCount = snapshot.rowIds.length\n\tconst columnCount = snapshot.columnIds.length\n\tif (rowCount === 0 || columnCount === 0) return null\n\n\tconst currentRowIndex = snapshot.rowIndexById.get(cell.rowId) ?? 0\n\tconst currentColumnIndex = snapshot.columnIndexById.get(cell.columnId) ?? 0\n\n\tconst nextRowIndex = clamp(currentRowIndex + rowDelta, 0, rowCount - 1)\n\tconst nextColumnIndex = clamp(currentColumnIndex + columnDelta, 0, columnCount - 1)\n\n\tconst nextRowId = snapshot.rowIds[nextRowIndex]\n\tconst nextColumnId = snapshot.columnIds[nextColumnIndex]\n\tif (!nextRowId || !nextColumnId) return null\n\n\treturn {\n\t\trowId: nextRowId,\n\t\tcolumnId: nextColumnId,\n\t}\n}\n\nexport function moveCellInTabOrder(\n\tcell: CellIdentifier,\n\tsnapshot: RowsAndColumnsSnapshot,\n\tdirection: TabOrderDirection,\n): TabOrderMovementResult | null {\n\tconst rowCount = snapshot.rowIds.length\n\tconst columnCount = snapshot.columnIds.length\n\tif (rowCount === 0 || columnCount === 0) return null\n\n\tconst currentRowIndex = snapshot.rowIndexById.get(cell.rowId)\n\tconst currentColumnIndex = snapshot.columnIndexById.get(cell.columnId)\n\tif (currentRowIndex === undefined || currentColumnIndex === undefined) return null\n\tconst currentCellIndex = currentRowIndex * columnCount + currentColumnIndex\n\tconst nextCellIndex = currentCellIndex + (direction === \"next\" ? 1 : -1)\n\tconst cellCount = rowCount * columnCount\n\tif (nextCellIndex < 0 || nextCellIndex >= cellCount) {\n\t\treturn { type: \"boundary\" }\n\t}\n\n\tconst nextRowIndex = Math.floor(nextCellIndex / columnCount)\n\tconst nextColumnIndex = nextCellIndex % columnCount\n\tconst nextRowId = snapshot.rowIds[nextRowIndex]\n\tconst nextColumnId = snapshot.columnIds[nextColumnIndex]\n\tif (!nextRowId || !nextColumnId) return null\n\n\treturn {\n\t\ttype: \"cell\",\n\t\tcell: {\n\t\t\trowId: nextRowId,\n\t\t\tcolumnId: nextColumnId,\n\t\t},\n\t}\n}\n", "import {\n\tassert,\n\tassertNever,\n\texternalModuleIdentifier,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\ttype ExternalModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n\tparseModuleIdentifier,\n\ttoLocalIdentifier,\n} from \"@framerjs/shared\"\nimport { convertHTMLToCollectionRichText } from \"document/components/chrome/shared/utils/convertHTMLToRichText.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport {\n\ttype ArrayItemVariableType,\n\tisArrayOfObjectControlDescription,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLink, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { LocalizedValues } from \"document/models/LocalizedValue.ts\"\nimport type { CollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport {\n\tisCollectionArrayControlPropValue,\n\tisCollectionControlProp,\n} from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { CollectionControlType } from \"document/models/controlProps/CollectionControlType.ts\"\nimport { withLocalizableControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { hasControlAltLocalized } from \"document/models/controlProps/WithControlAltText.ts\"\nimport {\n\tgetControlProp,\n\tgetEnumControlPropValue,\n\tgetLinkControlPropValue,\n\tgetMultiCollectionReferenceControlPropValue,\n\tgetRichTextControlPropValue,\n\tgetVectorSetItemControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport { isRichTextTreeValue } from \"document/models/richText/richTextStorage.ts\"\nimport { getPlainTextFromRichTextTreeValue } from \"document/models/richText/richTextStorageDocument.ts\"\nimport { isValidColorOrToken } from \"document/utils/isValidColorOrToken.ts\"\nimport {\n\tControlType,\n\ttype EnumControlDescription,\n\ttype LinkControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport { escapeHTML } from \"library/render/utils/dom.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport type { NativeTextMimeType } from \"utils/clipboard/clipboard.ts\"\nimport { clipboardRead, clipboardWrite } from \"utils/clipboard/index.ts\"\nimport { getCollectionItemName } from \"utils/collectionUtils.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { getValidDate } from \"utils/getValidDate.ts\"\nimport { getVekterLinkFromURL, resolveLinkToURL } from \"utils/resolveLink.ts\"\nimport { isNumber, isReadonlyArray, isString } from \"utils/typeChecks.ts\"\nimport { defaultIdentifierForControl, vectorSetInfoForPopout } from \"utils/vectorSets.ts\"\nimport type { BatchAssetUploader } from \"web/lib/BatchAssetUploader.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { z } from \"zod\"\nimport {\n\tgetModuleIdentifiersForRichTextTreeValue,\n\tupdateModuleIdentifiersInRichTextControlProp,\n} from \"../../../../utils/collectionUtils.ts\"\nimport { ToastKey } from \"../../../utils/ToastKey.ts\"\nimport { getResolvedLinkToWebPage, SlugBehavior } from \"../../../utils/getResolvedLinkToWebPage.ts\"\nimport {\n\tgetBasedOnStringVariableInfo,\n\tgetCollectionItemTableColumnTitle,\n\tgetPlainTextValueForCell,\n\tgetTextValueInfoForCell,\n} from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport { createCellAdapterContext, resolveNumberDisplayValue } from \"./VirtualCollectionItemTable.editingAdapters.ts\"\nimport type { CellAdapterContext } from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport {\n\ttype CellIdentifier,\n\tgetCellSelectionRanges,\n\tgetIdsInRange,\n\ttype RowsAndColumnsSnapshot,\n} from \"./VirtualCollectionItemTable.selection.ts\"\nimport { type CollectionItemTableColumn, type ColumnControl, isSlugColumn } from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionItemTableDraftValueForStatus,\n\tisCollectionItemTableStatusColumnKey,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\nimport { setCollectionItemsStatusWithConfirmation } from \"./utils/contentManagementActions.tsx\"\nimport {\n\tgetDateControlValueForInputValue,\n\tgetDateInputDisplayValue,\n\tgetDateTimeInputDisplayValue,\n} from \"./utils/dateInputValue.ts\"\nimport { getAssociatedVariableStringValue } from \"./utils/getAssociatedVariableStringValue.ts\"\n\nexport const collectionItemTableClipboardMimeType = \"application/x-framer-collection-item-table\"\n\nconst collectionItemTableClipboardVersion = 1\nconst tsvEscapableCharacterPattern = /[\",\\t\\r\\n]/u\nconst newlineSplitPattern = /\\r\\n?|\\n/u\nconst dateOnlyPattern = /^\\d{4}-\\d{2}-\\d{2}$/u\nconst dateTimeWithMinutePattern = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$/u\nconst dateTimeWithSpaceMinutePattern = /^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}$/u\nconst hexColorWithoutPrefixPattern = /^(?:[\\da-f]{3}|[\\da-f]{4}|[\\da-f]{6}|[\\da-f]{8})$/iu\n\ntype CollectionItemTableClipboardControlType = CollectionItemTableColumn[\"control\"][\"type\"]\ntype ArrayItemControlPropType = CollectionControlProp<Extract<ArrayItemVariableType, CollectionControlType>>[\"type\"]\ntype CollectionItemTableClipboardArrayItemControlType = ArrayItemControlPropType | ControlType.ResponsiveImage\ntype CollectionItemTableClipboardArrayItemField = z.infer<typeof clipboardArrayItemFieldSchema>\n\ninterface CollectionItemTableClipboardColumn {\n\tid: string\n\ttitle: string\n\tcontrolType: CollectionItemTableClipboardControlType\n\tarrayItemFields?: readonly CollectionItemTableClipboardArrayItemField[]\n\tdataIdentifier?: string\n\tdisplayTime?: boolean\n\tenumOptions?: readonly string[]\n\tenumOptionTitles?: readonly string[]\n\tsetModuleId?: string\n}\n\ninterface CollectionItemTableClipboardCell {\n\tcontrolProp?: CollectionControlProp\n\tdisplayText: string\n\tisInheritedValue?: boolean\n}\n\ninterface CollectionItemTableClipboardData {\n\tkind: \"collection-item-table\"\n\tversion: number\n\trowCount: number\n\tcolumnCount: number\n\tcolumns: readonly CollectionItemTableClipboardColumn[]\n\tcells: readonly (readonly CollectionItemTableClipboardCell[])[]\n}\n\ninterface SelectionStateSnapshot {\n\tanchor: CellIdentifier | null\n\tfocus: CellIdentifier | null\n}\n\ninterface CellRange {\n\trowIds: readonly NodeID[]\n\tcolumnIds: readonly string[]\n}\n\ninterface ColumnAssignment {\n\tsourceColumnIndex: number\n\ttargetColumnId: string\n}\n\ninterface ClipboardPasteTargetCell {\n\ttargetCell: CellIdentifier\n\tsourceColumn: CollectionItemTableClipboardColumn\n\tsourceCell: CollectionItemTableClipboardCell\n}\n\ninterface CopySelectionOptions {\n\tevent?: ClipboardEvent\n\tcollectionNodeId: NodeID\n\titems: readonly CollectionItemNode[]\n\tcolumns: readonly CollectionItemTableColumn[]\n\tsnapshot: RowsAndColumnsSnapshot\n\tselection: SelectionStateSnapshot\n}\n\ninterface PasteSelectionOptions extends CopySelectionOptions {\n\tassetUploader: BatchAssetUploader\n\tdataIsViewOnly: boolean\n}\n\ntype ReferenceLookupValue = string | null\ntype ClipboardPasteArrayItemFieldMapping = ReadonlyMap<string, CollectionItemTableClipboardArrayItemField> | null\n\ninterface ClipboardPasteCache {\n\tavailableLocaleIds: ReadonlySet<string>\n\treferenceLookupByDataIdentifier: Map<string | undefined, ReadonlyMap<string, ReferenceLookupValue>>\n\tarrayItemFieldMappingByColumnPair: Map<string, ClipboardPasteArrayItemFieldMapping>\n}\n\nconst allClipboardControlTypes: Record<CollectionItemTableClipboardControlType, true> = {\n\t[ControlType.Array]: true,\n\t[ControlType.Boolean]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.File]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.String]: true,\n\t[ControlType.VectorSetItem]: true,\n}\n\nconst allClipboardArrayItemControlTypes: Record<CollectionItemTableClipboardArrayItemControlType, true> = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.String]: true,\n}\n\nconst collectionControlPropSchema = z.custom<CollectionControlProp>(value =>\n\tisCollectionControlProp(value as CollectionControlProp | null | undefined),\n)\n\nconst clipboardArrayItemFieldSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string(),\n\tcontrolType: z.enum(getKeys(allClipboardArrayItemControlTypes)),\n})\n\nconst clipboardColumnSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string(),\n\tcontrolType: z.enum(getKeys(allClipboardControlTypes)),\n\tarrayItemFields: z.array(clipboardArrayItemFieldSchema).optional(),\n\tdataIdentifier: z.string().optional(),\n\tdisplayTime: z.boolean().optional(),\n\tenumOptions: z.array(z.string()).optional(),\n\tenumOptionTitles: z.array(z.string()).optional(),\n\tsetModuleId: z.string().optional(),\n})\n\nconst clipboardCellSchema = z.object({\n\tcontrolProp: collectionControlPropSchema.optional(),\n\tdisplayText: z.string(),\n\tisInheritedValue: z.boolean().optional(),\n})\n\nconst collectionItemTableClipboardDataSchema = z\n\t.object({\n\t\tkind: z.literal(\"collection-item-table\"),\n\t\tversion: z.literal(collectionItemTableClipboardVersion),\n\t\trowCount: z.number().int().positive(),\n\t\tcolumnCount: z.number().int().positive(),\n\t\tcolumns: z.array(clipboardColumnSchema),\n\t\tcells: z.array(z.array(clipboardCellSchema)),\n\t})\n\t.superRefine((data, ctx) => {\n\t\tif (data.columns.length !== data.columnCount) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"columns\"],\n\t\t\t\tmessage: \"Clipboard column count does not match metadata\",\n\t\t\t})\n\t\t}\n\t\tif (data.cells.length !== data.rowCount) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tpath: [\"cells\"],\n\t\t\t\tmessage: \"Clipboard row count does not match metadata\",\n\t\t\t})\n\t\t}\n\t\tdata.cells.forEach((row, rowIndex) => {\n\t\t\tif (row.length !== data.columnCount) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [\"cells\", rowIndex],\n\t\t\t\t\tmessage: \"Clipboard row width does not match metadata\",\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\nfunction getStringEnumControlOptions(control: EnumControlDescription): {\n\tenumOptions: readonly string[]\n\tenumOptionTitles: readonly string[]\n} {\n\tconst enumOptions = control.options.map(option => {\n\t\tassert(isString(option), \"Collection table clipboard only supports string enum options\")\n\t\treturn option\n\t})\n\tconst enumOptionTitles = enumOptions.map((option, index) => {\n\t\tconst optionTitle = control.optionTitles?.[index]\n\t\treturn optionTitle ?? fallbackTitleForOption(option)\n\t})\n\n\treturn {\n\t\tenumOptions,\n\t\tenumOptionTitles,\n\t}\n}\n\nfunction isClipboardArrayItemControlType(type: ControlType): type is CollectionItemTableClipboardArrayItemControlType {\n\treturn Object.hasOwn(allClipboardArrayItemControlTypes, type)\n}\n\nfunction getArrayItemFieldsForControl(\n\tcontrol: Extract<ColumnControl, { type: ControlType.Array }>,\n): CollectionItemTableClipboardArrayItemField[] | undefined {\n\tif (!isArrayOfObjectControlDescription(control)) return undefined\n\n\tconst fields: CollectionItemTableClipboardArrayItemField[] = []\n\tfor (const [id, itemControl] of Object.entries(control.control.controls)) {\n\t\tif (!isClipboardArrayItemControlType(itemControl.type)) continue\n\t\tfields.push({\n\t\t\tid,\n\t\t\ttitle: itemControl.title ?? id,\n\t\t\tcontrolType: itemControl.type,\n\t\t})\n\t}\n\n\treturn fields.length > 0 ? fields : undefined\n}\n\nfunction getClipboardColumn(column: CollectionItemTableColumn): CollectionItemTableClipboardColumn {\n\tswitch (column.control.type) {\n\t\tcase ControlType.Enum: {\n\t\t\tconst { enumOptions, enumOptionTitles } = getStringEnumControlOptions(column.control)\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t\tenumOptions,\n\t\t\t\tenumOptionTitles,\n\t\t\t}\n\t\t}\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t\tdataIdentifier: column.control.dataIdentifier,\n\t\t\t}\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t\tsetModuleId: column.control.setModuleId,\n\t\t\t}\n\t\tcase ControlType.Date:\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t\tdisplayTime: column.control.displayTime === true,\n\t\t\t}\n\t\tcase ControlType.String:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Color:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.File:\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t}\n\t\tcase ControlType.Array:\n\t\t\treturn {\n\t\t\t\tid: column.key,\n\t\t\t\ttitle: getCollectionItemTableColumnTitle(column),\n\t\t\t\tcontrolType: column.control.type,\n\t\t\t\tarrayItemFields: getArrayItemFieldsForControl(column.control),\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(column.control)\n\t}\n}\n\nfunction parseCollectionItemTableClipboardData(value: unknown): CollectionItemTableClipboardData | null {\n\tconst result = collectionItemTableClipboardDataSchema.safeParse(value)\n\treturn result.success ? result.data : null\n}\n\nfunction getCellRangeFromSelection(\n\tsnapshot: RowsAndColumnsSnapshot,\n\tselection: SelectionStateSnapshot,\n): CellRange | null {\n\tconst ranges = getCellSelectionRanges(selection.anchor, selection.focus, snapshot)\n\tif (ranges) {\n\t\treturn {\n\t\t\trowIds: getIdsInRange(snapshot.rowIds, ranges.rowRange),\n\t\t\tcolumnIds: getIdsInRange(snapshot.columnIds, ranges.columnRange),\n\t\t}\n\t}\n\n\tconst activeCell = selection.focus ?? selection.anchor\n\tif (!activeCell) return null\n\n\tconst rowIndex = snapshot.rowIndexById.get(activeCell.rowId)\n\tconst columnIndex = snapshot.columnIndexById.get(activeCell.columnId)\n\tif (rowIndex === undefined || columnIndex === undefined) return null\n\n\tconst rowId = snapshot.rowIds[rowIndex]\n\tconst columnId = snapshot.columnIds[columnIndex]\n\tif (!rowId || !columnId) return null\n\n\treturn {\n\t\trowIds: [rowId],\n\t\tcolumnIds: [columnId],\n\t}\n}\n\nfunction buildClipboardData({\n\titems,\n\tcolumns,\n\tsnapshot,\n\tselection,\n}: Omit<CopySelectionOptions, \"collectionNodeId\" | \"event\">): CollectionItemTableClipboardData | null {\n\tconst cellRange = getCellRangeFromSelection(snapshot, selection)\n\tif (!cellRange) return null\n\n\tconst rowCount = cellRange.rowIds.length\n\tconst columnCount = cellRange.columnIds.length\n\tif (rowCount === 0 || columnCount === 0) return null\n\n\tconst itemById = new Map(items.map(item => [item.id, item] as const))\n\tconst columnById = new Map(columns.map(column => [column.key, column] as const))\n\tconst sourceColumns = cellRange.columnIds\n\t\t.map(columnId => columnById.get(columnId))\n\t\t.filter((column): column is CollectionItemTableColumn => column !== undefined)\n\tif (sourceColumns.length !== columnCount) return null\n\n\tconst cells: (readonly CollectionItemTableClipboardCell[])[] = []\n\n\tfor (const rowId of cellRange.rowIds) {\n\t\tconst item = itemById.get(rowId)\n\t\tif (!item) return null\n\n\t\tconst rowCells = sourceColumns.map(column => {\n\t\t\tconst controlProp = column.getControlProp(item)\n\t\t\tconst collectionControlProp = isCollectionControlProp(controlProp)\n\t\t\t\t? getClipboardControlPropForCell(column, controlProp)\n\t\t\t\t: undefined\n\t\t\treturn {\n\t\t\t\tcontrolProp: collectionControlProp,\n\t\t\t\tdisplayText: getClipboardDisplayTextForCell(column, item, collectionControlProp),\n\t\t\t\tisInheritedValue: getClipboardInheritedStateForCell(column, item),\n\t\t\t}\n\t\t})\n\t\tcells.push(rowCells)\n\t}\n\n\treturn {\n\t\tkind: \"collection-item-table\",\n\t\tversion: collectionItemTableClipboardVersion,\n\t\trowCount,\n\t\tcolumnCount,\n\t\tcolumns: sourceColumns.map(getClipboardColumn),\n\t\tcells,\n\t}\n}\n\nfunction getClipboardControlPropForCell(\n\tcolumn: CollectionItemTableColumn,\n\tcontrolProp: CollectionControlProp,\n): CollectionControlProp {\n\tif (column.control.type !== ControlType.RichText || controlProp.type !== ControlType.RichText) return controlProp\n\n\treturn updateModuleIdentifiersInRichTextControlProp(controlProp, getExternalModuleIdentifierForRichTextCopy)\n}\n\nfunction getClipboardDisplayTextForCell(\n\tcolumn: CollectionItemTableColumn,\n\titem: CollectionItemNode,\n\tcontrolProp: CollectionControlProp | undefined,\n): string {\n\tif (column.control.type === ControlType.RichText) {\n\t\treturn getPlainTextFromRichTextTreeValue(getRichTextControlPropValue(column.control, controlProp))\n\t}\n\n\tif (column.control.type === ControlType.Link) {\n\t\tconst value = getLinkControlPropValue(column.control, controlProp)\n\t\tif (isLink(value)) {\n\t\t\tconst resolvedValue = resolveLinkToURL(engine.tree, value, item.cache)\n\t\t\tif (resolvedValue) return resolvedValue\n\n\t\t\tif (isLinkToWebPage(value)) {\n\t\t\t\tconst displayValue = getResolvedLinkToWebPage(engine.tree, value, SlugBehavior.DisplayName)\n\t\t\t\tif (displayValue) return displayValue\n\t\t\t}\n\t\t}\n\t}\n\n\treturn getPlainTextValueForCell(column, item)\n}\n\nfunction getClipboardInheritedStateForCell(column: CollectionItemTableColumn, item: CollectionItemNode): boolean {\n\tif (column.control.type !== ControlType.String) return false\n\treturn getTextValueInfoForCell(column, item).isInheritedValue\n}\n\nfunction escapeTabSeparatedValue(value: string, forceQuote = false): string {\n\tif (!forceQuote && !tsvEscapableCharacterPattern.test(value)) return value\n\treturn `\"${value.replaceAll('\"', '\"\"')}\"`\n}\n\nfunction getClipboardTSVCellValue(\n\tcolumn: CollectionItemTableClipboardColumn,\n\tcell: CollectionItemTableClipboardCell,\n): string {\n\tswitch (column.controlType) {\n\t\tcase ControlType.Date:\n\t\t\treturn getClipboardDateDisplayValue(column, cell)\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn getClipboardMultiCollectionReferenceValue(column, cell)\n\t\tdefault:\n\t\t\treturn cell.displayText\n\t}\n}\n\nfunction getEscapedClipboardTSVCellValue(\n\tcolumn: CollectionItemTableClipboardColumn | undefined,\n\tcell: CollectionItemTableClipboardCell,\n): string {\n\tconst value = column ? getClipboardTSVCellValue(column, cell) : cell.displayText\n\tconst shouldForceQuote =\n\t\tcolumn?.controlType === ControlType.Date && column.displayTime === true && value.includes(\" \")\n\treturn escapeTabSeparatedValue(value, shouldForceQuote)\n}\n\nfunction serializeCollectionItemTableClipboardRowAsTSV(\n\trow: readonly CollectionItemTableClipboardCell[],\n\tcolumns: readonly CollectionItemTableClipboardColumn[],\n): string {\n\treturn row.map((cell, index) => getEscapedClipboardTSVCellValue(columns[index], cell)).join(\"\\t\")\n}\n\nfunction serializeCollectionItemTableClipboardAsTSV(data: CollectionItemTableClipboardData): string {\n\treturn data.cells.map(row => serializeCollectionItemTableClipboardRowAsTSV(row, data.columns)).join(\"\\n\")\n}\n\nexport function parseCollectionItemTablePlainTextGrid(text: string): string[][] {\n\tconst rows: string[][] = []\n\tlet currentRow: string[] = []\n\tlet currentField = \"\"\n\tlet withinQuotes = false\n\tlet fieldStartedWithQuote = false\n\n\tfor (let index = 0; index < text.length; index++) {\n\t\tconst character = text[index]\n\t\tconst nextCharacter = text[index + 1]\n\n\t\tif (character === '\"') {\n\t\t\tif (!withinQuotes) {\n\t\t\t\tif (currentField.length === 0) {\n\t\t\t\t\twithinQuotes = true\n\t\t\t\t\tfieldStartedWithQuote = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tcurrentField += character\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (withinQuotes && nextCharacter === '\"') {\n\t\t\t\tcurrentField += character\n\t\t\t\tindex++\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (nextCharacter === \"\\t\" || nextCharacter === \"\\n\" || nextCharacter === \"\\r\" || nextCharacter === undefined) {\n\t\t\t\twithinQuotes = false\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcurrentField += character\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!withinQuotes && character === \"\\t\") {\n\t\t\tcurrentRow.push(currentField)\n\t\t\tcurrentField = \"\"\n\t\t\tfieldStartedWithQuote = false\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!withinQuotes && (character === \"\\n\" || character === \"\\r\")) {\n\t\t\tif (character === \"\\r\" && nextCharacter === \"\\n\") {\n\t\t\t\tindex++\n\t\t\t}\n\t\t\tcurrentRow.push(currentField)\n\t\t\trows.push(currentRow)\n\t\t\tcurrentRow = []\n\t\t\tcurrentField = \"\"\n\t\t\tfieldStartedWithQuote = false\n\t\t\tcontinue\n\t\t}\n\n\t\tcurrentField += character\n\t}\n\n\tif (withinQuotes && fieldStartedWithQuote) {\n\t\tcurrentField = `\"${currentField}`\n\t}\n\n\tcurrentRow.push(currentField)\n\trows.push(currentRow)\n\n\tif ((text.endsWith(\"\\n\") || text.endsWith(\"\\r\")) && rows.at(-1)?.length === 1 && rows.at(-1)?.[0] === \"\") {\n\t\trows.pop()\n\t}\n\n\treturn rows\n}\n\nfunction createClipboardDataFromPlainText(text: string): CollectionItemTableClipboardData | null {\n\tconst parsedRows = parseCollectionItemTablePlainTextGrid(text)\n\tconst rowCount = parsedRows.length\n\tconst columnCount = parsedRows.reduce((maximum, row) => Math.max(maximum, row.length), 0)\n\tif (rowCount === 0 || columnCount === 0) return null\n\n\tconst columns: CollectionItemTableClipboardColumn[] = Array.from({ length: columnCount }, (_value, index) => ({\n\t\tid: `text-column-${index}`,\n\t\ttitle: `Column ${index + 1}`,\n\t\tcontrolType: ControlType.String,\n\t}))\n\n\treturn {\n\t\tkind: \"collection-item-table\",\n\t\tversion: collectionItemTableClipboardVersion,\n\t\trowCount,\n\t\tcolumnCount,\n\t\tcolumns,\n\t\tcells: parsedRows.map(row =>\n\t\t\tArray.from({ length: columnCount }, (_value, index) => ({\n\t\t\t\tdisplayText: row[index] ?? \"\",\n\t\t\t})),\n\t\t),\n\t}\n}\n\nasync function createClipboardDataFromHTML(\n\thtml: string,\n\tassetUploader: BatchAssetUploader,\n): Promise<CollectionItemTableClipboardData> {\n\tconst richTextValue = await convertHTMLToCollectionRichText(html, assetUploader, {\n\t\tshowImageUploadProgress: true,\n\t})\n\n\treturn {\n\t\tkind: \"collection-item-table\",\n\t\tversion: collectionItemTableClipboardVersion,\n\t\trowCount: 1,\n\t\tcolumnCount: 1,\n\t\tcolumns: [\n\t\t\t{\n\t\t\t\tid: \"html-column-0\",\n\t\t\t\ttitle: \"Column 1\",\n\t\t\t\tcontrolType: ControlType.RichText,\n\t\t\t},\n\t\t],\n\t\tcells: [\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tcontrolProp: {\n\t\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\t\tvalue: richTextValue,\n\t\t\t\t\t},\n\t\t\t\t\tdisplayText: getPlainTextFromRichTextTreeValue(richTextValue),\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t}\n}\n\nfunction normalizeLookupText(value: string): string {\n\treturn value.trim().toLocaleLowerCase()\n}\n\nfunction getFallbackColumnAssignments(\n\tsourceColumnCount: number,\n\ttargetColumns: readonly CollectionItemTableColumn[],\n\tanchorColumnId: string,\n): ColumnAssignment[] {\n\tconst anchorIndex = targetColumns.findIndex(column => column.key === anchorColumnId)\n\tif (anchorIndex < 0) return []\n\n\treturn targetColumns.slice(anchorIndex, anchorIndex + sourceColumnCount).map((column, sourceColumnIndex) => ({\n\t\tsourceColumnIndex,\n\t\ttargetColumnId: column.key,\n\t}))\n}\n\nexport function getCollectionItemTablePasteColumnAssignments(options: {\n\tsourceColumns: readonly CollectionItemTableClipboardColumn[]\n\ttargetColumns: readonly CollectionItemTableColumn[]\n\tanchorColumnId: string\n}): ColumnAssignment[] {\n\tconst { sourceColumns, targetColumns, anchorColumnId } = options\n\tif (sourceColumns.length === 0 || targetColumns.length === 0) return []\n\n\tconst anchorIndex = targetColumns.findIndex(column => column.key === anchorColumnId)\n\tif (anchorIndex < 0) return []\n\n\tconst assignments = new Map<number, ColumnAssignment>()\n\tconst usedTargetColumnIds = new Set<string>()\n\n\tconst assignColumn = (\n\t\tsourceColumnIndex: number,\n\t\tmatcher: (column: CollectionItemTableColumn) => boolean,\n\t): boolean => {\n\t\tfor (const column of targetColumns) {\n\t\t\tif (usedTargetColumnIds.has(column.key)) continue\n\t\t\tif (!matcher(column)) continue\n\n\t\t\tassignments.set(sourceColumnIndex, {\n\t\t\t\tsourceColumnIndex,\n\t\t\t\ttargetColumnId: column.key,\n\t\t\t})\n\t\t\tusedTargetColumnIds.add(column.key)\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tsourceColumns.forEach((sourceColumn, sourceColumnIndex) => {\n\t\tassignColumn(sourceColumnIndex, column => column.key === sourceColumn.id)\n\t})\n\n\tsourceColumns.forEach((sourceColumn, sourceColumnIndex) => {\n\t\tif (assignments.has(sourceColumnIndex)) return\n\t\tconst sourceTitle = normalizeLookupText(sourceColumn.title)\n\t\tif (!sourceTitle.length) return\n\t\tassignColumn(\n\t\t\tsourceColumnIndex,\n\t\t\tcolumn => normalizeLookupText(getCollectionItemTableColumnTitle(column)) === sourceTitle,\n\t\t)\n\t})\n\n\tsourceColumns.forEach((_sourceColumn, sourceColumnIndex) => {\n\t\tif (assignments.has(sourceColumnIndex)) return\n\n\t\tfor (let columnOffset = 0; columnOffset < targetColumns.length; columnOffset++) {\n\t\t\tconst preferredColumnIndex = anchorIndex + sourceColumnIndex + columnOffset\n\t\t\tconst preferredColumn = targetColumns[preferredColumnIndex]\n\t\t\tif (!preferredColumn) continue\n\t\t\tif (usedTargetColumnIds.has(preferredColumn.key)) continue\n\n\t\t\tassignments.set(sourceColumnIndex, {\n\t\t\t\tsourceColumnIndex,\n\t\t\t\ttargetColumnId: preferredColumn.key,\n\t\t\t})\n\t\t\tusedTargetColumnIds.add(preferredColumn.key)\n\t\t\treturn\n\t\t}\n\t})\n\n\treturn Array.from(assignments.values())\n}\n\nfunction tryResolveBoolean(text: string): boolean | undefined {\n\tswitch (normalizeLookupText(text)) {\n\t\tcase \"true\":\n\t\tcase \"yes\":\n\t\tcase \"1\":\n\t\tcase \"on\":\n\t\t\treturn true\n\t\tcase \"false\":\n\t\tcase \"no\":\n\t\tcase \"0\":\n\t\tcase \"off\":\n\t\t\treturn false\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nfunction tryResolveEnumValue(\n\tcontrol: EnumControlDescription,\n\tsourceColumn: CollectionItemTableClipboardColumn,\n\tsourceCell: CollectionItemTableClipboardCell,\n): string | undefined {\n\tconst { enumOptions, enumOptionTitles } = getStringEnumControlOptions(control)\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Enum) {\n\t\tconst sourceValue = getEnumControlPropValue(\n\t\t\t{\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\toptions: [...(sourceColumn.enumOptions ?? [])],\n\t\t\t\toptionTitles: sourceColumn.enumOptionTitles ? [...sourceColumn.enumOptionTitles] : undefined,\n\t\t\t},\n\t\t\tsourceControlProp,\n\t\t)\n\t\tif (isString(sourceValue) && enumOptions.includes(sourceValue)) {\n\t\t\treturn sourceValue\n\t\t}\n\t}\n\n\tconst normalizedDisplayText = normalizeLookupText(sourceCell.displayText)\n\tfor (let index = 0; index < enumOptions.length; index++) {\n\t\tconst option = enumOptions[index]\n\t\tconst optionTitle = enumOptionTitles[index]\n\t\tif (isString(optionTitle) && normalizeLookupText(optionTitle) === normalizedDisplayText) return option\n\t\tif (normalizeLookupText(String(option)) === normalizedDisplayText) return option\n\t}\n\n\treturn undefined\n}\n\nfunction getReferenceLookup(dataIdentifier: string | undefined): ReadonlyMap<string, ReferenceLookupValue> {\n\tif (!isModuleExportIdentifier(dataIdentifier)) return new Map()\n\n\tconst collection = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\tif (!collection) return new Map()\n\n\tconst lookup = new Map<string, ReferenceLookupValue>()\n\tfor (const item of collection.getUnsortedChildren()) {\n\t\tif (!isCollectionItemNode(item)) continue\n\n\t\tconst key = normalizeLookupText(getCollectionItemName(collection, item))\n\t\tconst existingValue = lookup.get(key)\n\t\tif (existingValue === undefined) {\n\t\t\tlookup.set(key, item.id)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (existingValue !== item.id) {\n\t\t\tlookup.set(key, null)\n\t\t}\n\t}\n\treturn lookup\n}\n\nfunction createClipboardPasteCache(): ClipboardPasteCache {\n\treturn {\n\t\tavailableLocaleIds: createAvailableLocaleIdsForPaste(),\n\t\treferenceLookupByDataIdentifier: new Map(),\n\t\tarrayItemFieldMappingByColumnPair: new Map(),\n\t}\n}\n\nfunction getCachedReferenceLookup(\n\tcache: ClipboardPasteCache,\n\tdataIdentifier: string | undefined,\n): ReadonlyMap<string, ReferenceLookupValue> {\n\tconst lookup = cache.referenceLookupByDataIdentifier.get(dataIdentifier)\n\tif (lookup) return lookup\n\n\tconst newLookup = getReferenceLookup(dataIdentifier)\n\tcache.referenceLookupByDataIdentifier.set(dataIdentifier, newLookup)\n\treturn newLookup\n}\n\nfunction getReferenceLookupValue(\n\tlookup: ReadonlyMap<string, ReferenceLookupValue>,\n\tdisplayText: string,\n): string | undefined {\n\tconst value = lookup.get(normalizeLookupText(displayText))\n\treturn isString(value) ? value : undefined\n}\n\nfunction getVectorIdentifierByDisplayText(\n\tcolumn: CollectionItemTableColumn,\n\tcontext: CellAdapterContext,\n\tdisplayText: string,\n): string | undefined {\n\tif (column.control.type !== ControlType.VectorSetItem) return undefined\n\n\tconst defaultIdentifier = defaultIdentifierForControl(column.control, engine.tree, engine.stores.modulesStore)\n\tif (!defaultIdentifier) return undefined\n\n\tconst currentIdentifier = getVectorSetItemControlPropValue(column.control, context.getCurrentControlProp())\n\tconst vectorSetInfo = vectorSetInfoForPopout(\n\t\tisString(currentIdentifier) ? currentIdentifier : defaultIdentifier,\n\t\tdefaultIdentifier,\n\t\tengine.tree,\n\t\tengine.stores.modulesStore,\n\t\tengine.stores.vectorsStore,\n\t)\n\tif (!vectorSetInfo) return undefined\n\n\tconst normalizedDisplayText = normalizeLookupText(displayText)\n\tfor (const item of Object.values(vectorSetInfo.vectorSet.items)) {\n\t\tif (normalizeLookupText(item.name) === normalizedDisplayText) {\n\t\t\treturn item.moduleIdentifier\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nconst disallowedClipboardSourceForStringColumn: Record<CollectionItemTableClipboardControlType, boolean> = {\n\t[ControlType.Image]: true,\n\t[ControlType.ResponsiveImage]: true,\n\t[ControlType.File]: true,\n\n\t[ControlType.Boolean]: false,\n\t[ControlType.Number]: false,\n\t[ControlType.RichText]: false,\n\t[ControlType.String]: false,\n\t[ControlType.Enum]: false,\n\t[ControlType.Color]: false,\n\t[ControlType.Array]: false,\n\t[ControlType.Link]: false,\n\t[ControlType.Date]: false,\n\t[ControlType.CollectionReference]: false,\n\t[ControlType.MultiCollectionReference]: false,\n\t[ControlType.VectorSetItem]: false,\n}\n\nfunction getClipboardStringValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.String && isString(sourceControlProp.value)) {\n\t\treturn sourceControlProp.value\n\t}\n\n\treturn sourceCell.displayText\n}\n\nfunction getClipboardRichTextValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst text = sourceCell.displayText.trim()\n\tif (!text) return \"\"\n\n\treturn text\n\t\t.split(newlineSplitPattern)\n\t\t.map(line => {\n\t\t\tconst trimmedLine = line.trim()\n\t\t\treturn trimmedLine.length === 0 ? \"<br />\" : `<p>${escapeHTML(trimmedLine)}</p>`\n\t\t})\n\t\t.join(\"\")\n}\n\nfunction getDefaultStringValueForControl(control: Extract<ColumnControl, { type: ControlType.String }>): string {\n\tconst controlProp = getControlProp(control, undefined)\n\treturn isString(controlProp?.value) ? controlProp.value : \"\"\n}\n\nfunction getInheritedStringValueForCell(\n\tcontext: CellAdapterContext,\n\tcontrol: Extract<ColumnControl, { type: ControlType.String }>,\n): string | null {\n\tconst basedOnInfo = getBasedOnStringVariableInfo(context.column, context.item)\n\tif (!basedOnInfo) return null\n\n\tconst associatedValue = getAssociatedVariableStringValue(\n\t\tbasedOnInfo.variable,\n\t\tbasedOnInfo.collection.variables,\n\t\tcontext.item,\n\t)\n\tif (associatedValue !== undefined) return associatedValue\n\n\t// Keep clipboard \"matches inherited value\" checks aligned with the grid display when the\n\t// associated variable reference is broken and the column falls back to its own default value.\n\treturn getDefaultStringValueForControl(control)\n}\n\nfunction getPastedStringValueForTarget(\n\ttarget: ClipboardPasteTargetCell,\n\tcolumn: CollectionItemTableColumn,\n): string | undefined {\n\tif (column.control.type !== ControlType.String) return undefined\n\tif (disallowedClipboardSourceForStringColumn[target.sourceColumn.controlType]) return undefined\n\n\tconst sourceControlProp = target.sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.String && !isSlugColumn(column) && isString(sourceControlProp.value)) {\n\t\treturn sourceControlProp.value\n\t}\n\n\tconst nextText = getClipboardStringValue(target.sourceCell)\n\treturn isSlugColumn(column) ? slugify(nextText) : nextText\n}\n\ntype MutableClipboardPasteTargetsByColumnId = Map<string, ClipboardPasteTargetCell>\ntype MutableClipboardPasteTargetsByRowId = Map<NodeID, MutableClipboardPasteTargetsByColumnId>\ntype ClipboardPasteTargetsByColumnId = ReadonlyMap<string, ClipboardPasteTargetCell>\ntype ClipboardPasteTargetsByRowId = ReadonlyMap<NodeID, ClipboardPasteTargetsByColumnId>\n\nfunction getPastedAssociatedStringValueForCell(\n\tcontext: CellAdapterContext,\n\ttargetsByRowId: ClipboardPasteTargetsByRowId,\n\tcolumnsById: ReadonlyMap<string, CollectionItemTableColumn>,\n): string | undefined {\n\tconst basedOnInfo = getBasedOnStringVariableInfo(context.column, context.item)\n\tconst associatedVariableId = basedOnInfo?.variable.associatedStringVariable\n\tif (!associatedVariableId) return undefined\n\n\tconst rowTargets = targetsByRowId.get(context.cell.rowId)\n\tconst associatedTarget = rowTargets?.get(associatedVariableId)\n\tif (!associatedTarget) return undefined\n\n\tconst associatedColumn = columnsById.get(associatedVariableId)\n\tif (!associatedColumn) return undefined\n\n\treturn getPastedStringValueForTarget(associatedTarget, associatedColumn)\n}\n\nfunction getPastedAssociatedStringValueForTarget(\n\ttarget: ClipboardPasteTargetCell,\n\tcontext: CellAdapterContext,\n\ttargetsByRowId: ClipboardPasteTargetsByRowId,\n\tcolumnsById: ReadonlyMap<string, CollectionItemTableColumn>,\n): string | undefined {\n\tif (!target.sourceCell.isInheritedValue) return undefined\n\n\treturn getPastedAssociatedStringValueForCell(context, targetsByRowId, columnsById)\n}\n\nfunction getClipboardNumberDisplayValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Number && isNumber(sourceControlProp.value)) {\n\t\treturn String(sourceControlProp.value)\n\t}\n\n\treturn sourceCell.displayText\n}\n\nfunction getClipboardBooleanValue(sourceCell: CollectionItemTableClipboardCell): boolean | undefined {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Boolean && typeof sourceControlProp.value === \"boolean\") {\n\t\treturn sourceControlProp.value\n\t}\n\n\treturn tryResolveBoolean(sourceCell.displayText)\n}\n\nfunction getClipboardDateValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Date && isString(sourceControlProp.value)) {\n\t\treturn sourceControlProp.value\n\t}\n\n\treturn sourceCell.displayText\n}\n\nfunction getClipboardDateDisplayValue(\n\tcolumn: CollectionItemTableClipboardColumn,\n\tsourceCell: CollectionItemTableClipboardCell,\n): string {\n\tconst value = getClipboardDateValue(sourceCell)\n\tif (!value) return value\n\n\tif (!column.displayTime) {\n\t\treturn getDateInputDisplayValue(value)\n\t}\n\n\treturn getDateTimeInputDisplayValue(value).replace(\"T\", \" \")\n}\n\nfunction normalizeClipboardDateValue(value: string): string | undefined {\n\tif (dateOnlyPattern.test(value)) {\n\t\treturn getDateControlValueForInputValue(value, false)\n\t}\n\n\tif (dateTimeWithMinutePattern.test(value)) {\n\t\treturn getDateControlValueForInputValue(value, true)\n\t}\n\n\tif (dateTimeWithSpaceMinutePattern.test(value)) {\n\t\treturn getDateControlValueForInputValue(value.replace(\" \", \"T\"), true)\n\t}\n\n\tconst date = getValidDate(value)\n\treturn date ? date.toJSON() : undefined\n}\n\nfunction getClipboardMultiCollectionReferenceValue(\n\tcolumn: CollectionItemTableClipboardColumn,\n\tsourceCell: CollectionItemTableClipboardCell,\n): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type !== ControlType.MultiCollectionReference) {\n\t\treturn sourceCell.displayText\n\t}\n\tif (!isString(column.dataIdentifier)) return sourceCell.displayText\n\tconst value = getMultiCollectionReferenceControlPropValue(\n\t\t{\n\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\tdataIdentifier: column.dataIdentifier,\n\t\t},\n\t\tsourceControlProp,\n\t)\n\tif (!isReadonlyArray(value)) return sourceCell.displayText\n\n\tconst collection = getCollectionForIdentifier(\n\t\tengine.tree,\n\t\tisModuleExportIdentifier(column.dataIdentifier) ? column.dataIdentifier : undefined,\n\t)\n\tif (!collection) return sourceCell.displayText\n\n\tconst names: string[] = []\n\n\tfor (const itemId of value) {\n\t\tconst collectionItem = engine.tree.getNodeWithTrait(itemId, isCollectionItemNode)\n\t\tif (!collectionItem) continue\n\n\t\tconst parent = engine.tree.getNodeParent(collectionItem)\n\t\tif (!parent || parent.id !== collection.id) continue\n\n\t\tconst itemName = getCollectionItemName(collection, collectionItem)\n\t\tnames.push(itemName)\n\t}\n\n\treturn names.length > 0 ? names.join(\"\\n\") : sourceCell.displayText\n}\n\nfunction getClipboardColorValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Color && isString(sourceControlProp.value)) {\n\t\treturn sourceControlProp.value\n\t}\n\n\treturn sourceCell.displayText\n}\n\nfunction getNormalizedClipboardColorValue(sourceCell: CollectionItemTableClipboardCell): string | undefined {\n\tconst value = getClipboardColorValue(sourceCell).trim()\n\tif (!isValidColorOrToken(value)) return undefined\n\treturn hexColorWithoutPrefixPattern.test(value) ? `#${value}` : value\n}\n\nfunction getClipboardFileValue(sourceCell: CollectionItemTableClipboardCell): string {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.File && isString(sourceControlProp.value)) {\n\t\treturn sourceControlProp.value\n\t}\n\n\treturn sourceCell.displayText\n}\n\nfunction getClipboardLinkValue(\n\tcontrol: LinkControlDescription,\n\tsourceCell: CollectionItemTableClipboardCell,\n): Link | undefined {\n\tconst sourceControlProp = sourceCell.controlProp\n\tif (sourceControlProp?.type === ControlType.Link) {\n\t\tconst value = getLinkControlPropValue(control, sourceControlProp)\n\t\treturn isLink(value) ? value : undefined\n\t}\n\n\treturn getVekterLinkFromURL(engine, sourceCell.displayText, null)\n}\n\nfunction getArrayItemControlTypeMatchingKey(\n\ttype: CollectionItemTableClipboardArrayItemControlType,\n): ArrayItemControlPropType {\n\treturn type === ControlType.ResponsiveImage ? ControlType.Image : type\n}\n\nfunction arrayItemFieldTypesMatch(\n\tsourceType: CollectionItemTableClipboardArrayItemControlType,\n\ttargetType: CollectionItemTableClipboardArrayItemControlType,\n): boolean {\n\treturn getArrayItemControlTypeMatchingKey(sourceType) === getArrayItemControlTypeMatchingKey(targetType)\n}\n\nfunction arrayItemControlPropMatchesTargetType(\n\tcontrolProp: CollectionControlProp | undefined,\n\ttargetType: CollectionItemTableClipboardArrayItemControlType,\n): controlProp is CollectionControlProp {\n\tif (!controlProp || !isClipboardArrayItemControlType(controlProp.type)) return false\n\treturn arrayItemFieldTypesMatch(controlProp.type, targetType)\n}\n\nfunction getArrayItemFieldMapping(\n\tsourceFields: readonly CollectionItemTableClipboardArrayItemField[],\n\ttargetFields: readonly CollectionItemTableClipboardArrayItemField[],\n): ClipboardPasteArrayItemFieldMapping {\n\tif (sourceFields.length === 0 || targetFields.length === 0) return null\n\n\tconst mapping = new Map<string, CollectionItemTableClipboardArrayItemField>()\n\tconst usedTargetFieldIds = new Set<string>()\n\n\tconst assignField = (\n\t\tsourceField: CollectionItemTableClipboardArrayItemField,\n\t\tmatcher: (targetField: CollectionItemTableClipboardArrayItemField) => boolean,\n\t): boolean => {\n\t\tfor (const targetField of targetFields) {\n\t\t\tif (usedTargetFieldIds.has(targetField.id)) continue\n\t\t\tif (!arrayItemFieldTypesMatch(sourceField.controlType, targetField.controlType)) continue\n\t\t\tif (!matcher(targetField)) continue\n\n\t\t\tmapping.set(sourceField.id, targetField)\n\t\t\tusedTargetFieldIds.add(targetField.id)\n\t\t\treturn true\n\t\t}\n\n\t\treturn false\n\t}\n\n\tfor (const sourceField of sourceFields) {\n\t\tconst targetField = targetFields.find(field => field.id === sourceField.id)\n\t\tif (!targetField) continue\n\t\tif (!arrayItemFieldTypesMatch(sourceField.controlType, targetField.controlType)) continue\n\n\t\tif (usedTargetFieldIds.has(targetField.id)) continue\n\n\t\tmapping.set(sourceField.id, targetField)\n\t\tusedTargetFieldIds.add(targetField.id)\n\t}\n\n\tfor (const sourceField of sourceFields) {\n\t\tif (mapping.has(sourceField.id)) continue\n\t\tconst sourceTitle = normalizeLookupText(sourceField.title)\n\t\tif (!sourceTitle.length) continue\n\n\t\tassignField(sourceField, targetField => normalizeLookupText(targetField.title) === sourceTitle)\n\t}\n\n\tfor (const sourceField of sourceFields) {\n\t\tif (mapping.has(sourceField.id)) continue\n\t\tassignField(sourceField, () => true)\n\t}\n\n\treturn mapping.size > 0 ? mapping : null\n}\n\nfunction getArrayItemFieldMappingCacheKey(\n\tsourceColumn: CollectionItemTableClipboardColumn,\n\ttargetColumn: CollectionItemTableColumn,\n): string {\n\treturn `${sourceColumn.id}\\u0000${targetColumn.key}`\n}\n\nfunction getCachedArrayItemFieldMapping(\n\tsourceColumn: CollectionItemTableClipboardColumn,\n\ttargetColumn: CollectionItemTableColumn,\n\tcache: ClipboardPasteCache,\n): ClipboardPasteArrayItemFieldMapping {\n\tconst cacheKey = getArrayItemFieldMappingCacheKey(sourceColumn, targetColumn)\n\tconst cachedMapping = cache.arrayItemFieldMappingByColumnPair.get(cacheKey)\n\tif (cachedMapping !== undefined) return cachedMapping\n\n\tlet mapping: ClipboardPasteArrayItemFieldMapping = null\n\tif (targetColumn.control.type === ControlType.Array && isArrayOfObjectControlDescription(targetColumn.control)) {\n\t\tconst sourceFields = sourceColumn.arrayItemFields\n\t\tconst targetFields = getArrayItemFieldsForControl(targetColumn.control)\n\t\tif (sourceFields && targetFields) {\n\t\t\tmapping = getArrayItemFieldMapping(sourceFields, targetFields)\n\t\t}\n\t}\n\n\tcache.arrayItemFieldMappingByColumnPair.set(cacheKey, mapping)\n\treturn mapping\n}\n\nfunction getArrayControlPropForPasteTarget(\n\tsourceColumn: CollectionItemTableClipboardColumn,\n\tsourceControlProp: CollectionControlProp<ControlType.Array>,\n\ttargetColumn: CollectionItemTableColumn,\n\tcache: ClipboardPasteCache,\n): CollectionControlProp<ControlType.Array> | undefined {\n\tif (sourceColumn.id === targetColumn.key) return sourceControlProp\n\tif (!isCollectionArrayControlPropValue(sourceControlProp.value)) return undefined\n\n\tconst fieldMapping = getCachedArrayItemFieldMapping(sourceColumn, targetColumn, cache)\n\tif (!fieldMapping) return undefined\n\n\treturn {\n\t\ttype: ControlType.Array,\n\t\tvalue: sourceControlProp.value.map(item => {\n\t\t\tif (item.value === null) return item\n\n\t\t\tconst nextValue: NonNullable<typeof item.value> = {}\n\t\t\tfor (const [sourceFieldId, itemControlProp] of Object.entries(item.value)) {\n\t\t\t\tconst targetField = fieldMapping.get(sourceFieldId)\n\t\t\t\tif (!targetField) continue\n\t\t\t\tif (!arrayItemControlPropMatchesTargetType(itemControlProp, targetField.controlType)) continue\n\t\t\t\tnextValue[targetField.id] = itemControlProp\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...item,\n\t\t\t\tvalue: nextValue,\n\t\t\t}\n\t\t}),\n\t}\n}\n\nfunction getMultiCollectionReferenceParts(displayText: string): string[] {\n\tconst lineSeparatedParts = displayText\n\t\t.split(newlineSplitPattern)\n\t\t.map(part => part.trim())\n\t\t.filter(part => part.length > 0)\n\tif (lineSeparatedParts.length > 1) return lineSeparatedParts\n\n\tconst commaSeparatedParts = displayText\n\t\t.split(\",\")\n\t\t.map(part => part.trim())\n\t\t.filter(part => part.length > 0)\n\treturn commaSeparatedParts.length > 1 ? commaSeparatedParts : []\n}\n\nfunction createAvailableLocaleIdsForPaste(): ReadonlySet<string> {\n\treturn new Set([defaultLocaleId, ...(engine.tree.root.locales?.map(locale => locale.id) ?? [])])\n}\n\nfunction filterLocalizedValuesForDocument<T = string>(\n\tlocalizedValues: LocalizedValues<T> | undefined,\n\tavailableLocaleIds: ReadonlySet<string>,\n): LocalizedValues<T> | undefined {\n\tif (!localizedValues) return undefined\n\n\tconst entries = Object.entries(localizedValues)\n\tconst filteredEntries = entries.filter(([localeId]) => availableLocaleIds.has(localeId))\n\tif (filteredEntries.length === entries.length) return localizedValues\n\tif (filteredEntries.length === 0) return undefined\n\n\treturn Object.fromEntries(filteredEntries)\n}\n\nfunction sanitizeLocalizedControlPropForDocument(\n\tcontrolProp: CollectionControlProp,\n\tcache: ClipboardPasteCache,\n): CollectionControlProp {\n\tlet nextControlProp = controlProp\n\n\tif (withLocalizableControlPropValue(nextControlProp)) {\n\t\tconst filteredValueLocalized = filterLocalizedValuesForDocument(\n\t\t\tnextControlProp.valueLocalized,\n\t\t\tcache.availableLocaleIds,\n\t\t)\n\t\tif (filteredValueLocalized !== nextControlProp.valueLocalized) {\n\t\t\tnextControlProp = {\n\t\t\t\t...nextControlProp,\n\t\t\t\tvalueLocalized: filteredValueLocalized,\n\t\t\t}\n\t\t}\n\t}\n\n\tif (hasControlAltLocalized(nextControlProp) && nextControlProp.type === ControlType.Image) {\n\t\tconst filteredAltLocalized = filterLocalizedValuesForDocument(\n\t\t\tnextControlProp.altLocalized,\n\t\t\tcache.availableLocaleIds,\n\t\t)\n\t\tif (filteredAltLocalized !== nextControlProp.altLocalized) {\n\t\t\tnextControlProp = {\n\t\t\t\t...nextControlProp,\n\t\t\t\taltLocalized: filteredAltLocalized,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nextControlProp\n}\n\nfunction getExternalModuleIdentifierForRichTextCopy(\n\tidentifier: ModuleExportIdentifierString,\n): ModuleExportIdentifierString | undefined {\n\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\tif (parsedIdentifier?.kind !== \"localModuleExport\") return\n\n\tconst persistedModule = engine.stores.modulesStore.getPersistedModuleByLocalId(parsedIdentifier.localId)\n\tif (!persistedModule?.files.module) return\n\n\treturn externalModuleIdentifier(\n\t\tpersistedModule.id,\n\t\tpersistedModule.saveId,\n\t\tpersistedModule.files.module,\n\t\tparsedIdentifier.exportSpecifier,\n\t).value\n}\n\nfunction getLocalModuleIdentifierForRichTextPaste(\n\tidentifier: ModuleExportIdentifierString,\n): ModuleExportIdentifierString | undefined {\n\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\tif (parsedIdentifier?.kind !== \"externalModuleExport\") return\n\n\tconst persistedModule = engine.stores.modulesStore.getPersistedModuleByGlobalId(parsedIdentifier.moduleId)\n\tif (!persistedModule) return\n\n\treturn toLocalIdentifier(parsedIdentifier, persistedModule.localId).value\n}\n\nfunction getIsExpandedSelection(selectionRanges: ReturnType<typeof getCellSelectionRanges>): boolean {\n\tif (!selectionRanges) return false\n\n\treturn (\n\t\tselectionRanges.rowRange.end > selectionRanges.rowRange.start ||\n\t\tselectionRanges.columnRange.end > selectionRanges.columnRange.start\n\t)\n}\n\nfunction getTargetRowIds(options: {\n\tsnapshot: RowsAndColumnsSnapshot\n\tselectionRanges: ReturnType<typeof getCellSelectionRanges>\n\tisExpandedSelection: boolean\n\tanchorRowIndex: number\n\tclipboardRowCount: number\n}): readonly NodeID[] {\n\tconst { snapshot, selectionRanges, isExpandedSelection, anchorRowIndex, clipboardRowCount } = options\n\tif (isExpandedSelection) {\n\t\tif (!selectionRanges) return []\n\t\treturn getIdsInRange(snapshot.rowIds, selectionRanges.rowRange)\n\t}\n\n\treturn snapshot.rowIds.slice(anchorRowIndex, anchorRowIndex + clipboardRowCount)\n}\n\nfunction getExpandedSelectionColumnAssignments(\n\tsnapshot: RowsAndColumnsSnapshot,\n\tselectionRanges: NonNullable<ReturnType<typeof getCellSelectionRanges>>,\n\tclipboardColumnCount: number,\n): ColumnAssignment[] {\n\treturn getIdsInRange(snapshot.columnIds, selectionRanges.columnRange).map((targetColumnId, targetColumnIndex) => ({\n\t\tsourceColumnIndex: targetColumnIndex % clipboardColumnCount,\n\t\ttargetColumnId,\n\t}))\n}\n\nfunction getCollapsedSelectionColumnAssignments(options: {\n\tclipboardData: CollectionItemTableClipboardData\n\tcolumns: readonly CollectionItemTableColumn[]\n\tactiveColumnId: string\n}): ColumnAssignment[] {\n\tconst { clipboardData, columns, activeColumnId } = options\n\tif (clipboardData.columnCount === 1) {\n\t\treturn [{ sourceColumnIndex: 0, targetColumnId: activeColumnId }]\n\t}\n\n\tconst assignments = getCollectionItemTablePasteColumnAssignments({\n\t\tsourceColumns: clipboardData.columns,\n\t\ttargetColumns: columns,\n\t\tanchorColumnId: activeColumnId,\n\t})\n\tif (assignments.length > 0) return assignments\n\n\treturn getFallbackColumnAssignments(clipboardData.columnCount, columns, activeColumnId)\n}\n\nfunction getTargetColumnAssignments(options: {\n\tsnapshot: RowsAndColumnsSnapshot\n\tselectionRanges: ReturnType<typeof getCellSelectionRanges>\n\tisExpandedSelection: boolean\n\tclipboardData: CollectionItemTableClipboardData\n\tcolumns: readonly CollectionItemTableColumn[]\n\tactiveColumnId: string\n}): ColumnAssignment[] {\n\tconst { snapshot, selectionRanges, isExpandedSelection, clipboardData, columns, activeColumnId } = options\n\tif (isExpandedSelection) {\n\t\tif (!selectionRanges) return []\n\t\treturn getExpandedSelectionColumnAssignments(snapshot, selectionRanges, clipboardData.columnCount)\n\t}\n\n\treturn getCollapsedSelectionColumnAssignments({\n\t\tclipboardData,\n\t\tcolumns,\n\t\tactiveColumnId,\n\t})\n}\n\nfunction getClipboardPasteTargetCells(options: {\n\ttargetRowIds: readonly NodeID[]\n\ttargetColumnAssignments: readonly ColumnAssignment[]\n\tclipboardData: CollectionItemTableClipboardData\n\tcolumnsById: ReadonlyMap<string, CollectionItemTableColumn>\n}): ClipboardPasteTargetCell[] {\n\tconst { targetRowIds, targetColumnAssignments, clipboardData, columnsById } = options\n\tconst targetCells: ClipboardPasteTargetCell[] = []\n\n\tfor (let targetRowIndex = 0; targetRowIndex < targetRowIds.length; targetRowIndex++) {\n\t\tconst targetRowId = targetRowIds[targetRowIndex]\n\t\tif (!targetRowId) continue\n\n\t\tfor (let targetColumnIndex = 0; targetColumnIndex < targetColumnAssignments.length; targetColumnIndex++) {\n\t\t\tconst assignment = targetColumnAssignments[targetColumnIndex]\n\t\t\tif (!assignment) continue\n\n\t\t\tconst targetColumn = columnsById.get(assignment.targetColumnId)\n\t\t\tif (!targetColumn?.isValueEditable) continue\n\n\t\t\tconst sourceColumnIndex = assignment.sourceColumnIndex % clipboardData.columnCount\n\t\t\tconst sourceRowIndex = targetRowIndex % clipboardData.rowCount\n\t\t\tconst sourceColumn = clipboardData.columns[sourceColumnIndex]\n\t\t\tconst sourceRow = clipboardData.cells[sourceRowIndex]\n\t\t\tconst sourceCell = sourceRow?.[sourceColumnIndex]\n\t\t\tif (!sourceColumn || !sourceCell) continue\n\n\t\t\ttargetCells.push({\n\t\t\t\ttargetCell: {\n\t\t\t\t\trowId: targetRowId,\n\t\t\t\t\tcolumnId: assignment.targetColumnId,\n\t\t\t\t},\n\t\t\t\tsourceColumn,\n\t\t\t\tsourceCell,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn targetCells\n}\n\nfunction getCollectionItemIdsRequiringStatusChangeConfirmationForPaste(\n\ttargetCells: readonly ClipboardPasteTargetCell[],\n\tcolumnsById: ReadonlyMap<string, CollectionItemTableColumn>,\n): {\n\tdraftConfirmation: Set<NodeID>\n\tliveConfirmation: Set<NodeID>\n\tallRequiringConfirmation: Set<NodeID>\n} {\n\tconst collectionItemToDraftIds = new Set<NodeID>()\n\tconst collectionItemToLiveIds = new Set<NodeID>()\n\tconst collectionItemRequiringConfirmationIds = new Set<NodeID>()\n\n\tfor (const target of targetCells) {\n\t\tconst targetColumn = columnsById.get(target.targetCell.columnId)\n\t\tif (!targetColumn || !isCollectionItemTableStatusColumnKey(targetColumn.key)) continue\n\t\tif (targetColumn.control.type !== ControlType.Enum) continue\n\n\t\tconst collectionItem = engine.tree.getNodeWithTrait(target.targetCell.rowId, isCollectionItemNode)\n\t\tif (!collectionItem) continue\n\n\t\tconst nextValue = tryResolveEnumValue(targetColumn.control, target.sourceColumn, target.sourceCell)\n\t\tif (nextValue === undefined) continue\n\n\t\tconst nextDraftStatus = getCollectionItemTableDraftValueForStatus(nextValue)\n\t\tif (collectionItem.isDraft === nextDraftStatus) continue\n\n\t\tcollectionItemRequiringConfirmationIds.add(collectionItem.id)\n\t\tif (nextDraftStatus !== true) {\n\t\t\tcollectionItemToLiveIds.add(collectionItem.id)\n\t\t} else {\n\t\t\tcollectionItemToDraftIds.add(collectionItem.id)\n\t\t}\n\t}\n\n\treturn {\n\t\tdraftConfirmation: collectionItemToDraftIds,\n\t\tliveConfirmation: collectionItemToLiveIds,\n\t\tallRequiringConfirmation: collectionItemRequiringConfirmationIds,\n\t}\n}\n\nfunction getClipboardPasteTargetCellsWithoutConfirmedDraftStatuses({\n\ttargetCells,\n\tcolumnsById,\n\tcollectionItemIdsRequiringConfirmation,\n}: {\n\ttargetCells: readonly ClipboardPasteTargetCell[]\n\tcolumnsById: ReadonlyMap<string, CollectionItemTableColumn>\n\tcollectionItemIdsRequiringConfirmation: readonly NodeID[]\n}): readonly ClipboardPasteTargetCell[] {\n\tif (collectionItemIdsRequiringConfirmation.length === 0) return targetCells\n\n\tconst collectionItemIdsRequiringDraftConfirmationSet = new Set(collectionItemIdsRequiringConfirmation)\n\treturn targetCells.filter(target => {\n\t\tconst targetColumn = columnsById.get(target.targetCell.columnId)\n\t\tif (!targetColumn || !isCollectionItemTableStatusColumnKey(targetColumn.key)) return true\n\n\t\treturn !collectionItemIdsRequiringDraftConfirmationSet.has(target.targetCell.rowId)\n\t})\n}\n\nfunction applyCollectionItemDraftStatusDirectly(rowId: NodeID, value: string): boolean {\n\tconst collectionItem = engine.tree.getNodeWithTrait(rowId, isCollectionItemNode)\n\tif (!collectionItem) return false\n\n\tconst nextDraftStatus = getCollectionItemTableDraftValueForStatus(value)\n\tif (collectionItem.isDraft === nextDraftStatus) return true\n\n\tcollectionItem.set({\n\t\tisDraft: nextDraftStatus,\n\t})\n\treturn true\n}\n\nfunction applyClipboardCellToContext(\n\tcontext: CellAdapterContext,\n\tsourceColumn: CollectionItemTableClipboardColumn,\n\tsourceCell: CollectionItemTableClipboardCell,\n\tcache: ClipboardPasteCache,\n\toptions?: {\n\t\tskipDraftStatusConfirmation?: boolean\n\t\tpastedAssociatedStringValue?: string\n\t},\n): boolean {\n\tif (!context.column.isValueEditable) return false\n\n\tswitch (context.column.control.type) {\n\t\tcase ControlType.String: {\n\t\t\tif (disallowedClipboardSourceForStringColumn[sourceColumn.controlType]) {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (sourceControlProp?.type === ControlType.String && !isSlugColumn(context.column)) {\n\t\t\t\tcontext.setControlProp(sanitizeLocalizedControlPropForDocument(sourceControlProp, cache))\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst nextText = getClipboardStringValue(sourceCell)\n\t\t\tif (sourceCell.isInheritedValue) {\n\t\t\t\tconst inheritedTargetText =\n\t\t\t\t\toptions?.pastedAssociatedStringValue ?? getInheritedStringValueForCell(context, context.column.control)\n\t\t\t\tif (nextText === inheritedTargetText) {\n\t\t\t\t\t// Empty string clears the explicit override for based-on string fields.\n\t\t\t\t\tcontext.commitTextValueSync(\"\")\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isSlugColumn(context.column)) {\n\t\t\t\tcontext.commitSlugValue(slugify(nextText))\n\t\t\t} else {\n\t\t\t\tcontext.commitTextValueSync(nextText)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.RichText: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (sourceControlProp?.type === ControlType.RichText) {\n\t\t\t\tconst updatedControlProp = updateModuleIdentifiersInRichTextControlProp(\n\t\t\t\t\tsourceControlProp,\n\t\t\t\t\tgetLocalModuleIdentifierForRichTextPaste,\n\t\t\t\t)\n\t\t\t\tcontext.setControlProp(sanitizeLocalizedControlPropForDocument(updatedControlProp, cache))\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.RichText,\n\t\t\t\tvalue: getClipboardRichTextValue(sourceCell),\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Number: {\n\t\t\tconst nextDisplayValue = getClipboardNumberDisplayValue(sourceCell)\n\t\t\tconst nextValue = resolveNumberDisplayValue(\n\t\t\t\tcontext.column.control,\n\t\t\t\tnextDisplayValue,\n\t\t\t\tcontext.getCurrentNumberValue(),\n\t\t\t)\n\t\t\tif (!isNumber(nextValue)) return false\n\t\t\tcontext.commitNumberValueSync(nextValue)\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Boolean: {\n\t\t\tconst nextValue = getClipboardBooleanValue(sourceCell)\n\t\t\tif (nextValue === undefined) return false\n\t\t\tcontext.commitBooleanValue(nextValue)\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Enum: {\n\t\t\tconst nextValue = tryResolveEnumValue(context.column.control, sourceColumn, sourceCell)\n\t\t\tif (nextValue === undefined) return false\n\t\t\tif (options?.skipDraftStatusConfirmation && isCollectionItemTableStatusColumnKey(context.column.key)) {\n\t\t\t\treturn applyCollectionItemDraftStatusDirectly(context.cell.rowId, nextValue)\n\t\t\t}\n\t\t\tcontext.commitEnumValue(nextValue)\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Date: {\n\t\t\tconst nextValue = normalizeClipboardDateValue(getClipboardDateValue(sourceCell))\n\t\t\tif (!nextValue) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tvalue: nextValue,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Color: {\n\t\t\tconst nextValue = getNormalizedClipboardColorValue(sourceCell)\n\t\t\tif (!nextValue) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.Color,\n\t\t\t\tvalue: nextValue,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (sourceControlProp?.type === ControlType.Image) {\n\t\t\t\tcontext.setControlProp(sanitizeLocalizedControlPropForDocument(sourceControlProp, cache))\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase ControlType.Link: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (sourceControlProp?.type === ControlType.Link) {\n\t\t\t\tcontext.setControlProp(sanitizeLocalizedControlPropForDocument(sourceControlProp, cache))\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst nextLink = getClipboardLinkValue(context.column.control, sourceCell)\n\t\t\tif (!nextLink) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.Link,\n\t\t\t\tvalue: nextLink,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.File: {\n\t\t\tconst nextValue = getClipboardFileValue(sourceCell)\n\t\t\tif (!nextValue.length) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tvalue: nextValue,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.CollectionReference: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (\n\t\t\t\tsourceControlProp?.type === ControlType.CollectionReference &&\n\t\t\t\tsourceColumn.dataIdentifier === context.column.control.dataIdentifier\n\t\t\t) {\n\t\t\t\tcontext.setControlProp(sourceControlProp)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst nextValue = getReferenceLookupValue(\n\t\t\t\tgetCachedReferenceLookup(cache, context.column.control.dataIdentifier),\n\t\t\t\tsourceCell.displayText,\n\t\t\t)\n\t\t\tif (!nextValue) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tvalue: nextValue,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.MultiCollectionReference: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (\n\t\t\t\tsourceControlProp?.type === ControlType.MultiCollectionReference &&\n\t\t\t\tsourceColumn.dataIdentifier === context.column.control.dataIdentifier\n\t\t\t) {\n\t\t\t\tcontext.setControlProp(sourceControlProp)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst referenceLookup = getCachedReferenceLookup(cache, context.column.control.dataIdentifier)\n\t\t\tconst directMatch = getReferenceLookupValue(referenceLookup, sourceCell.displayText)\n\t\t\tif (directMatch) {\n\t\t\t\tcontext.setControlProp({\n\t\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\t\tvalue: [directMatch],\n\t\t\t\t})\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst parts = getMultiCollectionReferenceParts(sourceCell.displayText)\n\t\t\tif (parts.length === 0) return false\n\n\t\t\tconst nextValues = parts.map(part => getReferenceLookupValue(referenceLookup, part)).filter(isString)\n\t\t\tif (nextValues.length !== parts.length) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tvalue: nextValues,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.VectorSetItem: {\n\t\t\tconst sourceControlProp = sourceCell.controlProp\n\t\t\tif (\n\t\t\t\tsourceControlProp?.type === ControlType.VectorSetItem &&\n\t\t\t\tsourceColumn.setModuleId === context.column.control.setModuleId\n\t\t\t) {\n\t\t\t\tcontext.setControlProp(sourceControlProp)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tconst nextIdentifier = getVectorIdentifierByDisplayText(context.column, context, sourceCell.displayText)\n\t\t\tif (!isModuleExportIdentifier(nextIdentifier)) return false\n\t\t\tcontext.setControlProp({\n\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\tvalue: nextIdentifier,\n\t\t\t})\n\t\t\treturn true\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (sourceCell.controlProp?.type !== ControlType.Array) return false\n\n\t\t\tconst nextControlProp = getArrayControlPropForPasteTarget(\n\t\t\t\tsourceColumn,\n\t\t\t\tsourceCell.controlProp,\n\t\t\t\tcontext.column,\n\t\t\t\tcache,\n\t\t\t)\n\t\t\tif (!nextControlProp) return false\n\n\t\t\tcontext.setControlProp(nextControlProp)\n\t\t\treturn true\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(context.column.control)\n\t}\n}\n\nfunction applyClipboardPasteTargetCells(options: {\n\ttargetCells: readonly ClipboardPasteTargetCell[]\n\tcollectionNodeId: NodeID\n\tcolumns: readonly CollectionItemTableColumn[]\n\tskipDraftStatusConfirmation?: boolean\n}): number {\n\tconst { targetCells, collectionNodeId, columns, skipDraftStatusConfirmation } = options\n\tlet appliedCount = 0\n\tconst cache = createClipboardPasteCache()\n\tconst columnsById = new Map(columns.map(column => [column.key, column] as const))\n\tconst targetsByRowId: MutableClipboardPasteTargetsByRowId = new Map()\n\n\tfor (const target of targetCells) {\n\t\tlet rowTargets = targetsByRowId.get(target.targetCell.rowId)\n\t\tif (!rowTargets) {\n\t\t\trowTargets = new Map()\n\t\t\ttargetsByRowId.set(target.targetCell.rowId, rowTargets)\n\t\t}\n\n\t\trowTargets.set(target.targetCell.columnId, target)\n\t}\n\n\tfor (const target of targetCells) {\n\t\tconst context = createCellAdapterContext({\n\t\t\tcell: target.targetCell,\n\t\t\tcollectionNodeId,\n\t\t\tdataIsViewOnly: false,\n\t\t\tcolumns,\n\t\t})\n\t\tif (!context) continue\n\n\t\tconst pastedAssociatedStringValue = getPastedAssociatedStringValueForTarget(\n\t\t\ttarget,\n\t\t\tcontext,\n\t\t\ttargetsByRowId,\n\t\t\tcolumnsById,\n\t\t)\n\n\t\tif (\n\t\t\tapplyClipboardCellToContext(context, target.sourceColumn, target.sourceCell, cache, {\n\t\t\t\tskipDraftStatusConfirmation,\n\t\t\t\tpastedAssociatedStringValue,\n\t\t\t})\n\t\t) {\n\t\t\tappliedCount++\n\t\t}\n\t}\n\n\treturn appliedCount\n}\n\nfunction getExternalModuleIdentifiersForClipboardPasteTargetCells(\n\ttargetCells: readonly ClipboardPasteTargetCell[],\n): ExternalModuleExportIdentifier[] {\n\tconst externalModuleIdentifiers = new Map<string, ExternalModuleExportIdentifier>()\n\n\tfor (const target of targetCells) {\n\t\tconst sourceControlProp = target.sourceCell.controlProp\n\t\tif (sourceControlProp?.type !== ControlType.RichText) continue\n\n\t\tconst values = [sourceControlProp.value]\n\t\tfor (const localizedValue of Object.values(sourceControlProp.valueLocalized ?? {})) {\n\t\t\tif (localizedValue?.value) values.push(localizedValue.value)\n\t\t}\n\n\t\tfor (const value of values) {\n\t\t\tif (!isRichTextTreeValue(value)) continue\n\n\t\t\tfor (const identifier of getModuleIdentifiersForRichTextTreeValue(value)) {\n\t\t\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\t\t\tif (!isExternalModuleIdentifier(parsedIdentifier)) continue\n\t\t\t\tif (engine.stores.modulesStore.getPersistedModuleByGlobalId(parsedIdentifier.moduleId)) continue\n\n\t\t\t\texternalModuleIdentifiers.set(parsedIdentifier.value, parsedIdentifier)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Array.from(externalModuleIdentifiers.values())\n}\n\nasync function addExternalModulesForClipboardPaste(\n\texternalModuleIdentifiers: readonly ExternalModuleExportIdentifier[],\n\tonTreeUpdate: VoidFunction,\n): Promise<void> {\n\tconst minimumVisibleTimePromise = new Promise<void>(resolve => {\n\t\tsetTimeout(resolve, 3000)\n\t})\n\n\ttoast({\n\t\ttype: \"add\",\n\t\tkey: ToastKey.ClipboardLoadingExternalModules,\n\t\ticon: \"reconnecting\",\n\t\tduration: Infinity,\n\t\tvariant: \"progress\",\n\t\tprimaryText: \"Loading content.\",\n\t\tsecondaryText: \"Just a moment\u2026\",\n\t\tshowCloseButton: \"always\",\n\t})\n\n\ttry {\n\t\tawait engine.stores.modulesStore.addExternalModulesToProject(externalModuleIdentifiers, { onTreeUpdate })\n\t\tawait minimumVisibleTimePromise\n\t\ttoast({ type: \"remove\", key: ToastKey.ClipboardLoadingExternalModules })\n\t} catch (error) {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey: ToastKey.ClipboardLoadingExternalModules,\n\t\t\ticon: \"error\",\n\t\t\tduration: 3000,\n\t\t\tvariant: \"error\",\n\t\t\tprimaryText: \"Failed to load\",\n\t\t\tsecondaryText: \"content.\",\n\t\t})\n\t\tthrow error\n\t}\n}\n\nasync function readClipboardSelection(options: {\n\tassetUploader: BatchAssetUploader\n\tevent: ClipboardEvent | undefined\n\tpreferHTMLForSingleRichTextCell: boolean\n}): Promise<CollectionItemTableClipboardData | null> {\n\tconst { assetUploader, event, preferHTMLForSingleRichTextCell } = options\n\tconst clipboardData = await clipboardRead(\n\t\t[\n\t\t\tcollectionItemTableClipboardMimeType,\n\t\t\t...(preferHTMLForSingleRichTextCell ? ([\"text/html\"] as const) : []),\n\t\t\t\"text/tab-separated-values\",\n\t\t\t\"text/plain\",\n\t\t],\n\t\tevent,\n\t)\n\tif (!clipboardData) return null\n\n\tconst typedClipboardData = clipboardData[collectionItemTableClipboardMimeType]\n\tconst parsedTypedClipboardData = parseCollectionItemTableClipboardData(typedClipboardData)\n\tif (parsedTypedClipboardData) {\n\t\treturn parsedTypedClipboardData\n\t}\n\n\tconst html = clipboardData[\"text/html\"]\n\tif (preferHTMLForSingleRichTextCell && isString(html)) {\n\t\treturn createClipboardDataFromHTML(html, assetUploader)\n\t}\n\n\tconst plainText = clipboardData[\"text/tab-separated-values\"] ?? clipboardData[\"text/plain\"]\n\tif (!isString(plainText)) return null\n\treturn createClipboardDataFromPlainText(plainText)\n}\n\nexport async function copyCollectionItemTableSelectionToClipboard(options: CopySelectionOptions): Promise<boolean> {\n\tconst clipboardData = buildClipboardData(options)\n\tif (!clipboardData) return false\n\n\tconst tsvData = serializeCollectionItemTableClipboardAsTSV(clipboardData)\n\n\treturn clipboardWrite(\n\t\t{\n\t\t\t[collectionItemTableClipboardMimeType]: clipboardData,\n\t\t\t\"text/tab-separated-values\": tsvData,\n\t\t\t\"text/plain\": tsvData,\n\t\t},\n\t\toptions.event,\n\t)\n}\n\nexport async function pasteCollectionItemTableSelectionFromClipboard(options: PasteSelectionOptions): Promise<boolean> {\n\tif (options.dataIsViewOnly) return false\n\n\tconst activeCell = options.selection.focus ?? options.selection.anchor\n\tif (!activeCell) return false\n\n\tconst selectionRanges = getCellSelectionRanges(options.selection.anchor, options.selection.focus, options.snapshot)\n\tconst isExpandedSelection = getIsExpandedSelection(selectionRanges)\n\tconst activeColumn = options.columns.find(column => column.key === activeCell.columnId)\n\tconst preferHTMLForSingleRichTextCell = !isExpandedSelection && activeColumn?.control.type === ControlType.RichText\n\n\tconst eventTypes = options.event?.clipboardData?.types\n\tif (\n\t\teventTypes?.includes(collectionItemTableClipboardMimeType) === true ||\n\t\t(preferHTMLForSingleRichTextCell && eventTypes?.includes(\"text/html\") === true) ||\n\t\teventTypes?.includes(\"text/tab-separated-values\" satisfies NativeTextMimeType) === true ||\n\t\teventTypes?.includes(\"text/plain\" satisfies NativeTextMimeType) === true\n\t) {\n\t\toptions.event?.preventDefault()\n\t}\n\n\tconst clipboardData = await readClipboardSelection({\n\t\tassetUploader: options.assetUploader,\n\t\tevent: options.event,\n\t\tpreferHTMLForSingleRichTextCell,\n\t})\n\tif (!clipboardData) return false\n\n\tconst anchorRowIndex = options.snapshot.rowIndexById.get(activeCell.rowId)\n\tif (anchorRowIndex === undefined || options.snapshot.columnIndexById.get(activeCell.columnId) === undefined) {\n\t\treturn false\n\t}\n\tif (isExpandedSelection && !selectionRanges) return false\n\tif (!isExpandedSelection && !activeColumn?.isValueEditable) return false\n\n\tconst targetRowIds = getTargetRowIds({\n\t\tsnapshot: options.snapshot,\n\t\tselectionRanges,\n\t\tisExpandedSelection,\n\t\tanchorRowIndex,\n\t\tclipboardRowCount: clipboardData.rowCount,\n\t})\n\n\tconst targetColumnAssignments = getTargetColumnAssignments({\n\t\tsnapshot: options.snapshot,\n\t\tselectionRanges,\n\t\tisExpandedSelection,\n\t\tclipboardData,\n\t\tcolumns: options.columns,\n\t\tactiveColumnId: activeCell.columnId,\n\t})\n\n\tif (targetRowIds.length === 0 || targetColumnAssignments.length === 0) return false\n\n\tconst columnsById = new Map(options.columns.map(column => [column.key, column] as const))\n\tconst targetCells = getClipboardPasteTargetCells({\n\t\ttargetRowIds,\n\t\ttargetColumnAssignments,\n\t\tclipboardData,\n\t\tcolumnsById,\n\t})\n\tif (targetCells.length === 0) return false\n\n\tconst externalModuleIdentifiers = getExternalModuleIdentifiersForClipboardPasteTargetCells(targetCells)\n\n\tconst { draftConfirmation, liveConfirmation, allRequiringConfirmation } =\n\t\tgetCollectionItemIdsRequiringStatusChangeConfirmationForPaste(targetCells, columnsById)\n\n\tconst collectionItemIdsRequiringConfirmation = Array.from(allRequiringConfirmation)\n\n\tif (allRequiringConfirmation.size > 0) {\n\t\tif (externalModuleIdentifiers.length > 0) {\n\t\t\tawait addExternalModulesForClipboardPaste(externalModuleIdentifiers, () => {})\n\t\t}\n\n\t\tconst targetCellsWithoutConfirmedDraftStatuses = getClipboardPasteTargetCellsWithoutConfirmedDraftStatuses({\n\t\t\tcollectionItemIdsRequiringConfirmation,\n\t\t\ttargetCells,\n\t\t\tcolumnsById,\n\t\t})\n\n\t\tconst newStatusOrLookup = new Map<NodeID, true | undefined>()\n\t\tfor (const toDraftId of draftConfirmation) newStatusOrLookup.set(toDraftId, true)\n\t\tfor (const toLiveId of liveConfirmation) newStatusOrLookup.set(toLiveId, undefined)\n\n\t\tsetCollectionItemsStatusWithConfirmation(\n\t\t\tengine,\n\t\t\tcollectionItemIdsRequiringConfirmation,\n\t\t\tnewStatusOrLookup,\n\t\t\t\"collection_table\",\n\t\t\t{\n\t\t\t\tconfirmedAction: () => {\n\t\t\t\t\tapplyClipboardPasteTargetCells({\n\t\t\t\t\t\ttargetCells: targetCellsWithoutConfirmedDraftStatuses,\n\t\t\t\t\t\tcollectionNodeId: options.collectionNodeId,\n\t\t\t\t\t\tcolumns: options.columns,\n\t\t\t\t\t\tskipDraftStatusConfirmation: true,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\treturn true\n\t}\n\n\tlet appliedCount = 0\n\tconst applyTargetCells = () => {\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tappliedCount = applyClipboardPasteTargetCells({\n\t\t\t\ttargetCells,\n\t\t\t\tcollectionNodeId: options.collectionNodeId,\n\t\t\t\tcolumns: options.columns,\n\t\t\t})\n\t\t})\n\t}\n\n\tif (externalModuleIdentifiers.length > 0) {\n\t\tawait addExternalModulesForClipboardPaste(externalModuleIdentifiers, applyTargetCells)\n\t} else {\n\t\tapplyTargetCells()\n\t}\n\n\tif (appliedCount === 0) return false\n\treturn true\n}\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { cellBorderWidth } from \"./VirtualCollectionItemTable.styles.ts\"\nimport type { CollectionItemTableColumn, ColumnControl, ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\nimport { isCollectionItemTableStatusColumn } from \"./utils/collectionItemTableStatusColumn.ts\"\n\nexport const firstColumnOverlayButtonAllowance = 40\nexport const defaultColumnWidth = 170\nexport const maxColumnWidth = 2000\nexport const stringColumnDefaultWidth = 210\n\n// Tuned to fit native date and datetime inputs consistently across browsers.\nexport const dateColumnDefaultWidth = 125\nexport const dateTimeColumnDefaultWidth = 220\n\nconst minColumnWidth = 85\nexport const statusColumnMinWidth = 93\nconst booleanColumnMinWidth = dimensions.values.toggleWidthSmall + dimensions.values.panelPadding * 2 + cellBorderWidth\n// Tuned to fit the swatch and a readable hex color value.\nconst colorColumnMinWidth = 110\nconst imageColumnMinWidth =\n\tdimensions.values.cmsTablePreviewWidth + dimensions.values.panelPadding * 2 + cellBorderWidth\n\nexport function getMinDataColumnWidthForControlType(controlType: ControlType | undefined): number {\n\tswitch (controlType) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn booleanColumnMinWidth\n\t\tcase ControlType.Color:\n\t\t\treturn colorColumnMinWidth\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn imageColumnMinWidth\n\t\tdefault:\n\t\t\treturn minColumnWidth\n\t}\n}\n\nfunction getMinDataColumnWidth(column: CollectionItemTableColumn): number {\n\tif (isCollectionItemTableStatusColumn(column)) return statusColumnMinWidth\n\treturn getMinDataColumnWidthForControlType(column.control.type)\n}\n\nfunction getDefaultDataColumnWidth(column: CollectionItemTableColumn, defaultWidth: number): number {\n\tif (isCollectionItemTableStatusColumn(column)) return statusColumnMinWidth\n\treturn getDataColumnWidthForControl(column.control, defaultWidth)\n}\n\nexport function getMinWidthForColumn(columnIndex: number, column: CollectionItemTableColumn): number {\n\tconst baseMinWidth = getMinDataColumnWidth(column)\n\treturn columnIndex === 0 ? baseMinWidth + firstColumnOverlayButtonAllowance : baseMinWidth\n}\n\nexport function getMinWidthForColumnIndex(columnIndex: number, columns: readonly CollectionItemTableColumn[]): number {\n\tconst column = columns[columnIndex]\n\tif (!column) {\n\t\treturn columnIndex === 0 ? minColumnWidth + firstColumnOverlayButtonAllowance : minColumnWidth\n\t}\n\n\treturn getMinWidthForColumn(columnIndex, column)\n}\n\nexport function getDataColumnWidthForControl(control: ColumnControl | undefined, defaultColumnWidth: number): number {\n\tswitch (control?.type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn 100\n\t\tcase ControlType.Color:\n\t\t\treturn colorColumnMinWidth\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.Array:\n\t\t\treturn 130\n\t\tcase ControlType.String:\n\t\tcase ControlType.RichText:\n\t\t\treturn stringColumnDefaultWidth\n\t\tcase ControlType.Date:\n\t\t\treturn control.displayTime === true ? dateTimeColumnDefaultWidth : dateColumnDefaultWidth\n\t\tdefault:\n\t\t\treturn defaultColumnWidth\n\t}\n}\n\nfunction storedToRenderedColumnWidth(storedWidth: number, columnIndex: number): number {\n\treturn columnIndex === 0 ? storedWidth + firstColumnOverlayButtonAllowance : storedWidth\n}\n\nexport function renderedToStoredColumnWidth(renderedWidth: number, columnIndex: number): number {\n\treturn columnIndex === 0 ? renderedWidth - firstColumnOverlayButtonAllowance : renderedWidth\n}\n\ninterface GetRenderedColumnWidthsOptions {\n\tvisibleColumns: readonly CollectionItemTableColumn[]\n\tuserColumnWidths: Readonly<Partial<Record<ColumnKey, number>>>\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tstickyColumnCount: number\n\tfillerColumnMinWidth: number\n\tdefaultColumnWidth: number\n}\n\nfunction getMaxStickyColumnsTotalWidth({\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tfillerColumnMinWidth,\n}: {\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tfillerColumnMinWidth: number\n}): number | null {\n\tconst tableBodyWidth = tableViewportWidth - rowHeaderWidth\n\tconst maxStickyColumnsTotalWidth = tableBodyWidth - fillerColumnMinWidth\n\tif (maxStickyColumnsTotalWidth <= 0) return null\n\treturn maxStickyColumnsTotalWidth\n}\n\ninterface ClampStickyColumnWidthsOptions {\n\tcolumnWidths: readonly number[]\n\tvisibleColumns: readonly CollectionItemTableColumn[]\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tstickyColumnCount: number\n\tfillerColumnMinWidth: number\n\tdefaultColumnWidth: number\n}\n\nfunction clampStickyColumnWidths({\n\tcolumnWidths,\n\tvisibleColumns,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tstickyColumnCount,\n\tfillerColumnMinWidth,\n\tdefaultColumnWidth,\n}: ClampStickyColumnWidthsOptions): number[] {\n\tconst stickyColumnsLength = Math.min(stickyColumnCount, visibleColumns.length)\n\tconst maxStickyColumnsTotalWidth = getMaxStickyColumnsTotalWidth({\n\t\ttableViewportWidth,\n\t\trowHeaderWidth,\n\t\tfillerColumnMinWidth,\n\t})\n\tif (stickyColumnsLength <= 0) return [...columnWidths]\n\tif (maxStickyColumnsTotalWidth === null) return [...columnWidths]\n\n\tconst nextColumnWidths = [...columnWidths]\n\tlet remainingStickyWidth = maxStickyColumnsTotalWidth\n\n\tfor (let columnIndex = 0; columnIndex < stickyColumnsLength; columnIndex++) {\n\t\tconst currentWidth = nextColumnWidths[columnIndex] ?? defaultColumnWidth\n\t\tconst minWidth = getMinWidthForColumnIndex(columnIndex, visibleColumns)\n\t\tlet remainingMinWidth = 0\n\t\tfor (let nextColumnIndex = columnIndex + 1; nextColumnIndex < stickyColumnsLength; nextColumnIndex++) {\n\t\t\tremainingMinWidth += getMinWidthForColumnIndex(nextColumnIndex, visibleColumns)\n\t\t}\n\n\t\tconst availableWidthForCurrentColumn = remainingStickyWidth - remainingMinWidth\n\t\tconst maxWidth = Math.max(minWidth, availableWidthForCurrentColumn)\n\t\tconst nextWidth = Math.min(currentWidth, maxWidth)\n\t\tnextColumnWidths[columnIndex] = nextWidth\n\t\tremainingStickyWidth -= nextWidth\n\t}\n\n\treturn nextColumnWidths\n}\n\nexport function getRenderedColumnWidths({\n\tvisibleColumns,\n\tuserColumnWidths,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tstickyColumnCount,\n\tfillerColumnMinWidth,\n\tdefaultColumnWidth,\n}: GetRenderedColumnWidthsOptions): number[] {\n\tconst dataColumnWidthsBeforeStickyClamp = visibleColumns.map((column, columnIndex) => {\n\t\tconst defaultBaseWidth = getDefaultDataColumnWidth(column, defaultColumnWidth)\n\t\tconst minBaseWidth = getMinDataColumnWidth(column)\n\t\tconst userBaseWidth = userColumnWidths[column.key]\n\t\tconst preferredBaseWidth = userBaseWidth ?? defaultBaseWidth\n\t\tconst baseWidth = Math.max(minBaseWidth, preferredBaseWidth)\n\t\treturn storedToRenderedColumnWidth(baseWidth, columnIndex)\n\t})\n\tconst dataColumnWidths = clampStickyColumnWidths({\n\t\tcolumnWidths: dataColumnWidthsBeforeStickyClamp,\n\t\tvisibleColumns,\n\t\ttableViewportWidth,\n\t\trowHeaderWidth,\n\t\tstickyColumnCount,\n\t\tfillerColumnMinWidth,\n\t\tdefaultColumnWidth,\n\t})\n\tconst dataColumnsWidth = dataColumnWidths.reduce((sum, width) => sum + width, 0)\n\tconst tableBodyWidth = tableViewportWidth - rowHeaderWidth\n\tconst remainingTableBodyWidth = tableBodyWidth - dataColumnsWidth\n\tconst fillerColumnWidth = Math.max(fillerColumnMinWidth, remainingTableBodyWidth)\n\treturn [...dataColumnWidths, fillerColumnWidth]\n}\n\nexport function getColumnLeftOffsets(columnWidths: readonly number[]): number[] {\n\tconst offsets: number[] = []\n\tlet currentOffset = 0\n\tfor (const width of columnWidths) {\n\t\toffsets.push(currentOffset)\n\t\tcurrentOffset += width\n\t}\n\treturn offsets\n}\n\ninterface GetColumnWidthForIndexOptions {\n\tcolumnWidths: readonly number[]\n\tcolumnIndex: number\n\tdefaultColumnWidth: number\n}\n\nexport function getColumnWidthForIndex({\n\tcolumnWidths,\n\tcolumnIndex,\n\tdefaultColumnWidth,\n}: GetColumnWidthForIndexOptions): number {\n\treturn columnWidths[columnIndex] ?? defaultColumnWidth\n}\n\ninterface GetMaxWidthForColumnIndexOptions {\n\tcolumnWidths: readonly number[]\n\tcolumnIndex: number\n\tvisibleColumns: readonly CollectionItemTableColumn[]\n\tstickyColumnCount: number\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tfillerColumnMinWidth: number\n}\n\nexport function getMaxWidthForColumnIndex({\n\tcolumnWidths,\n\tcolumnIndex,\n\tvisibleColumns,\n\tstickyColumnCount,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tfillerColumnMinWidth,\n}: GetMaxWidthForColumnIndexOptions): number {\n\tif (columnIndex < 0 || columnIndex >= stickyColumnCount) return maxColumnWidth\n\n\tconst maxStickyColumnsTotalWidth = getMaxStickyColumnsTotalWidth({\n\t\ttableViewportWidth,\n\t\trowHeaderWidth,\n\t\tfillerColumnMinWidth,\n\t})\n\tif (maxStickyColumnsTotalWidth === null) return maxColumnWidth\n\n\tlet otherStickyColumnsWidth = 0\n\tconst stickyColumnsLength = Math.min(stickyColumnCount, visibleColumns.length)\n\tfor (let stickyColumnIndex = 0; stickyColumnIndex < stickyColumnsLength; stickyColumnIndex++) {\n\t\tif (stickyColumnIndex === columnIndex) continue\n\t\tconst minStickyColumnWidth = getMinWidthForColumnIndex(stickyColumnIndex, visibleColumns)\n\t\t// Live resize keeps sibling sticky columns fixed, but still reserves their minimum when callers pass raw widths.\n\t\tconst stickyColumnWidth = columnWidths[stickyColumnIndex]\n\t\tconst stickyColumnWidthWithFallback = stickyColumnWidth ?? minStickyColumnWidth\n\t\tconst reservedStickyColumnWidth = Math.max(stickyColumnWidthWithFallback, minStickyColumnWidth)\n\t\totherStickyColumnsWidth += reservedStickyColumnWidth\n\t}\n\n\tconst minWidth = getMinWidthForColumnIndex(columnIndex, visibleColumns)\n\tconst remainingStickyWidth = maxStickyColumnsTotalWidth - otherStickyColumnsWidth\n\tconst maxWidth = Math.min(maxColumnWidth, remainingStickyWidth)\n\treturn Math.max(minWidth, maxWidth)\n}\n\ninterface GetColumnResizeCursorOptions extends GetMaxWidthForColumnIndexOptions {\n\tcurrentWidth: number\n}\n\nexport function getColumnResizeCursor({\n\tcurrentWidth,\n\tcolumnWidths,\n\tcolumnIndex,\n\tvisibleColumns,\n\tstickyColumnCount,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tfillerColumnMinWidth,\n}: GetColumnResizeCursorOptions): \"e-resize\" | \"w-resize\" | \"col-resize\" {\n\tconst minResizeWidth = getMinWidthForColumnIndex(columnIndex, visibleColumns)\n\tif (currentWidth <= minResizeWidth) return \"e-resize\"\n\n\tconst maxResizeWidth = getMaxWidthForColumnIndex({\n\t\tcolumnWidths,\n\t\tcolumnIndex,\n\t\tvisibleColumns,\n\t\tstickyColumnCount,\n\t\ttableViewportWidth,\n\t\trowHeaderWidth,\n\t\tfillerColumnMinWidth,\n\t})\n\tif (currentWidth >= maxResizeWidth) return \"w-resize\"\n\n\treturn \"col-resize\"\n}\n", "import type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport {\n\ttype ColumnReorderPreviewRows,\n\tgetColumnReorderPreviewLeft,\n\tgetColumnReorderPreviewRows,\n\tgetColumnReorderPreviewTitle,\n\tgetColumnReorderPreviewWidth,\n} from \"./VirtualCollectionItemTable.columnReorderPreview.ts\"\nimport { getShouldHideColumnReorderInsertionIndicatorForAutoScroll } from \"./VirtualCollectionItemTable.reorderIndicatorVisibility.ts\"\nimport { getColumnReorderInsertionIndicatorLeft } from \"./VirtualCollectionItemTable.reorderIndicators.ts\"\nimport { type VirtualGridColumnReorderState, useVirtualGridColumnReorder } from \"./useVirtualGridColumnReorder.ts\"\nimport type { VirtualGridInteractionAction, VirtualGridInteractionKind } from \"./useVirtualGridInteractionMachine.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ntype ColumnReorderInteractionAction = Extract<\n\tVirtualGridInteractionAction,\n\t{ kind: \"startColumnReorder\" | \"updateColumnReorder\" | \"stopColumnReorder\" }\n>\n\ntype ColumnReorderInteractionState =\n\t| { kind: \"columnReorder\"; columnReorder: VirtualGridColumnReorderState }\n\t| { kind: Exclude<VirtualGridInteractionKind, \"columnReorder\"> }\n\ninterface GetColumnReorderingEnabledOptions {\n\tcolumnReorderingIsViewOnly: boolean\n\tcolumnCount: number\n}\n\nexport function getColumnReorderingEnabled({\n\tcolumnReorderingIsViewOnly,\n\tcolumnCount,\n}: GetColumnReorderingEnabledOptions): boolean {\n\treturn !columnReorderingIsViewOnly && columnCount > 1\n}\n\ninterface UseColumnReorderControllerOptions {\n\tinteractionState: ColumnReorderInteractionState\n\tdispatchInteraction: (action: ColumnReorderInteractionAction) => void\n\tcolumnReorderingIsViewOnly: boolean\n\tcolumns: readonly { control: { title?: string } }[]\n\titemsLength: number\n\ttableScrollRef: React.RefObject<HTMLDivElement | null>\n\tcolumnWidths: readonly number[]\n\tcolumnLeftOffsets: readonly number[]\n\trowHeaderWidth: number\n\tstickyColumnCount: number\n\tstickyColumnsWidth: number\n\tdefaultColumnWidth: number\n\tstopDragSelection: () => void\n\tfocusTableWithoutAutoSelect: () => void\n\tonCommitMove: (from: number, to: number) => void\n\tautoScrollEdgeThreshold: number\n\tautoScrollMaxStep: number\n\ttableRowHeight: number\n}\n\ninterface ColumnReorderControllerResult {\n\tcolumnReorderingEnabled: boolean\n\tisColumnReordering: boolean\n\tdraggedColumnId: ColumnKey | null\n\tdraggedColumnIndex: number | null\n\tstartColumnReorderDrag: (options: {\n\t\tcolumnId: ColumnKey\n\t\tcolumnIndex: number\n\t\tclientX: number\n\t\tpreviewLeft: number\n\t\tcolumnWidth: number\n\t}) => void\n\tcancelColumnReorderDrag: () => void\n\tcolumnReorderPreviewLeft: number | null\n\tcolumnReorderPreviewWidth: number | null\n\tcolumnReorderPreviewTitle: string | null\n\tcolumnReorderPreviewRows: ColumnReorderPreviewRows | null\n\tcolumnReorderInsertionIndicatorLeft: number | null\n}\n\nexport function useColumnReorderController({\n\tinteractionState,\n\tdispatchInteraction,\n\tcolumnReorderingIsViewOnly,\n\tcolumns,\n\titemsLength,\n\ttableScrollRef,\n\tcolumnWidths,\n\tcolumnLeftOffsets,\n\trowHeaderWidth,\n\tstickyColumnCount,\n\tstickyColumnsWidth,\n\tdefaultColumnWidth,\n\tstopDragSelection,\n\tfocusTableWithoutAutoSelect,\n\tonCommitMove,\n\tautoScrollEdgeThreshold,\n\tautoScrollMaxStep,\n\ttableRowHeight,\n}: UseColumnReorderControllerOptions): ColumnReorderControllerResult {\n\tconst columnReorderDragState = interactionState.kind === \"columnReorder\" ? interactionState.columnReorder : null\n\tconst columnReorderingEnabled = getColumnReorderingEnabled({\n\t\tcolumnReorderingIsViewOnly,\n\t\tcolumnCount: columns.length,\n\t})\n\tconst isColumnReordering = columnReorderDragState !== null\n\tconst draggedColumnId = columnReorderDragState?.columnId ?? null\n\tconst draggedColumnIndex = columnReorderDragState?.sourceColumnIndex ?? null\n\n\tconst startColumnReorderDragState = useCallback(\n\t\t(state: VirtualGridColumnReorderState) => {\n\t\t\tdispatchInteraction({ kind: \"startColumnReorder\", columnReorder: state })\n\t\t},\n\t\t[dispatchInteraction],\n\t)\n\n\tconst updateColumnReorderDragState = useCallback(\n\t\t(state: VirtualGridColumnReorderState) => {\n\t\t\tdispatchInteraction({ kind: \"updateColumnReorder\", columnReorder: state })\n\t\t},\n\t\t[dispatchInteraction],\n\t)\n\n\tconst clearColumnReorderDragState = useCallback(() => {\n\t\tdispatchInteraction({ kind: \"stopColumnReorder\" })\n\t}, [dispatchInteraction])\n\n\tconst { startColumnReorderDrag, cancelColumnReorderDrag } = useVirtualGridColumnReorder({\n\t\ttableScrollRef,\n\t\tcolumnWidths,\n\t\tcolumnLeftOffsets,\n\t\tcolumnsLength: columns.length,\n\t\trowHeaderWidth,\n\t\tstickyColumnsWidth,\n\t\tdefaultColumnWidth,\n\t\tcolumnReorderDragState,\n\t\tstartColumnReorderDragState,\n\t\tupdateColumnReorderDragState,\n\t\tclearColumnReorderDragState,\n\t\tstopDragSelection,\n\t\tfocusTableWithoutAutoSelect,\n\t\tonCommitMove,\n\t\tautoScrollEdgeThreshold,\n\t\tautoScrollMaxStep,\n\t})\n\n\tconst columnReorderPreviewLeft = getColumnReorderPreviewLeft(columnReorderDragState)\n\tconst columnReorderPreviewWidth = getColumnReorderPreviewWidth(columnReorderDragState)\n\tconst columnReorderPreviewTitle = useMemo(() => {\n\t\treturn getColumnReorderPreviewTitle({\n\t\t\tcolumns,\n\t\t\tdraggedColumnIndex,\n\t\t})\n\t}, [columns, draggedColumnIndex])\n\tconst columnReorderPreviewRows = useMemo(() => {\n\t\tif (!columnReorderDragState) return null\n\n\t\treturn getColumnReorderPreviewRows({\n\t\t\tisColumnReordering,\n\t\t\tdraggedColumnIndex,\n\t\t\tcolumnsLength: columns.length,\n\t\t\titemsLength,\n\t\t\tscrollTop: columnReorderDragState.currentScrollTop,\n\t\t\tclientHeight: columnReorderDragState.scrollViewportHeight,\n\t\t\ttableRowHeight,\n\t\t})\n\t}, [columns.length, columnReorderDragState, draggedColumnIndex, isColumnReordering, itemsLength, tableRowHeight])\n\n\tconst shouldHideColumnReorderInsertionIndicatorForAutoScroll = useMemo(() => {\n\t\tif (!columnReorderDragState) return false\n\n\t\treturn getShouldHideColumnReorderInsertionIndicatorForAutoScroll({\n\t\t\tdragState: columnReorderDragState,\n\t\t\tscrollBoundsLeft: columnReorderDragState.scrollBoundsLeft,\n\t\t\tscrollBoundsRight: columnReorderDragState.scrollBoundsRight,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnsWidth,\n\t\t\tedgeThreshold: autoScrollEdgeThreshold,\n\t\t\tscrollLeft: columnReorderDragState.currentScrollLeft,\n\t\t\tscrollWidth: columnReorderDragState.scrollContentWidth,\n\t\t\tclientWidth: columnReorderDragState.scrollViewportWidth,\n\t\t})\n\t}, [autoScrollEdgeThreshold, columnReorderDragState, rowHeaderWidth, stickyColumnsWidth])\n\n\tconst columnReorderInsertionIndicatorLeft = useMemo(() => {\n\t\treturn getColumnReorderInsertionIndicatorLeft({\n\t\t\tdragState: columnReorderDragState,\n\t\t\tshouldHideForAutoScroll: shouldHideColumnReorderInsertionIndicatorForAutoScroll,\n\t\t\tcolumnLeftOffsets,\n\t\t\tcolumnsLength: columns.length,\n\t\t\tstickyColumnCount,\n\t\t\tstickyColumnsWidth,\n\t\t\trowHeaderWidth,\n\t\t})\n\t}, [\n\t\tcolumnLeftOffsets,\n\t\tcolumnReorderDragState,\n\t\tcolumns.length,\n\t\trowHeaderWidth,\n\t\tshouldHideColumnReorderInsertionIndicatorForAutoScroll,\n\t\tstickyColumnCount,\n\t\tstickyColumnsWidth,\n\t])\n\n\treturn {\n\t\tcolumnReorderingEnabled,\n\t\tisColumnReordering,\n\t\tdraggedColumnId,\n\t\tdraggedColumnIndex,\n\t\tstartColumnReorderDrag,\n\t\tcancelColumnReorderDrag,\n\t\tcolumnReorderPreviewLeft,\n\t\tcolumnReorderPreviewWidth,\n\t\tcolumnReorderPreviewTitle,\n\t\tcolumnReorderPreviewRows,\n\t\tcolumnReorderInsertionIndicatorLeft,\n\t}\n}\n", "interface ColumnReorderPreviewDragState {\n\tstartPreviewLeft: number\n\tstartClientX: number\n\tcurrentClientX: number\n\tcolumnWidth: number\n}\n\ninterface GetColumnReorderPreviewTitleOptions {\n\tcolumns: readonly { control: { title?: string } }[]\n\tdraggedColumnIndex: number | null\n}\n\ninterface GetColumnReorderPreviewRowsOptions {\n\tisColumnReordering: boolean\n\tdraggedColumnIndex: number | null\n\tcolumnsLength: number\n\titemsLength: number\n\tscrollTop: number\n\tclientHeight: number\n\ttableRowHeight: number\n}\n\nexport interface ColumnReorderPreviewRows {\n\tscrollTop: number\n\trowIndices: number[]\n}\n\nexport function getColumnReorderPreviewLeft(dragState: ColumnReorderPreviewDragState | null): number | null {\n\tif (!dragState) return null\n\treturn dragState.startPreviewLeft + (dragState.currentClientX - dragState.startClientX)\n}\n\nexport function getColumnReorderPreviewWidth(dragState: ColumnReorderPreviewDragState | null): number | null {\n\treturn dragState?.columnWidth ?? null\n}\n\nexport function getColumnReorderPreviewTitle({\n\tcolumns,\n\tdraggedColumnIndex,\n}: GetColumnReorderPreviewTitleOptions): string | null {\n\tif (draggedColumnIndex === null) return null\n\treturn columns[draggedColumnIndex]?.control.title ?? `Column ${draggedColumnIndex + 1}`\n}\n\nexport function getColumnReorderPreviewRows({\n\tisColumnReordering,\n\tdraggedColumnIndex,\n\tcolumnsLength,\n\titemsLength,\n\tscrollTop,\n\tclientHeight,\n\ttableRowHeight,\n}: GetColumnReorderPreviewRowsOptions): ColumnReorderPreviewRows | null {\n\tif (!isColumnReordering || draggedColumnIndex === null || draggedColumnIndex >= columnsLength || itemsLength === 0) {\n\t\treturn null\n\t}\n\n\tconst bodyViewportHeight = Math.max(0, clientHeight - tableRowHeight)\n\tconst startRowIndex = Math.max(0, Math.floor(scrollTop / tableRowHeight) - 1)\n\tconst endRowIndex = Math.min(itemsLength - 1, Math.ceil((scrollTop + bodyViewportHeight) / tableRowHeight) + 1)\n\tif (startRowIndex > endRowIndex) return null\n\n\tconst rowIndices: number[] = []\n\tfor (let rowIndex = startRowIndex; rowIndex <= endRowIndex; rowIndex++) {\n\t\trowIndices.push(rowIndex)\n\t}\n\n\treturn {\n\t\tscrollTop,\n\t\trowIndices,\n\t}\n}\n", "interface GetShouldHideRowReorderInsertionIndicatorForAutoScrollOptions {\n\tdragState: {\n\t\tcurrentClientY: number\n\t} | null\n\tscrollBoundsTop: number\n\tscrollBoundsBottom: number\n\ttableRowHeight: number\n\tedgeThreshold: number\n\tscrollTop: number\n\tscrollHeight: number\n\tclientHeight: number\n}\n\nexport function getShouldHideRowReorderInsertionIndicatorForAutoScroll({\n\tdragState,\n\tscrollBoundsTop,\n\tscrollBoundsBottom,\n\ttableRowHeight,\n\tedgeThreshold,\n\tscrollTop,\n\tscrollHeight,\n\tclientHeight,\n}: GetShouldHideRowReorderInsertionIndicatorForAutoScrollOptions): boolean {\n\tif (!dragState) return false\n\n\tconst pointerY = dragState.currentClientY\n\tconst bodyTop = scrollBoundsTop + tableRowHeight\n\tconst bodyBottom = scrollBoundsBottom\n\tconst isNearTopEdge = pointerY < bodyTop + edgeThreshold\n\tconst isNearBottomEdge = pointerY > bodyBottom - edgeThreshold\n\tif (!isNearTopEdge && !isNearBottomEdge) return false\n\n\tconst maxScrollTop = Math.max(0, scrollHeight - clientHeight)\n\tconst canScrollUp = scrollTop > 0\n\tconst canScrollDown = scrollTop < maxScrollTop\n\treturn (isNearTopEdge && canScrollUp) || (isNearBottomEdge && canScrollDown)\n}\n\ninterface GetShouldHideColumnReorderInsertionIndicatorForAutoScrollOptions {\n\tdragState: {\n\t\tcurrentClientX: number\n\t} | null\n\tscrollBoundsLeft: number\n\tscrollBoundsRight: number\n\trowHeaderWidth: number\n\tstickyColumnsWidth: number\n\tedgeThreshold: number\n\tscrollLeft: number\n\tscrollWidth: number\n\tclientWidth: number\n}\n\nexport function getShouldHideColumnReorderInsertionIndicatorForAutoScroll({\n\tdragState,\n\tscrollBoundsLeft,\n\tscrollBoundsRight,\n\trowHeaderWidth,\n\tstickyColumnsWidth,\n\tedgeThreshold,\n\tscrollLeft,\n\tscrollWidth,\n\tclientWidth,\n}: GetShouldHideColumnReorderInsertionIndicatorForAutoScrollOptions): boolean {\n\tif (!dragState) return false\n\n\tconst pointerX = dragState.currentClientX\n\tconst bodyLeft = scrollBoundsLeft + rowHeaderWidth + stickyColumnsWidth\n\tconst bodyRight = scrollBoundsRight\n\n\t// When the pointer is over the sticky area, insertion points are statically\n\t// positioned and don't depend on scroll, so the indicator can always be shown.\n\tconst isOverStickyArea = pointerX < bodyLeft\n\tif (isOverStickyArea) return false\n\n\tconst isNearLeftEdge = pointerX < bodyLeft + edgeThreshold\n\tconst isNearRightEdge = pointerX > bodyRight - edgeThreshold\n\tif (!isNearLeftEdge && !isNearRightEdge) return false\n\n\tconst maxScrollLeft = Math.max(0, scrollWidth - clientWidth)\n\tconst canScrollLeft = scrollLeft > 0\n\tconst canScrollRight = scrollLeft < maxScrollLeft\n\treturn (isNearLeftEdge && canScrollLeft) || (isNearRightEdge && canScrollRight)\n}\n", "interface RowReorderInsertionIndicatorTopOptions {\n\tdragState: {\n\t\tdropIndex: number\n\t\tsourceRowIndex: number\n\t\tcurrentScrollTop: number\n\t} | null\n\tshouldHideForAutoScroll: boolean\n\ttableRowHeight: number\n}\n\nexport function getRowReorderInsertionIndicatorTop({\n\tdragState,\n\tshouldHideForAutoScroll,\n\ttableRowHeight,\n}: RowReorderInsertionIndicatorTopOptions): number | null {\n\tif (!dragState || shouldHideForAutoScroll) return null\n\tconst droppedAtSource = dragState.dropIndex === dragState.sourceRowIndex\n\tconst indexAfterSource = dragState.sourceRowIndex + 1\n\tconst droppedAfterSource = dragState.dropIndex === indexAfterSource\n\tif (droppedAtSource || droppedAfterSource) {\n\t\treturn null\n\t}\n\tconst dropOffsetY = dragState.dropIndex * tableRowHeight\n\tconst headerPlusDropOffset = tableRowHeight + dropOffsetY\n\treturn headerPlusDropOffset - dragState.currentScrollTop\n}\n\ninterface ColumnReorderInsertionIndicatorLeftOptions {\n\tdragState: {\n\t\tdropIndex: number\n\t\tsourceColumnIndex: number\n\t\tcurrentScrollLeft: number\n\t} | null\n\tshouldHideForAutoScroll: boolean\n\tcolumnLeftOffsets: readonly number[]\n\tcolumnsLength: number\n\tstickyColumnCount: number\n\tstickyColumnsWidth: number\n\trowHeaderWidth: number\n}\n\nexport function getColumnReorderInsertionIndicatorLeft({\n\tdragState,\n\tshouldHideForAutoScroll,\n\tcolumnLeftOffsets,\n\tcolumnsLength,\n\tstickyColumnCount,\n\tstickyColumnsWidth,\n\trowHeaderWidth,\n}: ColumnReorderInsertionIndicatorLeftOptions): number | null {\n\tif (!dragState || shouldHideForAutoScroll) return null\n\tconst droppedAtSource = dragState.dropIndex === dragState.sourceColumnIndex\n\tconst indexAfterSource = dragState.sourceColumnIndex + 1\n\tconst droppedAfterSource = dragState.dropIndex === indexAfterSource\n\tif (droppedAtSource || droppedAfterSource) {\n\t\treturn null\n\t}\n\n\tconst dropIndex = dragState.dropIndex\n\t// columnLeftOffsets has one extra entry for the filler column, so [columnsLength] is the total data columns width\n\tconst dataColumnsTotalWidth = columnLeftOffsets[columnsLength] ?? 0\n\tconst dropColumnLeft = columnLeftOffsets[dropIndex] ?? 0\n\tconst boundaryOffsetX = dropIndex >= columnsLength ? dataColumnsTotalWidth : dropColumnLeft\n\tif (dropIndex <= stickyColumnCount) {\n\t\treturn rowHeaderWidth + boundaryOffsetX\n\t}\n\n\tconst offsetWithoutSticky = boundaryOffsetX - stickyColumnsWidth\n\tconst scrolledOffsetX = offsetWithoutSticky - dragState.currentScrollLeft\n\treturn rowHeaderWidth + stickyColumnsWidth + scrolledOffsetX\n}\n", "import type React from \"react\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { getAutoScrollTimeScale } from \"./VirtualCollectionItemTable.autoScrollTimeScale.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\nexport interface VirtualGridColumnReorderState {\n\tcolumnId: ColumnKey\n\tsourceColumnIndex: number\n\tdropIndex: number\n\tstartClientX: number\n\tcurrentClientX: number\n\tcurrentScrollLeft: number\n\tcurrentScrollTop: number\n\tscrollBoundsLeft: number\n\tscrollBoundsRight: number\n\tscrollContentWidth: number\n\tscrollViewportWidth: number\n\tscrollViewportHeight: number\n\tstartPreviewLeft: number\n\tcolumnWidth: number\n}\n\ninterface StartColumnReorderDragOptions {\n\tcolumnId: ColumnKey\n\tcolumnIndex: number\n\tclientX: number\n\tpreviewLeft: number\n\tcolumnWidth: number\n}\n\ninterface UseVirtualGridColumnReorderArgs {\n\ttableScrollRef: React.RefObject<HTMLDivElement | null>\n\tcolumnWidths: readonly number[]\n\tcolumnLeftOffsets: readonly number[]\n\tcolumnsLength: number\n\trowHeaderWidth: number\n\tstickyColumnsWidth: number\n\tdefaultColumnWidth: number\n\tcolumnReorderDragState: VirtualGridColumnReorderState | null\n\tstartColumnReorderDragState: (state: VirtualGridColumnReorderState) => void\n\tupdateColumnReorderDragState: (state: VirtualGridColumnReorderState) => void\n\tclearColumnReorderDragState: () => void\n\tstopDragSelection: () => void\n\tfocusTableWithoutAutoSelect: () => void\n\tonCommitMove: (from: number, to: number) => void\n\tautoScrollEdgeThreshold: number\n\tautoScrollMaxStep: number\n}\n\nexport function useVirtualGridColumnReorder({\n\ttableScrollRef,\n\tcolumnWidths,\n\tcolumnLeftOffsets,\n\tcolumnsLength,\n\trowHeaderWidth,\n\tstickyColumnsWidth,\n\tdefaultColumnWidth,\n\tcolumnReorderDragState,\n\tstartColumnReorderDragState,\n\tupdateColumnReorderDragState,\n\tclearColumnReorderDragState,\n\tstopDragSelection,\n\tfocusTableWithoutAutoSelect,\n\tonCommitMove,\n\tautoScrollEdgeThreshold,\n\tautoScrollMaxStep,\n}: UseVirtualGridColumnReorderArgs) {\n\tconst getScrollMeasurements = useCallback(() => {\n\t\tconst scrollElement = tableScrollRef.current\n\t\tif (!scrollElement) return null\n\t\tconst bounds = scrollElement.getBoundingClientRect()\n\t\treturn {\n\t\t\tcurrentScrollLeft: scrollElement.scrollLeft,\n\t\t\tcurrentScrollTop: scrollElement.scrollTop,\n\t\t\tscrollBoundsLeft: bounds.left,\n\t\t\tscrollBoundsRight: bounds.right,\n\t\t\tscrollContentWidth: scrollElement.scrollWidth,\n\t\t\tscrollViewportWidth: scrollElement.clientWidth,\n\t\t\tscrollViewportHeight: scrollElement.clientHeight,\n\t\t}\n\t}, [tableScrollRef])\n\n\tconst columnReorderDragStateRef = useRef<VirtualGridColumnReorderState | null>(columnReorderDragState)\n\tconst isColumnReordering = columnReorderDragState !== null\n\tconst columnReorderPointerClientXRef = useRef<number | null>(null)\n\tconst columnReorderAutoScrollAnimationFrameRef = useRef<number | null>(null)\n\tconst columnReorderAutoScrollLastTimestampRef = useRef<number | null>(null)\n\n\tuseEffect(() => {\n\t\tcolumnReorderDragStateRef.current = columnReorderDragState\n\t}, [columnReorderDragState])\n\n\tconst getColumnReorderDropIndexFromClientX = useCallback(\n\t\t(clientX: number): number | null => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return null\n\n\t\t\tif (columnsLength <= 0) return 0\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst columnsBodyLeft = scrollBounds.left + rowHeaderWidth\n\t\t\tconst offsetFromColumnsBody = clientX - columnsBodyLeft\n\n\t\t\t// Sticky columns maintain their visual position regardless of scroll, so we must not\n\t\t\t// add scrollLeft when the pointer is over the sticky area.\n\t\t\tconst isOverStickyArea = offsetFromColumnsBody < stickyColumnsWidth\n\t\t\tconst scrollOffset = isOverStickyArea ? 0 : scrollElement.scrollLeft\n\t\t\tconst columnsRelativeX = offsetFromColumnsBody + scrollOffset\n\n\t\t\t// `columnLeftOffsets` has one extra entry for the filler column, so [columnsLength] is\n\t\t\t// the total data columns width.\n\t\t\tconst dataColumnsTotalWidth = columnLeftOffsets[columnsLength] ?? 0\n\n\t\t\tif (columnsRelativeX <= 0) return 0\n\t\t\tif (columnsRelativeX >= dataColumnsTotalWidth) return columnsLength\n\n\t\t\tfor (let columnIndex = 0; columnIndex < columnsLength; columnIndex++) {\n\t\t\t\tconst columnLeft = columnLeftOffsets[columnIndex] ?? 0\n\t\t\t\tconst columnWidth = columnWidths[columnIndex] ?? defaultColumnWidth\n\t\t\t\tconst columnRight = columnLeft + columnWidth\n\t\t\t\tif (columnsRelativeX > columnRight) continue\n\n\t\t\t\tconst offsetWithinColumn = columnsRelativeX - columnLeft\n\t\t\t\treturn offsetWithinColumn < columnWidth / 2 ? columnIndex : columnIndex + 1\n\t\t\t}\n\n\t\t\treturn columnsLength\n\t\t},\n\t\t[\n\t\t\tcolumnLeftOffsets,\n\t\t\tcolumnWidths,\n\t\t\tcolumnsLength,\n\t\t\tdefaultColumnWidth,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnsWidth,\n\t\t\ttableScrollRef,\n\t\t],\n\t)\n\n\tconst stopColumnReorderAutoScroll = useCallback(() => {\n\t\tif (columnReorderAutoScrollAnimationFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(columnReorderAutoScrollAnimationFrameRef.current)\n\t\t\tcolumnReorderAutoScrollAnimationFrameRef.current = null\n\t\t}\n\t\tcolumnReorderAutoScrollLastTimestampRef.current = null\n\t}, [])\n\n\tconst isPointerNearColumnReorderAutoScrollEdge = useCallback(\n\t\t(clientX: number) => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return false\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyLeft = scrollBounds.left + rowHeaderWidth + stickyColumnsWidth\n\t\t\tconst bodyRight = scrollBounds.right\n\t\t\tconst nearLeftEdge = clientX < bodyLeft + autoScrollEdgeThreshold\n\t\t\tconst nearRightEdge = clientX > bodyRight - autoScrollEdgeThreshold\n\t\t\treturn nearLeftEdge || nearRightEdge\n\t\t},\n\t\t[autoScrollEdgeThreshold, rowHeaderWidth, stickyColumnsWidth, tableScrollRef],\n\t)\n\n\tconst updateColumnReorderDropIndex = useCallback(\n\t\t(clientX: number) => {\n\t\t\tconst currentState = columnReorderDragStateRef.current\n\t\t\tif (!currentState) return\n\n\t\t\tconst nextDropIndex = getColumnReorderDropIndexFromClientX(clientX)\n\t\t\tconst scrollMeasurements = getScrollMeasurements()\n\t\t\tconst resolvedDropIndex = nextDropIndex ?? currentState.dropIndex\n\t\t\tconst resolvedScrollLeft = scrollMeasurements?.currentScrollLeft ?? currentState.currentScrollLeft\n\t\t\tif (\n\t\t\t\tcurrentState.dropIndex === resolvedDropIndex &&\n\t\t\t\tcurrentState.currentClientX === clientX &&\n\t\t\t\tcurrentState.currentScrollLeft === resolvedScrollLeft\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst nextState: VirtualGridColumnReorderState = {\n\t\t\t\t...currentState,\n\t\t\t\t...scrollMeasurements,\n\t\t\t\tdropIndex: resolvedDropIndex,\n\t\t\t\tcurrentClientX: clientX,\n\t\t\t\tcurrentScrollLeft: resolvedScrollLeft,\n\t\t\t}\n\n\t\t\tupdateColumnReorderDragState(nextState)\n\t\t\tcolumnReorderDragStateRef.current = nextState\n\t\t},\n\t\t[getColumnReorderDropIndexFromClientX, getScrollMeasurements, updateColumnReorderDragState],\n\t)\n\n\tconst clearActiveColumnReorderDragState = useCallback(() => {\n\t\tstopColumnReorderAutoScroll()\n\t\tcolumnReorderPointerClientXRef.current = null\n\t\tcolumnReorderDragStateRef.current = null\n\t\tclearColumnReorderDragState()\n\t\tfocusTableWithoutAutoSelect()\n\t}, [clearColumnReorderDragState, focusTableWithoutAutoSelect, stopColumnReorderAutoScroll])\n\n\tconst commitColumnReorderDrag = useCallback(() => {\n\t\tconst currentState = columnReorderDragStateRef.current\n\t\tif (!currentState) return\n\n\t\tclearActiveColumnReorderDragState()\n\t\tconst droppedAtSource = currentState.dropIndex === currentState.sourceColumnIndex\n\t\tconst droppedAfterSource = currentState.dropIndex === currentState.sourceColumnIndex + 1\n\t\tif (droppedAtSource || droppedAfterSource) {\n\t\t\treturn\n\t\t}\n\n\t\tconst isMovingForward = currentState.dropIndex > currentState.sourceColumnIndex\n\t\tconst toIndex = isMovingForward ? currentState.dropIndex - 1 : currentState.dropIndex\n\t\tonCommitMove(currentState.sourceColumnIndex, toIndex)\n\t}, [clearActiveColumnReorderDragState, onCommitMove])\n\n\tconst cancelColumnReorderDrag = useCallback(() => {\n\t\tclearActiveColumnReorderDragState()\n\t}, [clearActiveColumnReorderDragState])\n\n\tconst startColumnReorderDrag = useCallback(\n\t\t(options: StartColumnReorderDragOptions) => {\n\t\t\tconst { columnId, columnIndex, clientX, previewLeft, columnWidth } = options\n\t\t\tif (columnIndex < 0 || columnIndex >= columnsLength) return\n\n\t\t\tconst initialDropIndex = getColumnReorderDropIndexFromClientX(clientX) ?? columnIndex\n\t\t\tconst scrollMeasurements = getScrollMeasurements()\n\t\t\tconst nextState: VirtualGridColumnReorderState = {\n\t\t\t\tcolumnId,\n\t\t\t\tsourceColumnIndex: columnIndex,\n\t\t\t\tdropIndex: initialDropIndex,\n\t\t\t\tstartClientX: clientX,\n\t\t\t\tcurrentClientX: clientX,\n\t\t\t\tcurrentScrollLeft: scrollMeasurements?.currentScrollLeft ?? 0,\n\t\t\t\tcurrentScrollTop: scrollMeasurements?.currentScrollTop ?? 0,\n\t\t\t\tscrollBoundsLeft: scrollMeasurements?.scrollBoundsLeft ?? 0,\n\t\t\t\tscrollBoundsRight: scrollMeasurements?.scrollBoundsRight ?? 0,\n\t\t\t\tscrollContentWidth: scrollMeasurements?.scrollContentWidth ?? 0,\n\t\t\t\tscrollViewportWidth: scrollMeasurements?.scrollViewportWidth ?? 0,\n\t\t\t\tscrollViewportHeight: scrollMeasurements?.scrollViewportHeight ?? 0,\n\t\t\t\tstartPreviewLeft: previewLeft,\n\t\t\t\tcolumnWidth,\n\t\t\t}\n\n\t\t\tcolumnReorderPointerClientXRef.current = clientX\n\t\t\tcolumnReorderDragStateRef.current = nextState\n\t\t\tstopDragSelection()\n\t\t\tstartColumnReorderDragState(nextState)\n\t\t},\n\t\t[\n\t\t\tcolumnsLength,\n\t\t\tgetColumnReorderDropIndexFromClientX,\n\t\t\tgetScrollMeasurements,\n\t\t\tstartColumnReorderDragState,\n\t\t\tstopDragSelection,\n\t\t],\n\t)\n\n\tuseEffect(() => {\n\t\tif (!isColumnReordering) return\n\n\t\tconst autoScrollStep = (timestamp: number) => {\n\t\t\tcolumnReorderAutoScrollAnimationFrameRef.current = null\n\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tconst pointerClientX = columnReorderPointerClientXRef.current\n\t\t\tif (!scrollElement || pointerClientX === null) return\n\n\t\t\tconst timeScale = getAutoScrollTimeScale(timestamp, columnReorderAutoScrollLastTimestampRef.current)\n\t\t\tcolumnReorderAutoScrollLastTimestampRef.current = timestamp\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyLeft = scrollBounds.left + rowHeaderWidth + stickyColumnsWidth\n\t\t\tconst bodyRight = scrollBounds.right\n\n\t\t\tlet scrollDelta = 0\n\t\t\tif (pointerClientX < bodyLeft + autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = bodyLeft + autoScrollEdgeThreshold - pointerClientX\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tscrollDelta = -Math.max(1, step)\n\t\t\t} else if (pointerClientX > bodyRight - autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = pointerClientX - (bodyRight - autoScrollEdgeThreshold)\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tscrollDelta = Math.max(1, step)\n\t\t\t}\n\n\t\t\tlet canContinueAutoScroll = false\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tconst totalScrollLeft = scrollElement.scrollWidth - scrollElement.clientWidth\n\t\t\t\tconst maxScrollLeft = Math.max(0, totalScrollLeft)\n\t\t\t\tconst rawScrollLeft = scrollElement.scrollLeft + scrollDelta\n\t\t\t\tconst clampedScrollLeft = Math.max(0, rawScrollLeft)\n\t\t\t\tconst nextScrollLeft = Math.min(maxScrollLeft, clampedScrollLeft)\n\t\t\t\tif (nextScrollLeft !== scrollElement.scrollLeft) {\n\t\t\t\t\tscrollElement.scrollLeft = nextScrollLeft\n\t\t\t\t}\n\t\t\t\tconst canScrollLeft = scrollDelta < 0 && nextScrollLeft > 0\n\t\t\t\tconst canScrollRight = scrollDelta > 0 && nextScrollLeft < maxScrollLeft\n\t\t\t\tcanContinueAutoScroll = canScrollLeft || canScrollRight\n\t\t\t}\n\n\t\t\tupdateColumnReorderDropIndex(pointerClientX)\n\n\t\t\tif (!isPointerNearColumnReorderAutoScrollEdge(pointerClientX)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!canContinueAutoScroll) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (columnReorderDragStateRef.current === null) return\n\t\t\tif (columnReorderAutoScrollAnimationFrameRef.current !== null) return\n\t\t\tcolumnReorderAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst ensureColumnReorderAutoScrollRunning = () => {\n\t\t\tif (columnReorderAutoScrollAnimationFrameRef.current !== null) return\n\t\t\tcolumnReorderAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst handleWindowPointerMove = (event: PointerEvent) => {\n\t\t\tcolumnReorderPointerClientXRef.current = event.clientX\n\t\t\tupdateColumnReorderDropIndex(event.clientX)\n\n\t\t\tif (isPointerNearColumnReorderAutoScrollEdge(event.clientX)) {\n\t\t\t\tensureColumnReorderAutoScrollRunning()\n\t\t\t} else {\n\t\t\t\tstopColumnReorderAutoScroll()\n\t\t\t}\n\t\t}\n\n\t\tconst handleWindowKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tcancelColumnReorderDrag()\n\t\t}\n\n\t\tconst controller = new AbortController()\n\t\tconst abortSignal = controller.signal\n\t\twindow.addEventListener(\"pointermove\", handleWindowPointerMove, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointerup\", commitColumnReorderDrag, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointercancel\", cancelColumnReorderDrag, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"blur\", cancelColumnReorderDrag, { signal: abortSignal })\n\t\twindow.addEventListener(\"keydown\", handleWindowKeyDown, { capture: true, signal: abortSignal })\n\n\t\treturn () => {\n\t\t\tstopColumnReorderAutoScroll()\n\t\t\tcontroller.abort()\n\t\t}\n\t}, [\n\t\tautoScrollEdgeThreshold,\n\t\tautoScrollMaxStep,\n\t\tcancelColumnReorderDrag,\n\t\tisColumnReordering,\n\t\tcommitColumnReorderDrag,\n\t\tisPointerNearColumnReorderAutoScrollEdge,\n\t\trowHeaderWidth,\n\t\tstickyColumnsWidth,\n\t\tstopColumnReorderAutoScroll,\n\t\ttableScrollRef,\n\t\tupdateColumnReorderDropIndex,\n\t])\n\n\treturn {\n\t\tstartColumnReorderDrag,\n\t\tcancelColumnReorderDrag,\n\t\tclearActiveColumnReorderDragState,\n\t}\n}\n", "const frameDuration60fps = 1000 / 60\n\n/**\n * Returns a multiplier that normalizes a per-frame scroll delta to a consistent speed regardless of\n * display refresh rate. A 120 Hz display fires rAF callbacks twice as often as a 60 Hz one;\n * multiplying the delta by this scale compensates for that difference.\n *\n * On the first frame (no previous timestamp) the scale defaults to 1.\n */\nexport function getAutoScrollTimeScale(timestamp: number, lastTimestamp: number | null): number {\n\tif (lastTimestamp === null) return 1\n\treturn (timestamp - lastTimestamp) / frameDuration60fps\n}\n", "import { clampNumber, isEmptyObject } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { isShallowObjectEqual } from \"utils/isShallowEqual.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport {\n\tmaxColumnWidth,\n\tgetColumnLeftOffsets,\n\tgetMaxWidthForColumnIndex,\n\tgetMinWidthForColumnIndex,\n\tgetRenderedColumnWidths,\n\trenderedToStoredColumnWidth,\n} from \"./VirtualCollectionItemTable.columnLayout.ts\"\nimport type { VirtualGridInteractionAction, VirtualGridInteractionState } from \"./useVirtualGridInteractionMachine.ts\"\nimport type { CollectionItemTableColumn, ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\nexport const localStorageFieldWidthKey = \"cmsFieldWidth\"\n\ntype StoredColumnWidths = Record<ColumnKey, number | undefined>\ntype StoredColumnWidthsByCollection = Record<NodeID, StoredColumnWidths | undefined>\n\nconst emptyStoredColumnWidths: StoredColumnWidths = {}\n\nfunction updateCollectionColumnWidths({\n\tprevious,\n\tcollectionId,\n\tcolumnWidths,\n}: {\n\tprevious: StoredColumnWidthsByCollection\n\tcollectionId: NodeID\n\tcolumnWidths: StoredColumnWidths\n}): StoredColumnWidthsByCollection {\n\tconst { [collectionId]: optionalPreviousColumnWidths, ...otherCollections } = previous\n\tconst previousColumnWidths = optionalPreviousColumnWidths || emptyStoredColumnWidths\n\n\tif (isEmptyObject(columnWidths)) {\n\t\treturn optionalPreviousColumnWidths === undefined ? previous : otherCollections\n\t}\n\n\treturn isShallowObjectEqual(previousColumnWidths, columnWidths)\n\t\t? previous\n\t\t: { ...otherCollections, [collectionId]: columnWidths }\n}\n\nfunction clampStoredColumnWidths({\n\tcolumnWidths,\n\tvisibleColumns,\n}: {\n\tcolumnWidths: StoredColumnWidths\n\tvisibleColumns: readonly CollectionItemTableColumn[]\n}): StoredColumnWidths {\n\tconst nextColumnWidths: StoredColumnWidths = {}\n\tconst visibleColumnIndexByKey = new Map(visibleColumns.map((column, index) => [column.key, index] as const))\n\n\tfor (const [columnId, storedColumnWidth] of Object.entries(columnWidths)) {\n\t\tif (!isNumber(storedColumnWidth)) continue\n\n\t\tconst visibleColumnIndex = visibleColumnIndexByKey.get(columnId)\n\t\tif (visibleColumnIndex === undefined) {\n\t\t\tnextColumnWidths[columnId] = storedColumnWidth\n\t\t\tcontinue\n\t\t}\n\n\t\tconst minAllowedStoredColumnWidth = renderedToStoredColumnWidth(\n\t\t\tgetMinWidthForColumnIndex(visibleColumnIndex, visibleColumns),\n\t\t\tvisibleColumnIndex,\n\t\t)\n\t\tconst maxAllowedStoredColumnWidth = renderedToStoredColumnWidth(maxColumnWidth, visibleColumnIndex)\n\n\t\tnextColumnWidths[columnId] = clampNumber(\n\t\t\tstoredColumnWidth,\n\t\t\tminAllowedStoredColumnWidth,\n\t\t\tmaxAllowedStoredColumnWidth,\n\t\t)\n\t}\n\n\treturn isShallowObjectEqual(columnWidths, nextColumnWidths) ? columnWidths : nextColumnWidths\n}\n\nfunction sanitizeAndUpdateColumnWidths({\n\tprevious,\n\tcollectionId,\n\tcolumnId,\n\tcolumnWidth,\n}: {\n\tprevious: StoredColumnWidthsByCollection\n\tcollectionId: NodeID\n\tcolumnId: ColumnKey\n\tcolumnWidth: number | undefined\n}): StoredColumnWidthsByCollection {\n\tconst { [collectionId]: optionalPreviousColumnWidths } = previous\n\tconst previousColumnWidths = optionalPreviousColumnWidths || emptyStoredColumnWidths\n\tconst nextColumnWidths: StoredColumnWidths = {\n\t\t[columnId]: columnWidth,\n\t}\n\n\tfor (const [storedColumnId, storedColumnWidth] of Object.entries(previousColumnWidths)) {\n\t\tif (storedColumnId === columnId) continue\n\n\t\t// remove invalid values in case something weird tries to slip into localStorage\n\t\tif (!isNumber(storedColumnWidth) || storedColumnWidth <= 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\tnextColumnWidths[storedColumnId] = storedColumnWidth\n\t}\n\n\treturn updateCollectionColumnWidths({\n\t\tprevious,\n\t\tcollectionId,\n\t\tcolumnWidths: nextColumnWidths,\n\t})\n}\n\nexport interface VirtualGridColumnResizeState {\n\tcolumnId: ColumnKey\n\tsourceColumnIndex: number\n\tstartClientX: number\n\tstartWidth: number\n\tcurrentWidth: number\n}\n\ntype ColumnWidthInteractionAction = Extract<\n\tVirtualGridInteractionAction,\n\t{ kind: \"startColumnResize\" | \"updateColumnResize\" | \"stopColumnResize\" }\n>\n\nconst isColumnResizeInteraction = (\n\tinteractionState: VirtualGridInteractionState,\n): interactionState is { kind: \"columnResize\"; columnResize: VirtualGridColumnResizeState } => {\n\treturn interactionState.kind === \"columnResize\"\n}\n\ninterface UseColumnWidthControllerOptions {\n\tcollectionId: NodeID\n\tvisibleColumns: readonly CollectionItemTableColumn[]\n\ttableViewportWidth: number\n\trowHeaderWidth: number\n\tstickyColumnCount: number\n\tfillerColumnMinWidth: number\n\tdefaultColumnWidth: number\n\tinteractionState: VirtualGridInteractionState\n\tdispatchInteraction: (action: ColumnWidthInteractionAction) => void\n\tfocusTableWithoutAutoSelect: () => void\n}\n\ninterface ColumnWidthControllerResult {\n\tcolumnWidths: readonly number[]\n\tcolumnLeftOffsets: readonly number[]\n\tisColumnResizing: boolean\n\tresizingColumnId: ColumnKey | null\n\tstartColumnResize: (options: { columnId: ColumnKey; columnIndex: number; clientX: number }) => void\n\tcancelColumnResize: VoidFunction\n}\n\nexport function useColumnWidthController({\n\tcollectionId,\n\tvisibleColumns,\n\ttableViewportWidth,\n\trowHeaderWidth,\n\tstickyColumnCount,\n\tfillerColumnMinWidth,\n\tdefaultColumnWidth,\n\tinteractionState,\n\tdispatchInteraction,\n\tfocusTableWithoutAutoSelect,\n}: UseColumnWidthControllerOptions): ColumnWidthControllerResult {\n\tconst [storedColumnWidthsByCollection, setStoredColumnWidthsByCollection] =\n\t\tuseLocalStorage<StoredColumnWidthsByCollection>(localStorageFieldWidthKey, {})\n\n\tconst columnResizeState = isColumnResizeInteraction(interactionState) ? interactionState.columnResize : null\n\tconst columnResizeStateRef = useRef(columnResizeState)\n\n\tconst isColumnResizing = columnResizeState !== null\n\tconst resizingColumnId = columnResizeState?.columnId ?? null\n\n\tuseEffect(() => {\n\t\tcolumnResizeStateRef.current = columnResizeState\n\t}, [columnResizeState])\n\n\tconst storedColumnWidths = storedColumnWidthsByCollection[collectionId] || emptyStoredColumnWidths\n\tconst clampedStoredColumnWidths = useMemo(\n\t\t() => clampStoredColumnWidths({ columnWidths: storedColumnWidths, visibleColumns }),\n\t\t[storedColumnWidths, visibleColumns],\n\t)\n\n\t// Stored column widths with the in-progress resized width applied, if any\n\tconst pendingStoredColumnWidths = useMemo((): StoredColumnWidths => {\n\t\tif (!columnResizeState) return clampedStoredColumnWidths\n\n\t\treturn {\n\t\t\t...clampedStoredColumnWidths,\n\t\t\t[columnResizeState.columnId]: renderedToStoredColumnWidth(\n\t\t\t\tcolumnResizeState.currentWidth,\n\t\t\t\tcolumnResizeState.sourceColumnIndex,\n\t\t\t),\n\t\t}\n\t}, [columnResizeState, clampedStoredColumnWidths])\n\n\tconst renderedColumnWidths = useMemo(() => {\n\t\treturn getRenderedColumnWidths({\n\t\t\tvisibleColumns,\n\t\t\tuserColumnWidths: pendingStoredColumnWidths,\n\t\t\ttableViewportWidth,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnCount,\n\t\t\tfillerColumnMinWidth,\n\t\t\tdefaultColumnWidth,\n\t\t})\n\t}, [\n\t\tvisibleColumns,\n\t\tdefaultColumnWidth,\n\t\tpendingStoredColumnWidths,\n\t\tfillerColumnMinWidth,\n\t\trowHeaderWidth,\n\t\tstickyColumnCount,\n\t\ttableViewportWidth,\n\t])\n\n\tconst columnLeftOffsets = useMemo(() => {\n\t\treturn getColumnLeftOffsets(renderedColumnWidths)\n\t}, [renderedColumnWidths])\n\n\tconst stopResize = useCallback(() => {\n\t\tdispatchInteraction({ kind: \"stopColumnResize\" })\n\t\tfocusTableWithoutAutoSelect()\n\t}, [dispatchInteraction, focusTableWithoutAutoSelect])\n\n\tconst startResize = useCallback(\n\t\t({ columnId, columnIndex, clientX }: { columnId: ColumnKey; columnIndex: number; clientX: number }) => {\n\t\t\tif (columnIndex < 0 || columnIndex >= visibleColumns.length) return\n\n\t\t\tconst startWidth = renderedColumnWidths[columnIndex] ?? defaultColumnWidth\n\t\t\tconst nextState: VirtualGridColumnResizeState = {\n\t\t\t\tcolumnId,\n\t\t\t\tsourceColumnIndex: columnIndex,\n\t\t\t\tstartClientX: clientX,\n\t\t\t\tstartWidth,\n\t\t\t\tcurrentWidth: startWidth,\n\t\t\t}\n\n\t\t\tdispatchInteraction({ kind: \"startColumnResize\", columnResize: nextState })\n\t\t},\n\t\t[defaultColumnWidth, dispatchInteraction, renderedColumnWidths, visibleColumns.length],\n\t)\n\n\tconst updateResizeState = useCallback(\n\t\t(clientX: number) => {\n\t\t\tconst currentState = columnResizeStateRef.current\n\t\t\tif (!currentState) return\n\t\t\tconst widthDelta = clientX - currentState.startClientX\n\t\t\tconst minWidth = getMinWidthForColumnIndex(currentState.sourceColumnIndex, visibleColumns)\n\t\t\tconst maxWidth = getMaxWidthForColumnIndex({\n\t\t\t\tcolumnWidths: renderedColumnWidths,\n\t\t\t\tcolumnIndex: currentState.sourceColumnIndex,\n\t\t\t\tvisibleColumns,\n\t\t\t\tstickyColumnCount,\n\t\t\t\ttableViewportWidth,\n\t\t\t\trowHeaderWidth,\n\t\t\t\tfillerColumnMinWidth,\n\t\t\t})\n\t\t\tconst nextWidth = clampNumber(Math.round(currentState.startWidth + widthDelta), minWidth, maxWidth)\n\t\t\tif (currentState.currentWidth === nextWidth) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst nextState: VirtualGridColumnResizeState = {\n\t\t\t\t...currentState,\n\t\t\t\tcurrentWidth: nextWidth,\n\t\t\t}\n\t\t\tdispatchInteraction({ kind: \"updateColumnResize\", columnResize: nextState })\n\t\t},\n\t\t[\n\t\t\tdispatchInteraction,\n\t\t\tfillerColumnMinWidth,\n\t\t\trenderedColumnWidths,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnCount,\n\t\t\ttableViewportWidth,\n\t\t\tvisibleColumns,\n\t\t],\n\t)\n\n\tconst commitResizeState = useCallback(() => {\n\t\tconst currentState = columnResizeStateRef.current\n\t\tif (!currentState) return\n\n\t\tconst currentColumn = visibleColumns[currentState.sourceColumnIndex]\n\t\tif (!currentColumn || currentColumn.key !== currentState.columnId) {\n\t\t\tstopResize()\n\t\t\treturn\n\t\t}\n\n\t\tconst nextStoredColumnWidth = renderedToStoredColumnWidth(currentState.currentWidth, currentState.sourceColumnIndex)\n\n\t\tsetStoredColumnWidthsByCollection(previous =>\n\t\t\tsanitizeAndUpdateColumnWidths({\n\t\t\t\tprevious,\n\t\t\t\tcollectionId,\n\t\t\t\tcolumnId: currentState.columnId,\n\t\t\t\tcolumnWidth: nextStoredColumnWidth,\n\t\t\t}),\n\t\t)\n\n\t\tstopResize()\n\t}, [stopResize, collectionId, setStoredColumnWidthsByCollection, visibleColumns])\n\n\tuseEffect(() => {\n\t\tif (!isColumnResizing) return\n\n\t\tconst handleWindowPointerMove = (event: PointerEvent) => {\n\t\t\tupdateResizeState(event.clientX)\n\t\t}\n\n\t\tconst handleWindowKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tstopResize()\n\t\t}\n\n\t\tconst controller = new AbortController()\n\t\tconst abortSignal = controller.signal\n\t\twindow.addEventListener(\"pointermove\", handleWindowPointerMove, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointerup\", commitResizeState, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointercancel\", stopResize, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"blur\", stopResize, { signal: abortSignal })\n\t\twindow.addEventListener(\"keydown\", handleWindowKeyDown, { capture: true, signal: abortSignal })\n\n\t\treturn () => {\n\t\t\tcontroller.abort()\n\t\t}\n\t}, [stopResize, commitResizeState, isColumnResizing, updateResizeState])\n\n\treturn {\n\t\tcolumnWidths: renderedColumnWidths,\n\t\tcolumnLeftOffsets,\n\t\tisColumnResizing,\n\t\tresizingColumnId,\n\t\tstartColumnResize: startResize,\n\t\tcancelColumnResize: stopResize,\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useCallback, useLayoutEffect, useRef, useState } from \"react\"\nimport {\n\tactivateVirtualCollectionItemTableFileCells,\n\tcreateCellAdapterContext,\n\tdeleteVirtualCollectionItemTableCellValue,\n\tgetCellAdapter,\n\tgetCellAdapterForSession,\n\tpickVirtualCollectionItemTableFileCellFiles,\n\tsupportsDeletingVirtualCollectionItemTableCellValue,\n\ttype VirtualCollectionItemTableFileSelection,\n} from \"./VirtualCollectionItemTable.editingAdapters.ts\"\nimport {\n\ttype CellAdapterContext,\n\ttype EditingCommitAction,\n\ttype VirtualCollectionItemTableCellActionSupport,\n\ttype VirtualCollectionItemTableCellAdapter,\n\ttype VirtualCollectionItemTableEditingSession,\n\ttype VirtualCollectionItemTableInlineEditAction,\n\tsupportsEditingAction,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport { type CellIdentifier, getCellKey, type TabOrderDirection } from \"./VirtualCollectionItemTable.selection.ts\"\nimport { getSpreadsheetCellActionTargets } from \"./VirtualCollectionItemTable.spreadsheetCellAction.ts\"\nimport type { SelectionAutoScrollBehavior } from \"./useVirtualGridCellSelection.ts\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\n\nfunction createLazyValue<T>(makeValue: () => T): () => T {\n\tlet cachedResult: { value: T } | null = null\n\n\treturn () => {\n\t\tif (cachedResult) return cachedResult.value\n\n\t\tconst value = makeValue()\n\t\tcachedResult = { value }\n\t\treturn value\n\t}\n}\n\ninterface UseVirtualCollectionItemTableEditingOptions {\n\tcollectionNodeId: NodeID\n\tcolumns: readonly CollectionItemTableColumn[]\n\tdataIsViewOnly: boolean\n\tpreserveSelectionOnNextTableBlur: () => void\n\tfocusTable: () => void\n\tensureCellIsVisible: (cell: CellIdentifier, selectionAutoScrollBehavior: SelectionAutoScrollBehavior) => void\n\tmoveSelection: (\n\t\trowDelta: number,\n\t\tcolumnDelta: number,\n\t\textendRange: boolean,\n\t\tselectionAutoScrollBehavior: SelectionAutoScrollBehavior,\n\t) => void\n\tmoveSelectionInTabOrder: (\n\t\tdirection: TabOrderDirection,\n\t\tselectionAutoScrollBehavior: SelectionAutoScrollBehavior,\n\t) => boolean\n\tselectCell: (cell: CellIdentifier, selectionAutoScrollBehavior: SelectionAutoScrollBehavior) => void\n\tisRowReordering: boolean\n\tisColumnReordering: boolean\n\tisColumnResizing: boolean\n}\n\nexport function useVirtualCollectionItemTableEditing({\n\tcollectionNodeId,\n\tcolumns,\n\tdataIsViewOnly,\n\tpreserveSelectionOnNextTableBlur,\n\tfocusTable,\n\tensureCellIsVisible,\n\tmoveSelection,\n\tmoveSelectionInTabOrder,\n\tselectCell,\n\tisRowReordering,\n\tisColumnReordering,\n\tisColumnResizing,\n}: UseVirtualCollectionItemTableEditingOptions) {\n\tconst [editingSession, setEditingSession] = useState<VirtualCollectionItemTableEditingSession | null>(null)\n\tconst editingSessionRef = useRef<VirtualCollectionItemTableEditingSession | null>(null)\n\teditingSessionRef.current = editingSession\n\n\tconst getCurrentCellAdapterContext = useCallback(\n\t\t(cell: CellIdentifier) => {\n\t\t\treturn createCellAdapterContext({\n\t\t\t\tcell,\n\t\t\t\tcollectionNodeId,\n\t\t\t\tdataIsViewOnly,\n\t\t\t\tcolumns,\n\t\t\t})\n\t\t},\n\t\t[collectionNodeId, columns, dataIsViewOnly],\n\t)\n\n\tconst getCellActionSupport = useCallback(\n\t\t(cell: CellIdentifier | null): VirtualCollectionItemTableCellActionSupport => {\n\t\t\tif (!cell) return \"none\"\n\n\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\tif (!context) return \"none\"\n\n\t\t\tconst adapter = getCellAdapter(context)\n\t\t\treturn adapter?.getActionSupport(context) ?? \"none\"\n\t\t},\n\t\t[getCurrentCellAdapterContext],\n\t)\n\n\tconst finishEditingSession = useCallback(\n\t\t(command: EditingCommitAction = { type: \"close\" }) => {\n\t\t\tconst currentEditingSession = editingSessionRef.current\n\t\t\tif (!currentEditingSession) return\n\t\t\teditingSessionRef.current = null\n\n\t\t\tconst context = getCurrentCellAdapterContext(currentEditingSession.cell)\n\t\t\tconst adapter = context ? getCellAdapterForSession(currentEditingSession) : null\n\t\t\tif (context && adapter?.commitSession) {\n\t\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\t\tadapter.commitSession?.(context, currentEditingSession)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tsetEditingSession(null)\n\n\t\t\tswitch (command.type) {\n\t\t\t\tcase \"focusCurrentCell\":\n\t\t\t\t\tpreserveSelectionOnNextTableBlur()\n\t\t\t\t\tfocusTable()\n\t\t\t\t\treturn\n\n\t\t\t\tcase \"navigate\":\n\t\t\t\t\tpreserveSelectionOnNextTableBlur()\n\t\t\t\t\tfocusTable()\n\t\t\t\t\tmoveSelection(command.rowDelta, command.columnDelta, false, \"keyboard\")\n\t\t\t\t\treturn\n\n\t\t\t\tcase \"tabNavigate\": {\n\t\t\t\t\tconst movedSelection = moveSelectionInTabOrder(command.direction, \"keyboard\")\n\t\t\t\t\tif (movedSelection) {\n\t\t\t\t\t\tpreserveSelectionOnNextTableBlur()\n\t\t\t\t\t\tfocusTable()\n\t\t\t\t\t}\n\t\t\t\t\t// Tab reached the edge of the grid. Let the browser continue with native focus order.\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcase \"close\":\n\t\t\t\t\treturn\n\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(command)\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tfocusTable,\n\t\t\tgetCurrentCellAdapterContext,\n\t\t\tmoveSelection,\n\t\t\tmoveSelectionInTabOrder,\n\t\t\tpreserveSelectionOnNextTableBlur,\n\t\t],\n\t)\n\n\tconst cancelEditingSession = useCallback(() => {\n\t\tconst currentEditingSession = editingSessionRef.current\n\t\tif (!currentEditingSession) return\n\t\teditingSessionRef.current = null\n\n\t\tconst context = getCurrentCellAdapterContext(currentEditingSession.cell)\n\t\tconst adapter = context ? getCellAdapterForSession(currentEditingSession) : null\n\t\tif (context && adapter?.cancelSession) {\n\t\t\tadapter.cancelSession(context, currentEditingSession)\n\t\t}\n\n\t\tsetEditingSession(null)\n\t\tpreserveSelectionOnNextTableBlur()\n\t\tfocusTable()\n\t}, [focusTable, getCurrentCellAdapterContext, preserveSelectionOnNextTableBlur])\n\n\tconst updateEditingSessionValue = useCallback(\n\t\t(cell: CellIdentifier, value: string) => {\n\t\t\tconst currentEditingSession = editingSessionRef.current\n\t\t\tif (!currentEditingSession || getCellKey(currentEditingSession.cell) !== getCellKey(cell)) return\n\n\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\tconst adapter = context ? getCellAdapterForSession(currentEditingSession) : null\n\t\t\tif (!context || !adapter?.updateSessionDraft) return\n\n\t\t\tsetEditingSession(adapter.updateSessionDraft(context, currentEditingSession, value))\n\t\t},\n\t\t[getCurrentCellAdapterContext],\n\t)\n\n\tconst performCellAction = useCallback(\n\t\t(cell: CellIdentifier, initialValue: string | null = null) => {\n\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\tif (!context) return false\n\n\t\t\tconst adapter = getCellAdapter(context)\n\t\t\tconst actionSupport = adapter?.getActionSupport(context) ?? \"none\"\n\n\t\t\tif (supportsEditingAction(actionSupport) && adapter?.startSession) {\n\t\t\t\tconst nextSession = adapter.startSession(context, initialValue)\n\n\t\t\t\tselectCell(cell, \"none\")\n\t\t\t\tensureCellIsVisible(cell, \"scroll\")\n\t\t\t\tsetEditingSession(nextSession)\n\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif (actionSupport !== \"activate\") return false\n\n\t\t\tselectCell(cell, \"none\")\n\t\t\tensureCellIsVisible(cell, \"scroll\")\n\n\t\t\tif (adapter?.activate) {\n\t\t\t\tadapter.activate(context)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif (adapter?.activateMany) {\n\t\t\t\tadapter.activateMany([context])\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\treturn false\n\t\t},\n\t\t[ensureCellIsVisible, getCurrentCellAdapterContext, selectCell],\n\t)\n\n\tconst activateCells = useCallback(\n\t\t(cells: readonly CellIdentifier[]) => {\n\t\t\tlet activatedAtLeastOneCell = false\n\t\t\tconst contextsByAdapter = new Map<VirtualCollectionItemTableCellAdapter, CellAdapterContext[]>()\n\n\t\t\tfor (const cell of cells) {\n\t\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\t\tif (!context) continue\n\n\t\t\t\tconst adapter = getCellAdapter(context)\n\t\t\t\tif (adapter?.getActionSupport(context) !== \"activate\" || !adapter.activate) continue\n\n\t\t\t\tconst existingContexts = contextsByAdapter.get(adapter)\n\t\t\t\tif (existingContexts) {\n\t\t\t\t\texistingContexts.push(context)\n\t\t\t\t} else {\n\t\t\t\t\tcontextsByAdapter.set(adapter, [context])\n\t\t\t\t}\n\t\t\t\tactivatedAtLeastOneCell = true\n\t\t\t}\n\n\t\t\tfor (const [adapter, contexts] of contextsByAdapter) {\n\t\t\t\tif (adapter.activateMany) {\n\t\t\t\t\tadapter.activateMany(contexts)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfor (const context of contexts) {\n\t\t\t\t\tadapter.activate?.(context)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn activatedAtLeastOneCell\n\t\t},\n\t\t[getCurrentCellAdapterContext],\n\t)\n\n\tconst getFileCellAdapterContexts = useCallback(\n\t\t(cells: readonly CellIdentifier[]) => {\n\t\t\treturn cells.flatMap(cell => {\n\t\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\t\treturn context && getCellAdapter(context)?.kind === \"file\" ? [context] : []\n\t\t\t})\n\t\t},\n\t\t[getCurrentCellAdapterContext],\n\t)\n\n\tconst getPreparedFileInlineEditAction = useCallback(\n\t\t(cells: readonly CellIdentifier[]): VirtualCollectionItemTableInlineEditAction | null => {\n\t\t\tconst contexts = getFileCellAdapterContexts(cells)\n\t\t\tif (contexts.length === 0) return null\n\n\t\t\tconst getPickedFiles = createLazyValue<Promise<VirtualCollectionItemTableFileSelection | null>>(() =>\n\t\t\t\tpickVirtualCollectionItemTableFileCellFiles(contexts),\n\t\t\t)\n\t\t\tconst firstCell = cells[0]\n\t\t\treturn {\n\t\t\t\tprepare: () => {\n\t\t\t\t\tvoid getPickedFiles()\n\t\t\t\t},\n\t\t\t\trun: async () => {\n\t\t\t\t\tconst currentContexts = getFileCellAdapterContexts(cells)\n\t\t\t\t\tif (currentContexts.length === 0) return\n\n\t\t\t\t\tif (cells.length === 1 && firstCell) {\n\t\t\t\t\t\tselectCell(firstCell, \"none\")\n\t\t\t\t\t\tensureCellIsVisible(firstCell, \"scroll\")\n\t\t\t\t\t}\n\n\t\t\t\t\tvoid activateVirtualCollectionItemTableFileCells(currentContexts, await getPickedFiles())\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t[ensureCellIsVisible, getFileCellAdapterContexts, selectCell],\n\t)\n\n\tconst getDefaultInlineEditAction = useCallback(\n\t\t({\n\t\t\ttargetCell,\n\t\t\ttargetCells,\n\t\t}: {\n\t\t\ttargetCell: CellIdentifier | null\n\t\t\ttargetCells: readonly CellIdentifier[]\n\t\t}): VirtualCollectionItemTableInlineEditAction | undefined => {\n\t\t\tif (!targetCell) return undefined\n\n\t\t\treturn {\n\t\t\t\trun: () => {\n\t\t\t\t\tif (targetCells.length > 1) {\n\t\t\t\t\t\tactivateCells(targetCells)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tperformCellAction(targetCell)\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t[activateCells, performCellAction],\n\t)\n\n\tconst getSpreadsheetInlineEditAction = useCallback(\n\t\t({\n\t\t\ttargetCell,\n\t\t\tselectedCells,\n\t\t\tcolumn,\n\t\t}: {\n\t\t\ttargetCell: CellIdentifier | null\n\t\t\tselectedCells: readonly CellIdentifier[]\n\t\t\tcolumn: CollectionItemTableColumn | undefined\n\t\t}): VirtualCollectionItemTableInlineEditAction | undefined => {\n\t\t\tconst targetCells = getSpreadsheetCellActionTargets({\n\t\t\t\ttargetCell,\n\t\t\t\tselectedCells,\n\t\t\t\tcolumn,\n\t\t\t})\n\n\t\t\treturn getPreparedFileInlineEditAction(targetCells) ?? getDefaultInlineEditAction({ targetCell, targetCells })\n\t\t},\n\t\t[getDefaultInlineEditAction, getPreparedFileInlineEditAction],\n\t)\n\n\tconst canDeleteCells = useCallback(\n\t\t(cells: readonly CellIdentifier[]) => {\n\t\t\treturn cells.some(cell => {\n\t\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\t\treturn context ? supportsDeletingVirtualCollectionItemTableCellValue(context) : false\n\t\t\t})\n\t\t},\n\t\t[getCurrentCellAdapterContext],\n\t)\n\n\tconst deleteCells = useCallback(\n\t\t(cells: readonly CellIdentifier[]) => {\n\t\t\tconst contexts = cells.flatMap(cell => {\n\t\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\t\treturn context && supportsDeletingVirtualCollectionItemTableCellValue(context) ? [context] : []\n\t\t\t})\n\t\t\tif (contexts.length === 0) return false\n\n\t\t\tfinishEditingSession()\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tfor (const context of contexts) {\n\t\t\t\t\tdeleteVirtualCollectionItemTableCellValue(context)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn true\n\t\t},\n\t\t[finishEditingSession, getCurrentCellAdapterContext],\n\t)\n\n\tconst commitBooleanCellValue = useCallback(\n\t\t(cell: CellIdentifier, value: boolean) => {\n\t\t\tfinishEditingSession()\n\n\t\t\tconst context = getCurrentCellAdapterContext(cell)\n\t\t\tif (!context) return false\n\n\t\t\tconst adapter = getCellAdapter(context)\n\t\t\tif (adapter?.kind !== \"boolean\") return false\n\n\t\t\tcontext.commitBooleanValue(value)\n\t\t\treturn true\n\t\t},\n\t\t[finishEditingSession, getCurrentCellAdapterContext],\n\t)\n\n\tuseLayoutEffect(() => {\n\t\tconst currentEditingSession = editingSessionRef.current\n\t\tif (!currentEditingSession) return\n\n\t\tconst context = getCurrentCellAdapterContext(currentEditingSession.cell)\n\t\tif (!context) {\n\t\t\tsetEditingSession(null)\n\t\t\treturn\n\t\t}\n\n\t\tconst adapter = getCellAdapterForSession(currentEditingSession)\n\t\tconst actionSupport = adapter?.getActionSupport(context)\n\t\tif (!adapter || !supportsEditingAction(actionSupport ?? \"none\")) {\n\t\t\tsetEditingSession(null)\n\t\t\treturn\n\t\t}\n\n\t\tif (isRowReordering || isColumnReordering || isColumnResizing) {\n\t\t\tfinishEditingSession()\n\t\t}\n\t}, [finishEditingSession, getCurrentCellAdapterContext, isColumnReordering, isColumnResizing, isRowReordering])\n\n\treturn {\n\t\teditingSession,\n\t\teditingSessionKey: editingSession ? getCellKey(editingSession.cell) : null,\n\t\tgetCellActionSupport,\n\t\tperformCellAction,\n\t\tupdateEditingSessionValue,\n\t\tfinishEditingSession,\n\t\tcancelEditingSession,\n\t\tactivateCells,\n\t\tgetSpreadsheetInlineEditAction,\n\t\tcanDeleteCells,\n\t\tdeleteCells,\n\t\tcommitBooleanCellValue,\n\t}\n}\n", "import type { CollectionItemNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { CellIdentifier, TabOrderDirection } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\n\nexport interface EditingNavigation {\n\trowDelta: number\n\tcolumnDelta: number\n}\n\nexport type EditingCommitAction =\n\t| { type: \"close\" }\n\t| { type: \"focusCurrentCell\" }\n\t| { type: \"tabNavigate\"; direction: TabOrderDirection }\n\t| ({ type: \"navigate\" } & EditingNavigation)\n\nexport interface VirtualCollectionItemTableInlineEditAction {\n\tprepare?: () => void\n\trun: () => void | Promise<void>\n}\n\nexport type VirtualCollectionItemTableCellActionSupport = \"none\" | \"edit\" | \"editOnType\" | \"activate\"\n\nexport interface TextEditingState {\n\tvalue: string\n\tplaceholder: string | undefined\n}\n\nexport function supportsEditingAction(\n\tactionSupport: VirtualCollectionItemTableCellActionSupport,\n): actionSupport is \"edit\" | \"editOnType\" {\n\treturn actionSupport === \"edit\" || actionSupport === \"editOnType\"\n}\n\ninterface StringCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"string\"\n\tinitialValue: string\n\tdraftValue: string\n\tplaceholder: string | undefined\n\tpendingInsertedText: string | null\n}\n\ninterface MultilineStringCellEditingSession extends Omit<StringCellEditingSession, \"adapterKind\"> {\n\tadapterKind: \"multilineString\"\n}\n\ninterface SlugCellEditingSession extends Omit<StringCellEditingSession, \"adapterKind\"> {\n\tadapterKind: \"slug\"\n}\n\ninterface ColorCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"color\"\n}\n\ninterface ImageCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"image\"\n}\n\ninterface GalleryCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"gallery\"\n}\n\ninterface VectorSetItemCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"vectorSetItem\"\n}\n\ninterface LinkCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"link\"\n}\n\ninterface CollectionReferenceCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"collectionReference\"\n\tinitialSearchValue: string | null\n}\n\ninterface EnumCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"enum\"\n\tinitialSearchValue: string | null\n}\n\ninterface MultiCollectionReferenceCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"multiCollectionReference\"\n\tinitialSearchValue: string | null\n}\n\ninterface DateCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"date\"\n\tinitialValue: string\n\tdraftValue: string\n\tautoFilledInitialDraftValue?: string\n}\n\nexport interface NumberCellEditingSession {\n\tcell: CellIdentifier\n\tadapterKind: \"number\"\n\tinitialValue: number | undefined\n\tdisplayValue: string\n\tpendingInsertedText: string | null\n}\n\nexport type VirtualCollectionItemTableEditingSession =\n\t| SlugCellEditingSession\n\t| StringCellEditingSession\n\t| MultilineStringCellEditingSession\n\t| ColorCellEditingSession\n\t| ImageCellEditingSession\n\t| GalleryCellEditingSession\n\t| VectorSetItemCellEditingSession\n\t| LinkCellEditingSession\n\t| NumberCellEditingSession\n\t| DateCellEditingSession\n\t| EnumCellEditingSession\n\t| CollectionReferenceCellEditingSession\n\t| MultiCollectionReferenceCellEditingSession\n\nexport function isPopoutEditingSession(\n\teditingSession: VirtualCollectionItemTableEditingSession | null,\n): editingSession is Extract<\n\tVirtualCollectionItemTableEditingSession,\n\t{ adapterKind: \"color\" | \"image\" | \"gallery\" | \"vectorSetItem\" | \"link\" }\n> {\n\treturn (\n\t\teditingSession?.adapterKind === \"color\" ||\n\t\teditingSession?.adapterKind === \"image\" ||\n\t\teditingSession?.adapterKind === \"gallery\" ||\n\t\teditingSession?.adapterKind === \"vectorSetItem\" ||\n\t\teditingSession?.adapterKind === \"link\"\n\t)\n}\n\nexport function isComboBoxEditingSession(\n\teditingSession: VirtualCollectionItemTableEditingSession | null,\n): editingSession is Extract<\n\tVirtualCollectionItemTableEditingSession,\n\t{ adapterKind: \"enum\" | \"collectionReference\" | \"multiCollectionReference\" }\n> {\n\treturn (\n\t\teditingSession?.adapterKind === \"enum\" ||\n\t\teditingSession?.adapterKind === \"collectionReference\" ||\n\t\teditingSession?.adapterKind === \"multiCollectionReference\"\n\t)\n}\n\nexport function isPopoverEditingSession(\n\teditingSession: VirtualCollectionItemTableEditingSession | null,\n): editingSession is Extract<\n\tVirtualCollectionItemTableEditingSession,\n\t{\n\t\tadapterKind:\n\t\t\t| \"multilineString\"\n\t\t\t| \"color\"\n\t\t\t| \"image\"\n\t\t\t| \"gallery\"\n\t\t\t| \"vectorSetItem\"\n\t\t\t| \"link\"\n\t\t\t| \"enum\"\n\t\t\t| \"collectionReference\"\n\t\t\t| \"multiCollectionReference\"\n\t}\n> {\n\treturn (\n\t\teditingSession?.adapterKind === \"multilineString\" ||\n\t\tisPopoutEditingSession(editingSession) ||\n\t\tisComboBoxEditingSession(editingSession)\n\t)\n}\n\nexport interface CellAdapterContext {\n\tcell: CellIdentifier\n\titem: CollectionItemNode\n\tcolumn: CollectionItemTableColumn\n\tgetCurrentTextValue: () => string\n\tgetCurrentTextEditingState: () => TextEditingState\n\tgetCurrentControlProp: () => CollectionControlProp | undefined\n\tsetControlProp: (controlProp: CollectionControlProp) => void\n\tcommitEnumValue: (value: string) => void\n\tcommitTextValueSync: (value: string) => void\n\tcommitSlugValue: (value: string) => void\n\tgetCurrentNumberValue: () => number | undefined\n\tcommitNumberValueSync: (value: number) => void\n\tgetCurrentDateValue: () => string | undefined\n\tcommitDateValue: (value: string | undefined) => void\n\tgetCurrentBooleanValue: () => boolean\n\tcommitBooleanValue: (value: boolean) => void\n}\n\nexport interface VirtualCollectionItemTableCellAdapter {\n\tkind:\n\t\t| \"slug\"\n\t\t| \"string\"\n\t\t| \"multilineString\"\n\t\t| \"richText\"\n\t\t| \"number\"\n\t\t| \"date\"\n\t\t| \"boolean\"\n\t\t| \"color\"\n\t\t| \"image\"\n\t\t| \"file\"\n\t\t| \"gallery\"\n\t\t| \"vectorSetItem\"\n\t\t| \"link\"\n\t\t| \"enum\"\n\t\t| \"collectionReference\"\n\t\t| \"multiCollectionReference\"\n\tsupports: (context: CellAdapterContext) => boolean\n\tgetActionSupport: (context: CellAdapterContext) => Exclude<VirtualCollectionItemTableCellActionSupport, \"none\">\n\tstartSession?: (context: CellAdapterContext, initialValue: string | null) => VirtualCollectionItemTableEditingSession\n\tupdateSessionDraft?: (\n\t\tcontext: CellAdapterContext,\n\t\tsession: VirtualCollectionItemTableEditingSession,\n\t\tvalue: string,\n\t) => VirtualCollectionItemTableEditingSession\n\tcommitSession?: (context: CellAdapterContext, session: VirtualCollectionItemTableEditingSession) => void\n\tcancelSession?: (context: CellAdapterContext, session: VirtualCollectionItemTableEditingSession) => void\n\tactivate?: (context: CellAdapterContext) => void\n\tactivateMany?: (contexts: readonly CellAdapterContext[]) => void\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport {\n\ttype VirtualCollectionItemTableCellActionSupport,\n\tsupportsEditingAction,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport { getCellKey, getCellsInColumn, type CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { CollectionItemTableColumn, ColumnControl } from \"./utils/collectionItemTableColumns.ts\"\n\nfunction isFileColumn(\n\tcolumn: CollectionItemTableColumn | undefined,\n): column is CollectionItemTableColumn & { control: Extract<ColumnControl, { type: ControlType.File }> } {\n\treturn column?.control.type === ControlType.File\n}\n\nfunction isRichTextColumn(\n\tcolumn: CollectionItemTableColumn | undefined,\n): column is CollectionItemTableColumn & { control: Extract<ColumnControl, { type: ControlType.RichText }> } {\n\treturn column?.control.type === ControlType.RichText\n}\n\nfunction selectionContainsCell(targetCell: CellIdentifier, selectedCells: readonly CellIdentifier[]): boolean {\n\tconst targetCellKey = getCellKey(targetCell)\n\treturn selectedCells.some(cell => getCellKey(cell) === targetCellKey)\n}\n\nexport function supportsSpreadsheetCellAction(\n\tactionSupport: VirtualCollectionItemTableCellActionSupport,\n\tcolumn: CollectionItemTableColumn | undefined,\n): boolean {\n\tif (supportsEditingAction(actionSupport)) return true\n\n\treturn actionSupport === \"activate\" && (isFileColumn(column) || isRichTextColumn(column))\n}\n\nexport function getSpreadsheetCellActionLabel(column: CollectionItemTableColumn | undefined): string {\n\treturn isFileColumn(column) ? Dictionary.Upload : Dictionary.Edit\n}\n\nexport function canUseSelectedCellsForFileUploadAction({\n\ttargetCell,\n\tselectedCells,\n}: {\n\ttargetCell: CellIdentifier | null\n\tselectedCells: readonly CellIdentifier[]\n}): boolean {\n\tif (!targetCell) return false\n\tif (selectedCells.length <= 1) return false\n\n\treturn selectionContainsCell(targetCell, selectedCells)\n}\n\nexport function getSpreadsheetCellActionTargets({\n\ttargetCell,\n\tselectedCells,\n\tcolumn,\n}: {\n\ttargetCell: CellIdentifier | null\n\tselectedCells: readonly CellIdentifier[]\n\tcolumn: CollectionItemTableColumn | undefined\n}): readonly CellIdentifier[] {\n\tif (!targetCell) return []\n\n\tif (isFileColumn(column) && canUseSelectedCellsForFileUploadAction({ targetCell, selectedCells })) {\n\t\treturn getCellsInActivationColumn({ targetCell, selectedCells })\n\t}\n\n\treturn [targetCell]\n}\n\nexport function getCellsInActivationColumn({\n\ttargetCell,\n\tselectedCells,\n}: {\n\ttargetCell: CellIdentifier | null\n\tselectedCells: readonly CellIdentifier[]\n}): readonly CellIdentifier[] {\n\tif (!targetCell || selectedCells.length <= 1) return selectedCells\n\n\tif (!selectionContainsCell(targetCell, selectedCells)) return selectedCells\n\n\tconst targetColumnCells = getCellsInColumn(selectedCells, targetCell.columnId)\n\tif (selectedCells.every(cell => cell.columnId === targetCell.columnId)) return selectedCells\n\n\treturn targetColumnCells\n}\n", "export const dataIsVirtualCollectionItemTableFillerColumnAttribute =\n\t\"data-is-virtual-collection-item-table-filler-column\"\n\nexport const virtualCollectionItemTableFillerColumnSelector = `[${dataIsVirtualCollectionItemTableFillerColumnAttribute}]`\nexport const projectBarPreviewButtonSelector = `[data-testid=\"projectbar-preview-button\"]`\n", "import { dataIsPopoverSelector } from \"@framerjs/fresco\"\nimport { dataIsModalSelector } from \"@framerjs/fresco/components/CustomModal\"\nimport { dataIsContextMenuSelector } from \"menu/ContextMenu.tsx\"\nimport { dataIsPopoutWindowSelector } from \"../shared/PopoutWindow.tsx\"\nimport { dataIsAgentChatPanelSelector } from \"../shared/chromeHitTargets.ts\"\nimport { projectBarPreviewButtonSelector } from \"./VirtualCollectionItemTable.hitTargets.ts\"\nimport type { TabOrderDirection } from \"./VirtualCollectionItemTable.selection.ts\"\n\ntype AutoSelectTableFocusTarget = \"first\" | \"last\" | \"restore\"\n\nexport function focusElementWithoutAutoSelect({\n\telement,\n\tskipAutoSelectOnNextFocusRef,\n}: {\n\telement: HTMLElement | null\n\tskipAutoSelectOnNextFocusRef: React.MutableRefObject<boolean>\n}) {\n\tif (!element) return\n\tif (document.activeElement === element) return\n\n\tskipAutoSelectOnNextFocusRef.current = true\n\telement.focus()\n\n\tif (document.activeElement !== element) {\n\t\tskipAutoSelectOnNextFocusRef.current = false\n\t}\n}\n\nexport function shouldAutoSelectOnTableFocus({\n\teventTarget,\n\teventCurrentTarget,\n\tskipFromPointer,\n\tkeyboardInteractionBlocked,\n\thasValidSelection,\n}: {\n\teventTarget: EventTarget | null\n\teventCurrentTarget: EventTarget | null\n\tskipFromPointer: boolean\n\tkeyboardInteractionBlocked: boolean\n\thasValidSelection: boolean\n}): boolean {\n\tif (eventTarget !== eventCurrentTarget) return false\n\tif (skipFromPointer) return false\n\tif (keyboardInteractionBlocked) return false\n\tif (hasValidSelection) return false\n\treturn true\n}\n\nexport function getAutoSelectTableFocusTarget({\n\teventTarget,\n\teventCurrentTarget,\n\trelatedTarget,\n\tskipFromPointer,\n\tkeyboardInteractionBlocked,\n\thasValidSelection,\n}: {\n\teventTarget: EventTarget | null\n\teventCurrentTarget: EventTarget | null\n\trelatedTarget: EventTarget | null\n\tskipFromPointer: boolean\n\tkeyboardInteractionBlocked: boolean\n\thasValidSelection: boolean\n}): AutoSelectTableFocusTarget | null {\n\tif (\n\t\t!shouldAutoSelectOnTableFocus({\n\t\t\teventTarget,\n\t\t\teventCurrentTarget,\n\t\t\tskipFromPointer,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\thasValidSelection,\n\t\t})\n\t) {\n\t\treturn null\n\t}\n\n\tif (!(eventCurrentTarget instanceof HTMLElement)) {\n\t\treturn \"first\"\n\t}\n\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsContextMenuSelector)) {\n\t\treturn null\n\t}\n\n\tif (relatedTarget instanceof Node && eventCurrentTarget.contains(relatedTarget)) {\n\t\treturn \"restore\"\n\t}\n\n\tconst entryDirection = getTableEntryDirection(eventCurrentTarget, relatedTarget)\n\treturn entryDirection === \"previous\" ? \"last\" : \"first\"\n}\n\nexport function getVirtualCollectionItemTableContainerTabIndex({\n\tkeyboardInteractionBlocked,\n\thasEditingSession,\n}: {\n\tkeyboardInteractionBlocked: boolean\n\thasEditingSession: boolean\n}): -1 | 0 {\n\treturn keyboardInteractionBlocked || hasEditingSession ? -1 : 0\n}\n\nexport function shouldClearSelectionOnTableBlur({\n\teventCurrentTarget,\n\trelatedTarget,\n\tkeyboardInteractionBlocked,\n\thasCellSelection,\n}: {\n\teventCurrentTarget: EventTarget | null\n\trelatedTarget: EventTarget | null\n\tkeyboardInteractionBlocked: boolean\n\thasCellSelection: boolean\n}): boolean {\n\tif (!hasCellSelection) return false\n\tif (keyboardInteractionBlocked) return false\n\tif (!(eventCurrentTarget instanceof HTMLElement)) return false\n\tif (relatedTarget === null) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsModalSelector)) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsContextMenuSelector)) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsPopoverSelector)) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsPopoutWindowSelector)) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(dataIsAgentChatPanelSelector)) return false\n\tif (relatedTarget instanceof Element && relatedTarget.closest(projectBarPreviewButtonSelector)) return false\n\tif (relatedTarget instanceof Node && eventCurrentTarget.contains(relatedTarget)) return false\n\treturn true\n}\n\nfunction getTableEntryDirection(\n\ttableContainer: HTMLElement,\n\trelatedTarget: EventTarget | null,\n): TabOrderDirection | null {\n\tif (!(relatedTarget instanceof Node)) return null\n\n\tconst targetPosition = tableContainer.compareDocumentPosition(relatedTarget)\n\tif (targetPosition & Node.DOCUMENT_POSITION_PRECEDING) {\n\t\treturn \"next\"\n\t}\n\n\tif (targetPosition & Node.DOCUMENT_POSITION_FOLLOWING) {\n\t\treturn \"previous\"\n\t}\n\n\treturn null\n}\n", "import type { TabOrderDirection } from \"./VirtualCollectionItemTable.selection.ts\"\n\ninterface MoveSelectionKeyboardAction {\n\ttype: \"moveSelection\"\n\trowDelta: number\n\tcolumnDelta: number\n\textendSelection: boolean\n}\n\ninterface CancelRowReorderKeyboardAction {\n\ttype: \"cancelRowReorder\"\n}\n\ninterface CancelColumnReorderKeyboardAction {\n\ttype: \"cancelColumnReorder\"\n}\n\ninterface CancelColumnResizeKeyboardAction {\n\ttype: \"cancelColumnResize\"\n}\n\ninterface StartEditingKeyboardAction {\n\ttype: \"startEditing\"\n\tinitialValue: string | null\n}\n\ninterface ActivateCellKeyboardAction {\n\ttype: \"activateCell\"\n}\n\ninterface DeleteCellValueKeyboardAction {\n\ttype: \"deleteCellValue\"\n}\n\ninterface OpenItemOverlayKeyboardAction {\n\ttype: \"openItemOverlay\"\n}\n\ninterface ClearSelectionKeyboardAction {\n\ttype: \"clearSelection\"\n}\n\ninterface SelectAllKeyboardAction {\n\ttype: \"selectAll\"\n}\n\ntype VirtualCollectionItemTableKeyboardAction =\n\t| MoveSelectionKeyboardAction\n\t| CancelRowReorderKeyboardAction\n\t| CancelColumnReorderKeyboardAction\n\t| CancelColumnResizeKeyboardAction\n\t| StartEditingKeyboardAction\n\t| ActivateCellKeyboardAction\n\t| DeleteCellValueKeyboardAction\n\t| OpenItemOverlayKeyboardAction\n\t| ClearSelectionKeyboardAction\n\t| SelectAllKeyboardAction\n\ninterface CommitEditingKeyboardAction {\n\ttype: \"commitEditing\"\n\trowDelta: number\n\tcolumnDelta: number\n}\n\ninterface CommitEditingInTabOrderKeyboardAction {\n\ttype: \"commitEditingInTabOrder\"\n\tdirection: TabOrderDirection\n}\n\ninterface FinishEditingKeyboardAction {\n\ttype: \"finishEditing\"\n}\n\nexport type VirtualCollectionItemTableEditorKeyboardAction =\n\t| CommitEditingKeyboardAction\n\t| CommitEditingInTabOrderKeyboardAction\n\t| FinishEditingKeyboardAction\n\ninterface GetVirtualCollectionItemTableKeyboardActionOptions {\n\tkey: string\n\tshiftKey: boolean\n\tisCommandPressed: boolean\n\taltKey: boolean\n\trowCount: number\n\tcolumnCount: number\n\tisRowReordering: boolean\n\tisColumnReordering: boolean\n\tisColumnResizing: boolean\n\thasSelection: boolean\n\tselectedCellActionSupport: \"none\" | \"edit\" | \"editOnType\" | \"activate\"\n\tselectedCellDeleteEnabled: boolean\n}\n\ntype GetVirtualCollectionItemTableNavigationKeyboardActionOptions = Pick<\n\tGetVirtualCollectionItemTableKeyboardActionOptions,\n\t\"key\" | \"shiftKey\" | \"isCommandPressed\" | \"rowCount\" | \"columnCount\"\n>\n\nfunction getTypedCharacterForEditing({\n\tkey,\n\tisCommandPressed,\n\taltKey,\n}: Pick<GetVirtualCollectionItemTableKeyboardActionOptions, \"key\" | \"isCommandPressed\" | \"altKey\">): string | null {\n\tif (isCommandPressed || altKey) return null\n\tif (key.length !== 1) return null\n\treturn key\n}\n\nexport function getVirtualCollectionItemTableKeyboardAction({\n\tkey,\n\tshiftKey,\n\tisCommandPressed,\n\taltKey,\n\trowCount,\n\tcolumnCount,\n\tisRowReordering,\n\tisColumnReordering,\n\tisColumnResizing,\n\thasSelection,\n\tselectedCellActionSupport,\n\tselectedCellDeleteEnabled,\n}: GetVirtualCollectionItemTableKeyboardActionOptions): VirtualCollectionItemTableKeyboardAction | null {\n\tif (key === \"Escape\") {\n\t\tif (isRowReordering) return { type: \"cancelRowReorder\" }\n\t\tif (isColumnReordering) return { type: \"cancelColumnReorder\" }\n\t\tif (isColumnResizing) return { type: \"cancelColumnResize\" }\n\t\tif (hasSelection) return { type: \"clearSelection\" }\n\t}\n\n\t// If we're in row reorder, column reorder, or column resize mode, we don't want to\n\t// handle any other keyboard actions.\n\tif (isRowReordering || isColumnReordering || isColumnResizing) {\n\t\treturn null\n\t}\n\n\t// Space is a table-level shortcut for opening the collection item overlay.\n\t// It intentionally does not depend on the selected cell's inline action support.\n\tif (key === \" \" && !isCommandPressed && !altKey) {\n\t\treturn {\n\t\t\ttype: \"openItemOverlay\",\n\t\t}\n\t}\n\n\tif (selectedCellActionSupport === \"activate\" && key === \"Enter\") {\n\t\treturn {\n\t\t\ttype: \"activateCell\",\n\t\t}\n\t}\n\n\tif ((selectedCellActionSupport === \"edit\" || selectedCellActionSupport === \"editOnType\") && key === \"Enter\") {\n\t\treturn {\n\t\t\ttype: \"startEditing\",\n\t\t\tinitialValue: null,\n\t\t}\n\t}\n\n\tif (selectedCellActionSupport === \"editOnType\") {\n\t\tconst typedCharacter = getTypedCharacterForEditing({\n\t\t\tkey,\n\t\t\tisCommandPressed,\n\t\t\taltKey,\n\t\t})\n\n\t\tif (typedCharacter !== null) {\n\t\t\treturn {\n\t\t\t\ttype: \"startEditing\",\n\t\t\t\tinitialValue: typedCharacter,\n\t\t\t}\n\t\t}\n\t}\n\n\tif ((key === \"Backspace\" || key === \"Delete\") && !isCommandPressed && !altKey && selectedCellDeleteEnabled) {\n\t\treturn {\n\t\t\ttype: \"deleteCellValue\",\n\t\t}\n\t}\n\n\tif (isCommandPressed && !altKey && key.toLowerCase() === \"a\") {\n\t\treturn {\n\t\t\ttype: \"selectAll\",\n\t\t}\n\t}\n\n\tconst navigationAction = getVirtualCollectionItemTableNavigationKeyboardAction({\n\t\tkey,\n\t\tshiftKey,\n\t\tisCommandPressed,\n\t\trowCount,\n\t\tcolumnCount,\n\t})\n\tif (navigationAction) return navigationAction\n\n\treturn null\n}\n\nexport function getVirtualCollectionItemTableNavigationKeyboardAction({\n\tkey,\n\tshiftKey,\n\tisCommandPressed,\n\trowCount,\n\tcolumnCount,\n}: GetVirtualCollectionItemTableNavigationKeyboardActionOptions): MoveSelectionKeyboardAction | null {\n\tif (key === \"ArrowUp\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: isCommandPressed ? -rowCount : -1,\n\t\t\tcolumnDelta: 0,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\tif (key === \"ArrowDown\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: isCommandPressed ? rowCount : 1,\n\t\t\tcolumnDelta: 0,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\tif (key === \"ArrowLeft\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: 0,\n\t\t\tcolumnDelta: isCommandPressed ? -columnCount : -1,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\tif (key === \"ArrowRight\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: 0,\n\t\t\tcolumnDelta: isCommandPressed ? columnCount : 1,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\tif (key === \"Tab\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: 0,\n\t\t\tcolumnDelta: shiftKey ? -1 : 1,\n\t\t\textendSelection: false,\n\t\t}\n\t}\n\n\tif (key === \"Home\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: isCommandPressed ? -rowCount : 0,\n\t\t\tcolumnDelta: -columnCount,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\tif (key === \"End\") {\n\t\treturn {\n\t\t\ttype: \"moveSelection\",\n\t\t\trowDelta: isCommandPressed ? rowCount : 0,\n\t\t\tcolumnDelta: columnCount,\n\t\t\textendSelection: shiftKey,\n\t\t}\n\t}\n\n\treturn null\n}\n\ninterface GetVirtualCollectionItemTableEditorKeyboardActionOptions {\n\tkey: string\n\tshiftKey: boolean\n}\n\nexport function getVirtualCollectionItemTableEditorKeyboardAction({\n\tkey,\n\tshiftKey,\n}: GetVirtualCollectionItemTableEditorKeyboardActionOptions): VirtualCollectionItemTableEditorKeyboardAction | null {\n\tif (key === \"Tab\") {\n\t\treturn {\n\t\t\ttype: \"commitEditingInTabOrder\",\n\t\t\tdirection: shiftKey ? \"previous\" : \"next\",\n\t\t}\n\t}\n\n\tif (key === \"Enter\") {\n\t\treturn {\n\t\t\ttype: \"commitEditing\",\n\t\t\trowDelta: shiftKey ? -1 : 1,\n\t\t\tcolumnDelta: 0,\n\t\t}\n\t}\n\n\tif (key === \"Escape\") {\n\t\treturn {\n\t\t\ttype: \"finishEditing\",\n\t\t}\n\t}\n\n\treturn null\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { getShouldHideRowReorderInsertionIndicatorForAutoScroll } from \"./VirtualCollectionItemTable.reorderIndicatorVisibility.ts\"\nimport { getRowReorderInsertionIndicatorTop } from \"./VirtualCollectionItemTable.reorderIndicators.ts\"\nimport {\n\tgetRowReorderPreviewOffsetY,\n\tgetRowReorderPreviewRowIndex,\n\tgetRowReorderPreviewTop,\n} from \"./VirtualCollectionItemTable.rowReorderPreview.ts\"\nimport type { VirtualGridInteractionAction, VirtualGridInteractionKind } from \"./useVirtualGridInteractionMachine.ts\"\nimport { type VirtualGridRowReorderState, useVirtualGridRowReorder } from \"./useVirtualGridRowReorder.ts\"\n\ntype RowReorderInteractionAction = Extract<\n\tVirtualGridInteractionAction,\n\t{ kind: \"startRowReorder\" | \"updateRowReorder\" | \"stopRowReorder\" }\n>\n\ntype RowReorderInteractionState =\n\t| { kind: \"rowReorder\"; rowReorder: VirtualGridRowReorderState }\n\t| { kind: Exclude<VirtualGridInteractionKind, \"rowReorder\"> }\n\ninterface GetRowReorderingEnabledOptions {\n\tisFilterActive: boolean\n\tdataIsViewOnly: boolean\n\trowCount: number\n\tselectedRowCount: number\n}\n\nexport function getRowReorderingEnabled({\n\tisFilterActive,\n\tdataIsViewOnly,\n\trowCount,\n\tselectedRowCount,\n}: GetRowReorderingEnabledOptions): boolean {\n\treturn !isFilterActive && !dataIsViewOnly && rowCount > 1 && selectedRowCount === 0\n}\n\ninterface UseRowReorderControllerOptions<TItem extends { id: NodeID }> {\n\tinteractionState: RowReorderInteractionState\n\tdispatchInteraction: (action: RowReorderInteractionAction) => void\n\tisFilterActive: boolean\n\tdataIsViewOnly: boolean\n\trowIds: readonly NodeID[]\n\tselectedRowCount: number\n\ttableScrollRef: React.RefObject<HTMLDivElement | null>\n\ttableRowHeight: number\n\trowIndexById: ReadonlyMap<NodeID, number>\n\titems: readonly TItem[]\n\tstopDragSelection: () => void\n\tfocusTableWithoutAutoSelect: () => void\n\tonCommitMove: (from: number, to: number) => void\n\tautoScrollEdgeThreshold: number\n\tautoScrollMaxStep: number\n}\n\ninterface RowReorderControllerResult {\n\trowReorderingEnabled: boolean\n\tisRowReordering: boolean\n\tdraggedRowId: NodeID | null\n\tstartRowReorderDrag: (rowId: NodeID, clientY: number) => void\n\tcancelRowReorderDrag: () => void\n\trowReorderPreviewRowIndex: number | null\n\trowReorderPreviewTop: number | null\n\trowReorderInsertionIndicatorTop: number | null\n}\n\nexport function useRowReorderController<TItem extends { id: NodeID }>({\n\tinteractionState,\n\tdispatchInteraction,\n\tisFilterActive,\n\tdataIsViewOnly,\n\trowIds,\n\tselectedRowCount,\n\ttableScrollRef,\n\ttableRowHeight,\n\trowIndexById,\n\titems,\n\tstopDragSelection,\n\tfocusTableWithoutAutoSelect,\n\tonCommitMove,\n\tautoScrollEdgeThreshold,\n\tautoScrollMaxStep,\n}: UseRowReorderControllerOptions<TItem>): RowReorderControllerResult {\n\tconst rowReorderDragState = interactionState.kind === \"rowReorder\" ? interactionState.rowReorder : null\n\tconst rowReorderingEnabled = getRowReorderingEnabled({\n\t\tisFilterActive,\n\t\tdataIsViewOnly,\n\t\trowCount: rowIds.length,\n\t\tselectedRowCount,\n\t})\n\tconst isRowReordering = rowReorderDragState !== null\n\tconst draggedRowId = rowReorderDragState?.rowId ?? null\n\n\tconst startRowReorderDragState = useCallback(\n\t\t(state: VirtualGridRowReorderState) => {\n\t\t\tdispatchInteraction({ kind: \"startRowReorder\", rowReorder: state })\n\t\t},\n\t\t[dispatchInteraction],\n\t)\n\n\tconst updateRowReorderDragState = useCallback(\n\t\t(state: VirtualGridRowReorderState) => {\n\t\t\tdispatchInteraction({ kind: \"updateRowReorder\", rowReorder: state })\n\t\t},\n\t\t[dispatchInteraction],\n\t)\n\n\tconst clearRowReorderDragState = useCallback(() => {\n\t\tdispatchInteraction({ kind: \"stopRowReorder\" })\n\t}, [dispatchInteraction])\n\n\tconst { startRowReorderDrag, cancelRowReorderDrag } = useVirtualGridRowReorder({\n\t\ttableScrollRef,\n\t\ttableRowHeight,\n\t\trowIdsLength: rowIds.length,\n\t\trowIndexById,\n\t\trowReorderDragState,\n\t\tstartRowReorderDragState,\n\t\tupdateRowReorderDragState,\n\t\tclearRowReorderDragState,\n\t\tstopDragSelection,\n\t\tfocusTableWithoutAutoSelect,\n\t\tonCommitMove,\n\t\tautoScrollEdgeThreshold,\n\t\tautoScrollMaxStep,\n\t})\n\n\tconst rowReorderPreviewOffsetY = getRowReorderPreviewOffsetY(rowReorderDragState)\n\tconst rowReorderPreviewRowIndex = useMemo(() => {\n\t\treturn getRowReorderPreviewRowIndex({\n\t\t\tdragState: rowReorderDragState,\n\t\t\titems,\n\t\t\trowIndexById,\n\t\t})\n\t}, [items, rowIndexById, rowReorderDragState])\n\tconst rowReorderPreviewTop = useMemo(() => {\n\t\treturn getRowReorderPreviewTop({\n\t\t\tpreviewRowIndex: rowReorderPreviewRowIndex,\n\t\t\tpreviewOffsetY: rowReorderPreviewOffsetY,\n\t\t\ttableRowHeight,\n\t\t\trowCount: items.length,\n\t\t})\n\t}, [items.length, rowReorderPreviewOffsetY, rowReorderPreviewRowIndex, tableRowHeight])\n\n\tconst shouldHideRowReorderInsertionIndicatorForAutoScroll = useMemo(() => {\n\t\tif (!rowReorderDragState) return false\n\n\t\treturn getShouldHideRowReorderInsertionIndicatorForAutoScroll({\n\t\t\tdragState: rowReorderDragState,\n\t\t\tscrollBoundsTop: rowReorderDragState.scrollBoundsTop,\n\t\t\tscrollBoundsBottom: rowReorderDragState.scrollBoundsBottom,\n\t\t\ttableRowHeight,\n\t\t\tedgeThreshold: autoScrollEdgeThreshold,\n\t\t\tscrollTop: rowReorderDragState.currentScrollTop,\n\t\t\tscrollHeight: rowReorderDragState.scrollContentHeight,\n\t\t\tclientHeight: rowReorderDragState.scrollViewportHeight,\n\t\t})\n\t}, [autoScrollEdgeThreshold, rowReorderDragState, tableRowHeight])\n\n\tconst rowReorderInsertionIndicatorTop = useMemo(() => {\n\t\treturn getRowReorderInsertionIndicatorTop({\n\t\t\tdragState: rowReorderDragState,\n\t\t\tshouldHideForAutoScroll: shouldHideRowReorderInsertionIndicatorForAutoScroll,\n\t\t\ttableRowHeight,\n\t\t})\n\t}, [rowReorderDragState, shouldHideRowReorderInsertionIndicatorForAutoScroll, tableRowHeight])\n\n\treturn {\n\t\trowReorderingEnabled,\n\t\tisRowReordering,\n\t\tdraggedRowId,\n\t\tstartRowReorderDrag,\n\t\tcancelRowReorderDrag,\n\t\trowReorderPreviewRowIndex,\n\t\trowReorderPreviewTop,\n\t\trowReorderInsertionIndicatorTop,\n\t}\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\ninterface RowReorderPreviewDragState {\n\trowId: NodeID\n\tsourceRowIndex: number\n\tstartClientY: number\n\tcurrentClientY: number\n\tstartScrollTop: number\n\tcurrentScrollTop: number\n}\n\ninterface GetRowReorderPreviewRowIndexOptions {\n\tdragState: RowReorderPreviewDragState | null\n\titems: readonly { id: NodeID }[]\n\trowIndexById: ReadonlyMap<NodeID, number>\n}\n\nexport function getRowReorderPreviewOffsetY(dragState: RowReorderPreviewDragState | null): number {\n\tif (!dragState) return 0\n\treturn dragState.currentClientY - dragState.startClientY + (dragState.currentScrollTop - dragState.startScrollTop)\n}\n\nexport function getRowReorderPreviewRowIndex({\n\tdragState,\n\titems,\n\trowIndexById,\n}: GetRowReorderPreviewRowIndexOptions): number | null {\n\tif (!dragState) return null\n\n\tconst sourceRow = items[dragState.sourceRowIndex]\n\tif (sourceRow?.id === dragState.rowId) return dragState.sourceRowIndex\n\n\treturn rowIndexById.get(dragState.rowId) ?? null\n}\n\ninterface GetRowReorderPreviewTopOptions {\n\tpreviewRowIndex: number | null\n\tpreviewOffsetY: number\n\ttableRowHeight: number\n\trowCount: number\n}\n\nexport function getRowReorderPreviewTop({\n\tpreviewRowIndex,\n\tpreviewOffsetY,\n\ttableRowHeight,\n\trowCount,\n}: GetRowReorderPreviewTopOptions): number | null {\n\tif (previewRowIndex === null) return null\n\n\tconst unclampedTop = tableRowHeight + previewRowIndex * tableRowHeight + previewOffsetY\n\tconst minTop = tableRowHeight\n\tconst maxTop = tableRowHeight + Math.max(0, rowCount - 1) * tableRowHeight\n\treturn Math.min(maxTop, Math.max(minTop, unclampedTop))\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport React from \"react\"\nimport { getAutoScrollTimeScale } from \"./VirtualCollectionItemTable.autoScrollTimeScale.ts\"\n\nexport interface VirtualGridRowReorderState {\n\trowId: NodeID\n\tsourceRowIndex: number\n\tdropIndex: number\n\tstartClientY: number\n\tcurrentClientY: number\n\tstartScrollTop: number\n\tcurrentScrollTop: number\n\tscrollBoundsTop: number\n\tscrollBoundsBottom: number\n\tscrollContentHeight: number\n\tscrollViewportHeight: number\n}\n\ninterface UseVirtualGridRowReorderArgs {\n\ttableScrollRef: React.RefObject<HTMLDivElement | null>\n\ttableRowHeight: number\n\trowIdsLength: number\n\trowIndexById: ReadonlyMap<NodeID, number>\n\trowReorderDragState: VirtualGridRowReorderState | null\n\tstartRowReorderDragState: (state: VirtualGridRowReorderState) => void\n\tupdateRowReorderDragState: (state: VirtualGridRowReorderState) => void\n\tclearRowReorderDragState: () => void\n\tstopDragSelection: () => void\n\tfocusTableWithoutAutoSelect: () => void\n\tonCommitMove: (from: number, to: number) => void\n\tautoScrollEdgeThreshold: number\n\tautoScrollMaxStep: number\n}\n\nexport function useVirtualGridRowReorder({\n\ttableScrollRef,\n\ttableRowHeight,\n\trowIdsLength,\n\trowIndexById,\n\trowReorderDragState,\n\tstartRowReorderDragState,\n\tupdateRowReorderDragState,\n\tclearRowReorderDragState,\n\tstopDragSelection,\n\tfocusTableWithoutAutoSelect,\n\tonCommitMove,\n\tautoScrollEdgeThreshold,\n\tautoScrollMaxStep,\n}: UseVirtualGridRowReorderArgs) {\n\tconst getScrollMeasurements = React.useCallback(() => {\n\t\tconst scrollElement = tableScrollRef.current\n\t\tif (!scrollElement) return null\n\t\tconst bounds = scrollElement.getBoundingClientRect()\n\t\treturn {\n\t\t\tcurrentScrollTop: scrollElement.scrollTop,\n\t\t\tscrollBoundsTop: bounds.top,\n\t\t\tscrollBoundsBottom: bounds.bottom,\n\t\t\tscrollContentHeight: scrollElement.scrollHeight,\n\t\t\tscrollViewportHeight: scrollElement.clientHeight,\n\t\t}\n\t}, [tableScrollRef])\n\n\tconst rowReorderDragStateRef = React.useRef<VirtualGridRowReorderState | null>(rowReorderDragState)\n\tconst isRowReordering = rowReorderDragState !== null\n\tconst rowReorderPointerClientYRef = React.useRef<number | null>(null)\n\tconst rowReorderAutoScrollAnimationFrameRef = React.useRef<number | null>(null)\n\tconst rowReorderAutoScrollLastTimestampRef = React.useRef<number | null>(null)\n\n\tReact.useEffect(() => {\n\t\trowReorderDragStateRef.current = rowReorderDragState\n\t}, [rowReorderDragState])\n\n\tconst getRowReorderDropIndexFromClientY = React.useCallback(\n\t\t(clientY: number): number | null => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return null\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst rowsBodyTop = scrollBounds.top + tableRowHeight\n\t\t\tconst rowsRelativeY = clientY - rowsBodyTop + scrollElement.scrollTop\n\n\t\t\tif (rowIdsLength <= 0) return 0\n\t\t\tif (rowsRelativeY <= 0) return 0\n\n\t\t\tconst rowsTotalHeight = rowIdsLength * tableRowHeight\n\t\t\tif (rowsRelativeY >= rowsTotalHeight) return rowIdsLength\n\n\t\t\tconst rowIndex = Math.floor(rowsRelativeY / tableRowHeight)\n\t\t\tconst offsetWithinRow = rowsRelativeY - rowIndex * tableRowHeight\n\t\t\treturn offsetWithinRow < tableRowHeight / 2 ? rowIndex : rowIndex + 1\n\t\t},\n\t\t[rowIdsLength, tableRowHeight, tableScrollRef],\n\t)\n\n\tconst stopRowReorderAutoScroll = React.useCallback(() => {\n\t\tif (rowReorderAutoScrollAnimationFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(rowReorderAutoScrollAnimationFrameRef.current)\n\t\t\trowReorderAutoScrollAnimationFrameRef.current = null\n\t\t}\n\t\trowReorderAutoScrollLastTimestampRef.current = null\n\t}, [])\n\n\tconst isPointerNearRowReorderAutoScrollEdge = React.useCallback(\n\t\t(clientY: number) => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return false\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyTop = scrollBounds.top + tableRowHeight\n\t\t\tconst bodyBottom = scrollBounds.bottom\n\t\t\tconst nearTopEdge = clientY < bodyTop + autoScrollEdgeThreshold\n\t\t\tconst nearBottomEdge = clientY > bodyBottom - autoScrollEdgeThreshold\n\t\t\treturn nearTopEdge || nearBottomEdge\n\t\t},\n\t\t[autoScrollEdgeThreshold, tableRowHeight, tableScrollRef],\n\t)\n\n\tconst updateRowReorderDropIndex = React.useCallback(\n\t\t(clientY: number) => {\n\t\t\tconst currentState = rowReorderDragStateRef.current\n\t\t\tif (!currentState) return\n\n\t\t\tconst nextDropIndex = getRowReorderDropIndexFromClientY(clientY)\n\t\t\tconst scrollMeasurements = getScrollMeasurements()\n\t\t\tconst resolvedDropIndex = nextDropIndex ?? currentState.dropIndex\n\t\t\tconst resolvedScrollTop = scrollMeasurements?.currentScrollTop ?? currentState.currentScrollTop\n\t\t\tif (\n\t\t\t\tcurrentState.dropIndex === resolvedDropIndex &&\n\t\t\t\tcurrentState.currentClientY === clientY &&\n\t\t\t\tcurrentState.currentScrollTop === resolvedScrollTop\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst nextState: VirtualGridRowReorderState = {\n\t\t\t\t...currentState,\n\t\t\t\t...scrollMeasurements,\n\t\t\t\tdropIndex: resolvedDropIndex,\n\t\t\t\tcurrentClientY: clientY,\n\t\t\t\tcurrentScrollTop: resolvedScrollTop,\n\t\t\t}\n\n\t\t\tupdateRowReorderDragState(nextState)\n\t\t\trowReorderDragStateRef.current = nextState\n\t\t},\n\t\t[getRowReorderDropIndexFromClientY, getScrollMeasurements, updateRowReorderDragState],\n\t)\n\n\tconst clearActiveRowReorderDragState = React.useCallback(() => {\n\t\tstopRowReorderAutoScroll()\n\t\trowReorderPointerClientYRef.current = null\n\t\trowReorderDragStateRef.current = null\n\t\tclearRowReorderDragState()\n\t\tfocusTableWithoutAutoSelect()\n\t}, [clearRowReorderDragState, focusTableWithoutAutoSelect, stopRowReorderAutoScroll])\n\n\tconst commitRowReorderDrag = React.useCallback(() => {\n\t\tconst currentState = rowReorderDragStateRef.current\n\t\tif (!currentState) return\n\n\t\tclearActiveRowReorderDragState()\n\t\tconst droppedAtSource = currentState.dropIndex === currentState.sourceRowIndex\n\t\tconst droppedAfterSource = currentState.dropIndex === currentState.sourceRowIndex + 1\n\t\tif (droppedAtSource || droppedAfterSource) {\n\t\t\treturn\n\t\t}\n\n\t\tconst isMovingForward = currentState.dropIndex > currentState.sourceRowIndex\n\t\tconst toIndex = isMovingForward ? currentState.dropIndex - 1 : currentState.dropIndex\n\n\t\tonCommitMove(currentState.sourceRowIndex, toIndex)\n\t}, [clearActiveRowReorderDragState, onCommitMove])\n\n\tconst cancelRowReorderDrag = React.useCallback(() => {\n\t\tclearActiveRowReorderDragState()\n\t}, [clearActiveRowReorderDragState])\n\n\tconst startRowReorderDrag = React.useCallback(\n\t\t(rowId: NodeID, clientY: number) => {\n\t\t\tconst sourceRowIndex = rowIndexById.get(rowId)\n\t\t\tif (sourceRowIndex === undefined) return\n\n\t\t\tconst scrollMeasurements = getScrollMeasurements()\n\t\t\tconst initialScrollTop = scrollMeasurements?.currentScrollTop ?? 0\n\t\t\tconst nextState: VirtualGridRowReorderState = {\n\t\t\t\trowId,\n\t\t\t\tsourceRowIndex,\n\t\t\t\tdropIndex: getRowReorderDropIndexFromClientY(clientY) ?? sourceRowIndex,\n\t\t\t\tstartClientY: clientY,\n\t\t\t\tcurrentClientY: clientY,\n\t\t\t\tstartScrollTop: initialScrollTop,\n\t\t\t\tcurrentScrollTop: initialScrollTop,\n\t\t\t\tscrollBoundsTop: scrollMeasurements?.scrollBoundsTop ?? 0,\n\t\t\t\tscrollBoundsBottom: scrollMeasurements?.scrollBoundsBottom ?? 0,\n\t\t\t\tscrollContentHeight: scrollMeasurements?.scrollContentHeight ?? 0,\n\t\t\t\tscrollViewportHeight: scrollMeasurements?.scrollViewportHeight ?? 0,\n\t\t\t}\n\n\t\t\trowReorderPointerClientYRef.current = clientY\n\t\t\trowReorderDragStateRef.current = nextState\n\t\t\tstopDragSelection()\n\t\t\tstartRowReorderDragState(nextState)\n\t\t},\n\t\t[\n\t\t\tgetRowReorderDropIndexFromClientY,\n\t\t\tgetScrollMeasurements,\n\t\t\trowIndexById,\n\t\t\tstartRowReorderDragState,\n\t\t\tstopDragSelection,\n\t\t],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (!isRowReordering) return\n\n\t\tconst autoScrollStep = (timestamp: number) => {\n\t\t\trowReorderAutoScrollAnimationFrameRef.current = null\n\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tconst pointerClientY = rowReorderPointerClientYRef.current\n\t\t\tif (!scrollElement || pointerClientY === null) return\n\n\t\t\tconst timeScale = getAutoScrollTimeScale(timestamp, rowReorderAutoScrollLastTimestampRef.current)\n\t\t\trowReorderAutoScrollLastTimestampRef.current = timestamp\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyTop = scrollBounds.top + tableRowHeight\n\t\t\tconst bodyBottom = scrollBounds.bottom\n\n\t\t\tlet scrollDelta = 0\n\t\t\tif (pointerClientY < bodyTop + autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = bodyTop + autoScrollEdgeThreshold - pointerClientY\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tscrollDelta = -Math.max(1, step)\n\t\t\t} else if (pointerClientY > bodyBottom - autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = pointerClientY - (bodyBottom - autoScrollEdgeThreshold)\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tscrollDelta = Math.max(1, step)\n\t\t\t}\n\n\t\t\tlet canContinueAutoScroll = false\n\t\t\tif (scrollDelta !== 0) {\n\t\t\t\tconst totalScrollTop = scrollElement.scrollHeight - scrollElement.clientHeight\n\t\t\t\tconst maxScrollTop = Math.max(0, totalScrollTop)\n\t\t\t\tconst rawScrollTop = scrollElement.scrollTop + scrollDelta\n\t\t\t\tconst clampedScrollTop = Math.max(0, rawScrollTop)\n\t\t\t\tconst nextScrollTop = Math.min(maxScrollTop, clampedScrollTop)\n\t\t\t\tif (nextScrollTop !== scrollElement.scrollTop) {\n\t\t\t\t\tscrollElement.scrollTop = nextScrollTop\n\t\t\t\t}\n\t\t\t\tconst canScrollUp = scrollDelta < 0 && nextScrollTop > 0\n\t\t\t\tconst canScrollDown = scrollDelta > 0 && nextScrollTop < maxScrollTop\n\t\t\t\tcanContinueAutoScroll = canScrollUp || canScrollDown\n\t\t\t}\n\n\t\t\tupdateRowReorderDropIndex(pointerClientY)\n\n\t\t\tif (!isPointerNearRowReorderAutoScrollEdge(pointerClientY)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!canContinueAutoScroll) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (rowReorderDragStateRef.current === null) return\n\t\t\tif (rowReorderAutoScrollAnimationFrameRef.current !== null) return\n\t\t\trowReorderAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst ensureRowReorderAutoScrollRunning = () => {\n\t\t\tif (rowReorderAutoScrollAnimationFrameRef.current !== null) return\n\t\t\trowReorderAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst handleWindowPointerMove = (event: PointerEvent) => {\n\t\t\trowReorderPointerClientYRef.current = event.clientY\n\t\t\tupdateRowReorderDropIndex(event.clientY)\n\n\t\t\tif (isPointerNearRowReorderAutoScrollEdge(event.clientY)) {\n\t\t\t\tensureRowReorderAutoScrollRunning()\n\t\t\t} else {\n\t\t\t\tstopRowReorderAutoScroll()\n\t\t\t}\n\t\t}\n\n\t\tconst handleWindowKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tcancelRowReorderDrag()\n\t\t}\n\n\t\tconst controller = new AbortController()\n\t\tconst abortSignal = controller.signal\n\t\twindow.addEventListener(\"pointermove\", handleWindowPointerMove, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointerup\", commitRowReorderDrag, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointercancel\", cancelRowReorderDrag, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"blur\", cancelRowReorderDrag, { signal: abortSignal })\n\t\twindow.addEventListener(\"keydown\", handleWindowKeyDown, { capture: true, signal: abortSignal })\n\n\t\treturn () => {\n\t\t\tstopRowReorderAutoScroll()\n\t\t\tcontroller.abort()\n\t\t}\n\t}, [\n\t\tautoScrollEdgeThreshold,\n\t\tautoScrollMaxStep,\n\t\tcancelRowReorderDrag,\n\t\tcommitRowReorderDrag,\n\t\tisPointerNearRowReorderAutoScrollEdge,\n\t\tisRowReordering,\n\t\tstopRowReorderAutoScroll,\n\t\ttableRowHeight,\n\t\ttableScrollRef,\n\t\tupdateRowReorderDropIndex,\n\t])\n\n\treturn {\n\t\tstartRowReorderDrag,\n\t\tcancelRowReorderDrag,\n\t\tclearActiveRowReorderDragState,\n\t}\n}\n", "import { Mixed } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\ninterface GetAllVisibleRowsCheckboxStateOptions {\n\trowIds: readonly NodeID[]\n\tmultiSelectedItems: ReadonlySet<NodeID> | null | undefined\n}\n\nexport function getAllVisibleRowsCheckboxState({\n\trowIds,\n\tmultiSelectedItems,\n}: GetAllVisibleRowsCheckboxStateOptions): boolean | Mixed {\n\tif (rowIds.length === 0) return false\n\tif (!multiSelectedItems || multiSelectedItems.size === 0) return false\n\n\tlet selectedVisibleCount = 0\n\tfor (const rowId of rowIds) {\n\t\tif (multiSelectedItems.has(rowId)) {\n\t\t\tselectedVisibleCount++\n\t\t}\n\t}\n\n\tif (selectedVisibleCount === 0) return false\n\tif (selectedVisibleCount === rowIds.length) return true\n\treturn Mixed\n}\n", "import { dataIsPopoverSelector, virtualTableBottomFillerHitTargetSelector } from \"@framerjs/fresco\"\nimport { useEffect } from \"react\"\nimport { dataIsPopoutWindowSelector } from \"../shared/PopoutWindow.tsx\"\nimport { dataIsTableSearchBarSelector } from \"../shared/TableSearchBar.tsx\"\nimport { dataIsLeftPanelSelector, dataIsProjectBarSelector } from \"../shared/chromeHitTargets.ts\"\nimport {\n\tprojectBarPreviewButtonSelector,\n\tvirtualCollectionItemTableFillerColumnSelector,\n} from \"./VirtualCollectionItemTable.hitTargets.ts\"\n\nfunction getTargetElement(target: EventTarget | null): Element | null {\n\tif (target instanceof Element) return target\n\tif (target instanceof Node) return target.parentElement\n\treturn null\n}\n\nexport function shouldClearVirtualCollectionItemTableSelectionOnChromeInteraction(target: EventTarget | null): boolean {\n\tconst targetElement = getTargetElement(target)\n\tif (!targetElement) return false\n\n\t// Don't clear selection when clicking the project bar preview button because we use the preview\n\t// collection item id when toggling the preview.\n\tif (targetElement.closest(projectBarPreviewButtonSelector) !== null) return false\n\n\t// Don't clear the selection when interacting with a popout window or popover.\n\tif (targetElement.closest(dataIsPopoverSelector) !== null) return false\n\tif (targetElement.closest(dataIsPopoutWindowSelector) !== null) return false\n\n\treturn (\n\t\ttargetElement.closest(dataIsProjectBarSelector) !== null ||\n\t\ttargetElement.closest(dataIsLeftPanelSelector) !== null ||\n\t\ttargetElement.closest(dataIsTableSearchBarSelector) !== null ||\n\t\ttargetElement.closest(virtualCollectionItemTableFillerColumnSelector) !== null ||\n\t\ttargetElement.closest(virtualTableBottomFillerHitTargetSelector) !== null\n\t)\n}\n\nexport function useClearVirtualCollectionItemTableSelectionOnChromeInteraction({\n\thasCellSelection,\n\tclearSelection,\n}: {\n\thasCellSelection: boolean\n\tclearSelection: () => void\n}) {\n\tuseEffect(() => {\n\t\tif (!hasCellSelection) return\n\n\t\tconst handleDocumentMouseDown = (event: MouseEvent) => {\n\t\t\tif (shouldClearVirtualCollectionItemTableSelectionOnChromeInteraction(event.target)) {\n\t\t\t\tclearSelection()\n\t\t\t}\n\t\t}\n\n\t\tconst abortController = new AbortController()\n\n\t\tdocument.addEventListener(\"mousedown\", handleDocumentMouseDown, {\n\t\t\tcapture: true,\n\t\t\tsignal: abortController.signal,\n\t\t})\n\n\t\treturn () => {\n\t\t\tabortController.abort()\n\t\t}\n\t}, [clearSelection, hasCellSelection])\n}\n", "import type { VirtualTableIndexRange } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CSSProperties } from \"react\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport { cellBorderWidth } from \"./VirtualCollectionItemTable.styles.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface VirtualGridSelectionBounds {\n\tminRowIndex: number\n\tmaxRowIndex: number\n\tminColumnIndex: number\n\tmaxColumnIndex: number\n}\n\ninterface VirtualGridOverlayRect extends CSSProperties {\n\ttop: number\n\tleft: number\n\twidth: number\n\theight: number\n}\n\ninterface GetSelectionBoundsOptions {\n\tselectedCells: readonly CellIdentifier[]\n\trowIndexById: ReadonlyMap<NodeID, number>\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n\tincludeColumnIndex: (columnIndex: number) => boolean\n}\n\nexport function getSelectionBounds({\n\tselectedCells,\n\trowIndexById,\n\tcolumnIndexById,\n\tincludeColumnIndex,\n}: GetSelectionBoundsOptions): VirtualGridSelectionBounds | null {\n\tlet selectionBounds: VirtualGridSelectionBounds | null = null\n\n\tfor (const cell of selectedCells) {\n\t\tconst rowIndex = rowIndexById.get(cell.rowId)\n\t\tconst columnIndex = columnIndexById.get(cell.columnId)\n\t\tif (rowIndex === undefined || columnIndex === undefined) continue\n\t\tif (!includeColumnIndex(columnIndex)) continue\n\n\t\tselectionBounds = selectionBounds\n\t\t\t? {\n\t\t\t\t\tminRowIndex: Math.min(selectionBounds.minRowIndex, rowIndex),\n\t\t\t\t\tmaxRowIndex: Math.max(selectionBounds.maxRowIndex, rowIndex),\n\t\t\t\t\tminColumnIndex: Math.min(selectionBounds.minColumnIndex, columnIndex),\n\t\t\t\t\tmaxColumnIndex: Math.max(selectionBounds.maxColumnIndex, columnIndex),\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tminRowIndex: rowIndex,\n\t\t\t\t\tmaxRowIndex: rowIndex,\n\t\t\t\t\tminColumnIndex: columnIndex,\n\t\t\t\t\tmaxColumnIndex: columnIndex,\n\t\t\t\t}\n\t}\n\n\treturn selectionBounds\n}\n\nexport function isSelectionPartiallyVisible(options: {\n\tbounds: VirtualGridSelectionBounds\n\tvisibleRows: VirtualTableIndexRange\n\tvisibleColumns: VirtualTableIndexRange\n}): boolean {\n\tconst { bounds, visibleRows, visibleColumns } = options\n\tconst belowVisibleRows = bounds.maxRowIndex < visibleRows.start\n\tconst aboveVisibleRows = bounds.minRowIndex > visibleRows.end\n\tconst leftOfVisibleColumns = bounds.maxColumnIndex < visibleColumns.start\n\tconst rightOfVisibleColumns = bounds.minColumnIndex > visibleColumns.end\n\tconst fullyOutside = belowVisibleRows || aboveVisibleRows || leftOfVisibleColumns || rightOfVisibleColumns\n\treturn !fullyOutside\n}\n\nexport function getSelectionRangeOverlayRect(options: {\n\tbounds: VirtualGridSelectionBounds\n\ttableRowHeight: number\n\trowHeaderWidth: number\n\tcolumnLeftOffsets: readonly number[]\n\tcolumnWidths: readonly number[]\n\tdefaultColumnWidth: number\n}): VirtualGridOverlayRect {\n\tconst { bounds, tableRowHeight, rowHeaderWidth, columnLeftOffsets, columnWidths, defaultColumnWidth } = options\n\tconst topEdgeOffset = cellBorderWidth\n\tconst leftEdgeOffset = cellBorderWidth\n\n\tconst minColumnLeft = columnLeftOffsets[bounds.minColumnIndex] ?? 0\n\tconst maxColumnLeft = columnLeftOffsets[bounds.maxColumnIndex] ?? 0\n\tconst maxColumnWidth = columnWidths[bounds.maxColumnIndex] ?? defaultColumnWidth\n\n\tconst minRowOffset = bounds.minRowIndex * tableRowHeight\n\tconst top = tableRowHeight + minRowOffset - topEdgeOffset\n\tconst left = rowHeaderWidth + minColumnLeft - leftEdgeOffset\n\tconst right = rowHeaderWidth + maxColumnLeft + maxColumnWidth\n\tconst maxRowOffset = (bounds.maxRowIndex + 1) * tableRowHeight\n\tconst bottom = tableRowHeight + maxRowOffset\n\n\treturn {\n\t\ttop,\n\t\tleft,\n\t\twidth: right - left,\n\t\theight: bottom - top,\n\t}\n}\n\nexport function getSelectionAnchorOverlayRect(options: {\n\tanchorCell: CellIdentifier | null\n\trowIndexById: ReadonlyMap<NodeID, number>\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n\tincludeColumnIndex: (columnIndex: number) => boolean\n\tvisibleRows: VirtualTableIndexRange\n\tvisibleColumns: VirtualTableIndexRange\n\ttableRowHeight: number\n\trowHeaderWidth: number\n\tcolumnLeftOffsets: readonly number[]\n\tcolumnWidths: readonly number[]\n\tdefaultColumnWidth: number\n}): VirtualGridOverlayRect | null {\n\tconst {\n\t\tanchorCell,\n\t\trowIndexById,\n\t\tcolumnIndexById,\n\t\tincludeColumnIndex,\n\t\tvisibleRows,\n\t\tvisibleColumns,\n\t\ttableRowHeight,\n\t\trowHeaderWidth,\n\t\tcolumnLeftOffsets,\n\t\tcolumnWidths,\n\t\tdefaultColumnWidth,\n\t} = options\n\tif (!anchorCell) return null\n\n\tconst anchorRowIndex = rowIndexById.get(anchorCell.rowId)\n\tconst anchorColumnIndex = columnIndexById.get(anchorCell.columnId)\n\tif (anchorRowIndex === undefined || anchorColumnIndex === undefined) return null\n\tif (!includeColumnIndex(anchorColumnIndex)) return null\n\tif (anchorRowIndex < visibleRows.start || anchorRowIndex > visibleRows.end) return null\n\tif (anchorColumnIndex < visibleColumns.start || anchorColumnIndex > visibleColumns.end) return null\n\n\tconst topEdgeOffset = cellBorderWidth\n\tconst leftEdgeOffset = cellBorderWidth\n\n\tconst columnLeft = columnLeftOffsets[anchorColumnIndex] ?? 0\n\tconst columnWidth = columnWidths[anchorColumnIndex] ?? defaultColumnWidth\n\n\tconst anchorRowOffset = anchorRowIndex * tableRowHeight\n\tconst top = tableRowHeight + anchorRowOffset - topEdgeOffset\n\tconst left = rowHeaderWidth + columnLeft - leftEdgeOffset\n\tconst width = columnWidth + leftEdgeOffset\n\tconst height = tableRowHeight + topEdgeOffset\n\n\treturn { top, left, width, height }\n}\n\nexport function getSelectionStickyBoundaryRect(options: {\n\tbounds: VirtualGridSelectionBounds\n\tvisibleRows: VirtualTableIndexRange\n\ttableRowHeight: number\n\trowHeaderWidth: number\n\tcolumnLeftOffsets: readonly number[]\n\tcolumnWidths: readonly number[]\n\tdefaultColumnWidth: number\n}): VirtualGridOverlayRect | null {\n\tconst { bounds, visibleRows, tableRowHeight, rowHeaderWidth, columnLeftOffsets, columnWidths, defaultColumnWidth } =\n\t\toptions\n\tconst minRowIndex = Math.max(bounds.minRowIndex, visibleRows.start)\n\tconst maxRowIndex = Math.min(bounds.maxRowIndex, visibleRows.end)\n\tif (minRowIndex > maxRowIndex) return null\n\n\tconst maxColumnLeft = columnLeftOffsets[bounds.maxColumnIndex] ?? 0\n\tconst maxColumnWidth = columnWidths[bounds.maxColumnIndex] ?? defaultColumnWidth\n\tconst minRowOffset = minRowIndex * tableRowHeight\n\tconst rowCount = maxRowIndex - minRowIndex + 1\n\tconst top = tableRowHeight + minRowOffset\n\tconst left = rowHeaderWidth + maxColumnLeft + maxColumnWidth - cellBorderWidth\n\tconst width = cellBorderWidth\n\tconst height = rowCount * tableRowHeight\n\n\treturn { top, left, width, height }\n}\n\ninterface SelectionInnerBorderVisibility {\n\tshowRight: boolean\n\tshowBottom: boolean\n}\n\nexport function getSelectionInnerBorderVisibility(options: {\n\tselectionBounds: VirtualGridSelectionBounds\n\trowIndex: number\n\tcolumnIndex: number\n}): SelectionInnerBorderVisibility {\n\tconst { selectionBounds, rowIndex, columnIndex } = options\n\n\tconst { minRowIndex, maxRowIndex, minColumnIndex, maxColumnIndex } = selectionBounds\n\tconst rowIsInsideSelection = rowIndex >= minRowIndex && rowIndex <= maxRowIndex\n\tconst columnIsInsideSelection = columnIndex >= minColumnIndex && columnIndex <= maxColumnIndex\n\n\tif (!rowIsInsideSelection || !columnIsInsideSelection) {\n\t\treturn {\n\t\t\tshowRight: false,\n\t\t\tshowBottom: false,\n\t\t}\n\t}\n\n\treturn {\n\t\tshowRight: columnIndex < selectionBounds.maxColumnIndex,\n\t\tshowBottom: rowIndex < selectionBounds.maxRowIndex,\n\t}\n}\n", "import type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\n\n/**\n * Make sure to have stable row ids to avoid breaking memoization for all of the hooks depending on\n * these row ids when unrelated collection item properties change.\n */\nexport function useStableRowIds(items: readonly CollectionItemNode[]): readonly NodeID[] {\n\tconst [rowIds, setRowIds] = useState<readonly NodeID[]>(() => items.map(getId))\n\tconst [previousItems, setPreviousItems] = useState(items)\n\n\tif (items !== previousItems) {\n\t\tsetPreviousItems(items)\n\n\t\tif (itemCountOrOrderHasChanged(items, previousItems)) {\n\t\t\tconst newRowIds = items.map(getId)\n\t\t\tsetRowIds(newRowIds)\n\t\t\treturn newRowIds\n\t\t}\n\t}\n\n\treturn rowIds\n}\n\nfunction itemCountOrOrderHasChanged(\n\titems: readonly CollectionItemNode[],\n\tpreviousItems: readonly CollectionItemNode[],\n): boolean {\n\tif (items.length !== previousItems.length) return true\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: length is checked above.\n\t\tconst latestItem = items[i]!\n\t\t// biome-ignore lint/style/noNonNullAssertion: length is checked above.\n\t\tconst previousItem = previousItems[i]!\n\t\tif (latestItem.id !== previousItem.id) return true\n\t}\n\n\treturn false\n}\n", "import { useCallback, useRef, useState } from \"react\"\nimport { useElementScrollCallbackRef } from \"./useElementScrollCallbackRef.ts\"\n\ninterface VirtualCollectionItemTableViewportResult {\n\ttableViewportWidth: number\n\tisHorizontallyScrolled: boolean\n\ttableContainerCallbackRef: (element: HTMLDivElement | null) => void\n\ttableScrollCallbackRef: (element: HTMLDivElement | null) => void\n}\n\nexport function useVirtualCollectionItemTableViewport(): VirtualCollectionItemTableViewportResult {\n\tconst [tableViewportWidth, setTableViewportWidth] = useState(0)\n\tconst [isHorizontallyScrolled, setIsHorizontallyScrolled] = useState(false)\n\n\tconst tableContainerCleanupRef = useRef<VoidFunction | null>(null)\n\tconst tableContainerCallbackRef = useCallback((element: HTMLDivElement | null) => {\n\t\ttableContainerCleanupRef.current?.()\n\n\t\tif (!element) {\n\t\t\tsetTableViewportWidth(0)\n\t\t\treturn\n\t\t}\n\n\t\tconst updateWidth = () => {\n\t\t\tconst nextTableViewportWidth = element.clientWidth\n\t\t\tsetTableViewportWidth(nextTableViewportWidth)\n\t\t}\n\n\t\tupdateWidth()\n\n\t\tconst controller = new AbortController()\n\t\tlet observer: ResizeObserver | undefined\n\t\tif (typeof ResizeObserver !== \"undefined\") {\n\t\t\tobserver = new ResizeObserver(updateWidth)\n\t\t\tobserver.observe(element)\n\t\t} else {\n\t\t\twindow.addEventListener(\"resize\", updateWidth, { signal: controller.signal })\n\t\t}\n\n\t\ttableContainerCleanupRef.current = () => {\n\t\t\tcontroller.abort()\n\t\t\tobserver?.disconnect()\n\t\t}\n\t}, [])\n\n\tconst tableScrollCallbackRef = useElementScrollCallbackRef<HTMLDivElement>({\n\t\tonScroll: element => {\n\t\t\tconst nextIsHorizontallyScrolled = element.scrollLeft > 0\n\t\t\tsetIsHorizontallyScrolled(nextIsHorizontallyScrolled)\n\t\t},\n\t\trunOnMount: true,\n\t})\n\n\treturn {\n\t\ttableViewportWidth,\n\t\tisHorizontallyScrolled,\n\t\ttableContainerCallbackRef,\n\t\ttableScrollCallbackRef,\n\t}\n}\n", "import { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport { useCallback, useEffect, useRef } from \"react\"\n\ninterface UseElementScrollCallbackRefOptions<Element extends HTMLElement> {\n\tonScroll: (element: Element) => void\n\trunOnMount?: boolean\n}\n\nexport function useElementScrollCallbackRef<Element extends HTMLElement>({\n\tonScroll,\n\trunOnMount = false,\n}: UseElementScrollCallbackRefOptions<Element>): (element: Element | null) => void {\n\tconst cleanupRef = useRef<VoidFunction | null>(null)\n\n\tconst stableOnScroll = useStableCallback(onScroll)\n\n\tuseEffect(() => {\n\t\t// Make sure to clean up the scroll listener when the component unmounts.\n\t\treturn () => {\n\t\t\tcleanupRef.current?.()\n\t\t\tcleanupRef.current = null\n\t\t}\n\t}, [])\n\n\treturn useCallback(\n\t\t(element: Element | null) => {\n\t\t\tcleanupRef.current?.()\n\t\t\tcleanupRef.current = null\n\n\t\t\tif (!element) return\n\n\t\t\tconst handleScroll = () => {\n\t\t\t\tstableOnScroll(element)\n\t\t\t}\n\n\t\t\tif (runOnMount) {\n\t\t\t\thandleScroll()\n\t\t\t}\n\n\t\t\tconst controller = new AbortController()\n\t\t\telement.addEventListener(\"scroll\", handleScroll, { passive: true, signal: controller.signal })\n\n\t\t\tcleanupRef.current = () => {\n\t\t\t\tcontroller.abort()\n\t\t\t}\n\t\t},\n\t\t[runOnMount],\n\t)\n}\n", "import { cx } from \"@linaria/core\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getFileControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { CollectionItemOverlayButton } from \"./CollectionItemOverlayButton.tsx\"\nimport { DateCellValue, FileCellValue, TextCellValue } from \"./TableCellPreviews.tsx\"\nimport { getAccessibleLabelForCell, getTextValueInfoForCell } from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport type {\n\tEditingCommitAction,\n\tVirtualCollectionItemTableEditingSession,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport { dataIsVirtualCollectionItemTableFillerColumnAttribute } from \"./VirtualCollectionItemTable.hitTargets.ts\"\nimport { type CellIdentifier, getCellKey } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport type { RowContextMenuTarget } from \"./VirtualCollectionItemTable.tsx\"\nimport { VirtualCollectionItemTableBodyCellEditor } from \"./VirtualCollectionItemTableBodyCellEditor.tsx\"\nimport { VirtualCollectionItemTableBodyCellFrame } from \"./VirtualCollectionItemTableBodyCellFrame.tsx\"\nimport {\n\tVirtualCollectionItemTableBooleanBodyCell,\n\tisBooleanColumn,\n} from \"./VirtualCollectionItemTableBooleanBodyCell.tsx\"\nimport {\n\tVirtualCollectionItemTableComboBoxBodyCell,\n\tisComboBoxColumn,\n} from \"./VirtualCollectionItemTableComboBoxBodyCell.tsx\"\nimport {\n\tVirtualCollectionItemTablePopoutBodyCell,\n\tisPopoutColumn,\n} from \"./VirtualCollectionItemTablePopoutBodyCell.tsx\"\nimport { useVirtualCollectionItemTableClickToEditCell } from \"./useVirtualCollectionItemTableClickToEditCell.ts\"\nimport {\n\tisGalleryCollectionItemTableColumn,\n\ttype CollectionItemTableColumn,\n} from \"./utils/collectionItemTableColumns.ts\"\n\ninterface VirtualCollectionItemTableBodyCellProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode | undefined\n\tcolumn: CollectionItemTableColumn | undefined\n\tcolumnWidth: number\n\tdataIsViewOnly: boolean\n\tcolumnIndex: number\n\tstickyColumnCount: number\n\tisSelected: boolean\n\tisSelectionAnchor: boolean\n\tshowSelectedInnerRightBorder: boolean\n\tshowSelectedInnerBottomBorder: boolean\n\tisRowHighlighted: boolean\n\teditingSession: VirtualCollectionItemTableEditingSession | null\n\tisRowReorderPreviewDraggedRow: boolean\n\tshowCollectionItemOverlayButton: boolean\n\tonBeginDragSelection: (cell: CellIdentifier, shiftKey: boolean) => void\n\tonExtendDragSelection: (cell: CellIdentifier, pressedButtons: number) => void\n\tonStartEditing: (cell: CellIdentifier) => void\n\tonEditingValueChange: (cell: CellIdentifier, value: string) => void\n\tonFinishEditing: () => void\n\tonCommitBooleanValue: (cell: CellIdentifier, value: boolean) => void\n\tonCommitEditing: (command: EditingCommitAction) => void\n\tonToggleCollectionItemOverlay: (rowId: NodeID) => void\n\tonContextMenu: (target: RowContextMenuTarget, event: React.MouseEvent<HTMLDivElement>) => void\n}\n\nexport const VirtualCollectionItemTableBodyCell = React.memo(function VirtualCollectionItemTableBodyCell({\n\tcollectionNodeId,\n\titem,\n\tcolumn,\n\tcolumnWidth,\n\tdataIsViewOnly,\n\tcolumnIndex,\n\tstickyColumnCount,\n\tisSelected,\n\tisSelectionAnchor,\n\tshowSelectedInnerRightBorder,\n\tshowSelectedInnerBottomBorder,\n\tisRowHighlighted,\n\teditingSession,\n\tisRowReorderPreviewDraggedRow,\n\tshowCollectionItemOverlayButton,\n\tonBeginDragSelection,\n\tonExtendDragSelection,\n\tonStartEditing,\n\tonEditingValueChange,\n\tonFinishEditing,\n\tonCommitBooleanValue,\n\tonCommitEditing,\n\tonToggleCollectionItemOverlay,\n\tonContextMenu,\n}: VirtualCollectionItemTableBodyCellProps) {\n\tconst itemId = item?.id\n\n\tconst handleContextMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (!itemId) return\n\t\t\tonContextMenu({ rowId: itemId, columnId: column?.key }, event)\n\t\t},\n\t\t[column?.key, onContextMenu, itemId],\n\t)\n\n\tif (!item) return <div className={styles.bodyCell} role=\"gridcell\" tabIndex={-1} />\n\n\tconst isFirstColumn = columnIndex === 0\n\tconst isLastStickyColumn = columnIndex === stickyColumnCount - 1\n\tconst showRowHighlight = isRowHighlighted && !isSelected\n\n\tif (!column) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.bodyCell,\n\t\t\t\t\tstyles.bodyCellFiller,\n\t\t\t\t\tisLastStickyColumn && styles.bodyCellHideRightDivider,\n\t\t\t\t\tshowRowHighlight && styles.bodyCellRowHighlighted,\n\t\t\t\t\tisRowReorderPreviewDraggedRow && styles.bodyCellRowReorderDragged,\n\t\t\t\t)}\n\t\t\t\trole=\"gridcell\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\tdata-row-id={item.id}\n\t\t\t\t{...{ [dataIsVirtualCollectionItemTableFillerColumnAttribute]: \"true\" }}\n\t\t\t\tonContextMenu={handleContextMenu}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<VirtualCollectionItemTableDefinedBodyCell\n\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\titem={item}\n\t\t\tcolumn={column}\n\t\t\tcolumnWidth={columnWidth}\n\t\t\tdataIsViewOnly={dataIsViewOnly}\n\t\t\tisSelected={isSelected}\n\t\t\tisSelectionAnchor={isSelectionAnchor}\n\t\t\tisFirstColumn={isFirstColumn}\n\t\t\tisLastStickyColumn={isLastStickyColumn}\n\t\t\tshowRowHighlight={showRowHighlight}\n\t\t\tshowSelectedInnerRightBorder={showSelectedInnerRightBorder}\n\t\t\tshowSelectedInnerBottomBorder={showSelectedInnerBottomBorder}\n\t\t\tisRowHighlighted={isRowHighlighted}\n\t\t\teditingSession={editingSession}\n\t\t\tisRowReorderPreviewDraggedRow={isRowReorderPreviewDraggedRow}\n\t\t\tshowCollectionItemOverlayButton={showCollectionItemOverlayButton}\n\t\t\tonBeginDragSelection={onBeginDragSelection}\n\t\t\tonExtendDragSelection={onExtendDragSelection}\n\t\t\tonStartEditing={onStartEditing}\n\t\t\tonEditingValueChange={onEditingValueChange}\n\t\t\tonFinishEditing={onFinishEditing}\n\t\t\tonCommitBooleanValue={onCommitBooleanValue}\n\t\t\tonCommitEditing={onCommitEditing}\n\t\t\tonToggleCollectionItemOverlay={onToggleCollectionItemOverlay}\n\t\t\tonContextMenu={onContextMenu}\n\t\t/>\n\t)\n})\n\ninterface VirtualCollectionItemTableDefinedBodyCellProps extends Omit<\n\tVirtualCollectionItemTableBodyCellProps,\n\t\"columnIndex\" | \"stickyColumnCount\"\n> {\n\titem: CollectionItemNode\n\tcolumn: CollectionItemTableColumn\n\tcolumnWidth: number\n\tisFirstColumn: boolean\n\tisLastStickyColumn: boolean\n\tshowRowHighlight: boolean\n}\n\nconst VirtualCollectionItemTableDefinedBodyCell = React.memo(function VirtualCollectionItemTableDefinedBodyCell({\n\tcollectionNodeId,\n\titem,\n\tcolumn,\n\tcolumnWidth,\n\tdataIsViewOnly,\n\tisSelected,\n\tisSelectionAnchor,\n\tisFirstColumn,\n\tisLastStickyColumn,\n\tshowRowHighlight,\n\tshowSelectedInnerRightBorder,\n\tshowSelectedInnerBottomBorder,\n\teditingSession,\n\tisRowReorderPreviewDraggedRow,\n\tshowCollectionItemOverlayButton,\n\tonBeginDragSelection,\n\tonExtendDragSelection,\n\tonStartEditing,\n\tonEditingValueChange,\n\tonFinishEditing,\n\tonCommitBooleanValue,\n\tonCommitEditing,\n\tonToggleCollectionItemOverlay,\n\tonContextMenu,\n}: VirtualCollectionItemTableDefinedBodyCellProps) {\n\tconst handleContextMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tonContextMenu({ rowId: item.id, columnId: column.key }, event)\n\t\t},\n\t\t[column.key, item.id, onContextMenu],\n\t)\n\tconst isDateColumn = column.control.type === ControlType.Date\n\tconst isGalleryColumn = isGalleryCollectionItemTableColumn(column)\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\n\tconst className = cx(\n\t\tstyles.bodyCell,\n\t\tisFirstColumn && styles.bodyCellFirstColumn,\n\t\tisDateColumn && styles.bodyCellDate,\n\t\tisGalleryColumn && styles.bodyCellGallery,\n\t\tisLastStickyColumn && styles.bodyCellHideRightDivider,\n\t\tshowRowHighlight && styles.bodyCellRowHighlighted,\n\t\tisSelected && !isCellValueReadOnly && styles.bodyCellSelectedEditable,\n\t\tisSelected && styles.bodyCellSelectedRange,\n\t\tisSelected && showSelectedInnerRightBorder && styles.bodyCellSelectedInnerRightEdge,\n\t\tisSelected && showSelectedInnerBottomBorder && styles.bodyCellSelectedInnerBottomEdge,\n\t\teditingSession !== null && styles.bodyCellEditing,\n\t\tisRowReorderPreviewDraggedRow && styles.bodyCellRowReorderDragged,\n\t)\n\n\tconst cell: CellIdentifier = { rowId: item.id, columnId: column.key }\n\tconst cellKey = getCellKey(cell)\n\n\tconst overlayButton = showCollectionItemOverlayButton ? (\n\t\t<CollectionItemOverlayButton onToggle={() => onToggleCollectionItemOverlay(item.id)} />\n\t) : null\n\n\tconst handleMouseEnter = (event: React.MouseEvent<HTMLDivElement>) => {\n\t\tonExtendDragSelection(cell, event.buttons)\n\t}\n\n\tconst { handleMouseDown, handleClick } = useVirtualCollectionItemTableClickToEditCell({\n\t\tcell,\n\t\tisEditable: !isCellValueReadOnly,\n\t\tisSelectionAnchor,\n\t\tonBeginDragSelection,\n\t\tonStartEditing,\n\t\tshouldStartEditingFromClick: false,\n\t})\n\n\tif (isPopoutColumn(column)) {\n\t\treturn (\n\t\t\t<VirtualCollectionItemTablePopoutBodyCell\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcolumn={column}\n\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\tdataIsViewOnly={dataIsViewOnly}\n\t\t\t\tcellKey={cellKey}\n\t\t\t\tclassName={className}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tisSelectionAnchor={isSelectionAnchor}\n\t\t\t\teditingSession={editingSession}\n\t\t\t\tonBeginDragSelection={onBeginDragSelection}\n\t\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\t\tonStartEditing={onStartEditing}\n\t\t\t\tonEditingValueChange={onEditingValueChange}\n\t\t\t\tonFinishEditing={onFinishEditing}\n\t\t\t\tonCommitEditing={onCommitEditing}\n\t\t\t\toverlayButton={overlayButton}\n\t\t\t\tonContextMenu={handleContextMenu}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (isComboBoxColumn(column)) {\n\t\treturn (\n\t\t\t<VirtualCollectionItemTableComboBoxBodyCell\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcolumn={column}\n\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\tdataIsViewOnly={dataIsViewOnly}\n\t\t\t\tcellKey={cellKey}\n\t\t\t\tclassName={className}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tisSelectionAnchor={isSelectionAnchor}\n\t\t\t\teditingSession={editingSession}\n\t\t\t\tonBeginDragSelection={onBeginDragSelection}\n\t\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\t\tonStartEditing={onStartEditing}\n\t\t\t\tonEditingValueChange={onEditingValueChange}\n\t\t\t\tonFinishEditing={onFinishEditing}\n\t\t\t\tonCommitEditing={onCommitEditing}\n\t\t\t\toverlayButton={overlayButton}\n\t\t\t\tonContextMenu={handleContextMenu}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (isBooleanColumn(column)) {\n\t\treturn (\n\t\t\t<VirtualCollectionItemTableBooleanBodyCell\n\t\t\t\titem={item}\n\t\t\t\tcolumn={column}\n\t\t\t\tdataIsViewOnly={dataIsViewOnly}\n\t\t\t\tcellKey={cellKey}\n\t\t\t\tclassName={className}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\tonBeginDragSelection={onBeginDragSelection}\n\t\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\t\tonCommitBooleanValue={onCommitBooleanValue}\n\t\t\t\toverlayButton={overlayButton}\n\t\t\t\tonContextMenu={handleContextMenu}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconst { content, isInheritedValue, plainTextValue } = getBodyCellContent({\n\t\tcolumn,\n\t\titem,\n\t\tisSelected: isSelected && !isCellValueReadOnly,\n\t})\n\tconst ariaLabel = getAccessibleLabelForCell(column, item, plainTextValue)\n\n\treturn (\n\t\t<VirtualCollectionItemTableBodyCellFrame\n\t\t\tclassName={className}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tisSelected={isSelected}\n\t\t\tcellKey={cellKey}\n\t\t\trowId={item.id}\n\t\t\tcolumnId={column.key}\n\t\t\toverlayButton={overlayButton}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonClick={handleClick}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t>\n\t\t\t{editingSession ? (\n\t\t\t\t<VirtualCollectionItemTableBodyCellEditor\n\t\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\t\titem={item}\n\t\t\t\t\tcell={cell}\n\t\t\t\t\tcolumn={column}\n\t\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\t\teditingSession={editingSession}\n\t\t\t\t\tonChange={onEditingValueChange}\n\t\t\t\t\tonDismiss={onFinishEditing}\n\t\t\t\t\tonCommit={onCommitEditing}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.bodyCellContentPreview,\n\t\t\t\t\t\t(isInheritedValue || isCellValueReadOnly) && styles.readOnlyContent,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{content}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</VirtualCollectionItemTableBodyCellFrame>\n\t)\n})\n\nfunction getBodyCellContent({\n\tcolumn,\n\titem,\n\tisSelected,\n}: {\n\tcolumn: CollectionItemTableColumn\n\titem: CollectionItemNode\n\tisSelected: boolean\n}): {\n\tcontent: React.ReactNode\n\tisInheritedValue: boolean\n\tplainTextValue: string\n} {\n\tconst { isInheritedValue, plainTextValue } = getTextValueInfoForCell(column, item)\n\n\tif (column.control.type === ControlType.Date) {\n\t\treturn {\n\t\t\tcontent: <DateCellValue control={column.control} controlProp={column.getControlProp(item)} />,\n\t\t\tisInheritedValue: false,\n\t\t\tplainTextValue,\n\t\t}\n\t}\n\n\tif (column.control.type === ControlType.File) {\n\t\tconst value = getFileControlPropValue(column.control, column.getControlProp(item))\n\t\treturn {\n\t\t\tcontent: typeof value === \"string\" ? <FileCellValue value={value} isSelected={isSelected} /> : null,\n\t\t\tisInheritedValue: false,\n\t\t\tplainTextValue,\n\t\t}\n\t}\n\n\treturn {\n\t\tcontent: <TextCellValue value={plainTextValue} />,\n\t\tisInheritedValue,\n\t\tplainTextValue,\n\t}\n}\n", "import type React from \"react\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\n\nfunction OverlayButtonIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden=\"true\">\n\t\t\t<path d=\"M9 7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1Z\" fill=\"currentColor\" />\n\t\t\t<path\n\t\t\t\td=\"M2.75 7.25a3.5 3.5 0 0 1 3.5-3.5h7.5a3.5 3.5 0 0 1 3.5 3.5v5.5a3.5 3.5 0 0 1-3.5 3.5h-7.5a3.5 3.5 0 0 1-3.5-3.5Z\"\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\nexport function CollectionItemOverlayButton({ onToggle }: { onToggle: () => void }) {\n\tconst buttonLabel = \"Toggle Overlay\"\n\n\tconst handleMouseDown = (event: React.MouseEvent<HTMLButtonElement>) => {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\tconst handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tonToggle()\n\t}\n\n\tconst handleDoubleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\ttabIndex={-1}\n\t\t\taria-label={buttonLabel}\n\t\t\ttitle={buttonLabel}\n\t\t\tclassName={styles.bodyCellOverlayButton}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonClick={handleClick}\n\t\t\tonDoubleClick={handleDoubleClick}\n\t\t>\n\t\t\t<OverlayButtonIcon />\n\t\t</button>\n\t)\n}\n", "import { Popover, PopoverComboBox, PopoverMultiComboBox, useMergeRefs } from \"@framerjs/fresco\"\nimport type { AttachmentEdgePreferences } from \"@framerjs/fresco/src/components/Popover\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport {\n\tassert,\n\tisCommandKeyPressed,\n\tisModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n} from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport {\n\ttype CollectionArrayControlProp,\n\tisCollectionArrayControlPropValue,\n} from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport {\n\tgetCollectionReferenceControlPropValue,\n\tgetColorControlPropValue,\n\tgetImageControlProp,\n\tgetLinkControlPropValue,\n\tgetMultiCollectionReferenceControlPropValue,\n\tgetVectorSetItemControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport {\n\tgetReducedResponsiveImageControlProp,\n\treduceControlProp,\n\ttype ReducedImageControlProp,\n\ttype ReducedResponsiveImageControlProp,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { getReducedStaticArrayControlValue } from \"document/models/controlProps/getReducedStaticArrayControlValue.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { useTitleForLink } from \"document/utils/useTitleForLink.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { isNumber, isReadonlyArray, isString } from \"utils/typeChecks.ts\"\nimport { vectorSetInfoForPopout } from \"utils/vectorSets.ts\"\nimport { LinkPopout } from \"../properties/codeComponentRows/LinkPopout.tsx\"\nimport {\n\tuseDefaultVectorSetIdentifier,\n\tVectorSetItemPopout,\n} from \"../properties/codeComponentRows/VectorSetItemControlPropRow.tsx\"\nimport { useSubscribeToColorStyles } from \"../properties/utils/useSubscribeToFillValue.ts\"\nimport { ColorPickerPopout } from \"../shared/ColorPicker/ColorPickerPopout.tsx\"\nimport { GalleryPopoutContent } from \"../shared/GalleryPopoutContent.tsx\"\nimport { popoutButtonDataAttribute, usePopoutContent } from \"../shared/PopoutButton.tsx\"\nimport type { PopoutNavigation } from \"../shared/PopoutNavigation.tsx\"\nimport { PopoutPopover } from \"../shared/PopoutPopover.tsx\"\nimport { CollectionImagePopout } from \"./CollectionImagePopout.tsx\"\nimport { ComboBoxCellPills } from \"./ComboBoxCellPills.tsx\"\nimport { ReferenceCellPills } from \"./ReferenceCellPills.tsx\"\nimport { RevampedCmsPopoutThemeOverride } from \"./RevampedCmsPopoutThemeOverride.tsx\"\nimport {\n\tColorCellValue,\n\tGalleryArrayCellValue,\n\tImageCellValue,\n\tTextCellValue,\n\tVectorSetItemCellValue,\n} from \"./TableCellPreviews.tsx\"\nimport {\n\tclearVirtualCollectionItemTableImageCell,\n\tresolveNumberDisplayValue,\n\tupdateVirtualCollectionItemTableCollectionReferenceCell,\n\tupdateVirtualCollectionItemTableColorCell,\n\tupdateVirtualCollectionItemTableEnumCell,\n\tupdateVirtualCollectionItemTableGalleryCell,\n\tupdateVirtualCollectionItemTableImageCell,\n\tupdateVirtualCollectionItemTableLinkCell,\n\tupdateVirtualCollectionItemTableMultiCollectionReferenceCell,\n\tupdateVirtualCollectionItemTableVectorSetItemCell,\n} from \"./VirtualCollectionItemTable.editingAdapters.ts\"\nimport type {\n\tEditingCommitAction,\n\tVirtualCollectionItemTableEditingSession,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport {\n\tgetEnumComboBoxItems,\n\tgetEnumPillItems,\n\tgetEnumSelectedValue,\n} from \"./VirtualCollectionItemTable.enumOptions.ts\"\nimport {\n\tgetVirtualCollectionItemTableEditorKeyboardAction,\n\ttype VirtualCollectionItemTableEditorKeyboardAction,\n} from \"./VirtualCollectionItemTable.keyboardNavigation.ts\"\nimport type { CellIdentifier, TabOrderDirection } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { useCollectionReferenceInputOptions } from \"./useCollectionReferenceInputOptions.tsx\"\nimport {\n\ttype CollectionItemTableColumn,\n\tisGalleryCollectionItemTableColumn,\n} from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionItemTableStatusPillItems,\n\tgetCollectionItemTableStatusPillTone,\n\tgetCollectionItemTableStatusValue,\n\tisCollectionItemTableStatusColumn,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\nimport {\n\tgetDateControlValueForInputValue,\n\tgetDateInputDisplayValue,\n\tgetDateTimeInputDisplayValue,\n} from \"./utils/dateInputValue.ts\"\n\ninterface VirtualCollectionItemTableBodyCellEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tcolumnWidth: number\n\teditingSession: VirtualCollectionItemTableEditingSession\n\tonChange: (cell: CellIdentifier, value: string) => void\n\tonDismiss: () => void\n\tonCommit: (command: EditingCommitAction) => void\n}\n\nexport function VirtualCollectionItemTableBodyCellEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tcolumnWidth,\n\teditingSession,\n\tonChange,\n\tonDismiss,\n\tonCommit,\n}: VirtualCollectionItemTableBodyCellEditorProps) {\n\tif (editingSession.adapterKind === \"number\") {\n\t\treturn (\n\t\t\t<BodyCellNumberEditor\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tsession={editingSession}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonCommit={onCommit}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"color\") {\n\t\treturn (\n\t\t\t<BodyCellColorEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"date\") {\n\t\treturn (\n\t\t\t<BodyCellDateEditor\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tsession={editingSession}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t\tonCommit={onCommit}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"image\") {\n\t\treturn (\n\t\t\t<BodyCellImageEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"gallery\") {\n\t\treturn (\n\t\t\t<BodyCellGalleryEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"vectorSetItem\") {\n\t\treturn (\n\t\t\t<BodyCellVectorSetItemEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"link\") {\n\t\treturn (\n\t\t\t<BodyCellLinkEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"collectionReference\") {\n\t\treturn (\n\t\t\t<BodyCellCollectionReferenceEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tinitialSearchValue={editingSession.initialSearchValue}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"enum\") {\n\t\treturn (\n\t\t\t<BodyCellEnumEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tinitialSearchValue={editingSession.initialSearchValue}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"multiCollectionReference\") {\n\t\treturn (\n\t\t\t<BodyCellMultiCollectionReferenceEditor\n\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\titem={item}\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tinitialSearchValue={editingSession.initialSearchValue}\n\t\t\t\tonDismiss={onDismiss}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (editingSession.adapterKind === \"multilineString\") {\n\t\treturn (\n\t\t\t<BodyCellMultilineTextEditor\n\t\t\t\tcell={cell}\n\t\t\t\tcolumn={column}\n\t\t\t\tvalue={editingSession.draftValue}\n\t\t\t\tplaceholder={editingSession.placeholder}\n\t\t\t\tpendingInsertedText={editingSession.pendingInsertedText}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonCommit={onCommit}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<BodyCellTextEditor\n\t\t\tcell={cell}\n\t\t\tcolumn={column}\n\t\t\tvalue={editingSession.draftValue}\n\t\t\tplaceholder={editingSession.placeholder}\n\t\t\tpendingInsertedText={editingSession.pendingInsertedText}\n\t\t\tonChange={onChange}\n\t\t\tonCommit={onCommit}\n\t\t/>\n\t)\n}\n\ninterface BodyCellTextEditorProps {\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tvalue: string\n\tplaceholder: string | undefined\n\tpendingInsertedText: string | null\n\tonChange: (cell: CellIdentifier, value: string) => void\n\tonCommit: (command: EditingCommitAction) => void\n}\n\ntype EditableTextElement = HTMLInputElement | HTMLTextAreaElement\n\nfunction useCellEditorInitialCaret({\n\tinputRef,\n\tinsertedInitialTextRef,\n\tpendingInsertedText,\n\tenabled = true,\n}: {\n\tinputRef: React.RefObject<EditableTextElement | null>\n\tinsertedInitialTextRef: React.MutableRefObject<boolean>\n\tpendingInsertedText: string | null\n\tenabled?: boolean\n}) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: this mutable ref coordinates layout effects without driving renders.\n\tReact.useLayoutEffect(() => {\n\t\tif (!enabled || pendingInsertedText !== null || insertedInitialTextRef.current) return\n\n\t\tconst input = inputRef.current\n\t\tif (!input) return\n\n\t\tinput.focus()\n\n\t\tconst caretPosition = input.value.length\n\t\tinput.setSelectionRange(caretPosition, caretPosition)\n\t}, [enabled, inputRef, pendingInsertedText])\n}\n\nfunction useCellEditorPendingTextInsertion({\n\tcell,\n\tinputRef,\n\tinsertedInitialTextRef,\n\tpendingInsertedText,\n\tonChange,\n\tenabled = true,\n}: {\n\tcell: CellIdentifier\n\tinputRef: React.RefObject<EditableTextElement | null>\n\tinsertedInitialTextRef: React.MutableRefObject<boolean>\n\tpendingInsertedText: string | null\n\tonChange: (cell: CellIdentifier, value: string) => void\n\tenabled?: boolean\n}) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: this mutable ref coordinates layout effects without driving renders.\n\tReact.useLayoutEffect(() => {\n\t\tif (!enabled || pendingInsertedText === null || insertedInitialTextRef.current) return\n\n\t\tconst input = inputRef.current\n\t\tif (!input) return\n\n\t\tinsertedInitialTextRef.current = true\n\t\tinput.focus()\n\t\tinput.select()\n\n\t\tconst inserted = document.execCommand(\"insertText\", false, pendingInsertedText)\n\t\tif (!inserted) {\n\t\t\tinput.value = pendingInsertedText\n\t\t}\n\n\t\tonChange(cell, input.value)\n\t\trequestAnimationFrame(() => {\n\t\t\tconst caretPosition = input.value.length\n\t\t\tinput.setSelectionRange(caretPosition, caretPosition)\n\t\t})\n\t}, [cell, enabled, inputRef, onChange, pendingInsertedText])\n}\n\nfunction useCellEditorKeyboardCommit({\n\tonCommit,\n\tgetKeyboardAction = getVirtualCollectionItemTableEditorKeyboardAction,\n\tonAction,\n}: {\n\tonCommit: (command: EditingCommitAction) => void\n\tgetKeyboardAction?: (options: {\n\t\tkey: string\n\t\tshiftKey: boolean\n\t}) => VirtualCollectionItemTableEditorKeyboardAction | null\n\tonAction?: (action: VirtualCollectionItemTableEditorKeyboardAction) => boolean\n}) {\n\tconst ignoreNextBlurRef = React.useRef(false)\n\tconst pendingTabNavigationRef = React.useRef<TabOrderDirection | null>(null)\n\tconst clearPendingTabNavigationFrameRef = React.useRef<number | null>(null)\n\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tif (clearPendingTabNavigationFrameRef.current === null) return\n\t\t\tcancelAnimationFrame(clearPendingTabNavigationFrameRef.current)\n\t\t}\n\t}, [])\n\n\tconst schedulePendingTabNavigationClear = React.useCallback((element: EditableTextElement) => {\n\t\tif (clearPendingTabNavigationFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(clearPendingTabNavigationFrameRef.current)\n\t\t}\n\n\t\tclearPendingTabNavigationFrameRef.current = requestAnimationFrame(() => {\n\t\t\tclearPendingTabNavigationFrameRef.current = null\n\t\t\tif (document.activeElement === element) {\n\t\t\t\tpendingTabNavigationRef.current = null\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst handleBlur = React.useCallback(() => {\n\t\tif (ignoreNextBlurRef.current) {\n\t\t\tignoreNextBlurRef.current = false\n\t\t\treturn\n\t\t}\n\n\t\tif (clearPendingTabNavigationFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(clearPendingTabNavigationFrameRef.current)\n\t\t\tclearPendingTabNavigationFrameRef.current = null\n\t\t}\n\n\t\tconst pendingTabNavigation = pendingTabNavigationRef.current\n\t\tpendingTabNavigationRef.current = null\n\t\tonCommit(pendingTabNavigation ? { type: \"tabNavigate\", direction: pendingTabNavigation } : { type: \"close\" })\n\t}, [onCommit])\n\n\tconst handleEditorAction = React.useCallback(\n\t\t(event: React.KeyboardEvent<EditableTextElement>) => {\n\t\t\tconst isComposing = event.nativeEvent.isComposing || event.keyCode === 229\n\t\t\tif (isComposing) return false\n\n\t\t\tconst action = getKeyboardAction({\n\t\t\t\tkey: event.key,\n\t\t\t\tshiftKey: event.shiftKey,\n\t\t\t})\n\t\t\tif (!action) return false\n\n\t\t\tevent.stopPropagation()\n\n\t\t\tif (action.type === \"commitEditingInTabOrder\") {\n\t\t\t\tpendingTabNavigationRef.current = action.direction\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tevent.preventDefault()\n\t\t\tignoreNextBlurRef.current = true\n\t\t\tpendingTabNavigationRef.current = null\n\t\t\tif (clearPendingTabNavigationFrameRef.current !== null) {\n\t\t\t\tcancelAnimationFrame(clearPendingTabNavigationFrameRef.current)\n\t\t\t\tclearPendingTabNavigationFrameRef.current = null\n\t\t\t}\n\n\t\t\tif (onAction?.(action)) {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif (action.type === \"finishEditing\") {\n\t\t\t\tonCommit({ type: \"focusCurrentCell\" })\n\t\t\t} else {\n\t\t\t\tonCommit({\n\t\t\t\t\ttype: \"navigate\",\n\t\t\t\t\trowDelta: action.rowDelta,\n\t\t\t\t\tcolumnDelta: action.columnDelta,\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\t[getKeyboardAction, onAction, onCommit],\n\t)\n\n\tconst handleKeyUp = React.useCallback(\n\t\t(event: React.KeyboardEvent<EditableTextElement>) => {\n\t\t\tif (event.key !== \"Tab\") return\n\t\t\tschedulePendingTabNavigationClear(event.currentTarget)\n\t\t\tevent.stopPropagation()\n\t\t},\n\t\t[schedulePendingTabNavigationClear],\n\t)\n\n\treturn { handleBlur, handleEditorAction, handleKeyUp }\n}\n\nfunction getBodyCellMultilineTextEditorKeyboardAction({ key, shiftKey }: { key: string; shiftKey: boolean }) {\n\tif (key === \"Enter\" && shiftKey) {\n\t\treturn null\n\t}\n\n\treturn getVirtualCollectionItemTableEditorKeyboardAction({ key, shiftKey })\n}\n\nconst stopPropagation = (event: React.SyntheticEvent<EditableTextElement>) => {\n\tevent.stopPropagation()\n}\n\nconst stopButtonMousePropagation = (event: React.SyntheticEvent<HTMLButtonElement>) => {\n\tevent.stopPropagation()\n}\n\nconst bodyCellPopoverAttachmentEdge: AttachmentEdgePreferences = [\"right\", \"left\", \"auto-vertical\"]\n\ninterface BodyCellAutoOpenPopoutButtonProps {\n\tariaLabel: string\n\tnavigationTitle: string\n\tchildren: React.ReactNode\n\tpopout: React.ReactNode\n\tonDismiss: () => void\n\tbuttonClassName?: string\n\tdisplayDivider?: boolean\n}\n\nfunction BodyCellAutoOpenPopoutButton({\n\tariaLabel,\n\tnavigationTitle,\n\tchildren,\n\tpopout,\n\tonDismiss,\n\tbuttonClassName,\n\tdisplayDivider,\n}: BodyCellAutoOpenPopoutButtonProps) {\n\tconst buttonRef = React.useRef<HTMLButtonElement | null>(null)\n\tconst navigationRef = React.useRef<PopoutNavigation | null>(null)\n\n\tconst handlePopoverKeyDown = React.useCallback((event: React.KeyboardEvent) => {\n\t\tif (event.key !== \"Escape\") return\n\t\tif (!navigationRef.current?.isClosed()) return\n\n\t\tconst gridElement = buttonRef.current?.closest('[role=\"grid\"]')\n\t\trequestAnimationFrame(() => {\n\t\t\tif (gridElement instanceof HTMLElement) {\n\t\t\t\tgridElement.focus()\n\t\t\t}\n\t\t})\n\t}, [])\n\n\treturn (\n\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t<PopoutPopover\n\t\t\t\tnavigationRef={navigationRef}\n\t\t\t\tanchorRef={buttonRef}\n\t\t\t\tattachTo={bodyCellPopoverAttachmentEdge}\n\t\t\t\tfallbackToModalAppearance\n\t\t\t\tshowArrow={false}\n\t\t\t\tonKeydown={handlePopoverKeyDown}\n\t\t\t>\n\t\t\t\t<BodyCellAutoOpenPopoutButtonInner\n\t\t\t\t\tbuttonRef={buttonRef}\n\t\t\t\t\tariaLabel={ariaLabel}\n\t\t\t\t\tnavigationTitle={navigationTitle}\n\t\t\t\t\tpopout={popout}\n\t\t\t\t\tonDismiss={onDismiss}\n\t\t\t\t\tbuttonClassName={buttonClassName}\n\t\t\t\t\tdisplayDivider={displayDivider}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</BodyCellAutoOpenPopoutButtonInner>\n\t\t\t</PopoutPopover>\n\t\t</RevampedCmsPopoutThemeOverride>\n\t)\n}\n\ninterface BodyCellAutoOpenPopoutButtonInnerProps extends BodyCellAutoOpenPopoutButtonProps {\n\tbuttonRef: React.MutableRefObject<HTMLButtonElement | null>\n}\n\nfunction BodyCellAutoOpenPopoutButtonInner({\n\tbuttonRef,\n\tariaLabel,\n\tnavigationTitle,\n\tchildren,\n\tpopout,\n\tonDismiss,\n\tbuttonClassName,\n\tdisplayDivider,\n}: BodyCellAutoOpenPopoutButtonInnerProps) {\n\tconst ref = React.useRef<HTMLButtonElement | null>(null)\n\tconst mergedRefs = useMergeRefs(ref, buttonRef)\n\n\tconst { dismiss, isPresenting, present } = usePopoutContent({\n\t\tpopout,\n\t\tnavigationTitle,\n\t\tref,\n\t\tdisplayDivider,\n\t\tdisplayInPopover: true,\n\t\tautoFocusInside: true,\n\t\tonDismiss,\n\t})\n\tconst hasAutoPresentedRef = React.useRef(false)\n\n\tReact.useLayoutEffect(() => {\n\t\tif (hasAutoPresentedRef.current) return\n\t\thasAutoPresentedRef.current = true\n\t\tpresent()\n\t}, [present])\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n\t\tevent.stopPropagation()\n\n\t\tswitch (event.key) {\n\t\t\tcase \"Enter\":\n\t\t\tcase \" \":\n\t\t\t\tpresent()\n\t\t\t\tevent.preventDefault()\n\t\t\t\tbreak\n\t\t\tcase \"Escape\":\n\t\t\t\tdismiss()\n\t\t\t\tevent.preventDefault()\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tref={mergedRefs}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-expanded={isPresenting ? \"true\" : \"false\"}\n\t\t\tclassName={cx(styles.bodyCellPopoutButton, buttonClassName)}\n\t\t\tonClick={present}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonMouseDown={stopButtonMousePropagation}\n\t\t\tonDoubleClick={stopButtonMousePropagation}\n\t\t\t{...{ [popoutButtonDataAttribute]: true }}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t)\n}\n\ninterface BodyCellColorEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tonDismiss: () => void\n}\n\nfunction BodyCellColorEditor({ collectionNodeId, item, cell, column, onDismiss }: BodyCellColorEditorProps) {\n\tassert(column.control.type === ControlType.Color, \"Expected a color column for the color popout editor.\")\n\n\tconst controlProp = column.getControlProp(item)\n\tconst value = getColorControlPropValue(column.control, controlProp)\n\tif (isDynamicValue(value)) return null\n\n\tconst resolvedValue = value ?? \"\"\n\n\treturn (\n\t\t<BodyCellAutoOpenPopoutButton\n\t\t\tariaLabel={column.control.title ?? \"Edit color\"}\n\t\t\tnavigationTitle={column.control.title ?? Dictionary.Color}\n\t\t\tbuttonClassName={styles.bodyCellTextPopoutButton}\n\t\t\tpopout={\n\t\t\t\t<ColorPickerPopout\n\t\t\t\t\tvalue={resolvedValue}\n\t\t\t\t\tonChange={nextValue => {\n\t\t\t\t\t\tupdateVirtualCollectionItemTableColorCell(collectionNodeId, cell.rowId, cell.columnId, nextValue)\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonDismiss={onDismiss}\n\t\t>\n\t\t\t<ColorCellValue value={resolvedValue || \"transparent\"} size=\"default\" />\n\t\t</BodyCellAutoOpenPopoutButton>\n\t)\n}\n\ninterface BodyCellImageEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tonDismiss: () => void\n}\n\nfunction BodyCellImageEditor({ collectionNodeId, item, cell, column, onDismiss }: BodyCellImageEditorProps) {\n\tassert(\n\t\tcolumn.control.type === ControlType.Image || column.control.type === ControlType.ResponsiveImage,\n\t\t\"Expected an image column for the image popout editor.\",\n\t)\n\n\tconst controlProp = getImageControlProp(column.control, column.getControlProp(item))\n\tconst reducedControlProp = React.useMemo<ReducedImageControlProp | ReducedResponsiveImageControlProp>(() => {\n\t\tif (column.control.type === ControlType.ResponsiveImage) {\n\t\t\treturn getReducedResponsiveImageControlProp(controlProp, column.control)\n\t\t}\n\n\t\tconst reducedImageControlProp: ReducedImageControlProp = {\n\t\t\ttype: ControlType.Image,\n\t\t\tvalue: NotFound,\n\t\t}\n\t\treduceControlProp(reducedImageControlProp, controlProp, column.control)\n\t\treturn reducedImageControlProp\n\t}, [column.control, controlProp])\n\n\treturn (\n\t\t<BodyCellAutoOpenPopoutButton\n\t\t\tariaLabel={column.control.title ?? \"Edit image\"}\n\t\t\tnavigationTitle={column.control.title ?? Dictionary.Image}\n\t\t\tpopout={\n\t\t\t\t<CollectionImagePopout\n\t\t\t\t\tmaxExtraImages={0}\n\t\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\t\tonChange={(getUpdate: (currentControlProp: ImageControlProp | undefined) => ImageControlProp) => {\n\t\t\t\t\t\tupdateVirtualCollectionItemTableImageCell(collectionNodeId, cell.rowId, cell.columnId, getUpdate)\n\t\t\t\t\t}}\n\t\t\t\t\tonRemove={() => {\n\t\t\t\t\t\tclearVirtualCollectionItemTableImageCell(collectionNodeId, cell.rowId, cell.columnId)\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonDismiss={onDismiss}\n\t\t>\n\t\t\t<ImageCellValue control={column.control} rawControlProp={controlProp} size=\"default\" />\n\t\t</BodyCellAutoOpenPopoutButton>\n\t)\n}\n\ninterface BodyCellGalleryEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tcolumnWidth: number\n\tonDismiss: () => void\n}\n\nfunction BodyCellGalleryEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tcolumnWidth,\n\tonDismiss,\n}: BodyCellGalleryEditorProps) {\n\tassert(isGalleryCollectionItemTableColumn(column), \"Expected a gallery column.\")\n\n\tconst controlProp = column.getControlProp(item)\n\tconst reducedValue = React.useMemo(() => {\n\t\tconst value = controlProp?.type === ControlType.Array && isReadonlyArray(controlProp.value) ? controlProp.value : []\n\t\treturn getReducedStaticArrayControlValue(column.control, value, true)\n\t}, [column.control, controlProp])\n\tconst maxCount = isNumber(column.control.maxCount) ? column.control.maxCount : Infinity\n\tconst canAddImages = reducedValue.length < maxCount\n\n\treturn (\n\t\t<BodyCellAutoOpenPopoutButton\n\t\t\tdisplayDivider\n\t\t\tonDismiss={onDismiss}\n\t\t\tariaLabel={column.control.title ?? \"Edit gallery\"}\n\t\t\tnavigationTitle={column.control.title ?? Dictionary.Gallery}\n\t\t\tbuttonClassName={styles.bodyCellGalleryPopoutButton}\n\t\t\tpopout={\n\t\t\t\t<GalleryPopoutContent\n\t\t\t\t\tcontrol={column.control}\n\t\t\t\t\tvalue={reducedValue}\n\t\t\t\t\taddButtonEnabled={canAddImages}\n\t\t\t\t\tonChange={getUpdate => {\n\t\t\t\t\t\tupdateVirtualCollectionItemTableGalleryCell(\n\t\t\t\t\t\t\tcollectionNodeId,\n\t\t\t\t\t\t\tcell.rowId,\n\t\t\t\t\t\t\tcell.columnId,\n\t\t\t\t\t\t\t(current): CollectionArrayControlProp => {\n\t\t\t\t\t\t\t\tconst next = getUpdate(current)\n\t\t\t\t\t\t\t\tif (!isCollectionArrayControlPropValue(next.value)) return current\n\t\t\t\t\t\t\t\treturn { type: ControlType.Array, value: next.value }\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\t\t<GalleryArrayCellValue control={column.control} controlProp={controlProp} columnWidth={columnWidth} />\n\t\t</BodyCellAutoOpenPopoutButton>\n\t)\n}\n\ninterface BodyCellVectorSetItemEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tonDismiss: () => void\n}\n\nfunction getBodyCellVectorSetPopoutInfo({\n\tactiveIdentifier,\n\tdefaultIdentifier,\n\tengine,\n}: {\n\tactiveIdentifier: ModuleExportIdentifierString | undefined\n\tdefaultIdentifier: ModuleExportIdentifierString | undefined\n\tengine: ReturnType<typeof useBaseEngine>\n}) {\n\tif (!activeIdentifier || !defaultIdentifier) return undefined\n\treturn vectorSetInfoForPopout(\n\t\tactiveIdentifier,\n\t\tdefaultIdentifier,\n\t\tengine.tree,\n\t\tengine.stores.modulesStore,\n\t\tengine.stores.vectorsStore,\n\t)\n}\n\nfunction BodyCellVectorSetItemEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tonDismiss,\n}: BodyCellVectorSetItemEditorProps) {\n\tassert(\n\t\tcolumn.control.type === ControlType.VectorSetItem,\n\t\t\"Expected a vector set item column for the vector set popout editor.\",\n\t)\n\n\tconst engine = useBaseEngine()\n\tconst { modulesStore, vectorsStore } = engine.stores\n\tconst currentIdentifier = getVectorSetItemControlPropValue(column.control, column.getControlProp(item))\n\tconst resolvedCurrentIdentifier =\n\t\tisString(currentIdentifier) && isModuleExportIdentifier(currentIdentifier) ? currentIdentifier : undefined\n\tconst defaultIdentifier = useDefaultVectorSetIdentifier(column.control)\n\tconst activeIdentifier = resolvedCurrentIdentifier ?? defaultIdentifier\n\tconst activeIdentifiers = useMemo(\n\t\t() => (resolvedCurrentIdentifier ? new Set([resolvedCurrentIdentifier]) : undefined),\n\t\t[resolvedCurrentIdentifier],\n\t)\n\tconst svgThumbnailStyle = useSubscribeToColorStyles()\n\tconst info = useEngineState(\n\t\t() => getBodyCellVectorSetPopoutInfo({ activeIdentifier, defaultIdentifier, engine }),\n\t\t[activeIdentifier, defaultIdentifier],\n\t\t[EngineChange.Tree, modulesStore, vectorsStore],\n\t\t{ deepEqual: true },\n\t)\n\n\tconst handleChange = useCallback(\n\t\t(identifier: ModuleExportIdentifierString) => {\n\t\t\tupdateVirtualCollectionItemTableVectorSetItemCell(collectionNodeId, cell.rowId, cell.columnId, identifier)\n\t\t},\n\t\t[collectionNodeId, cell.rowId, cell.columnId],\n\t)\n\n\tif (!activeIdentifier || !defaultIdentifier || !info) return null\n\n\treturn (\n\t\t<BodyCellAutoOpenPopoutButton\n\t\t\tdisplayDivider\n\t\t\tariaLabel={column.control.title ?? \"Edit icon\"}\n\t\t\tnavigationTitle={info.vectorSet.setTitle}\n\t\t\tbuttonClassName={styles.bodyCellTextPopoutButton}\n\t\t\tonDismiss={onDismiss}\n\t\t\tpopout={\n\t\t\t\t<VectorSetItemPopout\n\t\t\t\t\tactiveIdentifiers={activeIdentifiers}\n\t\t\t\t\titemDictionary={info.vectorSet.items}\n\t\t\t\t\tsvgThumbnailStyle={svgThumbnailStyle}\n\t\t\t\t\tonChange={handleChange}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<VectorSetItemCellValue\n\t\t\t\tcontrol={column.control}\n\t\t\t\tcontrolProp={column.getControlProp(item)}\n\t\t\t\tfallbackTitle={info.vectorSet.title}\n\t\t\t\tisSelected\n\t\t\t/>\n\t\t</BodyCellAutoOpenPopoutButton>\n\t)\n}\n\ninterface BodyCellLinkEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tonDismiss: () => void\n}\n\nfunction BodyCellLinkEditor({ collectionNodeId, item, cell, column, onDismiss }: BodyCellLinkEditorProps) {\n\tassert(column.control.type === ControlType.Link, \"Expected a link column for the link popout editor.\")\n\n\tconst value = getLinkControlPropValue(column.control, column.getControlProp(item))\n\tassert(!isDynamicValue(value), \"Dynamic values are not supported within the CMS.\")\n\n\treturn (\n\t\t<BodyCellAutoOpenPopoutButton\n\t\t\tariaLabel={column.control.title ?? \"Edit link\"}\n\t\t\tnavigationTitle={column.control.title ?? Dictionary.Link}\n\t\t\tbuttonClassName={styles.bodyCellTextPopoutButton}\n\t\t\tpopout={\n\t\t\t\t<LinkPopout\n\t\t\t\t\tsupportsPageLinks\n\t\t\t\t\topenLinkCompletionsOnFocus={false}\n\t\t\t\t\tlink={value}\n\t\t\t\t\tonChange={nextValue => {\n\t\t\t\t\t\tif (isDynamicValue(nextValue)) return\n\t\t\t\t\t\tupdateVirtualCollectionItemTableLinkCell(collectionNodeId, cell.rowId, cell.columnId, nextValue)\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonDismiss={onDismiss}\n\t\t>\n\t\t\t<BodyCellLinkValue link={value} />\n\t\t</BodyCellAutoOpenPopoutButton>\n\t)\n}\n\nfunction BodyCellLinkValue({ link }: { link: Link | undefined }) {\n\tconst engine = useBaseEngine()\n\tconst value = useTitleForLink(engine, link, \"\")\n\n\treturn <TextCellValue value={value} />\n}\n\nconst bodyCellTextAreaPopoverAttachmentEdge: AttachmentEdgePreferences = [\"bottom\", \"top\"]\nconst bodyCellTextAreaMinRows = 1\nconst bodyCellTextAreaPopoverInset = dimensions.values.popoverAnchorInset\nconst zeroSize = Object.freeze<Size>({ height: 0, width: 0 })\n\nfunction useBodyCellTextAreaPopoverAnchor(): {\n\tsetAnchorElement: React.Dispatch<React.SetStateAction<HTMLDivElement | null>>\n\tanchorElement: HTMLElement | null\n\tanchorHeight: number\n\tanchorWidth: number\n} {\n\tconst [anchorElement, setAnchorElement] = React.useState<HTMLDivElement | null>(null)\n\tconst [anchorSize, setAnchorSize] = React.useState(zeroSize)\n\n\tReact.useLayoutEffect(() => {\n\t\tif (!anchorElement) {\n\t\t\tsetAnchorSize(currentSize => {\n\t\t\t\tif (currentSize.height === 0 && currentSize.width === 0) return currentSize\n\t\t\t\treturn zeroSize\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tconst measureAnchor = () => {\n\t\t\tconst rect = anchorElement.getBoundingClientRect()\n\t\t\tsetAnchorSize(currentSize => {\n\t\t\t\tif (currentSize.height === rect.height && currentSize.width === rect.width) return currentSize\n\t\t\t\treturn { height: rect.height, width: rect.width }\n\t\t\t})\n\t\t}\n\n\t\tmeasureAnchor()\n\n\t\tconst resizeObserver = new ResizeObserver(measureAnchor)\n\t\tresizeObserver.observe(anchorElement)\n\t\treturn () => resizeObserver.disconnect()\n\t}, [anchorElement])\n\n\treturn {\n\t\tsetAnchorElement,\n\t\tanchorElement,\n\t\tanchorHeight: anchorSize.height,\n\t\tanchorWidth: anchorSize.width,\n\t}\n}\n\nfunction getBodyCellTextAreaMirrorValue(value: string) {\n\treturn value.length > 0 ? `${value}\\u200b` : \" \"\n}\n\nfunction BodyCellMultilineTextEditor({\n\tcell,\n\tcolumn,\n\tvalue,\n\tplaceholder,\n\tpendingInsertedText,\n\tonChange,\n\tonCommit,\n}: BodyCellTextEditorProps) {\n\tconst inputRef = React.useRef<HTMLTextAreaElement>(null)\n\tconst insertedInitialTextRef = React.useRef(false)\n\tconst hasCommittedCloseRef = React.useRef(false)\n\tconst handleCommit = React.useCallback(\n\t\t(command: EditingCommitAction) => {\n\t\t\tif (command.type !== \"close\") {\n\t\t\t\tonCommit(command)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (hasCommittedCloseRef.current) return\n\t\t\thasCommittedCloseRef.current = true\n\t\t\tonCommit(command)\n\t\t},\n\t\t[onCommit],\n\t)\n\tconst { handleBlur, handleEditorAction, handleKeyUp } = useCellEditorKeyboardCommit({\n\t\tonCommit: handleCommit,\n\t\tgetKeyboardAction: getBodyCellMultilineTextEditorKeyboardAction,\n\t})\n\tconst { setAnchorElement, anchorElement, anchorHeight, anchorWidth } = useBodyCellTextAreaPopoverAnchor()\n\tconst popoverWidth = Math.max(anchorWidth - bodyCellTextAreaPopoverInset * 2, dimensions.values.panelMinWidth)\n\tconst mirrorValue = React.useMemo(() => getBodyCellTextAreaMirrorValue(value), [value])\n\n\tuseCellEditorInitialCaret({\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText,\n\t\tenabled: anchorElement !== null,\n\t})\n\tuseCellEditorPendingTextInsertion({\n\t\tcell,\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText,\n\t\tonChange,\n\t\tenabled: anchorElement !== null,\n\t})\n\n\tReact.useLayoutEffect(() => {\n\t\tconst input = inputRef.current\n\t\tif (!input || pendingInsertedText !== null || input.value === value) return\n\n\t\tinput.value = value\n\n\t\tif (document.activeElement === input) {\n\t\t\tconst caretPosition = input.value.length\n\t\t\tinput.setSelectionRange(caretPosition, caretPosition)\n\t\t}\n\t}, [pendingInsertedText, value])\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n\t\tif (isCommandKeyPressed(event)) {\n\t\t\tevent.stopPropagation()\n\t\t\treturn\n\t\t}\n\n\t\tif (!handleEditorAction(event)) {\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\tconst popoverOffset = React.useMemo(\n\t\t() => ({\n\t\t\tx: bodyCellTextAreaPopoverInset,\n\t\t\ty: -(anchorHeight - bodyCellTextAreaPopoverInset),\n\t\t}),\n\t\t[anchorHeight],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<div ref={setAnchorElement} className={cx(styles.bodyCellPopoverTrigger, styles.bodyCellTextAreaPreview)}>\n\t\t\t\t<TextCellValue value={value} />\n\t\t\t</div>\n\t\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={anchorElement}\n\t\t\t\t\talignSelf=\"start\"\n\t\t\t\t\tattachTo={bodyCellTextAreaPopoverAttachmentEdge}\n\t\t\t\t\toffset={popoverOffset}\n\t\t\t\t\tshowArrow={false}\n\t\t\t\t\tfocusTrapEnabled={false}\n\t\t\t\t\tanimateAppear={false}\n\t\t\t\t\tbackdropEnabled\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\thandleCommit({ type: \"close\" })\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={styles.bodyCellTextAreaPopover}\n\t\t\t\t\tstyle={{ width: popoverWidth }}\n\t\t\t\t>\n\t\t\t\t\t<div className={styles.bodyCellTextAreaEditor}>\n\t\t\t\t\t\t<div aria-hidden className={cx(styles.bodyCellTextAreaEditorLayer, styles.bodyCellTextAreaMirror)}>\n\t\t\t\t\t\t\t{mirrorValue}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\t\trows={bodyCellTextAreaMinRows}\n\t\t\t\t\t\t\tspellCheck={false}\n\t\t\t\t\t\t\tdefaultValue={value}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\taria-label={column.control.title ?? \"Edit cell\"}\n\t\t\t\t\t\t\tclassName={cx(styles.bodyCellTextAreaEditorLayer, styles.bodyCellTextAreaInput)}\n\t\t\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\t\t\tonChange={event => {\n\t\t\t\t\t\t\t\tonChange(cell, event.currentTarget.value)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\tonKeyUp={handleKeyUp}\n\t\t\t\t\t\t\tonClick={stopPropagation}\n\t\t\t\t\t\t\tonMouseDown={stopPropagation}\n\t\t\t\t\t\t\tonDoubleClick={stopPropagation}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t</RevampedCmsPopoutThemeOverride>\n\t\t</>\n\t)\n}\n\nfunction BodyCellTextEditor({\n\tcell,\n\tcolumn,\n\tvalue,\n\tplaceholder,\n\tpendingInsertedText,\n\tonChange,\n\tonCommit,\n}: BodyCellTextEditorProps) {\n\tconst inputRef = React.useRef<HTMLInputElement>(null)\n\tconst insertedInitialTextRef = React.useRef(false)\n\tconst { handleBlur, handleEditorAction, handleKeyUp } = useCellEditorKeyboardCommit({ onCommit })\n\tuseCellEditorInitialCaret({\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText,\n\t})\n\tuseCellEditorPendingTextInsertion({\n\t\tcell,\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText,\n\t\tonChange,\n\t})\n\n\tReact.useLayoutEffect(() => {\n\t\tconst input = inputRef.current\n\t\tif (!input || pendingInsertedText !== null || input.value === value) return\n\n\t\t// Keep native text entry behavior while still reflecting normalized draft updates from the adapter (e.g. slugs).\n\t\tinput.value = value\n\n\t\tif (document.activeElement === input) {\n\t\t\tconst caretPosition = input.value.length\n\t\t\tinput.setSelectionRange(caretPosition, caretPosition)\n\t\t}\n\t}, [pendingInsertedText, value])\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\tif (isCommandKeyPressed(event)) {\n\t\t\tevent.stopPropagation()\n\t\t\treturn\n\t\t}\n\n\t\tif (!handleEditorAction(event)) {\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\treturn (\n\t\t<input\n\t\t\tref={inputRef}\n\t\t\tautoFocus\n\t\t\ttype=\"text\"\n\t\t\tspellCheck={false}\n\t\t\tclassName={styles.bodyCellEditor}\n\t\t\tdefaultValue={value}\n\t\t\tplaceholder={placeholder}\n\t\t\taria-label={column.control.title ?? \"Edit cell\"}\n\t\t\tonBlur={handleBlur}\n\t\t\tonChange={event => {\n\t\t\t\tonChange(cell, event.currentTarget.value)\n\t\t\t}}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonKeyUp={handleKeyUp}\n\t\t\tonClick={stopPropagation}\n\t\t\tonMouseDown={stopPropagation}\n\t\t\tonDoubleClick={stopPropagation}\n\t\t/>\n\t)\n}\n\ninterface BodyCellNumberEditorProps {\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tsession: Extract<VirtualCollectionItemTableEditingSession, { adapterKind: \"number\" }>\n\tonChange: (cell: CellIdentifier, value: string) => void\n\tonCommit: (command: EditingCommitAction) => void\n}\n\nfunction BodyCellNumberEditor({ cell, column, session, onChange, onCommit }: BodyCellNumberEditorProps) {\n\tconst inputRef = React.useRef<HTMLInputElement>(null)\n\tconst insertedInitialTextRef = React.useRef(false)\n\tconst { handleBlur, handleEditorAction, handleKeyUp } = useCellEditorKeyboardCommit({ onCommit })\n\tconst numberControl = column.control.type === ControlType.Number ? column.control : null\n\tconst initialValue = isNumber(session.initialValue) ? String(session.initialValue) : \"\"\n\tuseCellEditorInitialCaret({\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText: session.pendingInsertedText,\n\t\tenabled: Boolean(numberControl),\n\t})\n\tuseCellEditorPendingTextInsertion({\n\t\tcell,\n\t\tinputRef,\n\t\tinsertedInitialTextRef,\n\t\tpendingInsertedText: session.pendingInsertedText,\n\t\tonChange,\n\t\tenabled: Boolean(numberControl),\n\t})\n\n\tif (!numberControl) return null\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\tif (isCommandKeyPressed(event)) {\n\t\t\tevent.stopPropagation()\n\t\t\treturn\n\t\t}\n\n\t\tif (event.key === \"ArrowUp\" || event.key === \"ArrowDown\") {\n\t\t\tevent.stopPropagation()\n\t\t\tevent.preventDefault()\n\n\t\t\tconst input = event.currentTarget\n\t\t\tconst step = numberControl.step ?? 1\n\t\t\tconst stepDirection = event.key === \"ArrowDown\" ? -1 : 1\n\t\t\tconst stepMultiplier = event.shiftKey ? 10 : 1\n\t\t\tconst resolvedValue = resolveNumberDisplayValue(numberControl, input.value, session.initialValue) ?? 0\n\t\t\tconst steppedValue = resolvedValue + step * stepDirection * stepMultiplier\n\t\t\tconst steppedDisplayValue = String(steppedValue)\n\t\t\tconst clampedValue = resolveNumberDisplayValue(numberControl, steppedDisplayValue, resolvedValue)\n\t\t\tconst nextDisplayValue = String(clampedValue ?? steppedValue)\n\n\t\t\tinput.value = nextDisplayValue\n\t\t\tonChange(cell, nextDisplayValue)\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tconst caretPosition = input.value.length\n\t\t\t\tinput.setSelectionRange(caretPosition, caretPosition)\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (!handleEditorAction(event)) {\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\treturn (\n\t\t<input\n\t\t\tref={inputRef}\n\t\t\tautoFocus\n\t\t\ttype=\"text\"\n\t\t\tspellCheck={false}\n\t\t\tdefaultValue={session.pendingInsertedText === null ? session.displayValue : initialValue}\n\t\t\tclassName={styles.bodyCellEditor}\n\t\t\taria-label={column.control.title ?? \"Edit number\"}\n\t\t\tonBlur={handleBlur}\n\t\t\tonChange={event => {\n\t\t\t\tonChange(cell, event.currentTarget.value)\n\t\t\t}}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonKeyUp={handleKeyUp}\n\t\t\tonClick={stopPropagation}\n\t\t\tonMouseDown={stopPropagation}\n\t\t\tonDoubleClick={stopPropagation}\n\t\t/>\n\t)\n}\n\ninterface BodyCellDateEditorProps {\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tsession: Extract<VirtualCollectionItemTableEditingSession, { adapterKind: \"date\" }>\n\tonChange: (cell: CellIdentifier, value: string) => void\n\tonDismiss: () => void\n\tonCommit: (command: EditingCommitAction) => void\n}\n\nfunction BodyCellDateEditor({ cell, column, session, onChange, onDismiss, onCommit }: BodyCellDateEditorProps) {\n\tconst inputRef = React.useRef<HTMLInputElement>(null)\n\tconst displayTime = column.control.type === ControlType.Date && column.control.displayTime === true\n\tconst inputType = displayTime ? \"datetime-local\" : \"date\"\n\tconst inputDisplayValue = displayTime\n\t\t? getDateTimeInputDisplayValue(session.draftValue)\n\t\t: getDateInputDisplayValue(session.draftValue)\n\n\tconst handleAction = useCallback(\n\t\t(action: VirtualCollectionItemTableEditorKeyboardAction): boolean => {\n\t\t\tif (\n\t\t\t\taction.type === \"finishEditing\" &&\n\t\t\t\tsession.autoFilledInitialDraftValue !== undefined &&\n\t\t\t\tsession.draftValue === session.autoFilledInitialDraftValue\n\t\t\t) {\n\t\t\t\tonDismiss()\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\treturn false\n\t\t},\n\t\t[session.autoFilledInitialDraftValue, session.draftValue, onDismiss],\n\t)\n\n\tconst { handleBlur, handleEditorAction, handleKeyUp } = useCellEditorKeyboardCommit({\n\t\tonCommit,\n\t\tonAction: handleAction,\n\t})\n\n\tReact.useLayoutEffect(() => {\n\t\tinputRef.current?.focus()\n\t}, [])\n\n\tReact.useLayoutEffect(() => {\n\t\tconst input = inputRef.current\n\t\tif (!input) return\n\n\t\tif (input.value === inputDisplayValue) return\n\n\t\tinput.value = inputDisplayValue\n\t}, [inputDisplayValue])\n\n\tconst handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\tif (isCommandKeyPressed(event)) {\n\t\t\tevent.stopPropagation()\n\t\t\treturn\n\t\t}\n\n\t\tif (!handleEditorAction(event)) {\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t// Native date/datetime-local inputs can briefly enter an invalid state while a single\n\t\t// segment is being edited. Treat that as transient browser UI state so we do not overwrite\n\t\t// the remaining segments with an empty draft.\n\t\tif (event.currentTarget.validity.badInput) return\n\n\t\tconst nextValue = getDateControlValueForInputValue(event.currentTarget.value, displayTime)\n\t\tif (event.currentTarget.value !== \"\" && nextValue === undefined) return\n\t\tonChange(cell, nextValue ?? \"\")\n\t}\n\n\treturn (\n\t\t<input\n\t\t\tref={inputRef}\n\t\t\tautoFocus\n\t\t\ttype={inputType}\n\t\t\tdefaultValue={inputDisplayValue}\n\t\t\tclassName={cx(styles.bodyCellEditor, styles.bodyCellDateEditor)}\n\t\t\taria-label={column.control.title ?? \"Edit date\"}\n\t\t\tonBlur={handleBlur}\n\t\t\tonChange={handleChange}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonKeyUp={handleKeyUp}\n\t\t\tonClick={stopPropagation}\n\t\t\tonMouseDown={stopPropagation}\n\t\t\tonDoubleClick={stopPropagation}\n\t\t/>\n\t)\n}\n\ninterface BodyCellEnumEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tinitialSearchValue: string | null\n\tonDismiss: () => void\n}\n\nfunction BodyCellEnumEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tinitialSearchValue,\n\tonDismiss,\n}: BodyCellEnumEditorProps) {\n\tconst enumControl = column.control.type === ControlType.Enum ? column.control : null\n\tassert(enumControl, \"Expected an enum column for the enum editor.\")\n\n\tconst engine = useAndAssertVekterEngine()\n\tconst comboBoxItems = React.useMemo(() => getEnumComboBoxItems(enumControl), [enumControl])\n\tconst controlProp = column.getControlProp(item)\n\tconst isStatusColumn = isCollectionItemTableStatusColumn(column)\n\tconst statusSelectedValue = isStatusColumn ? getCollectionItemTableStatusValue(item) : undefined\n\tconst selectedValue = statusSelectedValue ?? getEnumSelectedValue(enumControl, controlProp)\n\tconst checkedItems = selectedValue ? [selectedValue] : undefined\n\tconst pillItems = isStatusColumn\n\t\t? getCollectionItemTableStatusPillItems(item)\n\t\t: getEnumPillItems(enumControl, controlProp)\n\tconst selectedPillTone = statusSelectedValue ? getCollectionItemTableStatusPillTone(statusSelectedValue) : \"default\"\n\n\tconst handleChange = React.useCallback(\n\t\t(newValue: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\n\t\t\tconst isValidOption = comboBoxItems.some(option => option.type === \"option\" && option.value === newValue)\n\t\t\tif (!isValidOption) return\n\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tupdateVirtualCollectionItemTableEnumCell(collectionNodeId, cell.rowId, cell.columnId, newValue)\n\t\t\t})\n\n\t\t\treset()\n\t\t},\n\t\t[collectionNodeId, cell, comboBoxItems],\n\t)\n\n\treturn (\n\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t<PopoverComboBox\n\t\t\t\tdefaultOpen\n\t\t\t\tvalue=\"\"\n\t\t\t\titems={comboBoxItems}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tcheckedItems={checkedItems}\n\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\tinitialInputValue={initialSearchValue}\n\t\t\t\tselectedItemRemovable={false}\n\t\t\t\tselectedPillTone={selectedPillTone}\n\t\t\t\tonClose={onDismiss}\n\t\t\t>\n\t\t\t\t{({ triggerRef }) => (\n\t\t\t\t\t<button\n\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\taria-label={column.control.title ?? \"Edit enum\"}\n\t\t\t\t\t\tdata-popout-hitbox\n\t\t\t\t\t\tclassName={styles.bodyCellPopoverTrigger}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ComboBoxCellPills items={pillItems} />\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</PopoverComboBox>\n\t\t</RevampedCmsPopoutThemeOverride>\n\t)\n}\n\ninterface BodyCellCollectionReferenceEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tinitialSearchValue: string | null\n\tonDismiss: () => void\n}\n\nfunction BodyCellCollectionReferenceEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tinitialSearchValue,\n\tonDismiss,\n}: BodyCellCollectionReferenceEditorProps) {\n\tassert(\n\t\tcolumn.control.type === ControlType.CollectionReference,\n\t\t\"Expected a collection reference column for the reference editor.\",\n\t)\n\n\tconst dataIdentifier = column.control.dataIdentifier as ModuleExportIdentifierString\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst { listItemsById, itemOptions } = useCollectionReferenceInputOptions(dataIdentifier)\n\n\tconst controlProp = column.getControlProp(item)\n\tconst currentValue = getCollectionReferenceControlPropValue(column.control, controlProp)\n\tconst selectedValue = isString(currentValue) ? currentValue : undefined\n\n\tconst handleChange = React.useCallback(\n\t\t(newValue: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tif (!(newValue in listItemsById)) {\n\t\t\t\t\tupdateVirtualCollectionItemTableCollectionReferenceCell(\n\t\t\t\t\t\tcollectionNodeId,\n\t\t\t\t\t\tcell.rowId,\n\t\t\t\t\t\tcell.columnId,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tupdateVirtualCollectionItemTableCollectionReferenceCell(collectionNodeId, cell.rowId, cell.columnId, newValue)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\treset()\n\t\t},\n\t\t[collectionNodeId, cell, listItemsById],\n\t)\n\n\tconst checkedItems = selectedValue ? [selectedValue] : undefined\n\n\treturn (\n\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t<PopoverComboBox\n\t\t\t\tdefaultOpen\n\t\t\t\tvalue=\"\"\n\t\t\t\titems={itemOptions}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tcheckedItems={checkedItems}\n\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\tinitialInputValue={initialSearchValue}\n\t\t\t\tonClose={onDismiss}\n\t\t\t>\n\t\t\t\t{({ triggerRef }) => (\n\t\t\t\t\t<button\n\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\taria-label={column.control.title ?? \"Edit reference\"}\n\t\t\t\t\t\tdata-popout-hitbox\n\t\t\t\t\t\tclassName={styles.bodyCellPopoverTrigger}\n\t\t\t\t\t>\n\t\t\t\t\t\t{selectedValue && <ReferenceCellPills dataIdentifier={dataIdentifier} values={[selectedValue]} />}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</PopoverComboBox>\n\t\t</RevampedCmsPopoutThemeOverride>\n\t)\n}\n\ninterface BodyCellMultiCollectionReferenceEditorProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcell: CellIdentifier\n\tcolumn: CollectionItemTableColumn\n\tinitialSearchValue: string | null\n\tonDismiss: () => void\n}\n\nfunction BodyCellMultiCollectionReferenceEditor({\n\tcollectionNodeId,\n\titem,\n\tcell,\n\tcolumn,\n\tinitialSearchValue,\n\tonDismiss,\n}: BodyCellMultiCollectionReferenceEditorProps) {\n\tassert(\n\t\tcolumn.control.type === ControlType.MultiCollectionReference,\n\t\t\"Expected a multi collection reference column for the reference editor.\",\n\t)\n\n\tconst dataIdentifier = column.control.dataIdentifier as ModuleExportIdentifierString\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst { itemOptions } = useCollectionReferenceInputOptions(dataIdentifier)\n\n\tconst controlProp = column.getControlProp(item)\n\tconst currentValue = getMultiCollectionReferenceControlPropValue(column.control, controlProp)\n\tconst selectedValues: readonly string[] =\n\t\tisDynamicValue(currentValue) || !Array.isArray(currentValue) ? [] : currentValue\n\n\tconst handleChange = React.useCallback(\n\t\t(nextValues: readonly string[]) => {\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tupdateVirtualCollectionItemTableMultiCollectionReferenceCell(\n\t\t\t\t\tcollectionNodeId,\n\t\t\t\t\tcell.rowId,\n\t\t\t\t\tcell.columnId,\n\t\t\t\t\tnextValues.length > 0 ? nextValues : undefined,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[collectionNodeId, cell],\n\t)\n\n\treturn (\n\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t<PopoverMultiComboBox\n\t\t\t\tdefaultOpen\n\t\t\t\titems={itemOptions}\n\t\t\t\tvalue={selectedValues}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tplaceholder={Dictionary.AddEllipsis}\n\t\t\t\tinitialInputValue={initialSearchValue}\n\t\t\t\tonClose={onDismiss}\n\t\t\t>\n\t\t\t\t{({ triggerRef }) => (\n\t\t\t\t\t<button\n\t\t\t\t\t\tref={triggerRef}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\taria-label={column.control.title ?? \"Edit references\"}\n\t\t\t\t\t\tdata-popout-hitbox\n\t\t\t\t\t\tclassName={styles.bodyCellPopoverTrigger}\n\t\t\t\t\t>\n\t\t\t\t\t\t{selectedValues.length > 0 && (\n\t\t\t\t\t\t\t<ReferenceCellPills dataIdentifier={dataIdentifier} values={selectedValues} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</PopoverMultiComboBox>\n\t\t</RevampedCmsPopoutThemeOverride>\n\t)\n}\n", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getEnumControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { EnumControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { ComboBoxCellPillItem } from \"./ComboBoxCellPills.tsx\"\n\nexport function getEnumComboBoxItems(control: EnumControlDescription): ComboBoxListItem[] {\n\treturn control.options.map((option, index): ComboBoxListItem => {\n\t\tassert(isString(option), \"Expected collection enum options to be strings.\")\n\t\tconst title = control.optionTitles?.[index]\n\t\treturn {\n\t\t\ttype: \"option\",\n\t\t\tvalue: option,\n\t\t\ttitle: title ?? fallbackTitleForOption(option),\n\t\t}\n\t})\n}\n\nexport function getEnumSelectedValue(\n\tcontrol: EnumControlDescription,\n\tcontrolProp: ControlProp | undefined,\n): string | undefined {\n\tconst value = getEnumControlPropValue(control, controlProp)\n\tif (isDynamicValue(value)) return undefined\n\treturn isString(value) ? value : undefined\n}\n\nexport function getEnumPillItems(\n\tcontrol: EnumControlDescription,\n\tcontrolProp: ControlProp | undefined,\n): readonly ComboBoxCellPillItem[] {\n\tconst selectedValue = getEnumSelectedValue(control, controlProp)\n\treturn getEnumPillItemsForValue(control, selectedValue)\n}\n\nfunction getEnumPillItemsForValue(\n\tcontrol: EnumControlDescription,\n\tselectedValue: string | undefined,\n): readonly ComboBoxCellPillItem[] {\n\tif (!selectedValue) return emptyArray()\n\n\tconst selectedIndex = control.options.indexOf(selectedValue)\n\tif (selectedIndex === -1) return emptyArray()\n\n\tconst title = control.optionTitles?.[selectedIndex]\n\treturn [\n\t\t{\n\t\t\tkey: selectedValue,\n\t\t\tlabel: title ?? fallbackTitleForOption(selectedValue),\n\t\t},\n\t]\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type React from \"react\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface VirtualCollectionItemTableBodyCellFrameProps {\n\tclassName: string\n\tariaLabel: string\n\tisSelected: boolean\n\tcellKey: string\n\trowId: NodeID\n\tcolumnId: ColumnKey\n\toverlayButton: React.ReactNode\n\tchildren: React.ReactNode\n\tonMouseDown: React.MouseEventHandler<HTMLDivElement>\n\tonMouseMove?: React.MouseEventHandler<HTMLDivElement>\n\tonMouseEnter: React.MouseEventHandler<HTMLDivElement>\n\tonClick?: React.MouseEventHandler<HTMLDivElement>\n\tonDoubleClick?: React.MouseEventHandler<HTMLDivElement>\n\tonContextMenu: React.MouseEventHandler<HTMLDivElement>\n}\n\nexport function VirtualCollectionItemTableBodyCellFrame({\n\tclassName,\n\tariaLabel,\n\tisSelected,\n\tcellKey,\n\trowId,\n\tcolumnId,\n\toverlayButton,\n\tchildren,\n\tonMouseDown,\n\tonMouseMove,\n\tonMouseEnter,\n\tonClick,\n\tonDoubleClick,\n\tonContextMenu,\n}: VirtualCollectionItemTableBodyCellFrameProps) {\n\treturn (\n\t\t// biome-ignore lint/a11y/useKeyWithClickEvents: Keyboard activation is handled by the table-level grid navigation controller.\n\t\t<div\n\t\t\tclassName={className}\n\t\t\t// biome-ignore lint/a11y/useSemanticElements: Virtualized grid cells cannot use semantic table elements without breaking layout/sticky behavior.\n\t\t\trole=\"gridcell\"\n\t\t\taria-label={ariaLabel}\n\t\t\taria-selected={isSelected}\n\t\t\ttabIndex={-1}\n\t\t\tdata-cell-key={cellKey}\n\t\t\tdata-row-id={rowId}\n\t\t\tdata-column-id={columnId}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonMouseMove={onMouseMove}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonClick={onClick}\n\t\t\tonDoubleClick={onDoubleClick}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t{overlayButton}\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n", "import { Toggle } from \"@framerjs/fresco\"\nimport { isCommandKeyPressed } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { CollectionItemNode } from \"document/models/CanvasTree/index.ts\"\nimport { getBooleanControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { getCollectionItemTableColumnTitle } from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport { exceedsDragThreshold } from \"./VirtualCollectionItemTable.dragThreshold.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { VirtualCollectionItemTableBodyCellFrame } from \"./VirtualCollectionItemTableBodyCellFrame.tsx\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\n\ntype BooleanCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.Boolean }>\n}\n\nexport function isBooleanColumn(column: CollectionItemTableColumn): column is BooleanCollectionItemTableColumn {\n\treturn column.control.type === ControlType.Boolean\n}\n\nfunction getBooleanCellValue(column: BooleanCollectionItemTableColumn, item: CollectionItemNode): boolean {\n\tconst controlProp = column.getControlProp(item)\n\treturn getBooleanControlPropValue(column.control, controlProp) === true\n}\n\nfunction getBooleanGridCellAriaLabel(column: BooleanCollectionItemTableColumn, item: CollectionItemNode): string {\n\tconst title = getCollectionItemTableColumnTitle(column)\n\treturn `${title}: ${getBooleanCellValue(column, item) ? Dictionary.Yes : Dictionary.No}`\n}\n\nfunction isBooleanToggleTarget(target: EventTarget | null): boolean {\n\treturn target instanceof HTMLElement && target.closest(\"[data-boolean-toggle-hitbox]\") !== null\n}\n\nfunction BooleanBodyCellContent({\n\tcolumn,\n\titem,\n\tisEnabled,\n\tisReadOnly,\n}: {\n\tcolumn: BooleanCollectionItemTableColumn\n\titem: CollectionItemNode\n\tisEnabled: boolean\n\tisReadOnly: boolean\n}) {\n\tconst value = getBooleanCellValue(column, item)\n\tconst accessibilityLabel = `${column.control.title}: ${value ? Dictionary.Yes : Dictionary.No}`\n\n\treturn (\n\t\t<div className={cx(styles.bodyCellBooleanToggle, isReadOnly && styles.readOnlyContent)}>\n\t\t\t<div className={styles.bodyCellBooleanToggleVisual} aria-hidden>\n\t\t\t\t<Toggle value={value} enabled={isEnabled} small tabIndex={-1} onChange={noop} />\n\t\t\t</div>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\ttabIndex={-1}\n\t\t\t\taria-label={accessibilityLabel}\n\t\t\t\tdata-boolean-toggle-hitbox\n\t\t\t\tclassName={styles.bodyCellBooleanToggleHitbox}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\ninterface VirtualCollectionItemTableBooleanBodyCellProps {\n\titem: CollectionItemNode\n\tcolumn: BooleanCollectionItemTableColumn\n\tdataIsViewOnly: boolean\n\tcellKey: string\n\tclassName: string\n\tisSelected: boolean\n\toverlayButton: React.ReactNode\n\tonBeginDragSelection: (cell: CellIdentifier, shiftKey: boolean) => void\n\tonMouseEnter: React.MouseEventHandler<HTMLDivElement>\n\tonCommitBooleanValue: (cell: CellIdentifier, value: boolean) => void\n\tonContextMenu: React.MouseEventHandler<HTMLDivElement>\n}\n\nexport const VirtualCollectionItemTableBooleanBodyCell = React.memo(function VirtualCollectionItemTableBooleanBodyCell({\n\titem,\n\tcolumn,\n\tdataIsViewOnly,\n\tcellKey,\n\tclassName,\n\tisSelected,\n\toverlayButton,\n\tonBeginDragSelection,\n\tonMouseEnter,\n\tonCommitBooleanValue,\n\tonContextMenu,\n}: VirtualCollectionItemTableBooleanBodyCellProps) {\n\tconst dragStartPointRef = React.useRef<{ x: number; y: number } | null>(null)\n\tconst draggedDuringPressRef = React.useRef(false)\n\tconst pendingSwitchDragSelectionRef = React.useRef<{ shiftKey: boolean } | null>(null)\n\tconst pendingSwitchDragSelectionCleanupRef = React.useRef<(() => void) | null>(null)\n\tconst rowId = item.id\n\tconst columnId = column.key\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\tconst ariaLabel = getBooleanGridCellAriaLabel(column, item)\n\n\tconst beginDragSelection = React.useCallback(\n\t\t(shiftKey: boolean) => {\n\t\t\tonBeginDragSelection({ rowId, columnId }, shiftKey)\n\t\t},\n\t\t[columnId, onBeginDragSelection, rowId],\n\t)\n\n\tconst commitToggledValue = () => {\n\t\tonCommitBooleanValue({ rowId, columnId }, !getBooleanCellValue(column, item))\n\t}\n\n\tconst stopPendingSwitchDragSelection = React.useCallback(() => {\n\t\tpendingSwitchDragSelectionRef.current = null\n\n\t\tconst cleanup = pendingSwitchDragSelectionCleanupRef.current\n\t\tif (!cleanup) return\n\n\t\tpendingSwitchDragSelectionCleanupRef.current = null\n\t\tcleanup()\n\t}, [])\n\n\tconst maybeStartPendingSwitchDragSelection = React.useCallback(\n\t\t(clientX: number, clientY: number) => {\n\t\t\tconst pendingDragSelection = pendingSwitchDragSelectionRef.current\n\t\t\tconst dragStartPoint = dragStartPointRef.current\n\t\t\tif (!pendingDragSelection || !dragStartPoint) return\n\t\t\tif (!exceedsDragThreshold(clientX, clientY, dragStartPoint)) return\n\n\t\t\tdraggedDuringPressRef.current = true\n\t\t\tstopPendingSwitchDragSelection()\n\t\t\tbeginDragSelection(pendingDragSelection.shiftKey)\n\t\t},\n\t\t[beginDragSelection, stopPendingSwitchDragSelection],\n\t)\n\n\tconst startPendingSwitchDragSelection = React.useCallback(\n\t\t(shiftKey: boolean) => {\n\t\t\tstopPendingSwitchDragSelection()\n\t\t\tpendingSwitchDragSelectionRef.current = { shiftKey }\n\n\t\t\tconst handleWindowMouseMove = (event: MouseEvent) => {\n\t\t\t\tif ((event.buttons & 1) === 0) {\n\t\t\t\t\tstopPendingSwitchDragSelection()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tmaybeStartPendingSwitchDragSelection(event.clientX, event.clientY)\n\t\t\t}\n\n\t\t\tconst handleWindowMouseUp = () => {\n\t\t\t\tstopPendingSwitchDragSelection()\n\t\t\t}\n\n\t\t\twindow.addEventListener(\"mousemove\", handleWindowMouseMove, true)\n\t\t\twindow.addEventListener(\"mouseup\", handleWindowMouseUp, true)\n\t\t\twindow.addEventListener(\"blur\", handleWindowMouseUp)\n\n\t\t\tpendingSwitchDragSelectionCleanupRef.current = () => {\n\t\t\t\twindow.removeEventListener(\"mousemove\", handleWindowMouseMove, true)\n\t\t\t\twindow.removeEventListener(\"mouseup\", handleWindowMouseUp, true)\n\t\t\t\twindow.removeEventListener(\"blur\", handleWindowMouseUp)\n\t\t\t}\n\t\t},\n\t\t[maybeStartPendingSwitchDragSelection, stopPendingSwitchDragSelection],\n\t)\n\n\tReact.useEffect(() => stopPendingSwitchDragSelection, [stopPendingSwitchDragSelection])\n\n\tconst handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n\t\tif (event.button !== 0) return\n\t\tdragStartPointRef.current = {\n\t\t\tx: event.clientX,\n\t\t\ty: event.clientY,\n\t\t}\n\t\tdraggedDuringPressRef.current = false\n\n\t\tif (isBooleanToggleTarget(event.target)) {\n\t\t\tif (isCellValueReadOnly || isCommandKeyPressed(event) || event.altKey) {\n\t\t\t\tstopPendingSwitchDragSelection()\n\t\t\t} else if (event.shiftKey) {\n\t\t\t\tstopPendingSwitchDragSelection()\n\t\t\t\tevent.preventDefault()\n\t\t\t\tbeginDragSelection(true)\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tstartPendingSwitchDragSelection(false)\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tstopPendingSwitchDragSelection()\n\t\tevent.preventDefault()\n\t\tbeginDragSelection(event.shiftKey)\n\t}\n\n\tconst handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n\t\tif ((event.buttons & 1) === 0) return\n\t\tconst dragStartPoint = dragStartPointRef.current\n\t\tif (!dragStartPoint) return\n\n\t\tif (exceedsDragThreshold(event.clientX, event.clientY, dragStartPoint)) {\n\t\t\tdraggedDuringPressRef.current = true\n\t\t}\n\n\t\tmaybeStartPendingSwitchDragSelection(event.clientX, event.clientY)\n\t}\n\n\tconst handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n\t\tstopPendingSwitchDragSelection()\n\t\tif (isCellValueReadOnly) return\n\t\tif (event.shiftKey || isCommandKeyPressed(event) || event.altKey) return\n\t\tif (!isBooleanToggleTarget(event.target)) return\n\t\tif (draggedDuringPressRef.current) return\n\n\t\tcommitToggledValue()\n\t}\n\n\tconst handleDoubleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n\t\tstopPendingSwitchDragSelection()\n\t\tif (isCellValueReadOnly) return\n\t\tif (isBooleanToggleTarget(event.target)) return\n\n\t\tcommitToggledValue()\n\t}\n\n\treturn (\n\t\t<VirtualCollectionItemTableBodyCellFrame\n\t\t\tclassName={className}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tisSelected={isSelected}\n\t\t\tcellKey={cellKey}\n\t\t\trowId={rowId}\n\t\t\tcolumnId={columnId}\n\t\t\toverlayButton={overlayButton}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonMouseMove={handleMouseMove}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonClick={handleClick}\n\t\t\tonDoubleClick={handleDoubleClick}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t<BooleanBodyCellContent\n\t\t\t\tcolumn={column}\n\t\t\t\titem={item}\n\t\t\t\tisEnabled={!isCellValueReadOnly}\n\t\t\t\tisReadOnly={isCellValueReadOnly}\n\t\t\t/>\n\t\t</VirtualCollectionItemTableBodyCellFrame>\n\t)\n})\n", "import type { Point } from \"library/render/types/Point.ts\"\n\nconst dragStartThreshold = 4\n\nexport function exceedsDragThreshold(clientX: number, clientY: number, dragStartPoint: Point): boolean {\n\tconst movedX = Math.abs(clientX - dragStartPoint.x)\n\tconst movedY = Math.abs(clientY - dragStartPoint.y)\n\treturn movedX >= dragStartThreshold || movedY >= dragStartThreshold\n}\n", "import { IconInputDropdown } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\tgetCollectionReferenceControlPropValue,\n\tgetMultiCollectionReferenceControlPropValue,\n} from \"document/models/controlProps/getControlProps.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { type ComboBoxCellPillItem, ComboBoxCellPills, dataComboBoxCellPillAttribute } from \"./ComboBoxCellPills.tsx\"\nimport { useReferenceCellPillItems } from \"./ReferenceCellPills.tsx\"\nimport { getCollectionItemTableColumnTitle } from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport type {\n\tEditingCommitAction,\n\tVirtualCollectionItemTableEditingSession,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport { getEnumPillItems } from \"./VirtualCollectionItemTable.enumOptions.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { VirtualCollectionItemTableBodyCellEditor } from \"./VirtualCollectionItemTableBodyCellEditor.tsx\"\nimport { VirtualCollectionItemTableBodyCellFrame } from \"./VirtualCollectionItemTableBodyCellFrame.tsx\"\nimport { useVirtualCollectionItemTableClickToEditCell } from \"./useVirtualCollectionItemTableClickToEditCell.ts\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionItemTableStatusPillItems,\n\tisCollectionItemTableStatusColumn,\n} from \"./utils/collectionItemTableStatusColumn.ts\"\n\ntype ComboBoxCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<\n\t\tCollectionItemTableColumn[\"control\"],\n\t\t{ type: ControlType.Enum | ControlType.CollectionReference | ControlType.MultiCollectionReference }\n\t>\n}\n\ntype CollectionReferenceComboBoxCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.CollectionReference }>\n}\n\ntype MultiCollectionReferenceComboBoxCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.MultiCollectionReference }>\n}\n\ntype EnumComboBoxCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.Enum }>\n}\n\nexport function isComboBoxColumn(column: CollectionItemTableColumn): column is ComboBoxCollectionItemTableColumn {\n\treturn (\n\t\tcolumn.control.type === ControlType.Enum ||\n\t\tcolumn.control.type === ControlType.CollectionReference ||\n\t\tcolumn.control.type === ControlType.MultiCollectionReference\n\t)\n}\n\nfunction getAccessibleLabelForPillItems(\n\tcolumn: ComboBoxCollectionItemTableColumn,\n\titems: readonly ComboBoxCellPillItem[],\n): string {\n\tconst title = getCollectionItemTableColumnTitle(column)\n\tconst value = items.map(item => item.label).join(\", \")\n\treturn value ? `${title}: ${value}` : title\n}\n\ninterface VirtualCollectionItemTableComboBoxBodyCellProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcolumn: ComboBoxCollectionItemTableColumn\n\tcolumnWidth: number\n\tdataIsViewOnly: boolean\n\tcellKey: string\n\tclassName: string\n\tisSelected: boolean\n\tisSelectionAnchor: boolean\n\teditingSession: VirtualCollectionItemTableEditingSession | null\n\toverlayButton: React.ReactNode\n\tonBeginDragSelection: (cell: CellIdentifier, shiftKey: boolean) => void\n\tonMouseEnter: React.MouseEventHandler<HTMLDivElement>\n\tonStartEditing: (cell: CellIdentifier) => void\n\tonEditingValueChange: (cell: CellIdentifier, value: string) => void\n\tonFinishEditing: () => void\n\tonCommitEditing: (command: EditingCommitAction) => void\n\tonContextMenu: React.MouseEventHandler<HTMLDivElement>\n}\n\ntype CollectionReferenceComboBoxBodyCellProps = Omit<VirtualCollectionItemTableComboBoxBodyCellProps, \"column\"> & {\n\tcolumn: CollectionReferenceComboBoxCollectionItemTableColumn\n}\n\ntype MultiCollectionReferenceComboBoxBodyCellProps = Omit<VirtualCollectionItemTableComboBoxBodyCellProps, \"column\"> & {\n\tcolumn: MultiCollectionReferenceComboBoxCollectionItemTableColumn\n}\n\nfunction isCollectionReferenceComboBoxBodyCellProps(\n\tprops: VirtualCollectionItemTableComboBoxBodyCellProps,\n): props is CollectionReferenceComboBoxBodyCellProps {\n\treturn props.column.control.type === ControlType.CollectionReference\n}\n\nfunction isMultiCollectionReferenceComboBoxBodyCellProps(\n\tprops: VirtualCollectionItemTableComboBoxBodyCellProps,\n): props is MultiCollectionReferenceComboBoxBodyCellProps {\n\treturn props.column.control.type === ControlType.MultiCollectionReference\n}\n\nfunction isEnumComboBoxBodyCellProps(\n\tprops: VirtualCollectionItemTableComboBoxBodyCellProps,\n): props is VirtualCollectionItemTableComboBoxBodyCellProps & { column: EnumComboBoxCollectionItemTableColumn } {\n\treturn props.column.control.type === ControlType.Enum\n}\n\nfunction isComboBoxPillTarget(target: EventTarget | null): boolean {\n\treturn target instanceof Element && target.closest(`[${dataComboBoxCellPillAttribute}]`) !== null\n}\n\nfunction VirtualCollectionItemTableComboBoxBodyCellLayout({\n\tcollectionNodeId,\n\titem,\n\tcolumn,\n\tcolumnWidth,\n\tdataIsViewOnly,\n\tcellKey,\n\tclassName,\n\tariaLabel,\n\tisSelected,\n\tisSelectionAnchor,\n\teditingSession,\n\toverlayButton,\n\tonBeginDragSelection,\n\tonMouseEnter,\n\tonStartEditing,\n\tonEditingValueChange,\n\tonFinishEditing,\n\tonCommitEditing,\n\tonContextMenu,\n\tchildren,\n\thasSingleValuePreview,\n}: VirtualCollectionItemTableComboBoxBodyCellProps & {\n\tariaLabel: string\n\tchildren: React.ReactNode\n\thasSingleValuePreview: boolean\n}) {\n\tconst rowId = item.id\n\tconst columnId = column.key\n\tconst cell: CellIdentifier = { rowId, columnId }\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\n\tconst { handleMouseDown, handleClick } = useVirtualCollectionItemTableClickToEditCell({\n\t\tcell,\n\t\tisEditable: !isCellValueReadOnly,\n\t\tisSelectionAnchor,\n\t\tonBeginDragSelection,\n\t\tonStartEditing,\n\t\tshouldStartEditingFromClick: isComboBoxPillTarget,\n\t})\n\n\treturn (\n\t\t<VirtualCollectionItemTableBodyCellFrame\n\t\t\tclassName={cx(className, styles.bodyCellComboBox)}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tisSelected={isSelected}\n\t\t\tcellKey={cellKey}\n\t\t\trowId={rowId}\n\t\t\tcolumnId={columnId}\n\t\t\toverlayButton={overlayButton}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonClick={handleClick}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t{editingSession ? (\n\t\t\t\t<VirtualCollectionItemTableBodyCellEditor\n\t\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\t\titem={item}\n\t\t\t\t\tcell={cell}\n\t\t\t\t\tcolumn={column}\n\t\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\t\teditingSession={editingSession}\n\t\t\t\t\tonChange={onEditingValueChange}\n\t\t\t\t\tonDismiss={onFinishEditing}\n\t\t\t\t\tonCommit={onCommitEditing}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.bodyCellPopoverTrigger,\n\t\t\t\t\t\thasSingleValuePreview && styles.bodyCellComboBoxSingleValueTrigger,\n\t\t\t\t\t\tisCellValueReadOnly && styles.readOnlyContent,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</VirtualCollectionItemTableBodyCellFrame>\n\t)\n}\n\nfunction CollectionReferenceComboBoxBodyCell(props: CollectionReferenceComboBoxBodyCellProps) {\n\tconst { column, item } = props\n\tconst controlProp = column.getControlProp(item)\n\tconst value = getCollectionReferenceControlPropValue(column.control, controlProp)\n\tconst referenceValues = isString(value) ? [value] : []\n\tconst pillItems = useReferenceCellPillItems(\n\t\tcolumn.control.dataIdentifier as ModuleExportIdentifierString,\n\t\treferenceValues,\n\t)\n\n\treturn (\n\t\t<VirtualCollectionItemTableComboBoxBodyCellLayout\n\t\t\t{...props}\n\t\t\tariaLabel={getAccessibleLabelForPillItems(column, pillItems)}\n\t\t\thasSingleValuePreview\n\t\t>\n\t\t\t<ComboBoxCellPills\n\t\t\t\titems={pillItems}\n\t\t\t\ttrailingIcon={<IconInputDropdown />}\n\t\t\t\ttextOverflow=\"ellipsis\"\n\t\t\t\tpillMinWidth=\"min-content\"\n\t\t\t/>\n\t\t</VirtualCollectionItemTableComboBoxBodyCellLayout>\n\t)\n}\n\nfunction MultiCollectionReferenceComboBoxBodyCell(props: MultiCollectionReferenceComboBoxBodyCellProps) {\n\tconst { column, item } = props\n\tconst controlProp = column.getControlProp(item)\n\tconst value = getMultiCollectionReferenceControlPropValue(column.control, controlProp)\n\tconst referenceValues = isDynamicValue(value) || !Array.isArray(value) ? [] : value\n\tconst pillItems = useReferenceCellPillItems(\n\t\tcolumn.control.dataIdentifier as ModuleExportIdentifierString,\n\t\treferenceValues,\n\t)\n\n\treturn (\n\t\t<VirtualCollectionItemTableComboBoxBodyCellLayout\n\t\t\t{...props}\n\t\t\tariaLabel={getAccessibleLabelForPillItems(column, pillItems)}\n\t\t\thasSingleValuePreview={false}\n\t\t>\n\t\t\t<ComboBoxCellPills items={pillItems} textOverflow=\"clip\" pillMinWidth=\"min-content\" />\n\t\t</VirtualCollectionItemTableComboBoxBodyCellLayout>\n\t)\n}\n\nexport const VirtualCollectionItemTableComboBoxBodyCell = React.memo(\n\tfunction VirtualCollectionItemTableComboBoxBodyCell(props: VirtualCollectionItemTableComboBoxBodyCellProps) {\n\t\tconst { item } = props\n\n\t\tif (isCollectionReferenceComboBoxBodyCellProps(props)) {\n\t\t\treturn <CollectionReferenceComboBoxBodyCell {...props} />\n\t\t}\n\n\t\tif (isMultiCollectionReferenceComboBoxBodyCellProps(props)) {\n\t\t\treturn <MultiCollectionReferenceComboBoxBodyCell {...props} />\n\t\t}\n\n\t\tif (!isEnumComboBoxBodyCellProps(props)) return null\n\t\tconst enumColumn = props.column\n\t\tconst pillItems = isCollectionItemTableStatusColumn(enumColumn)\n\t\t\t? getCollectionItemTableStatusPillItems(item)\n\t\t\t: getEnumPillItems(enumColumn.control, enumColumn.getControlProp(item))\n\n\t\treturn (\n\t\t\t<VirtualCollectionItemTableComboBoxBodyCellLayout\n\t\t\t\t{...props}\n\t\t\t\tariaLabel={getAccessibleLabelForPillItems(enumColumn, pillItems)}\n\t\t\t\thasSingleValuePreview={true}\n\t\t\t>\n\t\t\t\t<ComboBoxCellPills items={pillItems} trailingIcon={<IconInputDropdown />} textOverflow=\"ellipsis\" />\n\t\t\t</VirtualCollectionItemTableComboBoxBodyCellLayout>\n\t\t)\n\t},\n)\n", "import React from \"react\"\nimport { isBoolean } from \"utils/typeChecks.ts\"\nimport { exceedsDragThreshold } from \"./VirtualCollectionItemTable.dragThreshold.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\n\ninterface UseVirtualCollectionItemTableActivatableBodyCellProps {\n\tcell: CellIdentifier\n\tisEditable: boolean\n\tisSelectionAnchor: boolean\n\tonBeginDragSelection: (cell: CellIdentifier, shiftKey: boolean) => void\n\tonStartEditing: (cell: CellIdentifier) => void\n\tshouldStartEditingFromClick: ((target: EventTarget | null) => boolean) | boolean\n}\n\nexport function useVirtualCollectionItemTableClickToEditCell({\n\tcell,\n\tisEditable,\n\tisSelectionAnchor,\n\tonBeginDragSelection,\n\tonStartEditing,\n\tshouldStartEditingFromClick = true,\n}: UseVirtualCollectionItemTableActivatableBodyCellProps) {\n\tconst dragStartPointRef = React.useRef<{ x: number; y: number } | null>(null)\n\tconst draggedDuringPressRef = React.useRef(false)\n\tconst pressTrackingCleanupRef = React.useRef<(() => void) | null>(null)\n\tconst anchorSelectedOnMouseDownRef = React.useRef(false)\n\n\tconst stopPressTracking = React.useCallback(() => {\n\t\tconst cleanup = pressTrackingCleanupRef.current\n\t\tpressTrackingCleanupRef.current = null\n\t\tcleanup?.()\n\t}, [])\n\n\t// Clean up the press tracking when the component using this hook unmounts.\n\tReact.useEffect(() => stopPressTracking, [stopPressTracking])\n\n\tconst startPressTracking = React.useCallback(\n\t\t(clientX: number, clientY: number) => {\n\t\t\tstopPressTracking()\n\t\t\tdragStartPointRef.current = { x: clientX, y: clientY }\n\t\t\tdraggedDuringPressRef.current = false\n\n\t\t\tconst handleWindowMouseMove = (event: MouseEvent) => {\n\t\t\t\tconst dragStartPoint = dragStartPointRef.current\n\t\t\t\tif (!dragStartPoint) return\n\t\t\t\tif ((event.buttons & 1) === 0) {\n\t\t\t\t\tstopPressTracking()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (exceedsDragThreshold(event.clientX, event.clientY, dragStartPoint)) {\n\t\t\t\t\tdraggedDuringPressRef.current = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst handleWindowMouseUp = () => {\n\t\t\t\tstopPressTracking()\n\t\t\t}\n\n\t\t\twindow.addEventListener(\"mousemove\", handleWindowMouseMove, true)\n\t\t\twindow.addEventListener(\"mouseup\", handleWindowMouseUp, true)\n\t\t\twindow.addEventListener(\"blur\", handleWindowMouseUp)\n\n\t\t\tpressTrackingCleanupRef.current = () => {\n\t\t\t\twindow.removeEventListener(\"mousemove\", handleWindowMouseMove, true)\n\t\t\t\twindow.removeEventListener(\"mouseup\", handleWindowMouseUp, true)\n\t\t\t\twindow.removeEventListener(\"blur\", handleWindowMouseUp)\n\t\t\t}\n\t\t},\n\t\t[stopPressTracking],\n\t)\n\n\tconst handleMouseDown = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (event.button !== 0) return\n\t\t\tdraggedDuringPressRef.current = false\n\t\t\tanchorSelectedOnMouseDownRef.current = isSelectionAnchor\n\t\t\tstartPressTracking(event.clientX, event.clientY)\n\t\t\tevent.preventDefault()\n\t\t\tonBeginDragSelection(cell, event.shiftKey)\n\t\t},\n\t\t[cell, isSelectionAnchor, onBeginDragSelection, startPressTracking],\n\t)\n\n\tconst handleClick = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tstopPressTracking()\n\t\t\tif (!isEditable) return\n\t\t\tif (event.shiftKey) return\n\t\t\tif (draggedDuringPressRef.current) return\n\t\t\tif (anchorSelectedOnMouseDownRef.current) {\n\t\t\t\tonStartEditing(cell)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (isBoolean(shouldStartEditingFromClick)) {\n\t\t\t\tif (!shouldStartEditingFromClick) return\n\t\t\t} else {\n\t\t\t\tif (!shouldStartEditingFromClick(event.target)) return\n\t\t\t}\n\n\t\t\tonStartEditing(cell)\n\t\t},\n\t\t[cell, isEditable, onStartEditing, shouldStartEditingFromClick, stopPressTracking],\n\t)\n\n\treturn {\n\t\thandleMouseDown,\n\t\thandleClick,\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { getColorControlPropValue, getLinkControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { useTitleForLink } from \"document/utils/useTitleForLink.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport {\n\tColorCellValue,\n\tGalleryArrayCellValue,\n\tImageCellValue,\n\tTextCellValue,\n\tVectorSetItemCellValue,\n\tVectorSetItemCellValueContent,\n\tuseVectorSetItemPreviewData,\n} from \"./TableCellPreviews.tsx\"\nimport {\n\tgetAccessibleLabelForCell,\n\tgetCollectionItemTableColumnTitle,\n} from \"./VirtualCollectionItemTable.cellTextValue.ts\"\nimport {\n\ttype EditingCommitAction,\n\ttype VirtualCollectionItemTableEditingSession,\n\tisPopoutEditingSession,\n} from \"./VirtualCollectionItemTable.editingTypes.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport { VirtualCollectionItemTableBodyCellEditor } from \"./VirtualCollectionItemTableBodyCellEditor.tsx\"\nimport { VirtualCollectionItemTableBodyCellFrame } from \"./VirtualCollectionItemTableBodyCellFrame.tsx\"\nimport { useVirtualCollectionItemTableClickToEditCell } from \"./useVirtualCollectionItemTableClickToEditCell.ts\"\nimport { isGalleryControl } from \"./utils/arrayGalleryUtils.ts\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\n\ntype PopoutCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<\n\t\tCollectionItemTableColumn[\"control\"],\n\t\t{\n\t\t\ttype:\n\t\t\t\t| ControlType.Color\n\t\t\t\t| ControlType.Image\n\t\t\t\t| ControlType.ResponsiveImage\n\t\t\t\t| ControlType.Array\n\t\t\t\t| ControlType.VectorSetItem\n\t\t\t\t| ControlType.Link\n\t\t}\n\t>\n}\n\ntype VectorSetItemPopoutCollectionItemTableColumn = CollectionItemTableColumn & {\n\tcontrol: Extract<CollectionItemTableColumn[\"control\"], { type: ControlType.VectorSetItem }>\n}\n\nexport function isPopoutColumn(column: CollectionItemTableColumn): column is PopoutCollectionItemTableColumn {\n\treturn (\n\t\tcolumn.control.type === ControlType.Color ||\n\t\tcolumn.control.type === ControlType.Image ||\n\t\tcolumn.control.type === ControlType.ResponsiveImage ||\n\t\t(column.control.type === ControlType.Array && isGalleryControl(column.control)) ||\n\t\tcolumn.control.type === ControlType.VectorSetItem ||\n\t\tcolumn.control.type === ControlType.Link\n\t)\n}\n\nfunction isPopoutHitboxTarget(target: EventTarget | null): boolean {\n\treturn target instanceof HTMLElement && target.closest(\"[data-popout-hitbox]\") !== null\n}\n\nfunction getPopoutBodyCellContent({\n\tcolumn,\n\titem,\n\tisSelected,\n\tcolumnWidth,\n}: {\n\tcolumn: PopoutCollectionItemTableColumn\n\titem: CollectionItemNode\n\tisSelected: boolean\n\tcolumnWidth: number\n}): React.ReactNode {\n\tswitch (column.control.type) {\n\t\tcase ControlType.Color: {\n\t\t\tconst controlProp = column.getControlProp(item)\n\t\t\tconst value = getColorControlPropValue(column.control, controlProp)\n\t\t\tassert(!isDynamicValue(value), \"Dynamic values are not supported within the CMS.\")\n\t\t\treturn <ColorCellValue value={isString(value) ? value : \"transparent\"} size=\"default\" />\n\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\treturn <ImageCellValue control={column.control} rawControlProp={column.getControlProp(item)} size=\"default\" />\n\t\t}\n\t\tcase ControlType.Array:\n\t\t\treturn (\n\t\t\t\t<GalleryArrayCellValue\n\t\t\t\t\tcontrol={column.control}\n\t\t\t\t\tcontrolProp={column.getControlProp(item)}\n\t\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn (\n\t\t\t\t<VectorSetItemCellValue\n\t\t\t\t\tcontrol={column.control}\n\t\t\t\t\tcontrolProp={column.getControlProp(item)}\n\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase ControlType.Link: {\n\t\t\tconst value = getLinkControlPropValue(column.control, column.getControlProp(item))\n\t\t\tassert(!isDynamicValue(value), \"Dynamic values are not supported within the CMS.\")\n\t\t\treturn <LinkPopoutCellValue value={value} />\n\t\t}\n\t}\n}\n\nfunction LinkPopoutCellValue({ value }: { value: ReturnType<typeof getLinkControlPropValue> }) {\n\tconst engine = useBaseEngine()\n\tconst textValue = useTitleForLink(engine, value, \"\")\n\n\treturn <TextCellValue value={textValue} />\n}\n\ninterface VirtualCollectionItemTablePopoutBodyCellProps {\n\tcollectionNodeId: NodeID\n\titem: CollectionItemNode\n\tcolumn: PopoutCollectionItemTableColumn\n\tcolumnWidth: number\n\tdataIsViewOnly: boolean\n\tcellKey: string\n\tclassName: string\n\tisSelected: boolean\n\tisSelectionAnchor: boolean\n\teditingSession: VirtualCollectionItemTableEditingSession | null\n\toverlayButton: React.ReactNode\n\tonBeginDragSelection: (cell: CellIdentifier, shiftKey: boolean) => void\n\tonMouseEnter: React.MouseEventHandler<HTMLDivElement>\n\tonStartEditing: (cell: CellIdentifier) => void\n\tonEditingValueChange: (cell: CellIdentifier, value: string) => void\n\tonFinishEditing: () => void\n\tonCommitEditing: (command: EditingCommitAction) => void\n\tonContextMenu: React.MouseEventHandler<HTMLDivElement>\n}\n\ntype VectorSetItemPopoutBodyCellProps = Omit<VirtualCollectionItemTablePopoutBodyCellProps, \"column\"> & {\n\tcolumn: VectorSetItemPopoutCollectionItemTableColumn\n}\n\nfunction isVectorSetItemPopoutBodyCellProps(\n\tprops: VirtualCollectionItemTablePopoutBodyCellProps,\n): props is VectorSetItemPopoutBodyCellProps {\n\treturn props.column.control.type === ControlType.VectorSetItem\n}\n\nfunction VirtualCollectionItemTablePopoutBodyCellLayout({\n\tcollectionNodeId,\n\titem,\n\tcolumn,\n\tcolumnWidth,\n\tdataIsViewOnly,\n\tcellKey,\n\tclassName,\n\tariaLabel,\n\tisSelected,\n\tisSelectionAnchor,\n\teditingSession,\n\toverlayButton,\n\tonBeginDragSelection,\n\tonMouseEnter,\n\tonStartEditing,\n\tonEditingValueChange,\n\tonFinishEditing,\n\tonCommitEditing,\n\tonContextMenu,\n\tchildren,\n}: VirtualCollectionItemTablePopoutBodyCellProps & { ariaLabel: string; children: React.ReactNode }) {\n\tconst rowId = item.id\n\tconst columnId = column.key\n\tconst cell: CellIdentifier = { rowId, columnId }\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\tconst usesTextPreviewLayout =\n\t\tcolumn.control.type === ControlType.Link || column.control.type === ControlType.VectorSetItem\n\tconst opensEditorOnSingleClick =\n\t\tcolumn.control.type !== ControlType.Link && column.control.type !== ControlType.VectorSetItem\n\n\tconst shouldStartEditingFromClick = useCallback(\n\t\t(target: EventTarget | null) => {\n\t\t\treturn opensEditorOnSingleClick && isPopoutHitboxTarget(target)\n\t\t},\n\t\t[opensEditorOnSingleClick],\n\t)\n\n\tconst { handleMouseDown, handleClick } = useVirtualCollectionItemTableClickToEditCell({\n\t\tcell,\n\t\tisEditable: !isCellValueReadOnly,\n\t\tisSelectionAnchor,\n\t\tonBeginDragSelection,\n\t\tonStartEditing,\n\t\tshouldStartEditingFromClick,\n\t})\n\n\treturn (\n\t\t<VirtualCollectionItemTableBodyCellFrame\n\t\t\tclassName={cx(className, isPopoutEditingSession(editingSession) && styles.bodyCellEditingPopout)}\n\t\t\tariaLabel={ariaLabel}\n\t\t\tisSelected={isSelected}\n\t\t\tcellKey={cellKey}\n\t\t\trowId={rowId}\n\t\t\tcolumnId={columnId}\n\t\t\toverlayButton={overlayButton}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonClick={handleClick}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t{editingSession ? (\n\t\t\t\t<VirtualCollectionItemTableBodyCellEditor\n\t\t\t\t\tcollectionNodeId={collectionNodeId}\n\t\t\t\t\titem={item}\n\t\t\t\t\tcell={cell}\n\t\t\t\t\tcolumn={column}\n\t\t\t\t\tcolumnWidth={columnWidth}\n\t\t\t\t\teditingSession={editingSession}\n\t\t\t\t\tonChange={onEditingValueChange}\n\t\t\t\t\tonDismiss={onFinishEditing}\n\t\t\t\t\tonCommit={onCommitEditing}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div\n\t\t\t\t\tdata-popout-hitbox\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.bodyCellPreviewHitbox,\n\t\t\t\t\t\tusesTextPreviewLayout && styles.bodyCellTextPreviewHitbox,\n\t\t\t\t\t\tisCellValueReadOnly && styles.readOnlyContent,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</VirtualCollectionItemTableBodyCellFrame>\n\t)\n}\n\nfunction VectorSetItemPopoutBodyCell(props: VectorSetItemPopoutBodyCellProps) {\n\tconst { column, item, isSelected, dataIsViewOnly } = props\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\tconst controlProp = column.getControlProp(item)\n\tconst { identifier, thumbnail, title } = useVectorSetItemPreviewData({\n\t\tcontrol: column.control,\n\t\tcontrolProp,\n\t})\n\tconst columnTitle = getCollectionItemTableColumnTitle(column)\n\tconst ariaLabel = title ? `${columnTitle}: ${title}` : columnTitle\n\n\treturn (\n\t\t<VirtualCollectionItemTablePopoutBodyCellLayout {...props} ariaLabel={ariaLabel}>\n\t\t\t<VectorSetItemCellValueContent\n\t\t\t\tidentifier={identifier}\n\t\t\t\tthumbnail={thumbnail}\n\t\t\t\ttitle={title}\n\t\t\t\tisSelected={isSelected && !isCellValueReadOnly}\n\t\t\t/>\n\t\t</VirtualCollectionItemTablePopoutBodyCellLayout>\n\t)\n}\n\nexport const VirtualCollectionItemTablePopoutBodyCell = React.memo(function VirtualCollectionItemTablePopoutBodyCell(\n\tprops: VirtualCollectionItemTablePopoutBodyCellProps,\n) {\n\tconst { item, column, isSelected, dataIsViewOnly, columnWidth } = props\n\tconst isCellValueReadOnly = !column.isValueEditable || dataIsViewOnly\n\n\tif (isVectorSetItemPopoutBodyCellProps(props)) {\n\t\treturn <VectorSetItemPopoutBodyCell {...props} />\n\t}\n\n\treturn (\n\t\t<VirtualCollectionItemTablePopoutBodyCellLayout {...props} ariaLabel={getAccessibleLabelForCell(column, item)}>\n\t\t\t{getPopoutBodyCellContent({\n\t\t\t\tcolumn,\n\t\t\t\titem,\n\t\t\t\tisSelected: isSelected && !isCellValueReadOnly,\n\t\t\t\tcolumnWidth,\n\t\t\t})}\n\t\t</VirtualCollectionItemTablePopoutBodyCellLayout>\n\t)\n})\n", "import { preventDefaultAndStopPropagation } from \"@framerjs/app-shared\"\nimport { IconArrowDownSmall } from \"@framerjs/fresco\"\nimport { TruncateWithEllipsisAndTitle } from \"@framerjs/fresco/components/TruncateWithEllipsisAndTitle\"\nimport { cx } from \"@linaria/core\"\nimport type { SortingOrder } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport type React from \"react\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\n\ninterface VirtualCollectionItemTableColumnHeaderCellProps {\n\ttitle: string\n\tisSorted: boolean\n\tsortingOrder: SortingOrder | undefined\n\tisActive: boolean\n\tisReadOnly: boolean\n\tonMouseDown?: React.MouseEventHandler<HTMLDivElement>\n\tonContextMenu?: React.MouseEventHandler<HTMLDivElement>\n\tonResizeHandleMouseDown?: React.MouseEventHandler<HTMLButtonElement>\n\tresizeCursor?: React.CSSProperties[\"cursor\"]\n}\n\nexport function VirtualCollectionItemTableColumnHeaderCell({\n\ttitle,\n\tisSorted,\n\tsortingOrder,\n\tisActive,\n\tisReadOnly,\n\tonMouseDown,\n\tonContextMenu,\n\tonResizeHandleMouseDown,\n\tresizeCursor,\n}: VirtualCollectionItemTableColumnHeaderCellProps) {\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(styles.columnHeaderCell, isActive && styles.columnHeaderCellActive)}\n\t\t\t// biome-ignore lint/a11y/useSemanticElements: Header cells are divs to support virtualization and drag overlays.\n\t\t\trole=\"columnheader\"\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tonContextMenu={onContextMenu}\n\t\t>\n\t\t\t<div className={styles.columnHeaderCellInner}>\n\t\t\t\t{isSorted && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.columnHeaderSortIcon,\n\t\t\t\t\t\t\tsortingOrder === \"ascending\" && styles.columnHeaderSortIconFlipped,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-hidden={true}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconArrowDownSmall />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<TruncateWithEllipsisAndTitle className={cx(isReadOnly && styles.readOnlyContent)}>\n\t\t\t\t\t{title}\n\t\t\t\t</TruncateWithEllipsisAndTitle>\n\t\t\t</div>\n\t\t\t{onResizeHandleMouseDown && (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName={styles.columnHeaderResizeHandle}\n\t\t\t\t\tstyle={{ cursor: resizeCursor }}\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tonMouseDown={onResizeHandleMouseDown}\n\t\t\t\t\tonContextMenu={preventDefaultAndStopPropagation}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\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 type { CollectionSortingRules, SortingOrder } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport { getCollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionSortingRules.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { controlPropSupportsSorting } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { VirtualCollectionItemTableColumnHeaderCell } from \"./VirtualCollectionItemTableColumnHeaderCell.tsx\"\nimport { generateVariablePanelPopoutId } from \"./utils/collectionFieldPopoutId.ts\"\nimport type { CollectionItemTableColumn } from \"./utils/collectionItemTableColumns.ts\"\nimport {\n\tgetCollectionSortingRulesFromStorage,\n\tgetCollectionItemTableHeaderSortRules,\n\tgetCollectionItemTableSingleSortUpdate,\n\tgetCollectionItemTableSortLabel,\n\tlocalStorageSortingRulesKey,\n\tupdateCollectionSortingRulesByCollection,\n} from \"./utils/collectionItemTableSorting.ts\"\nimport { isEditFieldsUseableInScreen } from \"./utils/screenFeatureUtils.ts\"\nimport {\n\tgetForcedVisibleVariableId,\n\tgetStoredFieldVisibilityByCollection,\n} from \"./utils/useCollectionFieldVisibility.ts\"\nimport { useCollectionVariablesAreViewOnly } from \"./utils/useCollectionIsViewOnly.ts\"\n\nconst columnHeaderPrimaryActionDragThreshold = 4\n\ninterface VirtualCollectionItemTableInteractiveColumnHeaderCellProps {\n\tcollectionNodeId: NodeID\n\tactiveSortingRules: CollectionSortingRules\n\tmultiSortEnabled: boolean\n\tcolumn: CollectionItemTableColumn\n\tcolumnIndex: number\n\tcolumnWidth: number\n\tresizeCursor: React.CSSProperties[\"cursor\"]\n\tdataIsViewOnly: boolean\n\tcolumnReorderingEnabled: boolean\n\tisDragInteractionInProgress: boolean\n\tisDraggedColumn: boolean\n\ttableContainerRef: React.RefObject<HTMLDivElement | null>\n\ttoggleVisibility: (columnKey: string) => void\n\tclearCellSelectionForRowSelection: () => void\n\tstartColumnReorderDrag: (options: {\n\t\tcolumnId: string\n\t\tcolumnIndex: number\n\t\tclientX: number\n\t\tpreviewLeft: number\n\t\tcolumnWidth: number\n\t}) => void\n\tstartColumnResize: (options: { columnId: string; columnIndex: number; clientX: number }) => void\n}\n\nexport function VirtualCollectionItemTableInteractiveColumnHeaderCell({\n\tcollectionNodeId,\n\tactiveSortingRules,\n\tmultiSortEnabled,\n\tcolumn,\n\tcolumnIndex,\n\tcolumnWidth,\n\tresizeCursor,\n\tdataIsViewOnly,\n\tcolumnReorderingEnabled,\n\tisDragInteractionInProgress,\n\tisDraggedColumn,\n\ttableContainerRef,\n\ttoggleVisibility,\n\tclearCellSelectionForRowSelection,\n\tstartColumnReorderDrag,\n\tstartColumnResize,\n}: VirtualCollectionItemTableInteractiveColumnHeaderCellProps) {\n\tconst [menuOpen, setMenuOpen] = useState(false)\n\tconst [, setLocalSortingRulesByCollection] = useLocalStorage<unknown>(localStorageSortingRulesKey, null)\n\tconst pendingPrimaryActionAbortControllerRef = useRef<AbortController | null>(null)\n\tconst contentIsViewOnly = useIsViewOnly(\"canEditContent\")\n\tconst allowRichTextTableColumns = useExperimentIsOn(\"cmsRichTextCollectionTable\")\n\tconst variablesAreViewOnly = useCollectionVariablesAreViewOnly(collectionNodeId)\n\tconst title = column.control.title ?? `Column ${columnIndex + 1}`\n\tconst sortingOrder = activeSortingRules.find(sortingRule => sortingRule.by === column.key)?.order\n\tconst isSorted = sortingOrder !== undefined\n\n\tconst variableModalActive = engine.stores.modalStore.useState(state => state.active.type === ModalType.Variables)\n\tconst selectedVariableId = engine.stores.variablesStore.useState(state => state.selectedVariablePath?.at(0) ?? null)\n\tconst isFieldBeingEdited = variableModalActive && selectedVariableId === column.key\n\n\tconst sortCollectionItemsByField = useEngineCallback(\n\t\t(fieldKey: string, order: SortingOrder) => {\n\t\t\tconst collection = engine.tree.getNodeWithTrait(collectionNodeId, isCollectionNode)\n\t\t\tassert(collection, \"Collection should still exist when sorting its items\")\n\n\t\t\tif (multiSortEnabled) {\n\t\t\t\tconst nextSortingRules = getCollectionItemTableHeaderSortRules(activeSortingRules, fieldKey, order)\n\t\t\t\tconst treeSortingRules = getCollectionSortingRules(collection.sorting, collection.sortingRules)\n\n\t\t\t\tsetLocalSortingRulesByCollection((previous: unknown) => {\n\t\t\t\t\tconst previousSortingRulesByCollection = getCollectionSortingRulesFromStorage(previous)\n\t\t\t\t\treturn updateCollectionSortingRulesByCollection(\n\t\t\t\t\t\tpreviousSortingRulesByCollection,\n\t\t\t\t\t\tcollectionNodeId,\n\t\t\t\t\t\tnextSortingRules,\n\t\t\t\t\t\ttreeSortingRules,\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcollection.set(getCollectionItemTableSingleSortUpdate(collection, fieldKey, order))\n\t\t},\n\t\t[activeSortingRules, collectionNodeId, multiSortEnabled, setLocalSortingRulesByCollection],\n\t)\n\n\tconst clearPendingPrimaryAction = useCallback(() => {\n\t\tpendingPrimaryActionAbortControllerRef.current?.abort()\n\t\tpendingPrimaryActionAbortControllerRef.current = null\n\t}, [])\n\n\tuseEffect(() => {\n\t\treturn clearPendingPrimaryAction\n\t}, [clearPendingPrimaryAction])\n\n\tconst showContextMenu = useCallback(\n\t\t(location: { x: number; y: number }) => {\n\t\t\tconst collectionNode = engine.tree.getNodeWithTrait(collectionNodeId, isCollectionNode)\n\t\t\tif (!collectionNode) return\n\n\t\t\tconst fieldVisibilityByCollection = getStoredFieldVisibilityByCollection()\n\t\t\tconst forcedVisibleVariableId = getForcedVisibleVariableId({\n\t\t\t\tpropertyControls: collectionNode.getPropertyControls(engine.tree, engine.componentLoader),\n\t\t\t\tvisibilityByField: fieldVisibilityByCollection?.[collectionNode.id],\n\t\t\t\tallowRichTextTableColumns,\n\t\t\t})\n\t\t\tconst currentOrder = activeSortingRules.find(sortingRule => sortingRule.by === column.key)?.order ?? \"mixed\"\n\t\t\tconst sortingEnabled = !contentIsViewOnly\n\t\t\tconst menuItems: MenuItemOptions[] = []\n\n\t\t\tif (column.isFieldEditable && isEditFieldsUseableInScreen()) {\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: variablesAreViewOnly ? \"View Field\" : \"Edit Field\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tid: \"edit_collection_variables\",\n\t\t\t\t\t\t\tpage: \"collection_table_header\",\n\t\t\t\t\t\t})\n\t\t\t\t\t\tengine.stores.variablesStore.selectedVariablePath = [column.key]\n\t\t\t\t\t\tengine.stores.chromeStore.activeCollectionPanelTab = CollectionPanelTab.Fields\n\t\t\t\t\t\tconst popoutId = generateVariablePanelPopoutId(column.key)\n\t\t\t\t\t\tengine.floatingWindowPopoutNavigation?.presentPopout(popoutId)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (column.supportsSorting && controlPropSupportsSorting(column.control.type)) {\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: \"Sort by\",\n\t\t\t\t\tsubmenu: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: getCollectionItemTableSortLabel(\"ascending\", column.control.type, column.key),\n\t\t\t\t\t\t\tenabled: sortingEnabled,\n\t\t\t\t\t\t\tchecked: currentOrder === \"ascending\",\n\t\t\t\t\t\t\tclick: () => sortCollectionItemsByField(column.key, \"ascending\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: getCollectionItemTableSortLabel(\"descending\", column.control.type, column.key),\n\t\t\t\t\t\t\tenabled: sortingEnabled,\n\t\t\t\t\t\t\tchecked: currentOrder === \"descending\",\n\t\t\t\t\t\t\tclick: () => sortCollectionItemsByField(column.key, \"descending\"),\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\tmenuItems.push({\n\t\t\t\tlabel: Dictionary.Hide,\n\t\t\t\tenabled: column.key !== forcedVisibleVariableId,\n\t\t\t\tclick: () => toggleVisibility(column.key),\n\t\t\t})\n\n\t\t\tsetMenuOpen(true)\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation,\n\t\t\t\tonDone: () => setMenuOpen(false),\n\t\t\t})\n\t\t},\n\t\t[\n\t\t\tactiveSortingRules,\n\t\t\tallowRichTextTableColumns,\n\t\t\tcollectionNodeId,\n\t\t\tcolumn,\n\t\t\tcontentIsViewOnly,\n\t\t\tsortCollectionItemsByField,\n\t\t\ttoggleVisibility,\n\t\t\tvariablesAreViewOnly,\n\t\t],\n\t)\n\n\tconst handleMouseDown = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (event.button !== 0 || event.ctrlKey) return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\tclearPendingPrimaryAction()\n\n\t\t\tconst startClientX = event.clientX\n\t\t\tconst startClientY = event.clientY\n\t\t\tconst tableContainerBounds = tableContainerRef.current?.getBoundingClientRect()\n\t\t\tconst headerBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tconst previewLeft = tableContainerBounds ? headerBounds.left - tableContainerBounds.left : 0\n\t\t\tlet didStartColumnReorder = false\n\t\t\tconst controller = new AbortController()\n\t\t\tpendingPrimaryActionAbortControllerRef.current = controller\n\n\t\t\tconst beginColumnReorder = (clientX: number) => {\n\t\t\t\tif (!columnReorderingEnabled) return\n\t\t\t\tif (isDragInteractionInProgress) return\n\t\t\t\tif (!tableContainerBounds) return\n\t\t\t\tif (didStartColumnReorder) return\n\n\t\t\t\tdidStartColumnReorder = true\n\n\t\t\t\tstartColumnReorderDrag({\n\t\t\t\t\tcolumnId: column.key,\n\t\t\t\t\tcolumnIndex,\n\t\t\t\t\tclientX,\n\t\t\t\t\tpreviewLeft,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t})\n\t\t\t\tclearCellSelectionForRowSelection()\n\t\t\t}\n\n\t\t\tconst handleWindowPointerMove = (moveEvent: PointerEvent) => {\n\t\t\t\tconst deltaX = Math.abs(moveEvent.clientX - startClientX)\n\t\t\t\tconst deltaY = Math.abs(moveEvent.clientY - startClientY)\n\t\t\t\tif (deltaX < columnHeaderPrimaryActionDragThreshold && deltaY < columnHeaderPrimaryActionDragThreshold) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tbeginColumnReorder(moveEvent.clientX)\n\t\t\t}\n\n\t\t\tconst handleWindowPointerUp = (upEvent: PointerEvent) => {\n\t\t\t\tclearPendingPrimaryAction()\n\t\t\t\tif (didStartColumnReorder) return\n\t\t\t\tshowContextMenu({ x: upEvent.clientX, y: upEvent.clientY })\n\t\t\t}\n\n\t\t\tconst handleWindowPointerCancel = () => {\n\t\t\t\tclearPendingPrimaryAction()\n\t\t\t}\n\n\t\t\twindow.addEventListener(\"pointermove\", handleWindowPointerMove, {\n\t\t\t\tcapture: true,\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\twindow.addEventListener(\"pointerup\", handleWindowPointerUp, {\n\t\t\t\tcapture: true,\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\twindow.addEventListener(\"pointercancel\", handleWindowPointerCancel, {\n\t\t\t\tcapture: true,\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\twindow.addEventListener(\"blur\", handleWindowPointerCancel, {\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t},\n\t\t[\n\t\t\tclearCellSelectionForRowSelection,\n\t\t\tclearPendingPrimaryAction,\n\t\t\tcolumn,\n\t\t\tcolumnIndex,\n\t\t\tcolumnReorderingEnabled,\n\t\t\tcolumnWidth,\n\t\t\tisDragInteractionInProgress,\n\t\t\tshowContextMenu,\n\t\t\tstartColumnReorderDrag,\n\t\t\ttableContainerRef,\n\t\t],\n\t)\n\n\tconst handleContextMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tclearPendingPrimaryAction()\n\t\t\tshowContextMenu({ x: event.clientX, y: event.clientY })\n\t\t},\n\t\t[clearPendingPrimaryAction, showContextMenu],\n\t)\n\n\tconst handleResizeHandleMouseDown = useCallback(\n\t\t(event: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (event.button !== 0) return\n\t\t\tif (isDragInteractionInProgress) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tclearPendingPrimaryAction()\n\n\t\t\tstartColumnResize({\n\t\t\t\tcolumnId: column.key,\n\t\t\t\tcolumnIndex,\n\t\t\t\tclientX: event.clientX,\n\t\t\t})\n\t\t},\n\t\t[clearPendingPrimaryAction, column.key, columnIndex, isDragInteractionInProgress, startColumnResize],\n\t)\n\n\treturn (\n\t\t<VirtualCollectionItemTableColumnHeaderCell\n\t\t\ttitle={title}\n\t\t\tisSorted={isSorted}\n\t\t\tsortingOrder={sortingOrder}\n\t\t\tisActive={isDraggedColumn || isFieldBeingEdited || menuOpen}\n\t\t\tisReadOnly={!column.isValueEditable || dataIsViewOnly}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t\tonResizeHandleMouseDown={handleResizeHandleMouseDown}\n\t\t\tresizeCursor={resizeCursor}\n\t\t/>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tCollectionSortingRule,\n\tCollectionSortingRules,\n\tSortingOrder,\n} from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport { getCollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionSortingRules.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\n\nexport const localStorageSortingRulesKey = \"cmsSortingRules\"\n\nexport type CollectionSortingRulesByCollection = Record<NodeID, CollectionSortingRules | undefined>\n\nconst allSortingRules = Object.freeze({\n\tascending: true,\n\tdescending: true,\n} as const satisfies Record<SortingOrder, true>)\n\nfunction isSortingOrder(value: unknown): value is SortingOrder {\n\treturn isString(value) && Object.hasOwn(allSortingRules, value)\n}\n\nfunction isSortingRule(value: unknown): value is CollectionSortingRule {\n\tif (!isObject(value)) return false\n\n\treturn isString(value.id) && isString(value.by) && isSortingOrder(value.order)\n}\n\nexport function getCollectionSortingRulesFromStorage(value: unknown): CollectionSortingRulesByCollection {\n\tif (!isObject(value)) return {}\n\n\tconst sortingRulesByCollection: CollectionSortingRulesByCollection = {}\n\n\tfor (const [collectionId, sortingRules] of Object.entries(value)) {\n\t\tconst validSortingRules = getValidCollectionSortingRules(sortingRules)\n\t\tif (validSortingRules === undefined) continue\n\n\t\tsortingRulesByCollection[collectionId] = validSortingRules\n\t}\n\n\treturn sortingRulesByCollection\n}\n\nfunction getValidCollectionSortingRules(value: unknown): CollectionSortingRules | undefined {\n\tif (!isArray(value)) return undefined\n\tif (!value.every(isSortingRule)) return undefined\n\n\treturn value.map(({ id, by, order }) => ({ id, by, order }))\n}\n\nexport function updateCollectionSortingRulesByCollection(\n\tsortingRulesByCollection: CollectionSortingRulesByCollection,\n\tcollectionId: NodeID,\n\tlocalSortingRules: CollectionSortingRules,\n\tcollectionSortingRules: CollectionSortingRules,\n): CollectionSortingRulesByCollection {\n\tif (isCollectionSortingRulesEqual(localSortingRules, collectionSortingRules)) {\n\t\tconst { [collectionId]: _removedSortingRules, ...remainingSortingRulesByCollection } = sortingRulesByCollection\n\t\treturn remainingSortingRulesByCollection\n\t}\n\n\treturn {\n\t\t...sortingRulesByCollection,\n\t\t[collectionId]: localSortingRules,\n\t}\n}\n\nexport function isCollectionSortingRulesEqual(\n\tleftRules: CollectionSortingRules,\n\trightRules: CollectionSortingRules,\n): boolean {\n\tif (leftRules.length !== rightRules.length) return false\n\n\t// Rule order is significant because earlier rules have higher sort priority.\n\tfor (const [index, leftRule] of leftRules.entries()) {\n\t\tconst rightRule = rightRules[index]\n\t\tif (!rightRule) return false\n\t\tif (leftRule.by !== rightRule.by || leftRule.order !== rightRule.order) return false\n\t}\n\n\treturn true\n}\n\nexport function getCollectionItemTableHeaderSortRules(\n\tactiveSortingRules: CollectionSortingRules,\n\tfieldKey: string,\n\torder: SortingOrder,\n): CollectionSortingRules {\n\tconst existingSortingRule = activeSortingRules.find(sortingRule => sortingRule.by === fieldKey)\n\tif (!existingSortingRule) {\n\t\treturn [{ id: randomID(), by: fieldKey, order }]\n\t}\n\n\treturn activeSortingRules.map((sortingRule): CollectionSortingRule => {\n\t\tif (sortingRule.by !== fieldKey) return sortingRule\n\t\treturn { ...sortingRule, order }\n\t})\n}\n\nexport function getCollectionItemTableSingleSortUpdate(\n\tcollection: Pick<CollectionNode, \"sorting\" | \"sortingRules\">,\n\tfieldKey: string,\n\torder: SortingOrder,\n): Partial<CollectionNode> {\n\tconst activeSortingRules = getCollectionSortingRules(collection.sorting, collection.sortingRules)\n\tconst shouldRemoveSorting = activeSortingRules.some(\n\t\tsortingRule => sortingRule.by === fieldKey && sortingRule.order === order,\n\t)\n\tconst sorting = shouldRemoveSorting ? undefined : { by: fieldKey, order }\n\treturn { sorting, sortingRules: undefined }\n}\n\nexport function getCollectionItemTableSortLabel(\n\torder: SortingOrder,\n\tcontrolType: ControlType,\n\tfieldKey: string,\n): string {\n\tif (fieldKey === collectionItemTableStatusColumnKey) {\n\t\treturn order === \"ascending\"\n\t\t\t? `${Dictionary.Draft} \u2192 ${Dictionary.Live}`\n\t\t\t: `${Dictionary.Live} \u2192 ${Dictionary.Draft}`\n\t}\n\n\tswitch (controlType) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn order === \"ascending\" ? Dictionary.AscendingBoolean : Dictionary.DescendingBoolean\n\t\tcase ControlType.String:\n\t\t\treturn order === \"ascending\" ? Dictionary.AscendingString : Dictionary.DescendingString\n\t\tcase ControlType.Number:\n\t\t\treturn order === \"ascending\" ? Dictionary.AscendingNumber : Dictionary.DescendingNumber\n\t\tcase ControlType.Date:\n\t\t\treturn order === \"ascending\" ? Dictionary.AscendingDate : Dictionary.DescendingDate\n\t\tdefault:\n\t\t\treturn order === \"ascending\" ? Dictionary.Ascending : Dictionary.Descending\n\t}\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionItemNode, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionPropertyControls } from \"document/models/CanvasTree/nodes/CollectionNodeCache.ts\"\nimport {\n\tfakeCreatedAtVariable,\n\tfakeUpdatedAtVariable,\n} from \"document/models/CanvasTree/nodes/utils/collectionAutoGeneratedVariables.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport type {\n\tDateVariableDefinition,\n\tVariableDefinition,\n\tVariableID,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useEffect, useMemo } from \"react\"\nimport { getLocalStorageValue, useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport type { CollectionItemTableColumn } from \"./collectionItemTableColumns.ts\"\nimport { isColumnControlDescription } from \"./collectionItemTableColumns.ts\"\nimport { collectionItemTableStatusControl } from \"./collectionItemTableStatusColumn.ts\"\n\nexport const localStorageFieldVisibilityKey = \"cmsFieldVisibility\"\nexport const localStorageFieldOrderKey = \"cmsFieldOrder\"\n\ntype VisibilityByField = Record<VariableID, boolean | undefined>\n\ntype FieldVisibilityByCollection = Record<NodeID, VisibilityByField | undefined>\ntype ColumnOrderByCollection = Record<NodeID, ColumnOrderKey[] | undefined>\ntype ColumnOrderKey = CollectionItemTableColumn[\"key\"]\n\nconst defaultStatusColumnIndex = 1\n\nfunction getColumnOrderWithStatusColumn({\n\tcolumnOrder,\n\tvisibleColumnKeys,\n}: {\n\tcolumnOrder: readonly ColumnOrderKey[]\n\tvisibleColumnKeys: readonly ColumnOrderKey[]\n}): ColumnOrderKey[] {\n\tif (\n\t\tcolumnOrder.includes(collectionItemTableStatusColumnKey) ||\n\t\t!visibleColumnKeys.includes(collectionItemTableStatusColumnKey)\n\t) {\n\t\treturn [...columnOrder]\n\t}\n\n\tconst nextColumnOrder = [...columnOrder]\n\tconst insertIndex = Math.min(nextColumnOrder.length > 0 ? defaultStatusColumnIndex : 0, nextColumnOrder.length)\n\tnextColumnOrder.splice(insertIndex, 0, collectionItemTableStatusColumnKey)\n\treturn nextColumnOrder\n}\n\nexport function getStoredFieldVisibilityByCollection(): FieldVisibilityByCollection | null {\n\treturn getLocalStorageValue<FieldVisibilityByCollection | null>(localStorageFieldVisibilityKey)\n}\n\nfunction useLocalVisibilityByField(collectionId: NodeID) {\n\tconst [fieldVisibility, setFieldVisibility] = useLocalStorage<FieldVisibilityByCollection | null>(\n\t\tlocalStorageFieldVisibilityKey,\n\t\tnull,\n\t)\n\n\tconst setLocalVisibilityByField = useCallback(\n\t\t(update: (prevVisibilityByField: VisibilityByField) => VisibilityByField) =>\n\t\t\tsetFieldVisibility(previous => ({\n\t\t\t\t...previous,\n\t\t\t\t[collectionId]: update(previous?.[collectionId] ?? {}),\n\t\t\t})),\n\t\t[collectionId, setFieldVisibility],\n\t)\n\n\treturn {\n\t\tlocalVisibilityByField: fieldVisibility?.[collectionId],\n\t\tsetLocalVisibilityByField,\n\t}\n}\n\nfunction useStoredColumnOrder(collectionId: NodeID) {\n\tconst [columnOrderByCollection, setColumnOrderByCollection] = useLocalStorage<ColumnOrderByCollection | null>(\n\t\tlocalStorageFieldOrderKey,\n\t\tnull,\n\t)\n\n\tconst setLocalColumnOrder = useCallback(\n\t\t(update: (previousColumnOrder: readonly ColumnOrderKey[]) => ColumnOrderKey[]) =>\n\t\t\tsetColumnOrderByCollection(previous => ({\n\t\t\t\t...previous,\n\t\t\t\t[collectionId]: update(previous?.[collectionId] ?? []),\n\t\t\t})),\n\t\t[collectionId, setColumnOrderByCollection],\n\t)\n\n\treturn {\n\t\tlocalColumnOrder: columnOrderByCollection?.[collectionId],\n\t\tsetLocalColumnOrder,\n\t}\n}\n\nfunction createTimestampColumn(\n\tvariable: DateVariableDefinition,\n\tgetValue: (item: CollectionItemNode) => string | undefined,\n): CollectionItemTableColumn {\n\treturn {\n\t\tcontrol: {\n\t\t\tdisplayTime: variable.options?.displayTime,\n\t\t\ttitle: variable.name,\n\t\t\ttype: ControlType.Date,\n\t\t},\n\t\tgetControlProp: item => ({\n\t\t\ttype: ControlType.Date,\n\t\t\tvalue: getValue(item),\n\t\t}),\n\t\tisFieldEditable: false,\n\t\tisValueEditable: false,\n\t\tsupportsSorting: true,\n\t\tvariable,\n\t\tkey: variable.id,\n\t}\n}\n\nfunction getVisibleColumnIds(\n\tpropertyControls: CollectionPropertyControls,\n\tvisibilityByField: VisibilityByField | undefined,\n\tallowRichTextTableColumns: boolean,\n): ReadonlySet<VariableID> {\n\tconst visibleColumnIds = new Set<VariableID>()\n\n\t// Add all columns that haven't been explicitly hidden.\n\tfor (const key in propertyControls) {\n\t\tconst control = propertyControls[key]\n\t\tif (!control || !isColumnControlDescription(control, allowRichTextTableColumns)) continue\n\n\t\tif (visibilityByField?.[key] !== false) {\n\t\t\tvisibleColumnIds.add(key)\n\t\t}\n\t}\n\n\t// If the user hasn't explicitly opted out of Created / Edited, add them.\n\tif (visibilityByField?.[fakeCreatedAtVariable.id] !== false) {\n\t\tvisibleColumnIds.add(fakeCreatedAtVariable.id)\n\t}\n\tif (visibilityByField?.[fakeUpdatedAtVariable.id] !== false) {\n\t\tvisibleColumnIds.add(fakeUpdatedAtVariable.id)\n\t}\n\tif (visibilityByField?.[collectionItemTableStatusColumnKey] !== false) {\n\t\tvisibleColumnIds.add(collectionItemTableStatusColumnKey)\n\t}\n\n\treturn visibleColumnIds\n}\n\nexport function getForcedVisibleVariableId({\n\tpropertyControls,\n\tvisibilityByField,\n\tallowRichTextTableColumns,\n}: {\n\tpropertyControls: CollectionPropertyControls\n\tvisibilityByField: VisibilityByField | undefined\n\tallowRichTextTableColumns: boolean\n}): VariableID | null {\n\tconst visibleColumnIds = getVisibleColumnIds(propertyControls, visibilityByField, allowRichTextTableColumns)\n\tlet firstControlId: VariableID | null = null\n\tlet firstVisibleControlId: VariableID | null = null\n\n\tfor (const id in propertyControls) {\n\t\tconst control = propertyControls[id]\n\t\tif (!control || !isColumnControlDescription(control, allowRichTextTableColumns)) continue\n\t\tif (!firstControlId) {\n\t\t\tfirstControlId = id\n\t\t}\n\n\t\tif (!visibleColumnIds.has(id)) continue\n\n\t\t// We have multiple visible columns, so don't force a column to be visible\n\t\tif (firstVisibleControlId) return null\n\n\t\tfirstVisibleControlId = id\n\t}\n\n\treturn firstVisibleControlId ?? firstControlId\n}\n\nfunction toggleFieldInVisibilityMap({\n\tvisibleColumnIds,\n\tfieldId,\n\tprevVisibilityByField,\n\tpropertyControls,\n\tallowRichTextTableColumns,\n}: {\n\tvisibleColumnIds: ReadonlySet<VariableID>\n\tfieldId: VariableID\n\tprevVisibilityByField: VisibilityByField\n\tpropertyControls: CollectionPropertyControls\n\tallowRichTextTableColumns: boolean\n}): VisibilityByField {\n\tconst nextVisibilityByField = { ...prevVisibilityByField }\n\n\t// Save the auto-generated visible variable IDs\n\tvisibleColumnIds.forEach(visibleFieldId => {\n\t\tnextVisibilityByField[visibleFieldId] = true\n\t})\n\n\t// Explicitly mark non-auto-generated columns as hidden.\n\tfor (const key in propertyControls) {\n\t\tif (!propertyControls[key] || !isColumnControlDescription(propertyControls[key], allowRichTextTableColumns)) {\n\t\t\tcontinue\n\t\t}\n\t\tif (!visibleColumnIds.has(key)) {\n\t\t\tnextVisibilityByField[key] = false\n\t\t}\n\t}\n\n\tnextVisibilityByField[fieldId] = !nextVisibilityByField[fieldId]\n\treturn nextVisibilityByField\n}\n\nexport function useCollectionFieldVisibility(engine: VekterEngine, collection: CollectionNode) {\n\tconst { localVisibilityByField, setLocalVisibilityByField } = useLocalVisibilityByField(collection.id)\n\tconst { localColumnOrder, setLocalColumnOrder } = useStoredColumnOrder(collection.id)\n\tconst isManagedByPlugin = Boolean(collection.managedByPlugin)\n\tconst allowRichTextTableColumns = useExperimentIsOn(\"cmsRichTextCollectionTable\")\n\n\tconst propertyControls = useEngineState(\n\t\t() => collection.getPropertyControls(engine.tree, engine.componentLoader),\n\t\t[collection],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst visibleColumnIds = useMemo(\n\t\t(): ReadonlySet<VariableID> =>\n\t\t\tgetVisibleColumnIds(propertyControls, localVisibilityByField, allowRichTextTableColumns),\n\t\t[allowRichTextTableColumns, localVisibilityByField, propertyControls],\n\t)\n\tconst variablesById = useMemo(() => {\n\t\tconst nextVariablesById = new Map<VariableID, VariableDefinition>()\n\n\t\tfor (const variable of collection.variables) {\n\t\t\tif (!isVariableDefinition(variable)) continue\n\t\t\tnextVariablesById.set(variable.id, variable)\n\t\t}\n\n\t\treturn nextVariablesById\n\t}, [collection.variables])\n\n\t/*\n\t * When a variable is forced-visible, it always shows even if the user has explicitly hidden it.\n\t * This can happen if:\n\t *\n\t * 1. The user has hidden all columns except one. The last one can't be hidden.\n\t * 2. In the situation above, the user deleted the forced-visible field.\n\t *    In that case, the first column field is picked automatically.\n\t */\n\tconst forcedVisibleVariableId: VariableID | null = useMemo(() => {\n\t\treturn getForcedVisibleVariableId({\n\t\t\tpropertyControls,\n\t\t\tvisibilityByField: localVisibilityByField,\n\t\t\tallowRichTextTableColumns,\n\t\t})\n\t}, [allowRichTextTableColumns, localVisibilityByField, propertyControls])\n\n\tconst getVisibility = useCallback(\n\t\t(variableId: VariableID) => variableId === forcedVisibleVariableId || visibleColumnIds.has(variableId),\n\t\t[forcedVisibleVariableId, visibleColumnIds],\n\t)\n\n\tconst unsortedVisibleColumns = useMemo(() => {\n\t\tconst columns: CollectionItemTableColumn[] = []\n\n\t\tif (propertyControls) {\n\t\t\tfor (const key in propertyControls) {\n\t\t\t\tconst control = propertyControls[key]\n\t\t\t\tif (!control || !isColumnControlDescription(control, allowRichTextTableColumns) || !getVisibility(key)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst variable = variablesById.get(key)\n\n\t\t\t\tcolumns.push({\n\t\t\t\t\tcontrol,\n\t\t\t\t\tgetControlProp: item => item.getControlProp(key),\n\t\t\t\t\tisFieldEditable: true,\n\t\t\t\t\tisValueEditable: !isManagedByPlugin || variable?.userEditable === true,\n\t\t\t\t\tsupportsSorting: true,\n\t\t\t\t\tvariable: variable ?? null,\n\t\t\t\t\tkey,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif (getVisibility(collectionItemTableStatusColumnKey)) {\n\t\t\tconst statusColumn: CollectionItemTableColumn = {\n\t\t\t\tcontrol: collectionItemTableStatusControl,\n\t\t\t\tgetControlProp: () => undefined,\n\t\t\t\tisFieldEditable: false,\n\t\t\t\tisValueEditable: !isManagedByPlugin,\n\t\t\t\tsupportsSorting: true,\n\t\t\t\tvariable: null,\n\t\t\t\tkey: collectionItemTableStatusColumnKey,\n\t\t\t}\n\n\t\t\tconst insertIndex = columns.length > 0 ? defaultStatusColumnIndex : 0\n\t\t\tcolumns.splice(insertIndex, 0, statusColumn)\n\t\t}\n\n\t\tif (getVisibility(fakeCreatedAtVariable.id)) {\n\t\t\tcolumns.push(createTimestampColumn(fakeCreatedAtVariable, item => item.createdAt))\n\t\t}\n\t\tif (getVisibility(fakeUpdatedAtVariable.id)) {\n\t\t\tcolumns.push(createTimestampColumn(fakeUpdatedAtVariable, item => item.updatedAt))\n\t\t}\n\n\t\treturn columns\n\t}, [allowRichTextTableColumns, getVisibility, isManagedByPlugin, propertyControls, variablesById])\n\n\tconst visibleColumns = useMemo(() => {\n\t\tif (!localColumnOrder || localColumnOrder.length === 0) {\n\t\t\treturn unsortedVisibleColumns\n\t\t}\n\n\t\tconst columnOrder = getColumnOrderWithStatusColumn({\n\t\t\tcolumnOrder: localColumnOrder,\n\t\t\tvisibleColumnKeys: unsortedVisibleColumns.map(column => column.key),\n\t\t})\n\t\tconst orderByKey = new Map(columnOrder.map((columnKey, index) => [columnKey, index] as const))\n\t\treturn [...unsortedVisibleColumns].sort((leftColumn, rightColumn) => {\n\t\t\tconst leftOrderIndex = orderByKey.get(leftColumn.key)\n\t\t\tconst rightOrderIndex = orderByKey.get(rightColumn.key)\n\t\t\tif (leftOrderIndex === undefined && rightOrderIndex === undefined) return 0\n\t\t\tif (leftOrderIndex === undefined) return 1\n\t\t\tif (rightOrderIndex === undefined) return -1\n\t\t\treturn leftOrderIndex - rightOrderIndex\n\t\t})\n\t}, [localColumnOrder, unsortedVisibleColumns])\n\n\tconst moveVisibleColumn = useCallback(\n\t\t(fromIndex: number, toIndex: number) => {\n\t\t\tsetLocalColumnOrder(() => {\n\t\t\t\tif (visibleColumns.length <= 1) return visibleColumns.map(column => column.key)\n\n\t\t\t\tconst columnKeys = visibleColumns.map(column => column.key)\n\t\t\t\tconst clampedFromIndex = Math.max(0, Math.min(fromIndex, columnKeys.length - 1))\n\t\t\t\tconst clampedToIndex = Math.max(0, Math.min(toIndex, columnKeys.length - 1))\n\t\t\t\tif (clampedFromIndex === clampedToIndex) return columnKeys\n\n\t\t\t\tconst nextColumnKeys = [...columnKeys]\n\t\t\t\tconst movedColumnKey = nextColumnKeys[clampedFromIndex]\n\t\t\t\tif (!movedColumnKey) return columnKeys\n\t\t\t\tnextColumnKeys.splice(clampedFromIndex, 1)\n\t\t\t\tnextColumnKeys.splice(clampedToIndex, 0, movedColumnKey)\n\t\t\t\treturn nextColumnKeys\n\t\t\t})\n\t\t},\n\t\t[setLocalColumnOrder, visibleColumns],\n\t)\n\n\tconst toggleVisibility = useCallback(\n\t\t(fieldId: VariableID) => {\n\t\t\tsetLocalVisibilityByField(prevVisibilityByField =>\n\t\t\t\ttoggleFieldInVisibilityMap({\n\t\t\t\t\tvisibleColumnIds,\n\t\t\t\t\tfieldId,\n\t\t\t\t\tprevVisibilityByField,\n\t\t\t\t\tpropertyControls,\n\t\t\t\t\tallowRichTextTableColumns,\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[allowRichTextTableColumns, propertyControls, setLocalVisibilityByField, visibleColumnIds],\n\t)\n\n\tconst visibilityOptions = useMemo((): MenuItemOptions[] => {\n\t\tconst variables: { key: VariableID; name: string }[] = Object.entries(propertyControls).flatMap(\n\t\t\t([key, control]) => {\n\t\t\t\tif (!control || !isColumnControlDescription(control, allowRichTextTableColumns)) {\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t\tconst variable = variablesById.get(key)\n\t\t\t\tif (!variable) return []\n\t\t\t\treturn [{ key, name: variable.name }]\n\t\t\t},\n\t\t)\n\n\t\tconst insertIndex = Math.min(defaultStatusColumnIndex, variables.length)\n\t\tvariables.splice(insertIndex, 0, { key: collectionItemTableStatusColumnKey, name: Dictionary.Status })\n\n\t\tvariables.push({ key: fakeCreatedAtVariable.id, name: fakeCreatedAtVariable.name })\n\t\tvariables.push({ key: fakeUpdatedAtVariable.id, name: fakeUpdatedAtVariable.name })\n\n\t\treturn variables.map(({ key, name }) => ({\n\t\t\tchecked: getVisibility(key),\n\t\t\tclick: () => toggleVisibility(key),\n\t\t\tenabled: key !== forcedVisibleVariableId,\n\t\t\tlabel: name,\n\t\t\ttype: \"checkbox\",\n\t\t}))\n\t}, [\n\t\tallowRichTextTableColumns,\n\t\tpropertyControls,\n\t\tvariablesById,\n\t\tgetVisibility,\n\t\tforcedVisibleVariableId,\n\t\ttoggleVisibility,\n\t])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: Does this really not need exhaustive deps?\n\tuseEffect(() => {\n\t\tif (!engine.stores.contextMenuStore.menu || engine.scheduler.inRendering) return\n\t\tengine.stores.contextMenuStore.show(visibilityOptions, engine.stores.contextMenuStore.menu.config)\n\t}, [visibilityOptions])\n\n\treturn {\n\t\tforcedVisibleVariableId,\n\t\tmoveVisibleColumn,\n\t\ttoggleVisibility,\n\t\tvisibilityOptions,\n\t\tvisibleColumns,\n\t}\n}\n", "import { CheckBox, IconDragHandle } from \"@framerjs/fresco\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport React, { useCallback } from \"react\"\nimport * as styles from \"./VirtualCollectionItemTable.styles.ts\"\nimport type { RowContextMenuTarget } from \"./VirtualCollectionItemTable.tsx\"\n\ninterface VirtualCollectionItemTableRowHeaderCellProps {\n\trowId: NodeID | undefined\n\trowTitle: string\n\tisSelected: boolean\n\tisHighlighted: boolean\n\tisDraggedRow: boolean\n\trowReorderingEnabled: boolean\n\tcontrolsEnabled: boolean\n\tisDragPreview?: boolean\n\tonRowReorderHandleMouseDown: (rowId: NodeID, event: React.MouseEvent<HTMLButtonElement>) => void\n\tonRowCheckboxClick: (rowId: NodeID, event: React.MouseEvent) => void\n\tonContextMenu: ((target: RowContextMenuTarget, event: React.MouseEvent<HTMLDivElement>) => void) | undefined\n}\n\nexport const VirtualCollectionItemTableRowHeaderCell = React.memo(function VirtualCollectionItemTableRowHeaderCell({\n\trowId,\n\trowTitle,\n\tisSelected,\n\tisHighlighted,\n\tisDraggedRow,\n\trowReorderingEnabled,\n\tcontrolsEnabled,\n\tisDragPreview = false,\n\tonRowReorderHandleMouseDown,\n\tonRowCheckboxClick,\n\tonContextMenu,\n}: VirtualCollectionItemTableRowHeaderCellProps) {\n\tconst handleContextMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (!rowId) return\n\t\t\tonContextMenu?.({ rowId }, event)\n\t\t},\n\t\t[rowId, onContextMenu],\n\t)\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.rowHeaderCell,\n\t\t\t\t(isHighlighted || isSelected) && styles.rowHeaderCellSelected,\n\t\t\t\tisDragPreview && isDraggedRow && styles.rowHeaderCellRowReorderDragged,\n\t\t\t)}\n\t\t\t// biome-ignore lint/a11y/useSemanticElements: Row headers are divs to support virtualization and overlay rendering.\n\t\t\trole=\"rowheader\"\n\t\t\tdata-row-id={rowId}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t>\n\t\t\t{rowId && rowReorderingEnabled && (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclassName={cx(styles.rowHeaderReorderIndicator, isDraggedRow && styles.rowHeaderReorderIndicatorActive)}\n\t\t\t\t\taria-label={`Reorder row ${rowTitle}`}\n\t\t\t\t\ttitle={`Reorder row ${rowTitle}`}\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tdisabled={!controlsEnabled}\n\t\t\t\t\tonMouseDown={event => onRowReorderHandleMouseDown(rowId, event)}\n\t\t\t\t>\n\t\t\t\t\t<IconDragHandle />\n\t\t\t\t</button>\n\t\t\t)}\n\t\t\t{rowId && (\n\t\t\t\t<CheckBox\n\t\t\t\t\tvalue={isSelected}\n\t\t\t\t\tonChange={noop}\n\t\t\t\t\tonClick={event => onRowCheckboxClick(rowId, event)}\n\t\t\t\t\tenabled={controlsEnabled}\n\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\tclassName={styles.rowHeaderCheckbox}\n\t\t\t\t\ttitle={`Select row ${rowTitle}`}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n})\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tButton,\n\tIconControlTypeStatus,\n\tIconInputClose,\n\tIconInputDropdown,\n\tSearchBar,\n\tStack,\n\ttabularNumbers,\n} from \"@framerjs/fresco\"\nimport * as pillStyles from \"@framerjs/fresco/src/components/PillTone.styles.ts\"\nimport * as popoverComboBoxStyles from \"@framerjs/fresco/src/components/PopoverComboBox.styles.ts\"\nimport { assert, isCommandKeyPressed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment, useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Tools } from \"document/stores/ToolEnum.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { editCollectionUsingPlugin } from \"plugins/editCollectionUsingPlugin.ts\"\nimport { isApiManagedCollection } from \"plugins/plugins.ts\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { record, UIInteraction } from \"web/lib/tracker.ts\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as toolbarItemStyles from \"../projectbar/ToolbarItem.styles.ts\"\nimport { ToolbarItem } from \"../projectbar/ToolbarItem.tsx\"\nimport { getToolbarIconSet } from \"../projectbar/icons/toolbarIconSet.ts\"\nimport { dataIsTableSearchBarDataAttribute } from \"../shared/TableSearchBar.tsx\"\nimport { createMenuIcon, menuIconForVariableType } from \"../shared/utils/panelIconForVariable.tsx\"\nimport { IconCmsTableSorting } from \"./IconCmsTableSorting.tsx\"\nimport { VirtualCollectionItemTableSortingPopover } from \"./VirtualCollectionItemTableSortingPopover.tsx\"\nimport * as styles from \"./VirtualCollectionItemTableToolbar.styles.ts\"\nimport {\n\ttype CollectionFiltersByTarget,\n\ttype CollectionItemTableFieldDefinition,\n\ttype CollectionItemTableFilter,\n\ttype CollectionItemTableFilterFor,\n\tgetCollectionItemTableFieldDefinitions,\n\tgetCollectionItemTableFieldFilterLabel,\n\tremoveCollectionItemTableFieldFilter,\n\ttoggleCollectionItemTableFieldFilter,\n} from \"./utils/collectionItemTableFilters.ts\"\nimport {\n\tgetCollectionSortingRulesFromStorage,\n\tlocalStorageSortingRulesKey,\n} from \"./utils/collectionItemTableSorting.ts\"\nimport {\n\tdeleteCollectionItemsWithConfirmation,\n\tsetCollectionItemsStatusWithConfirmation,\n} from \"./utils/contentManagementActions.tsx\"\nimport {\n\tdismissCreateCollectionItem,\n\thandleCreateCollectionItem,\n\tuseHasNewCollectionItemOverlayOpen,\n} from \"./utils/handleCreateCollectionItem.ts\"\n\ninterface VirtualCollectionItemTableToolbarProps {\n\tcollectionNode: CollectionNode\n\trawSearchTerm: string\n\tactiveFilters: readonly CollectionItemTableFilter[]\n\tmultiSelectedItems: ReadonlySet<NodeID> | null\n\tkeyboardInteractionBlocked: boolean\n\tsearchShortcutBlocked: boolean\n\tvisibilityOptions: MenuItemOptions[]\n\tdataIsViewOnly: boolean\n}\n\nexport function VirtualCollectionItemTableToolbar({\n\tcollectionNode,\n\trawSearchTerm,\n\tactiveFilters,\n\tmultiSelectedItems,\n\tkeyboardInteractionBlocked,\n\tsearchShortcutBlocked,\n\tvisibilityOptions,\n\tdataIsViewOnly,\n}: VirtualCollectionItemTableToolbarProps) {\n\tconst hasNewCollectionItemOverlayOpen = useHasNewCollectionItemOverlayOpen(engine)\n\tconst [multiSelectMenuOpen, setMultiSelectMenuOpen] = useState(false)\n\tconst [filterMenuOpen, setFilterMenuOpen] = useState(false)\n\tconst [sortingPopoverOpen, setSortingPopoverOpen] = useState(false)\n\tconst [storedLocalSortingRulesByCollection] = useLocalStorage<unknown>(localStorageSortingRulesKey, null)\n\tconst localSortingRulesByCollection = useMemo(\n\t\t() => getCollectionSortingRulesFromStorage(storedLocalSortingRulesByCollection),\n\t\t[storedLocalSortingRulesByCollection],\n\t)\n\tconst sortingButtonRef = useRef<HTMLDivElement>(null)\n\tconst searchInputRef = useRef<HTMLInputElement>(null)\n\tconst [searchVisible, setSearchVisible] = useState(() => rawSearchTerm.trim().length > 0)\n\tconst [autoFocusSearchInput, setAutoFocusSearchInput] = useState(false)\n\tconst ManagedSyncCollectionIcon = getToolbarIconSet(true).reload\n\tconst manageCollectionIcon = getToolbarIconSet(true).variables\n\tconst pluginManifestById = engine.stores.pluginStore.useState(state => state.manifestById)\n\tconst activePluginMode = engine.stores.pluginStore.useState(state => state.activePlugin?.modeHandlers.mode)\n\tconst contentIsViewOnly = useIsViewOnly(\"canEditContent\")\n\tconst variablesAreViewOnly = useIsViewOnly(\"canEditVariables\")\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tif (rawSearchTerm.trim().length > 0 && !searchVisible) {\n\t\tsetSearchVisible(true)\n\t\tsetAutoFocusSearchInput(false)\n\t}\n\n\tconst canCreateItems = !dataIsViewOnly && !collectionNode.managedByPlugin\n\tconst isManagedCollection = Boolean(collectionNode.managedByPlugin)\n\tconst managedCollectionPluginManifest = collectionNode.managedByPlugin\n\t\t? (pluginManifestById.get(collectionNode.managedByPlugin) ?? null)\n\t\t: null\n\tconst isApiManaged = isApiManagedCollection(collectionNode)\n\tconst canEditManagedContent = !contentIsViewOnly\n\tconst canEditManagedVariables = !variablesAreViewOnly\n\tconst syncEnabled = canEditManagedContent && !isApiManaged\n\tconst manageEnabled = (canEditManagedVariables || canEditManagedContent) && !isApiManaged\n\tconst canManageCollection = managedCollectionPluginManifest?.modes.includes(\"configureManagedCollection\") ?? false\n\n\tconst selectedItemCount = multiSelectedItems?.size ?? null\n\tconst hasLocalSortingOverride = localSortingRulesByCollection[collectionNode.id] !== undefined\n\n\tconst fieldDefinitions = useMemo(() => getCollectionItemTableFieldDefinitions(collectionNode), [collectionNode])\n\n\tconst onSearchTermChange = useEngineCallback(\n\t\t(searchTerm: string) => {\n\t\t\tengine.stores.contentManagementStore.setCollectionItemTableSearchTerm(collectionNode.id, searchTerm)\n\t\t},\n\t\t[collectionNode.id],\n\t)\n\n\tconst updateFiltersByTarget = useEngineCallback(\n\t\t(update: (filtersByTarget: CollectionFiltersByTarget) => CollectionFiltersByTarget) => {\n\t\t\tengine.stores.contentManagementStore.updateCollectionItemTableFilterState(collectionNode.id, filterState => ({\n\t\t\t\t...filterState,\n\t\t\t\tfiltersByTarget: update(filterState.filtersByTarget),\n\t\t\t}))\n\t\t},\n\t\t[collectionNode.id],\n\t)\n\n\tconst onRemoveFieldFilter = useCallback(\n\t\t(filter: CollectionItemTableFilter) => {\n\t\t\tupdateFiltersByTarget(filtersByTarget => removeCollectionItemTableFieldFilter(filtersByTarget, filter))\n\t\t},\n\t\t[updateFiltersByTarget],\n\t)\n\n\tconst updateFilterState = useCallback(\n\t\t<Field extends CollectionItemTableFieldDefinition, Filter extends CollectionItemTableFilterFor<Field>>(\n\t\t\tfield: Field,\n\t\t\tmaybeFilter: Filter | undefined,\n\t\t\tstate: Filter[\"state\"],\n\t\t) =>\n\t\t\tupdateFiltersByTarget(all => {\n\t\t\t\tconst filter = maybeFilter ? { ...maybeFilter, state } : { type: field.type, field, state }\n\t\t\t\treturn toggleCollectionItemTableFieldFilter(all, filter as CollectionItemTableFilter)\n\t\t\t}),\n\t\t[updateFiltersByTarget],\n\t)\n\n\tconst buildFilterMenuOptions = useCallback(\n\t\t<Field extends CollectionItemTableFieldDefinition>(\n\t\t\tfield: Field,\n\t\t\tfilter?: CollectionItemTableFilterFor<Field>,\n\t\t): MenuItemOptions[] => {\n\t\t\tswitch (field.type) {\n\t\t\t\tcase \"boolean\": {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.Yes,\n\t\t\t\t\t\t\tchecked: filter?.type === \"boolean\" && filter.state.value,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { value: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.No,\n\t\t\t\t\t\t\tchecked: filter?.type === \"boolean\" && !filter.state.value,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { value: false }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t\tcase \"file\":\n\t\t\t\tcase \"image\":\n\t\t\t\tcase \"link\":\n\t\t\t\tcase \"string\":\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.IsSet,\n\t\t\t\t\t\t\tchecked: filter?.type === field.type && filter.state.isSet,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { isSet: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.IsntSet,\n\t\t\t\t\t\t\tchecked: filter?.type === field.type && !filter.state.isSet,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { isSet: false }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t\tcase \"option\":\n\t\t\t\t\tif (field.type !== \"option\") return []\n\t\t\t\t\treturn field.config.options.map(option => ({\n\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\tlabel: option.label,\n\t\t\t\t\t\tchecked: filter?.type === \"option\" && filter.state.value === option.value,\n\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { value: option.value }),\n\t\t\t\t\t}))\n\t\t\t\tcase \"status\":\n\t\t\t\t\treturn [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.Live,\n\t\t\t\t\t\t\tchecked: filter?.type === \"status\" && filter.state.isLive,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { isLive: true }),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\t\t\tlabel: Dictionary.Draft,\n\t\t\t\t\t\t\tchecked: filter?.type === \"status\" && !filter.state.isLive,\n\t\t\t\t\t\t\tclick: () => updateFilterState(field, filter, { isLive: false }),\n\t\t\t\t\t\t},\n\t\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t[updateFilterState],\n\t)\n\n\tconst onShowFilterMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tconst elementBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tsetFilterMenuOpen(true)\n\n\t\t\tconst menuItems: MenuItemOptions[] = []\n\n\t\t\tfor (const field of fieldDefinitions) {\n\t\t\t\tconst activeFilter = activeFilters.find(filter => filter.field.id === field.id && filter.type === field.type)\n\n\t\t\t\tconst submenu = buildFilterMenuOptions(field, activeFilter)\n\t\t\t\tif (submenu.length === 0) continue\n\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: field.name,\n\t\t\t\t\ticon: getFilterMenuIcon(field, agentExperimentEnabled),\n\t\t\t\t\tsubmenu,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: { x: elementBounds.left, y: elementBounds.bottom + 4 },\n\t\t\t\tonDone: () => setFilterMenuOpen(false),\n\t\t\t})\n\t\t},\n\t\t[fieldDefinitions, activeFilters, buildFilterMenuOptions, agentExperimentEnabled],\n\t)\n\n\tconst onShowMultiSelectMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tassert(multiSelectedItems, \"Multi-select menu should not be shown when no items are selected\")\n\n\t\t\tconst elementBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tconst selectedItemIds = Array.from(multiSelectedItems)\n\t\t\tconst multiSelectionContentSummary = getMultiSelectionContentSummary(multiSelectedItems)\n\n\t\t\tsetMultiSelectMenuOpen(true)\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Draft,\n\t\t\t\t\t\tenabled: canCreateItems && multiSelectionContentSummary.hasNonDrafts,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tsetCollectionItemsStatusWithConfirmation(engine, selectedItemIds, true, \"collection_table\")\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: Dictionary.Undraft,\n\t\t\t\t\t\tenabled: canCreateItems && multiSelectionContentSummary.hasDrafts,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tsetCollectionItemsStatusWithConfirmation(engine, selectedItemIds, undefined, \"collection_table\")\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: Dictionary.Delete,\n\t\t\t\t\t\tenabled: canCreateItems && selectedItemIds.length > 0,\n\t\t\t\t\t\tclick: () => deleteCollectionItemsWithConfirmation(engine, selectedItemIds, \"toolbar\"),\n\t\t\t\t\t},\n\t\t\t\t\t{ type: \"separator\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Deselect\",\n\t\t\t\t\t\tclick: () => engine.stores.contentManagementStore.exitMultiSelectionMode(),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{\n\t\t\t\t\tlocation: { x: elementBounds.left, y: elementBounds.bottom + 4 },\n\t\t\t\t\tonDone: () => setMultiSelectMenuOpen(false),\n\t\t\t\t},\n\t\t\t)\n\t\t},\n\t\t[canCreateItems, multiSelectedItems],\n\t)\n\n\tconst onShowFilterPillMenu = useCallback(\n\t\t(filter: CollectionItemTableFilter, event: React.MouseEvent<HTMLElement>) => {\n\t\t\tconst elementBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tconst field = fieldDefinitions.find(\n\t\t\t\tdefinition => definition.id === filter.field.id && definition.type === filter.type,\n\t\t\t)\n\t\t\tif (!field) return\n\n\t\t\tconst menuItems: MenuItemOptions[] = buildFilterMenuOptions(field, filter).slice()\n\n\t\t\tmenuItems.push(\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tclick: () => onRemoveFieldFilter(filter),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: { x: elementBounds.left, y: elementBounds.bottom + 4 },\n\t\t\t})\n\t\t},\n\t\t[fieldDefinitions, onRemoveFieldFilter, buildFilterMenuOptions],\n\t)\n\n\tconst [fieldVisibilityMenuOpen, setFieldVisibilityMenuOpen] = useState(false)\n\n\tconst displayFieldOptions = useCallback(\n\t\t(_tool: undefined | Tools, event: React.MouseEvent<HTMLElement>) => {\n\t\t\tconst elementBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tsetFieldVisibilityMenuOpen(true)\n\n\t\t\trecord(\"ui_interaction\", { id: UIInteraction.showHideCmsColumns, page: \"collection_table_header\" })\n\n\t\t\tengine.stores.contextMenuStore.show(visibilityOptions, {\n\t\t\t\tcloseOnSelect: false,\n\t\t\t\tlocation: { x: elementBounds.right - 4, y: elementBounds.bottom + 4 },\n\t\t\t\tonDone: () => setFieldVisibilityMenuOpen(false),\n\t\t\t})\n\t\t},\n\t\t[visibilityOptions],\n\t)\n\n\tconst closeSortingPopover = useCallback(() => {\n\t\tsetSortingPopoverOpen(false)\n\t}, [])\n\n\tconst toggleSortingPopover = useCallback(() => {\n\t\tsetSortingPopoverOpen(open => !open)\n\t}, [])\n\n\tconst onCreateItem = hasNewCollectionItemOverlayOpen\n\t\t? () => dismissCreateCollectionItem(engine)\n\t\t: () => handleCreateCollectionItem(engine)\n\n\tconst focusSearchInput = useCallback((selectAllText = false) => {\n\t\tconst input = searchInputRef.current\n\t\tif (!input) return false\n\n\t\tinput.focus()\n\t\tif (selectAllText) input.select()\n\t\treturn true\n\t}, [])\n\n\tconst requestSearchInputFocus = useCallback(() => {\n\t\tif (focusSearchInput()) return\n\n\t\tsetSearchVisible(true)\n\t\tsetAutoFocusSearchInput(true)\n\t}, [focusSearchInput])\n\n\tconst hideSearch = useCallback(() => {\n\t\tif (rawSearchTerm.length > 0) {\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tengine.stores.contentManagementStore.setCollectionItemTableSearchTerm(collectionNode.id, \"\")\n\t\t\t})\n\t\t}\n\n\t\tsetAutoFocusSearchInput(false)\n\t\tsetSearchVisible(false)\n\t}, [collectionNode.id, rawSearchTerm])\n\n\tconst searchVisibleOnMouseDownRef = useRef<boolean | null>(null)\n\n\tconst handleSearchToolbarItemMouseDown = useCallback(() => {\n\t\tsearchVisibleOnMouseDownRef.current = searchVisible\n\t}, [searchVisible])\n\n\tconst handleSearchToolbarItemClickFallback = useCallback(() => {\n\t\tconst shouldHideSearch = searchVisibleOnMouseDownRef.current ?? searchVisible\n\t\tsearchVisibleOnMouseDownRef.current = null\n\n\t\tif (shouldHideSearch) {\n\t\t\thideSearch()\n\t\t\treturn\n\t\t}\n\n\t\trequestSearchInputFocus()\n\t}, [hideSearch, requestSearchInputFocus, searchVisible])\n\n\tuseEffect(() => {\n\t\tif (searchShortcutBlocked) return\n\n\t\tconst handleSearchShortcut = (event: KeyboardEvent) => {\n\t\t\tif (!isCommandKeyPressed(event) || event.key !== \"f\") return\n\n\t\t\trequestSearchInputFocus()\n\t\t\tevent.preventDefault()\n\t\t}\n\n\t\twindow.addEventListener(\"keydown\", handleSearchShortcut, true)\n\t\treturn () => window.removeEventListener(\"keydown\", handleSearchShortcut, true)\n\t}, [requestSearchInputFocus, searchShortcutBlocked])\n\n\tconst activeFilterPills = activeFilters.map(filter => ({\n\t\tkey: `${filter.type}:${filter.field.id}`,\n\t\tlabel: getCollectionItemTableFieldFilterLabel(filter),\n\t\tonRemove: () => onRemoveFieldFilter(filter),\n\t\tonMouseDown: (event: React.MouseEvent<HTMLElement>) => onShowFilterPillMenu(filter, event),\n\t}))\n\n\tconst rightmostActiveFilterPill = activeFilterPills.at(-1)\n\n\treturn (\n\t\t<div className={styles.container} {...{ [dataIsTableSearchBarDataAttribute]: true }}>\n\t\t\t<div className={styles.leftControls}>\n\t\t\t\t{selectedItemCount !== null ? (\n\t\t\t\t\t<MultiSelectActionButton\n\t\t\t\t\t\tselectedItemCount={selectedItemCount}\n\t\t\t\t\t\tselected={multiSelectMenuOpen}\n\t\t\t\t\t\tenabled={!keyboardInteractionBlocked}\n\t\t\t\t\t\tshowMultiSelectMenu={onShowMultiSelectMenu}\n\t\t\t\t\t/>\n\t\t\t\t) : isManagedCollection ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ticonOnly\n\t\t\t\t\t\t\ttitle=\"Sync\"\n\t\t\t\t\t\t\ticon={<ManagedSyncCollectionIcon />}\n\t\t\t\t\t\t\tselected={activePluginMode === \"syncManagedCollection\"}\n\t\t\t\t\t\t\tenabled={syncEnabled}\n\t\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\t\tonClick={() => editCollectionUsingPlugin(engine, collectionNode, \"syncManagedCollection\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{canManageCollection && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ticonOnly\n\t\t\t\t\t\t\t\ttitle=\"Manage\"\n\t\t\t\t\t\t\t\ticon={manageCollectionIcon}\n\t\t\t\t\t\t\t\tselected={activePluginMode === \"configureManagedCollection\"}\n\t\t\t\t\t\t\t\tenabled={manageEnabled}\n\t\t\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\t\t\tonClick={() => editCollectionUsingPlugin(engine, collectionNode, \"configureManagedCollection\")}\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\t<ToolbarItem\n\t\t\t\t\t\ticonOnly\n\t\t\t\t\t\ttitle={Dictionary.NewItem}\n\t\t\t\t\t\ticon={IconCmsTableCreateItem}\n\t\t\t\t\t\tselected={hasNewCollectionItemOverlayOpen}\n\t\t\t\t\t\tenabled={canCreateItems}\n\t\t\t\t\t\tclassName={cx(styles.iconButton, hasNewCollectionItemOverlayOpen && styles.iconButtonActive)}\n\t\t\t\t\t\tonClick={() => onCreateItem()}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<Experiment isOn=\"cmsMultiSort\">\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\ticonOnly\n\t\t\t\t\t\tref={sortingButtonRef}\n\t\t\t\t\t\ttitle=\"Sorting\"\n\t\t\t\t\t\ticon={IconCmsTableSorting}\n\t\t\t\t\t\tselected={sortingPopoverOpen}\n\t\t\t\t\t\tenabled={!keyboardInteractionBlocked}\n\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\tshowIndicatorDot={hasLocalSortingOverride}\n\t\t\t\t\t\tonClick={toggleSortingPopover}\n\t\t\t\t\t/>\n\t\t\t\t\t{sortingPopoverOpen && (\n\t\t\t\t\t\t<VirtualCollectionItemTableSortingPopover\n\t\t\t\t\t\t\tanchor={sortingButtonRef.current}\n\t\t\t\t\t\t\tcollectionNode={collectionNode}\n\t\t\t\t\t\t\tcanEditSorting={!contentIsViewOnly}\n\t\t\t\t\t\t\tonClose={closeSortingPopover}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Experiment>\n\t\t\t\t<ToolbarItem\n\t\t\t\t\ticonOnly\n\t\t\t\t\ttitle=\"Filter\"\n\t\t\t\t\ticon={IconCmsTableFilter}\n\t\t\t\t\tselected={filterMenuOpen}\n\t\t\t\t\tenabled={!keyboardInteractionBlocked}\n\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\tonMouseDown={(_, event) => onShowFilterMenu(event)}\n\t\t\t\t/>\n\t\t\t\t<ToolbarItem\n\t\t\t\t\ticonOnly\n\t\t\t\t\ttitle=\"Search\"\n\t\t\t\t\ticon={IconCmsTableSearch}\n\t\t\t\t\tselected={searchVisible}\n\t\t\t\t\tenabled={!keyboardInteractionBlocked}\n\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\tonMouseDown={handleSearchToolbarItemMouseDown}\n\t\t\t\t\tonClick={handleSearchToolbarItemClickFallback}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.searchContent}>\n\t\t\t\t\t{activeFilterPills.length > 0 && (\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" className={styles.filterPills}>\n\t\t\t\t\t\t\t{activeFilterPills.map(filter => (\n\t\t\t\t\t\t\t\t<FilterPill\n\t\t\t\t\t\t\t\t\tkey={filter.key}\n\t\t\t\t\t\t\t\t\tlabel={filter.label}\n\t\t\t\t\t\t\t\t\tonMouseDown={filter.onMouseDown}\n\t\t\t\t\t\t\t\t\tonRemove={filter.onRemove}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\t\t\t\t\t{searchVisible && (\n\t\t\t\t\t\t<SearchBar\n\t\t\t\t\t\t\tref={searchInputRef}\n\t\t\t\t\t\t\tvalue={rawSearchTerm}\n\t\t\t\t\t\t\tautoFocus={autoFocusSearchInput}\n\t\t\t\t\t\t\tisIconVisible={false}\n\t\t\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\t\t\ttabIndex={keyboardInteractionBlocked ? -1 : undefined}\n\t\t\t\t\t\t\tclassName={styles.searchBar}\n\t\t\t\t\t\t\tonChange={onSearchTermChange}\n\t\t\t\t\t\t\tonKeyDown={event => {\n\t\t\t\t\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t\t\t\thideSearch()\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (event.key === \"Backspace\") {\n\t\t\t\t\t\t\t\t\tif (event.repeat) return\n\t\t\t\t\t\t\t\t\tif (rawSearchTerm.length > 0) return\n\t\t\t\t\t\t\t\t\tif (!rightmostActiveFilterPill) return\n\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\trightmostActiveFilterPill.onRemove()\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonFocus={() => {\n\t\t\t\t\t\t\t\tsetAutoFocusSearchInput(false)\n\t\t\t\t\t\t\t\tsetSearchVisible(true)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\t\tif (rawSearchTerm.trim().length > 0) return\n\t\t\t\t\t\t\t\tsetSearchVisible(false)\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</div>\n\t\t\t</div>\n\t\t\t<div className={styles.rightControls}>\n\t\t\t\t<ToolbarItem\n\t\t\t\t\ticonOnly\n\t\t\t\t\ttitle=\"Show Columns\"\n\t\t\t\t\ticon={IconDotsHorizontal}\n\t\t\t\t\tselected={fieldVisibilityMenuOpen}\n\t\t\t\t\tenabled={!keyboardInteractionBlocked}\n\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\tonMouseDown={displayFieldOptions}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nlet statusFieldFilterMenuIcon: NonNullable<MenuItemOptions[\"icon\"]> | undefined\n\nfunction getFilterMenuIcon(\n\tfield: CollectionItemTableFieldDefinition,\n\tagentExperimentEnabled: boolean,\n): NonNullable<MenuItemOptions[\"icon\"]> {\n\tswitch (field.type) {\n\t\tcase \"boolean\":\n\t\t\treturn menuIconForVariableType(ControlType.Boolean, agentExperimentEnabled)\n\t\tcase \"file\":\n\t\t\treturn menuIconForVariableType(ControlType.File, agentExperimentEnabled)\n\t\tcase \"image\":\n\t\t\treturn menuIconForVariableType(ControlType.Image, agentExperimentEnabled)\n\t\tcase \"link\":\n\t\t\treturn menuIconForVariableType(ControlType.Link, agentExperimentEnabled)\n\t\tcase \"option\":\n\t\t\treturn menuIconForVariableType(ControlType.Enum, agentExperimentEnabled)\n\t\tcase \"status\":\n\t\t\treturn getStatusFieldFilterMenuIcon()\n\t\tcase \"string\":\n\t\t\treturn menuIconForVariableType(ControlType.String, agentExperimentEnabled)\n\t}\n}\n\nfunction getStatusFieldFilterMenuIcon(): NonNullable<MenuItemOptions[\"icon\"]> {\n\tstatusFieldFilterMenuIcon ??= createMenuIcon(<IconControlTypeStatus />)\n\treturn statusFieldFilterMenuIcon\n}\n\nfunction getMultiSelectionContentSummary(multiSelectedItems: ReadonlySet<NodeID> | null | undefined) {\n\tconst summary = {\n\t\thasDrafts: false,\n\t\thasNonDrafts: false,\n\t}\n\tif (!multiSelectedItems) return summary\n\n\tfor (const id of multiSelectedItems) {\n\t\tconst item = engine.tree.getNodeWithTrait(id, isCollectionItemNode)\n\t\tif (!item) continue\n\n\t\tif (item.isDraft) {\n\t\t\tsummary.hasDrafts = true\n\t\t} else {\n\t\t\tsummary.hasNonDrafts = true\n\t\t}\n\n\t\tif (summary.hasDrafts && summary.hasNonDrafts) break\n\t}\n\n\treturn summary\n}\n\nfunction MultiSelectActionButton({\n\tselectedItemCount,\n\tselected,\n\tenabled,\n\tshowMultiSelectMenu,\n}: {\n\tselectedItemCount: number\n\tselected: boolean\n\tenabled: boolean\n\tshowMultiSelectMenu: React.MouseEventHandler<HTMLElement>\n}) {\n\tconst title = `${selectedItemCount} Selected`\n\n\tconst clickHandlers = useClickHandlers(showMultiSelectMenu)\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cx(\n\t\t\t\ttoolbarItemStyles.container,\n\t\t\t\tenabled ? toolbarItemStyles.enabled : toolbarItemStyles.disabled,\n\t\t\t\tstyles.multiSelectButton,\n\t\t\t)}\n\t\t\tdisabled={!enabled}\n\t\t\taria-label={title}\n\t\t\taria-expanded={selected}\n\t\t\taria-haspopup=\"menu\"\n\t\t\t{...clickHandlers}\n\t\t>\n\t\t\t<span className={cx(styles.multiSelectButtonLabel, tabularNumbers)}>{title}</span>\n\t\t\t<IconInputDropdown />\n\t\t</button>\n\t)\n}\n\nfunction FilterPill({\n\tlabel,\n\tonMouseDown,\n\tonRemove,\n}: {\n\tlabel: string\n\tonRemove: () => void\n\tonMouseDown?: (event: React.MouseEvent<HTMLElement>) => void\n}) {\n\treturn (\n\t\t<div className={cx(pillStyles.pill, pillStyles.pillWithIcon)}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={styles.filterPillToggleButton}\n\t\t\t\tonMouseDown={event => {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tonMouseDown?.(event)\n\t\t\t\t}}\n\t\t\t\tonClick={event => {\n\t\t\t\t\tif (event.detail !== 0) return\n\n\t\t\t\t\tonMouseDown?.(event)\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<span className={pillStyles.pillText}>{label}</span>\n\t\t\t</button>\n\t\t\t<Button\n\t\t\t\ttitle={`Remove ${label} filter`}\n\t\t\t\taria-label={`Remove ${label} filter`}\n\t\t\t\tclassName={cx(pillStyles.pillIcon, popoverComboBoxStyles.pillCloseButton)}\n\t\t\t\tvariant=\"clean\"\n\t\t\t\tonMouseDown={event => {\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t}}\n\t\t\t\tonClick={event => {\n\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\tonRemove()\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<IconInputClose />\n\t\t\t</Button>\n\t\t</div>\n\t)\n}\n\nfunction IconCmsTableCreateItem() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden={true}>\n\t\t\t<g transform=\"translate(3 3)\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 7 0 L 7 14\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 0 7 L 14 7\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction IconCmsTableFilter() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden={true}>\n\t\t\t<path\n\t\t\t\td=\"M 1 5 C 1 4.448 1.448 4 2 4 L 18 4 C 18.552 4 19 4.448 19 5 C 19 5.552 18.552 6 18 6 L 2 6 C 1.448 6 1 5.552 1 5 Z M 4 10 C 4 9.448 4.448 9 5 9 L 15 9 C 15.552 9 16 9.448 16 10 C 16 10.552 15.552 11 15 11 L 5 11 C 4.448 11 4 10.552 4 10 Z M 7 15 C 7 14.448 7.448 14 8 14 L 12 14 C 12.552 14 13 14.448 13 15 C 13 15.552 12.552 16 12 16 L 8 16 C 7.448 16 7 15.552 7 15 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconCmsTableSearch() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden={true}>\n\t\t\t<path\n\t\t\t\td=\"M 9 3 C 12.314 3 15 5.686 15 9 C 15 12.314 12.314 15 9 15 C 5.686 15 3 12.314 3 9 C 3 5.686 5.686 3 9 3 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t/>\n\t\t\t<path d=\"M 13.5 13.5 L 17 17\" fill=\"transparent\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n\t\t</svg>\n\t)\n}\n\nfunction IconDotsHorizontal() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden={true}>\n\t\t\t<circle cx=\"5\" cy=\"10\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"10\" cy=\"10\" r=\"1.5\" fill=\"currentColor\" />\n\t\t\t<circle cx=\"15\" cy=\"10\" r=\"1.5\" fill=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "import { IconToolbarClock, IconToolbarReload } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport React from \"react\"\nimport { IconMagicContained } from \"../../localization/IconMagicContained.tsx\"\nimport { IconAgentToolbarMagic } from \"./IconAgentToolbarMagic.tsx\"\nimport { IconColumns } from \"./IconColumns.tsx\"\nimport { IconFilter } from \"./IconFilter.tsx\"\nimport { IconFrame } from \"./IconFrame.tsx\"\nimport { IconFullscreen } from \"./IconFullscreen.tsx\"\nimport { IconGlossary } from \"./IconGlossary.tsx\"\nimport { IconGrid } from \"./IconGrid.tsx\"\nimport { IconImage } from \"./IconImage.tsx\"\nimport { IconImport } from \"./IconImport.tsx\"\nimport { IconInsert } from \"./IconInsert.tsx\"\nimport { IconLayout } from \"./IconLayout.tsx\"\nimport { IconMasonryGrid } from \"./IconMasonryGrid.tsx\"\nimport { IconOptions } from \"./IconOptions.tsx\"\nimport { IconOval } from \"./IconOval.tsx\"\nimport { IconPlugins } from \"./IconPlugins.tsx\"\nimport { IconRows } from \"./IconRows.tsx\"\nimport { IconText } from \"./IconText.tsx\"\nimport { IconToolPath } from \"./IconToolPath.tsx\"\nimport { IconVariables } from \"./IconVariables.tsx\"\nimport { IconVideo } from \"./IconVideo.tsx\"\nimport { NewIconClock } from \"./NewIconClock.tsx\"\nimport { NewIconColumns } from \"./NewIconColumns.tsx\"\nimport { NewIconEdit } from \"./NewIconEdit.tsx\"\nimport { NewIconFilter } from \"./NewIconFilter.tsx\"\nimport { NewIconFrame } from \"./NewIconFrame.tsx\"\nimport { NewIconFullscreen } from \"./NewIconFullscreen.tsx\"\nimport { NewIconGlossary } from \"./NewIconGlossary.tsx\"\nimport { NewIconGrid } from \"./NewIconGrid.tsx\"\nimport { NewIconImage } from \"./NewIconImage.tsx\"\nimport { NewIconImport } from \"./NewIconImpor.tsx\"\nimport { NewIconInsert } from \"./NewIconInsert.tsx\"\nimport { NewIconMasonryGrid } from \"./NewIconMasonryGrid.tsx\"\nimport { NewIconOptions } from \"./NewIconOptions.tsx\"\nimport { NewIconOval } from \"./NewIconOval.tsx\"\nimport { NewIconPath } from \"./NewIconPath.tsx\"\nimport { NewIconPlugins } from \"./NewIconPlugins.tsx\"\nimport { NewIconPolygon } from \"./NewIconPolygon.tsx\"\nimport { NewIconPublish } from \"./NewIconPublish.tsx\"\nimport { NewIconRect } from \"./NewIconRect.tsx\"\nimport { NewIconReload } from \"./NewIconReload.tsx\"\nimport { NewIconRows } from \"./NewIconRows.tsx\"\nimport { NewIconStar } from \"./NewIconStar.tsx\"\nimport { NewIconText } from \"./NewIconText.tsx\"\nimport { NewIconToolPath } from \"./NewIconToolPath.tsx\"\nimport { NewIconVideo } from \"./NewIconVideo.tsx\"\nimport { iconColumnsString } from \"./iconColumnsString.ts\"\nimport { iconFrameString } from \"./iconFrameString.ts\"\nimport { iconGridString } from \"./iconGridString.ts\"\nimport { iconImageString } from \"./iconImageString.ts\"\nimport { iconMasonryGridString } from \"./iconMasonryGridString.ts\"\nimport { iconOvalString } from \"./iconOvalString.ts\"\nimport { iconPathString } from \"./iconPathString.ts\"\nimport { iconPolygonString } from \"./iconPolygonString.ts\"\nimport { iconRectString } from \"./iconRectString.ts\"\nimport { iconRowsString } from \"./iconRowsString.ts\"\nimport { iconStarString } from \"./iconStarString.ts\"\nimport { iconVideoString } from \"./iconVideoString.ts\"\nimport { newIconColumnsString } from \"./newIconColumnsString.ts\"\nimport { newIconFrameString } from \"./newIconFrameString.ts\"\nimport { newIconGridString } from \"./newIconGridString.ts\"\nimport { newIconImageString } from \"./newIconImageString.ts\"\nimport { newIconMasonryGridString } from \"./newIconMasonryGridString.ts\"\nimport { newIconOvalString } from \"./newIconOvalString.ts\"\nimport { newIconPathString } from \"./newIconPathString.ts\"\nimport { newIconPolygonString } from \"./newIconPolygonString.ts\"\nimport { newIconRectString } from \"./newIconRectString.ts\"\nimport { newIconRowsString } from \"./newIconRowsString.ts\"\nimport { newIconStarString } from \"./newIconStarString.ts\"\nimport { newIconVideoString } from \"./newIconVideoString.ts\"\n\nconst layoutTools = [\n\tTools.CreateFrame,\n\tTools.CreateRounded,\n\tTools.CreateImage,\n\tTools.CreateStack,\n\tTools.CreateRows,\n\tTools.CreateColumns,\n\tTools.CreateGrid,\n\tTools.CreateMasonry,\n\tTools.CreateVideo,\n] as const\n\nconst shapeTools = [\n\tTools.CreateRectangleShape,\n\tTools.CreateOvalShape,\n\tTools.CreatePolygonShape,\n\tTools.CreateStarShape,\n\tTools.Path,\n] as const\n\nconst layoutToolSet = new Set<Tools>(layoutTools)\nconst shapeToolSet = new Set<Tools>(shapeTools)\n\ntype LayoutTool = (typeof layoutTools)[number]\ntype ShapeTool = (typeof shapeTools)[number]\n\n// Reload icon is being passed some props, so we need to create a component that can be passed those props\n// and create the element with the props. The ref is used to animate the icon.\ntype ReloadIconComponent = React.ForwardRefExoticComponent<React.RefAttributes<SVGSVGElement>>\n\nconst ReloadIcon = React.forwardRef<SVGSVGElement>(function ReloadIcon(_, ref) {\n\treturn React.createElement(IconToolbarReload, { fill: colors.panelBackground, ref })\n})\n\nconst NewReloadIcon = React.forwardRef<SVGSVGElement>(function NewReloadIcon(_, ref) {\n\treturn React.createElement(NewIconReload, { ref })\n})\n\ninterface ToolbarIconSet {\n\tsize: number\n\teditFields: React.FunctionComponent\n\timport: React.FunctionComponent\n\tinsert: React.FunctionComponent\n\tfilter: React.FunctionComponent\n\tfullscreen: React.FunctionComponent\n\tglossary: React.FunctionComponent\n\tlayout: React.FunctionComponent\n\tmagic: React.FunctionComponent\n\tplugins: React.FunctionComponent\n\tpublish: React.FunctionComponent\n\toptions: React.FunctionComponent\n\treload: ReloadIconComponent\n\ttext: React.FunctionComponent\n\tvariables: React.FunctionComponent\n\tvector: React.FunctionComponent\n\tversions: React.FunctionComponent\n\tlayoutButtonByTool: (tool: LayoutTool) => React.FunctionComponent\n\tlayoutMenuByTool: (tool: LayoutTool) => string\n\tshapeButtonByTool: (tool: ShapeTool) => React.FunctionComponent\n\tshapeMenuByTool: (tool: ShapeTool) => string\n}\n\nconst iconSet: ToolbarIconSet = {\n\tsize: 18,\n\teditFields: IconVariables,\n\timport: IconImport,\n\tinsert: IconInsert,\n\tfilter: IconFilter,\n\tfullscreen: IconFullscreen,\n\tglossary: IconGlossary,\n\tlayout: IconLayout,\n\tmagic: IconMagicContained,\n\toptions: IconOptions,\n\treload: ReloadIcon,\n\tplugins: IconPlugins,\n\tpublish: IconVariables,\n\ttext: IconText,\n\tvariables: IconVariables,\n\tvector: IconToolPath,\n\tversions: IconToolbarClock,\n\tlayoutButtonByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateFrame:\n\t\t\t\treturn IconFrame\n\t\t\tcase Tools.CreateRounded:\n\t\t\t\treturn IconOval\n\t\t\tcase Tools.CreateImage:\n\t\t\t\treturn IconImage\n\t\t\tcase Tools.CreateStack:\n\t\t\t\treturn IconRows\n\t\t\tcase Tools.CreateRows:\n\t\t\t\treturn IconRows\n\t\t\tcase Tools.CreateColumns:\n\t\t\t\treturn IconColumns\n\t\t\tcase Tools.CreateGrid:\n\t\t\t\treturn IconGrid\n\t\t\tcase Tools.CreateMasonry:\n\t\t\t\treturn IconMasonryGrid\n\t\t\tcase Tools.CreateVideo:\n\t\t\t\treturn IconVideo\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n\tlayoutMenuByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateFrame:\n\t\t\t\treturn iconFrameString\n\t\t\tcase Tools.CreateRounded:\n\t\t\t\treturn iconOvalString\n\t\t\tcase Tools.CreateImage:\n\t\t\t\treturn iconImageString\n\t\t\tcase Tools.CreateStack:\n\t\t\t\treturn iconRowsString\n\t\t\tcase Tools.CreateRows:\n\t\t\t\treturn iconRowsString\n\t\t\tcase Tools.CreateColumns:\n\t\t\t\treturn iconColumnsString\n\t\t\tcase Tools.CreateGrid:\n\t\t\t\treturn iconGridString\n\t\t\tcase Tools.CreateMasonry:\n\t\t\t\treturn iconMasonryGridString\n\t\t\tcase Tools.CreateVideo:\n\t\t\t\treturn iconVideoString\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n\tshapeButtonByTool: _ => {\n\t\treturn IconToolPath\n\t},\n\tshapeMenuByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateRectangleShape:\n\t\t\t\treturn iconRectString\n\t\t\tcase Tools.CreateOvalShape:\n\t\t\t\treturn iconOvalString\n\t\t\tcase Tools.CreatePolygonShape:\n\t\t\t\treturn iconPolygonString\n\t\t\tcase Tools.CreateStarShape:\n\t\t\t\treturn iconStarString\n\t\t\tcase Tools.Path:\n\t\t\t\treturn iconPathString\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n}\n\nconst agentIconSet: ToolbarIconSet = {\n\tsize: 20,\n\teditFields: NewIconEdit,\n\tfilter: NewIconFilter,\n\tglossary: NewIconGlossary,\n\timport: NewIconImport,\n\tinsert: NewIconInsert,\n\tfullscreen: NewIconFullscreen,\n\tlayout: NewIconFrame,\n\tmagic: IconAgentToolbarMagic,\n\toptions: NewIconOptions,\n\treload: NewReloadIcon,\n\tplugins: NewIconPlugins,\n\tpublish: NewIconPublish,\n\ttext: NewIconText,\n\tvariables: NewIconEdit,\n\tvector: NewIconToolPath,\n\tversions: NewIconClock,\n\tlayoutButtonByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateFrame:\n\t\t\t\treturn NewIconFrame\n\t\t\tcase Tools.CreateRounded:\n\t\t\t\treturn NewIconOval\n\t\t\tcase Tools.CreateImage:\n\t\t\t\treturn NewIconImage\n\t\t\tcase Tools.CreateStack:\n\t\t\t\treturn NewIconRows\n\t\t\tcase Tools.CreateRows:\n\t\t\t\treturn NewIconRows\n\t\t\tcase Tools.CreateColumns:\n\t\t\t\treturn NewIconColumns\n\t\t\tcase Tools.CreateGrid:\n\t\t\t\treturn NewIconGrid\n\t\t\tcase Tools.CreateMasonry:\n\t\t\t\treturn NewIconMasonryGrid\n\t\t\tcase Tools.CreateVideo:\n\t\t\t\treturn NewIconVideo\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n\tlayoutMenuByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateFrame:\n\t\t\t\treturn newIconFrameString\n\t\t\tcase Tools.CreateRounded:\n\t\t\t\treturn newIconOvalString\n\t\t\tcase Tools.CreateImage:\n\t\t\t\treturn newIconImageString\n\t\t\tcase Tools.CreateStack:\n\t\t\t\treturn newIconRowsString\n\t\t\tcase Tools.CreateRows:\n\t\t\t\treturn newIconRowsString\n\t\t\tcase Tools.CreateColumns:\n\t\t\t\treturn newIconColumnsString\n\t\t\tcase Tools.CreateGrid:\n\t\t\t\treturn newIconGridString\n\t\t\tcase Tools.CreateMasonry:\n\t\t\t\treturn newIconMasonryGridString\n\t\t\tcase Tools.CreateVideo:\n\t\t\t\treturn newIconVideoString\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n\tshapeButtonByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateRectangleShape:\n\t\t\t\treturn NewIconRect\n\t\t\tcase Tools.CreateOvalShape:\n\t\t\t\treturn NewIconOval\n\t\t\tcase Tools.CreatePolygonShape:\n\t\t\t\treturn NewIconPolygon\n\t\t\tcase Tools.CreateStarShape:\n\t\t\t\treturn NewIconStar\n\t\t\tcase Tools.Path:\n\t\t\t\treturn NewIconPath\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n\tshapeMenuByTool: tool => {\n\t\tswitch (tool) {\n\t\t\tcase Tools.CreateRectangleShape:\n\t\t\t\treturn newIconRectString\n\t\t\tcase Tools.CreateOvalShape:\n\t\t\t\treturn newIconOvalString\n\t\t\tcase Tools.CreatePolygonShape:\n\t\t\t\treturn newIconPolygonString\n\t\t\tcase Tools.CreateStarShape:\n\t\t\t\treturn newIconStarString\n\t\t\tcase Tools.Path:\n\t\t\t\treturn newIconPathString\n\t\t\tdefault:\n\t\t\t\tassertNever(tool)\n\t\t}\n\t},\n}\n\nexport function getToolbarIconSet(isAgentExperimentOn: boolean): ToolbarIconSet {\n\treturn isAgentExperimentOn ? agentIconSet : iconSet\n}\n\nexport function isLayoutTool(tool: Tools): tool is LayoutTool {\n\treturn layoutToolSet.has(tool)\n}\n\nexport function isShapeTool(tool: Tools): tool is ShapeTool {\n\treturn shapeToolSet.has(tool)\n}\n", "export function IconMagicContained() {\n\treturn (\n\t\t<svg width=\"18\" height=\"18\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M14,0 C16.209139,0 18,1.790861 18,4 L18,14 C18,16.209139 16.209139,18 14,18 L4,18 C1.790861,18 0,16.209139 0,14 L0,4 C0,1.790861 1.790861,0 4,0 L14,0 Z M5.49075,11.6025 C5.41875,11.2815 4.96175,11.2815 4.89075,11.6025 L4.69175,12.4975 C4.62975,12.7755 4.41275,12.9925 4.13475,13.0545 L3.24075,13.2525 C2.91975,13.3245 2.91975,13.7815 3.24075,13.8525 L4.13475,14.0515 C4.41275,14.1135 4.62975,14.3305 4.69175,14.6085 L4.89075,15.5025 C4.96175,15.8235 5.41875,15.8235 5.49075,15.5025 L5.68875,14.6085 C5.75075,14.3305 5.96775,14.1135 6.24575,14.0515 L7.14075,13.8525 C7.46175,13.7815 7.46175,13.3245 7.14075,13.2525 L6.24575,13.0545 C5.96775,12.9925 5.75075,12.7755 5.68875,12.4975 Z M10.67275,3.5745 C10.50275,2.8085 9.41175,2.8085 9.24075,3.5745 L8.59175,6.4975 C8.52975,6.7755 8.31275,6.9925 8.03475,7.0545 L5.11175,7.7035 C4.34575,7.8735 4.34575,8.9655 5.11175,9.1355 L8.03475,9.7845 C8.31275,9.8465 8.52975,10.0635 8.59175,10.3415 L9.24075,13.2645 C9.41175,14.0305 10.50275,14.0305 10.67275,13.2645 L11.32275,10.3415 C11.38475,10.0635 11.60175,9.8465 11.87975,9.7845 L14.80275,9.1355 C15.56775,8.9655 15.56775,7.8735 14.80275,7.7035 L11.87975,7.0545 C11.60175,6.9925 11.38475,6.7755 11.32275,6.4975 Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconAgentToolbarMagic() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\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=\"2\"\n\t\t\t\td=\"M8.385 2.996a1.62 1.62 0 0 1 3.23 0V3A5.85 5.85 0 0 0 17 8.385h.004a1.62 1.62 0 0 1 0 3.23H17A5.85 5.85 0 0 0 11.615 17v.004a1.62 1.62 0 0 1-3.23 0V17A5.85 5.85 0 0 0 3 11.615h-.004a1.62 1.62 0 0 1 0-3.23H3A5.85 5.85 0 0 0 8.385 3Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconColumns() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 11.5 C 0 10.395 0.895 9.5 2 9.5 L 16 9.5 C 17.105 9.5 18 10.395 18 11.5 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 6.5 C 18 7.605 17.105 8.5 16 8.5 L 2 8.5 C 0.895 8.5 0 7.605 0 6.5 Z\"\n\t\t\t\ttransform=\"rotate(-90 9 9)\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconFilter() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm3.5 1a1 1 0 0 0 1 1h9a1 1 0 0 0 0-2h-9a1 1 0 0 0-1 1Zm2 4a1 1 0 0 0 1 1h5a1 1 0 0 0 0-2h-5a1 1 0 0 0-1 1Zm2 4a1 1 0 0 0 1 1h1a1 1 0 0 0 0-2h-1a1 1 0 0 0-1 1Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconFrame() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconFullscreen() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M1 5a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H5a4 4 0 0 1-4-4Zm15 0a1 1 0 0 0-1-1h-5a1 1 0 0 0 0 2h2.586L6 12.586V10a1 1 0 0 0-2 0v5a1 1 0 0 0 1 1h5a1 1 0 0 0 0-2H7.414L14 7.414V10a1 1 0 0 0 2 0Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconGlossary() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 6 12.793 C 6 13.238 6.539 13.461 6.854 13.146 L 8.646 11.354 C 8.842 11.158 9.158 11.158 9.354 11.354 L 11.146 13.146 C 11.461 13.461 12 13.238 12 12.793 L 12 5 C 12 4.448 11.552 4 11 4 L 7 4 C 6.448 4 6 4.448 6 5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export const IconGrid = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 10.5 C 0 9.948 0.448 9.5 1 9.5 L 7.5 9.5 C 8.052 9.5 8.5 9.948 8.5 10.5 L 8.5 17 C 8.5 17.552 8.052 18 7.5 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 9.5 10.5 C 9.5 9.948 9.948 9.5 10.5 9.5 L 17 9.5 C 17.552 9.5 18 9.948 18 10.5 L 18 14 C 18 16.209 16.209 18 14 18 L 10.5 18 C 9.948 18 9.5 17.552 9.5 17 Z M 0 4 C 0 1.791 1.791 0 4 0 L 7.5 0 C 8.052 0 8.5 0.448 8.5 1 L 8.5 7.5 C 8.5 8.052 8.052 8.5 7.5 8.5 L 1 8.5 C 0.448 8.5 0 8.052 0 7.5 Z M 9.5 1 C 9.5 0.448 9.948 0 10.5 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 7.5 C 18 8.052 17.552 8.5 17 8.5 L 10.5 8.5 C 9.948 8.5 9.5 8.052 9.5 7.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconImage() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm12 .5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm-9.34 8.6A1.25 1.25 0 0 0 3.73 15h10.5a1.25 1.25 0 0 0 1.05-1.92l-1.22-1.92a1.25 1.25 0 0 0-2.12 0l-.91 1.44-2.96-4.85a1.25 1.25 0 0 0-2.14 0Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconImport() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm7.914 6.5L5.621 8.207a1 1 0 0 0-1.414 0l-.086.086a1 1 0 0 0 0 1.414l4.086 4.086a1 1 0 0 0 1.414 0l4.086-4.086a.999.999 0 0 0 0-1.414l-.086-.086a1 1 0 0 0-1.414 0L9.914 10.5V5a1 1 0 0 0-2 0Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconInsert() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 8 8 L 5 8 C 4.448 8 4 8.448 4 9 C 4 9.552 4.448 10 5 10 L 8 10 L 8 13 C 8 13.552 8.448 14 9 14 C 9.552 14 10 13.552 10 13 L 10 10 L 13 10 C 13.552 10 14 9.552 14 9 C 14 8.448 13.552 8 13 8 L 10 8 L 10 5 C 10 4.448 9.552 4 9 4 C 8.448 4 8 4.448 8 5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n\nexport const IconNewItem = IconInsert\n", "export const IconLayout = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 10.5 C 0 9.948 0.448 9.5 1 9.5 L 7.5 9.5 C 8.052 9.5 8.5 9.948 8.5 10.5 L 8.5 17 C 8.5 17.552 8.052 18 7.5 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 9.5 10.5 C 9.5 9.948 9.948 9.5 10.5 9.5 L 17 9.5 C 17.552 9.5 18 9.948 18 10.5 L 18 14 C 18 16.209 16.209 18 14 18 L 10.5 18 C 9.948 18 9.5 17.552 9.5 17 Z M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 7.5 C 18 8.052 17.552 8.5 17 8.5 L 1 8.5 C 0.448 8.5 0 8.052 0 7.5 Z\"\n\t\t\t\ttransform=\"rotate(-90 9 9)\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export const IconMasonryGrid = () => {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" role=\"presentation\">\n\t\t\t<path\n\t\t\t\td=\"M 0 13.5 C 0 12.948 0.448 12.5 1 12.5 L 7.5 12.5 C 8.052 12.5 8.5 12.948 8.5 13.5 L 8.5 17 C 8.5 17.552 8.052 18 7.5 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 9.5 7.5 C 9.5 6.948 9.948 6.5 10.5 6.5 L 17 6.5 C 17.552 6.5 18 6.948 18 7.5 L 18 14 C 18 16.209 16.209 18 14 18 L 10.5 18 C 9.948 18 9.5 17.552 9.5 17 Z M 0 4 C 0 1.791 1.791 0 4 0 L 7.5 0 C 8.052 0 8.5 0.448 8.5 1 L 8.5 10.5 C 8.5 11.052 8.052 11.5 7.5 11.5 L 1 11.5 C 0.448 11.5 0 11.052 0 10.5 Z M 9.5 1 C 9.5 0.448 9.948 0 10.5 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 4.5 C 18 5.052 17.552 5.5 17 5.5 L 10.5 5.5 C 9.948 5.5 9.5 5.052 9.5 4.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconOptions() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 7.5 9 C 7.5 9.828 8.172 10.5 9 10.5 C 9.828 10.5 10.5 9.828 10.5 9 C 10.5 8.172 9.828 7.5 9 7.5 C 8.172 7.5 7.5 8.172 7.5 9 Z M 12 9 C 12 9.828 12.672 10.5 13.5 10.5 C 14.328 10.5 15 9.828 15 9 C 15 8.172 14.328 7.5 13.5 7.5 C 12.672 7.5 12 8.172 12 9 Z M 3 9 C 3 9.828 3.672 10.5 4.5 10.5 C 5.328 10.5 6 9.828 6 9 C 6 8.172 5.328 7.5 4.5 7.5 C 3.672 7.5 3 8.172 3 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconOval() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<path\n\t\t\t\td=\"M 1.5 10 C 1.5 5.306 5.306 1.5 10 1.5 L 10 1.5 C 14.694 1.5 18.5 5.306 18.5 10 L 18.5 10 C 18.5 14.694 14.694 18.5 10 18.5 L 10 18.5 C 5.306 18.5 1.5 14.694 1.5 10 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconPlugins() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm11.5 7.5h-1a1 1 0 0 0 0 2h1v1a1 1 0 0 0 2 0v-1h1a1 1 0 0 0 0-2h-1v-1a1 1 0 0 0-2 0Zm-1.5-6a2.5 2.5 0 1 0 5 0 2.5 2.5 0 0 0-5 0ZM2.785 7.095A.6.6 0 0 0 3.301 8h4.398a.6.6 0 0 0 .516-.905L6.017 3.374a.6.6 0 0 0-1.034 0Zm.245 4.875a.749.749 0 0 0 0 1.06l1.94 1.94a.749.749 0 0 0 1.06 0l1.94-1.94a.749.749 0 0 0 0-1.06l-1.94-1.94a.749.749 0 0 0-1.06 0Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconRows() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 11.5 C 0 10.395 0.895 9.5 2 9.5 L 16 9.5 C 17.105 9.5 18 10.395 18 11.5 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 6.5 C 18 7.605 17.105 8.5 16 8.5 L 2 8.5 C 0.895 8.5 0 7.605 0 6.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconText() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 4.5 6 C 4.5 6.552 4.948 7 5.5 7 L 8 7 L 8 12.5 C 8 13.052 8.448 13.5 9 13.5 C 9.552 13.5 10 13.052 10 12.5 L 10 7 L 12.5 7 C 13.052 7 13.5 6.552 13.5 6 C 13.5 5.448 13.052 5 12.5 5 L 5.5 5 C 4.948 5 4.5 5.448 4.5 6 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconToolPath() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\" role=\"presentation\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 10.5 5 C 10.5 5.299 10.553 5.587 10.649 5.853 L 5.972 10.696 C 5.673 10.57 5.345 10.5 5 10.5 C 3.619 10.5 2.5 11.619 2.5 13 C 2.5 14.381 3.619 15.5 5 15.5 C 6.381 15.5 7.5 14.381 7.5 13 C 7.5 12.701 7.447 12.413 7.351 12.147 L 12.028 7.304 C 12.327 7.43 12.655 7.5 13 7.5 C 14.381 7.5 15.5 6.381 15.5 5 C 15.5 3.619 14.381 2.5 13 2.5 C 11.619 2.5 10.5 3.619 10.5 5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconVariables() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 5 6 C 5 6.552 5.448 7 6 7 L 9.586 7 L 4.818 11.768 C 4.427 12.158 4.427 12.791 4.818 13.182 C 5.209 13.573 5.842 13.573 6.232 13.182 L 11 8.414 L 11 12 C 11 12.552 11.448 13 12 13 C 12.552 13 13 12.552 13 12 L 13 6 C 13 5.448 12.552 5 12 5 L 6 5 C 5.448 5 5 5.448 5 6 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconVideo() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm6 8.617a.5.5 0 0 0 .757.429l6.028-3.617a.5.5 0 0 0 0-.858L6.757 4.954A.5.5 0 0 0 6 5.383Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconClock() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Clock</title>\n\t\t\t<path\n\t\t\t\td=\"M 1 10 C 1 5.029 5.029 1 10 1 L 10 1 C 14.971 1 19 5.029 19 10 L 19 10 C 19 14.971 14.971 19 10 19 L 10 19 C 5.029 19 1 14.971 1 10 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 10 4.5 L 10 10\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 10 10 L 13.5 10\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconColumns() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Columns</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 10 4 L 10 16\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "export function NewIconFilter() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Filter</title>\n\t\t\t<path\n\t\t\t\td=\"M 1 4 C 1 3.448 1.448 3 2 3 L 18 3 C 18.552 3 19 3.448 19 4 L 19 4 C 19 4.552 18.552 5 18 5 L 2 5 C 1.448 5 1 4.552 1 4 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 4 10 C 4 9.448 4.448 9 5 9 L 15 9 C 15.552 9 16 9.448 16 10 L 16 10 C 16 10.552 15.552 11 15 11 L 5 11 C 4.448 11 4 10.552 4 10 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 7 16 C 7 15.448 7.448 15 8 15 L 12 15 C 12.552 15 13 15.448 13 16 L 13 16 C 13 16.552 12.552 17 12 17 L 8 17 C 7.448 17 7 16.552 7 16 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconFrame() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Frame</title>\n\t\t\t<path\n\t\t\t\td=\"M 2.5 5.5 C 2.5 3.843 3.843 2.5 5.5 2.5 L 14.5 2.5 C 16.157 2.5 17.5 3.843 17.5 5.5 L 17.5 14.5 C 17.5 16.157 16.157 17.5 14.5 17.5 L 5.5 17.5 C 3.843 17.5 2.5 16.157 2.5 14.5 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 7.5 3 L 6 3 C 4.343 3 3 4.343 3 6 L 3 7.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 12.5 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 7.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 12.5 17 L 14 17 C 15.657 17 17 15.657 17 14 L 17 12.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 7.5 17 L 6 17 C 4.343 17 3 15.657 3 14 L 3 12.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconFullscreen() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Fullscreen</title>\n\t\t\t<path\n\t\t\t\td=\"M10 3.5h6a.5.5 0 0 1 .5.5v6\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M10 16.5H4a.5.5 0 0 1-.5-.5v-6\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M4 16 16 4\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconGlossary() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Glossary</title>\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=\"2\"\n\t\t\t\td=\"M4 5a2.5 2.5 0 0 1 2.5-2.5h7A2.5 2.5 0 0 1 16 5v13l-6-4-6 4Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconGrid() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Grid</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t\t<path d=\"M 10 4 L 10 16\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "export function NewIconImage() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Image</title>\n\t\t\t<path\n\t\t\t\td=\"M3 6a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M3 13c3.402-4.859 10.598-4.859 14 0v1a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconImport() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Import</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 10.5 L 9.293 16.793 C 9.683 17.183 10.317 17.183 10.707 16.793 L 17 10.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 10 16 L 10 2\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconInsert() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Insert</title>\n\t\t\t<path\n\t\t\t\td=\"M 10 3 L 10 17\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 3 10 L 17 10\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconMasonryGrid() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Masonry Grid</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t\t<path d=\"M 8 4 L 8 9\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t\t<path d=\"M 12 11 L 12 16\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "export function NewIconOptions() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Options</title>\n\t\t\t<path\n\t\t\t\td=\"M 2 7.255 C 2 6.171 2.585 5.171 3.529 4.64 L 8.529 1.827 C 9.442 1.314 10.558 1.314 11.471 1.827 L 16.471 4.64 C 17.415 5.171 18 6.171 18 7.255 L 18 12.745 C 18 13.829 17.415 14.829 16.471 15.36 L 11.471 18.173 C 10.558 18.686 9.442 18.686 8.529 18.173 L 3.529 15.36 C 2.585 14.829 2 13.829 2 12.745 Z M 7 10 C 7 11.657 8.343 13 10 13 C 11.657 13 13 11.657 13 10 C 13 8.343 11.657 7 10 7 C 8.343 7 7 8.343 7 10 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconOval() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Oval</title>\n\t\t\t<path\n\t\t\t\td=\"M 2.5 10 C 2.5 5.858 5.858 2.5 10 2.5 L 10 2.5 C 14.142 2.5 17.5 5.858 17.5 10 L 17.5 10 C 17.5 14.142 14.142 17.5 10 17.5 L 10 17.5 C 5.858 17.5 2.5 14.142 2.5 10 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconPath() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Path</title>\n\t\t\t<path\n\t\t\t\td=\"M14.5 2.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6M5.5 11.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 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=\"2\"\n\t\t\t/>\n\t\t\t<path d=\"m8 12 4-4\" fill=\"transparent\" stroke=\"currentColor\" strokeWidth=\"2\" />\n\t\t</svg>\n\t)\n}\n", "export function NewIconPlugins() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Plugins</title>\n\t\t\t<g transform=\"translate(11.25 11.25)\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 1 5 C 0.448 5 0 4.552 0 4 L 0 4 C 0 3.448 0.448 3 1 3 L 7 3 C 7.552 3 8 3.448 8 4 L 8 4 C 8 4.552 7.552 5 7 5 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 1 2 C 0.448 2 0 1.552 0 1 L 0 1 C 0 0.448 0.448 0 1 0 L 7 0 C 7.552 0 8 0.448 8 1 L 8 1 C 8 1.552 7.552 2 7 2 Z\"\n\t\t\t\t\ttransform=\"translate(0 3) rotate(-90 4 1)\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<path\n\t\t\t\td=\"M 1.447 6.995 C 1.25 7.328 1.49 7.75 1.877 7.75 L 8.123 7.75 C 8.51 7.75 8.75 7.328 8.553 6.995 L 5.43 1.726 C 5.236 1.399 4.764 1.399 4.57 1.726 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 5 1.5 L 1.5 7.5 L 8.5 7.5 Z\" fill=\"rgba(136, 136, 136, 0.2)\" />\n\t\t\t<path\n\t\t\t\td=\"M 15 1.5 C 16.657 1.5 18 2.843 18 4.5 C 18 6.157 16.657 7.5 15 7.5 C 13.343 7.5 12 6.157 12 4.5 C 12 2.843 13.343 1.5 15 1.5 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t/>\n\t\t\t<path d=\"M 5 11.5 L 1.5 15.25 L 5 19 L 8.5 15.25 Z\" fill=\"rgba(136, 136, 136, 0.2)\" />\n\t\t\t<path\n\t\t\t\td=\"M 11.75 4.5 C 11.75 2.705 13.205 1.25 15 1.25 L 15 1.25 C 16.795 1.25 18.25 2.705 18.25 4.5 L 18.25 4.5 C 18.25 6.295 16.795 7.75 15 7.75 L 15 7.75 C 13.205 7.75 11.75 6.295 11.75 4.5 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 4.47 12.03 C 4.763 11.737 5.237 11.737 5.53 12.03 L 8.22 14.72 C 8.513 15.013 8.513 15.487 8.22 15.78 L 5.53 18.47 C 5.237 18.763 4.763 18.763 4.47 18.47 L 1.78 15.78 C 1.487 15.487 1.487 15.013 1.78 14.72 Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconPolygon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Polygon</title>\n\t\t\t<path\n\t\t\t\td=\"M 9 1.789 C 9.309 1.61 9.691 1.61 10 1.789 L 15.928 5.211 C 16.238 5.39 16.428 5.72 16.428 6.077 L 16.428 12.923 C 16.428 13.28 16.238 13.61 15.928 13.789 L 10 17.211 C 9.691 17.39 9.309 17.39 9 17.211 L 3.072 13.789 C 2.762 13.61 2.572 13.28 2.572 12.923 L 2.572 6.077 C 2.572 5.72 2.762 5.39 3.072 5.211 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconPublish() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Publish</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 9.5 L 9.293 3.207 C 9.683 2.817 10.317 2.817 10.707 3.207 L 17 9.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 10 17 L 10 3\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconRect() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Rectangle</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import React from \"react\"\n\nexport const NewIconReload = React.forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement>>(\n\tfunction NewIconReload(props, forwardedRef) {\n\t\treturn (\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" ref={forwardedRef} {...props}>\n\t\t\t\t<title>Reload</title>\n\t\t\t\t<path\n\t\t\t\t\td=\"M11 9h5.5a.5.5 0 0 0 .5-.5V3\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M14.596 14.596a6.5 6.5 0 1 1 1.772-5.906\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t)\n\t},\n)\n", "export function NewIconRows() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Rows</title>\n\t\t\t<path\n\t\t\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" strokeWidth=\"2\" stroke=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "export function NewIconStar() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<title>Star</title>\n\t\t\t<path\n\t\t\t\td=\"m10 2.264 2.821 4.117 4.787 1.411-3.043 3.955.137 4.989L10 15.064l-4.702 1.672.137-4.989-3.043-3.955 4.787-1.411Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 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=\"2\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconText() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<g fill=\"currentColor\">\n\t\t\t\t<path d=\"M9 4a1 1 0 0 1 2 0v12a1 1 0 0 1-2 0Z\" />\n\t\t\t\t<path d=\"M2.5 3.5a1 1 0 0 1 1-1h13a1 1 0 0 1 0 2h-13a1 1 0 0 1-1-1\" />\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconToolPath() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Tool Path</title>\n\t\t\t<path\n\t\t\t\td=\"M 10.856 3.919 C 10.467 3.274 9.533 3.274 9.144 3.919 L 2.165 15.483 C 1.763 16.15 2.243 17 3.021 17 L 16.979 17 C 17.757 17 18.237 16.15 17.835 15.483 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function NewIconVideo() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t\t\t<title>Video</title>\n\t\t\t<path\n\t\t\t\td=\"M 4.5 4.304 C 4.5 3.519 5.364 3.04 6.03 3.456 L 15.143 9.152 C 15.77 9.544 15.77 10.456 15.143 10.848 L 6.03 16.544 C 5.364 16.96 4.5 16.481 4.5 15.696 Z\"\n\t\t\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export const iconColumnsString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path\n\t\td=\"M 0 11.5 C 0 10.395 0.895 9.5 2 9.5 L 16 9.5 C 17.105 9.5 18 10.395 18 11.5 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 6.5 C 18 7.605 17.105 8.5 16 8.5 L 2 8.5 C 0.895 8.5 0 7.605 0 6.5 Z\"\n\t\ttransform=\"rotate(-90 9 9)\"\n\t\tfill=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const iconFrameString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path\n\t\td=\"M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z\"\n\t\tfill=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const iconGridString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path\n\t\td=\"M 0 10.5 C 0 9.948 0.448 9.5 1 9.5 L 7.5 9.5 C 8.052 9.5 8.5 9.948 8.5 10.5 L 8.5 17 C 8.5 17.552 8.052 18 7.5 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 9.5 10.5 C 9.5 9.948 9.948 9.5 10.5 9.5 L 17 9.5 C 17.552 9.5 18 9.948 18 10.5 L 18 14 C 18 16.209 16.209 18 14 18 L 10.5 18 C 9.948 18 9.5 17.552 9.5 17 Z M 0 4 C 0 1.791 1.791 0 4 0 L 7.5 0 C 8.052 0 8.5 0.448 8.5 1 L 8.5 7.5 C 8.5 8.052 8.052 8.5 7.5 8.5 L 1 8.5 C 0.448 8.5 0 8.052 0 7.5 Z M 9.5 1 C 9.5 0.448 9.948 0 10.5 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 7.5 C 18 8.052 17.552 8.5 17 8.5 L 10.5 8.5 C 9.948 8.5 9.5 8.052 9.5 7.5 Z\"\n\t\tfill=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const iconImageString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path\n\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm12 .5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 0 0-3 0Zm-9.34 8.6A1.25 1.25 0 0 0 3.73 15h10.5a1.25 1.25 0 0 0 1.05-1.92l-1.22-1.92a1.25 1.25 0 0 0-2.12 0l-.91 1.44-2.96-4.85a1.25 1.25 0 0 0-2.14 0Z\"\n\t\tfill=\"currentColor\"\n\t/>\n</svg>\n`\n", "export const iconMasonryGridString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" role=\"presentation\">\n\t<path\n\t\td=\"M 0 13.5 C 0 12.948 0.448 12.5 1 12.5 L 7.5 12.5 C 8.052 12.5 8.5 12.948 8.5 13.5 L 8.5 17 C 8.5 17.552 8.052 18 7.5 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 9.5 7.5 C 9.5 6.948 9.948 6.5 10.5 6.5 L 17 6.5 C 17.552 6.5 18 6.948 18 7.5 L 18 14 C 18 16.209 16.209 18 14 18 L 10.5 18 C 9.948 18 9.5 17.552 9.5 17 Z M 0 4 C 0 1.791 1.791 0 4 0 L 7.5 0 C 8.052 0 8.5 0.448 8.5 1 L 8.5 10.5 C 8.5 11.052 8.052 11.5 7.5 11.5 L 1 11.5 C 0.448 11.5 0 11.052 0 10.5 Z M 9.5 1 C 9.5 0.448 9.948 0 10.5 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 4.5 C 18 5.052 17.552 5.5 17 5.5 L 10.5 5.5 C 9.948 5.5 9.5 5.052 9.5 4.5 Z\"\n\t\tfill=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const iconOvalString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\">\n\t<path d=\"M 0 9 C 0 4.029 4.029 0 9 0 L 9 0 C 13.971 0 18 4.029 18 9 L 18 9 C 18 13.971 13.971 18 9 18 L 9 18 C 4.029 18 0 13.971 0 9 Z\" fill=\"currentColor\"></path>\n</svg>\n`\n", "export const iconPathString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\">\n\t<path d=\"M 4.5 10.5 C 4.94 10.5 5.358 10.595 5.735 10.765 L 10.765 5.735 C 10.595 5.358 10.5 4.94 10.5 4.5 C 10.5 2.843 11.843 1.5 13.5 1.5 C 15.157 1.5 16.5 2.843 16.5 4.5 C 16.5 6.157 15.157 7.5 13.5 7.5 C 13.06 7.5 12.642 7.405 12.265 7.235 L 7.235 12.265 C 7.405 12.642 7.5 13.06 7.5 13.5 C 7.5 15.157 6.157 16.5 4.5 16.5 C 2.843 16.5 1.5 15.157 1.5 13.5 C 1.5 11.843 2.843 10.5 4.5 10.5 Z\" fill=\"currentColor\"></path>\n</svg>\n`\n", "export const iconPolygonString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\">\n\t<path d=\"M 8.5 0.289 C 8.809 0.11 9.191 0.11 9.5 0.289 L 16.294 4.211 C 16.604 4.39 16.794 4.72 16.794 5.077 L 16.794 12.923 C 16.794 13.28 16.604 13.61 16.294 13.789 L 9.5 17.711 C 9.191 17.89 8.809 17.89 8.5 17.711 L 1.706 13.789 C 1.396 13.61 1.206 13.28 1.206 12.923 L 1.206 5.077 C 1.206 4.72 1.396 4.39 1.706 4.211 Z\" fill=\"currentColor\"></path>\n</svg>\n`\n", "export const iconRectString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" fill=\"none\">\n\t<path d=\"M 0 2 C 0 0.895 0.895 0 2 0 L 16 0 C 17.105 0 18 0.895 18 2 L 18 16 C 18 17.105 17.105 18 16 18 L 2 18 C 0.895 18 0 17.105 0 16 Z\" fill=\"currentColor\"></path>\n</svg>\n`\n", "export const iconRowsString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path\n\t\td=\"M 0 11.5 C 0 10.395 0.895 9.5 2 9.5 L 16 9.5 C 17.105 9.5 18 10.395 18 11.5 L 18 14 C 18 16.209 16.209 18 14 18 L 4 18 C 1.791 18 0 16.209 0 14 Z M 0 4 C 0 1.791 1.791 0 4 0 L 14 0 C 16.209 0 18 1.791 18 4 L 18 6.5 C 18 7.605 17.105 8.5 16 8.5 L 2 8.5 C 0.895 8.5 0 7.605 0 6.5 Z\"\n\t\tfill=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const iconStarString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t<path d=\"M 9.077 1.27 C 9.418 0.449 10.582 0.449 10.923 1.27 L 12.675 5.482 C 12.819 5.828 13.145 6.065 13.518 6.095 L 18.065 6.459 C 18.952 6.53 19.311 7.637 18.636 8.215 L 15.172 11.183 C 14.887 11.427 14.762 11.809 14.849 12.174 L 15.908 16.611 C 16.114 17.476 15.173 18.16 14.414 17.696 L 10.521 15.319 C 10.201 15.123 9.799 15.123 9.479 15.319 L 5.586 17.696 C 4.827 18.16 3.886 17.476 4.092 16.611 L 5.151 12.174 C 5.238 11.809 5.113 11.427 4.828 11.183 L 1.364 8.215 C 0.689 7.637 1.048 6.53 1.935 6.459 L 6.482 6.095 C 6.855 6.065 7.181 5.828 7.325 5.482 Z\" fill=\"currentColor\"></path>\n</svg>\n`\n", "export const iconVideoString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t<path fill=\"currentColor\" d=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm6 8.617a.5.5 0 0 0 .757.429l6.028-3.617a.5.5 0 0 0 0-.858L6.757 4.954A.5.5 0 0 0 6 5.383Z\"/>\n</svg>\n`\n", "export const newIconColumnsString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t/>\n\t<path d=\"M 10 4 L 10 16\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n</svg>\n`\n", "export const newIconFrameString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n   <path\n\t\td=\"M 2.5 5.5 C 2.5 3.843 3.843 2.5 5.5 2.5 L 14.5 2.5 C 16.157 2.5 17.5 3.843 17.5 5.5 L 17.5 14.5 C 17.5 16.157 16.157 17.5 14.5 17.5 L 5.5 17.5 C 3.843 17.5 2.5 16.157 2.5 14.5 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t></path>\n   \t<path\n\t\td=\"M 7.5 3 L 6 3 C 4.343 3 3 4.343 3 6 L 3 7.5\"\n\t\tfill=\"transparent\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n     \tstroke-linejoin=\"round\"\n    ></path>\n   \t<path\n\t\td=\"M 12.5 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 7.5\"\n\t\tfill=\"transparent\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t></path>\n  \t<path\n    \td=\"M 12.5 17 L 14 17 C 15.657 17 17 15.657 17 14 L 17 12.5\"\n\t\tfill=\"transparent\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t></path>\n   \t<path\n   \t\td=\"M 7.5 17 L 6 17 C 4.343 17 3 15.657 3 14 L 3 12.5\"\n\t\tfill=\"transparent\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t></path>\n</svg>\n`\n", "export const newIconGridString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t/>\n\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n\t<path d=\"M 10 4 L 10 16\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n</svg>\n`\n", "export const newIconImageString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t<path\n\t\td=\"M3 6a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3Z\"\n\t\tfill=\"transparent\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-width=\"2\"\n\t/>\n\t<path\n\t\td=\"M3 13c3.402-4.859 10.598-4.859 14 0v1a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3z\"\n\t\tfill=\"currentColor\"\n\t\tfill-opacity=\"0.2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-width=\"2\"\n\t/>\n</svg>\n`\n", "export const newIconMasonryGridString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t/>\n\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n\t<path d=\"M 8 4 L 8 9\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n\t<path d=\"M 12 11 L 12 16\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n</svg>\n`\n", "export const newIconOvalString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 2.5 10 C 2.5 5.858 5.858 2.5 10 2.5 L 10 2.5 C 14.142 2.5 17.5 5.858 17.5 10 L 17.5 10 C 17.5 14.142 14.142 17.5 10 17.5 L 10 17.5 C 5.858 17.5 2.5 14.142 2.5 10 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t/>\n</svg>\n`\n", "export const newIconPathString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t<path\n\t\td=\"M14.5 2.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6M5.5 11.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t\tstroke-width=\"2\"\n\t/>\n\t<path\n\t\td=\"m8 12 4-4\"\n\t\tfill=\"transparent\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-width=\"2\"\n\t/>\n</svg>\n`\n", "export const newIconPolygonString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 9 1.789 C 9.309 1.61 9.691 1.61 10 1.789 L 15.928 5.211 C 16.238 5.39 16.428 5.72 16.428 6.077 L 16.428 12.923 C 16.428 13.28 16.238 13.61 15.928 13.789 L 10 17.211 C 9.691 17.39 9.309 17.39 9 17.211 L 3.072 13.789 C 2.762 13.61 2.572 13.28 2.572 12.923 L 2.572 6.077 C 2.572 5.72 2.762 5.39 3.072 5.211 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t></path>\n</svg>\n`\n", "export const newIconRectString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t></path>\n</svg>\n`\n", "export const newIconRowsString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 3 6 C 3 4.343 4.343 3 6 3 L 14 3 C 15.657 3 17 4.343 17 6 L 17 14 C 17 15.657 15.657 17 14 17 L 6 17 C 4.343 17 3 15.657 3 14 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t/>\n\t<path d=\"M 4 10 L 16 10\" fill=\"rgba(136, 136, 136, 0.2)\" stroke-width=\"2\" stroke=\"currentColor\" />\n</svg>\n`\n", "export const newIconStarString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t<path\n\t\td=\"m10 2.264 2.821 4.117 4.787 1.411-3.043 3.955.137 4.989L10 15.064l-4.702 1.672.137-4.989-3.043-3.955 4.787-1.411Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t\tstroke-width=\"2\"\n\t/>\n</svg>\n`\n", "export const newIconVideoString = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\">\n\t<path\n\t\td=\"M 4.5 4.304 C 4.5 3.519 5.364 3.04 6.03 3.456 L 15.143 9.152 C 15.77 9.544 15.77 10.456 15.143 10.848 L 6.03 16.544 C 5.364 16.96 4.5 16.481 4.5 15.696 Z\"\n\t\tfill=\"rgba(136, 136, 136, 0.2)\"\n\t\tstroke-width=\"2\"\n\t\tstroke=\"currentColor\"\n\t\tstroke-linecap=\"round\"\n\t\tstroke-linejoin=\"round\"\n\t/>\n</svg>\n`\n", "export function IconCmsTableSorting() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\" aria-hidden={true}>\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t\t<path d=\"m1.5 7.293 3.47-3.469a.75.75 0 0 1 1.06 0L9.5 7.293M5.5 5.293v11.5\" />\n\t\t\t</g>\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\">\n\t\t\t\t<path d=\"m10.5 13 3.47 3.47a.75.75 0 0 0 1.06 0L18.5 13M14.5 3.5v12\" />\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tButton,\n\tEmptyState,\n\tIconOrder,\n\tIconVariableStatus,\n\tLegacyIconVariableStatus,\n\tPopover,\n\tPopupButton,\n\tPopupButtonItem,\n\tPopupButtonMenu,\n\tReadOnlyContext,\n\tScroll,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever, List } from \"@framerjs/shared\"\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 { CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionSortingRule, CollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport { getCollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionSortingRules.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tfakeCreatedAtVariable,\n\tfakeUpdatedAtVariable,\n} from \"document/models/CanvasTree/nodes/utils/collectionAutoGeneratedVariables.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport type {\n\tVariableDefinition,\n\tVariableID,\n\tVariableSupportingSorting,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isVariableDefinition, variableSupportsSorting } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport { PanelRow } from \"../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../properties/utils/doubleColumn.styles.ts\"\nimport { InlinePopoutNavigation } from \"../shared/InlinePopoutNavigation.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { iconForVariable } from \"../shared/utils/iconForVariable.tsx\"\nimport { useHasModalInFrontOfPopover } from \"../useHasModalInFrontOfPopover.ts\"\nimport { IconCmsTableSorting } from \"./IconCmsTableSorting.tsx\"\nimport { RevampedCmsPopoutThemeOverride } from \"./RevampedCmsPopoutThemeOverride.tsx\"\nimport * as styles from \"./VirtualCollectionItemTableSortingPopover.styles.ts\"\nimport {\n\tgetCollectionSortingRulesFromStorage,\n\tgetCollectionItemTableSortLabel,\n\tisCollectionSortingRulesEqual,\n\tlocalStorageSortingRulesKey,\n\tupdateCollectionSortingRulesByCollection,\n} from \"./utils/collectionItemTableSorting.ts\"\n\nconst popoverOffset = { x: 0, y: dimensions.values.inputSpacing + 10 }\n\ninterface VirtualCollectionItemTableSortingPopoverProps {\n\tanchor: HTMLElement | null\n\tcollectionNode: CollectionNode\n\tcanEditSorting: boolean\n\tonClose: () => void\n}\n\ninterface CollectionItemTableSortingField {\n\tid: VariableID\n\tname: string\n\tcontrolType: ControlType\n\tvariable: VariableDefinition | null\n}\n\nexport function VirtualCollectionItemTableSortingPopover({\n\tanchor,\n\tcollectionNode,\n\tcanEditSorting,\n\tonClose,\n}: VirtualCollectionItemTableSortingPopoverProps) {\n\tconst hasModalInFront = useHasModalInFrontOfPopover()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst [storedLocalSortingRulesByCollection, setLocalSortingRulesByCollection] = useLocalStorage<unknown>(\n\t\tlocalStorageSortingRulesKey,\n\t\tnull,\n\t)\n\tconst localSortingRulesByCollection = useMemo(\n\t\t() => getCollectionSortingRulesFromStorage(storedLocalSortingRulesByCollection),\n\t\t[storedLocalSortingRulesByCollection],\n\t)\n\n\tconst sortingFields = useMemo(() => getCollectionItemTableSortingFields(collectionNode), [collectionNode])\n\tconst sortingFieldById = useMemo(\n\t\t() => new Map(sortingFields.map(field => [field.id, field] as const)),\n\t\t[sortingFields],\n\t)\n\n\tconst treeSortingRules = useMemo(\n\t\t() => getCollectionSortingRules(collectionNode.sorting, collectionNode.sortingRules),\n\t\t[collectionNode.sorting, collectionNode.sortingRules],\n\t)\n\tconst localSortingRules = localSortingRulesByCollection[collectionNode.id]\n\tconst hasLocalOverride = localSortingRules !== undefined\n\tconst normalizedTreeSortingRules = useMemo(\n\t\t() => normalizeSortingRules(treeSortingRules, sortingFieldById),\n\t\t[sortingFieldById, treeSortingRules],\n\t)\n\tconst draftSortingRules = useMemo(\n\t\t() => normalizeSortingRules(localSortingRules ?? treeSortingRules, sortingFieldById),\n\t\t[localSortingRules, sortingFieldById, treeSortingRules],\n\t)\n\tconst hasActiveSortingRules = draftSortingRules.length > 0\n\tconst hasSortingChanges = !isCollectionSortingRulesEqual(draftSortingRules, normalizedTreeSortingRules)\n\tconst hasSaveableChanges = hasLocalOverride && hasSortingChanges\n\tconst availableSortingFields = useMemo(\n\t\t() => getAvailableSortingFields(sortingFields, draftSortingRules),\n\t\t[draftSortingRules, sortingFields],\n\t)\n\tconst hasAvailableSortingFields = availableSortingFields.length > 0\n\tconst canAddSorting = canEditSorting && hasAvailableSortingFields\n\tconst canUseDiscardOrClear = hasLocalOverride || canEditSorting\n\tconst showOnlyAddSortingFooter = !hasLocalOverride && !hasActiveSortingRules && !hasSortingChanges\n\tconst showSortingActionFooter = hasLocalOverride || (!hasLocalOverride && hasActiveSortingRules)\n\n\tconst clearLocalSortingRules = useCallback(() => {\n\t\tsetLocalSortingRulesByCollection((previous: unknown) => {\n\t\t\tconst sortingRulesByCollection = getCollectionSortingRulesFromStorage(previous)\n\t\t\tconst { [collectionNode.id]: _removedSortingRules, ...remainingSortingRulesByCollection } =\n\t\t\t\tsortingRulesByCollection\n\t\t\treturn remainingSortingRulesByCollection\n\t\t})\n\t}, [collectionNode.id, setLocalSortingRulesByCollection])\n\n\tconst setLocalSortingRules = useCallback(\n\t\t(rules: CollectionSortingRules) => {\n\t\t\tif (!canEditSorting) return\n\n\t\t\tsetLocalSortingRulesByCollection((previous: unknown) => {\n\t\t\t\tconst previousSortingRulesByCollection = getCollectionSortingRulesFromStorage(previous)\n\t\t\t\treturn updateCollectionSortingRulesByCollection(\n\t\t\t\t\tpreviousSortingRulesByCollection,\n\t\t\t\t\tcollectionNode.id,\n\t\t\t\t\trules,\n\t\t\t\t\tnormalizedTreeSortingRules,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[canEditSorting, collectionNode.id, normalizedTreeSortingRules, setLocalSortingRulesByCollection],\n\t)\n\n\tconst moveSortingRule = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\tsetLocalSortingRules(List.move(draftSortingRules, from, to))\n\t\t},\n\t\t[draftSortingRules, setLocalSortingRules],\n\t)\n\n\tconst updateSortingRule = useCallback(\n\t\t(id: NodeID, update: Partial<CollectionSortingRule>) => {\n\t\t\tsetLocalSortingRules(\n\t\t\t\tdraftSortingRules.map(sortingRule => {\n\t\t\t\t\tif (sortingRule.id !== id) return sortingRule\n\t\t\t\t\treturn { ...sortingRule, ...update }\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[draftSortingRules, setLocalSortingRules],\n\t)\n\n\tconst deleteSortingRule = useCallback(\n\t\t(id: NodeID) => {\n\t\t\tsetLocalSortingRules(draftSortingRules.filter(sortingRule => sortingRule.id !== id))\n\t\t},\n\t\t[draftSortingRules, setLocalSortingRules],\n\t)\n\n\tconst showAddSortingMenu = useCallback<React.MouseEventHandler<HTMLElement>>(\n\t\tevent => {\n\t\t\tif (!canEditSorting) return\n\n\t\t\tconst addSortingMenuItems = createAddSortingMenuItems(availableSortingFields, (field, order) => {\n\t\t\t\tsetLocalSortingRules([\n\t\t\t\t\t...draftSortingRules,\n\t\t\t\t\t{\n\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\tby: field.id,\n\t\t\t\t\t\torder,\n\t\t\t\t\t},\n\t\t\t\t])\n\t\t\t})\n\t\t\tif (addSortingMenuItems.length === 0) return\n\n\t\t\tconst clientRect = event.currentTarget.getBoundingClientRect()\n\t\t\tengine.stores.contextMenuStore.show(addSortingMenuItems, {\n\t\t\t\tlocation: clientRect,\n\t\t\t})\n\t\t},\n\t\t[availableSortingFields, canEditSorting, draftSortingRules, setLocalSortingRules],\n\t)\n\tconst addSortingSuggestionClickHandlers = useClickHandlers(showAddSortingMenu)\n\n\tconst clearSorting = useCallback(() => setLocalSortingRules([]), [setLocalSortingRules])\n\n\tconst saveSorting = useCallback(() => {\n\t\tif (!canEditSorting) return\n\n\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\tcollectionNode.set(getSavedSortingUpdate(draftSortingRules))\n\t\t})\n\t\tclearLocalSortingRules()\n\t}, [canEditSorting, clearLocalSortingRules, collectionNode, draftSortingRules])\n\n\tif (!anchor) return null\n\n\treturn (\n\t\t<RevampedCmsPopoutThemeOverride>\n\t\t\t<Popover\n\t\t\t\tanchor={anchor}\n\t\t\t\talignSelf=\"start\"\n\t\t\t\tattachTo=\"bottom\"\n\t\t\t\toffset={popoverOffset}\n\t\t\t\tshowArrow={false}\n\t\t\t\tonClose={onClose}\n\t\t\t\tclassName={styles.sortingPopover}\n\t\t\t\tfocusTrapEnabled={!hasModalInFront}\n\t\t\t>\n\t\t\t\t<ReadOnlyContext.Provider value={!canEditSorting}>\n\t\t\t\t\t<InlinePopoutNavigation title=\"Sorting\" displayDivider onClose={onClose}>\n\t\t\t\t\t\t<Scroll\n\t\t\t\t\t\t\tdirection=\"vertical\"\n\t\t\t\t\t\t\tclassName={cx(styles.sortingPopoverScroll, !hasActiveSortingRules && styles.sortingPopoverScrollEmpty)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{hasActiveSortingRules ? (\n\t\t\t\t\t\t\t\t<Stack gap={0} className={styles.sortingRows}>\n\t\t\t\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\t\t\t\tenabled={draftSortingRules.length > 1}\n\t\t\t\t\t\t\t\t\t\titems={draftSortingRules}\n\t\t\t\t\t\t\t\t\t\tmoveItem={moveSortingRule}\n\t\t\t\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{({ item: sortingRule }) => {\n\t\t\t\t\t\t\t\t\t\t\tconst sortingField = sortingFieldById.get(sortingRule.by)\n\t\t\t\t\t\t\t\t\t\t\tassert(sortingField)\n\n\t\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t\t<SortingRuleRow\n\t\t\t\t\t\t\t\t\t\t\t\t\tsortingRule={sortingRule}\n\t\t\t\t\t\t\t\t\t\t\t\t\tsortingField={sortingField}\n\t\t\t\t\t\t\t\t\t\t\t\t\tsortingFields={sortingFields}\n\t\t\t\t\t\t\t\t\t\t\t\t\tactiveSortingRules={draftSortingRules}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={updateSortingRule}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonDelete={deleteSortingRule}\n\t\t\t\t\t\t\t\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t</Sortable>\n\t\t\t\t\t\t\t\t\t{hasAvailableSortingFields && (\n\t\t\t\t\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"collectionTableSorting\"\n\t\t\t\t\t\t\t\t\t\t\t\ttooltipTitle=\"Add Sorting\"\n\t\t\t\t\t\t\t\t\t\t\t\t{...addSortingSuggestionClickHandlers}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<EmptyState\n\t\t\t\t\t\t\t\t\ticon={IconCmsTableSorting}\n\t\t\t\t\t\t\t\t\ticonLarge\n\t\t\t\t\t\t\t\t\ticonColor={colors.emptyStateIcon}\n\t\t\t\t\t\t\t\t\ticonBackgroundColor={colors.emptyStateCardBackground}\n\t\t\t\t\t\t\t\t\ttitle=\"No Sorting\"\n\t\t\t\t\t\t\t\t\tbody={\"Apply multiple sorting\\nrules to control the order\\nof items in the table.\"}\n\t\t\t\t\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\t\t\t\t\tclassName={styles.sortingEmptyState}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t{(showOnlyAddSortingFooter || showSortingActionFooter) && (\n\t\t\t\t\t\t\t\t<div className={styles.sortingFooter}>\n\t\t\t\t\t\t\t\t\t{showOnlyAddSortingFooter ? (\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.sortingFooterButton}\n\t\t\t\t\t\t\t\t\t\t\tenabled={canAddSorting}\n\t\t\t\t\t\t\t\t\t\t\tonClick={showAddSortingMenu}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tAdd Sorting\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles.sortingFooterButton}\n\t\t\t\t\t\t\t\t\t\t\t\tenabled={canUseDiscardOrClear}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={hasLocalOverride ? clearLocalSortingRules : clearSorting}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{hasLocalOverride ? Dictionary.Discard : Dictionary.Clear}\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\t\t\tenabled={canEditSorting && hasSaveableChanges}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles.sortingFooterButton}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={saveSorting}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{Dictionary.Save}\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Scroll>\n\t\t\t\t\t</InlinePopoutNavigation>\n\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t</Popover>\n\t\t</RevampedCmsPopoutThemeOverride>\n\t)\n}\n\nfunction getSavedSortingUpdate(rules: CollectionSortingRules): Pick<CollectionNode, \"sorting\" | \"sortingRules\"> {\n\tif (rules.length === 0) {\n\t\treturn { sorting: undefined, sortingRules: undefined }\n\t}\n\n\tif (rules.length === 1) {\n\t\tconst rule = rules[0]\n\t\tassert(rule)\n\t\treturn { sorting: { by: rule.by, order: rule.order }, sortingRules: undefined }\n\t}\n\n\treturn { sorting: undefined, sortingRules: rules }\n}\n\nfunction SortingRuleRow({\n\tsortingRule,\n\tsortingField,\n\tsortingFields,\n\tactiveSortingRules,\n\tonChange,\n\tonDelete,\n\tagentExperimentEnabled,\n}: {\n\tsortingRule: CollectionSortingRule\n\tsortingField: CollectionItemTableSortingField\n\tsortingFields: readonly CollectionItemTableSortingField[]\n\tactiveSortingRules: CollectionSortingRules\n\tonChange: (id: NodeID, update: Partial<CollectionSortingRule>) => void\n\tonDelete: (id: NodeID) => void\n\tagentExperimentEnabled: boolean\n}) {\n\tconst deleteSortingRule = useCallback(() => onDelete(sortingRule.id), [onDelete, sortingRule.id])\n\tconst useCompactPreview =\n\t\tagentExperimentEnabled &&\n\t\t(sortingField.controlType === ControlType.String || sortingField.id === collectionItemTableStatusColumnKey)\n\n\treturn (\n\t\t<PanelRow title={sortingField.name}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tnavigationTitle=\"Sorting\"\n\t\t\t\ttitle={getCollectionItemTableSortLabel(sortingRule.order, sortingField.controlType, sortingField.id)}\n\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\tonDelete={deleteSortingRule}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.tint} color=\"transparent\" strokedIcon={useCompactPreview}>\n\t\t\t\t\t\t{getSortingFieldPreview(sortingField, colors.buttonTextPrimary, agentExperimentEnabled)}\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t\tstrokedIconPreview={useCompactPreview}\n\t\t\t\tpopout={\n\t\t\t\t\t<SortingRulePopout\n\t\t\t\t\t\tsortingRule={sortingRule}\n\t\t\t\t\t\tsortingField={sortingField}\n\t\t\t\t\t\tsortingFields={sortingFields}\n\t\t\t\t\t\tactiveSortingRules={activeSortingRules}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction SortingRulePopout({\n\tsortingRule,\n\tsortingField,\n\tsortingFields,\n\tactiveSortingRules,\n\tonChange,\n}: {\n\tsortingRule: CollectionSortingRule\n\tsortingField: CollectionItemTableSortingField\n\tsortingFields: readonly CollectionItemTableSortingField[]\n\tactiveSortingRules: CollectionSortingRules\n\tonChange: (id: NodeID, update: Partial<CollectionSortingRule>) => void\n}) {\n\tconst menuOptions = useMemo(\n\t\t() =>\n\t\t\tgetSortingFieldMenuOptions(sortingFields, sortingRule, activeSortingRules, fieldId =>\n\t\t\t\tonChange(sortingRule.id, { by: fieldId }),\n\t\t\t),\n\t\t[activeSortingRules, onChange, sortingFields, sortingRule],\n\t)\n\n\tconst showFieldMenu = useCallback(\n\t\t(event: React.SyntheticEvent<HTMLButtonElement>) => {\n\t\t\tconst clientRect = event.currentTarget.getBoundingClientRect()\n\n\t\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: clientRect.left + dimensions.values.contextMenuOffsetX,\n\t\t\t\t\ty: clientRect.bottom,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[menuOptions],\n\t)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title={Dictionary.Field}>\n\t\t\t\t<PopupButtonMenu\n\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\ttitle={sortingField.name}\n\t\t\t\t\tonShowMenu={showFieldMenu}\n\t\t\t\t\tenabled={menuOptions.length > 0}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Order\">\n\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={getCollectionItemTableSortLabel(\"ascending\", sortingField.controlType, sortingField.id)}\n\t\t\t\t\t\tidentifier=\"ascending\"\n\t\t\t\t\t\tselected={sortingRule.order === \"ascending\"}\n\t\t\t\t\t\tonSelect={() => onChange(sortingRule.id, { order: \"ascending\" })}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={getCollectionItemTableSortLabel(\"descending\", sortingField.controlType, sortingField.id)}\n\t\t\t\t\t\tidentifier=\"descending\"\n\t\t\t\t\t\tselected={sortingRule.order === \"descending\"}\n\t\t\t\t\t\tonSelect={() => onChange(sortingRule.id, { order: \"descending\" })}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\nfunction getSortingFieldMenuOptions(\n\tsortingFields: readonly CollectionItemTableSortingField[],\n\tsortingRule: CollectionSortingRule,\n\tactiveSortingRules: CollectionSortingRules,\n\tonSelectField: (fieldId: VariableID) => void,\n): MenuItemOptions[] {\n\tconst selectedFieldIds = new Set(activeSortingRules.map(rule => rule.by))\n\tconst menuOptions: MenuItemOptions[] = []\n\n\tfor (const field of sortingFields) {\n\t\tif (field.id !== sortingRule.by && selectedFieldIds.has(field.id)) continue\n\n\t\tmenuOptions.push({\n\t\t\tlabel: field.name,\n\t\t\tchecked: field.id === sortingRule.by,\n\t\t\tclick: () => onSelectField(field.id),\n\t\t})\n\t}\n\n\treturn menuOptions\n}\n\nfunction getCollectionItemTableSortingFields(collectionNode: CollectionNode): CollectionItemTableSortingField[] {\n\tconst fields: CollectionItemTableSortingField[] = [\n\t\t{\n\t\t\tid: collectionItemTableStatusColumnKey,\n\t\t\tname: Dictionary.Status,\n\t\t\tcontrolType: ControlType.Enum,\n\t\t\tvariable: null,\n\t\t},\n\t]\n\n\tfor (const variable of collectionNode.variables) {\n\t\tif (!isVariableDefinition(variable)) continue\n\t\tif (!variableSupportsSorting(variable)) continue\n\n\t\tfields.push({\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tcontrolType: getControlTypeForSortingVariable(variable),\n\t\t\tvariable,\n\t\t})\n\t}\n\n\tfields.push({\n\t\tid: fakeCreatedAtVariable.id,\n\t\tname: fakeCreatedAtVariable.name,\n\t\tcontrolType: ControlType.Date,\n\t\tvariable: fakeCreatedAtVariable,\n\t})\n\tfields.push({\n\t\tid: fakeUpdatedAtVariable.id,\n\t\tname: fakeUpdatedAtVariable.name,\n\t\tcontrolType: ControlType.Date,\n\t\tvariable: fakeUpdatedAtVariable,\n\t})\n\n\treturn fields\n}\n\nfunction getControlTypeForSortingVariable(variable: VariableSupportingSorting): ControlType {\n\tswitch (variable.type) {\n\t\tcase \"slug\":\n\t\t\treturn ControlType.String\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Date:\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.String:\n\t\t\treturn variable.type\n\t\tdefault:\n\t\t\tassertNever(variable, \"Unsupported collection item table sorting field type\")\n\t}\n}\n\nfunction normalizeSortingRules(\n\tsortingRules: CollectionSortingRules,\n\tsortingFieldById: ReadonlyMap<VariableID, CollectionItemTableSortingField>,\n): CollectionSortingRules {\n\tconst usedFieldIds = new Set<VariableID>()\n\tconst normalizedSortingRules: CollectionSortingRule[] = []\n\n\tfor (const sortingRule of sortingRules) {\n\t\tif (!sortingFieldById.has(sortingRule.by)) continue\n\t\tif (usedFieldIds.has(sortingRule.by)) continue\n\t\tusedFieldIds.add(sortingRule.by)\n\t\tnormalizedSortingRules.push(sortingRule)\n\t}\n\n\treturn normalizedSortingRules\n}\n\nfunction getAvailableSortingFields(\n\tsortingFields: readonly CollectionItemTableSortingField[],\n\tactiveSortingRules: CollectionSortingRules,\n): CollectionItemTableSortingField[] {\n\tconst selectedFieldIds = new Set(activeSortingRules.map(rule => rule.by))\n\treturn sortingFields.filter(field => !selectedFieldIds.has(field.id))\n}\n\nfunction createAddSortingMenuItems(\n\tsortingFields: readonly CollectionItemTableSortingField[],\n\tonSelectSorting: (field: CollectionItemTableSortingField, order: CollectionSortingRule[\"order\"]) => void,\n): MenuItemOptions[] {\n\treturn sortingFields.map(field => ({\n\t\tlabel: field.name,\n\t\tsubmenu: [\n\t\t\t{\n\t\t\t\tlabel: getCollectionItemTableSortLabel(\"ascending\", field.controlType, field.id),\n\t\t\t\tclick: () => onSelectSorting(field, \"ascending\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: getCollectionItemTableSortLabel(\"descending\", field.controlType, field.id),\n\t\t\t\tclick: () => onSelectSorting(field, \"descending\"),\n\t\t\t},\n\t\t],\n\t}))\n}\n\nfunction getSortingFieldPreview(\n\tfield: CollectionItemTableSortingField,\n\tforeground: string,\n\tagentExperimentEnabled: boolean,\n): React.ReactElement {\n\tif (field.id === collectionItemTableStatusColumnKey) {\n\t\tif (agentExperimentEnabled) {\n\t\t\treturn <IconVariableStatus foreground={foreground} />\n\t\t}\n\t\treturn <LegacyIconVariableStatus foreground={foreground} />\n\t}\n\tif (field.variable) {\n\t\treturn iconForVariable(field.variable, {\n\t\t\tforeground,\n\t\t\tcompactStringIcon: agentExperimentEnabled,\n\t\t\tagentExperimentEnabled,\n\t\t})\n\t}\n\treturn <IconOrder />\n}\n", "import \"VirtualCollectionItemTableSortingPopover.styles_vpdean.wyw.css\"; export const sortingPopover = \"sortingPopover_s11lsmbe\";\nexport const sortingPopoverScroll = \"sortingPopoverScroll_sze7zx6\";\nexport const sortingPopoverScrollEmpty = \"sortingPopoverScrollEmpty_sutf9xu\";\nexport const sortingRows = \"sortingRows_s1xro5fc\";\nexport const sortingEmptyState = \"sortingEmptyState_s1weci4m\";\nexport const sortingFooter = \"sortingFooter_ssml9v3\";\nexport const sortingFooterButton = \"sortingFooterButton_s1mpery8\";", "import \"VirtualCollectionItemTableToolbar.styles_1l7ol3d.wyw.css\"; export const container = \"container_clhj7ic\";\nexport const leftControls = \"leftControls_l1weesbb\";\nexport const searchContent = \"searchContent_s6pw6hh\";\nexport const iconButton = \"iconButton_iyevhps\";\nexport const iconButtonActive = \"iconButtonActive_i1wcob1q\";\nexport const multiSelectButton = \"multiSelectButton_mnu85at\";\nexport const multiSelectButtonLabel = \"multiSelectButtonLabel_mwph75v\";\nexport const filterPills = \"filterPills_f1wn7fue\";\nexport const filterPillToggleButton = \"filterPillToggleButton_f1019kxk\";\nexport const searchBar = \"searchBar_s1yvm2a7\";\nexport const rightControls = \"rightControls_r1rd3w9i\";", "import { assertNever } from \"@framerjs/shared\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport {\n\tgetAutoSelectTableFocusTarget,\n\tshouldClearSelectionOnTableBlur,\n} from \"./VirtualCollectionItemTable.focusNavigation.ts\"\nimport type { SelectionAutoScrollBehavior } from \"./useVirtualGridCellSelection.ts\"\n\ninterface UseVirtualCollectionItemTableFocusNavigationOptions {\n\tpreserveSelectionOnNextTableBlurRef: React.MutableRefObject<boolean>\n\tskipAutoSelectOnNextTableFocusRef: React.MutableRefObject<boolean>\n\tkeyboardInteractionBlocked: boolean\n\thasValidSelection: boolean\n\thasCellSelection: boolean\n\texitMultiSelectionMode: () => void\n\trestoreMostRecentCellSelection: (selectionAutoScrollBehavior?: SelectionAutoScrollBehavior) => boolean\n\tselectFirstCell: (selectionAutoScrollBehavior?: SelectionAutoScrollBehavior) => boolean\n\tselectLastCell: (selectionAutoScrollBehavior?: SelectionAutoScrollBehavior) => boolean\n\tstopDragSelection: () => void\n\tclearSelection: () => void\n}\n\nexport function useVirtualCollectionItemTableFocusNavigation({\n\tpreserveSelectionOnNextTableBlurRef,\n\tskipAutoSelectOnNextTableFocusRef,\n\tkeyboardInteractionBlocked,\n\thasValidSelection,\n\thasCellSelection,\n\texitMultiSelectionMode,\n\trestoreMostRecentCellSelection,\n\tselectFirstCell,\n\tselectLastCell,\n\tstopDragSelection,\n\tclearSelection,\n}: UseVirtualCollectionItemTableFocusNavigationOptions) {\n\tconst skipFocusSelectionFromPointerRef = useRef(false)\n\tconst clearSkipFocusSelectionFrameRef = useRef<number | null>(null)\n\n\tconst handleTableFocus = useCallback(\n\t\t(event: React.FocusEvent<HTMLDivElement>) => {\n\t\t\tif (skipAutoSelectOnNextTableFocusRef.current) {\n\t\t\t\tskipAutoSelectOnNextTableFocusRef.current = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst autoSelectTarget = getAutoSelectTableFocusTarget({\n\t\t\t\teventTarget: event.target,\n\t\t\t\teventCurrentTarget: event.currentTarget,\n\t\t\t\trelatedTarget: event.relatedTarget,\n\t\t\t\tskipFromPointer: skipFocusSelectionFromPointerRef.current,\n\t\t\t\tkeyboardInteractionBlocked,\n\t\t\t\thasValidSelection,\n\t\t\t})\n\t\t\tif (!autoSelectTarget) return\n\n\t\t\texitMultiSelectionMode()\n\n\t\t\tswitch (autoSelectTarget) {\n\t\t\t\tcase \"first\":\n\t\t\t\t\tselectFirstCell(\"keyboard\")\n\t\t\t\t\treturn\n\t\t\t\tcase \"last\":\n\t\t\t\t\tselectLastCell(\"keyboard\")\n\t\t\t\t\treturn\n\t\t\t\tcase \"restore\":\n\t\t\t\t\trestoreMostRecentCellSelection(\"keyboard\")\n\t\t\t\t\treturn\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(autoSelectTarget)\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\texitMultiSelectionMode,\n\t\t\thasValidSelection,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\trestoreMostRecentCellSelection,\n\t\t\tskipAutoSelectOnNextTableFocusRef,\n\t\t\tselectFirstCell,\n\t\t\tselectLastCell,\n\t\t],\n\t)\n\n\tconst handleTableBlur = useCallback(\n\t\t(event: React.FocusEvent<HTMLDivElement>) => {\n\t\t\tif (preserveSelectionOnNextTableBlurRef.current) {\n\t\t\t\tpreserveSelectionOnNextTableBlurRef.current = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst shouldClearSelection = shouldClearSelectionOnTableBlur({\n\t\t\t\teventCurrentTarget: event.currentTarget,\n\t\t\t\trelatedTarget: event.relatedTarget,\n\t\t\t\tkeyboardInteractionBlocked,\n\t\t\t\thasCellSelection,\n\t\t\t})\n\t\t\tif (shouldClearSelection) {\n\t\t\t\tstopDragSelection()\n\t\t\t\tclearSelection()\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tclearSelection,\n\t\t\thasCellSelection,\n\t\t\tkeyboardInteractionBlocked,\n\t\t\tpreserveSelectionOnNextTableBlurRef,\n\t\t\tstopDragSelection,\n\t\t],\n\t)\n\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (clearSkipFocusSelectionFrameRef.current === null) return\n\t\t\tcancelAnimationFrame(clearSkipFocusSelectionFrameRef.current)\n\t\t}\n\t}, [])\n\n\tconst handleTableMouseDownCapture = useCallback(() => {\n\t\tskipFocusSelectionFromPointerRef.current = true\n\n\t\t// Pointer-initiated focus happens in the same event turn. Reset the guard on the next frame\n\t\t// so subsequent keyboard focus can still auto-select.\n\t\tif (clearSkipFocusSelectionFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(clearSkipFocusSelectionFrameRef.current)\n\t\t}\n\n\t\tclearSkipFocusSelectionFrameRef.current = requestAnimationFrame(() => {\n\t\t\tclearSkipFocusSelectionFrameRef.current = null\n\t\t\tskipFocusSelectionFromPointerRef.current = false\n\t\t})\n\t}, [])\n\n\treturn {\n\t\thandleTableFocus,\n\t\thandleTableBlur,\n\t\thandleTableMouseDownCapture,\n\t}\n}\n", "import { ModalType } from \"document/utils/ModalType.ts\"\nimport { useLayoutEffect, useRef } from \"react\"\n\nfunction shouldRestoreVirtualCollectionItemTableFocus(activeElement: Element | null): boolean {\n\treturn (\n\t\tactiveElement === null ||\n\t\tactiveElement === document.body ||\n\t\tactiveElement === document.documentElement ||\n\t\t!activeElement.isConnected\n\t)\n}\n\ninterface UseVirtualCollectionItemTableFocusRestorationOptions {\n\thasOpenOverlay: boolean\n\tactiveModalType: ModalType\n\tfocusTableWithoutAutoSelect: () => void\n}\n\nexport function useVirtualCollectionItemTableFocusRestoration({\n\thasOpenOverlay,\n\tactiveModalType,\n\tfocusTableWithoutAutoSelect,\n}: UseVirtualCollectionItemTableFocusRestorationOptions) {\n\tconst hasOpenModal = activeModalType !== ModalType.None\n\n\tconst isFirstRenderRef = useRef(true)\n\tconst previousHasOpenOverlayRef = useRef(hasOpenOverlay)\n\tconst previousHasOpenModalRef = useRef(hasOpenModal)\n\n\tuseLayoutEffect(() => {\n\t\tconst isFirstRender = isFirstRenderRef.current\n\t\tconst overlayJustClosed = previousHasOpenOverlayRef.current && !hasOpenOverlay\n\t\tconst modalJustClosed = previousHasOpenModalRef.current && !hasOpenModal\n\n\t\tisFirstRenderRef.current = false\n\t\tpreviousHasOpenOverlayRef.current = hasOpenOverlay\n\t\tpreviousHasOpenModalRef.current = hasOpenModal\n\n\t\tif (isFirstRender) return\n\t\tif (hasOpenOverlay || hasOpenModal) return\n\t\tif (!overlayJustClosed && !modalJustClosed) return\n\t\tif (!shouldRestoreVirtualCollectionItemTableFocus(document.activeElement)) return\n\n\t\tfocusTableWithoutAutoSelect()\n\t}, [focusTableWithoutAutoSelect, hasOpenModal, hasOpenOverlay])\n}\n", "import { isCommandKeyPressed } from \"@framerjs/shared\"\nimport { useEffect } from \"react\"\nimport { getVirtualCollectionItemTableNavigationKeyboardAction } from \"./VirtualCollectionItemTable.keyboardNavigation.ts\"\nimport type { SelectionAutoScrollBehavior } from \"./useVirtualGridCellSelection.ts\"\n\ninterface UseVirtualCollectionItemTableKeyboardEntryOptions {\n\trowCount: number\n\tcolumnCount: number\n\thasValidSelection: boolean\n\tkeyboardNavigationBlocked: boolean\n\tfocusTable: () => void\n\tselectFirstCell: (selectionAutoScrollBehavior?: SelectionAutoScrollBehavior) => boolean\n\tonCellInteraction: () => void\n}\n\nexport function useVirtualCollectionItemTableKeyboardEntry({\n\trowCount,\n\tcolumnCount,\n\thasValidSelection,\n\tkeyboardNavigationBlocked,\n\tfocusTable,\n\tselectFirstCell,\n\tonCellInteraction,\n}: UseVirtualCollectionItemTableKeyboardEntryOptions) {\n\tuseEffect(() => {\n\t\tif (rowCount === 0 || columnCount === 0 || keyboardNavigationBlocked) return\n\n\t\tconst controller = new AbortController()\n\t\tconst handleWindowKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.defaultPrevented) return\n\t\t\tif (event.key === \"Tab\") return\n\n\t\t\tconst action = getVirtualCollectionItemTableNavigationKeyboardAction({\n\t\t\t\tkey: event.key,\n\t\t\t\tshiftKey: event.shiftKey,\n\t\t\t\tisCommandPressed: isCommandKeyPressed(event),\n\t\t\t\trowCount,\n\t\t\t\tcolumnCount,\n\t\t\t})\n\t\t\tif (!action) return\n\t\t\tif (document.activeElement !== document.body && document.activeElement !== document.documentElement) return\n\t\t\tif (hasValidSelection) return\n\n\t\t\tonCellInteraction()\n\t\t\tif (!selectFirstCell(\"keyboard\")) return\n\n\t\t\tevent.preventDefault()\n\t\t\tfocusTable()\n\t\t}\n\n\t\twindow.addEventListener(\"keydown\", handleWindowKeyDown, { signal: controller.signal })\n\t\treturn () => controller.abort()\n\t}, [\n\t\tcolumnCount,\n\t\tfocusTable,\n\t\thasValidSelection,\n\t\tkeyboardNavigationBlocked,\n\t\tonCellInteraction,\n\t\trowCount,\n\t\tselectFirstCell,\n\t])\n}\n", "import React from \"react\"\nimport { getAutoScrollTimeScale } from \"./VirtualCollectionItemTable.autoScrollTimeScale.ts\"\nimport type { CellIdentifier } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface DragSelectionPointer {\n\tclientX: number\n\tclientY: number\n\tbuttons: number\n}\n\ninterface UseVirtualGridCellDragSelectionAutoScrollArgs {\n\tisCellDragSelecting: boolean\n\tactiveDragAnchorColumnId: ColumnKey | null\n\ttableScrollRef: React.RefObject<HTMLDivElement | null>\n\ttableRowHeight: number\n\trowHeaderWidth: number\n\tstickyColumnCount: number\n\tstickyColumnsWidth: number\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n\tautoScrollEdgeThreshold: number\n\tautoScrollMaxStep: number\n\tgetCellFromClientPoint: (clientX: number, clientY: number) => CellIdentifier | null\n\textendDragSelection: (cell: CellIdentifier, buttons: number) => void\n\tstopDragSelection: () => void\n}\n\nexport function useVirtualGridCellDragSelectionAutoScroll({\n\tisCellDragSelecting,\n\tactiveDragAnchorColumnId,\n\ttableScrollRef,\n\ttableRowHeight,\n\trowHeaderWidth,\n\tstickyColumnCount,\n\tstickyColumnsWidth,\n\tcolumnIndexById,\n\tautoScrollEdgeThreshold,\n\tautoScrollMaxStep,\n\tgetCellFromClientPoint,\n\textendDragSelection,\n\tstopDragSelection,\n}: UseVirtualGridCellDragSelectionAutoScrollArgs) {\n\tconst dragSelectionPointerRef = React.useRef<DragSelectionPointer | null>(null)\n\tconst dragSelectionAutoScrollAnimationFrameRef = React.useRef<number | null>(null)\n\tconst dragSelectionAutoScrollLastTimestampRef = React.useRef<number | null>(null)\n\n\tconst stopDragSelectionAutoScroll = React.useCallback(() => {\n\t\tif (dragSelectionAutoScrollAnimationFrameRef.current !== null) {\n\t\t\tcancelAnimationFrame(dragSelectionAutoScrollAnimationFrameRef.current)\n\t\t\tdragSelectionAutoScrollAnimationFrameRef.current = null\n\t\t}\n\t\tdragSelectionAutoScrollLastTimestampRef.current = null\n\t\tdragSelectionPointerRef.current = null\n\t}, [])\n\n\tconst isPointerNearDragSelectionAutoScrollEdge = React.useCallback(\n\t\t(clientX: number, clientY: number): boolean => {\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!scrollElement) return false\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyTop = scrollBounds.top + tableRowHeight\n\t\t\tconst bodyBottom = scrollBounds.bottom\n\t\t\tconst bodyLeft = scrollBounds.left + rowHeaderWidth\n\t\t\tconst bodyRight = scrollBounds.right\n\t\t\tconst anchorColumnIndex = activeDragAnchorColumnId ? columnIndexById.get(activeDragAnchorColumnId) : undefined\n\t\t\tconst anchorInNonStickyColumn = anchorColumnIndex !== undefined && anchorColumnIndex >= stickyColumnCount\n\t\t\tconst horizontalAutoScrollLeft = anchorInNonStickyColumn ? bodyLeft + stickyColumnsWidth : bodyLeft\n\t\t\treturn (\n\t\t\t\tclientY < bodyTop + autoScrollEdgeThreshold ||\n\t\t\t\tclientY > bodyBottom - autoScrollEdgeThreshold ||\n\t\t\t\tclientX < horizontalAutoScrollLeft + autoScrollEdgeThreshold ||\n\t\t\t\tclientX > bodyRight - autoScrollEdgeThreshold\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tactiveDragAnchorColumnId,\n\t\t\tautoScrollEdgeThreshold,\n\t\t\tcolumnIndexById,\n\t\t\trowHeaderWidth,\n\t\t\tstickyColumnCount,\n\t\t\tstickyColumnsWidth,\n\t\t\ttableRowHeight,\n\t\t\ttableScrollRef,\n\t\t],\n\t)\n\n\tReact.useEffect(() => {\n\t\tconst controller = new AbortController()\n\t\tconst abortSignal = controller.signal\n\t\twindow.addEventListener(\"pointerup\", stopDragSelection, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"pointercancel\", stopDragSelection, { capture: true, signal: abortSignal })\n\t\twindow.addEventListener(\"blur\", stopDragSelection, { signal: abortSignal })\n\n\t\treturn () => {\n\t\t\tcontroller.abort()\n\t\t}\n\t}, [stopDragSelection])\n\n\tReact.useEffect(() => {\n\t\tif (!isCellDragSelecting) return\n\n\t\tconst controller = new AbortController()\n\n\t\tconst autoScrollStep = (timestamp: number) => {\n\t\t\tdragSelectionAutoScrollAnimationFrameRef.current = null\n\n\t\t\tif (controller.signal.aborted) return\n\n\t\t\tconst pointer = dragSelectionPointerRef.current\n\t\t\tconst scrollElement = tableScrollRef.current\n\t\t\tif (!pointer || !scrollElement) return\n\t\t\tif ((pointer.buttons & 1) === 0) {\n\t\t\t\tstopDragSelection()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst timeScale = getAutoScrollTimeScale(timestamp, dragSelectionAutoScrollLastTimestampRef.current)\n\t\t\tdragSelectionAutoScrollLastTimestampRef.current = timestamp\n\n\t\t\tconst scrollBounds = scrollElement.getBoundingClientRect()\n\t\t\tconst bodyTop = scrollBounds.top + tableRowHeight\n\t\t\tconst bodyBottom = scrollBounds.bottom\n\t\t\tconst bodyLeft = scrollBounds.left + rowHeaderWidth\n\t\t\tconst bodyRight = scrollBounds.right\n\t\t\tconst anchorColumnIndex = activeDragAnchorColumnId ? columnIndexById.get(activeDragAnchorColumnId) : undefined\n\t\t\tconst anchorInNonStickyColumn = anchorColumnIndex !== undefined && anchorColumnIndex >= stickyColumnCount\n\t\t\tconst horizontalAutoScrollLeft = anchorInNonStickyColumn ? bodyLeft + stickyColumnsWidth : bodyLeft\n\n\t\t\tlet verticalScrollDelta = 0\n\t\t\tif (pointer.clientY < bodyTop + autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = bodyTop + autoScrollEdgeThreshold - pointer.clientY\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tverticalScrollDelta = -Math.max(1, step)\n\t\t\t} else if (pointer.clientY > bodyBottom - autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = pointer.clientY - (bodyBottom - autoScrollEdgeThreshold)\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\tverticalScrollDelta = Math.max(1, step)\n\t\t\t}\n\n\t\t\tlet horizontalScrollDelta = 0\n\t\t\tif (pointer.clientX < horizontalAutoScrollLeft + autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = horizontalAutoScrollLeft + autoScrollEdgeThreshold - pointer.clientX\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\thorizontalScrollDelta = -Math.max(1, step)\n\t\t\t} else if (pointer.clientX > bodyRight - autoScrollEdgeThreshold) {\n\t\t\t\tconst distance = pointer.clientX - (bodyRight - autoScrollEdgeThreshold)\n\t\t\t\tconst ratio = Math.min(1, distance / autoScrollEdgeThreshold)\n\t\t\t\tconst step = Math.round(ratio * autoScrollMaxStep * timeScale)\n\t\t\t\thorizontalScrollDelta = Math.max(1, step)\n\t\t\t}\n\n\t\t\tconst totalScrollTop = scrollElement.scrollHeight - scrollElement.clientHeight\n\t\t\tconst maxScrollTop = Math.max(0, totalScrollTop)\n\t\t\tconst totalScrollLeft = scrollElement.scrollWidth - scrollElement.clientWidth\n\t\t\tconst maxScrollLeft = Math.max(0, totalScrollLeft)\n\t\t\tconst rawScrollTop = scrollElement.scrollTop + verticalScrollDelta\n\t\t\tconst clampedScrollTop = Math.max(0, rawScrollTop)\n\t\t\tconst rawScrollLeft = scrollElement.scrollLeft + horizontalScrollDelta\n\t\t\tconst clampedScrollLeft = Math.max(0, rawScrollLeft)\n\t\t\tconst nextScrollTop = Math.min(maxScrollTop, clampedScrollTop)\n\t\t\tconst nextScrollLeft = Math.min(maxScrollLeft, clampedScrollLeft)\n\t\t\tif (nextScrollTop !== scrollElement.scrollTop) {\n\t\t\t\tscrollElement.scrollTop = nextScrollTop\n\t\t\t}\n\t\t\tif (nextScrollLeft !== scrollElement.scrollLeft) {\n\t\t\t\tscrollElement.scrollLeft = nextScrollLeft\n\t\t\t}\n\n\t\t\tconst cell = getCellFromClientPoint(pointer.clientX, pointer.clientY)\n\t\t\tif (cell) {\n\t\t\t\textendDragSelection(cell, pointer.buttons)\n\t\t\t}\n\n\t\t\tconst canScrollUp = verticalScrollDelta < 0 && nextScrollTop > 0\n\t\t\tconst canScrollDown = verticalScrollDelta > 0 && nextScrollTop < maxScrollTop\n\t\t\tconst canContinueVertically = canScrollUp || canScrollDown\n\t\t\tconst canScrollLeft = horizontalScrollDelta < 0 && nextScrollLeft > 0\n\t\t\tconst canScrollRight = horizontalScrollDelta > 0 && nextScrollLeft < maxScrollLeft\n\t\t\tconst canContinueHorizontally = canScrollLeft || canScrollRight\n\t\t\tif (!isPointerNearDragSelectionAutoScrollEdge(pointer.clientX, pointer.clientY)) return\n\t\t\tif (!canContinueVertically && !canContinueHorizontally) return\n\t\t\tif (controller.signal.aborted) return\n\t\t\tif (dragSelectionAutoScrollAnimationFrameRef.current !== null) return\n\t\t\tdragSelectionAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst ensureDragSelectionAutoScrollRunning = () => {\n\t\t\tif (dragSelectionAutoScrollAnimationFrameRef.current !== null) return\n\t\t\tdragSelectionAutoScrollAnimationFrameRef.current = requestAnimationFrame(autoScrollStep)\n\t\t}\n\n\t\tconst handleWindowPointerMove = (event: PointerEvent) => {\n\t\t\tif (controller.signal.aborted) return\n\n\t\t\tdragSelectionPointerRef.current = {\n\t\t\t\tclientX: event.clientX,\n\t\t\t\tclientY: event.clientY,\n\t\t\t\tbuttons: event.buttons,\n\t\t\t}\n\t\t\tconst cell = getCellFromClientPoint(event.clientX, event.clientY)\n\t\t\tif (cell) {\n\t\t\t\textendDragSelection(cell, event.buttons)\n\t\t\t}\n\t\t\tif ((event.buttons & 1) === 0) {\n\t\t\t\tstopDragSelection()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isPointerNearDragSelectionAutoScrollEdge(event.clientX, event.clientY)) {\n\t\t\t\tensureDragSelectionAutoScrollRunning()\n\t\t\t} else {\n\t\t\t\tstopDragSelectionAutoScroll()\n\t\t\t}\n\t\t}\n\n\t\tconst handleWindowPointerCancel = () => {\n\t\t\tstopDragSelectionAutoScroll()\n\t\t}\n\n\t\twindow.addEventListener(\"pointermove\", handleWindowPointerMove, { capture: true, signal: controller.signal })\n\t\twindow.addEventListener(\"pointercancel\", handleWindowPointerCancel, { capture: true, signal: controller.signal })\n\n\t\treturn () => {\n\t\t\tcontroller.abort()\n\t\t\tstopDragSelectionAutoScroll()\n\t\t}\n\t}, [\n\t\tactiveDragAnchorColumnId,\n\t\tautoScrollEdgeThreshold,\n\t\tautoScrollMaxStep,\n\t\tcolumnIndexById,\n\t\textendDragSelection,\n\t\tgetCellFromClientPoint,\n\t\tisCellDragSelecting,\n\t\tisPointerNearDragSelectionAutoScrollEdge,\n\t\trowHeaderWidth,\n\t\tstickyColumnCount,\n\t\tstickyColumnsWidth,\n\t\tstopDragSelection,\n\t\tstopDragSelectionAutoScroll,\n\t\ttableRowHeight,\n\t\ttableScrollRef,\n\t])\n}\n", "import type { VirtualTableIndexRange } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport React from \"react\"\nimport {\n\ttype CellIdentifier,\n\ttype RowsAndColumnsSnapshot,\n\tcreateRowsAndColumnsSnapshot,\n\tgetCellSelectionRanges,\n\tgetCellsInRectangle,\n\tgetIdsInRange,\n\tmoveCellInOrder,\n\tmoveCellInTabOrder,\n\ttype TabOrderDirection,\n} from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { VirtualGridInteractionAction, VirtualGridInteractionState } from \"./useVirtualGridInteractionMachine.ts\"\nimport type { ColumnKey } from \"./utils/collectionItemTableColumns.ts\"\n\ninterface CellSelectionState {\n\tanchor: CellIdentifier | null\n\tfocus: CellIdentifier | null\n\tsnapshot: RowsAndColumnsSnapshot | null\n}\n\nexport type SelectionAutoScrollBehavior = \"none\" | \"scroll\" | \"keyboard\"\n\nconst emptyCellSelectionState: CellSelectionState = {\n\tanchor: null,\n\tfocus: null,\n\tsnapshot: null,\n}\n\nfunction createSingleCellSelection(cell: CellIdentifier): CellSelectionState {\n\treturn {\n\t\tanchor: cell,\n\t\tfocus: cell,\n\t\tsnapshot: null,\n\t}\n}\n\nfunction createRangeSelection(\n\tanchor: CellIdentifier,\n\tfocus: CellIdentifier,\n\tsnapshot: RowsAndColumnsSnapshot,\n): CellSelectionState {\n\treturn {\n\t\tanchor,\n\t\tfocus,\n\t\tsnapshot,\n\t}\n}\n\nfunction getFirstCell(rowIds: readonly NodeID[], columnIds: readonly ColumnKey[]): CellIdentifier | null {\n\tconst firstRowId = rowIds[0]\n\tconst firstColumnId = columnIds[0]\n\tif (!firstRowId || !firstColumnId) return null\n\treturn { rowId: firstRowId, columnId: firstColumnId }\n}\n\nfunction getLastCell(rowIds: readonly NodeID[], columnIds: readonly ColumnKey[]): CellIdentifier | null {\n\tconst lastRowId = rowIds.at(-1)\n\tconst lastColumnId = columnIds.at(-1)\n\tif (!lastRowId || !lastColumnId) return null\n\treturn { rowId: lastRowId, columnId: lastColumnId }\n}\n\nfunction areCellsEqual(left: CellIdentifier | null, right: CellIdentifier | null): boolean {\n\tif (!left || !right) return false\n\tconst sameRow = left.rowId === right.rowId\n\tconst sameColumn = left.columnId === right.columnId\n\treturn sameRow && sameColumn\n}\n\ninterface UseVirtualGridCellSelectionArgs {\n\trowIds: readonly NodeID[]\n\tcolumnIds: readonly ColumnKey[]\n\trowIndexById: ReadonlyMap<NodeID, number>\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>\n\tfocusTable: () => void\n\tinteractionState: VirtualGridInteractionState\n\tdispatchInteraction: React.Dispatch<VirtualGridInteractionAction>\n}\n\nfunction isCellPresent(\n\tcell: CellIdentifier,\n\trowIndexById: ReadonlyMap<NodeID, number>,\n\tcolumnIndexById: ReadonlyMap<ColumnKey, number>,\n): boolean {\n\treturn rowIndexById.has(cell.rowId) && columnIndexById.has(cell.columnId)\n}\n\nfunction getSelectionRangeIfContiguous(\n\tselectedIds: readonly string[],\n\tindexById: ReadonlyMap<string, number>,\n): VirtualTableIndexRange | null {\n\tlet minIndex = Infinity\n\tlet maxIndex = -Infinity\n\tlet existingSelectionCount = 0\n\n\tfor (const id of selectedIds) {\n\t\tconst index = indexById.get(id)\n\t\tif (index === undefined) continue\n\n\t\tminIndex = Math.min(minIndex, index)\n\t\tmaxIndex = Math.max(maxIndex, index)\n\t\texistingSelectionCount += 1\n\t}\n\n\tif (existingSelectionCount === 0) return null\n\n\tconst selectionIsContiguous = maxIndex - minIndex + 1 === existingSelectionCount\n\treturn selectionIsContiguous ? { start: minIndex, end: maxIndex } : null\n}\n\nfunction computeNewAnchorAndFocus(\n\tanchor: CellIdentifier,\n\tfocus: CellIdentifier,\n\toldSnapshot: RowsAndColumnsSnapshot,\n\trowIds: readonly NodeID[],\n\tcolumnIds: readonly ColumnKey[],\n\trowRange: VirtualTableIndexRange,\n\tcolumnRange: VirtualTableIndexRange,\n): { anchor: CellIdentifier; focus: CellIdentifier } | null {\n\tconst oldAnchorRowIndex = oldSnapshot.rowIndexById.get(anchor.rowId)\n\tconst oldAnchorColumnIndex = oldSnapshot.columnIndexById.get(anchor.columnId)\n\tconst oldFocusRowIndex = oldSnapshot.rowIndexById.get(focus.rowId)\n\tconst oldFocusColumnIndex = oldSnapshot.columnIndexById.get(focus.columnId)\n\n\tif (\n\t\toldAnchorRowIndex === undefined ||\n\t\toldAnchorColumnIndex === undefined ||\n\t\toldFocusRowIndex === undefined ||\n\t\toldFocusColumnIndex === undefined\n\t) {\n\t\treturn null\n\t}\n\n\tconst anchorAtRowStart = oldAnchorRowIndex <= oldFocusRowIndex\n\tconst anchorAtColumnStart = oldAnchorColumnIndex <= oldFocusColumnIndex\n\tconst anchorRowId = rowIds[anchorAtRowStart ? rowRange.start : rowRange.end]\n\tconst anchorColumnId = columnIds[anchorAtColumnStart ? columnRange.start : columnRange.end]\n\tconst focusRowId = rowIds[anchorAtRowStart ? rowRange.end : rowRange.start]\n\tconst focusColumnId = columnIds[anchorAtColumnStart ? columnRange.end : columnRange.start]\n\n\tif (!anchorRowId || !anchorColumnId || !focusRowId || !focusColumnId) return null\n\n\treturn {\n\t\tanchor: { rowId: anchorRowId, columnId: anchorColumnId },\n\t\tfocus: { rowId: focusRowId, columnId: focusColumnId },\n\t}\n}\n\nfunction getSelectedCells(selection: CellSelectionState): CellIdentifier[] {\n\tconst ranges = getCellSelectionRanges(selection.anchor, selection.focus, selection.snapshot)\n\tif (selection.snapshot && ranges) {\n\t\treturn getCellsInRectangle(selection.snapshot, ranges.rowRange, ranges.columnRange)\n\t}\n\n\treturn selection.anchor ? [selection.anchor] : []\n}\n\n/**\n * When a change occurs (typically from another client), verify whether the current\n * selection is still valid.\n *\n * A selection is considered valid if:\n * - No new rows or columns were added to the selected rectangle\n * - Deleted rows or columns are ignored as long as the remaining selection stays contiguous\n * - Row and column order may differ, but the remaining selected rows and columns\n *   must still form contiguous ranges after the change\n *\n * Behavior:\n * - If the selection is still valid: return the same selection, ensuring the\n *   anchor and focus cells occupy opposite corners of the selected grid.\n * - If the selection is not valid:\n *   - If the anchor cell still exists: collapse the selection to the anchor.\n *   - Otherwise: return an empty selection.\n */\nfunction reconcileSelectionAfterStructureChange(\n\toldSelection: CellSelectionState,\n\tcurrentSnapshot: RowsAndColumnsSnapshot,\n): CellSelectionState {\n\tif (!oldSelection.anchor && !oldSelection.focus) return oldSelection\n\n\tconst { rowIds, columnIds, rowIndexById, columnIndexById } = currentSnapshot\n\tconst anchorCell = oldSelection.anchor\n\tconst focusCell = oldSelection.focus\n\n\tif (!anchorCell) return emptyCellSelectionState\n\tif (!focusCell) return createSingleCellSelection(anchorCell)\n\tif (!isCellPresent(anchorCell, rowIndexById, columnIndexById)) return emptyCellSelectionState\n\tif (!isCellPresent(focusCell, rowIndexById, columnIndexById)) return createSingleCellSelection(anchorCell)\n\n\t// Single-cell selection has null snapshot, so it is just { anchor, focus }\n\tif (!oldSelection.snapshot) return oldSelection\n\n\tconst oldRanges = getCellSelectionRanges(anchorCell, focusCell, oldSelection.snapshot)\n\tif (!oldRanges) return oldSelection\n\n\tconst selectedRowIds = getIdsInRange(oldSelection.snapshot.rowIds, oldRanges.rowRange)\n\tconst selectedColumnIds = getIdsInRange(oldSelection.snapshot.columnIds, oldRanges.columnRange)\n\tconst rowRange = getSelectionRangeIfContiguous(selectedRowIds, rowIndexById)\n\tif (!rowRange) return createSingleCellSelection(anchorCell)\n\n\tconst columnRange = getSelectionRangeIfContiguous(selectedColumnIds, columnIndexById)\n\tif (!columnRange) return createSingleCellSelection(anchorCell)\n\n\tconst nextAnchorAndFocus = computeNewAnchorAndFocus(\n\t\tanchorCell,\n\t\tfocusCell,\n\t\toldSelection.snapshot,\n\t\trowIds,\n\t\tcolumnIds,\n\t\trowRange,\n\t\tcolumnRange,\n\t)\n\tif (!nextAnchorAndFocus) return createSingleCellSelection(anchorCell)\n\n\tconst { anchor: nextAnchor, focus: nextFocus } = nextAnchorAndFocus\n\tconst nextSnapshot = createRowsAndColumnsSnapshot(rowIds, columnIds, rowIndexById, columnIndexById)\n\treturn { anchor: nextAnchor, focus: nextFocus, snapshot: nextSnapshot }\n}\n\nexport function useVirtualGridCellSelection({\n\trowIds,\n\tcolumnIds,\n\trowIndexById,\n\tcolumnIndexById,\n\tfocusTable,\n\tinteractionState,\n\tdispatchInteraction,\n}: UseVirtualGridCellSelectionArgs) {\n\tconst [selection, setSelection] = React.useState<CellSelectionState>(emptyCellSelectionState)\n\tconst selectionAutoScrollBehaviorRef = React.useRef<SelectionAutoScrollBehavior>(\"none\")\n\n\tconst selectionRef = React.useRef(selection)\n\tReact.useEffect(() => {\n\t\tselectionRef.current = selection\n\t}, [selection])\n\n\tconst latestSnapshot = React.useMemo(() => {\n\t\treturn createRowsAndColumnsSnapshot(rowIds, columnIds, rowIndexById, columnIndexById)\n\t}, [columnIds, columnIndexById, rowIds, rowIndexById])\n\n\tReact.useLayoutEffect(() => {\n\t\tsetSelection(currentSelection => reconcileSelectionAfterStructureChange(currentSelection, latestSnapshot))\n\t}, [latestSnapshot])\n\n\tconst selectCell = React.useCallback(\n\t\t(cell: CellIdentifier, selectionAutoScrollBehavior: SelectionAutoScrollBehavior) => {\n\t\t\tselectionAutoScrollBehaviorRef.current = selectionAutoScrollBehavior\n\t\t\tsetSelection(createSingleCellSelection(cell))\n\t\t},\n\t\t[],\n\t)\n\n\tconst moveSelection = React.useCallback(\n\t\t(\n\t\t\trowDelta: number,\n\t\t\tcolumnDelta: number,\n\t\t\textendRange: boolean,\n\t\t\tselectionAutoScrollBehavior: SelectionAutoScrollBehavior,\n\t\t) => {\n\t\t\tselectionAutoScrollBehaviorRef.current = selectionAutoScrollBehavior\n\n\t\t\tsetSelection(current => {\n\t\t\t\tconst activeCell = extendRange\n\t\t\t\t\t? (current.focus ?? current.anchor ?? getFirstCell(latestSnapshot.rowIds, latestSnapshot.columnIds))\n\t\t\t\t\t: (current.anchor ?? current.focus ?? getFirstCell(latestSnapshot.rowIds, latestSnapshot.columnIds))\n\t\t\t\tif (!activeCell) return current\n\n\t\t\t\tconst orderSnapshot = extendRange ? (current.snapshot ?? latestSnapshot) : latestSnapshot\n\t\t\t\tconst nextCell = moveCellInOrder(activeCell, orderSnapshot, rowDelta, columnDelta)\n\t\t\t\tif (!nextCell) return current\n\n\t\t\t\tif (extendRange) {\n\t\t\t\t\tconst anchor = current.anchor ?? activeCell\n\t\t\t\t\treturn { anchor, focus: nextCell, snapshot: orderSnapshot }\n\t\t\t\t}\n\n\t\t\t\treturn createSingleCellSelection(nextCell)\n\t\t\t})\n\t\t},\n\t\t[latestSnapshot],\n\t)\n\n\tconst moveSelectionInTabOrder = React.useCallback(\n\t\t(direction: TabOrderDirection, selectionAutoScrollBehavior: SelectionAutoScrollBehavior) => {\n\t\t\tconst currentSelection = selectionRef.current\n\t\t\tconst activeCell =\n\t\t\t\tcurrentSelection.anchor ??\n\t\t\t\tcurrentSelection.focus ??\n\t\t\t\tgetFirstCell(latestSnapshot.rowIds, latestSnapshot.columnIds)\n\t\t\tif (!activeCell) return false\n\n\t\t\tconst movement = moveCellInTabOrder(activeCell, latestSnapshot, direction)\n\t\t\tif (!movement || movement.type === \"boundary\") return false\n\n\t\t\tselectionAutoScrollBehaviorRef.current = selectionAutoScrollBehavior\n\t\t\tsetSelection(createSingleCellSelection(movement.cell))\n\t\t\treturn true\n\t\t},\n\t\t[latestSnapshot],\n\t)\n\n\tconst beginDragSelection = React.useCallback(\n\t\t(cell: CellIdentifier, extendRange: boolean) => {\n\t\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\n\t\t\tconst current = selectionRef.current\n\t\t\tconst anchor = extendRange && current.anchor ? current.anchor : cell\n\n\t\t\tdispatchInteraction({\n\t\t\t\tkind: \"startCellDragSelect\",\n\t\t\t\tdragSelection: {\n\t\t\t\t\tanchor,\n\t\t\t\t\tfocus: cell,\n\t\t\t\t\tsnapshot: latestSnapshot,\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tsetSelection({ anchor, focus: cell, snapshot: latestSnapshot })\n\n\t\t\tfocusTable()\n\t\t},\n\t\t[latestSnapshot, dispatchInteraction, focusTable],\n\t)\n\n\tconst extendDragSelection = React.useCallback(\n\t\t(cell: CellIdentifier, buttons: number) => {\n\t\t\tif ((buttons & 1) === 0) return\n\t\t\tif (interactionState.kind !== \"cellDragSelect\") return\n\n\t\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\t\t\tdispatchInteraction({ kind: \"updateCellDragSelectFocus\", focus: cell })\n\t\t\tsetSelection(current => {\n\t\t\t\tif (!current.anchor || !current.snapshot) return current\n\t\t\t\tif (areCellsEqual(current.focus, cell)) return current\n\n\t\t\t\treturn { anchor: current.anchor, focus: cell, snapshot: current.snapshot }\n\t\t\t})\n\t\t},\n\t\t[dispatchInteraction, interactionState.kind],\n\t)\n\n\tconst stopDragSelection = React.useCallback(() => {\n\t\tdispatchInteraction({ kind: \"stopCellDragSelect\" })\n\t}, [dispatchInteraction])\n\n\tconst clearSelection = React.useCallback(() => {\n\t\tsetSelection(emptyCellSelectionState)\n\t}, [])\n\n\tconst clearRangeSelection = React.useCallback(() => {\n\t\tsetSelection(currentSelection => {\n\t\t\tif (areCellsEqual(currentSelection.anchor, currentSelection.focus)) return currentSelection\n\t\t\tif (currentSelection.anchor) return createSingleCellSelection(currentSelection.anchor)\n\t\t\treturn emptyCellSelectionState\n\t\t})\n\t}, [])\n\n\tconst selectFirstCell = React.useCallback(\n\t\t(selectionAutoScrollBehavior: SelectionAutoScrollBehavior = \"keyboard\") => {\n\t\t\tconst firstCell = getFirstCell(rowIds, columnIds)\n\t\t\tif (!firstCell) return false\n\t\t\tselectCell(firstCell, selectionAutoScrollBehavior)\n\t\t\treturn true\n\t\t},\n\t\t[columnIds, rowIds, selectCell],\n\t)\n\n\tconst selectLastCell = React.useCallback(\n\t\t(selectionAutoScrollBehavior: SelectionAutoScrollBehavior = \"keyboard\") => {\n\t\t\tconst lastCell = getLastCell(rowIds, columnIds)\n\t\t\tif (!lastCell) return false\n\t\t\tselectCell(lastCell, selectionAutoScrollBehavior)\n\t\t\treturn true\n\t\t},\n\t\t[columnIds, rowIds, selectCell],\n\t)\n\n\tconst selectColumn = React.useCallback(\n\t\t(columnId: ColumnKey) => {\n\t\t\tconst firstRowId = latestSnapshot.rowIds[0]\n\t\t\tconst lastRowId = latestSnapshot.rowIds.at(-1)\n\t\t\tif (!firstRowId || !lastRowId || !latestSnapshot.columnIndexById.has(columnId)) return false\n\n\t\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\t\t\tsetSelection(\n\t\t\t\tcreateRangeSelection({ rowId: firstRowId, columnId }, { rowId: lastRowId, columnId }, latestSnapshot),\n\t\t\t)\n\t\t\treturn true\n\t\t},\n\t\t[latestSnapshot],\n\t)\n\n\tconst selectAllCells = React.useCallback(() => {\n\t\tconst firstCell = getFirstCell(latestSnapshot.rowIds, latestSnapshot.columnIds)\n\t\tconst lastCell = getLastCell(latestSnapshot.rowIds, latestSnapshot.columnIds)\n\t\tif (!firstCell || !lastCell) return false\n\n\t\tselectionAutoScrollBehaviorRef.current = \"none\"\n\t\tsetSelection(createRangeSelection(firstCell, lastCell, latestSnapshot))\n\t\treturn true\n\t}, [latestSnapshot])\n\n\tconst publicSelection = React.useMemo(\n\t\t() => ({\n\t\t\tselectedCells: getSelectedCells(selection),\n\t\t\tanchor: selection.anchor,\n\t\t\tfocus: selection.focus,\n\t\t}),\n\t\t[selection],\n\t)\n\n\tconst selectFirstCellIfNoneSelected = React.useCallback(() => {\n\t\tif (publicSelection.anchor || publicSelection.focus) return false\n\t\treturn selectFirstCell(\"keyboard\")\n\t}, [publicSelection.anchor, publicSelection.focus, selectFirstCell])\n\n\tconst activeDragSelectionAnchorColumnId =\n\t\tinteractionState.kind === \"cellDragSelect\" ? interactionState.dragSelection.anchor.columnId : null\n\n\treturn {\n\t\tselection: publicSelection,\n\t\tselectionAutoScrollBehaviorRef,\n\t\tselectCell,\n\t\tmoveSelection,\n\t\tmoveSelectionInTabOrder,\n\t\tbeginDragSelection,\n\t\textendDragSelection,\n\t\tstopDragSelection,\n\t\tclearSelection,\n\t\tclearRangeSelection,\n\t\tselectFirstCell,\n\t\tselectLastCell,\n\t\tselectColumn,\n\t\tselectAllCells,\n\t\tselectFirstCellIfNoneSelected,\n\t\tactiveDragSelectionAnchorColumnId,\n\t}\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport React from \"react\"\nimport type { VirtualGridColumnResizeState } from \"./VirtualCollectionItemTable.columnWidthController.ts\"\nimport type { CellIdentifier, RowsAndColumnsSnapshot } from \"./VirtualCollectionItemTable.selection.ts\"\nimport type { VirtualGridColumnReorderState } from \"./useVirtualGridColumnReorder.ts\"\nimport type { VirtualGridRowReorderState } from \"./useVirtualGridRowReorder.ts\"\n\ninterface VirtualGridSelectionDragState {\n\tanchor: CellIdentifier\n\tfocus: CellIdentifier\n\tsnapshot: RowsAndColumnsSnapshot\n}\n\nexport type VirtualGridInteractionState =\n\t| { kind: \"idle\" }\n\t| { kind: \"cellDragSelect\"; dragSelection: VirtualGridSelectionDragState; dragMovedToAnotherCell: boolean }\n\t| { kind: \"rowReorder\"; rowReorder: VirtualGridRowReorderState }\n\t| { kind: \"columnReorder\"; columnReorder: VirtualGridColumnReorderState }\n\t| { kind: \"columnResize\"; columnResize: VirtualGridColumnResizeState }\n\nexport type VirtualGridInteractionAction =\n\t| { kind: \"startCellDragSelect\"; dragSelection: VirtualGridSelectionDragState }\n\t| { kind: \"updateCellDragSelectFocus\"; focus: CellIdentifier }\n\t| { kind: \"stopCellDragSelect\" }\n\t| { kind: \"startRowReorder\"; rowReorder: VirtualGridRowReorderState }\n\t| { kind: \"updateRowReorder\"; rowReorder: VirtualGridRowReorderState }\n\t| { kind: \"stopRowReorder\" }\n\t| { kind: \"startColumnReorder\"; columnReorder: VirtualGridColumnReorderState }\n\t| { kind: \"updateColumnReorder\"; columnReorder: VirtualGridColumnReorderState }\n\t| { kind: \"stopColumnReorder\" }\n\t| { kind: \"startColumnResize\"; columnResize: VirtualGridColumnResizeState }\n\t| { kind: \"updateColumnResize\"; columnResize: VirtualGridColumnResizeState }\n\t| { kind: \"stopColumnResize\" }\n\t| { kind: \"cancelInteraction\" }\n\nexport type VirtualGridInteractionKind = VirtualGridInteractionState[\"kind\"]\n\nexport function reduceVirtualGridInteractionState(\n\tstate: VirtualGridInteractionState,\n\taction: VirtualGridInteractionAction,\n): VirtualGridInteractionState {\n\tswitch (action.kind) {\n\t\tcase \"startCellDragSelect\":\n\t\t\tif (state.kind !== \"idle\") return state\n\t\t\treturn { kind: \"cellDragSelect\", dragSelection: action.dragSelection, dragMovedToAnotherCell: false }\n\t\tcase \"updateCellDragSelectFocus\": {\n\t\t\tif (state.kind !== \"cellDragSelect\") return state\n\t\t\tconst { anchor } = state.dragSelection\n\t\t\tconst dragMovedToAnotherCell =\n\t\t\t\tstate.dragMovedToAnotherCell || anchor.rowId !== action.focus.rowId || anchor.columnId !== action.focus.columnId\n\t\t\treturn {\n\t\t\t\tkind: \"cellDragSelect\",\n\t\t\t\tdragSelection: { ...state.dragSelection, focus: action.focus },\n\t\t\t\tdragMovedToAnotherCell,\n\t\t\t}\n\t\t}\n\t\tcase \"stopCellDragSelect\":\n\t\t\tif (state.kind !== \"cellDragSelect\") return state\n\t\t\treturn { kind: \"idle\" }\n\t\tcase \"startRowReorder\":\n\t\t\tif (state.kind !== \"idle\") return state\n\t\t\treturn { kind: \"rowReorder\", rowReorder: action.rowReorder }\n\t\tcase \"updateRowReorder\":\n\t\t\tif (state.kind !== \"rowReorder\") return state\n\t\t\treturn { kind: \"rowReorder\", rowReorder: action.rowReorder }\n\t\tcase \"stopRowReorder\":\n\t\t\tif (state.kind !== \"rowReorder\") return state\n\t\t\treturn { kind: \"idle\" }\n\t\tcase \"startColumnReorder\":\n\t\t\tif (state.kind !== \"idle\") return state\n\t\t\treturn { kind: \"columnReorder\", columnReorder: action.columnReorder }\n\t\tcase \"updateColumnReorder\":\n\t\t\tif (state.kind !== \"columnReorder\") return state\n\t\t\treturn { kind: \"columnReorder\", columnReorder: action.columnReorder }\n\t\tcase \"stopColumnReorder\":\n\t\t\tif (state.kind !== \"columnReorder\") return state\n\t\t\treturn { kind: \"idle\" }\n\t\tcase \"startColumnResize\":\n\t\t\tif (state.kind !== \"idle\") return state\n\t\t\treturn { kind: \"columnResize\", columnResize: action.columnResize }\n\t\tcase \"updateColumnResize\":\n\t\t\tif (state.kind !== \"columnResize\") return state\n\t\t\treturn { kind: \"columnResize\", columnResize: action.columnResize }\n\t\tcase \"stopColumnResize\":\n\t\t\tif (state.kind !== \"columnResize\") return state\n\t\t\treturn { kind: \"idle\" }\n\t\tcase \"cancelInteraction\":\n\t\t\treturn { kind: \"idle\" }\n\t\tdefault:\n\t\t\tassertNever(action)\n\t}\n}\n\nconst initialInteractionState = { kind: \"idle\" } as const\n\nexport function useVirtualGridInteractionMachine() {\n\tconst [interactionState, dispatchInteraction] = React.useReducer(\n\t\treduceVirtualGridInteractionState,\n\t\tinitialInteractionState,\n\t)\n\n\treturn { interactionState, dispatchInteraction }\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { getItemsFromStartToEndInclusive } from \"utils/getItemsFromStartToEndInclusive.ts\"\nimport { getLastItemFromIterable } from \"utils/getLastItemFromIterable.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\ninterface UseVirtualGridRowSelectionArgs {\n\trowIds: readonly NodeID[]\n\tclearCellSelectionForRowSelection: () => void\n}\n\nexport function useVirtualGridRowSelection({\n\trowIds,\n\tclearCellSelectionForRowSelection,\n}: UseVirtualGridRowSelectionArgs) {\n\tconst exitMultiSelectionModeWhenEmpty = useCallback(() => {\n\t\tconst { contentManagementStore } = engine.stores\n\t\tif (contentManagementStore.multiSelectedItems?.size !== 0) return\n\t\tcontentManagementStore.exitMultiSelectionMode()\n\t}, [])\n\n\tconst toggleRowSelection = useCallback(\n\t\t(rowId: NodeID, expandSelection: boolean) => {\n\t\t\tconst { contentManagementStore } = engine.stores\n\t\t\tconst currentMultiSelectedItems = contentManagementStore.multiSelectedItems\n\n\t\t\tif (expandSelection && currentMultiSelectedItems && currentMultiSelectedItems.size > 0) {\n\t\t\t\tconst lastSelectedItem = getLastItemFromIterable(currentMultiSelectedItems)\n\t\t\t\tif (isString(lastSelectedItem) && rowIds.includes(lastSelectedItem)) {\n\t\t\t\t\tconst rowsToExpand = getItemsFromStartToEndInclusive(rowIds, rowId, lastSelectedItem)\n\t\t\t\t\tconst addToSelection = !currentMultiSelectedItems.has(rowId)\n\n\t\t\t\t\tif (addToSelection) {\n\t\t\t\t\t\tcontentManagementStore.selectItems(rowsToExpand)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontentManagementStore.deselectItems(rowsToExpand)\n\t\t\t\t\t}\n\n\t\t\t\t\texitMultiSelectionModeWhenEmpty()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontentManagementStore.toggleSelectItem(rowId)\n\t\t\texitMultiSelectionModeWhenEmpty()\n\t\t},\n\t\t[exitMultiSelectionModeWhenEmpty, rowIds],\n\t)\n\n\tconst handleRowCheckboxClick = useCallback(\n\t\t(rowId: NodeID, event: React.MouseEvent) => {\n\t\t\tclearCellSelectionForRowSelection()\n\t\t\ttoggleRowSelection(rowId, event.shiftKey)\n\t\t},\n\t\t[clearCellSelectionForRowSelection, toggleRowSelection],\n\t)\n\n\tconst handleAllRowsCheckboxChange = useCallback(\n\t\t(checked: boolean) => {\n\t\t\tclearCellSelectionForRowSelection()\n\t\t\tif (checked) {\n\t\t\t\tengine.stores.contentManagementStore.selectItems([...rowIds])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tengine.stores.contentManagementStore.deselectItems([...rowIds])\n\t\t\texitMultiSelectionModeWhenEmpty()\n\t\t},\n\t\t[clearCellSelectionForRowSelection, exitMultiSelectionModeWhenEmpty, rowIds],\n\t)\n\n\treturn {\n\t\thandleRowCheckboxClick,\n\t\thandleAllRowsCheckboxChange,\n\t}\n}\n", "export function getItemsFromStartToEndInclusive<T>(items: Iterable<T>, start: T, end: T): T[] {\n\tconst result: T[] = []\n\tlet foundStartItem = false\n\tlet foundEndItem = false\n\tfor (const item of items) {\n\t\tfoundStartItem = foundStartItem || start === item\n\t\tfoundEndItem = foundEndItem || end === item\n\t\tif (foundStartItem || foundEndItem) result.push(item)\n\t\tif (foundStartItem && foundEndItem) break\n\t}\n\treturn result\n}\n", "export function getLastItemFromIterable<T>(items: Iterable<T>): T | undefined {\n\tlet result: T | undefined\n\tfor (const item of items) {\n\t\tresult = item\n\t}\n\treturn result\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionItemNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisSlugVariableDefinition,\n\tisStringVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { getTakenSlugs } from \"../useTakenSlugs.ts\"\nimport { getUniqueCollectionItemSlug } from \"./getUniqueCollectionItemSlug.ts\"\n\nexport function duplicateCollectionItemImmediately(engine: VekterEngine, collectionItemId: NodeID): CollectionItemNode {\n\tconst { collection, collectionItem, duplicatedCollectionItem } = getDuplicatedCollectionItem(engine, collectionItemId)\n\tconst titleVariable = collection.getTitleVariable() ?? collection.variables.find(isStringVariableDefinition)\n\n\tif (titleVariable) {\n\t\tconst currentControlProp = duplicatedCollectionItem.getControlProp(titleVariable.id)\n\t\tlet currentTitle = \"\"\n\t\tif (currentControlProp?.type === ControlType.String && isString(currentControlProp.value)) {\n\t\t\tcurrentTitle = currentControlProp.value\n\t\t}\n\t\tconst baseTitle = currentTitle.length > 0 ? `${currentTitle} Copy` : \"Copy\"\n\t\tconst takenTitles = new Set<string>()\n\t\tfor (const item of collection.getUnsortedChildren()) {\n\t\t\tif (item.id === collectionItem.id) continue\n\n\t\t\tconst controlProp = item.getControlProp(titleVariable.id)\n\t\t\tif (controlProp?.type !== ControlType.String || !isString(controlProp.value)) continue\n\n\t\t\ttakenTitles.add(controlProp.value)\n\t\t}\n\t\tconst uniqueTitle = uniqueName(baseTitle, takenTitles)\n\t\tduplicatedCollectionItem.setControlProp(titleVariable.id, {\n\t\t\ttype: ControlType.String,\n\t\t\tvalue: uniqueTitle,\n\t\t})\n\t}\n\n\tconst takenSlugs = getTakenSlugs(collection, collectionItem)\n\tfor (const slugVariable of collection.variables.filter(isSlugVariableDefinition)) {\n\t\tconst currentControlProp = duplicatedCollectionItem.getControlProp(slugVariable.id)\n\t\tlet currentSlug = \"\"\n\t\tif (currentControlProp?.type === ControlType.String && isString(currentControlProp.value)) {\n\t\t\tcurrentSlug = currentControlProp.value\n\t\t}\n\t\tconst slugSource = currentSlug.length > 0 ? `${currentSlug} Copy` : \"Copy\"\n\t\tconst uniqueSlug = getUniqueCollectionItemSlug(slugSource, takenSlugs.get(slugVariable.id) ?? new Set())\n\t\tif (!uniqueSlug.length) {\n\t\t\tduplicatedCollectionItem.deleteProp(prefixControlPropKey(slugVariable.id))\n\t\t\tcontinue\n\t\t}\n\n\t\tduplicatedCollectionItem.setControlProp(slugVariable.id, {\n\t\t\ttype: ControlType.String,\n\t\t\tvalue: uniqueSlug,\n\t\t})\n\t}\n\n\tengine.stores.scopeStore.insertNode(duplicatedCollectionItem, collection.id, 0)\n\n\treturn duplicatedCollectionItem\n}\n\nfunction getDuplicatedCollectionItem(engine: VekterEngine, collectionItemId: NodeID) {\n\tconst collectionItem = engine.tree.getNodeWithTrait(collectionItemId, isCollectionItemNode)\n\tassert(collectionItem, \"Collection item should exist for duplication\")\n\tassert(collectionItem.parentid, \"Collection item should have a parent id\")\n\tconst collection = engine.tree.getNodeWithTrait(collectionItem.parentid, isCollectionNode)\n\tassert(collection, \"Collection parent should exist for duplication\")\n\n\tconst duplicatedCollectionItem = engine.cloneNode(collectionItem, false, false)\n\n\tif (!duplicatedCollectionItem.isDraft) {\n\t\tduplicatedCollectionItem.set({ isDraft: true })\n\t}\n\n\treturn {\n\t\tcollection,\n\t\tcollectionItem,\n\t\tduplicatedCollectionItem,\n\t}\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getMetricsInteractionSourceForScopeType } from \"document/components/utils/getMetricsInteractionSourceForScopeType.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport type { CmsAgentChatSelectionSnapshot } from \"../CmsAgentChatPanel.tsx\"\nimport type { VirtualCollectionItemTableInlineEditAction } from \"../VirtualCollectionItemTable.editingTypes.ts\"\nimport { openCollectionItemOverlayForCell } from \"../VirtualCollectionItemTable.openCollectionItemOverlay.ts\"\nimport type { CellIdentifier } from \"../VirtualCollectionItemTable.selection.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\nimport { isCollectionItemTableStatusColumnKey } from \"./collectionItemTableStatusColumn.ts\"\nimport {\n\tdeleteCollectionItemsWithConfirmation,\n\tsetCollectionItemsStatusWithConfirmation,\n} from \"./contentManagementActions.tsx\"\nimport { duplicateCollectionItemImmediately } from \"./duplicateCollectionItem.ts\"\n\nexport interface RowContextMenuSupport {\n\tclearCellSelectionForRowSelection: () => void\n\tfinishEditingSession: () => void\n\texitAgentSelectionMode: () => void\n\texitMultiSelectionMode: () => void\n\tfocusTable: () => void\n\tselectAndRevealDuplicateCell: (rowId: NodeID) => void\n}\n\nexport interface GetCollectionItemRowContextMenuOptionsArgs {\n\tengine: VekterEngine\n\tcollectionItemId: NodeID\n\tcontextMenuTargetCell: CellIdentifier | null\n\tselectedCells: readonly CellIdentifier[]\n\tinlineEditEnabled: boolean\n\tspreadsheetCellActionLabel: string\n\tinlineEditAction: VirtualCollectionItemTableInlineEditAction | undefined\n\trowContextMenuSupport: RowContextMenuSupport\n\tcmsAgentChatSelectionSnapshot?: CmsAgentChatSelectionSnapshot | undefined\n\tisContextMenuTargetCellInSelection?: boolean\n}\n\nexport function getCollectionItemRowContextMenuOptions({\n\tengine,\n\tcollectionItemId,\n\tcontextMenuTargetCell,\n\tselectedCells,\n\tinlineEditEnabled,\n\tspreadsheetCellActionLabel,\n\tinlineEditAction,\n\trowContextMenuSupport,\n\tcmsAgentChatSelectionSnapshot,\n\tisContextMenuTargetCellInSelection,\n}: GetCollectionItemRowContextMenuOptionsArgs): MenuItemOptions[] {\n\tconst collectionItem = engine.tree.getNodeWithTrait(collectionItemId, isCollectionItemNode)\n\tconst collection = engine.tree.getNodeWithTrait(collectionItem?.parentid, isCollectionNode)\n\tconst isDraft = Boolean(collectionItem?.isDraft)\n\tconst isViewOnly = getIsViewOnly(engine, \"canEditContent\") || Boolean(collection?.managedByPlugin)\n\tconst { contentManagementStore } = engine.stores\n\tconst multiSelectedItems = contentManagementStore.multiSelectedItems\n\tconst isCheckedInMultiSelectionMode = multiSelectedItems?.has(collectionItemId) === true\n\tconst isMultiSelectionModeActive = contentManagementStore.isMultiSelectionModeActive\n\tconst multiSelectedItemIds = Array.from(multiSelectedItems ?? [])\n\tconst hasAnyPrivateDraftCollectionItem = contentManagementStore.hasAnyPrivateDraftCollectionItem()\n\tconst rowActionCollectionItemIds =\n\t\tmultiSelectedItemIds.length > 0 && isCheckedInMultiSelectionMode ? multiSelectedItemIds : [collectionItemId]\n\tconst selectedStatusCellRowIds = getSelectedStatusCellRowIds({\n\t\tcontextMenuTargetCell,\n\t\tselectedCells,\n\t})\n\tconst draftActionCollectionItemIds =\n\t\tselectedStatusCellRowIds.length > 0 ? selectedStatusCellRowIds : rowActionCollectionItemIds\n\tconst draftActionEnabled =\n\t\tselectedStatusCellRowIds.length > 0 || multiSelectedItemIds.length === 0 || isCheckedInMultiSelectionMode\n\tconst showOpenOverlayItem = !isMultiSelectionModeActive\n\tconst showSpreadsheetInlineEditItem = contextMenuTargetCell != null && inlineEditAction && !isMultiSelectionModeActive\n\n\tconst options: MenuItemOptions[] = []\n\n\tif (cmsAgentChatSelectionSnapshot && isContextMenuTargetCellInSelection) {\n\t\toptions.push(\n\t\t\t{\n\t\t\t\tlabel: `Add To ${Dictionary.Agent}`,\n\t\t\t\tenabled: cmsAgentChatSelectionSnapshot.collectionItemIds.length > 0 && !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.agentStore.enqueueSelection({\n\t\t\t\t\t\ttype: \"cmsSelection\",\n\t\t\t\t\t\t...cmsAgentChatSelectionSnapshot,\n\t\t\t\t\t\tfocusInput: true,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t)\n\t}\n\n\tconst draftItem: MenuItemOptions = {\n\t\tlabel: isDraft ? Dictionary.Undraft : Dictionary.Draft,\n\t\tchecked: false,\n\t\tenabled: !isViewOnly && draftActionEnabled,\n\t\tclick: () => {\n\t\t\tsetCollectionItemsStatusWithConfirmation(\n\t\t\t\tengine,\n\t\t\t\tdraftActionCollectionItemIds,\n\t\t\t\tisDraft ? undefined : true,\n\t\t\t\t\"collection_table\",\n\t\t\t)\n\t\t},\n\t}\n\n\tlet openOverlayItem: MenuItemOptions | undefined\n\tif (showOpenOverlayItem) {\n\t\topenOverlayItem = {\n\t\t\tlabel: getOpenOverlayLabel(isViewOnly),\n\t\t\tenabled: !hasAnyPrivateDraftCollectionItem && !isMultiSelectionModeActive,\n\t\t\tclick: async () => {\n\t\t\t\trowContextMenuSupport.exitAgentSelectionMode()\n\t\t\t\trowContextMenuSupport.exitMultiSelectionMode()\n\t\t\t\trowContextMenuSupport.finishEditingSession()\n\t\t\t\trowContextMenuSupport.focusTable()\n\n\t\t\t\tconst { userKeptEditing } = await closeCollectionItems({\n\t\t\t\t\tengine,\n\t\t\t\t\ttarget: \"all\",\n\t\t\t\t})\n\t\t\t\tif (userKeptEditing) return\n\t\t\t\tif (engine.stores.contentManagementStore.isMultiSelectionModeActive) return\n\n\t\t\t\tif (contextMenuTargetCell) {\n\t\t\t\t\topenCollectionItemOverlayForCell({ engine, cell: contextMenuTargetCell })\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tengine.stores.contentManagementStore.clearCollectionItemControlToHighlight()\n\t\t\t\t\tengine.stores.selectionStore.set(collectionItemId)\n\t\t\t\t})\n\t\t\t},\n\t\t}\n\t}\n\n\tlet spreadsheetInlineEditItem: MenuItemOptions | undefined\n\tif (showSpreadsheetInlineEditItem) {\n\t\tspreadsheetInlineEditItem = {\n\t\t\tlabel: spreadsheetCellActionLabel,\n\t\t\tenabled: inlineEditEnabled === true,\n\t\t\tclick: async () => {\n\t\t\t\trowContextMenuSupport.exitAgentSelectionMode()\n\t\t\t\trowContextMenuSupport.exitMultiSelectionMode()\n\t\t\t\trowContextMenuSupport.finishEditingSession()\n\t\t\t\trowContextMenuSupport.focusTable()\n\t\t\t\tinlineEditAction.prepare?.()\n\n\t\t\t\tconst { userKeptEditing } = await closeCollectionItems({\n\t\t\t\t\tengine,\n\t\t\t\t\ttarget: \"all\",\n\t\t\t\t})\n\t\t\t\tif (userKeptEditing) return\n\n\t\t\t\tawait inlineEditAction.run()\n\t\t\t},\n\t\t}\n\t}\n\n\tif (spreadsheetInlineEditItem) {\n\t\toptions.push(spreadsheetInlineEditItem, { type: \"separator\" })\n\t\tif (openOverlayItem) {\n\t\t\toptions.push(openOverlayItem)\n\t\t}\n\t\toptions.push(draftItem)\n\t} else {\n\t\toptions.push(draftItem, { type: \"separator\" })\n\t\tif (openOverlayItem) {\n\t\t\toptions.push(openOverlayItem)\n\t\t}\n\t}\n\n\toptions.push(\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tenabled: !hasAnyPrivateDraftCollectionItem && !isViewOnly && !isMultiSelectionModeActive,\n\t\t\tclick: () => {\n\t\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\t\tconst duplicatedCollectionItem = duplicateCollectionItemImmediately(engine, collectionItemId)\n\t\t\t\t\trowContextMenuSupport.selectAndRevealDuplicateCell(duplicatedCollectionItem.id)\n\t\t\t\t})\n\t\t\t\trecord(\"collection_record_duplicate\", {\n\t\t\t\t\tsource: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\trowContextMenuSupport.clearCellSelectionForRowSelection()\n\t\t\t\tdeleteCollectionItemsWithConfirmation(engine, rowActionCollectionItemIds, \"collection_table\")\n\t\t\t},\n\t\t},\n\t)\n\n\treturn options\n}\n\nfunction getOpenOverlayLabel(isViewOnly: boolean) {\n\tif (isViewOnly) return Dictionary.View\n\treturn Dictionary.Open\n}\n\nfunction getSelectedStatusCellRowIds({\n\tcontextMenuTargetCell,\n\tselectedCells,\n}: {\n\tcontextMenuTargetCell?: CellIdentifier | null\n\tselectedCells?: readonly CellIdentifier[]\n}): NodeID[] {\n\tif (!contextMenuTargetCell) return []\n\n\tconst contextMenuOpenedOnStatusCell = isCollectionItemTableStatusColumnKey(contextMenuTargetCell.columnId)\n\tif (!contextMenuOpenedOnStatusCell) return []\n\tif (!selectedCells?.length) return []\n\n\tconst selectedContextMenuTargetCell = selectedCells.some(cell => {\n\t\treturn cell.rowId === contextMenuTargetCell.rowId && cell.columnId === contextMenuTargetCell.columnId\n\t})\n\tif (!selectedContextMenuTargetCell) return []\n\n\tconst rowIds = new Set<NodeID>()\n\tfor (const cell of selectedCells) {\n\t\tif (!isCollectionItemTableStatusColumnKey(cell.columnId)) continue\n\t\trowIds.add(cell.rowId)\n\t}\n\n\treturn Array.from(rowIds)\n}\n", "import { List } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getMetricsInteractionSourceForScopeType } from \"document/components/utils/getMetricsInteractionSourceForScopeType.ts\"\nimport defaultEngine from \"document/engine.ts\"\nimport type {\n\tCollectionDraftGrouping,\n\tCollectionItemNode,\n\tCollectionNode,\n\tNodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport { sortCollectionItems } from \"document/models/CanvasTree/nodes/CollectionNodeCache.ts\"\nimport {\n\tfakeCreatedAtVariable,\n\tfakeUpdatedAtVariable,\n} from \"document/models/CanvasTree/nodes/utils/collectionAutoGeneratedVariables.ts\"\nimport { collectionItemTableStatusColumnKey } from \"document/models/CanvasTree/nodes/utils/collectionStatusMetadata.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getLocalStorageValue, setLocalStorageAndUpdateListeners } from \"web/lib/useLocalStorage.ts\"\nimport { getCollectionSortingRulesFromStorage, localStorageSortingRulesKey } from \"./collectionItemTableSorting.ts\"\n\nfunction getSortingVariableName(collection: CollectionNode, sortingBy: string): string | null {\n\tif (sortingBy === collectionItemTableStatusColumnKey) return Dictionary.Status\n\tif (sortingBy === fakeCreatedAtVariable.id) return fakeCreatedAtVariable.name\n\tif (sortingBy === fakeUpdatedAtVariable.id) return fakeUpdatedAtVariable.name\n\n\tconst variable = collection.getVariable(sortingBy)\n\tif (!variable) return null\n\n\treturn variable.name || Dictionary.Unknown\n}\n\nfunction getFirstKnownSortingVariableName(\n\tcollection: CollectionNode,\n\tsortingRules: CollectionSortingRules,\n): string | null {\n\tfor (const sortingRule of sortingRules) {\n\t\tconst variableName = getSortingVariableName(collection, sortingRule.by)\n\t\tif (variableName) return variableName\n\t}\n\n\treturn null\n}\n\nfunction getSortedItemsForMove(\n\tcollection: CollectionNode,\n\tdraftGrouping: CollectionDraftGrouping,\n\tsortedItemIds: readonly NodeID[],\n): CollectionItemNode[] | null {\n\tconst collectionItemsById = new Map<NodeID, CollectionItemNode>()\n\tconst collectionItems = collection.getSortedChildren(\"public-only\", draftGrouping)\n\tfor (const item of collectionItems) {\n\t\tcollectionItemsById.set(item.id, item)\n\t}\n\n\tconst sortedItems: CollectionItemNode[] = []\n\n\tfor (const itemId of sortedItemIds) {\n\t\tconst item = collectionItemsById.get(itemId)\n\t\tif (!item) return null\n\t\tsortedItems.push(item)\n\t}\n\n\treturn sortedItems\n}\n\nfunction setLocalSortingRules(collectionId: NodeID, sortingRules: CollectionSortingRules | undefined) {\n\tconst sortingRulesFromStorage = getLocalStorageValue<unknown>(localStorageSortingRulesKey)\n\tconst localSortingRulesByCollection = getCollectionSortingRulesFromStorage(sortingRulesFromStorage)\n\n\tif (sortingRules === undefined) {\n\t\tconst { [collectionId]: _removedSortingRules, ...remainingSortingRulesByCollection } = localSortingRulesByCollection\n\t\tsetLocalStorageAndUpdateListeners(localStorageSortingRulesKey, remainingSortingRulesByCollection)\n\t\treturn\n\t}\n\n\tconst nextLocalSortingRulesByCollection = {\n\t\t...localSortingRulesByCollection,\n\t\t[collectionId]: sortingRules,\n\t}\n\tsetLocalStorageAndUpdateListeners(localStorageSortingRulesKey, nextLocalSortingRulesByCollection)\n}\n\nfunction itemOrderMatches(items: readonly CollectionItemNode[], itemIds: readonly NodeID[]): boolean {\n\treturn items.length === itemIds.length && items.every((item, index) => item.id === itemIds[index])\n}\n\nfunction sortingPreservesMovedOrder(\n\tcollection: CollectionNode,\n\tdraftGrouping: CollectionDraftGrouping,\n\tsortingRules: CollectionSortingRules,\n\tsortedCollectionItems: readonly CollectionItemNode[],\n): boolean {\n\tconst sortedItemIds = sortedCollectionItems.map(getId)\n\t// Row reordering is scoped to public table rows, matching the sorted items used for the move.\n\tconst nextSortedItems = sortCollectionItems(collection, collection.getUnsortedChildren(), draftGrouping, sortingRules)\n\treturn itemOrderMatches(nextSortedItems, sortedItemIds)\n}\n\ninterface HandleMoveCollectionItemOptions {\n\tfrom: number\n\tto: number\n\tcollectionNodeId: NodeID\n\tdraftStatus: boolean | undefined\n\tdraftGrouping: CollectionDraftGrouping\n\tsortedItemIds: readonly NodeID[]\n\tactiveSortingRules: CollectionSortingRules\n\tstoreManualSortingAsLocalOverride: boolean\n\n\t/** Used for testing. */\n\tengine?: VekterEngine\n}\n\nexport function handleMoveCollectionItem({\n\tengine = defaultEngine,\n\tfrom,\n\tto,\n\tdraftStatus,\n\tcollectionNodeId,\n\tdraftGrouping,\n\tsortedItemIds,\n\tactiveSortingRules,\n\tstoreManualSortingAsLocalOverride,\n}: HandleMoveCollectionItemOptions) {\n\tengine.scheduler.processAndRenderSync(() => {\n\t\tconst collection = engine.tree.getNodeWithTrait(collectionNodeId, isCollectionNode)\n\t\tif (!collection) return\n\n\t\tconst stateToken = engine.getStateToken()\n\n\t\trecord(\"collection_record_move\", {\n\t\t\tsource: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t})\n\n\t\tconst sortedItems = getSortedItemsForMove(collection, draftGrouping, sortedItemIds)\n\t\tif (!sortedItems) return\n\t\tconst movedItem = sortedItems[from]\n\t\tif (!movedItem) return\n\n\t\tif (draftStatus !== undefined) {\n\t\t\tif (draftStatus === false) {\n\t\t\t\t// Record the undraft event. The draft event is recorded in the confirmation modal.\n\t\t\t\trecord(\"collection_record_undraft\", {\n\t\t\t\t\tsource: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t\t\t})\n\t\t\t}\n\t\t\tengine.tree.current(movedItem)?.set({ isDraft: draftStatus === true ? true : undefined })\n\t\t}\n\n\t\tconst sortedCollectionItems = List.move(sortedItems, from, to)\n\t\tfor (const [index, sortedCollectionItem] of sortedCollectionItems.entries()) {\n\t\t\tengine.moveNode(sortedCollectionItem.id, collection.id, index)\n\t\t}\n\n\t\tif (draftStatus === true) {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConfirmCollectionItemStatusChange,\n\t\t\t\tinteractionRequired: true,\n\t\t\t\tvariant: \"destructive\",\n\t\t\t\tsource: \"collection_table\",\n\t\t\t\ttitle: Dictionary.MarkAsDraft,\n\t\t\t\tdescription: \"Your item will be removed from your website after you publish your changes.\",\n\t\t\t\tconfirmLabel: Dictionary.Confirm,\n\t\t\t\tonCancel: () => engine.resetTreeAndSelectionWithToken(stateToken),\n\t\t\t\tonConfirm: () =>\n\t\t\t\t\trecord(\"collection_record_draft\", {\n\t\t\t\t\t\tsource: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t\t\t\t}),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (draftStatus !== undefined || activeSortingRules.length === 0) return\n\n\t\tconst currentCollection = engine.tree.current(collection)\n\t\tif (!currentCollection) return\n\t\tif (sortingPreservesMovedOrder(currentCollection, draftGrouping, activeSortingRules, sortedCollectionItems)) {\n\t\t\treturn\n\t\t}\n\n\t\t// Only switch to manual sorting when at least one active rule still points to a known sortable field.\n\t\tconst firstKnownSortingVariableName = getFirstKnownSortingVariableName(currentCollection, activeSortingRules)\n\t\tif (!firstKnownSortingVariableName) return\n\n\t\tif (storeManualSortingAsLocalOverride) {\n\t\t\tsetLocalSortingRules(collection.id, [])\n\t\t\treturn\n\t\t}\n\n\t\tcurrentCollection.set({ sorting: undefined, sortingRules: undefined })\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\tinteractionRequired: true,\n\t\t\tsource: \"collection_table\",\n\t\t\ttitle: \"Change Sorting\",\n\t\t\tdescription: `Items are currently sorted by ${firstKnownSortingVariableName}. Would you like to sort manually?`,\n\t\t\tconfirmLabel: \"Sort Manually\",\n\t\t\tonCancel: () => {\n\t\t\t\tengine.resetTreeAndSelectionWithToken(stateToken)\n\t\t\t},\n\t\t\tonConfirm: noop,\n\t\t})\n\t})\n}\n", "import { emptyArray, emptyMap } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionNode.ts\"\nimport { sortCollectionItems } from \"document/models/CanvasTree/nodes/CollectionNodeCache.ts\"\nimport { getCollectionSortingRules } from \"document/models/CanvasTree/nodes/CollectionSortingRules.ts\"\nimport { useMemo } from \"react\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport {\n\ttype CollectionItemTableFilter,\n\tfilterCollectionItemTableItems,\n\tgetCollectionItemTableFieldDefinitions,\n\tshouldInvalidateFilter,\n} from \"./collectionItemTableFilters.ts\"\nimport { getCollectionSortingRulesFromStorage, localStorageSortingRulesKey } from \"./collectionItemTableSorting.ts\"\n\nexport interface FilteredCollectionItemsResult {\n\tfilteredItems: readonly CollectionItemNode[]\n\tisFilterActive: boolean\n\trawSearchTerm: string\n\tactiveFilters: readonly CollectionItemTableFilter[]\n\tactiveSortingRules: CollectionSortingRules\n}\n\n/**\n * Returns collection items filtered by the active collection table filters.\n */\nexport function useFilteredCollectionItems(\n\tengine: VekterEngine,\n\tcollectionNode: CollectionNode | null,\n): FilteredCollectionItemsResult {\n\tconst multiSortEnabled = useExperimentIsOn(\"cmsMultiSort\")\n\tconst { tableFiltersByCollection } = engine.stores.contentManagementStore.useState(state => ({\n\t\ttableFiltersByCollection: state.tableFiltersByCollection,\n\t}))\n\tconst [storedLocalSortingRulesByCollection] = useLocalStorage<unknown>(localStorageSortingRulesKey, null)\n\n\treturn useMemo<FilteredCollectionItemsResult>(() => {\n\t\tconst localSortingRulesByCollection = getCollectionSortingRulesFromStorage(storedLocalSortingRulesByCollection)\n\n\t\tif (!collectionNode) {\n\t\t\treturn {\n\t\t\t\tfilteredItems: emptyArray(),\n\t\t\t\tisFilterActive: false,\n\t\t\t\trawSearchTerm: \"\",\n\t\t\t\tactiveFilters: emptyArray(),\n\t\t\t\tactiveSortingRules: emptyArray(),\n\t\t\t}\n\t\t}\n\n\t\tconst filterState = tableFiltersByCollection.get(collectionNode.id)\n\t\tconst filtersByTarget = filterState?.filtersByTarget ?? emptyMap()\n\t\tconst rawSearchTerm = filterState?.searchTerm ?? \"\"\n\n\t\tconst fieldDefinitions = getCollectionItemTableFieldDefinitions(collectionNode)\n\t\tconst fieldDefinitionsById = new Map(fieldDefinitions.map(field => [field.id, field]))\n\t\tconst activeFilters: CollectionItemTableFilter[] = []\n\t\tfor (const storedFilter of filtersByTarget.values()) {\n\t\t\tconst currentField = fieldDefinitionsById.get(storedFilter.field.id)\n\t\t\tif (shouldInvalidateFilter(storedFilter, currentField)) continue\n\t\t\tactiveFilters.push({ ...storedFilter, field: currentField } as CollectionItemTableFilter)\n\t\t}\n\n\t\tconst itemCount = collectionNode.getItemCount()\n\t\tconst hasSearchTerm = rawSearchTerm.trim().length > 0\n\t\tconst hasAnyActiveFilter = activeFilters.length > 0\n\t\tconst isFilterActive = itemCount > 0 && (hasSearchTerm || hasAnyActiveFilter)\n\t\tconst localSortingRules = multiSortEnabled ? localSortingRulesByCollection[collectionNode.id] : undefined\n\t\tconst activeSortingRules =\n\t\t\tmultiSortEnabled && localSortingRules !== undefined\n\t\t\t\t? localSortingRules\n\t\t\t\t: getCollectionSortingRules(collectionNode.sorting, collectionNode.sortingRules)\n\t\tconst items =\n\t\t\tlocalSortingRules === undefined\n\t\t\t\t? collectionNode.getSortedChildren(\"public-only\", \"preserve-order\")\n\t\t\t\t: sortCollectionItems(collectionNode, collectionNode.getUnsortedChildren(), \"preserve-order\", localSortingRules)\n\n\t\tconst filteredItems = filterCollectionItemTableItems({\n\t\t\titems,\n\t\t\trawSearchTerm,\n\t\t\tactiveFilters,\n\t\t})\n\n\t\treturn {\n\t\t\tfilteredItems,\n\t\t\tisFilterActive,\n\t\t\trawSearchTerm,\n\t\t\tactiveFilters,\n\t\t\tactiveSortingRules,\n\t\t}\n\t}, [collectionNode, storedLocalSortingRulesByCollection, multiSortEnabled, tableFiltersByCollection])\n}\n", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { CenterChild, ComboBox, IconSidebarCollection, Stack, Tabs, TabsItem, ThemeOverride } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, emptyArray, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isCollectionNode, isContentManagementNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveLeftPanel, CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { memo } from \"react\"\nimport { canPasteCollections } from \"utils/clipboard/helpers/collections.ts\"\nimport { getSelectedCollectionName } from \"utils/collectionUtils.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { IconAgentCMS } from \"../agentPanel/components/IconAgentCMS.tsx\"\nimport { sortEntityAssetsAlphabetically } from \"../assets/actions/sort.ts\"\nimport { LeftPanel } from \"../leftPanel/LeftPanel.tsx\"\nimport { dataIsCollectionLeftPanelDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport { usePopoverWithinPadding } from \"../utils/usePopoverWithinPadding.ts\"\nimport { CollectionFieldsPanel } from \"./CollectionFieldsPanel.tsx\"\nimport * as styles from \"./CollectionLeftPanel.styles.ts\"\nimport { CollectionPanel } from \"./CollectionPanel.tsx\"\nimport { CollectionPluginsPanel } from \"./CollectionPluginsPanel.tsx\"\nimport { closeCollectionItems } from \"./utils/closeCollectionItems.tsx\"\nimport { getCollectionCreationOptions } from \"./utils/getCollectionCreationOptions.ts\"\n\nexport const CollectionLeftPanel = memo(function CollectionLeftPanel() {\n\tconst leftPanel = engine.stores.chromeStore.useState(state => state.leftPanel)\n\tconst shouldRenderLeftPanel = leftPanel === ActiveLeftPanel.ContentManagement\n\n\tif (!shouldRenderLeftPanel) return null\n\n\treturn <CollectionPanelWithTabs />\n})\n\nconst CollectionPanelWithTabs = () => {\n\tconst activeTab = engine.stores.chromeStore.useState(state => state.activeCollectionPanelTab)\n\n\tconst isCollectionsTab = activeTab === CollectionPanelTab.Collections\n\n\treturn (\n\t\t<LeftPanel\n\t\t\tresponsive\n\t\t\tonContextMenu={isCollectionsTab ? handleCollectionsContextMenu : undefined}\n\t\t\t{...{ [dataIsCollectionLeftPanelDataAttribute]: true }}\n\t\t>\n\t\t\t<CollectionPanelTabs activeTab={activeTab} />\n\t\t\t{activeTab === CollectionPanelTab.Fields && <CollectionSwitcher />}\n\t\t\t<Stack className={styles.rowsContainerStack} gap={0}>\n\t\t\t\t<CollectionPanelContent activeTab={activeTab} />\n\t\t\t</Stack>\n\t\t</LeftPanel>\n\t)\n}\n\nconst onSelect = engine.scheduler.wrapHandler((tab: CollectionPanelTab) => {\n\tengine.stores.chromeStore.activeCollectionPanelTab = tab\n})\n\nfunction CollectionPanelTabs({ activeTab }: { activeTab: CollectionPanelTab }) {\n\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName={cx(styles.header, styles.headerSpreadSheet)}\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t>\n\t\t\t<div className={styles.headerContent}>\n\t\t\t\t<ThemeOverride mode={!agentExperimentOn && \"cmsSidebarTabs\"}>\n\t\t\t\t\t<Tabs value={activeTab} onChange={onSelect}>\n\t\t\t\t\t\t<TabsItem value={CollectionPanelTab.Collections}>{Dictionary.Collections}</TabsItem>\n\t\t\t\t\t\t<TabsItem value={CollectionPanelTab.Fields}>{Dictionary.Fields}</TabsItem>\n\t\t\t\t\t\t<TabsItem value={CollectionPanelTab.Plugins}>{Dictionary.Plugins}</TabsItem>\n\t\t\t\t\t</Tabs>\n\t\t\t\t</ThemeOverride>\n\t\t\t</div>\n\t\t\t<div className={styles.divider} />\n\t\t</Stack>\n\t)\n}\n\nfunction selectCollection(id: NodeID, _final: boolean, reset: () => void) {\n\tconst node = engine.tree.getNode(id)\n\tif (!node || !isCollectionNode(node)) {\n\t\treset()\n\t\treturn\n\t}\n\n\tcloseCollectionItems({ engine, target: \"all\" })\n\t\t.then(({ userKeptEditing }) => {\n\t\t\tif (userKeptEditing) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.chromeStore.setLeftPanelOpenOnMobile(false)\n\n\t\t\t\tengine.stores.selectionStore.set(id)\n\t\t\t\trecord(\"ui_interaction\", { id: \"select_collection\", page: Pages.collectionPanel })\n\t\t\t})\n\t\t})\n\t\t.catch(unhandledError)\n}\n\nconst emptyItems: readonly ComboBoxListItem[] = emptyArray<ComboBoxListItem>()\n\nfunction CollectionSwitcher() {\n\tconst popoverWithin = usePopoverWithinPadding()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst CollectionIcon = agentExperimentEnabled ? IconAgentCMS : IconSidebarCollection\n\n\tconst comboListItems = useEngineState(\n\t\t(): readonly ComboBoxListItem[] => {\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\t\t\tif (!isContentManagementNode(activeScope)) return emptyItems\n\t\t\treturn activeScope.children.map(child => {\n\t\t\t\tassert(isCollectionNode(child), \"Expected all children to be collection nodes\")\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"option\" as const,\n\t\t\t\t\tvalue: child.id,\n\t\t\t\t\ttitle: child.resolveValue(\"name\") ?? Dictionary.Collection,\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.scopeStore],\n\t\t{ deepEqual: true },\n\t)\n\n\tconst selectedCollectionName = useEngineState(\n\t\t() => getSelectedCollectionName(engine) ?? Dictionary.Collection,\n\t\t[],\n\t\t[engine.stores.selectionStore, EngineChange.Tree],\n\t)\n\n\tif (comboListItems.length === 0) return null\n\n\treturn (\n\t\t<Stack className={styles.collectionSwitcher} gap={10}>\n\t\t\t<ComboBox\n\t\t\t\trightChevron\n\t\t\t\titems={comboListItems}\n\t\t\t\tmenuWithin={popoverWithin}\n\t\t\t\tvalue={selectedCollectionName}\n\t\t\t\tonChange={selectCollection}\n\t\t\t\tleftSlot={\n\t\t\t\t\t<CenterChild className={styles.leftIcon}>\n\t\t\t\t\t\t<CollectionIcon />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<div className={styles.divider} />\n\t\t</Stack>\n\t)\n}\n\nfunction CollectionPanelContent({ activeTab }: { activeTab: CollectionPanelTab }) {\n\tswitch (activeTab) {\n\t\tcase CollectionPanelTab.Collections:\n\t\t\treturn <CollectionPanel />\n\t\tcase CollectionPanelTab.Fields:\n\t\t\treturn <CollectionFieldsPanel />\n\t\tcase CollectionPanelTab.Plugins:\n\t\t\treturn <CollectionPluginsPanel />\n\t\tdefault:\n\t\t\tassertNever(activeTab)\n\t}\n}\n\nasync function handleCollectionsContextMenu(event: React.MouseEvent) {\n\tevent.preventDefault()\n\n\tconst canPaste = await canPasteCollections(engine.componentLoader)\n\tconst isViewOnly = getIsViewOnly(engine, \"canAddCollections\")\n\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t...getCollectionCreationOptions(engine, MetricsInteractionViews.CONTEXT_MENU, { canPaste }),\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tsortEntityAssetsAlphabetically(engine, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID)\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t{\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t},\n\t)\n}\n", "import { CenterChild, ReadOnlyContext, Scroll, Stack, truncateWithEllipsis, useReadOnly } from \"@framerjs/fresco\"\nimport { Sortable, type DragGestureEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, emptyArray, emptySet, ReadonlySet } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\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 type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisArrayVariable,\n\tisVariableDefinition,\n\ttype ArrayVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableID,\n\ttype VariableOrDivider,\n\ttype VariablesAndDividers,\n\ttype VariableType,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { SelectedVariablePath } from \"document/stores/VariablesStore.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ControlType, isEqual } from \"library/index.ts\"\nimport React, { useCallback, useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { IconSectionHeaderPlus } from \"../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { caretWidth, gap, rowIndentation } from \"../shared/CollapsibleRow.styles.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { popoutWindow } from \"../shared/PopoutWindow.tsx\"\nimport type { DeleteFieldPreventionData } from \"../shared/VariablesModal/DeleteFieldPrevention.tsx\"\nimport {\n\tgetPreventionDescription,\n\tNodesUsingVariableLinksList,\n\tPagesUsingVariableLinksList,\n} from \"../shared/VariablesModal/DeleteFieldPrevention.tsx\"\nimport { rowHeight } from \"../shared/VariablesModal/VariableRow.styles.ts\"\nimport { useNodeWithVariables } from \"../shared/VariablesModal/VariablesModal.tsx\"\nimport { createFinalName } from \"../shared/VariablesModal/createFinalName.ts\"\nimport type { SelectedVariableInfo } from \"../shared/VariablesModal/getSelectedVariableInfo.ts\"\nimport { getVariableCreationMenuOptions } from \"../shared/VariablesModal/getVariableCreationMenuOptions.ts\"\nimport { useDeleteVariable } from \"../shared/VariablesModal/useDeleteVariable.ts\"\nimport { useVariableActions } from \"../shared/VariablesModal/useVariableActions.ts\"\nimport { panelIconForVariable, panelIconForVariableType } from \"../shared/utils/panelIconForVariable.tsx\"\nimport * as styles from \"./CollectionFieldsPanel.styles.ts\"\nimport { FieldSettingsPopout } from \"./FieldSettingsPopout.tsx\"\nimport { generateVariablePanelPopoutId } from \"./utils/collectionFieldPopoutId.ts\"\n\nexport function CollectionFieldsPanel() {\n\tconst engine = useAndAssertVekterEngine()\n\tconst collectionNode = useCollectionNode()\n\tconst isManagedByPlugin = Boolean(collectionNode?.managedByPlugin)\n\tconst isReadOnly = useIsViewOnly(\"canEditVariables\") || isManagedByPlugin\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst [nonCollapsedVariables, setNonCollapsedVariables] = useState<ReadonlySet<VariableID>>(emptySet)\n\n\tconst variables = collectionNode?.variables ?? emptyArray()\n\n\tconst variableCount = variables.length\n\tconst sortingEnabled = variableCount > 1 && !isReadOnly\n\n\tconst { moveVariable, duplicateVariable, updateVariable } = useVariableActions({\n\t\tnodeWithVariablesId: collectionNode?.id ?? null,\n\t\tisReadOnly,\n\t})\n\n\tconst toggleCollapse = useCallback((variableId: VariableID) => {\n\t\tsetNonCollapsedVariables(prev => ReadonlySet.toggle(prev, variableId))\n\t}, [])\n\n\tconst renameVariable = useCallback(\n\t\t(variableId: VariableID, parentVariableId: VariableID | undefined, name: string, reset: () => void) => {\n\t\t\tconst variablesForParent = getVariablesForParent(parentVariableId, variables)\n\t\t\tif (!variablesForParent) return\n\n\t\t\tconst variable = variablesForParent.find(({ id }) => id === variableId)\n\t\t\tif (!variable) return\n\n\t\t\tconst finalName = createFinalName(variablesForParent, variable, name)\n\t\t\tconst nameIsEmpty = finalName.length < 1 && variable.type !== \"divider\"\n\t\t\tif (nameIsEmpty || finalName === variable.name) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst variableToUpdatePath: SelectedVariablePath = parentVariableId\n\t\t\t\t? [parentVariableId, variable.id]\n\t\t\t\t: [variable.id]\n\n\t\t\tupdateVariable(current => ({ ...current, name: finalName }), variableToUpdatePath)\n\t\t},\n\t\t[updateVariable, variables],\n\t)\n\n\tconst handleDragStart = useCallback((_event: DragGestureEvent, item: VariableOrDivider) => {\n\t\tsetNonCollapsedVariables(prev => ReadonlySet.remove(prev, item.id))\n\t\tpopoutWindow.close()\n\t}, [])\n\n\tconst handleAddField = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tassert(!isReadOnly, \"handleAddField should not be callable in read-only mode\")\n\t\t\tassert(collectionNode, \"handleAddField should not be callable without a collection node\")\n\n\t\t\tpopoutWindow.close()\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\tgetVariableCreationMenuOptions({\n\t\t\t\t\tengine,\n\t\t\t\t\tnodeWithVariables: collectionNode,\n\t\t\t\t\tshowTypeIcons: true,\n\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tlocation: {\n\t\t\t\t\t\tx: event.clientX,\n\t\t\t\t\t\ty: event.currentTarget.getBoundingClientRect().bottom + 4,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t},\n\t\t[agentExperimentEnabled, isReadOnly, collectionNode],\n\t)\n\n\tconst handleAddArrayItemField = useCallback(\n\t\t(event: React.SyntheticEvent<HTMLElement>, arrayVariable: ArrayVariableDefinition) => {\n\t\t\tassert(!isReadOnly, \"handleAddArrayItemField should not be callable in read-only mode\")\n\n\t\t\tconst latestCollectionNode = engine.tree.current(collectionNode)\n\t\t\tif (!latestCollectionNode) return\n\n\t\t\tpopoutWindow.close()\n\n\t\t\tconst selectedVariableInfo: SelectedVariableInfo = {\n\t\t\t\tnodeWithVariables: latestCollectionNode,\n\t\t\t\tselectedVariableParent: arrayVariable,\n\t\t\t\tselectedVariable: arrayVariable.itemVariables.at(-1) ?? null,\n\t\t\t}\n\t\t\tconst buttonBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tconst expandArrayVariable = () => {\n\t\t\t\tsetNonCollapsedVariables(prev => ReadonlySet.add(prev, arrayVariable.id))\n\t\t\t}\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\tgetVariableCreationMenuOptions({\n\t\t\t\t\tengine,\n\t\t\t\t\tnodeWithVariables: latestCollectionNode,\n\t\t\t\t\tselectedVariableInfo,\n\t\t\t\t\tshowTypeIcons: true,\n\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t\tonCreate: expandArrayVariable,\n\t\t\t\t}),\n\t\t\t\t{\n\t\t\t\t\tlocation: {\n\t\t\t\t\t\tx: buttonBounds.left,\n\t\t\t\t\t\ty: buttonBounds.bottom + 4,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t},\n\t\t[agentExperimentEnabled, isReadOnly, collectionNode],\n\t)\n\n\tconst onPreventDeleteVariable = useCallback(\n\t\t(preventionData: DeleteFieldPreventionData, variableToDelete: VariableDefinition) => {\n\t\t\tconst entityName = preventionData.type === \"pages\" ? \"field\" : \"variable\"\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\ttitle: `${variableToDelete.name} ${entityName} in use`,\n\t\t\t\tdescription: (\n\t\t\t\t\t<Stack gap={0}>\n\t\t\t\t\t\t<span>{getPreventionDescription(preventionData, variableToDelete.name)}</span>\n\t\t\t\t\t\t{preventionData.type === \"pages\" ? (\n\t\t\t\t\t\t\t<PagesUsingVariableLinksList\n\t\t\t\t\t\t\t\tpagesUsingVariables={preventionData.pagesUsingVariables}\n\t\t\t\t\t\t\t\tmaxPagesToShow={5}\n\t\t\t\t\t\t\t\tonDismiss={() => engine.stores.modalStore.dismiss()}\n\t\t\t\t\t\t\t\tvariant=\"filled\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<NodesUsingVariableLinksList\n\t\t\t\t\t\t\t\tnodeIdsUsingVariable={preventionData.nodeIdsUsingVariable}\n\t\t\t\t\t\t\t\tmaxNodesToShow={5}\n\t\t\t\t\t\t\t\tonDismiss={() => engine.stores.modalStore.dismiss()}\n\t\t\t\t\t\t\t\tvariant=\"filled\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t),\n\t\t\t\tcancelLabel: Dictionary.Dismiss,\n\t\t\t\tonCancel: () => engine.stores.modalStore.dismiss(),\n\t\t\t\tkeyboardConfirmMode: false,\n\t\t\t\tsource: \"collections_sidebar\",\n\t\t\t})\n\t\t},\n\t\t[],\n\t)\n\n\tconst { handleDeleteVariable, variablePendingDeletionPath, abortDeleteVariableUsageCheck } = useDeleteVariable({\n\t\tnodeWithVariables: collectionNode,\n\t\tisReadOnly,\n\t\tonPreventDeleteVariable,\n\t})\n\n\tconst onDeleteVariable = useCallback(\n\t\t(variable: VariableOrDivider, parentVariableId: VariableID | undefined) => {\n\t\t\tpopoutWindow.close()\n\t\t\tvoid handleDeleteVariable(variable, parentVariableId)\n\t\t},\n\t\t[handleDeleteVariable],\n\t)\n\n\treturn (\n\t\t<Scroll className={styles.fieldsPanelScroll}>\n\t\t\t<ReadOnlyContext.Provider value={isReadOnly}>\n\t\t\t\t{collectionNode && (\n\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\tisFirstSection\n\t\t\t\t\t\ttitle={Dictionary.Fields}\n\t\t\t\t\t\ttoggleExpanded={noop}\n\t\t\t\t\t\tisViewOnly={isReadOnly}\n\t\t\t\t\t\thasItems={false}\n\t\t\t\t\t\tenabled={!isReadOnly}\n\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\tcreateAction={handleAddField}\n\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t!isReadOnly ? (\n\t\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\t\texpanded\n\t\t\t\t\t\t\t\t\ttitle={`Add ${Dictionary.Field}`}\n\t\t\t\t\t\t\t\t\tcreateAction={handleAddField}\n\t\t\t\t\t\t\t\t\tisViewOnly={isReadOnly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : null\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{variableCount > 0 ? (\n\t\t\t\t\t<Sortable\n\t\t\t\t\t\tenabled={sortingEnabled}\n\t\t\t\t\t\titems={variables}\n\t\t\t\t\t\tmoveItem={moveVariable}\n\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\t\tclassName={styles.list}\n\t\t\t\t\t>\n\t\t\t\t\t\t{({ item: variable, isDragPreview }) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<CollectionFieldRow\n\t\t\t\t\t\t\t\t\tabortDeleteVariableUsageCheck={abortDeleteVariableUsageCheck}\n\t\t\t\t\t\t\t\t\tvariables={variables}\n\t\t\t\t\t\t\t\t\tvariable={variable}\n\t\t\t\t\t\t\t\t\tduplicateVariable={duplicateVariable}\n\t\t\t\t\t\t\t\t\tonDeleteVariable={onDeleteVariable}\n\t\t\t\t\t\t\t\t\trenameVariable={renameVariable}\n\t\t\t\t\t\t\t\t\tupdateVariable={updateVariable}\n\t\t\t\t\t\t\t\t\tmoveVariable={moveVariable}\n\t\t\t\t\t\t\t\t\tparentVariableId={undefined}\n\t\t\t\t\t\t\t\t\tisCollapsed={isDragPreview || !nonCollapsedVariables.has(variable.id)}\n\t\t\t\t\t\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\t\t\tvariablePendingDeletionPath={variablePendingDeletionPath}\n\t\t\t\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t\t\t\t\tonAddArrayItemField={handleAddArrayItemField}\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</Sortable>\n\t\t\t\t) : (\n\t\t\t\t\t<div className={styles.emptyStateContainer}>\n\t\t\t\t\t\t{emptyStateVariables.map(({ type, title }, idx) => (\n\t\t\t\t\t\t\t<EmptyCollectionFieldRow\n\t\t\t\t\t\t\t\tkey={type}\n\t\t\t\t\t\t\t\ttype={type}\n\t\t\t\t\t\t\t\tindex={idx}\n\t\t\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</Scroll>\n\t)\n}\n\nfunction useCollectionNode() {\n\tconst nodeWithVariables = useNodeWithVariables()\n\treturn isCollectionNode(nodeWithVariables) ? nodeWithVariables : null\n}\n\ninterface CollectionFieldRowProps {\n\tabortDeleteVariableUsageCheck: () => void\n\tvariable: VariableOrDivider\n\tvariables: VariablesAndDividers\n\tduplicateVariable: (variableId: VariableID, parentVariableId?: VariableID) => void\n\tonDeleteVariable: (variable: VariableOrDivider, parentVariableId: VariableID | undefined) => void\n\trenameVariable: (\n\t\tvariableId: VariableID,\n\t\tparentVariableId: VariableID | undefined,\n\t\tname: string,\n\t\treset: () => void,\n\t) => void\n\tupdateVariable: (\n\t\tgetUpdate: (current: VariableOrDivider) => VariableOrDivider,\n\t\tvariableToUpdatePath: SelectedVariablePath,\n\t) => void\n\tmoveVariable: (fromIndex: number, toIndex: number, parentVariableId?: VariableID) => void\n\tparentVariableId: VariableID | undefined\n\tdepth?: number\n\tisCollapsed: boolean | undefined\n\ttoggleCollapse: ((id: VariableID) => void) | undefined\n\tvariablePendingDeletionPath: SelectedVariablePath | null\n\tagentExperimentEnabled: boolean\n\tonAddArrayItemField: (event: React.SyntheticEvent<HTMLElement>, arrayVariable: ArrayVariableDefinition) => void\n}\n\nconst CollectionFieldRow = React.memo(function CollectionFieldRow({\n\tabortDeleteVariableUsageCheck,\n\tvariable,\n\tvariables,\n\tupdateVariable,\n\tduplicateVariable,\n\tonDeleteVariable,\n\trenameVariable,\n\tmoveVariable,\n\tparentVariableId,\n\tisCollapsed,\n\ttoggleCollapse,\n\tvariablePendingDeletionPath,\n\tagentExperimentEnabled,\n\tonAddArrayItemField,\n\tdepth = 0,\n}: CollectionFieldRowProps) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst arrayExperimentIsOn = useExperimentIsOn(\"arrays\")\n\tconst variablePath: SelectedVariablePath = parentVariableId ? [parentVariableId, variable.id] : [variable.id]\n\tconst selectedVariablePath: SelectedVariablePath = parentVariableId ? [parentVariableId, variable.id] : [variable.id]\n\tconst isDisabled = variablePendingDeletionPath ? isEqual(variablePendingDeletionPath, variablePath) : false\n\n\tconst handleUpdateVariable = useCallback(\n\t\t(getUpdate: (current: VariableOrDivider) => VariableOrDivider) => updateVariable(getUpdate, selectedVariablePath),\n\t\t[selectedVariablePath, updateVariable],\n\t)\n\n\tconst handleVariableNameChange = (_: NodeID, name: string, final: boolean, reset: () => void) => {\n\t\tif (!final) return\n\t\trenameVariable(variable.id, parentVariableId, name, reset)\n\t}\n\n\tconst getMenuOptions = useCallback(\n\t\t(id: NodeID): readonly MenuItemOptions[] => {\n\t\t\tconst isSlug = variable?.type === \"slug\"\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tenabled: !isSlug && !isReadOnly,\n\t\t\t\t\tclick: () => duplicateVariable(id, parentVariableId),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tenabled: !isSlug && !isReadOnly,\n\t\t\t\t\tclick: () => onDeleteVariable(variable, parentVariableId),\n\t\t\t\t},\n\t\t\t]\n\t\t},\n\t\t[variable, isReadOnly, duplicateVariable, onDeleteVariable, parentVariableId],\n\t)\n\n\tconst arrayVariable = isArrayVariable(variable) ? variable : null\n\tconst hasItemVariables = !!arrayVariable && arrayVariable.itemVariables.length > 0\n\tconst canAddArrayItemField = !!arrayVariable && arrayExperimentIsOn && !isReadOnly\n\tconst isDividerWithTitle = Boolean(variable.type === \"divider\" && variable.name)\n\tconst showDividerAbove = isDividerWithTitle || (!!arrayVariable && arrayExperimentIsOn)\n\tconst popoutId = generateVariablePanelPopoutId(variable.id, parentVariableId)\n\n\treturn (\n\t\t<Stack direction=\"column\" gap={0} className={cx(isDisabled && styles.disabled)}>\n\t\t\t{showDividerAbove && (\n\t\t\t\t<Divider\n\t\t\t\t\tdepth={depth}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tabortDeleteVariableUsageCheck={abortDeleteVariableUsageCheck}\n\t\t\t\t\thasArraySpacing={!!arrayVariable && arrayExperimentIsOn}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<FieldSettingsPopout\n\t\t\t\tid={popoutId}\n\t\t\t\tvariable={variable}\n\t\t\t\tvariables={variables}\n\t\t\t\treadOnly={isReadOnly}\n\t\t\t\tonUpdate={handleUpdateVariable}\n\t\t\t\tonPresent={abortDeleteVariableUsageCheck}\n\t\t\t>\n\t\t\t\t<CollapsibleRow\n\t\t\t\t\tisDivider={!isDividerWithTitle && variable.type === \"divider\"}\n\t\t\t\t\thideIcon={isDividerWithTitle}\n\t\t\t\t\tid={variable.id}\n\t\t\t\t\ttitle={variable.name}\n\t\t\t\t\tIcon={isVariableDefinition(variable) ? panelIconForVariable(variable, agentExperimentEnabled) : null}\n\t\t\t\t\tisEditable={!isReadOnly}\n\t\t\t\t\tinputId={`collection-field-${variable.id}`}\n\t\t\t\t\tonTitleChange={handleVariableNameChange}\n\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\tselectionStyle=\"unsaturated\"\n\t\t\t\t\twithCollapse={true}\n\t\t\t\t\tdepth={depth}\n\t\t\t\t\tisCollapsible={hasItemVariables && arrayExperimentIsOn}\n\t\t\t\t\tisCollapsed={isCollapsed}\n\t\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\t\tadditionalTrailingActionElement={\n\t\t\t\t\t\tcanAddArrayItemField && (\n\t\t\t\t\t\t\t<AddArrayItemFieldButton\n\t\t\t\t\t\t\t\tonAction={event => {\n\t\t\t\t\t\t\t\t\tassert(arrayVariable, \"Expected array variable when adding an array item field\")\n\t\t\t\t\t\t\t\t\tonAddArrayItemField(event, arrayVariable)\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</FieldSettingsPopout>\n\t\t\t{arrayVariable && hasItemVariables && !isCollapsed && arrayExperimentIsOn && (\n\t\t\t\t<Sortable\n\t\t\t\t\tenabled={!isReadOnly && arrayVariable.itemVariables.length > 1}\n\t\t\t\t\titems={arrayVariable.itemVariables}\n\t\t\t\t\tmoveItem={(from, to) => moveVariable(from, to, arrayVariable.id)}\n\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\tclassName={styles.list}\n\t\t\t\t>\n\t\t\t\t\t{({ item: itemVariable }) => (\n\t\t\t\t\t\t<CollectionFieldRow\n\t\t\t\t\t\t\tabortDeleteVariableUsageCheck={abortDeleteVariableUsageCheck}\n\t\t\t\t\t\t\tupdateVariable={updateVariable}\n\t\t\t\t\t\t\tkey={itemVariable.id}\n\t\t\t\t\t\t\tvariables={arrayVariable.itemVariables}\n\t\t\t\t\t\t\tvariable={itemVariable}\n\t\t\t\t\t\t\tduplicateVariable={duplicateVariable}\n\t\t\t\t\t\t\tonDeleteVariable={onDeleteVariable}\n\t\t\t\t\t\t\trenameVariable={renameVariable}\n\t\t\t\t\t\t\tmoveVariable={moveVariable}\n\t\t\t\t\t\t\tparentVariableId={arrayVariable.id}\n\t\t\t\t\t\t\tisCollapsed={undefined}\n\t\t\t\t\t\t\ttoggleCollapse={undefined}\n\t\t\t\t\t\t\tvariablePendingDeletionPath={variablePendingDeletionPath}\n\t\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t\t\tonAddArrayItemField={onAddArrayItemField}\n\t\t\t\t\t\t\tdepth={depth + 1}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Sortable>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n\nfunction AddArrayItemFieldButton({ onAction }: { onAction: (event: React.SyntheticEvent<HTMLElement>) => void }) {\n\t// By default open the menu on mouse down\n\tconst handleMouseDown = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tonAction(event)\n\t\t},\n\t\t[onAction],\n\t)\n\n\t// Allow opening the menu on \"click\" for accessibility (e.g. enter/space)\n\tconst handleClick = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tif (event.detail !== 0) return\n\t\t\tonAction(event)\n\t\t},\n\t\t[onAction],\n\t)\n\n\tconst title = `Add ${Dictionary.ArrayItem} ${Dictionary.Field}`\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={styles.addArrayItemFieldButton}\n\t\t\taria-label={title}\n\t\t\ttitle={title}\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\tonClick={handleClick}\n\t\t>\n\t\t\t<IconSectionHeaderPlus />\n\t\t</button>\n\t)\n}\n\nfunction getVariablesForParent(\n\tparentVariableId: VariableID | undefined,\n\tvariables: readonly VariableOrDivider[],\n): readonly VariableOrDivider[] | undefined {\n\tif (!parentVariableId) return variables\n\tconst parent = variables.find(variable => variable.id === parentVariableId)\n\tif (!parent || !isArrayVariable(parent)) return undefined\n\treturn parent.itemVariables\n}\n\nconst emptyStateVariables: { type: VariableType; title: string }[] = [\n\t{ type: ControlType.String, title: Dictionary.Title },\n\t{ type: \"slug\", title: Dictionary.Slug },\n\t{ type: ControlType.Image, title: Dictionary.Image },\n\t{ type: ControlType.RichText, title: Dictionary.Content },\n\t{ type: ControlType.Boolean, title: Dictionary.Featured },\n]\n\nfunction EmptyCollectionFieldRow({\n\ttype,\n\ttitle,\n\tindex,\n\tagentExperimentEnabled,\n}: {\n\ttype: VariableType\n\ttitle: string\n\tindex: number\n\tagentExperimentEnabled: boolean\n}) {\n\tconst totalCount = emptyStateVariables.length\n\tconst itemShare = 1 / totalCount\n\tconst position = index * itemShare\n\tconst opacity = Math.max(0, 1 - position)\n\treturn (\n\t\t<Stack\n\t\t\tclassName={styles.emptyRow}\n\t\t\tstyle={{ opacity, height: rowHeight }}\n\t\t\talignItems=\"center\"\n\t\t\tdirection=\"row\"\n\t\t\tpaddingLeft={25}\n\t\t>\n\t\t\t<CenterChild className={styles.emptyRowIconWrapper}>\n\t\t\t\t{panelIconForVariableType(type, agentExperimentEnabled)}\n\t\t\t</CenterChild>\n\t\t\t<div className={truncateWithEllipsis}>{title}</div>\n\t\t</Stack>\n\t)\n}\n\ninterface DividerProps {\n\tdepth: number\n\tpopoutId: string\n\tabortDeleteVariableUsageCheck: () => void\n\thasArraySpacing: boolean\n}\n\nfunction Divider({ depth, popoutId, abortDeleteVariableUsageCheck, hasArraySpacing }: DividerProps) {\n\tconst depthIndent = depth > 0 ? gap + caretWidth + depth * rowIndentation : undefined\n\tconst handleClick = useCallback(() => {\n\t\tabortDeleteVariableUsageCheck()\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}, [abortDeleteVariableUsageCheck, popoutId])\n\n\treturn (\n\t\t// biome-ignore lint/nursery/noStaticElementInteractions: Supplementary click target; the PopoutButton below is the primary interactive element for keyboard/screen-reader users.\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tgap={0}\n\t\t\tpaddingLeft={depthIndent}\n\t\t\tpaddingTop={dimensions.values.panelPadding}\n\t\t\tpaddingBottom={hasArraySpacing ? dimensions.values.panelPadding : 5}\n\t\t\tonClick={handleClick}\n\t\t\trole=\"presentation\"\n\t\t>\n\t\t\t<hr className={styles.divider} />\n\t\t</Stack>\n\t)\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\n\nexport const getAvailableCollections = (engine: VekterEngine): DataDefinition[] => {\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\tconst localCollectionIdentifiers = new Set(contentManagementNode?.children.map(node => node.instanceIdentifier) ?? [])\n\n\tconst collections = engine.componentLoader.getData().filter(entity => {\n\t\tconst identifier = parseModuleIdentifier(entity.identifier)\n\n\t\t// External data sources should not be included because they should not be selectable\n\t\tif (!isLocalModuleIdentifier(identifier)) {\n\t\t\treturn false\n\t\t}\n\n\t\t// TODO: This should support collections exported by other module types\n\t\tif (identifier.type !== ModuleType.Collection) return false\n\n\t\treturn localCollectionIdentifiers.has(identifier.value)\n\t})\n\n\treturn collections.sort((left, right) =>\n\t\tleft.name.localeCompare(right.name, undefined, {\n\t\t\tnumeric: true,\n\t\t}),\n\t)\n}\n", "import { usePrefersMouseDown } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { Scroll, Stack, Text } from \"@framerjs/fresco\"\nimport { dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { projectFeatures, useProjectFeatureIsOn } from \"app/projectFeatures.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport { getAvailableCollections } from \"document/components/utils/getAvailableCollections.ts\"\nimport { getRawWebPagePath, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { valueToPath } from \"document/components/utils/valueToPath.ts\"\nimport engine from \"document/engine.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tisCanvasPageNode,\n\tisDataRepeater,\n\tisDesignPageNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveContentPanelTab, ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { createCollectionDetailPage, createCollectionIndexPage } from \"document/utils/contentCreationTemplates.ts\"\nimport { customNotFoundPagePaths } from \"library/router/customNotFoundPagePaths.ts\"\nimport React, { useCallback, useMemo, useRef } from \"react\"\nimport { getSlugIdFromDataDefinition } from \"utils/collectionUtils.ts\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getLoadedWebPageTemplate } from \"../../utils/createWebPage.ts\"\nimport { type Row as CanvasPageRow, CanvasPages } from \"../Pages/CanvasPages.tsx\"\nimport { type Row as DesignPageRow, DesignPages } from \"../Pages/DesignPages.tsx\"\nimport { type Row as KitPageRow, KitPages } from \"../Pages/KitPages.tsx\"\nimport { RouteSegments } from \"../Pages/RouteSegments.tsx\"\nimport { useRouteSegmentChildrenRows } from \"../Pages/useRouteSegmentChildrenRows.ts\"\nimport { createFolder as createPageFolder } from \"../Pages/utils/createFolder.ts\"\nimport { findMatchingRouteSegmentIds, matchRouteSegment } from \"../Pages/utils/routeSegmentMatch.ts\"\nimport { sortRouteSegmentsAlphabetically } from \"../Pages/utils/sortRouteSegments.ts\"\nimport { useHomePageState } from \"../Pages/utils/useHomePageState.ts\"\nimport { sampleCollectionName } from \"../contentManagement/utils/createSampleCollection.ts\"\nimport {\n\tcreateSampleCollectionWithPages,\n\tdefaultBlogSampleCollectionPath,\n} from \"../contentManagement/utils/createSampleCollectionWithPages.ts\"\nimport { PanelSectionHeaderButton } from \"../properties/panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { ActiveContentPanelPageProvider } from \"./ActiveContentPanelPageProvider.tsx\"\nimport { ContentPanelHeader } from \"./ContentPanelHeader.tsx\"\nimport { ContentPanelLocaleSelector } from \"./ContentPanelLocaleSelector.tsx\"\nimport * as styles from \"./ContentPanelPagesTab.styles.ts\"\nimport { ContentPanelSearchBar } from \"./ContentPanelSearchBar.tsx\"\nimport { usePanelSearch } from \"./PanelSearch.tsx\"\n\nconst stopPropagation = (event: React.MouseEvent) => event.stopPropagation()\n\nasync function createWebPageWithPreloadedScopesData(isWireframerKitPage: boolean = false) {\n\tconst existingWebPage = engine.stores.scopeStore.getFirstWebPageNode()\n\tif (existingWebPage && !existingWebPage.isLoaded()) {\n\t\tawait existingWebPage.load()\n\t}\n\n\tawait engine.createWebPage({ isWireframerKitPage })\n\n\tif (isWireframerKitPage) {\n\t\tengine.stores.chromeStore.kitPagesExpanded = true\n\t} else {\n\t\tengine.stores.chromeStore.sitesPagesExpanded = true\n\t}\n}\n\nfunction getDefaultCollectionPath(dataDefinition: DataDefinition) {\n\tif (dataDefinition.name === sampleCollectionName) {\n\t\treturn defaultBlogSampleCollectionPath\n\t}\n\n\treturn valueToPath(dataDefinition.name)\n}\n\nfunction indexPageExistsOrLoading(dataDefinition: DataDefinition, onPageDidLoad?: () => void): boolean {\n\tconst defaultPath = getDefaultCollectionPath(dataDefinition)\n\tconst webPageWithEqualPath = engine.stores.scopeStore.getWebPageNodes().find(webPage => {\n\t\tconst pagePath = getRawWebPagePath(engine.tree, webPage)\n\t\treturn pagePath === defaultPath\n\t})\n\n\t// we don't have a page with the same path, it doesn't exist\n\tif (!webPageWithEqualPath) {\n\t\treturn false\n\t}\n\n\t// If we have a callback to call when the page loads, and the page is not loaded, load it\n\t// but if we don't have a callback, we don't need to load the page and let it be shallow\n\tif (!webPageWithEqualPath.isLoaded() && onPageDidLoad) {\n\t\tvoid webPageWithEqualPath\n\t\t\t.load()\n\t\t\t.then(() => {\n\t\t\t\tonPageDidLoad()\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t}\n\n\t// we are still loading, return true to disable the option\n\tif (!webPageWithEqualPath?.loaded) {\n\t\treturn true\n\t}\n\n\tfor (const node of webPageWithEqualPath.loaded.descendants()) {\n\t\tif (isDataRepeater(node) && node.dataIdentifier === dataDefinition.identifier) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nconst createCMSIndexPage = engine.scheduler.wrapHandler(\n\tasync (dataDefinition: DataDefinition, isWireframerKitPage: boolean = false) => {\n\t\tengine.stores.chromeStore.sitesPagesExpanded = true\n\t\tconst loadedTemplate = await getLoadedWebPageTemplate(engine)\n\t\tawait engine.scheduler.processWhenReadyAsync(() =>\n\t\t\tcreateCollectionIndexPage({\n\t\t\t\tengine,\n\t\t\t\tidentifier: dataDefinition.identifier,\n\t\t\t\tslugId: getSlugIdFromDataDefinition(dataDefinition),\n\t\t\t\tproperties: dataDefinition.properties,\n\t\t\t\tpreferredName: dataDefinition.name,\n\t\t\t\tpath: getDefaultCollectionPath(dataDefinition),\n\t\t\t\tloadedTemplate,\n\t\t\t\tisWireframerKitPage,\n\t\t\t}),\n\t\t)\n\t},\n)\n\nconst createCMSDetailPage = engine.scheduler.wrapHandler(\n\tasync (dataDefinition: DataDefinition, isWireframerKitPage: boolean = false) => {\n\t\tengine.stores.chromeStore.cmsPagesExpanded = true\n\t\tconst slugId = getSlugIdFromDataDefinition(dataDefinition)\n\t\tassert(slugId, \"Collection should contain slug to be able to make web page with content\")\n\t\tawait getLoadedWebPageTemplate(engine)\n\t\tawait createCollectionDetailPage({\n\t\t\tengine,\n\t\t\tslugId,\n\t\t\tpath: dataDefinition.name,\n\t\t\tpreferredName: dataDefinition.name,\n\t\t\tidentifier: dataDefinition.identifier,\n\t\t\tproperties: dataDefinition.properties,\n\t\t\tisWireframerKitPage,\n\t\t}).catch(unhandledError)\n\t},\n)\n\nconst getCmsPageOptions = (\n\tdataDefinitions: DataDefinition[],\n\tusedCollectionPageDataIdentifiers: Set<ModuleExportIdentifierString>,\n\tonPageDidLoad?: () => void,\n\tisWireframerKitPage: boolean = false,\n): MenuItemOptions[] =>\n\tdataDefinitions.map(dataDefinition => {\n\t\tconst detailPageAdded = usedCollectionPageDataIdentifiers.has(dataDefinition.identifier)\n\t\tconst hasSlug = Boolean(getSlugIdFromDataDefinition(dataDefinition))\n\n\t\tlet detailPageTitle = \"Detail Page\"\n\t\tif (!hasSlug) {\n\t\t\tdetailPageTitle += ` (missing ${Dictionary.Slug.toLowerCase()})`\n\t\t}\n\n\t\treturn {\n\t\t\tlabel: dataDefinition.name,\n\t\t\tsubmenu: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Index\",\n\t\t\t\t\tenabled: isWireframerKitPage || !indexPageExistsOrLoading(dataDefinition, onPageDidLoad),\n\t\t\t\t\tclick: () => createCMSIndexPage(dataDefinition, isWireframerKitPage),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: detailPageTitle,\n\t\t\t\t\tenabled: isWireframerKitPage || (!detailPageAdded && hasSlug),\n\t\t\t\t\tclick: () => createCMSDetailPage(dataDefinition, isWireframerKitPage),\n\t\t\t\t},\n\t\t\t],\n\t\t}\n\t})\n\nconst getCMSPageMenuOptions = (onPageDidLoad?: () => void, isWireframerKitPage: boolean = false) => {\n\tconst usedCollectionPageDataIdentifiers = new Set(\n\t\tengine.stores.scopeStore.getWebPageNodesWithCollection().map(webPage => webPage.dataIdentifier),\n\t)\n\tconst dataDefinitions = getAvailableCollections(engine)\n\treturn dataDefinitions.length > 0\n\t\t? getCmsPageOptions(dataDefinitions, usedCollectionPageDataIdentifiers, onPageDidLoad, isWireframerKitPage)\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Add Sample\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.chromeStore.cmsPagesExpanded = true\n\t\t\t\t\t\tContextAction.toggleContentManagementScope(engine)\n\t\t\t\t\t\tcreateSampleCollectionWithPages(engine, \"content_panel_pages_header\", isWireframerKitPage)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]\n}\n\nconst createFolder = engine.scheduler.wrapHandler(() => {\n\tcreatePageFolder(engine)\n\tengine.stores.chromeStore.removePanelOverrides()\n\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Pages\n\tengine.stores.chromeStore.chromeIsVisible = true\n\tengine.stores.chromeStore.sitesPagesExpanded = true\n})\n\nconst createDesignPage = engine.scheduler.wrapHandler(() => {\n\tengine.stores.chromeStore.designPagesExpanded = true\n\tconst pageId = ContextAction.createDesignPage(engine)\n\trecord(\"design_page_create\", { pageId, source: \"pages_panel\" })\n})\n\nconst createCanvasPage = engine.scheduler.wrapHandler(() => {\n\tengine.stores.chromeStore.canvasPagesExpanded = true\n\tContextAction.createCanvasPage(engine)\n})\n\nfunction has404Page() {\n\treturn engine.stores.scopeStore.getWebPageNodesWithoutCollection().some(node => {\n\t\tconst path = getWebPagePath(engine.tree, node)\n\t\tif (!path) return false\n\t\treturn customNotFoundPagePaths.has(path)\n\t})\n}\n\nasync function create404Page() {\n\tengine.stores.chromeStore.sitesPagesExpanded = true\n\tconst page = await engine.createWebPage({ preferredPath: \"/404\", startEditingPageTitle: false })\n\tpage.set({ webMetadata: { noIndex: true, noIndexSite: true } })\n}\n\nconst createPage = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tlet initial = true\n\tlet done = false\n\n\t// Show a context menu with options to create pages and folders\n\t//   This provides reactive updates only with new improved menus,\n\t//   and showMenu might be called multiple times when loading shallow pages\n\t//   Legacy menus do not get dynamically updated, so we only render once\n\tconst showMenu = () => {\n\t\tif (done) return\n\n\t\t// Note: `onPageDidLoad` is set only on the first call to `showMenu`,\n\t\t// so that on updates we don't re-subscribe to loading of pages again\n\t\tconst onPageDidLoad = initial ? showMenu : undefined\n\n\t\tinitial = false\n\n\t\tconst menuOptions: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"New Page\",\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: createWebPageWithPreloadedScopesData,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"New CMS Page\",\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tsubmenu: getCMSPageMenuOptions(onPageDidLoad),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"New 404 Page\",\n\t\t\t\tvisible: !has404Page(),\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: create404Page,\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: createFolder,\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => sortRouteSegmentsAlphabetically({ engine }),\n\t\t\t},\n\t\t]\n\n\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\tonDone() {\n\t\t\t\tdone = true\n\t\t\t},\n\t\t})\n\t}\n\n\tshowMenu()\n})\n\nconst createKitPage = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tlet initial = true\n\tlet done = false\n\n\t// Show a context menu with options to create pages and folders\n\t//   This provides reactive updates only with new improved menus,\n\t//   and showMenu might be called multiple times when loading shallow pages\n\t//   Legacy menus do not get dynamically updated, so we only render once\n\tconst showMenu = () => {\n\t\tif (done) return\n\n\t\t// Note: `onPageDidLoad` is set only on the first call to `showMenu`,\n\t\t// so that on updates we don't re-subscribe to loading of pages again\n\t\tconst onPageDidLoad = initial ? showMenu : undefined\n\n\t\tinitial = false\n\n\t\tconst menuOptions: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"New Page\",\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tvoid createWebPageWithPreloadedScopesData(true)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"New CMS Page\",\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tsubmenu: getCMSPageMenuOptions(onPageDidLoad, true),\n\t\t\t},\n\t\t]\n\n\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\tonDone() {\n\t\t\t\tdone = true\n\t\t\t},\n\t\t})\n\t}\n\n\tshowMenu()\n})\n\nconst plusIcon = <IconSectionHeaderPlus />\n\nexport const HeaderActionItem = React.forwardRef<\n\tHTMLDivElement,\n\t{\n\t\ttitle: string\n\t\texpanded: boolean\n\t\tactivePageName?: string | null\n\t\tcreateAction: (event: React.MouseEvent) => void\n\t\tisViewOnly: boolean\n\t}\n>(function HeaderActionItem(\n\t{ expanded, createAction, title, activePageName, isViewOnly },\n\tref: React.ForwardedRef<HTMLDivElement>,\n) {\n\tconst { mainView } = engine.stores.chromeStore.useState()\n\tconst codeEditorOpen = mainView === ActiveMainView.CodeEditor\n\tconst preferMouseDown = usePrefersMouseDown()\n\n\tconst mouseDownHandler = useCallback(\n\t\t(event: React.MouseEvent<Element, MouseEvent>) => {\n\t\t\tstopPropagation(event)\n\t\t\tcreateAction(event)\n\t\t},\n\t\t[createAction],\n\t)\n\n\tif (isViewOnly || (!expanded && !!activePageName)) {\n\t\tif (codeEditorOpen || !activePageName) return null\n\t\treturn (\n\t\t\t<Text size={fonts.size.labelLarge} className={styles.label}>\n\t\t\t\t{activePageName}\n\t\t\t</Text>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PanelSectionHeaderButton\n\t\t\tonClick={preferMouseDown ? undefined : createAction}\n\t\t\tonMouseDown={preferMouseDown ? mouseDownHandler : stopPropagation}\n\t\t\ttitle={title}\n\t\t\tref={ref}\n\t\t>\n\t\t\t{plusIcon}\n\t\t</PanelSectionHeaderButton>\n\t)\n})\n\nexport const ContentPanelPagesTab = React.memo(function ContentPanelPagesTab() {\n\tconst isDocumentLoaded = engine.stores.loadingStore.useState(state => state.isDocumentLoaded)\n\tconst isKitsExperimentOn = useExperimentIsOn(\"wireframerKits\")\n\tconst isKitProject = useProjectFeatureIsOn(\"kit\")\n\tconst canDesignKits = isKitProject && isKitsExperimentOn\n\tconst { sitesPagesExpanded, canvasPagesExpanded, designPagesExpanded, kitPagesExpanded, isPreviewingLocaleOnCanvas } =\n\t\tengine.stores.chromeStore.useState()\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\n\tconst activePageId = engine.stores.scopeStore.useState(state => state.active.id)\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst isViewOnlyOrPreviewingLocale = isViewOnly || isPreviewingLocaleOnCanvas\n\n\tconst canvasIsOn = useDeprecatedEngineState(\n\t\tEngineChange.UserDefaultsStore,\n\t\t() => engine.stores.persistedUserDefaults.canvasPage,\n\t)\n\tconst { hasSitesPages, hasCMSPages, hasCanvasPages, hasDesignPages, hasKitPages } = useDeprecatedEngineState(\n\t\t[engine.stores.scopeStore, EngineChange.Tree],\n\t\t() => engine.stores.scopeStore.hasPages(),\n\t)\n\n\tconst { homePageId, isHomePageAbTesting } = useHomePageState()\n\n\tconst { searchQueryFor } = usePanelSearch()\n\tconst filter = searchQueryFor(ActiveContentPanelTab.Pages).trim()\n\tconst isFiltering = filter !== \"\"\n\n\tconst { canvasPageRows, designPageRows, kitPageRows } = useEngineState(\n\t\t() => {\n\t\t\tconst kitPageRows: KitPageRow[] = []\n\t\t\tconst designPageRows: DesignPageRow[] = []\n\t\t\tconst canvasPageRows: CanvasPageRow[] = []\n\n\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\tconst name = node.resolveValue(\"name\")\n\t\t\t\tif (filter && name && !matchSubstring(filter, name)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isCanvasPageNode(node)) {\n\t\t\t\t\tcanvasPageRows.push({\n\t\t\t\t\t\tid: node.id,\n\t\t\t\t\t\tname,\n\t\t\t\t\t})\n\t\t\t\t} else if (isDesignPageNode(node)) {\n\t\t\t\t\tdesignPageRows.push({\n\t\t\t\t\t\tid: node.id,\n\t\t\t\t\t\tname,\n\t\t\t\t\t})\n\t\t\t\t} else if (isWebPageNode(node) && node.kitPage) {\n\t\t\t\t\tkitPageRows.push({\n\t\t\t\t\t\tid: node.id,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tcount: node.isLoaded() ? node.getPrimaryVariant().children?.length : 0,\n\t\t\t\t\t\tdataIdentifier: node.dataIdentifier,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcanvasPageRows,\n\t\t\t\tdesignPageRows,\n\t\t\t\tkitPageRows,\n\t\t\t}\n\t\t},\n\t\t[filter],\n\t\tEngineChange.Tree,\n\t\t{ deepEqual: true },\n\t)\n\n\tconst canvasLocaleId = engine.stores.chromeStore.useState(state => state.canvasLocaleId)\n\tconst routes = useRouteSegmentChildrenRows(getRouteSegmentRootNode(engine.tree).id, undefined, canvasLocaleId)\n\n\tconst { matchingRouteSegmentIds, expandableRouteSegmentIds, routesToUse } = useMemo(() => {\n\t\tif (!isFiltering) {\n\t\t\treturn {\n\t\t\t\tmatchingRouteSegmentIds: undefined,\n\t\t\t\texpandableRouteSegmentIds: undefined,\n\t\t\t\troutesToUse: routes,\n\t\t\t}\n\t\t}\n\n\t\tconst { matchingIds, expandableIds } = findMatchingRouteSegmentIds(engine, filter, routes)\n\n\t\t// Filter top-level routes to only include matching ones, children will be filtered by the RouteSegmentRow component\n\t\tconst filtered = routes.filter(route => matchingIds.has(route.segmentId))\n\n\t\treturn {\n\t\t\tmatchingRouteSegmentIds: matchingIds,\n\t\t\texpandableRouteSegmentIds: expandableIds,\n\t\t\troutesToUse: filtered,\n\t\t}\n\t}, [isFiltering, filter, routes])\n\n\tconst showHomePage = Boolean(\n\t\thomePageId && (!isFiltering || (isFiltering && matchRouteSegment(filter, Dictionary.Home))),\n\t)\n\n\tconst activeFilterWithoutResults =\n\t\tisFiltering &&\n\t\troutesToUse.length === 0 &&\n\t\tdesignPageRows.length === 0 &&\n\t\tcanvasPageRows.length === 0 &&\n\t\tkitPageRows.length === 0 &&\n\t\t!showHomePage // the home page is handled separately from the rest of the routes\n\n\tconst showDesignPanelHeader = !isFiltering || designPageRows.length > 0\n\tconst showPagesPanelHeader = !isFiltering || routesToUse.length > 0 || showHomePage\n\tconst showCanvasPanelHeader = !isFiltering || canvasPageRows.length > 0\n\tconst showKitPanelHeader = !isFiltering || kitPageRows.length > 0\n\n\t// User can create canvas pages only if the canvas pages feature is on.\n\tconst canCreateCanvasPage = projectFeatures.isOn(\"canvasPages\")\n\treturn (\n\t\t<ActiveContentPanelPageProvider containerRef={containerRef}>\n\t\t\t<div\n\t\t\t\tref={containerRef}\n\t\t\t\tclassName={styles.pagesWrapper}\n\t\t\t\tonMouseDownCapture={engine.stores.codeEditorStore.closeEditor}\n\t\t\t>\n\t\t\t\t<Stack direction=\"column\" gap={dimensions.css.panelControlGap} className={styles.searchBarLocaleWrapper}>\n\t\t\t\t\t<ContentPanelLocaleSelector />\n\n\t\t\t\t\t<ContentPanelSearchBar\n\t\t\t\t\t\tcontentPanelTab={ActiveContentPanelTab.Pages}\n\t\t\t\t\t\tisFocused={engine.stores.chromeStore.isContentPanelSearchFocused}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t\t<Scroll className={styles.scroll}>\n\t\t\t\t\t{activeFilterWithoutResults ? (\n\t\t\t\t\t\t<div className={styles.noResults}>No Pages Found</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{canDesignKits && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{showKitPanelHeader && (\n\t\t\t\t\t\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\t\t\t\t\t\ttitle={Dictionary.Kit}\n\t\t\t\t\t\t\t\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleKitPages}\n\t\t\t\t\t\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\t\t\t\t\t\ttitle={`Add ${Dictionary.Kit} Page`}\n\t\t\t\t\t\t\t\t\t\t\t\t\texpanded={kitPagesExpanded}\n\t\t\t\t\t\t\t\t\t\t\t\t\tcreateAction={createKitPage}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\t\t\t\t\t\tcreateAction={createKitPage}\n\t\t\t\t\t\t\t\t\t\t\thasItems={hasKitPages}\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{kitPagesExpanded && (\n\t\t\t\t\t\t\t\t\t\t<KitPages\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t\tactivePageId={activePageId}\n\t\t\t\t\t\t\t\t\t\t\trows={kitPageRows}\n\t\t\t\t\t\t\t\t\t\t/>\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\t{showDesignPanelHeader && (\n\t\t\t\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\t\t\t\ttitle={Dictionary.Design}\n\t\t\t\t\t\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleDesignPages}\n\t\t\t\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\t\t\t\ttitle={`Add ${Dictionary.Design} Page`}\n\t\t\t\t\t\t\t\t\t\t\texpanded={designPagesExpanded}\n\t\t\t\t\t\t\t\t\t\t\tcreateAction={createDesignPage}\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\t\t\t\tcreateAction={createDesignPage}\n\t\t\t\t\t\t\t\t\thasItems={hasDesignPages}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{designPagesExpanded && isDocumentLoaded && (\n\t\t\t\t\t\t\t\t<DesignPages\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\tactivePageId={activePageId}\n\t\t\t\t\t\t\t\t\trows={designPageRows}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{showPagesPanelHeader && (\n\t\t\t\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\t\t\t\ttitle={Dictionary.Pages}\n\t\t\t\t\t\t\t\t\ttoggleExpanded={createPage}\n\t\t\t\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\t\t\t\ttitle=\"Add Page\"\n\t\t\t\t\t\t\t\t\t\t\texpanded={sitesPagesExpanded}\n\t\t\t\t\t\t\t\t\t\t\tcreateAction={createPage}\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\t\t\t\tcreateAction={createPage}\n\t\t\t\t\t\t\t\t\tonRightClick={createPage}\n\t\t\t\t\t\t\t\t\thasItems={hasSitesPages || hasCMSPages}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isDocumentLoaded && sitesPagesExpanded && (\n\t\t\t\t\t\t\t\t<RouteSegments\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t\tisFiltering={isFiltering}\n\t\t\t\t\t\t\t\t\texpandableRouteSegmentIds={expandableRouteSegmentIds}\n\t\t\t\t\t\t\t\t\tmatchingRouteSegmentIds={matchingRouteSegmentIds}\n\t\t\t\t\t\t\t\t\tshowHomePage={showHomePage}\n\t\t\t\t\t\t\t\t\thomePageId={homePageId ?? \"\"}\n\t\t\t\t\t\t\t\t\tisHomePageAbTesting={isHomePageAbTesting}\n\t\t\t\t\t\t\t\t\troutes={routesToUse}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{(hasCanvasPages || (canvasIsOn && canCreateCanvasPage)) && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{showCanvasPanelHeader && (\n\t\t\t\t\t\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\t\t\t\t\t\ttitle=\"Canvas\"\n\t\t\t\t\t\t\t\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleCanvasPages}\n\t\t\t\t\t\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t\t\t\t\t\tcanCreateCanvasPage ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttitle=\"Add Canvas Page\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\texpanded={canvasPagesExpanded}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcreateAction={createCanvasPage}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\t\t\t\t\t\tcreateAction={canCreateCanvasPage ? createCanvasPage : undefined}\n\t\t\t\t\t\t\t\t\t\t\thasItems={hasCanvasPages}\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{canvasPagesExpanded && isDocumentLoaded && (\n\t\t\t\t\t\t\t\t\t\t<CanvasPages\n\t\t\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnlyOrPreviewingLocale}\n\t\t\t\t\t\t\t\t\t\t\tactivePageId={activePageId}\n\t\t\t\t\t\t\t\t\t\t\trows={canvasPageRows}\n\t\t\t\t\t\t\t\t\t\t/>\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</Scroll>\n\t\t\t</div>\n\t\t</ActiveContentPanelPageProvider>\n\t)\n})\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport React, { useRef } from \"react\"\nimport { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { DraggablePageRow } from \"./DraggablePageRow.tsx\"\nimport { usePagesMultiSelect } from \"./usePagesMultiSelect.ts\"\n\nexport interface Row {\n\tid: NodeID\n\tname?: string | null\n}\n\ninterface Props {\n\tisViewOnly: boolean\n\tactivePageId: string\n\trows: Row[]\n}\n\nexport function CanvasPages({ isViewOnly, rows, activePageId }: Props) {\n\tconst rowsRef = React.useRef(rows)\n\trowsRef.current = rows\n\n\tconst getRenderedIds = useStableCallback(() => rows.map(row => row.id))\n\n\tconst { handlePageClick, getIsPageSelected } = usePagesMultiSelect(\n\t\tContentPanelPage.Canvas,\n\t\tgetRenderedIds,\n\t\tactivePageId,\n\t)\n\n\tif (rows.length === 0) return null\n\n\treturn (\n\t\t<div style={{ marginBottom: dimensions.css.panelPadding }}>\n\t\t\t{rows.map(row => (\n\t\t\t\t<WithRefDraggablePageRow\n\t\t\t\t\tkey={row.id}\n\t\t\t\t\tid={row.id}\n\t\t\t\t\tpageType={ContentPanelPage.Canvas}\n\t\t\t\t\trows={rowsRef}\n\t\t\t\t\tname={row.name ?? \"\"}\n\t\t\t\t\tisEnabled={!isViewOnly && rows.length > 1}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\thandlePageClick={() => handlePageClick(row.id)}\n\t\t\t\t\tgetRenderedIds={getRenderedIds}\n\t\t\t\t\tgetIsPageSelected={getIsPageSelected}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nfunction withRefDraggablePageRow<T>(Component: React.ComponentType<T>) {\n\treturn function WithRefDraggablePageRow(props: T) {\n\t\tconst ref = useRef<HTMLDivElement>(null)\n\t\treturn <Component {...props} ref={ref} />\n\t}\n}\n\nconst WithRefDraggablePageRow = withRefDraggablePageRow(DraggablePageRow)\n", "import { dataIsModalSelector } from \"@framerjs/fresco/components/CustomModal\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { dataIsContextMenuSelector } from \"menu/ContextMenu.tsx\"\nimport { createContext, useCallback, useContext, useEffect, useMemo, useRef } from \"react\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { useOnClickOutside } from \"utils/useClickOutside.ts\"\nimport { useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\n\nexport enum ContentPanelPage {\n\tDesign = \"design\",\n\tCanvas = \"canvas\",\n\tRoutes = \"routes\",\n\tKit = \"kit\",\n}\n\ninterface ActiveContentPanelPageValue {\n\tregisterCleanup: (pageType: ContentPanelPage, cleanupFn: () => void) => () => void\n\tregisterCleanupForActivePage: (currentPageType: ContentPanelPage, cleanupFn: () => void) => () => void\n\trunCleanupsForNonMatchingTypes: (currentPageType: ContentPanelPage | null) => void\n}\n\nconst ActiveContentPanelPageContext = createContext<ActiveContentPanelPageValue | null>(null)\n\nexport function ActiveContentPanelPageProvider({\n\tcontainerRef,\n\tchildren,\n}: {\n\tcontainerRef?: React.RefObject<HTMLElement>\n\tchildren: React.ReactNode\n}) {\n\tconst fallbackRef = useRef<HTMLElement>(null)\n\tconst ref = containerRef ?? fallbackRef\n\n\t// Map to store cleanup functions for each page type\n\tconst cleanupFunctionsRef = useRef<Map<ContentPanelPage, () => void>>(new Map())\n\tconst cleanupFunctionsForActivePageRef = useRef<Map<ContentPanelPage, () => void>>(new Map())\n\n\t// Function to register cleanup functions\n\tconst registerCleanup = useCallback((pageType: ContentPanelPage, cleanupFn: () => void) => {\n\t\tcleanupFunctionsRef.current.set(pageType, cleanupFn)\n\n\t\t// Return unregister function\n\t\treturn () => {\n\t\t\tcleanupFunctionsRef.current.delete(pageType)\n\t\t}\n\t}, [])\n\n\tconst registerCleanupForActivePage = useCallback((pageType: ContentPanelPage, cleanupFn: () => void) => {\n\t\tcleanupFunctionsForActivePageRef.current.set(pageType, cleanupFn)\n\n\t\treturn () => {\n\t\t\tcleanupFunctionsForActivePageRef.current.delete(pageType)\n\t\t}\n\t}, [])\n\n\t// Function to run cleanups for non-matching page types\n\tconst runCleanupsForNonMatchingTypes = useCallback((currentPageType: ContentPanelPage | null) => {\n\t\tif (isNull(currentPageType)) return\n\n\t\tfor (const [pageType, cleanupFn] of cleanupFunctionsRef.current.entries()) {\n\t\t\tif (pageType !== currentPageType) {\n\t\t\t\tcleanupFn()\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tconst runAllCleanups = useCallback(() => {\n\t\tfor (const cleanupFn of cleanupFunctionsForActivePageRef.current.values()) {\n\t\t\tcleanupFn()\n\t\t}\n\t}, [])\n\n\t// Any click outside the pages panel should clear the multi-selection,\n\t// except for clicks within context menus or modals to keep these interactive.\n\tconst handleOutsideClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst target = event.target\n\t\t\tif (!(target instanceof Element)) return\n\n\t\t\t// Don't clear if the click is within a context menu\n\t\t\tif (target.closest(dataIsContextMenuSelector)) return\n\t\t\t// Don't clear if the click is within a modal\n\t\t\tif (target.closest(dataIsModalSelector)) return\n\n\t\t\trunAllCleanups()\n\t\t},\n\t\t[runAllCleanups],\n\t)\n\n\tuseOnClickOutside(ref, handleOutsideClick)\n\n\tuseOnEscape({\n\t\tname: \"ActiveContentPanelPageProvider\",\n\t\tstopPropagation: false,\n\t\tenabled: () => cleanupFunctionsForActivePageRef.current.size > 0,\n\t\thandler: runAllCleanups,\n\t})\n\n\tconst value = useMemo(\n\t\t() => ({\n\t\t\tregisterCleanup,\n\t\t\tregisterCleanupForActivePage,\n\t\t\trunCleanupsForNonMatchingTypes,\n\t\t}),\n\t\t[registerCleanup, runCleanupsForNonMatchingTypes, registerCleanupForActivePage],\n\t)\n\n\treturn <ActiveContentPanelPageContext.Provider value={value}>{children}</ActiveContentPanelPageContext.Provider>\n}\n\nexport function useActiveContentPanelPage(\n\tpageType: ContentPanelPage,\n\tcleanupFn: () => void,\n\tcleanupFnForActivePage: () => void,\n) {\n\tconst context = useContext(ActiveContentPanelPageContext)\n\tassert(!isNull(context), \"useActiveContentPanelPage must be used within an ActiveContentPanelPageProvider\")\n\n\t// Register cleanup function if provided\n\tuseEffect(() => {\n\t\tif (cleanupFn) {\n\t\t\treturn context.registerCleanup(pageType, cleanupFn)\n\t\t}\n\t}, [pageType, cleanupFn, context.registerCleanup])\n\n\tuseEffect(() => {\n\t\tif (cleanupFnForActivePage) {\n\t\t\treturn context.registerCleanupForActivePage(pageType, cleanupFnForActivePage)\n\t\t}\n\t}, [pageType, cleanupFnForActivePage, context.registerCleanupForActivePage])\n\n\tconst registerPageClick = useCallback(() => {\n\t\treturn context.runCleanupsForNonMatchingTypes(pageType)\n\t}, [context.runCleanupsForNonMatchingTypes, pageType])\n\n\treturn registerPageClick\n}\n", "import { Draggable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert } from \"@framerjs/shared\"\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 { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { EngineContext } from \"document/base-engine/BaseEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDesignPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { forwardRef } from \"react\"\nimport { useScrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { selectedSibling } from \"../shared/utils/panelMultiSelect.styles.ts\"\nimport * as styles from \"./DraggablePageRow.styles.ts\"\nimport { usePagesDragDrop } from \"./usePagesDragDrop.tsx\"\nimport { duplicateDesignPage } from \"./utils/duplicatePage.ts\"\nimport { editPageTitle, getPageInputId } from \"./utils/editPageRow.ts\"\nimport { getPageRowIcon } from \"./utils/getPageRowIcon.tsx\"\nimport { promptAndDeletePage, promptAndDeletePages } from \"./utils/promptAndDeletePage.ts\"\n\ninterface Row {\n\tid: NodeID\n\tname?: string | null\n}\n\ninterface Props {\n\tid: NodeID\n\trows: React.MutableRefObject<Row[]>\n\tpageType: Exclude<ContentPanelPage, \"routes\">\n\tname: string\n\tisEnabled: boolean\n\tisViewOnly: boolean\n\tdataIdentifier?: string\n\thandlePageClick: () => void\n\tgetRenderedIds: () => readonly NodeID[]\n\tgetIsPageSelected: (id: NodeID) => boolean\n\tgetMenuOptions?: (id: NodeID) => readonly MenuItemOptions[] | Promise<MenuItemOptions[]>\n}\n\nexport const DraggablePageRow = forwardRef<HTMLDivElement, Props>(function DraggablePageRow(\n\t{\n\t\tid,\n\t\trows,\n\t\tpageType,\n\t\tname,\n\t\tisEnabled,\n\t\tisViewOnly,\n\t\thandlePageClick,\n\t\tgetRenderedIds,\n\t\tgetIsPageSelected,\n\t\tdataIdentifier,\n\t},\n\tref,\n) {\n\tconst { handleDragStart, getDropTargetContainer, getInsertionIndicator, isDraggedOver } = usePagesDragDrop({\n\t\tid,\n\t\tisViewOnly,\n\t\tpageType,\n\t\tgetRenderedIds,\n\t\tgetIsPageSelected,\n\t})\n\n\tconst isSelected = getIsPageSelected(id)\n\tconst mergedRef = useScrollIntoView(ref, isSelected)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst handleChangeName = useEngineCallback(\n\t\t(pageId: NodeID, value: string) => {\n\t\t\tif (isViewOnly) return\n\t\t\tengine.stores.scopeStore.renameScope(pageId, value)\n\t\t\tif (pageType === ContentPanelPage.Design) {\n\t\t\t\trecord(\"ui_interaction\", { page: MetricsInteractionViews.CONTENT_PANEL, id: \"design_page_rename\" })\n\t\t\t}\n\n\t\t\tif (pageType === ContentPanelPage.Canvas) {\n\t\t\t\trecord(\"ui_interaction\", { page: MetricsInteractionViews.CONTENT_PANEL, id: \"canvas_page_rename\" })\n\t\t\t}\n\t\t},\n\t\t[isViewOnly, pageType],\n\t)\n\n\tconst icon = getPageRowIcon({ pageType, dataIdentifier, agentExperimentEnabled })\n\n\treturn (\n\t\t<div className={cx(styles.rowContainer, isSelected && selectedSibling)}>\n\t\t\t<div className={styles.draggableRowContainer}>\n\t\t\t\t<Draggable enabled={isEnabled} onDragStart={handleDragStart} hideDragSource={false}>\n\t\t\t\t\t{({ isDragPreview }) => {\n\t\t\t\t\t\tconst draggedRows =\n\t\t\t\t\t\t\tisDragPreview && isSelected ? rows.current.filter(row => getIsPageSelected(row.id)) : null\n\t\t\t\t\t\tconst shouldShowPreviewRows = draggedRows && (draggedRows.length > 1 || isSelected)\n\n\t\t\t\t\t\tif (isDragPreview && shouldShowPreviewRows) return getDragPreviewRows(draggedRows, agentExperimentEnabled)\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<EngineContext.Provider value={engine}>\n\t\t\t\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\t\t\t\tref={isSelected && !isDragPreview ? mergedRef || ref : undefined}\n\t\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\t\ttitle={name ?? \"\"}\n\t\t\t\t\t\t\t\t\tIcon={icon}\n\t\t\t\t\t\t\t\t\tgetMenuOptions={\n\t\t\t\t\t\t\t\t\t\tisViewOnly\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: () =>\n\t\t\t\t\t\t\t\t\t\t\t\t\tgetAllMenuOptions(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tgetSelectedRowIds(rows.current, getIsPageSelected),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpageType,\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\t\t\tonMouseUp={handlePageClick}\n\t\t\t\t\t\t\t\t\trowClassName={cx(isDraggedOver && styles.draggedOver)}\n\t\t\t\t\t\t\t\t\tisEditable={!isViewOnly}\n\t\t\t\t\t\t\t\t\tonTitleChange={handleChangeName}\n\t\t\t\t\t\t\t\t\tinputId={getPageInputId(id)}\n\t\t\t\t\t\t\t\t\t// Use withCollapse to make the indentation align with the web pages.\n\t\t\t\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\t\t\t\tisCollapsible={false}\n\t\t\t\t\t\t\t\t\tdepth={0}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</EngineContext.Provider>\n\t\t\t\t\t\t)\n\t\t\t\t\t}}\n\t\t\t\t</Draggable>\n\n\t\t\t\t{getDropTargetContainer()}\n\n\t\t\t\t{getInsertionIndicator()}\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n\nfunction getAllMenuOptions(\n\tid: NodeID,\n\tisSelected: boolean,\n\tselectedPages: NodeID[],\n\tpageType: Exclude<ContentPanelPage, \"routes\">,\n): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\t// Show the bulk menu if more than one item selected & current item is\n\t// a part of selection. Otherwise, show single-select ctx menu.\n\tif (isSelected && selectedPages.length > 1) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => promptAndDeletePages(engine, new Set(selectedPages), pageType),\n\t\t\t},\n\t\t]\n\t}\n\n\tconst selectedNode = engine.tree.get(id)\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => editPageTitle(id),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tvisible: isDesignPageNode(selectedNode),\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: async () => {\n\t\t\t\tassert(isDesignPageNode(selectedNode), \"Selected node is not a design page\")\n\t\t\t\tconst clonedPage = await duplicateDesignPage(engine, selectedNode)\n\t\t\t\tif (clonedPage) {\n\t\t\t\t\tengine.stores.scopeStore.select(clonedPage.id, { keepHistory: false })\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => promptAndDeletePage(engine, id),\n\t\t},\n\t]\n}\n\nfunction getDragPreviewRows(rows: Row[], agentExperimentEnabled: boolean) {\n\treturn rows.map(row => {\n\t\treturn (\n\t\t\t<CollapsibleRow\n\t\t\t\tkey={`${row.id}-preview`}\n\t\t\t\tid={`${row.id}-preview`}\n\t\t\t\ttitle={row.name ?? \"\"}\n\t\t\t\tIcon={getPageRowIcon({ pageType: ContentPanelPage.Canvas, agentExperimentEnabled })}\n\t\t\t\tisEditable={false}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible={false}\n\t\t\t\tdepth={0}\n\t\t\t/>\n\t\t)\n\t})\n}\n\nfunction getSelectedRowIds(rows: Row[], isSelectedFilterFn: (id: NodeID) => boolean) {\n\tconst selectedRowIds: NodeID[] = []\n\tfor (const row of rows) {\n\t\tif (isSelectedFilterFn(row.id)) selectedRowIds.push(row.id)\n\t}\n\treturn selectedRowIds\n}\n", "import \"DraggablePageRow.styles_1lfnwue.wyw.css\"; export const rowContainer = \"rowContainer_r4zrd1e\";\nexport const draggableRowContainer = \"draggableRowContainer_d124ob18\";\nexport const draggedOver = \"draggedOver_deltiww\";\nexport const dropTargetContainer = \"dropTargetContainer_d1mtw6tg\";\nexport const dropTarget = \"dropTarget_d1a48h09\";", "import { Stack } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { useDroppable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { useCallback, useState } from \"react\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport type { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { InsertionIndicator } from \"../shared/InsertionIndicator.tsx\"\nimport type { DragAndDropPosition } from \"../shared/utils/panelDragDrop.ts\"\nimport { calculateOffset } from \"../shared/utils/panelDragDrop.ts\"\nimport * as styles from \"./DraggablePageRow.styles.ts\"\n\nconst PAGES_DATA_TYPE = \"pages-item\"\nconst insertionIndicatorOffset = 32\n\ninterface DragoverSegment {\n\t/**\n\t * Insertion index within the root's children, of the same scope type:\n\t * - \\>\\= 0: drop as a sibling at this index (used for \"top\"/\"bottom\").\n\t *\n\t * Notes:\n\t * - \"top\" \u2192 before hovered row; \"bottom\" \u2192 after hovered row.\n\t */\n\tinsertOffset: number\n\t/**\n\t * Top/bottom line indicator; null when inserting \"as child\" (middle), which is not possible\n\t * for pages.\n\t */\n\tindicatorPosition: \"top\" | \"bottom\" | null\n}\n\nexport function usePagesDragDrop({\n\tid,\n\tisViewOnly,\n\tpageType,\n\tgetRenderedIds,\n\tgetIsPageSelected,\n}: {\n\tid: NodeID\n\tisViewOnly: boolean\n\tpageType: Exclude<ContentPanelPage, \"routes\">\n\tgetRenderedIds: () => readonly NodeID[]\n\tgetIsPageSelected: (id: NodeID) => boolean\n}) {\n\tconst [dragoverSegment, setDragoverSegment] = useState<DragoverSegment | null>(null)\n\n\tconst handleDragStart = useCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\tif (getIsPageSelected(id)) {\n\t\t\t\tconst draggedPageIds: NodeID[] = []\n\t\t\t\tfor (const nodeId of getRenderedIds()) {\n\t\t\t\t\tif (getIsPageSelected(nodeId)) draggedPageIds.push(nodeId)\n\t\t\t\t}\n\n\t\t\t\tif (draggedPageIds.length > 0) event.dataTransfer.setData(PAGES_DATA_TYPE, draggedPageIds)\n\t\t\t} else {\n\t\t\t\tevent.dataTransfer.setData(PAGES_DATA_TYPE, [id])\n\t\t\t}\n\t\t},\n\t\t[id, getIsPageSelected, getRenderedIds],\n\t)\n\n\tconst handleDragOver = useCallback(\n\t\t(event: DraggableEvent, position: DragAndDropPosition) => {\n\t\t\tconst draggedNodeIds = event.dataTransfer.getData(PAGES_DATA_TYPE) as NodeID[] | undefined\n\t\t\tif (isUndefined(draggedNodeIds) || draggedNodeIds.length === 0) return\n\n\t\t\tassert(!isUndefined(draggedNodeIds[0]), \"draggedNodeIds[0] must be defined\")\n\n\t\t\tif (isUndefined(id)) {\n\t\t\t\tsetDragoverSegment(\n\t\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\t\tinsertOffset: 0,\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\t// Cannot reparent in Design/Canvas pages\n\t\t\tif (position === \"middle\") return\n\n\t\t\t// Cannot drop within a selection\n\t\t\tif (draggedNodeIds.some(draggedId => draggedId === id)) return\n\n\t\t\tif (position !== \"top\" && position !== \"bottom\") assertNever(position)\n\n\t\t\tsetDragoverSegment(\n\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\tinsertOffset: calculateOffset(position),\n\t\t\t\t\tindicatorPosition: position,\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[id],\n\t)\n\n\tconst handleDrop = useEngineCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\tif (isNull(dragoverSegment)) return\n\n\t\t\tconst draggedNodeIds = event.dataTransfer.getData(PAGES_DATA_TYPE) as NodeID[] | undefined\n\t\t\tif (isUndefined(draggedNodeIds) || draggedNodeIds.length === 0) return\n\n\t\t\tconst { insertOffset } = dragoverSegment\n\t\t\tconst insertionIndex = id ? calculateInsertionIndex(insertOffset, id) : null\n\t\t\tif (isNull(insertionIndex)) return\n\n\t\t\tconst currentScopeNode = engine.stores.scopeStore.getScopeNode(id)\n\t\t\tif (isNull(currentScopeNode)) return\n\n\t\t\tconst scopeSiblings = engine.stores.scopeStore.getAllPageNodesOfScope(currentScopeNode)\n\n\t\t\tconst nodes = engine.tree.getNodes(draggedNodeIds)\n\n\t\t\t// When inserting to a higher insertionIndex, the items will reverse. This is a\n\t\t\t// peculiarity that also occurs in Layers.tsx\n\t\t\t// https://github.com/framer/company/issues/34039\n\t\t\tfor (let i = nodes.length - 1; i >= 0; i -= 1) {\n\t\t\t\tconst node = nodes[i]\n\t\t\t\tassert(!isUndefined(node), \"drag item must be defined\")\n\n\t\t\t\tlet localInsertionIndex = insertionIndex\n\t\t\t\tconst currentIndex = scopeSiblings.findIndex(scopeNode => scopeNode.id === node.id)\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\tengine.stores.scopeStore.movePage(node.id, localInsertionIndex)\n\t\t\t}\n\n\t\t\tif (draggedNodeIds.length > 1) {\n\t\t\t\trecord(\"site_page_bulk_move_section\", {\n\t\t\t\t\tpageIds: draggedNodeIds.join(\",\"),\n\t\t\t\t\tcount: draggedNodeIds.length,\n\t\t\t\t\tsection: pageType,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[dragoverSegment, id, pageType],\n\t)\n\n\tconst handleDragLeave = useCallback(() => {\n\t\tsetDragoverSegment(null)\n\t}, [])\n\n\tconst commonRefProps = {\n\t\tdataTypes: [PAGES_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\tenabled: !isViewOnly,\n\t})\n\n\tconst bottomDroppableRef = useDroppable({\n\t\t...commonRefProps,\n\t\tonDragOver: (event: DraggableEvent) => handleDragOver(event, \"bottom\"),\n\t})\n\n\tconst getDropTargetContainer = useCallback(() => {\n\t\treturn (\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\t\t)\n\t}, [topDroppableRef, midDroppableRef, bottomDroppableRef])\n\n\tconst getInsertionIndicator = useCallback(() => {\n\t\tif (isNull(dragoverSegment)) return null\n\t\tif (isNull(dragoverSegment.indicatorPosition)) return null\n\n\t\treturn (\n\t\t\t<InsertionIndicator\n\t\t\t\tdepth={0}\n\t\t\t\tposition={dragoverSegment.indicatorPosition}\n\t\t\t\tleftOffset={insertionIndicatorOffset}\n\t\t\t/>\n\t\t)\n\t}, [dragoverSegment])\n\n\tconst isDraggedOver = dragoverSegment?.insertOffset === -1\n\n\treturn { isDraggedOver, handleDragStart, getDropTargetContainer, getInsertionIndicator }\n}\n\nfunction updateDragoverSegmentIfNeeded(newDragoverSegment: DragoverSegment) {\n\treturn (oldDragoverSegment: DragoverSegment | null) => {\n\t\tif (isEqual(oldDragoverSegment, newDragoverSegment)) return oldDragoverSegment\n\t\treturn newDragoverSegment\n\t}\n}\n\nfunction calculateInsertionIndex(insertOffset: number, dropTargetId: NodeID): number | null {\n\t// In pages context, dropping \"into\" items is forbidden\n\tif (insertOffset === -1) {\n\t\treturn null\n\t}\n\n\tconst currentScopeNode = engine.stores.scopeStore.getScopeNode(dropTargetId)\n\tif (isNull(currentScopeNode)) return null\n\n\tconst scopeSiblings = engine.stores.scopeStore.getAllPageNodesOfScope(currentScopeNode)\n\n\tconst targetIndex = scopeSiblings.findIndex(node => node.id === dropTargetId)\n\tif (targetIndex === -1) {\n\t\t// Target not found, insert at end\n\t\treturn scopeSiblings.length\n\t}\n\n\t// Insert before or after the target\n\treturn targetIndex + insertOffset\n}\n", "import { IconKitPage, IconPage, IconSidebarCollection } from \"@framerjs/fresco\"\nimport { IconAgentCMS } from \"../../agentPanel/components/IconAgentCMS.tsx\"\nimport { IconAgentComponent } from \"../../agentPanel/components/IconAgentComponent.tsx\"\nimport { IconAgentPage } from \"../../agentPanel/components/IconAgentPage.tsx\"\nimport { ContentPanelPage } from \"../../contentPanel/ActiveContentPanelPageProvider.tsx\"\n\nexport function getPageRowIcon({\n\tpageType,\n\tdataIdentifier,\n\tagentExperimentEnabled,\n}: {\n\tpageType: Exclude<ContentPanelPage, \"routes\">\n\tdataIdentifier?: string\n\tagentExperimentEnabled: boolean\n}) {\n\tif (agentExperimentEnabled) {\n\t\tif (pageType === ContentPanelPage.Kit) return dataIdentifier ? IconAgentCMS : IconAgentComponent\n\t\treturn IconAgentPage\n\t}\n\n\tif (pageType === ContentPanelPage.Kit) return dataIdentifier ? IconSidebarCollection : IconKitPage\n\treturn IconPage\n}\n", "import { triggerCanvasPageDeleteEvent } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { AnyScopeNode, LoadedScopeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCanvasPageNode,\n\tisDesignPageNode,\n\tisKitPageNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport type { ContentPanelPage } from \"../../contentPanel/ActiveContentPanelPageProvider.tsx\"\n\nconst FALLBACK_DESCRIPTION = \"Deleting this page will remove all of its content for all project collaborators.\"\n\nfunction getAllPagesOfType(engine: VekterEngine, id: NodeID): AnyScopeNode[] | undefined {\n\tconst node = engine.tree.getNode(id)\n\tif (!node) return undefined\n\n\tif (isCanvasPageNode(node)) {\n\t\treturn engine.stores.scopeStore.getCanvasPageNodes()\n\t}\n\n\tif (isDesignPageNode(node)) {\n\t\treturn engine.stores.scopeStore.getDesignPageNodes()\n\t}\n\n\tif (isWebPageNode(node)) {\n\t\treturn isKitPageNode(node) ? engine.stores.scopeStore.getKitPageNodes() : engine.stores.scopeStore.getWebPageNodes()\n\t}\n\n\treturn undefined\n}\n\nconst deletePage = (engine: VekterEngine, id: NodeID) => {\n\tconst node = engine.tree.getNode(id)\n\tif (!node) return\n\n\tconst pagesOfSameType = getAllPagesOfType(engine, id)\n\tif (!pagesOfSameType) return\n\n\tconst currentIndex = pagesOfSameType.findIndex(page => page.id === id)\n\tif (currentIndex === -1) return\n\n\tconst nextIndex = (currentIndex + 1) % pagesOfSameType.length\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tif (isCanvasPageNode(node)) {\n\t\t\ttriggerCanvasPageDeleteEvent({ pageId: id })\n\t\t}\n\n\t\tif (isDesignPageNode(node)) {\n\t\t\trecord(\"design_page_delete\", { pageId: id })\n\t\t}\n\n\t\tif (isKitPageNode(node)) {\n\t\t\trecord(\"kit_page_delete\", { pageId: id })\n\t\t}\n\n\t\tengine.deleteNode(id)\n\n\t\t// Select the next page of the same type, if it exists.\n\t\tconst nextPageToSelect = pagesOfSameType[nextIndex]\n\t\tif (nextPageToSelect && nextPageToSelect.id !== id) {\n\t\t\tengine.stores.scopeStore.select(nextPageToSelect.id, { keepHistory: false })\n\t\t}\n\t})\n}\n\nconst isEmptyCanvasPageOrDesignPage = (scope: LoadedScopeNode) => {\n\tif (!isCanvasPageNode(scope) && !isDesignPageNode(scope)) return false\n\tconst groundNodes = scope.getGroundNodes()\n\treturn groundNodes.length === 0\n}\n\nconst isEmptyWebPage = (scope: LoadedScopeNode) => {\n\tif (!isWebPageNode(scope)) return false\n\n\t// When creating a web page, we always insert a breakpoint already.\n\t// Only consider the web page empty if the only ground node has no children.\n\tconst groundNodes = scope.getGroundNodes()\n\tif (groundNodes.length > 1) return false\n\tif (groundNodes.length === 0) return true\n\n\tconst onlyGroundNode = groundNodes[0]\n\treturn onlyGroundNode?.children?.length === 0\n}\n\ninterface PromptAndDeleteOptions {\n\tdescription: React.ReactNode | string\n\thasLinks?: boolean\n}\n\n/**\n * Used to delete a canvas page\n * To delete a web page we should use `promptAndDeleteSegment`\n * To delete an A/B testing variant web page we should use `promptAndDeleteAbVariant`\n */\nexport async function promptAndDeletePage(\n\tengine: VekterEngine,\n\tid: NodeID,\n\toptions: PromptAndDeleteOptions = { description: FALLBACK_DESCRIPTION, hasLinks: false },\n) {\n\tconst maybeScope = engine.tree.getNode(id)\n\tif (!isScopeNode(maybeScope)) return\n\n\tconst page = await maybeScope.load()\n\tif (!page) return\n\n\tif (isEmptyCanvasPageOrDesignPage(page) || (isEmptyWebPage(page) && !options.hasLinks)) {\n\t\tdeletePage(engine, id)\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\tvariant: \"destructive\",\n\t\ttitle: \"Delete Page\",\n\t\tdescription: options.description,\n\t\tonConfirm: () => {\n\t\t\tdeletePage(engine, id)\n\t\t},\n\t\tconfirmLabel: \"Delete\",\n\t\tsource: \"delete_page\",\n\t\tkeyboardConfirmMode: \"Enter\",\n\t})\n}\n\nconst bulkDeleteDescription = \"Deleting these pages will remove all of their content for all project collaborators.\"\n\n/**\n * Used to bulk delete a canvas page\n * To delete a web page we should use `promptAndDeleteSegment`\n * To delete an A/B testing variant web page we should use `promptAndDeleteAbVariant`\n */\nexport async function promptAndDeletePages(\n\tengine: VekterEngine,\n\tids: ReadonlySet<NodeID>,\n\tpageType: Exclude<ContentPanelPage, \"routes\">,\n) {\n\tlet canAllDeleteSafely = true\n\tfor (const id of ids) {\n\t\tconst maybeScope = engine.tree.getNode(id)\n\t\tif (!isScopeNode(maybeScope)) return\n\n\t\tconst page = await maybeScope.load()\n\t\tif (!page) return\n\n\t\t// Kit pages are essentially web pages so isEmptyWebPage is used to check if the kit page is empty.\n\t\tcanAllDeleteSafely = canAllDeleteSafely && (isEmptyCanvasPageOrDesignPage(page) || isEmptyWebPage(page))\n\t\tif (!canAllDeleteSafely) break\n\t}\n\n\tif (canAllDeleteSafely) {\n\t\tids.forEach(id => deletePage(engine, id))\n\t\trecord(\"site_page_bulk_delete\", getBulkDeleteData(ids.size, pageType))\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\tvariant: \"destructive\",\n\t\ttitle: \"Delete Pages\",\n\t\tdescription: bulkDeleteDescription,\n\t\tonConfirm: () => {\n\t\t\tids.forEach(id => deletePage(engine, id))\n\t\t\trecord(\"site_page_bulk_delete\", getBulkDeleteData(ids.size, pageType))\n\t\t},\n\t\tconfirmLabel: \"Delete\",\n\t\tsource: \"delete_pages\",\n\t\tkeyboardConfirmMode: \"Enter\",\n\t})\n}\n\nfunction getBulkDeleteData(\n\tcount: number,\n\tpageType: Exclude<ContentPanelPage, \"routes\">,\n): { count: number; section: Exclude<ContentPanelPage, \"routes\">; source: \"context_menu\" } {\n\treturn {\n\t\tcount,\n\t\tsection: pageType,\n\t\tsource: \"context_menu\",\n\t}\n}\n", "import { assert, emptySet } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCanvasPageNode,\n\tisDesignPageNode,\n\tisKitPageNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport { useCallback, useRef, useState } from \"react\"\nimport { getFirstItemFromIterable } from \"utils/getFirstItemFromIterable.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { useActiveContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { isRangeSelecting, isToggleSelecting } from \"../shared/utils/panelMultiSelect.ts\"\n\nconst pageTypeGuardMap: Record<ContentPanelPage, (node: unknown) => boolean> = {\n\tdesign: isDesignPageNode,\n\tcanvas: isCanvasPageNode,\n\troutes: isWebPageNode,\n\tkit: isKitPageNode,\n}\n\nfunction getSelectedPageIdFromActivePage(\n\tpageType: ContentPanelPage,\n\tactivePageId: NodeID | undefined,\n): ReadonlySet<NodeID> {\n\tconst node = engine.tree.getNode(activePageId)\n\n\t// If the type guard passes, type casting is safe.\n\tif (isUndefined(activePageId) || !pageTypeGuardMap[pageType](node)) return emptySet<NodeID>()\n\n\tconst selectedSegmentIds: Set<NodeID> = new Set()\n\tselectedSegmentIds.add(activePageId)\n\n\treturn selectedSegmentIds\n}\n\nfunction handlePageSelection(pageId: NodeID | undefined) {\n\tif (isUndefined(pageId)) return\n\tif (pageId === engine.stores.scopeStore.active.id) return\n\tif (!engine.stores.loadingStore.hasMinimalEditableData) return\n\n\tengine.stores.canvasStore.invalidateTransformUntilRendered(() => {\n\t\tengine.stores.scopeStore.select(pageId, { keepHistory: false })\n\t})\n}\n\ninterface PagesMultiSelect {\n\tselectedPages: ReadonlySet<NodeID>\n\t/**\n\t *\n\t * @param pageId The NodeID or special ID for a particular page. This is relevant for `routes`, which needs to\n\t * construct a special ID.\n\t * @param allowSingleClick If a value can be added to the multi select but should not trigger a single-select action\n\t * (likely because its value is not a scope node), then this can be set to false to prevent that case. This is the\n\t * case for RouteSegment folders, which do not have a webPageId.\n\t * @param scopeNodeToSelect If provided, this will be used to change the active scope. This is needed\n\t * for control AB variants, as their selection ID is not 1:1 with a WebPageNode.\n\t */\n\thandlePageClick: (pageId: NodeID, allowSingleClick?: boolean, scopeNodeToSelect?: NodeID) => void\n\tgetIsPageSelected: (pageId: NodeID) => boolean\n\t/** Reset the selection state. If no ID is provided, it will be cleared. */\n\tresetSelection: (initialId?: NodeID) => void\n}\n\nexport function usePagesMultiSelect(\n\tpageType: ContentPanelPage,\n\tgetRenderedIds: () => readonly NodeID[],\n\tactivePageId: NodeID | undefined,\n): PagesMultiSelect {\n\tconst lastSelectedIdRef = useRef<NodeID | null>(null)\n\n\tconst [selectedPages, setSelectedPages] = useState<ReadonlySet<NodeID>>(() =>\n\t\tgetSelectedPageIdFromActivePage(pageType, activePageId),\n\t)\n\n\tconst [prevActivePageId, setPrevActivePageId] = useState<NodeID | undefined>(activePageId)\n\n\tconst resetSelection = useCallback((initialId?: NodeID) => {\n\t\tsetSelectedPages(initialId ? new Set([initialId]) : emptySet<NodeID>())\n\t\tlastSelectedIdRef.current = initialId ?? null\n\t}, [])\n\n\t// This is used for clicks outside of the panel. The active page id should theoretically\n\t// not have changed. If it did, then the whole scope is updated, and the selection will\n\t// be reset.\n\tconst resetSelectionWithActivePageId = useStableCallback(() => {\n\t\tconst selectedIds = getSelectedPageIdFromActivePage(pageType, activePageId)\n\t\tconst firstSelectedId = getFirstItemFromIterable(selectedIds)\n\t\tresetSelection(firstSelectedId)\n\t})\n\n\tconst registerPageClick = useActiveContentPanelPage(pageType, resetSelection, resetSelectionWithActivePageId)\n\n\tconst handlePageClick = useEngineCallback(\n\t\t(pageId: NodeID, allowSingleClick = true, scopeNodeToSelect?: NodeID) => {\n\t\t\tregisterPageClick()\n\n\t\t\tif (isToggleSelecting()) {\n\t\t\t\tconst renderedOrderIds = getRenderedIds()\n\t\t\t\tconst newSelectedIds = getIntersection(renderedOrderIds, selectedPages)\n\t\t\t\tif (newSelectedIds.has(pageId)) {\n\t\t\t\t\tnewSelectedIds.delete(pageId)\n\t\t\t\t} else {\n\t\t\t\t\tnewSelectedIds.add(pageId)\n\t\t\t\t}\n\n\t\t\t\t// If no items selected, clear state.\n\t\t\t\tif (newSelectedIds.size === 0) {\n\t\t\t\t\tlastSelectedIdRef.current = null\n\t\t\t\t} else {\n\t\t\t\t\t// If the item was added to selection, make it the new last selected.\n\t\t\t\t\t// This allows subsequent range selections to start from this item.\n\t\t\t\t\tlastSelectedIdRef.current = newSelectedIds.has(pageId) ? pageId : lastSelectedIdRef.current\n\t\t\t\t}\n\n\t\t\t\tsetSelectedPages(newSelectedIds)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isRangeSelecting()) {\n\t\t\t\t// If no last selected exists, and the set is empty, initialize selection with target item.\n\t\t\t\tif (!lastSelectedIdRef.current && selectedPages.size === 0) {\n\t\t\t\t\tlastSelectedIdRef.current = pageId\n\t\t\t\t\tsetSelectedPages(new Set([pageId]))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst renderedOrderIds = getRenderedIds()\n\n\t\t\t\t// Calculate the range indices between last selected and target\n\t\t\t\tconst [from, to] = findSelectionIndices(\n\t\t\t\t\trenderedOrderIds,\n\t\t\t\t\tpageId,\n\t\t\t\t\tlastSelectedIdRef.current ?? getFirstItemFromIterable(selectedPages),\n\t\t\t\t)\n\t\t\t\t// If either index cannot be found, do nothing.\n\t\t\t\tif (from === -1 || to === -1) return\n\n\t\t\t\tconst updatedSelectedIds = getIntersection(renderedOrderIds, selectedPages)\n\n\t\t\t\t// Add all items in the new range (from last selected to target)\n\t\t\t\tfor (let i = from; i <= to; i += 1) {\n\t\t\t\t\tconst idToAdd = renderedOrderIds[i]\n\t\t\t\t\tassert(!isUndefined(idToAdd), \"Invalid visual order\")\n\t\t\t\t\tupdatedSelectedIds.add(idToAdd)\n\t\t\t\t}\n\n\t\t\t\tlastSelectedIdRef.current = pageId\n\t\t\t\tsetSelectedPages(updatedSelectedIds)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If the there are are no key modifiers, do a single click.\n\t\t\tif (allowSingleClick) handlePageSelection(scopeNodeToSelect ?? pageId)\n\t\t\tsetSelectedPages(new Set([pageId]))\n\t\t\tlastSelectedIdRef.current = pageId\n\t\t},\n\t\t[selectedPages, getRenderedIds, registerPageClick],\n\t)\n\n\tconst getIsPageSelected = useCallback((pageId: NodeID) => selectedPages.has(pageId), [selectedPages])\n\n\t// If the active page changes outside of a selection, such as deleting or duplicating a page,\n\t// the hook must reset the selection to the new active page.\n\tif (prevActivePageId !== activePageId) {\n\t\tconst selectedIds = getSelectedPageIdFromActivePage(pageType, activePageId)\n\t\tconst firstSelectedId = getFirstItemFromIterable(selectedIds)\n\t\tresetSelection(firstSelectedId)\n\t\tsetPrevActivePageId(activePageId)\n\t}\n\n\treturn {\n\t\tselectedPages,\n\t\thandlePageClick,\n\t\tresetSelection,\n\t\tgetIsPageSelected,\n\t}\n}\n\nfunction findSelectionIndices(\n\torderedIds: readonly NodeID[],\n\ttarget: NodeID,\n\trangeStart: NodeID | undefined,\n): [number, number] {\n\tconst targetIndex = orderedIds.indexOf(target)\n\tconst rangeStartIndex = rangeStart ? orderedIds.indexOf(rangeStart) : -1\n\n\tif (targetIndex === -1 || rangeStartIndex === -1) return [-1, -1]\n\n\treturn [Math.min(targetIndex, rangeStartIndex), Math.max(targetIndex, rangeStartIndex)]\n}\n\nfunction getIntersection(renderedIds: readonly NodeID[], selectedIds: ReadonlySet<NodeID>): Set<NodeID> {\n\tconst updatedSelectedIds: Set<NodeID> = new Set()\n\tfor (const id of renderedIds) {\n\t\tif (!selectedIds.has(id)) continue\n\t\tupdatedSelectedIds.add(id)\n\t}\n\treturn updatedSelectedIds\n}\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport React, { useRef } from \"react\"\nimport { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { DraggablePageRow } from \"./DraggablePageRow.tsx\"\nimport { usePagesMultiSelect } from \"./usePagesMultiSelect.ts\"\n\nexport interface Row {\n\tid: NodeID\n\tname?: string | null\n}\n\ninterface Props {\n\tisViewOnly: boolean\n\trows: Row[]\n\tactivePageId: NodeID\n}\n\nexport function DesignPages({ isViewOnly, rows, activePageId }: Props) {\n\tconst rowsRef = React.useRef(rows)\n\trowsRef.current = rows\n\n\tconst getRenderedIds = useStableCallback(() => rows.map(row => row.id))\n\n\tconst { handlePageClick, getIsPageSelected } = usePagesMultiSelect(\n\t\tContentPanelPage.Design,\n\t\tgetRenderedIds,\n\t\tactivePageId,\n\t)\n\n\tif (rows.length === 0) return null\n\n\treturn (\n\t\t<div style={{ marginBottom: dimensions.css.panelPadding }}>\n\t\t\t{rows.map(row => (\n\t\t\t\t<WithRefDraggablePageRow\n\t\t\t\t\tkey={row.id}\n\t\t\t\t\tid={row.id}\n\t\t\t\t\tpageType={ContentPanelPage.Design}\n\t\t\t\t\trows={rowsRef}\n\t\t\t\t\tname={row.name ?? \"\"}\n\t\t\t\t\tisEnabled={!isViewOnly && rows.length > 1}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\thandlePageClick={() => handlePageClick(row.id)}\n\t\t\t\t\tgetRenderedIds={getRenderedIds}\n\t\t\t\t\tgetIsPageSelected={getIsPageSelected}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nfunction withRefDraggablePageRow<T>(Component: React.ComponentType<T>) {\n\treturn function WithRefDraggablePageRow(props: T) {\n\t\tconst ref = useRef<HTMLDivElement>(null)\n\t\treturn <Component {...props} ref={ref} />\n\t}\n}\n\nconst WithRefDraggablePageRow = withRefDraggablePageRow(DraggablePageRow)\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport { memo, useRef } from \"react\"\nimport { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { DraggablePageRow } from \"./DraggablePageRow.tsx\"\nimport { usePagesMultiSelect } from \"./usePagesMultiSelect.ts\"\n\nexport interface Row {\n\tid: NodeID\n\tname?: string | null\n\tcount?: number\n\tdataIdentifier?: string\n}\n\ninterface Props {\n\tisViewOnly: boolean\n\trows: Row[]\n\tactivePageId: NodeID\n}\n\nexport const KitPages = memo(function KitPages({ isViewOnly, rows, activePageId }: Props) {\n\tconst rowsRef = useRef<Row[]>(rows)\n\trowsRef.current = rows\n\n\tconst getRenderedIds = useStableCallback(() => rows.map(row => row.id))\n\n\tconst { handlePageClick, getIsPageSelected } = usePagesMultiSelect(ContentPanelPage.Kit, getRenderedIds, activePageId)\n\n\tif (rows.length === 0) return null\n\n\treturn (\n\t\t<div style={{ marginBottom: dimensions.css.panelPadding }}>\n\t\t\t{rows.map(row => (\n\t\t\t\t<WithRefDraggablePageRow\n\t\t\t\t\tkey={row.id}\n\t\t\t\t\tid={row.id}\n\t\t\t\t\tpageType={ContentPanelPage.Kit}\n\t\t\t\t\trows={rowsRef}\n\t\t\t\t\tname={row.name ?? \"\"}\n\t\t\t\t\tdataIdentifier={row.dataIdentifier}\n\t\t\t\t\tisEnabled={!isViewOnly && rows.length > 1}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\thandlePageClick={() => handlePageClick(row.id)}\n\t\t\t\t\tgetRenderedIds={getRenderedIds}\n\t\t\t\t\tgetIsPageSelected={getIsPageSelected}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t)\n})\n\nfunction withRefDraggablePageRow<T>(Component: React.ComponentType<T>) {\n\treturn function WithRefDraggablePageRow(props: T) {\n\t\tconst ref = useRef<HTMLDivElement>(null)\n\t\treturn <Component {...props} ref={ref} />\n\t}\n}\n\nconst WithRefDraggablePageRow = withRefDraggablePageRow(DraggablePageRow)\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tROUTE_SEGMENT_ROOT_NODE_ID,\n\ttype RouteSegmentRootNode,\n} from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tisRouteSegmentNode,\n\tisRouteSegmentRootNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type { LocaleId, Locale as RouterLocale } from \"library/router/types.ts\"\nimport { startTransition, useEffect, useLayoutEffect, useMemo, useRef } from \"react\"\nimport { getRouterLocales } from \"utils/getRouterLocales.ts\"\nimport { getLocalizedValueForActiveLocale } from \"../localization/getValueForActiveLocale.ts\"\nimport { CollapsibleRowDivider } from \"../shared/CollapsibleRow.tsx\"\nimport type { Folder, WebPage } from \"./RouteSegment.types.ts\"\nimport { RouteSegmentRow } from \"./RouteSegmentRow.tsx\"\nimport { RouteSegmentVariantRow } from \"./RouteSegmentVariantRow.tsx\"\nimport * as styles from \"./RouteSegments.styles.ts\"\nimport { useRouteSegmentList } from \"./useRouteSegmentList.tsx\"\nimport type { RouteSegmentRenderRow } from \"./useRouteSegmentList.types.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"./utils/getRouteSegmentNodeByWebPageId.ts\"\n\ninterface Props {\n\troutes: readonly (WebPage | Folder)[]\n\tisViewOnly: boolean\n\tisFiltering: boolean\n\tshowHomePage: boolean\n\tisHomePageAbTesting: boolean\n\thomePageId: NodeID\n\texpandableRouteSegmentIds?: ReadonlySet<NodeID>\n\tmatchingRouteSegmentIds?: ReadonlySet<NodeID>\n}\n\nexport function RouteSegments({\n\troutes,\n\tisViewOnly,\n\tisFiltering,\n\texpandableRouteSegmentIds,\n\tmatchingRouteSegmentIds,\n\tshowHomePage,\n\thomePageId,\n\tisHomePageAbTesting,\n}: Props) {\n\tconst hasFilteredRef = useRef(false)\n\n\tconst rootRouteSegmentNode = useEngineState(\n\t\t() => getRouteSegmentRootNode(engine.tree),\n\t\t[ROUTE_SEGMENT_ROOT_NODE_ID],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst routerLocales = useEngineState(() => getRouterLocales(engine.tree, \"includeDrafts\"), [], [EngineChange.Tree])\n\tconst canvasLocaleId = engine.stores.chromeStore.useState(state => state.canvasLocaleId)\n\n\tconst pathConflicts = useMemo(\n\t\t() => buildPathConflictMap(rootRouteSegmentNode, routerLocales),\n\t\t[rootRouteSegmentNode, routerLocales],\n\t)\n\n\tuseEffect(() => {\n\t\tif (!pathConflicts.size) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst conflictParentIds = new Set<NodeID>()\n\t\t\tfor (const [nodeId] of pathConflicts) {\n\t\t\t\tconst parentNodeId = engine.tree.getParent(nodeId)?.id\n\t\t\t\tif (!parentNodeId || parentNodeId === ROUTE_SEGMENT_ROOT_NODE_ID) continue\n\t\t\t\tif (conflictParentIds.has(parentNodeId)) continue\n\t\t\t\tconflictParentIds.add(parentNodeId)\n\t\t\t\tengine.stores.chromeStore.expandRouteSegment(parentNodeId)\n\t\t\t}\n\t\t}, \"nonUserEvent\")\n\t}, [pathConflicts])\n\n\t// Create a stable reference to the map for passing to children\n\tconst { activePageId, activeRouteSegmentIds } = useEngineState(\n\t\t() => {\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\t\t\tif (!isWebPageNode(activeScope)) return {}\n\n\t\t\tconst activePageId = activeScope.id\n\t\t\tconst segment = getRouteSegmentNodeByWebPageId(engine.tree, activePageId)\n\t\t\tif (!segment) return { activePageId }\n\n\t\t\treturn {\n\t\t\t\tactivePageId,\n\t\t\t\tactiveRouteSegmentIds: new Set(engine.tree.getAncestors(segment.id)),\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.scopeStore],\n\t\t// Compare resulting state with deep equals, so we only re-render if the\n\t\t// `activeRouteSegmentIds` set has actually changed.\n\t\t{ deepEqual: true },\n\t)\n\n\tuseLayoutEffect(() => {\n\t\tif (!isFiltering || !expandableRouteSegmentIds || expandableRouteSegmentIds.size === 0) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.chromeStore.expandRouteSegment(expandableRouteSegmentIds)\n\t\t})\n\t}, [isFiltering, expandableRouteSegmentIds])\n\n\tuseLayoutEffect(() => {\n\t\tif (isFiltering) {\n\t\t\thasFilteredRef.current = true\n\t\t\treturn\n\t\t}\n\n\t\tif (hasFilteredRef.current) {\n\t\t\thasFilteredRef.current = false\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tstartTransition(() => {\n\t\t\t\t\tengine.stores.chromeStore.collapseAllRouteSegments()\n\n\t\t\t\t\tif (!activePageId) return\n\n\t\t\t\t\t// To expand the active node, we must expand all its route segment parents.\n\t\t\t\t\tconst activePageRouteSegment = getRouteSegmentNodeByWebPageId(engine.tree, activePageId)\n\t\t\t\t\tif (!activePageRouteSegment || !activePageRouteSegment.parentid) return\n\n\t\t\t\t\tconst parentRouteSegmentsToExpand: Set<NodeID> = new Set()\n\t\t\t\t\tfor (const ancestor of activePageRouteSegment.ancestors()) {\n\t\t\t\t\t\tif (!isRouteSegmentNode(ancestor)) continue\n\t\t\t\t\t\tparentRouteSegmentsToExpand.add(ancestor.id)\n\t\t\t\t\t}\n\n\t\t\t\t\tengine.stores.chromeStore.expandRouteSegment(parentRouteSegmentsToExpand)\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t}, [isFiltering, activePageId])\n\n\tconst homePageConfig = useMemo(\n\t\t() => ({\n\t\t\tshowHomePage,\n\t\t\thomePageId,\n\t\t\tisHomePageAbTesting,\n\t\t}),\n\t\t[showHomePage, homePageId, isHomePageAbTesting],\n\t)\n\n\tconst sharedProps = useEngineState(\n\t\t() => {\n\t\t\tconst { isPreviewingLocaleOnCanvas, canvasLocaleId } = engine.stores.chromeStore\n\t\t\tconst canvasLocale = engine.tree.root.getNonDefaultLocale(canvasLocaleId)\n\t\t\tconst routerLocales = getRouterLocales(engine.tree, \"includeDrafts\")\n\t\t\tconst routerLocale = routerLocales.find(locale => locale.id === canvasLocale?.id) || routerLocales[0]\n\n\t\t\treturn {\n\t\t\t\tisViewOnly,\n\t\t\t\tactiveRouteSegmentIds,\n\t\t\t\tisPreviewingLocaleOnCanvas,\n\t\t\t\tactiveRouterLocale: routerLocale,\n\t\t\t\tactiveCanvasLocale: canvasLocale,\n\t\t\t}\n\t\t},\n\t\t[isViewOnly, activeRouteSegmentIds],\n\t\t[EngineChange.Tree, engine.stores.chromeStore],\n\t)\n\n\tconst {\n\t\trouteSegmentList,\n\t\tgetIsRouteSegmentSelected,\n\t\tgetSelectedRows,\n\t\tgetDraggableRouteSegmentNodes,\n\t\thandleSegmentClick,\n\t\tresetSelection,\n\t} = useRouteSegmentList(\n\t\thomePageConfig,\n\t\tsharedProps,\n\t\tisFiltering,\n\t\tactivePageId,\n\t\tcanvasLocaleId,\n\t\tmatchingRouteSegmentIds,\n\t\troutes,\n\t)\n\n\tif (routeSegmentList.length === 0) return null\n\n\treturn (\n\t\t<div className={cx(styles.panelContainer, styles.disableHorizontalOverflowWhenDragging)}>\n\t\t\t{routeSegmentList.map(row => {\n\t\t\t\tswitch (row.type) {\n\t\t\t\t\tcase \"home\":\n\t\t\t\t\tcase \"webPage\":\n\t\t\t\t\tcase \"folder\": {\n\t\t\t\t\t\t// The original way that selection was calculated has already been done\n\t\t\t\t\t\t// in the preparation.\n\t\t\t\t\t\tconst isSelected = getIsRouteSegmentSelected({\n\t\t\t\t\t\t\twebPageId: row.webPageId,\n\t\t\t\t\t\t\tsegmentId: row.segmentId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<RouteSegmentRow\n\t\t\t\t\t\t\t\tkey={keyForType(row)}\n\t\t\t\t\t\t\t\t{...row}\n\t\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\t\tonClick={handleSegmentClick}\n\t\t\t\t\t\t\t\tgetSelectedRows={getSelectedRows}\n\t\t\t\t\t\t\t\tgetDraggableRouteSegmentNodes={getDraggableRouteSegmentNodes}\n\t\t\t\t\t\t\t\tresetSelection={resetSelection}\n\t\t\t\t\t\t\t\tpathConflictLocales={\n\t\t\t\t\t\t\t\t\trow.segmentId && pathConflicts.has(row.segmentId) ? pathConflicts.get(row.segmentId) : 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)\n\t\t\t\t\t}\n\t\t\t\t\tcase \"variant\": {\n\t\t\t\t\t\tconst { type: _type, ...variantRow } = row\n\t\t\t\t\t\t// The original way that selection was calculated has already been done\n\t\t\t\t\t\t// in the preparation.\n\t\t\t\t\t\tconst isSelected = getIsRouteSegmentSelected({ webPageId: row.webPageId })\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<RouteSegmentVariantRow\n\t\t\t\t\t\t\t\tkey={keyForType(row)}\n\t\t\t\t\t\t\t\t{...variantRow}\n\t\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\t\tonClick={handleSegmentClick}\n\t\t\t\t\t\t\t\tgetSelectedRows={getSelectedRows}\n\t\t\t\t\t\t\t\tgetDraggableRouteSegmentNodes={getDraggableRouteSegmentNodes}\n\t\t\t\t\t\t\t\tresetSelection={resetSelection}\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\tcase \"divider\":\n\t\t\t\t\t\treturn <CollapsibleRowDivider key={keyForType(row)} depth={row.depth} />\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn assertNever(row)\n\t\t\t\t}\n\t\t\t})}\n\t\t</div>\n\t)\n}\n\nfunction keyForType(row: RouteSegmentRenderRow): string {\n\tswitch (row.type) {\n\t\tcase \"home\":\n\t\t\treturn `${row.webPageId}`\n\t\tcase \"webPage\":\n\t\tcase \"folder\":\n\t\t\treturn `${row.segmentId}`\n\t\tcase \"variant\":\n\t\t\treturn `${row.webPageId}-variant`\n\t\tcase \"divider\":\n\t\t\treturn `${row.segmentId}-divider`\n\t\tdefault:\n\t\t\treturn assertNever(row)\n\t}\n}\n\nfunction addPathConflict(nodesWithConflictingPaths: Map<NodeID, LocaleId[]>, nodeId: NodeID, localeName: string) {\n\tconst existingLocalesForNode = nodesWithConflictingPaths.get(nodeId)\n\tif (existingLocalesForNode) {\n\t\texistingLocalesForNode.push(localeName)\n\t} else {\n\t\tnodesWithConflictingPaths.set(nodeId, [localeName])\n\t}\n}\n\nfunction buildPathConflictMap(routeSegmentRootNode: RouteSegmentRootNode, routerLocales: readonly RouterLocale[]) {\n\tconst nodesWithConflictingPaths: Map<NodeID, LocaleId[]> = new Map()\n\n\tfor (const node of routeSegmentRootNode.walk()) {\n\t\tif (!isRouteSegmentNode(node) && !isRouteSegmentRootNode(node)) continue\n\t\tif (node.children.length === 0) continue\n\n\t\tfor (const locale of routerLocales) {\n\t\t\tconst pathsAndUsages = new Map<string, NodeID[]>()\n\n\t\t\tfor (const sibling of node.children) {\n\t\t\t\tif (!isRouteSegmentNode(sibling)) continue\n\t\t\t\tif (sibling.dataIdentifier) continue\n\n\t\t\t\tconst localizedValue = getLocalizedValueForActiveLocale(locale, sibling.segmentLocalized)\n\t\t\t\tconst effectivePath = localizedValue?.value || sibling.segment\n\n\t\t\t\t// Track the initial use of the path\n\t\t\t\tconst existingNodesUsingPath = pathsAndUsages.get(effectivePath)\n\t\t\t\tif (!existingNodesUsingPath) {\n\t\t\t\t\tpathsAndUsages.set(effectivePath, [sibling.id])\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst localeName = locale.name\n\n\t\t\t\t// If we have previously found 1 node using the path then we now need to add that\n\t\t\t\t// one to the conflict map as well as the latest one.\n\t\t\t\tif (existingNodesUsingPath.length === 1) {\n\t\t\t\t\tassert(existingNodesUsingPath[0])\n\t\t\t\t\taddPathConflict(nodesWithConflictingPaths, existingNodesUsingPath[0], localeName)\n\t\t\t\t}\n\n\t\t\t\t// Keep track of all the nodes using the path so we don't re-add the first node to\n\t\t\t\t// the conflict map for future clashes.\n\t\t\t\texistingNodesUsingPath.push(sibling.id)\n\n\t\t\t\taddPathConflict(nodesWithConflictingPaths, sibling.id, localeName)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodesWithConflictingPaths\n}\n", "import { Draggable } from \"@framerjs/fresco/layout-transitions\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { isPageConvertibleToKit } from \"app/ai/utils/kitProject.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { experimentIsOnOrForceEnabled, useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { EngineContext } from \"document/base-engine/BaseEngine.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport { ANALYTICS_SCOPE_ID, AnalyticsScopeNode } from \"document/models/CanvasTree/nodes/AnalyticsScopeNode.ts\"\nimport { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isRouteSegmentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { customNotFoundPageSegments } from \"library/router/customNotFoundPagePaths.ts\"\nimport type { LocaleId, Locale as RouterLocale } from \"library/router/types.ts\"\nimport type React from \"react\"\nimport { memo, useCallback, useEffect, useRef } from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { editInCMS } from \"utils/collectionUtils.ts\"\nimport { useScrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { addFirstAbVariantIfNeeded } from \"../analytics/utils/addFirstAbVariantIfNeeded.ts\"\nimport { openAnalyticsFromWebPage } from \"../analytics/utils/openAnalytics.ts\"\nimport { promptAddAbVariant } from \"../analytics/utils/promptAddAbVariant.ts\"\nimport { promptStopAbTest } from \"../analytics/utils/promptStopAbTest.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { canReplaceWebPage } from \"../shared/ReplaceWebPageModal.tsx\"\nimport { showPageExistsToast } from \"../shared/showPageExistsToast.ts\"\nimport { getNodeData } from \"../shared/utils/getNodeData.ts\"\nimport { selectedSibling } from \"../shared/utils/panelMultiSelect.styles.ts\"\nimport { getPathVariablesWarningMessage } from \"../siteSettings/pathVariables.ts\"\nimport type { Folder, HomePage, WebPage } from \"./RouteSegment.types.ts\"\nimport * as styles from \"./RouteSegmentRow.styles.ts\"\nimport { getRouteSegmentMultiSelectMenu, shouldShowMultiSelectMenu } from \"./getRouteSegmentMultiSelectMenu.ts\"\nimport type { SelectableRouteSegmentRenderRow } from \"./useRouteSegmentList.types.ts\"\nimport { getDragPreviewRows, useRouteSegmentRowDragDrop } from \"./useRouteSegmentRowDragDrop.tsx\"\nimport { convertFolderToWebPage } from \"./utils/convertSegmentRoute.ts\"\nimport { duplicateWebPage } from \"./utils/duplicatePage.ts\"\nimport { editPageTitle, getPageInputId } from \"./utils/editPageRow.ts\"\nimport { getRawRouteSegmentFullPath, getReadableRouteSegmentFullPath } from \"./utils/getRouteSegmentFullPath.ts\"\nimport { getRouteSegmentIcon } from \"./utils/getRouteSegmentIcon.tsx\"\nimport { getRouteSegmentRowLabels } from \"./utils/getRouteSegmentRowLabels.ts\"\nimport { getTranslateContentMenuItem } from \"./utils/getTranslateContentMenuItem.ts\"\nimport { promptAndDeleteSegment } from \"./utils/promptAndDeleteRouteSegment.ts\"\nimport { promptAndDeleteSegmentWithReferenceCheck } from \"./utils/promptAndDeleteSegmentWithReferenceCheck.tsx\"\nimport { setHomePage } from \"./utils/setHomePage.ts\"\nimport { markPageAsDraftWithConfirmation, undraftPage } from \"./utils/setPageDraftStatus.ts\"\nimport { sortRouteSegmentsAlphabetically } from \"./utils/sortRouteSegments.ts\"\nimport { doesPathExist, updateRouteSegmentPath } from \"./utils/updateRouteSegmentPath.ts\"\nimport { useLocalizedPathRenameHandler } from \"./utils/useLocalizedPathRenameHandler.ts\"\n\nexport interface BaseProps {\n\tdepth: number\n\tisViewOnly: boolean\n\tisCollapsible: boolean\n\tcanSortRouteSegmentsAlphabetically: boolean\n\tisExpanded: boolean\n\tisSelected: boolean\n\tisPreviewingLocaleOnCanvas?: boolean\n\tactiveRouteSegmentIds?: ReadonlySet<NodeID>\n\tonClick: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => void\n\tgetDraggableRouteSegmentNodes: () => readonly RouteSegmentNode[]\n\tgetSelectedRows: () => readonly SelectableRouteSegmentRenderRow[]\n\tresetSelection?: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => void\n\tactiveRouterLocale?: RouterLocale | undefined\n\tactiveCanvasLocale?: Locale | undefined\n\tpathConflictLocales?: LocaleId[]\n}\n\nexport type HomePageProps = HomePage & {\n\tcanAddAbTestingVariant: boolean\n}\n\nexport type WebPageProps = WebPage & {\n\tcanAddAbTestingVariant: boolean\n}\n\nexport interface FolderProps extends Folder {\n\tcanAddAbTestingVariant?: never\n}\n\nexport type Props = BaseProps & (HomePageProps | WebPageProps | FolderProps)\n\nexport const RouteSegmentRow = memo<Props>(function RouteSegmentRow({\n\tdepth,\n\tsegmentId,\n\tsegment,\n\tactiveRouteSegmentIds,\n\tisViewOnly,\n\twebPageId,\n\ttype,\n\tcollectionId,\n\tcollectionName,\n\tcollectionItemCount,\n\tisDraft,\n\tisAbTesting,\n\tisPreviewingLocaleOnCanvas,\n\tfullPath,\n\ttrailingSlashSegmentParentId,\n\tselfOrAncestorDataIdentifier,\n\tisCollapsible,\n\tcanSortRouteSegmentsAlphabetically,\n\tisExpanded,\n\tisSelected,\n\tcanAddAbTestingVariant,\n\tonClick,\n\tgetDraggableRouteSegmentNodes,\n\tgetSelectedRows,\n\tresetSelection,\n\tactiveRouterLocale,\n\tactiveCanvasLocale,\n\tpathConflictLocales,\n}) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst isKitProject = useExperimentIsOn(\"wireframerKits\") && projectFeatures.isOn(\"kit\")\n\tconst isHomePage = type === \"home\"\n\tconst isCollection = Boolean(collectionId)\n\tconst isCollectionOrCollectionChild = Boolean(isCollection || selfOrAncestorDataIdentifier)\n\tconst isEditable = !isViewOnly && !isHomePage && !isPreviewingLocaleOnCanvas\n\tconst shouldAutoExpand =\n\t\tfullPath && isInActiveRoutesPath(segmentId, trailingSlashSegmentParentId, activeRouteSegmentIds)\n\tconst renamingEnabled = !isViewOnly && !isHomePage\n\tconst pathTranslationEnabled = engine.tree.root.translatePagePaths === \"yes\"\n\tconst localizedRenamingEnabled =\n\t\trenamingEnabled && !!segment && !isCollection && pathTranslationEnabled && !customNotFoundPageSegments.has(segment)\n\tconst displayTitle = isHomePage ? Dictionary.Home : (collectionName ?? `/${segment}`)\n\t// We don't want to allow users to modify the entire route when they're just editing the localized path.\n\tconst editingTitle = isPreviewingLocaleOnCanvas ? displayTitle : fullPath\n\tconst isViewOnlyOrPreviewingLocale = isViewOnly || !!isPreviewingLocaleOnCanvas\n\n\tconst rowRef = useRef<HTMLDivElement>(null)\n\tuseScrollIntoView(rowRef, isSelected)\n\n\tusePreloadedScope(ANALYTICS_SCOPE_ID)\n\n\tconst abTestFunnel = useEngineState(\n\t\t() => {\n\t\t\tconst analyticsScope = AnalyticsScopeNode.get(engine.tree)\n\t\t\tconst loadedAnalyticsScope = analyticsScope?.loaded\n\n\t\t\t// If the scope exists, we need it to be loaded\n\t\t\tif (analyticsScope && !loadedAnalyticsScope) return\n\n\t\t\tconst webPage = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)\n\t\t\tif (!webPage) return\n\n\t\t\tconst abTestingFunnel = webPage.getAbTestingFunnel(loadedAnalyticsScope)\n\t\t\treturn abTestingFunnel\n\t\t},\n\t\t[webPageId],\n\t\t[engine.stores.scopeStore, EngineChange.Tree],\n\t)\n\n\tuseEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tif (shouldAutoExpand && segmentId) {\n\t\t\t\tengine.stores.chromeStore.expandRouteSegment(segmentId)\n\t\t\t}\n\t\t}, \"nonUserEvent\")\n\t}, [shouldAutoExpand, segmentId])\n\n\tconst toggleCollapse = useEngineCallback(() => {\n\t\t// when no segmentId is defined, it means we are at the root level (Home Page)\n\t\tengine.stores.chromeStore.toggleRouteSegmentRow(segmentId ?? ROUTE_SEGMENT_ROOT_NODE_ID)\n\t}, [segmentId])\n\n\tconst handlePathChange = useEngineCallback(\n\t\t(_id: string, newFullPath: string, _final: boolean, reset: () => void) => {\n\t\t\tif (isViewOnly || type === \"home\") return\n\t\t\tif (newFullPath === fullPath) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst isValidPath = validatePath(newFullPath, segmentId, webPageId)\n\t\t\tif (!isValidPath) return\n\n\t\t\tconst wasExpandedBeforeUpdate = engine.stores.chromeStore.isExpandedRouteSegment(segmentId)\n\t\t\tconst updatedRouteSegment = updateRouteSegmentPath(\n\t\t\t\tsegmentId,\n\t\t\t\tnewFullPath,\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\t!!trailingSlashSegmentParentId,\n\t\t\t)\n\t\t\tif (wasExpandedBeforeUpdate && updatedRouteSegment) {\n\t\t\t\tengine.stores.chromeStore.expandRouteSegment(updatedRouteSegment.id)\n\t\t\t\tfor (const ancestor of updatedRouteSegment.ancestors()) {\n\t\t\t\t\tif (!isRouteSegmentNode(ancestor)) continue\n\t\t\t\t\tengine.stores.chromeStore.expandRouteSegment(ancestor.id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Ensure the selection state is current with the latest IDs. For example,\n\t\t\t// folders use route segment node IDs as its primary ID.\n\t\t\tif (updatedRouteSegment && resetSelection) {\n\t\t\t\tresetSelection({ webPageId, segmentId: updatedRouteSegment.id })\n\t\t\t}\n\t\t},\n\t\t[isViewOnly, type, fullPath, segmentId, webPageId, trailingSlashSegmentParentId, resetSelection],\n\t)\n\n\tconst handleLocalizedPathChange = useLocalizedPathRenameHandler({\n\t\tsegmentId,\n\t\ttrailingSlashSegmentParentId,\n\t\tactiveLocale: activeCanvasLocale,\n\t\tactiveRouterLocale,\n\t\tisViewOnly,\n\t\ttrackingSource: \"content_panel_pages\",\n\t})\n\n\tconst selectLastSegment = useCallback(\n\t\t(event: React.FocusEvent<HTMLInputElement>) => {\n\t\t\tif (!editingTitle) return\n\t\t\tif (isCollection) {\n\t\t\t\tevent.target.setSelectionRange(editingTitle.length, editingTitle.length)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst segmentWithoutSlash = displayTitle?.replace(/\\//gu, \"\")\n\t\t\tconst startPos = editingTitle.lastIndexOf(segmentWithoutSlash)\n\t\t\tconst endPos = startPos + segmentWithoutSlash.length\n\t\t\tevent.target.setSelectionRange(startPos, endPos)\n\t\t},\n\t\t[displayTitle, editingTitle, isCollection],\n\t)\n\n\tconst createPageInFolder = useEngineCallback(async () => {\n\t\tif (type !== \"folder\" || !segmentId) return\n\n\t\tconst folderPath = getRawRouteSegmentFullPath(engine.tree, engine.componentLoader, segmentId)\n\t\tconst pagePath = `${folderPath}/page`\n\t\tawait engine.createWebPage({ preferredPath: pagePath })\n\n\t\tengine.stores.chromeStore.expandRouteSegment(segmentId)\n\t}, [type, segmentId])\n\n\tconst showTranslateContentOption =\n\t\tengine.tree.root.hasAnyNonDefaultLocales() &&\n\t\texperimentIsOnOrForceEnabled(\"localizationAiUpdate\", engine.stores.previewStore.framerSiteId)\n\n\tconst getMenuOptions = useCallback((): MenuItemOptions[] => {\n\t\tconst selectedRows = getSelectedRows()\n\n\t\tif (shouldShowMultiSelectMenu(isSelected, selectedRows)) {\n\t\t\treturn getRouteSegmentMultiSelectMenu(engine, selectedRows, isViewOnlyOrPreviewingLocale, resetSelection)\n\t\t}\n\n\t\tconst renameActionIsForLocalizedPath = isPreviewingLocaleOnCanvas && activeRouterLocale && pathTranslationEnabled\n\t\tconst renamePathLabel = renameActionIsForLocalizedPath\n\t\t\t? `${Dictionary.Rename} in ${activeRouterLocale.name}`\n\t\t\t: Dictionary.Rename\n\n\t\tif (type === \"folder\") {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"New Page\",\n\t\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\t\tclick: createPageInFolder,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: renamePathLabel,\n\t\t\t\t\tenabled: isPreviewingLocaleOnCanvas ? localizedRenamingEnabled : renamingEnabled,\n\t\t\t\t\tclick: () => editPageTitle(segmentId),\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: isCollectionOrCollectionChild ? \"Convert to CMS Page\" : \"Convert to Page\",\n\t\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\t\tclick: () => convertFolderToWebPage(engine, segmentId),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.SortPagesAlphabetically,\n\t\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tif (!segmentId) return\n\t\t\t\t\t\tsortRouteSegmentsAlphabetically({\n\t\t\t\t\t\t\tsegmentId: trailingSlashSegmentParentId ?? segmentId,\n\t\t\t\t\t\t\tengine,\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\t{\n\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\t\tclick: () => promptAndDeleteSegment(engine, segmentId),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (!webPageId) return []\n\t\tconst webPageNode = engine.tree.get(webPageId)\n\t\tif (!isWebPageNode(webPageNode)) return []\n\n\t\t// Preload the page if it hasn't fully loaded yet. Most menu actions will need it to have\n\t\t// fully loaded, this speeds that up.\n\t\tif (!webPageNode.isLoaded()) {\n\t\t\tvoid engine.tree.getService(\"loader\")?.prioritizeLoadingScope(webPageId, { preload: true })\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Settings,\n\t\t\t\tenabled: engine.stores.loadingStore.hasMinimalEditableData,\n\t\t\t\tclick: async () => {\n\t\t\t\t\tawait engine.stores.siteSettingsStore.setActiveTab({\n\t\t\t\t\t\ttab: SiteSettingsTabNames.page,\n\t\t\t\t\t\tid: webPageId,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: `Edit in ${Dictionary.Cms}`,\n\t\t\t\tvisible: Boolean(selfOrAncestorDataIdentifier),\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!selfOrAncestorDataIdentifier) return\n\t\t\t\t\teditInCMS(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tselfOrAncestorDataIdentifier,\n\t\t\t\t\t\tengine.stores.scopeStore.getSelectedCollectionItemForWebPage(webPageNode),\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Draft,\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && !isHomePage,\n\t\t\t\tchecked: isDraft,\n\t\t\t\tclick: () => {\n\t\t\t\t\t// We use the captured `isDraft` instead of the latest `node.isDraft`, because if the user\n\t\t\t\t\t// intention is to, say, undraft the page, but somebody else already undrafted it while the\n\t\t\t\t\t// menu was open (we don't re-render open menus), we don't want to toggle it back on.\n\t\t\t\t\tif (isDraft) {\n\t\t\t\t\t\tundraftPage(engine, webPageId, \"context_menu\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmarkPageAsDraftWithConfirmation(engine, webPageId)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: renamePathLabel,\n\t\t\t\tenabled: !isHomePage && (isPreviewingLocaleOnCanvas ? localizedRenamingEnabled : renamingEnabled),\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (type === \"home\") return\n\t\t\t\t\teditPageTitle(segmentId)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.loadScopesThenProcess([webPageNode], ([loadedWebPageNode]): void => {\n\t\t\t\t\t\tif (!loadedWebPageNode) return\n\t\t\t\t\t\tduplicateWebPage(\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tloadedWebPageNode,\n\t\t\t\t\t\t\tloadedWebPageNode.getPrimaryVariant(),\n\t\t\t\t\t\t\tsegmentId ? getReadableRouteSegmentFullPath(engine.tree, engine.componentLoader, segmentId) : undefined,\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: Dictionary.Copy,\n\t\t\t\tenabled:\n\t\t\t\t\tengine.stores.loadingStore.hasMinimalEditableData && engine.stores.loadingStore.allModulesLoadedAndEvaluated,\n\t\t\t\tclick: async () => {\n\t\t\t\t\tconst loadedWebPageNode = await webPageNode.load()\n\t\t\t\t\tif (!loadedWebPageNode) return\n\n\t\t\t\t\tawait Clipboard.copy(engine, undefined, [webPageId])\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Copy Clipboard Data\",\n\t\t\t\tenabled:\n\t\t\t\t\tengine.stores.loadingStore.hasMinimalEditableData && engine.stores.loadingStore.allModulesLoadedAndEvaluated,\n\t\t\t\tvisible: employeesOnlySettings.isOn(\"moduleTools\"),\n\t\t\t\tclick: async () => {\n\t\t\t\t\tconst loadedWebPageNode = await webPageNode.load()\n\t\t\t\t\tif (!loadedWebPageNode) return\n\n\t\t\t\t\tconst data = getNodeData(engine, webPageId)\n\t\t\t\t\tconst json = JSON.stringify(data, null, 4)\n\t\t\t\t\tawait copyText(json)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled:\n\t\t\t\t\t!isViewOnlyOrPreviewingLocale && engine.stores.scopeStore.getRootScopeNodes().length > 1 && !isHomePage,\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (type === \"home\") return\n\t\t\t\t\tvoid promptAndDeleteSegmentWithReferenceCheck(engine, segmentId)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.SortPagesAlphabetically,\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && Boolean(segmentId),\n\t\t\t\tvisible: canSortRouteSegmentsAlphabetically,\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!segmentId) return\n\t\t\t\t\tsortRouteSegmentsAlphabetically({\n\t\t\t\t\t\tsegmentId: trailingSlashSegmentParentId ?? segmentId,\n\t\t\t\t\t\tengine,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: isAbTesting ? \"Add Variant\" : Dictionary.NewABTestEllipsis,\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && canAddAbTestingVariant,\n\t\t\t\tclick: () =>\n\t\t\t\t\tengine.loadScopesThenProcess(\n\t\t\t\t\t\t[webPageNode, AnalyticsScopeNode.get(engine.tree)],\n\t\t\t\t\t\t([webPage, analyticsScope]) =>\n\t\t\t\t\t\t\twebPage\n\t\t\t\t\t\t\t\t? isAbTesting\n\t\t\t\t\t\t\t\t\t? promptAddAbVariant(engine, webPage, analyticsScope, \"context_menu\")\n\t\t\t\t\t\t\t\t\t: addFirstAbVariantIfNeeded(engine, webPage, \"context_menu\")\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Stop A/B Test\u2026\",\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && isAbTesting,\n\t\t\t\tvisible: Boolean(abTestFunnel && abTestFunnel.status === FunnelStatus.Started),\n\t\t\t\tclick: () => abTestFunnel && promptStopAbTest(engine, abTestFunnel.id, \"context_menu\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"View Analytics\",\n\t\t\t\tclick: () => openAnalyticsFromWebPage(engine, webPageNode),\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: \"separator\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: isHomePage ? \"Home Page\" : \"Set Home Page\",\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && !isHomePage && !isDraft && !isCollectionOrCollectionChild,\n\t\t\t\tchecked: isHomePage,\n\t\t\t\tclick: () => setHomePage(engine, { segmentId, type, webPageId }),\n\t\t\t},\n\t\t\tgetTranslateContentMenuItem({\n\t\t\t\twebPageId,\n\t\t\t\tsegmentId,\n\t\t\t\tenabled: !isViewOnly && !getIsViewOnly(engine, \"canEditLocalizedValues\"),\n\t\t\t\tvisible: showTranslateContentOption,\n\t\t\t\tsource: \"context_menu\",\n\t\t\t}),\n\t\t\t{\n\t\t\t\ttype: \"separator\",\n\t\t\t\tvisible: showTranslateContentOption,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Replace This Page With\u2026\",\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale && canReplaceWebPage(webPageNode),\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.ReplaceWebPage,\n\t\t\t\t\t\toldNode: webPageNode,\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\t{\n\t\t\t\tlabel: \"Convert to CMS Page\u2026\",\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\tvisible: !isHomePage && !isCollectionOrCollectionChild,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.loadScopesThenProcess([webPageNode], ([loadedWebPageNode]): void => {\n\t\t\t\t\t\tif (!loadedWebPageNode) return\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.ConvertToCMSPage,\n\t\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t\t\twebPageId,\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: \"Convert to Kit Page\u2026\",\n\t\t\t\tenabled: !isViewOnlyOrPreviewingLocale,\n\t\t\t\tvisible: isKitProject && isPageConvertibleToKit(engine.tree, webPageNode),\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.ConvertToKitPage,\n\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t\twebPageIds: [webPageId],\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.ViewCustomCode,\n\t\t\t\tenabled: engine.stores.loadingStore.hasMinimalEditableData,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.siteSettingsStore\n\t\t\t\t\t\t.setActiveTab({\n\t\t\t\t\t\t\ttab: SiteSettingsTabNames.customCode,\n\t\t\t\t\t\t\tpageId: webPageId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch(unhandledError)\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\t}, [\n\t\ttype,\n\t\tisSelected,\n\t\tgetSelectedRows,\n\t\twebPageId,\n\t\tselfOrAncestorDataIdentifier,\n\t\tisViewOnly,\n\t\tisViewOnlyOrPreviewingLocale,\n\t\tisHomePage,\n\t\tisDraft,\n\t\tisAbTesting,\n\t\tsegmentId,\n\t\tcanSortRouteSegmentsAlphabetically,\n\t\tisCollectionOrCollectionChild,\n\t\ttrailingSlashSegmentParentId,\n\t\tabTestFunnel,\n\t\tcanAddAbTestingVariant,\n\t\tresetSelection,\n\t\trenamingEnabled,\n\t\tlocalizedRenamingEnabled,\n\t\tactiveRouterLocale,\n\t\tisPreviewingLocaleOnCanvas,\n\t\tpathTranslationEnabled,\n\t\tisKitProject,\n\t\tcreatePageInFolder,\n\t\tshowTranslateContentOption,\n\t])\n\n\tconst { handleDragStart, getDropTargetContainer, isDraggedOver, getInsertionIndicator } = useRouteSegmentRowDragDrop({\n\t\ttype,\n\t\twebPageId,\n\t\tsegmentId,\n\t\tisSelected,\n\t\ttrailingSlashSegmentParentId,\n\t\tcollectionId,\n\t\tselfOrAncestorDataIdentifier,\n\t\tisCollapsible,\n\t\tisExpanded,\n\t\tisViewOnly: isViewOnlyOrPreviewingLocale,\n\t\tisEditable,\n\t\tgetDraggableRouteSegmentNodes,\n\t})\n\n\tconst handleSelect = useCallback(() => {\n\t\tonClick({ webPageId, segmentId })\n\t}, [onClick, segmentId, webPageId])\n\n\tconst rowId = type === \"home\" ? \"homePage\" : segmentId\n\tconst Icon = getRouteSegmentIcon({\n\t\tisHomePage,\n\t\tisFolder: type === \"folder\",\n\t\tisCollection,\n\t\tagentExperimentEnabled: isAgentExperimentOn,\n\t})\n\n\treturn (\n\t\t<div className={cx(styles.rowContainer, isSelected && selectedSibling)}>\n\t\t\t<div className={styles.draggableRowContainer}>\n\t\t\t\t<Draggable\n\t\t\t\t\t// With multi-select, the home page can *start* a drag, but it cannot be included in the drag\n\t\t\t\t\t// data.\n\t\t\t\t\tenabled={!isViewOnlyOrPreviewingLocale}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\thideDragSource={false}\n\t\t\t\t>\n\t\t\t\t\t{({ isDragPreview }) => {\n\t\t\t\t\t\tconst draggedNodes = isDragPreview && isSelected ? getDraggableRouteSegmentNodes() : null\n\t\t\t\t\t\tconst shouldShowPreviewRows = draggedNodes && (draggedNodes.length > 1 || (!isHomePage && isSelected))\n\n\t\t\t\t\t\tif (isDragPreview && shouldShowPreviewRows) return getDragPreviewRows(draggedNodes, isAgentExperimentOn)\n\n\t\t\t\t\t\tif (isDragPreview && isHomePage) return null\n\n\t\t\t\t\t\tconst { subLabel, inlineLabel, badge } = getRouteSegmentRowLabels({\n\t\t\t\t\t\t\tcollectionItemCount,\n\t\t\t\t\t\t\tisAgentExperimentOn,\n\t\t\t\t\t\t\tisDraft,\n\t\t\t\t\t\t\tisAbTesting,\n\t\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\t\tisSelected,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<EngineContext.Provider value={engine}>\n\t\t\t\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\t\t\t\tref={rowRef}\n\t\t\t\t\t\t\t\t\tid={rowId}\n\t\t\t\t\t\t\t\t\tinputId={getPageInputId(rowId)}\n\t\t\t\t\t\t\t\t\tdataTestId=\"page-row\"\n\t\t\t\t\t\t\t\t\ttitle={displayTitle}\n\t\t\t\t\t\t\t\t\tIcon={Icon}\n\t\t\t\t\t\t\t\t\tbadge={badge}\n\t\t\t\t\t\t\t\t\tinlineLabel={inlineLabel}\n\t\t\t\t\t\t\t\t\tsubLabel={subLabel}\n\t\t\t\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\t\t\t\tisSelected={!isDragPreview && isSelected}\n\t\t\t\t\t\t\t\t\t// If the handler is not set on `mouseUp`, the click handler will fire off before drag & drop\n\t\t\t\t\t\t\t\t\t// can begin. This will mean only single-selects Drag & Drop will work. The other case would be to\n\t\t\t\t\t\t\t\t\t// block single clicks on an already selected row, which means the user would not be able to\n\t\t\t\t\t\t\t\t\t// take a multi-select and turn it into a single select.\n\t\t\t\t\t\t\t\t\tonMouseUp={handleSelect}\n\t\t\t\t\t\t\t\t\trowClassName={cx(isDraggedOver && styles.draggedOver)}\n\t\t\t\t\t\t\t\t\t// Edit\n\t\t\t\t\t\t\t\t\tisEditable={isPreviewingLocaleOnCanvas ? localizedRenamingEnabled : isEditable}\n\t\t\t\t\t\t\t\t\ttitleOnEdit={editingTitle}\n\t\t\t\t\t\t\t\t\tonTitleFocus={selectLastSegment}\n\t\t\t\t\t\t\t\t\tonTitleChange={isPreviewingLocaleOnCanvas ? handleLocalizedPathChange : handlePathChange}\n\t\t\t\t\t\t\t\t\twarningTitle={pathConflictLocales ? \"Page Path Conflict\" : undefined}\n\t\t\t\t\t\t\t\t\twarningText={\n\t\t\t\t\t\t\t\t\t\tpathConflictLocales\n\t\t\t\t\t\t\t\t\t\t\t? `This path has duplicates in other locales. To ensure links work correctly, make sure its path is unique in these locales: ${pathConflictLocales.join(\", \")}`\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Collapse\n\t\t\t\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\t\t\t\tdepth={depth}\n\t\t\t\t\t\t\t\t\tisCollapsible={isCollapsible}\n\t\t\t\t\t\t\t\t\tisCollapsed={!isExpanded}\n\t\t\t\t\t\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</EngineContext.Provider>\n\t\t\t\t\t\t)\n\t\t\t\t\t}}\n\t\t\t\t</Draggable>\n\n\t\t\t\t{getDropTargetContainer()}\n\n\t\t\t\t{getInsertionIndicator(depth)}\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n\nfunction isInActiveRoutesPath(\n\tsegmentId: NodeID,\n\ttrailingSlashSegmentParentId?: NodeID,\n\tactiveRouteSegmentIds?: ReadonlySet<NodeID>,\n) {\n\treturn (\n\t\tactiveRouteSegmentIds?.has(segmentId) ||\n\t\t(trailingSlashSegmentParentId && activeRouteSegmentIds?.has(trailingSlashSegmentParentId))\n\t)\n}\n\nfunction validatePath(path: string, segmentId: NodeID, webPageId?: NodeID) {\n\tconst routeSegmentRoot = getRouteSegmentRootNode(engine.tree)\n\tconst dataIdentifier = routeSegmentRoot.getDataIdentifierByRouteSegmentId(engine.tree, segmentId)\n\n\tif (dataIdentifier) {\n\t\tconst collectionData = engine.componentLoader.dataForIdentifier(dataIdentifier)\n\t\tconst warningMessage = getPathVariablesWarningMessage(path, collectionData)\n\t\tif (warningMessage) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"warning\",\n\t\t\t\ticon: \"warning\",\n\t\t\t\ttext: warningMessage,\n\t\t\t\tkey: \"cms-slug-warning\",\n\t\t\t})\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif (doesPathExist(engine.tree, path, webPageId)) {\n\t\tshowPageExistsToast(Boolean(dataIdentifier))\n\t\treturn false\n\t}\n\n\treturn true\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { LoadedWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { showAbTestUpsell } from \"../../shared/UpsellModal/utils/abTestUpsellModals.ts\"\nimport { showAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { addAbVariant } from \"./addAbVariant.ts\"\n\n/** Creates a new A/B testing variant for the control page if no variants exist */\nexport function addFirstAbVariantIfNeeded(engine: VekterEngine, node: LoadedWebPageNode, source: ModalOpenSource) {\n\tif (node.hasAbTestingChildren(engine.tree)) return\n\n\tif (showAbTestUpsell(engine, source, { isAddingTest: true })) return\n\tif (showAnalyticsEventsUpsell(engine, source)) return\n\n\taddAbVariant(engine, node)\n}\n", "import { toast } from \"web/lib/toaster.ts\"\n\nexport function showPageExistsToast(isCollection: boolean) {\n\tconst duration = isCollection ? 5000 : 2000\n\n\treturn toast({\n\t\ttype: \"add\",\n\t\tvariant: \"warning\",\n\t\ticon: \"warning\",\n\t\tprimaryText: \"Path already exists.\",\n\t\tsecondaryText: isCollection ? \"Collections need unique URLs.\" : \"Pages need unique URLs.\",\n\t\tkey: \"path-exists\",\n\t\tduration,\n\t})\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getUniqueSlotNodeIdsFromAllSlots } from \"document/models/CanvasTree/nodes/utils/slotUtils.ts\"\nimport { getClipboardData } from \"utils/clipboard/getClipboardData.ts\"\nimport type { FramerLayersClipboardData } from \"utils/clipboard/helpers/types.ts\"\n\n/**\n * Returns the POJO representation of the node with the given id, as well as its\n * connected slots. The returned data is ideal for JSON serialization to be\n * saved in our repository. The data will be normalized to not differ between\n * calls.\n */\nexport function getNodeData(engine: VekterEngine, id: NodeID): FramerLayersClipboardData {\n\tconst nodeIds = getSlotItemIdsFromSubtree(engine, id)\n\tnodeIds.add(id)\n\n\tconst data = getClipboardData(engine, nodeIds)\n\t// Kill originalFrames value since it randomly changes.\n\tdata.layers.originalFrames = {}\n\treturn data\n}\n\nfunction getSlotItemIdsFromSubtree(engine: VekterEngine, id: NodeID): Set<NodeID> {\n\tconst slotItemIds = new Set<NodeID>()\n\n\tconst node = engine.tree.get(id)\n\tif (!node) return slotItemIds\n\n\tfor (const child of node.walk()) {\n\t\tif (!isCodeComponentNode(child)) continue\n\n\t\tconst uniqueSlotItemIds = getUniqueSlotNodeIdsFromAllSlots(engine.tree, child, engine.componentLoader)\n\t\tfor (const slotItemId of uniqueSlotItemIds) {\n\t\t\tslotItemIds.add(slotItemId)\n\t\t}\n\t}\n\n\treturn slotItemIds\n}\n", "import \"RouteSegmentRow.styles_8yzfzv.wyw.css\"; export const rowContainer = \"rowContainer_rxctvrg\";\nexport const draggableRowContainer = \"draggableRowContainer_d78umqb\";\nexport const draggedOver = \"draggedOver_dy5pddr\";\nexport const dropTargetContainer = \"dropTargetContainer_d3vt08h\";\nexport const dropTarget = \"dropTarget_d1obw38k\";", "import { assert } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { BaseProps, FolderProps, HomePageProps, WebPageProps } from \"./RouteSegmentRow.tsx\"\nimport type { Props as RouteSegmentVariantRowProps } from \"./RouteSegmentVariantRow.tsx\"\n\nexport const MAX_AB_TESTING_VARIANTS = 4\n\n// Each page has its own `Omit` to remove `onClick`, `getSelectedRows`, `getDraggableRouteSegmentNodes`.\n// Otherwise, if the entire Props from `RouteSegmentRow` was used, TS cannot properly\n// infer discriminated unions for each page type.\ntype OmittedProps = \"onClick\" | \"getSelectedRows\" | \"getDraggableRouteSegmentNodes\"\n\ntype HomePageRenderRow = Omit<HomePageProps & BaseProps, OmittedProps>\nexport type WebPageRenderRow = Omit<WebPageProps & BaseProps, OmittedProps>\nexport type FolderRenderRow = Omit<FolderProps & BaseProps, OmittedProps>\nexport type VariantRenderRow = Omit<RouteSegmentVariantRowProps, OmittedProps> & { type: \"variant\" }\n\ninterface RouteSegmentDividerProps {\n\ttype: \"divider\"\n\tdepth: number\n\tsegmentId: NodeID\n}\n\nexport type RouteSegmentRenderRow =\n\t| HomePageRenderRow\n\t| WebPageRenderRow\n\t| FolderRenderRow\n\t| VariantRenderRow\n\t| RouteSegmentDividerProps\n\nexport type SelectableRouteSegmentRenderRow = Exclude<RouteSegmentRenderRow, RouteSegmentDividerProps>\n\nexport function isDividerRow(row: RouteSegmentRenderRow): row is Extract<RouteSegmentRenderRow, { type: \"divider\" }> {\n\treturn row.type === \"divider\"\n}\n\nfunction isWebPageRow(\n\trow: SelectableRouteSegmentRenderRow,\n): row is Extract<SelectableRouteSegmentRenderRow, { type: \"webPage\" }> {\n\treturn row.type === \"webPage\"\n}\n\nfunction isFolderRow(\n\trow: SelectableRouteSegmentRenderRow,\n): row is Extract<SelectableRouteSegmentRenderRow, { type: \"folder\" }> {\n\treturn row.type === \"folder\"\n}\n\nexport function isVariantRow(\n\trow: SelectableRouteSegmentRenderRow,\n): row is Extract<SelectableRouteSegmentRenderRow, { type: \"variant\" }> {\n\treturn row.type === \"variant\"\n}\n\nexport function isHomePageRow(\n\trow: SelectableRouteSegmentRenderRow,\n): row is Extract<SelectableRouteSegmentRenderRow, { type: \"home\" }> {\n\treturn row.type === \"home\"\n}\n\nexport function isMovableToFolderRow(\n\trow: SelectableRouteSegmentRenderRow,\n): row is Extract<SelectableRouteSegmentRenderRow, { type: \"webPage\" | \"folder\"; segmentId: string }> {\n\treturn (isWebPageRow(row) || isFolderRow(row)) && row.segmentId !== undefined\n}\n\nexport function canAllRowsBeMovedToFolder(rows: readonly SelectableRouteSegmentRenderRow[]): boolean {\n\treturn rows.length > 1 && rows.every(isMovableToFolderRow)\n}\n\n/**\n * WebPages that have an AB Test have a Control and Variants. The Control is the actual WebPage, while\n * its parent is a wrapper for these pages. They share a `webPageId`. Because of this, both are selected,\n * as selecting the parent page on its own does not have semantic meaning.\n */\nexport function isSingleSelectedControlVariant(\n\trows: readonly SelectableRouteSegmentRenderRow[],\n): rows is [HomePageRenderRow | WebPageRenderRow, VariantRenderRow] {\n\tif (rows.length !== 2) return false\n\n\tassert(!isUndefined(rows[0]) && !isUndefined(rows[1]), \"rows should have exactly 2 items\")\n\n\tif (!isHomePageRow(rows[0]) && !isWebPageRow(rows[0])) return false\n\n\treturn isVariantRow(rows[1]) && rows[1].isControl && rows[0].webPageId === rows[1].webPageId\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isNodeId } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { showPageExistsToast } from \"../../shared/showPageExistsToast.ts\"\nimport { isTrailingSlashSegmentNode } from \"./commons.ts\"\nimport { getRawRouteSegmentFullPath } from \"./getRouteSegmentFullPath.ts\"\nimport { doesPathExist } from \"./updateRouteSegmentPath.ts\"\n\nfunction canMoveSegment(\n\tsegmentNode: RouteSegmentNode,\n\tnewParentId: NodeID,\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n) {\n\tconst newParentPath =\n\t\tnewParentId === ROUTE_SEGMENT_ROOT_NODE_ID ? \"\" : getRawRouteSegmentFullPath(tree, componentLoader, newParentId)\n\tconst newPath = `${newParentPath}/${segmentNode.segment}`\n\n\treturn !doesPathExist(tree, newPath)\n}\n\nexport function moveRouteSegment(\n\tengine: VekterEngine,\n\tsegmentId: NodeID,\n\tnewParentId: NodeID,\n\tpositionInParent?: number,\n) {\n\tif (segmentId === newParentId) return\n\tconst homePageNodeId = engine.tree.root.homePageNodeId\n\tif (segmentId === homePageNodeId) return\n\tif (newParentId === homePageNodeId) return\n\n\tconst segmentNode = engine.tree.get<RouteSegmentNode>(segmentId)\n\tconst newParentNode = engine.tree.get<RouteSegmentNode>(newParentId)\n\tif (!segmentNode || !newParentNode) return\n\n\tconst safeNewParentId = isTrailingSlashSegmentNode(newParentNode) ? newParentNode.parentid : newParentId\n\tif (!isNodeId(safeNewParentId)) return\n\n\tif (\n\t\tsafeNewParentId !== segmentNode.parentid &&\n\t\t!canMoveSegment(segmentNode, safeNewParentId, engine.tree, engine.componentLoader)\n\t) {\n\t\tconst routeSegmentRoot = getRouteSegmentRootNode(engine.tree)\n\t\tconst dataIdentifier = routeSegmentRoot.getDataIdentifierByRouteSegmentId(engine.tree, segmentId)\n\n\t\t// we don't want to show a toast if the user is moving the segment to the same parent\n\t\treturn showPageExistsToast(Boolean(dataIdentifier))\n\t}\n\tif (segmentNode.parentid === safeNewParentId && isUndefined(positionInParent)) return\n\n\tengine.tree.moveNode(segmentNode, safeNewParentId, positionInParent)\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getInsertionPositionForSelection } from \"../../shared/utils/getInsertionPositionForSelection.ts\"\nimport type {\n\tFolderRenderRow,\n\tSelectableRouteSegmentRenderRow,\n\tWebPageRenderRow,\n} from \"../useRouteSegmentList.types.ts\"\nimport { isMovableToFolderRow } from \"../useRouteSegmentList.types.ts\"\nimport { createFolder } from \"./createFolder.ts\"\nimport { moveRouteSegment } from \"./moveRouteSegment.ts\"\n\nexport function createFolderFromSelection(\n\tengine: VekterEngine,\n\tselectedRows: readonly SelectableRouteSegmentRenderRow[],\n) {\n\tconst validRows = selectedRows.filter(isMovableToFolderRow)\n\tif (validRows.length === 0) return\n\n\tconst rootNode = getRouteSegmentRootNode(engine.tree)\n\tconst insertionInfo = getInsertionPositionForSelection(validRows, row => getEffectiveSegmentId(row), rootNode.id)\n\n\tconst newFolder = createFolder(engine, {\n\t\tpositionInParent: insertionInfo.position,\n\t\tparentId: insertionInfo.parentId,\n\t})\n\n\tif (!newFolder) return\n\n\tvalidRows.forEach(row => {\n\t\tconst segmentToMove = getEffectiveSegmentId(row)\n\t\tif (segmentToMove) {\n\t\t\tmoveRouteSegment(engine, segmentToMove, newFolder.id)\n\t\t}\n\t})\n\n\trecord(\"site_page_bulk_folder_create\", { count: validRows.length, source: \"context_menu\" })\n}\n\nfunction getEffectiveSegmentId(row: WebPageRenderRow | FolderRenderRow): string {\n\treturn row.trailingSlashSegmentParentId ?? row.segmentId\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { LoadedAnalyticsScopeNode, LoadedWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { FunnelStatus } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\nexport function deleteAbVariant(engine: VekterEngine, webPage: LoadedWebPageNode) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.deleteNode(webPage.id)\n\t\trecord(\"ab_variant_delete\", {\n\t\t\tpageId: webPage.id,\n\t\t\tabTestingParentId: webPage.abTestingParentId ?? webPage.id,\n\t\t})\n\t})\n}\n\n/**\n * Deletes an A/B testing variant from the given web page.\n */\nexport function promptDeleteAbVariant(\n\tengine: VekterEngine,\n\twebPage: LoadedWebPageNode,\n\tanalyticsScope: LoadedAnalyticsScopeNode | null,\n) {\n\tif (canSafelyDeleteAbVariant(webPage, analyticsScope)) {\n\t\tdeleteAbVariant(engine, webPage)\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.ConfirmUpdatingAbVariants,\n\t\tsource: \"automatic\",\n\t\ttitle: \"Updating Variants\",\n\t\tdescription: \"Updating variants while running an A/B test could potentially skew your results.\",\n\t\tconfirmLabel: \"Confirm\",\n\t\tonConfirm: () => deleteAbVariant(engine, webPage),\n\t\tvariant: \"destructive\",\n\t})\n}\n\nexport function canSafelyDeleteAbVariant(\n\twebPage: LoadedWebPageNode,\n\tanalyticsScope: LoadedAnalyticsScopeNode | null,\n): boolean {\n\treturn webPage.getAbTestingFunnel(analyticsScope)?.status !== FunnelStatus.Started\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport {\n\tAnalyticsScopeNode,\n\ttype AnyWebPageNode,\n\ttype LoadedAnalyticsScopeNode,\n\ttype LoadedWebPageNode,\n\ttype NodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport {\n\tisAnalyticsScopeNode,\n\tisRouteSegmentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport {\n\tcanSafelyDeleteAbVariant,\n\tdeleteAbVariant,\n\tpromptDeleteAbVariant,\n} from \"../../analytics/utils/promptDeleteAbVariant.ts\"\nimport type { SelectableRouteSegmentRenderRow, VariantRenderRow } from \"../useRouteSegmentList.types.ts\"\nimport { isHomePageRow, isVariantRow } from \"../useRouteSegmentList.types.ts\"\nimport {\n\tcanSafelyDeleteRouteSegmentNode,\n\tdeleteRouteSegmentAndOrphanedWebPages,\n\tpromptAndDeleteSegment,\n} from \"./promptAndDeleteRouteSegment.ts\"\n\n/**\n * Handles deletion of a mixed selection of route segment rows and A/B variant rows.\n *\n * Behavior:\n * - Single variant only \u2192 reuse prompt from A/B deletion flow (`promptDeleteAbVariant`).\n * - Single segment only \u2192 reuse segment deletion flow (`promptAndDeleteSegment`).\n * - Multiple and/or mixed selection \u2192 load all relevant scopes, determine if it's safe to\n *   delete immediately (no children, empty pages, no running variants), otherwise show a\n *   single destructive confirmation modal that deletes everything.\n */\nexport function promptAndDeleteRouteSegmentRows(\n\tengine: VekterEngine,\n\tselectedRows: readonly SelectableRouteSegmentRenderRow[],\n) {\n\tconst variantRows: VariantRenderRow[] = []\n\tconst segmentIds: NodeID[] = []\n\n\tfor (const row of selectedRows) {\n\t\tif (isVariantRow(row)) variantRows.push(row)\n\t\telse if (!isHomePageRow(row)) segmentIds.push(row.segmentId)\n\t}\n\n\tif (segmentIds.length === 0 && variantRows.length === 0) return\n\n\tif (variantRows.length === 1 && segmentIds.length === 0) {\n\t\tconst singleVariant = variantRows[0]\n\t\tassert(!isUndefined(singleVariant), \"Variant should be defined\")\n\n\t\t// Control variant cannot be deleted on their own. Only via their parent page.\n\t\tif (singleVariant.isControl) return\n\n\t\tconst variantWebPageNode = engine.tree.getNodeWithTrait(singleVariant.webPageId, isWebPageNode)\n\t\tif (isNull(variantWebPageNode)) return\n\n\t\t// Load the page scope and analytics scope, then prompt/execute the variant deletion\n\t\treturn engine.loadScopesThenProcess(\n\t\t\t[variantWebPageNode, AnalyticsScopeNode.get(engine.tree)],\n\t\t\t([loadedVariantWebPageNode, analyticsScope]) =>\n\t\t\t\tloadedVariantWebPageNode ? promptDeleteAbVariant(engine, loadedVariantWebPageNode, analyticsScope) : undefined,\n\t\t)\n\t}\n\n\tif (segmentIds.length === 1 && variantRows.length === 0) {\n\t\tassert(!isUndefined(segmentIds[0]), \"Segment ID should be defined\")\n\t\treturn promptAndDeleteSegment(engine, segmentIds[0])\n\t}\n\n\tconst allWebPageNodes: AnyWebPageNode[] = []\n\tconst allSegmentNodes: RouteSegmentNode[] = []\n\n\t// Collect web page nodes referenced by the selected segments\n\tsegmentIds.forEach(segmentId => {\n\t\tconst routeSegmentNode = engine.tree.getNode(segmentId)\n\t\tif (!isRouteSegmentNode(routeSegmentNode)) return\n\n\t\tallSegmentNodes.push(routeSegmentNode)\n\n\t\tif (isUndefined(routeSegmentNode.webPageId)) return\n\n\t\tconst webPageNode = engine.tree.getNodeWithTrait(routeSegmentNode.webPageId, isWebPageNode)\n\t\tif (isNull(webPageNode)) return\n\n\t\tallWebPageNodes.push(webPageNode)\n\t})\n\n\t// Collect web page nodes referenced by the selected variants\n\tvariantRows.forEach(variant => {\n\t\tconst webPageNode = engine.tree.getNodeWithTrait(variant.webPageId, isWebPageNode)\n\t\tif (!isNull(webPageNode)) allWebPageNodes.push(webPageNode)\n\t})\n\n\t// Pass to the mixed-selection handler that loads scopes and determines safe deletion\n\treturn handleMixedDeletion(engine, allWebPageNodes, allSegmentNodes, segmentIds, variantRows)\n}\n\n/**\n * Partitions a list of loaded nodes into loaded web pages and an optional analytics scope node.\n */\nfunction getLoadedWebPageNodes(loadedNodes: (LoadedWebPageNode | LoadedAnalyticsScopeNode | null)[]) {\n\tconst webPageNodes: LoadedWebPageNode[] = []\n\tlet analyticsScopeNode: LoadedAnalyticsScopeNode | null = null\n\tfor (const node of loadedNodes) {\n\t\tif (isNull(node)) continue\n\t\tif (isWebPageNode(node)) webPageNodes.push(node)\n\t\tif (isAnalyticsScopeNode(node)) analyticsScopeNode = node\n\t}\n\n\treturn { loadedWebPageNodes: webPageNodes, loadedAnalyticsScopeNode: analyticsScopeNode }\n}\n\n/**\n * Mixed deletion flow for multiple segments and/or variants:\n * - Loads scopes for all involved web pages and the analytics scope.\n * - For segments: checks for children and if linked pages are empty (similar to `promptAndDeleteSegment`).\n * - For variants: checks whether any variant is in a running funnel (similar to `promptDeleteAbVariant`).\n * - If safe: delete immediately; otherwise: show a destructive confirmation modal for bulk delete.\n */\nfunction handleMixedDeletion(\n\tengine: VekterEngine,\n\tallWebPageNodes: AnyWebPageNode[],\n\tallSegmentNodes: RouteSegmentNode[],\n\tsegmentIds: NodeID[],\n\tvariantRows: readonly VariantRenderRow[],\n) {\n\tconst analyticsScopeNode = AnalyticsScopeNode.get(engine.tree)\n\n\treturn engine.loadScopesThenProcess([...allWebPageNodes, analyticsScopeNode], loadedNodes => {\n\t\tconst { loadedWebPageNodes, loadedAnalyticsScopeNode } = getLoadedWebPageNodes(loadedNodes)\n\n\t\t// Safety checks for segments (children or non-empty linked pages means we should prompt)\n\t\tlet canAllSegmentsBeSafelyDeleted = true\n\t\tfor (const routeSegmentNode of allSegmentNodes) {\n\t\t\tconst webPageNode = loadedWebPageNodes.find(node => node.id === routeSegmentNode.webPageId)\n\t\t\tcanAllSegmentsBeSafelyDeleted =\n\t\t\t\tcanAllSegmentsBeSafelyDeleted && canSafelyDeleteRouteSegmentNode(webPageNode, routeSegmentNode)\n\t\t\tif (!canAllSegmentsBeSafelyDeleted) break\n\t\t}\n\n\t\tconst variantWebPageNodeMap: Record<NodeID, LoadedWebPageNode> = {}\n\n\t\t// Check whether any non-control variant is running (mirrors `promptDeleteAbVariant`)\n\t\tlet canAllVariantsBeSafelyDeleted = true\n\t\tfor (const variantRow of variantRows) {\n\t\t\tconst webPageNode = loadedWebPageNodes.find(node => node?.id === variantRow.webPageId)\n\t\t\tif (!webPageNode) continue\n\n\t\t\tvariantWebPageNodeMap[variantRow.webPageId] = webPageNode\n\n\t\t\tif (variantRow.isControl) {\n\t\t\t\tcanAllVariantsBeSafelyDeleted = false\n\t\t\t}\n\n\t\t\tcanAllVariantsBeSafelyDeleted =\n\t\t\t\tcanAllVariantsBeSafelyDeleted && canSafelyDeleteAbVariant(webPageNode, loadedAnalyticsScopeNode)\n\t\t\tif (!canAllVariantsBeSafelyDeleted) break\n\t\t}\n\n\t\tconst totalCount = segmentIds.length + variantRows.length\n\n\t\t// If everything is safe (no children, empty pages, no links, no running variants)\n\t\t// then delete immediately without prompt\n\t\tif (canAllSegmentsBeSafelyDeleted && canAllVariantsBeSafelyDeleted) {\n\t\t\tsegmentIds.forEach(segmentId => deleteRouteSegmentAndOrphanedWebPages(engine, segmentId))\n\t\t\tvariantRows.forEach(variantRow =>\n\t\t\t\tdeleteVariantRow(engine, variantRow, variantWebPageNodeMap[variantRow.webPageId]),\n\t\t\t)\n\t\t\trecord(\"site_page_bulk_delete\", getBulkDeleteData(totalCount))\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\tvariant: \"destructive\",\n\t\t\ttitle: \"Delete Pages\",\n\t\t\tdescription: \"Deleting these pages will remove all of their contents for all project collaborators.\",\n\t\t\tonConfirm: () => {\n\t\t\t\tsegmentIds.forEach(segmentId => deleteRouteSegmentAndOrphanedWebPages(engine, segmentId))\n\t\t\t\tvariantRows.forEach(variantRow =>\n\t\t\t\t\tdeleteVariantRow(engine, variantRow, variantWebPageNodeMap[variantRow.webPageId]),\n\t\t\t\t)\n\t\t\t\trecord(\"site_page_bulk_delete\", getBulkDeleteData(totalCount))\n\t\t\t},\n\t\t\tconfirmLabel: \"Delete All\",\n\t\t\tsource: \"delete_pages\",\n\t\t\tkeyboardConfirmMode: \"Enter\",\n\t\t})\n\t})\n}\n\nfunction deleteVariantRow(\n\tengine: VekterEngine,\n\tvariantRow: VariantRenderRow,\n\twebPageNodeForVariant: LoadedWebPageNode | undefined,\n) {\n\tif (variantRow.isControl || isUndefined(webPageNodeForVariant)) return\n\n\tdeleteAbVariant(engine, webPageNodeForVariant)\n}\n\nfunction getBulkDeleteData(count: number): { count: number; section: \"routes\"; source: \"context_menu\" } {\n\treturn {\n\t\tcount,\n\t\tsection: \"routes\",\n\t\tsource: \"context_menu\",\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { isPageConvertibleToKit } from \"app/ai/utils/kitProject.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { SelectableRouteSegmentRenderRow } from \"./useRouteSegmentList.types.ts\"\nimport {\n\tcanAllRowsBeMovedToFolder,\n\tisHomePageRow,\n\tisSingleSelectedControlVariant,\n\tisVariantRow,\n} from \"./useRouteSegmentList.types.ts\"\nimport { createFolderFromSelection } from \"./utils/createFolderFromSelection.ts\"\nimport { promptAndDeleteRouteSegmentRows } from \"./utils/promptAndDeleteRouteSegmentRows.ts\"\nimport { markPagesAsDraftWithConfirmation, undraftPages } from \"./utils/setPageDraftStatus.ts\"\n\n/**\n * The multi-select menu should only be visible if an item is a part of an active multi-selection. The one exception\n * is that if there are 2 selected rows, and they are a webpage and its control variant.\n */\nexport function shouldShowMultiSelectMenu(\n\tisSelected: boolean,\n\tselectedRows: readonly SelectableRouteSegmentRenderRow[],\n) {\n\treturn isSelected && selectedRows.length > 1 && !isSingleSelectedControlVariant(selectedRows)\n}\n\nexport function getRouteSegmentMultiSelectMenu(\n\tengine: VekterEngine,\n\tselectedRows: readonly SelectableRouteSegmentRenderRow[],\n\tisViewOnly: boolean,\n\tresetSelection?: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => void,\n) {\n\tconst isHomePageInSelection = selectedRows.some(isHomePageRow)\n\tconst isKitProject = experiments.isOn(\"wireframerKits\") && projectFeatures.isOn(\"kit\")\n\n\tconst showCreateFolder = canAllRowsBeMovedToFolder(selectedRows)\n\tconst createFolderOption: MenuItemOptions[] = showCreateFolder\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\t\tenabled: !isViewOnly && !isHomePageInSelection,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tcreateFolderFromSelection(engine, selectedRows)\n\t\t\t\t\t\tresetSelection?.({})\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\tconst showBulkDraft = selectedRows.every(row => !isUndefined(row.webPageId) && !isVariantRow(row))\n\tconst shouldShowConvertToKitPage = selectedRows.every(row => {\n\t\tconst node = engine.tree.getNodeWithTrait(row.webPageId, isWebPageNode)\n\t\treturn node && isPageConvertibleToKit(engine.tree, node)\n\t})\n\n\tconst bulkDraftOptions: MenuItemOptions[] = showBulkDraft\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Draft,\n\t\t\t\t\tenabled: !isViewOnly && !isHomePageInSelection && !isEveryNodeDrafted(engine, selectedRows),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tmarkPagesAsDraftWithConfirmation(\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tselectedRows.map(row => {\n\t\t\t\t\t\t\t\tassert(!isUndefined(row.webPageId), \"webPageId must be defined\")\n\t\t\t\t\t\t\t\treturn row.webPageId\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: Dictionary.Undraft,\n\t\t\t\t\tenabled: !isViewOnly && !isHomePageInSelection && !isEveryNodeUndrafted(engine, selectedRows),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tundraftPages(\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tselectedRows.map(row => {\n\t\t\t\t\t\t\t\tassert(!isUndefined(row.webPageId), \"webPageId must be defined\")\n\t\t\t\t\t\t\t\treturn row.webPageId\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: \"Convert to Kit Page\u2026\",\n\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\tvisible: isKitProject && shouldShowConvertToKitPage,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.ConvertToKitPage,\n\t\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t\t\twebPageIds: selectedRows.map(row => {\n\t\t\t\t\t\t\t\tassert(!isUndefined(row.webPageId), \"webPageId must be defined\")\n\t\t\t\t\t\t\t\treturn row.webPageId\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\n\treturn [\n\t\t...createFolderOption,\n\t\t...bulkDraftOptions,\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly && engine.stores.scopeStore.getRootScopeNodes().length > 1 && !isHomePageInSelection,\n\t\t\tclick: () => {\n\t\t\t\tpromptAndDeleteRouteSegmentRows(engine, selectedRows)\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction isEveryNodeDrafted(engine: VekterEngine, selectedRows: readonly SelectableRouteSegmentRenderRow[]) {\n\treturn selectedRows.every(row => {\n\t\tconst node = engine.tree.get<WebPageNode>(row.webPageId)\n\t\treturn node?.isDraft\n\t})\n}\n\nfunction isEveryNodeUndrafted(engine: VekterEngine, selectedRows: readonly SelectableRouteSegmentRenderRow[]) {\n\treturn selectedRows.every(row => {\n\t\tconst node = engine.tree.get<WebPageNode>(row.webPageId)\n\t\treturn !node?.isDraft\n\t})\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { useDroppable } from \"@framerjs/fresco/layout-transitions\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isNodeId } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isRouteSegmentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.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 type { DraggedSegment, DragoverSegment } from \"./RouteSegment.types.ts\"\nimport * as styles from \"./RouteSegmentRow.styles.ts\"\nimport { isFolderRouteSegmentNode, isFolderWebPage } from \"./useRouteSegmentChildrenRows.ts\"\nimport { getRouteSegmentIcon } from \"./utils/getRouteSegmentIcon.tsx\"\nimport { moveRouteSegment } from \"./utils/moveRouteSegment.ts\"\n\nconst ROUTE_SEGMENT_DATA_TYPE = \"route-segment-item\"\nconst insertionIndicatorOffset = 32\n\ninterface Props {\n\ttype: \"home\" | \"webPage\" | \"folder\" | \"variant\"\n\twebPageId?: NodeID | undefined\n\tsegmentId?: NodeID | undefined\n\tisSelected: boolean\n\ttrailingSlashSegmentParentId?: NodeID | undefined\n\tcollectionId?: ModuleExportIdentifierString | undefined\n\tselfOrAncestorDataIdentifier?: ModuleExportIdentifierString | undefined\n\tisCollapsible: boolean\n\tisExpanded: boolean\n\tisViewOnly: boolean\n\tisEditable: boolean\n\tgetDraggableRouteSegmentNodes: () => readonly RouteSegmentNode[]\n}\n\nexport function useRouteSegmentRowDragDrop({\n\ttype,\n\tsegmentId,\n\tisSelected,\n\ttrailingSlashSegmentParentId,\n\tcollectionId,\n\tselfOrAncestorDataIdentifier,\n\tisCollapsible,\n\tisExpanded,\n\tisViewOnly,\n\tisEditable,\n\tgetDraggableRouteSegmentNodes,\n}: Props) {\n\tconst isHomePage = type === \"home\"\n\tconst isVariant = type === \"variant\"\n\tconst [dragoverSegment, setDragoverSegment] = useState<DragoverSegment | null>(null)\n\n\tuseEffect(() => {\n\t\t// This will auto expand the segment if the user is dragging over it for a while.\n\t\tif (!dragoverSegment || !segmentId) return\n\t\tconst currentSegmentId = trailingSlashSegmentParentId ?? segmentId\n\t\tif (dragoverSegment.insertParentId !== currentSegmentId) return\n\t\tconst timeout = setTimeout(() => engine.stores.chromeStore.expandRouteSegment(segmentId), dragExpandTime)\n\t\treturn () => clearTimeout(timeout)\n\t}, [dragoverSegment, segmentId, trailingSlashSegmentParentId])\n\n\tconst handleDragStart = useEngineCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\t// if item is selected, it can be a part of the multi-selection.\n\t\t\tif (isSelected) {\n\t\t\t\t// Build multi-drag data in visual order\n\t\t\t\tconst draggedRouteSegmentNodeIds: NodeID[] = []\n\t\t\t\tfor (const node of getDraggableRouteSegmentNodes()) {\n\t\t\t\t\tengine.stores.chromeStore.collapseRouteSegment(node.id)\n\t\t\t\t\tdraggedRouteSegmentNodeIds.push(getDraggedRouteSegmentNodeId(node))\n\t\t\t\t}\n\n\t\t\t\tevent.dataTransfer.setData(ROUTE_SEGMENT_DATA_TYPE, draggedRouteSegmentNodeIds)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Single DND case / Home row & variants aren't ever draggable\n\t\t\tif (isHomePage || isVariant) return\n\n\t\t\tassert(!isUndefined(segmentId), \"segmentId must be defined\")\n\n\t\t\t// Collapse the source row during drag\n\t\t\tengine.stores.chromeStore.collapseRouteSegment(segmentId)\n\n\t\t\t// Trailing-slash rows proxy ops to their parent\n\t\t\tconst id = trailingSlashSegmentParentId ?? segmentId\n\t\t\tconst draggedSegment: NodeID[] = [id]\n\t\t\tevent.dataTransfer.setData(ROUTE_SEGMENT_DATA_TYPE, draggedSegment)\n\t\t},\n\t\t[getDraggableRouteSegmentNodes, isHomePage, isVariant, trailingSlashSegmentParentId, isSelected, segmentId],\n\t)\n\n\tconst handleDragOver = useCallback(\n\t\t(event: DraggableEvent, position: DragAndDropPosition) => {\n\t\t\tconst draggedRouteSegmentNodeIds = event.dataTransfer.getData(ROUTE_SEGMENT_DATA_TYPE) as NodeID[] | undefined\n\t\t\tif (isUndefined(draggedRouteSegmentNodeIds)) return\n\n\t\t\t// validate all dragged items against target rules\n\t\t\tconst hasDraggedItems = draggedRouteSegmentNodeIds.length > 0\n\t\t\tconst isAllDraggedItemsValid =\n\t\t\t\thasDraggedItems &&\n\t\t\t\tdraggedRouteSegmentNodeIds.every(id =>\n\t\t\t\t\tcanMoveSegment(\n\t\t\t\t\t\tgetDraggedSegment(engine.tree.getNodeWithTrait(id, isRouteSegmentNode)),\n\t\t\t\t\t\tcollectionId,\n\t\t\t\t\t\tselfOrAncestorDataIdentifier,\n\t\t\t\t\t\tposition,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\tif (!isAllDraggedItemsValid) return\n\n\t\t\t// When rendering a trailing-slash page (/folder/), this row is a \"/\" proxy.\n\t\t\t// Real operations should target its parent segment.\n\t\t\tconst id = trailingSlashSegmentParentId ?? segmentId\n\n\t\t\t// Ignore being able to drop inside of a selection block.\n\t\t\tif (draggedRouteSegmentNodeIds.some(draggedId => draggedId === id)) return\n\n\t\t\t// Parent that contains current hovered row\n\t\t\tconst parentId = engine.tree.get(id)?.parentid\n\n\t\t\t// Drop directly below Home if it's being hovered over.\n\t\t\tif (isHomePage) {\n\t\t\t\tif (!isNodeId(parentId)) return\n\t\t\t\tsetDragoverSegment(\n\t\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\t\tinsertParentId: parentId,\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\t// If no `id` is available for this row (e.g. \"home\" row & variants) the drag-over is\n\t\t\t// currently treated as \"insert at the root at index 0\".\n\t\t\t// Note: We render a \"bottom\" indicator here for visual clarity, even though the\n\t\t\t// insertion index is 0 (top of the root list).\n\t\t\tif (isUndefined(id)) {\n\t\t\t\tsetDragoverSegment(\n\t\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\t\tinsertParentId: ROUTE_SEGMENT_ROOT_NODE_ID,\n\t\t\t\t\t\tinsertOffset: 0,\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\t// \"middle\" \u2192 make it a direct child of this row.\n\t\t\tif (position === \"middle\") {\n\t\t\t\tsetDragoverSegment(\n\t\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\t\tinsertParentId: id,\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 parentSegment = engine.tree.get(parentId)\n\t\t\tif (!parentSegment || !parentSegment.children) return\n\n\t\t\tsetDragoverSegment(\n\t\t\t\tupdateDragoverSegmentIfNeeded({\n\t\t\t\t\tinsertParentId: parentSegment.id,\n\t\t\t\t\tinsertOffset: calculateOffset(position),\n\t\t\t\t\tindicatorPosition: position,\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[trailingSlashSegmentParentId, segmentId, isHomePage, selfOrAncestorDataIdentifier, collectionId],\n\t)\n\n\tconst handleDrop = useEngineCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\tif (isNull(dragoverSegment)) return\n\n\t\t\tconst draggedRouteSegmentNodeIds = event.dataTransfer.getData(ROUTE_SEGMENT_DATA_TYPE) as NodeID[] | undefined\n\t\t\tif (isUndefined(draggedRouteSegmentNodeIds) || draggedRouteSegmentNodeIds.length === 0) return\n\n\t\t\tconst { insertParentId, insertOffset } = dragoverSegment\n\n\t\t\tconst id = trailingSlashSegmentParentId ?? segmentId\n\t\t\tif (segmentId && isCollapsible && !isExpanded && insertParentId === id) {\n\t\t\t\tengine.stores.chromeStore.expandRouteSegment(segmentId)\n\t\t\t}\n\n\t\t\tconst insertionIndex = id ? calculateInsertionIndex(insertOffset, insertParentId, id) : null\n\t\t\tif (isNull(insertionIndex)) return\n\n\t\t\tconst dropTargetNode = engine.tree.get(id)\n\t\t\tif (!dropTargetNode) return\n\n\t\t\t// If the drop target is the root node, the root children should be the siblings.\n\t\t\tconst routeSegmentRoot =\n\t\t\t\tinsertParentId === ROUTE_SEGMENT_ROOT_NODE_ID ? getRouteSegmentRootNode(engine.tree) : null\n\t\t\tconst siblings = routeSegmentRoot\n\t\t\t\t? routeSegmentRoot.children.toArray()\n\t\t\t\t: engine.tree.getSiblingsIncludingSelf(dropTargetNode)\n\t\t\tconst nodes = engine.tree.getNodes(draggedRouteSegmentNodeIds)\n\n\t\t\t// When inserting to a higher insertionIndex, the items will reverse. This is a\n\t\t\t// peculiarity that also occurs in Layers.tsx\n\t\t\t// https://github.com/framer/company/issues/34039\n\t\t\tfor (let i = nodes.length - 1; i >= 0; i -= 1) {\n\t\t\t\tconst node = nodes[i]\n\t\t\t\tassert(!isUndefined(node), \"drag item must be defined\")\n\t\t\t\tif (node.id === insertParentId) continue\n\n\t\t\t\tlet localInsertionIndex = insertionIndex\n\t\t\t\tconst currentIndex = siblings.indexOf(node)\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\tmoveRouteSegment(engine, node.id, insertParentId, localInsertionIndex)\n\t\t\t}\n\n\t\t\tif (draggedRouteSegmentNodeIds.length > 1) {\n\t\t\t\trecord(\"site_page_bulk_move_section\", {\n\t\t\t\t\tpageIds: draggedRouteSegmentNodeIds.join(\",\"),\n\t\t\t\t\tcount: draggedRouteSegmentNodeIds.length,\n\t\t\t\t\tsection: \"routes\",\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[dragoverSegment, trailingSlashSegmentParentId, segmentId, isCollapsible, isExpanded],\n\t)\n\n\tconst handleDragLeave = useCallback(() => {\n\t\tsetDragoverSegment(null)\n\t}, [])\n\n\tconst commonRefProps = {\n\t\tdataTypes: [ROUTE_SEGMENT_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\tenabled: isEditable,\n\t})\n\n\tconst bottomDroppableRef = useDroppable({\n\t\t...commonRefProps,\n\t\tonDragOver: (event: DraggableEvent) => handleDragOver(event, \"bottom\"),\n\t})\n\n\tconst getDropTargetContainer = useCallback(() => {\n\t\treturn (\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\t\t)\n\t}, [topDroppableRef, midDroppableRef, bottomDroppableRef])\n\n\tconst getInsertionIndicator = useCallback(\n\t\t(depth: number) => {\n\t\t\tif (isNull(dragoverSegment)) return null\n\t\t\tif (isNull(dragoverSegment.indicatorPosition)) return null\n\n\t\t\treturn (\n\t\t\t\t<InsertionIndicator\n\t\t\t\t\tdepth={depth}\n\t\t\t\t\tposition={dragoverSegment.indicatorPosition}\n\t\t\t\t\tleftOffset={insertionIndicatorOffset}\n\t\t\t\t/>\n\t\t\t)\n\t\t},\n\t\t[dragoverSegment],\n\t)\n\n\tconst isDraggedOver = !isHomePage && dragoverSegment?.insertOffset === -1\n\n\treturn {\n\t\thandleDragStart,\n\t\tgetDropTargetContainer,\n\t\tisDraggedOver,\n\t\tgetInsertionIndicator,\n\t}\n}\n\nexport function getDragPreviewRows(routeSegmentNodes: readonly RouteSegmentNode[], agentExperimentEnabled: boolean) {\n\treturn routeSegmentNodes.map(node => {\n\t\tconst collectionName = node.dataIdentifier\n\t\t\t? engine.componentLoader.dataForIdentifier(node.dataIdentifier)?.name\n\t\t\t: undefined\n\t\tconst parent = engine.tree.getNodeWithTrait(node.parentid, isRouteSegmentNode)\n\t\tconst title =\n\t\t\tcollectionName ?? (parent && isFolderWebPage(parent) === node.id ? `/${parent.segment}/` : `/${node.segment}`)\n\n\t\treturn (\n\t\t\t<CollapsibleRow\n\t\t\t\tkey={node.id}\n\t\t\t\tid={node.id}\n\t\t\t\tdataTestId=\"page-row-preview\"\n\t\t\t\ttitle={title}\n\t\t\t\tIcon={getRouteSegmentIcon({\n\t\t\t\t\tisHomePage: false,\n\t\t\t\t\tisFolder: isFolderRouteSegmentNode(node),\n\t\t\t\t\tisCollection: Boolean(node.dataIdentifier),\n\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t})}\n\t\t\t\tisEditable={false}\n\t\t\t\twithCollapse={false}\n\t\t\t/>\n\t\t)\n\t})\n}\n\n/**\n * The `trailingSlashSegmentParentId` should take priority over the `segmentId` when determining the dragged item.\n * See @WebPage in RouteSegment.types.ts.\n */\nfunction getDraggedRouteSegmentNodeId(routeSegmentNode: RouteSegmentNode): NodeID {\n\tconst webPage = engine.tree.get(routeSegmentNode.webPageId)\n\tconst parent = engine.tree.getNodeWithTrait(routeSegmentNode.parentid, isRouteSegmentNode)\n\treturn isWebPageNode(webPage) && parent && isFolderWebPage(parent) === routeSegmentNode.id\n\t\t? parent.id\n\t\t: routeSegmentNode.id\n}\n\n// The collectionId and selfOrAncestorDataIdentifier are helped to determine whether an item\n// can be dropped in certain locations.\nfunction getDraggedSegment(routeSegmentNode: RouteSegmentNode | null): DraggedSegment | null {\n\tif (isNull(routeSegmentNode)) return null\n\tconst routeSegmentRoot = getRouteSegmentRootNode(engine.tree)\n\n\treturn {\n\t\tid: getDraggedRouteSegmentNodeId(routeSegmentNode),\n\t\tcollectionId: routeSegmentNode.dataIdentifier,\n\t\tselfOrAncestorDataIdentifier: routeSegmentRoot.getDataIdentifierByRouteSegmentId(engine.tree, routeSegmentNode.id),\n\t}\n}\n\nfunction canMoveSegment(\n\tdraggedSegment: DraggedSegment | null,\n\ttargetCollectionId: ModuleExportIdentifierString | undefined,\n\ttargetDataIdentifier: ModuleExportIdentifierString | undefined,\n\ttargetPosition: DragAndDropPosition,\n) {\n\tif (isNull(draggedSegment)) return false\n\tif (isNull(draggedSegment.id)) return false\n\n\tconst isCollection = Boolean(draggedSegment.collectionId)\n\tconst isCollectionDescendant = Boolean(!draggedSegment.collectionId && draggedSegment.selfOrAncestorDataIdentifier)\n\tconst isTargetToBeChild = targetPosition === \"middle\"\n\tconst isTargetCollection = Boolean(targetCollectionId && isTargetToBeChild)\n\tconst isTargetCollectionDescendant = Boolean(!targetCollectionId && targetDataIdentifier)\n\tconst isTargetCollectionOrCollectionDescendant = isTargetCollection || isTargetCollectionDescendant\n\n\t// Non-collection segments can only be dropped to non-collection segments.\n\tif (!isCollection && !isCollectionDescendant && isTargetCollectionOrCollectionDescendant) return false\n\n\t// Collection segments can't be dropped to other collections segments.\n\tif (isCollection && isTargetCollectionOrCollectionDescendant) return false\n\n\t// Collection tail segments can only be dropped to the same collection they belong to. If the target is a\n\t// the collection itself, it can only be dropped to the middle (inside of it).\n\tif (\n\t\tisCollectionDescendant &&\n\t\t((targetCollectionId === draggedSegment.selfOrAncestorDataIdentifier && !isTargetToBeChild) ||\n\t\t\ttargetDataIdentifier !== draggedSegment.selfOrAncestorDataIdentifier)\n\t) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunction updateDragoverSegmentIfNeeded(newDragoverSegment: DragoverSegment) {\n\treturn (oldDragoverSegment: DragoverSegment | null) => {\n\t\tif (isEqual(oldDragoverSegment, newDragoverSegment)) return oldDragoverSegment\n\t\treturn newDragoverSegment\n\t}\n}\n", "import { emptyArray } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getCollectionItemCount } from \"document/components/utils/collectionItemUtils.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tisRouteSegmentNode,\n\tisRouteSegmentRootNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getRouterLocale } from \"utils/getRouterLocales.ts\"\nimport { getPathForDisplay } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { getLocalizedValueForActiveLocale } from \"../localization/getValueForActiveLocale.ts\"\nimport type { CollectionData, Folder, WebPage } from \"./RouteSegment.types.ts\"\nimport { isTrailingSlashSegmentNode, isWithoutChildren } from \"./utils/commons.ts\"\nimport { getReadableRouteSegmentFullPath } from \"./utils/getRouteSegmentFullPath.ts\"\n\nexport function useRouteSegmentChildrenRows(\n\t/** The id of the route segment we are currently rendering. */\n\tsegmentId: NodeID | undefined,\n\t/**\n\t * If provided, the id of the route segment whose children we should use.\n\t * This will only be a node id when the parent route segment is rendering a\n\t * trailing slash page (/folder/), allowing us to render and interact with\n\t * the `/`, but show the other children of `/folder`.\n\t */\n\ttrailingSlashSegmentParentId: NodeID | undefined,\n\tlocaleId: LocaleId,\n): readonly (WebPage | Folder)[] {\n\tconst routeSegmentChildrenRows = useEngineState<readonly (WebPage | Folder)[]>(\n\t\t// Note: The collection data for collection pages looks at the component loader (ActiveBundle).\n\t\t() => {\n\t\t\tconst pathTranslationEnabled = engine.tree.root.translatePagePaths === \"yes\"\n\t\t\treturn getRouteSegmentChildrenRows(segmentId, trailingSlashSegmentParentId, pathTranslationEnabled, localeId)\n\t\t},\n\t\t[segmentId, trailingSlashSegmentParentId, engine.tree.root.translatePagePaths, localeId],\n\t\t[EngineChange.ActiveBundle, EngineChange.Tree, engine.stores.localizationStore],\n\t\t{ deepEqual: true },\n\t)\n\treturn routeSegmentChildrenRows\n}\n\nexport function getRouteSegmentChildrenRows(\n\tsegmentId: NodeID | undefined,\n\ttrailingSlashSegmentParentId: NodeID | undefined,\n\tpathTranslationEnabled: boolean,\n\tlocaleId: LocaleId,\n): readonly (WebPage | Folder)[] {\n\tconst routeSegmentNode = engine.tree.get(trailingSlashSegmentParentId ?? segmentId)\n\tif (!isRouteSegmentNode(routeSegmentNode) && !isRouteSegmentRootNode(routeSegmentNode)) return emptyArray()\n\n\tconst routeSegmentRoot = getRouteSegmentRootNode(engine.tree)\n\tconst info: (WebPage | Folder)[] = []\n\tconst locale = getRouterLocale(engine.tree, localeId)\n\tfor (const child of routeSegmentNode.children) {\n\t\t// If we have an override id (because the parent Route Segment\n\t\t// is rendering (/folder/ instead of /folder), skip the trailing\n\t\t// slash route segment so it isn't displayed twice.\n\t\tif (trailingSlashSegmentParentId && child.id === segmentId) continue\n\n\t\tconst webPage = engine.tree.get(child.webPageId)\n\t\tconst localizedChildSegment = pathTranslationEnabled\n\t\t\t? getLocalizedValueForActiveLocale(locale, child.segmentLocalized)\n\t\t\t: undefined\n\t\tconst localizedChildSegmentValue = getPathForDisplay(localizedChildSegment?.value || child.segment)\n\n\t\tconst collectionData = getCollectionDataForRouteSegmentRow(child, localeId)\n\t\tconst selfOrAncestorDataIdentifier = routeSegmentRoot.getDataIdentifierByRouteSegmentId(engine.tree, child.id)\n\t\t// A segment is only visualized as a webpage if it's webPageId\n\t\t// points to an existing webpage.\n\t\tif (isWebPageNode(webPage)) {\n\t\t\tinfo.push({\n\t\t\t\ttype: \"webPage\",\n\t\t\t\tsegmentId: child.id,\n\t\t\t\tsegment: localizedChildSegmentValue,\n\t\t\t\twebPageId: webPage.id,\n\t\t\t\tisDraft: !!webPage.isDraft,\n\t\t\t\tisAbTesting: webPage.hasAbTestingChildren(engine.tree),\n\t\t\t\tfullPath: getReadableRouteSegmentFullPath(engine.tree, engine.componentLoader, child.id),\n\t\t\t\tselfOrAncestorDataIdentifier,\n\t\t\t\tcollectionId: collectionData?.collectionId,\n\t\t\t\tcollectionName: collectionData?.collectionName,\n\t\t\t\tcollectionItemCount: collectionData?.collectionItemCount,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check if the folder has an empty trailing slash child with a\n\t\t// valid webpage. If it does, we will try to show this route\n\t\t// segment as if it were that webpage (/folder/ vs /folder).\n\t\tconst slashChild = child.children.find(\n\t\t\tgrandchild => isTrailingSlashSegmentNode(grandchild) && isWithoutChildren(grandchild),\n\t\t)\n\t\tconst slashChildWebPage = engine.tree.get(slashChild?.webPageId)\n\t\tif (slashChild && isWebPageNode(slashChildWebPage)) {\n\t\t\tinfo.push({\n\t\t\t\ttype: \"webPage\",\n\t\t\t\tsegmentId: slashChild.id,\n\t\t\t\tsegment: localizedChildSegmentValue + \"/\",\n\t\t\t\twebPageId: slashChildWebPage.id,\n\t\t\t\tisDraft: !!slashChildWebPage.isDraft,\n\t\t\t\tisAbTesting: slashChildWebPage.hasAbTestingChildren(engine.tree),\n\t\t\t\tfullPath: getReadableRouteSegmentFullPath(engine.tree, engine.componentLoader, slashChild.id),\n\t\t\t\ttrailingSlashSegmentParentId: child.id,\n\t\t\t\tselfOrAncestorDataIdentifier,\n\t\t\t\tcollectionId: collectionData?.collectionId,\n\t\t\t\tcollectionName: collectionData?.collectionName,\n\t\t\t\tcollectionItemCount: collectionData?.collectionItemCount,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\t// Otherwise it's a folder.\n\t\tinfo.push({\n\t\t\ttype: \"folder\",\n\t\t\tsegmentId: child.id,\n\t\t\tsegment: localizedChildSegmentValue,\n\t\t\tfullPath: getReadableRouteSegmentFullPath(engine.tree, engine.componentLoader, child.id),\n\t\t\tselfOrAncestorDataIdentifier,\n\t\t\tcollectionId: collectionData?.collectionId,\n\t\t\tcollectionName: collectionData?.collectionName,\n\t\t\tcollectionItemCount: collectionData?.collectionItemCount,\n\t\t})\n\t}\n\n\treturn info\n}\n\nfunction getCollectionDataForRouteSegmentRow(\n\trouteSegmentNode: RouteSegmentNode,\n\tlocaleId: LocaleId,\n): CollectionData | null {\n\tconst { dataIdentifier } = routeSegmentNode\n\tif (!dataIdentifier) return null\n\n\tconst collectionData = engine.componentLoader.dataForIdentifier(dataIdentifier)\n\n\treturn {\n\t\tcollectionId: dataIdentifier,\n\t\tcollectionName: collectionData?.name ?? \"No Name\",\n\t\tcollectionItemCount: getCollectionItemCount(engine.tree, engine.componentLoader, dataIdentifier, localeId),\n\t}\n}\n\nexport function isFolderWebPage(node: RouteSegmentNode) {\n\tconst slashChild = node.children.find(child => isTrailingSlashSegmentNode(child) && isWithoutChildren(child))\n\tconst slashChildWebPage = engine.tree.get(slashChild?.webPageId)\n\treturn slashChild && isWebPageNode(slashChildWebPage) ? slashChild.id : null\n}\n\nexport function isFolderRouteSegmentNode(node: RouteSegmentNode) {\n\tconst webPage = engine.tree.get(node.webPageId)\n\treturn !isWebPageNode(webPage) && !isFolderWebPage(node)\n}\n", "import { IconPage, IconSidebarCollection, IconSidebarFolder, IconWebPageHome } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport type { ReactNode } from \"react\"\nimport { IconAgentCMS } from \"../../agentPanel/components/IconAgentCMS.tsx\"\nimport { IconAgentHome } from \"../../agentPanel/components/IconAgentHome.tsx\"\nimport { IconAgentPage } from \"../../agentPanel/components/IconAgentPage.tsx\"\nimport { IconAgentFolder } from \"../icons/IconAgentFolder.tsx\"\n\nexport function getRouteSegmentIcon({\n\tisHomePage,\n\tisFolder,\n\tisCollection,\n\tagentExperimentEnabled = false,\n}: {\n\tisHomePage: boolean\n\tisFolder: boolean\n\tisCollection: boolean\n\tagentExperimentEnabled?: boolean\n}): ReactNode {\n\tif (agentExperimentEnabled) {\n\t\tif (isHomePage) return <IconAgentHome />\n\t\tif (isCollection) return <IconAgentCMS />\n\t\tif (isFolder) return <IconAgentFolder />\n\t\treturn <IconAgentPage />\n\t}\n\n\tif (isHomePage) return <IconWebPageHome />\n\tif (isCollection) return <IconSidebarCollection />\n\tif (isFolder) return <IconSidebarFolder fill={colors.pageFolderIconFill} />\n\treturn <IconPage />\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { createWebPage, getLoadedWebPageTemplate } from \"document/components/utils/createWebPage.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { generateCollectionPageMetadata } from \"document/utils/contentCreationTemplates.ts\"\nimport { getSlugIdFromDataDefinition } from \"utils/collectionUtils.ts\"\nimport { getRawRouteSegmentFullPath } from \"./getRouteSegmentFullPath.ts\"\n\n/**\n * Create a new web page node and associate it to the given route segment.\n */\nexport async function convertFolderToWebPage(engine: VekterEngine, segmentId: NodeID): Promise<void> {\n\tlet segmentNode = engine.tree.get<RouteSegmentNode>(segmentId)\n\tif (!segmentNode?.segment) return\n\n\tconst routeSegmentRoot = getRouteSegmentRootNode(engine.tree)\n\tconst dataIdentifier = routeSegmentRoot.getDataIdentifierByRouteSegmentId(engine.tree, segmentId)\n\tconst collectionData = dataIdentifier ? engine.componentLoader.dataForIdentifier(dataIdentifier) : undefined\n\n\tconst loadedTemplate = await getLoadedWebPageTemplate(engine)\n\n\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\tsegmentNode = engine.tree.current(segmentNode)\n\t\tif (!segmentNode) return\n\n\t\tconst webPage = createWebPage({\n\t\t\tengine,\n\t\t\tname:\n\t\t\t\tsegmentNode.dataIdentifier || collectionData ? (collectionData?.name ?? Dictionary.Page) : segmentNode.segment,\n\t\t\tpagePath: getRawRouteSegmentFullPath(engine.tree, engine.componentLoader, segmentNode.id),\n\t\t\texistingRouteSegment: segmentNode,\n\t\t\tdataIdentifier,\n\t\t\tloadedTemplate,\n\t\t})\n\n\t\tif (dataIdentifier && collectionData) {\n\t\t\tconst slugId = getSlugIdFromDataDefinition(collectionData)\n\n\t\t\tObject.entries(collectionData.properties).forEach(([key, description]) => {\n\t\t\t\tif (key === slugId) return\n\t\t\t\tif (description?.type === \"string\") {\n\t\t\t\t\tgenerateCollectionPageMetadata(engine, webPage, description, key)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n}\n", "export function buildSubLabel(parts: readonly (string | undefined)[]): string | undefined {\n\tconst subLabel = parts.filter((part): part is string => Boolean(part)).join(\" \u00B7 \")\n\treturn subLabel || undefined\n}\n", "import { isUndefined } from \"utils/typeChecks.ts\"\n\nexport function formatCollectionItemCount(count: number | undefined) {\n\treturn isUndefined(count) ? undefined : count.toLocaleString(\"en-US\")\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { buildSubLabel } from \"../../shared/utils/buildSubLabel.ts\"\nimport { formatCollectionItemCount } from \"./formatCollectionItemCount.ts\"\n\ninterface Params {\n\tcollectionItemCount: number | undefined\n\tisAgentExperimentOn: boolean\n\tisDraft: boolean | undefined\n\tisAbTesting: boolean | undefined\n\tisExpanded: boolean\n\tisSelected: boolean\n}\n\nfunction getBadge({\n\tisAgentExperimentOn,\n\tisDraft,\n\tisAbTesting,\n\tisExpanded,\n\tisSelected,\n}: Omit<Params, \"collectionItemCount\">) {\n\tif (!isAgentExperimentOn && isDraft) return Dictionary.Draft\n\tif (isAbTesting && !isExpanded && !isSelected) return Dictionary.A_B\n\n\treturn undefined\n}\n\nexport function getRouteSegmentRowLabels({\n\tcollectionItemCount,\n\tisAgentExperimentOn,\n\tisDraft,\n\tisAbTesting,\n\tisExpanded,\n\tisSelected,\n}: Params) {\n\tconst countLabel = formatCollectionItemCount(collectionItemCount)\n\tconst subLabel = isAgentExperimentOn ? buildSubLabel([isDraft ? Dictionary.Draft : undefined, countLabel]) : undefined\n\tconst inlineLabel = !isAgentExperimentOn && countLabel ? `\u2219 ${countLabel}` : undefined\n\tconst badge = getBadge({ isAgentExperimentOn, isDraft, isAbTesting, isExpanded, isSelected })\n\n\treturn { subLabel, inlineLabel, badge }\n}\n", "import type { ModalOpenSource } from \"@framerjs/events\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\n\ninterface Params {\n\twebPageId: NodeID\n\tsegmentId: NodeID | undefined\n\tenabled: boolean\n\tvisible?: boolean\n\tsource: ModalOpenSource\n}\n\nexport function getTranslateContentMenuItem({\n\twebPageId,\n\tsegmentId,\n\tenabled,\n\tvisible,\n\tsource,\n}: Params): MenuItemOptions {\n\treturn {\n\t\tlabel: `${Dictionary.Translate} ${Dictionary.Content}`,\n\t\tenabled,\n\t\tvisible,\n\t\tclick: async () => {\n\t\t\tconst webPageNode = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)\n\t\t\tif (!webPageNode) return\n\t\t\tconst loadedWebPageNode = await webPageNode.load()\n\t\t\tif (!loadedWebPageNode) return\n\n\t\t\tconst selectedNodesAndDescendants: NodeID[] = [loadedWebPageNode.id]\n\n\t\t\tconst routeSegmentNode = engine.tree.get(segmentId)\n\t\t\tif (routeSegmentNode) {\n\t\t\t\tselectedNodesAndDescendants.push(routeSegmentNode.id)\n\t\t\t}\n\n\t\t\tfor (const descendant of loadedWebPageNode.descendants()) {\n\t\t\t\tselectedNodesAndDescendants.push(descendant.id)\n\t\t\t}\n\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.ConfirmBatchTranslateLayers,\n\t\t\t\tnodeIds: selectedNodesAndDescendants,\n\t\t\t\tsource,\n\t\t\t})\n\t\t},\n\t}\n}\n", "import { IconPage, IconSidebarCollection, IconWebPageHome } from \"@framerjs/fresco\"\nimport { experiments } from \"app/experiments.ts\"\nimport { FullDocumentLoadCancelledError, type VekterEngine } from \"document/VekterEngine.ts\"\nimport { getWebPageDisplayTitle } from \"document/components/utils/webPageTitles.ts\"\nimport type { LoadedWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { isRouteSegmentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getWebPageNodes } from \"document/stores/ScopeStore.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport pluralize from \"pluralize\"\nimport { ButtonSheet, ButtonSheetItem } from \"../../contentManagement/utils/ButtonSheet.tsx\"\nimport type { CmsLinkReference } from \"./findCmsItemsLinkingToPage.ts\"\nimport { findCmsItemsLinkingToPage } from \"./findCmsItemsLinkingToPage.ts\"\nimport type { PageLinkReference } from \"./findWebPagesLinkingToPage.ts\"\nimport { findWebPagesLinkingToPage } from \"./findWebPagesLinkingToPage.ts\"\nimport { promptAndDeleteSegment } from \"./promptAndDeleteRouteSegment.ts\"\n\nconst pageIcons = {\n\thome: <IconWebPageHome />,\n\tcollection: <IconSidebarCollection />,\n\tother: <IconPage />,\n}\n\nfunction iconForPage(engine: VekterEngine, pageNode: LoadedWebPageNode) {\n\tif (engine.tree.root.homePageNodeId === pageNode.id) return pageIcons.home\n\tif (pageNode.dataIdentifier) return pageIcons.collection\n\treturn pageIcons.other\n}\n\ntype ReferenceItem = { type: \"page\"; reference: PageLinkReference } | { type: \"cms\"; reference: CmsLinkReference }\n\nfunction buildDescriptionWithReferences(\n\tengine: VekterEngine,\n\tlinkingPages: PageLinkReference[],\n\tcmsReferences: CmsLinkReference[],\n): React.ReactNode {\n\tconst allReferences: ReferenceItem[] = [\n\t\t...linkingPages.map((reference): ReferenceItem => ({ type: \"page\", reference })),\n\t\t...cmsReferences.map((reference): ReferenceItem => ({ type: \"cms\", reference })),\n\t]\n\tconst firstFiveReferences = allReferences.slice(0, 5)\n\tconst numRemainingReferences = allReferences.length - 5\n\n\tfunction navigateToLinkingNode(webPageId: NodeID, linkingNodeId: NodeID) {\n\t\tengine.stores.scopeStore.select(webPageId, { keepHistory: false })\n\t\tengine.stores.selectionStore.set(linkingNodeId)\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Layers\n\t\tengine.stores.modalStore.dismiss()\n\t}\n\n\tfunction navigateToCmsItem(itemId: NodeID, variableId: VariableID) {\n\t\tengine.stores.chromeStore.chromeIsVisible = true\n\t\tengine.stores.scopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\tengine.stores.selectionStore.set(itemId)\n\t\tengine.stores.contentManagementStore.setCollectionItemControlToHighlight(variableId)\n\t\tengine.stores.modalStore.dismiss()\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{`This page is linked to from ${numRemainingReferences > 0 ? `${allReferences.length} ${pluralize(\"place\", allReferences.length)}` : `the ${pluralize(\"place\", firstFiveReferences.length)} below`}. Deleting will break ${allReferences.length === 1 ? \"this link\" : \"these links\"}.`}\n\t\t\t<ReferencesList\n\t\t\t\tengine={engine}\n\t\t\t\treferences={firstFiveReferences}\n\t\t\t\tnavigateToLinkingNode={navigateToLinkingNode}\n\t\t\t\tnavigateToCmsItem={navigateToCmsItem}\n\t\t\t/>\n\t\t</>\n\t)\n}\n\ninterface ReferencesListProps {\n\tengine: VekterEngine\n\treferences: ReferenceItem[]\n\tnavigateToLinkingNode: (webPageId: NodeID, linkingNodeId: NodeID) => void\n\tnavigateToCmsItem: (itemId: NodeID, variableId: VariableID) => void\n}\n\nfunction ReferencesList({ engine, references, navigateToLinkingNode, navigateToCmsItem }: ReferencesListProps) {\n\treturn (\n\t\t<ButtonSheet variant=\"filled\">\n\t\t\t{references.map(item => {\n\t\t\t\tif (item.type === \"page\") {\n\t\t\t\t\tconst data = engine.componentLoader.dataForIdentifier(item.reference.webPage.dataIdentifier)\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ButtonSheetItem\n\t\t\t\t\t\t\tvariant=\"filled\"\n\t\t\t\t\t\t\tkey={item.reference.webPage.id}\n\t\t\t\t\t\t\tstartIcon={iconForPage(engine, item.reference.webPage)}\n\t\t\t\t\t\t\ttitle={getWebPageDisplayTitle(engine.tree, item.reference.webPage, data ?? null)}\n\t\t\t\t\t\t\tonClick={() => navigateToLinkingNode(item.reference.webPage.id, item.reference.linkingNodeId)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<ButtonSheetItem\n\t\t\t\t\t\tvariant=\"filled\"\n\t\t\t\t\t\tkey={`${item.reference.itemId}-${item.reference.variableId}`}\n\t\t\t\t\t\tstartIcon={<IconSidebarCollection />}\n\t\t\t\t\t\ttitle={`${item.reference.collectionName} \u00B7 ${item.reference.fieldName}`}\n\t\t\t\t\t\tonClick={() => navigateToCmsItem(item.reference.itemId, item.reference.variableId)}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</ButtonSheet>\n\t)\n}\n\n/**\n * Loads all web pages and CMS data, checks for incoming links to the target\n * page, and shows an enhanced deletion prompt that lists linking pages and\n * CMS items if any exist.\n */\nexport async function promptAndDeleteSegmentWithReferenceCheck(engine: VekterEngine, segmentId: NodeID) {\n\tconst partialTree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\tconst routeSegmentNode = partialTree.getNodeWithTrait(segmentId, isRouteSegmentNode)\n\tif (!routeSegmentNode) return\n\n\tconst webPageId = routeSegmentNode.webPageId\n\tif (!webPageId || experiments.get(\"pageLinkReferenceCheck\") !== \"on\") {\n\t\tpromptAndDeleteSegment(engine, segmentId)\n\t\treturn\n\t}\n\n\ttry {\n\t\tif (!engine.stores.treeStore.getDataTree()) {\n\t\t\tawait engine.runWithFullyLoadedTreeAsync({\n\t\t\t\tname: \"load_scopes_before_delete_page_reference_check\",\n\t\t\t\tmodalTitle: \"Loading Pages\\u2026\",\n\t\t\t\tmodalDescription: \"To delete your pages we have to load your entire project. Just a moment\\u2026\",\n\t\t\t\tcancellable: true,\n\t\t\t})\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof FullDocumentLoadCancelledError) return\n\t\tthrow error\n\t}\n\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\n\tconst allWebPages = getWebPageNodes(tree)\n\tconst loadedWebPages = allWebPages.filter(\n\t\t(webPage): webPage is LoadedWebPageNode => isWebPageNode(webPage) && Boolean(webPage.loaded),\n\t)\n\n\tconst linkingPages = findWebPagesLinkingToPage(loadedWebPages, webPageId, engine.componentLoader)\n\tconst cmsReferences = findCmsItemsLinkingToPage(tree, webPageId)\n\n\tif (linkingPages.length > 0 || cmsReferences.length > 0) {\n\t\tconst description = buildDescriptionWithReferences(engine, linkingPages, cmsReferences)\n\n\t\tpromptAndDeleteSegment(engine, segmentId, {\n\t\t\tdescription,\n\t\t\thasLinks: true,\n\t\t})\n\t} else {\n\t\tpromptAndDeleteSegment(engine, segmentId)\n\t}\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\n\nexport interface CmsLinkReference {\n\tcollectionId: NodeID\n\tcollectionName: string\n\titemId: NodeID\n\tfieldName: string\n\tvariableId: VariableID\n}\n\nexport function findCmsItemsLinkingToPage(tree: CanvasTree, targetWebPageId: NodeID): CmsLinkReference[] {\n\tconst results: CmsLinkReference[] = []\n\tconst contentManagementNode = getContentManagementNode(tree)?.loaded\n\tif (!contentManagementNode) return results\n\n\tfor (const collection of contentManagementNode.children) {\n\t\tconst collectionName = collection.resolveValue(\"name\") ?? Dictionary.Unknown\n\n\t\tfor (const item of collection.getUnsortedChildren()) {\n\t\t\tconst controlProps = item.getControlProps()\n\n\t\t\tfor (const variableId in controlProps) {\n\t\t\t\tconst controlProp = controlProps[variableId]\n\t\t\t\tif (!controlProp || controlProp.type !== ControlType.Link) continue\n\n\t\t\t\tif (isLinkToWebPage(controlProp.value) && controlProp.value.webPageId === targetWebPageId) {\n\t\t\t\t\tconst variableDefinition = collection.getVariable(variableId)\n\t\t\t\t\tresults.push({\n\t\t\t\t\t\tcollectionId: collection.id,\n\t\t\t\t\t\tcollectionName,\n\t\t\t\t\t\titemId: item.id,\n\t\t\t\t\t\tfieldName: variableDefinition?.name ?? variableId,\n\t\t\t\t\t\tvariableId,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn results\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { LoadedWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode, isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withControlProps } from \"document/models/CanvasTree/traits/WithControlProps.ts\"\nimport { withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isFramerPageLink, parseFramerPageLink } from \"library/modules/framerPageLink.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\n\nexport interface PageLinkReference {\n\twebPage: LoadedWebPageNode\n\tlinkingNodeId: NodeID\n}\n\n/**\n * Returns the ID of the first node in a web page that links to the given\n * target web page, or null if none is found. Checks:\n * - Node-level links (WithLink trait)\n * - Rich text inline links\n * - Legacy text node inline links (framer/page-link format)\n * - Code component control props of type ControlType.Link\n */\nfunction findFirstLinkingNode(\n\twebPage: LoadedWebPageNode,\n\ttargetWebPageId: NodeID,\n\tcomponentLoader: AnyComponentLoader,\n): NodeID | null {\n\tfor (const node of webPage.descendants()) {\n\t\tif (withLink(node)) {\n\t\t\tconst link = node.getLink()\n\t\t\tif (isLinkToWebPage(link) && link.webPageId === targetWebPageId) {\n\t\t\t\treturn node.id\n\t\t\t}\n\t\t}\n\n\t\tif (isRichTextNode(node)) {\n\t\t\tconst links = node.getLinks(false)\n\t\t\tfor (const link of links) {\n\t\t\t\tif (isLinkToWebPage(link) && link.webPageId === targetWebPageId) {\n\t\t\t\t\treturn node.id\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (isTextNode(node)) {\n\t\t\tconst inlineLinks = node.getInlineLinks(false)\n\t\t\tfor (const inlineLink of inlineLinks) {\n\t\t\t\tif (!inlineLink || !isFramerPageLink(inlineLink)) continue\n\t\t\t\tconst parsed = parseFramerPageLink(inlineLink)\n\t\t\t\tif (parsed?.target === targetWebPageId) {\n\t\t\t\t\treturn node.id\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (withControlProps(node)) {\n\t\t\tconst identifier = node.getControlPropSourceIdentifier()\n\t\t\tif (identifier) {\n\t\t\t\tconst propertyControls = componentLoader.getPropertyControlsForIdentifier(identifier)\n\t\t\t\tif (propertyControls) {\n\t\t\t\t\tconst controlProps = node.getControlProps(propertyControls)\n\t\t\t\t\tfor (const controlKey in controlProps) {\n\t\t\t\t\t\tconst controlProp = controlProps[controlKey]\n\t\t\t\t\t\tif (!controlProp || controlProp.type !== ControlType.Link) continue\n\t\t\t\t\t\tif (isLinkToWebPage(controlProp.value) && controlProp.value.webPageId === targetWebPageId) {\n\t\t\t\t\t\t\treturn node.id\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\treturn null\n}\n\n/**\n * Finds all loaded web pages that contain links to the given target web page,\n * along with the ID of the first linking node in each page.\n */\nexport function findWebPagesLinkingToPage(\n\twebPages: readonly LoadedWebPageNode[],\n\ttargetWebPageId: NodeID,\n\tcomponentLoader: AnyComponentLoader,\n): PageLinkReference[] {\n\tconst results: PageLinkReference[] = []\n\n\tfor (const webPage of webPages) {\n\t\tif (webPage.id === targetWebPageId) continue\n\n\t\tconst linkingNodeId = findFirstLinkingNode(webPage, targetWebPageId, componentLoader)\n\t\tif (linkingNodeId !== null) {\n\t\t\tresults.push({ webPage, linkingNodeId })\n\t\t}\n\t}\n\n\treturn results\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getUniquePagePath } from \"document/components/utils/getUniquePagePath.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { isRouteSegmentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport { isWithoutChildren } from \"./commons.ts\"\n\nexport function setHomePage(\n\tengine: VekterEngine,\n\t{\n\t\tsegmentId,\n\t\ttype,\n\t\twebPageId,\n\t}: {\n\t\tsegmentId?: NodeID\n\t\ttype: \"home\" | \"webPage\"\n\t\twebPageId: NodeID\n\t},\n) {\n\tif (type === \"home\") return\n\n\tconst currentRouteSegment = engine.tree.get(segmentId)\n\tif (!isRouteSegmentNode(currentRouteSegment)) return\n\n\tcurrentRouteSegment.set({ webPageId: undefined })\n\tif (isWithoutChildren(currentRouteSegment)) engine.tree.remove(currentRouteSegment.id)\n\n\tconst newHomePage = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)\n\tassert(newHomePage, \"The new home page must be a web page.\")\n\n\tconst homePageId = engine.tree.root.homePageNodeId\n\tconst currentHomePage = engine.tree.getNodeWithTrait(homePageId, isWebPageNode)\n\tif (currentHomePage) {\n\t\tconst previousHomePageSegment = new RouteSegmentNode({\n\t\t\tsegment: slugify(getUniquePagePath(\"old-home\", engine.tree, engine.componentLoader, null).path),\n\t\t\twebPageId: homePageId,\n\t\t})\n\t\tconst currentLayoutTemplateIdentifier = currentHomePage.layoutTemplateIdentifier\n\t\tengine.tree.insertNode(previousHomePageSegment, ROUTE_SEGMENT_ROOT_NODE_ID, -1)\n\n\t\tcurrentHomePage.set({ layoutTemplateIdentifier: currentLayoutTemplateIdentifier ?? undefined })\n\t}\n\n\tnewHomePage.set({ layoutTemplateIdentifier: undefined })\n\n\tengine.tree.root.set({\n\t\thomePageNodeId: webPageId,\n\t\tlayoutTemplateIdentifier: newHomePage.layoutTemplateIdentifier ?? undefined,\n\t})\n}\n", "import { slugify } from \"./slugify.ts\"\n\nconst removeSlashesRegExp = /\\//gu\n\nexport function sanitizePagePathSegment(value: string): string {\n\tconst base = slugify(value)\n\tif (base === \"\") return \"\"\n\treturn base.replace(removeSlashesRegExp, \"\")\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport { sanitizePagePathSegment } from \"library/utils/sanitizePagePathSegment.ts\"\nimport { getLocalizedValueForActiveLocale } from \"../../localization/getValueForActiveLocale.ts\"\nimport { type LocalizedValueTrackingSource, setLocalizedValue } from \"../../localization/updateLocalizedValue.ts\"\nimport { showPageExistsToast } from \"../../shared/showPageExistsToast.ts\"\n\ninterface Params {\n\tsegmentId: NodeID | undefined\n\ttrailingSlashSegmentParentId: NodeID | undefined\n\tactiveLocale: Locale | undefined\n\tactiveRouterLocale: RouterLocale | undefined\n\tisViewOnly: boolean\n\ttrackingSource: LocalizedValueTrackingSource\n}\n\nexport function useLocalizedPathRenameHandler({\n\tsegmentId,\n\ttrailingSlashSegmentParentId,\n\tactiveLocale,\n\tactiveRouterLocale,\n\tisViewOnly,\n\ttrackingSource,\n}: Params) {\n\treturn useEngineCallback(\n\t\t(_id: string, newValue: string, _final: boolean, reset: () => void) => {\n\t\t\tconst sanitizedValue = sanitizePagePathSegment(newValue)\n\t\t\tif (sanitizedValue === \"\") {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isViewOnly || !segmentId || !activeRouterLocale || !activeLocale) return\n\n\t\t\t// If we're editing a trailing slash page it is because the parent segment doesn't have its own page,\n\t\t\t// we need to edit the parent segment instead of the trailing slash segment\n\t\t\tconst effectiveSegmentId = trailingSlashSegmentParentId || segmentId\n\n\t\t\tconst source = engine.stores.localizationStore.getSourceForKeyPath(effectiveSegmentId)\n\t\t\tif (!source) return\n\n\t\t\tconst routeSegmentNode = engine.tree.get(effectiveSegmentId)\n\t\t\tif (!isRouteSegmentNode(routeSegmentNode)) return\n\n\t\t\t// Check for duplicate slugs in sibling segments\n\t\t\tconst parentNode = engine.tree.getParent(routeSegmentNode.id)\n\t\t\tif (parentNode) {\n\t\t\t\tfor (const sibling of parentNode.children) {\n\t\t\t\t\tif (!isRouteSegmentNode(sibling)) continue\n\t\t\t\t\tif (sibling.id === effectiveSegmentId) continue\n\t\t\t\t\tif (sibling.dataIdentifier) continue\n\n\t\t\t\t\tconst siblingLocalizedValue = getLocalizedValueForActiveLocale(activeRouterLocale, sibling.segmentLocalized)\n\t\t\t\t\tconst localizedSiblingSegment = siblingLocalizedValue?.value || sibling.segment\n\t\t\t\t\tif (sanitizedValue === localizedSiblingSegment) {\n\t\t\t\t\t\tshowPageExistsToast(false)\n\t\t\t\t\t\treset()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsetLocalizedValue(engine, sanitizedValue, source, activeLocale, { trackingSource })\n\t\t},\n\t\t[segmentId, trailingSlashSegmentParentId, activeLocale, activeRouterLocale, isViewOnly, trackingSource],\n\t)\n}\n", "import { Draggable } from \"@framerjs/fresco/layout-transitions\"\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 { EngineContext } from \"document/base-engine/BaseEngine.ts\"\nimport engine from \"document/engine.ts\"\nimport { AnalyticsScopeNode, type NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useCallback, useRef } from \"react\"\nimport { useScrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { promptAddAbVariant } from \"../analytics/utils/promptAddAbVariant.ts\"\nimport { promptDeleteAbVariant } from \"../analytics/utils/promptDeleteAbVariant.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { selectedSibling } from \"../shared/utils/panelMultiSelect.styles.ts\"\nimport * as routeSegmentRowStyles from \"./RouteSegmentRow.styles.ts\"\nimport { getRouteSegmentMultiSelectMenu, shouldShowMultiSelectMenu } from \"./getRouteSegmentMultiSelectMenu.ts\"\nimport type { SelectableRouteSegmentRenderRow } from \"./useRouteSegmentList.types.ts\"\nimport { MAX_AB_TESTING_VARIANTS } from \"./useRouteSegmentList.types.ts\"\nimport { getDragPreviewRows, useRouteSegmentRowDragDrop } from \"./useRouteSegmentRowDragDrop.tsx\"\nimport { editPageTitle, getPageInputId } from \"./utils/editPageRow.ts\"\n\nexport interface Props {\n\twebPageId: NodeID\n\twebPageName: string | null\n\tdepth: number\n\tisControl: boolean\n\tisSelected: boolean\n\tisViewOnly: boolean\n\tIcon: React.FunctionComponent | JSX.Element | React.ReactNode\n\tonClick: ({ webPageId }: { webPageId: NodeID }) => void\n\tgetSelectedRows: () => readonly SelectableRouteSegmentRenderRow[]\n\tgetDraggableRouteSegmentNodes: () => readonly RouteSegmentNode[]\n\tresetSelection?: ({ webPageId }: { webPageId?: NodeID }) => void\n}\n\nexport function RouteSegmentVariantRow({\n\twebPageId,\n\tdepth,\n\tisControl,\n\tisSelected,\n\tisViewOnly,\n\tIcon,\n\twebPageName,\n\tonClick,\n\tgetSelectedRows,\n\tgetDraggableRouteSegmentNodes,\n\tresetSelection,\n}: Props) {\n\tconst title = isControl ? \"Control\" : (webPageName ?? Dictionary.Variant)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst handleTitleChange = useEngineCallback(\n\t\t(id: NodeID, name: string, _final: boolean, _reset: () => void) => {\n\t\t\tif (isViewOnly) return\n\t\t\tconst variantPage = engine.tree.getNodeWithTrait(id, isWebPageNode)\n\t\t\tif (!variantPage) return\n\t\t\tvariantPage.set({ name })\n\t\t\trecord(\"ab_variant_rename\", {\n\t\t\t\tpageId: variantPage.id,\n\t\t\t\tabTestingParentId: variantPage.abTestingParentId ?? variantPage.id,\n\t\t\t})\n\t\t},\n\t\t[isViewOnly],\n\t)\n\n\tconst getMenuOptions = useEngineCallback(\n\t\t(nodeId: NodeID): MenuItemOptions[] => {\n\t\t\tconst selectedRows = getSelectedRows()\n\n\t\t\tif (shouldShowMultiSelectMenu(isSelected, selectedRows)) {\n\t\t\t\treturn getRouteSegmentMultiSelectMenu(engine, selectedRows, isViewOnly, resetSelection)\n\t\t\t}\n\n\t\t\tconst webPageNode = engine.tree.getNodeWithTrait(nodeId, isWebPageNode)\n\t\t\tif (!webPageNode) return []\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tenabled:\n\t\t\t\t\t\t!isViewOnly && (webPageNode.getAbTestingChildren(engine.tree)?.length ?? 0) < MAX_AB_TESTING_VARIANTS,\n\t\t\t\t\tclick: () =>\n\t\t\t\t\t\tengine.loadScopesThenProcess(\n\t\t\t\t\t\t\t[webPageNode, AnalyticsScopeNode.get(engine.tree)],\n\t\t\t\t\t\t\t([webPage, analyticsScope]) =>\n\t\t\t\t\t\t\t\twebPage ? promptAddAbVariant(engine, webPage, analyticsScope, \"context_menu\") : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Rename,\n\t\t\t\t\tenabled: !isViewOnly && !isControl,\n\t\t\t\t\tclick: () => editPageTitle(nodeId),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\tenabled: !isViewOnly && !isControl,\n\t\t\t\t\tclick: () =>\n\t\t\t\t\t\tengine.loadScopesThenProcess(\n\t\t\t\t\t\t\t[webPageNode, AnalyticsScopeNode.get(engine.tree)],\n\t\t\t\t\t\t\t([webPage, analyticsScope]) =>\n\t\t\t\t\t\t\t\twebPage ? promptDeleteAbVariant(engine, webPage, analyticsScope) : undefined,\n\t\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t]\n\t\t},\n\t\t[isViewOnly, isControl, isSelected, getSelectedRows, resetSelection],\n\t)\n\n\tconst { handleDragStart } = useRouteSegmentRowDragDrop({\n\t\ttype: \"variant\",\n\t\twebPageId,\n\t\tisSelected,\n\t\tisCollapsible: false,\n\t\tisExpanded: false,\n\t\tisViewOnly,\n\t\tisEditable: false,\n\t\tgetDraggableRouteSegmentNodes,\n\t})\n\n\tconst handleSelect = useCallback(() => {\n\t\tonClick({ webPageId })\n\t}, [onClick, webPageId])\n\n\tconst rowRef = useRef<HTMLDivElement>(null)\n\tuseScrollIntoView(rowRef, isSelected)\n\n\treturn (\n\t\t<div className={cx(routeSegmentRowStyles.rowContainer, isSelected && selectedSibling)}>\n\t\t\t<Draggable\n\t\t\t\t// With multi-select, variants can *start* a drag, but they cannot be included in the drag\n\t\t\t\t// data.\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\thideDragSource={false}\n\t\t\t>\n\t\t\t\t{({ isDragPreview }) => {\n\t\t\t\t\tconst draggedNodes = isDragPreview && isSelected ? getDraggableRouteSegmentNodes() : null\n\t\t\t\t\tconst shouldShowPreviewRows = draggedNodes && (draggedNodes.length > 1 || isSelected)\n\n\t\t\t\t\tif (isDragPreview && shouldShowPreviewRows) return getDragPreviewRows(draggedNodes, agentExperimentEnabled)\n\n\t\t\t\t\tif (isDragPreview) return null\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<EngineContext.Provider value={engine}>\n\t\t\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\t\t\tref={rowRef}\n\t\t\t\t\t\t\t\tid={webPageId}\n\t\t\t\t\t\t\t\tinputId={getPageInputId(webPageId)}\n\t\t\t\t\t\t\t\tdataTestId=\"page-row\"\n\t\t\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\t\t\tIcon={Icon}\n\t\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\t\t// If the handler is not set on `mouseUp`, the click handler will fire off before drag & drop\n\t\t\t\t\t\t\t\t// can begin. This will mean only single-selects Drag & Drop will work. The other case would be to\n\t\t\t\t\t\t\t\t// block single clicks on an already selected row, which means the user would not be able to\n\t\t\t\t\t\t\t\t// take a multi-select and turn it into a single select.\n\t\t\t\t\t\t\t\tonMouseUp={handleSelect}\n\t\t\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\t\t\t// Edit\n\t\t\t\t\t\t\t\tisEditable={!isViewOnly && !isControl}\n\t\t\t\t\t\t\t\ttitleOnEdit={title}\n\t\t\t\t\t\t\t\tonTitleChange={handleTitleChange}\n\t\t\t\t\t\t\t\t// Collapse\n\t\t\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\t\t\tdepth={depth}\n\t\t\t\t\t\t\t\tisCollapsible={false}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</EngineContext.Provider>\n\t\t\t\t\t)\n\t\t\t\t}}\n\t\t\t</Draggable>\n\t\t</div>\n\t)\n}\n", "import \"RouteSegments.styles_1axrolu.wyw.css\"; export const panelContainer = \"panelContainer_p1gjrh06\";\nexport const disableHorizontalOverflowWhenDragging = \"disableHorizontalOverflowWhenDragging_d1w15mfv\";", "import { IconPageVariant } from \"@framerjs/fresco\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { RouteSegmentNode } from \"document/models/CanvasTree/nodes/RouteSegmentNode.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { isRouteSegmentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale, LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type { Locale as RouterLocale } from \"library/router/types.ts\"\nimport { useCallback, useRef, useState } from \"react\"\nimport { isDefined, isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { ContentPanelPage } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport type { Folder, HomePage, WebPage } from \"./RouteSegment.types.ts\"\nimport { IconAgentPageVariantA } from \"./icons/IconAgentPageVariantA.tsx\"\nimport { IconAgentPageVariantB } from \"./icons/IconAgentPageVariantB.tsx\"\nimport { IconAgentPageVariantC } from \"./icons/IconAgentPageVariantC.tsx\"\nimport { IconAgentPageVariantD } from \"./icons/IconAgentPageVariantD.tsx\"\nimport { IconAgentPageVariantE } from \"./icons/IconAgentPageVariantE.tsx\"\nimport { usePagesMultiSelect } from \"./usePagesMultiSelect.ts\"\nimport { getRouteSegmentChildrenRows } from \"./useRouteSegmentChildrenRows.ts\"\nimport type { RouteSegmentRenderRow, SelectableRouteSegmentRenderRow } from \"./useRouteSegmentList.types.ts\"\nimport { MAX_AB_TESTING_VARIANTS, isDividerRow, isHomePageRow, isVariantRow } from \"./useRouteSegmentList.types.ts\"\nimport type { AbTestingVariant } from \"./utils/getAbTestingVariants.ts\"\nimport { getAbTestingVariants } from \"./utils/getAbTestingVariants.ts\"\n\ninterface HomePageConfig {\n\tshowHomePage: boolean\n\tisHomePageAbTesting: boolean\n\thomePageId: NodeID\n}\n\ninterface SharedProps {\n\tisViewOnly: boolean\n\tactiveRouteSegmentIds: ReadonlySet<NodeID> | undefined\n\tisPreviewingLocaleOnCanvas?: boolean\n\tactiveRouterLocale?: RouterLocale | undefined\n\tactiveCanvasLocale?: Locale | undefined\n}\n\nfunction getSelectedPageIdFromActivePage(activePageId: NodeID): NodeID | undefined {\n\tconst node = engine.tree.getNode(activePageId)\n\tif (!isWebPageNode(node)) return\n\n\tconst activePageSelectionId = getSelectionId(activePageId, undefined)\n\tif (isNull(activePageSelectionId)) return\n\n\treturn activePageSelectionId\n}\n\nfunction getSelectionIdForRouteSegment(row: RouteSegmentRenderRow): NodeID | null {\n\tif (isDividerRow(row)) return null\n\n\tconst segmentId = !isVariantRow(row) ? row.segmentId : undefined\n\treturn getSelectionId(row.webPageId, segmentId)\n}\n\nexport function useRouteSegmentList(\n\t{ showHomePage, homePageId, isHomePageAbTesting }: HomePageConfig,\n\tsharedProps: SharedProps,\n\tisFiltering: boolean,\n\tactivePageId: NodeID | undefined,\n\tlocaleId: LocaleId,\n\tmatchingRouteSegmentIds: ReadonlySet<NodeID> | undefined,\n\trouteItems: readonly (WebPage | Folder)[],\n): {\n\trouteSegmentList: readonly RouteSegmentRenderRow[]\n\thandleSegmentClick: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => void\n\tgetIsRouteSegmentSelected: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => boolean\n\tgetSelectedRows: () => readonly SelectableRouteSegmentRenderRow[]\n\tgetDraggableRouteSegmentNodes: () => readonly RouteSegmentNode[]\n\tresetSelection: ({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => void\n} {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst routeSegmentList = useEngineState<readonly RouteSegmentRenderRow[]>(\n\t\t() => {\n\t\t\tif (!showHomePage && routeItems.length === 0) return emptyArray<RouteSegmentRenderRow>()\n\n\t\t\tconst routeSegmentList: RouteSegmentRenderRow[] = []\n\n\t\t\tconst combinedRouteItems: readonly (HomePage | WebPage | Folder)[] = showHomePage\n\t\t\t\t? [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"home\",\n\t\t\t\t\t\t\twebPageId: homePageId,\n\t\t\t\t\t\t\tisAbTesting: isHomePageAbTesting,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...routeItems,\n\t\t\t\t\t]\n\t\t\t\t: routeItems\n\n\t\t\tconst pathTranslationEnabled = engine.tree.root.translatePagePaths === \"yes\"\n\n\t\t\tbuildRouteSegmentTree(\n\t\t\t\tsharedProps,\n\t\t\t\tisFiltering,\n\t\t\t\tactivePageId,\n\t\t\t\tlocaleId,\n\t\t\t\tmatchingRouteSegmentIds,\n\t\t\t\tcombinedRouteItems,\n\t\t\t\t0,\n\t\t\t\trouteSegmentList,\n\t\t\t\tpathTranslationEnabled,\n\t\t\t\tagentExperimentEnabled,\n\t\t\t)\n\n\t\t\treturn routeSegmentList\n\t\t},\n\t\t[\n\t\t\tshowHomePage,\n\t\t\thomePageId,\n\t\t\tisHomePageAbTesting,\n\t\t\tsharedProps,\n\t\t\tisFiltering,\n\t\t\tactivePageId,\n\t\t\tmatchingRouteSegmentIds,\n\t\t\trouteItems,\n\t\t\tagentExperimentEnabled,\n\t\t\tlocaleId,\n\t\t],\n\t\t[\n\t\t\t// The following are for getting latest route segment children info\n\t\t\tEngineChange.ActiveBundle,\n\t\t\tEngineChange.Tree,\n\t\t\tengine.stores.chromeStore,\n\t\t\tengine.stores.localizationStore,\n\t\t\t// The below is for getting latest ab testing variants\n\t\t\tEngineChange.TreeStore,\n\t\t],\n\t\t{ deepEqual: true },\n\t)\n\n\t// The refs are set in order to ensure a stable callback of the below methods as they are\n\t// not called during renders.\n\tconst routeSegmentRowsRef = useRef<readonly RouteSegmentRenderRow[]>(routeSegmentList)\n\trouteSegmentRowsRef.current = routeSegmentList\n\n\tconst getRenderedIds = useCallback(() => {\n\t\tconst renderedIds: NodeID[] = []\n\t\trouteSegmentRowsRef.current.forEach(routeSegment => {\n\t\t\tconst selectionId = getSelectionIdForRouteSegment(routeSegment)\n\t\t\tif (isNull(selectionId)) return\n\t\t\trenderedIds.push(selectionId)\n\t\t})\n\t\treturn renderedIds\n\t}, [])\n\n\tconst {\n\t\tselectedPages: selectedSegmentIds,\n\t\tgetIsPageSelected,\n\t\thandlePageClick,\n\t\tresetSelection: baseResetSelection,\n\t} = usePagesMultiSelect(ContentPanelPage.Routes, getRenderedIds, activePageId)\n\n\tconst selectedSegmentIdsRef = useRef<ReadonlySet<NodeID>>(selectedSegmentIds)\n\tselectedSegmentIdsRef.current = selectedSegmentIds\n\n\tconst [prevMatchingRouteSegmentIds, setPrevMatchingRouteSegmentIds] = useState(matchingRouteSegmentIds)\n\n\tconst getSelectedRows = useCallback((): readonly SelectableRouteSegmentRenderRow[] => {\n\t\tconst curSelectedSegmentIds = selectedSegmentIdsRef.current\n\t\tconst rows = routeSegmentRowsRef.current\n\n\t\tif (curSelectedSegmentIds.size === 0 || rows.length === 0) {\n\t\t\treturn emptyArray<SelectableRouteSegmentRenderRow>()\n\t\t}\n\n\t\tconst orderedSelectedRows: SelectableRouteSegmentRenderRow[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (isDividerRow(row)) continue\n\n\t\t\tconst selectionId = getSelectionIdForRouteSegment(row)\n\t\t\tif (!isNull(selectionId) && curSelectedSegmentIds.has(selectionId)) {\n\t\t\t\torderedSelectedRows.push(row)\n\t\t\t}\n\t\t}\n\n\t\treturn orderedSelectedRows.length > 0 ? orderedSelectedRows : emptyArray<SelectableRouteSegmentRenderRow>()\n\t}, [])\n\n\tconst getDraggableRouteSegmentNodes = useCallback((): readonly RouteSegmentNode[] => {\n\t\tconst curSelectedSegmentIds = selectedSegmentIdsRef.current\n\t\tconst rows = routeSegmentRowsRef.current\n\n\t\tif (curSelectedSegmentIds.size === 0 || rows.length === 0) {\n\t\t\treturn emptyArray<RouteSegmentNode>()\n\t\t}\n\n\t\tconst nodes: RouteSegmentNode[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (isDividerRow(row) || isHomePageRow(row) || isVariantRow(row)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst selectionId = getSelectionIdForRouteSegment(row)\n\t\t\tif (isNull(selectionId) || !curSelectedSegmentIds.has(selectionId)) continue\n\n\t\t\tconst node = engine.tree.getNodeWithTrait(row.segmentId, isRouteSegmentNode)\n\t\t\tif (!node) continue\n\n\t\t\tnodes.push(node)\n\t\t}\n\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(nodes) as RouteSegmentNode[]\n\n\t\treturn withoutDescendants.length ? withoutDescendants : emptyArray<RouteSegmentNode>()\n\t}, [])\n\n\tconst handleSegmentClick = useEngineCallback(\n\t\t({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => {\n\t\t\tconst id = getSelectionId(webPageId, segmentId)\n\t\t\tif (isNull(id)) return\n\n\t\t\thandlePageClick(id, Boolean(webPageId), webPageId)\n\t\t},\n\t\t[handlePageClick],\n\t)\n\n\tconst getIsRouteSegmentSelected = useCallback(\n\t\t({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => {\n\t\t\tconst selectionId = getSelectionId(webPageId, segmentId)\n\t\t\tif (isNull(selectionId)) return false\n\t\t\treturn getIsPageSelected(selectionId)\n\t\t},\n\t\t[getIsPageSelected],\n\t)\n\n\tconst resetSelection = useCallback(\n\t\t({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => {\n\t\t\tconst resetSelectionId = getSelectionId(webPageId, segmentId) ?? undefined\n\t\t\tbaseResetSelection(resetSelectionId)\n\t\t},\n\t\t[baseResetSelection],\n\t)\n\n\t// If `matchingRouteSegmentIds` updates, reset the selection state to the active page.\n\t// The set updates on a user search.\n\tif (!isEqual(prevMatchingRouteSegmentIds, matchingRouteSegmentIds, true)) {\n\t\tsetPrevMatchingRouteSegmentIds(matchingRouteSegmentIds)\n\t\tbaseResetSelection(activePageId ? getSelectedPageIdFromActivePage(activePageId) : undefined)\n\t}\n\n\treturn {\n\t\trouteSegmentList,\n\t\tgetIsRouteSegmentSelected,\n\t\thandleSegmentClick,\n\t\tgetSelectedRows,\n\t\tgetDraggableRouteSegmentNodes,\n\t\tresetSelection,\n\t}\n}\n\nfunction buildRouteSegmentTree(\n\tsharedProps: SharedProps,\n\tisFiltering: boolean,\n\tactivePageId: NodeID | undefined,\n\tlocaleId: LocaleId,\n\tmatchingRouteSegmentIds: ReadonlySet<NodeID> | undefined,\n\trouteItems: readonly (HomePage | WebPage | Folder)[],\n\tdepth: number,\n\trouteSegmentList: RouteSegmentRenderRow[],\n\tpathTranslationEnabled: boolean,\n\tagentExperimentEnabled: boolean,\n) {\n\tfor (const route of routeItems) {\n\t\tconst childSegments = getRouteSegmentChildrenRows(\n\t\t\troute.segmentId,\n\t\t\troute.trailingSlashSegmentParentId,\n\t\t\tpathTranslationEnabled,\n\t\t\tlocaleId,\n\t\t)\n\n\t\tconst { abTestingVariants, hasAbTestingVariants, canAddAbTestingVariant } = getRouteSegmentVariantState(\n\t\t\troute.webPageId,\n\t\t)\n\n\t\t// Displayable children are items that are included in the matchingRouteSegmentIds set,\n\t\t// which is a Set<NodeID> that only includes node ids that match the current search query.\n\t\t// If there's no search filter present, matchingRouteSegmentIds will be undefined.\n\t\tconst visibleSegments = getFilteredChildrenSegments(isFiltering, matchingRouteSegmentIds, childSegments)\n\n\t\tconst hasChildren = visibleSegments.length > 0\n\t\tconst isCollapsible = hasChildren || hasAbTestingVariants\n\t\t// when no segmentId is defined, it means we are at the root level (Home Page)\n\t\tconst isExpanded = engine.stores.chromeStore.isExpandedRouteSegment(route.segmentId ?? ROUTE_SEGMENT_ROOT_NODE_ID)\n\t\t// allow sorting children when there are more than one child segment\n\t\t// the root level (Home Page) doesn't have child segments because its segmentId is undefined\n\t\tconst canSortRouteSegmentsAlphabetically = childSegments.length > 1\n\n\t\t// NOTE: During the transition to multi-select state, we must fallback to the old isSelected\n\t\t// logic.\n\t\tconst isActivePageSelected = isDefined(activePageId) && activePageId === route.webPageId\n\t\tconst isPageVariantSelected = abTestingVariants.some(v => isDefined(activePageId) && v.webPageId === activePageId)\n\n\t\tconst isSelected =\n\t\t\t(isActivePageSelected && !hasAbTestingVariants) || (hasAbTestingVariants && !isExpanded && isPageVariantSelected)\n\n\t\trouteSegmentList.push({\n\t\t\tdepth,\n\t\t\tisCollapsible,\n\t\t\tisExpanded,\n\t\t\tisSelected,\n\t\t\tcanSortRouteSegmentsAlphabetically,\n\t\t\t...sharedProps,\n\t\t\t// This ensures that certain props that folders do not support are not passed down.\n\t\t\t...(route.type === \"folder\"\n\t\t\t\t? route\n\t\t\t\t: {\n\t\t\t\t\t\t...route,\n\t\t\t\t\t\tcanAddAbTestingVariant,\n\t\t\t\t\t}),\n\t\t})\n\n\t\tif (isCollapsible && isExpanded) {\n\t\t\tbuildRouteSegmentVariantRows(\n\t\t\t\tabTestingVariants,\n\t\t\t\tdepth + 1,\n\t\t\t\tsharedProps.isViewOnly,\n\t\t\t\trouteSegmentList,\n\t\t\t\tactivePageId,\n\t\t\t\tagentExperimentEnabled,\n\t\t\t)\n\n\t\t\tif (hasAbTestingVariants && hasChildren) {\n\t\t\t\trouteSegmentList.push({ type: \"divider\", depth: depth + 1, segmentId: route.segmentId ?? \"\" })\n\t\t\t}\n\n\t\t\tif (hasChildren) {\n\t\t\t\tbuildRouteSegmentTree(\n\t\t\t\t\tsharedProps,\n\t\t\t\t\tisFiltering,\n\t\t\t\t\tactivePageId,\n\t\t\t\t\tlocaleId,\n\t\t\t\t\tmatchingRouteSegmentIds,\n\t\t\t\t\tvisibleSegments,\n\t\t\t\t\tdepth + 1,\n\t\t\t\t\trouteSegmentList,\n\t\t\t\t\tpathTranslationEnabled,\n\t\t\t\t\tagentExperimentEnabled,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction buildRouteSegmentVariantRows(\n\tabTestingVariants: readonly AbTestingVariant[],\n\tdepth: number,\n\tisViewOnly: boolean,\n\trouteSegmentList: RouteSegmentRenderRow[],\n\tactivePageId: NodeID | undefined,\n\tagentExperimentEnabled: boolean,\n) {\n\tabTestingVariants.forEach((variant, variantIndex) => {\n\t\t// NOTE: During the transition to multi-select state, we must fallback to the old isSelected\n\t\t// logic.\n\t\tconst isVariantSelected = isDefined(activePageId) && variant.webPageId === activePageId\n\n\t\trouteSegmentList.push({\n\t\t\ttype: \"variant\",\n\t\t\tIcon: getPageVariantIcon(variantIndex, agentExperimentEnabled),\n\t\t\tdepth,\n\t\t\tisViewOnly,\n\t\t\tisSelected: isVariantSelected,\n\t\t\t...variant,\n\t\t})\n\t})\n}\n\nfunction getPageVariantIcon(variantIndex: number, agentExperimentEnabled: boolean) {\n\tif (agentExperimentEnabled) {\n\t\tswitch (variantIndex) {\n\t\t\tcase 0:\n\t\t\t\treturn <IconAgentPageVariantA />\n\t\t\tcase 1:\n\t\t\t\treturn <IconAgentPageVariantB />\n\t\t\tcase 2:\n\t\t\t\treturn <IconAgentPageVariantC />\n\t\t\tcase 3:\n\t\t\t\treturn <IconAgentPageVariantD />\n\t\t\tcase 4:\n\t\t\t\treturn <IconAgentPageVariantE />\n\t\t}\n\t}\n\n\treturn <IconPageVariant index={variantIndex} />\n}\n\nfunction getRouteSegmentVariantState(webPageId: NodeID | undefined): {\n\tabTestingVariants: readonly AbTestingVariant[]\n\thasAbTestingVariants: boolean\n\tcanAddAbTestingVariant: boolean\n} {\n\tconst abTestingVariants = getAbTestingVariants(webPageId)\n\treturn {\n\t\tabTestingVariants,\n\t\thasAbTestingVariants: abTestingVariants.length > 0,\n\t\tcanAddAbTestingVariant: abTestingVariants.length <= MAX_AB_TESTING_VARIANTS,\n\t}\n}\n\nfunction getFilteredChildrenSegments(\n\tisFiltering: boolean,\n\tmatchingRouteSegmentIds: ReadonlySet<NodeID> | undefined,\n\tchildren: readonly (WebPage | Folder)[],\n): readonly (WebPage | Folder)[] {\n\tif (!isFiltering || isUndefined(matchingRouteSegmentIds) || !children || !children.length) return children\n\treturn children.filter(child => matchingRouteSegmentIds.has(child.segmentId))\n}\n\nfunction getSelectionId(webPageId: NodeID | undefined, segmentId: NodeID | undefined): NodeID | null {\n\treturn webPageId ?? segmentId ?? null\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPageVariantA(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=\"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=\"m2.5 9.5 2.193-6.798A1.37 1.37 0 0 1 6 1.75c.596 0 1.124.384 1.307.952L9.5 9.5M3.5 7.25h5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPageVariantB(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=\"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=\"M2.75 2.25a.5.5 0 0 1 .5-.5h3a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-3.5H7A2.25 2.25 0 0 1 9.25 8 2.25 2.25 0 0 1 7 10.25H3.341a.59.59 0 0 1-.591-.591Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPageVariantC(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=\"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=\"M8 1.75H6.75A4.25 4.25 0 0 0 2.5 6a4.25 4.25 0 0 0 4.25 4.25H8\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPageVariantD(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=\"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=\"M8.75 6a4.25 4.25 0 0 1-4.25 4.25H2.841a.59.59 0 0 1-.591-.591V2.341c0-.326.265-.591.591-.591H4.5A4.25 4.25 0 0 1 8.75 6\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPageVariantE(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=\"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=\"M2.75 5.75H8M8 10.25H3.5a1 1 0 0 1-1-1v-6.5a1 1 0 0 1 1-1H8\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { emptyArray } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\nexport interface AbTestingVariant {\n\tisControl: boolean\n\twebPageId: NodeID\n\twebPageName: string | null\n}\n\nexport function getAbTestingVariants(webPageId: NodeID | undefined): readonly AbTestingVariant[] {\n\tconst abTestingParent = engine.tree.getNodeWithTrait(webPageId, isWebPageNode)\n\tif (!abTestingParent) return emptyArray()\n\n\tconst abTestingChildren = abTestingParent.getAbTestingChildren(engine.tree)\n\tif (!abTestingChildren) return emptyArray()\n\n\tconst result: AbTestingVariant[] = [\n\t\t{\n\t\t\tisControl: true,\n\t\t\twebPageId: abTestingParent.id,\n\t\t\twebPageName: abTestingParent.resolveValue(\"name\"),\n\t\t},\n\t]\n\tfor (const variant of abTestingChildren) {\n\t\tresult.push({\n\t\t\tisControl: false,\n\t\t\twebPageId: variant.id,\n\t\t\twebPageName: variant.resolveValue(\"name\"),\n\t\t})\n\t}\n\treturn result\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport type { Folder, WebPage } from \"../RouteSegment.types.ts\"\n\nconst spaceToDashRegex = /\\s+/gu\nconst slashAndDashRegex = /[/-]/gu\nconst leadingSlashRegex = /^\\/+/u\n\n/**\n * Matches a search query against a route segment.\n * It allows for some tolerance for dash separators, spaces, and leading slashes.\n * For example, searching for \"/404\" will match \"404\", and \"test 1\" will match \"test-1\".\n *\n * @param filter - The search query to match against.\n * @param segment - The route segment to match against.\n * @returns True if the search query matches the route segment, false otherwise.\n */\nexport function matchRouteSegment(filter: string, segment: string): boolean {\n\tconst normalizedFilter = filter.toLowerCase().trim().replace(leadingSlashRegex, \"\").replace(spaceToDashRegex, \"-\")\n\tconst normalizedSegment = segment.toLowerCase().replace(slashAndDashRegex, \"-\")\n\n\tif (normalizedFilter.length === 0) return true\n\n\treturn matchSubstring(normalizedFilter, normalizedSegment)\n}\n\n/**\n * Matches a search query against a collection.\n * This is used to match collection names, instead of only their segments.\n *\n * @param filter - The search query to match against.\n * @param dataIdentifier - The data identifier of the collection to match against.\n * @returns True if the search query matches the collection, false otherwise.\n */\nfunction matchCollection(componentLoader: ComponentLoader, filter: string, dataIdentifier: string): boolean {\n\tconst collectionData = componentLoader.dataForIdentifier(dataIdentifier)\n\treturn collectionData?.name ? matchRouteSegment(filter, collectionData.name) : false\n}\n\n/**\n * Recursively adds all descendants of a route segment to the matching set.\n * This is used when a parent folder matches the search query to show all its contents.\n *\n * @param engine - The Vekter engine instance.\n * @param segmentId - The ID of the segment whose descendants should be added.\n * @param trailingSlashSegmentParentId - The ID of the segment that is the parent of the trailing slash segment.\n * @param matchingIds - The set to collect matching segment IDs.\n */\nfunction addAllDescendants(\n\tengine: VekterEngine,\n\tsegmentId: string,\n\ttrailingSlashSegmentParentId: string | undefined,\n\tmatchingIds: Set<NodeID>,\n): void {\n\tconst routeSegmentNode = engine.tree.get(trailingSlashSegmentParentId ?? segmentId)\n\tif (!isRouteSegmentNode(routeSegmentNode)) {\n\t\treturn\n\t}\n\n\tfor (const child of routeSegmentNode.children) {\n\t\tif (trailingSlashSegmentParentId && child.id === segmentId) continue\n\n\t\tmatchingIds.add(child.id)\n\t\taddAllDescendants(engine, child.id, undefined, matchingIds)\n\t}\n}\n\n/**\n * Processes a route segment and its descendants.\n * Returns true if this segment or any of its descendants match the search query.\n * If this segment matches directly, all its descendants are included in the results.\n *\n * @param engine - The Vekter engine instance.\n * @param filter - The search query to match against.\n * @param segmentId - The ID of the segment to process.\n * @param trailingSlashSegmentParentId - The ID of the segment that is the parent of the trailing slash segment.\n * @param matchingIds - The set to collect matching segment IDs.\n * @param expandableIds - The set to collect IDs of segments that should be expanded.\n * @returns True if this segment or any of its descendants match the search query.\n */\nfunction processRouteSegment(\n\tengine: VekterEngine,\n\tfilter: string,\n\tsegmentId: string,\n\ttrailingSlashSegmentParentId: string | undefined,\n\tmatchingIds: Set<NodeID>,\n\texpandableIds: Set<NodeID>,\n): boolean {\n\tconst routeSegmentNode = engine.tree.get(trailingSlashSegmentParentId ?? segmentId)\n\tif (!isRouteSegmentNode(routeSegmentNode)) {\n\t\treturn false\n\t}\n\n\tconst segmentMatches = routeSegmentNode.dataIdentifier\n\t\t? matchCollection(engine.componentLoader, filter, routeSegmentNode.dataIdentifier) // Collection nodes are matched by their data identifier\n\t\t: matchRouteSegment(filter, routeSegmentNode.segment) // Route segments are matched by their segment name\n\n\t// If this segment matches, add it and ALL its descendants to the matching set\n\tif (segmentMatches) {\n\t\tmatchingIds.add(segmentId)\n\t\taddAllDescendants(engine, segmentId, trailingSlashSegmentParentId, matchingIds)\n\n\t\tif (routeSegmentNode.children.length > 0) {\n\t\t\texpandableIds.add(segmentId)\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// If this segment doesn't match, continue with recursive logic for children\n\tlet hasMatchingChildren = false\n\tfor (const child of routeSegmentNode.children) {\n\t\tif (trailingSlashSegmentParentId && child.id === segmentId) continue\n\n\t\tconst childHasMatchingDescendants = processRouteSegment(\n\t\t\tengine,\n\t\t\tfilter,\n\t\t\tchild.id,\n\t\t\tundefined,\n\t\t\tmatchingIds,\n\t\t\texpandableIds,\n\t\t)\n\n\t\tif (childHasMatchingDescendants) {\n\t\t\thasMatchingChildren = true\n\t\t}\n\t}\n\n\tif (hasMatchingChildren) {\n\t\tmatchingIds.add(segmentId)\n\t\texpandableIds.add(segmentId)\n\t\treturn true\n\t}\n\n\treturn false\n}\n\ninterface RouteSegmentFilterResult {\n\t/** IDs of segments that match the search query */\n\tmatchingIds: ReadonlySet<NodeID>\n\t/** IDs of segments that should be expanded to show matching children */\n\texpandableIds: ReadonlySet<NodeID>\n}\n\n/**\n * Recursively finds all route segment IDs that match the search query.\n * Returns both matching IDs and expandable IDs in one pass.\n *\n * @param engine - The Vekter engine instance.\n * @param filter - The search query to match against.\n * @param routes - The routes to search through.\n * @returns Object containing matching IDs and expandable IDs.\n */\nexport function findMatchingRouteSegmentIds(\n\tengine: VekterEngine,\n\tfilter: string,\n\troutes: readonly (WebPage | Folder)[],\n): RouteSegmentFilterResult {\n\tconst matchingIds = new Set<NodeID>()\n\tconst expandableIds = new Set<NodeID>()\n\n\troutes.forEach(route => {\n\t\tprocessRouteSegment(engine, filter, route.segmentId, route.trailingSlashSegmentParentId, matchingIds, expandableIds)\n\t})\n\n\treturn { matchingIds, expandableIds }\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\n\ninterface HomePageState {\n\thomePageId: NodeID | undefined\n\tisHomePageAbTesting: boolean\n}\n\nexport function useHomePageState(): HomePageState {\n\treturn useEngineState(\n\t\t(): HomePageState => {\n\t\t\tconst homePageId = engine.tree.root.homePageNodeId\n\t\t\tconst homePageNode = engine.tree.getNodeWithTrait(homePageId, isWebPageNode)\n\t\t\tconst isHomePageAbTesting = homePageNode ? homePageNode.hasAbTestingChildren(engine.tree) : false\n\t\t\treturn { homePageId, isHomePageAbTesting }\n\t\t},\n\t\t[],\n\t\t[EngineChange.TreeStore],\n\t)\n}\n", "import { CenterChild, ComboBox, type ComboBoxListItem, Stack } from \"@framerjs/fresco\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Locale, LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { getIncludedLocaleIds } from \"../floatingToolbar/CanvasLocaleToolbarItem.tsx\"\nimport * as styles from \"./ContentPanelLocaleSelector.styles.ts\"\n\nexport function ContentPanelLocaleSelector() {\n\tconst { canvasLocaleId } = engine.stores.chromeStore.useState()\n\n\tconst { defaultLocale, vekterLocales, canvasLocale, includedLocaleIds } = useEngineState(\n\t\t(): {\n\t\t\tdefaultLocale: Locale\n\t\t\tvekterLocales: readonly Locale[]\n\t\t\tcanvasLocale: Locale\n\t\t\tincludedLocaleIds: readonly LocaleId[]\n\t\t} => {\n\t\t\tconst resolvedDefaultLocale = engine.tree.root.getDefaultLocale()\n\t\t\tconst resolvedCanvasLocale = engine.tree.root.getLocale(canvasLocaleId)\n\t\t\tconst resolvedVekterLocales = engine.tree.root.locales ?? emptyArray<Locale>()\n\n\t\t\treturn {\n\t\t\t\tdefaultLocale: resolvedDefaultLocale,\n\t\t\t\tvekterLocales: resolvedVekterLocales,\n\t\t\t\tcanvasLocale: resolvedCanvasLocale,\n\t\t\t\tincludedLocaleIds: getIncludedLocaleIds(resolvedCanvasLocale),\n\t\t\t}\n\t\t},\n\t\t[canvasLocaleId],\n\t\t[EngineChange.Tree, engine.stores.scopeStore],\n\t\t// `getIncludedLocaleIds` returns a new array each time requires deepEqual or we rerender infinitely\n\t\t{ deepEqual: true },\n\t)\n\n\tconst comboBoxItems = useMemo(() => {\n\t\tconst items: ComboBoxListItem[] = [{ type: \"option\", value: defaultLocale.name, label: Dictionary.Default }]\n\t\tconst hiddenItems: ComboBoxListItem[] = []\n\t\tfor (const vekterLocale of vekterLocales) {\n\t\t\tconst enabled = includedLocaleIds.includes(vekterLocale.id)\n\t\t\tif (enabled) {\n\t\t\t\titems.push({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: vekterLocale.name,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\thiddenItems.push({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: vekterLocale.name,\n\t\t\t\t\tenabled,\n\t\t\t\t\tlabel: \"Hidden\",\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn items.concat(hiddenItems)\n\t}, [defaultLocale, vekterLocales, includedLocaleIds])\n\n\tif (!canvasLocale || !vekterLocales.length) return null\n\n\treturn (\n\t\t<Stack>\n\t\t\t<ComboBox\n\t\t\t\trightChevron\n\t\t\t\titems={comboBoxItems}\n\t\t\t\tvalue={canvasLocale.name}\n\t\t\t\twrapperClassName={styles.inputWrapper}\n\t\t\t\tonChange={(value, final, reset) => {\n\t\t\t\t\tif (!final) return\n\n\t\t\t\t\tconst chosenLocale =\n\t\t\t\t\t\tdefaultLocale.name === value ? defaultLocale : vekterLocales.find(({ name }) => name === value)\n\t\t\t\t\tif (chosenLocale) {\n\t\t\t\t\t\tengine.stores.chromeStore.canvasLocaleId = chosenLocale.id\n\t\t\t\t\t} else {\n\t\t\t\t\t\treset()\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\tleftSlot={\n\t\t\t\t\t<CenterChild className={styles.leftIcon}>\n\t\t\t\t\t\t<LocaleFlag localeCode={canvasLocale.code} />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n", "import \"ContentPanelLocaleSelector.styles_1n0emue.wyw.css\"; export const inputWrapper = \"inputWrapper_in1wqp8\";\nexport const leftIcon = \"leftIcon_l1cj560\";", "import \"ContentPanelPagesTab.styles_1cmtjyb.wyw.css\"; export const label = \"label_lkxg3hh\";\nexport const searchBarLocaleWrapper = \"searchBarLocaleWrapper_s1b0y02x\";\nexport const pagesWrapper = \"pagesWrapper_p1s2uxg4\";\nexport const scroll = \"scroll_sq09snn\";\nexport const noResults = \"noResults_n56qton\";", "import \"CollectionLeftPanel.styles_1g885rf.wyw.css\"; export const header = \"header_h1m18omj\";\nexport const headerSpreadSheet = \"headerSpreadSheet_h4ftt02\";\nexport const headerContent = \"headerContent_h11mgmbm\";\nexport const rowsContainerStack = \"rowsContainerStack_rcuinyv\";\nexport const divider = \"divider_dm478lk\";\nexport const collectionSwitcher = \"collectionSwitcher_c1gmjmpd\";\nexport const leftIcon = \"leftIcon_l1jc59gh\";", "import {\n\tCenterChild,\n\tEmptyState,\n\tIconSidebarCollection,\n\tReadOnlyContext,\n\tScroll,\n\tSearchBar,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert, isCommandKeyPressed, unhandledError } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\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 { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getShouldShowCmsAgentChatPanel } from \"document/components/chrome/contentManagement/useShouldShowCmsAgentChatPanel.ts\"\nimport { getMetricsInteractionSourceForScopeType } from \"document/components/utils/getMetricsInteractionSourceForScopeType.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n\tContentManagementEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isCollectionNode, isContentManagementNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveLeftPanel, CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { newSetByTogglingItem } from \"document/utils/newSetByTogglingItem.ts\"\nimport { PluginIcon } from \"plugins/PluginIcon.tsx\"\nimport { getPluginIcon } from \"plugins/plugins.ts\"\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { collapsedViewBreakpoint } from \"utils/chromeBreakpoints.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { canPasteCollections } from \"utils/clipboard/helpers/collections.ts\"\nimport { getSelectedCollectionId } from \"utils/collectionUtils.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getGeneratedValue } from \"../../../models/CanvasTree/traits/Generated.ts\"\nimport { editPageTitle, getPageInputId } from \"../Pages/utils/editPageRow.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { SidebarAdditionRow } from \"../SidebarAdditionRow.tsx\"\nimport { IconAgentCMS } from \"../agentPanel/components/IconAgentCMS.tsx\"\nimport { EntityRow } from \"../assets/EntityRow.tsx\"\nimport { renameEntity } from \"../assets/actions/rename.ts\"\nimport { expandAssetEntityItemsFromNode } from \"../assets/utils/expandAssetEntityItems.ts\"\nimport { createFolderFromSelection } from \"../assets/utils/multiselect.ts\"\nimport { type AssetRow, useAssetPanelEntityRows } from \"../assets/utils/useAssetPanelEntityRows.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport * as styles from \"./CollectionPanel.styles.ts\"\nimport { closeCollectionItems } from \"./utils/closeCollectionItems.tsx\"\nimport { handleAddNewCollection, handleCreateCollection } from \"./utils/handleCreateCollectionAction.ts\"\nimport { deleteReferencedCollectionAndFolderEntities, handleDeleteCollection } from \"./utils/handleDeleteCollection.tsx\"\nimport { handleDuplicateCollection } from \"./utils/handleDuplicateCollection.ts\"\nimport { sanitizeCollectionName } from \"./utils/sanitizeCollectionName.ts\"\nimport { isEditFieldsUseableInScreen } from \"./utils/screenFeatureUtils.ts\"\n\ntype CollectionAssetRow = AssetRow<{ collectionItemCount: string }>\n\nexport const CollectionPanel = React.memo(function CollectionPanel() {\n\tconst leftPanel = engine.stores.chromeStore.useState(state => state.leftPanel)\n\treturn leftPanel === ActiveLeftPanel.ContentManagement ? <CollectionPanelInner /> : null\n})\n\nfunction CollectionPanelInner() {\n\tconst isViewOnly = useIsViewOnly(\"canAddCollections\")\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst activeScope = useDeprecatedEngineState(\n\t\t[EngineChange.Tree, engine.stores.scopeStore],\n\t\t() => engine.stores.scopeStore.active,\n\t)\n\tconst selectedCollectionId = useEngineState(\n\t\t() => getSelectedCollectionId(engine),\n\t\t[],\n\t\t[engine.stores.selectionStore, EngineChange.Tree],\n\t)\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.collectionPanel })\n\n\tconst isCollapsedView = useMediaQuery(`(max-width: ${collapsedViewBreakpoint}px)`)\n\tconst CollectionIcon = agentExperimentEnabled ? IconAgentCMS : IconSidebarCollection\n\n\tconst contentManagementChildren = isContentManagementNode(activeScope) ? activeScope.children : noCollections\n\n\tconst [searchTerm, setSearchTerm] = useState<string>(\"\")\n\n\tconst { regularCollections, managedCollections, hasRegularCollections, hasMangedCollection } = useMemo(() => {\n\t\tconst regular: CollectionNode[] = []\n\t\tconst managed: CollectionNode[] = []\n\t\tlet hasRegular = false\n\t\tlet hasManged = false\n\n\t\tfor (const collection of contentManagementChildren) {\n\t\t\tif (!isCollectionNode(collection)) continue\n\n\t\t\tif (!collection.managedByPlugin) {\n\t\t\t\thasRegular = true\n\t\t\t\tregular.push(collection)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\thasManged = true\n\n\t\t\tif (searchTerm === \"\") {\n\t\t\t\tmanaged.push(collection)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst name = getGeneratedValue(collection.name)\n\t\t\tif (!name?.toLowerCase().includes(searchTerm.toLowerCase())) continue\n\n\t\t\tmanaged.push(collection)\n\t\t}\n\n\t\treturn {\n\t\t\tregularCollections: regular,\n\t\t\tmanagedCollections: managed,\n\t\t\thasRegularCollections: hasRegular,\n\t\t\thasMangedCollection: hasManged,\n\t\t}\n\t}, [contentManagementChildren, searchTerm])\n\n\tconst handleHeaderCreateCollection = () => {\n\t\thandleAddNewCollection().catch(unhandledError)\n\t}\n\n\tconst { folderPanelState, toggleFolderPanelCollapseEntity } = useCollectionFolderPanelState(\n\t\tregularCollections,\n\t\tsearchTerm,\n\t)\n\n\tconst { selectedIds, handleSelectCollectionRow } = useCollectionRowSelection(folderPanelState.rows)\n\n\tconst getOrderedIds = useCallback(\n\t\t(ids: ReadonlySet<NodeID>) => folderPanelState.rows.filter(row => ids.has(row.id)).map(getId),\n\t\t[folderPanelState.rows],\n\t)\n\n\tconst createContextMenuItems = useCallback((id: NodeID) => getMenuOptions(id, selectedIds), [selectedIds])\n\n\tconst hasVisibleRegularCollections = folderPanelState.rows.length > 0\n\tconst hasVisibleManagedCollections = managedCollections.length > 0\n\n\tconst hasSearch = searchTerm !== \"\"\n\tconst showSearchBar = hasRegularCollections || hasMangedCollection\n\tif (!showSearchBar && hasSearch) {\n\t\tsetSearchTerm(\"\")\n\t}\n\n\treturn (\n\t\t<Scroll className={styles.scroll}>\n\t\t\t{showSearchBar && (\n\t\t\t\t<Stack className={cx(styles.searchWrapper, styles.dividerLine)}>\n\t\t\t\t\t<SearchBar\n\t\t\t\t\t\tvalue={searchTerm}\n\t\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\tonChange={setSearchTerm}\n\t\t\t\t\t\tshowClearButton={true}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t\t{!hasRegularCollections && !hasSearch && (\n\t\t\t\t<Stack className={cx(styles.header, hasMangedCollection && styles.dividerLine)}>\n\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\ttitle={Dictionary.Collections}\n\t\t\t\t\t\ttoggleExpanded={noop}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tcreateAction={handleHeaderCreateCollection}\n\t\t\t\t\t\thasItems={false}\n\t\t\t\t\t\tisFirstSection={true}\n\t\t\t\t\t\tinTabbedPanel\n\t\t\t\t\t\theaderActionItem={\n\t\t\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\t\t\texpanded\n\t\t\t\t\t\t\t\ttitle=\"Add CMS Collection\"\n\t\t\t\t\t\t\t\tcreateAction={handleHeaderCreateCollection}\n\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\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</Stack>\n\t\t\t)}\n\n\t\t\t{hasRegularCollections && hasVisibleRegularCollections && (\n\t\t\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t\t\t<Stack className={styles.rowsContainer} gap={0}>\n\t\t\t\t\t\t{folderPanelState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectCollectionRow}\n\t\t\t\t\t\t\t\thasUnreferencedItems={folderPanelState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleFolderPanelCollapseEntity}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={createContextMenuItems}\n\t\t\t\t\t\t\t\tPopoutContent={undefined}\n\t\t\t\t\t\t\t\tdescription={row.collectionItemCount}\n\t\t\t\t\t\t\t\tselectedIds={selectedIds}\n\t\t\t\t\t\t\t\tisSortable={!hasSearch}\n\t\t\t\t\t\t\t\tgetOrderedIds={getOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID}\n\t\t\t\t\t\t\t\tdisableRename={isViewOnly}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{!hasSearch && (\n\t\t\t\t\t\t\t<SidebarAdditionRow\n\t\t\t\t\t\t\t\ttooltip={Dictionary.AddEllipsis}\n\t\t\t\t\t\t\t\tonClick={handleCreateCollection}\n\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\tindentation={11}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t)}\n\n\t\t\t{hasVisibleManagedCollections && (\n\t\t\t\t<>\n\t\t\t\t\t<ContentPanelHeader\n\t\t\t\t\t\ttitle=\"Synced\"\n\t\t\t\t\t\tisFirstSection={!hasVisibleRegularCollections}\n\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\ttoggleExpanded={noop}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\thasItems={false}\n\t\t\t\t\t/>\n\t\t\t\t\t<Sortable\n\t\t\t\t\t\tclassName={styles.sortable}\n\t\t\t\t\t\tenabled={!hasSearch && !isViewOnly && managedCollections.length > 1}\n\t\t\t\t\t\titems={managedCollections}\n\t\t\t\t\t\tmoveItem={handleMoveManagedCollection}\n\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\tautoSizeAnimationEnabled={false}\n\t\t\t\t\t\tonlyAnimateItemPositionsWhileDragging\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tisCollapsedView || hasSearch ? undefined : (\n\t\t\t\t\t\t\t\t<SidebarAdditionRow\n\t\t\t\t\t\t\t\t\ttooltip={Dictionary.AddEllipsis}\n\t\t\t\t\t\t\t\t\tonClick={showManagedCollectionPlugins}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\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\t\t{({ item: node }) => {\n\t\t\t\t\t\t\tassert(node.managedByPlugin)\n\t\t\t\t\t\t\tconst pluginManifest = engine.stores.pluginStore.manifestById.get(node.managedByPlugin)\n\t\t\t\t\t\t\tconst iconSrc = pluginManifest ? getPluginIcon(pluginManifest) : undefined\n\t\t\t\t\t\t\tconst isSelected = selectedCollectionId === node.id && !isCollapsedView\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\t\t\t\tid={node.id}\n\t\t\t\t\t\t\t\t\ttitle={node.resolveValue(\"name\") ?? \"\"}\n\t\t\t\t\t\t\t\t\tIcon={\n\t\t\t\t\t\t\t\t\t\ticonSrc ? (\n\t\t\t\t\t\t\t\t\t\t\t<CenterChild\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.pluginIconWrapper, isSelected && styles.pluginIconWrapperSelected)}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<PluginIcon src={iconSrc} size=\"small\" hideInnerShadow={isSelected} />\n\t\t\t\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\tCollectionIcon\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsubLabel={`${node.getItemCount()}`}\n\t\t\t\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\t\t\tonSelect={handleSelectCollectionRow}\n\t\t\t\t\t\t\t\t\tisEditable={!isViewOnly}\n\t\t\t\t\t\t\t\t\tonTitleChange={handleTitleChange}\n\t\t\t\t\t\t\t\t\tinputId={getPageInputId(node.id)}\n\t\t\t\t\t\t\t\t\twithCollapse={false}\n\t\t\t\t\t\t\t\t\trowClassName={styles.collapsibleRow}\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</Sortable>\n\t\t\t\t</>\n\t\t\t)}\n\n\t\t\t{hasSearch && showSearchBar && !hasVisibleManagedCollections && !hasVisibleRegularCollections && (\n\t\t\t\t<EmptyState center body={Dictionary.NoSearchResults} />\n\t\t\t)}\n\t\t</Scroll>\n\t)\n}\n\nfunction useCollectionFolderPanelState(regularCollections: CollectionNode[], searchQuery: string) {\n\tconst { collectionsRoot } = useEngineState(\n\t\t() => ({ collectionsRoot: ContentManagementEntityTypeRootNode.get(engine.tree) }),\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst expandedAssetEntityIds = useEngineState(\n\t\t() => engine.stores.chromeStore.expandedAssetEntityIds(false),\n\t\t[],\n\t\tengine.stores.chromeStore,\n\t)\n\n\tconst [folderPanelStateFromHook, toggleFolderPanelCollapseEntity] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(() => {\n\t\t\tconst unreferenced: CollectionAssetRow[] = []\n\n\t\t\tif (!collectionsRoot) return null\n\n\t\t\tfor (const collection of regularCollections) {\n\t\t\t\tconst maybeReferenceId = buildEntityReferenceNodeId(collection.id)\n\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\tunreferenced.push({\n\t\t\t\t\tid: collection.id,\n\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\tdepth: 0,\n\t\t\t\t\ttitle: collection.resolveValue(\"name\") ?? Dictionary.Unknown,\n\t\t\t\t\tcollectionItemCount: `${collection.getItemCount()}`,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tentityRootNode: collectionsRoot,\n\t\t\t\tunreferenced,\n\t\t\t\tincludeRoot: false,\n\t\t\t\ttree: engine.tree,\n\t\t\t\tgetReferenceMeta: (id: NodeID) => {\n\t\t\t\t\tconst node = engine.tree.get(id)\n\t\t\t\t\tif (!isCollectionNode(node)) return undefined\n\t\t\t\t\treturn { collectionItemCount: `${node.getItemCount()}` }\n\t\t\t\t},\n\t\t\t}\n\t\t}, [collectionsRoot, regularCollections]),\n\t)\n\n\tconst folderPanelFallbackRows = useMemo((): CollectionAssetRow[] => {\n\t\tif (collectionsRoot) return []\n\t\treturn regularCollections.flatMap((collection): CollectionAssetRow[] => {\n\t\t\tconst name = getGeneratedValue(collection.name)\n\t\t\tif (searchQuery && !name?.toLowerCase().includes(searchQuery.toLowerCase())) return []\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: collection.id,\n\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\tdepth: 0,\n\t\t\t\t\ttitle: collection.resolveValue(\"name\") ?? Dictionary.Unknown,\n\t\t\t\t\tcollectionItemCount: `${collection.getItemCount()}`,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\t}, [collectionsRoot, regularCollections, searchQuery])\n\n\tconst folderPanelState = useMemo(\n\t\t() => ({\n\t\t\trows: collectionsRoot ? folderPanelStateFromHook.rows : folderPanelFallbackRows,\n\t\t\thasUnreferencedItems: collectionsRoot\n\t\t\t\t? folderPanelStateFromHook.hasUnreferencedItems\n\t\t\t\t: folderPanelFallbackRows.length > 0,\n\t\t}),\n\t\t[\n\t\t\tcollectionsRoot,\n\t\t\tfolderPanelStateFromHook.rows,\n\t\t\tfolderPanelStateFromHook.hasUnreferencedItems,\n\t\t\tfolderPanelFallbackRows,\n\t\t],\n\t)\n\n\treturn { folderPanelState, toggleFolderPanelCollapseEntity }\n}\n\n/**\n * Handles row clicks in the collection panel with three selection modes:\n * - Shift+click: range-select all rows between the anchor (last single-selected item)\n *   and the clicked row, preserving existing selection.\n * - Cmd/Ctrl+click: toggle the clicked row in/out of the selection (multi-select),\n *   updating the range anchor when an item is added. Plugin-managed collections\n *   are excluded from toggle selection.\n * - Plain click: single-select. Collections navigate into the collection;\n *   folders just highlight without changing the active collection.\n *\n */\nfunction useCollectionRowSelection(rows: readonly CollectionAssetRow[]) {\n\tconst selectedCollectionId = useEngineState(\n\t\t() => getSelectedCollectionId(engine),\n\t\t[],\n\t\t[engine.stores.selectionStore, EngineChange.Tree],\n\t)\n\tconst [selectedIds, setSelectedIds] = useState<ReadonlySet<NodeID>>(() =>\n\t\tselectedCollectionId ? new Set([selectedCollectionId]) : new Set<NodeID>(),\n\t)\n\n\tconst [rangeAnchorId, setRangeAnchorId] = useState<NodeID | null>(null)\n\n\tconst setSingleSelection = useCallback((value: NodeID) => {\n\t\tconst singleIdSet = new Set([value])\n\t\tsetSelectedIds(singleIdSet)\n\t\tsetRangeAnchorId(value)\n\t}, [])\n\n\tconst [prevSelectedCollectionId, setPrevSelectedCollectionId] = useState(selectedCollectionId)\n\n\tif (selectedCollectionId !== prevSelectedCollectionId) {\n\t\tsetPrevSelectedCollectionId(selectedCollectionId)\n\n\t\tif (!selectedCollectionId) {\n\t\t\tsetSelectedIds(new Set())\n\t\t\tsetRangeAnchorId(null)\n\t\t} else {\n\t\t\tsetSelectedIds(prev => {\n\t\t\t\tif (prev.has(selectedCollectionId)) return prev\n\t\t\t\tconst singleIdArray = [selectedCollectionId]\n\t\t\t\treturn new Set(singleIdArray)\n\t\t\t})\n\t\t\tsetRangeAnchorId(selectedCollectionId)\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tif (!selectedCollectionId) return\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\texpandAssetEntityItemsFromNode(engine, selectedCollectionId, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID, false)\n\t\t})\n\t}, [selectedCollectionId])\n\n\tconst handleSelectCollectionRow = useCallback(\n\t\t(selectedItemId: NodeID, event: React.MouseEvent) => {\n\t\t\tconst node = engine.tree.getNode(selectedItemId)\n\t\t\tif (!node) return\n\n\t\t\tif (event.shiftKey && rows) {\n\t\t\t\tif (!rangeAnchorId || !selectedIds.has(rangeAnchorId)) {\n\t\t\t\t\tsetSingleSelection(selectedItemId)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst anchorIndex = rows.findIndex(row => row.id === rangeAnchorId)\n\t\t\t\tconst clickedIndex = rows.findIndex(row => row.id === selectedItemId)\n\n\t\t\t\tif (anchorIndex === -1 || clickedIndex === -1) {\n\t\t\t\t\tsetSingleSelection(selectedItemId)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst from = Math.min(anchorIndex, clickedIndex)\n\t\t\t\tconst to = Math.max(anchorIndex, clickedIndex)\n\n\t\t\t\tconst rangeIds = new Set(selectedIds)\n\n\t\t\t\tfor (let pointer = from; pointer <= to; pointer++) {\n\t\t\t\t\tconst row = rows[pointer]\n\t\t\t\t\tif (row) {\n\t\t\t\t\t\trangeIds.add(row.id)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsetSelectedIds(rangeIds)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isCommandKeyPressed(event)) {\n\t\t\t\tconst isManagedByPlugin = isCollectionNode(node) && Boolean(node.managedByPlugin)\n\t\t\t\tif (isManagedByPlugin) return\n\n\t\t\t\tsetSelectedIds(prev => {\n\t\t\t\t\tconst newSelection = newSetByTogglingItem(prev, selectedItemId)\n\t\t\t\t\tconst itemHasBeenAddedToSelection = newSelection.has(selectedItemId) && !prev.has(selectedItemId)\n\n\t\t\t\t\tif (itemHasBeenAddedToSelection) {\n\t\t\t\t\t\tsetRangeAnchorId(selectedItemId)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn newSelection\n\t\t\t\t})\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isCollectionNode(node)) {\n\t\t\t\thandleSelectCollection(selectedItemId, () => setSingleSelection(selectedItemId))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetSingleSelection(selectedItemId)\n\t\t},\n\t\t[rows, rangeAnchorId, selectedIds, setSingleSelection],\n\t)\n\n\treturn { selectedIds, handleSelectCollectionRow }\n}\n\nfunction handleSelectCollection(id: NodeID, onWillSelect?: () => void) {\n\tengine.stores.chromeStore.setLeftPanelOpenOnMobile(false)\n\n\tcloseCollectionItems({ engine, target: \"all\" })\n\t\t.then(({ userKeptEditing }) => {\n\t\t\tif (userKeptEditing) return\n\n\t\t\tonWillSelect?.()\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.selectionStore.set(id)\n\t\t\t\trecord(\"ui_interaction\", { id: \"select_collection\", page: Pages.collectionPanel })\n\t\t\t})\n\t\t})\n\t\t.catch(unhandledError)\n}\n\nconst showManagedCollectionPlugins = engine.scheduler.wrapHandler(() => {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.QuickActions,\n\t\tsource: \"collections_sidebar\",\n\t\tinitialCategory: { type: QuickActionsCategoryType.ManagedCollectionPlugins },\n\t})\n})\n\nconst handleTitleChange = engine.scheduler.wrapHandler(\n\t(id: NodeID, name: string, _final: boolean, reset: () => void) => {\n\t\tif (getIsViewOnly(engine, \"canAddCollections\")) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tconst node = engine.tree.get(id)\n\t\tif (!node) return\n\n\t\tconst finalName = sanitizeCollectionName(engine.tree, id, name)\n\t\tif (!finalName) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tnode.set({ name: finalName })\n\t\trecord(\"collection_rename\", { source: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType) })\n\t},\n)\n\nconst handleMoveCollection = engine.scheduler.wrapHandler(\n\t(from: number, to: number, type: \"regularCollection\" | \"managedCollection\") => {\n\t\tif (getIsViewOnly(engine, \"canAddCollections\")) return\n\n\t\tconst contentManagementNode = engine.stores.scopeStore.active\n\t\tassert(isContentManagementNode(contentManagementNode), \"Content management node should be active\")\n\n\t\tconst collections = contentManagementNode.children.filter(\n\t\t\tnode => isCollectionNode(node) && (type === \"regularCollection\") === !node.managedByPlugin,\n\t\t)\n\n\t\tconst fromCollection = collections[from]\n\t\tassert(isCollectionNode(fromCollection), \"Collection from index should be in range\")\n\n\t\tconst toCollection = collections[to]\n\t\tassert(isCollectionNode(toCollection), \"Collection to index should be in range\")\n\n\t\tconst actualToIndex = contentManagementNode.children.findIndex(node => node.id === toCollection.id)\n\n\t\tengine.moveNode(fromCollection.id, contentManagementNode.id, actualToIndex)\n\t\trecord(\"collection_move\", { source: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType) })\n\t},\n)\n\nfunction handleMoveManagedCollection(from: number, to: number) {\n\thandleMoveCollection(from, to, \"managedCollection\")\n}\n\nconst getMenuOptions = async (id: NodeID, selectedIds?: ReadonlySet<NodeID>): Promise<MenuItemOptions[]> => {\n\tconst isViewOnly = getIsViewOnly(engine, \"canAddCollections\")\n\n\tconst node = engine.tree.get(id)\n\tconst isManagedByPlugin = isCollectionNode(node) && Boolean(node.managedByPlugin)\n\tconst canEditVariables = !getIsViewOnly(engine, \"canEditVariables\") && !isManagedByPlugin\n\tconst canPaste = await canPasteCollections(engine.componentLoader)\n\tconst shouldShowMenuOptionsForMultipleSelection = selectedIds && selectedIds.size > 1 && selectedIds.has(id)\n\n\tif (shouldShowMenuOptionsForMultipleSelection) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tcreateFolderFromSelection(noop, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID)(selectedIds)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => deleteReferencedCollectionAndFolderEntities(engine, selectedIds).catch(unhandledError),\n\t\t\t},\n\t\t]\n\t}\n\n\tconst options: MenuItemOptions[] = []\n\n\tif (isCollectionNode(node) && getShouldShowCmsAgentChatPanel()) {\n\t\toptions.push(\n\t\t\t{\n\t\t\t\tlabel: `Add To ${Dictionary.Agent}`,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.agentStore.enqueueSelection({\n\t\t\t\t\t\ttype: \"cmsCollection\",\n\t\t\t\t\t\tcollectionId: id,\n\t\t\t\t\t\tcollectionName: node.resolveValue(\"name\") || Dictionary.Collection,\n\t\t\t\t\t\tfocusInput: true,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t)\n\t}\n\n\toptions.push(\n\t\t{\n\t\t\tlabel: canEditVariables ? Dictionary.EditFields : Dictionary.ViewFields,\n\t\t\tvisible: isEditFieldsUseableInScreen(),\n\t\t\tclick: () => {\n\t\t\t\trecord(\"ui_interaction\", { id: \"edit_collection_variables\", page: Pages.collectionPanel })\n\t\t\t\tengine.stores.selectionStore.set(id)\n\t\t\t\tengine.stores.chromeStore.activeCollectionPanelTab = CollectionPanelTab.Fields\n\t\t\t},\n\t\t},\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\tif (isManagedByPlugin) {\n\t\t\t\t\teditPageTitle(id)\n\t\t\t\t} else {\n\t\t\t\t\trenameEntity(id)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\thandleDuplicateCollection(engine, id, MetricsInteractionViews.CMS).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Copy,\n\t\t\tenabled:\n\t\t\t\tengine.stores.loadingStore.hasMinimalEditableData && engine.stores.loadingStore.allModulesLoadedAndEvaluated,\n\t\t\tclick: () => {\n\t\t\t\tClipboard.copy(engine, undefined, [id]).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Paste,\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, undefined, id).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\thandleDeleteCollection(engine, id, MetricsInteractionViews.CMS).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t)\n\n\treturn options\n}\n\nconst noCollections: CollectionNode[] = []\n", "import \"SidebarAdditionRow.styles_1tm5hgn.wyw.css\"; export const row = \"row_r1n7avyj\";\nexport const rowDisabled = \"rowDisabled_r15jp3gp\";\nexport const iconWrapper = \"iconWrapper_i1mb2j66\";", "import { CenterChild, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type React from \"react\"\nimport * as styles from \"./SidebarAdditionRow.styles.ts\"\n\nfunction Icon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\">\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeMiterlimit=\"10\" strokeWidth=\"1.5\">\n\t\t\t\t<path d=\"M5.75 1.25v9M1.25 5.75h9\" />\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\ninterface Props {\n\ttooltip: string\n\tisViewOnly: boolean\n\tonClick?: (event: React.MouseEvent) => void\n\tonMouseDown?: (event: React.MouseEvent) => void\n\tindentation?: number\n}\n\nexport function SidebarAdditionRow({ tooltip, onClick, onMouseDown, isViewOnly, indentation = 0 }: Props) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn (\n\t\t<Stack\n\t\t\tonClick={onClick}\n\t\t\tonMouseDown={onMouseDown}\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tgap={isAgentExperimentOn ? 4 : 8}\n\t\t\tpaddingLeft={`calc(${dimensions.css.panelPadding} - 2px + ${indentation}px)`}\n\t\t\tclassName={cx(styles.row, isViewOnly && styles.rowDisabled)}\n\t\t\ttitle={tooltip}\n\t\t>\n\t\t\t<CenterChild className={styles.iconWrapper}>\n\t\t\t\t<Icon />\n\t\t\t</CenterChild>\n\t\t\t<span>Add\u2026</span>\n\t\t</Stack>\n\t)\n}\n", "import \"CollectionPanel.styles_bcq5pd.wyw.css\"; export const scroll = \"scroll_s10v7jp0\";\nexport const sortable = \"sortable_s3ulg1s\";\nexport const collapsibleRow = \"collapsibleRow_cyxn5pt\";\nexport const rowsContainer = \"rowsContainer_r27m4ou\";\nexport const header = \"header_h10pldxo\";\nexport const dividerLine = \"dividerLine_d1dz71jf\";\nexport const searchWrapper = \"searchWrapper_s1kvmfum\";\nexport const pluginIconWrapper = \"pluginIconWrapper_p1jwware\";\nexport const pluginIconWrapperSelected = \"pluginIconWrapperSelected_pqd2yxm\";", "import { MetricsInteractionViews } from \"app/metrics.ts\"\nimport engine from \"document/engine.ts\"\nimport { canPasteCollections } from \"utils/clipboard/helpers/collections.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\nimport { addNewCollection, getCollectionCreationOptions } from \"./getCollectionCreationOptions.ts\"\n\nasync function canCreateNewCollection() {\n\tconst { userKeptEditing } = await closeCollectionItems({\n\t\tengine,\n\t\ttarget: \"all\",\n\t})\n\treturn !userKeptEditing\n}\n\nexport const handleAddNewCollection = async () => {\n\tif (!(await canCreateNewCollection())) return\n\tengine.scheduler.processWhenReady(() => {\n\t\taddNewCollection(engine, Pages.collectionPanel, \"create_blank_collection\")\n\t})\n}\n\nexport const handleCreateCollection = async (event: React.MouseEvent) => {\n\trecord(\"ui_interaction\", { id: \"display_create_collection_menu\", page: Pages.collectionPanel })\n\n\tconst canPaste = await canPasteCollections(engine.componentLoader)\n\n\tengine.stores.contextMenuStore.show(getCollectionCreationOptions(engine, MetricsInteractionViews.CMS, { canPaste }), {\n\t\tlocation: { x: event.clientX, y: event.clientY },\n\t})\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { EmptyState, Scroll, SearchBar, Stack } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { IconWithInnerShadow, PluginIcon } from \"plugins/PluginIcon.tsx\"\nimport { PluginRow } from \"plugins/PluginRow.tsx\"\nimport {\n\tgetPluginIcon,\n\ttype HostedPluginManifest,\n\ttype PluginManifestId,\n\ttype VekterPluginManifest,\n} from \"plugins/plugins.ts\"\nimport {\n\tnormalizePluginSearchTerms,\n\tpluginMatchesSearchTerms,\n\tuseEligiblePluginManifests,\n} from \"plugins/useEligiblePluginManifests.ts\"\nimport { Fragment, useMemo, useState } from \"react\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { IconPlugins } from \"../QuickActions/utils/icons.tsx\"\nimport { PanelSectionHeader } from \"../properties/panels/PanelSectionHeader.tsx\"\nimport * as styles from \"./PluginsPanel.styles.ts\"\n\ninterface PluginSection {\n\ttitle: string\n\tplugins: readonly HostedPluginManifest[]\n}\n\ninterface PluginsPanelProps {\n\tselectedManifestId: PluginManifestId | null\n\tfeaturedPluginManifestIds: readonly PluginManifestId[]\n\tsupportedModes: readonly Mode[]\n\tonPluginClick: (this: unknown, manifest: VekterPluginManifest) => void\n\tmarketplacePluginsUrl: string\n}\n\nexport function PluginsPanel({\n\tselectedManifestId,\n\tfeaturedPluginManifestIds,\n\tsupportedModes,\n\tonPluginClick,\n\tmarketplacePluginsUrl,\n}: PluginsPanelProps) {\n\tconst [searchValue, setSearchValue] = useState(\"\")\n\tconst normalizedSearchTerms = useMemo(() => normalizePluginSearchTerms(searchValue), [searchValue])\n\tconst pluginSections = usePluginSections(normalizedSearchTerms, supportedModes, featuredPluginManifestIds)\n\n\treturn (\n\t\t<Stack className={styles.panel} gap={0}>\n\t\t\t<Stack className={styles.searchWrapper} gap={0}>\n\t\t\t\t<SearchBar\n\t\t\t\t\tvalue={searchValue}\n\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\tonChange={setSearchValue}\n\t\t\t\t\tshowClearButton={true}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t\t<Scroll className={styles.scroll}>\n\t\t\t\t<PluginsContent\n\t\t\t\t\tsections={pluginSections}\n\t\t\t\t\tisSearching={normalizedSearchTerms.length > 0}\n\t\t\t\t\tselectedManifestId={selectedManifestId}\n\t\t\t\t\tonPluginClick={onPluginClick}\n\t\t\t\t\tmarketplacePluginsUrl={marketplacePluginsUrl}\n\t\t\t\t/>\n\t\t\t</Scroll>\n\t\t</Stack>\n\t)\n}\n\n/**\n * Returns the panel's plugin sections \u2014 Recents + Featured when no search is active, or a single\n * Marketplace section filtered by `searchTerms`. Returns an empty array when a search yields no\n * matches so the caller can render an empty state.\n */\nfunction usePluginSections(\n\tsearchTerms: readonly string[],\n\tsupportedModes: readonly Mode[],\n\tfeaturedPluginManifestIds: readonly PluginManifestId[],\n) {\n\tconst eligibleManifests = useEligiblePluginManifests(supportedModes)\n\tconst recentlyUsedIds = engine.stores.pluginStore.useState(state => state.recentlyUsedPluginManifestIds)\n\tconst [recentlyUsedIdsSnapshot, setRecentlyUsedIdsSnapshot] = useState(recentlyUsedIds)\n\n\t// After clearing all recents we should sync the snapshot to the current state\n\tif (recentlyUsedIds.size === 0 && recentlyUsedIdsSnapshot.size > 0) {\n\t\tsetRecentlyUsedIdsSnapshot(recentlyUsedIds)\n\t}\n\n\tconst eligibleManifestsById = useMemo<ReadonlyMap<PluginManifestId, HostedPluginManifest>>(() => {\n\t\tconst map = new Map<PluginManifestId, HostedPluginManifest>()\n\t\tfor (const manifest of eligibleManifests) map.set(manifest.id, manifest)\n\t\treturn map\n\t}, [eligibleManifests])\n\n\tconst recents = useMemo<readonly HostedPluginManifest[]>(() => {\n\t\tconst result: HostedPluginManifest[] = []\n\t\tfor (const manifestId of recentlyUsedIdsSnapshot) {\n\t\t\tconst manifest = eligibleManifestsById.get(manifestId)\n\t\t\tif (!manifest) continue\n\t\t\tresult.push(manifest)\n\t\t}\n\t\treturn result\n\t}, [recentlyUsedIdsSnapshot, eligibleManifestsById])\n\n\tconst featured = useMemo<readonly HostedPluginManifest[]>(() => {\n\t\tconst recentIds = new Set(recents.map(manifest => manifest.id))\n\t\tconst result: HostedPluginManifest[] = []\n\t\tfor (const manifestId of featuredPluginManifestIds) {\n\t\t\tif (recentIds.has(manifestId)) continue\n\t\t\tconst manifest = eligibleManifestsById.get(manifestId)\n\t\t\tif (!manifest) continue\n\t\t\tresult.push(manifest)\n\t\t}\n\t\treturn result\n\t}, [recents, eligibleManifestsById, featuredPluginManifestIds])\n\n\treturn useMemo<readonly PluginSection[]>(() => {\n\t\tconst shouldShowMarketplaceSection = searchTerms.length > 0\n\t\t// While searching we collapse everything into a single Marketplace section across all eligible\n\t\t// plugins, including any recents/featured, matching the previous QuickActions behavior.\n\t\tif (shouldShowMarketplaceSection) {\n\t\t\tconst matches = eligibleManifests.filter(manifest => pluginMatchesSearchTerms(manifest, searchTerms))\n\t\t\treturn matches.length > 0 ? [{ title: Dictionary.Marketplace, plugins: matches }] : []\n\t\t}\n\n\t\tconst result: PluginSection[] = []\n\t\tif (recents.length > 0) result.push({ title: Dictionary.Recents, plugins: recents })\n\t\tif (featured.length > 0) result.push({ title: Dictionary.Featured, plugins: featured })\n\t\treturn result\n\t}, [recents, featured, eligibleManifests, searchTerms])\n}\n\ninterface PluginsContentProps {\n\tsections: readonly PluginSection[]\n\tisSearching: boolean\n\tselectedManifestId: PluginManifestId | null\n\tonPluginClick: (this: unknown, manifest: VekterPluginManifest) => void\n\tmarketplacePluginsUrl: string\n}\n\nfunction PluginsContent({\n\tsections,\n\tisSearching,\n\tselectedManifestId,\n\tonPluginClick,\n\tmarketplacePluginsUrl,\n}: PluginsContentProps) {\n\tif (isSearching && sections.length === 0) {\n\t\treturn <EmptyState center body={Dictionary.NoSearchResults} />\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{sections.map((section, index) => (\n\t\t\t\t<Fragment key={section.title}>\n\t\t\t\t\t<PanelSectionHeader title={section.title} panelDivider={index > 0} className={styles.sectionHeader} />\n\t\t\t\t\t{section.plugins.map(manifest => (\n\t\t\t\t\t\t<PluginRow\n\t\t\t\t\t\t\tkey={manifest.id}\n\t\t\t\t\t\t\tvariant=\"withinSidebar\"\n\t\t\t\t\t\t\ticon={<PluginIcon src={getPluginIcon(manifest)} size=\"small\" />}\n\t\t\t\t\t\t\tlabel={manifest.name}\n\t\t\t\t\t\t\tselected={selectedManifestId === manifest.id}\n\t\t\t\t\t\t\tonClick={() => onPluginClick(manifest)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</Fragment>\n\t\t\t))}\n\t\t\t{!isSearching && (\n\t\t\t\t<PluginRow\n\t\t\t\t\tvariant=\"withinSidebar\"\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<IconWithInnerShadow size=\"small\">\n\t\t\t\t\t\t\t<IconPlugins />\n\t\t\t\t\t\t</IconWithInnerShadow>\n\t\t\t\t\t}\n\t\t\t\t\tlabel=\"Browse All\"\n\t\t\t\t\tselected={false}\n\t\t\t\t\tonClick={() => openNewTab(marketplacePluginsUrl)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import \"PluginsPanel.styles_bb6vyu.wyw.css\"; export const panel = \"panel_pkozb8d\";\nexport const searchWrapper = \"searchWrapper_sze0lrb\";\nexport const scroll = \"scroll_sh3qefu\";\nexport const sectionHeader = \"sectionHeader_s117lq70\";", "import engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport {\n\tairtableManifestId,\n\tashbyManifestId,\n\tcmsExportManifestId,\n\tcsvImportManifestId,\n\tgoogleSheetsManifestId,\n\thubspotManifestId,\n\tnotionManifestId,\n\ttype PluginManifestId,\n\ttype VekterPluginManifest,\n} from \"plugins/plugins.ts\"\nimport { showUnsupportedModesToast } from \"plugins/toast.ts\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { openPluginAndCreateManagedCollectionIfNeeded } from \"../QuickActions/utils/usePluginQuickActions.tsx\"\nimport { PluginsPanel } from \"../shared/PluginsPanel.tsx\"\n\nconst marketplacePluginsUrl = \"https://www.framer.com/marketplace/plugins/category/cms/\"\n\n// Plugin modes that are openable from the CMS plugins panel. Keep this aligned with the modes the\n// QuickActions opener resolves for the ContentManagement main view (no category override) \u2014 otherwise\n// the panel will show plugins that the opener can't actually start, and clicking them will throw.\nconst cmsSupportedModes: readonly Mode[] = [\"configureManagedCollection\", \"syncManagedCollection\", \"collection\"]\n\nconst cmsFeaturedPluginManifestIds: readonly PluginManifestId[] = [\n\tgoogleSheetsManifestId,\n\tnotionManifestId,\n\tairtableManifestId,\n\tashbyManifestId,\n\thubspotManifestId,\n\tcsvImportManifestId,\n\tcmsExportManifestId,\n]\n\nexport function CollectionPluginsPanel() {\n\tconst selectedManifestId = useSelectedManifestId()\n\n\treturn (\n\t\t<PluginsPanel\n\t\t\tselectedManifestId={selectedManifestId}\n\t\t\tfeaturedPluginManifestIds={cmsFeaturedPluginManifestIds}\n\t\t\tsupportedModes={cmsSupportedModes}\n\t\t\tonPluginClick={onOpenManagedCollectionClick}\n\t\t\tmarketplacePluginsUrl={marketplacePluginsUrl}\n\t\t/>\n\t)\n}\n\nfunction useSelectedManifestId(): PluginManifestId | null {\n\tconst activePluginId = engine.stores.pluginStore.useState(state => state.activePlugin?.manifestId ?? null)\n\tconst pendingCreateManagedCollectionManifestId = engine.stores.modalStore.useState(state =>\n\t\tstate.active.type === ModalType.CreateManagedCollection ? state.active.manifest.id : null,\n\t)\n\treturn activePluginId ?? pendingCreateManagedCollectionManifestId\n}\n\nconst onOpenManagedCollectionClick = engine.scheduler.wrapHandler((manifest: VekterPluginManifest) => {\n\t// Mirrors PluginPicker.handleSelectPlugin: pick the first CMS-supported mode the manifest declares\n\t// and bail out with a toast otherwise. In normal flow the row is only rendered when the manifest\n\t// is eligible, but this guards us if a stale manifest somehow makes it through.\n\tconst supportedMode = cmsSupportedModes.find(mode => manifest.modes.includes(mode))\n\tif (!supportedMode) {\n\t\tshowUnsupportedModesToast(cmsSupportedModes)\n\t\treturn\n\t}\n\n\topenPluginAndCreateManagedCollectionIfNeeded(manifest, undefined, undefined, undefined)\n})\n", "import engine from \"document/engine.ts\"\nimport { ActiveLeftPanel } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { LeftPanel } from \"../leftPanel/LeftPanel.tsx\"\nimport { TabbedContentPanel } from \"./TabbedContentPanel.tsx\"\n\nexport const ContentPanel = React.memo(function ContentPanel() {\n\tconst { chromeIsVisible, leftPanel } = engine.stores.chromeStore.useState()\n\tconst isHidden = leftPanel !== ActiveLeftPanel.Canvas\n\n\tif (!chromeIsVisible) return null\n\n\treturn (\n\t\t<LeftPanel hiddenWithoutUnmounting={isHidden}>\n\t\t\t<TabbedContentPanel />\n\t\t</LeftPanel>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem, Tabs, TabsItem } from \"@framerjs/fresco\"\nimport { appAccelerators } from \"app/AppAccelerators.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { getAcceleratorTokenSeparator, getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport { Assets } from \"../assets/Assets.tsx\"\nimport { ContentPanelPagesTab } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { Layers } from \"../layers/Layers.tsx\"\nimport { PanelSearchProvider } from \"./PanelSearch.tsx\"\nimport * as styles from \"./TabbedContentPanel.styles.ts\"\n\nfunction TabbedContent({ tab }: { tab: ActiveContentPanelTab }) {\n\tuseRecordEffect(\"ui_impression\", { page: `content_panel_tab_${tab.toLowerCase()}` }, [tab])\n\n\tswitch (tab) {\n\t\tcase ActiveContentPanelTab.Pages:\n\t\t\treturn <ContentPanelPagesTab />\n\t\tcase ActiveContentPanelTab.Layers:\n\t\t\treturn <Layers />\n\t\tcase ActiveContentPanelTab.Assets: {\n\t\t\treturn <Assets />\n\t\t}\n\t}\n}\n\nfunction onSelect(tab: ActiveContentPanelTab) {\n\tengine.stores.chromeStore.contentPanelTab = tab\n}\n\nexport function TabbedContentPanel() {\n\tconst { contentPanelTab } = engine.stores.chromeStore.useState()\n\tconst isAgentExperiment = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<PanelSearchProvider>\n\t\t\t{isAgentExperiment ? (\n\t\t\t\t<MemoizedTabControl contentPanelTab={contentPanelTab} />\n\t\t\t) : (\n\t\t\t\t<MemoizedSegmentedControl contentPanelTab={contentPanelTab} />\n\t\t\t)}\n\t\t\t<TabbedContent tab={contentPanelTab} />\n\t\t</PanelSearchProvider>\n\t)\n}\n\n/**\n * Memoized to avoid re-renders coming from chromeStore changes while the tab change is animating.\n */\nconst MemoizedTabControl = React.memo(({ contentPanelTab }: { contentPanelTab: ActiveContentPanelTab }) => (\n\t<div className={styles.header}>\n\t\t<Tabs value={contentPanelTab} onChange={onSelect}>\n\t\t\t<TabsItem\n\t\t\t\tvalue={ActiveContentPanelTab.Pages}\n\t\t\t\ttitle={\n\t\t\t\t\tappAccelerators.showPages\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showPages).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tdata-testid=\"pages-tab\"\n\t\t\t>\n\t\t\t\tPages\n\t\t\t</TabsItem>\n\t\t\t<TabsItem\n\t\t\t\tvalue={ActiveContentPanelTab.Layers}\n\t\t\t\ttitle={\n\t\t\t\t\tappAccelerators.showLayers\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showLayers).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tdata-testid=\"layers-tab\"\n\t\t\t>\n\t\t\t\tLayers\n\t\t\t</TabsItem>\n\t\t\t<TabsItem\n\t\t\t\tvalue={ActiveContentPanelTab.Assets}\n\t\t\t\ttitle={\n\t\t\t\t\tappAccelerators.showAssets\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showAssets).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tdata-testid=\"assets-tab\"\n\t\t\t>\n\t\t\t\tAssets\n\t\t\t</TabsItem>\n\t\t</Tabs>\n\t</div>\n))\n\nconst MemoizedSegmentedControl = React.memo(({ contentPanelTab }: { contentPanelTab: ActiveContentPanelTab }) => (\n\t<div className={styles.header}>\n\t\t<SegmentedControl unsaturated>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={ActiveContentPanelTab.Pages}\n\t\t\t\ttitle=\"Pages\"\n\t\t\t\ttooltip={\n\t\t\t\t\tappAccelerators.showPages\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showPages).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tselected={contentPanelTab === ActiveContentPanelTab.Pages}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\tdata-testid=\"pages-tab\"\n\t\t\t/>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={ActiveContentPanelTab.Layers}\n\t\t\t\ttitle=\"Layers\"\n\t\t\t\ttooltip={\n\t\t\t\t\tappAccelerators.showLayers\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showLayers).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tselected={contentPanelTab === ActiveContentPanelTab.Layers}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\tdata-testid=\"layers-tab\"\n\t\t\t/>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={ActiveContentPanelTab.Assets}\n\t\t\t\ttitle=\"Assets\"\n\t\t\t\ttooltip={\n\t\t\t\t\tappAccelerators.showAssets\n\t\t\t\t\t\t? getAcceleratorTokens(appAccelerators.showAssets).join(getAcceleratorTokenSeparator())\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tselected={contentPanelTab === ActiveContentPanelTab.Assets}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\tdata-testid=\"assets-tab\"\n\t\t\t/>\n\t\t</SegmentedControl>\n\t</div>\n))\n", "import { ReadOnlyContext, type ScrollOffsetRestorationCache, ScrollWithOffsetRestoration } from \"@framerjs/fresco\"\nimport { dataIsModalSelector } from \"@framerjs/fresco/components/CustomModal\"\nimport type { LocalModuleId } from \"@framerjs/shared\"\nimport 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 {\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tLAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { newSetByTogglingItem } from \"document/utils/newSetByTogglingItem.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { dataIsContextMenuSelector, isBackdropElement } from \"menu/ContextMenu.tsx\"\nimport React, { useCallback, useLayoutEffect, useRef, useState } from \"react\"\nimport { useOnClickOutside } from \"utils/useClickOutside.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { EscapePrecedence, useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\nimport { ContentPanelSearchBar } from \"../contentPanel/ContentPanelSearchBar.tsx\"\nimport { usePanelSearch } from \"../contentPanel/PanelSearch.tsx\"\nimport { isPopoutButtonElement } from \"../shared/PopoutButton.tsx\"\nimport { dataIsPopoutWindowSelector, popoutWindow } from \"../shared/PopoutWindow.tsx\"\nimport { isRangeSelecting, isToggleSelecting } from \"../shared/utils/panelMultiSelect.ts\"\nimport * as styles from \"./Assets.styles.ts\"\nimport { EntityCodeFilesAssetSection } from \"./EntityCodeFilesAssetSection.tsx\"\nimport { EntityComponentsAssetSection } from \"./EntityComponentsAssetSection.tsx\"\nimport { EntityLayoutTemplatesAssetSection } from \"./EntityLayoutTemplatesAssetSection.tsx\"\nimport { EntityStylesAssetSection } from \"./EntityStylesAssetSection.tsx\"\nimport { EntityVectorSetsAssetSection } from \"./EntityVectorSetsAssetSection.tsx\"\nimport { expandAssetEntityItemsFromNode } from \"./utils/expandAssetEntityItems.ts\"\nimport type { AssetRow } from \"./utils/useAssetPanelEntityRows.ts\"\n\ninterface SectionConfig {\n\tkey: \"layoutTemplates\" | \"components\" | \"styles\" | \"vectorSets\" | \"codeFiles\"\n\tcomponent:\n\t\t| typeof EntityLayoutTemplatesAssetSection\n\t\t| typeof EntityComponentsAssetSection\n\t\t| typeof EntityStylesAssetSection\n\t\t| typeof EntityVectorSetsAssetSection\n\t\t| typeof EntityCodeFilesAssetSection\n}\n\nconst sectionsConfig: SectionConfig[] = [\n\t{\n\t\tkey: \"layoutTemplates\",\n\t\tcomponent: EntityLayoutTemplatesAssetSection,\n\t},\n\t{\n\t\tkey: \"components\",\n\t\tcomponent: EntityComponentsAssetSection,\n\t},\n\t{\n\t\tkey: \"styles\",\n\t\tcomponent: EntityStylesAssetSection,\n\t},\n\t{\n\t\tkey: \"vectorSets\",\n\t\tcomponent: EntityVectorSetsAssetSection,\n\t},\n\t{\n\t\tkey: \"codeFiles\",\n\t\tcomponent: EntityCodeFilesAssetSection,\n\t},\n] as const\n\nconst scrollOffsetRestorationCache: ScrollOffsetRestorationCache = new Map()\n\nexport const Assets = React.memo(function Assets() {\n\tconst { scopeStore, codeEditorStore, chromeStore } = engine.stores\n\tconst { activeScopeId, activeScopeType } = useEngineState(\n\t\t() => {\n\t\t\treturn {\n\t\t\t\tactiveScopeId: scopeStore.activeId,\n\t\t\t\tactiveScopeType: scopeStore.scopeType,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\tscopeStore,\n\t)\n\tconst currentCodeFileId = useEngineState(() => codeEditorStore.currentCodeFileId, [], codeEditorStore)\n\n\tconst assetsPanelRef = useRef<HTMLDivElement>(null)\n\n\t// Used to track changing sections during multi-select\n\tconst lastSelectionTypeRootId = useRef<EntityTypeRootId | null>(\n\t\tgetTypeRootNodeIdToExpand(currentCodeFileId, activeScopeType),\n\t)\n\t// Auto-select the active scope/code file on first load\n\tconst currentViewId = currentCodeFileId ?? activeScopeId\n\t// A code file editor doesn't have a scope, so if the scope is not allowed to be selected, we need to check for\n\t// a current code file id to make sure that open code editors will be picked up as the selection.\n\tconst hasValidView = isAllowedToSetScopeAsSelection(activeScopeType) || !!currentCodeFileId\n\tconst [selectedItemIds, setSelectedItemIds] = useState<ReadonlySet<NodeID>>(() => {\n\t\tif (hasValidView) {\n\t\t\treturn new Set([currentViewId])\n\t\t}\n\t\treturn new Set()\n\t})\n\t// Sets don't guarantee a meaningful \"last\" item for range selection anchoring,\n\t// so we use a separate state to keep track of the item that was last clicked when range selecting.\n\tconst [rangeAnchorId, setRangeAnchorId] = useState<NodeID | null>(() => currentViewId)\n\n\tconst isContentPanelSearchFocused = useEngineState(() => chromeStore.isContentPanelSearchFocused, [], chromeStore)\n\n\tconst { expandedAssetEntityIds, isPreviewingLocaleOnCanvas } = useEngineState(\n\t\t() => ({\n\t\t\tisPreviewingLocaleOnCanvas: chromeStore.isPreviewingLocaleOnCanvas,\n\t\t\texpandedAssetEntityIds: chromeStore.expandedAssetEntityIds(false),\n\t\t}),\n\t\t[],\n\t\tchromeStore,\n\t)\n\n\tconst isViewOnly = useIsViewOnly(\"canDesign\") || isPreviewingLocaleOnCanvas\n\n\tconst setSingleSelection = useCallback((value: NodeID) => {\n\t\tsetSelectedItemIds(new Set([value]))\n\t\tsetRangeAnchorId(value)\n\t}, [])\n\n\t// Resets the selection on scope change\n\tconst previousScopeRef = useRef<string | null>(null)\n\tif (previousScopeRef.current && previousScopeRef.current !== currentViewId) {\n\t\tif (selectedItemIds.size > 0 && hasValidView) {\n\t\t\t// If there was a selection, make it single select of the new scope\n\t\t\tsetSingleSelection(currentViewId)\n\t\t} else {\n\t\t\t// Clear any lingering state\n\t\t\tsetSelectedItemIds(new Set())\n\t\t\tsetRangeAnchorId(null)\n\t\t}\n\t}\n\tpreviousScopeRef.current = currentViewId\n\n\t// Auto-expand folders to make the current scope's corresponding row visible\n\tuseLayoutEffect(() => {\n\t\tif (!currentCodeFileId && !activeScopeId) return\n\n\t\tconst selectedScopeId = currentCodeFileId ?? activeScopeId\n\t\tconst typeRootNodeId = getTypeRootNodeIdToExpand(currentCodeFileId, activeScopeType)\n\t\tif (!typeRootNodeId) return\n\n\t\t// We can't update store data while rendering\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t// Make sure we expand the folders until the selected node\n\t\t\texpandAssetEntityItemsFromNode(engine, selectedScopeId, typeRootNodeId, false)\n\t\t})\n\t}, [currentCodeFileId, activeScopeId, activeScopeType])\n\n\tconst handleSelectItem = useCallback(\n\t\t(value: NodeID, typeRootId: EntityTypeRootId, currentRows?: readonly AssetRow[]) => {\n\t\t\tconst node = engine.tree.getNode(value)\n\t\t\tif (!node) return\n\n\t\t\t// Clean up popout before processing a new selection\n\t\t\tif (popoutWindow.isOpen()) {\n\t\t\t\tpopoutWindow.close()\n\t\t\t}\n\n\t\t\tif (lastSelectionTypeRootId.current !== typeRootId) {\n\t\t\t\tlastSelectionTypeRootId.current = typeRootId\n\t\t\t\tsetSingleSelection(value)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isRangeSelecting() && currentRows) {\n\t\t\t\tif (!rangeAnchorId || !selectedItemIds.has(rangeAnchorId)) {\n\t\t\t\t\tsetSingleSelection(value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst anchorIndex = currentRows.findIndex(row => row.id === rangeAnchorId)\n\t\t\t\tconst clickedIndex = currentRows.findIndex(row => row.id === value)\n\n\t\t\t\t// If the anchor item or the clicked item is not found in the current rows,\n\t\t\t\t// we set the single selection to the clicked item\n\t\t\t\tif (anchorIndex === -1 || clickedIndex === -1) {\n\t\t\t\t\tsetSingleSelection(value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst from = Math.min(anchorIndex, clickedIndex)\n\t\t\t\tconst to = Math.max(anchorIndex, clickedIndex)\n\t\t\t\tconst rangeIds = new Set(selectedItemIds)\n\n\t\t\t\tfor (let i = from; i <= to; i++) {\n\t\t\t\t\tconst row = currentRows[i]\n\t\t\t\t\tif (row) {\n\t\t\t\t\t\trangeIds.add(row.id)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsetSelectedItemIds(rangeIds)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (isToggleSelecting()) {\n\t\t\t\tsetSelectedItemIds(prev => {\n\t\t\t\t\tconst newSelection = newSetByTogglingItem(prev, value)\n\n\t\t\t\t\t// If the item was added to the selection, it becomes the new anchor\n\t\t\t\t\tif (newSelection.has(value) && !prev.has(value)) {\n\t\t\t\t\t\tsetRangeAnchorId(value)\n\t\t\t\t\t}\n\t\t\t\t\treturn newSelection\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetSingleSelection(value)\n\t\t},\n\t\t[setSingleSelection, selectedItemIds, rangeAnchorId],\n\t)\n\n\tconst onClearSelection = useCallback(\n\t\t({ closePopout = true }: { closePopout?: boolean } = {}) => {\n\t\t\t// Always close popout first if it's open to ensure immediate response and non-blocking behavior\n\t\t\tif (closePopout && popoutWindow.isOpen()) {\n\t\t\t\tpopoutWindow.close()\n\t\t\t}\n\n\t\t\tif (hasValidView) {\n\t\t\t\t// If there's an active scope, select it\n\t\t\t\tsetSingleSelection(currentViewId)\n\t\t\t} else {\n\t\t\t\t// Otherwise just clear selections\n\t\t\t\tsetSelectedItemIds(new Set())\n\t\t\t\tsetRangeAnchorId(null)\n\t\t\t}\n\t\t},\n\t\t[setSingleSelection, currentViewId, hasValidView],\n\t)\n\n\t// Any click outside the assets panel should clear the multi-selection,\n\t// except for clicks within popover content or context menus to keep these interactive.\n\tconst handleOutsideClick = useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst target = event.target\n\t\t\tif (!(target instanceof Element)) return\n\n\t\t\t// Don't clear if the click is within a popover window\n\t\t\tif (target.closest(dataIsPopoutWindowSelector)) return\n\t\t\t// Don't clear if the click is within a context menu\n\t\t\tif (target.closest(dataIsContextMenuSelector)) return\n\t\t\t// Don't clear if the click is within a context menu backdrop\n\t\t\tif (isBackdropElement(target)) return\n\t\t\t// Don't clear if the click is within a modal\n\t\t\tif (target.closest(dataIsModalSelector)) return\n\n\t\t\t// Don't close the popout when clicking a popout button, as it would\n\t\t\t// close the popout before it has a chance to open (due to PreferMouseDown)\n\t\t\tonClearSelection({ closePopout: !isPopoutButtonElement(target) })\n\t\t},\n\t\t[onClearSelection],\n\t)\n\n\tuseOnClickOutside(assetsPanelRef, handleOutsideClick)\n\n\tuseOnEscape({\n\t\tname: \"AssetsPopout\",\n\t\tprecedence: EscapePrecedence.popout,\n\t\tenabled: () => popoutWindow.isOpen(),\n\t\thandler: onClearSelection,\n\t})\n\tuseOnEscape({\n\t\tname: \"Assets\",\n\t\tprecedence: EscapePrecedence.panelSelection,\n\t\thandler: onClearSelection,\n\t})\n\n\tconst { searchQueryFor } = usePanelSearch()\n\tconst searchQuery = searchQueryFor(ActiveContentPanelTab.Assets)\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t<div className={styles.wrapper} ref={assetsPanelRef} tabIndex={-1}>\n\t\t\t\t<div className={styles.searchBarWrapper}>\n\t\t\t\t\t<ReadOnlyContext.Provider value={false}>\n\t\t\t\t\t\t<ContentPanelSearchBar\n\t\t\t\t\t\t\tcontentPanelTab={ActiveContentPanelTab.Assets}\n\t\t\t\t\t\t\tisFocused={isContentPanelSearchFocused}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t</div>\n\t\t\t\t<ScrollWithOffsetRestoration\n\t\t\t\t\tclassName={styles.scroll}\n\t\t\t\t\trestorationID=\"assets-panel\"\n\t\t\t\t\trestorationCache={scrollOffsetRestorationCache}\n\t\t\t\t>\n\t\t\t\t\t{sectionsConfig.map(({ key, component: AssetSection }) => (\n\t\t\t\t\t\t<AssetSection\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tsearchQuery={searchQuery}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tselectedItemIds={selectedItemIds}\n\t\t\t\t\t\t\texpandedAssetEntityIds={expandedAssetEntityIds}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t\tonClearSelection={onClearSelection}\n\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId.current}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ScrollWithOffsetRestoration>\n\t\t\t\t<div className={styles.noResults}>\n\t\t\t\t\t<p>No Assets Found</p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</ReadOnlyContext.Provider>\n\t)\n})\n\nfunction getTypeRootNodeIdToExpand(\n\tcurrentCodeFileId: LocalModuleId | null | undefined,\n\tactiveScopeType: ScopeType,\n): EntityTypeRootId | null {\n\t// Opening code files does not correspond to a specific scope,\n\t// they just inherit the previously opened one. Therefore, if we\n\t// know that there's a current code file in store, we can use that\n\t// to auto expand the code files section.\n\tif (currentCodeFileId) {\n\t\treturn CODE_FILE_ENTITY_TYPE_ROOT_ID\n\t}\n\n\tswitch (activeScopeType) {\n\t\tcase ScopeType.LayoutTemplate:\n\t\t\treturn LAYOUT_TEMPLATE_ENTITY_ROOT_ID\n\t\tcase ScopeType.SmartComponent:\n\t\t\treturn COMPONENTS_ENTITY_TYPE_ROOT_ID\n\t\tcase ScopeType.VectorSet:\n\t\t\treturn VECTOR_SET_ENTITY_TYPE_ROOT_ID\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\n// Helper to determine whether a scope type corresponds to an asset type that can be selected\nfunction isAllowedToSetScopeAsSelection(activeScopeType: ScopeType) {\n\treturn (\n\t\tactiveScopeType === ScopeType.SmartComponent ||\n\t\tactiveScopeType === ScopeType.VectorSet ||\n\t\tactiveScopeType === ScopeType.LayoutTemplate\n\t)\n}\n", "import \"Assets.styles_jettdi.wyw.css\"; export const noResults = \"noResults_n1pzqs4s\";\nexport const scroll = \"scroll_sd1o7fg\";\nexport const wrapper = \"wrapper_w1rnri5n\";\nexport const searchBarWrapper = \"searchBarWrapper_sdw2kvc\";", "import { palette } from \"@framerjs/fresco/tokens\"\nimport { assert, ModuleType, asLocalId } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useEmployeesOnlySettingIsOn } from \"app/employeesOnlySettings.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype EntityReferenceNode,\n\tbuildCodeFileEntityReferenceNodeId,\n} from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCodeFileEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport {\n\ttype LocalModuleNode,\n\tLocalModulesListNode,\n\tisLocalModuleNode,\n} from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { createReferenceForNodeIfNeeded } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isEntityFolderNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { openPluginAndCreateManagedCollectionIfNeeded } from \"../QuickActions/utils/usePluginQuickActions.tsx\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { createCodeFileContextMenuItems } from \"../properties/utils/getCodeFileRowProps.ts\"\nimport type { ContextMenuOptions } from \"../properties/utils/presetRowProps.ts\"\nimport { isMultiSelectModifierKeyPressed } from \"../shared/utils/panelMultiSelect.ts\"\nimport { areCodeFilesInUse } from \"../utils/codeFileUsageChecker.ts\"\nimport { EntityRow } from \"./EntityRow.tsx\"\nimport * as styles from \"./EntitySection.styles.ts\"\nimport type { EntitySectionProps } from \"./EntitySection.ts\"\nimport { ImportMap } from \"./ImportMap.tsx\"\nimport { ShaderModules } from \"./ShaderModules.tsx\"\nimport { createAndRenameFolderNode, createEntityReferenceNodeForRootType } from \"./actions/create.ts\"\nimport { deleteCodeFileNode, deleteEntityFolderNode, deleteLocalComponentScopeNode } from \"./actions/delete.ts\"\nimport { sortEntityAssetsAlphabetically } from \"./actions/sort.ts\"\nimport { createMultiSelectContextMenu } from \"./utils/createMultiSelectContextMenu.ts\"\nimport { getModulesMap } from \"./utils/getExportedModulesMap.ts\"\nimport { getNodeName } from \"./utils/getNodeName.ts\"\nimport { createFolderFromSelection, createRenderOrderedGetter } from \"./utils/multiselect.ts\"\nimport { resolveContextMenuHandler } from \"./utils/resolveContextMenuHandler.ts\"\nimport { type AssetRow, useAssetPanelEntityRows, useLocalShaderModuleFolder } from \"./utils/useAssetPanelEntityRows.ts\"\n\nexport const EntityCodeFilesAssetSection = React.memo(function EntityCodeFilesAssetSection({\n\tisViewOnly,\n\tselectedItemIds,\n\texpandedAssetEntityIds,\n\tonSelectItem,\n\tonClearSelection,\n\tsearchQuery,\n\tlastSelectionTypeRootId,\n}: EntitySectionProps) {\n\tconst importsMapEnabled = useEmployeesOnlySettingIsOn(\"showImportMap\")\n\tconst showShaderTools = useEmployeesOnlySettingIsOn(\"showShaderTools\")\n\tconst shadersExperimentOn = useExperimentIsOn(\"shaders\")\n\tconst showShaders = showShaderTools && shadersExperimentOn\n\n\tconst codeFilesExpanded = engine.stores.chromeStore.useState(state => state.codeFilesExpanded)\n\n\tconst dependenciesModule = useEngineState(\n\t\t() => engine.stores.modulesStore.dependenciesModule,\n\t\t[EngineChange.ActiveBundle],\n\t\tengine.stores.modulesStore,\n\t)\n\n\tconst [state, toggleCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(() => {\n\t\t\tconst entityRootNode = CodeFileEntityTypeRootNode.get(engine.tree)\n\t\t\tif (!entityRootNode) return null\n\n\t\t\tconst modulesMap = getModulesMap(engine.componentLoader)\n\n\t\t\tconst localModuleNodes = LocalModulesListNode.getModuleNodes(engine.tree)\n\n\t\t\tconst depth = 0\n\t\t\t/**\n\t\t\t * To check for non referenced nodes we build the reference id that would be fixed for a given node\n\t\t\t * and we check if that node already exists in the tree. If it does we skip it.\n\t\t\t */\n\t\t\tconst unreferenced: AssetRow[] = []\n\t\t\tconst allowList = new Set<NodeID>()\n\n\t\t\tfor (const node of localModuleNodes) {\n\t\t\t\tif (node.save.type !== ModuleType.Code) continue\n\n\t\t\t\tconst maybeReferenceId = buildCodeFileEntityReferenceNodeId(node.id)\n\t\t\t\tallowList.add(node.id)\n\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\tconst nodeName = getNodeName(node)\n\n\t\t\t\tif (searchQuery && !matchSubstring(searchQuery, nodeName)) continue\n\n\t\t\t\tunreferenced.push({\n\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\tid: node.id,\n\t\t\t\t\tdepth,\n\t\t\t\t\ttitle: nodeName,\n\t\t\t\t\tmodules: modulesMap?.get(node.id),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tentityRootNode,\n\t\t\t\tunreferenced,\n\t\t\t\tallowList,\n\t\t\t\tmodulesByLocalId: modulesMap,\n\t\t\t\ttree: engine.tree,\n\t\t\t}\n\t\t}, [searchQuery]),\n\t\t[EngineChange.ActiveBundle],\n\t)\n\n\tconst showImportMap = importsMapEnabled && !!dependenciesModule\n\tconst shaderFolder = useLocalShaderModuleFolder(searchQuery, \"fileName\")\n\n\t// Include shader items in the row list so shift-click range selection works across code files and shaders.\n\tconst allRows = useMemo(() => {\n\t\tif (!showShaders) return state.rows\n\t\tconst shaderRows: AssetRow[] = shaderFolder.items.map(item => ({\n\t\t\ttype: \"reference\",\n\t\t\tid: item.localId,\n\t\t\tdepth: 1,\n\t\t\ttitle: item.name,\n\t\t}))\n\t\treturn [...shaderRows, ...state.rows]\n\t}, [state.rows, shaderFolder.items, showShaders])\n\n\tconst handleSelectItem = useEngineCallback(\n\t\t(value: NodeID) => {\n\t\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return\n\n\t\t\tconst node = engine.tree.getNode(value)\n\n\t\t\tif (isLocalModuleNode(node) && node.save.name && !isMultiSelectModifierKeyPressed()) {\n\t\t\t\tengine.stores.codeEditorStore.editFile(node.save.name)\n\t\t\t}\n\n\t\t\tonSelectItem(value, CODE_FILE_ENTITY_TYPE_ROOT_ID, allRows)\n\t\t},\n\t\t[onSelectItem, allRows],\n\t)\n\n\tconst handleImportMapSelectItem = useEngineCallback(\n\t\t(id: string) => {\n\t\t\tengine.stores.codeEditorStore.editFile(id)\n\n\t\t\tonSelectItem(id, CODE_FILE_ENTITY_TYPE_ROOT_ID, allRows)\n\t\t},\n\t\t[onSelectItem, allRows],\n\t)\n\n\tconst getOrderedIds = useMemo(() => createRenderOrderedGetter(allRows), [allRows])\n\n\tconst hasItems = state.rows.length > 0\n\tconst createContextMenu = useCreateContextMenu(hasItems)\n\n\tconst multipleCodeFileContextMenuItems = useMemo(() => {\n\t\treturn createMultipleCodeFileContextMenuItems(onClearSelection)(selectedItemIds)\n\t}, [onClearSelection, selectedItemIds])\n\n\tconst contextMenuHandler = useMemo(\n\t\t() =>\n\t\t\tresolveContextMenuHandler(selectedItemIds, createCodeFileItemContextMenuItems, multipleCodeFileContextMenuItems),\n\t\t[selectedItemIds, multipleCodeFileContextMenuItems],\n\t)\n\n\tif (searchQuery && !hasItems && !showShaders) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle={Dictionary.Code}\n\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleCodeFiles}\n\t\t\t\tonRightClick={createContextMenu}\n\t\t\t\tinTabbedPanel\n\t\t\t\thasItems={hasItems || showShaders}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\ttitle=\"Add Code\"\n\t\t\t\t\t\texpanded={codeFilesExpanded}\n\t\t\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\n\t\t\t{codeFilesExpanded && (\n\t\t\t\t<div className={styles.sectionContent}>\n\t\t\t\t\t{showImportMap && (\n\t\t\t\t\t\t<ImportMap\n\t\t\t\t\t\t\texpandedAssetEntityIds={expandedAssetEntityIds}\n\t\t\t\t\t\t\tselectedItemIds={selectedItemIds}\n\t\t\t\t\t\t\tonSelectItem={handleImportMapSelectItem}\n\t\t\t\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{showShaders && (\n\t\t\t\t\t\t<ShaderModules\n\t\t\t\t\t\t\tsearchQuery={searchQuery}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tdisplayNameMode=\"fileName\"\n\t\t\t\t\t\t\tselectedItemIds={selectedItemIds}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{state.rows.map(row => (\n\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\ttypeRootId={CODE_FILE_ENTITY_TYPE_ROOT_ID}\n\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\tcolor={palette.purple100}\n\t\t\t\t\t\t\tonToggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t\thasUnreferencedItems={state.hasUnreferencedItems}\n\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandler}\n\t\t\t\t\t\t\tisCodeFileFolder={row.isCodeFileFolder}\n\t\t\t\t\t\t\tmodules={row.modules}\n\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\tgetOrderedIds={getOrderedIds}\n\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nfunction createCodeFileItemContextMenuItems(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get<LocalModuleNode>(id)\n\tif (isNull(node)) return []\n\tif (!isLocalModuleNode(node) || node.save.type !== ModuleType.Code) return []\n\n\treturn createCodeFileContextMenuItems(node, options)\n}\n\nfunction createMultipleCodeFileContextMenuItems(onClearSelection: () => void) {\n\treturn createMultiSelectContextMenu({\n\t\ttypeRootId: CODE_FILE_ENTITY_TYPE_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, CODE_FILE_ENTITY_TYPE_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isLocalModuleNode(node) || node.save.type !== ModuleType.Code) continue\n\n\t\t\t\t\tconst entry = engine.stores.modulesStore.getModuleEntryByLocalId(asLocalId(nodeId))\n\t\t\t\t\tif (!entry?.sourceContent) return\n\n\t\t\t\t\tengine.stores.codeEditorStore.createFile({\n\t\t\t\t\t\tpath: entry.name,\n\t\t\t\t\t\tcontent: entry.sourceContent,\n\t\t\t\t\t\topenFile: false,\n\t\t\t\t\t\tonSuccess: id => {\n\t\t\t\t\t\t\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\t\t\t\t\t\t\tconst node = engine.tree.get<LocalModuleNode>(id)\n\t\t\t\t\t\t\tif (!node) return\n\n\t\t\t\t\t\t\tconst originalReferenceNodeId = buildCodeFileEntityReferenceNodeId(nodeId)\n\t\t\t\t\t\t\tconst originalReferenceNode = engine.tree.get<EntityReferenceNode>(originalReferenceNodeId)\n\t\t\t\t\t\t\tif (isNull(originalReferenceNode)) return\n\n\t\t\t\t\t\t\tconst parentId = originalReferenceNode.parentid\n\n\t\t\t\t\t\t\tif (!parentId) return\n\n\t\t\t\t\t\t\tcreateReferenceForNodeIfNeeded(engine.tree, parentId, id, true)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tconst codeFilesNeedingConfirmation: CanvasNode[] = []\n\t\t\t\tconst otherNodes: NodeID[] = []\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isLocalModuleNode(node) && node.save.type === ModuleType.Code) {\n\t\t\t\t\t\tcodeFilesNeedingConfirmation.push(node)\n\t\t\t\t\t} else {\n\t\t\t\t\t\totherNodes.push(nodeId)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const nodeId of otherNodes) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvoid deleteLocalComponentScopeNode(engine, nodeId)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (codeFilesNeedingConfirmation.length > 0) {\n\t\t\t\t\tconst filePaths: string[] = []\n\n\t\t\t\t\tfor (const node of codeFilesNeedingConfirmation) {\n\t\t\t\t\t\tif (!isLocalModuleNode(node) || node.save.type !== ModuleType.Code || !node.save.name) continue\n\t\t\t\t\t\tfilePaths.push(`${ModuleType.Code}/${node.save.name}`)\n\t\t\t\t\t}\n\n\t\t\t\t\t// We use the single file modal for one file, or the multiple files modal for more than one\n\t\t\t\t\tif (codeFilesNeedingConfirmation.length === 1) {\n\t\t\t\t\t\tconst singleCodeFile = codeFilesNeedingConfirmation[0]\n\t\t\t\t\t\tif (!singleCodeFile) return\n\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.DeleteCodeFile,\n\t\t\t\t\t\t\tsource: \"assets_panel\",\n\t\t\t\t\t\t\tpath: filePaths[0] || \"Unknown\",\n\t\t\t\t\t\t\tonConfirm: async () => {\n\t\t\t\t\t\t\t\tconst codeFileNode = codeFilesNeedingConfirmation[0]\n\t\t\t\t\t\t\t\tif (!isLocalModuleNode(codeFileNode) || codeFileNode.save.type !== ModuleType.Code) {\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tawait deleteCodeFileNode(engine, codeFileNode.id)\n\t\t\t\t\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst canDeleteAll = !areCodeFilesInUse(codeFilesNeedingConfirmation)\n\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.DeleteMultipleCodeFiles,\n\t\t\t\t\t\t\tsource: \"assets_panel\",\n\t\t\t\t\t\t\tpaths: filePaths,\n\t\t\t\t\t\t\tonConfirm: async () => {\n\t\t\t\t\t\t\t\tfor (const codeFileNode of codeFilesNeedingConfirmation) {\n\t\t\t\t\t\t\t\t\tawait deleteCodeFileNode(engine, codeFileNode.id)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tcanDeleteAll,\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\tdisabledByFolders: false,\n\t\t},\n\t})\n}\n\nfunction contextMenu({ sortAlphabetically }: { sortAlphabetically: boolean }): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\tconst workshopPluginManifest = engine.stores.pluginStore.getWorkshopManifest()\n\tconst showNewWithAiItem = !!workshopPluginManifest\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.NewCodeFile,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () =>\n\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\trootType: CODE_FILE_ENTITY_TYPE_ROOT_ID,\n\t\t\t\t}),\n\t\t},\n\n\t\t{\n\t\t\tlabel: Dictionary.NewFolder,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => createAndRenameFolderNode(engine, CODE_FILE_ENTITY_TYPE_ROOT_ID, false),\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: \"New with AI\",\n\t\t\tenabled: !isViewOnly,\n\t\t\tvisible: showNewWithAiItem,\n\t\t\tclick: () => {\n\t\t\t\t// the plugin only works on the canvas so we need to close the code editor\n\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t\tassert(workshopPluginManifest, \"Workshop plugin manifest should be available\")\n\t\t\t\topenPluginAndCreateManagedCollectionIfNeeded(workshopPluginManifest, undefined, undefined)\n\t\t\t},\n\t\t},\n\t\t{ type: \"separator\", visible: showNewWithAiItem },\n\t\t{\n\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\tvisible: sortAlphabetically,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, CODE_FILE_ENTITY_TYPE_ROOT_ID),\n\t\t},\n\t]\n}\n\nfunction useCreateContextMenu(hasItems: boolean) {\n\treturn useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tengine.stores.contextMenuStore.show(contextMenu({ sortAlphabetically: hasItems }), {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: event.clientX,\n\t\t\t\t\ty: event.clientY,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[hasItems],\n\t)\n}\n", "import { ModuleType, asLocalId, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { editInfoForCodeComponentIdentifier } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype EntityReferenceNode,\n\tbuildCodeFileEntityReferenceNodeId,\n} from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport type { LocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { createReferenceForNodeIfNeeded } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { componentExportIdentifierStringForLocalModule } from \"modules/utils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport { deleteCodeFileNode } from \"../../assets/actions/delete.ts\"\nimport { getModuleContextMenuItems } from \"../../shared/utils/getComponentContextMenuItems.ts\"\nimport type { ContextMenuOptions } from \"./presetRowProps.ts\"\n\nconst log = getLogger(\"codeFileContextMenuItems\")\n\nexport function createCodeFileContextMenuItems(\n\tnode: LocalModuleNode,\n\t{ startRenaming }: ContextMenuOptions,\n): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tconst codeComponentIdentifier = componentExportIdentifierStringForLocalModule(\n\t\tengine.componentLoader,\n\t\tengine.stores.modulesStore,\n\t\tasLocalId(node.id),\n\t)\n\n\tconst moduleContextMenuItems = getModuleContextMenuItems({\n\t\tcomponentIdentifier: codeComponentIdentifier,\n\t\tteamLibrary: engine.stores.libraryStore.teamLibrary,\n\t\tisViewOnly,\n\t\tsource: \"code_panel\",\n\t})\n\n\tconst menuItems = [\n\t\t...editInfoForCodeComponentIdentifier(codeComponentIdentifier, engine, {\n\t\t\tkeepHistory: false,\n\t\t}),\n\t\t{\n\t\t\ttype: \"separator\" as const,\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Find,\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\tsource: \"code_panel\",\n\t\t\t\t\tinitialCategory: {\n\t\t\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttype: FindNodesType.CodeFile,\n\t\t\t\t\t\t\ttitle: node.save.name ?? Dictionary.Unknown,\n\t\t\t\t\t\t\tmoduleId: asLocalId(node.id),\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\t{ label: Dictionary.Rename, enabled: !isViewOnly, click: startRenaming },\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tclick() {\n\t\t\t\tduplicateCodeFile(node.id)\n\t\t\t},\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: async () => {\n\t\t\t\tif (!engine.stores.treeStore.getDataTree()) {\n\t\t\t\t\tawait engine.runWithFullyLoadedTreeAsync({ name: \"delete_file_modal\" })\n\t\t\t\t}\n\t\t\t\tconst tree = engine.stores.treeStore.getDataTreeOrLoadedTree()\n\n\t\t\t\tconst currentNode = tree.current(node)\n\n\t\t\t\tif (!currentNode || !currentNode.save.name) return\n\n\t\t\t\tshowDeleteFileModal(currentNode.id, currentNode.save.name)\n\t\t\t},\n\t\t},\n\t]\n\n\tif (moduleContextMenuItems.length > 0) {\n\t\tmenuItems.push({ type: \"separator\" })\n\t\tmenuItems.push(...moduleContextMenuItems)\n\t}\n\n\treturn menuItems\n}\n\nfunction duplicateCodeFile(nodeId: NodeID) {\n\ttry {\n\t\tconst entry = engine.stores.modulesStore.getModuleEntryByLocalId(asLocalId(nodeId))\n\t\tif (!entry?.sourceContent) return\n\n\t\tengine.stores.codeEditorStore.createFile({\n\t\t\tpath: entry.name,\n\t\t\tcontent: entry.sourceContent,\n\t\t\topenFile: true,\n\t\t\tonSuccess: id => {\n\t\t\t\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\t\t\t\tconst node = engine.tree.get<LocalModuleNode>(id)\n\t\t\t\tif (!node) return\n\n\t\t\t\tconst originalReferenceNodeId = buildCodeFileEntityReferenceNodeId(nodeId)\n\t\t\t\tconst originalReferenceNode = engine.tree.get<EntityReferenceNode>(originalReferenceNodeId)\n\t\t\t\tif (isNull(originalReferenceNode)) return\n\n\t\t\t\tconst parentId = originalReferenceNode.parentid\n\n\t\t\t\tif (!parentId) return\n\n\t\t\t\tcreateReferenceForNodeIfNeeded(engine.tree, parentId, id, true)\n\t\t\t},\n\t\t})\n\t} catch (err) {\n\t\tlog.error(\"Failed to duplicate code file\", err)\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"error\",\n\t\t\tprimaryText: \"Failed to duplicate\",\n\t\t\tsecondaryText: \"code file.\",\n\t\t\tkey: \"codefile-duplication-error\",\n\t\t\ticon: \"error\",\n\t\t})\n\t}\n}\n\nfunction showDeleteFileModal(id: NodeID, name: string) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.DeleteCodeFile,\n\t\tsource: \"delete_code_file\",\n\t\tpath: `${ModuleType.Code}/${name}`,\n\t\tonConfirm: engine.scheduler.wrapHandler(async () => {\n\t\t\t/** We must wait for the delete action to succeed in the case of codeModules as there is no optimistic modulesStorage yet.\n\t\t\t * We also wait to dismiss the modal until after the delete is completed to provide user feedback of the pending action.\n\t\t\t * The current file of the editor is automatically unset as it no longer exists.\n\t\t\t */\n\t\t\tawait deleteCodeFileNode(engine, id)\n\n\t\t\tengine.stores.modalStore.dismiss()\n\t\t}),\n\t})\n}\n", "import \"EntitySection.styles_1ltm163.wyw.css\"; export const sectionContent = \"sectionContent_s12ttli4\";", "import { IconAssetsCodeFile, IconAssetsCodeFolder } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { DEPENDENCIES_FILE_ID, IMPORT_MAP_FILE_ID } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { filename } from \"code-editor/utils.ts\"\nimport React, { useCallback } from \"react\"\nimport { IconAgentCode } from \"../agentPanel/components/IconAgentCode.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport * as assetStyles from \"./EntityAssetRow.styles.ts\"\n\nconst dependenciesFolderId = \"DEPENDENCIES_FOLDER_ID\"\n\nconst dependenciesFileTitle = filename(DEPENDENCIES_FILE_ID)\nconst importMapFileTitle = filename(IMPORT_MAP_FILE_ID)\n\ninterface ImportMapProps {\n\texpandedAssetEntityIds: ReadonlySet<string>\n\tselectedItemIds: ReadonlySet<string | null> | null\n\tonSelectItem: (id: string) => void\n\ttoggleCollapse: (id: string) => void\n}\n\nexport const ImportMap = React.memo(function ImportMap({\n\texpandedAssetEntityIds,\n\tselectedItemIds,\n\tonSelectItem,\n\ttoggleCollapse,\n}: ImportMapProps) {\n\tconst handleToggleCollapse = useCallback(() => toggleCollapse(dependenciesFolderId), [toggleCollapse])\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst CodeFileIcon = agentExperimentEnabled ? IconAgentCode : IconAssetsCodeFile\n\n\tconst isCollapsed = !expandedAssetEntityIds?.has(dependenciesFolderId)\n\n\treturn (\n\t\t<>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={dependenciesFolderId}\n\t\t\t\ttitle={Dictionary.Dependencies}\n\t\t\t\tdepth={0}\n\t\t\t\tIcon={<IconAssetsCodeFolder className={assetStyles.icon} />}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible\n\t\t\t\tisCollapsed={isCollapsed}\n\t\t\t\ttoggleCollapse={handleToggleCollapse}\n\t\t\t\tisEditable={false}\n\t\t\t\ttitleCanTriggerCollapse\n\t\t\t/>\n\t\t\t{!isCollapsed && (\n\t\t\t\t<>\n\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\tid={DEPENDENCIES_FILE_ID}\n\t\t\t\t\t\tdepth={1}\n\t\t\t\t\t\ttitle={dependenciesFileTitle}\n\t\t\t\t\t\tIcon={<CodeFileIcon color={colors.assetCodeFileIcon} />}\n\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\tisSelected={selectedItemIds?.has(DEPENDENCIES_FILE_ID)}\n\t\t\t\t\t\tonSelect={onSelectItem}\n\t\t\t\t\t\tisEditable={false}\n\t\t\t\t\t/>\n\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\tid={IMPORT_MAP_FILE_ID}\n\t\t\t\t\t\tdepth={1}\n\t\t\t\t\t\ttitle={importMapFileTitle}\n\t\t\t\t\t\tIcon={<CodeFileIcon color={colors.assetCodeFileIcon} />}\n\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\tisSelected={selectedItemIds?.has(IMPORT_MAP_FILE_ID)}\n\t\t\t\t\t\tonSelect={onSelectItem}\n\t\t\t\t\t\tisEditable={false}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { splitExtension } from \"@framerjs/assets\"\nimport { IconEntityFolder, IconLayerShader } from \"@framerjs/fresco\"\nimport { Draggable, type DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { palette } from \"@framerjs/fresco/tokens\"\nimport {\n\ttype LocalModuleId,\n\ttype ModuleExportIdentifierString,\n\tgetLogger,\n\tisLocalModuleIdentifier,\n\tlocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\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 type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { type DraggableComponentData, DraggableComponentDataType } from \"document/components/canvas/CanvasDropZone.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport { getNameFromPath } from \"document/utils/assetPath.ts\"\nimport { memo, useCallback } from \"react\"\nimport { tsExtension } from \"utils/fileExtensionNames.ts\"\nimport {\n\tcreateShaderFile,\n\tcreateShaderModule,\n\tdeleteShaderModule,\n\tduplicateShaderModule,\n\trenameShaderModule,\n} from \"utils/shaderFiles.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { editPanelTitle } from \"../Pages/utils/editPanelRow.ts\"\nimport { IconAgentLayerShader } from \"../layers/AgentLayerIcons.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { selectedSibling } from \"../shared/utils/panelMultiSelect.styles.ts\"\nimport * as assetStyles from \"./EntityAssetRow.styles.ts\"\nimport { FOLDER_COLOR } from \"./EntityAssetRow.styles.ts\"\nimport { insertCanvasNode } from \"./actions/insertCanvasNode.ts\"\nimport { useLocalShaderModuleFolder } from \"./utils/useAssetPanelEntityRows.ts\"\n\nconst log = getLogger(\"ShaderModules\")\n\ninterface ShaderModulesProps {\n\tsearchQuery: string\n\tisViewOnly: boolean\n\tdisplayNameMode?: \"shaderTitle\" | \"fileName\"\n\tselectedItemIds?: ReadonlySet<NodeID>\n\tonSelectItem?: (id: NodeID) => void\n}\n\nexport const ShaderModules = memo(function ShaderModules({\n\tsearchQuery,\n\tisViewOnly,\n\tdisplayNameMode = \"shaderTitle\",\n\tselectedItemIds,\n\tonSelectItem,\n}: ShaderModulesProps) {\n\tconst shaderFolder = useLocalShaderModuleFolder(searchQuery, displayNameMode)\n\tconst shaderModules = shaderFolder.items\n\tconst shadersExpanded = engine.stores.chromeStore.useState(s => s.shadersExpanded)\n\n\tconst getFolderMenuOptions = useCallback((): MenuItemOptions[] => {\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.NewShader,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: createNewShader,\n\t\t\t},\n\t\t]\n\t}, [isViewOnly])\n\n\tif (shaderModules.length === 0 && searchQuery) return null\n\n\treturn (\n\t\t<div style={{ [FOLDER_COLOR]: palette.purple100 }}>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={shaderFolder.id}\n\t\t\t\ttitle={shaderFolder.title}\n\t\t\t\tdepth={0}\n\t\t\t\tIcon={<IconEntityFolder className={assetStyles.icon} />}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible\n\t\t\t\tisCollapsed={!shadersExpanded}\n\t\t\t\ttoggleCollapse={engine.stores.chromeStore.toggleShaders}\n\t\t\t\tisEditable={false}\n\t\t\t\ttitleCanTriggerCollapse\n\t\t\t\tgetMenuOptions={getFolderMenuOptions}\n\t\t\t/>\n\t\t\t{shadersExpanded &&\n\t\t\t\tshaderModules.map(shader => (\n\t\t\t\t\t<ShaderAssetItemRow\n\t\t\t\t\t\tkey={shader.localId}\n\t\t\t\t\t\tlocalId={shader.localId}\n\t\t\t\t\t\tname={shader.name}\n\t\t\t\t\t\tpath={shader.path}\n\t\t\t\t\t\tcanRename={shader.canRename}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tdepth={1}\n\t\t\t\t\t\tisSelected={selectedItemIds?.has(shader.localId)}\n\t\t\t\t\t\tonSelectItem={onSelectItem}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t</div>\n\t)\n})\n\ninterface ShaderAssetItemRowProps {\n\tlocalId: LocalModuleId\n\tname: string\n\tpath: string\n\tisViewOnly: boolean\n\tcanRename: boolean\n\tdepth: number\n\tisSelected?: boolean\n\tonSelectItem?: (id: NodeID) => void\n}\n\nconst ShaderAssetItemRow = memo(function ShaderAssetItemRow({\n\tlocalId,\n\tname,\n\tpath,\n\tisViewOnly,\n\tcanRename,\n\tdepth,\n\tisSelected,\n\tonSelectItem,\n}: ShaderAssetItemRowProps) {\n\tconst inputId = `shader-${localId}`\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst handleSelect = useCallback(() => {\n\t\tonSelectItem?.(localId)\n\t}, [localId, onSelectItem])\n\n\tconst handleTitleChange = useCallback(\n\t\tasync (_id: NodeID, newTitle: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\n\t\t\tconst newName = newTitle.trim()\n\t\t\tif (!newName) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Compare after normalizing extension to avoid renaming \"Foo.ts\" to \"Foo_1.ts\" when user edits to \"Foo\"\n\t\t\tconst nameWithCorrectExtension = splitExtension(newName)[0] + tsExtension\n\t\t\tconst currentFileName = getNameFromPath(path)\n\t\t\tif (nameWithCorrectExtension === currentFileName) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait renameShaderModule(engine.stores.modulesStore, localId, nameWithCorrectExtension)\n\t\t\t} catch {\n\t\t\t\treset()\n\t\t\t}\n\t\t},\n\t\t[localId, path],\n\t)\n\n\tconst handleDuplicate = useCallback(async () => {\n\t\ttry {\n\t\t\tawait duplicateShaderModule(engine.stores.modulesStore, localId)\n\t\t} catch (error) {\n\t\t\tlog.reportError(error)\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Failed to duplicate\",\n\t\t\t\tsecondaryText: \"shader module.\",\n\t\t\t\tkey: `shader-module-duplicate-error`,\n\t\t\t})\n\t\t}\n\t}, [localId])\n\n\tconst handleDelete = useCallback(async () => {\n\t\tif (isShaderModuleInUse(localId)) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Shader module\",\n\t\t\t\tsecondaryText: \"is currently in use.\",\n\t\t\t\tkey: `shader-module-in-use`,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tawait deleteShaderModule(engine.stores.modulesStore, localId)\n\t\t} catch (error) {\n\t\t\tlog.reportError(error)\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"Failed to delete\",\n\t\t\t\tsecondaryText: \"shader module.\",\n\t\t\t\tkey: `shader-module-delete-error`,\n\t\t\t})\n\t\t}\n\t}, [localId])\n\n\tconst getMenuOptions = useCallback((): MenuItemOptions[] => {\n\t\tconst canDelete = !isShaderModuleInUse(localId)\n\t\tconst canInsert = !isViewOnly\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Insert,\n\t\t\t\tenabled: canInsert,\n\t\t\t\tclick: () => insertShaderNode(engine, localId),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Rename,\n\t\t\t\tenabled: !isViewOnly && canRename,\n\t\t\t\tclick: () => editPanelTitle(inputId),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t\tclick: handleDuplicate,\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled: !isViewOnly && canDelete,\n\t\t\t\tclick: handleDelete,\n\t\t\t},\n\t\t]\n\t}, [isViewOnly, canRename, localId, inputId, handleDelete, handleDuplicate])\n\n\tconst handleDragStart = useCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\tevent.dataTransfer.setData(\n\t\t\t\tDraggableComponentDataType,\n\t\t\t\tdataForShaderModuleIdentifier(localModuleIdentifier(localId, \"default\").value),\n\t\t\t)\n\t\t},\n\t\t[localId],\n\t)\n\n\treturn (\n\t\t<div className={cx(isSelected && selectedSibling)}>\n\t\t\t<HandleClickOnClick>\n\t\t\t\t<Draggable hideDragSource={false} onDragStart={handleDragStart} autoScrollEnabled={false}>\n\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\tid={localId}\n\t\t\t\t\t\tdepth={depth}\n\t\t\t\t\t\ttitle={name}\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? <IconAgentLayerShader /> : <IconLayerShader />}\n\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\twithCollapse\n\t\t\t\t\t\tisCollapsible={false}\n\t\t\t\t\t\tisEditable={!isViewOnly && canRename}\n\t\t\t\t\t\tinputId={inputId}\n\t\t\t\t\t\tonTitleChange={handleTitleChange}\n\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t/>\n\t\t\t\t</Draggable>\n\t\t\t</HandleClickOnClick>\n\t\t</div>\n\t)\n})\n\nfunction dataForShaderModuleIdentifier(moduleIdentifier: ModuleExportIdentifierString): DraggableComponentData {\n\tconst component = new ShaderNode({\n\t\tshaderModuleIdentifier: moduleIdentifier,\n\t\twidth: 400,\n\t\theight: 300,\n\t})\n\n\treturn {\n\t\tcomponent,\n\t\tsource: \"component_panel\",\n\t\ttype: \"component\",\n\t}\n}\n\nasync function createNewShader() {\n\tconst { name, content } = createShaderFile(\"NewShader\")\n\tconst entry = await createShaderModule(engine.stores.modulesStore, name, content)\n\n\tif (!engine.stores.chromeStore.shadersExpanded) {\n\t\tengine.stores.chromeStore.toggleShaders()\n\t}\n\n\tengine.stores.codeEditorStore.editFile(entry.name)\n}\n\nfunction insertShaderNode(engine: VekterEngine, localId: LocalModuleId) {\n\tconst entry = engine.stores.modulesStore.getModuleEntryByLocalId(localId)\n\tif (!entry) {\n\t\tlog.error(localId, \"not found\")\n\t\treturn\n\t}\n\n\tconst moduleIdentifier = localModuleIdentifier(localId, \"default\").value\n\tconst shaderNode = new ShaderNode({\n\t\tshaderModuleIdentifier: moduleIdentifier,\n\t\twidth: 400,\n\t\theight: 300,\n\t})\n\tinsertCanvasNode({ vekterEngine: engine, component: shaderNode })\n}\n\nfunction isShaderModuleInUse(localId: LocalModuleId): boolean {\n\tconst entry = engine.stores.modulesStore.getModuleEntryByLocalId(localId)\n\tif (entry) {\n\t\tconst dependents = engine.stores.modulesStore.getDependentsOfModule(entry.name)\n\t\tif (dependents && dependents.size > 0) {\n\t\t\tlog.debug(entry.name, \"is in use by\", dependents)\n\t\t\treturn true\n\t\t}\n\t}\n\n\tfor (const node of engine.stores.treeStore.getPartialIndexes().shaderNodes) {\n\t\tconst parsed = parseModuleIdentifier(node.shaderModuleIdentifier)\n\t\tif (!isLocalModuleIdentifier(parsed) || parsed.localId !== localId) continue\n\n\t\tlog.debug(localId, \"is in use by shader node\", node.id)\n\t\treturn true\n\t}\n\n\treturn false\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EntityTypeRootId } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isEntityFolderNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport type { ContextMenuOptions } from \"../../properties/utils/presetRowProps.ts\"\nimport { deleteEntityFolderNode } from \"../actions/delete.ts\"\nimport { canDeleteEntityFolderNode } from \"./canDeleteEntityFolderNode.ts\"\nimport { getModulesMap } from \"./getExportedModulesMap.ts\"\nimport { getAssetSectionForTracking, hasAnyFolders } from \"./multiselect.ts\"\n\ninterface MultiSelectAction {\n\t/** Handler function that performs the action */\n\thandler: (nodeIds: ReadonlySet<NodeID>) => void | Promise<void>\n\t/** Custom validation function to determine if action should be enabled for the current selection */\n\tcustomEnabledCheck?: (nodeIds: ReadonlySet<NodeID>) => boolean\n\t/** Whether folders should disable this action */\n\tdisabledByFolders?: boolean\n}\n\ninterface MultiSelectConfig {\n\ttypeRootId: EntityTypeRootId\n\tnewFolder?: MultiSelectAction\n\tinsert?: MultiSelectAction\n\tduplicate?: MultiSelectAction\n\tdelete?: MultiSelectAction\n}\n\n/**\n * Checks if all folders in the selection can be deleted\n */\nfunction canDeleteAllFolders(folders: CanvasNode[]): boolean {\n\tconst modulesMap = getModulesMap(engine.componentLoader)\n\n\tfor (const folder of folders) {\n\t\tif (!isEntityFolderNode(folder)) continue\n\n\t\tconst modules = modulesMap?.get(folder.id)\n\t\tif (!canDeleteEntityFolderNode(folder, engine, modules)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n/**\n * Wraps a delete handler to automatically show folder confirmation modal when folders are detected\n */\nfunction wrapDeleteHandlerWithFolderConfirmation(handler: (nodeIds: ReadonlySet<NodeID>) => void | Promise<void>) {\n\treturn async (nodeIds: ReadonlySet<NodeID>) => {\n\t\tconst hasDataTree = Boolean(engine.stores.treeStore.getDataTree())\n\n\t\t// Collect folders that need confirmation\n\t\tconst foldersNeedingConfirmation: CanvasNode[] = []\n\t\t// Collect other nodes that the original handler will handle\n\t\tconst otherNodes: NodeID[] = []\n\n\t\tfor (const nodeId of nodeIds) {\n\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\tif (!node) continue\n\n\t\t\tif (isEntityFolderNode(node) && node.children.length > 0) {\n\t\t\t\tfoldersNeedingConfirmation.push(node)\n\t\t\t} else {\n\t\t\t\totherNodes.push(nodeId)\n\t\t\t}\n\t\t}\n\n\t\t// If we have folders needing confirmation, show modal first\n\t\tif (foldersNeedingConfirmation.length > 0) {\n\t\t\tconst folderPaths = foldersNeedingConfirmation.map(node => node.resolveValue(\"name\") ?? Dictionary.Unknown)\n\n\t\t\t// Use single folder modal for one folder, multiple folder modal for more than one\n\t\t\tif (foldersNeedingConfirmation.length === 1) {\n\t\t\t\tconst folderNode = foldersNeedingConfirmation[0]\n\t\t\t\tif (!folderNode) return\n\n\t\t\t\tconst promptDeleteSingleFolder = () => {\n\t\t\t\t\tconst canDeleteFolder = canDeleteAllFolders(foldersNeedingConfirmation)\n\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.DeleteEntityFolder,\n\t\t\t\t\t\tsource: \"assets_panel\",\n\t\t\t\t\t\tpath: folderPaths[0] || Dictionary.Unknown,\n\t\t\t\t\t\tonConfirm: async () => {\n\t\t\t\t\t\t\tif (!isEntityFolderNode(folderNode)) return\n\n\t\t\t\t\t\t\tawait deleteEntityFolderNode(engine, folderNode)\n\t\t\t\t\t\t\tengine.stores.modalStore.dismiss()\n\n\t\t\t\t\t\t\tif (otherNodes.length === 0) return\n\n\t\t\t\t\t\t\tif (hasDataTree) {\n\t\t\t\t\t\t\t\tawait handler(new Set(otherNodes))\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\tengine.runWithFullyLoadedTree(() => handler(new Set(otherNodes)), {\n\t\t\t\t\t\t\t\tname: \"deleteRemainingNodesAfterFolder\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcanDeleteFolder,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif (!hasDataTree) {\n\t\t\t\t\tawait engine.scheduler.runWithFullyLoadedTreeAsync({ name: \"deleteEntityFolder\" })\n\t\t\t\t}\n\n\t\t\t\tpromptDeleteSingleFolder()\n\t\t\t} else {\n\t\t\t\tconst promptDeleteMultipleFolders = () => {\n\t\t\t\t\tconst canDeleteAll = canDeleteAllFolders(foldersNeedingConfirmation)\n\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.DeleteMultipleEntityFolders,\n\t\t\t\t\t\tsource: \"assets_panel\",\n\t\t\t\t\t\tpaths: folderPaths,\n\t\t\t\t\t\tonConfirm: async () => {\n\t\t\t\t\t\t\tfor (const folderNode of foldersNeedingConfirmation) {\n\t\t\t\t\t\t\t\tawait deleteEntityFolderNode(engine, folderNode)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tengine.stores.modalStore.dismiss()\n\n\t\t\t\t\t\t\tif (otherNodes.length === 0) return\n\n\t\t\t\t\t\t\tif (hasDataTree) {\n\t\t\t\t\t\t\t\tawait handler(new Set(otherNodes))\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\tengine.runWithFullyLoadedTree(() => handler(new Set(otherNodes)), {\n\t\t\t\t\t\t\t\tname: \"deleteRemainingNodesAfterMultipleFolders\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcanDeleteAll,\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tif (hasDataTree) {\n\t\t\t\t\tpromptDeleteMultipleFolders()\n\t\t\t\t} else {\n\t\t\t\t\tawait engine.scheduler.runWithFullyLoadedTreeAsync({ name: \"deleteMultipleEntityFolders\" })\n\t\t\t\t\tpromptDeleteMultipleFolders()\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// No folders needing confirmation, just run original handler\n\t\t\tawait handler(nodeIds)\n\t\t}\n\t}\n}\n\n/**\n * Creates a multi-select context menu function with consistent behavior across asset sections.\n */\nexport function createMultiSelectContextMenu(config: MultiSelectConfig) {\n\treturn function multiSelectContextMenu(selectedIds: ReadonlySet<NodeID>) {\n\t\treturn (_id: NodeID, _options: ContextMenuOptions) => {\n\t\t\tif (selectedIds.size <= 1) return []\n\n\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\t\t\tconst hasFolders = hasAnyFolders(selectedIds)\n\n\t\t\tconst menuItems: MenuItemOptions[] = []\n\n\t\t\tif (config.newFolder) {\n\t\t\t\tconst newFolderDisabledByFolders = config.newFolder.disabledByFolders !== false && hasFolders\n\t\t\t\tconst newFolderCustomCheck = config.newFolder.customEnabledCheck?.(selectedIds) ?? true\n\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\t\tenabled: !isViewOnly && !newFolderDisabledByFolders && newFolderCustomCheck,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tvoid config.newFolder?.handler(selectedIds)\n\t\t\t\t\t\trecord(\"asset_bulk_folder_create\", {\n\t\t\t\t\t\t\tsource: getAssetSectionForTracking(config.typeRootId),\n\t\t\t\t\t\t\tcount: selectedIds.size,\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\tif (config.insert) {\n\t\t\t\tconst insertDisabledByFolders = config.insert.disabledByFolders !== false && hasFolders\n\t\t\t\tconst insertCustomCheck = config.insert.customEnabledCheck?.(selectedIds) ?? true\n\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: Dictionary.Insert,\n\t\t\t\t\tenabled: !isViewOnly && !insertDisabledByFolders && insertCustomCheck,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tvoid config.insert?.handler(selectedIds)\n\t\t\t\t\t\trecord(\"asset_bulk_move_section\", {\n\t\t\t\t\t\t\tsource: getAssetSectionForTracking(config.typeRootId),\n\t\t\t\t\t\t\tcount: selectedIds.size,\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\tif (config.duplicate) {\n\t\t\t\tconst duplicateDisabledByFolders = config.duplicate.disabledByFolders !== false && hasFolders\n\t\t\t\tconst duplicateCustomCheck = config.duplicate.customEnabledCheck?.(selectedIds) ?? true\n\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tenabled: !isViewOnly && !duplicateDisabledByFolders && duplicateCustomCheck,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tvoid config.duplicate?.handler(selectedIds)\n\t\t\t\t\t\trecord(\"asset_bulk_duplicate\", {\n\t\t\t\t\t\t\tsource: getAssetSectionForTracking(config.typeRootId),\n\t\t\t\t\t\t\tcount: selectedIds.size,\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\tif (config.delete) {\n\t\t\t\tconst deleteDisabledByFolders = config.delete.disabledByFolders !== false && hasFolders\n\t\t\t\tconst deleteCustomCheck = config.delete.customEnabledCheck?.(selectedIds) ?? true\n\n\t\t\t\t// Wrapped delete handler to automatically handle folder confirmations\n\t\t\t\tconst wrappedHandler = wrapDeleteHandlerWithFolderConfirmation(config.delete.handler)\n\n\t\t\t\tmenuItems.push({\n\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\tenabled: !isViewOnly && !deleteDisabledByFolders && deleteCustomCheck,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tvoid wrappedHandler(selectedIds)\n\t\t\t\t\t\trecord(\"asset_bulk_delete\", {\n\t\t\t\t\t\t\tsource: getAssetSectionForTracking(config.typeRootId),\n\t\t\t\t\t\t\tcount: selectedIds.size,\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\treturn menuItems\n\t\t}\n\t}\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { CreateContextMenuItemsHandler } from \"../types.ts\"\n\n/**\n * Helper used to resolve the correct context menu item creation handler depending on the selection state.\n */\nexport function resolveContextMenuHandler(\n\tselectedIds: ReadonlySet<NodeID>,\n\tsingleItemHandler: CreateContextMenuItemsHandler,\n\tmultiSelectHandler: CreateContextMenuItemsHandler,\n): CreateContextMenuItemsHandler {\n\tif (selectedIds.size <= 1) return singleItemHandler\n\n\treturn (id, options) => {\n\t\tif (selectedIds.has(id)) {\n\t\t\treturn multiSelectHandler(id, options)\n\t\t}\n\t\treturn singleItemHandler(id, options)\n\t}\n}\n", "import { palette } from \"@framerjs/fresco/src/tokens\"\nimport {\n\ttype LocalModuleId,\n\ttype LocalModuleIdentifierString,\n\tModuleType,\n\tasLocalId,\n\tisLocalModuleIdentifier,\n\tlocalModuleIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { cloneScopeNodeWithVariants } from \"document/components/unlinking/importExternalSmartComponentOrWebpage.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tComponentEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { LocalModulesListNode, isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { duplicateEntityReferenceNode } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isEntityFolderNode, isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\n\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { createComponentRowMenuContext, insertComponentNode } from \"../properties/utils/getComponentRowProps.ts\"\nimport type { ContextMenuOptions } from \"../properties/utils/presetRowProps.ts\"\nimport { isMultiSelectModifierKeyPressed } from \"../shared/utils/panelMultiSelect.ts\"\nimport { EntityRow } from \"./EntityRow.tsx\"\nimport * as styles from \"./EntitySection.styles.ts\"\nimport type { EntitySectionProps } from \"./EntitySection.ts\"\nimport { ExternalComponents, useExternalModules } from \"./ExternalComponents.tsx\"\nimport { createAndRenameFolderNode, createEntityReferenceNodeForRootType } from \"./actions/create.ts\"\nimport { deleteEntityFolderNode, deleteLocalComponentScopeNode } from \"./actions/delete.ts\"\nimport { sortEntityAssetsAlphabetically } from \"./actions/sort.ts\"\nimport { createMultiSelectContextMenu } from \"./utils/createMultiSelectContextMenu.ts\"\nimport { expandAssetEntityItemsFromNode } from \"./utils/expandAssetEntityItems.ts\"\nimport { getModulesMap } from \"./utils/getExportedModulesMap.ts\"\nimport { getNodeName } from \"./utils/getNodeName.ts\"\nimport { createFolderFromSelection, createRenderOrderedGetter } from \"./utils/multiselect.ts\"\nimport { resolveContextMenuHandler } from \"./utils/resolveContextMenuHandler.ts\"\nimport {\n\ttype AssetRow,\n\ttype AssetRowContext,\n\tgetAssetRows,\n\tuseAssetPanelEntityRows,\n} from \"./utils/useAssetPanelEntityRows.ts\"\n\nexport const EntityComponentsAssetSection = React.memo(function EntityComponentsAssetSection({\n\tisViewOnly,\n\tselectedItemIds,\n\texpandedAssetEntityIds,\n\tonSelectItem,\n\tonClearSelection,\n\tsearchQuery,\n\tlastSelectionTypeRootId,\n}: EntitySectionProps) {\n\tconst componentsExpanded = engine.stores.chromeStore.useState(state => state.componentsExpanded)\n\tconst shaderModulesEnabled = useExperimentIsOn(\"shaders\")\n\tconst externalModules = useExternalModules(searchQuery, shaderModulesEnabled)\n\tconst hasExternalModules = externalModules.length > 0\n\n\tconst [state, toggleCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\tinitialCtx => {\n\t\t\t\tconst modules = getModulesMap(engine.componentLoader)\n\t\t\t\tconst entityRootNode = ComponentEntityTypeRootNode.get(engine.tree)\n\t\t\t\tconst localModuleNodes = LocalModulesListNode.getModuleNodes(engine.tree)\n\n\t\t\t\tif (!entityRootNode) return null\n\n\t\t\t\tconst unreferenced: AssetRow[] = []\n\n\t\t\t\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\t\t\t\tconst allowList = new Set<NodeID>()\n\n\t\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\t\tif (!isSmartComponentNode(node)) continue\n\n\t\t\t\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\t\t\t\tallowList.add(node.id)\n\t\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\t\tif (!rootMatchesSearch && !matchSubstring(searchQuery, node.resolveValue(\"name\"))) continue\n\n\t\t\t\t\tunreferenced.push({\n\t\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\t\tid: node.id,\n\t\t\t\t\t\t// If there are any local unreferenced components they will be nested inside\n\t\t\t\t\t\t// the Project folder.\n\t\t\t\t\t\tdepth: 1,\n\t\t\t\t\t\ttitle: getNodeName(node),\n\t\t\t\t\t\tmodules: modules?.get(asLocalId(node.id)),\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tconst ctx: AssetRowContext = {\n\t\t\t\t\t...initialCtx,\n\t\t\t\t\tmodulesByLocalId: modules,\n\t\t\t\t\tallowList,\n\t\t\t\t\tcreateMagicFolders: true,\n\t\t\t\t}\n\n\t\t\t\tfor (const node of localModuleNodes) {\n\t\t\t\t\tif (node.save.type !== ModuleType.Code) continue\n\n\t\t\t\t\tconst nodeModule = modules?.get(asLocalId(node.id))\n\t\t\t\t\tif (isUndefined(nodeModule)) continue\n\n\t\t\t\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\t\t\t\tallowList.add(node.id)\n\t\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\t\t// Use `getAssetRows` instead of pushing an object to create magic folders.\n\t\t\t\t\tconst rows = getAssetRows(node, 1, rootMatchesSearch, ctx)\n\t\t\t\t\tunreferenced.push(...rows)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tentityRootNode,\n\t\t\t\t\tunreferenced,\n\t\t\t\t\tallowList,\n\t\t\t\t\tmodulesByLocalId: modules,\n\t\t\t\t\tcreateMagicFolders: ctx.createMagicFolders,\n\t\t\t\t\tincludeRoot: true,\n\t\t\t\t\tskipEmptyRoot: true,\n\t\t\t\t\ttree: engine.tree,\n\t\t\t\t}\n\t\t\t},\n\t\t\t[searchQuery],\n\t\t),\n\t\t[EngineChange.ActiveBundle],\n\t)\n\n\tconst handleSelectItem = useEngineCallback(\n\t\t(value: NodeID | LocalModuleIdentifierString) => {\n\t\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return\n\n\t\t\tlet node = engine.tree.getNode(value)\n\n\t\t\tif (!node) {\n\t\t\t\tconst parsed = parseModuleIdentifier(value)\n\t\t\t\tif (!isLocalModuleIdentifier(parsed)) return\n\t\t\t\tnode = engine.tree.getNodeWithTrait(parsed.localId, isLocalModuleNode)\n\t\t\t}\n\n\t\t\tif (!isMultiSelectModifierKeyPressed()) {\n\t\t\t\t// TODO: Check how it would work with the magic folder for exported components in same file\n\t\t\t\tif (\n\t\t\t\t\tisLocalModuleNode(node) &&\n\t\t\t\t\t(node.save.type === ModuleType.Code || node.save.type === ModuleType.Shader) &&\n\t\t\t\t\tnode.save.name\n\t\t\t\t) {\n\t\t\t\t\tengine.stores.codeEditorStore.editFile(node.save.name)\n\t\t\t\t} else if (isSmartComponentNode(node)) {\n\t\t\t\t\tengine.stores.scopeStore.select(node.id, { keepHistory: false })\n\t\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tonSelectItem(value, COMPONENTS_ENTITY_TYPE_ROOT_ID, state.rows)\n\t\t},\n\t\t[onSelectItem, state.rows],\n\t)\n\n\tconst getOrderedIds = useMemo(() => createRenderOrderedGetter(state.rows), [state.rows])\n\n\tconst hasItems = state.rows.length > 0\n\n\tconst createContextMenu = useCreateContextMenu(hasItems)\n\n\tconst multipleComponentContextMenuItems = useMemo(() => {\n\t\treturn createMultipleComponentContextMenuItems(onClearSelection)(selectedItemIds)\n\t}, [onClearSelection, selectedItemIds])\n\n\tconst contextMenuHandler = useMemo(\n\t\t() => resolveContextMenuHandler(selectedItemIds, createComponentItemContextMenu, multipleComponentContextMenuItems),\n\t\t[selectedItemIds, multipleComponentContextMenuItems],\n\t)\n\n\tif (searchQuery && !hasItems && !hasExternalModules) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle=\"Components\"\n\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleComponents}\n\t\t\t\tonRightClick={createContextMenu}\n\t\t\t\tinTabbedPanel\n\t\t\t\thasItems={hasItems}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\ttitle=\"Add Component\"\n\t\t\t\t\t\texpanded={componentsExpanded}\n\t\t\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\n\t\t\t{componentsExpanded && (hasItems || hasExternalModules) && (\n\t\t\t\t<div className={styles.sectionContent}>\n\t\t\t\t\t{state.rows.map(row => (\n\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\ttypeRootId={COMPONENTS_ENTITY_TYPE_ROOT_ID}\n\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\tcolor={palette.purple100}\n\t\t\t\t\t\t\tonToggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t\thasUnreferencedItems={state.hasUnreferencedItems}\n\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandler}\n\t\t\t\t\t\t\tisCodeFileFolder={row.isCodeFileFolder}\n\t\t\t\t\t\t\tmodules={row.modules}\n\t\t\t\t\t\t\tisSortable={row.isSortable}\n\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\tgetOrderedIds={getOrderedIds}\n\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\tdisableRename={row.isCodeFileFolder || row.isCodeFileAsset}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t\t<ExternalComponents externalModules={externalModules} isViewOnly={isViewOnly} searchQuery={searchQuery} />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nfunction createMultipleComponentContextMenuItems(onClearSelection: () => void) {\n\treturn createMultiSelectContextMenu({\n\t\ttypeRootId: COMPONENTS_ENTITY_TYPE_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, COMPONENTS_ENTITY_TYPE_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tinsert: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly || engine.stores.codeEditorStore.currentCodeFileId) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tconst identifier = getComponentIdentifier(node)\n\t\t\t\t\tif (identifier) {\n\t\t\t\t\t\tinsertComponentNode(identifier)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tcustomEnabledCheck: () => !engine.stores.codeEditorStore.currentCodeFileId,\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: async (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isSmartComponentNode(node)) continue\n\n\t\t\t\t\tconst loadedComponent = await node.load()\n\t\t\t\t\tif (!loadedComponent) return\n\n\t\t\t\t\tconst variant = engine.tree.getNode(node.baseVariantId)\n\t\t\t\t\tif (!variant || !isPrimaryVariant(variant)) return\n\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tconst newNode = cloneScopeNodeWithVariants(engine, loadedComponent, variant, \"duplicate\", {\n\t\t\t\t\t\t\tintrinsicSize: engine.tree.getRect(variant),\n\t\t\t\t\t\t\tenterIsolation: false,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tduplicateEntityReferenceNode(engine, loadedComponent.id, newNode.id)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\tcustomEnabledCheck: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (node && isLocalModuleNode(node) && node.save.type === ModuleType.Code) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isSmartComponentNode(node) || (isLocalModuleNode(node) && node.save.type === ModuleType.Code)) {\n\t\t\t\t\t\tvoid deleteLocalComponentScopeNode(engine, nodeId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tcustomEnabledCheck: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (node && isLocalModuleNode(node) && node.save.type === ModuleType.Code) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n}\n\nfunction getComponentIdentifier(node: CanvasNode | null): string | null {\n\tif (!node) return null\n\n\tif (isSmartComponentNode(node)) {\n\t\treturn node.instanceIdentifier\n\t} else if (isLocalModuleNode(node) && node.save.type === ModuleType.Code) {\n\t\treturn localModuleIdentifier(node.id as LocalModuleId, \"default\").value\n\t}\n\treturn null\n}\n\nfunction createComponentItemContextMenu(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get(id)\n\tif (isNull(node)) return []\n\tif (!isSmartComponentNode(node) && !isLocalModuleNode(node)) return []\n\n\treturn createComponentRowMenuContext(node, options)\n}\n\nfunction contextMenu({ sortAlphabetically }: { sortAlphabetically: boolean }): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.NewComponent,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () =>\n\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\trootType: COMPONENTS_ENTITY_TYPE_ROOT_ID,\n\t\t\t\t\tonDone: (id: NodeID) => {\n\t\t\t\t\t\texpandAssetEntityItemsFromNode(engine, id, COMPONENTS_ENTITY_TYPE_ROOT_ID, false)\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.NewFolder,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => createAndRenameFolderNode(engine, COMPONENTS_ENTITY_TYPE_ROOT_ID, false),\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\tvisible: sortAlphabetically,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, COMPONENTS_ENTITY_TYPE_ROOT_ID),\n\t\t},\n\t]\n}\n\nfunction useCreateContextMenu(hasItems: boolean) {\n\treturn useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tengine.stores.contextMenuStore.show(contextMenu({ sortAlphabetically: hasItems }), {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: event.clientX,\n\t\t\t\t\ty: event.clientY,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[hasItems],\n\t)\n}\n", "import { isReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport {\n\ttype ExternalModuleExportIdentifierString,\n\ttype LocalModuleId,\n\tModuleType,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { cloneScopeNodeWithVariants } from \"document/components/unlinking/importExternalSmartComponentOrWebpage.ts\"\nimport { codeComponentFromDefinition } from \"document/components/utils/componentHelpers.ts\"\nimport { isFramerModule } from \"document/components/utils/defaultComponents.ts\"\nimport { editInfoForCodeComponentIdentifier } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport engine from \"document/engine.ts\"\nimport type { AnySmartComponentNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { type LocalModuleNode, isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport { duplicateEntityReferenceNode } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport {\n\tgetExternalModuleSourceProjectURL,\n\topenExternalModuleWithAccessCheck,\n} from \"document/models/CanvasTree/nodes/utils/externalModuleNodeHelpers.ts\"\nimport { isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { componentExportIdentifierStringForLocalModule } from \"modules/utils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport {\n\tcanDeleteLocalSmartComponentNode,\n\tcanRemoveExternalModuleNode,\n\tdeleteLocalComponentScopeNode,\n} from \"../../assets/actions/delete.ts\"\nimport { insertCanvasNode } from \"../../assets/actions/insertCanvasNode.ts\"\nimport { getModuleContextMenuItems } from \"../../shared/utils/getComponentContextMenuItems.ts\"\nimport type { ContextMenuOptions } from \"./presetRowProps.ts\"\n\nconst removeExternalModuleNode = (codeComponentIdentifier: ExternalModuleExportIdentifierString) => {\n\tif (!canRemoveExternalModuleNode(engine, codeComponentIdentifier)) return\n\n\tconst moduleIdentifier = parseModuleIdentifier(codeComponentIdentifier)\n\tif (!moduleIdentifier) return\n\tif (moduleIdentifier.kind !== \"externalModuleExport\") return\n\n\tengine.deleteNode(moduleIdentifier.moduleId)\n}\n\nexport function insertComponentNode(codeComponentIdentifier: string) {\n\tconst entityDefinition = engine.componentLoader.componentForIdentifier(codeComponentIdentifier)\n\tif (!entityDefinition || !isReactComponentDefinition(entityDefinition)) return\n\n\tconst component = codeComponentFromDefinition(entityDefinition)\n\n\tinsertCanvasNode({ vekterEngine: engine, component })\n}\n\nfunction insertShaderNode(shaderModuleIdentifier: ExternalModuleExportIdentifierString) {\n\tconst shaderNode = new ShaderNode({\n\t\tshaderModuleIdentifier,\n\t\twidth: 400,\n\t\theight: 300,\n\t})\n\n\tinsertCanvasNode({ vekterEngine: engine, component: shaderNode })\n}\n\nasync function duplicateSmartComponentNode(node: AnySmartComponentNode) {\n\tconst loadedComponent = await node.load()\n\tif (!loadedComponent) return\n\n\tconst variant = engine.tree.getNode(node.baseVariantId)\n\tif (!variant || !isPrimaryVariant(variant)) return\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst newNode = cloneScopeNodeWithVariants(engine, loadedComponent, variant, \"duplicate\", {\n\t\t\tintrinsicSize: engine.tree.getRect(variant),\n\t\t})\n\n\t\tduplicateEntityReferenceNode(engine, loadedComponent.id, newNode.id)\n\t})\n}\n\nexport function createComponentRowMenuContext(\n\tnode: AnySmartComponentNode | LocalModuleNode,\n\toptions: ContextMenuOptions,\n): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tconst isSmartComponent = !isLocalModuleNode(node) && isSmartComponentNode(node)\n\n\t// TODO: LocalModuleNode id could be of type LocalModuleId.\n\tconst codeComponentIdentifier = isSmartComponent\n\t\t? node.instanceIdentifier\n\t\t: componentExportIdentifierStringForLocalModule(\n\t\t\t\tengine.componentLoader,\n\t\t\t\tengine.stores.modulesStore,\n\t\t\t\tnode.id as LocalModuleId,\n\t\t\t)\n\n\tconst moduleContextMenuItems = getModuleContextMenuItems({\n\t\tcomponentIdentifier: codeComponentIdentifier,\n\t\tteamLibrary: engine.stores.libraryStore.teamLibrary,\n\t\tisViewOnly,\n\t\tsource: \"components_panel\",\n\t})\n\n\tconst deleteEnabled = isViewOnly ? false : () => canDeleteLocalSmartComponentNode(engine, codeComponentIdentifier)\n\n\tconst menuItems: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: Dictionary.Insert,\n\t\t\tenabled:\n\t\t\t\t!isViewOnly &&\n\t\t\t\tnode.id !== engine.stores.scopeStore.active.id &&\n\t\t\t\t!engine.stores.codeEditorStore.currentCodeFileId,\n\t\t\tclick: () => insertComponentNode(codeComponentIdentifier),\n\t\t},\n\t\t...editInfoForCodeComponentIdentifier(codeComponentIdentifier, engine, {\n\t\t\tkeepHistory: false,\n\t\t\tincludeAccelerator: false,\n\t\t}),\n\t\t{\n\t\t\tlabel: Dictionary.Find,\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\tsource: \"components_panel\",\n\t\t\t\t\tinitialCategory: {\n\t\t\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttype: FindNodesType.CodeComponent,\n\t\t\t\t\t\t\ttitle: (isLocalModuleNode(node) ? node.save.name : node.resolveValue(\"name\")) ?? Dictionary.Unknown,\n\t\t\t\t\t\t\tcomponentIdentifier: codeComponentIdentifier,\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\t{\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tvisible: isSmartComponent,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: options.startRenaming,\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tvisible: isSmartComponent,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => isSmartComponent && duplicateSmartComponentNode(node),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tvisible: isSmartComponent,\n\t\t\tenabled: deleteEnabled,\n\t\t\tclick: () => isSmartComponent && deleteLocalComponentScopeNode(engine, node.id),\n\t\t},\n\t]\n\n\tif (moduleContextMenuItems.length > 0) {\n\t\tmenuItems.push({ type: \"separator\" })\n\t\tmenuItems.push(...moduleContextMenuItems)\n\t}\n\n\treturn menuItems\n}\n\nexport async function createExternalComponentRowMenuContext(\n\tid: NodeID,\n\texportIdentifier: ExternalModuleExportIdentifierString,\n\tname: string,\n\tlocalId: LocalModuleId | undefined,\n) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tconst node = engine.tree.getNode<ExternalModuleNode>(id)\n\tif (isNull(node)) return []\n\tconst isShader = node.type === ModuleType.Shader\n\n\tconst items: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: Dictionary.Insert,\n\t\t\tenabled: !isViewOnly && !engine.stores.codeEditorStore.currentCodeFileId,\n\t\t\tclick: () => (isShader ? insertShaderNode(exportIdentifier) : insertComponentNode(exportIdentifier)),\n\t\t},\n\t\t...editInfoForCodeComponentIdentifier(exportIdentifier, engine, {\n\t\t\tkeepHistory: false,\n\t\t\texternalModuleType: node.type,\n\t\t\tincludeAccelerator: false,\n\t\t}),\n\t]\n\n\tif (!isShader) {\n\t\titems.push({\n\t\t\tlabel: Dictionary.Find,\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\tsource: \"components_panel\",\n\t\t\t\t\tinitialCategory: {\n\t\t\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttype: FindNodesType.CodeComponent,\n\t\t\t\t\t\t\ttitle: name,\n\t\t\t\t\t\t\tcomponentIdentifier: exportIdentifier,\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\tconst canDelete = canRemoveExternalModuleNode(engine, exportIdentifier)\n\n\titems.push({\n\t\tlabel: Dictionary.Delete,\n\t\tenabled: !isViewOnly && canDelete,\n\t\tclick: () => removeExternalModuleNode(exportIdentifier),\n\t})\n\n\tconst canAccessPrimary =\n\t\t!isFramerModule(engine.tree, exportIdentifier) || employeesOnlySettings.isOn(\"openPrimaryForBuiltInModules\")\n\tconst canOpenPrimary = Boolean(!isViewOnly && node.ownerType === \"project\" && node.ownerId && canAccessPrimary)\n\n\tif (canOpenPrimary && (isShader || localId)) {\n\t\titems.push(\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.OpenPrimary,\n\t\t\t\tclick: async () => {\n\t\t\t\t\tconst sourceProjectURL = getExternalModuleSourceProjectURL(node, localId)\n\t\t\t\t\tif (!sourceProjectURL) return\n\n\t\t\t\t\t// we check ownerType === \"project\" before getting here\n\t\t\t\t\tconst projectId = node.ownerId\n\t\t\t\t\tif (!projectId) return\n\n\t\t\t\t\trecord(\"open_primary_component_start\", {})\n\n\t\t\t\t\tawait openExternalModuleWithAccessCheck(sourceProjectURL, projectId)\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t}\n\n\tconst moduleMenuItems = await getModuleContextMenuItems({\n\t\tcomponentIdentifier: exportIdentifier,\n\t\tisViewOnly,\n\t\tteamLibrary: engine.stores.libraryStore.teamLibrary,\n\t\tsource: \"components_panel\",\n\t})\n\n\tif (moduleMenuItems.length > 0) {\n\t\titems.push({ type: \"separator\" })\n\t\titems.push(...moduleMenuItems)\n\t}\n\n\treturn items\n}\n", "import { splitExtension } from \"@framerjs/assets\"\nimport { Badge, IconEntityFolder, IconLayerComponent } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, palette } from \"@framerjs/fresco/tokens\"\nimport {\n\ttype ExternalModuleExportIdentifierString,\n\ttype LocalModuleId,\n\ttype ModuleExportIdentifierString,\n\tModuleType,\n\tasGlobalId,\n\tasLocalId,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport { parseIntrinsicSizeFromAnnotations } from \"code-generation/utils/annotations.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { type DraggableComponentData, DraggableComponentDataType } from \"document/components/canvas/CanvasDropZone.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype ExternalModuleNode,\n\tExternalModulesListNode,\n} from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport { isExternalModuleNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getNameFromPath } from \"document/utils/assetPath.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport { memo, useCallback, useMemo, useState } from \"react\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { IconAgentComponent } from \"../agentPanel/components/IconAgentComponent.tsx\"\nimport { createExternalComponentRowMenuContext } from \"../properties/utils/getComponentRowProps.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport * as assetStyles from \"./EntityAssetRow.styles.ts\"\nimport { FOLDER_COLOR } from \"./EntityAssetRow.styles.ts\"\nimport { ExternalAssetItemRow } from \"./ExternalAssetRow.tsx\"\nimport * as styles from \"./ExternalComponents.styles.ts\"\nimport { getExternalAssetFolderId } from \"./utils/externalModuleFolderUtils.ts\"\n\nconst DEFAULT_FOLDER_ID = \"Other\"\nconst DEFAULT_FOLDER_NAME = \"Other\"\nconst componentExternalModuleTypes = new Set<ModuleType>([ModuleType.Canvas, ModuleType.Code])\nconst componentAndShaderExternalModuleTypes = new Set<ModuleType>([\n\tModuleType.Canvas,\n\tModuleType.Code,\n\tModuleType.Shader,\n])\n\ninterface ExternalComponentFolder<TItem extends ExternalModuleFolderItem = ExternalModuleFolderItem> {\n\tid: string\n\tname: string\n\titems: TItem[]\n\tupdates: number\n\tmoduleType: ModuleType.Canvas | ModuleType.Code | ModuleType.Shader\n\tshouldAutoExpand?: boolean\n}\n\ninterface ExternalModuleFolderItemExtra {\n\treadonly [key: string]: unknown\n}\n\ntype ExternalModuleFolderItem<TExtra extends ExternalModuleFolderItemExtra = ExternalModuleFolderItemExtra> = {\n\tid: NodeID\n\texportIdentifier: ExternalModuleExportIdentifierString\n\tlocalId: LocalModuleId | undefined\n\tname: string\n\thasUpdate: boolean\n\titemModuleType: ModuleType\n} & TExtra\n\ninterface UseExternalModuleFoldersOptions<TExtra extends ExternalModuleFolderItemExtra> {\n\tsearchQuery: string\n\tmoduleTypes: ReadonlySet<ModuleType>\n\tgetItemExtra: (args: {\n\t\tnode: ExternalModuleNode\n\t\tlocalId: LocalModuleId | undefined\n\t}) => ({ name: string } & TExtra) | null\n}\n\nfunction useExternalModuleFolders<TExtra extends ExternalModuleFolderItemExtra>({\n\tsearchQuery,\n\tmoduleTypes,\n\tgetItemExtra,\n}: UseExternalModuleFoldersOptions<TExtra>): ExternalComponentFolder<ExternalModuleFolderItem<TExtra>>[] {\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst externalModulesDynamicInfo = engine.stores.modulesStore.externalModulesDynamicInfo\n\t\t\tconst externalModulesNodes = ExternalModulesListNode.getModuleNodes(engine.tree)\n\n\t\t\tconst externalModulesFoldersById: Map<\n\t\t\t\tstring,\n\t\t\t\tExternalComponentFolder<ExternalModuleFolderItem<TExtra>>\n\t\t\t> = new Map()\n\n\t\t\tfor (const node of externalModulesNodes) {\n\t\t\t\tconst nodeType = node.type\n\t\t\t\tif (!nodeType || !moduleTypes.has(nodeType as ModuleType)) continue\n\t\t\t\tconst moduleType = nodeType as ExternalComponentFolder[\"moduleType\"]\n\t\t\t\tif (!isExternalModuleIdentifier(node.codeComponentIdentifier)) continue\n\n\t\t\t\tconst dynamicLocalId = externalModulesDynamicInfo.get(asGlobalId(node.id))?.localId\n\t\t\t\tconst localId = dynamicLocalId ? asLocalId(dynamicLocalId) : undefined\n\t\t\t\tconst itemExtra = getItemExtra({ node, localId })\n\t\t\t\tif (!itemExtra) continue\n\n\t\t\t\tconst folderName = node.group?.name?.trim() ?? DEFAULT_FOLDER_NAME\n\t\t\t\tconst folderId = node.group?.id ?? DEFAULT_FOLDER_ID\n\n\t\t\t\tconst folderMatches = !searchQuery || matchSubstring(searchQuery, folderName)\n\t\t\t\tconst itemMatches = !searchQuery || matchSubstring(searchQuery, itemExtra.name)\n\t\t\t\tif (searchQuery && !folderMatches && !itemMatches) continue\n\n\t\t\t\tconst saveId = parseModuleIdentifier(node.codeComponentIdentifier).saveId\n\t\t\t\tconst hasUpdate = saveId !== node.updateSaveId\n\n\t\t\t\tlet existingFolder = externalModulesFoldersById.get(folderId)\n\t\t\t\tif (isUndefined(existingFolder)) {\n\t\t\t\t\tconst newFolder: ExternalComponentFolder<ExternalModuleFolderItem<TExtra>> = {\n\t\t\t\t\t\tid: folderId,\n\t\t\t\t\t\tname: folderName,\n\t\t\t\t\t\titems: [],\n\t\t\t\t\t\tupdates: 0,\n\t\t\t\t\t\tmoduleType,\n\t\t\t\t\t\tshouldAutoExpand: false,\n\t\t\t\t\t}\n\t\t\t\t\texternalModulesFoldersById.set(folderId, newFolder)\n\t\t\t\t\texistingFolder = newFolder\n\t\t\t\t}\n\n\t\t\t\tif (hasUpdate) existingFolder.updates++\n\n\t\t\t\tif (searchQuery && (folderMatches || itemMatches)) {\n\t\t\t\t\texistingFolder.shouldAutoExpand = true\n\t\t\t\t}\n\n\t\t\t\texistingFolder.items.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\texportIdentifier: node.codeComponentIdentifier,\n\t\t\t\t\tlocalId,\n\t\t\t\t\tname: itemExtra.name,\n\t\t\t\t\thasUpdate,\n\t\t\t\t\titemModuleType: nodeType as ModuleType,\n\t\t\t\t\t...(itemExtra as TExtra),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst externalModulesFolders = Array.from(externalModulesFoldersById.values())\n\t\t\texternalModulesFolders.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))\n\t\t\tfor (const folder of externalModulesFolders) {\n\t\t\t\tfolder.items.sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))\n\t\t\t}\n\n\t\t\treturn externalModulesFolders\n\t\t},\n\t\t[searchQuery, moduleTypes, getItemExtra],\n\t\tEngineChange.TreeStore,\n\t\t{ deepEqual: true },\n\t)\n}\n\ninterface ExternalComponentsProps {\n\texternalModules: ExternalComponentFolder[]\n\tisViewOnly: boolean\n\tsearchQuery: string\n}\n\nexport const useExternalModules = (searchQuery: string = \"\", includeShaders: boolean = false) => {\n\tconst moduleTypes = includeShaders ? componentAndShaderExternalModuleTypes : componentExternalModuleTypes\n\n\tconst getItemExtra = useCallback(\n\t\t({ node, localId }: { node: ExternalModuleNode; localId: LocalModuleId | undefined }) => {\n\t\t\tif (node.type === ModuleType.Shader) {\n\t\t\t\tif (!isExternalModuleIdentifier(node.codeComponentIdentifier)) return null\n\n\t\t\t\tconst parsed = parseModuleIdentifier(node.codeComponentIdentifier)\n\t\t\t\tconst localEntryPath = localId ? engine.stores.modulesStore.getModuleEntryByLocalId(localId)?.name : undefined\n\t\t\t\tconst path = localEntryPath ?? undefined\n\t\t\t\tconst fallbackFileName =\n\t\t\t\t\tisExternalModuleIdentifier(parsed) && isModuleExportIdentifier(parsed) ? parsed.file : undefined\n\t\t\t\tconst fallbackName = splitExtension(getNameFromPath(path ?? fallbackFileName ?? (node.title || \"default\")))[0]\n\n\t\t\t\treturn {\n\t\t\t\t\tname: getShaderDisplayName(node.codeComponentIdentifier, fallbackName),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn { name: node.title || \"\" }\n\t\t},\n\t\t[],\n\t)\n\n\treturn useExternalModuleFolders({\n\t\tsearchQuery,\n\t\tmoduleTypes,\n\t\tgetItemExtra,\n\t})\n}\n\nconst emptyCollapsedSet: ReadonlySet<NodeID> = new Set()\n\nexport const ExternalComponents = memo(function ExternalComponents({\n\texternalModules,\n\tisViewOnly,\n\tsearchQuery,\n}: ExternalComponentsProps) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst expandedAssetEntityIds = useEngineState(\n\t\t() => engine.stores.chromeStore.expandedAssetEntityIds(false),\n\t\t[],\n\t\t[engine.stores.chromeStore],\n\t)\n\n\tconst [collapsedDuringSearch, setCollapsedDuringSearch] = useState<ReadonlySet<NodeID>>(() => emptyCollapsedSet)\n\n\tif (!searchQuery && collapsedDuringSearch.size > 0) {\n\t\t// Setting state during a render instead of an effect, as recommended for such cases:\n\t\t// https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes\n\t\tsetCollapsedDuringSearch(emptyCollapsedSet)\n\t}\n\n\tconst handleToggleCollapse = useCallback(\n\t\t(id: NodeID, moduleType: ModuleType.Canvas | ModuleType.Code | ModuleType.Shader) => {\n\t\t\tif (searchQuery) {\n\t\t\t\tsetCollapsedDuringSearch(prev => {\n\t\t\t\t\tconst newSet = new Set(prev)\n\t\t\t\t\tif (newSet.has(id)) {\n\t\t\t\t\t\tnewSet.delete(id)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewSet.add(id)\n\t\t\t\t\t}\n\t\t\t\t\treturn newSet\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tengine.stores.chromeStore.toggleAssetEntityItem(getExternalAssetFolderId(id, moduleType), false)\n\t\t\t}\n\t\t},\n\t\t[searchQuery],\n\t)\n\n\tconst getFolderCollapseState = useCallback(\n\t\t(folder: ExternalComponentFolder) => {\n\t\t\tif (!searchQuery) {\n\t\t\t\treturn !expandedAssetEntityIds?.has(getExternalAssetFolderId(folder.id, folder.moduleType))\n\t\t\t}\n\n\t\t\tif (!folder.shouldAutoExpand) {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\treturn collapsedDuringSearch.has(folder.id)\n\t\t},\n\t\t[searchQuery, expandedAssetEntityIds, collapsedDuringSearch],\n\t)\n\n\treturn (\n\t\t<div style={{ [FOLDER_COLOR]: palette.purple100 }}>\n\t\t\t{externalModules.map(folder => (\n\t\t\t\t<ExternalComponentAssetFolderRow\n\t\t\t\t\tkey={folder.id}\n\t\t\t\t\tid={folder.id}\n\t\t\t\t\ttitle={folder.name}\n\t\t\t\t\titems={folder.items}\n\t\t\t\t\tupdates={folder.updates}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tisCollapsed={getFolderCollapseState(folder)}\n\t\t\t\t\ttoggleCollapse={() => handleToggleCollapse(folder.id, folder.moduleType)}\n\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t)\n})\n\ninterface ExternalComponentAssetFolderRowProps {\n\tid: string\n\ttitle: string\n\titems: ExternalModuleFolderItem[]\n\tupdates: number\n\tisViewOnly: boolean\n\tisCollapsed: boolean\n\ttoggleCollapse: () => void\n\tagentExperimentEnabled: boolean\n}\n\nfunction getMenuOptions(\n\tid: NodeID,\n\texportIdentifier: ExternalModuleExportIdentifierString,\n\ttitle: string,\n\tlocalId: LocalModuleId | undefined,\n) {\n\treturn createExternalComponentRowMenuContext(id, exportIdentifier, title, localId)\n}\n\nfunction onDragStart(event: DraggableEvent, exportIdentifier: ExternalModuleExportIdentifierString): void {\n\tconst parsed = parseModuleIdentifier(exportIdentifier)\n\tconst moduleNode = engine.tree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)\n\n\tconst annotations = moduleNode?.annotations\n\tconst size = annotations ? parseIntrinsicSizeFromAnnotations(annotations) : undefined\n\n\t// Create the component directly without relying on the componentLoader,\n\t// as external components that aren't evaluated won't be in the loader\n\tconst component = new CodeComponentNode({\n\t\twidth: size?.width ?? 200,\n\t\theight: size?.height ?? 200,\n\t\theightType: DimensionType.FixedNumber,\n\t\twidthType: DimensionType.FixedNumber,\n\t\tcodeComponentIdentifier: exportIdentifier,\n\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t})\n\n\tconst data: DraggableComponentData = {\n\t\tcomponent,\n\t\tsource: \"component_panel\",\n\t\ttype: \"component\",\n\t}\n\tevent.dataTransfer.setData(DraggableComponentDataType, data)\n}\n\nconst ExternalComponentAssetFolderRow = memo(function ExternalComponentAssetFolderRow({\n\tid,\n\ttitle,\n\titems,\n\tupdates,\n\tisViewOnly,\n\tisCollapsed,\n\ttoggleCollapse,\n\tagentExperimentEnabled,\n}: ExternalComponentAssetFolderRowProps) {\n\tconst componentItems = useMemo(() => items.filter(item => item.itemModuleType !== ModuleType.Shader), [items])\n\tconst shaderItems = useMemo(() => items.filter(item => item.itemModuleType === ModuleType.Shader), [items])\n\n\treturn (\n\t\t<>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={id}\n\t\t\t\ttitle={title}\n\t\t\t\tdepth={0}\n\t\t\t\tIcon={<IconEntityFolder className={assetStyles.icon} />}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible\n\t\t\t\tisCollapsed={isCollapsed}\n\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\tisEditable={false}\n\t\t\t\ttitleCanTriggerCollapse\n\t\t\t\ttrailingElementOverride={\n\t\t\t\t\tisCollapsed &&\n\t\t\t\t\tupdates > 0 && (\n\t\t\t\t\t\t<Badge className={styles.badge} variant=\"componentTintDimmed\">\n\t\t\t\t\t\t\t{updates}\n\t\t\t\t\t\t</Badge>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{!isCollapsed && shaderItems.length > 0 && (\n\t\t\t\t<ExternalShaderSubFolder\n\t\t\t\t\titems={shaderItems}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tfolderId={id}\n\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{!isCollapsed &&\n\t\t\t\tcomponentItems.map(item => (\n\t\t\t\t\t<ExternalAssetItemRow\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\ttitle={item.name}\n\t\t\t\t\t\texportIdentifier={item.exportIdentifier}\n\t\t\t\t\t\tlocalId={item.localId}\n\t\t\t\t\t\thasUpdate={item.hasUpdate}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tIcon={getExternalComponentIcon(agentExperimentEnabled)}\n\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\tonUpdate={onUpdate}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t</>\n\t)\n})\n\nfunction onUpdate(exportIdentifier: ExternalModuleExportIdentifierString) {\n\treturn engine.stores.modulesStore.updateExternalModuleComponentInstances(exportIdentifier).then(() => {\n\t\t// When updating a component with a component preset,\n\t\t// collections will not render components presets correctly\n\t\t// until they are regenerated. This is because the component\n\t\t// presets are linked with the module identifier including the\n\t\t// version. We don't want to wait for the component generation\n\t\t// queue to run, so we update the collections manually here.\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tconst collectionIds = new Set<NodeID>()\n\t\t\t// We only need to update collections of the current scope.\n\t\t\t// Other collections are not shown on the canvas so it\n\t\t\t// doesn't matter if they take longer to update.\n\t\t\tfor (const node of engine.stores.scopeStore.active.walk()) {\n\t\t\t\tif (withCollectionDataSource(node) && node.dataIdentifier) {\n\t\t\t\t\tconst collection = getCollectionForIdentifier(engine.tree, node.dataIdentifier)\n\t\t\t\t\tif (collection) collectionIds.add(collection.id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const collectionId of collectionIds) {\n\t\t\t\t// This will only update collections that are in the\n\t\t\t\t// queue already. So it will skip collections that don't\n\t\t\t\t// contain the component that was updated.\n\t\t\t\tengine.stores.codeGenerationStore.updateComponent(collectionId).catch(unhandledError)\n\t\t\t}\n\t\t})\n\t})\n}\n\n// --- Shader sub-folder rendering within external package folders ---\n\ninterface ExternalShaderSubFolderProps {\n\titems: ExternalModuleFolderItem[]\n\tisViewOnly: boolean\n\tfolderId: string\n\tagentExperimentEnabled: boolean\n}\n\nconst ExternalShaderSubFolder = memo(function ExternalShaderSubFolder({\n\titems,\n\tisViewOnly,\n\tfolderId,\n\tagentExperimentEnabled,\n}: ExternalShaderSubFolderProps) {\n\tconst shadersExpanded = engine.stores.chromeStore.useState(s => s.shadersExpanded)\n\n\treturn (\n\t\t<div style={{ [FOLDER_COLOR]: palette.purple100 }}>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={`shaders-folder-${folderId}`}\n\t\t\t\ttitle={Dictionary.Shaders}\n\t\t\t\tdepth={1}\n\t\t\t\tIcon={<IconEntityFolder className={assetStyles.icon} />}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible\n\t\t\t\tisCollapsed={!shadersExpanded}\n\t\t\t\ttoggleCollapse={engine.stores.chromeStore.toggleShaders}\n\t\t\t\tisEditable={false}\n\t\t\t\ttitleCanTriggerCollapse\n\t\t\t/>\n\t\t\t{shadersExpanded &&\n\t\t\t\titems.map(item => (\n\t\t\t\t\t<ExternalAssetItemRow\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\ttitle={item.name}\n\t\t\t\t\t\texportIdentifier={item.exportIdentifier}\n\t\t\t\t\t\tlocalId={item.localId}\n\t\t\t\t\t\thasUpdate={item.hasUpdate}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tdepth={2}\n\t\t\t\t\t\tIcon={getExternalComponentIcon(agentExperimentEnabled)}\n\t\t\t\t\t\tgetMenuOptions={getShaderMenuOptions}\n\t\t\t\t\t\tonUpdate={onShaderUpdate}\n\t\t\t\t\t\tonDragStart={onShaderDragStart}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tif (isViewOnly || !item.localId) return\n\t\t\t\t\t\t\tconst entry = engine.stores.modulesStore.getModuleEntryByLocalId(item.localId)\n\t\t\t\t\t\t\tif (entry) engine.stores.codeEditorStore.editFile(entry.name)\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t</div>\n\t)\n})\n\nfunction getExternalComponentIcon(agentExperimentEnabled: boolean) {\n\tif (agentExperimentEnabled) return <IconAgentComponent style={{ color: colors.assetComponentIcon }} />\n\treturn <IconLayerComponent color={colors.assetComponentIcon} />\n}\n\nfunction getShaderMenuOptions(\n\tid: NodeID,\n\texportIdentifier: ExternalModuleExportIdentifierString,\n\ttitle: string,\n\tlocalId: LocalModuleId | undefined,\n) {\n\treturn createExternalComponentRowMenuContext(id, exportIdentifier, title, localId)\n}\n\nfunction onShaderDragStart(event: DraggableEvent, exportIdentifier: ExternalModuleExportIdentifierString) {\n\tconst component = new ShaderNode({\n\t\tshaderModuleIdentifier: exportIdentifier as ModuleExportIdentifierString,\n\t\twidth: 400,\n\t\theight: 300,\n\t})\n\tconst data: DraggableComponentData = { component, source: \"component_panel\", type: \"component\" }\n\tevent.dataTransfer.setData(DraggableComponentDataType, data)\n}\n\nfunction onShaderUpdate(exportIdentifier: ExternalModuleExportIdentifierString) {\n\treturn engine.stores.modulesStore.updateExternalModuleComponentInstances(exportIdentifier)\n}\n\nfunction getShaderDisplayName(moduleIdentifier: string, fallbackName: string) {\n\tconst shaderDefinition = engine.componentLoader.shaderForIdentifier(moduleIdentifier)\n\treturn shaderDefinition?.title?.trim() || fallbackName\n}\n", "import { Draggable, type DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { type ExternalModuleExportIdentifierString, type LocalModuleId, unhandledError } from \"@framerjs/shared\"\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 { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { memo, useCallback, useEffect, useState } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { stopPropagation } from \"../properties/rows/utils/stopPropagation.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport * as styles from \"./ExternalComponents.styles.ts\"\n\nfunction onMouseDown(event: React.MouseEvent) {\n\tevent.preventDefault()\n\tevent.stopPropagation()\n}\n\nconst exitMode = () => engine.scheduler.processWhenReady(engine.exitMode)\n\ninterface ExternalComponentAssetItemRowProps {\n\tid: string\n\tdepth?: number\n\ttitle: string\n\texportIdentifier: ExternalModuleExportIdentifierString\n\tlocalId?: LocalModuleId\n\thasUpdate: boolean\n\tisViewOnly: boolean\n\tgetMenuOptions: (\n\t\tid: NodeID,\n\t\texportIdentifier: ExternalModuleExportIdentifierString,\n\t\ttitle: string,\n\t\tlocalId: LocalModuleId | undefined,\n\t) => MenuItemOptions[] | Promise<MenuItemOptions[]>\n\tonUpdate: (exportIdentifier: ExternalModuleExportIdentifierString) => Promise<void>\n\tonDragStart: (event: DraggableEvent, exportIdentifier: ExternalModuleExportIdentifierString) => void\n\tIcon: React.ReactNode\n\tupdateButtonClassName?: string\n\tonSelect?: () => void\n}\n\nexport const ExternalAssetItemRow = memo(function ExternalAssetItemRow({\n\tid,\n\tdepth = 1,\n\ttitle,\n\texportIdentifier,\n\tlocalId,\n\thasUpdate,\n\tisViewOnly,\n\tupdateButtonClassName,\n\tgetMenuOptions,\n\tonUpdate,\n\tonDragStart,\n\tIcon,\n\tonSelect,\n}: ExternalComponentAssetItemRowProps) {\n\tconst [shouldUpdate, setShouldUpdate] = useState(hasUpdate)\n\n\t/**\n\t * @FIXME - In future we should find a way to not rely on `useEffect` to\n\t * update `shouldUpdate` state and cause a re-render.\n\t */\n\tuseEffect(() => {\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\tsetShouldUpdate(hasUpdate)\n\t}, [hasUpdate])\n\n\tconst onClickUpdate = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\n\t\t\tif (isViewOnly) return\n\n\t\t\tsetShouldUpdate(false)\n\n\t\t\tonUpdate(exportIdentifier)\n\t\t\t\t.then(() => {\n\t\t\t\t\ttoast({\n\t\t\t\t\t\ttype: \"add\",\n\t\t\t\t\t\tvariant: \"success\",\n\t\t\t\t\t\ticon: \"success\",\n\t\t\t\t\t\ttext: `${title} has been updated`,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tunhandledError(e)\n\n\t\t\t\t\tsetShouldUpdate(true)\n\n\t\t\t\t\ttoast({\n\t\t\t\t\t\ttype: \"add\",\n\t\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\t\ticon: \"error\",\n\t\t\t\t\t\ttext: `${title} failed to update`,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t},\n\t\t[onUpdate, exportIdentifier, title, isViewOnly],\n\t)\n\n\tconst handleDragStart = useCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\texitMode()\n\t\t\tonDragStart(event, exportIdentifier)\n\t\t},\n\t\t[onDragStart, exportIdentifier],\n\t)\n\n\tconst getMenu = useCallback(\n\t\t(id: NodeID) => getMenuOptions(id, exportIdentifier, title, localId),\n\t\t[getMenuOptions, exportIdentifier, title, localId],\n\t)\n\n\treturn (\n\t\t<Draggable hideDragSource={false} onDragStart={handleDragStart} onMouseDown={onMouseDown} autoScrollEnabled={false}>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={id}\n\t\t\t\tdepth={depth}\n\t\t\t\ttitle={title}\n\t\t\t\tIcon={Icon}\n\t\t\t\twithCollapse\n\t\t\t\tisEditable={false}\n\t\t\t\tgetMenuOptions={getMenu}\n\t\t\t\tonSelect={onSelect}\n\t\t\t\ttrailingElementOverride={\n\t\t\t\t\tshouldUpdate &&\n\t\t\t\t\t!isViewOnly && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cx(styles.updateButton, updateButtonClassName)}\n\t\t\t\t\t\t\tonClick={onClickUpdate}\n\t\t\t\t\t\t\tonMouseDown={stopPropagation}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{Dictionary.Update}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t</Draggable>\n\t)\n})\n", "import \"ExternalComponents.styles_1tgdz95.wyw.css\"; export const updateButton = \"updateButton_urlik4g\";\nexport const badge = \"badge_baz5kyp\";", "import { ModuleType, assertNever } from \"@framerjs/shared\"\n\nconst vectorSuffix = \"-vector\"\nconst componentSuffix = \"-component\"\n\n/**\n * (External) Module types that can be displayed in the assets panel and support folder expansion.\n */\ntype AssetPanelModuleType = ModuleType.VectorSet | ModuleType.Canvas | ModuleType.Code | ModuleType.Shader\n\n/**\n * Creates unique folder IDs for external modules to avoid collisions.\n * Adds suffixes to prevent collisions with other external module folders,\n * e.g. having a \"Your Workspace\" folder in both components and vector sets.\n *\n * @param baseId - The folder ID from the external module's group\n * @param moduleType - The external module type\n * @returns Namespaced folder ID for safe expansion state\n */\nexport function getExternalAssetFolderId(baseId: string, moduleType: AssetPanelModuleType): string {\n\tswitch (moduleType) {\n\t\tcase ModuleType.VectorSet:\n\t\t\treturn `${baseId}${vectorSuffix}`\n\t\tcase ModuleType.Canvas:\n\t\tcase ModuleType.Code: // Canvas Components and Code Modules are both considered components in the assets panel\n\t\tcase ModuleType.Shader:\n\t\t\treturn `${baseId}${componentSuffix}`\n\t\tdefault:\n\t\t\tassertNever(\n\t\t\t\tmoduleType,\n\t\t\t\t`Unsupported external module type for folder ID generation: ${moduleType}. Add handling for this module type in getExternalModuleFolderId.`,\n\t\t\t)\n\t}\n}\n", "import { palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tLAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\tLayoutTemplateEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isEntityFolderNode, isLayoutTemplateNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport type { ContextMenuOptions } from \"../properties/utils/presetRowProps.ts\"\nimport { duplicateLayoutTemplateNode } from \"../shared/utils/duplicateLayoutTemplate.ts\"\nimport { isMultiSelectModifierKeyPressed } from \"../shared/utils/panelMultiSelect.ts\"\nimport { EntityRow } from \"./EntityRow.tsx\"\nimport * as styles from \"./EntitySection.styles.ts\"\nimport type { EntitySectionProps } from \"./EntitySection.ts\"\nimport { createAndRenameFolderNode, createEntityReferenceNodeForRootType } from \"./actions/create.ts\"\nimport { deleteEntityFolderNode, deleteLocalComponentScopeNode } from \"./actions/delete.ts\"\nimport { sortEntityAssetsAlphabetically } from \"./actions/sort.ts\"\nimport { createMultiSelectContextMenu } from \"./utils/createMultiSelectContextMenu.ts\"\nimport { expandAssetEntityItemsFromNode } from \"./utils/expandAssetEntityItems.ts\"\nimport { getNodeName } from \"./utils/getNodeName.ts\"\nimport { createFolderFromSelection, createRenderOrderedGetter } from \"./utils/multiselect.ts\"\nimport { resolveContextMenuHandler } from \"./utils/resolveContextMenuHandler.ts\"\nimport { type AssetRow, useAssetPanelEntityRows } from \"./utils/useAssetPanelEntityRows.ts\"\n\nexport const EntityLayoutTemplatesAssetSection = React.memo(function EntityLayoutTemplatesAssetSection({\n\tisViewOnly,\n\tselectedItemIds,\n\texpandedAssetEntityIds,\n\tonSelectItem,\n\tonClearSelection,\n\tsearchQuery,\n\tlastSelectionTypeRootId,\n}: EntitySectionProps) {\n\tconst sectionExpanded = engine.stores.chromeStore.useState(state => state.layoutTemplatesExpanded)\n\n\tconst [state, toggleCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(() => {\n\t\t\tconst entityRootNode = LayoutTemplateEntityTypeRootNode.get(engine.tree)\n\n\t\t\tif (!entityRootNode) return null\n\n\t\t\tconst unreferenced: AssetRow[] = []\n\n\t\t\tconst rootMatchesSearch = entityRootNode && matchSubstring(searchQuery, entityRootNode.getName())\n\n\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\tif (!isLayoutTemplateNode(node)) continue\n\n\t\t\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\tif (!rootMatchesSearch && !matchSubstring(searchQuery, node.resolveValue(\"name\"))) continue\n\n\t\t\t\tunreferenced.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\tdepth: 0,\n\t\t\t\t\ttitle: getNodeName(node),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tentityRootNode,\n\t\t\t\tunreferenced,\n\t\t\t\ttree: engine.tree,\n\t\t\t}\n\t\t}, [searchQuery]),\n\t)\n\n\tconst handleSelectItem = useEngineCallback(\n\t\t(value: NodeID) => {\n\t\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return\n\n\t\t\tconst node = engine.tree.getNode(value)\n\n\t\t\tif (isLayoutTemplateNode(node) && !isMultiSelectModifierKeyPressed()) {\n\t\t\t\tengine.stores.scopeStore.select(value, { keepHistory: false })\n\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t}\n\n\t\t\tonSelectItem(value, LAYOUT_TEMPLATE_ENTITY_ROOT_ID, state.rows)\n\t\t},\n\t\t[onSelectItem, state.rows],\n\t)\n\n\tconst getOrderedIds = useMemo(() => createRenderOrderedGetter(state.rows), [state.rows])\n\n\tconst hasItems = state.rows.length > 0\n\n\tconst createContextMenu = useCreateContextMenu(hasItems)\n\n\tconst multipleLayoutTemplateContextMenuItems = useMemo(() => {\n\t\treturn createMultipleLayoutTemplateContextMenuItems(onClearSelection)(selectedItemIds)\n\t}, [onClearSelection, selectedItemIds])\n\n\tconst contextMenuHandler = useMemo(\n\t\t() => resolveContextMenuHandler(selectedItemIds, createItemContextMenu, multipleLayoutTemplateContextMenuItems),\n\t\t[selectedItemIds, multipleLayoutTemplateContextMenuItems],\n\t)\n\n\tif (searchQuery && !hasItems) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle={Dictionary.Templates}\n\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleLayoutTemplates}\n\t\t\t\tonRightClick={createContextMenu}\n\t\t\t\tinTabbedPanel\n\t\t\t\thasItems={hasItems}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\ttitle={`Add ${Dictionary.Template}`}\n\t\t\t\t\t\texpanded={sectionExpanded}\n\t\t\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\n\t\t\t{sectionExpanded && hasItems && (\n\t\t\t\t<div className={styles.sectionContent}>\n\t\t\t\t\t{state.rows.map(row => (\n\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\ttypeRootId={LAYOUT_TEMPLATE_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t\tonToggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\thasUnreferencedItems={state.hasUnreferencedItems}\n\t\t\t\t\t\t\tcolor={palette.purple100}\n\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandler}\n\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\tgetOrderedIds={getOrderedIds}\n\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nfunction createItemContextMenu(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get(id)\n\tif (!node) return []\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.Edit,\n\t\t\tclick: () => {\n\t\t\t\tengine.stores.scopeStore.select(id, { keepHistory: false })\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: options.startRenaming,\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: async () => {\n\t\t\t\tconst template = engine.tree.get(id)\n\t\t\t\tif (!isScopeNode(template, true)) return\n\t\t\t\tconst loadedLayoutTemplate = template.isLoaded() ? template : await template.load()\n\t\t\t\tif (!isLayoutTemplateNode(loadedLayoutTemplate)) return\n\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tconst newNode = duplicateLayoutTemplateNode(engine.tree, engine.componentLoader, loadedLayoutTemplate)\n\t\t\t\t\tengine.stores.scopeStore.select(newNode.id, { keepHistory: false })\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\tvoid deleteLocalComponentScopeNode(engine, id)\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction createMultipleLayoutTemplateContextMenuItems(onClearSelection: () => void) {\n\treturn createMultiSelectContextMenu({\n\t\ttypeRootId: LAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, LAYOUT_TEMPLATE_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: async (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isLayoutTemplateNode(node)) continue\n\n\t\t\t\t\tif (!isScopeNode(node, true)) return\n\t\t\t\t\tconst loadedLayoutTemplate = node.isLoaded() ? node : await node.load()\n\t\t\t\t\tif (!isLayoutTemplateNode(loadedLayoutTemplate)) return\n\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tduplicateLayoutTemplateNode(engine.tree, engine.componentLoader, loadedLayoutTemplate)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (node && isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isLayoutTemplateNode(node)) continue\n\t\t\t\t\tvoid deleteLocalComponentScopeNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n}\n\nfunction contextMenu({ sortAlphabetically }: { sortAlphabetically: boolean }): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.NewTemplate,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () =>\n\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\trootType: LAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\t\t\t\t\tonDone: (id: NodeID) => {\n\t\t\t\t\t\texpandAssetEntityItemsFromNode(engine, id, LAYOUT_TEMPLATE_ENTITY_ROOT_ID, false)\n\t\t\t\t\t\tengine.stores.scopeStore.select(id, { keepHistory: false })\n\t\t\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.NewFolder,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => createAndRenameFolderNode(engine, LAYOUT_TEMPLATE_ENTITY_ROOT_ID, false),\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\tenabled: !isViewOnly,\n\t\t\tvisible: sortAlphabetically,\n\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, LAYOUT_TEMPLATE_ENTITY_ROOT_ID),\n\t\t},\n\t]\n}\n\nfunction useCreateContextMenu(hasItems: boolean) {\n\treturn useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tengine.stores.contextMenuStore.show(contextMenu({ sortAlphabetically: hasItems }), {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: event.clientX,\n\t\t\t\t\ty: event.clientY,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[hasItems],\n\t)\n}\n", "import { ReadOnlyContext } from \"@framerjs/fresco\"\nimport { palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { deleteToken, duplicateToken } from \"document/components/utils/tokenContextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport { ColorStyleTokenListNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tBlockquoteEntityTypeRootNode,\n\tCMSEntityTypeRootNode,\n\tCMS_ENTITY_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tColorEntityTypeRootNode,\n\ttype EntityTypeRootId,\n\tINLINE_CODE_ENTITY_ROOT_ID,\n\tInlineCodeEntityTypeRootNode,\n\tLINK_ENTITY_ROOT_ID,\n\tLinkEntityTypeRootNode,\n\tTEXT_ENTITY_ROOT_ID,\n\tTextEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.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 { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport type { TableStylePresetNode } from \"document/models/CanvasTree/nodes/TableStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport { duplicateEntityReferenceNode } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport {\n\tisBlockquoteStylePresetNode,\n\tisColorStyleTokenNode,\n\tisComponentPresetNode,\n\tisEntityFolderNode,\n\tisImageStylePresetNode,\n\tisInlineCodeStylePresetNode,\n\tisLinkStylePresetNode,\n\tisTableStylePresetNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getRichTextTagName, richTextTags } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { isReplica } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useCallback, useMemo } from \"react\"\nimport { createBlockquoteStylePreset } from \"utils/blockquoteStylePresetUtils.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 { matchSubstring } from \"utils/searchUtils.ts\"\nimport { createTableStylePreset } from \"utils/tableStylePresetUtils.ts\"\nimport { createTextStylePreset } from \"utils/textStylePresetUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { EditComponentPresetPopout } from \"../properties/panels/EditComponentPresetPopout.tsx\"\nimport { EditImageStylePresetPopout } from \"../properties/panels/EditImageStylePresetPopout.tsx\"\nimport { EditTableStylePresetPopout } from \"../properties/panels/EditTableStylePresetPopout.tsx\"\nimport { getTextStylePresetBreakpointOverridesFromTree } from \"../properties/panels/utils/getTextStylePresetBreakpoints.ts\"\nimport { useComponentsWithPresets } from \"../properties/panels/utils/useComponentsWithPresets.ts\"\nimport {\n\tBlockquoteStylePresetPopoutContent,\n\tcreateBlockquoteItemContextMenuItems,\n} from \"../properties/utils/getBlockquoteStylePresetRowProps.tsx\"\nimport {\n\tColorStyleTokenPopoutContent,\n\tcreateColorItemContextMenuItems,\n} from \"../properties/utils/getColorStyleTokenRowProps.tsx\"\nimport { createComponentPresetContextMenuItems } from \"../properties/utils/getComponentPresetRowProps.tsx\"\nimport { createImageContextMenuItems } from \"../properties/utils/getImageStylePresetRowProps.tsx\"\nimport {\n\tInlineCodeStylePresetPopoutContent,\n\tcreateInlineCodeItemContextMenuItems,\n} from \"../properties/utils/getInlineCodeStylePresetRowProps.tsx\"\nimport {\n\tLinkStylePresetPopoutContent,\n\tcreateLinkItemContextMenuItems,\n} from \"../properties/utils/getLinkStylePresetRowProps.tsx\"\nimport { createTableContextMenuItems } from \"../properties/utils/getTableStylePresetRowProps.tsx\"\nimport {\n\tTextStylePresetPopoutContent,\n\tcreateTextItemContextMenuItems,\n} from \"../properties/utils/getTextStylePresetRowProps.tsx\"\nimport type { ContextMenuOptions } from \"../properties/utils/presetRowProps.ts\"\nimport { removePresetNode } from \"../properties/utils/removePresetNode.ts\"\nimport { usePopoutContent } from \"../shared/PopoutButton.tsx\"\nimport { isMultiSelectModifierKeyPressed } from \"../shared/utils/panelMultiSelect.ts\"\nimport { EntityRow } from \"./EntityRow.tsx\"\nimport * as styles from \"./EntitySection.styles.ts\"\nimport type { EntitySectionProps } from \"./EntitySection.ts\"\nimport { createAndRenameFolderNode, createEntityReferenceNodeForRootType } from \"./actions/create.ts\"\nimport { deleteEntityFolderNode } from \"./actions/delete.ts\"\nimport { expandParentAndRenameEntity } from \"./actions/rename.ts\"\nimport type { AssetReferencePopoutContentProps } from \"./types.ts\"\nimport { createMultiSelectContextMenu } from \"./utils/createMultiSelectContextMenu.ts\"\nimport { type AssetRowComponentType, getComponentType } from \"./utils/getComponentType.ts\"\nimport { getNodeName } from \"./utils/getNodeName.ts\"\nimport { getTextStylePresetDescription } from \"./utils/getTextStylePresetDescription.ts\"\nimport { createFolderFromSelection, createRenderOrderedGetter } from \"./utils/multiselect.ts\"\nimport { resolveContextMenuHandler } from \"./utils/resolveContextMenuHandler.ts\"\nimport { type AssetRow, useAssetPanelEntityRows } from \"./utils/useAssetPanelEntityRows.ts\"\n\nconst tableComponentTypeMeta = { componentType: \"table\" } as const\nconst imageComponentTypeMeta = { componentType: \"image\" } as const\n\nfunction usePresetNodes() {\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst allPresetNodes = PresetsListNode.getNodes(engine.tree)\n\n\t\t\tconst textStylePresetNodes: NodeID[] = []\n\t\t\tconst linkStylePresetNodes: NodeID[] = []\n\t\t\tconst blockquoteStylePresetNodes: NodeID[] = []\n\t\t\tconst inlineCodeStylePresetNodes: NodeID[] = []\n\t\t\tconst imageStylePresetNodes: NodeID[] = []\n\t\t\tconst componentPresetNodes: NodeID[] = []\n\t\t\tconst tableStylePresetNodes: NodeID[] = []\n\n\t\t\tfor (const node of allPresetNodes) {\n\t\t\t\tif (isReplica(node)) continue\n\n\t\t\t\tif (isTextStylePresetNode(node)) {\n\t\t\t\t\ttextStylePresetNodes.push(node.id)\n\t\t\t\t} else if (isLinkStylePresetNode(node)) {\n\t\t\t\t\tlinkStylePresetNodes.push(node.id)\n\t\t\t\t} else if (isBlockquoteStylePresetNode(node)) {\n\t\t\t\t\tblockquoteStylePresetNodes.push(node.id)\n\t\t\t\t} else if (isInlineCodeStylePresetNode(node)) {\n\t\t\t\t\tinlineCodeStylePresetNodes.push(node.id)\n\t\t\t\t} else if (isImageStylePresetNode(node)) {\n\t\t\t\t\timageStylePresetNodes.push(node.id)\n\t\t\t\t} else if (isComponentPresetNode(node)) {\n\t\t\t\t\tcomponentPresetNodes.push(node.id)\n\t\t\t\t} else if (isTableStylePresetNode(node)) {\n\t\t\t\t\ttableStylePresetNodes.push(node.id)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttextStylePresetNodes,\n\t\t\t\tlinkStylePresetNodes,\n\t\t\t\tblockquoteStylePresetNodes,\n\t\t\t\tinlineCodeStylePresetNodes,\n\t\t\t\timageStylePresetNodes,\n\t\t\t\tcomponentPresetNodes,\n\t\t\t\ttableStylePresetNodes,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree],\n\t\t{ deepEqual: true },\n\t)\n}\n\nfunction getColorStyleRows(searchQuery: string) {\n\tconst entityRootNode = ColorEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow<{ light: string; dark?: string }>[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\tconst allowList = new Set<NodeID>()\n\n\tfor (const node of ColorStyleTokenListNode.getTokenNodes(engine.tree)) {\n\t\tallowList.add(node.id)\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t\tlight: node.light,\n\t\t\tdark: node.dark,\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\tgetReferenceMeta: (id: NodeID) => {\n\t\t\tconst reference = engine.tree.get(id)\n\t\t\tif (!isColorStyleTokenNode(reference)) return\n\t\t\treturn {\n\t\t\t\tlight: reference.light,\n\t\t\t\tdark: reference.dark,\n\t\t\t}\n\t\t},\n\t\ttree: engine.tree,\n\t\tallowList,\n\t}\n}\n\nfunction getTextStyleRows(presetNodeIds: NodeID[], searchQuery: string) {\n\tconst entityRootNode = TextEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow<{ description?: string }>[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\tfor (const id of presetNodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isTextStylePresetNode(node)) continue\n\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t\tdescription: getTextStylePresetDescription(node),\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\tgetReferenceMeta: (id: NodeID) => {\n\t\t\tconst node = engine.tree.get(id)\n\t\t\tif (!isTextStylePresetNode(node)) return\n\t\t\treturn { description: getTextStylePresetDescription(node) }\n\t\t},\n\t\ttree: engine.tree,\n\t}\n}\n\nfunction getLinkStyleRows(presetNodeIds: readonly NodeID[], searchQuery: string) {\n\tconst entityRootNode = LinkEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\tfor (const id of presetNodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isLinkStylePresetNode(node)) continue\n\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\ttree: engine.tree,\n\t}\n}\n\nfunction getBlockquoteStyleRows(presetNodeIds: readonly NodeID[], searchQuery: string) {\n\tconst entityRootNode = BlockquoteEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\tfor (const id of presetNodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isBlockquoteStylePresetNode(node)) continue\n\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\ttree: engine.tree,\n\t}\n}\n\nfunction getInlineCodeStyleRows(presetNodeIds: readonly NodeID[], searchQuery: string) {\n\tconst entityRootNode = InlineCodeEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\tfor (const id of presetNodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isInlineCodeStylePresetNode(node)) continue\n\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\ttree: engine.tree,\n\t}\n}\n\nfunction getCmsStyleRows(\n\tcomponents: ComponentWithPreset[],\n\timageStylePresetNodeIds: readonly NodeID[],\n\tcomponentPresetNodeIds: readonly NodeID[],\n\ttableStylePresetNodeIds: readonly NodeID[],\n\tsearchQuery: string,\n) {\n\tconst entityRootNode = CMSEntityTypeRootNode.get(engine.tree)\n\tif (!entityRootNode) return null\n\n\tconst unreferenced: AssetRow<{ componentType?: AssetRowComponentType }>[] = []\n\tconst rootMatchesSearch = matchSubstring(searchQuery, entityRootNode.getName())\n\n\tconst cmsNodeIds = [...imageStylePresetNodeIds, ...componentPresetNodeIds, ...tableStylePresetNodeIds]\n\n\tfor (const id of cmsNodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isImageStylePresetNode(node) && !isComponentPresetNode(node) && !isTableStylePresetNode(node)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\tconst name = getNodeName(node)\n\t\tif (searchQuery && !rootMatchesSearch && !matchSubstring(searchQuery, name)) continue\n\n\t\tunreferenced.push({\n\t\t\tid: node.id,\n\t\t\ttype: \"reference\",\n\t\t\tdepth: 1,\n\t\t\ttitle: name,\n\t\t\tcomponentType: isComponentPresetNode(node)\n\t\t\t\t? getComponentType(node, components)\n\t\t\t\t: isTableStylePresetNode(node)\n\t\t\t\t\t? \"table\"\n\t\t\t\t\t: \"image\",\n\t\t})\n\t}\n\n\treturn {\n\t\tentityRootNode,\n\t\tunreferenced,\n\t\tincludeRoot: true,\n\t\tgetReferenceMeta: (id: NodeID) => {\n\t\t\tconst node = engine.tree.get(id)\n\t\t\tif (isTableStylePresetNode(node)) {\n\t\t\t\treturn tableComponentTypeMeta\n\t\t\t}\n\t\t\tif (isImageStylePresetNode(node)) {\n\t\t\t\treturn imageComponentTypeMeta\n\t\t\t}\n\t\t\tif (isComponentPresetNode(node)) {\n\t\t\t\treturn { componentType: getComponentType(node, components) }\n\t\t\t}\n\t\t},\n\t}\n}\n\nexport const EntityStylesAssetSection = React.memo(function EntityStylesAssetSection({\n\tisViewOnly,\n\tselectedItemIds,\n\texpandedAssetEntityIds,\n\tonSelectItem,\n\tonClearSelection,\n\tsearchQuery,\n\tlastSelectionTypeRootId,\n}: EntitySectionProps) {\n\tconst stylesExpanded = engine.stores.chromeStore.useState(state => state.stylesExpanded)\n\tconst components = useComponentsWithPresets()\n\n\tconst presetNodes = usePresetNodes()\n\n\tconst [colorState, toggleColorCollapse] = useAssetPanelEntityRows<{\n\t\tlight: string\n\t\tdark?: string\n\t}>(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(() => getColorStyleRows(searchQuery), [searchQuery]),\n\t)\n\tconst [textState, toggleTextCollapse] = useAssetPanelEntityRows<{ description?: string }>(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t() => getTextStyleRows(presetNodes.textStylePresetNodes, searchQuery),\n\t\t\t[presetNodes.textStylePresetNodes, searchQuery],\n\t\t),\n\t)\n\tconst [linkState, toggleLinkCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t() => getLinkStyleRows(presetNodes.linkStylePresetNodes, searchQuery),\n\t\t\t[presetNodes.linkStylePresetNodes, searchQuery],\n\t\t),\n\t)\n\tconst [blockquoteState, toggleBlockquoteCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t() => getBlockquoteStyleRows(presetNodes.blockquoteStylePresetNodes, searchQuery),\n\t\t\t[presetNodes.blockquoteStylePresetNodes, searchQuery],\n\t\t),\n\t)\n\tconst [inlineCodeState, toggleInlineCodeCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t() => getInlineCodeStyleRows(presetNodes.inlineCodeStylePresetNodes, searchQuery),\n\t\t\t[presetNodes.inlineCodeStylePresetNodes, searchQuery],\n\t\t),\n\t)\n\tconst [cmsState, toggleCmsCollapse] = useAssetPanelEntityRows<{\n\t\tcomponentType?: AssetRowComponentType\n\t}>(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(\n\t\t\t() =>\n\t\t\t\tgetCmsStyleRows(\n\t\t\t\t\tcomponents,\n\t\t\t\t\tpresetNodes.imageStylePresetNodes,\n\t\t\t\t\tpresetNodes.componentPresetNodes,\n\t\t\t\t\tpresetNodes.tableStylePresetNodes,\n\t\t\t\t\tsearchQuery,\n\t\t\t\t),\n\t\t\t[\n\t\t\t\tcomponents,\n\t\t\t\tpresetNodes.imageStylePresetNodes,\n\t\t\t\tpresetNodes.componentPresetNodes,\n\t\t\t\tpresetNodes.tableStylePresetNodes,\n\t\t\t\tsearchQuery,\n\t\t\t],\n\t\t),\n\t)\n\n\tconst handleSelectItem = useCallback(\n\t\t(value: NodeID, typeRootId: EntityTypeRootId, currentRows?: readonly AssetRow[]) => {\n\t\t\tif (!isMultiSelectModifierKeyPressed()) engine.stores.codeEditorStore.closeEditor()\n\t\t\tonSelectItem(value, typeRootId, currentRows)\n\t\t},\n\t\t[onSelectItem],\n\t)\n\n\tconst handleSelectTextItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, TEXT_ENTITY_ROOT_ID, textState.rows),\n\t\t[handleSelectItem, textState.rows],\n\t)\n\tconst handleSelectLinkItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, LINK_ENTITY_ROOT_ID, linkState.rows),\n\t\t[handleSelectItem, linkState.rows],\n\t)\n\tconst handleSelectColorItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, COLOR_ENTITY_ROOT_ID, colorState.rows),\n\t\t[handleSelectItem, colorState.rows],\n\t)\n\tconst handleSelectCmsItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, CMS_ENTITY_ROOT_ID, cmsState.rows),\n\t\t[handleSelectItem, cmsState.rows],\n\t)\n\tconst handleSelectBlockquoteItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, BLOCKQUOTE_ENTITY_ROOT_ID, blockquoteState.rows),\n\t\t[handleSelectItem, blockquoteState.rows],\n\t)\n\tconst handleSelectInlineCodeItem = useCallback(\n\t\t(value: NodeID) => handleSelectItem(value, INLINE_CODE_ENTITY_ROOT_ID, inlineCodeState.rows),\n\t\t[handleSelectItem, inlineCodeState.rows],\n\t)\n\n\tconst { present, ref } = usePopoutContent({\n\t\tpopout: <ColorStyleTokenPopoutContent folderId={COLOR_ENTITY_ROOT_ID} popout={false} />,\n\t\tnavigationTitle: \"New Color Style\",\n\t})\n\n\tconst handleCreateAction = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tcreateContextMenu(event, components, present)\n\t\t},\n\t\t[components, present],\n\t)\n\n\tconst multiStyleContextMenuItems = useMemo(() => {\n\t\treturn {\n\t\t\ttext: createMultipleTextStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t\tlink: createMultipleLinkStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t\tcolor: createMultipleColorStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t\tcms: createMultipleCmsStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t\tblockquote: createMultipleBlockquoteStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t\tinlineCode: createMultipleInlineCodeStyleContextMenuItems(onClearSelection)(selectedItemIds),\n\t\t}\n\t}, [onClearSelection, selectedItemIds])\n\n\tconst contextMenuHandlers = useMemo(\n\t\t() => ({\n\t\t\ttext: resolveContextMenuHandler(selectedItemIds, createTextItemContextMenuItems, multiStyleContextMenuItems.text),\n\t\t\tlink: resolveContextMenuHandler(selectedItemIds, createLinkItemContextMenuItems, multiStyleContextMenuItems.link),\n\t\t\tcolor: resolveContextMenuHandler(\n\t\t\t\tselectedItemIds,\n\t\t\t\tcreateColorItemContextMenuItems,\n\t\t\t\tmultiStyleContextMenuItems.color,\n\t\t\t),\n\t\t\tcms: resolveContextMenuHandler(selectedItemIds, createCmsItemContextMenuItems, multiStyleContextMenuItems.cms),\n\t\t\tblockquote: resolveContextMenuHandler(\n\t\t\t\tselectedItemIds,\n\t\t\t\tcreateBlockquoteItemContextMenuItems,\n\t\t\t\tmultiStyleContextMenuItems.blockquote,\n\t\t\t),\n\t\t\tinlineCode: resolveContextMenuHandler(\n\t\t\t\tselectedItemIds,\n\t\t\t\tcreateInlineCodeItemContextMenuItems,\n\t\t\t\tmultiStyleContextMenuItems.inlineCode,\n\t\t\t),\n\t\t}),\n\t\t[selectedItemIds, multiStyleContextMenuItems],\n\t)\n\n\tconst getTextOrderedIds = useMemo(() => createRenderOrderedGetter(textState.rows), [textState.rows])\n\tconst getLinkOrderedIds = useMemo(() => createRenderOrderedGetter(linkState.rows), [linkState.rows])\n\tconst getColorOrderedIds = useMemo(() => createRenderOrderedGetter(colorState.rows), [colorState.rows])\n\tconst getCmsOrderedIds = useMemo(() => createRenderOrderedGetter(cmsState.rows), [cmsState.rows])\n\tconst getBlockquoteOrderedIds = useMemo(() => createRenderOrderedGetter(blockquoteState.rows), [blockquoteState.rows])\n\tconst getInlineCodeOrderedIds = useMemo(() => createRenderOrderedGetter(inlineCodeState.rows), [inlineCodeState.rows])\n\n\tconst sectionHasAnyItems =\n\t\tcmsState.rows.length > 0 ||\n\t\ttextState.rows.length > 0 ||\n\t\tlinkState.rows.length > 0 ||\n\t\tblockquoteState.rows.length > 0 ||\n\t\tinlineCodeState.rows.length > 0 ||\n\t\tcolorState.rows.length > 0\n\n\tif (searchQuery && !sectionHasAnyItems) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle={Dictionary.Styles}\n\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleStyles}\n\t\t\t\tonRightClick={handleCreateAction}\n\t\t\t\tinTabbedPanel\n\t\t\t\thasItems={sectionHasAnyItems}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\ttitle=\"Add Style\"\n\t\t\t\t\t\texpanded={stylesExpanded}\n\t\t\t\t\t\tcreateAction={handleCreateAction}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcreateAction={handleCreateAction}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\n\t\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t\t{sectionHasAnyItems && stylesExpanded && (\n\t\t\t\t\t<div className={styles.sectionContent}>\n\t\t\t\t\t\t{textState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={TEXT_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectTextItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={textState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleTextCollapse}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.text}\n\t\t\t\t\t\t\t\tPopoutContent={TextStylePresetPopoutContent}\n\t\t\t\t\t\t\t\tdescription={row.description}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getTextOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{linkState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={LINK_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectLinkItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={linkState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleLinkCollapse}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.link}\n\t\t\t\t\t\t\t\tPopoutContent={LinkStylePresetPopoutContent}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getLinkOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{colorState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={COLOR_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectColorItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={colorState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleColorCollapse}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\tPopoutContent={ColorStyleTokenPopoutContent}\n\t\t\t\t\t\t\t\tnewItemNavigationTitle=\"New Color Style\"\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.color}\n\t\t\t\t\t\t\t\tlight={row.light}\n\t\t\t\t\t\t\t\tdark={row.dark}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getColorOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{cmsState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={CMS_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectCmsItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={cmsState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleCmsCollapse}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.cms}\n\t\t\t\t\t\t\t\tPopoutContent={CMSPopoutContent}\n\t\t\t\t\t\t\t\tcomponentType={row.componentType}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getCmsOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{blockquoteState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={BLOCKQUOTE_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectBlockquoteItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={blockquoteState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleBlockquoteCollapse}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.blockquote}\n\t\t\t\t\t\t\t\tPopoutContent={BlockquoteStylePresetPopoutContent}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getBlockquoteOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t{inlineCodeState.rows.map(row => (\n\t\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\t\ttypeRootId={INLINE_CODE_ENTITY_ROOT_ID}\n\t\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\t\tonSelectItem={handleSelectInlineCodeItem}\n\t\t\t\t\t\t\t\thasUnreferencedItems={inlineCodeState.hasUnreferencedItems}\n\t\t\t\t\t\t\t\tonToggleCollapse={toggleInlineCodeCollapse}\n\t\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\t\treferenceWithPopoutDivider\n\t\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandlers.inlineCode}\n\t\t\t\t\t\t\t\tPopoutContent={InlineCodeStylePresetPopoutContent}\n\t\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\t\tgetOrderedIds={getInlineCodeOrderedIds}\n\t\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</>\n\t)\n})\n\nfunction CMSPopoutContent({ referenceItemId }: AssetReferencePopoutContentProps) {\n\tconst preset = useEngineState(\n\t\t() => {\n\t\t\treturn engine.tree.get<ImageStylePresetNode | TableStylePresetNode | ComponentPresetNode>(referenceItemId)\n\t\t},\n\t\t[referenceItemId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tif (isNull(preset)) return null\n\tif (isImageStylePresetNode(preset)) {\n\t\treturn <EditImageStylePresetPopout preset={preset} />\n\t}\n\n\tif (isComponentPresetNode(preset)) {\n\t\treturn <EditComponentPresetPopout preset={preset} />\n\t}\n\n\tif (isTableStylePresetNode(preset)) {\n\t\treturn <EditTableStylePresetPopout preset={preset} />\n\t}\n\n\treturn null\n}\n\nfunction createCmsItemContextMenuItems(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get<ImageStylePresetNode | TableStylePresetNode | ComponentPresetNode>(id)\n\tif (isNull(node)) return []\n\n\tif (isImageStylePresetNode(node)) return createImageContextMenuItems(node, options)\n\n\tif (isTableStylePresetNode(node)) return createTableContextMenuItems(node, options)\n\n\tif (isComponentPresetNode(node)) return createComponentPresetContextMenuItems(node, options)\n\n\treturn []\n}\n\nconst createMultipleTextStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: TEXT_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, TEXT_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isTextStylePresetNode(node)) continue\n\t\t\t\t\tcreateTextStylePreset(engine, node.tag, {\n\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\ttextStyle: node.getTextStyle(),\n\t\t\t\t\t\tbreakpointOverrides: getTextStylePresetBreakpointOverridesFromTree(engine.tree, node),\n\t\t\t\t\t\tonCreate(newPreset: TextStylePresetNode) {\n\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isTextStylePresetNode(node)) continue\n\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nconst createMultipleLinkStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: LINK_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, LINK_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isLinkStylePresetNode(node)) continue\n\n\t\t\t\t\tcreateLinkStylePreset(engine, {\n\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\tpresetOverrides: { ...node.getLinkStyle(), linkTransition: node.linkTransition },\n\t\t\t\t\t\tonCreate(newPreset: LinkStylePresetNode) {\n\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isLinkStylePresetNode(node)) continue\n\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nconst createMultipleColorStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: COLOR_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, COLOR_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isColorStyleTokenNode(node)) continue\n\n\t\t\t\t\tduplicateToken(engine, node)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isColorStyleTokenNode(node)) continue\n\t\t\t\t\tdeleteToken(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nconst createMultipleCmsStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: CMS_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, CMS_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isImageStylePresetNode(node)) {\n\t\t\t\t\t\tcreateImageStylePreset(engine, {\n\t\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\t\timageStyle: node.getImageStyle(),\n\t\t\t\t\t\t\tonCreate(newPreset: ImageStylePresetNode) {\n\t\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (isTableStylePresetNode(node)) {\n\t\t\t\t\t\tcreateTableStylePreset(engine, {\n\t\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\t\ttableStyle: node.getTableStyle(),\n\t\t\t\t\t\t\tonCreate(newPreset: TableStylePresetNode) {\n\t\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (isImageStylePresetNode(node) || isTableStylePresetNode(node)) {\n\t\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t\t} else if (isComponentPresetNode(node)) {\n\t\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nconst createMultipleBlockquoteStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: BLOCKQUOTE_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, BLOCKQUOTE_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isBlockquoteStylePresetNode(node)) continue\n\n\t\t\t\t\tcreateBlockquoteStylePreset(engine, {\n\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\tblockquoteStyle: node.getBlockquoteStyle(),\n\t\t\t\t\t\tonCreate(newPreset: BlockquoteStylePresetNode) {\n\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isBlockquoteStylePresetNode(node)) continue\n\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nconst createMultipleInlineCodeStyleContextMenuItems = (onClearSelection: () => void) =>\n\tcreateMultiSelectContextMenu({\n\t\ttypeRootId: INLINE_CODE_ENTITY_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, INLINE_CODE_ENTITY_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isInlineCodeStylePresetNode(node)) continue\n\n\t\t\t\t\tcreateInlineCodeStylePreset(engine, {\n\t\t\t\t\t\tname: node.getName(),\n\t\t\t\t\t\tinlineCodeStyle: node.getInlineCodeStyle(),\n\t\t\t\t\t\tonCreate(newPreset: InlineCodeStylePresetNode) {\n\t\t\t\t\t\t\tduplicateEntityReferenceNode(engine, node.id, newPreset.id)\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\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isInlineCodeStylePresetNode(node)) continue\n\t\t\t\t\tremovePresetNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n\nfunction createContextMenu(\n\tevent: React.MouseEvent,\n\tcomponents: ComponentWithPreset[],\n\tpresentColorPopout: VoidFunction,\n) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tconst cmsStyleMenuItems: MenuItemOptions[] = components.map(component => ({\n\t\tlabel: component.name,\n\t\tenabled: !isViewOnly,\n\t\tclick: () =>\n\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\trootType: CMS_ENTITY_ROOT_ID,\n\t\t\t\tcmsOptions: { type: \"component\", component },\n\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, CMS_ENTITY_ROOT_ID, id, false),\n\t\t\t}),\n\t}))\n\n\tcmsStyleMenuItems.push({\n\t\tlabel: Dictionary.Image,\n\t\tenabled: !isViewOnly,\n\t\tclick: () =>\n\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\trootType: CMS_ENTITY_ROOT_ID,\n\t\t\t\tcmsOptions: { type: \"image\" },\n\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, CMS_ENTITY_ROOT_ID, id, false),\n\t\t\t}),\n\t})\n\n\tcmsStyleMenuItems.push({\n\t\tlabel: Dictionary.Table,\n\t\tenabled: !isViewOnly,\n\t\tclick: () =>\n\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\trootType: CMS_ENTITY_ROOT_ID,\n\t\t\t\tcmsOptions: { type: \"table\" },\n\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, CMS_ENTITY_ROOT_ID, id, false),\n\t\t\t}),\n\t})\n\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Text,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t...richTextTags.map(tag => ({\n\t\t\t\t\t\tlabel: getRichTextTagName(tag),\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\t\t\t\trootType: TEXT_ENTITY_ROOT_ID,\n\t\t\t\t\t\t\t\ttag,\n\t\t\t\t\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, TEXT_ENTITY_ROOT_ID, id, false),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t})),\n\t\t\t\t\t{ type: \"separator\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, TEXT_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Link,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewStyle,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\t\t\t\trootType: LINK_ENTITY_ROOT_ID,\n\t\t\t\t\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, LINK_ENTITY_ROOT_ID, id, false),\n\t\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: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, LINK_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Blockquote,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewStyle,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\t\t\t\trootType: BLOCKQUOTE_ENTITY_ROOT_ID,\n\t\t\t\t\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, BLOCKQUOTE_ENTITY_ROOT_ID, id, false),\n\t\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: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, BLOCKQUOTE_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Code,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewStyle,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\t\t\t\trootType: INLINE_CODE_ENTITY_ROOT_ID,\n\t\t\t\t\t\t\t\tonDone: id => expandParentAndRenameEntity(engine, INLINE_CODE_ENTITY_ROOT_ID, id, false),\n\t\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: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, INLINE_CODE_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Color,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewStyle,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\t\t\t\trootType: COLOR_ENTITY_ROOT_ID,\n\t\t\t\t\t\t\t\tpresent: presentColorPopout,\n\t\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: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, COLOR_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Cms,\n\t\t\t\tvisible: components.length > 0,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t...cmsStyleMenuItems,\n\t\t\t\t\t{ type: \"separator\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.NewFolder,\n\t\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\t\tclick: () => createAndRenameFolderNode(engine, CMS_ENTITY_ROOT_ID, false),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\t{\n\t\t\tsearchable: false,\n\t\t\tlocation: {\n\t\t\t\tx: event.clientX,\n\t\t\t\ty: event.clientY,\n\t\t\t},\n\t\t},\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { filterComponentPresetControls } from \"document/models/controlProps/filterComponentPresetControls.ts\"\nimport { getControlProp, useControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport { getReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useMemoReducedControlProps } from \"document/models/controlProps/memoReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { useMemo } from \"react\"\nimport { useReactComponentDefinition } from \"../../richTextEditor/useCodeBlockLanguages.ts\"\nimport { useHiddenStateForModule } from \"../../richTextEditor/useHiddenStateForModule.tsx\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PresetPopoutContainer } from \"./PresetPopoutContainer.tsx\"\nimport { getControlIcons } from \"./utils/getControlIcons.ts\"\n\ninterface Props {\n\tpreset: ComponentPresetNode\n}\n\nexport function EditComponentPresetPopout({ preset }: Props) {\n\tconst component = useReactComponentDefinition(preset.componentIdentifier)\n\tconst properties = component?.properties\n\n\tconst changeHandler = useEngineCallback(\n\t\t(controlKey: string, getUpdate: (currentControlProp: ControlProp) => ControlProp) => {\n\t\t\tif (!properties) return\n\t\t\tconst latestPreset = engine.tree.current(preset)\n\t\t\tif (!latestPreset) return\n\t\t\tconst control = properties[controlKey]\n\t\t\tif (!control) return\n\t\t\tconst rawControlProp = latestPreset.getRawControlProp(controlKey)\n\t\t\tconst currentControlProp = getControlProp(control, rawControlProp)\n\t\t\tif (!currentControlProp) return\n\t\t\tconst newControlProp = getUpdate(currentControlProp)\n\t\t\tlatestPreset.setControlProp(controlKey, newControlProp)\n\t\t},\n\t\t[preset, properties],\n\t)\n\n\tconst controls = useMemo(() => filterComponentPresetControls(component, \"onlyPresets\"), [component])\n\tconst controlProps = useControlProps(controls, preset.getRawControlProps())\n\tconst reducedControlProps = useMemoReducedControlProps(getReducedControlProps(properties ?? {}, [controlProps]))\n\n\tconst hiddenState = useHiddenStateForModule(preset.componentIdentifier, controlProps)\n\n\tconst hiddenStateByNodeId = useMemo(() => {\n\t\treturn { [preset.id]: hiddenState }\n\t}, [preset.id, hiddenState])\n\n\tfunction handleImageUpload() {\n\t\tthrow new Error(\"Not implemented\")\n\t}\n\n\treturn (\n\t\t<PresetPopoutContainer withPanelHeader={false}>\n\t\t\t<Panel>\n\t\t\t\t{Object.entries(controls).map(([controlKey, control]) => {\n\t\t\t\t\tif (!control) return null\n\t\t\t\t\tif (hiddenState[controlKey]) return null\n\t\t\t\t\tconst reducedControlProp = reducedControlProps[controlKey]\n\t\t\t\t\tif (!reducedControlProp) return null\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ControlPropRow\n\t\t\t\t\t\t\tkey={controlKey}\n\t\t\t\t\t\t\tnodeIds={[preset.id]}\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\tcontrolKey={controlKey}\n\t\t\t\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\t\t\t\tonChange={changeHandler}\n\t\t\t\t\t\t\tonImageUpload={handleImageUpload}\n\t\t\t\t\t\t\tsupportsVariables={false}\n\t\t\t\t\t\t\tsupportsComputedValues={false}\n\t\t\t\t\t\t\ticons={getControlIcons(control, reducedControlProps)}\n\t\t\t\t\t\t\tscopeType={ScopeType.CanvasPage}\n\t\t\t\t\t\t\thiddenControlsByNodeId={hiddenStateByNodeId}\n\t\t\t\t\t\t\tcontrolSourceIdentifier={preset.componentIdentifier}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</Panel>\n\t\t</PresetPopoutContainer>\n\t)\n}\n", "import type { ReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport type {\n\tControlDescription,\n\tEnumControlDescription,\n\tSegmentedControlIcon,\n} from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\n\ntype IconSwitch = Exclude<EnumControlDescription[\"optionIcons\"], SegmentedControlIcon[] | undefined>\n\nfunction isIconSwitch(value: EnumControlDescription[\"optionIcons\"]): value is IconSwitch {\n\treturn isObject(value)\n}\n\nfunction staticSwitchToIconList(\n\ticons: IconSwitch,\n\tcodeComponentControlProps: ReducedControlProps,\n): SegmentedControlIcon[] | undefined {\n\ttry {\n\t\tconst keys = Object.keys(icons)\n\t\tconst expressionKey = keys[0]\n\t\tif (!isString(expressionKey)) return\n\t\tconst cases = icons[expressionKey]\n\t\tif (!isObject(cases)) return\n\t\tconst caseControlProp = codeComponentControlProps[expressionKey]\n\t\tif (!caseControlProp) return\n\t\tconst caseValue = caseControlProp[\"value\"]\n\t\tconst caseValueToString = `${caseValue}`\n\t\treturn cases[caseValueToString]\n\t} catch {\n\t\treturn\n\t}\n}\n\nconst memoizedIconsByKey: Map<string, SegmentedControlIcon[]> = new Map()\n\nexport function getControlIcons(\n\tcontrol: ControlDescription,\n\tcodeComponentControlProps: ReducedControlProps,\n): SegmentedControlIcon[] | undefined {\n\tif (control.type !== ControlType.Enum) return\n\tif (!isIconSwitch(control.optionIcons)) return\n\n\tconst controlIcons = staticSwitchToIconList(control.optionIcons, codeComponentControlProps)\n\tif (!controlIcons) return\n\n\tconst key = controlIcons.join(\",\")\n\tif (!memoizedIconsByKey.has(key)) {\n\t\tmemoizedIconsByKey.set(key, controlIcons)\n\t}\n\treturn memoizedIconsByKey.get(key)\n}\n", "import type { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport { reduceCornerShape, reducedCornerShapeDefaults } from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { getReducedRadiusDefaults, reduceRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport {\n\tgetReducedRadiusPerCornerDefaults,\n\treduceRadiusPerCorner,\n} from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { getReducedBorderDefaults, reduceBorder } from \"document/models/CanvasTree/traits/utils/reduceBorder.ts\"\nimport type { ReducedShadows } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport { reduceShadows } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport { useMemo } from \"react\"\nimport { BorderPanel } from \"./BorderPanel.tsx\"\nimport { CornerPanel } from \"./CornerPanel.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PresetPopoutContainer } from \"./PresetPopoutContainer.tsx\"\nimport { ShadowPanel } from \"./ShadowPanel.tsx\"\n\ninterface Props {\n\tpreset: ImageStylePresetNode\n}\n\nexport function EditImageStylePresetPopout({ preset }: Props) {\n\treturn (\n\t\t<PresetPopoutContainer withPanelHeader={false}>\n\t\t\t<Panel>\n\t\t\t\t<ImageStylePresetCornerRows preset={preset} />\n\t\t\t\t<ImageStylePresetBorderRow preset={preset} />\n\t\t\t\t<ImageStylePresetBoxShadowRow preset={preset} />\n\t\t\t</Panel>\n\t\t</PresetPopoutContainer>\n\t)\n}\n\ninterface RowProps {\n\tpreset: ImageStylePresetNode\n}\n\nfunction ImageStylePresetCornerRows({ preset }: RowProps) {\n\tconst reducedProps = useMemo(() => {\n\t\tconst result = {\n\t\t\t...getReducedRadiusDefaults(),\n\t\t\t...getReducedRadiusPerCornerDefaults(),\n\t\t\t...reducedCornerShapeDefaults,\n\t\t}\n\n\t\treduceRadius(preset, result)\n\t\treduceRadiusPerCorner(preset, result)\n\t\treduceCornerShape(preset, result)\n\n\t\treturn result\n\t}, [preset])\n\n\treturn (\n\t\t<CornerPanel\n\t\t\texpandedSelectionForShapeGeometryIds={[preset.id]}\n\t\t\tonlyBreakpointNodes={false}\n\t\t\tonlyRelativeRadiusNodes={false}\n\t\t\tradius={reducedProps.radius}\n\t\t\tradiusTopLeft={reducedProps.radiusTopLeft}\n\t\t\tradiusTopRight={reducedProps.radiusTopRight}\n\t\t\tradiusBottomRight={reducedProps.radiusBottomRight}\n\t\t\tradiusBottomLeft={reducedProps.radiusBottomLeft}\n\t\t\tradiusPerCorner={reducedProps.radiusPerCorner}\n\t\t\tcornerShape={reducedProps.cornerShape}\n\t\t\tshowUnconditionally\n\t\t/>\n\t)\n}\n\nfunction ImageStylePresetBorderRow({ preset }: RowProps) {\n\tconst reducedProps = useMemo(() => {\n\t\tconst result = getReducedBorderDefaults()\n\n\t\treduceBorder(preset, result)\n\n\t\treturn result\n\t}, [preset])\n\n\treturn (\n\t\t<BorderPanel\n\t\t\tnodeIds={[preset.id]}\n\t\t\tonlyBreakpointNodes={false}\n\t\t\tborderEnabled={reducedProps.borderEnabled}\n\t\t\tborderWidth={reducedProps.borderWidth}\n\t\t\tborderColor={reducedProps.borderColor}\n\t\t\tborderStyle={reducedProps.borderStyle}\n\t\t\tborderPerSide={reducedProps.borderPerSide}\n\t\t\tborderTop={reducedProps.borderTop}\n\t\t\tborderRight={reducedProps.borderRight}\n\t\t\tborderBottom={reducedProps.borderBottom}\n\t\t\tborderLeft={reducedProps.borderLeft}\n\t\t/>\n\t)\n}\n\nfunction ImageStylePresetBoxShadowRow({ preset }: RowProps) {\n\tconst reducedProps = useMemo(() => {\n\t\tconst result: ReducedShadows = {\n\t\t\tanyNodesWithShadows: false,\n\t\t\tshadows: NotFound,\n\t\t\tonlyNodesSupportingShadowSpread: true,\n\t\t\tonlyNodesSupportingRealisticShadows: true,\n\t\t\tonlyNodesSupportingShadowInset: true,\n\t\t}\n\n\t\treduceShadows(preset, result)\n\n\t\treturn result\n\t}, [preset])\n\n\treturn (\n\t\t<ShadowPanel\n\t\t\texpandedSelectionForShapeStylesIds={[preset.id]}\n\t\t\tanyShapeNode={false}\n\t\t\tonlyBreakpointNodes={false}\n\t\t\tdismissPopoutOnDrag={false}\n\t\t\tonlyShapeNodes={false}\n\t\t\tanyNodesWithShadows={reducedProps.anyNodesWithShadows}\n\t\t\tshadows={reducedProps.shadows}\n\t\t\tonlyNodesSupportingShadowSpread={reducedProps.onlyNodesSupportingShadowSpread}\n\t\t\tonlyNodesSupportingRealisticShadows={reducedProps.onlyNodesSupportingRealisticShadows}\n\t\t\tonlyNodesSupportingShadowInset={reducedProps.onlyNodesSupportingShadowInset}\n\t\t/>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { isComponentPresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport { EditComponentPresetPopout } from \"../panels/EditComponentPresetPopout.tsx\"\nimport type { ContextMenuOptions, SharedPresetRowProps } from \"./presetRowProps.ts\"\nimport { removePresetNode } from \"./removePresetNode.ts\"\n\nexport function createComponentPresetItemContextMenuItems(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get<ComponentPresetNode>(id)\n\tif (isNull(node)) return []\n\tif (!isComponentPresetNode(node)) return []\n\n\treturn createComponentPresetContextMenuItems(node, options)\n}\n\nexport function createComponentPresetContextMenuItems(\n\tpreset: ComponentPresetNode,\n\t{ startRenaming }: ContextMenuOptions,\n) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tfunction findNodes() {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.QuickActions,\n\t\t\tsource: \"styles_panel\",\n\t\t\tinitialCategory: {\n\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\toptions: {\n\t\t\t\t\ttype: FindNodesType.ComponentPreset,\n\t\t\t\t\ttitle: preset.resolveValue(\"name\") ?? Dictionary.Unknown,\n\t\t\t\t\tpresetId: preset.id,\n\t\t\t\t\tcomponentIdentifier: preset.componentIdentifier,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Find\",\n\t\t\tclick: findNodes,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Rename\",\n\t\t\tclick: startRenaming,\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Delete\",\n\t\t\tclick: () => removePresetNode(engine, preset.id),\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\t]\n}\n\nexport function getComponentPresetRowProps(preset: ComponentPresetNode): SharedPresetRowProps {\n\treturn {\n\t\tid: preset.id,\n\t\tname: preset.resolveValue(\"name\") ?? Dictionary.Unknown,\n\t\tpopoutContent: <EditComponentPresetPopout preset={preset} />,\n\t\twithPopoutDivider: true,\n\t\tcreateContextMenuItems(options) {\n\t\t\treturn createComponentPresetContextMenuItems(preset, options)\n\t\t},\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport {\n\tduplicateEntityReferenceNode,\n\tremoveNodeWithReference,\n} from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isImageStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { createImageStylePreset } from \"utils/imageStylePresetUtils.ts\"\nimport { canDeleteStylePreset } from \"utils/stylePresetUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport type { ContextMenuOptions } from \"./presetRowProps.ts\"\n\nexport function createImagePresetItemContextMenuItems(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get<ImageStylePresetNode>(id)\n\tif (isNull(node)) return []\n\tif (!isImageStylePresetNode(node)) return []\n\n\treturn createImageContextMenuItems(node, options)\n}\n\nexport function createImageContextMenuItems(preset: ImageStylePresetNode, { startRenaming }: ContextMenuOptions) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tfunction findNodes() {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.QuickActions,\n\t\t\tsource: \"styles_panel\",\n\t\t\tinitialCategory: {\n\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\toptions: {\n\t\t\t\t\ttype: FindNodesType.StylePreset,\n\t\t\t\t\ttitle: preset.getName(),\n\t\t\t\t\tpresetId: preset.id,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\tfunction duplicatePreset() {\n\t\tcreateImageStylePreset(engine, {\n\t\t\tname: preset.getName(),\n\t\t\timageStyle: preset.getImageStyle(),\n\t\t\tonCreate(newPreset) {\n\t\t\t\tduplicateEntityReferenceNode(engine, preset.id, newPreset.id)\n\t\t\t},\n\t\t})\n\t}\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Find\",\n\t\t\tclick: findNodes,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Rename\",\n\t\t\tclick: startRenaming,\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Duplicate\",\n\t\t\tclick: duplicatePreset,\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Delete\",\n\t\t\tclick: () => removeNodeWithReference(engine.tree, preset.id),\n\t\t\tenabled: !isViewOnly && canDeleteStylePreset(engine.stores.treeStore, preset),\n\t\t},\n\t]\n}\n", "import { NumberInputWithTicker, NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { experiments } from \"app/experiments.ts\"\nimport { getClosestToRegularFont } from \"document/components/utils/getClosestToRegularFont.ts\"\nimport engine from \"document/engine.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { reduceCornerShape, reducedCornerShapeDefaults } from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { inlineCodeStyleDefaults } from \"document/models/CanvasTree/traits/WithInlineCodeStyle.ts\"\nimport { getReducedRadiusDefaults, reduceRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport {\n\tgetReducedRadiusPerCornerDefaults,\n\treduceRadiusPerCorner,\n} from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { getReducedBorderDefaults, reduceBorder } from \"document/models/CanvasTree/traits/utils/reduceBorder.ts\"\nimport type { ReadonlyFont, ReadonlyFontFamily } from \"library/render/fonts/types.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { FontRow } from \"../rows/FontRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { TextColorRow } from \"../rows/TextColorRow.tsx\"\nimport { BorderPanel } from \"./BorderPanel.tsx\"\nimport { CornerPanel } from \"./CornerPanel.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PresetPopoutContainer } from \"./PresetPopoutContainer.tsx\"\nimport { getSimilarFontForSelector } from \"./utils/textStyle.ts\"\n\ninterface Props {\n\tpreset: InlineCodeStylePresetNode\n}\n\nexport function EditInlineCodeStylePresetPopout({ preset }: Props) {\n\treturn (\n\t\t<PresetPopoutContainer withPanelHeader={false}>\n\t\t\t<Panel>\n\t\t\t\t<InlineCodeStylePresetFontRow preset={preset} />\n\t\t\t\t<InlineCodeStylePresetFontSizeScaleRow preset={preset} />\n\t\t\t\t<InlineCodeStylePresetTextColorRow preset={preset} />\n\t\t\t\t<InlineCodeStylePresetFillColorRow preset={preset} />\n\t\t\t\t<InlineCodeStylePresetCornerRows preset={preset} />\n\t\t\t\t<InlineCodeStylePresetPaddingRow preset={preset} />\n\t\t\t\t<InlineCodeStylePresetBorderRow preset={preset} />\n\t\t\t</Panel>\n\t\t</PresetPopoutContainer>\n\t)\n}\n\ninterface RowProps {\n\tpreset: InlineCodeStylePresetNode\n}\n\nfunction InlineCodeStylePresetFontRow({ preset }: RowProps) {\n\tconst changeFont = engine.scheduler.wrapHandler(({ selector }: ReadonlyFont) => {\n\t\tengine.tree.current(preset)?.set({ inlineCodeFont: selector })\n\t})\n\n\tconst changeFontFamily = engine.scheduler.wrapHandler((fontFamily: ReadonlyFontFamily) => {\n\t\tconst defaultFont = getClosestToRegularFont(fontFamily)\n\t\tconst font = getSimilarFontForSelector(preset.inlineCodeFont, fontFamily) ?? defaultFont\n\n\t\tchangeFont(font)\n\t})\n\n\tconst onHighlightFontFamily = useCallback(\n\t\t(fontFamily: ReadonlyFontFamily) => {\n\t\t\tif (!experiments.isOn(\"fontPreviewStylePresets\")) return\n\n\t\t\tconst regularFontVariant = getClosestToRegularFont(fontFamily)\n\t\t\tconst closestFontVariant = getSimilarFontForSelector(preset.inlineCodeFont, fontFamily) ?? regularFontVariant\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.fontPreviewStore.enterPreviewForStylePreset(preset.id, closestFontVariant.selector)\n\t\t\t})\n\t\t},\n\t\t[preset.inlineCodeFont, preset.id],\n\t)\n\n\tconst onHighlightEnd = useCallback(() => {\n\t\tif (!experiments.isOn(\"fontPreviewStylePresets\")) return\n\n\t\tengine.scheduler.processWhenReady(engine.stores.fontPreviewStore.exitPreviewForStylePreset)\n\t}, [])\n\n\tconst selectedFonts = useMemo(() => {\n\t\treturn new Set([preset.inlineCodeFont])\n\t}, [preset.inlineCodeFont])\n\n\treturn (\n\t\t<FontRow\n\t\t\tpopoutIdentifier=\"inline-code-styles-preset-typeface\"\n\t\t\tselectedFonts={selectedFonts}\n\t\t\tonChange={changeFont}\n\t\t\tonChangeFontFamily={changeFontFamily}\n\t\t\tonHighlightFontFamily={onHighlightFontFamily}\n\t\t\tonHighlightEnd={onHighlightEnd}\n\t\t/>\n\t)\n}\n\nfunction InlineCodeStylePresetFontSizeScaleRow({ preset }: RowProps) {\n\tconst value = Math.round(preset.inlineCodeFontSizeScale * 100)\n\n\tconst changeFontSizeScale = engine.scheduler.wrapHandler((newFontSizeScale: number) => {\n\t\tengine.tree.current(preset)?.set({ inlineCodeFontSizeScale: newFontSizeScale / 100 })\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Size\">\n\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\tonChange={changeFontSizeScale}\n\t\t\t\tvalue={value}\n\t\t\t\tunit=\"%\"\n\t\t\t\tmin={50}\n\t\t\t\tmax={150}\n\t\t\t\tdefaultValue={inlineCodeStyleDefaults.inlineCodeFontSizeScale * 100}\n\t\t\t\tstep={1}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction InlineCodeStylePresetTextColorRow({ preset }: RowProps) {\n\tconst changeTextColor = engine.scheduler.wrapHandler((newTextColor: VariableReference | string) => {\n\t\tif (isVariableReference(newTextColor)) return\n\t\tengine.tree.current(preset)?.set({ inlineCodeTextColor: newTextColor })\n\t})\n\n\tconst deleteTextColor = engine.scheduler.wrapHandler(() => {\n\t\tengine.tree.current(preset)?.set({ inlineCodeTextColor: undefined })\n\t})\n\n\treturn (\n\t\t<TextColorRow\n\t\t\ttextColor={preset.inlineCodeTextColor}\n\t\t\tonChange={changeTextColor}\n\t\t\tonDelete={preset.inlineCodeTextColor !== undefined ? deleteTextColor : undefined}\n\t\t/>\n\t)\n}\n\nfunction InlineCodeStylePresetFillColorRow({ preset }: RowProps) {\n\tconst changeFillColor = engine.scheduler.wrapHandler((newFillColor?: string) => {\n\t\tengine.tree.current(preset)?.set({ inlineCodeFillColor: newFillColor })\n\t})\n\n\tfunction clearFillColor() {\n\t\tchangeFillColor(undefined)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Fill\">\n\t\t\t<ColorPopoutButton\n\t\t\t\tnavigationTitle=\"Fill\"\n\t\t\t\tvalue={preset.inlineCodeFillColor}\n\t\t\t\tonChange={changeFillColor}\n\t\t\t\tonDelete={isString(preset.inlineCodeFillColor) ? clearFillColor : undefined}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction InlineCodeStylePresetCornerRows({ preset }: RowProps) {\n\tconst reducedProps = useMemo(() => {\n\t\tconst result = {\n\t\t\t...getReducedRadiusDefaults(),\n\t\t\t...getReducedRadiusPerCornerDefaults(),\n\t\t\t...reducedCornerShapeDefaults,\n\t\t}\n\n\t\treduceRadius(preset, result)\n\t\treduceRadiusPerCorner(preset, result)\n\t\treduceCornerShape(preset, result)\n\n\t\treturn result\n\t}, [preset])\n\n\treturn (\n\t\t<CornerPanel\n\t\t\texpandedSelectionForShapeGeometryIds={[preset.id]}\n\t\t\tonlyBreakpointNodes={false}\n\t\t\tonlyRelativeRadiusNodes={false}\n\t\t\t{...reducedProps}\n\t\t\tshowUnconditionally\n\t\t/>\n\t)\n}\n\nfunction InlineCodeStylePresetPaddingRow({ preset }: RowProps) {\n\tconst changePaddingHorizontal = engine.scheduler.wrapHandler((newPadding: number) => {\n\t\tengine.tree.current(preset)?.set({ inlineCodePaddingHorizontal: newPadding })\n\t})\n\n\tconst changePaddingVertical = engine.scheduler.wrapHandler((newPadding: number) => {\n\t\tengine.tree.current(preset)?.set({ inlineCodePaddingVertical: newPadding })\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Padding\">\n\t\t\t<NumberInputWithTicker\n\t\t\t\tlabel=\"X\"\n\t\t\t\tmin={0}\n\t\t\t\tstep={0.1}\n\t\t\t\tdefaultValue={inlineCodeStyleDefaults.inlineCodePaddingHorizontal}\n\t\t\t\tvalue={preset.inlineCodePaddingHorizontal}\n\t\t\t\tonChange={changePaddingHorizontal}\n\t\t\t/>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tlabel=\"Y\"\n\t\t\t\tmin={0}\n\t\t\t\tstep={0.1}\n\t\t\t\tdefaultValue={inlineCodeStyleDefaults.inlineCodePaddingVertical}\n\t\t\t\tvalue={preset.inlineCodePaddingVertical}\n\t\t\t\tonChange={changePaddingVertical}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction InlineCodeStylePresetBorderRow({ preset }: RowProps) {\n\tconst reducedProps = useMemo(() => {\n\t\tconst result = getReducedBorderDefaults()\n\n\t\treduceBorder(preset, result)\n\n\t\treturn result\n\t}, [preset])\n\n\treturn <BorderPanel nodeIds={[preset.id]} onlyBreakpointNodes={false} {...reducedProps} />\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport {\n\tduplicateEntityReferenceNode,\n\tremoveNodeWithReference,\n} from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isInlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { createInlineCodeStylePreset } from \"utils/inlineCodeStylePresetUtils.ts\"\nimport { canDeleteStylePreset } from \"utils/stylePresetUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport type { AssetReferencePopoutContentProps } from \"../../assets/types.ts\"\nimport { EditInlineCodeStylePresetPopout } from \"../panels/EditInlineCodeStylePresetPopout.tsx\"\nimport type { ContextMenuOptions } from \"./presetRowProps.ts\"\n\nexport function createInlineCodeItemContextMenuItems(id: NodeID, options: ContextMenuOptions) {\n\tconst node = engine.tree.get<InlineCodeStylePresetNode>(id)\n\tif (isNull(node)) return []\n\tif (!isInlineCodeStylePresetNode(node)) return []\n\n\treturn createContextMenuItems(node, options)\n}\n\nfunction createContextMenuItems(preset: InlineCodeStylePresetNode, { startRenaming }: ContextMenuOptions) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tfunction findNodes() {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.QuickActions,\n\t\t\tsource: \"styles_panel\",\n\t\t\tinitialCategory: {\n\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\toptions: {\n\t\t\t\t\ttype: FindNodesType.StylePreset,\n\t\t\t\t\ttitle: preset.getName(),\n\t\t\t\t\tpresetId: preset.id,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\tfunction duplicatePreset() {\n\t\tcreateInlineCodeStylePreset(engine, {\n\t\t\tname: preset.getName(),\n\t\t\tinlineCodeStyle: preset.getInlineCodeStyle(),\n\t\t\tonCreate(newPreset) {\n\t\t\t\tduplicateEntityReferenceNode(engine, preset.id, newPreset.id)\n\t\t\t},\n\t\t})\n\t}\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Find\",\n\t\t\tclick: findNodes,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Rename\",\n\t\t\tclick: startRenaming,\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Duplicate\",\n\t\t\tclick: duplicatePreset,\n\t\t\tenabled: !isViewOnly,\n\t\t},\n\n\t\t{\n\t\t\tlabel: \"Delete\",\n\t\t\tclick: () => removeNodeWithReference(engine.tree, preset.id),\n\t\t\tenabled: !isViewOnly && canDeleteStylePreset(engine.stores.treeStore, preset),\n\t\t},\n\t]\n}\n\nexport function InlineCodeStylePresetPopoutContent({ referenceItemId }: AssetReferencePopoutContentProps) {\n\tconst node = useEngineState(\n\t\t() => {\n\t\t\treturn engine.tree.get<InlineCodeStylePresetNode>(referenceItemId)\n\t\t},\n\t\t[referenceItemId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tif (isNull(node) || !isInlineCodeStylePresetNode(node)) return null\n\n\treturn <EditInlineCodeStylePresetPopout preset={node} />\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport type { ComponentWithPreset } from \"utils/getComponentsWithPresets.ts\"\n\nexport type AssetRowComponentType = \"code\" | \"video\" | \"image\" | \"table\"\n\nexport function getComponentType(\n\tnode: ComponentPresetNode,\n\tcomponents?: ComponentWithPreset[],\n): AssetRowComponentType | undefined {\n\tconst component = components?.find(localComponent => localComponent.componentIdentifier === node.componentIdentifier)\n\n\tconst name = (component?.name ?? node.resolveValue(\"name\") ?? Dictionary.Unknown).toLowerCase()\n\tif (name?.includes(\"code\")) return \"code\"\n\tif (name?.includes(\"youtube\") || name?.includes(\"vimeo\")) return \"video\"\n}\n", "import { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { Badge, IconEntityFolder, IconLayerVector } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { palette } from \"@framerjs/fresco/tokens\"\nimport {\n\tassert,\n\ttype ExternalModuleExportIdentifierString,\n\tModuleType,\n\tasGlobalId,\n\tassertNever,\n\temptyArray,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tlocalModuleIdentifierForStableName,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport {\n\tisFramerVectorInfo,\n\tisFramerVectorSetInfo,\n\tisPublishedVectorSetInfo,\n} from \"code-generation/utils/annotations.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { DraggableComponentDataType } from \"document/components/canvas/CanvasDropZone.tsx\"\nimport { isBuiltInVectorSet, isUnlinkingDisabledOnNode } from \"document/components/unlinking/utils.ts\"\nimport { goToLocalSourceNode } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { buildEntityReferenceNodeId } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\tVectorSetEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport {\n\ttype ExternalModuleNode,\n\tExternalModulesListNode,\n} from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { VectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport {\n\tisEntityFolderNode,\n\tisExternalModuleNode,\n\tisVectorSetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { cx } from \"library/index.ts\"\nimport React, { useCallback, useMemo, useState } from \"react\"\nimport { copyImportURL } from \"utils/clipboard/helpers/copyModuleImports.ts\"\nimport { matchSubstring } from \"utils/searchUtils.ts\"\nimport { defaultIdentifierForLocalVectorSet, getVectorSetIdentifiers, getVectorSetName } from \"utils/vectorSets.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { FindNodesType, QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { IconAgentVectorSet } from \"../agentPanel/components/IconAgentVectorSet.tsx\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { HeaderActionItem } from \"../contentPanel/ContentPanelPagesTab.tsx\"\nimport { insertComponentNode } from \"../properties/utils/getComponentRowProps.ts\"\nimport type { ContextMenuOptions } from \"../properties/utils/presetRowProps.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { duplicateVectorSetNode } from \"../shared/utils/getComponentContextMenuItems.ts\"\nimport { isMultiSelectModifierKeyPressed } from \"../shared/utils/panelMultiSelect.ts\"\nimport { dataForExternalVectorSet } from \"./DraggableEntityItem.tsx\"\nimport * as assetStyles from \"./EntityAssetRow.styles.ts\"\nimport { EntityRow } from \"./EntityRow.tsx\"\nimport * as styles from \"./EntitySection.styles.ts\"\nimport type { EntitySectionProps } from \"./EntitySection.ts\"\nimport { ExternalAssetItemRow } from \"./ExternalAssetRow.tsx\"\nimport * as externalStyles from \"./ExternalComponents.styles.ts\"\nimport { createAndRenameFolderNode, createEntityReferenceNodeForRootType } from \"./actions/create.ts\"\nimport {\n\tcanDeleteVectorSetNode,\n\tdeleteEntityFolderNode,\n\tdeleteExternalVectorSetModule,\n\tdeleteLocalComponentScopeNode,\n} from \"./actions/delete.ts\"\nimport { insertCanvasNode } from \"./actions/insertCanvasNode.ts\"\nimport { sortEntityAssetsAlphabetically } from \"./actions/sort.ts\"\nimport { createMultiSelectContextMenu } from \"./utils/createMultiSelectContextMenu.ts\"\nimport { expandAssetEntityItemsFromNode } from \"./utils/expandAssetEntityItems.ts\"\nimport { getExternalAssetFolderId } from \"./utils/externalModuleFolderUtils.ts\"\nimport { getNodeName } from \"./utils/getNodeName.ts\"\nimport { createFolderFromSelection, createRenderOrderedGetter } from \"./utils/multiselect.ts\"\nimport { resolveContextMenuHandler } from \"./utils/resolveContextMenuHandler.ts\"\nimport { type AssetRow, useAssetPanelEntityRows } from \"./utils/useAssetPanelEntityRows.ts\"\n\nfunction useExternalVectorSets(searchQuery: string, expandedAssetEntityIds: ReadonlySet<NodeID>) {\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst sets: SetUpdates = new Map()\n\t\t\tconst publishedSets: Set<string> = new Set()\n\n\t\t\t// Iterate through external modules and reduce whether any Vectors have updates to a\n\t\t\t// single boolean per Vector Set.\n\t\t\tfor (const node of ExternalModulesListNode.getModuleNodes(engine.tree)) {\n\t\t\t\tif (!isExternalVectorNode(node)) continue\n\n\t\t\t\tconst folderName = node.group?.name || \"\"\n\t\t\t\tconst itemName = getNodeName(node)\n\t\t\t\tconst folderMatches = !searchQuery || matchSubstring(searchQuery, folderName)\n\t\t\t\tconst itemMatches = !searchQuery || matchSubstring(searchQuery, itemName)\n\n\t\t\t\tif (searchQuery && !folderMatches && !itemMatches) continue\n\n\t\t\t\tconst parsed = parseModuleIdentifier(node.codeComponentIdentifier)\n\t\t\t\tif (!isExternalModuleIdentifier(parsed)) continue\n\n\t\t\t\tconst hasUpdate = parsed.saveId !== node.updateSaveId\n\n\t\t\t\tswitch (node.type) {\n\t\t\t\t\tcase ModuleType.VectorSet: {\n\t\t\t\t\t\tconst info = node.annotation(AnnotationKey.FramerVectorSet)\n\t\t\t\t\t\tif (!isFramerVectorSetInfo(info)) continue\n\t\t\t\t\t\tconst isPublished = isPublishedVectorSetInfo(info)\n\t\t\t\t\t\tif (isPublished) publishedSets.add(node.id)\n\n\t\t\t\t\t\t// If the set is published, the update status is entirely based on the\n\t\t\t\t\t\t// vector set, not any vectors that may or may not have updated\n\t\t\t\t\t\t// versions.\n\t\t\t\t\t\tsets.set(node.id, isPublished ? hasUpdate : sets.get(node.id) || hasUpdate)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase ModuleType.Vector: {\n\t\t\t\t\t\tconst info = node.annotation(AnnotationKey.FramerVector)\n\t\t\t\t\t\tif (!isFramerVectorInfo(info)) continue\n\n\t\t\t\t\t\t// If the vector belongs to a published set, do not update the update\n\t\t\t\t\t\t// status of the set. Only the set can have updates.\n\t\t\t\t\t\tconst isPublished = publishedSets.has(info.set.moduleId)\n\t\t\t\t\t\tif (isPublished) continue\n\n\t\t\t\t\t\tsets.set(info.set.moduleId, sets.get(info.set.moduleId) || hasUpdate)\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(node.type)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst folders = new Map<string, Folder>()\n\t\t\tfor (const [id, hasUpdate] of sets) {\n\t\t\t\tconst node = engine.tree.getNodeWithTrait(id, isExternalModuleNode)\n\t\t\t\tif (!node) continue\n\n\t\t\t\tconst folderId = node.group?.id ?? DEFAULT_FOLDER_ID\n\t\t\t\tconst folderName = node.group?.name ?? DEFAULT_FOLDER_NAME\n\t\t\t\tconst itemName = getNodeName(node)\n\n\t\t\t\tconst folderMatches = !searchQuery || matchSubstring(searchQuery, folderName)\n\t\t\t\tconst itemMatches = !searchQuery || matchSubstring(searchQuery, itemName)\n\n\t\t\t\tconst folder = folders.get(folderId) ?? {\n\t\t\t\t\tid: folderId,\n\t\t\t\t\tname: folderName,\n\t\t\t\t\titems: [],\n\t\t\t\t\tupdates: 0,\n\t\t\t\t\tshouldAutoExpand: false,\n\t\t\t\t}\n\n\t\t\t\tif (hasUpdate) folder.updates++\n\n\t\t\t\tif (searchQuery && (folderMatches || itemMatches)) {\n\t\t\t\t\tfolder.shouldAutoExpand = true\n\t\t\t\t}\n\n\t\t\t\tfolder.items.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\tname: itemName,\n\t\t\t\t\thasUpdate,\n\t\t\t\t\texportIdentifier: node.codeComponentIdentifier,\n\t\t\t\t})\n\n\t\t\t\tfolders.set(folderId, folder)\n\t\t\t}\n\n\t\t\treturn Array.from(folders.values()).sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true }))\n\t\t},\n\t\t[searchQuery, expandedAssetEntityIds],\n\t\t[EngineChange.TreeStore],\n\t\t{ deepEqual: true },\n\t)\n}\n\nexport const EntityVectorSetsAssetSection = React.memo(function EntityVectorSetsAssetSection({\n\tisViewOnly,\n\tsearchQuery,\n\tselectedItemIds,\n\texpandedAssetEntityIds,\n\tonSelectItem,\n\tonClearSelection,\n\tlastSelectionTypeRootId,\n}: EntitySectionProps) {\n\tconst expanded = engine.stores.chromeStore.useState(state => state.vectorSetsExpanded)\n\n\tconst [state, toggleCollapse] = useAssetPanelEntityRows(\n\t\tsearchQuery,\n\t\texpandedAssetEntityIds,\n\t\tuseCallback(() => {\n\t\t\tconst entityRootNode = VectorSetEntityTypeRootNode.get(engine.tree)\n\t\t\tif (!entityRootNode) return null\n\n\t\t\tconst unreferenced: AssetRow[] = []\n\n\t\t\tconst rootMatchesSearch = entityRootNode && matchSubstring(searchQuery, getNodeName(entityRootNode))\n\n\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\tif (!isVectorSetNode(node)) continue\n\n\t\t\t\tconst maybeReferenceId = buildEntityReferenceNodeId(node.id)\n\t\t\t\tif (engine.tree.has(maybeReferenceId)) continue\n\n\t\t\t\tif (!rootMatchesSearch && !matchSubstring(searchQuery, node.resolveValue(\"name\") || \"\")) continue\n\n\t\t\t\tunreferenced.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttype: \"reference\",\n\t\t\t\t\t// If there are any local unreferenced vector sets they will be nested inside\n\t\t\t\t\t// the Project folder.\n\t\t\t\t\tdepth: 1,\n\t\t\t\t\ttitle: getNodeName(node),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tentityRootNode,\n\t\t\t\tunreferenced,\n\t\t\t\tincludeRoot: true,\n\t\t\t\ttree: engine.tree,\n\t\t\t}\n\t\t}, [searchQuery]),\n\t)\n\n\tconst externalFolders = useExternalVectorSets(searchQuery, expandedAssetEntityIds)\n\n\tconst handleSelectItem = useEngineCallback(\n\t\t(value: NodeID) => {\n\t\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return\n\n\t\t\tconst node = engine.tree.getNode(value)\n\t\t\tif (!node) return\n\n\t\t\tif (isVectorSetNode(node) && !isMultiSelectModifierKeyPressed()) {\n\t\t\t\tengine.stores.scopeStore.select(value, { keepHistory: false })\n\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t}\n\n\t\t\tonSelectItem(value, VECTOR_SET_ENTITY_TYPE_ROOT_ID, state.rows)\n\t\t},\n\t\t[onSelectItem, state.rows],\n\t)\n\n\tconst getOrderedIds = useMemo(() => createRenderOrderedGetter(state.rows), [state.rows])\n\n\tconst hasLocalItems = state.rows.length > 0\n\tconst hasExternalItems = externalFolders.length > 0\n\tconst hasItems = hasLocalItems || hasExternalItems\n\n\tconst createContextMenu = useCreateContextMenu(hasItems)\n\n\tconst multipleVectorSetContextMenuItems = useMemo(() => {\n\t\treturn getMultipleVectorSetContextMenuItems(onClearSelection)(selectedItemIds)\n\t}, [onClearSelection, selectedItemIds])\n\n\tconst contextMenuHandler = useMemo(\n\t\t() => resolveContextMenuHandler(selectedItemIds, getLocalVectorSetMenuItems, multipleVectorSetContextMenuItems),\n\t\t[selectedItemIds, multipleVectorSetContextMenuItems],\n\t)\n\n\tconst showVectorSets = expanded && hasItems\n\n\tif (searchQuery && !hasItems) return null\n\n\treturn (\n\t\t<>\n\t\t\t<ContentPanelHeader\n\t\t\t\ttitle=\"Vectors\"\n\t\t\t\ttoggleExpanded={engine.stores.chromeStore.toggleVectorSets}\n\t\t\t\tonRightClick={createContextMenu}\n\t\t\t\tinTabbedPanel\n\t\t\t\thasItems={hasItems}\n\t\t\t\theaderActionItem={\n\t\t\t\t\t<HeaderActionItem\n\t\t\t\t\t\ttitle={`Add ${Dictionary.Vector}`}\n\t\t\t\t\t\texpanded={expanded}\n\t\t\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcreateAction={createContextMenu}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\n\t\t\t{showVectorSets && (\n\t\t\t\t<div className={styles.sectionContent}>\n\t\t\t\t\t{state.rows.map(row => (\n\t\t\t\t\t\t<EntityRow\n\t\t\t\t\t\t\tkey={row.id}\n\t\t\t\t\t\t\ttype={row.type}\n\t\t\t\t\t\t\ttypeRootId={VECTOR_SET_ENTITY_TYPE_ROOT_ID}\n\t\t\t\t\t\t\tdepth={row.depth}\n\t\t\t\t\t\t\tid={row.id}\n\t\t\t\t\t\t\ttitle={row.title}\n\t\t\t\t\t\t\tselected={selectedItemIds.has(row.id)}\n\t\t\t\t\t\t\tcollapsed={row.collapsed}\n\t\t\t\t\t\t\tcolor={palette.blue60}\n\t\t\t\t\t\t\tonToggleCollapse={toggleCollapse}\n\t\t\t\t\t\t\tonSelectItem={handleSelectItem}\n\t\t\t\t\t\t\thasUnreferencedItems={state.hasUnreferencedItems}\n\t\t\t\t\t\t\treferenceCreateContextMenuItems={contextMenuHandler}\n\t\t\t\t\t\t\tselectedIds={selectedItemIds}\n\t\t\t\t\t\t\tgetOrderedIds={getOrderedIds}\n\t\t\t\t\t\t\tlastSelectionTypeRootId={lastSelectionTypeRootId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\n\t\t\t\t\t<ExternalVectorSets\n\t\t\t\t\t\texternalFolders={externalFolders}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\texpandedAssetEntityIds={expandedAssetEntityIds}\n\t\t\t\t\t\tsearchQuery={searchQuery}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nconst DEFAULT_FOLDER_ID = Dictionary.Other\nconst DEFAULT_FOLDER_NAME = Dictionary.Other\n\nfunction isExternalVectorNode(\n\tnode: ExternalModuleNode,\n): node is ExternalModuleNode & { type: ModuleType.Vector | ModuleType.VectorSet } {\n\treturn node.type === ModuleType.Vector || node.type === ModuleType.VectorSet\n}\n\ninterface Folder {\n\tid: NodeID\n\tname: string\n\titems: Item[]\n\tupdates: number\n\tshouldAutoExpand?: boolean\n}\n\ninterface Item {\n\tid: NodeID\n\tname: string\n\thasUpdate: boolean\n\texportIdentifier: ExternalModuleExportIdentifierString\n}\n\ntype HasUpdate = boolean\ntype SetUpdates = Map<NodeID, HasUpdate>\n\nconst emptyCollapsedSet: ReadonlySet<NodeID> = new Set()\n\nconst ExternalVectorSets = React.memo(function ExternalVectorSets({\n\tisViewOnly,\n\texternalFolders,\n\texpandedAssetEntityIds,\n\tsearchQuery,\n}: {\n\tisViewOnly: boolean\n\texternalFolders: Folder[]\n\texpandedAssetEntityIds: ReadonlySet<NodeID>\n\tsearchQuery: string\n}) {\n\tconst [collapsedDuringSearch, setCollapsedDuringSearch] = useState<ReadonlySet<NodeID>>(() => emptyCollapsedSet)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tif (!searchQuery && collapsedDuringSearch.size > 0) {\n\t\t// Setting state during a render instead of an effect, as recommended for such cases:\n\t\t// https://react.dev/learn/you-might-not-need-an-effect#adjusting-some-state-when-a-prop-changes\n\t\tsetCollapsedDuringSearch(emptyCollapsedSet)\n\t}\n\n\tconst handleToggleCollapse = useCallback(\n\t\t(id: NodeID) => {\n\t\t\tif (searchQuery) {\n\t\t\t\tsetCollapsedDuringSearch(prev => {\n\t\t\t\t\tconst newSet = new Set(prev)\n\t\t\t\t\tif (newSet.has(id)) {\n\t\t\t\t\t\tnewSet.delete(id)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewSet.add(id)\n\t\t\t\t\t}\n\t\t\t\t\treturn newSet\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tengine.stores.chromeStore.toggleAssetEntityItem(getExternalAssetFolderId(id, ModuleType.VectorSet), false)\n\t\t\t}\n\t\t},\n\t\t[searchQuery],\n\t)\n\n\tconst getFolderCollapseState = useCallback(\n\t\t(folder: Folder) => {\n\t\t\tif (!searchQuery) {\n\t\t\t\treturn !expandedAssetEntityIds.has(getExternalAssetFolderId(folder.id, ModuleType.VectorSet))\n\t\t\t}\n\n\t\t\tif (!folder.shouldAutoExpand) {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\treturn collapsedDuringSearch.has(folder.id)\n\t\t},\n\t\t[searchQuery, expandedAssetEntityIds, collapsedDuringSearch],\n\t)\n\n\treturn (\n\t\t<div className={assetStyles.externalVectors}>\n\t\t\t{externalFolders.map(folder => (\n\t\t\t\t<ExternalVectorAssetFolderRow\n\t\t\t\t\tkey={folder.id}\n\t\t\t\t\tid={folder.id}\n\t\t\t\t\ttitle={folder.name}\n\t\t\t\t\titems={folder.items}\n\t\t\t\t\tupdates={folder.updates}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tisCollapsed={getFolderCollapseState(folder)}\n\t\t\t\t\ttoggleCollapse={() => handleToggleCollapse(folder.id)}\n\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</div>\n\t)\n})\n\ninterface ExternalComponentAssetFolderRowProps {\n\tid: string\n\ttitle: string\n\titems: Item[]\n\tupdates: number\n\tisViewOnly: boolean\n\tisCollapsed: boolean\n\ttoggleCollapse: () => void\n\tagentExperimentEnabled: boolean\n}\n\nfunction onUpdate(exportIdentifier: ExternalModuleExportIdentifierString) {\n\treturn updateExternalVectorSet(parseModuleIdentifier(exportIdentifier).moduleId)\n}\n\nfunction onDragStart(event: DraggableEvent, exportIdentifier: ExternalModuleExportIdentifierString): void {\n\tconst data = dataForExternalVectorSet(engine.tree, parseModuleIdentifier(exportIdentifier).moduleId)\n\tif (!data) return\n\tevent.dataTransfer.setData(DraggableComponentDataType, data)\n}\n\nfunction insertExternalVectorSet(id: NodeID) {\n\tconst data = dataForExternalVectorSet(engine.tree, id)\n\tif (!data?.component) return\n\tinsertCanvasNode({ vekterEngine: engine, component: data.component })\n}\n\nfunction getExternalVectorSetMenuItems(id: NodeID) {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tconst allowsUnlinking = !isBuiltInVectorSet(id) && !isUnlinkingDisabledOnNode(engine, id)\n\n\tconst menuItems: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: Dictionary.Insert,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => insertExternalVectorSet(id),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Unlink,\n\t\t\tenabled: !isViewOnly && allowsUnlinking,\n\t\t\tclick: () => {\n\t\t\t\tconst node = engine.tree.getNodeWithTrait(id, isExternalModuleNode)\n\t\t\t\tif (!node) return\n\n\t\t\t\tconst setInfo = node.annotation(AnnotationKey.FramerVectorSet)\n\t\t\t\tif (!isFramerVectorSetInfo(setInfo)) return\n\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.VectorSetUnlink,\n\t\t\t\t\tsource: \"assets_panel\",\n\t\t\t\t\tvectorSetNodeId: id,\n\t\t\t\t\titemCount: setInfo.items.length,\n\t\t\t\t\tonSuccess: (vectorSet: VectorSetNode) => {\n\t\t\t\t\t\tengine.stores.selectionStore.set([vectorSet])\n\t\t\t\t\t\tengine.stores.scopeStore.select(vectorSet.id, { keepHistory: false })\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.Find,\n\t\t\tclick: () => {\n\t\t\t\tconst node = engine.tree.get(id)\n\t\t\t\tif (!node) return\n\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\t\tsource: \"components_panel\",\n\t\t\t\t\tinitialCategory: {\n\t\t\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttype: FindNodesType.VectorSet,\n\t\t\t\t\t\t\ttitle: getVectorSetName(node),\n\t\t\t\t\t\t\tcomponentIdentifier: getVectorSetIdentifiers(engine, id),\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\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: isViewOnly ? false : () => canDeleteVectorSetNode(engine, id),\n\t\t\tclick: () => deleteExternalVectorSetModule(engine, id),\n\t\t},\n\t]\n\treturn menuItems\n}\n\nconst ExternalVectorAssetFolderRow = React.memo(function ExternalVectorAssetFolderRow({\n\tid,\n\ttitle,\n\titems,\n\tupdates,\n\tisViewOnly,\n\tisCollapsed,\n\ttoggleCollapse,\n\tagentExperimentEnabled,\n}: ExternalComponentAssetFolderRowProps) {\n\treturn (\n\t\t<>\n\t\t\t<CollapsibleRow\n\t\t\t\tid={id}\n\t\t\t\ttitle={title}\n\t\t\t\tdepth={0}\n\t\t\t\tIcon={<IconEntityFolder className={assetStyles.icon} />}\n\t\t\t\twithCollapse\n\t\t\t\tisCollapsible\n\t\t\t\tisCollapsed={isCollapsed}\n\t\t\t\ttoggleCollapse={toggleCollapse}\n\t\t\t\tisEditable={false}\n\t\t\t\ttitleCanTriggerCollapse\n\t\t\t\ttrailingElementOverride={\n\t\t\t\t\tisCollapsed &&\n\t\t\t\t\tupdates > 0 && <Badge className={cx(externalStyles.badge, assetStyles.vectorBadge)}>{updates}</Badge>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{!isCollapsed &&\n\t\t\t\titems.map(item => (\n\t\t\t\t\t<ExternalAssetItemRow\n\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\ttitle={item.name}\n\t\t\t\t\t\texportIdentifier={item.exportIdentifier}\n\t\t\t\t\t\thasUpdate={item.hasUpdate}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tIcon={getExternalVectorSetIcon(agentExperimentEnabled)}\n\t\t\t\t\t\tonUpdate={onUpdate}\n\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\tgetMenuOptions={getExternalVectorSetMenuItems}\n\t\t\t\t\t\tupdateButtonClassName={assetStyles.vectorBadge}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t</>\n\t)\n})\n\nfunction getExternalVectorSetIcon(agentExperimentEnabled: boolean) {\n\tif (agentExperimentEnabled) return <IconAgentVectorSet className={assetStyles.blue} />\n\treturn <IconLayerVector className={assetStyles.blue} />\n}\n\nasync function updateExternalVectorSet(id: NodeID) {\n\tconst node = engine.tree.getNodeWithTrait(id, isExternalModuleNode)\n\tif (!node || !isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\n\tconst parsed = node.annotation(AnnotationKey.FramerVectorSet)\n\tif (!isFramerVectorSetInfo(parsed)) return\n\n\t// If the vector set hasn't changed, we can just update the vector set items\n\tif (node.updateSaveId === parseModuleIdentifier(node.codeComponentIdentifier).saveId) {\n\t\t// If the vector set is published, we don't need to do anything because we should have already updated the vectors when we updated the set.\n\t\tif (isPublishedVectorSetInfo(parsed)) return\n\t\t// If the set isn't published, we just want the latest saveid for each module.\n\t\tawait engine.stores.modulesStore.addOrUpdateExternalVectors(\n\t\t\tparsed.items.map(info => ({ moduleId: asGlobalId(info.moduleId), saveId: \"\" })),\n\t\t)\n\t} else {\n\t\t// Otherwise, we need to update the vector set node, followed by the vector set items to ensure\n\t\t// we add new items documented in the latest vector set annotations.\n\t\tawait engine.stores.modulesStore.addOrUpdateVectorSetAndVectors({\n\t\t\tmoduleId: asGlobalId(node.id),\n\t\t\tsaveId: node.updateSaveId,\n\t\t})\n\t}\n}\n\nfunction getLocalVectorSetMenuItems(id: NodeID, options: ContextMenuOptions): readonly MenuItemOptions[] {\n\tconst node = engine.tree.get(id)\n\tif (!isVectorSetNode(node)) return emptyArray<MenuItemOptions>()\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\tconst deleteEnabled = isViewOnly ? false : () => canDeleteVectorSetNode(engine, id)\n\tconst defaultItem = defaultIdentifierForLocalVectorSet(id, engine.stores.modulesStore)\n\tif (!defaultItem) return emptyArray<MenuItemOptions>()\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.Insert,\n\t\t\tenabled:\n\t\t\t\t!isViewOnly && id !== engine.stores.scopeStore.active.id && !engine.stores.codeEditorStore.currentCodeFileId,\n\t\t\tclick: async () => {\n\t\t\t\tconst loadedSet = node.isLoaded() ? node : await node.load()\n\t\t\t\tassert(isVectorSetNode(loadedSet), \"Vector set must be loaded.\")\n\t\t\t\tconst defaultVectorSetItem = loadedSet.children?.find(child => isVectorSetItem(child))\n\t\t\t\tif (!defaultVectorSetItem) return\n\n\t\t\t\tinsertComponentNode(\n\t\t\t\t\tlocalModuleIdentifierForStableName(ModuleType.Vector, defaultVectorSetItem.id, \"default\").value,\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: isViewOnly ? Dictionary.View : Dictionary.Edit,\n\t\t\tclick: () => {\n\t\t\t\tgoToLocalSourceNode(id, engine, null, { keepHistory: false })\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Find,\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\tsource: \"components_panel\",\n\t\t\t\t\tinitialCategory: {\n\t\t\t\t\t\ttype: QuickActionsCategoryType.FindNodes,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttype: FindNodesType.VectorSet,\n\t\t\t\t\t\t\ttitle: getVectorSetName(node),\n\t\t\t\t\t\t\tcomponentIdentifier: getVectorSetIdentifiers(engine, id),\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\t{\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: options.startRenaming,\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: async () => {\n\t\t\t\tconst vectorSet = engine.tree.get(id)\n\t\t\t\tif (!isScopeNode(vectorSet, true)) return\n\t\t\t\tconst loadedVectorSet = vectorSet.isLoaded() ? vectorSet : await vectorSet.load()\n\t\t\t\tif (!isVectorSetNode(loadedVectorSet)) return\n\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tconst newNode = duplicateVectorSetNode(engine.tree, engine.componentLoader, loadedVectorSet)\n\t\t\t\t\tengine.stores.scopeStore.select(newNode.id, { keepHistory: false })\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tenabled: deleteEnabled,\n\t\t\tclick: () => {\n\t\t\t\tvoid deleteLocalComponentScopeNode(engine, id)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.CopyUrl,\n\t\t\tclick: () => copyImportURL(engine, defaultItem, false),\n\t\t},\n\t]\n}\n\nfunction getMultipleVectorSetContextMenuItems(onClearSelection: () => void) {\n\treturn createMultiSelectContextMenu({\n\t\ttypeRootId: VECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\t\tnewFolder: {\n\t\t\thandler: createFolderFromSelection(onClearSelection, VECTOR_SET_ENTITY_TYPE_ROOT_ID),\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t\tinsert: {\n\t\t\thandler: async (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isVectorSetNode(node)) continue\n\n\t\t\t\t\tconst loadedSet = node.isLoaded() ? node : await node.load()\n\t\t\t\t\tassert(isVectorSetNode(loadedSet), \"Vector set must be loaded.\")\n\t\t\t\t\tconst defaultVectorSetItem = loadedSet.children?.find(child => isVectorSetItem(child))\n\t\t\t\t\tif (!defaultVectorSetItem) return\n\n\t\t\t\t\tinsertComponentNode(\n\t\t\t\t\t\tlocalModuleIdentifierForStableName(ModuleType.Vector, defaultVectorSetItem.id, \"default\").value,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tduplicate: {\n\t\t\thandler: async (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node || !isVectorSetNode(node)) continue\n\n\t\t\t\t\tif (!isScopeNode(node, true)) return\n\t\t\t\t\tconst loadedVectorSet = node.isLoaded() ? node : await node.load()\n\t\t\t\t\tif (!isVectorSetNode(loadedVectorSet)) return\n\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tduplicateVectorSetNode(engine.tree, engine.componentLoader, loadedVectorSet)\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: true,\n\t\t},\n\t\tdelete: {\n\t\t\thandler: (nodeIds: ReadonlySet<NodeID>) => {\n\t\t\t\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\t\t\t\tif (isViewOnly) return\n\n\t\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\t\tif (!node) continue\n\t\t\t\t\tif (isEntityFolderNode(node)) {\n\t\t\t\t\t\tvoid deleteEntityFolderNode(engine, node)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isVectorSetNode(node)) continue\n\t\t\t\t\tvoid deleteLocalComponentScopeNode(engine, nodeId)\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisabledByFolders: false,\n\t\t},\n\t})\n}\n\nfunction contextMenu({ sortAlphabetically }: { sortAlphabetically: boolean }): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\treturn [\n\t\t{\n\t\t\tlabel: Dictionary.NewVectorSet,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () =>\n\t\t\t\tcreateEntityReferenceNodeForRootType(engine, {\n\t\t\t\t\trootType: VECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\t\t\t\t\tonDone: (id: NodeID) => {\n\t\t\t\t\t\texpandAssetEntityItemsFromNode(engine, id, VECTOR_SET_ENTITY_TYPE_ROOT_ID, false)\n\t\t\t\t\t\tengine.stores.scopeStore.select(id, { keepHistory: false })\n\t\t\t\t\t\tengine.stores.codeEditorStore.closeEditor()\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.NewFolder,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => createAndRenameFolderNode(engine, VECTOR_SET_ENTITY_TYPE_ROOT_ID, false),\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.SortAlphabetically,\n\t\t\tvisible: sortAlphabetically,\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => sortEntityAssetsAlphabetically(engine, VECTOR_SET_ENTITY_TYPE_ROOT_ID),\n\t\t},\n\t]\n}\n\nfunction useCreateContextMenu(hasItems: boolean) {\n\treturn useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tengine.stores.contextMenuStore.show(contextMenu({ sortAlphabetically: hasItems }), {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: event.clientX,\n\t\t\t\t\ty: event.clientY,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[hasItems],\n\t)\n}\n", "import \"TabbedContentPanel.styles_ro9ts4.wyw.css\"; export const header = \"header_hgjxkia\";", "import {\n\tCenterChild,\n\tEmptyState,\n\tIconChevronRight,\n\tScroll,\n\tSearchBar,\n\tSpinner,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { ActiveLeftPanel } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { performMainMenuAction } from \"../QuickActions/utils/useMainMenuActions.ts\"\nimport { AiSidebarContent } from \"../aiSidebar/AiSidebar.tsx\"\nimport { NoCollectionsEmptyState } from \"../contentManagement/NoCollectionsEmptyState.tsx\"\nimport * as leftPanelStyles from \"../leftPanel/LeftPanel.styles.ts\"\nimport { LeftPanel } from \"../leftPanel/LeftPanel.tsx\"\nimport * as agentInputStyles from \"../shared/AgentSearchBar.styles.ts\"\nimport { getNoSearchResultProps } from \"../shared/utils/getNoSearchResultProps.ts\"\nimport { GroupTitle } from \"./GroupTitle.tsx\"\nimport * as styles from \"./InsertSidebar.styles.ts\"\nimport { InsertSidebarItems } from \"./InsertSidebarItems.tsx\"\nimport { InsertSidebarKitSections } from \"./InsertSidebarKitSections.tsx\"\nimport { InsertSidebarSection } from \"./InsertSidebarSection.tsx\"\nimport { useCollectionListSection, useCollectionPageSection } from \"./collectionSections.ts\"\nimport { useRestoreScrollOffset } from \"./hooks/useRestoreScrollOffset.ts\"\nimport type {\n\tCategory,\n\tCategoryTypes,\n\tDataSourceCategory,\n\tDataSourceItem,\n\tDataSourceSection,\n\tHoverEffect,\n\tSearchResults,\n} from \"./types.ts\"\nimport { NavigationBehavior, itemsAreDataSourceSections } from \"./types.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\n\nexport const InsertSidebar = React.memo(function InsertSidebar() {\n\tconst { chromeStore, insertSidebarStore } = engine.stores\n\tconst { leftPanel, chromeIsVisible, insertSidebarHasBeenVisible } = chromeStore.useState()\n\tconst { activeCategoryType, categories } = insertSidebarStore.useState()\n\n\tconst visible = leftPanel === ActiveLeftPanel.Insert && chromeIsVisible\n\n\tif (!insertSidebarHasBeenVisible) return null\n\n\tconst activeCategory = categories?.find(\n\t\t(category): category is DataSourceCategory => category.type === activeCategoryType,\n\t)\n\n\tinsertSidebarStore.loadIfNeeded()\n\n\treturn (\n\t\t<>\n\t\t\t<LeftPanel hiddenWithoutUnmounting={!visible}>\n\t\t\t\t{activeCategory?.navigationBehavior === NavigationBehavior.Replace ? (\n\t\t\t\t\t<InsertSidebarCategoryContent visible={visible} activeCategory={activeCategory} />\n\t\t\t\t) : (\n\t\t\t\t\t<InsertSidebarContent visible={visible} />\n\t\t\t\t)}\n\t\t\t</LeftPanel>\n\n\t\t\t{activeCategory?.navigationBehavior === NavigationBehavior.Push && (\n\t\t\t\t<InsertSidebarCategoryContent visible={visible} activeCategory={activeCategory} />\n\t\t\t)}\n\t\t</>\n\t)\n})\n\ninterface InsertSidebarContentProps {\n\tvisible: boolean\n}\n\nfunction InsertSidebarContent({ visible }: InsertSidebarContentProps) {\n\tconst { insertSidebarStore, chromeStore } = engine.stores\n\tconst { isLoaded, categories, search, searchResults, activeCategoryType } = insertSidebarStore.useState()\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst searchRef = React.useRef<HTMLInputElement>(null)\n\n\tReact.useEffect(() => {\n\t\tif (!visible) return\n\t\tsearchRef.current?.focus()\n\t\tif (engine.isRemountingUI()) return\n\t\trecord(\"ui_impression\", { page: Pages.insertSidebar })\n\t}, [visible])\n\n\tconst searchKeyDownHandler = React.useCallback((event: React.KeyboardEvent) => {\n\t\tif (event.key === \"Escape\") {\n\t\t\tchromeStore.hideInsertSidebar()\n\t\t}\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\tif (!searchResults) return\n\n\t\tconst debounce = setTimeout(() => {\n\t\t\tconst trackingValues = { searchValue: search, educationItemsReturned: 0, canvasItemsReturned: 0 }\n\n\t\t\tfor (const result of searchResults) {\n\t\t\t\ttrackingValues.canvasItemsReturned += result.items.length\n\t\t\t}\n\n\t\t\trecord(\"insert_sidebar_search\", trackingValues)\n\t\t}, 300)\n\n\t\treturn () => {\n\t\t\tclearTimeout(debounce)\n\t\t}\n\t}, [search, searchResults])\n\n\tif (!isLoaded || !categories) return visible ? <Spinner /> : null\n\n\treturn (\n\t\t<Scroll\n\t\t\tclassName={cx(styles.scroll, searchResults && styles.searchResultsWrapper, !searchResults && styles.categories)}\n\t\t>\n\t\t\t<CenterChild className={styles.floatingHeader}>\n\t\t\t\t<SearchBar\n\t\t\t\t\tref={searchRef}\n\t\t\t\t\tclassName={cx(styles.searchInputWrapper, agentEnabled && agentInputStyles.agentInputWrapper)}\n\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\tvalue={search}\n\t\t\t\t\tonChange={insertSidebarStore.updateSearch}\n\t\t\t\t\tonKeyDown={searchKeyDownHandler}\n\t\t\t\t\tshowClearButton\n\t\t\t\t/>\n\t\t\t</CenterChild>\n\t\t\t{searchResults ? (\n\t\t\t\trenderSearchResults(searchResults, !agentEnabled)\n\t\t\t) : (\n\t\t\t\t<SectionCategories activeCategoryType={activeCategoryType} categories={categories} />\n\t\t\t)}\n\t\t</Scroll>\n\t)\n}\n\ninterface InsertSidebarCategoryContentProps {\n\tvisible: boolean\n\tactiveCategory: DataSourceCategory\n}\n\nfunction InsertSidebarCategoryContent({ visible, activeCategory }: InsertSidebarCategoryContentProps) {\n\tconst { insertSidebarStore } = engine.stores\n\tconst { activeCategoryType, categories } = insertSidebarStore.useState()\n\tconst kitsEnabled = useExperimentIsOn(\"wireframerKits\")\n\n\tconst isVisible = Boolean(visible && categories && activeCategoryType)\n\n\tif (!categories || !activeCategoryType) return null\n\tif (!activeCategory.items) return null\n\n\tconst { navigationBehavior } = activeCategory\n\n\tif (kitsEnabled && activeCategoryType === \"kitSections\") {\n\t\treturn (\n\t\t\t<InsertSidebarKitSections\n\t\t\t\tvisible={isVisible}\n\t\t\t\tnavigationBehavior={navigationBehavior}\n\t\t\t\tshouldIgnoreTint={activeCategory.shouldIgnoreTint}\n\t\t\t\thoverEffect={activeCategory.hoverEffect}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (!kitsEnabled && activeCategoryType === \"wireframer\") return <AiSidebarContent visible={isVisible} />\n\n\tif (activeCategoryType === \"cmsCollectionList\") {\n\t\treturn <InsertSidebarCollectionList visible={isVisible} navigationBehavior={navigationBehavior} />\n\t}\n\n\tif (activeCategoryType === \"cmsContentFields\") {\n\t\treturn <InsertSidebarCollectionFields visible={isVisible} navigationBehavior={navigationBehavior} />\n\t}\n\n\treturn (\n\t\t<InsertSidebarContentPanel\n\t\t\titems={activeCategory.items}\n\t\t\tshouldIgnoreTint={activeCategory.shouldIgnoreTint}\n\t\t\thoverEffect={activeCategory.hoverEffect}\n\t\t\tvisible={isVisible}\n\t\t\tactiveCategory={activeCategoryType}\n\t\t\tnavigationBehavior={navigationBehavior}\n\t\t/>\n\t)\n}\n\ninterface InsertSidebarCollectionProps {\n\tvisible: boolean\n\tnavigationBehavior: NavigationBehavior\n}\n\nfunction InsertSidebarCollectionList({ visible, navigationBehavior }: InsertSidebarCollectionProps) {\n\tconst collectionListSection = useCollectionListSection()\n\tconst sections: DataSourceSection[] = []\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\tif (collectionListSection) sections.push(collectionListSection)\n\n\treturn (\n\t\t<InsertSidebarContentPanel\n\t\t\titems={sections}\n\t\t\tshouldIgnoreTint={false}\n\t\t\tvisible={visible}\n\t\t\temptyState={<NoCollectionsEmptyState type=\"noCollection\" secondaryActions={agentEnabled} />}\n\t\t\thoverEffect=\"highlight\"\n\t\t\tactiveCategory=\"cmsCollectionList\"\n\t\t\tnavigationBehavior={navigationBehavior}\n\t\t/>\n\t)\n}\n\nfunction InsertSidebarCollectionFields({ visible, navigationBehavior }: InsertSidebarCollectionProps) {\n\tconst sections: DataSourceSection[] = []\n\tconst collectionPageSection = useCollectionPageSection()\n\tif (collectionPageSection) sections.push(collectionPageSection)\n\n\treturn (\n\t\t<InsertSidebarContentPanel\n\t\t\titems={sections}\n\t\t\tshouldIgnoreTint={false}\n\t\t\tvisible={visible}\n\t\t\temptyState={<NoCollectionsEmptyState type=\"noCollectionFields\" />}\n\t\t\thoverEffect=\"highlight\"\n\t\t\tactiveCategory=\"cmsContentFields\"\n\t\t\tnavigationBehavior={navigationBehavior}\n\t\t/>\n\t)\n}\n\nfunction CategoryContent({\n\tactiveCategory,\n\titems,\n\tshouldIgnoreTint,\n\thoverEffect,\n\tvisible,\n}: {\n\tactiveCategory: Category\n\titems: DataSourceItem[] | DataSourceSection[]\n\tshouldIgnoreTint: boolean\n\thoverEffect: HoverEffect\n\tvisible: boolean\n}) {\n\tconst scrollRef = useRestoreScrollOffset(activeCategory, visible)\n\n\tif (itemsAreDataSourceSections(items)) {\n\t\treturn (\n\t\t\t<Scroll ref={scrollRef} className={styles.scroll}>\n\t\t\t\t<InsertSidebarSection sections={items} ignoreTint={shouldIgnoreTint} hoverEffect={hoverEffect} />\n\t\t\t</Scroll>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Scroll ref={scrollRef} className={styles.scroll}>\n\t\t\t<InsertSidebarItems items={items} ignoreTint={shouldIgnoreTint} hoverEffect={hoverEffect} />\n\t\t</Scroll>\n\t)\n}\n\ninterface InsertSidebarContentPanelProps {\n\tactiveCategory: Category\n\titems: DataSourceItem[] | DataSourceSection[]\n\tvisible: boolean\n\tshouldIgnoreTint: boolean\n\thoverEffect: HoverEffect\n\temptyState?: React.ReactNode\n\tnavigationBehavior: NavigationBehavior\n}\n\nfunction InsertSidebarContentPanel({\n\tactiveCategory,\n\titems,\n\tvisible,\n\tnavigationBehavior,\n\tshouldIgnoreTint,\n\thoverEffect,\n\temptyState,\n}: InsertSidebarContentPanelProps) {\n\tconst ref = React.useRef<HTMLDivElement>(null)\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.categoryContent,\n\t\t\t\tnavigationBehavior === NavigationBehavior.Push && styles.pushedCategoryContent,\n\t\t\t\t!visible && leftPanelStyles.leftPanelHidden,\n\t\t\t\tappPointerEvents,\n\t\t\t)}\n\t\t>\n\t\t\t{emptyState && items.length === 0 ? (\n\t\t\t\temptyState\n\t\t\t) : (\n\t\t\t\t<CategoryContent\n\t\t\t\t\tactiveCategory={activeCategory}\n\t\t\t\t\titems={items}\n\t\t\t\t\tshouldIgnoreTint={shouldIgnoreTint}\n\t\t\t\t\thoverEffect={hoverEffect}\n\t\t\t\t\tvisible={visible}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction setSafeZoneVisible(safeZoneRef: React.RefObject<HTMLDivElement>) {\n\tsafeZoneRef.current?.classList.add(\"enabled\")\n}\n\nfunction setSafeZoneHidden(safeZoneRef: React.RefObject<HTMLDivElement>) {\n\tsafeZoneRef.current?.classList.remove(\"enabled\")\n}\n\nconst enableSafeZoneWithTimeout = (() => {\n\tlet timer: number | undefined\n\treturn (safeZoneRef: React.RefObject<HTMLDivElement>) => {\n\t\tclearTimeout(timer)\n\t\tsetSafeZoneVisible(safeZoneRef)\n\t\ttimer = window.setTimeout(() => {\n\t\t\tsetSafeZoneHidden(safeZoneRef)\n\t\t}, 80)\n\t}\n})()\n\ninterface SectionCategoryProps {\n\tcategory: DataSourceCategory\n\tselected: boolean\n\tonMouseMove: (event: React.MouseEvent, category: DataSourceCategory) => void\n\tnavigationBehavior: NavigationBehavior\n}\n\nconst SectionCategory = React.memo(function SectionCategory({ category, selected, onMouseMove }: SectionCategoryProps) {\n\tconst { appAction, navigationBehavior } = category\n\tconst { insertSidebarStore } = engine.stores\n\n\t// The sidebar has to be reloaded for the experiment to take effect,\n\t// so not using the hook here to prevent a mixed state.\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\tconst shadersEnabled = useExperimentIsOn(\"shaders\")\n\n\tconst activeCategoryType = insertSidebarStore.activeCategoryType\n\n\tconst onSelect = () => {\n\t\tif (activeCategoryType === category.type) return\n\t\tinsertSidebarStore.activeCategoryType = category.type\n\t}\n\n\tconst mouseMoveHandler = (event: React.MouseEvent) => {\n\t\tif (navigationBehavior === NavigationBehavior.Push) {\n\t\t\tonSelect()\n\t\t} else {\n\t\t\tinsertSidebarStore.activeCategoryType = null\n\t\t}\n\t\tonMouseMove(event, category)\n\t}\n\n\tconst mouseClickHandler = () => {\n\t\tif (navigationBehavior === NavigationBehavior.Replace) {\n\t\t\tonSelect()\n\t\t\treturn\n\t\t}\n\n\t\tif (!appAction) return\n\t\tengine.stores.chromeStore.hideInsertSidebar()\n\t\tperformMainMenuAction(appAction)\n\t}\n\n\tif (selected && !engine.isRemountingUI()) {\n\t\trecord(\"ui_impression\", { page: `${Pages.insertSidebar}_${category.type}` })\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tkey={category.type}\n\t\t\tdirection=\"row\"\n\t\t\tjustifyContent=\"flex-start\"\n\t\t\talignItems=\"center\"\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={0}\n\t\t\tpaddingBottom={0}\n\t\t\tpaddingRight={dimensions.css.inputSpacing}\n\t\t\tpaddingLeft={dimensions.css.inputSpacing}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.sectionCategory,\n\t\t\t\tagentEnabled && styles.agentSectionCategory,\n\t\t\t\t!agentEnabled && styles.iconBackground[category.type],\n\t\t\t\t!agentEnabled && category.type === \"vectors\" && shadersEnabled && styles.vectorsIconDarkerBackground,\n\t\t\t\tstyles.icon,\n\t\t\t\tnavigationBehavior === NavigationBehavior.Replace && styles.sectionCategoryButton,\n\t\t\t\tselected && styles.sectionCategoryActive,\n\t\t\t\tagentEnabled && selected && styles.agentSectionCategoryActive,\n\t\t\t)}\n\t\t\tonClick={mouseClickHandler}\n\t\t\tonMouseEnter={() => navigationBehavior === NavigationBehavior.Push && onSelect()}\n\t\t\tonMouseMove={mouseMoveHandler}\n\t\t>\n\t\t\t<category.icon />\n\t\t\t<span>{category.title}</span>\n\t\t\t{category.items && category.navigationBehavior === NavigationBehavior.Push && <IconChevronRight />}\n\t\t</Stack>\n\t)\n})\n\ninterface SectionCategoriesProps {\n\tactiveCategoryType: Category | null\n\tcategories: CategoryTypes[]\n}\n\nfunction SectionCategories({ activeCategoryType, categories }: SectionCategoriesProps) {\n\tconst safeZoneRef = React.useRef<HTMLDivElement>(null)\n\n\t// We temporary render a triangle that prevents other categories from being selected when moving the mouse towards the category content\n\tconst enableSafeZone = React.useCallback(() => {\n\t\tenableSafeZoneWithTimeout(safeZoneRef)\n\t}, [])\n\n\tconst disableSafeZone = React.useCallback(() => {\n\t\tsetSafeZoneHidden(safeZoneRef)\n\t}, [])\n\n\tconst onMouseMoveCategory = React.useCallback(\n\t\t(event: React.MouseEvent, category: DataSourceCategory) => {\n\t\t\tconst safeZone = safeZoneRef.current\n\t\t\tif (!safeZone) return\n\n\t\t\t// If the category is not pushing a new side panel, we don't need the safezone.\n\t\t\tif (category.navigationBehavior !== NavigationBehavior.Push) return\n\n\t\t\tenableSafeZone()\n\t\t\tconst areaRect = safeZone.getBoundingClientRect()\n\t\t\tconst { clientX, clientY } = event\n\t\t\tconst x = clientX - areaRect.left + 4\n\t\t\tconst y = clientY - areaRect.top\n\t\t\tconst topDistance = y\n\t\t\tconst bottomDistance = areaRect.bottom - y\n\t\t\tconst topOffset = Math.max(topDistance * 0.03, 5)\n\t\t\tconst bottomOffset = Math.max(bottomDistance * 0.03, 5)\n\t\t\tsafeZone.style.clipPath = `polygon(100% 0, ${x}px ${y - topOffset}px, ${x}px ${y + bottomOffset}px, 100% 100%)`\n\t\t},\n\t\t[enableSafeZone],\n\t)\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.panelPadding}>\n\t\t\t{categories.map(category => {\n\t\t\t\tif (category.type === \"categoryGroupTitle\") {\n\t\t\t\t\treturn <GroupTitle key={\"groupTitle\" + category.title} title={category.title} displayDivider />\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<SectionCategory\n\t\t\t\t\t\tkey={category.type}\n\t\t\t\t\t\tcategory={category}\n\t\t\t\t\t\tselected={activeCategoryType === category.type}\n\t\t\t\t\t\tonMouseMove={onMouseMoveCategory}\n\t\t\t\t\t\tnavigationBehavior={category.navigationBehavior}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t\t{/* biome-ignore lint/a11y/useKeyWithMouseEvents: Pre-existing issue */}\n\t\t\t<div\n\t\t\t\tref={safeZoneRef}\n\t\t\t\tclassName={styles.sectionCategorySafeZone}\n\t\t\t\tonMouseMove={enableSafeZone}\n\t\t\t\t// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events\n\t\t\t\tonMouseOut={disableSafeZone}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\nfunction renderSearchResults(searchResults: SearchResults, displayTitle: boolean) {\n\tif (searchResults.length === 0) {\n\t\treturn (\n\t\t\t<Stack className={styles.noSearchResults}>\n\t\t\t\t<EmptyState center {...getNoSearchResultProps()} />\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{searchResults.map((result, index) => {\n\t\t\t\treturn (\n\t\t\t\t\t<InsertSidebarSection\n\t\t\t\t\t\tkey={result.sectionTitle}\n\t\t\t\t\t\tdisplayDivider={index > 0}\n\t\t\t\t\t\tignoreTint\n\t\t\t\t\t\thoverEffect=\"highlight\"\n\t\t\t\t\t\tsections={[result]}\n\t\t\t\t\t\tdisplayTitle={displayTitle}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n", "import \"GroupTitle.styles_gkqhxv.wyw.css\"; export const group = \"group_g15oll3g\";\nexport const groupWithDivider = \"groupWithDivider_g1h9v9wx\";", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./GroupTitle.styles.ts\"\n\ninterface GroupTitleProps {\n\ttitle: string\n\tdisplayDivider: boolean\n}\n\nexport const GroupTitle = ({ title, displayDivider }: GroupTitleProps) => {\n\treturn (\n\t\t<Stack\n\t\t\tkey={title}\n\t\t\tdirection=\"row\"\n\t\t\tjustifyContent=\"flex-start\"\n\t\t\talignItems=\"center\"\n\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\tclassName={cx(styles.group, displayDivider && styles.groupWithDivider)}\n\t\t>\n\t\t\t{title}\n\t\t</Stack>\n\t)\n}\n", "import { CenterChild, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { Draggable } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type { ExternalModuleExportIdentifier, ExternalModuleIdentifier, LocalModuleIdentifier } from \"@framerjs/shared\"\nimport {\n\tModuleType,\n\tasGlobalId,\n\tisExternalModuleIdentifier,\n\tparseModuleIdentifier,\n\ttoLocalIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport type {\n\tDraggableComponentData,\n\tDraggableModuleComponentData,\n} from \"document/components/canvas/CanvasDropZone.tsx\"\nimport {\n\tDraggableClipboardDataType,\n\tDraggableComponentDataType,\n\tDraggableModuleComponentDataType,\n} from \"document/components/canvas/CanvasDropZone.tsx\"\nimport { autoDetach } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport { getParentForInsertNode } from \"document/components/utils/getParentForInsertNode.ts\"\nimport { insertComponent } from \"document/components/utils/insertComponent.ts\"\nimport { canReplaceNode } from \"document/components/utils/replaceNodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { hasOrCanCreateEvents } from \"document/models/CanvasTree/actions/hasOrCanCreateEvents.ts\"\nimport { CanvasNode, CodeComponentNode, FrameNode } from \"document/models/CanvasTree/index.ts\"\nimport ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { StylePresetNode } from \"document/models/CanvasTree/nodes/utils/isStylePresetNode.ts\"\nimport { isCodeComponentNode, isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isBreakpointVariant, isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { isLayoutSectionBasedOnIntrinsicSize } from \"document/utils/layoutSectionHelpers.ts\"\nimport type { MotionStyle } from \"framer-motion\"\nimport { motion, useMotionValue } from \"framer-motion\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { framerLayersClipboardHandler } from \"utils/clipboard/handlers.ts\"\nimport { insertStylePresets } from \"utils/stylePresetUtils.ts\"\nimport type { ComponentAddedToCanvasSource } from \"utils/tracking/trackComponentAddedToCanvas.ts\"\nimport { getComponentType, getInsertTypeFromComponentType } from \"utils/tracking/trackComponentAddedToCanvas.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as styles from \"./InsertSidebar.styles.ts\"\nimport { uploadImage } from \"./dataSources/utils.tsx\"\nimport { insertDataSourceItemToast } from \"./insertDataSourceItemToast.ts\"\nimport type { DataSourceItem, DataSourceItemModuleURL, HoverEffect, LayoutVariants } from \"./types.ts\"\nimport {\n\tgetModuleIdentifierForItem,\n\thasFillImageUpload,\n\thasGenerateNodes,\n\thasModuleURL,\n\thasTint,\n\tisClipboardDataItem,\n\tisVectorDataSourceItem,\n\twithFullWidth,\n\twithHideTitle,\n\twithIntrinsicSize,\n} from \"./types.ts\"\nimport { withShader } from \"document/models/CanvasTree/traits/WithShader.ts\"\nimport { withCodeComponent } from \"document/models/CanvasTree/traits/WithCodeComponent.ts\"\n\ninterface InsertSidebarItemProps {\n\titem: DataSourceItem\n\tignoreTint: boolean\n\thoverEffect: HoverEffect\n\thideItemFrame?: boolean\n}\n\nexport const InsertSidebarItem = React.memo(function InsertSidebarItem({\n\titem,\n\tignoreTint,\n\thoverEffect,\n\thideItemFrame = false,\n}: InsertSidebarItemProps) {\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst { isDarkMode } = useDarkMode()\n\tconst dragRef = React.useRef<ComponentData>()\n\tconst opacity = useMotionValue(1)\n\n\tif (!withIntrinsicSize(item)) return null\n\tconst { insertSidebarStore, chromeStore, codeGenerationStore, canvasStore } = engine.stores\n\n\tconst onMouseEnter = () => {\n\t\tif (!isClipboardDataItem(item)) return\n\n\t\t// Preload clipboard data.\n\t\titem.clipboardData?.().catch(unhandledError)\n\t}\n\n\tconst onClick = async () => {\n\t\tif (isViewOnly) return\n\n\t\tif (isClipboardDataItem(item)) {\n\t\t\tconst scopeNode = engine.stores.scopeStore.active\n\t\t\tconst parentNode = scopeNode.getGroundNodes().find(isPrimaryVariant)\n\t\t\t// When clicking an item in the insert sidebar, we only support pasting into primary variants for now.\n\t\t\t// TODO: Add support for clicking in a sidebar item and pasting it into anywhere in the canvas.\n\t\t\tif (!parentNode) return\n\n\t\t\ttry {\n\t\t\t\tconst clipboardData = await item.clipboardData()\n\n\t\t\t\tconst success = await framerLayersClipboardHandler({\n\t\t\t\t\tengine,\n\t\t\t\t\tlayersData: clipboardData,\n\t\t\t\t\tposition: Point(0, 0),\n\t\t\t\t\tinsertTarget: { parentId: parentNode.id },\n\t\t\t\t\tshouldPasteTextStyles: true,\n\t\t\t\t})\n\n\t\t\t\tif (!success) return\n\n\t\t\t\trecord(\"insert_panel_add\", {\n\t\t\t\t\ttypeAdded: \"clipboard\",\n\t\t\t\t\tcategoryTitle: item.keywords ?? \"\",\n\t\t\t\t\titemTitle: item.title,\n\t\t\t\t\titemId: item.key,\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tunhandledError(error)\n\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 insert item.\",\n\t\t\t\t\tsecondaryText: \"Please reload.\",\n\t\t\t\t\taction: {\n\t\t\t\t\t\ttitle: \"Reload\",\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\twindow.location.reload()\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tshowCloseButton: \"never\",\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\tconst componentData = await getComponentData(item)\n\t\tif (!componentData) return\n\n\t\t// Handles uploading of the pattern image preset to the assets service\n\t\t// and updating the fillImage property on the node.\n\t\tif (hasFillImageUpload(item)) {\n\t\t\tconst { imageToUpload } = item\n\n\t\t\tif (imageToUpload && isFrameNode(componentData.component)) {\n\t\t\t\tuploadImage(imageToUpload, componentData.component, engine).catch(unhandledError)\n\t\t\t}\n\t\t}\n\n\t\tconst { component, source } = componentData\n\t\tif (!component) return\n\n\t\tconst identifier = parseModuleIdentifier(getModuleIdentifierString(component))\n\n\t\tif (identifier?.kind !== \"externalModuleExport\") {\n\t\t\t// We don't need to set up any external modules, so perform the insert immediately.\n\t\t\t// ? without this process when ready i was getting \u201Ctree must be clean\u201D errors\n\t\t\tawait insertDataSourceItemToast(async () => {\n\t\t\t\tif (\"nodesToRegenerate\" in componentData) {\n\t\t\t\t\tconst nodesToRegenerate = componentData.nodesToRegenerate ?? []\n\t\t\t\t\tfor (const nodeId of nodesToRegenerate) {\n\t\t\t\t\t\tawait codeGenerationStore.forceComponentUpdate(nodeId)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tif (\"stylePresets\" in componentData) {\n\t\t\t\t\t\tconst stylePresets = componentData.stylePresets ?? []\n\t\t\t\t\t\tinsertStylePresets(engine, stylePresets)\n\t\t\t\t\t}\n\n\t\t\t\t\tperformInsert(item, component, source, undefined, isLayoutSectionBasedOnIntrinsicSize(item))\n\t\t\t\t})\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\ttry {\n\t\t\tawait insertDataSourceItemToast(async () => {\n\t\t\t\tconst shouldBecomeFullWidthForVariants =\n\t\t\t\t\t\"shouldBecomeFullWidthForVariants\" in componentData\n\t\t\t\t\t\t? componentData.shouldBecomeFullWidthForVariants\n\t\t\t\t\t\t: undefined\n\t\t\t\tawait engine.stores.modulesStore.addExternalModulesToProject([identifier], {\n\t\t\t\t\tonTreeUpdate: () => {\n\t\t\t\t\t\tengine.stores.chromeStore.autoDetachingNodeId = component.id\n\t\t\t\t\t\tperformInsert(\n\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t\tshouldBecomeFullWidthForVariants,\n\t\t\t\t\t\t\tisLayoutSectionBasedOnIntrinsicSize(item),\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 externalModuleNode = isExternalModuleIdentifier(identifier)\n\t\t\t\t? engine.tree.getNode<ExternalModuleNode>(identifier.moduleId)\n\t\t\t\t: null\n\t\t\tif (!externalModuleNode?.type) return\n\n\t\t\tif (withShader(component)) {\n\t\t\t\trecord(\"shader_insert\", {\n\t\t\t\t\tmoduleId: identifier.value,\n\t\t\t\t\tshaderName: item.title,\n\t\t\t\t\tscopeType: engine.stores.scopeStore.scopeType,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tconst category = insertSidebarStore.getCategoryForItem(item)\n\t\t\t\tconst meta = getComponentType(component, engine)\n\t\t\t\tconst typeAdded = getInsertTypeFromComponentType(meta)\n\n\t\t\t\trecord(\"insert_panel_add\", {\n\t\t\t\t\ttypeAdded,\n\t\t\t\t\tcategoryTitle: category.title,\n\t\t\t\t\titemTitle: item.title,\n\t\t\t\t\titemId: externalModuleNode.id,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst shouldDetachOnInsert = \"shouldDetachOnInsert\" in componentData ? componentData.shouldDetachOnInsert : false\n\n\t\t\tif (shouldDetachOnInsert) {\n\t\t\t\tif (!isCodeComponentNode(component)) return\n\t\t\t\tawait autoDetach(component, engine, identifier, externalModuleNode.type)\n\t\t\t}\n\n\t\t\tconst vectorSetModuleId = \"vectorSetModuleId\" in componentData ? componentData.vectorSetModuleId : undefined\n\t\t\tif (!vectorSetModuleId) return\n\n\t\t\t// If we're inserting an external vector module, pull in the set as well as the latest vectors in the set as external modules.\n\t\t\tawait engine.stores.modulesStore.addOrUpdateVectorSetAndVectors({\n\t\t\t\tmoduleId: asGlobalId(vectorSetModuleId),\n\t\t\t\tsaveId: \"\",\n\t\t\t})\n\t\t} finally {\n\t\t\tengine.stores.chromeStore.autoDetachingNodeId = null\n\t\t}\n\t}\n\n\tconst onDragStart = async (event: DraggableEvent) => {\n\t\topacity.set(1)\n\n\t\texitMode()\n\n\t\t// Collection items are not added through the datasource but through a hook in the component for display so\n\t\t// getCategoryForItem will fail on an assertion because there are no items in the datasource.\n\t\t// We can ignore collections on this check anyway. Not sure of a better way to get the category type for an item\n\t\t// in a way that also works for search and there is no active category.\n\t\tlet shouldHideInsertSidebar = !isClipboardDataItem(item)\n\t\tif (hasModuleURL(item) && item.module?.id) {\n\t\t\tconst category = insertSidebarStore.getCategoryForItem(item)\n\n\t\t\t// We want to hide the insert sidebar when dragging an item that is not a layout section.\n\t\t\tshouldHideInsertSidebar = !category.shouldKeepInsertSidebarOpenOnItemDrag\n\t\t}\n\n\t\tif (shouldHideInsertSidebar) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tchromeStore.hideInsertSidebar()\n\t\t\t})\n\t\t}\n\n\t\tif (isClipboardDataItem(item)) {\n\t\t\tconst clipboardData = await item.clipboardData()\n\t\t\t// Creating a dummy node to be used for the insertion indicator when dragging a clipboard data item\n\t\t\t// to a stack or grid. We don't support floating nodes for clipboard data items at the moment.\n\t\t\tevent.dataTransfer.setData(DraggableClipboardDataType, {\n\t\t\t\tclipboardData,\n\t\t\t\tisLayoutSection: isLayoutSectionBasedOnIntrinsicSize(item),\n\t\t\t\tnode: new FrameNode({ width: item.intrinsicWidth, height: item.intrinsicHeight }),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tconst data = await getComponentData(item)\n\t\tconst componentData = (dragRef.current = data)\n\n\t\tif (!componentData) {\n\t\t\treturn\n\t\t}\n\n\t\tif (hasGenerateNodes(item) || hasFillImageUpload(item)) {\n\t\t\tevent.dataTransfer.setData(DraggableComponentDataType, componentData)\n\t\t} else if (hasModuleURL(item)) {\n\t\t\tif (!item.module) return\n\n\t\t\tevent.dataTransfer.setData(DraggableModuleComponentDataType, componentData)\n\n\t\t\t// Preload modules that are dragged from the insert sidebar.\n\t\t\tconst moduleIdentifier = getModuleIdentifierForItem(item)\n\t\t\tif (!moduleIdentifier) return\n\n\t\t\tengine.stores.modulesStore.preloadExternalModules([moduleIdentifier]).catch(unhandledError)\n\t\t}\n\t}\n\n\tconst onDrag = (event: DraggableEvent) => {\n\t\tif (isUndefined(dragRef.current?.overlayType)) return\n\n\t\tconst currentScope = engine.stores.scopeStore.active\n\t\tconst mouse = canvasStore.convertContainerPointToCanvas(event.client)\n\n\t\tconst floating = engine.tree.getTopMostChildNode(\n\t\t\tengine.tree.getNodesAtPoint(currentScope, mouse).filter(node => {\n\t\t\t\tif (isBreakpointVariant(node)) return false\n\t\t\t\tif (!canReplaceNode(node, { allowVariants: true })) return false\n\t\t\t\tif (hasFloatingPosition(node)) return true\n\t\t\t\tif (hasOrCanCreateEvents(node, engine.componentLoader)) return true\n\t\t\t\treturn false\n\t\t\t}),\n\t\t)\n\n\t\t// When dragging over a node that can receive an overlay, hide the drag\n\t\t// placeholder to focus the on canvas swap indicator.\n\t\topacity.set(floating ? 0 : 1)\n\t}\n\n\tconst onDragEnd = (event: DraggableEvent) => {\n\t\topacity.set(1)\n\n\t\tif (event.cancelled) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.chromeStore.showInsertSidebar()\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (isClipboardDataItem(item)) {\n\t\t\trecord(\"insert_panel_add\", {\n\t\t\t\ttypeAdded: \"clipboard\",\n\t\t\t\tcategoryTitle: item.keywords ?? \"\",\n\t\t\t\titemTitle: item.title,\n\t\t\t\titemId: item.key,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tensureCollectionReferenceAddIsTracked(item)\n\n\t\tif (!hasModuleURL(item) || !item.module?.id) return\n\n\t\tconst componentData = (event.dataTransfer.getData(DraggableModuleComponentDataType) ??\n\t\t\tevent.dataTransfer.getData(DraggableModuleComponentDataType)) as\n\t\t\t| DraggableComponentData\n\t\t\t| DraggableModuleComponentData\n\t\t\t| undefined\n\n\t\tif (!componentData?.component) return\n\n\t\tif (withShader(componentData.component)) {\n\t\t\trecord(\"shader_insert\", {\n\t\t\t\tmoduleId: componentData.component.shaderModuleIdentifier,\n\t\t\t\tshaderName: item.title || item.module.title,\n\t\t\t\tscopeType: engine.stores.scopeStore.scopeType,\n\t\t\t})\n\t\t} else {\n\t\t\tconst category = insertSidebarStore.getCategoryForItem(item)\n\t\t\tconst meta = getComponentType(componentData.component, engine)\n\t\t\tconst typeAdded = getInsertTypeFromComponentType(meta)\n\n\t\t\trecord(\"insert_panel_add\", {\n\t\t\t\ttypeAdded,\n\t\t\t\tcategoryTitle: category.title,\n\t\t\t\titemTitle: item.title,\n\t\t\t\titemId: item.module?.id,\n\t\t\t})\n\t\t}\n\t}\n\n\tconst itemWithAspectRatio = withAspectRatio(item)\n\tconst isFullWidth = !agentEnabled && (itemWithAspectRatio || (withFullWidth(item) && item.fullWidth))\n\tconst hideTitle = withHideTitle(item) && item.hideTitle\n\tconst itemTitle = agentEnabled && item.agentTitle ? item.agentTitle : item.title\n\n\tconst dragEnabled =\n\t\t!isViewOnly &&\n\t\t(hasGenerateNodes(item) ||\n\t\t\tBoolean(hasModuleURL(item) && item.module && item.module.type !== ModuleType.Screen) ||\n\t\t\tisClipboardDataItem(item))\n\n\treturn (\n\t\t<Draggable\n\t\t\tenabled={dragEnabled}\n\t\t\thideDragSource={false}\n\t\t\tonDragStart={onDragStart}\n\t\t\tonDragEnd={onDragEnd}\n\t\t\tonDrag={onDrag}\n\t\t\tautoScrollEnabled={false}\n\t\t\thoveringDropTargetClassName={styles.hoveringDropTarget}\n\t\t\tdragScale={1}\n\t\t\tclassName={cx(isFullWidth && styles.gridItemFullWidth)}\n\t\t\tonMouseEnter={onMouseEnter}\n\t\t\tonClick={onClick}\n\t\t>\n\t\t\t{dragInfo => {\n\t\t\t\tconst gridItemStyle: React.CSSProperties = {}\n\n\t\t\t\tif (hasTint(item) && !ignoreTint) {\n\t\t\t\t\tgridItemStyle[\"--tint\"] = item.tint\n\t\t\t\t\tgridItemStyle[\"--background-light\"] = item.backgroundLight\n\t\t\t\t\tgridItemStyle[\"--background-dark\"] = item.backgroundDark\n\t\t\t\t}\n\n\t\t\t\tif(agentEnabled) {\n\t\t\t\t\tgridItemStyle[\"--background-light\"] = colors.agentInput\n\t\t\t\t\tgridItemStyle[\"--background-dark\"] = colors.agentInput\n\t\t\t\t}\n\n\t\t\t\tlet dragPreviewElement: JSX.Element | null = null\n\t\t\t\tlet gridItemScaleX = 0\n\t\t\t\tlet gridItemScaleY = 0\n\t\t\t\tlet withDropTargetHover = false\n\t\t\t\tlet centerOffsetStyle: React.CSSProperties | undefined = undefined\n\n\t\t\t\tif (withIntrinsicSize(item) && dragInfo.isDragPreview) {\n\t\t\t\t\tconst { intrinsicWidth, intrinsicHeight } = item\n\t\t\t\t\tconst visibleRect = canvasStore.getCanvasVisibleRectTakingOverlaysIntoAccount()\n\t\t\t\t\tconst fitsInViewport = intrinsicWidth < visibleRect.width && intrinsicHeight < visibleRect.height\n\n\t\t\t\t\t// We display a placeholder that has the same size as the inserted component, only if that size fits within the canvas viewport\n\t\t\t\t\tif (fitsInViewport) {\n\t\t\t\t\t\twithDropTargetHover = true\n\n\t\t\t\t\t\t// Make sure that the component placeholder becomes center aligned with the mouse, that way the preview will match the exact insert location\n\t\t\t\t\t\tcenterOffsetStyle = {\n\t\t\t\t\t\t\t\"--center-offset-x\": `${-dragInfo.centerOfGravityOffset.x}px`,\n\t\t\t\t\t\t\t\"--center-offset-y\": `${-dragInfo.centerOfGravityOffset.y}px`,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst width = item.intrinsicWidth * canvasStore.zoom\n\t\t\t\t\t\tconst height = item.intrinsicHeight * canvasStore.zoom\n\n\t\t\t\t\t\t// We scale the placeholder to match the grid item size before it appears\n\t\t\t\t\t\tconst placeholderScaleX = dragInfo.dragSourceWidth / width\n\t\t\t\t\t\tconst placeholderScaleY = dragInfo.dragSourceHeight / height\n\t\t\t\t\t\tconst dragPreviewStyle: React.CSSProperties = {\n\t\t\t\t\t\t\t\"--scale-x\": `${placeholderScaleX}`,\n\t\t\t\t\t\t\t\"--scale-y\": `${placeholderScaleY}`,\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// We scale the grid item to match the placeholder size when the placeholder appears\n\t\t\t\t\t\tgridItemScaleX = width / dragInfo.dragSourceWidth\n\t\t\t\t\t\tgridItemScaleY = height / dragInfo.dragSourceHeight\n\t\t\t\t\t\tgridItemStyle[\"--scale-x\"] = `${gridItemScaleX}`\n\t\t\t\t\t\tgridItemStyle[\"--scale-y\"] = `${gridItemScaleY}`\n\n\t\t\t\t\t\tconst displayText = height > 16 && width > 40\n\t\t\t\t\t\tconst shortestSide = Math.min(width, height)\n\t\t\t\t\t\tconst borderRadius = Math.min(8, shortestSide / 4)\n\n\t\t\t\t\t\tdragPreviewStyle.width = width\n\t\t\t\t\t\tdragPreviewStyle.height = height\n\t\t\t\t\t\tdragPreviewStyle.borderRadius = borderRadius\n\n\t\t\t\t\t\tdragPreviewElement = (\n\t\t\t\t\t\t\t<CenterChild className={styles.dragPreviewWrapper}>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\tstyles.dragPreviewItem,\n\t\t\t\t\t\t\t\t\t\ttruncateWithEllipsis,\n\t\t\t\t\t\t\t\t\t\thasFillImageUpload(item) && styles.dragPreviewUploadingItem,\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\tstyle={dragPreviewStyle}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{displayText && item.title}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst bannerStyle = getBannerStyle(item, isClipboardDataItem(item))\n\t\t\t\tconst AgentPreviewIcon = item.agentPreviewIcon\n\t\t\t\tconst agentPreviewImage = getAgentPreviewImage(\n\t\t\t\t\tagentEnabled,\n\t\t\t\t\titem.agentPreviewImage,\n\t\t\t\t\titem.agentPreviewImageLight,\n\t\t\t\t\tisDarkMode,\n\t\t\t\t)\n\n\t\t\t\tconst agentEdgeToEdgePreview = agentEnabled && hideTitle\n\t\t\t\tconst itemWrapperHoverEffectClassName =\n\t\t\t\t\thoverEffect === \"grow\" ? styles.itemWrapperGrowHoverEffect : styles.itemWrapperTintHoverEffect\n\t\t\t\tconst previewPadding = isNumber(item.previewPadding)\n\t\t\t\t\t? item.previewPadding\n\t\t\t\t\t: itemWithAspectRatio && !hideItemFrame\n\t\t\t\t\t\t? dimensions.css.inputSpacing\n\t\t\t\t\t\t: undefined\n\n\t\t\t\treturn (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.itemWrapper,\n\t\t\t\t\t\t\titemWithAspectRatio && styles.itemWrapperAutoHeight,\n\t\t\t\t\t\t\titemWrapperHoverEffectClassName,\n\t\t\t\t\t\t\tagentEnabled && styles.agentItemWrapper,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...centerOffsetStyle,\n\t\t\t\t\t\t\t\topacity,\n\t\t\t\t\t\t\t\t...(item.wrapperHeight && { \"--wrapperHeight\": `${item.wrapperHeight}px` }),\n\t\t\t\t\t\t\t} as MotionStyle\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!hideItemFrame && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={gridItemStyle}\n\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\tstyles.itemTile,\n\t\t\t\t\t\t\t\t\tagentEnabled && styles.agentItemTile,\n\t\t\t\t\t\t\t\t\twithDropTargetHover && styles.withDropTargetHover,\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\t<Stack\n\t\t\t\t\t\t\ttitle={agentEnabled ? undefined : item.title}\n\t\t\t\t\t\t\taria-label={agentEnabled ? itemTitle : undefined}\n\t\t\t\t\t\t\tstyle={gridItemStyle}\n\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\tstyles.item,\n\t\t\t\t\t\t\t\tagentEnabled && styles.agentItem,\n\t\t\t\t\t\t\t\tdragEnabled && hoverEffect !== \"grow\" && styles.draggableItem,\n\t\t\t\t\t\t\t\titemWithAspectRatio && styles.layoutItem,\n\t\t\t\t\t\t\t\twithDropTargetHover && styles.withDropTargetHover,\n\t\t\t\t\t\t\t\thideItemFrame && styles.itemWithoutFrame,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tpadding={\n\t\t\t\t\t\t\t\tagentEdgeToEdgePreview ? 0 : agentEnabled ? dimensions.css.inputSpacing : previewPadding\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talignItems={itemWithAspectRatio ? \"center\" : undefined}\n\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{agentEnabled ? (\n\t\t\t\t\t\t\t\t<div className={styles.agentItemPreviewArea}>\n\t\t\t\t\t\t\t\t\t{AgentPreviewIcon ? (\n\t\t\t\t\t\t\t\t\t\t<div className={styles.agentItemPreviewIcon}>\n\t\t\t\t\t\t\t\t\t\t\t<AgentPreviewIcon />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) : agentPreviewImage ? (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.agentItemPreviewImage}\n\t\t\t\t\t\t\t\t\t\t\tsrc={agentPreviewImage}\n\t\t\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\t\t\t\twidth={item.agentPreviewWidth}\n\t\t\t\t\t\t\t\t\t\t\theight={item.agentPreviewHeight}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\t\tstyles.itemBanner,\n\t\t\t\t\t\t\t\t\t\t\t\titemWithAspectRatio && styles.itemBannerFullSize,\n\t\t\t\t\t\t\t\t\t\t\t\thideItemFrame && styles.itemBannerWithoutFrame,\n\t\t\t\t\t\t\t\t\t\t\t\tstyles.agentItemBanner,\n\t\t\t\t\t\t\t\t\t\t\t\tagentEdgeToEdgePreview && styles.agentItemBannerEdgeToEdge,\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tstyle={bannerStyle}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\tstyles.itemBanner,\n\t\t\t\t\t\t\t\t\t\titemWithAspectRatio && styles.itemBannerFullSize,\n\t\t\t\t\t\t\t\t\t\thideItemFrame && styles.itemBannerWithoutFrame,\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\tstyle={bannerStyle}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t{!hideTitle && (agentEnabled || !itemWithAspectRatio) && (\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\t\t\tjustifyContent=\"flex-start\"\n\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\tstyles.itemTitleWrapper,\n\t\t\t\t\t\t\t\t\t\tagentEnabled && styles.agentItemTitleWrapper,\n\t\t\t\t\t\t\t\t\t\ttruncateWithEllipsis,\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<div className={cx(styles.itemTitle, agentEnabled && styles.agentItemTitle, truncateWithEllipsis)}>\n\t\t\t\t\t\t\t\t\t\t{itemTitle}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t{dragPreviewElement}\n\t\t\t\t\t</motion.div>\n\t\t\t\t)\n\t\t\t}}\n\t\t</Draggable>\n\t)\n})\n\ntype ComponentData = DraggableComponentData | DraggableModuleComponentData | undefined\n\nasync function getComponentData(item: DataSourceItem): Promise<ComponentData> {\n\tif (hasGenerateNodes(item)) {\n\t\tconst generated = await item.generateNodes(engine)\n\n\t\tlet component: CanvasNode\n\t\tlet stylePresets: StylePresetNode[]\n\n\t\tif (generated instanceof CanvasNode) {\n\t\t\tcomponent = generated\n\t\t\tstylePresets = []\n\t\t} else {\n\t\t\tcomponent = generated.node\n\t\t\tstylePresets = generated.stylePresets\n\t\t}\n\n\t\treturn {\n\t\t\tsource: \"insert_panel\",\n\t\t\tcomponent,\n\t\t\tstylePresets,\n\t\t\tnodesToRegenerate: item.nodesToRegenerate,\n\t\t\timageToUpload: hasFillImageUpload(item) ? item.imageToUpload : undefined,\n\t\t}\n\t}\n\n\tif (hasModuleURL(item)) {\n\t\tconst moduleIdentifier = getModuleIdentifierForItem(item)\n\t\tif (!moduleIdentifier) return\n\t\tconst localModuleIdentifier = convertExternalToLocalIdentifier(moduleIdentifier)\n\n\t\t// Use intrinsic dimensions for code component nodes, not known in all case\n\t\tlet width: number | undefined\n\t\tlet height: number | undefined\n\t\tif (withIntrinsicSize(item)) {\n\t\t\twidth = item.intrinsicWidth\n\t\t\theight = item.intrinsicHeight\n\t\t}\n\n\t\tconst component = createNodeForModule(item, moduleIdentifier, localModuleIdentifier, width, height)\n\n\t\tconst { insertSidebarStore } = engine.stores\n\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tmoduleIdentifier,\n\t\t\tsource: \"insert_panel\",\n\t\t\tshouldBecomeFullWidthForVariants: insertSidebarStore.shouldBecomeFullWidthForVariants(moduleIdentifier.moduleId),\n\t\t\tisLayoutSection: isNumber(width) && width >= 900,\n\t\t\tshouldDetachOnInsert: insertSidebarStore.shouldDetachOnInsert(moduleIdentifier.moduleId),\n\t\t\toverlayType: insertSidebarStore.shouldInsertAsOverlayType(moduleIdentifier.moduleId),\n\t\t\tvectorSetModuleId: isVectorDataSourceItem(item) ? item.vectorSetModuleId : undefined,\n\t\t}\n\t}\n\n\tunhandledError(new Error(\"unhandled data source type\"))\n}\n\nfunction exitMode() {\n\tengine.scheduler.processWhenReady(engine.exitMode)\n}\n\nfunction performInsert(\n\titem: DataSourceItem,\n\tcomponent: CanvasNode | CodeComponentNode,\n\tsource: ComponentAddedToCanvasSource,\n\tshouldBecomeFullWidthForVariants: LayoutVariants | undefined,\n\tisLayoutSection: boolean | undefined,\n) {\n\tconst parent = getParentForInsertNode(component, engine)\n\tconst { canvasStore } = engine.stores\n\tlet center = canvasStore.getCanvasCenter()\n\n\tconst parentRectCenter = parent ? Rect.center(convertFrameToCanvas(engine.tree, parent)) : null\n\tconst visibleCanvasRect = canvasStore.getCanvasVisibleRectTakingOverlaysIntoAccount()\n\tif (parentRectCenter && Rect.containsPoint(visibleCanvasRect, parentRectCenter)) {\n\t\tcenter = parentRectCenter\n\t}\n\n\tensureCollectionReferenceAddIsTracked(item)\n\n\tinsertComponent({\n\t\tengine: engine,\n\t\tcomponent: component as CanvasNode,\n\t\tcanvasPoint: center,\n\t\tsource,\n\t\tshouldBecomeFullWidthForVariants,\n\t\tisLayoutSection,\n\t\tnotDraggedOntoCanvas: true,\n\t\tinsertAsGroundNode: !isLayoutSection,\n\t})\n\texitMode()\n\n\tif (!isLayoutSection) {\n\t\tengine.stores.chromeStore.hideInsertSidebar()\n\t}\n}\n\nfunction ensureCollectionReferenceAddIsTracked(item: DataSourceItem) {\n\tif (\n\t\titem.trackingType === ControlType.CollectionReference ||\n\t\titem.trackingType === ControlType.MultiCollectionReference\n\t) {\n\t\trecord(\"collection_reference_add\", { source: \"insert_panel\" })\n\t}\n}\n\nfunction getModuleIdentifierString(node: CanvasNode | ShaderNode | CodeComponentNode): string {\n\tif (withCodeComponent(node)) return node.codeComponentIdentifier\n\tif (withShader(node)) return node.shaderModuleIdentifier\n\treturn node.id\n}\n\nfunction createNodeForModule(\n\titem: DataSourceItemModuleURL & { title?: string },\n\tmoduleIdentifier: ExternalModuleExportIdentifier,\n\tlocalModuleIdentifier: LocalModuleIdentifier | undefined,\n\twidth: number | undefined,\n\theight: number | undefined,\n): CanvasNode {\n\tif (item.module?.type === ModuleType.Shader) {\n\t\treturn new ShaderNode({\n\t\t\tshaderModuleIdentifier: moduleIdentifier.value,\n\t\t\twidth: width ?? 400,\n\t\t\theight: height ?? 400,\n\t\t})\n\t}\n\n\treturn new CodeComponentNode({\n\t\tcodeComponentIdentifier: localModuleIdentifier?.value ?? moduleIdentifier.value,\n\t\twidth,\n\t\theight,\n\t\tcursor: item.cursor,\n\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t...prefixControlProps(item.controlProps ?? {}),\n\t})\n}\n\nfunction convertExternalToLocalIdentifier(\n\texternalModuleIdentifier: ExternalModuleIdentifier,\n): LocalModuleIdentifier | undefined {\n\tconst module = engine.stores.modulesStore.getPersistedModuleByGlobalId(externalModuleIdentifier.moduleId)\n\tif (!module) return\n\treturn toLocalIdentifier(externalModuleIdentifier, module.localId)\n}\n\nfunction getAgentPreviewImage(\n\tagentEnabled: boolean,\n\timage: string | undefined,\n\timageLight: string | undefined,\n\tisDarkMode: boolean,\n): string | undefined {\n\tif (!agentEnabled) return undefined\n\tif (!isDarkMode && imageLight) return imageLight\n\treturn image\n}\n\nfunction getBannerStyle(\n\t{\n\t\taspectRatio,\n\t\timage,\n\t\timageDark,\n\t\tminWidth,\n\t\tminHeight,\n\t\tpreviewWidth,\n\t\tpreviewHeight,\n\t\tpreviewRadius,\n\t}: {\n\t\taspectRatio?: number\n\t\timage: string\n\t\timageDark?: string\n\t\tminWidth?: number\n\t\tminHeight?: number\n\t\tpreviewWidth?: number\n\t\tpreviewHeight?: number\n\t\tpreviewRadius?: number\n\t},\n\tforceAspectRatio = false,\n): React.CSSProperties {\n\tconst bannerStyle: React.CSSProperties = {}\n\tbannerStyle[\"--image\"] = `url(\"${image}\")`\n\tif (isNumber(aspectRatio)) {\n\t\tif (forceAspectRatio || aspectRatio <= 1) {\n\t\t\tbannerStyle.paddingTop = `calc(${aspectRatio} * 100%)`\n\t\t} else {\n\t\t\tconst height = 133\n\t\t\tbannerStyle.paddingTop = height\n\t\t\tbannerStyle.width = height / aspectRatio\n\t\t}\n\t}\n\n\tif (isNumber(minHeight)) {\n\t\tbannerStyle[\"--minHeight\"] = `${minHeight}px`\n\t}\n\n\tif (isNumber(minWidth)) {\n\t\tbannerStyle[\"--preview-min-width\"] = `${minWidth}px`\n\t}\n\n\tif (isNumber(previewWidth)) {\n\t\tbannerStyle[\"--preview-width\"] = `${previewWidth}px`\n\t}\n\n\tif (isNumber(previewHeight)) {\n\t\tbannerStyle[\"--preview-height\"] = `${previewHeight}px`\n\t}\n\n\tif (isNumber(previewRadius)) {\n\t\tbannerStyle[\"--preview-radius\"] = `${previewRadius}px`\n\t}\n\n\tif (imageDark) bannerStyle[\"--image-dark\"] = `url(\"${imageDark}\")`\n\n\treturn bannerStyle\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { GroupTitle } from \"./GroupTitle.tsx\"\nimport * as styles from \"./InsertSidebar.styles.ts\"\nimport { InsertSidebarItem } from \"./InsertSidebarItem.tsx\"\nimport type { DataSourceItem, HoverEffect } from \"./types.ts\"\n\ninterface InsertSidebarItemsProps {\n\titems: DataSourceItem[]\n\tignoreTint: boolean\n\thoverEffect: HoverEffect\n\tsectionTitle?: string\n\tdisplayDivider?: boolean\n}\n\nexport function InsertSidebarItems({\n\titems,\n\tignoreTint,\n\tsectionTitle,\n\thoverEffect,\n\tdisplayDivider = false,\n}: InsertSidebarItemsProps) {\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={displayDivider ? 0 : dimensions.css.panelPadding}\n\t\t\tclassName={styles.insertableItems}\n\t\t>\n\t\t\t{sectionTitle && <GroupTitle displayDivider={displayDivider} title={sectionTitle} />}\n\t\t\t<div className={cx(styles.grid, agentEnabled && styles.agentGrid)}>\n\t\t\t\t{items.map(item => (\n\t\t\t\t\t<InsertSidebarItem key={item.key} item={item} ignoreTint={ignoreTint} hoverEffect={hoverEffect} />\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n", "import { Scroll, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { DefaultKit } from \"app/ai/kits/DefaultKit.ts\"\nimport type { KitSectionMeta, WireframerKit } from \"app/ai/utils/wireframerKit.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { ScopeNode } from \"document/models/CanvasTree/nodes/ScopeNode.ts\"\nimport { isDesignPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { useEffect, useMemo, useState } from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport type { FramerLayersClipboardData } from \"utils/clipboard/helpers/types.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport * as leftPanelStyles from \"../leftPanel/LeftPanel.styles.ts\"\nimport * as insertSidebarStyles from \"./InsertSidebar.styles.ts\"\nimport { InsertSidebarItem } from \"./InsertSidebarItem.tsx\"\nimport { InsertSidebarSection } from \"./InsertSidebarSection.tsx\"\nimport { layoutSectionItems } from \"./dataSources/items/layoutSectionItems.ts\"\nimport { useRestoreScrollOffset } from \"./hooks/useRestoreScrollOffset.ts\"\nimport type { DataSourceClipboardDataItem, DataSourceSection, HoverEffect } from \"./types.ts\"\nimport { NavigationBehavior, itemsAreDataSourceSections } from \"./types.ts\"\n\n/**\n * @description This is the padding introduced in the image generated for a kit section when creating kit screenshots.\n * @note This is also set on the BE when generating the kit section screenshots so can't only be updated here.\n */\nconst padding: number = 10\n\ninterface InsertSidebarKitSectionsProps {\n\tvisible: boolean\n\tnavigationBehavior: NavigationBehavior\n\tshouldIgnoreTint: boolean\n\thoverEffect: HoverEffect\n}\n\nexport function InsertSidebarKitSections({\n\tvisible,\n\tnavigationBehavior,\n\tshouldIgnoreTint,\n\thoverEffect,\n}: InsertSidebarKitSectionsProps) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst activeScope = engine.stores.scopeStore.useState(state => state.active)\n\tconst [kitSections, setKitSections] = useState<DataSourceSection[] | DataSourceClipboardDataItem[]>([])\n\tconst { isDarkMode } = useDarkMode()\n\n\tuseEffect(() => {\n\t\tif (!visible) return\n\n\t\tconst abortController = new AbortController()\n\n\t\tloadKitSections(engine, activeScope, abortController.signal, isDarkMode)\n\t\t\t.then(sections => {\n\t\t\t\tif (abortController.signal.aborted) return\n\n\t\t\t\tsetKitSections(sections)\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tif (abortController.signal.aborted) return\n\n\t\t\t\tsetKitSections([])\n\t\t\t\tunhandledError(error)\n\t\t\t})\n\n\t\treturn () => {\n\t\t\tabortController.abort()\n\t\t}\n\t}, [activeScope, visible, isDarkMode])\n\n\tconst scrollRef = useRestoreScrollOffset(\"kitSections\", visible)\n\n\tconst items = useMemo(() => {\n\t\tif (itemsAreDataSourceSections(kitSections)) {\n\t\t\treturn <InsertSidebarSection sections={kitSections} ignoreTint={shouldIgnoreTint} hoverEffect={hoverEffect} />\n\t\t}\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={dimensions.css.panelPadding}\n\t\t\t\tpaddingBottom={dimensions.css.panelPadding}\n\t\t\t\tclassName={insertSidebarStyles.insertableItems}\n\t\t\t>\n\t\t\t\t<div className={insertSidebarStyles.grid}>\n\t\t\t\t\t{kitSections.map(kitSection => (\n\t\t\t\t\t\t<InsertSidebarItem\n\t\t\t\t\t\t\tkey={kitSection.key}\n\t\t\t\t\t\t\titem={kitSection}\n\t\t\t\t\t\t\tignoreTint={shouldIgnoreTint}\n\t\t\t\t\t\t\thoverEffect={hoverEffect}\n\t\t\t\t\t\t\thideItemFrame\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t)\n\t}, [kitSections, shouldIgnoreTint, hoverEffect])\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tinsertSidebarStyles.categoryContent,\n\t\t\t\tnavigationBehavior === NavigationBehavior.Push && insertSidebarStyles.pushedCategoryContent,\n\t\t\t\t!visible && leftPanelStyles.leftPanelHidden,\n\t\t\t\tappPointerEvents,\n\t\t\t)}\n\t\t>\n\t\t\t<Scroll ref={scrollRef} className={insertSidebarStyles.scroll}>\n\t\t\t\t{items}\n\t\t\t</Scroll>\n\t\t</div>\n\t)\n}\n\nasync function loadKitSections(\n\tengine: VekterEngine,\n\tactiveScope: ScopeNode | null,\n\tsignal: AbortSignal,\n\tisDarkMode: boolean,\n): Promise<DataSourceClipboardDataItem[] | DataSourceSection[]> {\n\tconst cmsEnabled = !isDesignPageNode(activeScope)\n\tconst kit = await engine.stores.aiGenerationStore.getKit(engine, {\n\t\tcms: cmsEnabled,\n\t})\n\n\tif (signal.aborted) return []\n\n\t// For Wireframer default kit, we need to show the layout sections items.\n\tif (kit.id === DefaultKit.id) return layoutSectionItems\n\n\tconst sectionItems: DataSourceClipboardDataItem[] = buildKitSectionItems(engine, kit, cmsEnabled, isDarkMode)\n\n\t// Sorting kit sections by category order.\n\tsectionItems.sort((a, b) => {\n\t\tconst orderDiff = categoryOrder(a.title) - categoryOrder(b.title)\n\t\tif (orderDiff !== 0) return orderDiff\n\n\t\treturn a.title.localeCompare(b.title)\n\t})\n\n\tif (signal.aborted) return []\n\n\treturn sectionItems\n}\n\nfunction categoryOrder(title: string): number {\n\t// Sorting kit sections by title (category) to keep pinned sections at the top and footer sections at the bottom.\n\tconst normalized = title.toLowerCase()\n\tif (normalized.includes(\"navigation\")) return 0\n\tif (normalized.includes(\"hero\")) return 1\n\tif (normalized.includes(\"footer\")) return 3\n\treturn 2\n}\n\nfunction buildKitSectionItems(\n\tengine: VekterEngine,\n\tkit: WireframerKit,\n\tcmsEnabled: boolean,\n\tisDarkMode: boolean,\n): DataSourceClipboardDataItem[] {\n\tconst sectionItems: DataSourceClipboardDataItem[] = []\n\tfor (const sectionId in kit.sections) {\n\t\tconst section = kit.sections[sectionId]\n\t\tassert(section, `Section ${sectionId} not found in kit`)\n\n\t\t// Filter out detail page sections.\n\t\tif (section.detailPageCollectionId) continue\n\n\t\t// If CMS is not enabled, filter out sections that have CMS connected fields.\n\t\tif (!cmsEnabled && section.fields?.some(field => field.isCMSConnectedField)) continue\n\n\t\tconst sectionItem = buildKitSectionItem(engine, kit, section, isDarkMode)\n\t\tif (!sectionItem) continue\n\n\t\tsectionItems.push(sectionItem)\n\t}\n\n\treturn sectionItems\n}\n\nfunction buildKitSectionItem(\n\tengine: VekterEngine,\n\tkit: WireframerKit,\n\tmeta: KitSectionMeta,\n\tisDarkMode: boolean,\n): DataSourceClipboardDataItem | undefined {\n\tconst intrinsicWidth = meta.intrinsicWidth\n\tassert(isNumber(intrinsicWidth), \"Intrinsic width must be defined\")\n\n\tconst intrinsicHeight = meta.intrinsicHeight\n\tassert(isNumber(intrinsicHeight), \"Intrinsic height must be defined\")\n\n\tconst width: number = intrinsicWidth + 2 * padding\n\tconst height: number = intrinsicHeight + 2 * padding\n\n\t// Adding padding introduced in screenshot generation.\n\tconst aspectRatio = intrinsicWidth > 0 ? height / width : 1\n\n\tconst image = kit.getSectionScreenshot(engine, meta.id, isDarkMode)\n\t// KITS TODO: We should handle this better, maybe show a placeholder image or something.\n\tif (!image) return\n\n\treturn {\n\t\tkey: meta.id,\n\t\ttitle: meta.category ?? meta.id,\n\t\tkeywords: meta.category ?? null,\n\t\timage,\n\t\taspectRatio,\n\t\tclipboardData: () => getClipboardData(kit, meta),\n\t\tintrinsicWidth: width,\n\t\tintrinsicHeight: height,\n\t}\n}\n\nasync function getClipboardData(kit: WireframerKit, meta: KitSectionMeta): Promise<FramerLayersClipboardData> {\n\tconst sectionData = await kit.getClipboardDataById(meta.id)\n\tassert(sectionData, `Section ${meta.id} not found in kit`)\n\n\tconst intrinsicWidth = meta.intrinsicWidth\n\tassert(isNumber(intrinsicWidth), \"Intrinsic width must be defined\")\n\n\tconst intrinsicHeight = meta.intrinsicHeight\n\tassert(isNumber(intrinsicHeight), \"Intrinsic height must be defined\")\n\n\t// To position the node outside of a scope node the clipboard data needs the original node frame, otherwise\n\t// we end up with a node with 0 width.\n\tsectionData.layers.originalFrames = {\n\t\t...sectionData.layers.originalFrames,\n\t\t[meta.id]: {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\twidth: intrinsicWidth,\n\t\t\theight: intrinsicHeight,\n\t\t},\n\t}\n\n\treturn sectionData\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { memo, useCallback } from \"react\"\nimport * as styles from \"./InsertSidebar.styles.ts\"\nimport { InsertSidebarItems } from \"./InsertSidebarItems.tsx\"\nimport type { ColorScheme, DataSourceSection, HoverEffect } from \"./types.ts\"\n\ninterface SectionProps {\n\tsections: DataSourceSection[]\n\tignoreTint: boolean\n\thoverEffect: HoverEffect\n\tdisplayDivider?: boolean\n\tdisplayTitle?: boolean\n}\n\nexport const InsertSidebarSection = memo(function InsertSidebarSection({\n\tsections,\n\tignoreTint,\n\thoverEffect,\n\tdisplayDivider,\n\tdisplayTitle = true,\n}: SectionProps) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst colorSchemePreference = engine.stores.insertSidebarStore.useState(state => state.colorSchemePreference)\n\n\tconst handleColorSchemeChange = useCallback((colorScheme: ColorScheme) => {\n\t\tengine.stores.insertSidebarStore.colorSchemePreference = colorScheme\n\t}, [])\n\n\tconst hasColorScheme = sections.some(section => section.colorScheme !== undefined)\n\n\tconst filteredSections = hasColorScheme\n\t\t? sections.filter(section => section.colorScheme === colorSchemePreference)\n\t\t: sections\n\n\treturn (\n\t\t<>\n\t\t\t{hasColorScheme && (\n\t\t\t\t<div className={styles.colorSchemeSelector}>\n\t\t\t\t\t<SegmentedControl>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle=\"Light\"\n\t\t\t\t\t\t\tidentifier=\"light\"\n\t\t\t\t\t\t\tselected={colorSchemePreference === \"light\"}\n\t\t\t\t\t\t\tonSelect={() => handleColorSchemeChange(\"light\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle=\"Dark\"\n\t\t\t\t\t\t\tidentifier=\"dark\"\n\t\t\t\t\t\t\tselected={colorSchemePreference === \"dark\"}\n\t\t\t\t\t\t\tonSelect={() => handleColorSchemeChange(\"dark\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{filteredSections.map(section => (\n\t\t\t\t<InsertSidebarItems\n\t\t\t\t\tkey={section.sectionTitle}\n\t\t\t\t\titems={section.items}\n\t\t\t\t\tignoreTint={ignoreTint}\n\t\t\t\t\tsectionTitle={displayTitle ? section.sectionTitle : undefined}\n\t\t\t\t\thoverEffect={hoverEffect}\n\t\t\t\t\tdisplayDivider={displayDivider}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</>\n\t)\n})\n", "import { useLayoutEffect, useRef } from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\n\ntype ScrollOffsetKey = string\n\nconst scrollOffsetMap = new Map<ScrollOffsetKey, number>()\n\nexport function useRestoreScrollOffset(scrollOffsetKey: ScrollOffsetKey, visible: boolean) {\n\tconst ref = useRef<HTMLDivElement>(null)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: We need it to fire on visible changes.\n\tuseLayoutEffect(() => {\n\t\tconst element = ref.current\n\t\tif (!element) return\n\n\t\tconst lastOffset = scrollOffsetMap.get(scrollOffsetKey)\n\t\telement.scrollTop = isNumber(lastOffset) ? lastOffset : 0\n\n\t\tconst handleScroll = () => {\n\t\t\tscrollOffsetMap.set(scrollOffsetKey, element.scrollTop)\n\t\t}\n\n\t\telement.addEventListener(\"scroll\", handleScroll)\n\t\treturn () => element.removeEventListener(\"scroll\", handleScroll)\n\t}, [scrollOffsetKey, visible])\n\n\treturn ref\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { getAvailableCollections } from \"./getAvailableCollections.ts\"\n\nexport function useAvailableCollections(): DataDefinition[] {\n\treturn useDeprecatedEngineState(EngineChange.ActiveBundle, () => getAvailableCollections(engine))\n}\n", "import { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { assert } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { propKeyIsTitleLike } from \"document/components/utils/propKeyIsTitleLike.ts\"\nimport { useAvailableCollections } from \"document/components/utils/useAvailableCollections.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { FrameNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { createRichTextNodeWithTag } from \"document/models/CanvasTree/nodes/RichTextNode.utils.ts\"\nimport { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableProviderVariableMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { withVariableProvider } from \"document/models/CanvasTree/traits/WithVariableProvider.ts\"\nimport {\n\ttype VariableDefinition,\n\tcontrolDescriptionFromVariable,\n\tisArrayOfObjectControlDescription,\n\tisStringVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { createComputedFormattedDate } from \"document/models/CanvasTree/traits/utils/createComputedFormattedDate.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport {\n\tcreatedAtVariableId,\n\tnextItemVariableId,\n\tpreviousItemVariableId,\n\tupdatedAtVariableId,\n} from \"document/utils/CollectionItemVariables.ts\"\nimport {\n\tcreateArrayGrid,\n\tcreateCollectionItem,\n\tcreateCollectionItemNavigationLinks,\n\tcreateCollectionList,\n\tgalleryImageHeight,\n\trepeaterSize,\n\ttextColor,\n} from \"document/utils/contentCreationTemplates.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNestedVariable, isTopLevelIdVariableId } from \"utils/collectionReferenceUtils.ts\"\nimport { getDefaultLinkStylePreset } from \"utils/linkStylePresetUtils.ts\"\nimport { getDefaultTextStylePreset } from \"utils/textStylePresetUtils.ts\"\nimport { isSlugVariable } from \"utils/variableMetadata.ts\"\nimport agentCollectionImage from \"./dataSources/images/agent/cms/collection.svg\"\nimport agentContentImage from \"./dataSources/images/agent/cms/content.svg\"\nimport agentCreatedImage from \"./dataSources/images/agent/cms/created.svg\"\nimport agentDateImage from \"./dataSources/images/agent/cms/date.svg\"\nimport agentGalleryImage from \"./dataSources/images/agent/cms/gallery.svg\"\nimport agentImageImage from \"./dataSources/images/agent/cms/image.svg\"\nimport agentMultiReferenceImage from \"./dataSources/images/agent/cms/multi-ref.svg\"\nimport agentPaginationImage from \"./dataSources/images/agent/cms/pagination.svg\"\nimport agentReferenceImage from \"./dataSources/images/agent/cms/ref.svg\"\nimport agentTitleImage from \"./dataSources/images/agent/cms/title.svg\"\nimport agentUpdatedImage from \"./dataSources/images/agent/cms/updated.svg\"\nimport dataCollectionDarkImage from \"./dataSources/images/data-collection-dark.png\"\nimport dataCollectionLightImage from \"./dataSources/images/data-collection-light.png\"\nimport dataContentDarkImage from \"./dataSources/images/data-content-dark.png\"\nimport dataContentLightImage from \"./dataSources/images/data-content-light.png\"\nimport dataDateDarkImage from \"./dataSources/images/data-date-dark.png\"\nimport dataDateLightImage from \"./dataSources/images/data-date-light.png\"\nimport dataGalleryDarkImage from \"./dataSources/images/data-gallery-dark.png\"\nimport dataGalleryLightImage from \"./dataSources/images/data-gallery-light.png\"\nimport dataImageDarkImage from \"./dataSources/images/data-image-dark.png\"\nimport dataImageLightImage from \"./dataSources/images/data-image-light.png\"\nimport dataMultiReferenceDarkImage from \"./dataSources/images/data-multi-reference-dark.png\"\nimport dataMultiReferenceLightImage from \"./dataSources/images/data-multi-reference-light.png\"\nimport dataPreviousNextDarkImage from \"./dataSources/images/data-previous-next-dark.png\"\nimport dataPreviousNextLightImage from \"./dataSources/images/data-previous-next-light.png\"\nimport dataReferenceDarkImage from \"./dataSources/images/data-reference-dark.png\"\nimport dataReferenceLightImage from \"./dataSources/images/data-reference-light.png\"\nimport dataTitleDarkImage from \"./dataSources/images/data-title-dark.png\"\nimport dataTitleLightImage from \"./dataSources/images/data-title-light.png\"\nimport type { DataSourceItemGenerateNodes, DataSourceSection } from \"./types.ts\"\n\nconst agentCMSPreviewSize = 40\n\nexport function useCollectionListSection(): DataSourceSection | null {\n\tconst collections = useAvailableCollections()\n\n\tconst items = collections.map((collection): DataSourceItemGenerateNodes => {\n\t\treturn {\n\t\t\tkey: collection.name,\n\t\t\ttitle: collection.name,\n\t\t\tkeywords: \"\",\n\t\t\timage: dataCollectionLightImage,\n\t\t\timageDark: dataCollectionDarkImage,\n\t\t\tagentPreviewImage: agentCollectionImage,\n\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\tintrinsicWidth: repeaterSize,\n\t\t\tintrinsicHeight: repeaterSize,\n\t\t\thideTitle: false,\n\t\t\tfullWidth: true,\n\t\t\tgenerateNodes() {\n\t\t\t\tconst slugId = collection.annotations?.[AnnotationKey.FramerSlug]\n\n\t\t\t\tconst webPages = engine.stores.scopeStore.getWebPageNodes()\n\t\t\t\tconst webPageUsingCollection = webPages.find(webPage => {\n\t\t\t\t\treturn webPage.dataIdentifier === collection.identifier\n\t\t\t\t})\n\n\t\t\t\tconst repeater = createCollectionList({\n\t\t\t\t\tengine,\n\t\t\t\t\tidentifier: collection.identifier,\n\t\t\t\t\tslugId,\n\t\t\t\t\tproperties: collection.properties,\n\t\t\t\t\tdetailPageId: webPageUsingCollection?.id,\n\t\t\t\t})\n\t\t\t\trepeater.set({ collectionLimit: 10 })\n\t\t\t\treturn repeater\n\t\t\t},\n\t\t}\n\t})\n\n\tif (collections.length === 0) return null\n\n\treturn { items, sectionTitle: \"Collections\" }\n}\n\ninterface DataScopeInfo {\n\tscopeId: NodeID\n\tdataName: string\n\tcollectionNode: CollectionNode | undefined\n\tvariableMap: VariableProviderVariableMap | undefined\n}\n\nexport function useCollectionPageSection(): DataSourceSection | null {\n\tconst scopeInfo = useEngineState(\n\t\t(): DataScopeInfo | null => {\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\n\t\t\tif (!isWebPageNode(activeScope)) return null\n\t\t\tif (!hasCollectionDataSource(activeScope)) return null\n\t\t\tif (!withVariableProvider(activeScope)) return null\n\n\t\t\tconst data = engine.componentLoader.dataForIdentifier(activeScope.dataIdentifier)\n\t\t\tif (!data) return null\n\n\t\t\tconst variableMap = activeScope.getProvidedVariableMap(\n\t\t\t\tengine.tree,\n\t\t\t\tundefined,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tengine.componentLoader.activeBundleHash,\n\t\t\t)\n\n\t\t\tconst contentManagementNode = getContentManagementNode(engine.tree)\n\n\t\t\tconst collectionNode = contentManagementNode?.loaded?.children.find(\n\t\t\t\tchild => child.instanceIdentifier === activeScope.dataIdentifier,\n\t\t\t)\n\n\t\t\treturn {\n\t\t\t\tscopeId: activeScope.id,\n\t\t\t\tdataName: `${data.name} Fields`,\n\t\t\t\tcollectionNode,\n\t\t\t\tvariableMap,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle],\n\t)\n\n\treturn React.useMemo((): DataSourceSection | null => {\n\t\tif (!scopeInfo) return null\n\n\t\tconst providerId = scopeInfo.scopeId\n\n\t\tlet hasPreviousItemVariable = false\n\t\tlet hasNextItemVariable = false\n\n\t\tconst items: DataSourceItemGenerateNodes[] = []\n\t\tif (scopeInfo.variableMap) {\n\t\t\tfor (const [variableId, variable] of scopeInfo.variableMap) {\n\t\t\t\tif (isTopLevelIdVariableId(variableId)) continue\n\t\t\t\tif (isSlugVariable(variable)) continue\n\t\t\t\tif (isNestedVariable(variable)) continue\n\n\t\t\t\tswitch (variable.type) {\n\t\t\t\t\tcase ControlType.Array: {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\ttrackingType: ControlType.Array,\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataGalleryLightImage,\n\t\t\t\t\t\t\timageDark: dataGalleryDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentGalleryImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\tintrinsicWidth: repeaterSize,\n\t\t\t\t\t\t\tintrinsicHeight: repeaterSize,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\tconst control = controlDescriptionFromVariable(\n\t\t\t\t\t\t\t\t\tengine.tree,\n\t\t\t\t\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\t\t\t\t\tvariable,\n\t\t\t\t\t\t\t\t\tScopeType.ContentManagement,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tassert(isArrayOfObjectControlDescription(control), \"Array variable expected to have object\")\n\n\t\t\t\t\t\t\t\treturn createArrayGrid({\n\t\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\t\tvariableId,\n\t\t\t\t\t\t\t\t\tproperties: control.control.controls,\n\t\t\t\t\t\t\t\t\titemHeight: galleryImageHeight,\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\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tcase ControlType.RichText: {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataContentLightImage,\n\t\t\t\t\t\t\timageDark: dataContentDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentContentImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\t// FIXME: add correct size\n\t\t\t\t\t\t\tintrinsicWidth: 200,\n\t\t\t\t\t\t\tintrinsicHeight: 200,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\treturn new RichTextNode({\n\t\t\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\t\t\thtml: variable.name,\n\t\t\t\t\t\t\t\t\thtmlContent: createVariableReference(variableId, providerId),\n\t\t\t\t\t\t\t\t\tparagraphSpacing: 32,\n\t\t\t\t\t\t\t\t\twidthType: DimensionType.FractionOfFreeSpace,\n\t\t\t\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\t\t\t\theightType: DimensionType.Auto,\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\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcase ControlType.String: {\n\t\t\t\t\t\tconst isMultiLine = Boolean(variable.options?.displayTextArea)\n\t\t\t\t\t\tconst isTitle = propKeyIsTitleLike(variable.name) && !isMultiLine\n\t\t\t\t\t\tconst agentStringPreviewImage = isMultiLine ? agentContentImage : agentTitleImage\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: isMultiLine ? dataContentLightImage : dataTitleLightImage,\n\t\t\t\t\t\t\timageDark: isMultiLine ? dataContentDarkImage : dataTitleDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentStringPreviewImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\t// FIXME: add correct size\n\t\t\t\t\t\t\tintrinsicWidth: 200,\n\t\t\t\t\t\t\tintrinsicHeight: 200,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\tconst text = createRichTextNodeWithTag({\n\t\t\t\t\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\t\t\t\t\ttag: isTitle ? \"h1\" : \"p\",\n\t\t\t\t\t\t\t\t\ttext: variable.name,\n\t\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\t\t\t\twidth: 600,\n\t\t\t\t\t\t\t\t\t\theight: isTitle ? 60 : 16,\n\t\t\t\t\t\t\t\t\t\twidthType: isMultiLine ? DimensionType.FixedNumber : DimensionType.Auto,\n\t\t\t\t\t\t\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\t\t\t\t\t\t\ttextContent: createVariableReference(variableId, providerId),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tif (!isTitle) {\n\t\t\t\t\t\t\t\t\ttext.setTextColor(textColor, false)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn text\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcase ControlType.Image: {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataImageLightImage,\n\t\t\t\t\t\t\timageDark: dataImageDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentImageImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\tintrinsicWidth: 600,\n\t\t\t\t\t\t\tintrinsicHeight: 600,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\treturn new FrameNode({\n\t\t\t\t\t\t\t\t\twidth: 600,\n\t\t\t\t\t\t\t\t\theight: 600,\n\t\t\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\t\t\tfillEnabled: true,\n\t\t\t\t\t\t\t\t\tfillType: \"image\",\n\t\t\t\t\t\t\t\t\tfillImage: createVariableReference(variableId, providerId),\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\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcase ControlType.Date: {\n\t\t\t\t\t\tlet agentDatePreviewImage = agentDateImage\n\t\t\t\t\t\tif (variableId === createdAtVariableId) {\n\t\t\t\t\t\t\tagentDatePreviewImage = agentCreatedImage\n\t\t\t\t\t\t} else if (variableId === updatedAtVariableId) {\n\t\t\t\t\t\t\tagentDatePreviewImage = agentUpdatedImage\n\t\t\t\t\t\t}\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataDateLightImage,\n\t\t\t\t\t\t\timageDark: dataDateDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentDatePreviewImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\tintrinsicWidth: 600,\n\t\t\t\t\t\t\tintrinsicHeight: 16,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\tconst text = createRichTextNodeWithTag({\n\t\t\t\t\t\t\t\t\ttree: engine.tree,\n\t\t\t\t\t\t\t\t\ttag: \"p\",\n\t\t\t\t\t\t\t\t\ttext: variable.name,\n\t\t\t\t\t\t\t\t\tattributes: {\n\t\t\t\t\t\t\t\t\t\tname: variable.name,\n\t\t\t\t\t\t\t\t\t\twidth: 600,\n\t\t\t\t\t\t\t\t\t\theight: 16,\n\t\t\t\t\t\t\t\t\t\twidthType: DimensionType.Auto,\n\t\t\t\t\t\t\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\t\t\t\t\t\t\ttextContent: createComputedFormattedDate(createVariableReference(variableId, providerId), {\n\t\t\t\t\t\t\t\t\t\t\tdisplay: variable.options?.displayTime === true ? \"date-time\" : \"date\",\n\t\t\t\t\t\t\t\t\t\t}),\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\ttext.setTextColor(textColor, false)\n\t\t\t\t\t\t\t\treturn text\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcase ControlType.CollectionReference: {\n\t\t\t\t\t\tif (variableId === previousItemVariableId) {\n\t\t\t\t\t\t\thasPreviousItemVariable = true\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (variableId === nextItemVariableId) {\n\t\t\t\t\t\t\thasNextItemVariable = true\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\ttrackingType: ControlType.CollectionReference,\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataReferenceLightImage,\n\t\t\t\t\t\t\timageDark: dataReferenceDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentReferenceImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\tintrinsicWidth: repeaterSize,\n\t\t\t\t\t\t\tintrinsicHeight: repeaterSize,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\tconst collection = engine.componentLoader.dataForIdentifier(variable.dataIdentifier)\n\t\t\t\t\t\t\t\tassert(collection, \"Collection must exist\")\n\t\t\t\t\t\t\t\tconst slugId = collection.annotations?.[AnnotationKey.FramerSlug]\n\n\t\t\t\t\t\t\t\tconst webPages = engine.stores.scopeStore.getWebPageNodes()\n\t\t\t\t\t\t\t\tconst webPageUsingCollection = webPages.find(webPage => {\n\t\t\t\t\t\t\t\t\treturn webPage.dataIdentifier === collection.identifier\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn createCollectionItem({\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tproviderId,\n\t\t\t\t\t\t\t\t\tslugId,\n\t\t\t\t\t\t\t\t\tparentVariableId: variableId,\n\t\t\t\t\t\t\t\t\tproperties: collection.properties,\n\t\t\t\t\t\t\t\t\tdetailPageId: webPageUsingCollection?.id,\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\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tcase ControlType.MultiCollectionReference: {\n\t\t\t\t\t\titems.push({\n\t\t\t\t\t\t\ttrackingType: ControlType.MultiCollectionReference,\n\t\t\t\t\t\t\tkey: variableId,\n\t\t\t\t\t\t\ttitle: variable.name,\n\t\t\t\t\t\t\tkeywords: \"\",\n\t\t\t\t\t\t\timage: dataMultiReferenceLightImage,\n\t\t\t\t\t\t\timageDark: dataMultiReferenceDarkImage,\n\t\t\t\t\t\t\tagentPreviewImage: agentMultiReferenceImage,\n\t\t\t\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\t\t\t\tintrinsicWidth: repeaterSize,\n\t\t\t\t\t\t\tintrinsicHeight: repeaterSize,\n\t\t\t\t\t\t\thideTitle: false,\n\t\t\t\t\t\t\tfullWidth: true,\n\t\t\t\t\t\t\tgenerateNodes() {\n\t\t\t\t\t\t\t\tconst collection = engine.componentLoader.dataForIdentifier(variable.dataIdentifier)\n\t\t\t\t\t\t\t\tassert(collection, \"Collection must exist\")\n\t\t\t\t\t\t\t\tconst slugId = collection.annotations?.[AnnotationKey.FramerSlug]\n\n\t\t\t\t\t\t\t\tconst webPages = engine.stores.scopeStore.getWebPageNodes()\n\t\t\t\t\t\t\t\tconst webPageUsingCollection = webPages.find(webPage => {\n\t\t\t\t\t\t\t\t\treturn webPage.dataIdentifier === collection.identifier\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tconst node = createCollectionList({\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tidentifier: collection.identifier,\n\t\t\t\t\t\t\t\t\tslugId,\n\t\t\t\t\t\t\t\t\tproperties: collection.properties,\n\t\t\t\t\t\t\t\t\tdetailPageId: webPageUsingCollection?.id,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tnode.set({\n\t\t\t\t\t\t\t\t\tcollectionLimit: 10,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn node\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst hasNavigationVariables = hasPreviousItemVariable || hasNextItemVariable\n\t\tconst collectionNode = scopeInfo.collectionNode\n\n\t\tif (hasNavigationVariables || collectionNode) {\n\t\t\titems.push({\n\t\t\t\ttrackingType: ControlType.CollectionReference,\n\t\t\t\tkey: \"previous-next\",\n\t\t\t\ttitle: \"Previous / Next\",\n\t\t\t\tkeywords: \"\",\n\t\t\t\timage: dataPreviousNextLightImage,\n\t\t\t\timageDark: dataPreviousNextDarkImage,\n\t\t\t\tagentPreviewImage: agentPaginationImage,\n\t\t\t\tagentPreviewWidth: agentCMSPreviewSize,\n\t\t\t\tagentPreviewHeight: agentCMSPreviewSize,\n\t\t\t\tintrinsicWidth: repeaterSize,\n\t\t\t\tintrinsicHeight: repeaterSize,\n\t\t\t\thideTitle: false,\n\t\t\t\tfullWidth: true,\n\t\t\t\tnodesToRegenerate: !hasNavigationVariables && collectionNode ? [collectionNode.id] : undefined,\n\t\t\t\tgenerateNodes() {\n\t\t\t\t\tlet slugVariable: VariableDefinition | undefined\n\t\t\t\t\tlet titleVariable: VariableDefinition | undefined\n\n\t\t\t\t\tif (scopeInfo.variableMap) {\n\t\t\t\t\t\tfor (const [, variable] of scopeInfo.variableMap) {\n\t\t\t\t\t\t\tif (isSlugVariable(variable)) {\n\t\t\t\t\t\t\t\tslugVariable ??= variable\n\t\t\t\t\t\t\t} else if (isStringVariableDefinition(variable)) {\n\t\t\t\t\t\t\t\ttitleVariable ??= variable\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (slugVariable && titleVariable) break\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tassert(slugVariable, \"Slug variable must exist\")\n\n\t\t\t\t\tconst paragraphStylePreset =\n\t\t\t\t\t\tgetDefaultTextStylePreset(engine.tree, \"p\") ?? TextStylePresetNode.createDefault(\"p\")\n\n\t\t\t\t\tconst linkStylePreset = getDefaultLinkStylePreset(engine.tree) ?? LinkStylePresetNode.createDefault()\n\n\t\t\t\t\tconst navigationLinksNode = createCollectionItemNavigationLinks({\n\t\t\t\t\t\tscopeId: scopeInfo.scopeId,\n\t\t\t\t\t\tslugVariableId: slugVariable.id,\n\t\t\t\t\t\ttitleVariableId: titleVariable?.id,\n\t\t\t\t\t\tparagraphStylePreset,\n\t\t\t\t\t\tlinkStylePreset,\n\t\t\t\t\t})\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tnode: navigationLinksNode,\n\t\t\t\t\t\tstylePresets: [paragraphStylePreset, linkStylePreset],\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tif (items.length === 0) return null\n\t\treturn { items, sectionTitle: scopeInfo.dataName }\n\t}, [scopeInfo])\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { useEffect } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { EngineChange } from \"../../../EngineChanges.ts\"\nimport { getProgressPercentageForLocale } from \"./getProgressForLocale.ts\"\nimport * as styles from \"./localeCanvasPreviewToast.styles.ts\"\nimport { useActiveLocalizationLocale } from \"./useActiveLocalizationLocale.ts\"\nimport { useActiveScopeVisibleInLocale } from \"./useActiveScopeVisibleInLocale.tsx\"\n\nconst localeCanvasPreviewToastKey = \"locale-canvas-preview\"\n\nfunction LocaleCanvasPreviewToastText() {\n\tconst activeLocale = useActiveLocalizationLocale()\n\tconst isVisibleInLocale = useActiveScopeVisibleInLocale()\n\n\tif (!activeLocale) return null\n\n\tconst isViewOnly = getIsViewOnly(engine, \"canEditContent\")\n\tconst progress = getProgressPercentageForLocale(activeLocale.id, engine.stores.localizationStore.progressPerLocale)\n\tconst viewingOrEditing = isViewOnly ? \"Viewing\" : \"Editing\"\n\n\tconst message = isVisibleInLocale ? (\n\t\t<>\n\t\t\t{`${viewingOrEditing} ${activeLocale.name} ${Dictionary.Translation}`}\n\t\t\t<span className={styles.label}>{` \u00B7 ${progress}`}</span>\n\t\t</>\n\t) : (\n\t\t<>{`This page is hidden in ${activeLocale.name}`}</>\n\t)\n\n\treturn message\n}\n\nfunction LocaleCanvasPreviewToastInner() {\n\tuseEffect(() => {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey: localeCanvasPreviewToastKey,\n\t\t\tvariant: \"info\",\n\t\t\ttext: <LocaleCanvasPreviewToastText />,\n\t\t\tduration: Infinity,\n\t\t\ticonOverride: \"locale\",\n\t\t\tshowCloseButton: \"never\",\n\t\t\taction: {\n\t\t\t\ttitle: \"Done\",\n\t\t\t\tonClick: () => (engine.stores.chromeStore.canvasLocaleId = defaultLocaleId),\n\t\t\t},\n\t\t})\n\n\t\treturn () => {\n\t\t\ttoast({ type: \"remove\", key: localeCanvasPreviewToastKey })\n\t\t}\n\t}, [])\n\n\treturn null\n}\n\nexport function LocaleCanvasPreviewToast() {\n\tconst showToast = useDeprecatedEngineState(\n\t\t[engine.stores.localizationStore, engine.stores.chromeStore, engine.stores.modalStore, EngineChange.Tree],\n\t\t() => {\n\t\t\treturn (\n\t\t\t\tengine.stores.chromeStore.canvasLocaleId !== defaultLocaleId &&\n\t\t\t\tengine.stores.chromeStore.mainView === ActiveMainView.Canvas &&\n\t\t\t\t!engine.stores.chromeStore.overlay &&\n\t\t\t\t!engine.stores.modalStore.isVisible()\n\t\t\t)\n\t\t},\n\t)\n\n\treturn showToast ? <LocaleCanvasPreviewToastInner /> : null\n}\n", "import type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { clamp } from \"framer-motion\"\nimport type { CountPerLocale } from \"./calculateLocalizationSourceState.ts\"\n\nfunction getPercentage(rawProgress: number) {\n\tconst progress = clamp(0, 1, rawProgress)\n\n\tif (progress === 0) return 0\n\n\t// Once you've finished any item, we make the progress at least 1%, but only 100% if all items\n\t// are finished.\n\treturn 1 + Math.floor(progress * 99)\n}\n\nexport const testing = { getPercentage }\n\nexport function getProgressPercentageForLocale(localeId: LocaleId, progressPerLocale: CountPerLocale): string {\n\tconst progress = progressPerLocale[localeId] ?? 0\n\treturn getPercentage(progress) + \"%\"\n}\n", "import \"localeCanvasPreviewToast.styles_1lx5qpk.wyw.css\"; export const label = \"label_l1ozmimg\";", "import { Scroll, Stack, Tabs, TabsItem } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens/dimensions\"\nimport { assert, List } from \"@framerjs/shared\"\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 { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveMainView, LocalizationPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { useMemo } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { getId } from \"utils/getId.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport type { RemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { SidebarAdditionRow } from \"../SidebarAdditionRow.tsx\"\nimport * as collectionPanelStyles from \"../contentManagement/CollectionPanel.styles.ts\"\nimport { LeftPanel } from \"../leftPanel/LeftPanel.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { buildSubLabel } from \"../shared/utils/buildSubLabel.ts\"\nimport { LocalizationPluginsPanel } from \"./LocalizationPluginsPanel.tsx\"\nimport * as styles from \"./LocalizationSidebar.styles.ts\"\nimport { LocalizationFooterUpsell } from \"./LocalizationSidebarFooterUpsell.tsx\"\nimport { hasBatchTranslatableItems, showBatchTranslateAllModal } from \"./batchTranslateUtils.ts\"\nimport { createLocale, deleteLocaleWithConfirmation } from \"./createLocale.tsx\"\nimport { getProgressPercentageForLocale } from \"./getProgressForLocale.ts\"\nimport { useActiveLocalizationLocale } from \"./useActiveLocalizationLocale.ts\"\nimport { useLocales } from \"./useLocales.ts\"\n\nfunction isDraft(localeId: LocaleId): boolean {\n\tconst locale = engine.tree.root.getNonDefaultLocale(localeId)\n\treturn locale?.draft ?? false\n}\n\nfunction openSettings(initialLocaleId: LocaleId) {\n\trecord(\"ui_interaction\", { id: \"edit_localization\", page: Pages.localizationPanel })\n\tengine.stores.localizationStore.selectedLocaleId = initialLocaleId\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.LocaleSettings,\n\t\tinitialLocaleId,\n\t\tsource: \"localization_sidebar\",\n\t})\n}\n\nfunction getMenuOptionsGetter(remoteDispatch: RemoteDispatch | null) {\n\treturn (localeId: LocaleId): MenuItemOptions[] => {\n\t\tconst selectedLocale = engine.tree.root.getNonDefaultLocale(localeId)\n\t\tassert(selectedLocale)\n\n\t\tconst localizedValuesIsViewOnly = getIsViewOnly(engine, \"canEditLocalizedValues\")\n\t\tconst localesIsViewOnly = getIsViewOnly(engine, \"canEditLocales\")\n\n\t\tconst localeIsDraft = isDraft(localeId)\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Settings\",\n\t\t\t\tenabled: !localesIsViewOnly,\n\t\t\t\tclick: () => openSettings(localeId),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Draft,\n\t\t\t\tenabled: !localesIsViewOnly,\n\t\t\t\tchecked: localeIsDraft,\n\t\t\t\tclick: () => {\n\t\t\t\t\tfunction updateDraftStatus() {\n\t\t\t\t\t\tconst locales = engine.tree.root.locales\n\t\t\t\t\t\tif (!locales) return\n\t\t\t\t\t\tconst newLocales = locales.map(locale => {\n\t\t\t\t\t\t\tif (locale.id !== localeId) return locale\n\t\t\t\t\t\t\tconst draft = !localeIsDraft\n\t\t\t\t\t\t\trecord(\"locale_update\", {\n\t\t\t\t\t\t\t\tdraft,\n\t\t\t\t\t\t\t\tcode: locale.code,\n\t\t\t\t\t\t\t\tname: locale.name,\n\t\t\t\t\t\t\t\tslug: locale.slug,\n\t\t\t\t\t\t\t\thasFallback: Boolean(locale.fallback),\n\t\t\t\t\t\t\t\tsource: \"localization_sidebar\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn { ...locale, draft }\n\t\t\t\t\t\t})\n\t\t\t\t\t\tengine.tree.root.set({ locales: newLocales })\n\t\t\t\t\t}\n\n\t\t\t\t\tif (localeIsDraft) {\n\t\t\t\t\t\tupdateDraftStatus()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.ConfirmCollectionItemStatusChange,\n\t\t\t\t\t\t\tvariant: \"destructive\",\n\t\t\t\t\t\t\ttitle: \"Mark as Draft\",\n\t\t\t\t\t\t\tdescription: \"Your locale will be removed from your website after you publish your changes.\",\n\t\t\t\t\t\t\tconfirmLabel: \"Confirm\",\n\t\t\t\t\t\t\tonConfirm: updateDraftStatus,\n\t\t\t\t\t\t\tsource: \"localization_sidebar\",\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: `${Dictionary.Translate} All`,\n\t\t\t\tenabled: !localizedValuesIsViewOnly && hasBatchTranslatableItems(selectedLocale),\n\t\t\t\tclick: () => showBatchTranslateAllModal(selectedLocale, \"localization_sidebar\"),\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\tenabled: !localesIsViewOnly,\n\t\t\t\tclick: () => deleteLocaleWithConfirmation(selectedLocale.id, \"localization_sidebar\", remoteDispatch),\n\t\t\t},\n\t\t]\n\t}\n}\n\nfunction selectLocale(id: LocaleId) {\n\tengine.stores.localizationStore.selectedLocaleId = id\n}\n\nconst onTabSelect = engine.scheduler.wrapHandler((tab: LocalizationPanelTab) => {\n\tengine.stores.chromeStore.activeLocalizationPanelTab = tab\n})\n\nexport const LocalizationSidebar = React.memo(function LocalizationSidebar() {\n\tconst { mainView } = engine.stores.chromeStore.useState()\n\tconst activeTab = engine.stores.chromeStore.useState(state => state.activeLocalizationPanelTab)\n\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tif (mainView !== ActiveMainView.Localizations) return null\n\n\treturn (\n\t\t<LeftPanel>\n\t\t\t<CollectionPanelTabs activeTab={activeTab} />\n\t\t\t{activeTab === LocalizationPanelTab.Locales && (\n\t\t\t\t<Scroll className={cx(collectionPanelStyles.scroll, agentExperimentOn ? styles.scroll : styles.scrollLegacy)}>\n\t\t\t\t\t<LocalesList />\n\t\t\t\t</Scroll>\n\t\t\t)}\n\n\t\t\t{activeTab === LocalizationPanelTab.Plugins && <LocalizationPluginsPanel />}\n\t\t\t<LocalizationFooterUpsell />\n\t\t</LeftPanel>\n\t)\n})\n\nfunction CollectionPanelTabs({ activeTab }: { activeTab: LocalizationPanelTab }) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName={styles.tabHeader}\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t>\n\t\t\t<div className={styles.tabHeaderContent}>\n\t\t\t\t<Tabs value={activeTab} onChange={onTabSelect}>\n\t\t\t\t\t<TabsItem value={LocalizationPanelTab.Locales}>{Dictionary.Locales}</TabsItem>\n\t\t\t\t\t<TabsItem value={LocalizationPanelTab.Plugins}>{Dictionary.Plugins}</TabsItem>\n\t\t\t\t</Tabs>\n\t\t\t</div>\n\t\t\t<div className={styles.divider} />\n\t\t</Stack>\n\t)\n}\n\nfunction LocalesList() {\n\tconst { hasCalculatedLocalizationState } = engine.stores.localizationStore.useState()\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst localesIsViewOnly = useIsViewOnly(\"canEditLocales\") || !hasCalculatedLocalizationState\n\n\tconst locales = useLocales()\n\tconst localeCount = locales.length\n\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst getMenuOptions = useMemo(() => getMenuOptionsGetter(remoteDispatch), [remoteDispatch])\n\n\tconst tooltipByLocaleId = useDeprecatedEngineState(\n\t\tengine.stores.localizationStore,\n\t\t() => {\n\t\t\tconst result: Record<LocaleId, string | undefined> = {}\n\n\t\t\tfor (const locale of locales) {\n\t\t\t\tconst translatedWordCount = engine.stores.localizationStore.getTranslatedWordCountForLocale(locale.id)\n\t\t\t\tif (translatedWordCount === 0) continue\n\t\t\t\tresult[locale.id] = `${translatedWordCount} Words Translated`\n\t\t\t}\n\n\t\t\treturn result\n\t\t},\n\t\t[locales],\n\t)\n\n\tconst handleMove = useEngineCallback(\n\t\t(from: number, to: number) => {\n\t\t\tengine.tree.root.set({ locales: List.move(locales, from, to) })\n\t\t},\n\t\t[locales],\n\t)\n\n\tconst activeLocale = useActiveLocalizationLocale()\n\tconst progressPerLocale = engine.stores.localizationStore.useState(state => state.progressPerLocale)\n\n\treturn (\n\t\t<Sortable\n\t\t\tclassName={collectionPanelStyles.sortable}\n\t\t\tenabled={!localesIsViewOnly && localeCount > 1}\n\t\t\titems={locales}\n\t\t\tmoveItem={handleMove}\n\t\t\tkeyForItem={getId}\n\t\t\tautoSizeAnimationEnabled={false}\n\t\t\tfooter={\n\t\t\t\tlocaleCount === 0 ? undefined : (\n\t\t\t\t\t<SidebarAdditionRow\n\t\t\t\t\t\ttooltip={`Add ${Dictionary.Locale}`}\n\t\t\t\t\t\tonClick={() => createLocale(\"localization_sidebar\")}\n\t\t\t\t\t\tisViewOnly={localesIsViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{({ item: locale }) => {\n\t\t\t\tconst progressLabel = hasCalculatedLocalizationState\n\t\t\t\t\t? getProgressPercentageForLocale(locale.id, progressPerLocale)\n\t\t\t\t\t: undefined\n\t\t\t\tconst subLabel = isAgentExperimentOn\n\t\t\t\t\t? buildSubLabel([locale.draft ? Dictionary.Draft : undefined, progressLabel])\n\t\t\t\t\t: undefined\n\t\t\t\tconst inlineLabel = !isAgentExperimentOn && progressLabel ? `\u00B7 ${progressLabel}` : undefined\n\n\t\t\t\treturn (\n\t\t\t\t\t<CollapsibleRow\n\t\t\t\t\t\tid={locale.id}\n\t\t\t\t\t\ttitle={locale.name}\n\t\t\t\t\t\ttooltip={tooltipByLocaleId[locale.id]}\n\t\t\t\t\t\tIcon={<LocaleFlag localeCode={locale.code} />}\n\t\t\t\t\t\tbadge={!isAgentExperimentOn && locale.draft ? Dictionary.Draft : undefined}\n\t\t\t\t\t\tinlineLabel={inlineLabel}\n\t\t\t\t\t\tsubLabel={subLabel}\n\t\t\t\t\t\tonEdit={hasCalculatedLocalizationState ? openSettings : undefined}\n\t\t\t\t\t\tgetMenuOptions={hasCalculatedLocalizationState ? getMenuOptions : undefined}\n\t\t\t\t\t\tisSelected={activeLocale?.id === locale.id}\n\t\t\t\t\t\tonSelect={selectLocale}\n\t\t\t\t\t\tisEditable={false}\n\t\t\t\t\t\twithCollapse={false}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}}\n\t\t</Sortable>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport { localeSyncManifestId, type PluginManifestId, type VekterPluginManifest } from \"plugins/plugins.ts\"\nimport { showUnsupportedModesToast } from \"plugins/toast.ts\"\nimport type { Mode } from \"#framer-plugin/messages.ts\"\nimport { PluginsPanel } from \"../shared/PluginsPanel.tsx\"\n\nconst marketplacePluginsUrl = \"https://www.framer.com/marketplace/plugins/category/localization/\"\n\n// Plugin modes that are openable from the localization plugins panel. Keep this aligned with the\n// modes the QuickActions opener resolves for the Localizations main view \u2014 otherwise the panel\n// will show plugins that the opener can't actually start, and clicking them will throw.\nconst localizationSupportedModes: readonly Mode[] = [\"localization\"]\n\nconst localizationFeaturedPluginManifestIds: readonly PluginManifestId[] = [localeSyncManifestId]\n\nexport function LocalizationPluginsPanel() {\n\tconst selectedManifestId = useSelectedManifestId()\n\n\treturn (\n\t\t<PluginsPanel\n\t\t\tselectedManifestId={selectedManifestId}\n\t\t\tfeaturedPluginManifestIds={localizationFeaturedPluginManifestIds}\n\t\t\tsupportedModes={localizationSupportedModes}\n\t\t\tonPluginClick={onOpenLocalizationPluginClick}\n\t\t\tmarketplacePluginsUrl={marketplacePluginsUrl}\n\t\t/>\n\t)\n}\n\nfunction useSelectedManifestId(): PluginManifestId | null {\n\treturn engine.stores.pluginStore.useState(state => state.activePlugin?.manifestId ?? null)\n}\n\nconst onOpenLocalizationPluginClick = engine.scheduler.wrapHandler((manifest: VekterPluginManifest) => {\n\t// Guards against a stale manifest making it through if eligibility filtering ever lags behind\n\t// what the opener can actually resolve in Localizations view.\n\tconst supportedMode = localizationSupportedModes.find(mode => manifest.modes.includes(mode))\n\tif (!supportedMode) {\n\t\tshowUnsupportedModesToast(localizationSupportedModes)\n\t\treturn\n\t}\n\n\tvoid engine.stores.pluginStore.openPlugin(manifest, engine, { mode: \"localization\" })\n})\n", "import \"LocalizationSidebar.styles_sfxmno.wyw.css\"; export const tabHeader = \"tabHeader_t1czrwq0\";\nexport const tabHeaderContent = \"tabHeaderContent_t1i7ah84\";\nexport const divider = \"divider_d2vsvkl\";\nexport const scrollLegacy = \"scrollLegacy_si3hwkm\";\nexport const scroll = \"scroll_s18pro9\";", "import { Button, Progress, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport React, { useCallback } from \"react\"\nimport { showLocalizationTranslationLimitUpsell } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport * as styles from \"./LocalizationSidebarFooterUpsell.styles.ts\"\nimport { useTranslationLimits } from \"./getTranslationLimits.ts\"\n\nexport const LocalizationFooterUpsell = React.memo(function LocalizationFooterUpsell() {\n\tconst { hasWordLimit, maxTranslatableWords, currentTranslatedWords } = useTranslationLimits()\n\tconst hasCalculatedLocalizationState = engine.stores.localizationStore.useState(\n\t\tstate => state.hasCalculatedLocalizationState,\n\t)\n\n\tconst handleUpgrade = useCallback(() => showLocalizationTranslationLimitUpsell(engine, \"localization_sidebar\"), [])\n\n\tif (!hasCalculatedLocalizationState || !hasWordLimit) return null\n\n\tconst showWordLimitWarning =\n\t\t(maxTranslatableWords > 0 || currentTranslatedWords > 0) && currentTranslatedWords >= maxTranslatableWords * 0.95\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tdirection=\"column\"\n\t\t\tclassName={styles.borderTop}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.panelPadding}\n\t\t>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={styles.header}>\n\t\t\t\t<T>Words</T>\n\t\t\t\t<span className={cx(styles.label, showWordLimitWarning && styles.warningTint)}>\n\t\t\t\t\t{currentTranslatedWords.toLocaleString()} / {maxTranslatableWords.toLocaleString()}\n\t\t\t\t</span>\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"column\" gap={dimensions.css.panelGap}>\n\t\t\t\t<Progress\n\t\t\t\t\tvalue={currentTranslatedWords}\n\t\t\t\t\tmax={maxTranslatableWords}\n\t\t\t\t\ttint={showWordLimitWarning ? \"warning\" : undefined}\n\t\t\t\t/>\n\t\t\t\t<Button bold onClick={handleUpgrade}>\n\t\t\t\t\tUpgrade\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import \"LocalizationSidebarFooterUpsell.styles_2xedt7.wyw.css\"; export const borderTop = \"borderTop_bvhajod\";\nexport const header = \"header_hgiigg\";\nexport const label = \"label_l1us5c1m\";\nexport const warningTint = \"warningTint_w1tewvxq\";", "import type { ComboBoxListItem, ComboBoxProps, StickyHeaderLevel } from \"@framerjs/fresco\"\nimport {\n\tBadge,\n\tButton,\n\tCenterChild,\n\tComboBox,\n\tDropdownButton,\n\tIconComponentSmall,\n\tIconDots,\n\tIconLayoutTemplate,\n\tIconLock,\n\tIconMagicSmall,\n\tIconPage,\n\tIconSidebarCollection,\n\tReadOnlyContext,\n\tStack,\n\tVirtualList,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { Events } from \"@framerjs/fresco/layout-transitions\"\nimport { fontSizeTokens } from \"@framerjs/fresco/src/components/Font.styles\"\nimport type { AttachmentEdgePreferences } from \"@framerjs/fresco/src/components/Popover\"\nimport { dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLocaleConfig } from \"document/models/CanvasTree/traits/WithLocaleConfig.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { UniqueLocalizedValues } from \"document/stores/LocalizationStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { isLocalizedValueManagedByPlugin } from \"document/utils/isLocalizedValueManagedByPlugin.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { isLocalizationScope } from \"../QuickActions/utils/LocalizationScope.ts\"\nimport { IconAgentCMS } from \"../agentPanel/components/IconAgentCMS.tsx\"\nimport { IconAgentComponent } from \"../agentPanel/components/IconAgentComponent.tsx\"\nimport { IconAgentPage } from \"../agentPanel/components/IconAgentPage.tsx\"\nimport { EscapePrecedence, useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\nimport { IconAgentBreakpointLayoutTemplate } from \"../layers/AgentLayerIcons.tsx\"\nimport { stopPropagation } from \"../properties/rows/utils/stopPropagation.ts\"\nimport { CollapseIndicator } from \"../shared/CollapseIndicator.tsx\"\nimport { ImagePopoutButton } from \"../shared/ImagePopoutButton.tsx\"\nimport { TableSearchBar } from \"../shared/TableSearchBar.tsx\"\nimport { showAiCreditLimitModalIfReached } from \"../shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport {\n\tupsellLocalizationTranslationLimit,\n\tupsellTranslatableWordLimit,\n} from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { IconMagic } from \"./IconMagic.tsx\"\nimport * as styles from \"./LocalizationTable.styles.ts\"\nimport { LocalizationTableEmptyState } from \"./LocalizationTableEmptyState.tsx\"\nimport * as badgeStyles from \"./LocalizationValueStatus.styles.ts\"\nimport { LocalizationValueStatus } from \"./LocalizationValueStatus.tsx\"\nimport { canBeBatchTranslated } from \"./canBeBatchTranslated.ts\"\nimport type {\n\tLocalizationSource,\n\tLocalizationSourceGroup,\n\tLocalizationSourceOrGroupStatus,\n} from \"./getLocalizationSources.ts\"\nimport {\n\tallFilterStatuses,\n\tisImageSource,\n\tisMultiLineSourceOrLocalizedValue,\n\tisOverlayOnlyRichTextSource,\n\tisSlugSource,\n\twithLocalizationSubGroups,\n} from \"./getLocalizationSources.ts\"\nimport { getNameForLocalizationStatus } from \"./getNameForLocalizationStatus.ts\"\nimport { getTitleForLocalizationScope } from \"./getTitleForLocalizationScope.ts\"\nimport { isIncludedInLocale, toggleLocaleInclusion } from \"./includedLocales.ts\"\nimport { isExpandedSourceGroup } from \"./isExpandedSourceGroup.ts\"\nimport { isGroupExcludedInLocale } from \"./isGroupExcludedInLocale.ts\"\nimport { forEachLocalizationSourceInGroup, someLocalizationSourceInGroup } from \"./localizationSourceGroupUtils.ts\"\nimport { openTextEditorOverlay } from \"./openTextEditorOverlay.ts\"\nimport { approveLocalizedValue, clearLocalizedValue } from \"./updateLocalizedValue.ts\"\nimport { useActiveLocalizationLocale } from \"./useActiveLocalizationLocale.ts\"\nimport { useLocales } from \"./useLocales.ts\"\nimport { useLocalizedValueEditingState } from \"./useLocalizedValueEditingState.ts\"\nimport { useNameForDefaultLocale } from \"./useNameForDefaultLocale.ts\"\nimport { useSourceOptionsMenu } from \"./useSourceOptionsMenu.ts\"\n\nconst popoverOffset = { x: 0, y: 10 }\n\nfunction getExistingTranslationsComboBoxItems(uniqueLocalizedValues: UniqueLocalizedValues): ComboBoxListItem[] {\n\tconst items: ComboBoxListItem[] = []\n\n\tfor (const uniqueLocalizedValue of uniqueLocalizedValues) {\n\t\titems.push({\n\t\t\ttype: \"option\",\n\t\t\tvalue: uniqueLocalizedValue,\n\t\t})\n\t}\n\n\treturn items\n}\n\nfunction AIButton({\n\tactive,\n\tenabled,\n\tonClick,\n}: {\n\tactive: boolean\n\tenabled: boolean\n\tonClick: (event: React.MouseEvent<HTMLButtonElement>) => void\n}) {\n\treturn (\n\t\t<Button\n\t\t\tenabled={enabled}\n\t\t\tonClick={onClick}\n\t\t\ttitle={`${Dictionary.Translate} with ${Dictionary.Ai}`}\n\t\t\tclassName={cx(styles.actionButton, active && styles.actionButtonActive)}\n\t\t>\n\t\t\t<IconMagic active={active} />\n\t\t</Button>\n\t)\n}\n\nfunction OptionsButton({\n\tenabled,\n\tsource,\n\tactiveLocale,\n\tmanagedByPlugin,\n\tonMenuOpen,\n\tonMenuClose,\n}: {\n\tenabled: boolean\n\tsource: LocalizationSource\n\tactiveLocale: Locale\n\tmanagedByPlugin: boolean\n\tonMenuOpen: () => void\n\tonMenuClose: () => void\n}) {\n\tconst sourceOptionsMenu = useSourceOptionsMenu({\n\t\tsource,\n\t\tactiveLocale,\n\t\tmanagedByPlugin,\n\t\tonMenuOpen,\n\t\tonMenuClose,\n\t})\n\n\treturn (\n\t\t<Button\n\t\t\tenabled={enabled}\n\t\t\tclassName={cx(styles.actionButton, sourceOptionsMenu.isOpen && styles.actionButtonActive)}\n\t\t\ttitle=\"View Options\"\n\t\t\tonMouseDown={sourceOptionsMenu.popup}\n\t\t>\n\t\t\t<IconDots />\n\t\t</Button>\n\t)\n}\n\nfunction TranslationInput({\n\tvalue,\n\ttranslationValue,\n\ttextInputEnabled,\n\tplaceholder,\n\tsource,\n\tactiveLocale,\n\tisTranslating,\n\tuniqueLocalizedValues,\n\tcomboBoxRef,\n\tonChange,\n}: {\n\tvalue: string | undefined\n\ttranslationValue: string\n\ttextInputEnabled: boolean\n\tplaceholder: string\n\tsource: LocalizationSource\n\tactiveLocale: Locale\n\tisTranslating: boolean\n\tuniqueLocalizedValues: UniqueLocalizedValues\n\tcomboBoxRef: React.Ref<HTMLInputElement>\n\tonChange: ComboBoxProps[\"onChange\"]\n}) {\n\tconst showButton = isOverlayOnlyRichTextSource(source) || isMultiLineSourceOrLocalizedValue(source, activeLocale)\n\tconst isSlug = isSlugSource(source)\n\n\tconst existingTranslationsItems = React.useMemo(() => {\n\t\tif (!isUndefined(value)) return []\n\t\treturn getExistingTranslationsComboBoxItems(uniqueLocalizedValues)\n\t}, [value, uniqueLocalizedValues])\n\n\tlet inputValue = \"\"\n\tif (isTranslating) {\n\t\tinputValue = translationValue\n\t} else if (!source.inherited && value) {\n\t\tinputValue = value\n\t}\n\n\tif (isSlug) {\n\t\tif (!inputValue.startsWith(\"/\")) {\n\t\t\tinputValue &&= `/${inputValue}`\n\t\t}\n\t\tplaceholder &&= `/${placeholder}`\n\t}\n\n\tconst label = inputValue || placeholder\n\n\tfunction handleButtonClick() {\n\t\tif (upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")) {\n\t\t\treturn\n\t\t}\n\n\t\tengine.stores.chromeStore.setOverlay({\n\t\t\ttype: \"localization\",\n\t\t\tkeyPath: source.keyPath,\n\t\t})\n\t}\n\n\tif (showButton) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tvariant=\"link\"\n\t\t\t\ttitle={`Edit in ${Dictionary.Overlay}`}\n\t\t\t\tonClick={handleButtonClick}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.rowButton,\n\t\t\t\t\ttruncateWithEllipsis,\n\t\t\t\t\t(isUndefined(value) || source.inherited) && styles.placeholderButton,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{label}\n\t\t\t</Button>\n\t\t)\n\t}\n\n\tfunction handleInputFocus(event: React.SyntheticEvent) {\n\t\tif (upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")) {\n\t\t\tevent.preventDefault()\n\t\t\treturn\n\t\t}\n\n\t\tif (event.type !== \"focus\") return\n\n\t\t// If the user has just added another translation, the LocalizationStore\n\t\t// hasn't updated yet. We need to wait for the next frame to decide if\n\t\t// we need to show the upsell.\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tupsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")\n\t\t})\n\t}\n\n\treturn (\n\t\t<ComboBox\n\t\t\tref={comboBoxRef}\n\t\t\tenabled={textInputEnabled}\n\t\t\twrapperClassName={cx(styles.textInput, styles.fullWidth)}\n\t\t\titems={existingTranslationsItems}\n\t\t\tvalue={inputValue}\n\t\t\tplaceholder={placeholder}\n\t\t\tonChange={onChange}\n\t\t\tclassName={styles.textInput}\n\t\t\tonFocus={handleInputFocus}\n\t\t\t// This will prevent a flicker because the input gets focused and\n\t\t\t// unfocused right away.\n\t\t\tonMouseDown={handleInputFocus}\n\t\t/>\n\t)\n}\n\nfunction LocalizationSourceOriginIcon({\n\tisTranslating,\n\tgeneratedByAI,\n\tmanagedByPlugin,\n}: {\n\tisTranslating: boolean\n\tgeneratedByAI: boolean\n\tmanagedByPlugin: boolean\n}) {\n\tconst data = useMemo(() => {\n\t\tif (isTranslating || generatedByAI) return { title: \"Generated by AI\", icon: <IconMagicSmall /> }\n\t\tif (managedByPlugin) return { title: \"Managed by plugin\", icon: <IconLock /> }\n\t}, [isTranslating, generatedByAI, managedByPlugin])\n\n\tif (!data) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<Stack title={data.title} className={styles.originIcon}>\n\t\t\t{data.icon}\n\t\t</Stack>\n\t)\n}\n\n// Defined outside the component to reduce renders\nconst popoverAttachmentEdge: AttachmentEdgePreferences = [\"bottom\", \"top\"]\n\nconst LocalizationSourceRow = React.memo(function LocalizationSourceRow({\n\tsource,\n\tinsetLevel,\n\tactiveLocale,\n\tlocales,\n\tisLast,\n\tuniqueLocalizedValues,\n}: {\n\tsource: LocalizationSource\n\tinsetLevel: styles.InsetLevel\n\tactiveLocale: Locale\n\tlocales: readonly Locale[]\n\tisLast: boolean\n\tuniqueLocalizedValues: UniqueLocalizedValues\n}) {\n\tconst [isContextOpen, setIsContextOpen] = useState(false)\n\tconst [isOptionsOpen, setIsOptionsOpen] = useState(false)\n\tconst comboBoxRef = useRef<HTMLInputElement>(null)\n\n\tconst {\n\t\tisRichText,\n\t\tisImage,\n\t\toriginalInputValue,\n\t\toriginalInputPlaceholder,\n\t\tinputValue,\n\t\tinputPlaceholder,\n\t\tinputEnabled,\n\t\tinputHidden,\n\t\tupdate,\n\t\tisTranslating,\n\t\ttoggleTranslate,\n\t\ttranslationValue,\n\t\ttranslationEnabled,\n\t\tmanagedByPlugin,\n\t\tgeneratedByAI,\n\t\toriginalImageValue,\n\t\toriginalImagePositionX,\n\t\toriginalImagePositionY,\n\t\timageValue,\n\t\timageFallback,\n\t\timagePositionX,\n\t\timagePositionY,\n\t\thandleImageUpload,\n\t\thandleFocalPointChange,\n\t\tupdateAssetSize,\n\t\timageSupportsFocalPoint,\n\t} = useLocalizedValueEditingState(engine, activeLocale, locales, source, \"localization_table\")\n\n\tconst sourceOptionsMenu = useSourceOptionsMenu({\n\t\tsource,\n\t\tactiveLocale,\n\t\tmanagedByPlugin,\n\t\topenAtMousePosition: true,\n\t\tonMenuOpen: () => setIsContextOpen(true),\n\t\tonMenuClose: () => setIsContextOpen(false),\n\t})\n\n\tconst hasWarning = source.localizedValueStatuses[activeLocale.id] === \"warning\"\n\tconst isSlug = isSlugSource(source)\n\n\tfunction handleOriginalInputValueClick() {\n\t\tif (upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")) {\n\t\t\treturn\n\t\t}\n\n\t\tif (isRichText || isMultiLineSourceOrLocalizedValue(source, activeLocale)) {\n\t\t\topenTextEditorOverlay(source)\n\t\t\treturn\n\t\t}\n\n\t\tif (comboBoxRef.current) {\n\t\t\tcomboBoxRef.current.focus()\n\t\t}\n\t}\n\n\tfunction handleImagePopoutBeforePresent() {\n\t\treturn !upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")\n\t}\n\n\tconst originalValue = originalInputValue || originalInputPlaceholder\n\tconst formattedOriginalValue = isSlug && originalValue ? `/${originalValue}` : originalValue\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.row,\n\t\t\t\tstyles.columns,\n\t\t\t\tisContextOpen && styles.rowHighlight,\n\t\t\t\t!isLast && styles.bottomSeparator,\n\t\t\t)}\n\t\t\tonContextMenu={sourceOptionsMenu.popup}\n\t\t>\n\t\t\t<Button\n\t\t\t\tvariant=\"link\"\n\t\t\t\tonClick={handleOriginalInputValueClick}\n\t\t\t\tstyle={{ paddingLeft: styles.getInsetForLevel(insetLevel) + styles.textInsetAlignment }}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.rowButton,\n\t\t\t\t\t!originalInputValue && styles.placeholderButton,\n\t\t\t\t\tmanagedByPlugin && styles.managedByPlugin,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<Stack gap={dimensions.css.panelGap} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t{isImage && (\n\t\t\t\t\t\t<ReadOnlyContext.Provider value>\n\t\t\t\t\t\t\t<ImagePopoutButton\n\t\t\t\t\t\t\t\timageReference={originalImageValue ?? \"\"}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Image}\n\t\t\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\t\t\tonChangeAssetSize={noop}\n\t\t\t\t\t\t\t\tdisplayInPopover\n\t\t\t\t\t\t\t\tpopoverOffset={popoverOffset}\n\t\t\t\t\t\t\t\tpopoverAttachmentEdge={popoverAttachmentEdge}\n\t\t\t\t\t\t\t\tpreviewWithoutInset\n\t\t\t\t\t\t\t\tpopoutButtonClassName={styles.imagePreviewThumbnail}\n\t\t\t\t\t\t\t\tonMouseDown={stopPropagation}\n\t\t\t\t\t\t\t\tonBeforePresent={handleImagePopoutBeforePresent}\n\t\t\t\t\t\t\t\tpositionX={originalImagePositionX}\n\t\t\t\t\t\t\t\tpositionY={originalImagePositionY}\n\t\t\t\t\t\t\t\tonChangeFocalPosition={imageSupportsFocalPoint ? noop : undefined}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t)}\n\t\t\t\t\t{!inputHidden && <span className={truncateWithEllipsis}>{formattedOriginalValue}</span>}\n\t\t\t\t</Stack>\n\t\t\t</Button>\n\t\t\t<Stack\n\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={cx(styles.fullHeight, managedByPlugin && styles.managedByPlugin)}\n\t\t\t>\n\t\t\t\t<LocalizationSourceOriginIcon\n\t\t\t\t\tisTranslating={isTranslating}\n\t\t\t\t\tgeneratedByAI={generatedByAI}\n\t\t\t\t\tmanagedByPlugin={managedByPlugin}\n\t\t\t\t/>\n\t\t\t\t<Stack\n\t\t\t\t\tgap={dimensions.css.panelGap}\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={cx(styles.fullHeight, styles.fullWidth, styles.grow)}\n\t\t\t\t>\n\t\t\t\t\t{isImage && (\n\t\t\t\t\t\t<ImagePopoutButton\n\t\t\t\t\t\t\timageReference={imageValue ?? imageFallback ?? \"\"}\n\t\t\t\t\t\t\ttitle={Dictionary.Image}\n\t\t\t\t\t\t\tonChange={handleImageUpload}\n\t\t\t\t\t\t\tonChangeAssetSize={updateAssetSize}\n\t\t\t\t\t\t\tdisplayInPopover\n\t\t\t\t\t\t\tpopoverOffset={popoverOffset}\n\t\t\t\t\t\t\tpopoverAttachmentEdge={popoverAttachmentEdge}\n\t\t\t\t\t\t\tpreviewWithoutInset\n\t\t\t\t\t\t\tpreviewDimmed={!imageValue}\n\t\t\t\t\t\t\tpopoutButtonClassName={styles.imagePreviewThumbnail}\n\t\t\t\t\t\t\tonBeforePresent={handleImagePopoutBeforePresent}\n\t\t\t\t\t\t\tonChangeFocalPosition={handleFocalPointChange}\n\t\t\t\t\t\t\tpositionX={imagePositionX}\n\t\t\t\t\t\t\tpositionY={imagePositionY}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{!inputHidden && (\n\t\t\t\t\t\t<TranslationInput\n\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\ttranslationValue={translationValue}\n\t\t\t\t\t\t\ttextInputEnabled={inputEnabled}\n\t\t\t\t\t\t\tplaceholder={inputPlaceholder}\n\t\t\t\t\t\t\tsource={source}\n\t\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\t\tisTranslating={isTranslating}\n\t\t\t\t\t\t\tuniqueLocalizedValues={uniqueLocalizedValues}\n\t\t\t\t\t\t\tcomboBoxRef={comboBoxRef}\n\t\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t\t<Stack\n\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"end\"\n\t\t\t\tclassName={styles.fullHeight}\n\t\t\t>\n\t\t\t\t<Stack\n\t\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={cx(styles.actionButtons, (isOptionsOpen || isTranslating) && styles.actionButtonsAlwaysVisible)}\n\t\t\t\t>\n\t\t\t\t\t{!source.aiTranslationDisabled && (\n\t\t\t\t\t\t<AIButton\n\t\t\t\t\t\t\tactive={isTranslating}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tif (upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")) {\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (isRichText) {\n\t\t\t\t\t\t\t\t\topenTextEditorOverlay(source, { startTranslation: true })\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttoggleTranslate()\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tenabled={translationEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<OptionsButton\n\t\t\t\t\t\tsource={source}\n\t\t\t\t\t\tenabled={!isTranslating}\n\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\tmanagedByPlugin={managedByPlugin}\n\t\t\t\t\t\tonMenuOpen={() => setIsOptionsOpen(true)}\n\t\t\t\t\t\tonMenuClose={() => setIsOptionsOpen(false)}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"end\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={cx(!hasWarning && styles.hideWhenRowHovered, !hasWarning && isOptionsOpen && styles.hide)}\n\t\t\t\t>\n\t\t\t\t\t<LocalizationValueStatus source={source} activeLocale={activeLocale} />\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</div>\n\t)\n})\n\nfunction getItemKey(item: LocalizationSource | LocalizationSourceGroup): string {\n\tif (item.type === \"sourceGroup\") return item.nodeId + \"-group\"\n\treturn item.keyPath\n}\n\nfunction getStickyHeaderLevelForItem(item: LocalizationSource | LocalizationSourceGroup): StickyHeaderLevel {\n\tif (item.type !== \"sourceGroup\") return \"off\"\n\tif (item.groupType === \"collectionItem\") return \"secondary\"\n\treturn \"primary\"\n}\n\nfunction displayDefaultLocaleOptions(event: React.MouseEvent<HTMLButtonElement>) {\n\tconst isReadOnly = getIsViewOnly(engine, \"canDesign\")\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: `${isReadOnly ? Dictionary.View : Dictionary.Edit} Default Language`,\n\t\t\t\tclick: () => engine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.project }),\n\t\t\t},\n\t\t],\n\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t)\n}\n\nfunction displayActiveLocaleOptions(event: React.MouseEvent<HTMLButtonElement>) {\n\tconst { selectedLocaleId } = engine.stores.localizationStore\n\tif (!selectedLocaleId) return\n\n\tconst isReadOnly = getIsViewOnly(engine, \"canDesign\")\n\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: `${isReadOnly ? Dictionary.View : Dictionary.Edit} ${Dictionary.Locale}`,\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.LocaleSettings,\n\t\t\t\t\t\tinitialLocaleId: selectedLocaleId,\n\t\t\t\t\t\tsource: \"localization_table\",\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t)\n}\n\nconst updateSearchTerm = engine.scheduler.wrapHandler((newSearchTerm: string) => {\n\tengine.stores.localizationStore.searchTerm = newSearchTerm\n})\n\nfunction setStatus(status: LocalizationSourceOrGroupStatus | null) {\n\tif (status === engine.stores.localizationStore.status) {\n\t\tengine.stores.localizationStore.resetPersistedOrder(engine.stores.treeStore.getDataTreeOrPartialTree())\n\t} else {\n\t\tengine.stores.localizationStore.status = status\n\t}\n}\n\nfunction showStatusOptions(event: React.MouseEvent<HTMLDivElement>) {\n\tconst element = event.currentTarget\n\tconst bounds = element.getBoundingClientRect()\n\tconst activeStatus = engine.stores.localizationStore.status\n\n\tconst statusMenuItems = allFilterStatuses.map((status): MenuItemOptions => {\n\t\tconst checked = activeStatus === status\n\t\treturn {\n\t\t\tchecked,\n\t\t\tlabel: getNameForLocalizationStatus(status),\n\t\t\tclick: () => setStatus(status),\n\t\t}\n\t})\n\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: \"All\",\n\t\t\t\tchecked: !activeStatus,\n\t\t\t\tclick: () => setStatus(null),\n\t\t\t},\n\t\t\t...statusMenuItems,\n\t\t],\n\t\t{\n\t\t\tlocation: {\n\t\t\t\tx: bounds.left,\n\t\t\t\ty: bounds.bottom - 10,\n\t\t\t},\n\t\t},\n\t)\n}\n\nfunction getGroupIcon(icon: LocalizationSourceGroup[\"groupType\"], agentExperimentEnabled: boolean) {\n\tswitch (icon) {\n\t\tcase \"component\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentComponent />\n\t\t\treturn <IconComponentSmall />\n\t\tcase \"template\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentBreakpointLayoutTemplate />\n\t\t\treturn <IconLayoutTemplate />\n\t\tcase \"collection\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentCMS />\n\t\t\treturn <IconSidebarCollection />\n\t\tcase \"page\":\n\t\tcase \"settings\":\n\t\tcase \"collectionItem\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentPage />\n\t\t\treturn <IconPage />\n\t\tdefault:\n\t\t\tassertNever(icon)\n\t}\n}\n\nfunction hasNonManagedLocalizedValue(source: LocalizationSource, activeLocale: Locale): boolean {\n\tconst localizedValue = isImageSource(source)\n\t\t? source.imageLocalizedValues[activeLocale.id]\n\t\t: source.localizedValues[activeLocale.id]\n\tif (!localizedValue) return false\n\n\tconst managedByPlugin = isLocalizedValueManagedByPlugin(engine, source, localizedValue)\n\treturn !managedByPlugin\n}\n\nfunction hasBatchTranslatableSources(group: LocalizationSourceGroup, activeLocale: Locale): boolean {\n\treturn someLocalizationSourceInGroup(group, source =>\n\t\tcanBeBatchTranslated(activeLocale, source, engine.stores.previewStore.framerSiteId),\n\t)\n}\n\nfunction getBatchTranslatableKeyPaths(group: LocalizationSourceGroup, activeLocale: Locale): Set<string> {\n\tconst keyPaths = new Set<string>()\n\n\tforEachLocalizationSourceInGroup(group, source => {\n\t\tif (!canBeBatchTranslated(activeLocale, source, engine.stores.previewStore.framerSiteId)) return\n\t\tkeyPaths.add(source.keyPath)\n\t})\n\n\treturn keyPaths\n}\n\nfunction LocalizationGroup({\n\tgroup,\n\texpanded,\n\tinsetLevel,\n\tactiveLocale,\n\tonExpandedToggle,\n}: {\n\tgroup: LocalizationSourceGroup\n\texpanded: boolean\n\tinsetLevel: styles.InsetLevel\n\tactiveLocale: Locale\n\tonExpandedToggle: (willExpand: boolean, groupId: string) => void\n}) {\n\tconst { groupType, name } = group\n\tconst readOnly = useIsViewOnly(\"canEditContent\")\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst hasAnyBatchTranslatableSources = useMemo(() => {\n\t\treturn hasBatchTranslatableSources(group, activeLocale)\n\t}, [group, activeLocale])\n\n\tconst canBeExpanded = group.items.length > 0 || (withLocalizationSubGroups(group) && group.groups.length > 0)\n\n\tconst openBatchTranslateModal = (event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\n\t\tif (showModalIfAiDisabled(engine, \"localization_table\")) return\n\t\tif (showAiCreditLimitModalIfReached(engine, \"localization_table\")) return\n\t\tif (upsellTranslatableWordLimit(engine, \"localization_table\")) return\n\n\t\tconst batchTranslatableKeyPaths = getBatchTranslatableKeyPaths(group, activeLocale)\n\t\tassert(batchTranslatableKeyPaths.size > 0, \"Expected batch translatable key paths\")\n\n\t\tif (!expanded) {\n\t\t\tengine.stores.localizationStore.setSourceGroupExpanded(group.nodeId, activeLocale, true, false)\n\t\t}\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.BatchTranslate,\n\t\t\tlocalesWithKeyPaths: [{ locale: activeLocale, keyPaths: batchTranslatableKeyPaths }],\n\t\t\tsource: \"localization_table\",\n\t\t})\n\t}\n\n\tconst toggleExpanded = useEngineCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (!Events.isLeftMouseButton(event)) return\n\n\t\t\tconst shouldExpand = !expanded\n\n\t\t\tengine.scheduler.processAndRenderSync(() => {\n\t\t\t\tengine.stores.localizationStore.setSourceGroupExpanded(group.nodeId, activeLocale, shouldExpand, event.altKey)\n\t\t\t})\n\n\t\t\tonExpandedToggle(shouldExpand, group.nodeId)\n\t\t},\n\t\t[group.nodeId, expanded, activeLocale, onExpandedToggle],\n\t)\n\n\tconst [menuOpen, setMenuOpen] = React.useState(false)\n\n\tconst isExcludedGroup = isGroupExcludedInLocale(group, activeLocale)\n\n\tconst showOptions = (event: React.MouseEvent, { atMousePosition = false }: { atMousePosition: boolean }) => {\n\t\tevent.stopPropagation()\n\n\t\tconst element = event.currentTarget\n\t\tconst bounds = element.getBoundingClientRect()\n\n\t\tfunction isClearableItem(source: LocalizationSource): boolean {\n\t\t\treturn hasNonManagedLocalizedValue(source, activeLocale)\n\t\t}\n\n\t\tfunction isNewItem(source: LocalizationSource): boolean {\n\t\t\treturn source.localizedValueStatuses[activeLocale.id] === \"new\"\n\t\t}\n\n\t\tconst hasAnyNewItem = someLocalizationSourceInGroup(group, isNewItem)\n\t\tconst hasAnyClearableItem = someLocalizationSourceInGroup(group, isClearableItem)\n\n\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Ignore All\",\n\t\t\t\tenabled: hasAnyNewItem && !readOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tforEachLocalizationSourceInGroup(group, source => {\n\t\t\t\t\t\tif (!isNewItem(source)) return\n\n\t\t\t\t\t\tapproveLocalizedValue(engine, source, activeLocale, { trackingSource: \"localization_table\" })\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Clear All\",\n\t\t\t\tenabled: hasAnyClearableItem && !readOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tforEachLocalizationSourceInGroup(group, source => {\n\t\t\t\t\t\tif (!isClearableItem(source)) return\n\n\t\t\t\t\t\tclearLocalizedValue(engine, source, activeLocale, {\n\t\t\t\t\t\t\ttarget: \"all\",\n\t\t\t\t\t\t\ttrackingSource: \"localization_table\",\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\ttype: \"separator\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: `${isExcludedGroup ? Dictionary.Show : Dictionary.Hide} in this Locale`,\n\t\t\t\tenabled: !readOnly,\n\t\t\t\tvisible: group.supportsLocaleVisibility,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst node = engine.tree.get(group.nodeId)\n\t\t\t\t\tassert(withLocaleConfig(engine.tree, node), \"Expected node to support locale visibility\")\n\n\t\t\t\t\ttoggleLocaleInclusion(engine, node, activeLocale.id)\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\n\t\tif (group.groupType === \"collection\") {\n\t\t\tconst collectionNode = engine.tree.getNodeWithTrait(group.nodeId, isCollectionNode)\n\t\t\tconst allItemsAreHidden =\n\t\t\t\tcollectionNode?.getUnsortedChildren().every(collectionItem => {\n\t\t\t\t\treturn !isIncludedInLocale(engine.tree, collectionItem, activeLocale.id)\n\t\t\t\t}) ?? false\n\n\t\t\tmenuItems.push({\n\t\t\t\tlabel: `${allItemsAreHidden ? Dictionary.Show : Dictionary.Hide} All in this Locale`,\n\t\t\t\tdescription: `${allItemsAreHidden ? `Include` : `Exclude`} all collection items`,\n\t\t\t\tvisible: group.groupType === \"collection\",\n\t\t\t\tenabled: !readOnly && group.groups.length > 0,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst node = engine.tree.getNodeWithTrait(group.nodeId, isCollectionNode)\n\t\t\t\t\tif (!node) return\n\n\t\t\t\t\tif (!allItemsAreHidden) {\n\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\ttype: ModalType.ConfirmHideAllInThisLocale,\n\t\t\t\t\t\t\ttitle: `Hide all ${node.resolveValue(\"name\")}`,\n\t\t\t\t\t\t\tdescription: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\tThis will hide{\" \"}\n\t\t\t\t\t\t\t\t\t<span className={styles.confirmHideAllInThisLocaleBoldText}>all {node.resolveValue(\"name\")}</span>{\" \"}\n\t\t\t\t\t\t\t\t\tfrom the collection in the current locale. To hide just one, select the individual item.\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tconfirmLabel: `Hide All Items`,\n\t\t\t\t\t\t\tcancelLabel: Dictionary.Cancel,\n\t\t\t\t\t\t\tinteractionRequired: true,\n\t\t\t\t\t\t\tonConfirm: () => toggleAllItemsInCollection(group.nodeId, activeLocale, allItemsAreHidden),\n\t\t\t\t\t\t\tvariant: \"destructive\",\n\t\t\t\t\t\t\tdismissVariant: \"default\",\n\t\t\t\t\t\t\tbuttonDirection: \"row\",\n\t\t\t\t\t\t\thasBackdrop: true,\n\t\t\t\t\t\t\tsource: \"localization_table\",\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\ttoggleAllItemsInCollection(group.nodeId, activeLocale, true)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tsetMenuOpen(true)\n\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\tlocation: atMousePosition\n\t\t\t\t? { x: event.clientX, y: event.clientY }\n\t\t\t\t: { x: bounds.right + dimensions.values.contextMenuOffsetX, y: bounds.bottom },\n\t\t\tonDone: () => setMenuOpen(false),\n\t\t})\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tonMouseDown={toggleExpanded}\n\t\t\tjustifyContent=\"space-between\"\n\t\t\trole={canBeExpanded ? \"button\" : undefined}\n\t\t\tpaddingLeft={`calc(${dimensions.css.panelPadding} + ${styles.getInsetForLevel(insetLevel)}px)`}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tonContextMenu={event => {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tshowOptions(event, { atMousePosition: true })\n\t\t\t}}\n\t\t\tclassName={cx(styles.group, canBeExpanded && styles.collapsableGroup)}\n\t\t>\n\t\t\t<Stack direction=\"row\" alignItems=\"center\" className={cx(isExcludedGroup && styles.excludedGroupTitle)}>\n\t\t\t\t<CollapseIndicator\n\t\t\t\t\twithMargin={false}\n\t\t\t\t\tcollapsed={!expanded}\n\t\t\t\t\tvisible={canBeExpanded}\n\t\t\t\t\tclassName={styles.collapseIndicator}\n\t\t\t\t/>\n\t\t\t\t<CenterChild className={cx(styles.groupIcon, groupType === \"component\" && styles.withComponentTint)}>\n\t\t\t\t\t{getGroupIcon(groupType, agentExperimentEnabled)}\n\t\t\t\t</CenterChild>\n\t\t\t\t{name}\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"row\" className={cx(styles.noShrink, !menuOpen && styles.hiddenUnlessGroupHovered)}>\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\tenabled={!readOnly && hasAnyBatchTranslatableSources}\n\t\t\t\t\tclassName={styles.buttonWithLeftIcon}\n\t\t\t\t\ttitle={`${Dictionary.Translate} with ${Dictionary.Ai}`}\n\t\t\t\t\tonMouseDown={openBatchTranslateModal}\n\t\t\t\t>\n\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={2}>\n\t\t\t\t\t\t<IconMagic active={false} />\n\t\t\t\t\t\t{Dictionary.Translate}\n\t\t\t\t\t</Stack>\n\t\t\t\t</Button>\n\t\t\t\t<Button\n\t\t\t\t\tclassName={cx(styles.actionButton, menuOpen && styles.actionButtonActive)}\n\t\t\t\t\ttitle=\"View Options\"\n\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\tshowOptions(event, { atMousePosition: false })\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<IconDots />\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t\t{isExcludedGroup && (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"end\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={cx(styles.hideWhenGroupHovered, menuOpen && styles.hide)}\n\t\t\t\t>\n\t\t\t\t\t<Badge variant=\"neutral\" className={badgeStyles.badge}>\n\t\t\t\t\t\tHidden\n\t\t\t\t\t</Badge>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction toggleAllItemsInCollection(nodeId: NodeID, activeLocale: Locale, shouldInclude: boolean) {\n\tconst node = engine.tree.getNodeWithTrait(nodeId, isCollectionNode)\n\tif (!node) return\n\n\tfor (const collectionItem of node.getUnsortedChildren()) {\n\t\tconst isIncluded = isIncludedInLocale(engine.tree, collectionItem, activeLocale.id)\n\n\t\tif (shouldInclude === isIncluded) continue\n\n\t\ttoggleLocaleInclusion(engine, collectionItem, activeLocale.id)\n\t}\n}\n\n/** group might become out of view after collapsing, so we scroll to it */\nfunction useScrollToLastCollapsedGroup() {\n\tconst [scrollToIndex, setScrollToIndex] = useState<number | undefined>(undefined)\n\n\tconst onExpandedToggle = useCallback((willExpand: boolean, nodeId: string) => {\n\t\tif (willExpand) return\n\n\t\tconst listItems = engine.stores.localizationStore.virtualListItems\n\t\tif (!listItems || !listItems.length) return\n\n\t\tconst indexToScrollTo = listItems.findIndex(item => item.nodeId === nodeId)\n\t\tif (indexToScrollTo === -1) return\n\n\t\tsetScrollToIndex(indexToScrollTo)\n\t}, [])\n\n\tuseEffect(() => {\n\t\t// reset scrollToIndex so if we collapse same group again - prop change is triggered.\n\t\t// Note: this useEffect relies on scrolling performed with useLayoutEffect inside VirtualList component\n\t\tif (scrollToIndex !== undefined) {\n\t\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\t\tsetScrollToIndex(undefined)\n\t\t}\n\t}, [scrollToIndex])\n\n\treturn { scrollToIndex, onExpandedToggle }\n}\n\nfunction LocalizationTableInner() {\n\tconst { virtualListItems, searchTerm, status, scopeFilter, expandedSourceGroups, hasCalculatedLocalizationState } =\n\t\tengine.stores.localizationStore.useState()\n\n\tconst isReadOnly = useIsViewOnly(\"canEditContent\")\n\n\tconst defaultLocaleName = useNameForDefaultLocale()\n\n\tconst scroll = React.useRef<HTMLDivElement>(null)\n\n\tuseRecordEffect(\"ui_impression\", { page: \"localization_items_table\" })\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Scroll position reset doesn't use its dependencies\n\tuseEffect(() => {\n\t\t// Scroll to top when the search term, status, or filter changes\n\t\tconst scrollElement = scroll.current\n\t\tif (!scrollElement) return\n\t\tscrollElement.scrollTop = 0\n\t}, [searchTerm, status, scopeFilter])\n\n\tconst scopeFilterTitle = useDeprecatedEngineState(\n\t\t[EngineChange.ActiveBundle, EngineChange.Tree],\n\t\t(): string | undefined => {\n\t\t\tif (!scopeFilter) return\n\t\t\tconst node = engine.tree.getNodeWithTrait(scopeFilter, isLocalizationScope)\n\t\t\tif (!node) return\n\t\t\treturn getTitleForLocalizationScope(node, engine.tree, engine.componentLoader)\n\t\t},\n\t\t[scopeFilter],\n\t)\n\n\tuseOnEscape({\n\t\tname: \"LocalizationTable\",\n\t\tprecedence: EscapePrecedence.scopeExit,\n\t\tenabled: () => !engine.stores.chromeStore.overlay,\n\t\thandler: engine.scheduler.wrapHandler(() => {\n\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t}),\n\t})\n\n\tconst locales = useLocales()\n\tconst activeLocale = useActiveLocalizationLocale()\n\n\tconst virtualListItemCount = virtualListItems?.length ?? 0\n\n\tconst hasItems = !!activeLocale && !!virtualListItems && virtualListItemCount > 0\n\n\tconst { scrollToIndex, onExpandedToggle } = useScrollToLastCollapsedGroup()\n\n\treturn (\n\t\t<Stack direction=\"column\" gap={0} className={styles.container}>\n\t\t\t{activeLocale && hasCalculatedLocalizationState && (\n\t\t\t\t<>\n\t\t\t\t\t<TableSearchBar\n\t\t\t\t\t\tenabled\n\t\t\t\t\t\tfullWidthSeparator={hasItems}\n\t\t\t\t\t\tfontSize={fontSizeTokens.tokens.heading}\n\t\t\t\t\t\tvalue={searchTerm}\n\t\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\t\tonChange={updateSearchTerm}\n\t\t\t\t\t\tcategory={scopeFilterTitle}\n\t\t\t\t\t\tonSelectCategory={() => {\n\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\t\t\t\t\tinitialCategory: { type: QuickActionsCategoryType.LocaleScopeFilter },\n\t\t\t\t\t\t\t\tsource: \"localization_table\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClearCategory={() => (engine.stores.localizationStore.scopeFilter = null)}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className={cx(styles.header, styles.columns, styles.bottomSeparator)}>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\ttitle=\"View Default Language Options\"\n\t\t\t\t\t\t\tonMouseDown={displayDefaultLocaleOptions}\n\t\t\t\t\t\t\tclassName={styles.headerButton}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{defaultLocaleName}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\ttitle={`View ${Dictionary.Locale} Options`}\n\t\t\t\t\t\t\tenabled={Boolean(activeLocale)}\n\t\t\t\t\t\t\tonMouseDown={displayActiveLocaleOptions}\n\t\t\t\t\t\t\tclassName={styles.headerButton}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{activeLocale.name}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"end\">\n\t\t\t\t\t\t\t<DropdownButton size={fonts.size.heading} onMouseDown={showStatusOptions}>\n\t\t\t\t\t\t\t\t{status ? getNameForLocalizationStatus(status) : \"All\"}\n\t\t\t\t\t\t\t</DropdownButton>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<ReadOnlyContext.Provider value={isReadOnly}>\n\t\t\t\t{hasItems ? (\n\t\t\t\t\t<VirtualList\n\t\t\t\t\t\tshowScrollbar\n\t\t\t\t\t\tscrollRef={scroll}\n\t\t\t\t\t\tkeyForItem={getItemKey}\n\t\t\t\t\t\tstickyHeaderLevelForItem={getStickyHeaderLevelForItem}\n\t\t\t\t\t\titems={virtualListItems}\n\t\t\t\t\t\theightForItem={dimensions.values.tableRowHeight}\n\t\t\t\t\t\tclassName={styles.fillContainer}\n\t\t\t\t\t\tscrollToIndex={scrollToIndex}\n\t\t\t\t\t>\n\t\t\t\t\t\t{({ item, index }) => {\n\t\t\t\t\t\t\tif (item.type === \"sourceGroup\") {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<LocalizationGroup\n\t\t\t\t\t\t\t\t\t\tkey={item.nodeId}\n\t\t\t\t\t\t\t\t\t\tgroup={item}\n\t\t\t\t\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\t\t\t\t\tinsetLevel={getInsetLevelForItem(item)}\n\t\t\t\t\t\t\t\t\t\texpanded={isExpandedSourceGroup(item, activeLocale, expandedSourceGroups)}\n\t\t\t\t\t\t\t\t\t\tonExpandedToggle={onExpandedToggle}\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\n\t\t\t\t\t\t\tconst isLast = index === virtualListItems.length - 1\n\n\t\t\t\t\t\t\tconst uniqueLocalizedValues = engine.stores.localizationStore.getUniqueLocalizedValues(item, activeLocale)\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LocalizationSourceRow\n\t\t\t\t\t\t\t\t\tisLast={isLast}\n\t\t\t\t\t\t\t\t\tsource={item}\n\t\t\t\t\t\t\t\t\tlocales={locales}\n\t\t\t\t\t\t\t\t\tactiveLocale={activeLocale}\n\t\t\t\t\t\t\t\t\tuniqueLocalizedValues={uniqueLocalizedValues}\n\t\t\t\t\t\t\t\t\tinsetLevel={getInsetLevelForItem(item)}\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</VirtualList>\n\t\t\t\t) : (\n\t\t\t\t\t<LocalizationTableEmptyState isReadOnly={isReadOnly} activeLocale={activeLocale} />\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</Stack>\n\t)\n}\n\nfunction getInsetLevelForItem(item: LocalizationSource | LocalizationSourceGroup): styles.InsetLevel {\n\tif (item.type === \"sourceGroup\") {\n\t\treturn item.groupType === \"collectionItem\" ? 1 : 0\n\t}\n\treturn item.insetLevel ?? 0\n}\n\nexport const LocalizationTable = React.memo(function LocalizationTable() {\n\tconst { mainView } = engine.stores.chromeStore.useState()\n\tif (mainView !== ActiveMainView.Localizations) return null\n\treturn <LocalizationTableInner />\n})\n", "import \"LocalizationTable.styles_9fsllw.wyw.css\"; export function getInsetForLevel(insetLevel) {\n  const insetWidth = 22;\n  return insetLevel * insetWidth;\n}\nexport const textInsetAlignment = 39;\nexport const container = \"container_cr19p7q\";\nexport const header = \"header_h4slxw5\";\nexport const headerButton = \"headerButton_h12p4vfb\";\nexport const collapseIndicator = \"collapseIndicator_cf9fhqo\";\nexport const fillContainer = \"fillContainer_fh82vle\";\nexport const hiddenUnlessGroupHovered = \"hiddenUnlessGroupHovered_h18ho26x\";\nexport const buttonWithLeftIcon = \"buttonWithLeftIcon_b1es5k28\";\nexport const noShrink = \"noShrink_nh3d9d2\";\nexport const group = \"group_gz9l54n\";\nexport const collapsableGroup = \"collapsableGroup_c1pd0hp\";\nexport const hideWhenGroupHovered = \"hideWhenGroupHovered_hqe13b1\";\nexport const groupIcon = \"groupIcon_g1buhcst\";\nexport const withComponentTint = \"withComponentTint_wb07tc7\";\nexport const hideWhenRowHovered = \"hideWhenRowHovered_h1v1d48y\";\nexport const hide = \"hide_h1yqdd0k\";\nexport const excludedGroupTitle = \"excludedGroupTitle_e9nlqmj\";\nexport const row = \"row_r1clw312\";\nexport const rowButton = \"rowButton_rim0lhi\";\nexport const placeholderButton = \"placeholderButton_psmjx9c\";\nexport const columns = \"columns_c1ss8po0\";\nexport const bottomSeparator = \"bottomSeparator_b83rjyp\";\nexport const rowHighlight = \"rowHighlight_rk0y21a\";\nexport const managedByPlugin = \"managedByPlugin_m1jkmegx\";\nexport const imagePreviewThumbnail = \"imagePreviewThumbnail_ib1i4wf\";\nexport const textInput = \"textInput_t1tacwp8\";\nexport const fullWidth = \"fullWidth_fbrhss7\";\nexport const fullHeight = \"fullHeight_f1wnqi2b\";\nexport const grow = \"grow_g1lcz6me\";\nexport const actionButton = \"actionButton_a14rnpkj\";\nexport const actionButtonActive = \"actionButtonActive_a1kuw46\";\nexport const actionButtons = \"actionButtons_a1paseuo\";\nexport const actionButtonsAlwaysVisible = \"actionButtonsAlwaysVisible_a1eecxn\";\nexport const originIcon = \"originIcon_ok9lvf6\";\nexport const confirmHideAllInThisLocaleBoldText = \"confirmHideAllInThisLocaleBoldText_c1uo6o7d\";", "import type { EmptyStateProps } from \"@framerjs/fresco\"\nimport { Button, EmptyState, IconGlobeLarge } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type React from \"react\"\nimport { useMemo } from \"react\"\nimport { getNoSearchResultProps } from \"../shared/utils/getNoSearchResultProps.ts\"\nimport { fillContainer } from \"./LocalizationTable.styles.ts\"\nimport * as styles from \"./LocalizationTableEmptyState.styles.ts\"\nimport { createLocale } from \"./createLocale.tsx\"\nimport {\n\ttype LocalizationSource,\n\ttype LocalizationSourceGroup,\n\ttype LocalizationSourceOrGroupStatus,\n\twithLocalizationSubGroups,\n} from \"./getLocalizationSources.ts\"\n\nfunction getSourcesVisibleInScope(\n\tgroups: readonly LocalizationSourceGroup[] | null,\n\tvisibleScopes: ReadonlySet<NodeID> | null,\n\tresult: LocalizationSource[] = [],\n): LocalizationSource[] {\n\tif (!groups) return result\n\n\tfor (const group of groups) {\n\t\tif (visibleScopes && !visibleScopes.has(group.nodeId)) continue\n\n\t\tresult.push(...group.items)\n\n\t\tif (withLocalizationSubGroups(group)) {\n\t\t\tgetSourcesVisibleInScope(group.groups, visibleScopes, result)\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunction getEmptyStateProps(\n\tactiveLocale: Locale | null,\n\tgroups: readonly LocalizationSourceGroup[] | null,\n\tvisibleScopes: ReadonlySet<NodeID> | null,\n\tsourcesFilteredByScope: LocalizationSource[],\n\tisLoadingReady: boolean,\n\tsearchTerm: string,\n\tstatus: LocalizationSourceOrGroupStatus | null,\n\tisReadOnly: boolean,\n): EmptyStateProps {\n\tif (!activeLocale) {\n\t\tconst handleAddLocale = () => {\n\t\t\tif (!isLoadingReady) return\n\t\t\tconst hasBaseLanguage = Boolean(engine.tree.root.webMetadata?.language)\n\t\t\tif (!hasBaseLanguage) {\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.ConfirmDefaultLanguage,\n\t\t\t\t\tonConfirm: () => createLocale(\"localization_table\"),\n\t\t\t\t\tsource: \"localization_table\",\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tcreateLocale(\"localization_table\")\n\t\t}\n\n\t\treturn {\n\t\t\ticon: null,\n\t\t\tmaxBodyWidth: 150,\n\t\t\ttitle: Dictionary.Localization,\n\t\t\tbody: `Add a ${Dictionary.Locale} to start localizing your site.`,\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\ttitle={`Add ${Dictionary.Locale}`}\n\t\t\t\t\tenabled={!isReadOnly && isLoadingReady}\n\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\tclassName={styles.button}\n\t\t\t\t\tonClick={handleAddLocale}\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t}\n\n\tif (!groups || groups.length === 0) {\n\t\treturn { body: \"No Items\" }\n\t}\n\n\tconst isSearching = searchTerm.trim().length > 0\n\tif (isSearching) return getNoSearchResultProps()\n\n\tconst viewAllAction = (\n\t\t<Button\n\t\t\tbold\n\t\t\ttitle=\"View All\"\n\t\t\tvariant=\"withDepthPrimary\"\n\t\t\tonClick={() => (engine.stores.localizationStore.status = null)}\n\t\t/>\n\t)\n\n\tif (visibleScopes && sourcesFilteredByScope.length === 0) {\n\t\treturn {\n\t\t\tbody: \"No Items For Selected Filter\",\n\t\t\tbutton: viewAllAction,\n\t\t}\n\t}\n\n\tif (status === \"new\") {\n\t\tconst hasNeedsReviewItems = sourcesFilteredByScope.some(\n\t\t\tsource => source.localizedValueStatuses[activeLocale.id] === \"needsReview\",\n\t\t)\n\n\t\tconst title = \"No New Items\"\n\t\tlet action: React.ReactNode | undefined\n\n\t\tif (hasNeedsReviewItems) {\n\t\t\taction = (\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\tvariant=\"withDepthPrimary\"\n\t\t\t\t\ttitle={`${Dictionary.Review} Items`}\n\t\t\t\t\tonClick={() => (engine.stores.localizationStore.status = \"needsReview\")}\n\t\t\t\t/>\n\t\t\t)\n\t\t} else if (sourcesFilteredByScope.length) {\n\t\t\taction = viewAllAction\n\t\t}\n\n\t\treturn { body: title, button: action }\n\t}\n\n\tif (status === \"needsReview\") {\n\t\tconst hasNewItems = sourcesFilteredByScope.some(source => source.localizedValueStatuses[activeLocale.id] === \"new\")\n\n\t\tconst title = `No Items to ${Dictionary.Review}`\n\t\tlet action: React.ReactNode | undefined\n\n\t\tif (hasNewItems) {\n\t\t\taction = (\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\ttitle=\"View New Items\"\n\t\t\t\t\tvariant=\"withDepthPrimary\"\n\t\t\t\t\tonClick={() => (engine.stores.localizationStore.status = \"new\")}\n\t\t\t\t/>\n\t\t\t)\n\t\t} else if (sourcesFilteredByScope.length) {\n\t\t\taction = viewAllAction\n\t\t}\n\n\t\treturn { body: title, button: action }\n\t}\n\n\tif (status === \"done\") {\n\t\tconst title = \"No Items Done\"\n\t\tlet action: React.ReactNode | undefined\n\n\t\tif (sourcesFilteredByScope.length) {\n\t\t\taction = viewAllAction\n\t\t}\n\n\t\treturn { body: title, button: action }\n\t}\n\n\tif (status === \"hidden\") {\n\t\treturn {\n\t\t\tbody: \"No Hidden Items\",\n\t\t\tbutton: (\n\t\t\t\t<Button\n\t\t\t\t\tbold\n\t\t\t\t\ttitle=\"Clear Filter\"\n\t\t\t\t\tvariant=\"withDepthPrimary\"\n\t\t\t\t\tonClick={() => (engine.stores.localizationStore.status = null)}\n\t\t\t\t/>\n\t\t\t),\n\t\t}\n\t}\n\n\treturn { body: \"\" }\n}\n\nexport function LocalizationTableEmptyState({\n\tisReadOnly,\n\tactiveLocale,\n}: {\n\tisReadOnly: boolean\n\tactiveLocale: Locale | null\n}) {\n\tconst { searchTerm, groups, status, visibleScopes, hasCalculatedLocalizationState } =\n\t\tengine.stores.localizationStore.useState()\n\tconst isLoadingReady = engine.stores.loadingStore.useState(state => state.isReady)\n\tconst sourcesFilteredByScope = useMemo(() => {\n\t\treturn getSourcesVisibleInScope(groups, visibleScopes)\n\t}, [groups, visibleScopes])\n\tconst emptyStateProps = getEmptyStateProps(\n\t\tactiveLocale,\n\t\tgroups,\n\t\tvisibleScopes,\n\t\tsourcesFilteredByScope,\n\t\tisLoadingReady,\n\t\tsearchTerm,\n\t\tstatus,\n\t\tisReadOnly,\n\t)\n\n\treturn (\n\t\t<div className={fillContainer}>\n\t\t\t{hasCalculatedLocalizationState && (\n\t\t\t\t<EmptyState\n\t\t\t\t\tcenter\n\t\t\t\t\ticonLarge\n\t\t\t\t\ticon={<IconGlobeLarge />}\n\t\t\t\t\ticonColor={colors.tint}\n\t\t\t\t\ticonBackgroundColor={colors.tintDimmed}\n\t\t\t\t\tfullWidthButton={false}\n\t\t\t\t\t{...emptyStateProps}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n", "import \"LocalizationTableEmptyState.styles_1gcwqz1.wyw.css\"; export const button = \"button_b8wh3b7\";", "import type { AssetSize } from \"@framerjs/assets\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport { isCollectionNode, isRouteSegmentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { getLocalizedValueText } from \"document/models/LocalizedValue.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { isLocalizedValueManagedByPlugin } from \"document/utils/isLocalizedValueManagedByPlugin.ts\"\nimport type { RelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { sanitizePagePathSegment } from \"library/utils/sanitizePagePathSegment.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport React, { useMemo } from \"react\"\nimport { getRouterLocales } from \"utils/getRouterLocales.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport type { ImageUploadResultWithOptionalAssetSize } from \"web/pages/project/lib/UploadService.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getHTMLTextContentPreservingNewLinesCached } from \"../../../../utils/getHTMLTextContent.ts\"\nimport {\n\tconvertPartialTemplateVariableIdsToNames,\n\tconvertTemplateVariableIdsToNames,\n\tconvertTemplateVariableNamesToIds,\n} from \"../siteSettings/templateVariables.ts\"\nimport { convertToRichTextLocalizedValue, convertToTextLocalizedValue } from \"./getCompatibleLocalizedValue.ts\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\nimport {\n\tgetCollectionSlugOccurrencesByLocaleId,\n\tisImageSource,\n\tisRichTextControlPropSource,\n\tisRichTextSource,\n\tisRouteSegmentSource,\n\tisSlugSource,\n\tisTitleAndDescriptionSource,\n} from \"./getLocalizationSources.ts\"\nimport { getLocalizedFallback } from \"./getLocalizedFallback.ts\"\nimport { getLocalizedValueForActiveLocale } from \"./getValueForActiveLocale.ts\"\nimport { showMatchingItemsToast } from \"./showMatchingItemsToast.ts\"\nimport type {\n\tGeneratedByAI,\n\tLocalizedValueTrackingSource,\n\tWithLocalizedValueTrackingSource,\n} from \"./updateLocalizedValue.ts\"\nimport { clearLocalizedValue, setLocalizedValue } from \"./updateLocalizedValue.ts\"\nimport { useLocalizedImageEditingState } from \"./useLocalizedImageEditingState.ts\"\nimport { useTranslate } from \"./useTranslate.ts\"\n\nfunction replaceNewlinesWithSingleSpace(text: string) {\n\treturn text.replaceAll(/\\n+/gu, \" \")\n}\n\nfunction getLocalizedFallbackTextContent(\n\tsource: LocalizationSource,\n\tactiveLocale: Locale,\n\tlocales: readonly Locale[],\n): string | undefined {\n\tconst localizedFallback = getLocalizedFallback(source, activeLocale, locales)\n\tif (!localizedFallback) return\n\treturn getLocalizedValueText(localizedFallback, { preserveNewLines: true })\n}\n\ninterface LocalizedValueEditingState {\n\tisRichText: boolean\n\tisImage: boolean\n\n\toriginalValue: string\n\toriginalInputValue: string\n\toriginalInputPlaceholder: string | undefined\n\n\trawInputValue: string | undefined\n\tinputValue: string | undefined\n\tinputPlaceholder: string\n\tinputEnabled: boolean\n\tinputHidden: boolean\n\n\tupdate(newValue: string | null, final?: boolean, resetInput?: () => void): void\n\n\tisTranslating: boolean\n\ttoggleTranslate(): void\n\ttranslationValue: string\n\ttranslationEnabled: boolean\n\tmanagedByPlugin: boolean\n\tgeneratedByAI: boolean\n\n\toriginalImageValue: string | undefined\n\toriginalImagePositionX: RelativeNumber | undefined\n\toriginalImagePositionY: RelativeNumber | undefined\n\timageValue: string | undefined\n\timageFallback: string | undefined\n\timageEnabled: boolean\n\timageSupportsFocalPoint: boolean\n\timagePositionX: RelativeNumber | undefined\n\timagePositionY: RelativeNumber | undefined\n\thandleImageUpload(imageUpload: Promise<ImageUploadResultWithOptionalAssetSize[]>): void\n\thandleFocalPointChange:\n\t\t| ((focalPointX: RelativeNumber | undefined, focalPointY: RelativeNumber | undefined) => void)\n\t\t| undefined\n\tupdateAssetSize: (size: AssetSize) => void\n\tclearImage(): void\n}\n\nexport function useLocalizedValueEditingState(\n\tengine: VekterEngine,\n\tactiveLocale: Locale,\n\tlocales: readonly Locale[],\n\tsource: LocalizationSource,\n\ttrackingSource: LocalizedValueTrackingSource,\n): LocalizedValueEditingState {\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\n\t// TODO(richTextJson): Support full rich-text editing for JSON-backed sources and remove this\n\t// plain-text fallback.\n\tconst isJSONBackedRichText = isRichTextControlPropSource(source) && typeof source.richTextValue !== \"string\"\n\tconst isRichText = isRichTextSource(source) && !isJSONBackedRichText\n\tconst isImage = isImageSource(source)\n\tconst isTitleAndDescription = isTitleAndDescriptionSource(source)\n\tconst isSlug = isSlugSource(source)\n\n\tconst dataIdentifier = isTitleAndDescription ? source.dataIdentifier : undefined\n\tconst collectionData = useDataForIdentifier(dataIdentifier)\n\n\tconst originalValue = React.useMemo(() => {\n\t\tif (isTitleAndDescription) {\n\t\t\treturn convertTemplateVariableIdsToNames(source.value, collectionData, engine.componentLoader)\n\t\t}\n\n\t\treturn source.value\n\t}, [engine, collectionData, source.value, isTitleAndDescription])\n\n\tconst originalInputValue = React.useMemo(() => {\n\t\tif (isTitleAndDescription) {\n\t\t\treturn convertTemplateVariableIdsToNames(source.value, collectionData, engine.componentLoader)\n\t\t}\n\n\t\tif (!isRichText) return source.value\n\n\t\t// For HTML-backed sources (control props and canvas nodes), extract text content.\n\t\treturn getHTMLTextContentPreservingNewLinesCached(source.value)\n\t}, [engine, collectionData, source.value, isRichText, isTitleAndDescription])\n\n\tconst localizedValue = source.localizedValues[activeLocale.id]\n\n\tconst rawInputValue = React.useMemo(() => {\n\t\tif (!localizedValue) return\n\t\treturn isString(localizedValue.value) ? localizedValue.value : undefined\n\t}, [localizedValue])\n\n\tconst inputValue = React.useMemo(() => {\n\t\tconst convertedLocalizedValue = isRichText\n\t\t\t? convertToRichTextLocalizedValue(localizedValue, source.value)\n\t\t\t: convertToTextLocalizedValue(localizedValue)\n\n\t\tif (!convertedLocalizedValue) return\n\n\t\tconst textValue: string = isString(convertedLocalizedValue.value)\n\t\t\t? convertedLocalizedValue.value\n\t\t\t: getLocalizedValueText(convertedLocalizedValue, { preserveNewLines: true })\n\n\t\tif (isTitleAndDescription) {\n\t\t\treturn convertTemplateVariableIdsToNames(textValue, collectionData, engine.componentLoader)\n\t\t}\n\n\t\tif (!isRichText) {\n\t\t\t// Existing localized values may still be stored as rich-text HTML even for\n\t\t\t// JSON-backed sources on the plain-text path. Show them as extracted text.\n\t\t\treturn getLocalizedValueText(convertedLocalizedValue, { preserveNewLines: true })\n\t\t}\n\n\t\tif (convertedLocalizedValue.type !== \"rich-text\") return\n\t\treturn getLocalizedValueText(convertedLocalizedValue, { preserveNewLines: true })\n\t}, [engine, localizedValue, isRichText, source.value, isTitleAndDescription, collectionData])\n\n\tconst managedByPlugin = localizedValue ? isLocalizedValueManagedByPlugin(engine, source, localizedValue) : false\n\tconst generatedByAI = localizedValue?.generatedByAI ?? false\n\n\tfunction update(newValue: string, generatedByAI: GeneratedByAI, resetInput: (() => void) | undefined) {\n\t\tif (!isValidInputUpdate(newValue)) {\n\t\t\tresetInput?.()\n\t\t\treturn\n\t\t}\n\n\t\tif (inputValue === newValue && !isSlug) return\n\n\t\tif (newValue === \"\") {\n\t\t\tif (isUndefined(inputValue)) return\n\t\t\tif (source.inherited) return\n\n\t\t\tclearLocalizedValue(engine, source, activeLocale, { target: \"default\", trackingSource })\n\t\t\tshowMatchingItemsToast(engine, { type: \"clear\" }, source, activeLocale, {\n\t\t\t\tgeneratedByAI: false,\n\t\t\t\ttrackingSource,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (isTitleAndDescription) {\n\t\t\tnewValue = convertTemplateVariableNamesToIds(newValue, collectionData, engine.componentLoader)\n\t\t}\n\n\t\tif (isSlug) {\n\t\t\tconst slugified = slugify(newValue)\n\t\t\tnewValue = isRouteSegmentSource(source) ? sanitizePagePathSegment(slugified) : slugified\n\n\t\t\tif (newValue === \"\") {\n\t\t\t\tclearLocalizedValue(engine, source, activeLocale, { target: \"default\", trackingSource })\n\t\t\t\tresetInput?.()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (newValue === inputValue) {\n\t\t\t\tresetInput?.()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tconst options: GeneratedByAI & WithLocalizedValueTrackingSource = {\n\t\t\t...generatedByAI,\n\t\t\ttrackingSource,\n\t\t}\n\t\tsetLocalizedValue(engine, newValue, source, activeLocale, options)\n\n\t\tif (engine.stores.chromeStore.mainView === ActiveMainView.Localizations) {\n\t\t\tshowMatchingItemsToast(engine, { type: \"update\", value: newValue }, source, activeLocale, options)\n\t\t}\n\t}\n\n\tfunction isValidInputUpdate(newValue: string): boolean {\n\t\tif (!isSlug) return true\n\t\tif (inputValue === newValue) return true\n\n\t\tconst isRouteSegment = isRouteSegmentSource(source)\n\n\t\tconst slugified = isRouteSegment ? sanitizePagePathSegment(newValue) : slugify(newValue)\n\t\tif (slugified.length === 0) return true\n\n\t\tif (isRouteSegment) {\n\t\t\tconst parentNode = engine.tree.getParent(source.nodeId)\n\t\t\tassert(parentNode, \"parentNode must exist\")\n\n\t\t\tconst routerLocales = getRouterLocales(engine.tree, \"includeDrafts\")\n\t\t\tconst selectedLocale = routerLocales.find(locale => locale.id === activeLocale.id) || routerLocales[0]\n\t\t\tassert(selectedLocale, \"Locale should always exist\")\n\n\t\t\tfor (const child of parentNode.children) {\n\t\t\t\tassert(isRouteSegmentNode(child), \"expected child to be route segment node\")\n\t\t\t\t// Skip self\n\t\t\t\tif (child.id === source.nodeId) continue\n\t\t\t\t// Skip CMS segments\n\t\t\t\tif (child.dataIdentifier) continue\n\t\t\t\tconst childLocalizedValue = getLocalizedValueForActiveLocale(selectedLocale, child.segmentLocalized)\n\t\t\t\tconst localizedSegment = childLocalizedValue?.value || child.segment\n\t\t\t\tif (localizedSegment === slugified) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true\n\t\t}\n\n\t\tconst collectionNode = engine.tree.getParent(source.nodeId)\n\t\tassert(isCollectionNode(collectionNode), \"expected slug parent to be collection node\")\n\n\t\tconst slugsByLocale = getCollectionSlugOccurrencesByLocaleId([activeLocale], collectionNode)\n\n\t\tconst isUniqueSlug = (slugsByLocale[activeLocale.id]?.get(slugified) ?? 0) === 0\n\t\tif (isUniqueSlug) return true\n\n\t\ttoast({\n\t\t\tprimaryText: \"Slug already exists.\",\n\t\t\tsecondaryText: \"Couldn\u2019t save item.\",\n\t\t\tkey: \"slug-duplicate-warning\",\n\t\t\tvariant: \"warning\",\n\t\t\ttype: \"add\",\n\t\t})\n\n\t\treturn false\n\t}\n\n\tconst {\n\t\tisTranslating,\n\t\ttoggleTranslate,\n\t\ttranslationValue: rawTranslationValue,\n\t} = useTranslate(source, activeLocale, (newValue: string) => {\n\t\tupdate(newValue, { generatedByAI: true }, undefined)\n\t})\n\n\tconst translationValue = useMemo(() => {\n\t\tif (!isTitleAndDescription) return rawTranslationValue\n\t\treturn convertPartialTemplateVariableIdsToNames(rawTranslationValue, collectionData)\n\t}, [collectionData, isTitleAndDescription, rawTranslationValue])\n\n\tconst inputFallbackValue = React.useMemo(() => {\n\t\tconst fallbackTextContent = getLocalizedFallbackTextContent(source, activeLocale, locales)\n\n\t\tif (fallbackTextContent && isTitleAndDescription) {\n\t\t\treturn convertTemplateVariableIdsToNames(fallbackTextContent, collectionData, engine.componentLoader)\n\t\t}\n\n\t\treturn fallbackTextContent ?? originalInputValue\n\t}, [engine, source, activeLocale, locales, originalInputValue, collectionData, isTitleAndDescription])\n\n\tconst inputPlaceholder = React.useMemo(() => {\n\t\tif (isTranslating) return \"\"\n\n\t\tif (source.inherited && isString(inputValue)) {\n\t\t\treturn replaceNewlinesWithSingleSpace(inputValue)\n\t\t}\n\n\t\tif (inputValue !== \"\" && inputFallbackValue.length) {\n\t\t\treturn replaceNewlinesWithSingleSpace(inputFallbackValue)\n\t\t}\n\n\t\tif (isImage) return Dictionary.EmptyAltText\n\t\treturn Dictionary.EmptyText\n\t}, [isTranslating, source, inputValue, isImage, inputFallbackValue])\n\n\tconst originalInputPlaceholder = isImage ? Dictionary.EmptyAltText : Dictionary.EmptyText\n\tconst {\n\t\toriginalImageValue,\n\t\timageValue,\n\t\timageFallback,\n\t\thandleImageUpload,\n\t\tupdateAssetSize,\n\t\tclearImage,\n\t\timageSupportsFocalPoint,\n\t\toriginalImagePositionX,\n\t\toriginalImagePositionY,\n\t\timagePositionX,\n\t\timagePositionY,\n\t\thandleFocalPointChange,\n\t} = useLocalizedImageEditingState(engine, source, activeLocale, locales, \"properties_panel\")\n\tconst inputHidden = isImage && !source.supportsAlt\n\n\treturn {\n\t\tisRichText,\n\t\tisImage,\n\n\t\toriginalValue,\n\t\toriginalInputValue,\n\t\toriginalInputPlaceholder,\n\n\t\trawInputValue,\n\t\tinputValue,\n\t\tinputPlaceholder,\n\t\tinputEnabled: !isViewOnly && !isTranslating && !managedByPlugin,\n\t\tinputHidden,\n\n\t\tupdate: (newValue: string, _: boolean, reset: () => void) => update(newValue, { generatedByAI: false }, reset),\n\n\t\tisTranslating,\n\t\ttoggleTranslate,\n\t\ttranslationValue,\n\t\ttranslationEnabled: !isViewOnly && Boolean(originalInputValue) && !inputHidden && !managedByPlugin,\n\t\tmanagedByPlugin,\n\t\tgeneratedByAI,\n\n\t\toriginalImageValue,\n\t\timageValue,\n\t\timageFallback,\n\t\timageEnabled: !isViewOnly,\n\t\thandleImageUpload,\n\t\tupdateAssetSize,\n\t\tclearImage,\n\n\t\timageSupportsFocalPoint,\n\n\t\toriginalImagePositionX: imageSupportsFocalPoint ? originalImagePositionX : undefined,\n\t\toriginalImagePositionY: imageSupportsFocalPoint ? originalImagePositionY : undefined,\n\t\timagePositionX: imageSupportsFocalPoint ? imagePositionX : undefined,\n\t\timagePositionY: imageSupportsFocalPoint ? imagePositionY : undefined,\n\t\thandleFocalPointChange: imageSupportsFocalPoint ? handleFocalPointChange : undefined,\n\t}\n}\n", "import { assert, emptyArray } from \"@framerjs/shared\"\nimport { showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport engine from \"document/engine.ts\"\nimport { LocalizationGlossaryNode } from \"document/models/CanvasTree/nodes/LocalizationGlossaryNode.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useStableCallback } from \"library/utils/useStableCallback.ts\"\nimport React from \"react\"\nimport { showAiCreditLimitModalIfReached } from \"../shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport { TranslationTask } from \"./BatchTranslation.ts\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\nimport { getReusableTranslationsByHash } from \"./getReusableTranslationsByHash.ts\"\nimport { getTranslationSourceType } from \"./getTranslationSourceType.ts\"\nimport { buildGlossaryForLocale } from \"./glossaryUtils.ts\"\n\nexport function useTranslate(\n\tsource: LocalizationSource | undefined,\n\tactiveLocale: Locale,\n\tonChange: (html: string) => void,\n) {\n\tconst translationTaskRef = React.useRef<TranslationTask | null>(null)\n\tconst stableOnChange = useStableCallback(onChange)\n\n\tconst [isTranslating, setIsTranslating] = React.useState(false)\n\tconst [translationValue, setTranslationValue] = React.useState(\"\")\n\n\tconst start = () => {\n\t\tassert(source)\n\n\t\tconst currentTranslation = translationTaskRef.current\n\t\tif (currentTranslation?.state.type === \"translating\") return\n\n\t\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\t\tconst originalLanguage = tree.root.webMetadata?.language\n\n\t\tconst glossaryForLocale = buildGlossaryForLocale(\n\t\t\tactiveLocale,\n\t\t\ttree.root.locales || emptyArray(),\n\t\t\tLocalizationGlossaryNode.get(tree),\n\t\t)\n\t\tconst currentLocalizedValue = source.localizedValues[activeLocale.id]\n\n\t\tconst reusableTranslationsByHash = getReusableTranslationsByHash(\n\t\t\tactiveLocale,\n\t\t\tengine.stores.localizationStore,\n\t\t\tglossaryForLocale,\n\t\t\tnew Set([source.hash]),\n\t\t\tcurrentLocalizedValue,\n\t\t)\n\n\t\tconst preexistingTranslation = reusableTranslationsByHash.get(source.hash)\n\t\tif (preexistingTranslation) {\n\t\t\tstableOnChange(preexistingTranslation)\n\t\t\treturn\n\t\t}\n\n\t\t// Only block once we know we'd need a model call \u2014 translation memory should still work.\n\t\tif (showModalIfAiDisabled(engine, \"properties\")) return\n\t\tif (showAiCreditLimitModalIfReached(engine, \"properties\")) return\n\n\t\ttranslationTaskRef.current = new TranslationTask({\n\t\t\tengine,\n\t\t\tsource,\n\t\t\tbehavior: \"parseWhileStreaming\",\n\t\t\tlocale: activeLocale,\n\t\t\tfromLanguage: originalLanguage,\n\t\t\tglossaryForLocale,\n\t\t\tframerSiteId: engine.stores.previewStore.framerSiteId,\n\t\t\tprojectLicenseType: engine.stores.projectStore.projectLicenseType,\n\t\t\tsessionId: crypto.randomUUID(),\n\t\t\tuiContext: \"singleTranslation\",\n\t\t\tcomponentLoader: engine.componentLoader,\n\t\t\tonChange: state => {\n\t\t\t\tif (state.type === \"translating\") {\n\t\t\t\t\tsetTranslationValue(state.value)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif (state.type === \"done\") {\n\t\t\t\t\tstableOnChange(state.value)\n\t\t\t\t}\n\n\t\t\t\t// Delay updating React state because else the tree might not yet contain the latest\n\t\t\t\t// values.\n\t\t\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\t\t\tsetIsTranslating(false)\n\t\t\t\t\tsetTranslationValue(\"\")\n\t\t\t\t})\n\t\t\t},\n\t\t})\n\n\t\tsetIsTranslating(true)\n\t}\n\n\tconst translationMode = source ? getTranslationSourceType(source) : undefined\n\n\tReact.useEffect(() => {\n\t\t// Keep the dependency explicit even though the current effect body only cancels on cleanup.\n\t\tvoid translationMode\n\t\t// Cancel the current task when unmounting or when the translation mode changes\n\t\t// (e.g. switching between HTML-backed rich text, JSON-backed rich text, or plain text).\n\t\treturn () => {\n\t\t\ttranslationTaskRef.current?.cancel()\n\t\t}\n\t}, [translationMode])\n\n\tconst stop = () => {\n\t\ttranslationTaskRef.current?.cancel()\n\t}\n\n\treturn {\n\t\tisTranslating,\n\t\ttoggleTranslate: isTranslating ? stop : start,\n\t\ttranslationValue,\n\t}\n}\n", "import {\n\tIconDots,\n\tProjectBarButton,\n\tReadOnlyContext,\n\tScroll,\n\tSpacer,\n\tStack,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { assert, isCommandKeyPressed } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { pulseAnimation } from \"document/components/chrome/localization/sharedLocalization.styles.ts\"\nimport { useChromeOverlay } from \"document/components/utils/useChromeOverlay.tsx\"\nimport engine from \"document/engine.ts\"\nimport { isContentNode } from \"document/models/CanvasTree/nodes/TreeNode.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { getLayoutDirectionValue } from \"document/utils/getLayoutDirectionValue.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { cmsSchemaParams, localizationCanvasSchemaParams, makeSchema } from \"prosemirror/schema/index.ts\"\nimport React, { useCallback, useMemo, useRef } from \"react\"\nimport { LocaleFlag } from \"utils/LocaleFlag.tsx\"\nimport { isEmptyRichTextValue } from \"utils/isEmptyRichTextValue.ts\"\nimport { getTagsFromRichText } from \"utils/richTextUtils.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { EscapePrecedence, useOnEscape } from \"../contentManagement/utils/useOnEscape.ts\"\nimport { PublishToolbarItem } from \"../projectbar/PublishToolbarItem.tsx\"\nimport type { InsertButtonPopoverOptions } from \"../richTextEditor/RichTextEditorWithToolbar.tsx\"\nimport { ToolbarItemGroup } from \"../richTextEditor/RichTextEditorWithToolbar.tsx\"\nimport { RichTextEditorWithToolbarAndNodeViews } from \"../richTextEditor/RichTextEditorWithToolbarAndNodeViews.tsx\"\nimport { RichTextToolbarButton } from \"../richTextEditor/RichTextToolbarButton.tsx\"\nimport { EditorOverlay, EditorOverlaySaveButton, EditorOverlayToolbar } from \"../shared/EditorOverlay.tsx\"\nimport { PaginationArrows } from \"../shared/PaginationArrows.tsx\"\nimport { upsellLocalizationTranslationLimit } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { IconMagic } from \"./IconMagic.tsx\"\nimport * as styles from \"./LocalizationTextEditorOverlay.styles.ts\"\nimport { PlainTextEditor } from \"./PlainTextEditor.tsx\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\nimport { isImageSource, isLinkSource } from \"./getLocalizationSources.ts\"\nimport { getNameForDefaultLocale } from \"./getNameForDefaultLocale.ts\"\nimport { useActiveLocalizationLocale } from \"./useActiveLocalizationLocale.ts\"\nimport { useLocales } from \"./useLocales.ts\"\nimport { useLocalizedValueEditingState } from \"./useLocalizedValueEditingState.ts\"\nimport { viewSourceOption } from \"./useSourceOptionsMenu.ts\"\n\nconst dismiss = engine.scheduler.wrapHandler(() => {\n\tengine.stores.chromeStore.hideOverlay()\n})\n\nconst insertButtonPopoverOptions: InsertButtonPopoverOptions = {\n\tpopoverAttachmentEdge: [\"left\", \"auto-vertical\"],\n\tpopoverOffset: { x: 30, y: 0 },\n\tdisplayInPopover: true,\n\tshowArrow: false,\n}\n\nfunction blurActiveInput() {\n\tconst activeElement = document.activeElement\n\n\tif (activeElement instanceof HTMLInputElement || activeElement instanceof HTMLTextAreaElement) {\n\t\tactiveElement.blur()\n\t}\n}\n\ninterface Props {\n\tsource: LocalizationSource\n\tactiveLocale: Locale\n\tkeyPath: string\n\tsingleColumn: boolean\n\tstartTranslation: boolean\n}\n\nfunction Overlay({ source, activeLocale, keyPath, singleColumn, startTranslation }: Props) {\n\tconst locales = useLocales()\n\n\tconst scroll = useRef<HTMLDivElement>(null)\n\n\tconst virtualListItems = engine.stores.localizationStore.useState(state => state.virtualListItems)\n\tconst visibleTextSources = useMemo(() => {\n\t\treturn (\n\t\t\tvirtualListItems?.filter((item): item is LocalizationSource => {\n\t\t\t\treturn item.type !== \"sourceGroup\" && !isImageSource(item) && !isLinkSource(item)\n\t\t\t}) ?? []\n\t\t)\n\t}, [virtualListItems])\n\tconst currentSourceIndex = visibleTextSources.findIndex(visibleTextSource => visibleTextSource.keyPath === keyPath)\n\tconst { defaultLocaleCode, defaultLocaleName, defaultLocaleLayoutDirection, currentLocaleLayoutDirection } =\n\t\tuseEngineState(\n\t\t\t() => {\n\t\t\t\tconst defaultLocale = engine.tree.root.getDefaultLocale()\n\t\t\t\tconst adaptLayoutToTextDirection = engine.tree.root.adaptLayoutToTextDirection\n\n\t\t\t\treturn {\n\t\t\t\t\tdefaultLocaleCode: engine.tree.root.getDefaultLocaleCode(),\n\t\t\t\t\tdefaultLocaleName: getNameForDefaultLocale(engine.tree),\n\t\t\t\t\tdefaultLocaleLayoutDirection: getLayoutDirectionValue(defaultLocale, adaptLayoutToTextDirection),\n\t\t\t\t\tcurrentLocaleLayoutDirection: getLayoutDirectionValue(activeLocale, adaptLayoutToTextDirection),\n\t\t\t\t}\n\t\t\t},\n\t\t\t[activeLocale],\n\t\t\tEngineChange.Tree,\n\t\t)\n\n\tconst {\n\t\tisRichText,\n\t\toriginalValue,\n\t\trawInputValue,\n\t\tinputValue,\n\t\tinputEnabled,\n\t\tupdate,\n\t\tisTranslating,\n\t\ttoggleTranslate,\n\t\ttranslationValue,\n\t\ttranslationEnabled,\n\t\tmanagedByPlugin,\n\t} = useLocalizedValueEditingState(engine, activeLocale, locales, source, \"localization_overlay\")\n\n\tconst setActiveLocale = useEngineCallback((localeId: string) => {\n\t\tif (engine.stores.chromeStore.mainView === ActiveMainView.Canvas) {\n\t\t\tengine.stores.chromeStore.canvasLocaleId = localeId\n\t\t} else {\n\t\t\tengine.stores.localizationStore.selectedLocaleId = localeId\n\t\t}\n\t}, [])\n\n\tconst isReadOnly = useIsViewOnly(\"canEditContent\") || managedByPlugin\n\n\t// We disable the rules of hooks because we only want to start translating when the\n\t// `startTranslation` prop changes.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tReact.useEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tif (!startTranslation) return\n\t\t\tif (isTranslating) return\n\t\t\ttoggleTranslate()\n\t\t})\n\t}, [startTranslation])\n\n\tconst [hasUnsavedChanges, setHasUnsavedChanges] = React.useState(false)\n\tconst canSave = hasUnsavedChanges && !isTranslating\n\n\tuseOnEscape({\n\t\tname: \"LocalizationTextEditorOverlay\",\n\t\tprecedence: EscapePrecedence.overlay,\n\t\thandler: engine.scheduler.wrapHandler(() => {\n\t\t\tengine.stores.chromeStore.hideOverlay()\n\t\t}),\n\t})\n\n\tconst sourceType = source.type\n\tconst sourceNode = engine.tree.get(source.nodeId)\n\tconst schema = useMemo(\n\t\t() =>\n\t\t\tmakeSchema(\n\t\t\t\tisContentNode(sourceNode)\n\t\t\t\t\t? cmsSchemaParams\n\t\t\t\t\t: // per @jonas: this is used for localization data, which does not contain styles\n\t\t\t\t\t\tlocalizationCanvasSchemaParams,\n\t\t\t),\n\t\t[sourceNode],\n\t)\n\n\tconst supportedTags = useMemo(() => {\n\t\tif (sourceType !== ClassDiscriminator.RichTextNode) return\n\t\treturn getTagsFromRichText(originalValue)\n\t}, [originalValue, sourceType])\n\n\tconst showOptionsMenu = (event: React.MouseEvent) => {\n\t\tif (!source) return\n\n\t\tconst element = event.currentTarget\n\t\tconst bounds = element.getBoundingClientRect()\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\tviewSourceOption(source),\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: `${singleColumn ? Dictionary.Show : Dictionary.Hide} Default Language`,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst overlay = engine.stores.chromeStore.overlay\n\t\t\t\t\t\tassert(overlay && overlay.type === \"localization\")\n\t\t\t\t\t\tengine.stores.chromeStore.setOverlay({ ...overlay, singleColumn: !singleColumn })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t{\n\t\t\t\tlocation: {\n\t\t\t\t\tx: bounds.left,\n\t\t\t\t\ty: bounds.bottom,\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t}\n\n\tconst navigate = useCallback(\n\t\t(index: number) => {\n\t\t\tconst currentSource = visibleTextSources[index]\n\t\t\tif (!currentSource) return\n\n\t\t\tconst nextKeyPath = currentSource.keyPath\n\t\t\tengine.stores.chromeStore.setOverlay({ type: \"localization\", keyPath: nextKeyPath, singleColumn })\n\t\t},\n\t\t[visibleTextSources, singleColumn],\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent | KeyboardEvent) => {\n\t\t\tif (isCommandKeyPressed(event) && event.key === \"ArrowUp\") {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tblurActiveInput()\n\t\t\t\tnavigate(currentSourceIndex - 1)\n\t\t\t\tscroll.current?.scrollTo(0, 0)\n\t\t\t}\n\n\t\t\tif (isCommandKeyPressed(event) && event.key === \"ArrowDown\") {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tblurActiveInput()\n\t\t\t\tnavigate(currentSourceIndex + 1)\n\t\t\t\tscroll.current?.scrollTo(0, 0)\n\t\t\t}\n\t\t},\n\t\t[currentSourceIndex, navigate],\n\t)\n\n\tReact.useEffect(() => {\n\t\twindow.addEventListener(\"keydown\", handleKeyDown)\n\n\t\treturn () => window.removeEventListener(\"keydown\", handleKeyDown)\n\t}, [handleKeyDown])\n\n\tfunction showLocaleOptions(event: React.MouseEvent<HTMLButtonElement>) {\n\t\tif (!locales || locales.length === 0) return\n\n\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\tengine.stores.contextMenuStore.show(\n\t\t\tlocales.map(locale => ({\n\t\t\t\tlabel: locale.name,\n\t\t\t\tchecked: activeLocale.id === locale.id,\n\t\t\t\tclick: () => setActiveLocale(locale.id),\n\t\t\t})),\n\t\t\t{ location: { x: bounds.left - 8, y: bounds.bottom + 12 } },\n\t\t)\n\t}\n\n\tconst onChange = React.useCallback(\n\t\t(htmlOrText: string) => {\n\t\t\tsetHasUnsavedChanges(false)\n\n\t\t\tconst newValue = isRichText && isEmptyRichTextValue(htmlOrText) ? null : htmlOrText\n\t\t\tupdate(newValue)\n\t\t},\n\t\t[update, isRichText],\n\t)\n\n\tconst getCanFocus = React.useCallback(() => {\n\t\treturn !upsellLocalizationTranslationLimit(engine, source, activeLocale, \"properties\")\n\t}, [source, activeLocale])\n\n\tconst originalValueLeftToolBarSlot = (\n\t\t<Stack direction=\"row\" className={cx(styles.grow, styles.shrink)}>\n\t\t\t<ToolbarItemGroup className={styles.shrink}>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\tonClick={noop}\n\t\t\t\t\tisActive={false}\n\t\t\t\t\ttitle={defaultLocaleName}\n\t\t\t\t\tclassName={cx(styles.toolbarButton, styles.defaultCursor, styles.shrink)}\n\t\t\t\t\tcenterChild={false}\n\t\t\t\t>\n\t\t\t\t\t<LocaleFlag size=\"large\" localeCode={defaultLocaleCode} />\n\t\t\t\t\t<span className={cx(truncateWithEllipsis, styles.shrink)}>{defaultLocaleName}</span>\n\t\t\t\t</RichTextToolbarButton>\n\t\t\t</ToolbarItemGroup>\n\t\t</Stack>\n\t)\n\n\tconst originalValueRightToolBarSlot = (\n\t\t<ToolbarItemGroup>\n\t\t\t<RichTextToolbarButton\n\t\t\t\tisActive={false}\n\t\t\t\tdisabled={!translationEnabled}\n\t\t\t\tonClick={toggleTranslate}\n\t\t\t\tclassName={cx(styles.toolbarButton, styles.translateButton)}\n\t\t\t\ttitle={isTranslating ? \"Stop Translating\" : `${Dictionary.Translate} with ${Dictionary.Ai}`}\n\t\t\t\tcenterChild={false}\n\t\t\t>\n\t\t\t\t<IconMagic active={isTranslating} />\n\t\t\t\t<span className={isTranslating ? pulseAnimation : undefined}>Translate</span>\n\t\t\t</RichTextToolbarButton>\n\t\t</ToolbarItemGroup>\n\t)\n\n\tconst translationLeftToolbarSlot = (\n\t\t<Stack direction=\"row\" className={cx(styles.grow, styles.shrink)}>\n\t\t\t<ToolbarItemGroup className={styles.shrink}>\n\t\t\t\t<RichTextToolbarButton\n\t\t\t\t\tisActive={false}\n\t\t\t\t\ttitle={activeLocale.name}\n\t\t\t\t\tonMouseDown={showLocaleOptions}\n\t\t\t\t\tclassName={cx(styles.toolbarButton, styles.shrink)}\n\t\t\t\t\tcenterChild={false}\n\t\t\t\t>\n\t\t\t\t\t<LocaleFlag size=\"large\" localeCode={activeLocale.code} />\n\t\t\t\t\t<span className={cx(truncateWithEllipsis, styles.shrink)}>{activeLocale.name}</span>\n\t\t\t\t</RichTextToolbarButton>\n\t\t\t</ToolbarItemGroup>\n\t\t</Stack>\n\t)\n\n\treturn (\n\t\t<EditorOverlay\n\t\t\tblockingBackdrop\n\t\t\tdismiss={dismiss}\n\t\t\tclassName={cx(styles.overlay, singleColumn && styles.singleColumnOverlay)}\n\t\t\ttoolbar={\n\t\t\t\t<EditorOverlayToolbar dismiss={dismiss}>\n\t\t\t\t\t{!singleColumn && (\n\t\t\t\t\t\t<PaginationArrows\n\t\t\t\t\t\t\tenabled={!isTranslating}\n\t\t\t\t\t\t\tindex={currentSourceIndex}\n\t\t\t\t\t\t\ttotal={visibleTextSources.length}\n\t\t\t\t\t\t\tonNavigate={navigate}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<Spacer flex />\n\t\t\t\t\t<ProjectBarButton round onMouseDown={showOptionsMenu} enabled={!isTranslating}>\n\t\t\t\t\t\t<IconDots />\n\t\t\t\t\t</ProjectBarButton>\n\t\t\t\t\t<EditorOverlaySaveButton\n\t\t\t\t\t\ttitle={canSave ? Dictionary.Save : \"Saved\"}\n\t\t\t\t\t\tenabled={canSave}\n\t\t\t\t\t\tonClick={() => setHasUnsavedChanges(false)}\n\t\t\t\t\t/>\n\t\t\t\t\t<PublishToolbarItem />\n\t\t\t\t</EditorOverlayToolbar>\n\t\t\t}\n\t\t>\n\t\t\t<Scroll ref={scroll} className={styles.scroll}>\n\t\t\t\t<div className={cx(styles.editors, singleColumn && styles.singleColumnEditors)}>\n\t\t\t\t\t{!singleColumn && (\n\t\t\t\t\t\t<ReadOnlyContext.Provider value={true}>\n\t\t\t\t\t\t\t{isRichText ? (\n\t\t\t\t\t\t\t\t<RichTextEditorWithToolbarAndNodeViews\n\t\t\t\t\t\t\t\t\tvariant=\"legacy\"\n\t\t\t\t\t\t\t\t\tclassName={cx(styles.richTextEditor, styles.hideWhenOnlySingleColumnFits)}\n\t\t\t\t\t\t\t\t\thideNonInformativeToolbarItems\n\t\t\t\t\t\t\t\t\tkey={`original-${source.nodeId}`}\n\t\t\t\t\t\t\t\t\tvalue={originalValue}\n\t\t\t\t\t\t\t\t\tdefaultValue={originalValue}\n\t\t\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\t\t\t\tscopeType={ScopeType.ContentManagement} // FIXME: this should be coming from the source\n\t\t\t\t\t\t\t\t\tpopoverAttachmentEdge=\"right\"\n\t\t\t\t\t\t\t\t\tschema={schema}\n\t\t\t\t\t\t\t\t\tsupportedTags={supportedTags}\n\t\t\t\t\t\t\t\t\theaderClassName={styles.stickyHeader}\n\t\t\t\t\t\t\t\t\ttextEditorWrapperClassName={styles.textEditorWrapper}\n\t\t\t\t\t\t\t\t\tleftToolbarSlot={originalValueLeftToolBarSlot}\n\t\t\t\t\t\t\t\t\trightToolbarSlot={originalValueRightToolBarSlot}\n\t\t\t\t\t\t\t\t\tlayoutDirection={defaultLocaleLayoutDirection}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<PlainTextEditor\n\t\t\t\t\t\t\t\t\tvalue={originalValue}\n\t\t\t\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\t\t\t\theaderClassName={styles.stickyHeader}\n\t\t\t\t\t\t\t\t\tleftToolbarSlot={originalValueLeftToolBarSlot}\n\t\t\t\t\t\t\t\t\trightToolbarSlot={originalValueRightToolBarSlot}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t)}\n\t\t\t\t\t<ReadOnlyContext.Provider value={isReadOnly || isTranslating}>\n\t\t\t\t\t\t{isRichText ? (\n\t\t\t\t\t\t\t<RichTextEditorWithToolbarAndNodeViews\n\t\t\t\t\t\t\t\tvariant=\"legacy\"\n\t\t\t\t\t\t\t\tclassName={styles.richTextEditor}\n\t\t\t\t\t\t\t\tkey={`localized-${source.nodeId}`}\n\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\tvalue={isTranslating ? translationValue : undefined}\n\t\t\t\t\t\t\t\tdefaultValue={rawInputValue ?? \"\"}\n\t\t\t\t\t\t\t\tenabled={inputEnabled}\n\t\t\t\t\t\t\t\tscopeType={ScopeType.ContentManagement} // FIXME: this should be coming from the source\n\t\t\t\t\t\t\t\tonUnsavedChange={() => setHasUnsavedChanges(true)}\n\t\t\t\t\t\t\t\tgetCanFocus={getCanFocus}\n\t\t\t\t\t\t\t\tlayoutDirection={currentLocaleLayoutDirection}\n\t\t\t\t\t\t\t\tschema={schema}\n\t\t\t\t\t\t\t\tsupportedTags={supportedTags}\n\t\t\t\t\t\t\t\theaderClassName={styles.stickyHeader}\n\t\t\t\t\t\t\t\ttextEditorWrapperClassName={styles.textEditorWrapper}\n\t\t\t\t\t\t\t\tinsertButtonPopoverOptions={insertButtonPopoverOptions}\n\t\t\t\t\t\t\t\tleftToolbarSlot={translationLeftToolbarSlot}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<PlainTextEditor\n\t\t\t\t\t\t\t\tvalue={isTranslating ? translationValue : inputValue}\n\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\theaderClassName={styles.stickyHeader}\n\t\t\t\t\t\t\t\tleftToolbarSlot={translationLeftToolbarSlot}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t</div>\n\t\t\t</Scroll>\n\t\t</EditorOverlay>\n\t)\n}\n\nexport function LocalizationTextEditorOverlay() {\n\tconst activeLocale = useActiveLocalizationLocale()\n\tconst overlay = useChromeOverlay()\n\n\tconst localizationSource = useEngineState(\n\t\t() => {\n\t\t\tif (!overlay || overlay.type !== \"localization\") return\n\t\t\treturn engine.stores.localizationStore.getSourceForKeyPath(overlay.keyPath)\n\t\t},\n\t\t[overlay],\n\t\tengine.stores.localizationStore,\n\t)\n\n\tif (!activeLocale || !localizationSource) return null\n\n\treturn (\n\t\t<Overlay\n\t\t\tkey={activeLocale.id}\n\t\t\tsource={localizationSource}\n\t\t\tkeyPath={localizationSource.keyPath}\n\t\t\tactiveLocale={activeLocale}\n\t\t\tsingleColumn={overlay?.type === \"localization\" && overlay.singleColumn === true}\n\t\t\tstartTranslation={overlay?.type === \"localization\" && overlay.startTranslation === true}\n\t\t/>\n\t)\n}\n", "import \"PaginationArrows.styles_ttpt13.wyw.css\"; export const pagination = \"pagination_p1qy82uc\";\nexport const arrow = \"arrow_a1obob69\";\nexport const arrowPrevious = \"arrowPrevious_a1j6r8je\";\nexport const arrowNext = \"arrowNext_ajkk9iv\";", "import {\n\tIconNavigationDown,\n\tIconNavigationUp,\n\tReadOnlyContext,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { clamp } from \"framer-motion\"\nimport * as styles from \"./PaginationArrows.styles.ts\"\n\ninterface Props {\n\tenabled?: boolean\n\t/** Current page index. */\n\tindex: number\n\t/** Total number of pages. */\n\ttotal: number\n\tpreviousButtonTooltip?: string\n\tnextButtonTooltip?: string\n\tonNavigate: (index: number) => void\n}\n\n/**\n * Next and previous controls to navigate between a set of pages or items. Index\n * is automatically clamped.\n */\nexport function PaginationArrows({\n\tenabled = true,\n\tindex,\n\ttotal,\n\tonNavigate,\n\tpreviousButtonTooltip,\n\tnextButtonTooltip,\n}: Props) {\n\tconst maxIndex = total - 1\n\tconst previousEnabled = index > 0\n\tconst nextEnabled = index >= 0 && index < maxIndex\n\n\tconst navigate = (direction: -1 | 1) => {\n\t\tconst nextIndex = clamp(0, maxIndex, index + direction)\n\t\tonNavigate(nextIndex)\n\t}\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={false}>\n\t\t\t<SegmentedControl\n\t\t\t\tclassName={styles.pagination}\n\t\t\t\tstyle={{ width: `calc(${dimensions.css.inputHeight} * 2)` }}\n\t\t\t\tenabled={enabled}\n\t\t\t>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\ttitle={Dictionary.Previous}\n\t\t\t\t\tclassName={cx(styles.arrow, styles.arrowPrevious)}\n\t\t\t\t\tenabled={previousEnabled}\n\t\t\t\t\tselected={false}\n\t\t\t\t\tidentifier={-1}\n\t\t\t\t\tonSelect={navigate}\n\t\t\t\t\ttooltip={previousButtonTooltip}\n\t\t\t\t>\n\t\t\t\t\t<IconNavigationUp />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\ttitle={Dictionary.Next}\n\t\t\t\t\tclassName={cx(styles.arrow, styles.arrowNext)}\n\t\t\t\t\tenabled={nextEnabled}\n\t\t\t\t\tselected={false}\n\t\t\t\t\tidentifier={1}\n\t\t\t\t\tonSelect={navigate}\n\t\t\t\t\ttooltip={nextButtonTooltip}\n\t\t\t\t>\n\t\t\t\t\t<IconNavigationDown />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t</ReadOnlyContext.Provider>\n\t)\n}\n", "import \"LocalizationTextEditorOverlay.styles_1s8ms5l.wyw.css\"; export const overlay = \"overlay_obb6yup\";\nexport const singleColumnOverlay = \"singleColumnOverlay_s3u1jkj\";\nexport const scroll = \"scroll_sm7qzu6\";\nexport const editors = \"editors_et13w5j\";\nexport const singleColumnEditors = \"singleColumnEditors_s1azqwo2\";\nexport const richTextEditor = \"richTextEditor_rxc847q\";\nexport const hideWhenOnlySingleColumnFits = \"hideWhenOnlySingleColumnFits_h803rjf\";\nexport const textEditorWrapper = \"textEditorWrapper_t101ilpv\";\nexport const defaultCursor = \"defaultCursor_d1an66r0\";\nexport const stickyHeader = \"stickyHeader_s25wm5s\";\nexport const toolbarButton = \"toolbarButton_typb1nq\";\nexport const translateButton = \"translateButton_t8m5pgo\";\nexport const grow = \"grow_g14s9rm0\";\nexport const shrink = \"shrink_s8wvca6\";", "import \"plainTextEditor.styles_3rh8gw.wyw.css\"; export const plainTextEditor = \"plainTextEditor_pxdgvz\";\nexport const textArea = \"textArea_tb0z8z9\";", "import { Stack, TextArea, detectTextDirection } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { getTemplateVariableNameRegex } from \"@framerjs/shared/src/custom-code/templateVariableRegexes.ts\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport * as richTextEditorStyles from \"../richTextEditor/RichTextEditorWithToolbar.styles.ts\"\nimport * as styles from \"./plainTextEditor.styles.ts\"\n\ninterface Props {\n\tvalue: string | undefined\n\tleftToolbarSlot?: React.ReactNode\n\trightToolbarSlot?: React.ReactNode\n\theaderClassName?: string\n\tonChange: (newValue: string) => void\n}\n\nexport function PlainTextEditor(props: Props) {\n\tconst { value = \"\", leftToolbarSlot, rightToolbarSlot, headerClassName, onChange } = props\n\n\t// Remove template variables when checking direction. Variables at the start\n\t// of a string with mostly RTL text will be wrongly considered LTR.\n\tconst templateVariableNameRegex = getTemplateVariableNameRegex()\n\tconst valueWithoutTemplateVariables = value.replace(templateVariableNameRegex, \"\")\n\tconst direction = detectTextDirection(valueWithoutTemplateVariables)\n\n\treturn (\n\t\t<div className={styles.plainTextEditor}>\n\t\t\t<Stack\n\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\tclassName={cx(richTextEditorStyles.textStyleHeader, headerClassName)}\n\t\t\t>\n\t\t\t\t{leftToolbarSlot && <div>{leftToolbarSlot}</div>}\n\t\t\t\t{rightToolbarSlot && <div>{rightToolbarSlot}</div>}\n\t\t\t</Stack>\n\t\t\t<TextArea\n\t\t\t\tclassName={styles.textArea}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={onChange}\n\t\t\t\tautoResize\n\t\t\t\tmaxRows={Infinity}\n\t\t\t\tselectOnFocus={false}\n\t\t\t\tnewlinesOnEnter\n\t\t\t\tdirection={direction}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { CodeEditorModulePreview } from \"./CodeEditorModulePreview.tsx\"\n\nexport const CodeEditorPreview = React.memo(function CodeEditorPreview() {\n\tconst codeEditorPreviewVisible = engine.stores.chromeStore.useState(state => state.codeEditorPreviewVisible)\n\tconst framerSiteId = engine.stores.previewStore.useState(state => state.framerSiteId)\n\n\tif (!codeEditorPreviewVisible || !framerSiteId) return null\n\n\treturn <CodeEditorModulePreview />\n})\n", "import type { Immutable } from \"@framerjs/app-shared/src/lib/immer.ts\"\nimport { getLogger, isLocalModuleIdentifier, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport { getGlobalPreviewHandlers } from \"document/preview/globalPreviewHandlers.ts\"\nimport type { ModuleEntry, PersistedModule } from \"modules/ModulesStorage.ts\"\nimport { getTypeSlashName } from \"modules/utils.ts\"\nimport * as React from \"react\"\nimport { rotateElement } from \"../shared/utils/rotateElement.ts\"\nimport * as styles from \"./CodeEditorModulePreview.styles.ts\"\nimport { CodeEditorPreviewToolbar } from \"./CodeEditorPreviewToolbar.tsx\"\nimport { CodeEditorPreviewWindow } from \"./CodeEditorPreviewWindow.tsx\"\nimport { ComponentPreviewWrapper } from \"./ModulePreviewWrapper.tsx\"\n\nconst log = getLogger(\"CodeEditorModulePreview\")\n\nfunction currentModuleForIdentifier(moduleIdentifier?: string): Immutable<ModuleEntry> | PersistedModule | undefined {\n\tconst parsedIdentifier = parseModuleIdentifier(moduleIdentifier)\n\tif (!isLocalModuleIdentifier(parsedIdentifier)) return undefined\n\tconst { localId } = parsedIdentifier\n\tif (!localId) return undefined\n\tconst { modulesStore } = engine.stores\n\treturn modulesStore.getModuleEntryByLocalId(localId) ?? modulesStore.getPersistedModuleByLocalId(localId)\n}\n\nexport function CodeEditorModulePreview() {\n\tconst previewContentRef = React.useRef<HTMLDivElement>(null)\n\tconst reloadIconRef = React.useRef<SVGSVGElement>(null)\n\tconst { previewStore, modulesStore } = engine.stores\n\tconst { framerSiteId, previewItem } = previewStore.useState(state => ({\n\t\tframerSiteId: state.framerSiteId,\n\t\tpreviewItem: state.item,\n\t}))\n\n\tconst moduleIdentifier =\n\t\tpreviewItem?.type === \"component\" && isModuleExportIdentifier(previewItem.componentId)\n\t\t\t? previewItem.componentId\n\t\t\t: undefined\n\tconst moduleEntry = currentModuleForIdentifier(moduleIdentifier)\n\tif (moduleEntry) {\n\t\tlog.debug(\"CodeEditorModulePreview\", { moduleIdentifier, type: moduleEntry.type })\n\t\tconst typeSlashName = getTypeSlashName({ type: moduleEntry.type, name: moduleEntry.name })\n\t\tconst fastRefreshEntry = modulesStore.fastRefreshModules.get(typeSlashName)\n\t\tif (!fastRefreshEntry || fastRefreshEntry.sourceContent !== moduleEntry.sourceContent) {\n\t\t\tmodulesStore.createFastRefreshModuleFromModule(moduleEntry)\n\t\t}\n\t}\n\n\tconst handleReload = React.useCallback(async () => {\n\t\tconst { codeEditorStore } = engine.stores\n\t\tif (codeEditorStore.currentCodeFileEdited) {\n\t\t\t// If the current code file has unsaved changes, assume reload means \u2318S (https://framer-team.slack.com/archives/CC17ARGP8/p1765312262629749).\n\t\t\t// Saving the file is enough to reload the preview thanks to Fast Refresh.\n\t\t\tawait codeEditorStore.saveCurrentFile()\n\t\t} else {\n\t\t\t// If the current code file does not have unsaved changes, assume reload means a request for a full reload.\n\t\t\tgetGlobalPreviewHandlers().reload()\n\t\t\tconst currentModule = currentModuleForIdentifier(moduleIdentifier)\n\t\t\tif (currentModule) {\n\t\t\t\tmodulesStore.createFastRefreshModuleFromModule(currentModule)\n\t\t\t}\n\t\t}\n\n\t\tconst reloadIcon = reloadIconRef.current\n\t\tif (reloadIcon) rotateElement(reloadIcon)\n\t}, [moduleIdentifier])\n\n\tif (!framerSiteId) return null\n\n\treturn (\n\t\t<CodeEditorPreviewWindow\n\t\t\ttoolbar={<CodeEditorPreviewToolbar onReload={handleReload} />}\n\t\t\tcontentRef={previewContentRef}\n\t\t\tvisible\n\t\t>\n\t\t\t<div className={cx(styles.container, styles.iframeWrapper, styles.fullHeight)}>\n\t\t\t\t{moduleEntry && moduleIdentifier && (\n\t\t\t\t\t<ComponentPreviewWrapper\n\t\t\t\t\t\tframerSiteId={framerSiteId}\n\t\t\t\t\t\tmoduleIdentifier={moduleIdentifier}\n\t\t\t\t\t\tenableFastRefresh\n\t\t\t\t\t\tlayout={moduleEntry.type === \"screen\" ? \"screen\" : \"component\"}\n\t\t\t\t\t\tstyle={{ height: \"100%\" }}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</CodeEditorPreviewWindow>\n\t)\n}\n", "import \"CodeEditorModulePreview.styles_wtmam8.wyw.css\"; export const container = \"container_c2c36n1\";\nexport const iframeWrapper = \"iframeWrapper_i1duelx5\";\nexport const fullHeight = \"fullHeight_f1sy8xi6\";", "import { Button, IconPreviewConsole, IconPreviewReload, PanelHeader } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport { rotateElement } from \"../shared/utils/rotateElement.ts\"\nimport * as classes from \"./CodeEditorPreviewToolbar.styles.ts\"\nimport { PreviewItemsButton } from \"./PreviewItemsButton.tsx\"\n\ninterface Props {\n\thasConsole?: boolean\n\thasErrors?: boolean\n\thasWarnings?: boolean\n\tonReload: () => void\n\tonToggleConsole?: () => void\n}\n\nexport function CodeEditorPreviewToolbar({\n\thasConsole = false,\n\thasErrors = false,\n\thasWarnings = false,\n\tonReload,\n\tonToggleConsole,\n}: Props) {\n\tconst reloadIconRef = React.useRef<SVGSVGElement>(null)\n\n\tconst handleReload = React.useCallback(() => {\n\t\tonReload()\n\t\tconst reloadIcon = reloadIconRef.current\n\t\tif (reloadIcon) rotateElement(reloadIcon)\n\t}, [onReload])\n\n\treturn (\n\t\t<div className={cx(classes.previewToolbar, classes.flatToolbar)}>\n\t\t\t<PanelHeader title=\"Preview\" className={cx(classes.flatHeader)}>\n\t\t\t\t<div className={classes.fixedWidthSpacer} />\n\t\t\t\t{onToggleConsole !== undefined && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\ttitle={`${hasConsole ? \"Hide\" : \"Show\"} console`}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tclasses.toolbarButton,\n\t\t\t\t\t\t\thasWarnings && !hasErrors && \"has-warnings\",\n\t\t\t\t\t\t\thasErrors && \"has-errors\",\n\t\t\t\t\t\t\thasConsole && \"active\",\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={onToggleConsole}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconPreviewConsole />\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t\t<Button variant=\"link\" title=\"Reset preview\" className={cx(classes.toolbarButton)} onClick={handleReload}>\n\t\t\t\t\t<IconPreviewReload ref={reloadIconRef} />\n\t\t\t\t</Button>\n\t\t\t\t<PreviewItemsButton className={classes.previewItemsButton} />\n\t\t\t</PanelHeader>\n\t\t</div>\n\t)\n}\n", "import \"CodeEditorPreviewToolbar.styles_nooako.wyw.css\"; export const toolbarButton = \"toolbarButton_te7d3bz\";\nexport const previewToolbar = \"previewToolbar_pxhoxl8\";\nexport const fixedWidthSpacer = \"fixedWidthSpacer_f13bgbpj\";\nexport const previewItemsButton = \"previewItemsButton_ptba93y\";\nexport const flatToolbar = \"flatToolbar_f75eej9\";\nexport const flatHeader = \"flatHeader_f12pfgcm\";", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { Button, IconInputDropdown, ProjectBarButton, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\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 { isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type { PreviewItem } from \"document/preview/PreviewItem.ts\"\nimport { isPreviewItemEqual } from \"document/preview/PreviewItem.ts\"\nimport type { PreviewItemWithName } from \"document/preview/PreviewRecentList.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./PreviewItemsButton.styles.ts\"\nimport { getLabelForComponent } from \"./getLabelForComponent.ts\"\n\ninterface Props {\n\tvariant?: \"large\"\n\tclassName?: string\n}\n\nconst supportedModuleTypes = new Set<string>([ModuleType.Screen, ModuleType.Code, ModuleType.Canvas])\n\nexport function PreviewItemsButton({ className, variant }: Props) {\n\tconst ref = React.useRef<HTMLButtonElement>(null)\n\tconst [menuIsOpen, setMenuIsOpen] = React.useState(false)\n\tconst { treeStore, previewStore, contextMenuStore } = engine.stores\n\tconst mostRecentItemName = previewStore.useState(state => state.recent.items[0]?.name)\n\n\tconst showMenu = React.useCallback(() => {\n\t\tif (!ref.current) return\n\n\t\tsetMenuIsOpen(true)\n\n\t\tconst localComponents: EntityDefinition[] = []\n\t\tconst webpageComponents: EntityDefinition[] = []\n\t\tconst screenComponents: EntityDefinition[] = []\n\n\t\tfor (const component of engine.componentLoader.getAllLocalModules()) {\n\t\t\tif (component.type !== \"component\") continue\n\t\t\tconst componentIdentifier = parseModuleIdentifier(component.identifier)\n\t\t\tif (!componentIdentifier || !isLocalModuleIdentifier(componentIdentifier)) continue\n\t\t\tconst module = treeStore.tree.getNodeWithTrait(componentIdentifier.localId, isLocalModuleNode)\n\t\t\tif (!module || !supportedModuleTypes.has(module.save.type)) continue\n\t\t\tconst node = treeStore.tree.get(componentIdentifier.localIdName)\n\t\t\tif (node && isWebPageNode(node) && hasCollectionDataSource(node)) continue\n\t\t\tif (module.save.type === ModuleType.Screen) {\n\t\t\t\tif (node && isWebPageNode(node)) {\n\t\t\t\t\twebpageComponents.push(component)\n\t\t\t\t} else {\n\t\t\t\t\tscreenComponents.push(component)\n\t\t\t\t}\n\t\t\t} else if (module.save.type === ModuleType.Code || module.save.type === ModuleType.Canvas) {\n\t\t\t\tlocalComponents.push(component)\n\t\t\t}\n\t\t}\n\n\t\tconst menuItems: MenuItemOptions[] = buildMenu({\n\t\t\trecentItems: previewStore.recent.items,\n\t\t\tlocalComponents,\n\t\t\twebpageComponents,\n\t\t\tscreenComponents,\n\t\t\tactiveStickySelection: previewStore.stickyPreviewItem,\n\t\t\tonClick: handlePreviewItemClick,\n\t\t})\n\n\t\tconst bounds = ref.current.getBoundingClientRect()\n\n\t\tcontextMenuStore.show(menuItems, {\n\t\t\tlocation: { x: bounds.right, y: bounds.bottom },\n\t\t\tonDone: () => setMenuIsOpen(false),\n\t\t})\n\t}, [])\n\n\tconst content = (\n\t\t<>\n\t\t\t<div className={truncateWithEllipsis}>{mostRecentItemName ?? \"Preview\u2026\"}</div>\n\t\t\t<div className={cx(styles.chevronWrapper, menuIsOpen && styles.chevronWrapperUp)}>\n\t\t\t\t<IconInputDropdown />\n\t\t\t</div>\n\t\t</>\n\t)\n\n\treturn variant === \"large\" ? (\n\t\t<ProjectBarButton className={styles.large} ref={ref} round title=\"Select preview item\" onClick={showMenu}>\n\t\t\t{content}\n\t\t</ProjectBarButton>\n\t) : (\n\t\t<Button as=\"div\" className={cx(styles.button, className)} onClick={showMenu} ref={ref}>\n\t\t\t{content}\n\t\t</Button>\n\t)\n}\n\nfunction handlePreviewItemClick(previewItem: PreviewItem) {\n\tconst { chromeStore, previewStore } = engine.stores\n\tconst isCodeEditorOpen = chromeStore.mainView === ActiveMainView.CodeEditor\n\tconst isStickyDeselection = isPreviewItemEqual(previewStore.item, previewItem) && previewStore.stickyPreviewItem\n\n\tif (isStickyDeselection) {\n\t\tpreviewStore.stickyPreviewItem = false\n\t\tpreviewStore.item = previewStore.computePreviewItem()\n\n\t\t// Early return to avoid explicitly setting preview item\n\t\treturn\n\t}\n\n\trecord(\"code_preview_sticky_add\", { previewItemType: previewItem.type })\n\n\tif (isCodeEditorOpen) {\n\t\tpreviewStore.stickyPreviewItem = true\n\t}\n\n\tpreviewStore.item = previewItem\n}\n\nfunction buildMenu({\n\trecentItems,\n\tlocalComponents,\n\twebpageComponents,\n\tscreenComponents,\n\tactiveStickySelection,\n\tonClick,\n}: {\n\trecentItems: PreviewItemWithName[]\n\tlocalComponents?: EntityDefinition[]\n\twebpageComponents?: EntityDefinition[]\n\tscreenComponents?: EntityDefinition[]\n\tactiveStickySelection?: boolean\n\tonClick: (previewItem: PreviewItem) => void\n}): MenuItemOptions[] {\n\tconst menuItems: MenuItemOptions[] = []\n\tconst { treeStore, previewStore } = engine.stores\n\n\tmenuItems.push({ label: Dictionary.Recents, enabled: false })\n\tfor (const previewItemWithName of recentItems) {\n\t\tconst { name, ...previewItem } = previewItemWithName\n\t\tconst isStickySelection = isPreviewItemEqual(previewItemWithName, previewStore.item) && activeStickySelection\n\n\t\tmenuItems.push({\n\t\t\tlabel: name,\n\t\t\tclick: () => onClick(previewItem),\n\t\t\t...(isStickySelection ? { checked: true } : {}),\n\t\t})\n\t}\n\n\tmenuItems.push({ type: \"separator\" }, { label: \"All\", enabled: false })\n\n\tif (localComponents && localComponents.length > 0) {\n\t\tmenuItems.push({\n\t\t\tlabel: `${Dictionary.Component}s`,\n\t\t\tsubmenu: localComponents.map((component): MenuItemOptions => {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: getLabelForComponent(engine.componentLoader, treeStore, component.identifier, component.name),\n\t\t\t\t\tclick: () => onClick({ type: \"component\", componentId: component.identifier }),\n\t\t\t\t}\n\t\t\t}),\n\t\t})\n\t}\n\tif (webpageComponents && webpageComponents.length > 0) {\n\t\tmenuItems.push({\n\t\t\tlabel: `${Dictionary.WebPage}s`,\n\t\t\tsubmenu: webpageComponents.map((component): MenuItemOptions => {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: getLabelForComponent(engine.componentLoader, treeStore, component.identifier, component.name),\n\t\t\t\t\tclick: () => onClick({ type: \"component\", componentId: component.identifier }),\n\t\t\t\t}\n\t\t\t}),\n\t\t})\n\t}\n\tif (screenComponents && screenComponents.length > 0) {\n\t\tmenuItems.push({\n\t\t\tlabel: `${Dictionary.Screen}s`,\n\t\t\tsubmenu: screenComponents.map((component): MenuItemOptions => {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: getLabelForComponent(engine.componentLoader, treeStore, component.identifier, component.name),\n\t\t\t\t\tclick: () => onClick({ type: \"component\", componentId: component.identifier }),\n\t\t\t\t}\n\t\t\t}),\n\t\t})\n\t}\n\n\treturn menuItems\n}\n\nexport const _buildMenuForTesting = buildMenu\n", "import \"PreviewItemsButton.styles_1lv01u4.wyw.css\"; export const button = \"button_b17yqsqe\";\nexport const chevronWrapper = \"chevronWrapper_c1r1xq1m\";\nexport const chevronWrapperUp = \"chevronWrapperUp_cdrdg3r\";\nexport const large = \"large_lc440z0\";", "import type { MouseTrackerEvent } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { isNumber, isObject } from \"utils/typeChecks.ts\"\nimport { useShouldShowCodeAgentPanel } from \"../agentPanel/useShouldShowCodeAgentPanel.ts\"\nimport * as styles from \"./CodeEditorPreviewWindow.styles.ts\"\nimport type { FreedomOfMovement } from \"./WindowResize.tsx\"\nimport { WindowResize } from \"./WindowResize.tsx\"\nimport { sessionDataForIdentifier } from \"./sessionDataForIdentifier.ts\"\n\ninterface Props {\n\ttoolbar: React.ReactNode\n\tchildren: React.ReactNode\n\tvisible: boolean\n\tcontentRef: React.RefObject<HTMLDivElement>\n}\n\nconst freedomOfMovementDefaults: FreedomOfMovement = {\n\ttopMaxReached: true,\n\ttopMinReached: true,\n\trightMaxReached: true,\n\trightMinReached: true,\n\tbottomMaxReached: true,\n\tbottomMinReached: true,\n\tleftMaxReached: false,\n\tleftMinReached: false,\n}\n\nconst previewWidthVar = \"--framerInternalUI-previewWidth\"\nconst defaultWidth = dimensions.values.codeEditorMinWidth\n\nfunction getMaxWidth(panelPadding: number, showCodeAgentPanel: boolean, codeAgentPanelWidth: number) {\n\tconst agentPanelWidth = showCodeAgentPanel ? codeAgentPanelWidth : 0\n\treturn (\n\t\twindow.innerWidth -\n\t\tengine.stores.layoutState.currentChromeMarginLeft -\n\t\tdimensions.values.codeEditorMinWidth -\n\t\tagentPanelWidth -\n\t\tpanelPadding\n\t)\n}\n\ninterface StoredWidth {\n\twidth: number\n}\n\nconst storedWidthKey: keyof StoredWidth = \"width\"\n\nfunction storedWidthValidator(value: unknown): value is StoredWidth {\n\tif (!isObject(value)) return false\n\tif (!(storedWidthKey in value)) return false\n\treturn isNumber(value[storedWidthKey])\n}\n\nconst [getSessionData, setSessionData] = sessionDataForIdentifier(\"code-editor-preview-data\", storedWidthValidator, {\n\twidth: defaultWidth,\n})\n\nfunction setWidthProperty(width: number) {\n\tdocument.body.style.setProperty(previewWidthVar, `${width}px`)\n}\n\nfunction getEffectivePreviewWidth(preferredWidth: number, maxWidth: number) {\n\treturn Math.min(Math.max(styles.previewMinWidth, preferredWidth), Math.max(styles.previewMinWidth, maxWidth))\n}\n\nexport function CodeEditorPreviewWindow({ toolbar, children, visible, contentRef }: Props) {\n\tconst windowContainerRef = React.useRef<HTMLDivElement>(null)\n\tconst [freedomOfMovement, setFreedomOfMovement] = React.useState(freedomOfMovementDefaults)\n\tconst freedomofMovementRef = React.useRef(freedomOfMovement)\n\tfreedomofMovementRef.current = freedomOfMovement\n\n\tconst panelPadding = useDimensionValue(\"panelPadding\")\n\tconst showCodeAgentPanel = useShouldShowCodeAgentPanel()\n\tconst codeAgentPanelWidth = useEngineState(\n\t\t() => engine.stores.layoutState.getCurrentPropertyPanelWidth(),\n\t\t[],\n\t\tEngineChange.PropertyPanelWidth,\n\t)\n\n\tconst updateFreedomOfMovement = React.useCallback(\n\t\t(width: number) => {\n\t\t\tconst maxWidth = getMaxWidth(panelPadding, showCodeAgentPanel, codeAgentPanelWidth)\n\t\t\tconst newFreedomOfMovement: FreedomOfMovement = {\n\t\t\t\t...freedomOfMovementDefaults,\n\t\t\t\tleftMinReached: width <= styles.previewMinWidth,\n\t\t\t\tleftMaxReached: width >= maxWidth,\n\t\t\t}\n\t\t\t// Only update freedom of movement when the values are different\n\t\t\tif (!isShallowEqual(freedomofMovementRef.current, newFreedomOfMovement)) {\n\t\t\t\tsetFreedomOfMovement(newFreedomOfMovement)\n\t\t\t}\n\t\t},\n\t\t[panelPadding, showCodeAgentPanel, codeAgentPanelWidth],\n\t)\n\n\tconst setPreviewWidth = React.useCallback(\n\t\t(width: number) => {\n\t\t\tsetWidthProperty(width)\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.chromeStore.codeEditorPreviewWidth = width\n\t\t\t\tupdateFreedomOfMovement(width)\n\t\t\t})\n\t\t},\n\t\t[updateFreedomOfMovement],\n\t)\n\n\tconst applyPreferredPreviewWidth = React.useCallback(() => {\n\t\tconst preferredWidth = getSessionData().width\n\t\tconst width = getEffectivePreviewWidth(\n\t\t\tpreferredWidth,\n\t\t\tgetMaxWidth(panelPadding, showCodeAgentPanel, codeAgentPanelWidth),\n\t\t)\n\t\tsetPreviewWidth(width)\n\t}, [panelPadding, showCodeAgentPanel, codeAgentPanelWidth, setPreviewWidth])\n\n\t// Update freedom of movement when becoming visible or resizing browser window\n\tReact.useLayoutEffect(() => {\n\t\tif (!visible) return\n\t\tapplyPreferredPreviewWidth()\n\t\twindow.addEventListener(\"resize\", applyPreferredPreviewWidth)\n\t\treturn () => window.removeEventListener(\"resize\", applyPreferredPreviewWidth)\n\t}, [applyPreferredPreviewWidth, visible])\n\n\t// Resizing\n\tconst widthAtStartRef = React.useRef<number | null>(null)\n\n\tconst resizeStartHandler = React.useCallback(() => {\n\t\tconst containerElement = windowContainerRef.current\n\t\tif (!containerElement) {\n\t\t\twidthAtStartRef.current = null\n\t\t\treturn\n\t\t}\n\t\tconst startRect = containerElement.getBoundingClientRect()\n\t\twidthAtStartRef.current = startRect.width - panelPadding\n\t}, [panelPadding])\n\n\tconst resizeHandler = React.useCallback(\n\t\t(event: MouseTrackerEvent) => {\n\t\t\tconst widthAtStart = widthAtStartRef.current\n\t\t\tif (widthAtStart === null) return\n\t\t\tconst preferredWidth = Math.max(styles.previewMinWidth, widthAtStart - event.offset.x)\n\t\t\tconst width = getEffectivePreviewWidth(\n\t\t\t\tpreferredWidth,\n\t\t\t\tgetMaxWidth(panelPadding, showCodeAgentPanel, codeAgentPanelWidth),\n\t\t\t)\n\t\t\tsetSessionData({ width: preferredWidth })\n\t\t\tsetPreviewWidth(width)\n\t\t},\n\t\t[setPreviewWidth, panelPadding, showCodeAgentPanel, codeAgentPanelWidth],\n\t)\n\n\tconst windowContainerStyles: React.CSSProperties = {\n\t\tposition: \"absolute\",\n\t\ttop: \"var(--framerInternalUI-chromeToolbarHeight)\",\n\t\tright: showCodeAgentPanel ? \"var(--framerInternalUI-propertyPanelWidth)\" : \"0\",\n\t\tbottom: \"var(--framerInternalUI-chromeMarginBottom)\",\n\t\twidth: `calc(var(${previewWidthVar}) + ${dimensions.css.panelPadding})`,\n\t\tminWidth: styles.previewMinOuterWidth,\n\t\tmaxWidth: showCodeAgentPanel ? styles.previewMaxWidthWithAgent : styles.previewMaxWidth,\n\t\tpointerEvents: \"none\",\n\t}\n\n\treturn (\n\t\t<div ref={windowContainerRef} style={windowContainerStyles} className={cx(!visible && styles.windowHidden)}>\n\t\t\t<WindowResize\n\t\t\t\tonDragStart={resizeStartHandler}\n\t\t\t\tonDrag={resizeHandler}\n\t\t\t\tonDragEnd={resizeHandler}\n\t\t\t\tfreedomOfMovement={freedomOfMovement}\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tclassName={styles.window}\n\t\t\t\tstyle={{\n\t\t\t\t\tposition: \"relative\",\n\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\theight: \"100%\",\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{toolbar}\n\t\t\t\t<div ref={contentRef} className={styles.windowContent}>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "import \"CodeEditorPreviewWindow.styles_36697k.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const previewMinWidth = dimensions.values.panelMinWidth;\nexport const previewMinOuterWidth = `calc(${previewMinWidth}px + ${dimensions.css.panelPadding})`;\nconst previewMaxWidthBase = `100vw - var(--framerInternalUI-chromeMarginLeft) - ${dimensions.css.codeEditorMinWidth}`;\nexport const previewMaxWidth = `calc(${previewMaxWidthBase})`;\nexport const previewMaxWidthWithAgent = `calc(${previewMaxWidthBase} - var(--framerInternalUI-propertyPanelWidth, 0px))`;\nexport const windowContent = \"windowContent_wkcyn1k\";\nexport const window = \"window_wlz0n6n\";\nexport const windowHidden = \"windowHidden_w17025cg\";", "type GetData<T> = () => T\ntype ComputeData<T> = (currentValue: T) => T\ntype SetData<T> = (value: T | ComputeData<T>) => void\n\nfunction isFunction(value: unknown): value is Function {\n\treturn typeof value === \"function\"\n}\n\nexport function sessionDataForIdentifier<T extends object>(\n\tidentifier: string,\n\tvalidator: (value: unknown) => value is T,\n\tfallbackValue: T,\n): [GetData<T>, SetData<T>] {\n\tconst getData: GetData<T> = () => {\n\t\tif (typeof sessionStorage === \"undefined\") return fallbackValue\n\t\tconst storedValue = sessionStorage.getItem(identifier)\n\t\tif (!storedValue) return fallbackValue\n\t\tconst data = JSON.parse(storedValue)\n\t\treturn validator(data) ? data : fallbackValue\n\t}\n\tconst setData: SetData<T> = value => {\n\t\tconst newValue = isFunction(value) ? value(getData()) : value\n\t\tif (typeof sessionStorage === \"undefined\") return\n\t\tsessionStorage.setItem(identifier, JSON.stringify(newValue))\n\t}\n\treturn [getData, setData]\n}\n", "import type { ModulePreviewSandbox } from \"@framerjs/framer-services\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PreviewItem } from \"document/preview/PreviewItem.ts\"\nimport { togglePreviewNodeResponsive } from \"document/preview/togglePreviewNodeResponsive.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport type { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { memo, useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { useForceUpdate } from \"utils/useForceUpdate.ts\"\nimport { FullsizePreview } from \"./FullsizePreview.tsx\"\nimport { ModulePreviewWrapper, PreviewVisibilityContext } from \"./ModulePreviewWrapper.tsx\"\nimport { minHeightPreview, minWidthPreview } from \"./fullsizePreviewLayoutHelpers.ts\"\nimport { getRenderInfoForPreviewItem } from \"./getRenderInfoForPreviewItem.ts\"\n\nconst log = getLogger(\"OverCanvasPreview\")\n\nconst OVER_CANVAS_UNRESPONSIVE_RENDER_TIME_THRESHOLD_MS = 1000\n\nexport const OverCanvasPreview = memo(function OverCanvasPreview() {\n\tconst { treeStore, popoverStore, loadingStore, chromeStore } = engine.stores\n\tconst isDocumentEmpty = useDeprecatedEngineState(EngineChange.TreeStore, () => treeStore.isDocumentEmpty)\n\tconst isDocumentLoaded = loadingStore.useState(state => state.isDocumentLoaded)\n\tconst { active: activePopover } = popoverStore.useState()\n\n\t// Only a single preview can be rendered at the same time, so only unmount if code editor preview is visible\n\tconst codeEditorPreviewVisible = chromeStore.useState(state => state.codeEditorPreviewVisible)\n\tif (codeEditorPreviewVisible) return null\n\n\t// Don't load the preview before any part of the document.\n\tif (!isDocumentLoaded) return null\n\n\treturn (\n\t\t<OverCanvasPreviewInner\n\t\t\tisDocumentEmpty={isDocumentEmpty}\n\t\t\tisDocumentLoaded={isDocumentLoaded}\n\t\t\tactivePopover={activePopover}\n\t\t/>\n\t)\n})\n\ninterface InnerProps {\n\tactivePopover: PopoverType\n\tisDocumentEmpty: boolean\n\tisDocumentLoaded: boolean\n}\n\nfunction OverCanvasPreviewInner({ activePopover, isDocumentEmpty, isDocumentLoaded }: InnerProps) {\n\tconst handleClose = useCallback(() => togglePreviewVisible(engine, { visible: false }), [])\n\tconst handleResponsive = useCallback(() => togglePreviewNodeResponsive(engine), [])\n\tconst { fullsizePreviewStore, previewStore, chromeStore } = engine.stores\n\tconst handleTogglePreviewUI = useCallback(() => fullsizePreviewStore.togglePreviewUIVisible(), [])\n\n\tconst { previewItem, deviceOptions, isResponsive, framerSiteId, targetModuleRevisions } = previewStore.useState(\n\t\tstate => ({\n\t\t\tpreviewItem: state.item,\n\t\t\ttargetModuleRevisions: state.targetModuleRevisions,\n\t\t\tdeviceOptions: state.metadata.deviceOptions,\n\t\t\tisResponsive: state.metadata.isResponsive,\n\t\t\tframerSiteId: state.framerSiteId,\n\t\t\tforceOverCanvasPreviewRender: state.forceOverCanvasPreviewRender,\n\t\t}),\n\t)\n\tconst { isPreviewUIVisible, resizablePreviewSize } = fullsizePreviewStore.useState()\n\n\tlog.debug(\"OverCanvasPreviewInner\", { previewItem, resizablePreviewSize, isPreviewUIVisible })\n\n\tconst renderInfo = useRenderInfo(previewItem)\n\tconst type = previewItem?.type\n\tconst style = useMemo(() => (type === \"component\" ? { height: \"100%\" } : undefined), [type])\n\n\t// We can't render the preview if the framerSiteId hash has not been created\n\t// yet. This should happen within moments of rendering.\n\tif (!framerSiteId) return null\n\n\treturn (\n\t\t<PreviewVisibility>\n\t\t\t{visible => (\n\t\t\t\t<FullsizePreview\n\t\t\t\t\tactivePopover={activePopover}\n\t\t\t\t\tisDocumentEmpty={isDocumentEmpty}\n\t\t\t\t\tisDocumentLoaded={isDocumentLoaded}\n\t\t\t\t\tdeviceOptions={deviceOptions ? { ...deviceOptions, transparentBackground: true } : undefined}\n\t\t\t\t\tvisible={visible}\n\t\t\t\t\tisResponsive={isResponsive}\n\t\t\t\t\t// Don't show a spinner, because we handle the loading state differently\n\t\t\t\t\tisPreviewReady={true}\n\t\t\t\t\tpreviewUIVisible={isPreviewUIVisible}\n\t\t\t\t\tdisplayMinimalUI={chromeStore.displayMinimalUI}\n\t\t\t\t\tresizablePreviewSize={resizablePreviewSize}\n\t\t\t\t\tonClose={handleClose}\n\t\t\t\t\tonHandleResponsive={handleResponsive}\n\t\t\t\t\tonHandleTogglePreviewUI={handleTogglePreviewUI}\n\t\t\t\t\tminPreviewWidth={renderInfo.kind === \"webpage\" ? minWidthPreview : 0}\n\t\t\t\t\tminPreviewHeight={renderInfo.kind === \"webpage\" ? minHeightPreview : 0}\n\t\t\t\t>\n\t\t\t\t\t<ModulePreviewWrapper\n\t\t\t\t\t\tframerSiteId={framerSiteId}\n\t\t\t\t\t\trenderInfo={renderInfo}\n\t\t\t\t\t\ttargetModuleRevisions={targetModuleRevisions}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t\tisDocumentLoaded={isDocumentLoaded}\n\t\t\t\t\t\tunresponsiveRenderTimeThreshold={OVER_CANVAS_UNRESPONSIVE_RENDER_TIME_THRESHOLD_MS}\n\t\t\t\t\t/>\n\t\t\t\t</FullsizePreview>\n\t\t\t)}\n\t\t</PreviewVisibility>\n\t)\n}\n\nfunction PreviewVisibility({ children }: { children: (visible: boolean) => React.ReactNode }) {\n\tconst forceUpdate = useForceUpdate()\n\tconst isPreviewVisible = engine.stores.chromeStore.useState(state => state.mainView === ActiveMainView.Preview)\n\tconst shouldStartPreloading = engine.stores.previewStore.useState(state => state.shouldStartPreloading)\n\tconst wasPreviewVisible = useRef(isPreviewVisible)\n\n\tconst onPreviewContentUnmount = useConstant(() => () => {\n\t\t// When the preview successfully renders null, set the visibility state\n\t\t// to false and rerender to finally hide the preview.\n\t\tisVisibleAfterReactRender.current = false\n\t\tforceUpdate()\n\t})\n\tconst isVisibleAfterReactRender = useRef(false)\n\n\tuseEffect(() => {\n\t\tif (isPreviewVisible && !wasPreviewVisible.current) {\n\t\t\t// When the preview becomes visible, reset the visibility state.\n\t\t\t// This allows the preview to reset it to false when it paints null.\n\t\t\tisVisibleAfterReactRender.current = true\n\t\t}\n\t\twasPreviewVisible.current = isPreviewVisible\n\t}, [isPreviewVisible])\n\n\t// Only render the preview iframe if it was mounted before. Or if preview should be visible. Or\n\t// if preview can start preloading, which will become true after the canvas has fully loaded.\n\t// That way the preview iframe is mounted quickly, preventing an initial delay when the user\n\t// opens preview. But is not mounted so quickly that it interferes with the sandbox getting up\n\t// and running.\n\tconst wasPreviewMounted = useRef(false)\n\tif (!wasPreviewMounted.current && !isPreviewVisible && !shouldStartPreloading) return null\n\n\t// Track that the preview was mounted.\n\twasPreviewMounted.current = true\n\n\t// When the app wants to hide the preview, only set visibility to false\n\t// after we have received a pong from the iframe that it has painted null.\n\tconst visibility = isPreviewVisible || isVisibleAfterReactRender.current\n\n\treturn (\n\t\t<PreviewVisibilityContext.Provider value={onPreviewContentUnmount}>\n\t\t\t{children(visibility)}\n\t\t</PreviewVisibilityContext.Provider>\n\t)\n}\n\nfunction useRenderInfo(previewItem: PreviewItem | undefined): ModulePreviewSandbox.RenderInfo {\n\treturn useMemo(() => {\n\t\treturn getRenderInfoForPreviewItem(engine.componentLoader, engine.stores, previewItem)\n\t}, [previewItem])\n}\n", "// TODO: This is duplicated between Web and Vekter, clean it up (but until then,\n// try to keep these two in sync)\n\nimport { cx } from \"@linaria/core\"\nimport type { DeviceOptions } from \"library/components/Device/index.ts\"\nimport { Device } from \"library/components/Device/index.ts\"\nimport type React from \"react\"\nimport { forwardRef } from \"react\"\nimport * as classes from \"./PreviewContainer.styles.ts\"\n\nconst observer = window.ResizeObserver\ninterface Props {\n\thidden?: boolean\n\toverrideTheme?: \"dark\" | \"light\"\n\tdeviceOptions?: DeviceOptions\n\tcanResize?: boolean\n\tchildren: React.ReactNode\n\tonClickCapture?: (e: React.MouseEvent<HTMLDivElement>) => void\n}\n\nexport const PreviewContainer = forwardRef(function PreviewContainer(\n\t{ hidden, deviceOptions, canResize = false, children, onClickCapture, overrideTheme }: Props,\n\tref: React.Ref<HTMLDivElement>,\n) {\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\tclasses.container,\n\t\t\t\thidden && classes.hidden,\n\t\t\t\t!hidden && !deviceOptions && classes.implicitResponsive,\n\t\t\t)}\n\t\t\tonClickCapture={onClickCapture}\n\t\t>\n\t\t\t<Device\n\t\t\t\tcanResize={canResize}\n\t\t\t\toverrideTheme={overrideTheme}\n\t\t\t\tdeviceOptions={deviceOptions}\n\t\t\t\tscaleTo=\"dynamic\"\n\t\t\t\tResizeObserver={observer}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Device>\n\t\t</div>\n\t)\n})\n", "import type { MouseTrackerEvent } from \"@framerjs/fresco\"\nimport { Button, MouseTracker, Stack } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { ResizablePreviewSize } from \"document/stores/FullsizePreviewStore.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport type { DeviceOptions } from \"library/components/Device/index.ts\"\nimport { debounce } from \"library/render/utils/debounce.ts\"\nimport { LoadingIndicator } from \"preview-module/components/LoadingIndicator.tsx\"\nimport { PreviewContainer } from \"preview-module/components/PreviewContainer.tsx\"\nimport React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { EmptyDocumentPreview } from \"./EmptyDocumentPreview.tsx\"\nimport * as styles from \"./FullsizePreview.styles.ts\"\nimport {\n\tfullsizePreviewId,\n\tgetFullsizePreviewMaxHeight,\n\tgetFullsizePreviewMaxWidth,\n\tgetFullsizePreviewSize,\n\thandlebarsSize,\n} from \"./fullsizePreviewLayoutHelpers.ts\"\n\ninterface Props {\n\tactivePopover: PopoverType\n\tchildren: React.ReactNode\n\tconsoleRendered?: React.ReactNode\n\tdeviceOptions?: DeviceOptions\n\tvisible: boolean\n\tisResponsive?: boolean\n\tisDocumentLoaded: boolean\n\tisDocumentEmpty: boolean\n\tisPreviewReady?: boolean\n\tcontentRef?: React.RefObject<HTMLDivElement>\n\tpreviewUIVisible: boolean\n\tdisplayMinimalUI: boolean\n\tresizablePreviewSize?: ResizablePreviewSize\n\tonClose: () => void\n\tonHandleResponsive: () => void\n\tonHandleTogglePreviewUI: () => void\n\tminPreviewWidth?: number\n\tminPreviewHeight?: number\n}\n\nexport function FullsizePreview({\n\tactivePopover,\n\tchildren,\n\tconsoleRendered,\n\tdeviceOptions,\n\tvisible,\n\tisResponsive,\n\tisDocumentLoaded,\n\tisDocumentEmpty,\n\tisPreviewReady,\n\tcontentRef,\n\tpreviewUIVisible,\n\tdisplayMinimalUI,\n\tresizablePreviewSize: size,\n\tonClose,\n\tonHandleResponsive,\n\tonHandleTogglePreviewUI,\n\tminPreviewWidth = 0,\n\tminPreviewHeight = 0,\n}: Props) {\n\tconst ref = React.useRef<HTMLDivElement>(null)\n\tReact.useEffect(() => {\n\t\tif (!visible || !ref.current) return\n\t\t// When the preview gets shown, let's force the browser to do layout\n\t\t// before the preview iframe even gets a chance to render the preview.\n\t\t// Otherwise, if a component were to try to access e.g. its offsetWidth,\n\t\t// it might come back as \"0\".\n\t\t//\n\t\t// With this effect, and knowing that React effects fire bottom-up, we\n\t\t// can be sure that layout will happen before usePreviewServices in\n\t\t// OverCanvasPreview sends the service call (postMessage) to unpause and\n\t\t// render the preview.\n\t\t// eslint-disable-next-line no-unused-expressions, @typescript-eslint/no-unused-expressions\n\t\tref.current.offsetWidth // force layout\n\t}, [visible])\n\tconst elementRef = React.useRef<HTMLDivElement>(null)\n\n\tconst maxWidth = getFullsizePreviewMaxWidth()\n\tconst maxHeight = getFullsizePreviewMaxHeight()\n\tconst width = size?.width ?? maxWidth\n\tconst height = size?.height ?? maxHeight\n\tconst widthAtDragStartRef = React.useRef<number | null>(null)\n\tconst heightAtDragStartRef = React.useRef<number | null>(null)\n\n\tconst { fullsizePreviewStore, documentSettingsStore } = engine.stores\n\n\tconst handleKeypress = React.useCallback(\n\t\t(evt: KeyboardEvent) => {\n\t\t\tconst key = evt.key.toLowerCase()\n\t\t\t// do not close preview if any of the settings popovers are open\n\t\t\tif (evt.key === \"Escape\" && (typeof activePopover === \"undefined\" || activePopover === PopoverType.None)) {\n\t\t\t\tonClose()\n\t\t\t\t// don't let the Escape event reach the canvas, as that would cancel user's selection\n\t\t\t\tevt.stopPropagation()\n\t\t\t}\n\t\t\tif (key === \"z\") {\n\t\t\t\t// Don't trigger this if we're editing text\n\t\t\t\tconst { activeElement } = document\n\t\t\t\tif (\n\t\t\t\t\tactiveElement?.nodeName === \"INPUT\" ||\n\t\t\t\t\tactiveElement?.nodeName === \"TEXTAREA\" ||\n\t\t\t\t\tactiveElement?.nodeName === \"SELECT\" ||\n\t\t\t\t\t(activeElement as HTMLElement).isContentEditable\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tonHandleResponsive()\n\t\t\t}\n\t\t},\n\t\t[onClose, activePopover, onHandleResponsive],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (!visible) return\n\t\twindow.addEventListener(\"keydown\", handleKeypress, true)\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"keydown\", handleKeypress, true)\n\t\t}\n\t}, [handleKeypress, visible])\n\n\tReact.useEffect(() => {\n\t\tif (!visible) return\n\t\tconst updateSize = debounce(() => {\n\t\t\tfullsizePreviewStore.resizablePreviewSize = getFullsizePreviewSize()\n\t\t}, 200)\n\t\twindow.addEventListener(\"resize\", updateSize)\n\t\treturn () => {\n\t\t\tupdateSize.cancel()\n\t\t\twindow.removeEventListener(\"resize\", updateSize)\n\t\t}\n\t}, [visible])\n\n\tconst onBackgroundClick = React.useCallback(\n\t\t(e: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (e.target === e.currentTarget) {\n\t\t\t\tonClose()\n\t\t\t}\n\t\t},\n\t\t[onClose],\n\t)\n\n\tconst onResizeRight = ({ offset }: MouseTrackerEvent) => {\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight,\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart + offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onResizeLeft = ({ offset }: MouseTrackerEvent) => {\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight,\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart - offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onResizeBottom = ({ offset }: MouseTrackerEvent) => {\n\t\tconst heightAtDragStart = heightAtDragStartRef.current\n\t\tif (heightAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight: Math.min(Math.max(minPreviewHeight, heightAtDragStart + offset.y * 2), maxHeight),\n\t\t\twidth,\n\t\t}\n\t}\n\n\tconst onResizeTopRight = ({ offset }: MouseTrackerEvent) => {\n\t\tconst heightAtDragStart = heightAtDragStartRef.current\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (heightAtDragStart === null || widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight: Math.min(Math.max(minPreviewHeight, heightAtDragStart - offset.y * 2), maxHeight),\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart + offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onResizeTopLeft = ({ offset }: MouseTrackerEvent) => {\n\t\tconst heightAtDragStart = heightAtDragStartRef.current\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (heightAtDragStart === null || widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight: Math.min(Math.max(minPreviewHeight, heightAtDragStart - offset.y * 2), maxHeight),\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart - offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onResizeBottomRight = ({ offset }: MouseTrackerEvent) => {\n\t\tconst heightAtDragStart = heightAtDragStartRef.current\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (heightAtDragStart === null || widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight: Math.min(Math.max(minPreviewHeight, heightAtDragStart + offset.y * 2), maxHeight),\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart + offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onResizeBottomLeft = ({ offset }: MouseTrackerEvent) => {\n\t\tconst heightAtDragStart = heightAtDragStartRef.current\n\t\tconst widthAtDragStart = widthAtDragStartRef.current\n\t\tif (heightAtDragStart === null || widthAtDragStart === null) return\n\t\tfullsizePreviewStore.resizablePreviewSize = {\n\t\t\theight: Math.min(Math.max(minPreviewHeight, heightAtDragStart + offset.y * 2), maxHeight),\n\t\t\twidth: Math.min(Math.max(minPreviewWidth, widthAtDragStart - offset.x * 2), maxWidth),\n\t\t}\n\t}\n\n\tconst onDragStart = React.useCallback(() => {\n\t\tconst element = elementRef.current\n\t\twidthAtDragStartRef.current = element?.offsetWidth ?? null\n\t\theightAtDragStartRef.current = element?.offsetHeight ?? null\n\t}, [])\n\n\tconst canResize = isResponsive && previewUIVisible\n\tconst showResizeHandles = canResize && isPreviewReady\n\tconst showDisplayUIButton = isResponsive && !previewUIVisible && !displayMinimalUI\n\t// no need to observe, changes to theme only possible via theme switcher which will also change Device theme\n\tconst themeOnOpen = documentSettingsStore.hasDarkAppearance ? \"dark\" : \"light\"\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.previewWrapperPosition,\n\t\t\t\tstyles.wrapper,\n\t\t\t\tappPointerEvents,\n\t\t\t\t!visible && styles.hiddenPreview,\n\t\t\t\t!previewUIVisible && styles.fillScreenWrapper,\n\t\t\t)}\n\t\t\tonDoubleClick={onBackgroundClick}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<div className={styles.fullscreenWrapper} ref={contentRef}>\n\t\t\t\t<div\n\t\t\t\t\tclassName={styles.background}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbackground: deviceOptions?.background ?? colors.canvasBackground,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<div className={cx(styles.content, isResponsive && styles.responsiveContent)}>\n\t\t\t\t\t\t{!isDocumentEmpty ? (\n\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\tclassName={styles.innerContent}\n\t\t\t\t\t\t\t\tpaddingTop={canResize ? \"20px\" : undefined}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\theight: canResize ? `${height}px` : \"100%\",\n\t\t\t\t\t\t\t\t\t\tmaxHeight: canResize ? `calc(100% - ${handlebarsSize / 2}px)` : \"100%\",\n\t\t\t\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\t\t\t\tminHeight: \"100px\",\n\t\t\t\t\t\t\t\t\t\tposition: \"relative\",\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\t\t{showResizeHandles && (\n\t\t\t\t\t\t\t\t\t\t<div className={styles.resizeContainer}>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.resizeBarTopDiagonal, styles.cursorNWSE)}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"nwse-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeTopLeft}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles.resizeBar}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"ew-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeLeft}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<div className={styles.resizeHandle} />\n\t\t\t\t\t\t\t\t\t\t\t</MouseTracker>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.resizeBarBottomDiagonal, styles.cursorNESW)}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"nesw-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeBottomLeft}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\t\t\t\tjustifyContent=\"center\"\n\t\t\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\theight: canResize ? `${height}px` : \"100%\",\n\t\t\t\t\t\t\t\t\t\t\twidth: canResize ? `${width}px` : \"100%\",\n\t\t\t\t\t\t\t\t\t\t\tminWidth: `${minPreviewWidth}px`,\n\t\t\t\t\t\t\t\t\t\t\tmaxWidth: canResize ? `calc(100% - ${handlebarsSize}px)` : \"100%\",\n\t\t\t\t\t\t\t\t\t\t\tmaxHeight: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\tminHeight: `${minPreviewHeight}px`,\n\t\t\t\t\t\t\t\t\t\t\tposition: \"relative\",\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tid={fullsizePreviewId}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\tvariant=\"withDepth\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\t\tstyles.expandToolbarButton,\n\t\t\t\t\t\t\t\t\t\t\t\tshowDisplayUIButton && styles.expandToolbarButtonVisible,\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\tonClick={onHandleTogglePreviewUI}\n\t\t\t\t\t\t\t\t\t\t\ttitle=\"Show interface\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tShow UI\n\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t<PreviewContainer\n\t\t\t\t\t\t\t\t\t\t\tref={elementRef}\n\t\t\t\t\t\t\t\t\t\t\toverrideTheme={themeOnOpen}\n\t\t\t\t\t\t\t\t\t\t\tcanResize={canResize}\n\t\t\t\t\t\t\t\t\t\t\tdeviceOptions={\n\t\t\t\t\t\t\t\t\t\t\t\tdeviceOptions && {\n\t\t\t\t\t\t\t\t\t\t\t\t\t...deviceOptions,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnoPadding: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t\t\t</PreviewContainer>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t{showResizeHandles && (\n\t\t\t\t\t\t\t\t\t\t<div className={styles.resizeContainer}>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.resizeBarTopDiagonal, styles.cursorNESW)}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"nesw-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeTopRight}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={styles.resizeBar}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"ew-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeRight}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<div className={styles.resizeHandle} />\n\t\t\t\t\t\t\t\t\t\t\t</MouseTracker>\n\t\t\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.resizeBarBottomDiagonal, styles.cursorNWSE)}\n\t\t\t\t\t\t\t\t\t\t\t\tcursor=\"nwse-resize\"\n\t\t\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\t\t\tonDrag={onResizeBottomRight}\n\t\t\t\t\t\t\t\t\t\t\t></MouseTracker>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t{showResizeHandles && (\n\t\t\t\t\t\t\t\t\t<MouseTracker\n\t\t\t\t\t\t\t\t\t\tclassName={styles.resizeBarHorizontal}\n\t\t\t\t\t\t\t\t\t\tcursor=\"ns-resize\"\n\t\t\t\t\t\t\t\t\t\tonDragStart={onDragStart}\n\t\t\t\t\t\t\t\t\t\tonDrag={onResizeBottom}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<div className={styles.resizeHandleHorizontal} />\n\t\t\t\t\t\t\t\t\t</MouseTracker>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tisDocumentLoaded && <EmptyDocumentPreview onClose={onClose} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!isPreviewReady && visible && <LoadingIndicator />}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{consoleRendered}\n\t\t</div>\n\t)\n}\n", "import \"EmptyDocumentPreview.styles_1806no3.wyw.css\"; export const mainStyle = \"mainStyle_maaddy7\";\nexport const iconStyle = \"iconStyle_ih8f8eu\";\nexport const linkStyle = \"linkStyle_l1fpmzei\";", "import { IconProjectBarPreview } from \"@framerjs/fresco\"\nimport { iconStyle, linkStyle, mainStyle } from \"./EmptyDocumentPreview.styles.ts\"\n\ninterface Props {\n\tonClose: () => void\n}\n\nexport function EmptyDocumentPreview({ onClose }: Props) {\n\treturn (\n\t\t<>\n\t\t\t<div className={mainStyle}>\n\t\t\t\t<div className={iconStyle}>\n\t\t\t\t\t<IconProjectBarPreview />\n\t\t\t\t</div>\n\t\t\t\tAdd a screen or a frame\n\t\t\t\t<br /> in the canvas to preview.\n\t\t\t\t<span className={linkStyle} onClick={onClose}>\n\t\t\t\t\tBack to Canvas\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</>\n\t)\n}\n", "import \"FullsizePreview.styles_z7jnm3.wyw.css\"; export const handleWidth = 5;\nexport const handlebarPadding = 10;\nexport const previewWrapperPosition = \"previewWrapperPosition_pkl1u3r\";\nexport const wrapper = \"wrapper_wxcte9l\";\nexport const fillScreenWrapper = \"fillScreenWrapper_f1n3299g\";\nexport const hiddenPreview = \"hiddenPreview_h1cpb4ns\";\nexport const background = \"background_bumf1gf\";\nexport const content = \"content_clm2yka\";\nexport const responsiveContent = \"responsiveContent_r1y4oj9c\";\nexport const innerContent = \"innerContent_i1ij4rv5\";\nexport const fullscreenWrapper = \"fullscreenWrapper_f22re6d\";\nexport const resizeHandle = \"resizeHandle_r3a6bsw\";\nexport const resizeHandleHorizontal = \"resizeHandleHorizontal_rnk44v2\";\nexport const resizeContainer = \"resizeContainer_r7w6jhd\";\nexport const resizeBar = \"resizeBar_r1lh8oh8\";\nexport const resizeBarHorizontal = \"resizeBarHorizontal_r75f24d\";\nexport const resizeBarBottomDiagonal = \"resizeBarBottomDiagonal_r1jbtcak\";\nexport const resizeBarTopDiagonal = \"resizeBarTopDiagonal_r1dszvl0\";\nexport const cursorNESW = \"cursorNESW_cm7bfh1\";\nexport const cursorNWSE = \"cursorNWSE_c1c93fyy\";\nexport const expandToolbarButton = \"expandToolbarButton_eycho2l\";\nexport const expandToolbarButtonVisible = \"expandToolbarButtonVisible_e1l73qz1\";", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { agentDimensionTokenOverrides } from \"app/agent/utils/dimensions.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { Size } from \"library/render/types/Size.ts\"\nimport { handleWidth, handlebarPadding } from \"./FullsizePreview.styles.ts\"\n\nexport const fullsizePreviewId = \"fullsize-preview-container\"\n\nexport function getFullsizePreviewSize(): Size {\n\tconst previewContainer = document.getElementById(fullsizePreviewId)\n\tif (!(previewContainer instanceof HTMLElement)) return Size.zero\n\treturn { width: previewContainer.offsetWidth, height: previewContainer.offsetHeight }\n}\n\n// Refers to the combined pixels of the handlebars for both sides\nexport const handlebarsSize = (handlebarPadding * 2 + handleWidth) * 2\n\nexport const getFullsizePreviewMaxWidth = () => window.innerWidth - handlebarsSize\nexport const getFullsizePreviewMaxHeight = () => {\n\tconst isStatusBarVisible = engine.stores.chromeStore.chromeIsVisible && engine.stores.chromeStore.statusBarIsVisible\n\tconst statusBarHeight = isStatusBarVisible ? dimensions.values.statusBarHeight : 0\n\tconst isAgentOn = experiments.is(\"agent\", \"on\")\n\tconst webBarHeight = isAgentOn ? agentDimensionTokenOverrides.webBarHeight : dimensions.values.webBarHeight\n\treturn window.innerHeight - handlebarsSize - webBarHeight - statusBarHeight\n}\n\nexport const minWidthPreview = 320\nexport const minHeightPreview = 100\n\n// This function handles all the Math operations that make sure that the new value:\n// 1. Is an integer\n// 2. Is smaller than the maximum allowed value\n// 3. Is larger than the maximum allowed value\nexport function getNewAllowedPreviewSize(value: number, maxValue: number, minValue: number) {\n\treturn Math.min(Math.max(Math.floor(value), minValue), maxValue)\n}\n", "import engine from \"document/engine.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { ProjectToolbar } from \"./ProjectToolbar.tsx\"\n\nexport const ProjectBar = React.memo(function ProjectBar() {\n\tconst { mainView, codeEditorPreviewVisible } = engine.stores.chromeStore.useState()\n\treturn <ProjectBarInner mainView={mainView} isCodeEditorPreviewDisplayed={codeEditorPreviewVisible} />\n})\n\ninterface InnerProps {\n\tmainView: ActiveMainView\n\tisCodeEditorPreviewDisplayed: boolean\n}\n\nconst ProjectBarInner = React.memo(function ProjectBarInner({ mainView, isCodeEditorPreviewDisplayed }: InnerProps) {\n\tconst isSitesSettingsOpen = mainView === ActiveMainView.SiteSettings\n\n\tconst project = engine.stores.projectStore.useState(state => state.project)\n\tconst { activeScopeType, checkingActivePage } = engine.stores.scopeStore.useState(state => ({\n\t\tactive: state.active,\n\t\tactiveScopeType: state.scopeType,\n\t\tcheckingActivePage: state.checkingActivePage,\n\t}))\n\n\treturn (\n\t\t<ProjectToolbar\n\t\t\tmainView={mainView}\n\t\t\tshowToolbar={!isSitesSettingsOpen}\n\t\t\tisCodeEditorPreviewDisplayed={isCodeEditorPreviewDisplayed}\n\t\t\tactiveScopeType={activeScopeType}\n\t\t\tcheckingActivePage={checkingActivePage}\n\t\t\tproject={project}\n\t\t/>\n\t)\n})\n", "import type { ACLEntry, UserACLEntry, WindowWithCurrentUser } from \"@framerjs/app-shared\"\nimport { ACLAvatarList, useSortedACL } from \"@framerjs/app-shared\"\nimport { Avatar, Button, IconAgentPlus, Popover, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions, shadows } from \"@framerjs/fresco/tokens\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport engine from \"document/engine.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport pluralize from \"pluralize\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport * as styles from \"./Collaborators.styles.ts\"\nimport { useHoverPopover } from \"./useHoverPopover.ts\"\n\nconst displayInvitePopover = () => {\n\tengine.stores.popoverStore.active = PopoverType.Invite\n\trecord(\"ui_interaction\", { page: MetricsInteractionViews.PROJECT_MENU_BAR, id: \"share-project\" })\n}\n\nexport function Collaborators() {\n\tconst { isDarkMode } = useDarkMode()\n\n\t// Hardcoded because this used to depend on the property panel width, but is now independent from it\n\tconst maxCollaboratorAvatars = 4\n\n\tconst { displayMinimalUI, collectionItemOverlayOpen } = engine.stores.chromeStore.useState(state => ({\n\t\tdisplayMinimalUI: state.displayMinimalUI,\n\t\tcollectionItemOverlayOpen: state.overlay?.type === \"collectionItem\",\n\t}))\n\tconst agentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst agentMaxAvatars = 3\n\n\tif (collectionItemOverlayOpen) return null\n\n\treturn agentEnabled ? (\n\t\t<CollaboratorsWithPopover\n\t\t\tisDarkMode={isDarkMode}\n\t\t\tmaxCollaboratorAvatars={agentMaxAvatars}\n\t\t\tdisplayMinimalUI={displayMinimalUI}\n\t\t/>\n\t) : (\n\t\t<CollaboratorsInner\n\t\t\tisDarkMode={isDarkMode}\n\t\t\tmaxCollaboratorAvatars={maxCollaboratorAvatars}\n\t\t\tdisplayMinimalUI={displayMinimalUI}\n\t\t/>\n\t)\n}\n\ninterface CollaboratorsInnerProps {\n\tdisplayMinimalUI: boolean\n\tisDarkMode: boolean\n\tmaxCollaboratorAvatars: number\n}\n\nfunction CollaboratorsInner({ displayMinimalUI, isDarkMode, maxCollaboratorAvatars }: CollaboratorsInnerProps) {\n\tconst user = (window.parent as WindowWithCurrentUser).framerUser\n\n\tconst { acl, activeIds } = engine.stores.projectStore.useState()\n\tconst [userEntry, activeEntries, inactiveEntries] = useSortedACL({ acl, activeIds, userId: user.id })\n\n\tconst entries = React.useMemo(() => {\n\t\treturn activeEntries.map(withInactive(false)).concat(inactiveEntries.map(withInactive(true)))\n\t}, [activeEntries, inactiveEntries])\n\n\treturn (\n\t\t<div className={styles.avatarList}>\n\t\t\t<Button enabled={!displayMinimalUI} onClick={displayInvitePopover} type=\"button\" variant=\"link\">\n\t\t\t\t<ACLAvatarList\n\t\t\t\t\tuserEntry={userEntry}\n\t\t\t\t\tentries={entries}\n\t\t\t\t\tisDarkMode={isDarkMode}\n\t\t\t\t\tmaxAvatars={maxCollaboratorAvatars}\n\t\t\t\t/>\n\t\t\t</Button>\n\t\t</div>\n\t)\n}\n\nconst maxVisiblePopoverEntries = 5\n\nfunction CollaboratorsWithPopover({ displayMinimalUI, isDarkMode, maxCollaboratorAvatars }: CollaboratorsInnerProps) {\n\tconst user = (window.parent as WindowWithCurrentUser).framerUser\n\n\tconst { acl, activeIds } = engine.stores.projectStore.useState()\n\tconst [userEntry, activeEntries, inactiveEntries] = useSortedACL({ acl, activeIds, userId: user.id })\n\n\tconst entries = React.useMemo(() => {\n\t\treturn activeEntries.map(withInactive(false)).concat(inactiveEntries.map(withInactive(true)))\n\t}, [activeEntries, inactiveEntries])\n\n\tconst triggerRef = React.useRef<HTMLDivElement>(null)\n\tconst popoverRef = React.useRef<HTMLDivElement>(null)\n\tconst { isVisible, close } = useHoverPopover({ triggerRef, popoverRef })\n\n\tconst allEntries = React.useMemo(() => {\n\t\tconst result: ACLEntry[] = []\n\t\tif (userEntry) result.push(userEntry)\n\t\tresult.push(...entries)\n\t\treturn result\n\t}, [userEntry, entries])\n\n\tconst visibleEntries = allEntries.slice(0, maxVisiblePopoverEntries)\n\tconst remainingCount = allEntries.length - visibleEntries.length\n\n\tconst handleClick = React.useCallback(() => {\n\t\tclose()\n\t\tdisplayInvitePopover()\n\t}, [close])\n\n\treturn (\n\t\t<div className={styles.avatarList}>\n\t\t\t<Button enabled={!displayMinimalUI} onClick={handleClick} type=\"button\" variant=\"link\">\n\t\t\t\t<div ref={triggerRef}>\n\t\t\t\t\t<ACLAvatarList\n\t\t\t\t\t\tuserEntry={userEntry}\n\t\t\t\t\t\tentries={entries}\n\t\t\t\t\t\tisDarkMode={isDarkMode}\n\t\t\t\t\t\tmaxAvatars={maxCollaboratorAvatars}\n\t\t\t\t\t\twithTooltips={false}\n\t\t\t\t\t\tlistClassName={styles.agentAvatarList}\n\t\t\t\t\t\tavatarClassName={styles.agentAvatarFallback}\n\t\t\t\t\t\tshadow={shadows.avatarOverlap}\n\t\t\t\t\t\tcountColor={colors.tabsBackgroundSelected}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Button>\n\n\t\t\t{isVisible && (\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={triggerRef.current}\n\t\t\t\t\talignSelf=\"center\"\n\t\t\t\t\tattachTo=\"bottom\"\n\t\t\t\t\tshowArrow={false}\n\t\t\t\t\tarrow={{ alignSelf: \"center\" }}\n\t\t\t\t\toffset={{ x: 0, y: dimensions.values.tooltipArrowHeight + 1 }}\n\t\t\t\t\tbackdropEnabled={false}\n\t\t\t\t\tfocusTrapEnabled={false}\n\t\t\t\t\tonClose={close}\n\t\t\t\t\tclassName={styles.popoverRadius}\n\t\t\t\t>\n\t\t\t\t\t<div ref={popoverRef}>\n\t\t\t\t\t\t<PopoverContent visibleEntries={visibleEntries} remainingCount={remainingCount} />\n\t\t\t\t\t</div>\n\t\t\t\t</Popover>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\ninterface PopoverContentProps {\n\tvisibleEntries: ACLEntry[]\n\tremainingCount: number\n}\n\nfunction PopoverContent({ visibleEntries, remainingCount }: PopoverContentProps) {\n\treturn (\n\t\t<Stack gap={0} className={styles.content}>\n\t\t\t{visibleEntries.map((entry, i) => (\n\t\t\t\t<React.Fragment key={entry.user.id}>\n\t\t\t\t\t<CollaboratorRow entry={entry} />\n\t\t\t\t\t{(i < visibleEntries.length - 1 || remainingCount > 0) && <div className={styles.separator} />}\n\t\t\t\t</React.Fragment>\n\t\t\t))}\n\n\t\t\t{remainingCount > 0 && (\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tgap={dimensions.css.menuItemGap}\n\t\t\t\t\tpadding={dimensions.css.menuItemPadding}\n\t\t\t\t>\n\t\t\t\t\t<div className={styles.plusIcon}>\n\t\t\t\t\t\t<IconAgentPlus />\n\t\t\t\t\t</div>\n\t\t\t\t\t<span className={styles.othersText}>{`${remainingCount} ${pluralize(\"other\", remainingCount)}\u2026`}</span>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction CollaboratorRow({ entry }: { entry: ACLEntry }) {\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tgap={dimensions.css.menuItemGap}\n\t\t\tpadding={dimensions.css.menuItemPadding}\n\t\t>\n\t\t\t<Avatar\n\t\t\t\tsrc={entry.user.avatar}\n\t\t\t\ttext={entry.user.initials}\n\t\t\t\tsize={styles.popoverAvatarSize}\n\t\t\t\tradiusCustomStyles={styles.avatarRadius}\n\t\t\t\ttextCustomStyles={styles.avatarText}\n\t\t\t\tshadow={shadows.avatar}\n\t\t\t/>\n\t\t\t<span className={styles.usernameText}>{entry.user.name}</span>\n\t\t</Stack>\n\t)\n}\n\nfunction withInactive(inactive: boolean): (v: UserACLEntry) => UserACLEntry & { inactive: boolean } {\n\treturn (v: UserACLEntry) => ({ ...v, inactive })\n}\n", "import \"Collaborators.styles_xw90uv.wyw.css\"; import { cx } from \"@linaria/core\";\nexport const avatarList = \"avatarList_asxk117\";\nexport const popoverAvatarSize = 20;\nexport const popoverRadius = \"popoverRadius_pc3mh1s\";\nexport const content = \"content_c1xrhb8f\";\nexport const separator = \"separator_s3bg8pf\";\nexport const avatarRadius = \"avatarRadius_a13nhm4i\";\nexport const avatarText = \"avatarText_a12inckv\";\nconst textBase = \"textBase_t8reg7b\";\nexport const usernameText = cx(textBase, \"usernameText_u8bkffm\");\nexport const othersText = cx(textBase, \"othersText_o6n2y7j\");\nexport const agentAvatarList = \"agentAvatarList_a1oziywj\";\nexport const agentAvatarFallback = \"agentAvatarFallback_a1vkf5rv\";\nexport const plusIcon = \"plusIcon_pv4q2s\";", "import { useCallback, useEffect, useState } from \"react\"\nimport { useHoverTimers } from \"./useHoverTimers.ts\"\n\ninterface UseHoverPopoverOptions {\n\ttriggerRef: React.RefObject<HTMLElement | null>\n\tpopoverRef: React.RefObject<HTMLElement | null>\n\tdismissDelayMs?: number\n\ttriggerDelayMs?: number\n}\n\ninterface HoverPopoverResult {\n\tisVisible: boolean\n\tisHoveredRef: React.RefObject<boolean>\n\tclose: () => void\n\tscheduleTrigger: () => void\n\tscheduleDismiss: () => void\n\tcancelTimers: () => void\n}\n\nexport function useHoverPopover({\n\ttriggerRef,\n\tpopoverRef,\n\tdismissDelayMs = 150,\n\ttriggerDelayMs = 300,\n}: UseHoverPopoverOptions): HoverPopoverResult {\n\tconst [isVisible, setIsVisible] = useState(false)\n\tconst {\n\t\tisHoveredRef,\n\t\tscheduleTrigger: timerScheduleTrigger,\n\t\tscheduleDismiss: timerScheduleDismiss,\n\t\tcancelTimers,\n\t} = useHoverTimers({ triggerDelayMs, dismissDelayMs })\n\n\tconst show = useCallback(() => setIsVisible(true), [])\n\tconst hide = useCallback(() => setIsVisible(false), [])\n\n\tconst scheduleTrigger = useCallback(() => timerScheduleTrigger(show), [timerScheduleTrigger, show])\n\tconst scheduleDismiss = useCallback(() => timerScheduleDismiss(hide), [timerScheduleDismiss, hide])\n\n\tuseEffect(() => {\n\t\tconst trigger = triggerRef.current\n\t\tif (!trigger) return\n\n\t\tconst onEnter = () => {\n\t\t\tisHoveredRef.current = true\n\t\t\tscheduleTrigger()\n\t\t}\n\t\tconst onLeave = () => {\n\t\t\tisHoveredRef.current = false\n\t\t\tscheduleDismiss()\n\t\t}\n\n\t\ttrigger.addEventListener(\"pointerenter\", onEnter)\n\t\ttrigger.addEventListener(\"pointerleave\", onLeave)\n\t\treturn () => {\n\t\t\ttrigger.removeEventListener(\"pointerenter\", onEnter)\n\t\t\ttrigger.removeEventListener(\"pointerleave\", onLeave)\n\t\t}\n\t}, [triggerRef, isHoveredRef, scheduleTrigger, scheduleDismiss])\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: isVisible triggers re-binding after the popover element mounts/unmounts\n\tuseEffect(() => {\n\t\tconst popover = popoverRef.current\n\t\tif (!popover) return\n\n\t\tconst onEnter = () => {\n\t\t\tisHoveredRef.current = true\n\t\t\tcancelTimers()\n\t\t\tsetIsVisible(true)\n\t\t}\n\t\tconst onLeave = () => {\n\t\t\tisHoveredRef.current = false\n\t\t\tscheduleDismiss()\n\t\t}\n\n\t\tpopover.addEventListener(\"pointerenter\", onEnter)\n\t\tpopover.addEventListener(\"pointerleave\", onLeave)\n\t\treturn () => {\n\t\t\tpopover.removeEventListener(\"pointerenter\", onEnter)\n\t\t\tpopover.removeEventListener(\"pointerleave\", onLeave)\n\t\t}\n\t}, [popoverRef, isVisible, isHoveredRef, cancelTimers, scheduleDismiss])\n\n\tconst close = useCallback(() => {\n\t\tcancelTimers()\n\t\tisHoveredRef.current = false\n\t\tsetIsVisible(false)\n\t}, [cancelTimers, isHoveredRef])\n\n\treturn {\n\t\tisVisible,\n\t\tisHoveredRef,\n\t\tclose,\n\t\tscheduleTrigger,\n\t\tscheduleDismiss,\n\t\tcancelTimers,\n\t}\n}\n", "import { useCallback, useEffect, useRef } from \"react\"\n\ninterface UseHoverTimersOptions {\n\ttriggerDelayMs?: number\n\tdismissDelayMs?: number\n}\n\nexport function useHoverTimers({ triggerDelayMs = 300, dismissDelayMs = 150 }: UseHoverTimersOptions = {}) {\n\tconst isHoveredRef = useRef(false)\n\tconst triggerTimeout = useRef<ReturnType<typeof setTimeout>>()\n\tconst dismissTimeout = useRef<ReturnType<typeof setTimeout>>()\n\n\tconst cancelTimers = useCallback(() => {\n\t\tclearTimeout(triggerTimeout.current)\n\t\tclearTimeout(dismissTimeout.current)\n\t}, [])\n\n\tconst scheduleTrigger = useCallback(\n\t\t(onTrigger: () => void) => {\n\t\t\tclearTimeout(triggerTimeout.current)\n\t\t\ttriggerTimeout.current = setTimeout(() => {\n\t\t\t\tif (isHoveredRef.current) onTrigger()\n\t\t\t}, triggerDelayMs)\n\t\t},\n\t\t[triggerDelayMs],\n\t)\n\n\tconst scheduleDismiss = useCallback(\n\t\t(onDismiss: () => void) => {\n\t\t\tclearTimeout(dismissTimeout.current)\n\t\t\tdismissTimeout.current = setTimeout(() => {\n\t\t\t\tif (!isHoveredRef.current) onDismiss()\n\t\t\t}, dismissDelayMs)\n\t\t},\n\t\t[dismissDelayMs],\n\t)\n\n\tuseEffect(() => {\n\t\treturn () => cancelTimers()\n\t}, [cancelTimers])\n\n\treturn { isHoveredRef, scheduleTrigger, scheduleDismiss, cancelTimers }\n}\n", "import { CenterChild, IconGlobeLarge, ProjectBarButton } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { memo } from \"react\"\n\ninterface Props {\n\tenabled: boolean\n\tonToggle: () => void\n}\n\nexport const LocalizationToolbarItem = memo(function LocalizationToolbarItem({ enabled, onToggle }: Props) {\n\tconst { mainView, displayMinimalUI } = engine.stores.chromeStore.useState(state => ({\n\t\tmainView: state.mainView,\n\t\tdisplayMinimalUI: state.displayMinimalUI,\n\t}))\n\n\tif (displayMinimalUI) return null\n\n\tconst previewVisible = mainView === ActiveMainView.Preview\n\tconst canvasVisible = mainView === ActiveMainView.Canvas\n\tconst localizationVisible = mainView === ActiveMainView.Localizations\n\tconst contentManagementVisible = mainView === ActiveMainView.ContentManagement\n\tconst settingsVisible = mainView === ActiveMainView.SiteSettings\n\tconst analyticsVisible = mainView === ActiveMainView.Analytics\n\n\tconst isVisible =\n\t\tcanvasVisible ||\n\t\tlocalizationVisible ||\n\t\tcontentManagementVisible ||\n\t\tsettingsVisible ||\n\t\tpreviewVisible ||\n\t\tanalyticsVisible\n\n\tif (!isVisible) return null\n\n\treturn (\n\t\t<ProjectBarButton\n\t\t\tenabled={enabled}\n\t\t\tactive={localizationVisible}\n\t\t\tround\n\t\t\tstyle={{ width: dimensions.css.inputHeight }}\n\t\t\ttitle={Dictionary.Localization}\n\t\t\tonClick={onToggle}\n\t\t>\n\t\t\t<CenterChild>\n\t\t\t\t<IconGlobeLarge />\n\t\t\t</CenterChild>\n\t\t</ProjectBarButton>\n\t)\n})\n", "import { Button, IconChevronLeft, IconSharePreview, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Experiment, useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { getGlobalPreviewHandlers } from \"document/preview/globalPreviewHandlers.ts\"\nimport { togglePreviewNodeResponsive } from \"document/preview/togglePreviewNodeResponsive.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport React from \"react\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { rotateElement } from \"../shared/utils/rotateElement.ts\"\nimport { ModeToggle } from \"./ModeToggle.tsx\"\nimport { centerBar, previewBackButton, previewBackButtonIcon } from \"./ProjectBar.styles.ts\"\nimport { ToolbarItem } from \"./ToolbarItem.tsx\"\nimport { SitesToolbarResizeInputs } from \"./ToolbarResizeInputs.tsx\"\nimport { getToolbarIconSet } from \"./icons/toolbarIconSet.ts\"\n\nexport function PreviewToolbar() {\n\tconst { fullsizePreviewStore, previewStore } = engine.stores\n\tconst { resizablePreviewSize } = fullsizePreviewStore.useState()\n\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst toolbarIconSet = getToolbarIconSet(agentExperimentEnabled)\n\n\tconst { isResponsive, canChangeResponsive } = previewStore.useState(state => ({\n\t\tisResponsive: Boolean(state.metadata.isResponsive),\n\t\tcanChangeResponsive: Boolean(state.metadata.canChangeResponsive),\n\t}))\n\n\tconst reloadIconRef = React.useRef<SVGSVGElement>(null)\n\tconst ReloadIcon = toolbarIconSet.reload\n\n\tconst handleReload = React.useCallback(() => {\n\t\tgetGlobalPreviewHandlers().reload()\n\t\tconst reloadIcon = reloadIconRef.current\n\t\tif (reloadIcon) rotateElement(reloadIcon)\n\t}, [])\n\n\tconst handleResponsive = React.useCallback(() => togglePreviewNodeResponsive(engine), [])\n\n\tconst handleTogglePreviewUI = React.useCallback(\n\t\t() => fullsizePreviewStore.togglePreviewUIVisible(),\n\t\t[fullsizePreviewStore],\n\t)\n\tconst handleBack = React.useCallback(() => togglePreviewVisible(engine, { source: \"project_bar\" }), [])\n\n\tconst handleShare = React.useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.preview,\n\t\t\tid: UIInteraction.sharePreviewLink,\n\t\t})\n\t\tconst url = new URL(window.location.href)\n\t\turl.searchParams.set(\"view\", \"preview\")\n\t\turl.searchParams.set(\"fullscreen\", \"true\")\n\t\tvoid navigator.clipboard.writeText(url.href)\n\t}, [])\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"flex-start\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tgap={10}\n\t\t\t>\n\t\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t\t<Button variant=\"withDepth\" title=\"Back\" onClick={handleBack} className={previewBackButton}>\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"center\" gap={8}>\n\t\t\t\t\t\t\t<span className={previewBackButtonIcon}>\n\t\t\t\t\t\t\t\t<IconChevronLeft />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span>Back</span>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Button>\n\t\t\t\t</Experiment>\n\t\t\t\t<Stack direction=\"row\" justifyContent=\"flex-start\" alignItems=\"center\" gap={5}>\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\ttitle=\"Reload\"\n\t\t\t\t\t\ticon={<ReloadIcon ref={reloadIconRef} />}\n\t\t\t\t\t\tselected={false}\n\t\t\t\t\t\tonClick={handleReload}\n\t\t\t\t\t\tenabled\n\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\ttitle=\"Fullscreen\"\n\t\t\t\t\t\ticon={toolbarIconSet.fullscreen}\n\t\t\t\t\t\tselected={false}\n\t\t\t\t\t\tonClick={handleTogglePreviewUI}\n\t\t\t\t\t\tenabled={isResponsive}\n\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t/>\n\t\t\t\t\t<Experiment isOn=\"previewSharing\">\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttitle=\"Share\"\n\t\t\t\t\t\t\ticon={<IconSharePreview />}\n\t\t\t\t\t\t\tselected={false}\n\t\t\t\t\t\t\tonClick={handleShare}\n\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Experiment>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\" className={centerBar}>\n\t\t\t\t<Stack direction=\"row\" gap={10} justifyContent=\"center\" alignItems=\"center\" style={{ pointerEvents: \"auto\" }}>\n\t\t\t\t\t<SitesToolbarResizeInputs resizablePreviewSize={resizablePreviewSize} enabled={isResponsive} />\n\t\t\t\t\t{canChangeResponsive && <ModeToggle isResponsive={isResponsive} onHandleResponsive={handleResponsive} />}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport React from \"react\"\nimport * as styles from \"./ModeToggle.styles.ts\"\n\ninterface Props {\n\tisResponsive: boolean\n\tonHandleResponsive: () => void\n}\nexport const ModeToggle = React.memo(function ModeToggle({ isResponsive, onHandleResponsive }: Props) {\n\treturn (\n\t\t<SegmentedControl showSelectionWhenDisabled animateOnPropChange className={styles.segmentedControl} unsaturated>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier\n\t\t\t\tkey=\"responsive\"\n\t\t\t\ttitle=\"Stretch\"\n\t\t\t\tselected={isResponsive === true}\n\t\t\t\tonSelect={onHandleResponsive}\n\t\t\t/>\n\t\t\t<SegmentedControlItem\n\t\t\t\tidentifier={false}\n\t\t\t\tkey=\"scale-to-fit\"\n\t\t\t\ttitle=\"Scale\"\n\t\t\t\tselected={isResponsive === false}\n\t\t\t\tonSelect={onHandleResponsive}\n\t\t\t/>\n\t\t</SegmentedControl>\n\t)\n})\n", "import \"ModeToggle.styles_ry2dg.wyw.css\"; export const segmentedControl = \"segmentedControl_s3iy7gt\";", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getFullsizePreviewMaxWidth } from \"document/components/chrome/preview/fullsizePreviewLayoutHelpers.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Breakpoints } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport type { IsBreakpoint, IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { PreviewItem } from \"document/preview/PreviewItem.ts\"\nimport { entryNodeForNodeToRender } from \"preview-module/utils/entryNodeForNodeToRender.ts\"\nimport { findActiveBreakpointId } from \"utils/getActiveBreakpoint.ts\"\n\nexport const clampWithFallback = (n: number | undefined, max: number): number => Math.min(max, n ?? max)\n\ntype PreviewBreakpointNode = CanvasNode & WithSize & IsVariant & IsBreakpoint\n\nexport function getNextBreakpoint(\n\tbreakpoints: Breakpoints,\n\tactiveBreakpointNode: PreviewBreakpointNode | null,\n\tindex: -1 | 1,\n): PreviewBreakpointNode | null {\n\tif (!activeBreakpointNode || !activeBreakpointNode.id || !breakpoints) return null\n\tconst breakpointIds = Object.keys(breakpoints)\n\tconst currentIndex = breakpointIds.indexOf(activeBreakpointNode.id)\n\tif (currentIndex === -1) return null\n\n\tconst nextIndex = currentIndex + index\n\tconst nextBreakpointId = breakpointIds[nextIndex]\n\tif (!nextBreakpointId) return null\n\treturn getBreakpointNode(nextBreakpointId)\n}\n\nexport function getBreakpointNode(breakpointId: string): PreviewBreakpointNode | null {\n\tconst breakpointNode = engine.tree.getNode(breakpointId)\n\treturn isBreakpointVariant(breakpointNode) && withSize(breakpointNode) ? breakpointNode : null\n}\n\nexport function getPreviewBreakpoints(previewItem: PreviewItem | undefined): Breakpoints | undefined {\n\tif (!previewItem || previewItem.type !== \"node\") return undefined\n\n\tconst node = engine.tree.get(previewItem.nodeId)\n\tif (!node) return undefined\n\n\tconst entryNodeInfo = entryNodeForNodeToRender(node, engine.tree)\n\tconst entryScopeNode = entryNodeInfo.entryScopeNode\n\tif (!entryScopeNode) return undefined\n\n\tif (!isWebPageNode(entryScopeNode) || !entryScopeNode.isLoaded()) return undefined\n\treturn entryScopeNode.getBreakpointValues()\n}\n\n/**\n * Change the breakpoint of the active scope to the next or previous breakpoint.\n *\n * @param vekterEngine The VekterEngine instance\n * @param direction -1 for previous, 1 for next\n */\nexport function switchPreviewBreakpoint(vekterEngine: VekterEngine, direction: -1 | 1): void {\n\tconst maxWidth = getFullsizePreviewMaxWidth()\n\tconst { previewStore, fullsizePreviewStore } = vekterEngine.stores\n\tconst resizablePreviewSize = fullsizePreviewStore.resizablePreviewSize\n\tconst width = clampWithFallback(resizablePreviewSize?.width, maxWidth)\n\n\tconst breakpoints = getPreviewBreakpoints(previewStore.item)\n\tif (!breakpoints) return\n\n\tconst activeBreakpointId = findActiveBreakpointId(breakpoints, width)\n\tif (!activeBreakpointId) return\n\tconst activeBreakpointNode = getBreakpointNode(activeBreakpointId)\n\n\tconst newBreakpoint = getNextBreakpoint(breakpoints, activeBreakpointNode, direction)\n\tif (!newBreakpoint) return\n\n\tfullsizePreviewStore.updatePreviewWidthWithBreakpoint(newBreakpoint)\n}\n\nexport function getActiveBreakpointNode(\n\tbreakpoints: Breakpoints | undefined,\n\twidth: number,\n): PreviewBreakpointNode | null {\n\tconst activeBreakpointId = findActiveBreakpointId(breakpoints, width)\n\tif (!activeBreakpointId) return null\n\treturn getBreakpointNode(activeBreakpointId)\n}\n", "import { NumberInputWithTicker, PopupButtonMenu } from \"@framerjs/fresco\"\nimport { appAccelerators } from \"app/AppAccelerators.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Breakpoints } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport type { ResizablePreviewSize } from \"document/stores/FullsizePreviewStore.ts\"\nimport {\n\tclampWithFallback,\n\tgetActiveBreakpointNode,\n\tgetBreakpointNode,\n\tgetNextBreakpoint,\n\tgetPreviewBreakpoints,\n\tswitchPreviewBreakpoint,\n} from \"document/utils/breakpointPreview.ts\"\nimport React from \"react\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport {\n\tgetFullsizePreviewMaxHeight,\n\tgetFullsizePreviewMaxWidth,\n\tgetNewAllowedPreviewSize,\n\tminHeightPreview,\n\tminWidthPreview,\n} from \"../preview/fullsizePreviewLayoutHelpers.ts\"\nimport * as styles from \"./ToolbarResizeInputs.styles.ts\"\n\ninterface Props {\n\tresizablePreviewSize?: ResizablePreviewSize\n\tenabled?: boolean\n}\n\nconst fallbackName = \"Custom\"\n\nexport function SitesToolbarResizeInputs({ resizablePreviewSize, enabled = true }: Props) {\n\tconst maxWidth = getFullsizePreviewMaxWidth()\n\tconst maxHeight = getFullsizePreviewMaxHeight()\n\tconst width = clampWithFallback(resizablePreviewSize?.width, maxWidth)\n\tconst height = clampWithFallback(resizablePreviewSize?.height, maxHeight)\n\tconst { fullsizePreviewStore, previewStore } = engine.stores\n\tconst previewItem = previewStore.useState(state => state.item)\n\n\tconst breakpoints = React.useMemo(() => getPreviewBreakpoints(previewItem), [previewItem])\n\tconst anyBreakpoints = breakpoints ? Object.keys(breakpoints).length > 0 : false\n\n\tconst handleSetNewWidth = engine.scheduler.wrapHandler((value: number, _: string | undefined, reset: () => void) => {\n\t\tif (!resizablePreviewSize) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\t\tconst newWidth = getNewAllowedPreviewSize(value, maxWidth, minWidthPreview)\n\t\tif (newWidth === resizablePreviewSize.width) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\t\tfullsizePreviewStore.resizablePreviewSize = { ...resizablePreviewSize, width: newWidth }\n\t})\n\n\tconst handleSetNewHeight = engine.scheduler.wrapHandler((value: number, _: string | undefined, reset: () => void) => {\n\t\tif (!resizablePreviewSize) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\t\tconst newHeight = getNewAllowedPreviewSize(value, maxHeight, minHeightPreview)\n\t\tif (newHeight === resizablePreviewSize.height) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\t\tfullsizePreviewStore.resizablePreviewSize = { ...resizablePreviewSize, height: newHeight }\n\t})\n\n\treturn (\n\t\t<div className={styles.inputsGrid}>\n\t\t\t{anyBreakpoints && (\n\t\t\t\t<PopupButtonMenu\n\t\t\t\t\ttitle={getActiveBreakpointNode(breakpoints, width)?.resolveValue(\"name\") ?? fallbackName}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tonShowMenu={event => showMenuItems(event, breakpoints, width, maxWidth)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<NumberInputWithTicker value={width.toString()} onChange={handleSetNewWidth} enabled={enabled} labelShort=\"W\" />\n\t\t\t<NumberInputWithTicker value={height.toString()} onChange={handleSetNewHeight} enabled={enabled} labelShort=\"H\" />\n\t\t</div>\n\t)\n}\n\nfunction showMenuItems(\n\tevent: React.SyntheticEvent<HTMLButtonElement>,\n\tbreakpoints: Breakpoints | undefined,\n\twidth: number,\n\tmaxWidth: number,\n) {\n\tif (isUndefined(breakpoints)) return\n\tconst activeBreakpointNode = getActiveBreakpointNode(breakpoints, width)\n\tconst breakpointOptions: MenuItemOptions[] = []\n\n\tfor (const breakpointId in breakpoints) {\n\t\tconst breakpointNode = getBreakpointNode(breakpointId)\n\t\tconst name = breakpointNode?.resolveValue(\"name\")\n\t\tif (!breakpointNode || isNull(name)) continue\n\n\t\tbreakpointOptions.push({\n\t\t\tlabel: name,\n\t\t\tchecked: activeBreakpointNode?.id === breakpointId,\n\t\t\tenabled: maxWidth >= breakpointNode.width,\n\t\t\tclick: () => engine.stores.fullsizePreviewStore.updatePreviewWidthWithBreakpoint(breakpointNode),\n\t\t})\n\t}\n\n\tconst nextBreakpoint = getNextBreakpoint(breakpoints, activeBreakpointNode, 1)\n\tconst prevBreakpoint = getNextBreakpoint(breakpoints, activeBreakpointNode, -1)\n\n\tconst menuItems: MenuItemOptions[] = breakpointOptions.concat([\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: \"Next\",\n\t\t\tenabled: !!nextBreakpoint && nextBreakpoint.width <= maxWidth,\n\t\t\taccelerator: appAccelerators.previewNextBreakpoint,\n\t\t\tclick: () => switchPreviewBreakpoint(engine, 1),\n\t\t},\n\t\t{\n\t\t\tlabel: \"Previous\",\n\t\t\tenabled: !!prevBreakpoint && prevBreakpoint.width <= maxWidth,\n\t\t\taccelerator: appAccelerators.previewPreviousBreakpoint,\n\t\t\tclick: () => switchPreviewBreakpoint(engine, -1),\n\t\t},\n\t])\n\n\tconst bounds = event.currentTarget.getBoundingClientRect()\n\tconst point = { x: bounds.left, y: bounds.bottom + 10 }\n\tengine.stores.contextMenuStore.show(menuItems, { location: point })\n}\n", "import \"ToolbarResizeInputs.styles_vzpenp.wyw.css\"; export const inputsGrid = \"inputsGrid_imxswdu\";", "import engine from \"document/engine.ts\"\nimport { isKitPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport React from \"react\"\nimport { KitProjectBarTitle } from \"./KitProjectBarTitle.tsx\"\nimport { RegularProjectBarTitle } from \"./RegularProjectBarTitle.tsx\"\n\ninterface Props {\n\ttitle: string\n}\n\nexport const ProjectBarTitle = React.memo(function ProjectBarTitle({ title }: Props) {\n\tconst { scopeStore } = engine.stores\n\tconst activeScope = scopeStore.useState(state => state.active)\n\tconst isKitPage = isKitPageNode(activeScope)\n\n\treturn isKitPage ? <KitProjectBarTitle /> : <RegularProjectBarTitle title={title} />\n})\n", "import { IconKitPage, Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport * as styles from \"./KitProjectBarTitle.styles.ts\"\nimport { KitProjectPopover } from \"./KitProjectPopover.tsx\"\nimport { ProjectBarTitleLayout } from \"./ProjectBarTitleLayout.tsx\"\nimport { useKitManifest } from \"./useKitManifest.ts\"\n\nexport const KitProjectBarTitle = React.memo(function KitProjectBarTitle() {\n\tconst { kitManifest } = useKitManifest()\n\n\treturn (\n\t\t<ProjectBarTitleLayout popoverContent={<KitProjectPopover />}>\n\t\t\t{({ clickHandlers, ref }) => (\n\t\t\t\t<Stack\n\t\t\t\t\tref={ref as unknown as React.RefObject<HTMLDivElement>}\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tgap={8}\n\t\t\t\t\tpadding={8}\n\t\t\t\t\tclassName={cx(styles.kitBadgeContainer)}\n\t\t\t\t\t{...clickHandlers}\n\t\t\t\t>\n\t\t\t\t\t<IconKitPage />\n\t\t\t\t\t<span className={cx(styles.kitBadgeTitle)}>{kitManifest.title}</span>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</ProjectBarTitleLayout>\n\t)\n})\n", "import \"KitProjectBarTitle.styles_95m60y.wyw.css\"; export const kitBadgeContainer = \"kitBadgeContainer_k1pv9ppi\";\nexport const kitBadgeTitle = \"kitBadgeTitle_k1ha5rs9\";", "import { Button, Spinner, Stack, TextArea } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { ModuleType } from \"@framerjs/shared\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport engine from \"document/engine.ts\"\nimport { kitModuleName } from \"modules/ModulesStorage.ts\"\nimport { startTransition, useCallback, useMemo } from \"react\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { copyAIKitRemixLink } from \"web/lib/copyRemixLink.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { ButtonWithPreview } from \"../../shared/ButtonWithPreview.tsx\"\nimport { PopoutButtonBackgroundPreview } from \"../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { TextInputWithEmoji } from \"../../shared/TextInputWithEmoji.tsx\"\nimport * as styles from \"./KitProjectPopover.styles.ts\"\nimport { useKitIconUpload } from \"./useKitIconUpload.tsx\"\nimport { useKitManifest } from \"./useKitManifest.ts\"\nimport { useKitPublishing } from \"./useKitPublishing.ts\"\n\nexport function KitProjectPopover() {\n\tconst { kitManifest, updateKitManifest } = useKitManifest()\n\n\tconst { isPublishing, publishLabel, canPublish, lastVersion, publishKit } = useKitPublishing()\n\n\tconst hasIcon = Boolean(kitManifest?.icon)\n\n\tconst handleUpdateIcon = useCallback(\n\t\t(newIcon: string | undefined) => {\n\t\t\tif (!canPublish) return\n\n\t\t\tstartTransition(() => updateKitManifest({ icon: newIcon }))\n\t\t},\n\t\t[updateKitManifest, canPublish],\n\t)\n\n\tconst { onUpload, onDelete } = useKitIconUpload(canPublish, handleUpdateIcon)\n\n\tconst handleTitleChange = useCallback(\n\t\t(value: string, final: boolean, reset: () => void) => {\n\t\t\tif (!canPublish) return\n\t\t\tif (!final) return\n\t\t\tif (!value.trim()) {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tstartTransition(() => updateKitManifest({ title: value }))\n\t\t},\n\t\t[updateKitManifest, canPublish],\n\t)\n\n\tconst handlePromptChange = useCallback(\n\t\t(value: string) => {\n\t\t\tif (!canPublish) return\n\n\t\t\tstartTransition(() => updateKitManifest({ prompt: value }))\n\t\t},\n\t\t[updateKitManifest, canPublish],\n\t)\n\n\tconst handleCopyLink = useCallback(() => {\n\t\tconst kitModuleHandle = engine.stores.modulesStore.forType(ModuleType.Kit).getByStableName(kitModuleName)\n\t\tcopyAIKitRemixLink(kitModuleHandle.id)\n\t}, [])\n\n\tconst versionBadge = useMemo(() => {\n\t\tif (!lastVersion) return \"Draft\"\n\n\t\treturn `V${lastVersion}`\n\t}, [lastVersion])\n\n\treturn (\n\t\t<Stack gap={0} className={styles.container}>\n\t\t\t<div className={styles.titleContainer}>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={5}>\n\t\t\t\t\t<span className={styles.title}>{kitManifest.title}</span>\n\t\t\t\t\t<span className={styles.versionBadge}>{versionBadge}</span>\n\t\t\t\t</Stack>\n\t\t\t</div>\n\n\t\t\t<Stack gap={5} className={styles.contentContainer}>\n\t\t\t\t<Stack gap={0}>\n\t\t\t\t\t<PanelRow title=\"Name\">\n\t\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t\t<TextInputWithEmoji\n\t\t\t\t\t\t\t\tvalue={kitManifest?.title || \"\"}\n\t\t\t\t\t\t\t\tonChange={handleTitleChange}\n\t\t\t\t\t\t\t\tplaceholder=\"My Kit\"\n\t\t\t\t\t\t\t\tenabled={canPublish}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Icon\">\n\t\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t\t<ButtonWithPreview\n\t\t\t\t\t\t\t\ttitle={hasIcon ? \"Image\" : \"Upload\u2026\"}\n\t\t\t\t\t\t\t\ttitleColor={hasIcon ? undefined : colors.inputLabel}\n\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\thasIcon && kitManifest.icon ? (\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\tsrc={resolveImage(kitManifest.icon)}\n\t\t\t\t\t\t\t\t\t\t\talt=\"Kit icon\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\twidth: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t\theight: \"100%\",\n\t\t\t\t\t\t\t\t\t\t\t\tobjectFit: \"cover\",\n\t\t\t\t\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<PopoutButtonBackgroundPreview\n\t\t\t\t\t\t\t\t\t\t\tbackground={colors.popoverBackground}\n\t\t\t\t\t\t\t\t\t\t\tborderColor={colors.colorIconBorder}\n\t\t\t\t\t\t\t\t\t\t/>\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\tonPresent={onUpload}\n\t\t\t\t\t\t\t\tonDelete={hasIcon ? onDelete : undefined}\n\t\t\t\t\t\t\t\tenabled={canPublish}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Prompt\">\n\t\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t\t<TextArea\n\t\t\t\t\t\t\t\tvalue={kitManifest?.prompt || \"\"}\n\t\t\t\t\t\t\t\tplaceholder=\"Prompt\u2026\"\n\t\t\t\t\t\t\t\tonChange={handlePromptChange}\n\t\t\t\t\t\t\t\tenabled={canPublish}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={styles.buttons}\n\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\tenabled={!isPublishing && !isNull(lastVersion)}\n\t\t\t\t\t\tonClick={handleCopyLink}\n\t\t\t\t\t>\n\t\t\t\t\t\tCopy Link\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={styles.buttons}\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tenabled={canPublish && !isPublishing}\n\t\t\t\t\t\tonClick={publishKit}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isPublishing ? <Spinner /> : publishLabel}\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { InputWrapper, TextInput, emoji, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport * as styles from \"./TextInputWithEmoji.styles.ts\"\n\ntype Props = React.ComponentPropsWithoutRef<typeof TextInput> & {\n\tinputWrapperClassName?: string\n\tlarge?: boolean\n\tonEscape?: (event: React.KeyboardEvent) => void\n}\n\nexport function TextInputWithEmoji({ className, ...props }: Props) {\n\tconst [isEditing, setIsEditing] = React.useState(false)\n\tconst [emojiURL, textSansEmoji] = emoji.extract(props.value)\n\tconst { inputWrapperClassName, onEscape, ...rest } = props\n\n\tconst onFocus = () => {\n\t\tif (isEditing) return\n\t\tsetIsEditing(true)\n\t}\n\n\tconst onBlur = () => {\n\t\tsetIsEditing(false)\n\t}\n\n\tconst handleKeyDown = (event: React.KeyboardEvent) => {\n\t\tevent.stopPropagation()\n\n\t\tif (event.key === \"Escape\") onEscape?.(event)\n\t}\n\n\treturn (\n\t\t<InputWrapper\n\t\t\tlarge={props.large}\n\t\t\tclassName={cx(styles.inputWrapper, props.large && styles.inputWrapperLarge, inputWrapperClassName, className)}\n\t\t>\n\t\t\t{emojiURL && (\n\t\t\t\t<div className={truncateWithEllipsis} style={{ display: isEditing ? \"none\" : \"flex\" }}>\n\t\t\t\t\t<img src={emojiURL} alt=\"\" crossOrigin=\"anonymous\" decoding=\"async\" />\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t<TextInput\n\t\t\t\t{...rest}\n\t\t\t\tvalue={isEditing ? props.value : textSansEmoji}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\tonBlur={onBlur}\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\tstyle={{ paddingLeft: 0 }}\n\t\t\t/>\n\t\t</InputWrapper>\n\t)\n}\n", "import \"TextInputWithEmoji.styles_1j02u7l.wyw.css\"; export const inputWrapper = \"inputWrapper_ixo8rkm\";\nexport const inputWrapperLarge = \"inputWrapperLarge_i10ofcho\";", "import \"KitProjectPopover.styles_5ji57f.wyw.css\"; export const container = \"container_c1vuhrvg\";\nexport const titleContainer = \"titleContainer_t1uoqgig\";\nexport const title = \"title_t178xljx\";\nexport const versionBadge = \"versionBadge_v1c9dyjr\";\nexport const contentContainer = \"contentContainer_ch8hmbz\";\nexport const buttons = \"buttons_b6fy6uy\";", "import { unhandledError } from \"@framerjs/shared\"\nimport { createAssetReferenceForUploadImageResult } from \"document/utils/createAssetReferenceFromImageUpload.ts\"\nimport React from \"react\"\nimport { chooseFileService } from \"web/pages/project/lib/ChooseFileService.ts\"\nimport type { ImageUploadResult } from \"web/pages/project/lib/UploadService.ts\"\n\ntype UploadIconHandler = (icon: string | undefined) => void\n\nexport function useKitIconUpload(\n\tenabled: boolean | undefined,\n\tonUpload: UploadIconHandler,\n\tallowedFileTypes?: string[],\n): {\n\tonUpload: () => Promise<void>\n\tchooseImages: (images?: FileList | File[]) => Promise<void>\n\tonDelete: () => void\n} {\n\tconst chooseImages = React.useCallback(\n\t\tasync (images?: FileList | File[]) => {\n\t\t\tif (!enabled) return\n\t\t\ttry {\n\t\t\t\tconst uploadedImages: ImageUploadResult[] = images\n\t\t\t\t\t? await chooseFileService.addImages(images)\n\t\t\t\t\t: await chooseFileService.pickAndUploadImage({ allowedFileTypes })\n\n\t\t\t\tif (uploadedImages.length === 0) return\n\n\t\t\t\tconst uploadedImage = uploadedImages[0]\n\t\t\t\tif (!uploadedImage) return\n\t\t\t\tconst assetReference = createAssetReferenceForUploadImageResult(uploadedImage)\n\t\t\t\tonUpload(assetReference)\n\t\t\t} catch (error) {\n\t\t\t\tunhandledError(`Failed to upload kit icon: ${error}`)\n\t\t\t}\n\t\t},\n\t\t[allowedFileTypes, enabled, onUpload],\n\t)\n\n\tconst onUploadClick = React.useCallback(async () => {\n\t\tawait chooseImages()\n\t}, [chooseImages])\n\n\tconst onDelete = React.useCallback(() => {\n\t\tonUpload(undefined)\n\t}, [onUpload])\n\n\treturn {\n\t\tonUpload: onUploadClick,\n\t\tchooseImages,\n\t\tonDelete,\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { KitManifest } from \"document/models/CanvasTree/traits/WithKitManifest.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\n\ninterface UseKitManifestResult {\n\tkitManifest: KitManifest\n\tupdateKitManifest: (updates: Partial<KitManifest>) => void\n}\n\nexport function useKitManifest(): UseKitManifestResult {\n\tconst isKitProject = experiments.isOn(\"wireframerKits\") && projectFeatures.isOn(\"kit\")\n\n\tconst kitManifest = useEngineState(\n\t\t() => (isKitProject ? engine.tree.root.kitManifest : undefined),\n\t\t[],\n\t\tEngineChange.Tree,\n\t)\n\n\tassert(kitManifest, \"Kit manifest must be defined\")\n\n\tconst updateKitManifest = React.useCallback(\n\t\t(updates: Partial<KitManifest>) => {\n\t\t\tif (!kitManifest) return\n\n\t\t\tengine.scheduler.process(() => {\n\t\t\t\tconst lastKitManifest = engine.tree.root.kitManifest\n\t\t\t\tassert(lastKitManifest, \"Kit manifest must be defined\")\n\t\t\t\tengine.tree.root.set({ kitManifest: { ...lastKitManifest, ...updates } })\n\t\t\t})\n\t\t},\n\t\t[kitManifest],\n\t)\n\n\treturn {\n\t\tkitManifest,\n\t\tupdateKitManifest,\n\t}\n}\n", "import { ModuleType } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { kitModuleName } from \"modules/ModulesStorage.ts\"\nimport { useCallback, useMemo, useState } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\n\ninterface UseKitPublishingResult {\n\tisPublishing: boolean\n\tpublishLabel: string\n\tcanPublish: boolean\n\tlastVersion: string | null\n\tpublishKit: () => Promise<void>\n}\n\nexport function useKitPublishing(): UseKitPublishingResult {\n\tconst [isPublishing, setIsPublishing] = useState(false)\n\n\tconst isViewOnly = useIsViewOnly(\"canPublish\")\n\n\tconst teamLibraryId = useEngineState(() => engine.stores.libraryStore.teamLibrary?.id, [], engine.stores.libraryStore)\n\n\t// This is fine to memo with empty dependencies because the kit module handle is not going to change for the kit\n\t// module.\n\tconst kitModuleHandle = useMemo(\n\t\t() => engine.stores.modulesStore.forType(ModuleType.Kit).getByStableName(kitModuleName),\n\t\t[],\n\t)\n\n\tconst lastPublish = useEngineState(\n\t\t() => engine.stores.modulesStore.getPersistedModuleByLocalId(kitModuleHandle.localId)?.lastPublish ?? null,\n\t\t[kitModuleHandle.localId],\n\t\tengine.stores.modulesStore,\n\t)\n\n\t// Only users in a team can publish kit modules for the first time.\n\tconst canPublish = !isViewOnly && (!!teamLibraryId || !!lastPublish)\n\n\tconst publishLabel = lastPublish ? Dictionary.Update : Dictionary.Publish\n\n\tconst publishKit = useCallback(async () => {\n\t\tif (!canPublish) return\n\n\t\ttry {\n\t\t\tsetIsPublishing(true)\n\n\t\t\tawait engine.stores.aiGenerationStore.publishLocalKit(engine)\n\t\t} catch (err) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\ttext: err instanceof Error ? err.message : \"Failed to publish kit\",\n\t\t\t\ticon: \"error\",\n\t\t\t})\n\t\t} finally {\n\t\t\tsetIsPublishing(false)\n\t\t}\n\t}, [canPublish])\n\n\treturn {\n\t\tcanPublish,\n\t\tpublishLabel,\n\t\tisPublishing,\n\t\tpublishKit,\n\t\tlastVersion: lastPublish?.version ?? null,\n\t}\n}\n", "import type { ClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport React from \"react\"\nimport { ProjectBarPopover } from \"./ProjectBarPopover.tsx\"\nimport * as styles from \"./ProjectBarTitle.styles.ts\"\nimport { useProjectBarPopover } from \"./shared.ts\"\n\ninterface Props {\n\tchildren: (props: { clickHandlers: ClickHandlers; ref: React.RefObject<HTMLButtonElement> }) => React.ReactNode\n\tpopoverContent: React.ReactNode\n}\n\n/**\n * Shared layout component for project bar titles.\n * Handles the common centerContent wrapper and popover logic.\n */\nexport const ProjectBarTitleLayout = React.memo(\n\tReact.forwardRef<HTMLDivElement, Props>(function ProjectBarTitleLayout({ children, popoverContent }, forwardedRef) {\n\t\tconst anchorRef = React.useRef<HTMLDivElement | null>(null)\n\t\tconst { isPopoverOpen, clickHandlers, ref } = useProjectBarPopover()\n\n\t\tconst setAnchorRef = React.useCallback(\n\t\t\t(node: HTMLDivElement | null) => {\n\t\t\t\tanchorRef.current = node\n\n\t\t\t\tif (typeof forwardedRef === \"function\") {\n\t\t\t\t\tforwardedRef(node)\n\t\t\t\t} else if (forwardedRef) {\n\t\t\t\t\tforwardedRef.current = node\n\t\t\t\t}\n\t\t\t},\n\t\t\t[forwardedRef],\n\t\t)\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div ref={setAnchorRef} className={styles.centerContent}>\n\t\t\t\t\t{children({ clickHandlers, ref })}\n\t\t\t\t</div>\n\n\t\t\t\t<ProjectBarPopover isOpen={isPopoverOpen} anchor={anchorRef.current}>\n\t\t\t\t\t{popoverContent}\n\t\t\t\t</ProjectBarPopover>\n\t\t\t</>\n\t\t)\n\t}),\n)\n", "import \"ProjectBar.styles_bfm43t.wyw.css\"; export const projectBar = \"projectBar_plqvl4o\";\nexport const popover = \"popover_pj7opby\";", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport engine from \"document/engine.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport { useCallback, useRef } from \"react\"\n\n/**\n * Shared hook for project bar popover logic\n */\nexport function useProjectBarPopover() {\n\tconst { popoverStore } = engine.stores\n\tconst ref = useRef<HTMLButtonElement>(null)\n\n\tconst isPopoverOpen = popoverStore.useState(state => state.active === PopoverType.Project)\n\n\tconst togglePopover = useCallback(() => {\n\t\tif (popoverStore.active === PopoverType.Project) {\n\t\t\tpopoverStore.active = PopoverType.None\n\t\t} else {\n\t\t\tpopoverStore.active = PopoverType.Project\n\t\t}\n\t}, [popoverStore])\n\n\tconst clickHandlers = useClickHandlers(togglePopover)\n\n\treturn {\n\t\tisPopoverOpen,\n\t\tclickHandlers,\n\t\tref,\n\t}\n}\n\n/**\n * Close popover utility\n */\nexport const closePopover = () => (engine.stores.popoverStore.active = PopoverType.None)\n", "import { Popover } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type React from \"react\"\nimport * as projectBarStyles from \"web/pages/project/components/ProjectBar.styles.ts\"\nimport { usePopoverWithinPadding } from \"../../utils/usePopoverWithinPadding.ts\"\nimport { closePopover } from \"./shared.ts\"\n\ninterface Props {\n\tisOpen: boolean\n\tanchor: HTMLElement | null\n\tchildren: React.ReactNode\n}\n\nexport function ProjectBarPopover({ isOpen, anchor, children }: Props) {\n\tconst webBarHeight = useDimensionValue(\"webBarHeight\")\n\n\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst popoverWithinPadding = usePopoverWithinPadding()\n\n\tif (!isOpen || !anchor) return null\n\n\tconst popoverOffset = { x: 0, y: 0 }\n\tconst popoverTop = webBarHeight + dimensions.values.popoverOffsetY\n\n\treturn (\n\t\t<Popover\n\t\t\tclassName={projectBarStyles.popover}\n\t\t\tanchor={anchor}\n\t\t\talignSelf=\"center\"\n\t\t\tattachTo=\"bottom\"\n\t\t\twithin={{ ...popoverWithinPadding, top: popoverTop }}\n\t\t\toffset={popoverOffset}\n\t\t\tonClose={closePopover}\n\t\t\tthemeBehavior={agentExperimentOn ? \"none\" : \"auto\"}\n\t\t>\n\t\t\t{children}\n\t\t</Popover>\n\t)\n}\n", "import \"ProjectBarTitle.styles_1ifncs7.wyw.css\"; export const centerContent = \"centerContent_cuh4ris\";\nexport const title = \"title_td2l6rg\";\nexport const measuringOverflow = \"measuringOverflow_m1l1iw4e\";\nexport const titleCanShrink = \"titleCanShrink_t111k3cd\";\nexport const rowTitle = \"rowTitle_r1x7wnqu\";\nexport const rowControl = \"rowControl_radnfxq\";\nexport const hostname = \"hostname_h142qubs\";\nexport const popover = \"popover_p1d0hqcf\";\nexport const popoverRow = \"popoverRow_p1war2c2\";\nexport const versionHistoryName = \"versionHistoryName_vhcenue\";", "import type { CustomHostname, DefaultHostname } from \"@framerjs/app-shared\"\nimport { openNewTab } from \"@framerjs/app-shared\"\nimport type { BranchHostname } from \"@framerjs/app-shared/src/Deployments.ts\"\nimport { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Stack, T, emoji, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useCallback } from \"react\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport { UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useDisplayUrlWithLink } from \"../../../utils/useDisplayUrlWithLink.ts\"\nimport { ProjectLocationButton } from \"../../siteSettings/Project/ProjectLocationButton.tsx\"\nimport { ProjectTitleInput } from \"../../siteSettings/Project/ProjectTitleInput.tsx\"\nimport { ProjectBarBadge } from \"./ProjectBarBadge.tsx\"\nimport { ProjectBarBranch } from \"./ProjectBarBranch.tsx\"\nimport * as styles from \"./ProjectBarTitle.styles.ts\"\nimport { ProjectBarTitleLayout } from \"./ProjectBarTitleLayout.tsx\"\nimport { closePopover } from \"./shared.ts\"\n\ninterface Props {\n\ttitle: string\n}\n\ninterface CommonPublishedState {\n\tpublishedOrPublishingUpdates: boolean\n}\n\ninterface PublishedStateWithHostname {\n\thostname: CustomHostname | DefaultHostname | BranchHostname\n\turl: string\n}\n\ninterface PublishedStateWithoutHostname {\n\thostname: undefined\n\turl: undefined\n}\n\ntype PublishedState = CommonPublishedState & (PublishedStateWithHostname | PublishedStateWithoutHostname)\n\nfunction usePublishedState(): PublishedState {\n\tconst { publishStore, treeStore } = engine.stores\n\tconst previouslyPublishedRef = React.useRef<boolean>(false)\n\tconst { customHostname, defaultHostname, branchHostname } = publishStore.useState()\n\tconst onMainBranch = treeStore.isOnMainBranch()\n\tconst hostname = onMainBranch ? (customHostname ?? defaultHostname) : branchHostname\n\n\tconst { displayUrl, linkUrl } = useDisplayUrlWithLink({ hostname, linkToActivePage: true })\n\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst { publishStatus } = publishStore\n\t\t\tif (publishStatus === PublishStatus.Unpublished) {\n\t\t\t\tpreviouslyPublishedRef.current = false\n\t\t\t} else if (publishStatus === PublishStatus.Published) {\n\t\t\t\tpreviouslyPublishedRef.current = true\n\t\t\t}\n\n\t\t\tif (hostname && displayUrl && linkUrl) {\n\t\t\t\tconst displayHostname = { ...hostname, hostname: displayUrl }\n\t\t\t\treturn {\n\t\t\t\t\tpublishedOrPublishingUpdates: previouslyPublishedRef.current,\n\t\t\t\t\thostname: displayHostname,\n\t\t\t\t\turl: linkUrl,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn { publishedOrPublishingUpdates: previouslyPublishedRef.current }\n\t\t\t}\n\t\t},\n\t\t[displayUrl, linkUrl, hostname],\n\t\t[publishStore, EngineChange.Tree],\n\t\t{ deepEqual: true }, // displayHostname is nested\n\t)\n}\n\nfunction RegularProjectPopover() {\n\treturn (\n\t\t<Stack className={styles.popover} gap={dimensions.css.popoverGap} padding={dimensions.css.popoverPadding}>\n\t\t\t<Stack className={styles.popoverRow} direction=\"row\" gap={dimensions.css.inputSpacing} alignItems=\"center\">\n\t\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>\n\t\t\t\t\t<T>{Dictionary.Name}</T>\n\t\t\t\t</div>\n\t\t\t\t<ProjectTitleInput\n\t\t\t\t\tclassName={styles.rowControl}\n\t\t\t\t\tonEscape={() => {\n\t\t\t\t\t\tclosePopover()\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t\t<Stack className={styles.popoverRow} direction=\"row\" gap={dimensions.css.inputSpacing} alignItems=\"center\">\n\t\t\t\t<div className={cx(truncateWithEllipsis, styles.rowTitle)}>\n\t\t\t\t\t<T>{Dictionary.Folder}</T>\n\t\t\t\t</div>\n\t\t\t\t<ProjectLocationButton className={styles.rowControl} showLeadingIcon />\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nexport const RegularProjectBarTitle = React.memo(function RegularProjectBarTitle({ title }: Props) {\n\t// Note: This uses the placeholder as a fallback value so the label won't be empty.\n\tconst { historyStore } = engine.stores\n\tconst [_, textSansEmoji] = emoji.extract(title)\n\n\tconst { hostname, publishedOrPublishingUpdates, url } = usePublishedState()\n\tconst activeHistoryVersionName = historyStore.useState(state => state.activeVersionName)\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handleOpenLink = useCallback(\n\t\t(event: React.SyntheticEvent) => {\n\t\t\tevent.preventDefault()\n\t\t\tif (!hostname || !url) return\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: \"tool-bar\",\n\t\t\t\tid: hostname.type === \"custom\" ? UIInteraction.openCustomLink : UIInteraction.openPublishedLink,\n\t\t\t})\n\t\t\topenNewTab(url)\n\t\t},\n\t\t[hostname, url],\n\t)\n\n\tconst clickHandlerOpenLink = useClickHandlers(handleOpenLink, undefined, true)\n\n\tconst renderStatus = () => {\n\t\tif (activeHistoryVersionName) {\n\t\t\treturn (\n\t\t\t\t<span className={cx(styles.hostname)}>\n\t\t\t\t\t<span className={styles.versionHistoryName}>{activeHistoryVersionName}</span>\n\t\t\t\t</span>\n\t\t\t)\n\t\t}\n\n\t\tif (publishedOrPublishingUpdates && hostname && !isAgentExperimentOn) {\n\t\t\treturn (\n\t\t\t\t<span className={cx(styles.hostname)}>\n\t\t\t\t\t<a href={url} {...clickHandlerOpenLink}>\n\t\t\t\t\t\t{hostname.hostname}\n\t\t\t\t\t</a>\n\t\t\t\t</span>\n\t\t\t)\n\t\t}\n\n\t\treturn null\n\t}\n\n\tconst containerRef = React.useRef<HTMLDivElement>(null)\n\tconst statusRef = React.useRef<HTMLSpanElement>(null)\n\tconst projectBadgeRef = React.useRef<HTMLSpanElement>(null)\n\n\tconst hideableRefs = useConstant(() => [projectBadgeRef, statusRef])\n\tconst allHideableRefsHidden = usePriorityOverflow(containerRef, hideableRefs)\n\n\treturn (\n\t\t<ProjectBarTitleLayout ref={containerRef} popoverContent={<RegularProjectPopover />}>\n\t\t\t{({ clickHandlers, ref }) => (\n\t\t\t\t<>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.title,\n\t\t\t\t\t\t\t// If there's nothing else left to hide, allow the title to shrink.\n\t\t\t\t\t\t\tallHideableRefsHidden && styles.titleCanShrink,\n\t\t\t\t\t\t\ttruncateWithEllipsis,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...clickHandlers}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t>\n\t\t\t\t\t\t{textSansEmoji}\n\t\t\t\t\t</span>\n\t\t\t\t\t<span ref={statusRef}>{renderStatus()}</span>\n\t\t\t\t\t<span ref={projectBadgeRef}>\n\t\t\t\t\t\t<ProjectBarBadge />\n\t\t\t\t\t</span>\n\t\t\t\t\t<ProjectBarBranch popoverAnchorRef={containerRef} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ProjectBarTitleLayout>\n\t)\n})\n\n/**\n * Will hide the hideable refs, starting at the beginning of the array, when the container can't fit them all.\n */\nfunction usePriorityOverflow(\n\tcontainerRef: React.RefObject<HTMLElement>,\n\thideableRefs: readonly React.RefObject<HTMLElement>[],\n): boolean {\n\tconst [allHideableRefsHidden, setAllHideableRefsHidden] = React.useState(false)\n\n\tconst measure = React.useCallback(() => {\n\t\tconst container = containerRef.current\n\t\tif (!container) return\n\n\t\tcontainer.classList.add(styles.measuringOverflow)\n\n\t\ttry {\n\t\t\tfor (const ref of hideableRefs) {\n\t\t\t\tconst element = ref.current\n\t\t\t\tif (element) element.hidden = false\n\t\t\t}\n\n\t\t\tfor (const ref of hideableRefs) {\n\t\t\t\tif (visibleChildrenFit(container)) {\n\t\t\t\t\tsetAllHideableRefsHidden(false)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst element = ref.current\n\t\t\t\tif (element) element.hidden = true\n\t\t\t}\n\n\t\t\tsetAllHideableRefsHidden(true)\n\t\t} finally {\n\t\t\tcontainer.classList.remove(styles.measuringOverflow)\n\t\t}\n\t}, [containerRef, hideableRefs])\n\n\tReact.useLayoutEffect(() => {\n\t\tmeasure()\n\t}, [measure])\n\n\tReact.useEffect(() => {\n\t\tconst container = containerRef.current\n\t\tif (!container || typeof ResizeObserver === \"undefined\") return\n\n\t\tconst resizeObserver = new ResizeObserver(measure)\n\t\t// This responds to the content size changes.\n\t\tresizeObserver.observe(container)\n\t\t// This responds to the available space changes.\n\t\tif (container.parentElement) resizeObserver.observe(container.parentElement)\n\n\t\treturn () => resizeObserver.disconnect()\n\t}, [containerRef, measure])\n\n\treturn allHideableRefsHidden\n}\n\n/**\n * Elaborate alternative to doing scrollWidth <= clientWidth that works well with fractional widths and rounding.\n */\nfunction visibleChildrenFit(container: HTMLElement): boolean {\n\tconst containerRect = container.getBoundingClientRect()\n\tconst containerStyles = getComputedStyle(container)\n\tconst contentRight = containerRect.right - Number.parseFloat(containerStyles.paddingRight)\n\n\tfor (const child of container.children) {\n\t\tif (!(child instanceof HTMLElement) || child.hidden) continue\n\t\tif (child.getBoundingClientRect().right > contentRight) return false\n\t}\n\n\treturn true\n}\n", "import type { BranchHostname } from \"@framerjs/app-shared/src/Deployments.ts\"\nimport { MAX_HOSTNAME_PART_LENGTH } from \"canvas-sandbox-renderer/sandboxConfig.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { isBranchNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\n\n// Branch hostnames are similar to default hostnames, but with a \"--<branchId>\" suffix on the top label.\n// This function embeds the branch title, which is more recognizable for users\n// and can change freely (e.g. on branch renames), since FramerDomainsServer ignores the branch title.\nexport function branchHostnameWithTitle(hostname: BranchHostname, tree: CanvasTree): string {\n\tconst branchNode = tree.getNodeWithTrait(hostname.branchId, isBranchNode)\n\tif (!branchNode) {\n\t\treturn hostname.hostname\n\t}\n\n\tconst branchName = branchNode.title\n\tconst baseHostname = hostname.hostname\n\tconst hostnameTopLabel = baseHostname.split(\".\")[0]\n\tconst branchIdSuffix = `--${hostname.branchId}`\n\tconst branchIdSuffixStart = hostnameTopLabel.lastIndexOf(branchIdSuffix)\n\tif (branchIdSuffixStart === -1) {\n\t\t// Unexpected, but handle it gracefully\n\t\treturn baseHostname\n\t}\n\n\t// We subtract an extra char for the \"-\" separator between branch title and id.\n\tconst charsAvailableInTopLabel = MAX_HOSTNAME_PART_LENGTH - hostnameTopLabel.length - 1\n\tconst branchNameForHostname = slugify(branchName).slice(0, charsAvailableInTopLabel)\n\tconst hostnameWithoutBranchIdSuffix = hostnameTopLabel.slice(0, branchIdSuffixStart)\n\tconst prettyHostnameTopLabel = `${hostnameWithoutBranchIdSuffix}--${branchNameForHostname}-${hostname.branchId}`\n\n\treturn baseHostname.replace(hostnameTopLabel, prettyHostnameTopLabel)\n}\n\nexport function prettifyBranchHostname(hostname: BranchHostname, tree: CanvasTree): string {\n\tconst branchNode = tree.getNodeWithTrait(hostname.branchId, isBranchNode)\n\tif (!branchNode) {\n\t\treturn hostname.hostname\n\t}\n\n\tconst branchName = branchNode.title\n\tconst baseHostname = hostname.hostname\n\tconst hostnameTopLabel = baseHostname.split(\".\")[0]\n\tconst branchIdSuffix = `--${hostname.branchId}`\n\tconst branchIdSuffixStart = hostnameTopLabel.lastIndexOf(branchIdSuffix)\n\tif (branchIdSuffixStart === -1) {\n\t\t// Unexpected, but handle it gracefully\n\t\treturn baseHostname\n\t}\n\n\tconst displayHostnamePrefix = hostnameTopLabel.slice(0, branchIdSuffixStart).replace(/-\\d+$/, \"\")\n\tconst displayHostnamePrefixWithEllipsis = `${displayHostnamePrefix}\u2026`\n\tconst charsAvailableInTopLabel = Math.max(0, MAX_HOSTNAME_PART_LENGTH - displayHostnamePrefixWithEllipsis.length)\n\tconst branchNameForHostname = slugify(branchName).slice(0, charsAvailableInTopLabel)\n\tconst hostnameWithoutBranchIdSuffix = hostnameTopLabel.slice(0, branchIdSuffixStart)\n\tconst prettyHostnameTopLabel = branchNameForHostname\n\t\t? `${displayHostnamePrefixWithEllipsis}${branchNameForHostname}`\n\t\t: hostnameWithoutBranchIdSuffix\n\n\treturn baseHostname.replace(hostnameTopLabel, prettyHostnameTopLabel)\n}\n", "import type { CustomHostname, Hostname } from \"@framerjs/app-shared\"\nimport { HostnameType } from \"@framerjs/app-shared\"\nimport type { BranchHostname } from \"@framerjs/app-shared/src/Deployments.ts\"\n\nimport { isLocalHostname } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useExperimentIsOn } from \"../../../app/experiments.ts\"\nimport { formatCanonicalUrlForDisplay } from \"./formatCanonicalUrlForDisplay.ts\"\nimport { getActiveWebPageURL } from \"./getActiveWebPageURL.ts\"\nimport { branchHostnameWithTitle, prettifyBranchHostname } from \"./prettifyBranchHostname.ts\"\n\n/** Returns the site URL for display and a link URL.\n * - If the experiment \"showCanonicalUrlAsDefault\" is on and `hostname` is a CustomHostname,\n *   then it uses the custom canonical URL.\n * - If `linkToActivePage` is true, it generates a link to the active web page.\n * - If `hostname` is undefined, it returns undefined for both displayUrl and linkUrl.\n */\nexport function useDisplayUrlWithLink(opts: {\n\thostname: Hostname | CustomHostname | BranchHostname | undefined\n\tlinkToActivePage: boolean\n}): { displayUrl: string | undefined; linkUrl: string | undefined } {\n\tconst useCanonicalUrl = opts.hostname?.type === HostnameType.Custom\n\tconst showCanonicalUrl = useExperimentIsOn(\"showCanonicalUrlAsDefault\")\n\n\treturn useEngineState(\n\t\t() => {\n\t\t\tif (opts.hostname === undefined) {\n\t\t\t\treturn {\n\t\t\t\t\tdisplayUrl: undefined,\n\t\t\t\t\tlinkUrl: undefined,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst canonicalURL = engine.stores.publishStore.canonicalURL\n\t\t\tif (useCanonicalUrl && showCanonicalUrl && canonicalURL.type === \"custom\") {\n\t\t\t\treturn {\n\t\t\t\t\tdisplayUrl: formatCanonicalUrlForDisplay(canonicalURL.url),\n\t\t\t\t\tlinkUrl: opts.linkToActivePage\n\t\t\t\t\t\t? getActiveWebPageURL(engine.componentLoader, engine.stores, opts.hostname.hostname, true)\n\t\t\t\t\t\t: canonicalURL.url,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst rawHostname = opts.hostname.hostname\n\t\t\tconst displayHostname =\n\t\t\t\topts.hostname.type === HostnameType.Branch ? prettifyBranchHostname(opts.hostname, engine.tree) : rawHostname\n\t\t\tconst linkHostname =\n\t\t\t\topts.hostname.type === HostnameType.Branch ? branchHostnameWithTitle(opts.hostname, engine.tree) : rawHostname\n\n\t\t\tlet protocol = \"https://\"\n\t\t\tif (isLocalHostname(rawHostname)) {\n\t\t\t\tprotocol = \"http://\"\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tdisplayUrl: displayHostname,\n\t\t\t\tlinkUrl: opts.linkToActivePage\n\t\t\t\t\t? getActiveWebPageURL(engine.componentLoader, engine.stores, linkHostname, false)\n\t\t\t\t\t: `${protocol}${linkHostname}`,\n\t\t\t}\n\t\t},\n\t\t[showCanonicalUrl, opts.hostname, opts.linkToActivePage],\n\t\t[\n\t\t\tEngineChange.ActiveBundle,\n\t\t\tEngineChange.Tree,\n\t\t\tengine.stores.publishStore,\n\t\t\tengine.stores.chromeStore,\n\t\t\tengine.stores.localizationStore,\n\t\t\tengine.stores.scopeStore,\n\t\t],\n\t)\n}\n", "import type { WindowWithCurrentUser } from \"@framerjs/app-shared\"\nimport { getProjectLocationLabel } from \"@framerjs/app-shared\"\nimport {\n\tButton,\n\tCenterChild,\n\tIconEntityFolder,\n\tIconInputDropdown,\n\tSpacer,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useWebProjectService } from \"../../shared/utils/useWebProjectService.ts\"\nimport * as styles from \"./ProjectLocationButton.styles.ts\"\n\ninterface Props {\n\tclassName?: string\n\tid?: string\n\tshowLeadingIcon?: boolean\n}\n\nexport function ProjectLocationButton({ id, className, showLeadingIcon = false }: Props) {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\n\tconst user = (window.parent as WindowWithCurrentUser).framerUser\n\tconst project = engine.stores.projectStore.useState(state => state.project)\n\n\tconst label = React.useMemo(() => {\n\t\tif (!project) return null\n\t\treturn getProjectLocationLabel(project, user.id)\n\t}, [project, user.id])\n\n\tconst { webProjectServiceRef, canMoveProject } = useWebProjectService()\n\n\tfunction handleMoveProject(event: React.MouseEvent<HTMLElement>) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\n\t\tconst webProjectService = webProjectServiceRef.current\n\t\tif (!webProjectService) return\n\n\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\n\t\tvoid webProjectService.showMoveProjectMenu({\n\t\t\tlocation: {\n\t\t\t\tx: bounds.left,\n\t\t\t\ty: bounds.bottom + 5,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tid={id}\n\t\t\tclassName={cx(styles.locationButton, className)}\n\t\t\tenabled={!isViewOnly && canMoveProject}\n\t\t\tonClick={handleMoveProject}\n\t\t>\n\t\t\t{showLeadingIcon && (\n\t\t\t\t<span className={styles.iconWrapper}>\n\t\t\t\t\t<IconEntityFolder />\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t<span className={truncateWithEllipsis}>{label}</span>\n\t\t\t<Spacer flex minSize={4} />\n\t\t\t<CenterChild className={styles.selectIconWrapper}>\n\t\t\t\t<IconInputDropdown />\n\t\t\t</CenterChild>\n\t\t</Button>\n\t)\n}\n", "import \"ProjectLocationButton.styles_1dnwoas.wyw.css\"; export const locationButton = \"locationButton_l1tn2zxk\";\nexport const iconWrapper = \"iconWrapper_i1cywotd\";\nexport const selectIconWrapper = \"selectIconWrapper_sq7fn7q\";", "import * as ipc from \"app/ipc.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { titleOrUntitled } from \"web/lib/Project.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getIpcRenderer } from \"wrappers/ipcRenderer.ts\"\nimport { TextInputWithEmoji } from \"../../shared/TextInputWithEmoji.tsx\"\n\nfunction commitTitleUpdate(value: string) {\n\tgetIpcRenderer().send(ipc.ProjectTitleUpdate, value)\n}\n\ninterface Props {\n\tid?: string\n\tclassName?: string\n\tonEscape?: (event: React.KeyboardEvent) => void\n}\n\nexport function ProjectTitleInput({ id, className, onEscape }: Props) {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\n\tconst title = titleOrUntitled(engine.stores.projectStore.useState(state => state.project?.title))\n\n\tconst onChange = React.useCallback((value: string, final: boolean, reset: () => void) => {\n\t\tif (!value.trim()) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tconst currentTitle = engine.stores.projectStore.project?.title\n\t\tif (value !== currentTitle) {\n\t\t\t// Note that this will optimistically and synchronously update the\n\t\t\t// ProjectStore's title, so the update should be almost immediately\n\t\t\t// (= time to re-render) reflected in this component.\n\t\t\tcommitTitleUpdate(value)\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<TextInputWithEmoji\n\t\t\tclassName={className}\n\t\t\tenabled={!isViewOnly}\n\t\t\tvalue={title}\n\t\t\tonChange={onChange}\n\t\t\tonEscape={onEscape}\n\t\t\tplaceholder=\"My Project\"\n\t\t\tid={id}\n\t\t\tautoFocus\n\t\t/>\n\t)\n}\n", "import \"ProjectBarBadge.styles_1fxyf5b.wyw.css\"; export const sitesToolbarBadge = \"sitesToolbarBadge_scaknyo\";\nexport const sitesToolbarBadgeAgent = \"sitesToolbarBadgeAgent_s1gae3f0\";\nexport const agentDotSeparator = \"agentDotSeparator_ar1nkla\";", "import type { WindowWithCurrentUser } from \"@framerjs/app-shared\"\nimport { ProjectLicenseType, TeamLicenseType, isOrganizationSpace } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIs, useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { UpsellPages, UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { SitesBadge } from \"../../SitesBadge/SitesBadge.tsx\"\nimport * as styles from \"./ProjectBarBadge.styles.ts\"\n\nexport function ProjectBarBadge() {\n\tconst user = (window.parent as WindowWithCurrentUser).framerUser\n\tconst { project } = engine.stores.projectStore.useState()\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst isBranchingExperimentOn = !useExperimentIs(\"branching\", \"off\")\n\n\tif (!project) return null\n\n\tconst projectSpaceId = project.space.id\n\n\tconst projectLicenseType = project.license.type\n\n\tconst team = user.spaces.find(({ id }) => id === projectSpaceId)\n\tconst isTeamSpace = isOrganizationSpace(team)\n\n\tif (!isTeamSpace) return null\n\n\tconst isEnterpriseTeam = project?.teamLicenseType === TeamLicenseType.EnterprisePlan\n\tconst isFreePlanSite = project?.license.type === ProjectLicenseType.FreeSite\n\tconst isFreeSiteInEnterpriseTeam = isEnterpriseTeam && isFreePlanSite\n\n\tif (\n\t\t// This covers the case where a project is enterprise due to being in an\n\t\t// organization even though the team license differs. this can happen\n\t\t// due to changes made in the admin dashboard\n\t\tprojectLicenseType === ProjectLicenseType.EnterpriseSite ||\n\t\t(isEnterpriseTeam && !isFreeSiteInEnterpriseTeam)\n\t) {\n\t\treturn null\n\t}\n\n\tif ((isAgentExperimentOn || isBranchingExperimentOn) && !isFreePlanSite) return null\n\n\tconst openCheckoutPage = () => {\n\t\tupdatePurchaseOrigin(\n\t\t\tUpsellType.projectBarUpsell,\n\t\t\t{ projectId: project.id, site: project.license.type, team: project.teamLicenseType },\n\t\t\tnull,\n\t\t)\n\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: UpsellPages.ProjectToolbarSitesUpsell,\n\t\t\tid: UpsellUIInteraction.confirmInAppUpsell,\n\t\t})\n\t\tengine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.plans }).catch(unhandledError)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{isAgentExperimentOn && <span className={styles.agentDotSeparator}>\u00B7</span>}\n\t\t\t<SitesBadge\n\t\t\t\tvariant={projectLicenseType}\n\t\t\t\tclassName={cx(styles.sitesToolbarBadge, isAgentExperimentOn && styles.sitesToolbarBadgeAgent)}\n\t\t\t\tonClick={isFreeSiteInEnterpriseTeam ? undefined : openCheckoutPage}\n\t\t\t/>\n\t\t</>\n\t)\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { useExperimentIs } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { useIsCrdt } from \"document/crdt/useIsCrdt.ts\"\nimport engine from \"document/engine.ts\"\nimport type { BranchNode } from \"document/models/CanvasTree/nodes/branches/BranchNode.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { PanelSectionHeaderButton } from \"../../properties/panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { usePopoutContent } from \"../../shared/PopoutButton.tsx\"\nimport { PopoutPopover } from \"../../shared/PopoutPopover.tsx\"\nimport { usePopoverWithinPadding } from \"../../utils/usePopoverWithinPadding.ts\"\nimport { IconBranch } from \"../icons/IconBranch.tsx\"\nimport { BranchesPopoutContent } from \"./BranchesPopoutContent.tsx\"\nimport * as styles from \"./ProjectBarBranch.styles.ts\"\n\ninterface ProjectBarBranchProps {\n\tpopoverAnchorRef: React.RefObject<HTMLElement>\n}\n\nexport const ProjectBarBranch = React.memo(function ProjectBarBranch({ popoverAnchorRef }: ProjectBarBranchProps) {\n\tconst isBranchingExperimentOn = !useExperimentIs(\"branching\", \"off\")\n\tconst isBranchingEnabled = useIsCrdt() && isBranchingExperimentOn\n\tif (!isBranchingEnabled) return null\n\n\treturn <ProjectBarBranchInner popoverAnchorRef={popoverAnchorRef} />\n})\n\nfunction ProjectBarBranchInner({ popoverAnchorRef }: ProjectBarBranchProps) {\n\tconst activeBranch = useEngineState(() => engine.tree.get<BranchNode>(engine.activeBranchId), [], EngineChange.Tree)\n\n\t// Pin the popout below the project bar to match the project title popover position.\n\tconst webBarHeight = useDimensionValue(\"webBarHeight\")\n\tconst popoverWithinPadding = usePopoverWithinPadding()\n\tconst popoverTop = webBarHeight + dimensions.values.popoverOffsetY\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<PopoutPopover\n\t\t\t\tanchorRef={popoverAnchorRef}\n\t\t\t\tattachTo=\"bottom\"\n\t\t\t\toffset={{ x: 0, y: 0 }}\n\t\t\t\twithin={{ ...popoverWithinPadding, top: popoverTop }}\n\t\t\t\tthemeBehavior=\"none\"\n\t\t\t>\n\t\t\t\t<BranchTriggerButton activeBranch={activeBranch} />\n\t\t\t</PopoutPopover>\n\t\t</div>\n\t)\n}\n\ninterface BranchTriggerButtonProps {\n\tactiveBranch: BranchNode | null\n}\n\nfunction BranchTriggerButton({ activeBranch }: BranchTriggerButtonProps) {\n\tconst { present, isPresenting } = usePopoutContent({\n\t\tpopout: <BranchesPopoutContent />,\n\t\tnavigationTitle: \"Branches\",\n\t\ttoolbarAction: <CreateBranchButton />,\n\t})\n\n\tconst activeBranchTitle = activeBranch?.title ?? \"main\"\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"clean\"\n\t\t\tclassName={cx(styles.button, styles.buttonMain)}\n\t\t\taria-expanded={isPresenting}\n\t\t\tonClick={present}\n\t\t>\n\t\t\t<IconBranch />\n\t\t\t{activeBranchTitle}\n\t\t</Button>\n\t)\n}\n\nfunction CreateBranchButton() {\n\tconst handleCreate = () => {\n\t\tengine.createBranchAndSwitch()\n\t}\n\n\treturn (\n\t\t<PanelSectionHeaderButton onClick={handleCreate} title=\"Create branch\" className={styles.createBranchButton}>\n\t\t\t<IconSectionHeaderPlus />\n\t\t</PanelSectionHeaderButton>\n\t)\n}\n", "import type React from \"react\"\n\nexport function IconBranch({ className, ...rest }: React.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\tviewBox=\"0 0 12 12\"\n\t\t\twidth=\"12\"\n\t\t\theight=\"12\"\n\t\t\tfill=\"none\"\n\t\t\tclassName={className}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<path\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\td=\"M3.5 7V3M5 8.5h.5a3 3 0 0 0 3-3h0\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M8.5 2a2 2 0 1 1 .001 3.999A2 2 0 0 1 8.5 2m-1 2a1 1 0 1 0 2 0 1 1 0 0 0-2 0M3.5 6.5a2 2 0 1 1 .001 3.999A2 2 0 0 1 3.5 6.5m-1 2a1 1 0 1 0 2 0 1 1 0 0 0-2 0\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\topacity={0.2}\n\t\t\t\td=\"M8.5 2.5a1.5 1.5 0 1 1-.001 3.001A1.5 1.5 0 0 1 8.5 2.5M3.5 7a1.5 1.5 0 1 1-.001 3.001A1.5 1.5 0 0 1 3.5 7\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { Composite, CompositeItem, useCompositeStore } from \"@ariakit/react\"\nimport { ACLEntryKind, type UserACLEntry } from \"@framerjs/app-shared\"\nimport { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { MAIN_BRANCH_ID } from \"@framerjs/crdtree2/src/table/branchId.ts\"\nimport {\n\tAvatar,\n\tButton,\n\tContextMenuButton,\n\tIconSectionCollapsed,\n\tScroll,\n\tSearchBar,\n\tStack,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { type BranchContributor, isBranchContributor } from \"document/models/CanvasTree/nodes/branches/BranchNode.ts\"\nimport { BranchesNode } from \"document/models/CanvasTree/nodes/branches/BranchesNode.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { useCallback, useContext, useMemo, useRef, useState } from \"react\"\nimport { useContextMenu } from \"web/lib/useContextMenu.ts\"\nimport * as agentSearchBarStyles from \"../../shared/AgentSearchBar.styles.ts\"\nimport { EditableTextInput } from \"../../shared/EditableTextInput/EditableTextInput.tsx\"\nimport { PopoutContext } from \"../../shared/PopoutContext.ts\"\nimport { RelativeTime } from \"../../siteSettings/RelativeTime.tsx\"\nimport { IconBranch } from \"../icons/IconBranch.tsx\"\nimport * as styles from \"./BranchesPopoutContent.styles.ts\"\n\nconst NESTED_INDENT_PX = 30\n\ninterface FlatBranchItem {\n\tid: string\n\ttitle: string\n\tbaseId?: string\n\tcontributors?: BranchContributor[]\n\tcreatedBy?: string\n\tlastEdited?: number\n}\n\ninterface BranchItem extends FlatBranchItem {\n\tdepth: number\n\thasChildren: boolean\n}\n\nexport function BranchesPopoutContent() {\n\tconst [search, setSearch] = useState(\"\")\n\tconst [renamingBranchId, setRenamingBranchId] = useState<string | null>(null)\n\tconst searchInputRef = useRef<HTMLInputElement>(null)\n\tconst navigation = useContext(PopoutContext)\n\n\tconst activeBranchId = useEngineState(() => engine.activeBranchId, [], EngineChange.Tree)\n\tconst branchesNode = useEngineState(() => BranchesNode.get(engine.tree), [], EngineChange.Tree)\n\n\tconst branches = useMemo<FlatBranchItem[]>(() => {\n\t\tconst items: FlatBranchItem[] = [{ id: MAIN_BRANCH_ID, title: \"main\", baseId: undefined }]\n\t\tif (branchesNode) {\n\t\t\tfor (const node of branchesNode.children) {\n\t\t\t\tif (node.deletedAt) continue\n\t\t\t\titems.push({\n\t\t\t\t\tid: node.id,\n\t\t\t\t\ttitle: node.title,\n\t\t\t\t\tbaseId: node.baseId,\n\t\t\t\t\tcontributors: node.contributors,\n\t\t\t\t\tcreatedBy: node.createdBy,\n\t\t\t\t\tlastEdited: node.lastEdited,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn items\n\t}, [branchesNode])\n\n\tconst { branchById, childrenByParentId } = useMemo(() => {\n\t\treturn getBranchHierarchy(branches)\n\t}, [branches])\n\n\tconst [expandedIds, setExpandedIds] = useState<Set<string>>(() => {\n\t\treturn getDefaultExpandedIds({\n\t\t\tactiveBranchId,\n\t\t\tbranchById,\n\t\t})\n\t})\n\n\t// Expand the full ancestor path whenever the active branch changes so the\n\t// newly active branch is always visible\n\tconst lastSeenActiveBranchIdRef = useRef(activeBranchId)\n\tif (lastSeenActiveBranchIdRef.current !== activeBranchId) {\n\t\tlastSeenActiveBranchIdRef.current = activeBranchId\n\t\tconst pathIds = getDefaultExpandedIds({ activeBranchId, branchById })\n\t\tsetExpandedIds(current => {\n\t\t\tif ([...pathIds].every(id => current.has(id))) return current\n\t\t\treturn new Set([...current, ...pathIds])\n\t\t})\n\t}\n\n\tconst toggleExpanded = useCallback((branchId: string) => {\n\t\tsetExpandedIds(current => {\n\t\t\tconst next = new Set(current)\n\t\t\tif (next.has(branchId)) {\n\t\t\t\tnext.delete(branchId)\n\t\t\t} else {\n\t\t\t\tnext.add(branchId)\n\t\t\t}\n\t\t\treturn next\n\t\t})\n\t}, [])\n\n\tconst activeBranch = branchById.get(activeBranchId)\n\tassert(activeBranch, `Active branch ${activeBranchId} not found`)\n\tconst baseBranch = activeBranch.baseId ? branchById.get(activeBranch.baseId) : undefined\n\tconst baseBranchTitle = baseBranch?.title ?? \"main\"\n\n\tconst isSearching = search.trim().length > 0\n\tconst filtered = useMemo(() => {\n\t\tif (isSearching) {\n\t\t\tconst normalizedSearch = search.toLowerCase()\n\t\t\treturn branches\n\t\t\t\t.filter(branch => branch.title.toLowerCase().includes(normalizedSearch))\n\t\t\t\t.map(branch => ({\n\t\t\t\t\t...branch,\n\t\t\t\t\tdepth: 0,\n\t\t\t\t\thasChildren: childrenByParentId.has(branch.id),\n\t\t\t\t}))\n\t\t}\n\n\t\treturn flattenBranches({\n\t\t\trootId: MAIN_BRANCH_ID,\n\t\t\tbranchById,\n\t\t\tchildrenByParentId,\n\t\t\texpandedIds,\n\t\t})\n\t}, [branchById, branches, childrenByParentId, expandedIds, isSearching, search])\n\tconst hasSearchResults = filtered.length > 0\n\tconst aclById = engine.stores.projectStore.useState(state => state.aclById)\n\tconst currentUserId = engine.stores.sessionStore.user.id\n\n\tconst handleSwitch = useCallback((branchId: string) => {\n\t\tif (branchId === engine.activeBranchId) return\n\t\tengine.switchActiveBranch(branchId)\n\t}, [])\n\n\tconst handleStartRename = useCallback((branchId: string) => {\n\t\tsetRenamingBranchId(branchId)\n\t}, [])\n\n\tconst handleStopRename = useCallback(() => {\n\t\tsetRenamingBranchId(null)\n\t}, [])\n\n\tconst handleMerge = () => {\n\t\tnavigation?.close()\n\t\tengine.mergeBranchToBase()\n\t}\n\n\tconst handleCreateBranch = () => {\n\t\tengine.createBranchAndSwitch()\n\t}\n\n\tconst isOnBranch = !engine.stores.treeStore.isOnMainBranch()\n\tconst activeBranchHasChildren = (childrenByParentId.get(activeBranchId)?.length ?? 0) > 0\n\tconst isContributorToActiveBranch = isBranchContributor(activeBranch, currentUserId)\n\tconst isContributorToBaseBranch = !baseBranch || isBranchContributor(baseBranch, currentUserId)\n\tconst canApply = isOnBranch && !activeBranchHasChildren && isContributorToActiveBranch && isContributorToBaseBranch\n\n\tconst compositeStore = useCompositeStore({\n\t\torientation: \"vertical\",\n\t\tfocusLoop: true,\n\t\tdefaultActiveId: activeBranchId,\n\t})\n\n\tconst handleSearchKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent) => {\n\t\t\tif (event.key !== \"ArrowDown\") return\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst firstId = filtered[0]?.id\n\t\t\tif (firstId) compositeStore.move(firstId)\n\t\t},\n\t\t[compositeStore, filtered],\n\t)\n\n\tconst focusSearchInput = useCallback(() => {\n\t\tsearchInputRef.current?.focus()\n\t}, [])\n\n\treturn (\n\t\t<Scroll className={styles.scroll}>\n\t\t\t<Stack gap={0}>\n\t\t\t\t<Stack paddingTop={0}>\n\t\t\t\t\t<Stack gap={0} className={cx(styles.sticky, hasSearchResults && styles.dividerBottom)}>\n\t\t\t\t\t\t<SearchBar\n\t\t\t\t\t\t\tref={searchInputRef}\n\t\t\t\t\t\t\tclassName={cx(styles.searchBar, agentSearchBarStyles.agentInputWrapper)}\n\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\tvalue={search}\n\t\t\t\t\t\t\tonChange={setSearch}\n\t\t\t\t\t\t\tonKeyDown={handleSearchKeyDown}\n\t\t\t\t\t\t\tplaceholder={Dictionary.SearchEllipsis}\n\t\t\t\t\t\t\tshowClearButton\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t{hasSearchResults && (\n\t\t\t\t\t\t<Composite store={compositeStore} aria-label=\"Branches\" className={styles.itemsWrapper}>\n\t\t\t\t\t\t\t{filtered.map(branch => {\n\t\t\t\t\t\t\t\tconst createdByEntry = branch.createdBy ? aclById[branch.createdBy] : undefined\n\t\t\t\t\t\t\t\tconst createdByUser = createdByEntry?.kind === ACLEntryKind.User ? createdByEntry.user : undefined\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<BranchRow\n\t\t\t\t\t\t\t\t\t\tkey={branch.id}\n\t\t\t\t\t\t\t\t\t\tbranch={branch}\n\t\t\t\t\t\t\t\t\t\tcreatedByUser={createdByUser}\n\t\t\t\t\t\t\t\t\t\tisActive={branch.id === activeBranchId}\n\t\t\t\t\t\t\t\t\t\tisContributor={isBranchContributor(branch, currentUserId)}\n\t\t\t\t\t\t\t\t\t\tlastEdited={branch.lastEdited}\n\t\t\t\t\t\t\t\t\t\tonSwitch={handleSwitch}\n\t\t\t\t\t\t\t\t\t\tisCollapsed={branch.id !== MAIN_BRANCH_ID && branch.hasChildren && !expandedIds.has(branch.id)}\n\t\t\t\t\t\t\t\t\t\tshowCollapseControl={!isSearching && branch.id !== MAIN_BRANCH_ID && branch.hasChildren}\n\t\t\t\t\t\t\t\t\t\tonToggleExpanded={toggleExpanded}\n\t\t\t\t\t\t\t\t\t\tcanCreateBranch={!isSearching}\n\t\t\t\t\t\t\t\t\t\tonFocusSearch={focusSearchInput}\n\t\t\t\t\t\t\t\t\t\tisRenaming={branch.id === renamingBranchId}\n\t\t\t\t\t\t\t\t\t\tonStartRename={() => handleStartRename(branch.id)}\n\t\t\t\t\t\t\t\t\t\tonStopRename={handleStopRename}\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</Composite>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\n\t\t\t\t<div className={cx(styles.mergeButtonWrapper, styles.divider)}>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={styles.footerButton}\n\t\t\t\t\t\tenabled={isOnBranch ? canApply : true}\n\t\t\t\t\t\tonClick={isOnBranch ? handleMerge : handleCreateBranch}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isOnBranch ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<span className={styles.mergeButtonAccent}>Apply</span>\n\t\t\t\t\t\t\t\t<span className={styles.mergeButtonMuted}> to {baseBranchTitle}</span>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className={styles.mergeButtonAccent}>Create Branch</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t</Scroll>\n\t)\n}\n\ninterface BranchRowProps {\n\tbranch: BranchItem\n\tcreatedByUser?: UserACLEntry[\"user\"]\n\tisActive: boolean\n\tisContributor: boolean\n\tlastEdited?: number\n\tonSwitch: (branchId: string) => void\n\tisCollapsed: boolean\n\tshowCollapseControl: boolean\n\tonToggleExpanded: (branchId: string) => void\n\tcanCreateBranch: boolean\n\tonFocusSearch: () => void\n\tisRenaming: boolean\n\tonStartRename: () => void\n\tonStopRename: () => void\n}\n\nfunction BranchRow({\n\tbranch,\n\tcreatedByUser,\n\tisActive,\n\tisContributor,\n\tlastEdited,\n\tonSwitch,\n\tisCollapsed,\n\tshowCollapseControl,\n\tonToggleExpanded,\n\tcanCreateBranch,\n\tonFocusSearch,\n\tisRenaming,\n\tonStartRename,\n\tonStopRename,\n}: BranchRowProps) {\n\tconst contextMenu = useContextMenu()\n\tconst [isMenuVisible, setIsMenuVisible] = useState(false)\n\tconst contextMenuButtonRef = useRef<HTMLButtonElement>(null)\n\n\tconst openContextMenu = useCallback(\n\t\t(x: number, y: number) => {\n\t\t\tconst isMain = branch.id === MAIN_BRANCH_ID\n\t\t\tconst items: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Branch,\n\t\t\t\t\tenabled: canCreateBranch,\n\t\t\t\t\tclick: () => engine.createBranchFromBaseAndSwitch(branch.id),\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.Rename,\n\t\t\t\t\tenabled: !isMain && isContributor,\n\t\t\t\t\tclick: () => onStartRename(),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\tenabled: !isMain && !branch.hasChildren && isContributor,\n\t\t\t\t\tclick: () => engine.deleteBranch(branch.id),\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tsetIsMenuVisible(true)\n\t\t\tcontextMenu.show(items, {\n\t\t\t\tlocation: { x, y },\n\t\t\t\tonDone: () => setIsMenuVisible(false),\n\t\t\t})\n\t\t},\n\t\t[branch.id, branch.hasChildren, isContributor, canCreateBranch, contextMenu, onStartRename],\n\t)\n\n\tfunction handleContextMenu(event: React.MouseEvent<HTMLElement>) {\n\t\tevent.preventDefault()\n\t\topenContextMenu(event.clientX, event.clientY)\n\t}\n\n\tfunction handleContextButtonClick(event: React.MouseEvent<HTMLButtonElement>) {\n\t\tevent.preventDefault()\n\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\topenContextMenu(bounds.x, bounds.bottom + 5)\n\t}\n\n\tfunction handleCollapseClick(event: React.MouseEvent<HTMLButtonElement>) {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\t\tonToggleExpanded(branch.id)\n\t}\n\n\tfunction handleCollapseMouseDown(event: React.MouseEvent<HTMLButtonElement>) {\n\t\tevent.stopPropagation()\n\t}\n\n\tfunction handleRowKeyDown(event: React.KeyboardEvent<HTMLElement>) {\n\t\tif (isRenaming) return\n\n\t\tif (branch.id === MAIN_BRANCH_ID && event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tonFocusSearch()\n\t\t\treturn\n\t\t}\n\n\t\tif (event.ctrlKey && event.key === \"Enter\") {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tconst button = contextMenuButtonRef.current\n\t\t\tif (button) {\n\t\t\t\tconst bounds = button.getBoundingClientRect()\n\t\t\t\topenContextMenu(bounds.x, bounds.bottom + 5)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tif (!showCollapseControl) return\n\t\tif (event.key === \"ArrowRight\" && isCollapsed) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tonToggleExpanded(branch.id)\n\t\t\treturn\n\t\t}\n\t\tif (event.key === \"ArrowLeft\" && !isCollapsed) {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tonToggleExpanded(branch.id)\n\t\t}\n\t}\n\n\treturn (\n\t\t<CompositeItem\n\t\t\tid={branch.id}\n\t\t\tonClick={isRenaming ? undefined : () => onSwitch(branch.id)}\n\t\t\tonKeyDown={handleRowKeyDown}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t\taria-current={isActive ? \"true\" : undefined}\n\t\t\trender={\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tclassName={cx(styles.branchRow, isActive && styles.activeBranchRow)}\n\t\t\t\t\tpaddingLeft={branch.depth * NESTED_INDENT_PX}\n\t\t\t\t>\n\t\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\taria-label={isCollapsed ? \"Expand branch\" : \"Collapse branch\"}\n\t\t\t\t\t\t\taria-expanded={showCollapseControl ? !isCollapsed : undefined}\n\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\tstyles.caretButton,\n\t\t\t\t\t\t\t\tisCollapsed && styles.caretButtonCollapsed,\n\t\t\t\t\t\t\t\t!showCollapseControl && styles.caretButtonHidden,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tonMouseDown={handleCollapseMouseDown}\n\t\t\t\t\t\t\tonClick={handleCollapseClick}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<IconSectionCollapsed height={6} />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HandleClickOnClick>\n\t\t\t\t\t<div className={cx(styles.avatarContainer, !createdByUser && isActive && styles.activeAvatarContainer)}>\n\t\t\t\t\t\t<BranchRowAvatar createdByUser={createdByUser} isActive={isActive} />\n\t\t\t\t\t</div>\n\t\t\t\t\t{isRenaming ? (\n\t\t\t\t\t\t<BranchNameInput branchId={branch.id} title={branch.title} onDone={onStopRename} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.branchName, isActive && styles.activeBranchName)}>\n\t\t\t\t\t\t\t{branch.title}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t{!isRenaming && (\n\t\t\t\t\t\t<div className={styles.rowActions}>\n\t\t\t\t\t\t\t{lastEdited !== undefined && (\n\t\t\t\t\t\t\t\t<RelativeTime\n\t\t\t\t\t\t\t\t\ttimestamp={lastEdited}\n\t\t\t\t\t\t\t\t\tshowTooltip={false}\n\t\t\t\t\t\t\t\t\taddSuffix={false}\n\t\t\t\t\t\t\t\t\tclassName={cx(styles.lastEditedText, isMenuVisible && styles.lastEditedHidden)}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<ContextMenuButton\n\t\t\t\t\t\t\t\tref={contextMenuButtonRef}\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\tonMouseDown={handleContextButtonClick}\n\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\tstyles.contextMenuButton,\n\t\t\t\t\t\t\t\t\tisActive && styles.contextMenuButtonSelected,\n\t\t\t\t\t\t\t\t\tisMenuVisible && styles.contextMenuVisible,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t/>\n\t)\n}\n\nfunction BranchNameInput({ branchId, title, onDone }: { branchId: string; title: string; onDone: () => void }) {\n\t// Prevents double-commit when both onChange(final=true) and onBlur fire together\n\tconst committedRef = useRef(false)\n\tconst [isEditing, setIsEditingState] = useState(true)\n\n\tconst handleRef = useCallback((input: HTMLInputElement | null) => {\n\t\tif (!input) return\n\t\tinput.focus()\n\t\tinput.select()\n\t}, [])\n\n\tconst handleChange = useCallback(\n\t\t(value: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final || committedRef.current) return\n\t\t\tcommittedRef.current = true\n\t\t\tconst trimmed = value.trim()\n\t\t\tif (trimmed.length === 0) {\n\t\t\t\treset()\n\t\t\t\tonDone()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (trimmed !== title) {\n\t\t\t\tengine.renameBranch(branchId, trimmed)\n\t\t\t}\n\t\t\tonDone()\n\t\t},\n\t\t[branchId, title, onDone],\n\t)\n\n\tconst setIsEditing = useCallback<React.Dispatch<React.SetStateAction<boolean>>>(\n\t\tvalue => {\n\t\t\tconst nextIsEditing = typeof value === \"function\" ? value(isEditing) : value\n\t\t\tsetIsEditingState(nextIsEditing)\n\t\t\tif (nextIsEditing || committedRef.current) return\n\t\t\tcommittedRef.current = true\n\t\t\tonDone()\n\t\t},\n\t\t[isEditing, onDone],\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\tevent.stopPropagation()\n\t\t\tif (event.key !== \"Escape\") return\n\t\t\tcommittedRef.current = true\n\t\t\tonDone()\n\t\t},\n\t\t[onDone],\n\t)\n\n\tconst stopPropagation = useCallback((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\t}, [])\n\n\treturn (\n\t\t<EditableTextInput\n\t\t\tid={`${branchId}-rename-input`}\n\t\t\tref={handleRef}\n\t\t\tclassName={styles.renameInput}\n\t\t\tplaceholder={title}\n\t\t\teditingInitialValue={title}\n\t\t\tallowEdit\n\t\t\tallowEmpty={false}\n\t\t\tisEditing={isEditing}\n\t\t\tsetIsEditing={setIsEditing}\n\t\t\tonValueChange={handleChange}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonMouseDown={stopPropagation}\n\t\t\tonClick={stopPropagation}\n\t\t\tsmall\n\t\t\tselectionStyle=\"unsaturated\"\n\t\t\taria-label=\"Rename branch\"\n\t\t/>\n\t)\n}\n\nfunction BranchRowAvatar({ createdByUser, isActive }: { createdByUser?: UserACLEntry[\"user\"]; isActive: boolean }) {\n\tif (!createdByUser) {\n\t\treturn <IconBranch className={cx(styles.branchIconColor, isActive && styles.activeBranchIcon)} aria-hidden=\"true\" />\n\t}\n\n\treturn (\n\t\t<Avatar\n\t\t\tsrc={createdByUser.avatar}\n\t\t\ttext={createdByUser.initials || createdByUser.name}\n\t\t\tsize={styles.branchAvatarSize}\n\t\t\tavatarCustomStyles={styles.branchAvatar}\n\t\t\tradiusCustomStyles={styles.branchAvatarRadius}\n\t\t\ttextCustomStyles={styles.branchAvatarText}\n\t\t/>\n\t)\n}\n\nfunction getBranchHierarchy(branches: FlatBranchItem[]) {\n\tconst branchById = new Map<string, FlatBranchItem>()\n\tconst childrenByParentId = new Map<string, FlatBranchItem[]>()\n\n\tfor (const branch of branches) {\n\t\tbranchById.set(branch.id, branch)\n\t\tif (!branch.baseId) continue\n\t\tconst children = childrenByParentId.get(branch.baseId)\n\t\tif (children) {\n\t\t\tchildren.push(branch)\n\t\t} else {\n\t\t\tchildrenByParentId.set(branch.baseId, [branch])\n\t\t}\n\t}\n\n\t// Compute the most recent lastEdited across each branch's entire subtree so\n\t// that a parent with an old lastEdited still sorts above siblings when one of\n\t// its descendants was edited more recently.\n\tconst subtreeLastEdited = new Map<string, number>()\n\tfunction getSubtreeLastEdited(id: string): number {\n\t\tconst cached = subtreeLastEdited.get(id)\n\t\tif (cached !== undefined) return cached\n\t\tconst branch = branchById.get(id)\n\t\tlet max = branch?.lastEdited ?? 0\n\t\tfor (const child of childrenByParentId.get(id) ?? []) {\n\t\t\tmax = Math.max(max, getSubtreeLastEdited(child.id))\n\t\t}\n\t\tsubtreeLastEdited.set(id, max)\n\t\treturn max\n\t}\n\tfor (const branch of branches) {\n\t\tgetSubtreeLastEdited(branch.id)\n\t}\n\n\tfor (const children of childrenByParentId.values()) {\n\t\tchildren.sort((a, b) => (subtreeLastEdited.get(b.id) ?? 0) - (subtreeLastEdited.get(a.id) ?? 0))\n\t}\n\n\treturn { branchById, childrenByParentId }\n}\n\nfunction getDefaultExpandedIds({\n\tactiveBranchId,\n\tbranchById,\n}: {\n\tactiveBranchId: string\n\tbranchById: Map<string, FlatBranchItem>\n}) {\n\tconst expandedIds = new Set<string>()\n\n\tlet current = branchById.get(activeBranchId)\n\twhile (current) {\n\t\tif (current.id !== activeBranchId) {\n\t\t\texpandedIds.add(current.id)\n\t\t}\n\t\tcurrent = current.baseId ? branchById.get(current.baseId) : undefined\n\t}\n\n\treturn expandedIds\n}\n\nfunction flattenBranches({\n\trootId,\n\tbranchById,\n\tchildrenByParentId,\n\texpandedIds,\n}: {\n\trootId: string\n\tbranchById: Map<string, FlatBranchItem>\n\tchildrenByParentId: Map<string, FlatBranchItem[]>\n\texpandedIds: Set<string>\n}): BranchItem[] {\n\tconst flattened: BranchItem[] = []\n\tconst visited = new Set<string>()\n\n\tfunction visit(branch: FlatBranchItem, depth: number) {\n\t\tif (visited.has(branch.id)) return\n\t\tvisited.add(branch.id)\n\n\t\tconst children = childrenByParentId.get(branch.id) ?? []\n\t\tflattened.push({\n\t\t\tid: branch.id,\n\t\t\ttitle: branch.title,\n\t\t\tbaseId: branch.baseId,\n\t\t\tcontributors: branch.contributors,\n\t\t\tcreatedBy: branch.createdBy,\n\t\t\tlastEdited: branch.lastEdited,\n\t\t\tdepth,\n\t\t\thasChildren: children.length > 0,\n\t\t})\n\n\t\tif (branch.id !== rootId && children.length > 0 && !expandedIds.has(branch.id)) return\n\n\t\tconst childDepth = branch.id === rootId ? depth : depth + 1\n\t\tfor (const child of children) {\n\t\t\tvisit(child, childDepth)\n\t\t}\n\t}\n\n\tconst root = branchById.get(rootId)\n\tif (root) visit(root, 0)\n\n\treturn flattened\n}\n", "import \"BranchesPopoutContent.styles_16gey7d.wyw.css\"; export const branchAvatarSize = 16;\nexport const scroll = \"scroll_s7qi4ef\";\nexport const divider = \"divider_dm20vna\";\nexport const dividerBottom = \"dividerBottom_d1gtechv\";\nexport const sticky = \"sticky_sjxphmx\";\nexport const searchBar = \"searchBar_s1ic5218\";\nexport const itemsWrapper = \"itemsWrapper_i1rejca2\";\nexport const mergeButtonWrapper = \"mergeButtonWrapper_mqhvsrs\";\nexport const footerButton = \"footerButton_f1lc05qz\";\nexport const mergeButtonAccent = \"mergeButtonAccent_m8ukft9\";\nexport const mergeButtonMuted = \"mergeButtonMuted_m1jqpg04\";\nexport const lastEditedText = \"lastEditedText_l1c0lwih\";\nexport const lastEditedHidden = \"lastEditedHidden_li8lhse\";\nexport const contextMenuButton = \"contextMenuButton_cu3pqnb\";\nexport const contextMenuButtonSelected = \"contextMenuButtonSelected_ca6kgai\";\nexport const contextMenuVisible = \"contextMenuVisible_c6zkgya\";\nexport const branchRow = \"branchRow_bylo76r\";\nexport const activeBranchRow = \"activeBranchRow_a1mh26gi\";\nexport const caretButton = \"caretButton_cok9ave\";\nexport const caretButtonCollapsed = \"caretButtonCollapsed_cbol4xv\";\nexport const caretButtonHidden = \"caretButtonHidden_c1qdlf3q\";\nexport const branchIconColor = \"branchIconColor_b4wulnq\";\nexport const activeBranchIcon = \"activeBranchIcon_a102els2\";\nexport const branchAvatar = \"branchAvatar_bwbo4r5\";\nexport const branchAvatarRadius = \"branchAvatarRadius_bpijpz6\";\nexport const branchAvatarText = \"branchAvatarText_bs2ox7s\";\nexport const branchName = \"branchName_bcb9xeu\";\nexport const activeBranchName = \"activeBranchName_avgjh02\";\nexport const avatarContainer = \"avatarContainer_apmv3t0\";\nexport const activeAvatarContainer = \"activeAvatarContainer_a8j67pa\";\nexport const rowActions = \"rowActions_r1jcog6w\";\nexport const renameInput = \"renameInput_riikik8\";", "import \"ProjectBarBranch.styles_1xwx1jn.wyw.css\"; export const container = \"container_c1jx7ujd\";\nexport const button = \"button_b19ch0dm\";\nexport const buttonMain = \"buttonMain_b1pr2vnx\";\nexport const createBranchButton = \"createBranchButton_ccgp79i\";", "import \"ProjectMenuButton.styles_1rqpyia.wyw.css\"; export const menuButton = \"menuButton_mzdxepy\";\nexport const menuButtonWithTitle = \"menuButtonWithTitle_mhwxpxa\";\nexport const modeName = \"modeName_mt2eksg\";\nexport const backButton = \"backButton_b1jtypx8\";\nexport const chevron = \"chevron_c1ocfhn0\";", "import { subscribe } from \"@ariakit/core/utils/store\"\nimport { useMenuStore } from \"@ariakit/react\"\nimport { projectBarMenu } from \"@framerjs/app-shared\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport { Experiment } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { getContextMenuItemsWithPath } from \"document/utils/getContextMenuItemsWithPath.ts\"\nimport { filterMenuItems } from \"menu/ContextMenu.tsx\"\nimport { Menu } from \"menu/Menu.tsx\"\nimport { MenuConfigProvider } from \"menu/MenuConfigContext.tsx\"\nimport type { MenuItemOptionsWithPath } from \"menu/types.ts\"\nimport type React from \"react\"\nimport { startTransition, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport type { ActionManager } from \"web/pages/project/lib/ActionManager.ts\"\nimport { vekterGlobal } from \"web/pages/project/lib/TODO.ts\"\nimport type {\n\tMenuItemOptionsWithLabel,\n\tMenuItemOptionsWithLabelOrSeparator,\n} from \"web/pages/project/lib/convertServiceMenuItems.ts\"\nimport * as classes from \"./ProjectMenu.styles.ts\"\nimport { noExitAnimationAttribute } from \"./ProjectMenu.styles.ts\"\nimport { getProjectBarMenuLocation } from \"./projectBarMenuOffset.ts\"\nimport { useHoverTimers } from \"./useHoverTimers.ts\"\n\ninterface Selection {\n\tpath: number[]\n\taction: AppAction | undefined\n\taltKey: boolean\n\tshiftKey: boolean\n\tmetaKey: boolean\n\tctrlKey: boolean\n}\n\ninterface ProjectMenuChildProps {\n\tonClick?: (event: React.MouseEvent<HTMLButtonElement>) => void\n\tonMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void\n\tonPointerEnter?: () => void\n\tonPointerLeave?: () => void\n\ttriggerRef?: React.RefObject<HTMLDivElement>\n}\n\ninterface Props {\n\tchildren: (props: ProjectMenuChildProps) => React.ReactNode | React.ReactNode[]\n}\n\nconst previewRoles: ReadonlySet<string> = new Set([\n\t\"openCanvas\",\n\t\"openCMS\",\n\t\"openLocalization\",\n\t\"openAnalytics\",\n\t\"openSettings\",\n\t\"openEvaluations\",\n])\n\nfunction isPreviewableItem(item: MenuItemOptions): boolean {\n\treturn item.type === \"normal\" && !!item.role && previewRoles.has(item.role) && item.visible !== false\n}\n\nfunction walkMenuTreeForActionPath(\n\tcurrentMenu: MenuItemOptionsWithLabelOrSeparator,\n\tpath: number[],\n\tindex: number,\n\trole: string | undefined,\n\tlabels: string[],\n): string[] | undefined {\n\tif (index < path.length && !currentMenu.submenu) return\n\n\tconst itemIndex = path[index]\n\tassert(isNumber(itemIndex), \"Item index is not a number\")\n\tconst item = currentMenu.submenu?.[itemIndex]\n\n\tif (!item || item.type === \"separator\") return\n\tif (index + 1 === path.length && item.role !== role) return\n\n\tif (index + 1 < path.length) {\n\t\treturn walkMenuTreeForActionPath(item, path, index + 1, role, [...labels, item.label])\n\t}\n\n\treturn labels\n}\n\nfunction trackMenuBarInteraction({\n\tpaths,\n\taction,\n\tmenuOptions,\n}: {\n\tpaths: number[]\n\taction: string\n\tmenuOptions: MenuItemOptionsWithLabel[]\n}) {\n\tlet identifiers: string[] = []\n\n\tfor (const rootMenu of menuOptions) {\n\t\tconst branch = walkMenuTreeForActionPath(rootMenu, paths, 0, action, [rootMenu.label])\n\t\tif (branch?.length) {\n\t\t\tidentifiers = branch\n\t\t\tbreak\n\t\t}\n\t}\n\n\tconst identifier = [...identifiers, action.replace(/([A-Z])/gu, \"-$1\")].join(\"-\").replace(/\\s+/gu, \"-\").toLowerCase()\n\n\trecord(\"ui_interaction\", {\n\t\tpage: \"project-menu-bar\",\n\t\tid: `menu-item-${identifier}`,\n\t})\n}\n\nasync function handlePick(s: Selection, actionManager: ActionManager) {\n\tconst { action, path, ...info } = s\n\tif (!action) return\n\n\ttrackMenuBarInteraction({\n\t\tpaths: path,\n\t\taction,\n\t\tmenuOptions: actionManager.menu.filter(isMenuItemOptionsWithLabel),\n\t})\n\n\treturn actionManager.dispatch(action, info)\n}\n\nfunction isMenuItemOptionsWithLabel(item: MenuItemOptions): item is MenuItemOptionsWithLabel {\n\treturn item.type === \"normal\"\n}\n\nfunction onToggleMenu(open: boolean) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.chromeStore.isProjectMenuOpen = open\n\t}, \"nonUserEvent\")\n}\n\nfunction makeOnSelect(actionManager: ActionManager) {\n\treturn (event: React.MouseEvent, item: { path: number[]; role?: AppAction }) => {\n\t\tconst selection = {\n\t\t\tpath: item.path,\n\t\t\taction: item?.role,\n\t\t\taltKey: event.altKey,\n\t\t\tshiftKey: event.shiftKey,\n\t\t\t// eslint-disable-next-line no-restricted-syntax -- Passed as-is to actions which make their own judgements about the meta key\n\t\t\tmetaKey: event.metaKey,\n\t\t\tctrlKey: event.ctrlKey,\n\t\t}\n\t\thandlePick(selection, actionManager).catch(unhandledError)\n\t}\n}\n\nfunction LegacyProjectMenu({ children }: Props) {\n\tconst handleClick = useCallback(async (event: React.MouseEvent<HTMLButtonElement>) => {\n\t\tconst actionManager = vekterGlobal?.actionManager\n\t\tif (!actionManager) return\n\n\t\tconst triggerRect = event.currentTarget.getBoundingClientRect()\n\t\tawait actionManager.validateMenu(actionManager.menu)\n\n\t\tonToggleMenu(true)\n\n\t\trecord(\"ui_interaction\", { id: \"open-project-menu\", page: \"project-menu-bar\" })\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\tactionManager.menu,\n\t\t\t{\n\t\t\t\tlocation: getProjectBarMenuLocation(triggerRect.left, triggerRect.bottom, false),\n\t\t\t\tonSelect: makeOnSelect(actionManager),\n\t\t\t\tclassName: cx(classes.menu, projectBarMenu),\n\t\t\t\tonDone: () => {\n\t\t\t\t\tonToggleMenu(false)\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"skipValidation\",\n\t\t)\n\t}, [])\n\n\treturn <>{children({ onClick: handleClick })}</>\n}\n\nfunction AgentProjectMenu({ children }: Props) {\n\tconst triggerRef = useRef<HTMLDivElement>(null)\n\tconst { isHoveredRef, scheduleTrigger, scheduleDismiss, cancelTimers } = useHoverTimers()\n\n\tconst mode = useMenuMode()\n\tconst isFullMode = mode.value === \"full\"\n\n\tconst menuStore = useMenuStore({\n\t\tplacement: \"bottom-start\",\n\t\torientation: \"vertical\",\n\t})\n\n\tconst [items, setItems] = useState<readonly MenuItemOptionsWithPath[]>([])\n\tconst [startTime, setStartTime] = useState<number | undefined>()\n\tconst [searchValue, setSearchValue] = useState<string | undefined>(undefined)\n\t// Monotonic token to cancel stale async menu updates.\n\t// Hover-triggered preview opening and click-triggered full opening both await\n\t// `validateMenu()`. Without a token, whichever promise resolves last can overwrite\n\t// the current mode/items (causing preview<->full flicker/reversion).\n\tconst requestIdRef = useRef(0)\n\n\tconst filteredItems = useMemo(() => {\n\t\tif (mode.value !== \"full\" || !searchValue) return items\n\t\treturn filterMenuItems(searchValue, items)\n\t}, [mode.value, items, searchValue])\n\n\tconst handleSearch = useCallback((value: string) => startTransition(() => setSearchValue(value)), [])\n\n\tconst setExitAnimationEnabled = useCallback(\n\t\t(enabled: boolean) => {\n\t\t\tconst popoverElement = menuStore.getState().popoverElement\n\t\t\tif (!popoverElement) return\n\t\t\tif (enabled) {\n\t\t\t\tpopoverElement.removeAttribute(noExitAnimationAttribute)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpopoverElement.setAttribute(noExitAnimationAttribute, \"true\")\n\t\t},\n\t\t[menuStore],\n\t)\n\n\tconst invalidatePendingRequests = useCallback(() => {\n\t\trequestIdRef.current += 1\n\t\tcancelTimers()\n\t}, [cancelTimers])\n\n\tconst resetToIdle = useCallback(() => {\n\t\tinvalidatePendingRequests()\n\t\tisHoveredRef.current = false\n\t\tmode.set(\"idle\")\n\t\tsetStartTime(undefined)\n\t\tsetSearchValue(undefined)\n\t}, [isHoveredRef, mode, invalidatePendingRequests])\n\n\tconst dismiss = useCallback(\n\t\t(animate: boolean = true) => {\n\t\t\tconst wasFullMode = mode.get() === \"full\"\n\t\t\tsetExitAnimationEnabled(animate)\n\t\t\tinvalidatePendingRequests()\n\t\t\tmenuStore.hide()\n\t\t\tif (wasFullMode) {\n\t\t\t\tonToggleMenu(false)\n\t\t\t}\n\t\t},\n\t\t[mode, setExitAnimationEnabled, menuStore, invalidatePendingRequests],\n\t)\n\n\tconst openPreview = useCallback(async () => {\n\t\tif (!triggerRef.current) return\n\t\tif (mode.get() !== \"idle\") return\n\n\t\tinvalidatePendingRequests()\n\t\tconst requestId = requestIdRef.current\n\n\t\tconst actionManager = vekterGlobal?.actionManager\n\t\tif (!actionManager) return\n\n\t\tawait actionManager.validateMenu(actionManager.menu)\n\n\t\tif (requestId !== requestIdRef.current) return\n\t\t// Re-check mode after async validation. The user may have clicked\n\t\t// the trigger in the meantime, which promotes the menu to full mode.\n\t\tif (mode.get() !== \"idle\") return\n\t\tif (!isHoveredRef.current) return\n\n\t\tconst filteredItems = actionManager.menu.filter(isPreviewableItem)\n\t\tif (filteredItems.length === 0) return\n\n\t\tconst itemsWithPath = getContextMenuItemsWithPath(filteredItems, null)\n\t\tmode.set(\"preview\")\n\t\tsetItems(itemsWithPath)\n\t\tsetStartTime(performance.now())\n\t\tsetExitAnimationEnabled(true)\n\t\tmenuStore.show()\n\t}, [mode, menuStore, isHoveredRef, setExitAnimationEnabled, invalidatePendingRequests])\n\n\tconst expandToFull = useCallback(async () => {\n\t\tinvalidatePendingRequests()\n\t\tconst requestId = requestIdRef.current\n\n\t\t// Promote to full mode immediately on click so preview does not linger\n\t\t// while async menu validation is in flight.\n\t\tif (mode.get() !== \"full\") {\n\t\t\tmode.set(\"full\")\n\t\t\tsetSearchValue(\"\")\n\t\t\tonToggleMenu(true)\n\t\t}\n\n\t\tconst actionManager = vekterGlobal?.actionManager\n\t\tif (!actionManager) return\n\n\t\tawait actionManager.validateMenu(actionManager.menu)\n\t\tif (requestId !== requestIdRef.current) return\n\n\t\tif (!menuStore.getState().open) {\n\t\t\tsetExitAnimationEnabled(true)\n\t\t\tmenuStore.show()\n\t\t}\n\n\t\tconst fullItems = getContextMenuItemsWithPath(actionManager.menu, null)\n\t\tsetItems(fullItems)\n\t\tsetStartTime(performance.now())\n\t\trecord(\"ui_interaction\", { id: \"open-project-menu\", page: \"project-menu-bar\" })\n\t}, [mode, menuStore, setExitAnimationEnabled, invalidatePendingRequests])\n\n\tuseEffect(() => {\n\t\tconst unsubscribe = subscribe(menuStore, [\"mounted\"], (state, prevState) => {\n\t\t\tif (prevState.mounted && !state.mounted) {\n\t\t\t\tconst wasFullMode = mode.get() === \"full\"\n\t\t\t\tresetToIdle()\n\t\t\t\t// Clear retained menu items only after the popover unmounts to\n\t\t\t\t// avoid flashing empty content during exit animation.\n\t\t\t\tsetItems([])\n\t\t\t\t// Only notify the chrome store when leaving full mode; preview\n\t\t\t\t// mode never marked the menu as open.\n\t\t\t\tif (wasFullMode) onToggleMenu(false)\n\t\t\t}\n\t\t})\n\t\treturn () => {\n\t\t\tunsubscribe()\n\t\t\tcancelTimers()\n\t\t}\n\t}, [mode, menuStore, resetToIdle, cancelTimers])\n\n\tconst handleSelection = useCallback(\n\t\t(event: React.MouseEvent, item: MenuItemOptionsWithPath) => {\n\t\t\tif (mode.get() === \"full\") {\n\t\t\t\tconst actionManager = vekterGlobal?.actionManager\n\t\t\t\tif (!actionManager) return\n\t\t\t\tconst selection = {\n\t\t\t\t\tpath: item.path,\n\t\t\t\t\taction: item?.role,\n\t\t\t\t\taltKey: event.altKey,\n\t\t\t\t\tshiftKey: event.shiftKey,\n\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- Passed as-is to actions which make their own judgements about the meta key\n\t\t\t\t\tmetaKey: event.metaKey,\n\t\t\t\t\tctrlKey: event.ctrlKey,\n\t\t\t\t}\n\t\t\t\thandlePick(selection, actionManager).catch(unhandledError)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdismiss(false)\n\t\t\tconst actionManager = vekterGlobal?.actionManager\n\t\t\tif (!actionManager || !item.role) return\n\n\t\t\trecord(\"ui_interaction\", { page: \"project-menu-bar\", id: `preview-item-${item.role}` })\n\t\t\tactionManager\n\t\t\t\t.dispatch(item.role, {\n\t\t\t\t\taltKey: event.altKey,\n\t\t\t\t\tshiftKey: event.shiftKey,\n\t\t\t\t\t// eslint-disable-next-line no-restricted-syntax -- Passed as-is to actions which make their own judgements about the meta key\n\t\t\t\t\tmetaKey: event.metaKey,\n\t\t\t\t\tctrlKey: event.ctrlKey,\n\t\t\t\t})\n\t\t\t\t.catch(unhandledError)\n\t\t},\n\t\t[mode, dismiss],\n\t)\n\n\tconst getAnchorRect = useCallback(() => {\n\t\tconst el = triggerRef.current\n\t\tif (!el) return null\n\t\tconst rect = el.getBoundingClientRect()\n\t\tconst loc = getProjectBarMenuLocation(rect.left, rect.bottom, true)\n\t\treturn { x: loc.x, y: loc.y, width: 0, height: 0, top: loc.y, bottom: loc.y, left: loc.x, right: loc.x }\n\t}, [])\n\n\tconst hideOnInteractOutside = useCallback((event: Event) => {\n\t\tconst trigger = triggerRef.current\n\t\tconst target = event.target\n\t\tif (!trigger || !(target instanceof Node)) return true\n\t\treturn !trigger.contains(target)\n\t}, [])\n\n\tconst handleMenuPointerEnter = useCallback(() => {\n\t\tisHoveredRef.current = true\n\t\tcancelTimers()\n\t}, [isHoveredRef, cancelTimers])\n\n\tconst handleMenuPointerLeave = useCallback(() => {\n\t\tisHoveredRef.current = false\n\t\tif (mode.get() === \"full\") return\n\t\tcancelTimers()\n\t\tscheduleDismiss(() => {\n\t\t\tdismiss()\n\t\t})\n\t}, [mode, isHoveredRef, cancelTimers, scheduleDismiss, dismiss])\n\n\tconst menuProps = useMemo(\n\t\t() => ({\n\t\t\tstore: menuStore,\n\t\t\tgetAnchorRect,\n\t\t\tclassName: cx(classes.menu, projectBarMenu),\n\t\t\t// Opening on mousedown means the same click sequence is still in flight.\n\t\t\t// If the menu is modal here, Ariakit's backdrop can receive that click\n\t\t\t// and immediately dismiss the menu (flash-open/close).\n\t\t\tmodal: false,\n\t\t\thideOnInteractOutside,\n\t\t\tonPointerEnter: handleMenuPointerEnter,\n\t\t\tonPointerLeave: handleMenuPointerLeave,\n\t\t}),\n\t\t[menuStore, getAnchorRect, hideOnInteractOutside, handleMenuPointerEnter, handleMenuPointerLeave],\n\t)\n\n\tconst handlePointerEnter = useCallback(() => {\n\t\tif (mode.get() === \"full\") return\n\t\tisHoveredRef.current = true\n\t\tcancelTimers()\n\t\tscheduleTrigger(() => openPreview().catch(unhandledError))\n\t}, [mode, cancelTimers, scheduleTrigger, openPreview, isHoveredRef])\n\n\tconst handlePointerLeave = useCallback(() => {\n\t\tif (mode.get() === \"full\") return\n\t\tcancelTimers()\n\t\tscheduleDismiss(() => {\n\t\t\tdismiss()\n\t\t})\n\t\tisHoveredRef.current = false\n\t}, [mode, isHoveredRef, dismiss, cancelTimers, scheduleDismiss])\n\n\tconst handleMouseDown = useCallback(\n\t\t(event: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\tif (mode.get() === \"full\") {\n\t\t\t\tdismiss(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.stopPropagation()\n\t\t\texpandToFull().catch(unhandledError)\n\t\t},\n\t\t[mode, expandToFull, dismiss],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t{children({\n\t\t\t\tonClick: undefined,\n\t\t\t\tonMouseDown: handleMouseDown,\n\t\t\t\tonPointerEnter: handlePointerEnter,\n\t\t\t\tonPointerLeave: handlePointerLeave,\n\t\t\t\ttriggerRef,\n\t\t\t})}\n\t\t\t<MenuConfigProvider startTime={startTime} mouseDidMove closeOnSelect>\n\t\t\t\t<Menu\n\t\t\t\t\tunsaturated\n\t\t\t\t\titems={filteredItems}\n\t\t\t\t\tmenuProps={menuProps}\n\t\t\t\t\tonSelection={handleSelection}\n\t\t\t\t\tsearchValue={isFullMode ? searchValue : undefined}\n\t\t\t\t\tonSearch={handleSearch}\n\t\t\t\t/>\n\t\t\t</MenuConfigProvider>\n\t\t</>\n\t)\n}\n\ntype MenuMode = \"idle\" | \"preview\" | \"full\"\n\ninterface MenuModeHandle {\n\tvalue: MenuMode\n\tset: (next: MenuMode) => void\n\tget: () => MenuMode\n}\n\nfunction useMenuMode(): MenuModeHandle {\n\tconst [value, setValue] = useState<MenuMode>(\"idle\")\n\tconst ref = useRef<MenuMode>(\"idle\")\n\n\tconst set = useCallback((next: MenuMode) => {\n\t\tref.current = next\n\t\tsetValue(next)\n\t}, [])\n\n\tconst get = useCallback(() => ref.current, [])\n\n\treturn useMemo(() => ({ value, set, get }), [value, set, get])\n}\n\nexport function ProjectMenu({ children }: Props) {\n\treturn (\n\t\t<>\n\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t<AgentProjectMenu>{children}</AgentProjectMenu>\n\t\t\t</Experiment>\n\t\t\t<Experiment isNotOn=\"agent\">\n\t\t\t\t<LegacyProjectMenu>{children}</LegacyProjectMenu>\n\t\t\t</Experiment>\n\t\t</>\n\t)\n}\n", "import \"ProjectMenu.styles_viv09f.wyw.css\"; export const noExitAnimationAttribute = \"data-no-exit-animation\";\nexport const menu = \"menu_mnqig5c\";", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { menuGutter } from \"menu/Menu.styles.ts\"\n\n/** Base visual gap (px) between a project-bar element's bottom edge and its menu. */\nexport const projectBarMenuGapPx = 10\n\n/**\n * 1px nudge so the menu's top border optically aligns with the\n * topbar's bottom border.\n */\nexport const projectBarOpticalAlignPx = 1\n\n/**\n * When an Ariakit root-level `<Menu>` is used (instead of ContextMenuStore),\n * it adds a built-in gutter. Subtract it so the visual gap stays the same.\n */\nexport const ariakitRootMenuGutterCompensation = -menuGutter\n\nexport function getProjectBarMenuLocation(triggerLeft: number, triggerBottom: number, ariakitRootMenu: boolean) {\n\treturn {\n\t\tx: triggerLeft + dimensions.values.contextMenuOffsetX,\n\t\ty:\n\t\t\ttriggerBottom +\n\t\t\tprojectBarMenuGapPx +\n\t\t\tprojectBarOpticalAlignPx +\n\t\t\t(ariakitRootMenu ? ariakitRootMenuGutterCompensation : 0),\n\t}\n}\n", "export function IconFramerLogo() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"15\">\n\t\t\t<path d=\"M10 0v5H5L0 0ZM0 5h5l5 5H5v5l-5-5Z\" fill=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "import { Button, CenterChild, IconInputDropdown, Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { ProjectMenu } from \"./ProjectMenu.tsx\"\nimport * as styles from \"./ProjectMenuButton.styles.ts\"\nimport { IconFramerLogo } from \"./icons/IconFramerLogo.tsx\"\n\ninterface Props {\n\ttitle?: string\n}\n\nexport function ProjectMenuButton({ title }: Props) {\n\treturn (\n\t\t<ProjectMenu>\n\t\t\t{({ onClick, onMouseDown, onPointerEnter, onPointerLeave, triggerRef }) => (\n\t\t\t\t<div ref={triggerRef} onPointerEnter={onPointerEnter} onPointerLeave={onPointerLeave}>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"withDepth\"\n\t\t\t\t\t\tdata-testid=\"projectbar-menu-button\"\n\t\t\t\t\t\taria-label={title ? undefined : \"Menu\"}\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tonMouseDown={onMouseDown}\n\t\t\t\t\t\tclassName={cx(styles.menuButton, title && styles.menuButtonWithTitle)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"center\" gap={8}>\n\t\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t\t<IconFramerLogo />\n\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t{title && <span className={styles.modeName}>{title}</span>}\n\t\t\t\t\t\t\t<span className={cx(styles.chevron)}>\n\t\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</ProjectMenu>\n\t)\n}\n", "import { ProjectBarButton, Stack } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport { appAccelerators, getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EmployeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { Experiment, experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveLeftPanel, ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { ToolbarType, getToolbarType } from \"../shared/utils/toolbarHelpers.ts\"\nimport { AnalyticsToolbarItems } from \"./AnalyticsToolbarItems.tsx\"\nimport { dismissInsertTooltip } from \"./InsertButtonTooltip.tsx\"\nimport { LocalizationToolbarItems } from \"./LocalizationToolbarItems.tsx\"\nimport * as styles from \"./Toolbar.styles.ts\"\nimport { ToolbarItem } from \"./ToolbarItem.tsx\"\nimport { IconAi } from \"./icons/IconAi.tsx\"\nimport { IconCMS } from \"./icons/IconCMS.tsx\"\nimport { IconCMSFill } from \"./icons/IconCMSFill.tsx\"\nimport { getToolbarIconSet, isLayoutTool, isShapeTool } from \"./icons/toolbarIconSet.ts\"\nimport { ariakitRootMenuGutterCompensation, projectBarOpticalAlignPx } from \"./projectBarMenuOffset.ts\"\nimport { usePluginsFromToolbar } from \"./usePluginsFromToolbar.ts\"\n\nconst shapeTools = [\n\tTools.Path,\n\tTools.CreateRectangleShape,\n\tTools.CreateOvalShape,\n\tTools.CreatePolygonShape,\n\tTools.CreateStarShape,\n] as const\n\ntype ShapeTool = (typeof shapeTools)[number]\n\nfunction titleForShapeTool(tool: ShapeTool): string {\n\tswitch (tool) {\n\t\tcase Tools.Path:\n\t\t\treturn Dictionary.Path\n\t\tcase Tools.CreateRectangleShape:\n\t\t\treturn Dictionary.Rectangle\n\t\tcase Tools.CreateOvalShape:\n\t\t\treturn Dictionary.Oval\n\t\tcase Tools.CreatePolygonShape:\n\t\t\treturn Dictionary.Polygon\n\t\tcase Tools.CreateStarShape:\n\t\t\treturn Dictionary.Star\n\t}\n}\n\nconst openVariablesModal = () => engine.stores.modalStore.set({ type: ModalType.Variables, source: \"toolbar\" })\n\nexport const Toolbar = React.memo(function Toolbar() {\n\tconst { codeEditorStore, toolStore, scopeStore, modalStore, loadingStore, chromeStore } = engine.stores\n\tconst { tool } = toolStore.useState()\n\tconst { mainView, leftPanel, isPreviewingLocaleOnCanvas, overlay } = chromeStore.useState()\n\tconst isCollectionItemOverlayActive = overlay?.type === \"collectionItem\"\n\n\tconst isViewOnly = useIsViewOnly(\"canDesign\") || isPreviewingLocaleOnCanvas || isCollectionItemOverlayActive\n\tconst hasMinimalEditableData = loadingStore.useState(state => state.hasMinimalEditableData)\n\tconst isCodeEditorOpen = mainView === ActiveMainView.CodeEditor\n\tconst contentManagementSidebarVisible = leftPanel === ActiveLeftPanel.ContentManagement\n\tconst aiSidebarVisible = leftPanel === ActiveLeftPanel.Ai\n\tconst insertActive = leftPanel === ActiveLeftPanel.Insert\n\tconst activeModal = modalStore.useState(state => state.active)\n\tconst isCodeImportActive =\n\t\tactiveModal.type === ModalType.QuickActions &&\n\t\tactiveModal.initialCategory?.type === QuickActionsCategoryType.CodeImport\n\n\tconst { isSelectingPlugin, showPluginQuickActions } = usePluginsFromToolbar()\n\n\tconst { shouldShowVariablesButton, activeScopeType } = scopeStore.useState(state => {\n\t\treturn {\n\t\t\tshouldShowVariablesButton:\n\t\t\t\twithVariables(state.active) &&\n\t\t\t\t// We intentionally want to keep the Variables button hidden for web pages\n\t\t\t\t// to keep the UI simple. The modal will be accessible when clicking on assigned variables.\n\t\t\t\t!isWebPageNode(state.active),\n\t\t\tactiveScopeType: state.scopeType,\n\t\t}\n\t})\n\n\tconst { versionHistoryActive } = codeEditorStore.useState()\n\tconst onCloseVersionHistory = useEngineCallback(() => {\n\t\tcodeEditorStore.versionHistoryActive = false\n\t}, [codeEditorStore])\n\tconst onToggleVersionHistory = useEngineCallback(() => {\n\t\tcodeEditorStore.versionHistoryActive = !codeEditorStore.versionHistoryActive\n\t}, [codeEditorStore])\n\n\tconst onPublishModule = useEngineCallback(() => {\n\t\tonCloseVersionHistory()\n\t\tmodalStore.set({ type: ModalType.PublishModule, source: \"toolbar\" })\n\t}, [onCloseVersionHistory, modalStore.set])\n\n\tconst showInsertMenu = useEngineCallback(() => {\n\t\tif (isViewOnly) return\n\t\tchromeStore.chromeIsVisible = true\n\n\t\tif (!isCodeEditorOpen) {\n\t\t\tengine.stores.chromeStore.toggleInsertSidebar()\n\t\t\tdismissInsertTooltip()\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tid: Pages.insertSidebar,\n\t\t\t\tpage: Pages.toolbar,\n\t\t\t})\n\t\t} else {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\tinitialCategory: { type: QuickActionsCategoryType.CodeImport },\n\t\t\t\tsource: \"main_menu\",\n\t\t\t})\n\t\t\trecord(\"ui_interaction\", { page: Pages.toolbar, id: UIInteraction.codeImport })\n\t\t}\n\n\t\tonCloseVersionHistory()\n\t\tengine.cancelTool()\n\t}, [isViewOnly, isCodeEditorOpen, onCloseVersionHistory, chromeStore])\n\n\tconst showAiMenu = useEngineCallback(() => {\n\t\tif (isViewOnly) return\n\t\tchromeStore.chromeIsVisible = true\n\t\tengine.stores.chromeStore.toggleAiSidebar()\n\t}, [isViewOnly, chromeStore])\n\n\tconst setTool = useEngineCallback(\n\t\t(newTool: Tools) => {\n\t\t\tif (tool === newTool) return engine.setTool(Tools.Highlight)\n\t\t\tif (newTool === Tools.Path) engine.stores.selectionStore.clear()\n\t\t\tengine.setTool(newTool)\n\t\t},\n\t\t[tool],\n\t)\n\n\tconst webBarHeight = useDimensionValue(\"webBarHeight\")\n\tconst agentMenuAnchorOffset = projectBarOpticalAlignPx + ariakitRootMenuGutterCompensation\n\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst toolbarMenuAnchorY = webBarHeight + (agentExperimentEnabled ? agentMenuAnchorOffset : 0)\n\tconst layoutMenuStackEnabled = useExperimentIsOn(\"layoutMenuStack\")\n\tconst toolbarIconSet = getToolbarIconSet(agentExperimentEnabled)\n\n\tconst [layoutMenuActive, setLayoutMenuActive] = React.useState<boolean>(false)\n\tconst [shapeMenuActive, setShapeMenuActive] = React.useState<boolean>(false)\n\tconst layoutButtonRef = React.createRef<HTMLDivElement>()\n\tconst showLayoutMenu = React.useCallback(\n\t\t(_tool: Tools, event: React.MouseEvent) => {\n\t\t\tconst layoutMenuOptions: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateFrame),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateFrame),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateFrame,\n\t\t\t\t\tclick: () => setTool(Tools.CreateFrame),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateStack),\n\t\t\t\t\tvisible: layoutMenuStackEnabled,\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateColumns),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateStack,\n\t\t\t\t\tclick: () => setTool(Tools.CreateStack),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateRows),\n\t\t\t\t\tvisible: !layoutMenuStackEnabled,\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateRows),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateRows,\n\t\t\t\t\tclick: () => setTool(Tools.CreateRows),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateColumns),\n\t\t\t\t\tvisible: !layoutMenuStackEnabled,\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateColumns),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateColumns,\n\t\t\t\t\tclick: () => setTool(Tools.CreateColumns),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateGrid),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateGrid),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateGrid,\n\t\t\t\t\tclick: () => setTool(Tools.CreateGrid),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateMasonry),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateMasonry),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateMasonry,\n\t\t\t\t\tclick: () => setTool(Tools.CreateMasonry),\n\t\t\t\t\tvisible: experiments.isOn(\"masonryLayout\"),\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateImage),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateImage),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateImage,\n\t\t\t\t\tclick: () => setTool(Tools.CreateImage),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForLayoutTool(Tools.CreateVideo),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.layoutMenuByTool(Tools.CreateVideo),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: toolbarIconSet.size,\n\t\t\t\t\t\theight: toolbarIconSet.size,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateVideo,\n\t\t\t\t\tclick: () => setTool(Tools.CreateVideo),\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tconst { clientX, clientY } = event\n\t\t\tlet position = { x: clientX, y: clientY }\n\n\t\t\tif (layoutButtonRef.current) {\n\t\t\t\tconst rect = layoutButtonRef.current.getBoundingClientRect()\n\t\t\t\tconst y = toolbarMenuAnchorY\n\t\t\t\tconst x = rect.left\n\t\t\t\tposition = { x, y }\n\t\t\t}\n\n\t\t\tsetLayoutMenuActive(true)\n\t\t\tengine.stores.contextMenuStore.show(layoutMenuOptions, {\n\t\t\t\tlocation: position,\n\t\t\t\tclassName: styles.layoutMenu,\n\t\t\t\tonDone: () => setLayoutMenuActive(false),\n\t\t\t})\n\t\t},\n\t\t[layoutButtonRef, layoutMenuStackEnabled, setTool, toolbarMenuAnchorY, toolbarIconSet],\n\t)\n\n\tconst shapeMenuRef = React.createRef<HTMLDivElement>()\n\tconst isVectorScope = activeScopeType === ScopeType.VectorSet\n\tconst showShapeMenu = React.useCallback(\n\t\t(_tool: Tools, event: React.MouseEvent) => {\n\t\t\tconst shapeMenuOptions: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForShapeTool(Tools.CreateRectangleShape),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.shapeMenuByTool(Tools.CreateRectangleShape),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: 20,\n\t\t\t\t\t\theight: 20,\n\t\t\t\t\t},\n\t\t\t\t\taccelerator: appAccelerators.toolCreateRectangleShape,\n\t\t\t\t\tclick: () => setTool(Tools.CreateRectangleShape),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForShapeTool(Tools.CreateOvalShape),\n\t\t\t\t\ticon: { src: toolbarIconSet.shapeMenuByTool(Tools.CreateOvalShape), inlineSVG: true, width: 20, height: 20 },\n\t\t\t\t\taccelerator: appAccelerators.toolCreateOvalShape,\n\t\t\t\t\tclick: () => setTool(Tools.CreateOvalShape),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForShapeTool(Tools.CreatePolygonShape),\n\t\t\t\t\ticon: {\n\t\t\t\t\t\tsrc: toolbarIconSet.shapeMenuByTool(Tools.CreatePolygonShape),\n\t\t\t\t\t\tinlineSVG: true,\n\t\t\t\t\t\twidth: 20,\n\t\t\t\t\t\theight: 20,\n\t\t\t\t\t},\n\t\t\t\t\tclick: () => setTool(Tools.CreatePolygonShape),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForShapeTool(Tools.CreateStarShape),\n\t\t\t\t\ticon: { src: toolbarIconSet.shapeMenuByTool(Tools.CreateStarShape), inlineSVG: true, width: 20, height: 20 },\n\t\t\t\t\tclick: () => setTool(Tools.CreateStarShape),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: titleForShapeTool(Tools.Path),\n\t\t\t\t\ticon: { src: toolbarIconSet.shapeMenuByTool(Tools.Path), inlineSVG: true, width: 20, height: 20 },\n\t\t\t\t\taccelerator: appAccelerators.toolPath,\n\t\t\t\t\tclick: () => setTool(Tools.Path),\n\t\t\t\t\tvisible: !isVectorScope,\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tconst { clientX, clientY } = event\n\t\t\tlet position = { x: clientX, y: clientY }\n\n\t\t\tif (shapeMenuRef.current) {\n\t\t\t\tconst rect = shapeMenuRef.current.getBoundingClientRect()\n\t\t\t\tconst y = toolbarMenuAnchorY\n\t\t\t\tconst x = rect.left\n\t\t\t\tposition = { x, y }\n\t\t\t}\n\n\t\t\tsetShapeMenuActive(true)\n\t\t\tengine.stores.contextMenuStore.show(shapeMenuOptions, {\n\t\t\t\tlocation: position,\n\t\t\t\tclassName: styles.layoutMenu,\n\t\t\t\tonDone: () => setShapeMenuActive(false),\n\t\t\t})\n\t\t},\n\t\t[shapeMenuRef, setTool, isVectorScope, toolbarMenuAnchorY, toolbarIconSet],\n\t)\n\n\tconst toggleContentManagement = useEngineCallback(() => {\n\t\tonCloseVersionHistory()\n\n\t\trecord(\"ui_interaction\", {\n\t\t\tid: Pages.collectionPanel,\n\t\t\tpage: Pages.toolbar,\n\t\t})\n\n\t\tContextAction.toggleContentManagementScope(engine)\n\t}, [onCloseVersionHistory])\n\n\tconst onCreateCodeFile = useEngineCallback(() => {\n\t\tonCloseVersionHistory()\n\t\tengine.stores.modalStore.set({ type: ModalType.CodeFileCreation, source: \"toolbar\" })\n\t}, [onCloseVersionHistory])\n\n\tconst toolbarType = getToolbarType(mainView, isVectorScope)\n\n\tconst triggerRef = React.useRef<HTMLDivElement>(null)\n\n\tfunction getTools(): React.ReactNode {\n\t\tconst insertTooltip = getTooltip(\"toggleInsert\")\n\t\tconst textTooltip = getTooltip(\"toolCreateText\")\n\t\tconst vectorTooltip = getVectorTooltip(tool)\n\t\tconst cmsTooltip = getTooltip(\"toggleContentManagement\")\n\n\t\tconst pathTooltip = getTooltip(\"toolPath\")\n\t\tconst shapeTooltip = getShapeTooltip(tool)\n\n\t\tconst layoutTooltip = getLayoutTooltip(tool)\n\n\t\tswitch (toolbarType) {\n\t\t\tcase ToolbarType.Default:\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={styles.desktopOnlyToolbarItem} ref={triggerRef}>\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.Insert}\n\t\t\t\t\t\t\t\ttooltip={insertTooltip.text}\n\t\t\t\t\t\t\t\ttooltipShortcut={insertTooltip.shortcut}\n\t\t\t\t\t\t\t\ticon={toolbarIconSet.insert}\n\t\t\t\t\t\t\t\tselected={insertActive}\n\t\t\t\t\t\t\t\tonClick={showInsertMenu}\n\t\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{experiments.isOn(\"wireframerKits\") && (\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ticon={IconAi}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Ai}\n\t\t\t\t\t\t\t\tselected={aiSidebarVisible}\n\t\t\t\t\t\t\t\tonClick={showAiMenu}\n\t\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={layoutButtonRef}\n\t\t\t\t\t\t\ticon={isLayoutTool(tool) ? toolbarIconSet.layoutButtonByTool(tool) : toolbarIconSet.layout}\n\t\t\t\t\t\t\ttitle={titleForLayoutTool(tool)}\n\t\t\t\t\t\t\ttooltip={layoutTooltip.text}\n\t\t\t\t\t\t\ttooltipShortcut={layoutTooltip.shortcut}\n\t\t\t\t\t\t\tselected={layoutMenuActive || isLayoutToolSelected(tool)}\n\t\t\t\t\t\t\tonMouseDown={showLayoutMenu}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttool={Tools.CreateText}\n\t\t\t\t\t\t\ticon={toolbarIconSet.text}\n\t\t\t\t\t\t\ttitle={Dictionary.Text}\n\t\t\t\t\t\t\ttooltip={textTooltip.text}\n\t\t\t\t\t\t\ttooltipShortcut={textTooltip.shortcut}\n\t\t\t\t\t\t\tselected={tool === Tools.CreateText}\n\t\t\t\t\t\t\tonClick={setTool}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\ttitle={titleForVectorTool(tool)}\n\t\t\t\t\t\t\ttooltip={vectorTooltip.text}\n\t\t\t\t\t\t\ttooltipShortcut={vectorTooltip.shortcut}\n\t\t\t\t\t\t\tref={shapeMenuRef}\n\t\t\t\t\t\t\ticon={isShapeTool(tool) ? toolbarIconSet.shapeButtonByTool(tool) : toolbarIconSet.vector}\n\t\t\t\t\t\t\tselected={shapeMenuActive || isVectorToolSelected(tool)}\n\t\t\t\t\t\t\tonMouseDown={showShapeMenu}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Experiment isNotOn=\"agent\">\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ticon={IconCMS}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Cms}\n\t\t\t\t\t\t\t\ttooltip={cmsTooltip.text}\n\t\t\t\t\t\t\t\ttooltipShortcut={cmsTooltip.shortcut}\n\t\t\t\t\t\t\t\tselected={contentManagementSidebarVisible}\n\t\t\t\t\t\t\t\tonClick={toggleContentManagement}\n\t\t\t\t\t\t\t\tenabled={hasMinimalEditableData && !isCollectionItemOverlayActive}\n\t\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ProjectBarButton\n\t\t\t\t\t\t\t\tround\n\t\t\t\t\t\t\t\tclassName={cx(styles.mobileOnlyToolbarItem)}\n\t\t\t\t\t\t\t\tonClick={toggleContentManagement}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Cms}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Stack justifyContent=\"center\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t\t\t\t\t\t<IconCMSFill />\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t</ProjectBarButton>\n\t\t\t\t\t\t</Experiment>\n\n\t\t\t\t\t\t{shouldShowVariablesButton && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\t\t\ttitle={Dictionary.Variables}\n\t\t\t\t\t\t\t\t\ticon={toolbarIconSet.variables}\n\t\t\t\t\t\t\t\t\tselected={activeModal.type === ModalType.Variables}\n\t\t\t\t\t\t\t\t\tonClick={openVariablesModal}\n\t\t\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\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\t * Do not remove the moduleTools. We use them to update Smart Components\n\t\t\t\t\t\t\t\t * that are used in the insert menu.\n\t\t\t\t\t\t\t\t */}\n\t\t\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"moduleTools\">\n\t\t\t\t\t\t\t\t\t{activeScopeType === ScopeType.SmartComponent && (\n\t\t\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\t\t\ttitle={Dictionary.Publish}\n\t\t\t\t\t\t\t\t\t\t\ticon={toolbarIconSet.publish}\n\t\t\t\t\t\t\t\t\t\t\tselected={activeModal.type === ModalType.PublishModule}\n\t\t\t\t\t\t\t\t\t\t\tonClick={onPublishModule}\n\t\t\t\t\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</EmployeesOnlySettings>\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\tcase ToolbarType.VectorSet:\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttool={Tools.Path}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\ttitle={Dictionary.Path}\n\t\t\t\t\t\t\ttooltip={pathTooltip.text}\n\t\t\t\t\t\t\ttooltipShortcut={pathTooltip.shortcut}\n\t\t\t\t\t\t\ticon={toolbarIconSet.shapeButtonByTool(Tools.Path)}\n\t\t\t\t\t\t\tselected={tool === Tools.Path}\n\t\t\t\t\t\t\tonClick={setTool}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={shapeMenuRef}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\ttitle={getShapeTitle(tool)}\n\t\t\t\t\t\t\ttooltip={shapeTooltip.text}\n\t\t\t\t\t\t\ttooltipShortcut={shapeTooltip.shortcut}\n\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\tisShapeTool(tool) && tool !== Tools.Path\n\t\t\t\t\t\t\t\t\t? toolbarIconSet.shapeButtonByTool(tool)\n\t\t\t\t\t\t\t\t\t: toolbarIconSet.vector\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tselected={shapeMenuActive || isShapeToolSelected(tool)}\n\t\t\t\t\t\t\tonMouseDown={showShapeMenu}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\ttitle={Dictionary.Variables}\n\t\t\t\t\t\t\ticon={toolbarIconSet.variables}\n\t\t\t\t\t\t\tselected={activeModal.type === ModalType.Variables}\n\t\t\t\t\t\t\tonClick={openVariablesModal}\n\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"moduleTools\">\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.Publish}\n\t\t\t\t\t\t\t\ticon={toolbarIconSet.publish}\n\t\t\t\t\t\t\t\tselected={activeModal.type === ModalType.PublishModule}\n\t\t\t\t\t\t\t\tonClick={onPublishModule}\n\t\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\t\tclassName={styles.desktopOnlyToolbarItem}\n\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</EmployeesOnlySettings>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\tcase ToolbarType.Code:\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttitle=\"New File\"\n\t\t\t\t\t\t\ticon={toolbarIconSet.insert}\n\t\t\t\t\t\t\tselected={activeModal.type === ModalType.CodeFileCreation}\n\t\t\t\t\t\t\tonClick={onCreateCodeFile}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttitle=\"Import\"\n\t\t\t\t\t\t\ticon={toolbarIconSet.import}\n\t\t\t\t\t\t\tselected={isCodeImportActive}\n\t\t\t\t\t\t\tonClick={showInsertMenu}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"moduleTools\">\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ttitle=\"Versions\"\n\t\t\t\t\t\t\t\ticon={toolbarIconSet.versions}\n\t\t\t\t\t\t\t\tselected={versionHistoryActive}\n\t\t\t\t\t\t\t\tonClick={onToggleVersionHistory}\n\t\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</EmployeesOnlySettings>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\ttitle={Dictionary.Plugins}\n\t\t\t\t\t\t\ticon={toolbarIconSet.plugins}\n\t\t\t\t\t\t\tselected={isSelectingPlugin}\n\t\t\t\t\t\t\tonClick={showPluginQuickActions}\n\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"moduleTools\">\n\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\ttitle={Dictionary.Publish}\n\t\t\t\t\t\t\t\ticon={toolbarIconSet.publish}\n\t\t\t\t\t\t\t\tselected={activeModal.type === ModalType.PublishModule}\n\t\t\t\t\t\t\t\tonClick={onPublishModule}\n\t\t\t\t\t\t\t\tenabled\n\t\t\t\t\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</EmployeesOnlySettings>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\tcase ToolbarType.ContentManagement:\n\t\t\t\treturn null\n\t\t\tcase ToolbarType.Localizations:\n\t\t\t\treturn <LocalizationToolbarItems />\n\t\t\tcase ToolbarType.Analytics:\n\t\t\t\treturn <AnalyticsToolbarItems />\n\t\t\tdefault:\n\t\t\t\tassertNever(toolbarType)\n\t\t}\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName={cx(styles.bar, styles.toolsBreakpoint(toolbarType))}\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\tgap={0}\n\t\t>\n\t\t\t<Stack gap={5} direction=\"row\" alignItems=\"center\">\n\t\t\t\t{getTools()}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n\nfunction getTooltip(actionType: AppAction): { text: string; shortcut?: string } {\n\tconst actionLabel = actionLabels[actionType]\n\tif (!actionLabel) return { text: \"\" }\n\n\tconst actionAccelerator = getActionAccelerator(actionType)\n\tif (!actionAccelerator) return { text: actionLabel }\n\n\treturn { text: actionLabel, shortcut: getAcceleratorTokens(actionAccelerator).join(\"\") }\n}\n\nfunction titleForLayoutTool(tool: Tools) {\n\tswitch (tool) {\n\t\tcase Tools.CreateFrame:\n\t\t\treturn Dictionary.Frame\n\t\tcase Tools.CreateRounded:\n\t\t\treturn Dictionary.Rounded\n\t\tcase Tools.CreateImage:\n\t\t\treturn Dictionary.Image\n\t\tcase Tools.CreateStack:\n\t\t\treturn Dictionary.Stack\n\t\tcase Tools.CreateRows:\n\t\t\treturn Dictionary.Rows\n\t\tcase Tools.CreateColumns:\n\t\t\treturn Dictionary.Columns\n\t\tcase Tools.CreateGrid:\n\t\t\treturn Dictionary.Grid\n\t\tcase Tools.CreateMasonry:\n\t\t\treturn Dictionary.Masonry\n\t\tcase Tools.CreateVideo:\n\t\t\treturn Dictionary.Video\n\t\tdefault:\n\t\t\treturn Dictionary.Layout\n\t}\n}\n\nfunction isLayoutToolSelected(tool: Tools) {\n\treturn (\n\t\ttool === Tools.CreateFrame ||\n\t\ttool === Tools.CreateRounded ||\n\t\ttool === Tools.CreateImage ||\n\t\ttool === Tools.CreateRows ||\n\t\ttool === Tools.CreateColumns ||\n\t\ttool === Tools.CreateGrid ||\n\t\ttool === Tools.CreateMasonry ||\n\t\ttool === Tools.CreateStack ||\n\t\ttool === Tools.CreateVideo\n\t)\n}\n\nfunction getLayoutTooltip(tool: Tools): { text: string; shortcut?: string } {\n\tif (!isLayoutTool(tool)) return { text: Dictionary.Layout }\n\treturn getTooltip(Tools.actionForCase(tool))\n}\n\nfunction isShapeToolSelected(tool: Tools) {\n\treturn (\n\t\ttool === Tools.CreateOvalShape ||\n\t\ttool === Tools.CreateRectangleShape ||\n\t\ttool === Tools.CreatePolygonShape ||\n\t\ttool === Tools.CreateStarShape\n\t)\n}\n\nfunction isVectorToolSelected(tool: Tools) {\n\treturn isShapeToolSelected(tool) || tool === Tools.Path\n}\n\nfunction titleForVectorTool(tool: Tools): string {\n\tif (isShapeToolSelected(tool) || tool === Tools.Path) return titleForShapeTool(tool)\n\treturn Dictionary.Vector\n}\n\nfunction getVectorTooltip(tool: Tools): { text: string; shortcut?: string } {\n\tif (!isShapeToolSelected(tool) && tool !== Tools.Path) return { text: Dictionary.Vector }\n\treturn getTooltip(Tools.actionForCase(tool))\n}\n\nfunction getShapeTitle(tool: Tools): string {\n\tif (!isShapeToolSelected(tool)) return Dictionary.Shape\n\treturn titleForShapeTool(tool)\n}\n\nfunction getShapeTooltip(tool: Tools): { text: string; shortcut?: string } {\n\tif (!isShapeToolSelected(tool)) return { text: Dictionary.Shape }\n\treturn getTooltip(Tools.actionForCase(tool))\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\n\nexport enum ToolbarType {\n\tDefault,\n\tCode,\n\tContentManagement,\n\tLocalizations,\n\tAnalytics,\n\tVectorSet,\n}\n\nexport function getToolbarType(mainView: ActiveMainView, isVectorScope: boolean): ToolbarType {\n\tswitch (mainView) {\n\t\tcase ActiveMainView.Localizations:\n\t\t\treturn ToolbarType.Localizations\n\t\tcase ActiveMainView.ContentManagement:\n\t\t\treturn ToolbarType.ContentManagement\n\t\tcase ActiveMainView.CodeEditor:\n\t\t\treturn ToolbarType.Code\n\t\tcase ActiveMainView.Analytics:\n\t\t\treturn ToolbarType.Analytics\n\t\tcase ActiveMainView.SiteSettings:\n\t\tcase ActiveMainView.Preview:\n\t\tcase ActiveMainView.Canvas:\n\t\t\treturn isVectorScope ? ToolbarType.VectorSet : ToolbarType.Default\n\t\tdefault:\n\t\t\tassertNever(mainView, \"Unknown main view\")\n\t}\n}\n", "import { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\nimport { rotateElement } from \"../shared/utils/rotateElement.ts\"\nimport { ToolbarItem } from \"./ToolbarItem.tsx\"\nimport { getToolbarIconSet } from \"./icons/toolbarIconSet.ts\"\n\nexport function AnalyticsToolbarItems() {\n\tconst reloadIconRef = React.useRef<SVGSVGElement>(null)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst toolbarIconSet = getToolbarIconSet(agentExperimentEnabled)\n\tconst ReloadIcon = toolbarIconSet.reload\n\n\tconst handleReload = React.useCallback(() => {\n\t\tengine.stores.analyticsStore.fetchTab()\n\t\tconst reloadIcon = reloadIconRef.current\n\t\tif (reloadIcon) rotateElement(reloadIcon)\n\t}, [])\n\n\tif (engine.stores.chromeStore.displayMinimalUI) return null\n\n\treturn (\n\t\t<ToolbarItem\n\t\t\ttitle=\"Refresh\"\n\t\t\ticon={<ReloadIcon ref={reloadIconRef} />}\n\t\t\tselected={false}\n\t\t\tonClick={handleReload}\n\t\t\tenabled={true}\n\t\t\ticonOnly={agentExperimentEnabled}\n\t\t/>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { useLocales } from \"../localization/useLocales.ts\"\nimport { upsellTranslateAll } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { ToolbarItem } from \"./ToolbarItem.tsx\"\nimport { getToolbarIconSet } from \"./icons/toolbarIconSet.ts\"\n\nfunction showLocaleScopeFilterOptions() {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.QuickActions,\n\t\tinitialCategory: { type: QuickActionsCategoryType.LocaleScopeFilter },\n\t\tsource: \"toolbar\",\n\t})\n}\n\nfunction showGlossaryModal() {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.LocalizationGlossary,\n\t\tsource: \"toolbar\",\n\t})\n}\n\nfunction showLocaleOptions() {\n\tassert(\n\t\tengine.stores.localizationStore.selectedLocaleId,\n\t\t\"locale options should only be accessible when a locale is active\",\n\t)\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.LocaleSettings,\n\t\tsource: \"toolbar\",\n\t\tinitialLocaleId: engine.stores.localizationStore.selectedLocaleId,\n\t})\n}\n\nexport function LocalizationToolbarItems() {\n\tconst hasCalculatedLocalizationState = engine.stores.localizationStore.useState(\n\t\tstate => state.hasCalculatedLocalizationState,\n\t)\n\tconst userCanEditLocale = !useIsViewOnly(\"canDesign\") && hasCalculatedLocalizationState\n\n\tconst locales = useLocales()\n\tconst selectedLocale = useDeprecatedEngineState([engine.stores.localizationStore, EngineChange.Tree], () => {\n\t\treturn engine.tree.root.getNonDefaultLocale(engine.stores.localizationStore.selectedLocaleId)\n\t})\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst toolbarIconSet = getToolbarIconSet(agentExperimentEnabled)\n\n\tconst hasLocaleSelected = Boolean(selectedLocale)\n\n\tconst { active: activeModal } = engine.stores.modalStore.useState()\n\n\tconst isQuickActionsActive = activeModal.type === ModalType.QuickActions\n\tconst isLocaleScopeFilterActive =\n\t\tisQuickActionsActive && activeModal.initialCategory?.type === QuickActionsCategoryType.LocaleScopeFilter\n\tconst isLocaleOptionsActive = activeModal.type === ModalType.LocaleSettings\n\tconst isGlossaryOptionActive = activeModal.type === ModalType.LocalizationGlossary\n\n\tfunction translateAll() {\n\t\tif (upsellTranslateAll(engine, \"toolbar\")) return\n\t\tif (!selectedLocale || !userCanEditLocale) return\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.ConfirmBatchTranslateAll,\n\t\t\tactiveLocale: selectedLocale,\n\t\t\tsource: \"toolbar\",\n\t\t})\n\t}\n\n\treturn (\n\t\t<Stack gap={5} direction=\"row\" alignItems=\"center\">\n\t\t\t<ToolbarItem\n\t\t\t\ttitle={Dictionary.Translate}\n\t\t\t\ticon={toolbarIconSet.magic}\n\t\t\t\tselected={activeModal.type === ModalType.ConfirmBatchTranslateAll}\n\t\t\t\tonClick={translateAll}\n\t\t\t\tenabled={hasLocaleSelected && userCanEditLocale}\n\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t/>\n\t\t\t<ToolbarItem\n\t\t\t\ttitle=\"Glossary\"\n\t\t\t\ticon={toolbarIconSet.glossary}\n\t\t\t\tenabled={!!locales.length}\n\t\t\t\tselected={isGlossaryOptionActive}\n\t\t\t\tonClick={showGlossaryModal}\n\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t/>\n\t\t\t<ToolbarItem\n\t\t\t\ttitle=\"Filter\"\n\t\t\t\ticon={toolbarIconSet.filter}\n\t\t\t\tenabled={hasLocaleSelected && hasCalculatedLocalizationState}\n\t\t\t\tselected={isLocaleScopeFilterActive}\n\t\t\t\tonClick={showLocaleScopeFilterOptions}\n\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t/>\n\t\t\t<ToolbarItem\n\t\t\t\ttitle=\"Settings\"\n\t\t\t\ticon={toolbarIconSet.options}\n\t\t\t\tselected={isLocaleOptionsActive}\n\t\t\t\tonClick={showLocaleOptions}\n\t\t\t\tenabled={hasLocaleSelected && hasCalculatedLocalizationState}\n\t\t\t\ticonOnly={agentExperimentEnabled}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n", "import \"Toolbar.styles_coe15f.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { experiments } from \"app/experiments.ts\";\nimport { ToolbarType } from \"../shared/utils/toolbarHelpers.ts\";\nexport const desktopOnlyToolbarItem = \"desktopOnlyToolbarItem_d1n47kaf\";\nexport const mobileOnlyToolbarItem = \"mobileOnlyToolbarItem_mpj6fkl\";\nexport const bar = \"bar_b19kvjzb\";\nconst toolbarSmallerPadding = \"toolbarSmallerPadding_tdokzdk\";\nconst localizationTools = \"localizationTools_ltzn900\";\nconst contentManagementTools = \"contentManagementTools_c11pgir6\";\nconst defaultTools = \"defaultTools_d1qwkrlz\";\nconst codeTools = \"codeTools_ctcbhw4\";\nexport function toolsBreakpoint(type) {\n  switch (type) {\n    case ToolbarType.Default:\n      return cx(defaultTools);\n    case ToolbarType.Code:\n      return codeTools;\n    case ToolbarType.ContentManagement:\n      return cx(contentManagementTools, !experiments.isOn(\"agent\") && toolbarSmallerPadding);\n    case ToolbarType.Localizations:\n      return cx(localizationTools, !experiments.isOn(\"agent\") && toolbarSmallerPadding);\n  }\n}\nexport const layoutMenu = \"layoutMenu_l274gfq\";", "export function IconAi() {\n\treturn (\n\t\t<svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t<title>AI</title>\n\t\t\t<g mask=\"url(#mask0_337_105)\">\n\t\t\t\t<rect width=\"18\" height=\"18\" fill=\"currentColor\" />\n\t\t\t</g>\n\t\t\t<defs>\n\t\t\t\t<mask id=\"mask0_337_105\" maskUnits=\"userSpaceOnUse\" x=\"0\" y=\"0\" width=\"18\" height=\"18\">\n\t\t\t\t\t<rect width=\"18\" height=\"18\" fill=\"black\" />\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M0 4C0 1.791 1.791 0 4 0H14C16.209 0 18 1.791 18 4V14C18 16.209 16.209 18 14 18H4C1.791 18 0 16.209 0 14V4Z\"\n\t\t\t\t\t\tfill=\"white\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M3.59101 12.6269C3.90401 12.5489 4.14901 12.3039 4.22701 11.9909L4.48901 10.9439C4.57001 10.6209 5.03001 10.6209 5.11101 10.9439L5.37301 11.9909C5.45101 12.3039 5.69601 12.5489 6.00901 12.6269L7.05601 12.8889C7.37901 12.9699 7.37901 13.4299 7.05601 13.5109L6.00901 13.7729C5.69601 13.8509 5.45101 14.0959 5.37301 14.4089L5.11101 15.4559C5.03001 15.7789 4.57001 15.7789 4.48901 15.4559L4.22701 14.4089C4.14901 14.0959 3.90401 13.8509 3.59101 13.7729L2.54401 13.5109C2.22101 13.4299 2.22101 12.9699 2.54401 12.8889L3.59101 12.6269Z\"\n\t\t\t\t\t\tfill=\"black\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M8.09218 6.31799C8.43118 6.24599 8.69618 5.98099 8.76818 5.64199L9.42818 2.50599C9.56918 1.83199 10.5312 1.83199 10.6722 2.50599L11.3322 5.64199C11.4042 5.98099 11.6692 6.24599 12.0082 6.31799L15.1442 6.97799C15.8182 7.11899 15.8182 8.08099 15.1442 8.22199L12.0082 8.88199C11.6692 8.95399 11.4042 9.21899 11.3322 9.55799L10.6722 12.694C10.5312 13.368 9.56918 13.368 9.42818 12.694L8.76818 9.55799C8.69618 9.21899 8.43118 8.95399 8.09218 8.88199L4.95618 8.22199C4.28218 8.08099 4.28218 7.11899 4.95618 6.97799L8.09218 6.31799Z\"\n\t\t\t\t\t\tfill=\"black\"\n\t\t\t\t\t/>\n\t\t\t\t</mask>\n\t\t\t</defs>\n\t\t</svg>\n\t)\n}\n", "export function IconCMS() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M0 4a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4Zm4.5 1.75C4.5 6.993 6.515 8 9 8s4.5-1.007 4.5-2.25S11.485 3.5 9 3.5 4.5 4.507 4.5 5.75Zm9 1.35c0 1.243-2.015 2.25-4.5 2.25S4.5 8.343 4.5 7.1v1.8c0 1.243 2.015 2.25 4.5 2.25s4.5-1.007 4.5-2.25V7.1Zm0 3.15c0 1.243-2.015 2.25-4.5 2.25s-4.5-1.007-4.5-2.25v1.8c0 1.243 2.015 2.25 4.5 2.25s4.5-1.007 4.5-2.25v-1.8Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconCMSFill() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"13\" height=\"15\" fill=\"none\">\n\t\t\t<path\n\t\t\t\td=\"M 6.5 0 C 10.09 0 13 1.38 13 3.083 C 13 4.785 10.09 6.165 6.5 6.165 C 2.91 6.165 0 4.785 0 3.083 C 0 1.38 2.91 0 6.5 0 Z M 13 7.398 C 13 9.101 10.09 10.481 6.5 10.481 C 2.91 10.481 0 9.101 0 7.398 C 0 6.547 0 4.932 0 4.932 C 0 6.635 2.91 8.015 6.5 8.015 C 10.09 8.015 13 6.635 13 4.932 C 13 4.95 13 6.552 13 7.398 Z M 13 11.714 C 13 13.417 10.09 14.797 6.5 14.797 C 2.91 14.797 0 13.417 0 11.714 C 0 10.863 0 9.248 0 9.248 C 0 10.95 2.91 12.331 6.5 12.331 C 10.09 12.331 13 10.95 13 9.248 C 13 9.266 13 10.868 13 11.714 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\n\nexport function usePluginsFromToolbar() {\n\tconst isSelectingPlugin = useEngineState(\n\t\t() =>\n\t\t\tengine.stores.modalStore.active.type === ModalType.QuickActions &&\n\t\t\tengine.stores.modalStore.active.initialCategory?.type === QuickActionsCategoryType.Plugins,\n\t\t[],\n\t\tengine.stores.modalStore,\n\t)\n\n\tconst showPluginQuickActions = useEngineCallback(() => {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.QuickActions,\n\t\t\tinitialCategory: { type: QuickActionsCategoryType.Plugins },\n\t\t\tsource: \"toolbar\",\n\t\t})\n\t}, [])\n\n\treturn {\n\t\tisSelectingPlugin,\n\t\tshowPluginQuickActions,\n\t}\n}\n", "export function IconSyncFill() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" fill=\"none\">\n\t\t\t<path\n\t\t\t\td=\"M14 7.34a5.5 5.5 0 1 0-.7 7.14 1 1 0 0 0-1.47-1.37A3.5 3.5 0 1 1 12.66 9H10a1 1 0 0 0 0 2h5a1 1 0 0 0 1-1V5a1 1 0 0 0-2 0Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { Project } from \"@framerjs/app-shared\"\nimport {\n\tButton,\n\tCenterChild,\n\tIconArrowLeft,\n\tIconFramerLogo,\n\tIconInputDropdown,\n\tIconPreviewCloseBigger,\n\tIconProjectBarPreview,\n\tIconSettings,\n\tProjectBarButton,\n\tStack,\n\tTranslatable as T,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { cx } from \"@linaria/core\"\nimport { getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment, useExperimentIsOn } from \"app/experiments.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport { isContentManagementNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport { PopoverType } from \"document/stores/PopoverStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { editCollectionUsingPlugin } from \"plugins/editCollectionUsingPlugin.ts\"\nimport type React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { collapsedViewBreakpoint } from \"utils/chromeBreakpoints.ts\"\nimport { getSelectedCollectionName } from \"utils/collectionUtils.ts\"\nimport { useSingleButtonEnabled } from \"utils/projectToolbarHooks.tsx\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { titleOrUntitled } from \"web/lib/Project.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { IconAnalytics } from \"../analytics/icons.tsx\"\nimport { openAnalyticsFromCurrentlySelectedItem } from \"../analytics/utils/openAnalytics.ts\"\nimport { closeCollectionItems } from \"../contentManagement/utils/closeCollectionItems.tsx\"\nimport { useActiveCollection } from \"../contentManagement/utils/useActiveCollection.ts\"\nimport { dataIsProjectBarDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport { Collaborators } from \"./Collaborators.tsx\"\nimport { LocalizationToolbarItem } from \"./LocalizationToolbarItem.tsx\"\nimport { PreviewToolbar } from \"./PreviewToolbar.tsx\"\nimport * as styles from \"./ProjectBar.styles.ts\"\nimport { ProjectBarTitle } from \"./ProjectBarTitle/ProjectBarTitle.tsx\"\nimport { backButton as backButtonStyle } from \"./ProjectMenuButton.styles.ts\"\nimport { ProjectMenuButton } from \"./ProjectMenuButton.tsx\"\nimport { PublishToolbarItem } from \"./PublishToolbarItem.tsx\"\nimport { Toolbar } from \"./Toolbar.tsx\"\nimport { ToolbarTooltip, getNativeToolbarTooltipText, useToolbarTooltipVariant } from \"./ToolbarTooltip.tsx\"\nimport { IconSyncFill } from \"./icons/IconSyncFill.tsx\"\nimport { NewIconProjectBarPreview } from \"./icons/NewIconProjectBarPreview.tsx\"\nimport { projectBarMenuGapPx } from \"./projectBarMenuOffset.ts\"\n\nconst openLocalization = engine.scheduler.wrapHandler(async () => {\n\tconst { userKeptEditing } = await closeCollectionItems({ engine, target: \"all-except-selected\" })\n\tif (userKeptEditing) return\n\tengine.stores.chromeStore.setLocalizationsVisible(true)\n})\n\nconst openContentManagement = engine.scheduler.wrapHandler(() => {\n\tif (engine.stores.chromeStore.mainView !== ActiveMainView.ContentManagement) {\n\t\tContextAction.toggleContentManagementScope(engine)\n\t}\n})\n\nconst showViewDropdown = (event: React.MouseEvent<HTMLButtonElement>) => {\n\tconst bounds = event.currentTarget.getBoundingClientRect()\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Cms,\n\t\t\t\tclick: openContentManagement,\n\t\t\t\tchecked: engine.stores.chromeStore.mainView === ActiveMainView.ContentManagement,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Localization,\n\t\t\t\tclick: openLocalization,\n\t\t\t\tchecked: engine.stores.chromeStore.mainView === ActiveMainView.Localizations,\n\t\t\t},\n\t\t],\n\t\t{\n\t\t\tlocation: { x: bounds.left + dimensions.values.contextMenuOffsetX, y: bounds.bottom + projectBarMenuGapPx },\n\t\t},\n\t)\n}\n\nconst BackButton = ({ onClick, mainView }: { onClick: () => void; mainView: ActiveMainView }) => {\n\tconst singleButtonEnabled = useSingleButtonEnabled(mainView)\n\tconst buttonAsTitleOnly = useMediaQuery(`(max-width: ${collapsedViewBreakpoint}px)`)\n\tlet title: React.ReactNode | undefined\n\n\tif (mainView === ActiveMainView.ContentManagement || mainView === ActiveMainView.Localizations) {\n\t\ttitle = (\n\t\t\t<Button\n\t\t\t\tclassName={cx(buttonAsTitleOnly && styles.framerIconButtonAsTitle)}\n\t\t\t\tonMouseDown={buttonAsTitleOnly ? undefined : showViewDropdown}\n\t\t\t\tbold\n\t\t\t\tenabled={!singleButtonEnabled}\n\t\t\t>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={styles.framerIconOffset}\n\t\t\t\t\tgap={buttonAsTitleOnly ? 8 : undefined}\n\t\t\t\t>\n\t\t\t\t\t<IconFramerLogo className={styles.buttonFramerLogo} />\n\t\t\t\t\t<span>{mainView === ActiveMainView.Localizations ? Dictionary.Localization : Dictionary.Cms}</span>\n\t\t\t\t\t{buttonAsTitleOnly ? null : (\n\t\t\t\t\t\t<span className={styles.dropdownIcon}>\n\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Button>\n\t\t)\n\n\t\tif (buttonAsTitleOnly) {\n\t\t\treturn title\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button variant=\"withDepth\" title=\"Back\" className={backButtonStyle} onClick={onClick}>\n\t\t\t\t<CenterChild>\n\t\t\t\t\t<IconArrowLeft />\n\t\t\t\t</CenterChild>\n\t\t\t</Button>\n\t\t\t{title}\n\t\t</>\n\t)\n}\n\nconst goBack = async () => {\n\tif (engine.stores.siteSettingsStore.isOpen) {\n\t\tengine.stores.siteSettingsStore.close()\n\t} else if (engine.stores.analyticsStore.isOpen) {\n\t\tengine.stores.analyticsStore.close()\n\t} else if (engine.stores.chromeStore.isEvaluationsModeActive) {\n\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t} else if (engine.stores.chromeStore.mainView === ActiveMainView.Preview) {\n\t\ttogglePreviewVisible(engine, { source: \"project_bar\" })\n\t} else if (engine.stores.chromeStore.mainView === ActiveMainView.Localizations) {\n\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t} else if (isContentManagementNode(engine.stores.scopeStore.active)) {\n\t\tconst { userKeptEditing } = await closeCollectionItems({\n\t\t\tengine,\n\t\t\ttarget: \"all-except-selected\",\n\t\t})\n\t\tif (userKeptEditing) return\n\t\tContextAction.toggleContentManagementScope(engine)\n\t}\n}\n\nfunction getModeNameForMainView(mainView: ActiveMainView, isEvaluationsModeActive: boolean): string | undefined {\n\tif (isEvaluationsModeActive) return Dictionary.Evaluations\n\tswitch (mainView) {\n\t\tcase ActiveMainView.Canvas:\n\t\tcase ActiveMainView.CodeEditor:\n\t\t\treturn Dictionary.Canvas\n\t\tcase ActiveMainView.ContentManagement:\n\t\t\treturn Dictionary.Cms\n\t\tcase ActiveMainView.Localizations:\n\t\t\treturn Dictionary.Localization\n\t\tcase ActiveMainView.Analytics:\n\t\t\treturn Dictionary.Analytics\n\t\tcase ActiveMainView.SiteSettings:\n\t\t\treturn Dictionary.Settings\n\t\tcase ActiveMainView.Preview:\n\t\t\treturn Dictionary.Preview\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nconst CollectionSelectionButton = ({ mainView }: { mainView: ActiveMainView }) => {\n\tconst selectedCollectionName = useEngineState(\n\t\t() => getSelectedCollectionName(engine),\n\t\t[],\n\t\t[engine.stores.selectionStore, EngineChange.Tree],\n\t)\n\tconst isLeftPanelOpenOnMobile = engine.stores.chromeStore.useState(state => state.isLeftPanelOpenOnMobile)\n\n\tif (mainView !== ActiveMainView.ContentManagement) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cx(styles.sectionFilterButton, isLeftPanelOpenOnMobile && styles.activeSectionFilterButton)}\n\t\t\tonClick={() => engine.stores.chromeStore.toggleLeftPanelOpenOnMobile()}\n\t\t>\n\t\t\t<span className={styles.sectionFilterButtonText}>{selectedCollectionName || \"Select a collection\"}</span>\n\t\t\t<span className={cx(styles.sectionFilterButtonDropdownIcon, isLeftPanelOpenOnMobile && \"active\")}>\n\t\t\t\t<IconInputDropdown />\n\t\t\t</span>\n\t\t</button>\n\t)\n}\n\nconst useMainViewToggle = (\n\tviewToToggle: ActiveMainView,\n): {\n\tenabled: boolean\n\ttoggle: () => void\n} => {\n\tconst { chromeStore, contentManagementStore, previewStore } = engine.stores\n\tconst currentView = chromeStore.useState(state => state.mainView)\n\n\tconst previewPageIdForCollectionItem = useDeprecatedEngineState(\n\t\t[EngineChange.Tree, chromeStore, contentManagementStore],\n\t\t() => {\n\t\t\tconst collectionItemIdBasedOnCurrentSelection =\n\t\t\t\tcontentManagementStore.getCollectionItemIdBasedOnCurrentSelection()\n\t\t\treturn collectionItemIdBasedOnCurrentSelection\n\t\t\t\t? (previewStore.getWebPageNodeForCollectionItem(collectionItemIdBasedOnCurrentSelection)?.id ?? null)\n\t\t\t\t: null\n\t\t},\n\t)\n\n\tconst isCmsPreviewEnabled =\n\t\tcurrentView === ActiveMainView.ContentManagement && previewPageIdForCollectionItem !== null\n\tconst isDefaultPreviewEnabled =\n\t\tcurrentView !== ActiveMainView.ContentManagement &&\n\t\tcurrentView !== ActiveMainView.Localizations &&\n\t\tcurrentView !== ActiveMainView.Analytics &&\n\t\tcurrentView !== ActiveMainView.SiteSettings\n\n\tconst isPreviewEnabled = isDefaultPreviewEnabled || isCmsPreviewEnabled\n\n\tswitch (viewToToggle) {\n\t\tcase ActiveMainView.Preview: {\n\t\t\treturn {\n\t\t\t\tenabled: isPreviewEnabled,\n\t\t\t\ttoggle: async () => {\n\t\t\t\t\tif (isCmsPreviewEnabled) {\n\t\t\t\t\t\tconst collectionItemIdBasedOnCurrentSelection =\n\t\t\t\t\t\t\tcontentManagementStore.getCollectionItemIdBasedOnCurrentSelection()\n\t\t\t\t\t\tconst webPageNode = collectionItemIdBasedOnCurrentSelection\n\t\t\t\t\t\t\t? previewStore.getWebPageNodeForCollectionItem(collectionItemIdBasedOnCurrentSelection)\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\tif (!webPageNode) return\n\n\t\t\t\t\t\tif (!webPageNode.isLoaded()) {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait webPageNode.load()\n\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\tunhandledError(error)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttogglePreviewVisible(engine, { source: \"cms\" })\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\ttogglePreviewVisible(engine, { source: \"project_bar\" })\n\t\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t\t\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t\t\t\t\tengine.stores.siteSettingsStore.close()\n\t\t\t\t\tengine.stores.analyticsStore.close()\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t\tcase ActiveMainView.SiteSettings:\n\t\t\treturn {\n\t\t\t\tenabled: true,\n\t\t\t\ttoggle: () => {\n\t\t\t\t\ttogglePreviewVisible(engine, { visible: false })\n\t\t\t\t\tengine.stores.siteSettingsStore.toggle()\n\t\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t\t\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t\t\t\t\tengine.stores.analyticsStore.close()\n\t\t\t\t},\n\t\t\t}\n\t\tcase ActiveMainView.Analytics:\n\t\t\treturn {\n\t\t\t\tenabled: true,\n\t\t\t\ttoggle: () => {\n\t\t\t\t\ttogglePreviewVisible(engine, { visible: false })\n\n\t\t\t\t\tif (engine.stores.analyticsStore.isOpen) {\n\t\t\t\t\t\tengine.stores.analyticsStore.close()\n\t\t\t\t\t} else {\n\t\t\t\t\t\topenAnalyticsFromCurrentlySelectedItem(engine)\n\t\t\t\t\t}\n\n\t\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t\t\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t\t\t\t\tengine.stores.siteSettingsStore.close()\n\t\t\t\t},\n\t\t\t}\n\t\tcase ActiveMainView.Localizations:\n\t\t\treturn {\n\t\t\t\tenabled: true,\n\t\t\t\ttoggle: () => {\n\t\t\t\t\ttogglePreviewVisible(engine, { visible: false })\n\t\t\t\t\tconst isLocalizationsVisible = engine.stores.chromeStore.mainView === ActiveMainView.Localizations\n\t\t\t\t\tengine.stores.chromeStore.setLocalizationsVisible(!isLocalizationsVisible)\n\t\t\t\t\tengine.stores.agentStore.exitEvaluationsMode()\n\t\t\t\t\tengine.stores.siteSettingsStore.close()\n\t\t\t\t\tengine.stores.analyticsStore.close()\n\t\t\t\t},\n\t\t\t}\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tenabled: false,\n\t\t\t\ttoggle: noop,\n\t\t\t}\n\t}\n}\n\nconst NewCollectionItemButton = ({ mainView }: { mainView: ActiveMainView }) => {\n\tconst canEditContent = !useIsViewOnly(\"canEditContent\")\n\tconst singleButtonEnabled = useSingleButtonEnabled(mainView)\n\tconst { collection } = useActiveCollection(engine)\n\n\tif (mainView !== ActiveMainView.ContentManagement) return null\n\tif (!collection?.managedByPlugin) return null\n\n\treturn (\n\t\t<ProjectBarButton\n\t\t\tround\n\t\t\tenabled={canEditContent && !singleButtonEnabled}\n\t\t\tclassName={styles.cmsNewItemButton}\n\t\t\tonClick={() => editCollectionUsingPlugin(engine, collection, \"syncManagedCollection\")}\n\t\t\ttitle=\"Sync\"\n\t\t>\n\t\t\t<Stack justifyContent=\"center\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t<IconSyncFill />\n\t\t\t</Stack>\n\t\t</ProjectBarButton>\n\t)\n}\n\nconst SettingsButton = ({ siteSettingsTabDisplayed }: { siteSettingsTabDisplayed: boolean }) => {\n\tconst { enabled, toggle } = useMainViewToggle(ActiveMainView.SiteSettings)\n\n\tif (engine.stores.chromeStore.displayMinimalUI) return null\n\n\treturn (\n\t\t<ProjectBarButton\n\t\t\tround\n\t\t\tenabled={enabled}\n\t\t\tactive={siteSettingsTabDisplayed}\n\t\t\tonClick={toggle}\n\t\t\ttitle={Dictionary.Settings}\n\t\t>\n\t\t\t<Stack justifyContent=\"center\" alignItems=\"center\" direction=\"row\">\n\t\t\t\t<IconSettings />\n\t\t\t</Stack>\n\t\t</ProjectBarButton>\n\t)\n}\n\nconst AnalyticsButton = ({ mainView }: { mainView: ActiveMainView }) => {\n\tconst { enabled, toggle } = useMainViewToggle(ActiveMainView.Analytics)\n\tconst analyticsTabDisplayed = mainView === ActiveMainView.Analytics\n\tconst contentManagementTabDisplayed = mainView === ActiveMainView.ContentManagement\n\n\tif (engine.stores.chromeStore.displayMinimalUI && (analyticsTabDisplayed || contentManagementTabDisplayed)) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<ProjectBarButton\n\t\t\tround\n\t\t\tenabled={enabled}\n\t\t\tactive={analyticsTabDisplayed}\n\t\t\tonClick={toggle}\n\t\t\ttitle={Dictionary.Analytics}\n\t\t>\n\t\t\t<IconAnalytics />\n\t\t</ProjectBarButton>\n\t)\n}\n\nconst displayInvitePopover = () => {\n\tif (engine.stores.chromeStore.displayMinimalUI) return\n\tengine.stores.popoverStore.active = PopoverType.Invite\n\trecord(\"ui_interaction\", { page: MetricsInteractionViews.PROJECT_MENU_BAR, id: \"share-project\" })\n}\n\ninterface Props {\n\tmainView: ActiveMainView\n\tshowToolbar: boolean\n\tisCodeEditorPreviewDisplayed: boolean\n\tactiveScopeType: ScopeType\n\tcheckingActivePage: boolean\n\tproject: Project | undefined\n}\n\nexport function ProjectToolbar({\n\tmainView,\n\tshowToolbar,\n\tisCodeEditorPreviewDisplayed,\n\tactiveScopeType,\n\tcheckingActivePage,\n\tproject,\n}: Props) {\n\tconst { isPreviewUIVisible } = engine.stores.fullsizePreviewStore.useState()\n\tconst isEvaluationsModeActive = engine.stores.chromeStore.useState(state => state.isEvaluationsModeActive)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst showTitle =\n\t\tmainView === ActiveMainView.Canvas ||\n\t\tmainView === ActiveMainView.SiteSettings ||\n\t\tmainView === ActiveMainView.ContentManagement\n\tconst hideLeftSectionForAgentPreview = agentExperimentEnabled && mainView === ActiveMainView.Preview\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.container,\n\t\t\t\tappPointerEvents,\n\t\t\t\tmainView === ActiveMainView.Preview && styles.previewBar,\n\t\t\t\t!isPreviewUIVisible && styles.previewBarHidden,\n\t\t\t\tmainView === ActiveMainView.ContentManagement && styles.mobileBorderlessContainer,\n\t\t\t)}\n\t\t\t{...{ [dataIsProjectBarDataAttribute]: \"true\" }}\n\t\t>\n\t\t\t{!hideLeftSectionForAgentPreview && (\n\t\t\t\t<Stack\n\t\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"flex-start\"\n\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\tclassName={\n\t\t\t\t\t\t(mainView === ActiveMainView.ContentManagement || mainView === ActiveMainView.Localizations) &&\n\t\t\t\t\t\t!agentExperimentEnabled\n\t\t\t\t\t\t\t? styles.alignButtonsToSidebar\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t\t\t<ProjectMenuButton title={getModeNameForMainView(mainView, isEvaluationsModeActive)} />\n\t\t\t\t\t</Experiment>\n\t\t\t\t\t<Experiment isNotOn=\"agent\">\n\t\t\t\t\t\t{mainView === ActiveMainView.SiteSettings ||\n\t\t\t\t\t\tmainView === ActiveMainView.ContentManagement ||\n\t\t\t\t\t\tmainView === ActiveMainView.Preview ||\n\t\t\t\t\t\tmainView === ActiveMainView.Analytics ||\n\t\t\t\t\t\tmainView === ActiveMainView.Localizations ||\n\t\t\t\t\t\tisEvaluationsModeActive ? (\n\t\t\t\t\t\t\t<BackButton onClick={goBack} mainView={mainView} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ProjectMenuButton />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Experiment>\n\t\t\t\t\t<CollectionSelectionButton mainView={mainView} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t\t{mainView === ActiveMainView.Preview ? <PreviewToolbar /> : showToolbar && <Toolbar />}\n\t\t\t{showTitle && project && (\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"center\" className={styles.centerBar}>\n\t\t\t\t\t<ProjectBarTitle title={titleOrUntitled(project.title)} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"flex-end\"\n\t\t\t\tclassName={cx(styles.side, styles.rightSide, checkingActivePage && styles.hidden)}\n\t\t\t>\n\t\t\t\t<ProjectActions\n\t\t\t\t\tmainView={mainView}\n\t\t\t\t\tactiveScopeType={activeScopeType}\n\t\t\t\t\tisCodeEditorPreviewDisplayed={isCodeEditorPreviewDisplayed}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</div>\n\t)\n}\n\ninterface ProjectActionsProps {\n\tmainView: ActiveMainView\n\tisCodeEditorPreviewDisplayed: boolean\n\tactiveScopeType: ScopeType\n}\n\nconst ProjectActions = ({ mainView, activeScopeType, isCodeEditorPreviewDisplayed }: ProjectActionsProps) => {\n\tconst { enabled: localizationEnabled, toggle: toggleLocalization } = useMainViewToggle(ActiveMainView.Localizations)\n\tconst agentOn = useExperimentIsOn(\"agent\")\n\tconst showActiveMainViewItems = !agentOn && mainView !== ActiveMainView.ContentManagement\n\n\tif (activeScopeType === ScopeType.CanvasPage || activeScopeType === ScopeType.DesignPage) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{!engine.stores.chromeStore.displayMinimalUI && <Collaborators />}\n\t\t\t\t{!engine.stores.chromeStore.displayMinimalUI && <InviteButton />}\n\t\t\t\t{mainView === ActiveMainView.CodeEditor && (\n\t\t\t\t\t<PreviewButton\n\t\t\t\t\t\tisRightAlignedPreviewButton\n\t\t\t\t\t\tactiveScopeType={activeScopeType}\n\t\t\t\t\t\tmainView={mainView}\n\t\t\t\t\t\tisCodeEditorPreviewDisplayed={isCodeEditorPreviewDisplayed}\n\t\t\t\t\t\tbuttonVariant={isCodeEditorPreviewDisplayed ? \"default\" : \"primary\"}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n\n\tconst sharedProjectActions = (\n\t\t<>\n\t\t\t<NewCollectionItemButton mainView={mainView} />\n\t\t\t{!engine.stores.chromeStore.displayMinimalUI && <Collaborators />}\n\t\t\t{showActiveMainViewItems && (\n\t\t\t\t<>\n\t\t\t\t\t<LocalizationToolbarItem enabled={localizationEnabled} onToggle={toggleLocalization} />\n\t\t\t\t\t<SettingsButton siteSettingsTabDisplayed={mainView === ActiveMainView.SiteSettings} />\n\t\t\t\t\t<AnalyticsButton mainView={mainView} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</>\n\t)\n\n\tif (mainView === ActiveMainView.CodeEditor) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{sharedProjectActions}\n\t\t\t\t{!engine.stores.chromeStore.displayMinimalUI && <InviteButton />}\n\t\t\t\t<PreviewButton\n\t\t\t\t\tisRightAlignedPreviewButton\n\t\t\t\t\tactiveScopeType={activeScopeType}\n\t\t\t\t\tmainView={mainView}\n\t\t\t\t\tisCodeEditorPreviewDisplayed={isCodeEditorPreviewDisplayed}\n\t\t\t\t\tbuttonVariant={isCodeEditorPreviewDisplayed ? \"default\" : \"primary\"}\n\t\t\t\t/>\n\t\t\t</>\n\t\t)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{sharedProjectActions}\n\t\t\t<PreviewButton\n\t\t\t\tisRightAlignedPreviewButton={false}\n\t\t\t\tactiveScopeType={activeScopeType}\n\t\t\t\tmainView={mainView}\n\t\t\t\tisCodeEditorPreviewDisplayed={isCodeEditorPreviewDisplayed}\n\t\t\t\tbuttonVariant=\"default\"\n\t\t\t/>\n\t\t\t{!engine.stores.chromeStore.displayMinimalUI && <InviteButton />}\n\t\t\t<PublishToolbarItem />\n\t\t</>\n\t)\n}\n\ninterface PreviewButtonProps {\n\tactiveScopeType: ScopeType\n\tmainView: ActiveMainView\n\tbuttonVariant: \"primary\" | \"default\"\n\tisCodeEditorPreviewDisplayed: boolean\n\tisRightAlignedPreviewButton: boolean\n}\n\nconst PreviewButton = ({\n\tbuttonVariant,\n\tmainView,\n\tisCodeEditorPreviewDisplayed,\n\tisRightAlignedPreviewButton,\n}: PreviewButtonProps) => {\n\tconst { enabled: previewEnabled, toggle: togglePreview } = useMainViewToggle(ActiveMainView.Preview)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst tooltipVariant = useToolbarTooltipVariant()\n\tconst shouldUseToolbarTooltip = tooltipVariant === \"toolbar\"\n\n\tif (engine.stores.chromeStore.displayMinimalUI) return null\n\n\t// Use different keys to avoid animating when switching between web/canvas\n\t// page. We do want the button to animate between the active & inactive\n\t// state in the code editor. So the key is not 100% mapped to the button variant\n\tconst previewButtonKey = isRightAlignedPreviewButton ? \"primary-preview-button\" : \"default-preview-button\"\n\tconst isAnyPreviewDisplayed = isCodeEditorPreviewDisplayed || mainView === ActiveMainView.Preview\n\tconst tooltipText = isAnyPreviewDisplayed ? \"Close Preview\" : Dictionary.Preview\n\tconst previewAccelerator = getActionAccelerator(\"showPreview\")\n\tconst tooltipShortcut = previewAccelerator ? getAcceleratorTokens(previewAccelerator).join(\"\") : undefined\n\n\tconst previewButton = (\n\t\t<ProjectBarButton\n\t\t\tdata-testid=\"projectbar-preview-button\"\n\t\t\tenabled={previewEnabled}\n\t\t\tround\n\t\t\tonClick={togglePreview}\n\t\t\ttitle={shouldUseToolbarTooltip ? undefined : getNativeToolbarTooltipText(tooltipText, tooltipShortcut)}\n\t\t\tkey={previewButtonKey}\n\t\t\tvariant={agentExperimentEnabled ? \"default\" : buttonVariant}\n\t\t\tactive={agentExperimentEnabled ? isAnyPreviewDisplayed : mainView === ActiveMainView.Preview}\n\t\t\taria-label={shouldUseToolbarTooltip ? tooltipText : undefined}\n\t\t>\n\t\t\t{agentExperimentEnabled ? (\n\t\t\t\t<NewIconProjectBarPreview />\n\t\t\t) : isCodeEditorPreviewDisplayed ? (\n\t\t\t\t<IconPreviewCloseBigger />\n\t\t\t) : (\n\t\t\t\t<IconProjectBarPreview />\n\t\t\t)}\n\t\t</ProjectBarButton>\n\t)\n\n\treturn (\n\t\t<ToolbarTooltip enabled={shouldUseToolbarTooltip} text={tooltipText} shortcut={tooltipShortcut}>\n\t\t\t{previewButton}\n\t\t</ToolbarTooltip>\n\t)\n}\n\nconst InviteButton = () => {\n\tconst { popoverStore } = engine.stores\n\tconst isInvitePopoverActive = useDeprecatedEngineState(popoverStore, () => popoverStore.active === PopoverType.Invite)\n\n\treturn (\n\t\t<ProjectBarButton\n\t\t\tid=\"toolbar-invite-button\"\n\t\t\tvariant=\"default\"\n\t\t\tonClick={displayInvitePopover}\n\t\t\tactive={isInvitePopoverActive}\n\t\t>\n\t\t\t<T>Invite</T>\n\t\t</ProjectBarButton>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { BranchNode } from \"document/models/CanvasTree/nodes/branches/BranchNode.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ToastKey } from \"document/utils/ToastKey.ts\"\nimport { useEffect } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport {\n\tgetPermissionStateWithIsReady,\n\tgetPermissionStateWithIsReadyDependencies,\n\tisViewOnly,\n} from \"web/pages/project/permissions/isViewOnly.ts\"\n\ninterface ViewingBranchFromOtherUserToastState {\n\tcanJoin: boolean\n\ttitle: string\n}\n\nexport function ViewingBranchFromOtherUserToast() {\n\tconst state = useEngineState<ViewingBranchFromOtherUserToastState | null>(\n\t\t() => {\n\t\t\tif (!engine.stores.chromeStore.isViewingBranchFromOtherUser) return null\n\n\t\t\tconst branchNode = engine.tree.get<BranchNode>(engine.activeBranchId)\n\t\t\tconst currentState = getPermissionStateWithIsReady(getPermissionStateWithIsReadyDependencies(engine.stores))\n\t\t\tconst stateAsContributor = { ...currentState, isViewingBranchFromOtherUser: false }\n\t\t\treturn {\n\t\t\t\tcanJoin: !isViewOnly(stateAsContributor, \"canSendDiffs\"),\n\t\t\t\ttitle: branchNode?.title ?? engine.activeBranchId,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[\n\t\t\tengine.stores.chromeStore,\n\t\t\tengine.stores.loadingStore,\n\t\t\tengine.stores.projectStore,\n\t\t\tengine.stores.sessionStore,\n\t\t\tEngineChange.Tree,\n\t\t],\n\t)\n\n\treturn state ? <ViewingBranchFromOtherUserToastInner canJoin={state.canJoin} title={state.title} /> : null\n}\n\nfunction ViewingBranchFromOtherUserToastInner({ canJoin, title }: ViewingBranchFromOtherUserToastState) {\n\tuseEffect(() => {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tkey: ToastKey.ViewingBranchFromOtherUser,\n\t\t\tvariant: \"info\",\n\t\t\ticonOverride: \"branch\",\n\t\t\tprimaryText: \"Viewing branch\",\n\t\t\tsecondaryText: title,\n\t\t\tduration: Infinity,\n\t\t\tpermanent: true,\n\t\t\taction: canJoin ? { title: \"Join\", onClick: () => engine.joinBranchAsContributor() } : undefined,\n\t\t})\n\n\t\treturn () => {\n\t\t\ttoast({ type: \"remove\", key: ToastKey.ViewingBranchFromOtherUser })\n\t\t}\n\t}, [canJoin, title])\n\n\treturn null\n}\n", "import { Scroll } from \"@framerjs/fresco\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { MetricsViewContext } from \"app/metrics.ts\"\nimport { createFeedbackDispatcher } from \"document/components/chrome/feedback/dispatcher.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { FeedbackActionType } from \"feedback/actions.ts\"\nimport { getThreadTimestamp } from \"feedback/utils.ts\"\nimport { useCallback, useContext, useMemo } from \"react\"\nimport * as styles from \"./AgentFeedbackSidebar.styles.ts\"\nimport { AgentFeedbackThreadCard } from \"./AgentFeedbackThreadCard.tsx\"\n\nconst log = getLogger(\"AgentFeedbackSidebar\")\n\nexport function AgentFeedbackSidebar() {\n\tconst { threads, currentUserId, selectedThreadId } = useEngineState(\n\t\t() => {\n\t\t\tconst { feedbackStore } = engine.stores\n\t\t\treturn {\n\t\t\t\tthreads: feedbackStore.threads,\n\t\t\t\tcurrentUserId: feedbackStore.currentUser?.id,\n\t\t\t\tselectedThreadId: feedbackStore.selectedThreadId,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[engine.stores.feedbackStore],\n\t)\n\n\tconst metricsContext = useContext(MetricsViewContext)\n\tconst dispatch = useMemo(() => createFeedbackDispatcher({ metricsContext }), [metricsContext])\n\n\tconst handleSelect = useCallback(async (threadId: string) => {\n\t\tawait engine.stores.feedbackStore.setSelectedThread(threadId)\n\t}, [])\n\n\tconst handleResolve = useCallback(\n\t\t(threadId: string) => {\n\t\t\tvoid dispatch({ type: FeedbackActionType.ThreadUpdate, id: threadId, archived: true })\n\t\t},\n\t\t[dispatch],\n\t)\n\n\tconst handleDelete = useCallback(\n\t\t(threadId: string, hasMultipleComments: boolean) => {\n\t\t\tvoid dispatch({ type: FeedbackActionType.ThreadDelete, id: threadId, hasMultipleComments })\n\t\t},\n\t\t[dispatch],\n\t)\n\n\tconst sortedThreads = useMemo(\n\t\t() => [...threads].sort((threadA, threadB) => getThreadTimestamp(threadA) - getThreadTimestamp(threadB)),\n\t\t[threads],\n\t)\n\n\tif (sortedThreads.length === 0) {\n\t\treturn (\n\t\t\t<div className={styles.container}>\n\t\t\t\t<div className={styles.header}>{Dictionary.Comments}</div>\n\t\t\t\t<div className={styles.emptyState}>Click anywhere on the canvas to comment.</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<div className={styles.header}>{Dictionary.Comments}</div>\n\t\t\t<Scroll>\n\t\t\t\t<ul className={styles.threadList}>\n\t\t\t\t\t{sortedThreads.map(thread => (\n\t\t\t\t\t\t<AgentFeedbackThreadCard\n\t\t\t\t\t\t\tkey={thread.id}\n\t\t\t\t\t\t\tthread={thread}\n\t\t\t\t\t\t\tcurrentUserId={currentUserId ?? \"\"}\n\t\t\t\t\t\t\tisSelected={thread.id === selectedThreadId}\n\t\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\t\tonResolve={handleResolve}\n\t\t\t\t\t\t\tonDelete={handleDelete}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t</Scroll>\n\t\t</div>\n\t)\n}\n", "import \"AgentFeedbackSidebar.styles_89hig4.wyw.css\"; export const container = \"container_c10f27ky\";\nexport const header = \"header_h1w75hxn\";\nexport const threadList = \"threadList_t1ox0y9i\";\nexport const emptyState = \"emptyState_ebt1d96\";", "import { Avatar, Stack } from \"@framerjs/fresco\"\nimport { shadows } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\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 { isLocalId } from \"feedback/model.ts\"\nimport type { Thread } from \"feedback/types.ts\"\nimport { useSafeComment } from \"feedback/useFeedbackCommentEditorView.ts\"\nimport { getThreadPermalink } from \"feedback/utils.ts\"\nimport type React from \"react\"\nimport { useCallback, useState } from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { countAndNoun } from \"utils/countAndNoun.ts\"\nimport { formatDate } from \"web/lib/Project.ts\"\nimport { formatDistanceToNowShort } from \"web/pages/project/lib/formatDistanceToNowShort.ts\"\nimport * as styles from \"./AgentFeedbackThreadCard.styles.ts\"\nimport { FeedbackThreadActions } from \"./FeedbackThreadActions.tsx\"\nimport * as shared from \"./agentFeedbackComment.styles.ts\"\n\ninterface Props {\n\tthread: Thread\n\tcurrentUserId: string\n\tisSelected: boolean\n\tonSelect: (threadId: string) => void\n\tonResolve: (threadId: string) => void\n\tonDelete: (threadId: string, hasMultipleComments: boolean) => void\n}\n\nexport function AgentFeedbackThreadCard({ thread, currentUserId, isSelected, onSelect, onResolve, onDelete }: Props) {\n\tconst firstComment = thread.comments[0]\n\tassert(firstComment, \"Thread must have at least one comment\")\n\n\tconst author = firstComment.author\n\tconst { html } = useSafeComment(firstComment.text)\n\tconst replyCount = thread.comments.filter(c => !c.deletedBy).length - 1\n\n\tconst lastComment = thread.comments.at(-1)\n\tconst threadDate = lastComment?.createdAt ?? firstComment.createdAt\n\n\tconst handleClick = useCallback(() => {\n\t\tonSelect(thread.id)\n\t}, [thread.id, onSelect])\n\n\tconst handleResolve = useCallback(() => {\n\t\tonResolve(thread.id)\n\t}, [thread.id, onResolve])\n\n\tconst canDelete = !isLocalId(thread.id) && firstComment.author.id === currentUserId\n\n\tconst [isMenuOpen, setIsMenuOpen] = useState(false)\n\n\tconst handleMenuClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\t\t\tconst { clientX: x, clientY: y } = event\n\t\t\tconst items: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.CopyLink,\n\t\t\t\t\tenabled: !isLocalId(thread.id),\n\t\t\t\t\tclick: () => void Clipboard.copyText(getThreadPermalink({ threadId: thread.id })),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\t\tvisible: canDelete,\n\t\t\t\t\tclick: () => onDelete(thread.id, thread.comments.length > 1),\n\t\t\t\t},\n\t\t\t]\n\t\t\tsetIsMenuOpen(true)\n\t\t\tengine.stores.contextMenuStore.show(items, { location: { x, y }, onDone: () => setIsMenuOpen(false) })\n\t\t},\n\t\t[thread.id, thread.comments.length, canDelete, onDelete],\n\t)\n\n\treturn (\n\t\t<li className={cx(styles.card, isSelected && styles.cardSelected, isMenuOpen && styles.cardMenuOpen)}>\n\t\t\t<button type=\"button\" className={styles.cardButton} onClick={handleClick}>\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<Avatar\n\t\t\t\t\t\tsize={20}\n\t\t\t\t\t\tsrc={author.avatar}\n\t\t\t\t\t\ttext={author.initials}\n\t\t\t\t\t\tradiusCustomStyles={shared.avatarRadius}\n\t\t\t\t\t\tshadow={shadows.avatar}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<Stack gap={0} className={styles.cardHeader}>\n\t\t\t\t\t\t<span className={shared.authorName}>{author.name}</span>\n\t\t\t\t\t\t<time className={shared.timestamp} dateTime={threadDate.toISOString()} title={formatDate(threadDate)}>\n\t\t\t\t\t\t\t{formatDistanceToNowShort(threadDate, { justNow: true })}\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\n\t\t\t\t{/* biome-ignore lint/security/noDangerouslySetInnerHtml: intentional */}\n\t\t\t\t<div className={styles.commentText} dangerouslySetInnerHTML={{ __html: html }} />\n\n\t\t\t\t{replyCount > 0 && <span className={styles.replyCount}>{countAndNoun(replyCount, \"reply\", \"replies\")}</span>}\n\t\t\t</button>\n\n\t\t\t<div className={styles.actionsContainer}>\n\t\t\t\t<FeedbackThreadActions\n\t\t\t\t\tvisible\n\t\t\t\t\tactive={isSelected}\n\t\t\t\t\tmenuOpen={isMenuOpen}\n\t\t\t\t\tonMenuClick={handleMenuClick}\n\t\t\t\t\tonResolveClick={handleResolve}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</li>\n\t)\n}\n", "import \"AgentFeedbackThreadCard.styles_1fem4hh.wyw.css\"; import { cx } from \"@linaria/core\";\nimport * as shared from \"./agentFeedbackComment.styles.ts\";\nexport const actionsContainer = \"actionsContainer_a106mwyw\";\nexport const cardSelected = \"cardSelected_cllamsi\";\nexport const cardMenuOpen = \"cardMenuOpen_cb97l37\";\nexport const card = \"card_c1vpwbnz\";\nexport const cardButton = \"cardButton_cq5hei8\";\nexport const cardHeader = \"cardHeader_c19w8fbo\";\nexport const commentText = cx(shared.commentText, \"commentText_c13mvw4t\");\nexport const replyCount = \"replyCount_rv3jooi\";", "import { type VersionDeployment, openNewTab } from \"@framerjs/app-shared\"\nimport { Button, EmptyState, IconClose, IconHistory, Scroll, Spinner, Translatable as T } from \"@framerjs/fresco\"\nimport { debounce } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { formatDistanceToNow } from \"date-fns\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { Panel } from \"document/components/chrome/properties/panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"document/components/chrome/properties/panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"document/components/chrome/properties/panels/PanelSectionHeaderButton.tsx\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { DEPLOYMENTS_LIST_LIMIT } from \"document/utils/sitesAPI.ts\"\nimport React, { useEffect, useState } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { timelineEventMinHeight } from \"./DocumentTimelineEvent.styles.ts\"\nimport { DocumentTimelineEvent, DocumentTimelineEventSkeleton } from \"./DocumentTimelineEvent.tsx\"\nimport * as styles from \"./DocumentTimelinePanel.styles.ts\"\nimport { initClusterHistory } from \"./initClusterHistory.ts\"\nimport { clearTimelineScrollPos, getTimelineScrollPos, setTimelineScrollPos } from \"./persistTimelinePanelState.ts\"\nimport { resetVersionHistoryState } from \"./resetVersionHistoryState.ts\"\n\nexport function DocumentTimelinePanel() {\n\tReact.useEffect(() => {\n\t\tif (!engine.isRemountingUI()) record(\"history_panel_open\", {})\n\t\treturn () => engine.stores.historyStore.stopLoadingAndPolling()\n\t}, [])\n\n\tconst branchId = useEngineState(() => engine.stores.treeStore.branchId, [], EngineChange.Tree)\n\tconst lastLoadedBranchRef = React.useRef<string | null>(branchId)\n\n\tconst { loadingState, clusters, activeTreeVersion, activeVersionDeploymentId } = engine.stores.historyStore.useState()\n\n\tconst scrollContainerRef = React.useRef<HTMLDivElement>(null)\n\n\t// This is a workaround for knowing if an unmount & remount was triggered\n\t// by a `key` change in `src/document/component/Document.tsx` when a previous version is selected.\n\tconst initialLoadHadVersions = React.useRef(engine.stores.publishStore.didLoadInitialVersionDeployments)\n\tif (initialLoadHadVersions.current && !engine.stores.publishStore.didLoadInitialVersionDeployments) {\n\t\t// This means versions were refreshed externally so we want to ensure they\n\t\t// animate in when they finish loading.\n\t\tinitialLoadHadVersions.current = false\n\t}\n\n\tuseEffect(() => {\n\t\tif (initialLoadHadVersions.current) {\n\t\t\tconst scrollPos = getTimelineScrollPos()\n\t\t\tscrollContainerRef.current?.scrollTo({\n\t\t\t\ttop: scrollPos,\n\t\t\t})\n\n\t\t\tinitClusterHistory()\n\t\t} else {\n\t\t\tclearTimelineScrollPos()\n\t\t}\n\t}, [])\n\n\tconst {\n\t\tversions: deploymentVersions,\n\t\tdidLoadInitialVersionDeployments,\n\t\tcanLoadMoreVersionDeployments,\n\t} = engine.stores.publishStore.useState()\n\n\tconst getMinRecords = React.useCallback(() => {\n\t\treturn scrollContainerRef.current ? Math.ceil(scrollContainerRef.current.clientHeight / timelineEventMinHeight) : 20\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst branchChanged = lastLoadedBranchRef.current !== branchId\n\t\tif (branchChanged) {\n\t\t\tlastLoadedBranchRef.current = branchId\n\t\t}\n\n\t\t// DynamoDB can read up to a limit of 1MB data when querying. For some projects\n\t\t// this means a full 'page' of records is not returned, so we want to fetch more\n\t\t// until the UI is paginatable by scrolling.\n\t\tconst shouldLoadMore = deploymentVersions.length < getMinRecords() && canLoadMoreVersionDeployments\n\t\tconst isInitialLoad = !didLoadInitialVersionDeployments\n\n\t\tconst loadVersionsLimit = Math.max(getMinRecords(), DEPLOYMENTS_LIST_LIMIT)\n\t\tif (branchChanged || isInitialLoad) {\n\t\t\tvoid engine.stores.publishStore.loadVersions(loadVersionsLimit).then(() => {\n\t\t\t\tif (branchChanged || isInitialLoad) {\n\t\t\t\t\tinitClusterHistory()\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tif (shouldLoadMore) {\n\t\t\tvoid engine.stores.publishStore.loadVersions(loadVersionsLimit)\n\t\t}\n\t}, [branchId, didLoadInitialVersionDeployments, canLoadMoreVersionDeployments, deploymentVersions, getMinRecords])\n\n\tconst [isLoadingMoreDeployments, setIsLoadingMoreDeployments] = useState(false)\n\n\tconst debouncedPaginateDeployments = debounce(function () {\n\t\tif (isLoadingMoreDeployments) return\n\t\tif (\n\t\t\tengine.stores.publishStore.didLoadInitialVersionDeployments &&\n\t\t\t!engine.stores.publishStore.canLoadMoreVersionDeployments\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tsetIsLoadingMoreDeployments(true)\n\t\tvoid engine.stores.publishStore.loadVersions().finally(() => {\n\t\t\tsetIsLoadingMoreDeployments(false)\n\t\t})\n\t}, 500)\n\n\tconst debouncedSetScrollPos = debounce(setTimelineScrollPos, 100)\n\n\tconst handleScroll = (event: React.UIEvent<HTMLDivElement, UIEvent>) => {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = event.currentTarget\n\n\t\tdebouncedSetScrollPos(scrollTop)\n\n\t\tconst threshold = timelineEventMinHeight * 3\n\t\tconst isNearBottom = scrollTop + clientHeight >= scrollHeight - threshold\n\n\t\tif (isNearBottom) {\n\t\t\tdebouncedPaginateDeployments()\n\t\t}\n\t}\n\n\tconst handleClose = React.useCallback(() => {\n\t\tresetVersionHistoryState()\n\t\tengine.stores.chromeStore.isHistoryModeActive = false\n\t}, [])\n\n\tconst restoreLatestVersion = React.useCallback(() => {\n\t\tengine.stores.historyStore.restoreLatest()\n\t}, [])\n\n\tconst selectClusterVersion = React.useCallback((version: number, time: number) => {\n\t\tconst name = formatDistanceToNow(time, { addSuffix: true })\n\t\tvoid engine.stores.historyStore.loadVersion(version, name)\n\t}, [])\n\n\tconst selectPublishedVersion = React.useCallback((deployment: VersionDeployment) => {\n\t\tconst name = formatDistanceToNow(new Date(deployment.createdAt).getTime(), { addSuffix: true })\n\t\tvoid engine.stores.historyStore.loadVersionDeployment(deployment, name)\n\t}, [])\n\n\tconst isLoadingClusters = loadingState !== \"ready\"\n\n\tconst isLoadingDeployments =\n\t\t!didLoadInitialVersionDeployments || (deploymentVersions.length < getMinRecords() && canLoadMoreVersionDeployments)\n\n\tconst isLoading = isLoadingClusters || isLoadingDeployments\n\n\tconst showEmptyState =\n\t\t!isLoadingClusters && clusters.length < 1 && !isLoadingDeployments && !deploymentVersions.length\n\n\treturn (\n\t\t<Panel\n\t\t\tclassName={styles.panel}\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={\n\t\t\t\t\t\t<span className={styles.panelTitleWrapper}>\n\t\t\t\t\t\t\t<T>Version History</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t}\n\t\t\t\t\tpanelDivider={false}\n\t\t\t\t\tclassName={styles.panelHeader}\n\t\t\t\t>\n\t\t\t\t\t<PanelSectionHeaderButton className={styles.btnClose} onClick={handleClose} title=\"Exit\">\n\t\t\t\t\t\t<IconClose />\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t<div className={styles.divider} />\n\t\t\t<Scroll ref={scrollContainerRef} className={styles.scroll} onScroll={handleScroll}>\n\t\t\t\t{showEmptyState ? (\n\t\t\t\t\t<DocumentTimelineEmptyState />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{isLoading && <DocumentTimelineEventSkeleton />}\n\n\t\t\t\t\t\t{!isLoading && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<DocumentTimelineEvent\n\t\t\t\t\t\t\t\t\tkey=\"latest\"\n\t\t\t\t\t\t\t\t\tonSelect={restoreLatestVersion}\n\t\t\t\t\t\t\t\t\tselected={activeTreeVersion === \"latest\"}\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t{!!clusters.length &&\n\t\t\t\t\t\t\t\t\tclusters.map(cluster => (\n\t\t\t\t\t\t\t\t\t\t<DocumentTimelineEvent\n\t\t\t\t\t\t\t\t\t\t\tkey={`cluster#${cluster.time}`}\n\t\t\t\t\t\t\t\t\t\t\tselected={!activeVersionDeploymentId && activeTreeVersion === cluster.treeVersion}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={selectClusterVersion}\n\t\t\t\t\t\t\t\t\t\t\tcluster={cluster}\n\t\t\t\t\t\t\t\t\t\t\tanimate={!initialLoadHadVersions.current}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t\t{!!deploymentVersions.length &&\n\t\t\t\t\t\t\t\t\tdeploymentVersions.map(deployment => (\n\t\t\t\t\t\t\t\t\t\t<DocumentTimelineEvent\n\t\t\t\t\t\t\t\t\t\t\tkey={`deployment#${deployment.id}`}\n\t\t\t\t\t\t\t\t\t\t\tselected={activeVersionDeploymentId === deployment.id}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={selectPublishedVersion}\n\t\t\t\t\t\t\t\t\t\t\tdeployment={deployment}\n\t\t\t\t\t\t\t\t\t\t\tanimate={!initialLoadHadVersions.current}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t\t{isLoadingMoreDeployments && (\n\t\t\t\t\t\t\t\t\t<div className={styles.spinner}>\n\t\t\t\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t\t\t\t</div>\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</Scroll>\n\t\t</Panel>\n\t)\n}\n\nconst DocumentTimelineEmptyState = () => {\n\treturn (\n\t\t<div className={styles.emptyState}>\n\t\t\t<EmptyState\n\t\t\t\ticon={IconHistory}\n\t\t\t\tbody={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<T>There\u2019s no history yet.</T>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<T>Start editing the project to</T>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<T>see autosaved versions.</T>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tbutton={\n\t\t\t\t\t<Button variant=\"default\" title={Dictionary.LearnMore} onClick={openLearnMoreLink} style={{ width: 90 }} />\n\t\t\t\t}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nconst openLearnMoreLink = () => {\n\topenNewTab(\"https://www.framer.com/learn/version-history/\")\n}\n", "import \"DocumentTimelineEvent.styles_vr4fqn.wyw.css\"; export const timelineEventMinHeight = 45;\nexport const timelineEvent = \"timelineEvent_t1xunsas\";\nexport const timelineEventSkeleton = \"timelineEventSkeleton_txtrxeb\";\nexport const timelineEventHeader = \"timelineEventHeader_t1ge56b9\";\nexport const title = \"title_tyq2bhg\";\nexport const subtitle = \"subtitle_s1tq82fy\";\nexport const timelineEventSelected = \"timelineEventSelected_t12cmeau\";\nexport const timelineEventSelectedWithChanges = \"timelineEventSelectedWithChanges_t1jigu9d\";\nexport const timelineEventChangeSummary = \"timelineEventChangeSummary_t18tgqin\";\nexport const timelineEventChangeSummaryRemainder = \"timelineEventChangeSummaryRemainder_t1ne6eqj\";\nexport const timelineEventTotalChanges = \"timelineEventTotalChanges_tmsugnn\";", "import \"ChangeRow.styles_16o46m4.wyw.css\"; export const container = \"container_cbvylx2\";\nexport const iconContainer = \"iconContainer_i7xjp2o\";", "import { Badge, IconLayerComponent, IconPage, IconSidebarCollection, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { ChangeStatus, ChangeType, type ProjectChange } from \"web/pages/project/projectChanges.ts\"\nimport * as styles from \"./ChangeRow.styles.ts\"\n\ninterface Props {\n\tchange: Omit<ProjectChange, \"nodeId\">\n}\n\nexport function ChangeRow({ change }: Props) {\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<div className={styles.iconContainer}>\n\t\t\t\t<ChangeIcon change={change} />\n\t\t\t</div>\n\n\t\t\t<span className={truncateWithEllipsis}>{change.name}</span>\n\n\t\t\t{change.status === ChangeStatus.Added && <Badge>{Dictionary.New}</Badge>}\n\t\t</div>\n\t)\n}\n\nconst icons: Record<ChangeType, React.ReactNode> = {\n\t[ChangeType.WebPage]: <IconPage />,\n\t[ChangeType.SmartComponent]: <IconLayerComponent />,\n\t[ChangeType.CollectionItem]: <IconSidebarCollection />,\n\t[ChangeType.ProxyRoute]: <IconPage />,\n\t[ChangeType.LayoutTemplate]: <IconLayerComponent />,\n}\n\nfunction IconDeleted() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t<path d=\"M0 3.75A.75.75 0 0 1 .75 3h10.5a.75.75 0 0 1 0 1.5H.75A.75.75 0 0 1 0 3.75Z\" fill=\"currentColor\" />\n\t\t\t<path\n\t\t\t\td=\"M2.25 3.75h7.5v5.5a2 2 0 0 1-2 2h-3.5a2 2 0 0 1-2-2Z\"\n\t\t\t\tfill=\"rgba(153, 153, 153, 0.15)\"\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=\"M3.75 1.75a1 1 0 0 1 1-1h2.5a1 1 0 0 1 1 1v2h-4.5Z\"\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\nexport function ChangeIcon({ change }: { change: Pick<ProjectChange, \"status\" | \"type\"> }) {\n\tif (change.status === ChangeStatus.Removed) return <IconDeleted />\n\treturn icons[change.type]\n}\n", "import type { VersionDeployment } from \"@framerjs/app-shared\"\nimport { truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { RelativeTime } from \"document/components/chrome/siteSettings/RelativeTime.tsx\"\nimport engine from \"document/engine.ts\"\nimport { motion } from \"framer-motion\"\nimport { getLogger } from \"library/utils/getLogger.ts\"\nimport { parseChanges } from \"web/pages/project/components/PublishPopover/utils/changeSummary.ts\"\nimport { ChangeRow } from \"./ChangeRow.tsx\"\nimport * as styles from \"./DocumentTimelineEvent.styles.ts\"\nimport type { Activity } from \"./dataProcessing.ts\"\n\nconst log = getLogger(\"DocumentTimelineEvent\")\n\ntype Props =\n\t| {\n\t\t\tselected: boolean\n\t\t\tonSelect: (deployment: VersionDeployment) => void\n\t\t\tdeployment: VersionDeployment\n\t\t\tanimate: boolean\n\t  }\n\t| {\n\t\t\tselected: boolean\n\t\t\tonSelect: (treeVersion: number, time: number) => void\n\t\t\tcluster: Activity\n\t\t\tanimate: boolean\n\t  }\n\t| {\n\t\t\tselected: boolean\n\t\t\tonSelect: () => void\n\t  }\n\nexport function DocumentTimelineEvent(props: Props) {\n\tif (\"deployment\" in props) {\n\t\treturn <Deployment {...props} />\n\t} else if (\"cluster\" in props) {\n\t\treturn <Cluster {...props} />\n\t} else {\n\t\treturn <CurrentDocument {...props} />\n\t}\n}\n\nexport function DocumentTimelineEventSkeleton() {\n\treturn <div className={cx(styles.timelineEvent, styles.timelineEventSelected, styles.timelineEventSkeleton)} />\n}\n\nconst crossfadeAnimation = {\n\tinitial: { opacity: 0 },\n\tanimate: { opacity: 1 },\n\ttransition: { duration: 0.3 },\n}\n\ninterface DeploymentProps {\n\tdeployment: VersionDeployment\n\tselected: boolean\n\tonSelect: (deployment: VersionDeployment) => void\n\tanimate: boolean\n}\n\nfunction Deployment({ deployment, onSelect, selected, animate }: DeploymentProps) {\n\tconst deployedAt = deployment.createdAt\n\tconst deployedBy = deployment.deployedBy.name\n\n\tlet changeSummary: ReturnType<typeof parseChanges> | undefined\n\tif (deployment.changeSummary) {\n\t\ttry {\n\t\t\tchangeSummary = parseChanges(deployment.changeSummary)\n\t\t} catch (e) {\n\t\t\tlog.error(e)\n\t\t}\n\t}\n\n\tconst animationProps = animate\n\t\t? crossfadeAnimation\n\t\t: {\n\t\t\t\tinitial: false,\n\t\t\t\tanimate: false,\n\t\t\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\t{...animationProps}\n\t\t\tonClick={() => onSelect(deployment)}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.timelineEvent,\n\t\t\t\tselected && styles.timelineEventSelected,\n\t\t\t\tselected && !!changeSummary?.totalChanges && styles.timelineEventSelectedWithChanges,\n\t\t\t)}\n\t\t>\n\t\t\t<div>\n\t\t\t\t<div className={styles.timelineEventHeader}>\n\t\t\t\t\t<p className={cx(styles.title, truncateWithEllipsis)}>\n\t\t\t\t\t\t<RelativeTime timestamp={deployedAt} />\n\t\t\t\t\t\t&nbsp;\u00B7&nbsp;\n\t\t\t\t\t\t<span title={deployedBy}>{deployedBy}</span>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\n\t\t\t\t{!!changeSummary && (\n\t\t\t\t\t<div className={cx(styles.timelineEventTotalChanges, truncateWithEllipsis)}>\n\t\t\t\t\t\tPublished&nbsp;\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{changeSummary.totalChanges}&nbsp;\n\t\t\t\t\t\t\t{changeSummary.totalChanges === 1 ? \"Change\" : \"Changes\"}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{!!changeSummary?.totalChanges && selected && (\n\t\t\t\t<div className={cx(styles.timelineEventChangeSummary)}>\n\t\t\t\t\t{changeSummary.changes.map((change, idx) => (\n\t\t\t\t\t\t<ChangeRow key={idx} change={change} />\n\t\t\t\t\t))}\n\t\t\t\t\t{changeSummary.totalChanges > changeSummary.changes.length && (\n\t\t\t\t\t\t<p className={cx(truncateWithEllipsis, styles.timelineEventChangeSummaryRemainder)}>\n\t\t\t\t\t\t\t...and {changeSummary.totalChanges - changeSummary.changes.length} other changes\n\t\t\t\t\t\t</p>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</motion.div>\n\t)\n}\n\ninterface ClusterProps {\n\tcluster: Activity\n\tselected: boolean\n\tonSelect: (treeVersion: number, time: number) => void\n\tanimate: boolean\n}\n\nfunction Cluster({ cluster, selected, onSelect, animate }: ClusterProps) {\n\tconst { acl } = engine.stores.projectStore.useState()\n\n\tconst authors = acl.filter(e => e.user.id in cluster.authors).map(e => e.user.name)\n\tconst authorsText =\n\t\tauthors.length <= 1 ? authors[0] || \"\" : `${authors.slice(0, -1).join(\", \")} & ${authors[authors.length - 1]}`\n\tconst animationProps = animate\n\t\t? crossfadeAnimation\n\t\t: {\n\t\t\t\tinitial: false,\n\t\t\t\tanimate: false,\n\t\t\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\t{...animationProps}\n\t\t\tonClick={() => onSelect(cluster.treeVersion, cluster.time)}\n\t\t\tclassName={cx(styles.timelineEvent, selected && styles.timelineEventSelected)}\n\t\t>\n\t\t\t<div>\n\t\t\t\t<div className={styles.timelineEventHeader}>\n\t\t\t\t\t<p className={cx(styles.title, truncateWithEllipsis)}>\n\t\t\t\t\t\t<RelativeTime timestamp={cluster.time} />\n\t\t\t\t\t\t&nbsp;\u00B7&nbsp;\n\t\t\t\t\t\t<span title={authorsText}>{authorsText}</span>\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\n\t\t\t\t<p className={styles.subtitle}>Autosave</p>\n\t\t\t</div>\n\t\t</motion.div>\n\t)\n}\n\ninterface CurrentDocumentProps {\n\tselected: boolean\n\tonSelect: () => void\n}\n\nfunction CurrentDocument({ selected, onSelect }: CurrentDocumentProps) {\n\treturn (\n\t\t<div onClick={onSelect} className={cx(styles.timelineEvent, selected && styles.timelineEventSelected)}>\n\t\t\t<p className={styles.title}>Current Version</p>\n\t\t\t<p className={styles.subtitle}>Latest</p>\n\t\t</div>\n\t)\n}\n", "import \"DocumentTimelinePanel.styles_9pgxbz.wyw.css\"; export const panel = \"panel_p17kgv7f\";\nexport const panelHeader = \"panelHeader_p13sdz0m\";\nexport const scroll = \"scroll_s1h1p6zo\";\nexport const panelTitleWrapper = \"panelTitleWrapper_ptyuarr\";\nexport const divider = \"divider_d12nwu5e\";\nexport const btnClose = \"btnClose_b1wzui0z\";\nexport const emptyState = \"emptyState_e1juryet\";\nexport const spinner = \"spinner_s1rnoufn\";", "import { Spinner, Stack, Tabs, TabsItem } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { AgentFeedbackSidebar } from \"app/agent/components/Feedback/AgentFeedbackSidebar.tsx\"\nimport { useCanViewAgent } from \"app/agent/hooks/useCanViewAgent.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment } from \"app/experiments.ts\"\nimport { MetricsInteractionViews, MetricsViewContext } from \"app/metrics.ts\"\nimport engine from \"document/engine.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ActiveRightPanel, CanvasPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { wantsNativeTextActions } from \"document/utils/wantsNativeTextActions.ts\"\nimport { environment } from \"environment/index.ts\"\nimport { DocumentTimelinePanel } from \"history/DocumentTimelinePanel.tsx\"\nimport React from \"react\"\nimport { appPointerEvents } from \"utils/appPointerEvents.styles.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { PanelContext } from \"../PanelTooltip.tsx\"\nimport { CanvasAgentChatPanel } from \"../agentPanel/CanvasAgentChatPanel.tsx\"\nimport { AnalyticsFunnelSidebar } from \"../analytics/components/AnalyticsFunnelSidebar.tsx\"\nimport { FeedbackHUDContainer } from \"../feedback/FeedbackHUDContainer.tsx\"\nimport { LocalizedValuePanel } from \"../properties/LocalizedValuePanel.tsx\"\nimport { PropertiesContainer } from \"../properties/index.tsx\"\nimport { ResizeZone } from \"../shared/ResizeZone.tsx\"\nimport { dataIsRightPanelDataAttribute } from \"../shared/chromeHitTargets.ts\"\nimport { EvaluationsPanel } from \"./evaluationsPanelEntry.tsx\"\nimport * as classes from \"./rightPanel.styles.ts\"\nimport { getCanvasPanelFallbackTab } from \"./rightPanelState.ts\"\n\nconst onContextMenu: React.MouseEventHandler = event => {\n\tif (!wantsNativeTextActions(event.target)) {\n\t\tevent.preventDefault()\n\t}\n}\n\nconst setPropertyPanelWidth = engine.scheduler.wrapHandler((width: number) => {\n\tengine.stores.layoutState.setPropertyPanelWidth(width)\n})\n\nconst setEvaluationsPanelWidth = engine.scheduler.wrapHandler((width: number) => {\n\tengine.stores.layoutState.setEvaluationsPanelWidth(width)\n})\n\nfunction EvaluationsPanelFallback() {\n\treturn (\n\t\t<Stack className={classes.evaluationsFallback} gap={dimensions.css.panelGap} alignItems=\"center\">\n\t\t\t<Spinner />\n\t\t\t<span>Loading evaluations\u2026</span>\n\t\t</Stack>\n\t)\n}\n\ninterface PanelContentProps {\n\tisFeedbackModeActive: boolean\n\tactiveRightPanel: ActiveRightPanel\n\tactiveRightPanelTab: CanvasPanelTab\n\tisEvaluationsModeActive: boolean\n\tisPreviewingLocaleOnCanvas: boolean\n}\n\nfunction EvaluationsPanelContent() {\n\tif (!EvaluationsPanel) return null\n\treturn (\n\t\t<React.Suspense fallback={<EvaluationsPanelFallback />}>\n\t\t\t<EvaluationsPanel />\n\t\t</React.Suspense>\n\t)\n}\n\nfunction CanvasPanelContent({\n\tactiveTab,\n\tisEvaluationsModeActive,\n}: {\n\tactiveTab: CanvasPanelTab\n\tisEvaluationsModeActive: boolean\n}) {\n\tswitch (activeTab) {\n\t\tcase CanvasPanelTab.Chat:\n\t\t\tif (isEvaluationsModeActive) return <EvaluationsPanelContent />\n\t\t\treturn <CanvasAgentChatPanel />\n\t\tcase CanvasPanelTab.Properties:\n\t\t\treturn <PropertiesContainer />\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nfunction PanelContent({\n\tisFeedbackModeActive,\n\tactiveRightPanel,\n\tactiveRightPanelTab,\n\tisEvaluationsModeActive,\n\tisPreviewingLocaleOnCanvas,\n}: PanelContentProps) {\n\tif (isFeedbackModeActive) {\n\t\treturn (\n\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.FEEDBACK_PANEL}>\n\t\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t\t<AgentFeedbackSidebar />\n\t\t\t\t</Experiment>\n\t\t\t\t<Experiment isNotOn=\"agent\">\n\t\t\t\t\t<FeedbackHUDContainer />\n\t\t\t\t</Experiment>\n\t\t\t</MetricsViewContext.Provider>\n\t\t)\n\t}\n\n\tswitch (activeRightPanel) {\n\t\tcase ActiveRightPanel.Canvas:\n\t\t\tif (isPreviewingLocaleOnCanvas) {\n\t\t\t\treturn (\n\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.PROPERTIES_PANEL}>\n\t\t\t\t\t\t<LocalizedValuePanel />\n\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (isEvaluationsModeActive) {\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CanvasPanelTabs activeTab={activeRightPanelTab} isEvaluationsModeActive={true} />\n\t\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.PROPERTIES_PANEL}>\n\t\t\t\t\t\t\t<CanvasPanelContent activeTab={activeRightPanelTab} isEvaluationsModeActive={true} />\n\t\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<Experiment isOn=\"agent\">\n\t\t\t\t\t\t<CanvasPanelTabs activeTab={activeRightPanelTab} isEvaluationsModeActive={false} />\n\t\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.PROPERTIES_PANEL}>\n\t\t\t\t\t\t\t<CanvasPanelContent activeTab={activeRightPanelTab} isEvaluationsModeActive={false} />\n\t\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t\t</Experiment>\n\t\t\t\t\t<Experiment isNotOn=\"agent\">\n\t\t\t\t\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.PROPERTIES_PANEL}>\n\t\t\t\t\t\t\t<PropertiesContainer />\n\t\t\t\t\t\t</MetricsViewContext.Provider>\n\t\t\t\t\t</Experiment>\n\t\t\t\t</>\n\t\t\t)\n\t\tcase ActiveRightPanel.History:\n\t\t\treturn <DocumentTimelinePanel />\n\t\tcase ActiveRightPanel.Analytics:\n\t\t\treturn <AnalyticsFunnelSidebar />\n\t\tcase ActiveRightPanel.Evaluations:\n\t\t\treturn <EvaluationsPanelContent />\n\t\tcase ActiveRightPanel.None:\n\t\t\treturn null\n\t\tdefault:\n\t\t\tassertNever(activeRightPanel)\n\t}\n}\n\nexport const RightPanel = React.memo(function RightPanel() {\n\tconst stores = engine.stores\n\tconst supportsProjectBar = !(environment.isAutomation || environment.isTest)\n\tconst isFeedbackModeActive = stores.toolStore.useState(state => state.feedbackModeActive)\n\tconst { chromeIsVisible, rightPanel, activeRightPanelTab, isEvaluationsModeActive, isPreviewingLocaleOnCanvas } =\n\t\tstores.chromeStore.useState(state => {\n\t\t\treturn {\n\t\t\t\tchromeIsVisible: state.chromeIsVisible,\n\t\t\t\trightPanel: state.rightPanel,\n\t\t\t\tactiveRightPanelTab: state.activeRightPanelTab,\n\t\t\t\tisEvaluationsModeActive: state.isEvaluationsModeActive,\n\t\t\t\tisPreviewingLocaleOnCanvas: state.isPreviewingLocaleOnCanvas,\n\t\t\t}\n\t\t})\n\tconst isLoadingPartialDocument = stores.loadingStore.useState(state => state.busyLoadingFirstData)\n\tconst ref = React.useRef(null)\n\tconst isEvaluationsPanel =\n\t\trightPanel === ActiveRightPanel.Evaluations ||\n\t\t(isEvaluationsModeActive && rightPanel === ActiveRightPanel.Canvas && activeRightPanelTab === CanvasPanelTab.Chat)\n\n\tif (!chromeIsVisible) return null\n\tif (rightPanel === ActiveRightPanel.None) return null\n\n\treturn (\n\t\t<PanelContext.Provider value={ref}>\n\t\t\t<div\n\t\t\t\tclassName={cx(\n\t\t\t\t\tclasses.rightPanel,\n\t\t\t\t\tisLoadingPartialDocument && classes.disabledPanel,\n\t\t\t\t\tsupportsProjectBar && classes.projectBarOffset,\n\t\t\t\t\tisEvaluationsPanel && classes.evaluationPanel,\n\t\t\t\t\tappPointerEvents,\n\t\t\t\t)}\n\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\tref={ref}\n\t\t\t\t{...{ [dataIsRightPanelDataAttribute]: \"true\" }}\n\t\t\t>\n\t\t\t\t<div className={classes.panelContentStack}>\n\t\t\t\t\t<div className={classes.panelContentWrapper}>\n\t\t\t\t\t\t<PanelContent\n\t\t\t\t\t\t\tisFeedbackModeActive={isFeedbackModeActive}\n\t\t\t\t\t\t\tisPreviewingLocaleOnCanvas={isPreviewingLocaleOnCanvas}\n\t\t\t\t\t\t\tactiveRightPanel={rightPanel}\n\t\t\t\t\t\t\tactiveRightPanelTab={activeRightPanelTab}\n\t\t\t\t\t\t\tisEvaluationsModeActive={isEvaluationsModeActive}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<ResizeZone\n\t\t\t\t\tside=\"left\"\n\t\t\t\t\tminSize={stores.layoutState.minWidth}\n\t\t\t\t\tmaxSize={isEvaluationsPanel ? () => window.innerWidth : stores.layoutState.maxWidth}\n\t\t\t\t\tdefaultSize={stores.layoutState.defaultTabContentWidth}\n\t\t\t\t\tgetSize={\n\t\t\t\t\t\tisEvaluationsPanel\n\t\t\t\t\t\t\t? stores.layoutState.getCurrentEvaluationsPanelWidth\n\t\t\t\t\t\t\t: stores.layoutState.getCurrentPropertyPanelWidth\n\t\t\t\t\t}\n\t\t\t\t\tsetSize={isEvaluationsPanel ? setEvaluationsPanelWidth : setPropertyPanelWidth}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</PanelContext.Provider>\n\t)\n})\n\nconst onSelect = (tab: CanvasPanelTab) => {\n\tengine.stores.chromeStore.activeRightPanelTab = tab\n}\n\nconst CanvasPanelTabs = ({\n\tactiveTab,\n\tisEvaluationsModeActive,\n}: {\n\tactiveTab: CanvasPanelTab\n\tisEvaluationsModeActive: boolean\n}) => {\n\tconst targetEngine = useAndAssertVekterEngine()\n\tconst canViewChatTab = useCanViewAgent()\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst hasReceivedUserPermissions = targetEngine.stores.chromeStore.useState(state => state.hasReceivedUserPermissions)\n\tconst isLoadingStoreReady = targetEngine.stores.loadingStore.useState(state => state.isReady)\n\tconst supportsPropertiesPanel = useEngineState(\n\t\t() => {\n\t\t\tconst selection = targetEngine.stores.selectionStore.ids\n\t\t\t// At the moment, we display chat in all scopes so we disable the properties panel in all scopes except\n\t\t\t// for web pages and layout templates.\n\t\t\t// If we remove the chat panel in some scopes, we can remove the style panel restriction.\n\t\t\tconst scope = targetEngine.stores.scopeStore.active\n\t\t\treturn isWebPageNode(scope) || isLayoutTemplateNode(scope) || selection.length > 0\n\t\t},\n\t\t[],\n\t\t[targetEngine.stores.scopeStore, targetEngine.stores.selectionStore],\n\t)\n\tconst permissionsReady = isLoadingStoreReady && hasReceivedUserPermissions\n\tconst canViewPrimaryTab = isEvaluationsModeActive || canViewChatTab || !permissionsReady\n\n\t// Switch away from the chat tab if the user is not allowed to view it. Switch to the chat tab\n\t// only if the user canDesign, (asymmetry intended).\n\tReact.useEffect(() => {\n\t\tconst tab = getCanvasPanelFallbackTab({\n\t\t\tactiveTab,\n\t\t\tcanViewPrimaryTab,\n\t\t\tsupportsPropertiesPanel,\n\t\t\tisViewOnly,\n\t\t\tpermissionsReady,\n\t\t})\n\n\t\tif (!tab || tab === activeTab) return\n\n\t\ttargetEngine.scheduler.processWhenReady(() => {\n\t\t\ttargetEngine.stores.chromeStore.activeRightPanelTab = tab\n\t\t})\n\t}, [\n\t\ttargetEngine.scheduler,\n\t\ttargetEngine.stores.chromeStore,\n\t\tcanViewPrimaryTab,\n\t\tsupportsPropertiesPanel,\n\t\tactiveTab,\n\t\tisViewOnly,\n\t\tpermissionsReady,\n\t])\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName={classes.header}\n\t\t\tgap={dimensions.css.panelGap}\n\t\t\tpaddingTop={dimensions.css.panelPadding}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t>\n\t\t\t<Tabs value={activeTab} onChange={onSelect}>\n\t\t\t\t<TabsItem value={CanvasPanelTab.Chat} data-testid=\"chat-tab\" disabled={!canViewPrimaryTab}>\n\t\t\t\t\t{isEvaluationsModeActive ? Dictionary.Evaluations : Dictionary.Agent}\n\t\t\t\t</TabsItem>\n\t\t\t\t<TabsItem value={CanvasPanelTab.Properties} data-testid=\"properties-tab\" disabled={!supportsPropertiesPanel}>\n\t\t\t\t\t{Dictionary.Style}\n\t\t\t\t</TabsItem>\n\t\t\t</Tabs>\n\n\t\t\t<div className={classes.divider} />\n\t\t</Stack>\n\t)\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { isAgentPanelTool } from \"document/components/tools/utils/agentToolHelpers.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\nimport { AgentChatPanel, type AgentSelectionMode } from \"./AgentChatPanel.tsx\"\n\nexport function CanvasAgentChatPanel() {\n\tconst enabled = useEngineState(() => isAgentPanelTool(engine.tool), [], EngineChange.Tool)\n\tconst setEnabled = useEngineCallback((shouldEnable: boolean) => {\n\t\tif (shouldEnable) {\n\t\t\tContextAction.startAgentContextTool(engine)\n\t\t\treturn\n\t\t}\n\n\t\tif (isAgentPanelTool(engine.tool)) {\n\t\t\tengine.exitTool()\n\t\t}\n\t}, [])\n\n\tconst selectionMode = useMemo<AgentSelectionMode>(() => ({ enabled, setEnabled }), [enabled, setEnabled])\n\n\treturn <AgentChatPanel selectionMode={selectionMode} />\n}\n", "import { ReadOnlyContext } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment, useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { type FunnelFilterKey, FunnelStatus, getFilterValueByKey } from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport type { FunnelStepNode } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { type NodeID, randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isFunnelNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { AnalyticsTabNames } from \"document/stores/AnalyticsStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo, useCallback, useMemo } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { Panel } from \"../../properties/panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"../../properties/panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"../../properties/panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../../properties/panels/icons/IconSectionHeaderPlus.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport type { AnalyticsFunnelFilterOption, AnalyticsFunnelGroupByOption } from \"../types.ts\"\nimport { createFunnelStep, funnelStepPopoutId } from \"../utils/createFunnelStep.ts\"\nimport {\n\ttype FilterMenuOption,\n\tfilterMenuOptions,\n\tfunnelFilterMap,\n\tgetDefaultFilterValue,\n\tgetFilterLabel,\n} from \"../utils/filters.ts\"\nimport { type GroupByMenuOptions, groupByMenuOptions } from \"../utils/groupBy.ts\"\nimport {\n\tgetSupportedTrackingEventTypes,\n\tgetTrackingEventTypeIcon,\n\tgetTrackingEventTypeLabel,\n\tgetTrackingEventTypeTitle,\n} from \"../utils/trackingEventTypes.tsx\"\nimport * as styles from \"./AnalyticsFunnelSidebar.styles.ts\"\nimport { AnalyticsFunnelSidebarOptionsPanel } from \"./AnalyticsFunnelSidebarOptionsPanel.tsx\"\nimport { FunnelFilterInput } from \"./FunnelFilterInput.tsx\"\nimport { FunnelGroupByInput } from \"./FunnelGroupByInput.tsx\"\nimport { FunnelStepPopout } from \"./FunnelStepPopout.tsx\"\n\nconst maxFunnelSteps = 5\n\nexport const AnalyticsFunnelSidebar = memo(function AnalyticsFunnelSidebar() {\n\tconst funnelId = engine.stores.analyticsStore.useState(({ active }) =>\n\t\tactive?.tab === AnalyticsTabNames.abtest || active?.tab === AnalyticsTabNames.funnel ? active.id : null,\n\t)\n\tconst groupBy = engine.stores.analyticsStore.useState(state => state.groupBy)\n\n\tconst funnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\n\t// View-only when user lacks permissions OR when A/B test is stopped\n\tconst isViewOnly =\n\t\tuseIsViewOnly(\"canEditAnalytics\") || Boolean(funnel?.abTestingParentId && funnel?.status === FunnelStatus.Stopped)\n\n\t// A/B tests have special step structure:\n\t// - First step: non-draggable\n\t// - Other steps: draggable\n\t// Regular funnels: all steps are draggable\n\tconst isAbTest = Boolean(funnel?.abTestingParentId)\n\tconst firstStepNonDraggable = isAbTest ? (funnel?.children.at(0) as FunnelStepNode) : null\n\tconst draggableSteps = useMemo(() => {\n\t\tif (!funnel?.children) return []\n\t\treturn (isAbTest ? funnel.children.slice(1) : funnel.children) as FunnelStepNode[]\n\t}, [funnel?.children, isAbTest])\n\n\tconst moveStep = useEngineCallback(\n\t\t(from: number, to: number) => {\n\t\t\tif (!funnel || isViewOnly) return\n\t\t\tconst fromStep = from >= 0 ? funnel.children.at(from) : undefined\n\t\t\tconst toStep = to >= 0 ? funnel.children.at(to) : undefined\n\t\t\tif (!fromStep || !toStep) return\n\t\t\tengine.moveNode(fromStep.id, funnel.id, to)\n\t\t},\n\t\t[funnel, isViewOnly],\n\t)\n\n\tconst moveAbTestSteps = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\t// A/B test draggable steps start at index 1, so adjust indices\n\t\t\tmoveStep(from + 1, to + 1)\n\t\t},\n\t\t[moveStep],\n\t)\n\n\tconst moveFunction = isAbTest ? moveAbTestSteps : moveStep\n\tconst totalSteps = funnel?.children?.length || 0\n\tconst canDragSteps = !isViewOnly && (isAbTest ? totalSteps > 2 : totalSteps > 1)\n\n\tconst addStep = useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tif (isViewOnly) return\n\t\t\tconst menuItems: MenuItemOptions[] = getSupportedTrackingEventTypes().map(trackingEventType => ({\n\t\t\t\tlabel: getTrackingEventTypeTitle(trackingEventType),\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!funnelId) return\n\t\t\t\t\tcreateFunnelStep(funnelId, trackingEventType)\n\t\t\t\t},\n\t\t\t}))\n\t\t\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[isViewOnly, funnelId],\n\t)\n\n\tconst buildFilterMenuItems = useEngineCallback(\n\t\t(\n\t\t\tcategories: FilterMenuOption<AnalyticsFunnelFilterOption>,\n\t\t\tavailableFilters: FunnelFilterKey[],\n\t\t): MenuItemOptions[] => {\n\t\t\tconst menu: MenuItemOptions[] = []\n\n\t\t\tfor (const label in categories) {\n\t\t\t\tconst filterKey = categories[label]\n\n\t\t\t\tif (typeof filterKey === \"string\") {\n\t\t\t\t\tconst availableFilter = availableFilters.find(filter => funnelFilterMap[filter] === filterKey)\n\n\t\t\t\t\tif (availableFilter) {\n\t\t\t\t\t\tmenu.push({\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tif (!funnel) return\n\t\t\t\t\t\t\t\tfunnel.set({\n\t\t\t\t\t\t\t\t\t[availableFilter]: [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\t\t\t\t\tvalue: getDefaultFilterValue(availableFilter),\n\t\t\t\t\t\t\t\t\t\t},\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\trecord(\"funnel_filter_create\", { funnelId: funnel.id, filterType: availableFilter })\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} else if (filterKey) {\n\t\t\t\t\tconst submenuItems = buildFilterMenuItems(filterKey, availableFilters)\n\t\t\t\t\tif (submenuItems.length > 0) {\n\t\t\t\t\t\tmenu.push({\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\tsubmenu: submenuItems,\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\treturn menu\n\t\t},\n\t\t[funnel],\n\t)\n\n\tconst addFilter = useEngineCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tif (isViewOnly || !funnel) return\n\n\t\t\tconst availableFilterTypes = getKeys(funnelFilterMap).filter(filterType => funnel[filterType] === undefined)\n\n\t\t\tif (availableFilterTypes.length === 0) return\n\n\t\t\tconst menuItems = buildFilterMenuItems(filterMenuOptions, availableFilterTypes)\n\n\t\t\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[isViewOnly, funnel, buildFilterMenuItems],\n\t)\n\n\tconst updateFilter = useEngineCallback(\n\t\t(filterType: FunnelFilterKey, newValue: string) => {\n\t\t\tif (!funnel) return\n\t\t\tif (getFilterValueByKey(funnel, filterType) === newValue) return\n\n\t\t\t// We don't actually support multiple values yet, so for now it gets overwritten=\n\t\t\tfunnel.set({ [filterType]: [{ id: randomID(), value: newValue }] })\n\t\t\trecord(\"funnel_filter_update\", { funnelId: funnel.id, filterType })\n\t\t},\n\t\t[funnel],\n\t)\n\n\tconst removeFilter = useEngineCallback(\n\t\t(filterType: FunnelFilterKey) => {\n\t\t\tif (!funnel) return\n\n\t\t\tfunnel.set({ [filterType]: undefined })\n\t\t\trecord(\"funnel_filter_delete\", { funnelId: funnel.id, filterType })\n\t\t},\n\t\t[funnel],\n\t)\n\n\tconst hasAvailableFilters = useMemo(\n\t\t() =>\n\t\t\tfunnel ? getKeys(funnelFilterMap).some((filterType: FunnelFilterKey) => funnel[filterType] === undefined) : false,\n\t\t[funnel],\n\t)\n\n\tconst appliedFilters = useMemo(() => {\n\t\tif (!funnel) return []\n\n\t\treturn getKeys(funnelFilterMap).filter(filterType => funnel[filterType] !== undefined)\n\t}, [funnel])\n\n\tconst updateGroupBy = useEngineCallback(\n\t\t(newGroupBy: AnalyticsFunnelGroupByOption) => {\n\t\t\tif (!funnel) return\n\t\t\tif (groupBy === newGroupBy) return\n\n\t\t\tengine.stores.analyticsStore.groupBy = newGroupBy\n\t\t},\n\t\t[funnel, groupBy],\n\t)\n\n\tconst buildGroupByMenuItems = useCallback(\n\t\t(categories: GroupByMenuOptions) => {\n\t\t\tconst menu: MenuItemOptions[] = []\n\n\t\t\tfor (const [groupKey, groupLabel] of Object.entries(categories)) {\n\t\t\t\tmenu.push({\n\t\t\t\t\tlabel: groupLabel,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tupdateGroupBy(groupKey as AnalyticsFunnelGroupByOption)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn menu\n\t\t},\n\t\t[updateGroupBy],\n\t)\n\n\tconst addGroupBy = useEngineCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tif (!funnel) return\n\t\t\tengine.stores.contextMenuStore.show(buildGroupByMenuItems(groupByMenuOptions), {\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t})\n\t\t},\n\t\t[funnel, buildGroupByMenuItems],\n\t)\n\n\tconst removeGroupBy = useEngineCallback(() => {\n\t\tif (!funnel) return\n\n\t\tengine.stores.analyticsStore.groupBy = undefined\n\t}, [funnel])\n\n\tif (!funnel) return null\n\n\tconst canAddSteps = funnel.children.length < maxFunnelSteps && !isViewOnly\n\tconst canAddGroupBy = !groupBy\n\n\treturn (\n\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t<div className={styles.panelContainer}>\n\t\t\t\t<Panel\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\t\ttitle=\"Steps\"\n\t\t\t\t\t\t\tclickable={canAddSteps}\n\t\t\t\t\t\t\tonClick={canAddSteps ? addStep : undefined}\n\t\t\t\t\t\t\tonContextMenu={addStep}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{canAddSteps && (\n\t\t\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{firstStepNonDraggable && (\n\t\t\t\t\t\t<div className={styles.nonDraggableFirstStep}>\n\t\t\t\t\t\t\t<FunnelStepRow\n\t\t\t\t\t\t\t\tfunnelId={funnel.id}\n\t\t\t\t\t\t\t\tkey={firstStepNonDraggable.id}\n\t\t\t\t\t\t\t\tstep={firstStepNonDraggable}\n\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\tcanDelete={false}\n\t\t\t\t\t\t\t\tisTrackingTypeDisabled={true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{draggableSteps.length > 0 && (\n\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\tclassName={styles.sortable}\n\t\t\t\t\t\t\tenabled={canDragSteps}\n\t\t\t\t\t\t\titems={draggableSteps}\n\t\t\t\t\t\t\tmoveItem={moveFunction}\n\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\tautoSizeAnimationEnabled={false}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{({ item: step, index }) => (\n\t\t\t\t\t\t\t\t<FunnelStepRow\n\t\t\t\t\t\t\t\t\tfunnelId={funnel.id}\n\t\t\t\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t\tcanDelete={(isAbTest || index > 0) && !isViewOnly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Sortable>\n\t\t\t\t\t)}\n\t\t\t\t</Panel>\n\t\t\t\t{isAbTest && <AnalyticsFunnelSidebarOptionsPanel isViewOnly={isViewOnly} funnelId={funnelId} />}\n\t\t\t\t<Panel\n\t\t\t\t\theader={\n\t\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\t\ttitle=\"Filters\"\n\t\t\t\t\t\t\tclickable={!isViewOnly && hasAvailableFilters}\n\t\t\t\t\t\t\tonClick={!isViewOnly && hasAvailableFilters ? addFilter : undefined}\n\t\t\t\t\t\t\tonContextMenu={!isViewOnly && hasAvailableFilters ? addFilter : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{!isViewOnly && hasAvailableFilters && (\n\t\t\t\t\t\t\t\t<PanelSectionHeaderButton onClick={addFilter}>\n\t\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{appliedFilters.map(filterType => (\n\t\t\t\t\t\t<PanelRow\n\t\t\t\t\t\t\ttitle={getFilterLabel(filterType)}\n\t\t\t\t\t\t\tkey={filterType}\n\t\t\t\t\t\t\tonContextMenu={(event: React.MouseEvent) => {\n\t\t\t\t\t\t\t\tif (isViewOnly || !engine?.stores.contextMenuStore) return\n\t\t\t\t\t\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\t\t\t\t\t\t\tclick: () => removeFilter(filterType),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\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\t\t<div key={filterType} className={cx(doubleColumnClass, styles.filterWrapper)}>\n\t\t\t\t\t\t\t\t<FunnelFilterInput\n\t\t\t\t\t\t\t\t\tfunnel={funnel}\n\t\t\t\t\t\t\t\t\tkey={filterType}\n\t\t\t\t\t\t\t\t\tfilterType={filterType}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t\tonChangeValue={updateFilter}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t))}\n\t\t\t\t</Panel>\n\n\t\t\t\t{!isAbTest && (\n\t\t\t\t\t<Experiment isOn=\"analyticsFunnelGroupBy\">\n\t\t\t\t\t\t<Panel\n\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\t\t\t\ttitle=\"Group By\"\n\t\t\t\t\t\t\t\t\tclickable={canAddGroupBy}\n\t\t\t\t\t\t\t\t\tonClick={canAddGroupBy ? addGroupBy : undefined}\n\t\t\t\t\t\t\t\t\tonContextMenu={canAddGroupBy ? addGroupBy : undefined}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{canAddGroupBy && (\n\t\t\t\t\t\t\t\t\t\t<PanelSectionHeaderButton onClick={addGroupBy}>\n\t\t\t\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{groupBy && (\n\t\t\t\t\t\t\t\t<PanelRow\n\t\t\t\t\t\t\t\t\ttitle=\"Field\"\n\t\t\t\t\t\t\t\t\tonContextMenu={(event: React.MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (!engine?.stores.contextMenuStore) return\n\t\t\t\t\t\t\t\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\t\t\t\t\t\t\t\t\tclick: () => removeGroupBy(),\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t\t\t\t\t\t\t\t)\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\t\t<div className={cx(doubleColumnClass, styles.filterWrapper)}>\n\t\t\t\t\t\t\t\t\t\t<FunnelGroupByInput isViewOnly={false} value={groupBy} onChangeValue={updateGroupBy} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Panel>\n\t\t\t\t\t</Experiment>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</ReadOnlyContext.Provider>\n\t)\n})\n\ninterface FunnelStepRowProps {\n\tfunnelId: NodeID\n\tstep: FunnelStepNode\n\tisViewOnly: boolean\n\tcanDelete: boolean\n\tisTrackingTypeDisabled?: boolean\n}\n\nfunction FunnelStepRow({ funnelId, step, isViewOnly, canDelete, isTrackingTypeDisabled = false }: FunnelStepRowProps) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tengine.deleteNode(step.id)\n\t\trecord(\"funnel_step_delete\", { funnelId, stepId: step.id })\n\t}, [funnelId, step.id])\n\n\tconst [firstAction] = step.children\n\tassert(firstAction, \"Funnel step must have a tracking event\")\n\n\tconst type = firstAction.trackingEventType ?? \"pageview\"\n\tconst icon = getTrackingEventTypeIcon(type, {\n\t\tagentExperimentEnabled: isAgentExperimentOn,\n\t\ttrackingRoutePath: firstAction.trackingRoutePath,\n\t})\n\n\treturn (\n\t\t<PanelRow title={getTrackingEventTypeLabel(type)}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={funnelStepPopoutId(step.id)}\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t\ttitle={step.resolveValue(\"name\") || getDefaultName(engine.componentLoader, step)}\n\t\t\t\tpreview={<PopoutButtonPreviewIconWrapper>{icon}</PopoutButtonPreviewIconWrapper>}\n\t\t\t\tnavigationTitle=\"Edit Step\"\n\t\t\t\tnavigationClassName={styles.popoutWrapper}\n\t\t\t\tdisplayDivider\n\t\t\t\tpopout={\n\t\t\t\t\t<FunnelStepPopout\n\t\t\t\t\t\tfunnelId={funnelId}\n\t\t\t\t\t\tstepId={step.id}\n\t\t\t\t\t\tname={step.resolveValue(\"name\")}\n\t\t\t\t\t\tactionTrackingEventType={type}\n\t\t\t\t\t\tisTrackingTypeDisabled={isTrackingTypeDisabled}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tonDelete={canDelete ? onDelete : undefined}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import type { AnalyticsFunnelGroupByOption } from \"../types.ts\"\n\nexport type GroupByMenuOptions = {\n\t[key in AnalyticsFunnelGroupByOption]: string\n}\n\nexport const groupByMenuOptions: GroupByMenuOptions = {\n\tdevice: \"Device\",\n\tos: \"OS\",\n\tbrowser: \"Browser\",\n\tcountryCode: \"Country Code\",\n\tlocale: \"Locale\",\n\tframerLocale: \"Framer Locale\",\n}\n", "import \"AnalyticsFunnelSidebar.styles_1up5fjp.wyw.css\"; export const panelContainer = \"panelContainer_pbkrdv7\";\nexport const nonDraggableFirstStep = \"nonDraggableFirstStep_n2p7be\";\nexport const sortable = \"sortable_s1ozstj4\";\nexport const popoutWrapper = \"popoutWrapper_p1fsxrq5\";\nexport const filterWrapper = \"filterWrapper_f5qgcsw\";\nexport const filterInput = \"filterInput_f172m31d\";\nexport const filterInputWrapper = \"filterInputWrapper_fyibpt6\";", "import { PopupButton, PopupButtonItem, Stack } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { FunnelNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tAbDistributionMode,\n\tAbVariantWithDistributionPercentage,\n} from \"document/models/CanvasTree/nodes/abTestDistribution.ts\"\nimport { isFunnelNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo, useCallback } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { Panel } from \"../../properties/panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"../../properties/panels/PanelSectionHeader.tsx\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { IconAgentDistribution, IconDistribution } from \"../icons.tsx\"\nimport { getVariantColorToken } from \"../utils/variantColorToken.ts\"\nimport * as styles from \"./AnalyticsFunnelSidebarOptionsPanel.styles.ts\"\nimport type { Distribution } from \"./DistributionSlider/Distribution.ts\"\nimport { DistributionSlider } from \"./DistributionSlider/DistributionSlider.tsx\"\n\ninterface AnalyticsFunnelSidebarOptionsPanelProps {\n\tisViewOnly: boolean\n\tfunnelId: NodeID | null\n}\n\nexport const AnalyticsFunnelSidebarOptionsPanel = memo(function AnalyticsFunnelSidebarOptionsPanel({\n\tisViewOnly,\n\tfunnelId,\n}: AnalyticsFunnelSidebarOptionsPanelProps) {\n\tconst distributionMode = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode)?.abDistributionMode ?? \"even\",\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handlePresent = useCallback(() => {\n\t\tif (!funnelId) return\n\t\trecord(\"funnel_distribution_popout_open\", { funnelId })\n\t}, [funnelId])\n\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title=\"Options\" />}>\n\t\t\t<PanelRow title=\"Distribution\">\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={`customDistribution-${funnelId}`}\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\ttitle={distributionMode === \"custom\" ? \"Custom\" : \"Even\"}\n\t\t\t\t\tnavigationTitle=\"Distribution\"\n\t\t\t\t\tnavigationClassName={styles.popoutWrapper}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tonPresent={handlePresent}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t{isAgentExperimentOn ? <IconAgentDistribution /> : <IconDistribution />}\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t\tpopout={<OptionsPanelPopoutContent funnelId={funnelId} />}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Panel>\n\t)\n})\n\ninterface OptionsPanelPopoutContentProps {\n\tfunnelId: NodeID | null\n}\n\nfunction OptionsPanelPopoutContent({ funnelId }: OptionsPanelPopoutContentProps) {\n\tconst funnel = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(funnelId, isFunnelNode),\n\t\t[funnelId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tconst { distributions, mode } = funnel?.getAbVariantDistributions(engine.tree, engine.componentLoader) ?? {\n\t\tdistributions: [] as AbVariantWithDistributionPercentage[],\n\t}\n\n\t// Add colors to distributions for the slider\n\tconst distributionsWithColors: Distribution[] = distributions.map((dist, index) => ({\n\t\t...dist,\n\t\tcolor: getVariantColorToken(index),\n\t}))\n\n\tconst handleDragStart = useEngineCallback(() => {\n\t\tif (mode === \"custom\") return\n\t\tfunnel?.set({ abDistributionMode: \"custom\" })\n\t}, [funnel, mode])\n\n\tconst handleDistributionChange = useEngineCallback(\n\t\t(newDistributions: Distribution[]) => {\n\t\t\tif (funnel) persistDistributions(funnel, newDistributions, \"custom\")\n\t\t\tif (funnelId) record(\"funnel_distribution_change\", { funnelId, mode: \"custom\" })\n\t\t},\n\t\t[funnel, funnelId],\n\t)\n\n\tconst handleModeChange = useEngineCallback(\n\t\t(newMode: AbDistributionMode) => {\n\t\t\tif (funnel) persistDistributions(funnel, distributions, newMode)\n\t\t\tif (funnelId) record(\"funnel_distribution_change\", { funnelId, mode: newMode })\n\t\t},\n\t\t[funnel, funnelId, distributions],\n\t)\n\n\treturn (\n\t\t<Stack className={styles.container} gap={0}>\n\t\t\t<PopupButton>\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\ttitle=\"Even\"\n\t\t\t\t\tidentifier=\"even\"\n\t\t\t\t\tselected={mode === \"even\"}\n\t\t\t\t\tonSelect={() => handleModeChange(\"even\")}\n\t\t\t\t/>\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\ttitle=\"Custom\"\n\t\t\t\t\tidentifier=\"custom\"\n\t\t\t\t\tselected={mode === \"custom\"}\n\t\t\t\t\tonSelect={() => handleModeChange(\"custom\")}\n\t\t\t\t/>\n\t\t\t</PopupButton>\n\t\t\t<DistributionSlider\n\t\t\t\tdistributions={distributionsWithColors}\n\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\tonDistributionChange={handleDistributionChange}\n\t\t\t\tariaLabel=\"A/B test variant distributions\"\n\t\t\t\tdescription=\"Adjust the percentage distribution for each variant. Use arrow keys to fine-tune values, or drag the controls.\"\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\nconst persistDistributions = (\n\tfunnel: FunnelNode,\n\tnewDistributions: AbVariantWithDistributionPercentage[],\n\tnewMode: AbDistributionMode,\n) => {\n\tfunnel.set({ abDistributionMode: newMode })\n\n\tif (newMode === \"even\") {\n\t\t// Clear weights when switching to even\n\t\t// The weights are normalised at the point of reading, so will be evenly distributed\n\t\tfor (const dist of newDistributions) {\n\t\t\tconst node = engine.tree.get(dist.id)\n\t\t\tif (isWebPageNode(node)) {\n\t\t\t\tnode.set({ abTestingDistributionWeightPpm: undefined })\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Update weights on each WebPageNode variant\n\t\tfor (const dist of newDistributions) {\n\t\t\tconst node = engine.tree.get(dist.id)\n\t\t\tif (isWebPageNode(node)) {\n\t\t\t\tnode.set({ abTestingDistributionWeightPpm: convertPercentageToPpm(dist.percentage) })\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst convertPercentageToPpm = (percentage: number | undefined) => Math.round(percentage ?? 0) * 10_000\n", "import \"AnalyticsFunnelSidebarOptionsPanel.styles_ha0sts.wyw.css\"; export const container = \"container_c1lxb0sb\";\nexport const popoutWrapper = \"popoutWrapper_p18jt8gs\";", "import { Stack, a11yStyles } from \"@framerjs/fresco\"\nimport { frescoSettingsContext } from \"@framerjs/fresco/components/FrescoSettings\"\nimport { cx } from \"@linaria/core\"\nimport { forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\"\nimport type { Distribution } from \"./Distribution.ts\"\nimport * as styles from \"./DistributionSlider.styles.ts\"\nimport { SliderBar, SliderBarControl } from \"./SliderBar.tsx\"\n\ninterface DistributionSliderProps extends React.ComponentProps<\"div\"> {\n\tdistributions: Distribution[]\n\tariaLabel?: string\n\tdescription: string\n\tonDragStart?: () => void\n\tonDistributionChange: (distributions: Distribution[]) => void\n}\n\nexport function DistributionSlider({\n\tdistributions,\n\tariaLabel = \"Distribution slider\",\n\tdescription,\n\tonDragStart,\n\tonDistributionChange,\n\t...props\n}: DistributionSliderProps) {\n\tconst sliderContainerRef = useRef<HTMLFieldSetElement>(null)\n\tconst controlsContainerRef = useRef<HTMLDivElement>(null)\n\tconst frescoSettings = useContext(frescoSettingsContext)\n\tconst [lastClickedIndex, setLastClickedIndex] = useState<number | null>(null)\n\n\tconst [localDistributions, setLocalDistributions] = useState(() => distributions)\n\tconst [dragPreviewDistributions, setDragPreviewDistributions] = useState<Distribution[] | null>(null)\n\n\tif (!areDistributionsEqual(distributions, localDistributions)) {\n\t\tsetDragPreviewDistributions(null)\n\t\tsetLocalDistributions(distributions)\n\t}\n\n\tconst handleDragStart = useCallback(\n\t\t(index: number) => {\n\t\t\tfrescoSettings.beginUndoGroup?.()\n\t\t\tonDragStart?.()\n\t\t\tsetLastClickedIndex(index)\n\t\t},\n\t\t[onDragStart, frescoSettings],\n\t)\n\n\tconst handleDragPreviewChange = useCallback((newDistributions: Distribution[]) => {\n\t\tsetDragPreviewDistributions(newDistributions)\n\t}, [])\n\n\tconst handleDistributionChange = useCallback(\n\t\t(changedDistributions?: Distribution[]) => {\n\t\t\tif (!dragPreviewDistributions && !changedDistributions) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst committedDistributions: Distribution[] = changedDistributions || dragPreviewDistributions || []\n\t\t\tonDistributionChange(committedDistributions)\n\t\t\tfrescoSettings.endUndoGroup?.()\n\t\t},\n\t\t[dragPreviewDistributions, onDistributionChange, frescoSettings],\n\t)\n\n\tconst handleBarClick = useCallback(\n\t\t(newDistributions: Distribution[]) => {\n\t\t\tfrescoSettings.beginUndoGroup?.()\n\t\t\tonDistributionChange(newDistributions)\n\t\t\tfrescoSettings.endUndoGroup?.()\n\t\t},\n\t\t[onDistributionChange, frescoSettings],\n\t)\n\n\tconst displayDistributions = dragPreviewDistributions ?? localDistributions\n\n\treturn (\n\t\t<div {...props}>\n\t\t\t<Fieldset ref={sliderContainerRef} aria-label={ariaLabel} description={description}>\n\t\t\t\t<SliderBar distributions={displayDistributions} onBarClick={handleBarClick} />\n\t\t\t\t<SliderControlsContainer ref={controlsContainerRef}>\n\t\t\t\t\t{localDistributions.map((distribution, index) =>\n\t\t\t\t\t\tindex === distributions.length - 1 ? null : (\n\t\t\t\t\t\t\t<SliderBarControl\n\t\t\t\t\t\t\t\tkey={distribution.id}\n\t\t\t\t\t\t\t\tcontrolsContainerRef={controlsContainerRef}\n\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\tdistribution={distribution}\n\t\t\t\t\t\t\t\tdistributions={localDistributions}\n\t\t\t\t\t\t\t\tonDragStart={() => handleDragStart(index)}\n\t\t\t\t\t\t\t\tonDistributionChange={handleDistributionChange}\n\t\t\t\t\t\t\t\tonDragPreviewChange={handleDragPreviewChange}\n\t\t\t\t\t\t\t\tzIndex={index === lastClickedIndex || distribution.percentage === 100 ? 1 : 0}\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</SliderControlsContainer>\n\t\t\t</Fieldset>\n\t\t\t<div className={styles.divider} />\n\t\t\t<DistributionsTable distributions={displayDistributions} />\n\t\t</div>\n\t)\n}\n\nfunction DistributionsTable({ distributions }: { distributions: Distribution[] }) {\n\treturn (\n\t\t<Stack className={styles.distributionsTable} gap={0}>\n\t\t\t{distributions.map(distribution => (\n\t\t\t\t<Stack key={distribution.id} className={styles.distributionRow} direction=\"row\" alignItems=\"center\" gap={10}>\n\t\t\t\t\t<div className={styles.distributionDot} style={{ \"--distribution-color\": distribution.color }} />\n\t\t\t\t\t<span className={styles.distributionName}>{distribution.name}</span>\n\t\t\t\t\t<span className={styles.distributionPercentage}>{Math.round(distribution.percentage || 0)}%</span>\n\t\t\t\t</Stack>\n\t\t\t))}\n\t\t</Stack>\n\t)\n}\n\nconst SliderControlsContainer = forwardRef<HTMLDivElement, React.ComponentProps<\"div\">>(\n\t({ className, ...props }, ref) => {\n\t\treturn <div ref={ref} className={cx(styles.distributionsContainer, className)} role=\"presentation\" {...props} />\n\t},\n)\n\nSliderControlsContainer.displayName = \"SliderControlsContainer\"\n\nconst Fieldset = forwardRef<HTMLFieldSetElement, React.ComponentProps<\"fieldset\"> & { description: string }>(\n\t({ children, className, ...props }, ref) => {\n\t\tconst sliderId = useId()\n\t\treturn (\n\t\t\t<fieldset\n\t\t\t\tref={ref}\n\t\t\t\taria-label={props[\"aria-label\"]}\n\t\t\t\taria-describedby={`${sliderId}-description`}\n\t\t\t\tclassName={cx(styles.sliderContainer, className)}\n\t\t\t\tstyle={{ touchAction: \"none\" }}\n\t\t\t>\n\t\t\t\t<div id={`${sliderId}-description`} className={a11yStyles.screenReaderOnly}>\n\t\t\t\t\t{props.description}\n\t\t\t\t</div>\n\t\t\t\t{children}\n\t\t\t\t<div\n\t\t\t\t\trole=\"status\"\n\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\tclassName={a11yStyles.screenReaderOnly}\n\t\t\t\t\tid={`${sliderId}-announcements`}\n\t\t\t\t/>\n\t\t\t</fieldset>\n\t\t)\n\t},\n)\n\nFieldset.displayName = \"Fieldset\"\n\nfunction areDistributionsEqual(a: Distribution[], b: Distribution[]): boolean {\n\tif (a.length !== b.length) return false\n\treturn a.every((dist, idx) => {\n\t\tconst other = b[idx]\n\t\tif (!other) return false\n\t\tif (dist.id !== other.id) return false\n\n\t\tconst currentPercentage = dist.percentage ?? 0\n\t\tconst otherPercentage = other.percentage ?? 0\n\t\treturn Math.abs(currentPercentage - otherPercentage) < 0.001\n\t})\n}\n", "import \"DistributionSlider.styles_1kak73k.wyw.css\"; export const sliderContainer = \"sliderContainer_s1cxpct3\";\nexport const sliderBar = \"sliderBar_s1j985xu\";\nexport const controlHitboxSize = 24;\nexport const controlKnobSize = 14;\nexport const controlKnobSideOffset = (controlHitboxSize - controlKnobSize) / 2;\nexport const distributionsContainer = \"distributionsContainer_d1junzg1\";\nexport const unsetButtonStyles = \"unsetButtonStyles_uhkmrft\";\nexport const controlButton = \"controlButton_cdywl6s\";\nexport const barSection = \"barSection_b196mnei\";\nexport const distributionsTable = \"distributionsTable_dcg3ept\";\nexport const distributionRow = \"distributionRow_d1lmuw03\";\nexport const distributionDot = \"distributionDot_d1prfnk2\";\nexport const distributionName = \"distributionName_d9gz4kl\";\nexport const distributionPercentage = \"distributionPercentage_dwooj19\";\nexport const divider = \"divider_d1404aj0\";", "import { cx } from \"@linaria/core\"\nimport type { PanInfo } from \"framer-motion\"\nimport { motion, useDragControls, useMotionValue } from \"framer-motion\"\nimport { useCallback, useRef } from \"react\"\nimport type { Distribution } from \"./Distribution.ts\"\nimport { applyDistributionPercentageChange, sumPercentages } from \"./Distribution.ts\"\nimport * as styles from \"./DistributionSlider.styles.ts\"\nimport { getButtonLeftPosition } from \"./getButtonLeftPosition.ts\"\nimport { useSliderDragConstraints } from \"./useSliderDragConstraints.ts\"\nimport { useSyncSliderButtonPosition } from \"./useSyncSliderButtonPosition.ts\"\n\nconst INCREMENT_STEP_PCT = 5\n\ninterface SliderBarProps {\n\tdistributions: Distribution[]\n\tonBarClick: (newDistributions: Distribution[]) => void\n}\n\nexport function SliderBar({ distributions, onBarClick }: SliderBarProps) {\n\tconst barRef = useRef<HTMLDivElement>(null)\n\n\tconst handleClick = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (!barRef.current || !onBarClick) return\n\n\t\t\tconst rect = barRef.current.getBoundingClientRect()\n\t\t\tconst clickX = event.clientX - rect.left\n\t\t\tconst clickPercentage = (clickX / rect.width) * 100\n\n\t\t\tconst knobIndex = findKnobIndexAtPercentage(distributions, clickPercentage)\n\t\t\tconst newDistributions = applyDistributionAtCumulativePercentage(distributions, knobIndex, clickPercentage)\n\n\t\t\tonBarClick(newDistributions)\n\t\t},\n\t\t[distributions, onBarClick],\n\t)\n\n\treturn (\n\t\t<div ref={barRef} aria-hidden=\"true\" className={styles.sliderBar} onClick={handleClick}>\n\t\t\t{distributions.map(distribution => (\n\t\t\t\t<SliderBarSection key={distribution.id} distribution={distribution} />\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\ninterface SliderBarSectionProps extends React.ComponentProps<\"div\"> {\n\tdistribution: Distribution\n}\n\nfunction SliderBarSection({ distribution, ...props }: SliderBarSectionProps) {\n\treturn (\n\t\t<div\n\t\t\t{...props}\n\t\t\tclassName={cx(styles.barSection, props.className)}\n\t\t\tstyle={{\n\t\t\t\t...props.style,\n\t\t\t\t\"--distribution-color\": distribution.color,\n\t\t\t\t\"--distribution-percentage\": `${distribution.percentage}%`,\n\t\t\t}}\n\t\t/>\n\t)\n}\n\ninterface SliderBarControlProps {\n\tclassName?: string\n\tcontrolsContainerRef: React.RefObject<HTMLDivElement>\n\tindex: number\n\tdistribution: Distribution\n\tdistributions: Distribution[]\n\tonDistributionChange: (newDistributions?: Distribution[]) => void\n\tonDragPreviewChange: (newDistributions: Distribution[]) => void\n\tonDragStart?: () => void\n\tzIndex: number\n}\n\nexport function SliderBarControl({\n\tcontrolsContainerRef,\n\tindex,\n\tdistribution,\n\tdistributions,\n\tonDistributionChange,\n\tonDragPreviewChange,\n\tonDragStart,\n\tzIndex,\n\t...props\n}: SliderBarControlProps) {\n\tconst sliderButtonRef = useRef<HTMLButtonElement>(null)\n\tconst dragControls = useDragControls()\n\tconst x = useMotionValue(0)\n\n\tuseSyncSliderButtonPosition({\n\t\tcontrolsContainerRef,\n\t\tdistributions,\n\t\tindex,\n\t\tcontrolHitboxSize: styles.controlHitboxSize,\n\t\tcontrolKnobSideOffset: styles.controlKnobSideOffset,\n\t\tx,\n\t})\n\n\tconst dragConstraints = useSliderDragConstraints({\n\t\tcontrolsContainerRef,\n\t\tdistributions,\n\t\tindex,\n\t\tcontrolKnobSize: styles.controlKnobSize,\n\t})\n\n\tconst handleDragStart = useCallback(() => {\n\t\tonDragStart?.()\n\t}, [onDragStart])\n\n\tconst handleDrag = useCallback(\n\t\t(_event: MouseEvent | PointerEvent | TouchEvent, _info: PanInfo) => {\n\t\t\tif (!controlsContainerRef.current) return\n\t\t\tif (!sliderButtonRef.current) return\n\n\t\t\tconst containerWidth = controlsContainerRef.current.clientWidth\n\t\t\tconst containerRect = controlsContainerRef.current.getBoundingClientRect()\n\t\t\tconst buttonRect = sliderButtonRef.current.getBoundingClientRect()\n\n\t\t\tconst onePercentageWidth = containerWidth / 100\n\n\t\t\tconst actualButtonLeftX = buttonRect.left - containerRect.left\n\t\t\tconst buttonCenterX = actualButtonLeftX + styles.controlHitboxSize / 2\n\t\t\tconst iconX = buttonCenterX - styles.controlKnobSideOffset\n\n\t\t\tconst isFirstButton = index === 0\n\t\t\tconst isLastVisibleButton = index === distributions.length - 2\n\n\t\t\tconst minButtonIconPosition = isFirstButton ? 0 : sumPercentages(distributions, 0, index) * onePercentageWidth\n\n\t\t\tconst maxButtonIconPosition = isLastVisibleButton\n\t\t\t\t? containerWidth\n\t\t\t\t: sumPercentages(distributions, 0, index + 2) * onePercentageWidth\n\n\t\t\tconst clampedIconX = Math.max(minButtonIconPosition, Math.min(iconX, maxButtonIconPosition))\n\n\t\t\tconst newCumulativePercentage = (clampedIconX / containerWidth) * 100\n\t\t\tconst previewDistributions = applyDistributionAtCumulativePercentage(\n\t\t\t\tdistributions,\n\t\t\t\tindex,\n\t\t\t\tnewCumulativePercentage,\n\t\t\t)\n\t\t\tonDragPreviewChange(previewDistributions)\n\t\t},\n\t\t[controlsContainerRef, onDragPreviewChange, distributions, index],\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tif (!controlsContainerRef.current) return\n\n\t\t\tconst multiplier = event.shiftKey ? 2 : 1\n\t\t\tconst currentPercentage = distribution.percentage ?? 0\n\t\t\tconst minPossiblePercentage = 0\n\t\t\tconst maxPossiblePercentage = 100\n\n\t\t\tlet newPercentage = currentPercentage\n\t\t\tswitch (event.key) {\n\t\t\t\tcase \"ArrowLeft\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = Math.max(minPossiblePercentage, currentPercentage - 1 * multiplier)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"ArrowDown\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = Math.max(minPossiblePercentage, currentPercentage - INCREMENT_STEP_PCT * multiplier)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"ArrowRight\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = Math.min(maxPossiblePercentage, currentPercentage + 1 * multiplier)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"ArrowUp\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = Math.min(maxPossiblePercentage, currentPercentage + INCREMENT_STEP_PCT * multiplier)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"Home\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = minPossiblePercentage\n\t\t\t\t\tbreak\n\t\t\t\tcase \"End\":\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tnewPercentage = maxPossiblePercentage\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst isFirstButton = index === 0\n\t\t\tconst isLastVisibleButton = index === distributions.length - 2\n\t\t\tconst prevCumulativePercentage = isFirstButton ? 0 : sumPercentages(distributions, 0, index)\n\t\t\tconst nextCumulativePercentage = isLastVisibleButton\n\t\t\t\t? maxPossiblePercentage\n\t\t\t\t: sumPercentages(distributions, 0, index + 2)\n\n\t\t\tconst maxNextValue = nextCumulativePercentage - prevCumulativePercentage\n\t\t\tconst clampedPercentage = Math.max(minPossiblePercentage, Math.min(maxNextValue, newPercentage))\n\t\t\tconst updatedDistributions = applyDistributionPercentageChange(distributions, index, clampedPercentage)\n\n\t\t\tconst containerWidth = controlsContainerRef.current.clientWidth\n\t\t\tx.set(\n\t\t\t\tgetButtonLeftPosition({\n\t\t\t\t\tcontainerWidth,\n\t\t\t\t\tdistributions: updatedDistributions,\n\t\t\t\t\tindex,\n\t\t\t\t\tcontrolHitboxSize: styles.controlHitboxSize,\n\t\t\t\t\tcontrolKnobSideOffset: styles.controlKnobSideOffset,\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tonDistributionChange(updatedDistributions)\n\t\t},\n\t\t[controlsContainerRef, distribution.percentage, distributions, index, onDistributionChange, x],\n\t)\n\n\tconst commitDistributionChange = useCallback(() => {\n\t\tif (!controlsContainerRef.current || !sliderButtonRef.current) {\n\t\t\treturn\n\t\t}\n\t\tconst containerRect = controlsContainerRef.current.getBoundingClientRect()\n\t\tconst buttonRect = sliderButtonRef.current.getBoundingClientRect()\n\n\t\tconst actualButtonLeftX = buttonRect.left - containerRect.left\n\t\tx.set(actualButtonLeftX)\n\t\tonDistributionChange()\n\t}, [onDistributionChange, controlsContainerRef, x])\n\n\tconst roundedPercentage = roundToStep(distribution.percentage)\n\n\treturn (\n\t\t<motion.button\n\t\t\t{...props}\n\t\t\tref={sliderButtonRef}\n\t\t\tclassName={cx(styles.controlButton, styles.unsetButtonStyles, props.className)}\n\t\t\trole=\"slider\"\n\t\t\taria-label={`Distribution for ${distribution.name}`}\n\t\t\taria-valuenow={roundedPercentage}\n\t\t\taria-valuetext={`${roundedPercentage}%`}\n\t\t\taria-valuemin={0}\n\t\t\taria-valuemax={100}\n\t\t\taria-orientation=\"horizontal\"\n\t\t\tdrag=\"x\"\n\t\t\tdragControls={dragControls}\n\t\t\tdragElastic={false}\n\t\t\tdragMomentum={false}\n\t\t\tdragConstraints={dragConstraints ?? false}\n\t\t\tonDragStart={handleDragStart}\n\t\t\tonDrag={handleDrag}\n\t\t\tonDragEnd={commitDistributionChange}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tstyle={{\n\t\t\t\tx,\n\t\t\t\t\"--control-color\": distribution.color,\n\t\t\t\tzIndex,\n\t\t\t}}\n\t\t/>\n\t)\n}\n\nconst roundToStep = (percent: number | undefined) =>\n\tMath.round((percent ?? 0) / INCREMENT_STEP_PCT) * INCREMENT_STEP_PCT\n\nfunction findKnobIndexAtPercentage(distributions: Distribution[], percentage: number): number {\n\tlet cumulativePercentage = 0\n\tfor (let i = 0; i < distributions.length - 1; i++) {\n\t\tcumulativePercentage += distributions[i]?.percentage ?? 0\n\t\tif (percentage <= cumulativePercentage) {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn Math.max(0, distributions.length - 2)\n}\n\n/**\n * Applies a distribution change based on where the knob should be positioned\n * (as a cumulative percentage from 0-100%).\n */\nfunction applyDistributionAtCumulativePercentage(\n\tdistributions: Distribution[],\n\tknobIndex: number,\n\tcumulativePercentage: number,\n): Distribution[] {\n\tconst prevCumulativePercentage = knobIndex === 0 ? 0 : sumPercentages(distributions, 0, knobIndex)\n\tconst newPercentage = cumulativePercentage - prevCumulativePercentage\n\treturn applyDistributionPercentageChange(distributions, knobIndex, newPercentage)\n}\n", "import { unsafeArrayAt } from \"@framerjs/shared\"\n\nexport interface Distribution {\n\tid: string\n\tname: string\n\tcolor: string | undefined\n\tpercentage: number | undefined\n}\n\nexport const sumPercentages = (\n\tdistributions: Pick<Distribution, \"percentage\">[],\n\tstartIndex: number = 0,\n\tendIndex: number = distributions.length,\n): number => {\n\tlet sum = 0\n\tfor (let i = startIndex; i < endIndex; i++) {\n\t\tsum += distributions[i]?.percentage ?? 0\n\t}\n\treturn sum\n}\n\nexport function applyDistributionPercentageChange(\n\tdistributions: Distribution[],\n\tindex: number,\n\tnewPercentage: number,\n): Distribution[] {\n\tconst updatedDistributions = [...distributions]\n\tconst currentDistribution = unsafeArrayAt(updatedDistributions, index)\n\tconst deltaPercentage = newPercentage - (currentDistribution.percentage ?? 0)\n\n\tupdatedDistributions[index] = {\n\t\t...currentDistribution,\n\t\tpercentage: newPercentage,\n\t}\n\n\tconst isLastVisibleButton = index === distributions.length - 2\n\tif (!isLastVisibleButton) {\n\t\tconst nextDist = unsafeArrayAt(updatedDistributions, index + 1)\n\t\tupdatedDistributions[index + 1] = {\n\t\t\t...nextDist,\n\t\t\tpercentage: Math.max(0, (nextDist.percentage ?? 0) - deltaPercentage),\n\t\t}\n\t}\n\n\tconst runningTotal = sumPercentages(updatedDistributions, 0, distributions.length - 1)\n\tupdatedDistributions[distributions.length - 1] = {\n\t\t...unsafeArrayAt(updatedDistributions, distributions.length - 1),\n\t\tpercentage: 100 - runningTotal,\n\t}\n\n\treturn updatedDistributions\n}\n", "import { type Distribution, sumPercentages } from \"./Distribution.ts\"\n\nexport function getButtonLeftPosition({\n\tcontainerWidth,\n\tdistributions,\n\tindex,\n\tcontrolHitboxSize,\n\tcontrolKnobSideOffset,\n}: {\n\tcontainerWidth: number\n\tdistributions: Distribution[]\n\tindex: number\n\tcontrolHitboxSize: number\n\tcontrolKnobSideOffset: number\n}): number {\n\tconst onePercentageWidth = containerWidth / 100\n\tconst cumulativePercentage = sumPercentages(distributions, 0, index + 1)\n\tconst buttonIconPosition = cumulativePercentage * onePercentageWidth\n\treturn buttonIconPosition + controlKnobSideOffset - controlHitboxSize / 2\n}\n", "import { useEffect, useMemo, useState } from \"react\"\nimport type { Distribution } from \"./Distribution.ts\"\nimport { sumPercentages } from \"./Distribution.ts\"\n\ninterface SliderDragConstraintsOptions {\n\tcontrolsContainerRef: React.RefObject<HTMLDivElement>\n\tdistributions: Distribution[]\n\tindex: number\n\tcontrolKnobSize: number\n}\n\nexport function useSliderDragConstraints({\n\tcontrolsContainerRef,\n\tdistributions,\n\tindex,\n\tcontrolKnobSize,\n}: SliderDragConstraintsOptions) {\n\tconst [containerWidth, setContainerWidth] = useState<number | null>(null)\n\n\tuseEffect(() => {\n\t\tconst el = controlsContainerRef.current\n\t\tif (!el) {\n\t\t\tsetContainerWidth(null)\n\t\t\treturn\n\t\t}\n\n\t\tconst update = () => setContainerWidth(el.clientWidth)\n\t\tupdate()\n\n\t\tconst ro = new ResizeObserver(update)\n\t\tro.observe(el)\n\t\treturn () => ro.disconnect()\n\t}, [])\n\n\treturn useMemo(() => {\n\t\tif (containerWidth === null) return\n\t\tif (index === distributions.length - 1) return\n\n\t\tconst isFirstButton = index === 0\n\t\tconst isLastButton = index === distributions.length - 2\n\n\t\tconst onePercentageWidth = containerWidth / 100\n\n\t\tconst buttonPositions = distributions.map(\n\t\t\t(_dist, idx) => sumPercentages(distributions, 0, idx + 1) * onePercentageWidth,\n\t\t)\n\n\t\tlet leftConstraint: number | undefined\n\t\tlet rightConstraint: number | undefined\n\n\t\tif (isFirstButton) {\n\t\t\tleftConstraint = 0\n\t\t\trightConstraint = isLastButton ? containerWidth : (buttonPositions[index + 1] ?? 0)\n\t\t} else if (!isLastButton) {\n\t\t\tleftConstraint = buttonPositions[index - 1] ?? 0\n\t\t\trightConstraint = buttonPositions[index + 1] ?? 0\n\t\t} else {\n\t\t\tleftConstraint = buttonPositions[index - 1] ?? 0\n\t\t\trightConstraint = containerWidth\n\t\t}\n\n\t\tconst controlKnobRadius = controlKnobSize / 2\n\n\t\treturn {\n\t\t\tleft: leftConstraint - controlKnobRadius,\n\t\t\tright: rightConstraint - controlKnobRadius,\n\t\t\ttop: 0,\n\t\t\tbottom: 0,\n\t\t}\n\t}, [containerWidth, distributions, index, controlKnobSize])\n}\n", "import type { MotionValue } from \"framer-motion\"\nimport { useEffect } from \"react\"\nimport type { Distribution } from \"./Distribution.ts\"\nimport { getButtonLeftPosition } from \"./getButtonLeftPosition.ts\"\n\ninterface SliderButtonPositionOptions {\n\tcontrolsContainerRef: React.RefObject<HTMLDivElement>\n\tdistributions: Distribution[]\n\tindex: number\n\tcontrolHitboxSize: number\n\tcontrolKnobSideOffset: number\n\tx: MotionValue<number>\n}\n\nexport function useSyncSliderButtonPosition({\n\tcontrolsContainerRef,\n\tdistributions,\n\tindex,\n\tcontrolHitboxSize,\n\tcontrolKnobSideOffset,\n\tx,\n}: SliderButtonPositionOptions) {\n\tuseEffect(() => {\n\t\tif (!controlsContainerRef.current) return\n\n\t\tconst containerWidth = controlsContainerRef.current.clientWidth\n\t\tx.set(\n\t\t\tgetButtonLeftPosition({\n\t\t\t\tcontainerWidth,\n\t\t\t\tdistributions,\n\t\t\t\tindex,\n\t\t\t\tcontrolHitboxSize,\n\t\t\t\tcontrolKnobSideOffset,\n\t\t\t}),\n\t\t)\n\t}, [controlsContainerRef, distributions, index, controlHitboxSize, controlKnobSideOffset, x])\n}\n", "import { PopupButton, PopupButtonItem, TextInput } from \"@framerjs/fresco\"\nimport type { ComboBoxListItemOption } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport {\n\ttype FunnelFilterKey,\n\ttype FunnelNode,\n\tgetFilterValueByKey,\n} from \"document/models/CanvasTree/nodes/FunnelNode.ts\"\nimport { useMemo } from \"react\"\nimport { LocaleSelector } from \"../../shared/LocaleSelector.tsx\"\nimport type { LocaleRegionCode } from \"../../shared/locales.ts\"\nimport { funnelFilterMap, funnelFilters, getFilterOptionLabel } from \"../utils/filters.ts\"\nimport * as styles from \"./AnalyticsFunnelSidebar.styles.ts\"\n\nexport function FunnelFilterInput({\n\tfunnel,\n\tfilterType,\n\tonChangeValue,\n\tisViewOnly,\n}: {\n\tfunnel: FunnelNode\n\tfilterType: FunnelFilterKey\n\tonChangeValue: (filterType: FunnelFilterKey, newValue: string) => void\n\tisViewOnly: boolean\n}) {\n\tconst displayValue = useMemo(() => {\n\t\tconst filterValue = getFilterValueByKey(funnel, filterType)\n\t\treturn filterValue ? getFilterOptionLabel(filterType, filterValue) : filterValue\n\t}, [filterType, funnel])\n\n\tconst comboBoxItems = useMemo(() => {\n\t\tconst filter = funnelFilters[funnelFilterMap[filterType]]\n\t\tif (!filter || filter.type !== \"dropdown\") return []\n\n\t\tconst options = filter.options || {}\n\t\tconst items: ComboBoxListItemOption[] = []\n\n\t\tfor (const key of Object.keys(options)) {\n\t\t\titems.push({\n\t\t\t\ttype: \"option\" as const,\n\t\t\t\tvalue: key,\n\t\t\t\ttitle: options[key],\n\t\t\t})\n\t\t}\n\n\t\treturn items\n\t}, [filterType])\n\n\tconst funnelFilter = funnelFilters[funnelFilterMap[filterType]]\n\n\tif (!funnelFilter) return null\n\n\tfunction getFilterInput() {\n\t\tconst filter = funnelFilter\n\t\tif (!filter) return null\n\n\t\tswitch (filter.type) {\n\t\t\tcase \"dropdown\":\n\t\t\t\treturn (\n\t\t\t\t\t<PopupButton value={displayValue || \"\"} enabled={!isViewOnly} className={styles.filterInput}>\n\t\t\t\t\t\t{comboBoxItems.map(item => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={item.value}\n\t\t\t\t\t\t\t\tidentifier={item.value}\n\t\t\t\t\t\t\t\ttitle={item.title}\n\t\t\t\t\t\t\t\tselected={getFilterValueByKey(funnel, filterType) === item.value}\n\t\t\t\t\t\t\t\tonSelect={value => onChangeValue(filterType, value)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t)\n\t\t\tcase \"text\":\n\t\t\t\treturn (\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvalue={getFilterValueByKey(funnel, filterType)}\n\t\t\t\t\t\tonChange={value => onChangeValue(filterType, value)}\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tclassName={styles.filterInput}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tcase \"region\":\n\t\t\t\treturn (\n\t\t\t\t\t<LocaleSelector\n\t\t\t\t\t\trightChevron\n\t\t\t\t\t\ttype=\"region\"\n\t\t\t\t\t\tonChange={value => onChangeValue(filterType, value)}\n\t\t\t\t\t\tvalue={getFilterValueByKey(funnel, filterType) as LocaleRegionCode}\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tlanguageCode=\"\"\n\t\t\t\t\t\tupsellOtherRegions={false}\n\t\t\t\t\t\twrapperClassName={styles.filterInput}\n\t\t\t\t\t\twithFlag={false}\n\t\t\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tdefault:\n\t\t\t\treturn null\n\t\t}\n\t}\n\n\treturn <div className={styles.filterInputWrapper}>{getFilterInput()}</div>\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { AnalyticsFunnelGroupByOption } from \"../types.ts\"\nimport { groupByMenuOptions } from \"../utils/groupBy.ts\"\nimport * as styles from \"./AnalyticsFunnelSidebar.styles.ts\"\n\nconst comboBoxItems = Object.entries(groupByMenuOptions).map(([groupKey, groupLabel]) => ({\n\ttype: \"option\",\n\ttitle: groupLabel,\n\tvalue: groupKey,\n}))\n\ninterface FunnelGroupByInputProps {\n\tvalue: AnalyticsFunnelGroupByOption\n\tonChangeValue: (newGroupBy: AnalyticsFunnelGroupByOption) => void\n\tisViewOnly?: boolean\n}\n\nexport function FunnelGroupByInput({ value, onChangeValue, isViewOnly }: FunnelGroupByInputProps) {\n\treturn (\n\t\t<div className={styles.filterInputWrapper}>\n\t\t\t<PopupButton value={value} enabled={!isViewOnly} className={styles.filterInput}>\n\t\t\t\t{comboBoxItems.map(item => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={item.value}\n\t\t\t\t\t\tidentifier={item.value}\n\t\t\t\t\t\ttitle={item.title}\n\t\t\t\t\t\tselected={value === item.value}\n\t\t\t\t\t\tonSelect={onChangeValue}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</div>\n\t)\n}\n", "import { Stack, TextInput } from \"@framerjs/fresco\"\nimport { 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 type { TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { FunnelStepActionNode } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { isFunnelStepActionNode, isFunnelStepNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { type ReactElement, memo, useState } from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { CustomEventStepForm } from \"./CustomEventStepForm.tsx\"\nimport * as styles from \"./FunnelStepPopout.styles.ts\"\nimport { PageviewStepForm } from \"./PageviewStepForm.tsx\"\nimport { TrackingIdStepForm } from \"./TrackingIdStepForm.tsx\"\nimport { TrackingTypeDropdown } from \"./TrackingTypeDropdown.tsx\"\n\ninterface FunnelStepPopoutProps {\n\tfunnelId: NodeID\n\tstepId: NodeID\n\tname: string | null\n\tactionTrackingEventType: TrackingEventType\n\tisTrackingTypeDisabled?: boolean\n}\n\nexport const FunnelStepPopout = memo(function FunnelStepPopout({\n\tfunnelId,\n\tstepId,\n\tname,\n\tactionTrackingEventType: initialTrackingEventType,\n\tisTrackingTypeDisabled = false,\n}: FunnelStepPopoutProps) {\n\tconst [actionTrackingEventType, setActionTrackingEventType] = useState(initialTrackingEventType)\n\n\tconst onNameChange = useEngineCallback(\n\t\t(newName: string) => {\n\t\t\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\t\t\tif (!step) return\n\t\t\tstep.set({ name: newName })\n\t\t\trecord(\"funnel_step_rename\", { funnelId, stepId })\n\t\t},\n\t\t[funnelId, stepId],\n\t)\n\n\tconst onTrackingEventTypeChange = useEngineCallback(\n\t\t(trackingEventType: TrackingEventType) => {\n\t\t\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\t\t\tif (!step?.children) return\n\n\t\t\tfor (const child of step.children) {\n\t\t\t\tengine.deleteNode(child.id)\n\t\t\t}\n\n\t\t\tconst newAction = new FunnelStepActionNode({ trackingEventType })\n\t\t\tengine.tree.insertNode(newAction, step.id)\n\t\t\trecord(\"funnel_step_update\", { funnelId, stepId, eventType: trackingEventType, actionCount: 0 })\n\n\t\t\tsetActionTrackingEventType(trackingEventType)\n\t\t\tstep.set({ name: Dictionary.Any })\n\t\t},\n\t\t[funnelId, stepId],\n\t)\n\n\tconst onActionChange = useEngineCallback(\n\t\t(actionUpdate: Partial<FunnelStepActionNode>, stepName: string, actionId: NodeID) => {\n\t\t\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\t\t\tif (!step) return\n\n\t\t\tconst existingAction = engine.tree.getNodeWithTrait(actionId, isFunnelStepActionNode)\n\t\t\tif (!existingAction) return\n\n\t\t\t// Count existing selected actions based on the property being updated\n\t\t\tconst selectedActions = step.children.filter((action: FunnelStepActionNode) => {\n\t\t\t\tif (actionUpdate.trackingRoutePath !== undefined) {\n\t\t\t\t\treturn action.trackingRoutePath\n\t\t\t\t}\n\t\t\t\tif (actionUpdate.trackingId !== undefined) {\n\t\t\t\t\treturn action.trackingId\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t})\n\n\t\t\tif (selectedActions.length === 1) {\n\t\t\t\tstep.set({ name: stepName })\n\t\t\t}\n\t\t\texistingAction.set(actionUpdate)\n\n\t\t\trecord(\"funnel_step_update\", {\n\t\t\t\tfunnelId,\n\t\t\t\tstepId,\n\t\t\t\teventType: actionTrackingEventType,\n\t\t\t\tactionCount: selectedActions.length,\n\t\t\t})\n\t\t},\n\t\t[funnelId, stepId, actionTrackingEventType],\n\t)\n\n\tconst onActionCreate = useEngineCallback(\n\t\t(actionUpdate: Partial<FunnelStepActionNode>, stepName: string) => {\n\t\t\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\t\t\tif (!step) return\n\n\t\t\t// Count existing selected actions based on the property being updated\n\t\t\tconst selectedActions = step.children.filter((action: FunnelStepActionNode) => {\n\t\t\t\tif (actionUpdate.trackingRoutePath !== undefined) {\n\t\t\t\t\treturn action.trackingRoutePath\n\t\t\t\t}\n\t\t\t\tif (actionUpdate.trackingId !== undefined) {\n\t\t\t\t\treturn action.trackingId\n\t\t\t\t}\n\t\t\t\treturn false\n\t\t\t})\n\n\t\t\tif (selectedActions.length === 0) {\n\t\t\t\tstep.set({ name: stepName })\n\t\t\t}\n\t\t\tconst newAction = new FunnelStepActionNode({\n\t\t\t\t...actionUpdate,\n\t\t\t\ttrackingEventType: actionTrackingEventType,\n\t\t\t})\n\t\t\tengine.tree.insertNode(newAction, step.id)\n\n\t\t\tconst propertyValue = actionUpdate.trackingRoutePath || actionUpdate.trackingId\n\t\t\trecord(\"funnel_step_update\", {\n\t\t\t\tfunnelId,\n\t\t\t\tstepId,\n\t\t\t\teventType: actionTrackingEventType,\n\t\t\t\tactionCount: propertyValue ? selectedActions.length + 1 : selectedActions.length,\n\t\t\t})\n\n\t\t\treturn newAction.id\n\t\t},\n\t\t[funnelId, stepId, actionTrackingEventType],\n\t)\n\n\tconst onActionRemove = useEngineCallback(\n\t\t(actionId: NodeID) => {\n\t\t\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\t\t\tif (!step) return\n\n\t\t\tconst stepAction = engine.tree.getNodeWithTrait(actionId, isFunnelStepActionNode)\n\t\t\tif (!stepAction) return\n\n\t\t\tlet matchingActionsCount = 0\n\t\t\tfor (const action of step.children) {\n\t\t\t\tif (action.trackingEventType === actionTrackingEventType) {\n\t\t\t\t\tmatchingActionsCount++\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (matchingActionsCount === 1) {\n\t\t\t\t// We keep 1 empty record to use it for action creation\n\t\t\t\t// In the old projects we might not have an empty record\n\t\t\t\t// in this case we don't remove, but cleanup the data\n\t\t\t\tstepAction.deleteProp(\"trackingId\")\n\t\t\t\tstepAction.deleteProp(\"trackingRoutePath\")\n\t\t\t} else {\n\t\t\t\tengine.deleteNode(stepAction.id)\n\t\t\t}\n\n\t\t\tif (!hasAnyTrackingOrRoute(stepId)) {\n\t\t\t\t// getDefaultName will return \"Any\" if the name is unset\n\t\t\t\tstep.set({ name: undefined })\n\t\t\t}\n\n\t\t\trecord(\"funnel_step_update\", {\n\t\t\t\tfunnelId,\n\t\t\t\tstepId,\n\t\t\t\teventType: actionTrackingEventType,\n\t\t\t\tactionCount: Math.max(matchingActionsCount - 2, 0),\n\t\t\t})\n\t\t},\n\t\t[funnelId, stepId, actionTrackingEventType],\n\t)\n\n\tconst stepForm: ReactElement = (() => {\n\t\tswitch (actionTrackingEventType) {\n\t\t\tcase \"pageview\":\n\t\t\t\treturn (\n\t\t\t\t\t<PageviewStepForm\n\t\t\t\t\t\tstepId={stepId}\n\t\t\t\t\t\tisTrackingTypeDisabled={isTrackingTypeDisabled}\n\t\t\t\t\t\tonActionRemove={onActionRemove}\n\t\t\t\t\t\tonActionChange={onActionChange}\n\t\t\t\t\t\tonActionCreate={onActionCreate}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tcase \"click\":\n\t\t\tcase \"form_submit\":\n\t\t\t\treturn (\n\t\t\t\t\t<TrackingIdStepForm\n\t\t\t\t\t\tfunnelId={funnelId}\n\t\t\t\t\t\tstepId={stepId}\n\t\t\t\t\t\tactionTrackingEventType={actionTrackingEventType}\n\t\t\t\t\t\tisTrackingTypeDisabled={isTrackingTypeDisabled}\n\t\t\t\t\t\tonActionRemove={onActionRemove}\n\t\t\t\t\t\tonActionChange={onActionChange}\n\t\t\t\t\t\tonActionCreate={onActionCreate}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tcase \"custom\":\n\t\t\t\treturn (\n\t\t\t\t\t<CustomEventStepForm\n\t\t\t\t\t\tstepId={stepId}\n\t\t\t\t\t\tisTrackingTypeDisabled={isTrackingTypeDisabled}\n\t\t\t\t\t\tonActionRemove={onActionRemove}\n\t\t\t\t\t\tonActionChange={onActionChange}\n\t\t\t\t\t\tonActionCreate={onActionCreate}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tcase \"trigger_invoke\":\n\t\t\t\treturn (\n\t\t\t\t\t<TrackingIdStepForm\n\t\t\t\t\t\tfunnelId={funnelId}\n\t\t\t\t\t\tstepId={stepId}\n\t\t\t\t\t\tactionTrackingEventType={actionTrackingEventType}\n\t\t\t\t\t\tisTrackingTypeDisabled={isTrackingTypeDisabled}\n\t\t\t\t\t\tonActionRemove={onActionRemove}\n\t\t\t\t\t\tonActionChange={onActionChange}\n\t\t\t\t\t\tonActionCreate={onActionCreate}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\tdefault:\n\t\t\t\tassertNever(actionTrackingEventType)\n\t\t}\n\t})()\n\n\treturn (\n\t\t<Stack className={styles.container} gap={0}>\n\t\t\t<PanelRow title=\"Name\">\n\t\t\t\t<TextInput\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\tonChange={onNameChange}\n\t\t\t\t\tplaceholder=\"\"\n\t\t\t\t\tvalue={name || Dictionary.Any}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Type}>\n\t\t\t\t<TrackingTypeDropdown\n\t\t\t\t\tvalue={actionTrackingEventType}\n\t\t\t\t\tonSelect={onTrackingEventTypeChange}\n\t\t\t\t\tdisabled={isTrackingTypeDisabled}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t{stepForm}\n\t\t</Stack>\n\t)\n})\n\nfunction hasAnyTrackingOrRoute(stepId: NodeID) {\n\tconst step = engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)\n\tif (!step) return false\n\treturn step.children.some((action: FunnelStepActionNode) => action.trackingId || action.trackingRoutePath)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FunnelStepActionNode } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { MAX_STEP_ACTIONS } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { memo, useCallback } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useMatchingStepActions } from \"../utils/useMatchingStepActions.ts\"\nimport { CustomTrackingIdInput } from \"./CustomTrackingIdInput.tsx\"\n\ninterface CustomEventStepFormProps {\n\tstepId: NodeID\n\tisTrackingTypeDisabled?: boolean\n\tonActionRemove: (actionId: string) => void\n\tonActionChange: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string, actionId: NodeID) => void\n\tonActionCreate: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string) => NodeID | undefined\n}\n\nexport const CustomEventStepForm = memo(function CustomEventStepForm({\n\tstepId,\n\tisTrackingTypeDisabled = false,\n\tonActionRemove,\n\tonActionChange,\n\tonActionCreate,\n}: CustomEventStepFormProps) {\n\tconst matchingStepActions = useMatchingStepActions(stepId, \"custom\")\n\n\tconst onCustomEventCreate = useCallback(\n\t\t(trackingId: string) => {\n\t\t\tif (trackingId) {\n\t\t\t\tonActionCreate({ trackingId }, titleCase(trackingId))\n\t\t\t}\n\t\t},\n\t\t[onActionCreate],\n\t)\n\n\tconst onCustomEventChange = useCallback(\n\t\t(trackingId: string, actionId: NodeID) => {\n\t\t\tif (trackingId) {\n\t\t\t\tonActionChange({ trackingId }, titleCase(trackingId), actionId)\n\t\t\t} else {\n\t\t\t\tonActionRemove(actionId)\n\t\t\t}\n\t\t},\n\t\t[onActionChange, onActionRemove],\n\t)\n\n\tconst isFirstActionStepSelection = matchingStepActions.length === 0\n\n\treturn (\n\t\t<>\n\t\t\t{matchingStepActions.map((action, index) => (\n\t\t\t\t<PanelRow key={action.id} title={index === 0 ? Dictionary.Tracking : \"\"}>\n\t\t\t\t\t<CustomTrackingIdInput\n\t\t\t\t\t\tvalue={action.trackingId || \"\"}\n\t\t\t\t\t\tactionId={action.id}\n\t\t\t\t\t\tonChange={onCustomEventChange}\n\t\t\t\t\t\tdisabled={isTrackingTypeDisabled}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t))}\n\t\t\t{!isTrackingTypeDisabled && matchingStepActions.length < MAX_STEP_ACTIONS && (\n\t\t\t\t<PanelRow title={isFirstActionStepSelection ? Dictionary.Tracking : \"\"}>\n\t\t\t\t\t<CustomTrackingIdInput\n\t\t\t\t\t\tvalue=\"\"\n\t\t\t\t\t\tonCreate={onCustomEventCreate}\n\t\t\t\t\t\tplaceholder={isFirstActionStepSelection ? \"ID\" : \"Add ID\u2026\"}\n\t\t\t\t\t\tautoFocus={isFirstActionStepSelection}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { emptyArray } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReadonlyChildList } from \"document/models/CanvasTree/nodes/ChildList.ts\"\nimport type { FunnelStepActionNode, TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { isFunnelStepNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\n\n/** Returns non empty step actions, depending on the actionTrackingEventType */\nexport function useMatchingStepActions(\n\tstepId: NodeID,\n\tactionTrackingEventType: TrackingEventType,\n): readonly FunnelStepActionNode[] {\n\tconst stepActions: ReadonlyChildList<FunnelStepActionNode> | undefined = useEngineState(\n\t\t() => engine.tree.getNodeWithTrait(stepId, isFunnelStepNode)?.children,\n\t\t[stepId],\n\t\t[EngineChange.Tree],\n\t)\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tstepActions?.filter(\n\t\t\t\taction =>\n\t\t\t\t\taction.trackingEventType === actionTrackingEventType && (action.trackingId || action.trackingRoutePath),\n\t\t\t) ?? emptyArray(),\n\t\t[stepActions, actionTrackingEventType],\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getTrackingId } from \"library/modules/useTracking.ts\"\nimport { memo, useCallback, useState } from \"react\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\n\ninterface CommonCustomTrackingIdInputProps {\n\tvalue: string\n\tplaceholder?: string\n\tdisabled?: boolean\n\tautoFocus?: boolean\n}\n\ntype CustomTrackingIdInputProps =\n\t| ({\n\t\t\tactionId: NodeID\n\t\t\tonChange: (routePath: string, actionId: NodeID) => void\n\t\t\tonCreate?: never\n\t  } & CommonCustomTrackingIdInputProps)\n\t| ({\n\t\t\tactionId?: never\n\t\t\tonChange?: never\n\t\t\tonCreate: (routePath: string) => void\n\t  } & CommonCustomTrackingIdInputProps)\n\nexport const CustomTrackingIdInput = memo(function CustomTrackingIdInput(props: CustomTrackingIdInputProps) {\n\tconst { value, placeholder = \"ID\", disabled, autoFocus } = props\n\n\tconst [editedValue, setEditedValue] = useState(value)\n\n\tconst onInputChange = useCallback((newValue: string) => setEditedValue(getTrackingId(newValue)), [])\n\n\tconst onInputBlur = useCallback(() => {\n\t\tif (props.actionId !== undefined) {\n\t\t\tprops.onChange(getTrackingId(editedValue), props.actionId)\n\t\t} else {\n\t\t\tprops.onCreate(getTrackingId(editedValue))\n\t\t\tsetEditedValue(\"\")\n\t\t}\n\t}, [editedValue, props.actionId, props.onChange, props.onCreate])\n\n\tconst onInputKeyDown = useCallback(\n\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\tif (event.key === \"Enter\") onInputBlur()\n\t\t},\n\t\t[onInputBlur],\n\t)\n\n\treturn (\n\t\t<TextInput\n\t\t\tclassName={doubleColumnClass}\n\t\t\tvalue={editedValue}\n\t\t\tonChange={onInputChange}\n\t\t\tonBlur={onInputBlur}\n\t\t\tonKeyDown={onInputKeyDown}\n\t\t\tplaceholder={placeholder}\n\t\t\tenabled={!disabled}\n\t\t\tautoFocus={autoFocus}\n\t\t\tconstantChange\n\t\t/>\n\t)\n})\n", "import \"FunnelStepPopout.styles_qv19h0.wyw.css\"; export const container = \"container_cw95b44\";\nexport const helpText = \"helpText_h4gxjmy\";", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FunnelStepActionNode } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { MAX_STEP_ACTIONS } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { memo, useCallback, useMemo } from \"react\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { useMatchingStepActions } from \"../utils/useMatchingStepActions.ts\"\nimport { RoutePathComboBox, useRoutePathsForCompletion } from \"./RoutePathComboBox.tsx\"\n\ninterface PageviewFormProps {\n\tstepId: NodeID\n\tisTrackingTypeDisabled?: boolean\n\tonActionRemove: (actionId: string) => void\n\tonActionChange: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string, actionId: NodeID) => void\n\tonActionCreate: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string) => NodeID | undefined\n}\n\nexport const PageviewStepForm = memo(function PageviewStepForm({\n\tstepId,\n\tisTrackingTypeDisabled = false,\n\tonActionRemove,\n\tonActionChange,\n\tonActionCreate,\n}: PageviewFormProps) {\n\tconst { routeByTitle, titleByRoute, comboBoxItems } = useRoutePathsForCompletion()\n\n\tconst matchingStepActions = useMatchingStepActions(stepId, \"pageview\")\n\n\t// Exclude selected options from the autocomplete\n\tconst availableOptions = useMemo(() => {\n\t\tconst selectedRoutePaths = matchingStepActions.map(action => action.trackingRoutePath).filter(Boolean)\n\t\treturn comboBoxItems.filter(item => !selectedRoutePaths.includes(routeByTitle[item.value]))\n\t}, [comboBoxItems, matchingStepActions, routeByTitle])\n\n\tconst onRoutePathChange = useCallback(\n\t\t(trackingRoutePath: string, title: string, actionId: NodeID) =>\n\t\t\tonActionChange({ trackingRoutePath }, `View ${title}`, actionId),\n\t\t[onActionChange],\n\t)\n\n\tconst onRoutePathCreate = useCallback(\n\t\t(trackingRoutePath: string, title: string) => onActionCreate({ trackingRoutePath }, `View ${title}`),\n\t\t[onActionCreate],\n\t)\n\n\tconst isFirstActionStepSelection = matchingStepActions.length === 0\n\n\treturn (\n\t\t<>\n\t\t\t{matchingStepActions.map((action, index) => (\n\t\t\t\t<PanelRow key={action.id} title={index === 0 ? Dictionary.Page : \"\"}>\n\t\t\t\t\t<RoutePathComboBox\n\t\t\t\t\t\tvalue={action.trackingRoutePath || \"\"}\n\t\t\t\t\t\tonChange={onRoutePathChange}\n\t\t\t\t\t\tavailableItems={availableOptions}\n\t\t\t\t\t\trouteByTitle={routeByTitle}\n\t\t\t\t\t\ttitleByRoute={titleByRoute}\n\t\t\t\t\t\tplaceholder={Dictionary.SelectEllipsis}\n\t\t\t\t\t\tonDelete={() => onActionRemove(action.id)}\n\t\t\t\t\t\tactionId={action.id}\n\t\t\t\t\t\tdisabled={isTrackingTypeDisabled}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t))}\n\t\t\t{!isTrackingTypeDisabled && availableOptions.length > 0 && matchingStepActions.length < MAX_STEP_ACTIONS && (\n\t\t\t\t<PanelRow title={isFirstActionStepSelection ? Dictionary.Page : \"\"}>\n\t\t\t\t\t<RoutePathComboBox\n\t\t\t\t\t\tvalue=\"\"\n\t\t\t\t\t\tkey={matchingStepActions.length}\n\t\t\t\t\t\tonCreate={onRoutePathCreate}\n\t\t\t\t\t\tavailableItems={availableOptions}\n\t\t\t\t\t\trouteByTitle={routeByTitle}\n\t\t\t\t\t\ttitleByRoute={titleByRoute}\n\t\t\t\t\t\tplaceholder={isFirstActionStepSelection ? Dictionary.SelectEllipsis : Dictionary.AddEllipsis}\n\t\t\t\t\t\tautoFocus={isFirstActionStepSelection}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import type { ComboBoxListItemOption } from \"@framerjs/fresco\"\nimport { ComboBox, IconInputClose } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { FALLBACK_PATH, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, ShallowWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo, useMemo } from \"react\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport * as styles from \"./RoutePathComboBox.styles.ts\"\n\ninterface CommonRoutePathComboBoxProps {\n\tvalue: string | undefined\n\tonDelete?: (routePath: string | undefined) => void\n\tavailableItems: ComboBoxListItemOption[]\n\trouteByTitle: Record<string, string>\n\ttitleByRoute: Record<string, string>\n\tplaceholder: string\n\tautoFocus?: boolean\n\tactionId?: NodeID\n\tdisabled?: boolean\n}\n\ntype RoutePathComboBoxProps =\n\t| ({\n\t\t\tactionId: NodeID\n\t\t\tonChange: (routePath: string, title: string, actionId: NodeID) => void\n\t\t\tonCreate?: never\n\t  } & CommonRoutePathComboBoxProps)\n\t| ({\n\t\t\tactionId?: never\n\t\t\tonChange?: never\n\t\t\tonCreate: (routePath: string, title: string) => void\n\t  } & CommonRoutePathComboBoxProps)\n\nexport const RoutePathComboBox = memo(function RoutePathComboBox(props: RoutePathComboBoxProps) {\n\tconst {\n\t\tvalue,\n\t\tonDelete,\n\t\tavailableItems,\n\t\tplaceholder,\n\t\trouteByTitle,\n\t\ttitleByRoute,\n\t\tautoFocus = false,\n\t\tdisabled = false,\n\t} = props\n\tconst currentValue = value ? titleByRoute[value] : undefined\n\n\tconst handleOnChange = useEngineCallback(\n\t\t(title: string, _final: boolean, reset: () => void) => {\n\t\t\tconst newRoutePath = routeByTitle[title]\n\t\t\tif (newRoutePath) {\n\t\t\t\tif (props.actionId !== undefined) {\n\t\t\t\t\tprops.onChange(newRoutePath, title, props.actionId)\n\t\t\t\t} else {\n\t\t\t\t\tprops.onCreate(newRoutePath, title)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Always reset to disallow inexistent paths in the input\n\t\t\treset()\n\t\t},\n\t\t[routeByTitle, props.actionId, props.onChange, props.onCreate],\n\t)\n\n\treturn (\n\t\t<ComboBox\n\t\t\tautoFocus={autoFocus}\n\t\t\tautoCompleteEnabled\n\t\t\titems={availableItems}\n\t\t\tplaceholder={placeholder}\n\t\t\tonChange={handleOnChange}\n\t\t\twrapperClassName={doubleColumnClass}\n\t\t\tvalue={currentValue || \"\"}\n\t\t\tenabled={!disabled}\n\t\t\trightSlot={\n\t\t\t\tonDelete &&\n\t\t\t\t!disabled && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={styles.deleteIcon}\n\t\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={() => onDelete(value)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t)\n})\n\ninterface RoutePathsForCompletion {\n\trouteByTitle: Record<string, string>\n\ttitleByRoute: Record<string, string>\n\tcomboBoxItems: ComboBoxListItemOption[]\n}\n\nexport function useRoutePathsForCompletion(): RoutePathsForCompletion {\n\tconst { webPageIdToWebPagePath, homePageNodeId } = useEngineState(\n\t\t() => {\n\t\t\tconst routeSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\t\t\treturn {\n\t\t\t\twebPageIdToWebPagePath: routeSegmentRootNode.getWebPageIdToRawPathMap(engine.tree),\n\t\t\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\treturn useMemo(() => {\n\t\tconst routeByTitle: Record<string, string> = {}\n\t\tconst titleByRoute: Record<string, string> = {}\n\t\tconst comboBoxItems: ComboBoxListItemOption[] = []\n\n\t\tfor (const [webPageId, routePath] of webPageIdToWebPagePath.entries()) {\n\t\t\tconst webPage = engine.tree.get<ShallowWebPageNode>(webPageId)\n\t\t\tif (!webPage) continue\n\n\t\t\tconst isHomePage = webPageId === homePageNodeId\n\t\t\tconst title = isHomePage ? Dictionary.Home : getWebPagePath(engine.tree, webPage) || FALLBACK_PATH\n\t\t\tif (!routePath) continue\n\n\t\t\trouteByTitle[title] = routePath\n\t\t\ttitleByRoute[routePath] = title\n\t\t\tcomboBoxItems.push({ type: \"option\", value: title })\n\t\t}\n\t\treturn { routeByTitle, titleByRoute, comboBoxItems }\n\t}, [webPageIdToWebPagePath, homePageNodeId])\n}\n", "import \"RoutePathComboBox.styles_1p5dz4x.wyw.css\"; export const deleteIcon = \"deleteIcon_d1owowzf\";", "import { Link, T } from \"@framerjs/fresco\"\nimport { emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { TrackingIdForNode } from \"code-generation/utils/TrackingIdCollector.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, ShallowScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tFunnelStepActionNode,\n\tTrackingEventType,\n\tTrackingIdNodeSnapshot,\n} from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { MAX_STEP_ACTIONS } from \"document/models/CanvasTree/nodes/FunnelStepNode.ts\"\nimport { isFunnelNode, isFunnelStepActionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { memo, useCallback, useMemo } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { getTrackingIdNodeForSnapshot } from \"../utils/getTrackingIdNodeForSnapshot.ts\"\nimport { useMatchingStepActions } from \"../utils/useMatchingStepActions.ts\"\nimport * as styles from \"./FunnelStepPopout.styles.ts\"\nimport { TrackingIdComboBox, useTrackingIdsForCompletion } from \"./TrackingIdComboBox.tsx\"\n\ninterface TrackingIdStepFormProps {\n\tfunnelId: NodeID\n\tstepId: NodeID\n\tactionTrackingEventType: Extract<TrackingEventType, \"click\" | \"form_submit\" | \"custom\" | \"trigger_invoke\">\n\tisTrackingTypeDisabled?: boolean\n\tonActionRemove: (actionId: string) => void\n\tonActionChange: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string, actionId: NodeID) => void\n\tonActionCreate: (actionUpdate: Partial<FunnelStepActionNode>, stepName: string) => NodeID | undefined\n}\n\nexport const TrackingIdStepForm = memo(function TrackingIdStepForm({\n\tfunnelId,\n\tstepId,\n\tactionTrackingEventType,\n\tisTrackingTypeDisabled = false,\n\tonActionRemove,\n\tonActionChange,\n\tonActionCreate,\n}: TrackingIdStepFormProps) {\n\tconst snapshotTrackingIdNodes = useExperimentIsOn(\"snapshotTrackingIdNodes\")\n\tconst { dataByTrackingId, comboBoxItems, scopeIdsByTrackingId } = useTrackingIdsForCompletion(actionTrackingEventType)\n\n\tconst matchingStepActions = useMatchingStepActions(stepId, actionTrackingEventType)\n\n\t// Exclude selected options from the autocomplete\n\tconst availableOptions = useMemo(() => {\n\t\tconst selectedTrackingIds = matchingStepActions.map(action => action.trackingId).filter(Boolean)\n\t\treturn comboBoxItems.filter(item => !selectedTrackingIds.includes(item.value))\n\t}, [comboBoxItems, matchingStepActions])\n\n\tconst onTrackingIdCreate = useCallback(\n\t\t(trackingId: string) => {\n\t\t\tconst newActionId = onActionCreate({ trackingId }, titleCase(trackingId))\n\t\t\tif (snapshotTrackingIdNodes && newActionId) {\n\t\t\t\tprocessSnapshotForTrackingId(\n\t\t\t\t\ttrackingId,\n\t\t\t\t\tnewActionId,\n\t\t\t\t\tactionTrackingEventType,\n\t\t\t\t\tdataByTrackingId[trackingId] || emptyArray(),\n\t\t\t\t\tfunnelId,\n\t\t\t\t\tscopeIdsByTrackingId[trackingId] || emptyArray(),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\tonActionCreate,\n\t\t\tsnapshotTrackingIdNodes,\n\t\t\tactionTrackingEventType,\n\t\t\tdataByTrackingId,\n\t\t\tfunnelId,\n\t\t\tscopeIdsByTrackingId,\n\t\t],\n\t)\n\n\tconst onTrackingIdChange = useCallback(\n\t\t(trackingId: string, actionId: NodeID) => onActionChange({ trackingId }, titleCase(trackingId), actionId),\n\t\t[onActionChange],\n\t)\n\n\tconst isFirstActionStepSelection = matchingStepActions.length === 0\n\n\treturn (\n\t\t<>\n\t\t\t{matchingStepActions.map((action, index) => (\n\t\t\t\t<PanelRow key={action.id} title={index === 0 ? Dictionary.Tracking : \"\"}>\n\t\t\t\t\t<TrackingIdComboBox\n\t\t\t\t\t\tkey={action.id}\n\t\t\t\t\t\tvalue={action.trackingId || \"\"}\n\t\t\t\t\t\tactionId={action.id}\n\t\t\t\t\t\tonChange={onTrackingIdChange}\n\t\t\t\t\t\tavailableItems={availableOptions}\n\t\t\t\t\t\tdataByTrackingId={dataByTrackingId}\n\t\t\t\t\t\tplaceholder=\"Select\u2026\"\n\t\t\t\t\t\tonDelete={() => onActionRemove(action.id)}\n\t\t\t\t\t\tdisabled={isTrackingTypeDisabled}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t))}\n\t\t\t{!isTrackingTypeDisabled && availableOptions.length > 0 && matchingStepActions.length < MAX_STEP_ACTIONS && (\n\t\t\t\t<PanelRow title={isFirstActionStepSelection ? Dictionary.Tracking : \"\"}>\n\t\t\t\t\t<TrackingIdComboBox\n\t\t\t\t\t\tkey={matchingStepActions.length}\n\t\t\t\t\t\tvalue=\"\"\n\t\t\t\t\t\tonCreate={onTrackingIdCreate}\n\t\t\t\t\t\tavailableItems={availableOptions}\n\t\t\t\t\t\tdataByTrackingId={dataByTrackingId}\n\t\t\t\t\t\tplaceholder={isFirstActionStepSelection ? \"Select\u2026\" : \"Add\u2026\"}\n\t\t\t\t\t\tautoFocus={isFirstActionStepSelection}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{availableOptions.length === 0 && isFirstActionStepSelection && (\n\t\t\t\t<PanelRow title=\"\">\n\t\t\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t\t\t<Link href=\"https://www.framer.com/help/articles/how-to-track-links-and-forms-in-framer/\">\n\t\t\t\t\t\t\tAdd a tracking ID\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t<T className={styles.helpText}> to a link or form to set up a funnel or an A/B test.</T>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\n/**\n * Creates a snapshot of tracking ID nodes for a funnel step action.\n * This function captures the current state of nodes associated with a tracking ID\n * and stores them as a snapshot in the action node for joining past event data in the funnel.\n *\n * @param trackingId The tracking ID to create a snapshot for\n * @param newActionId The ID of the newly created funnel step action node\n * @param actionTrackingEventType The type of tracking event (only processes 'click' events)\n * @param trackingIdData Array of tracking ID data containing node references\n * @param funnelId The ID of the funnel containing this step\n * @param scopeIdsByTrackingId Map of tracking IDs to their associated scope IDs\n */\nfunction processSnapshotForTrackingId(\n\ttrackingId: string,\n\tnewActionId: NodeID,\n\tactionTrackingEventType: TrackingEventType,\n\ttrackingIdData: readonly TrackingIdForNode[] | undefined,\n\tfunnelId: NodeID,\n\tscopeIds: readonly NodeID[],\n) {\n\t// If the data is missing or the event type is not a click, skip the snapshot\n\tif (trackingIdData === undefined || actionTrackingEventType !== \"click\") return\n\n\t// Don't create a snapshot for an A/B testing funnel, because it\n\t// only needs current events, not past events. Moreover,\n\t// page variants will have different node ids for the same links\n\tconst funnel = engine.tree.getNodeWithTrait(funnelId, isFunnelNode)\n\tif (!funnel || funnel.abTestingParentId) return\n\n\tconst scopesToLoad: ShallowScopeNode[] = []\n\tfor (const scopeId of scopeIds) {\n\t\tconst scope = engine.tree.getNodeWithTrait(scopeId, isScopeNode)\n\t\tif (scope && !scope.isLoaded()) scopesToLoad.push(scope)\n\t}\n\n\tengine.loadScopesThenProcess(scopesToLoad, () => {\n\t\t// If the node is missing or the tracking id has changed, skip the snapshot\n\t\tconst newActionNode = engine.tree.getNodeWithTrait(newActionId, isFunnelStepActionNode)\n\t\tif (!newActionNode || newActionNode.trackingId !== trackingId) return\n\n\t\tconst trackingIdNodesSnapshot: TrackingIdNodeSnapshot[] = []\n\t\tlet skipSnapshot = false\n\n\t\tfor (const { nodeId } of trackingIdData) {\n\t\t\tif (nodeId === undefined) {\n\t\t\t\t// If the nodeId is not set, it means the tracking id was set\n\t\t\t\t// on a component instance. In this case we cannot reliably\n\t\t\t\t// join past events\n\t\t\t\tskipSnapshot = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tconst nodeSnapshots = getTrackingIdNodeForSnapshot(nodeId, trackingId)\n\t\t\tif (nodeSnapshots.length === 0) continue\n\t\t\ttrackingIdNodesSnapshot.push(...nodeSnapshots)\n\t\t}\n\n\t\tif (trackingIdNodesSnapshot.length > 0 && !skipSnapshot) {\n\t\t\tnewActionNode.set({\n\t\t\t\ttrackingIdNodesSnapshot,\n\t\t\t\ttrackingIdNodesSnapshotCreatedAt: new Date().toISOString(),\n\t\t\t})\n\t\t}\n\t\trecord(\"funnel_tracking_id_nodes_snapshot\", {\n\t\t\tfunnelId,\n\t\t\ttrackingId,\n\t\t\tnodeCount: skipSnapshot ? 0 : trackingIdNodesSnapshot.length,\n\t\t})\n\t})\n}\n", "import { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { TrackingIdNodeSnapshot } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isRichTextNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { hasLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToURL } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\n\n/**\n * Creates a trackingIdNodeSnapshot with data for the given link.\n * @param nodeId - The nodeId of the node that contains the link.\n * @param link - The link to create a trackingIdNodeSnapshot for.\n * @returns A new TrackingIdNodeSnapshot with the link data.\n * If the link is a dynamic value, the snapshot will be matched by node id alone.\n * If the link is an external link, the snapshot will have the full href of the link (example: https://www.framer.com).\n * If the link is an internal link, the snapshot will have the targetRoutePath (internal route path, example: /about/).\n * If an internal link is to a collection item page, the snapshot will additionally have the targetCollectionItemId.\n * Otherwise, returns undefined.\n */\nfunction createTrackingIdNodeSnapshot(\n\tnodeId: NodeID,\n\tlink: Link | DynamicValue | undefined,\n): TrackingIdNodeSnapshot | undefined {\n\tif (isUndefined(link)) return\n\n\tconst id = randomID()\n\n\t// Dynamic links are matched by node id alone\n\tif (isDynamicValue(link)) return { id, nodeId }\n\n\t// Handle external links\n\tif (isLinkToURL(link)) return { id, nodeId, href: link.url }\n\n\t// Handle internal links\n\tconst targetWebPageNode = engine.tree.getNodeWithTrait(link.webPageId, isWebPageNode)\n\tconst targetRoutePath = getRawWebPagePath(engine.tree, targetWebPageNode)\n\tif (!targetRoutePath) return\n\n\t// Handle links to collection item\n\tif (link.pathVariables) {\n\t\tfor (const key in link.pathVariables) {\n\t\t\tconst value = link.pathVariables[key]\n\t\t\tif (isResolvedCollectionItemSelector(value)) {\n\t\t\t\treturn {\n\t\t\t\t\tid,\n\t\t\t\t\tnodeId,\n\t\t\t\t\ttargetRoutePath,\n\t\t\t\t\ttargetCollectionItemId: value.collectionItemId,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { id, nodeId, targetRoutePath }\n}\n\n/**\n * Collects all links from a node and returns them as an array.\n * @param node - The node to collect links from.\n * @param trackingId - The trackingId to collect links for.\n * @returns TrackingIdNodeSnapshot[] with merged data of the links.\n */\nexport function getTrackingIdNodeForSnapshot(\n\tnodeId: MaybeNodeID,\n\ttrackingId: string,\n): readonly TrackingIdNodeSnapshot[] {\n\tconst snapshots: TrackingIdNodeSnapshot[] = []\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!node || !nodeId) return snapshots\n\n\tif (hasLink(node) && node.linkClickTrackingId === trackingId) {\n\t\tconst link = node.getLink()\n\t\tconst snapshot = createTrackingIdNodeSnapshot(nodeId, link)\n\t\tif (snapshot) snapshots.push(snapshot)\n\t}\n\n\tif (isRichTextNode(node)) {\n\t\tfor (const link of node.getLinksByClickTrackingId(trackingId)) {\n\t\t\tconst snapshot = createTrackingIdNodeSnapshot(nodeId, link)\n\t\t\tif (snapshot) snapshots.push(snapshot)\n\t\t}\n\t}\n\n\treturn snapshots\n}\n", "import { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ComboBoxListItemOption } from \"@framerjs/fresco\"\nimport { ComboBox, IconInputClose } from \"@framerjs/fresco\"\nimport { parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { TrackingIdForNode } from \"code-generation/utils/TrackingIdCollector.ts\"\nimport { parseTrackingIdsAnnotation } from \"code-generation/utils/TrackingIdCollector.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { memo } from \"react\"\nimport { isDefined } from \"utils/typeChecks.ts\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport * as styles from \"./TrackingIdComboBox.styles.ts\"\n\ninterface CommonTrackingIdComboBoxProps {\n\tvalue: string | undefined\n\tonDelete?: () => void\n\tavailableItems: ComboBoxListItemOption[]\n\tdataByTrackingId: Record<string, TrackingIdForNode[]>\n\tplaceholder: string\n\tautoFocus?: boolean\n\tactionId?: string\n\tdisabled?: boolean\n}\n\ntype TrackingIdComboBoxProps =\n\t| ({\n\t\t\tactionId: NodeID\n\t\t\tonChange: (trackingId: string, actionId: NodeID) => void\n\t\t\tonCreate?: never\n\t  } & CommonTrackingIdComboBoxProps)\n\t| ({\n\t\t\tactionId?: never\n\t\t\tonChange?: never\n\t\t\tonCreate: (trackingId: string) => void\n\t  } & CommonTrackingIdComboBoxProps)\n\nexport const TrackingIdComboBox = memo(function TrackingIdComboBox(props: TrackingIdComboBoxProps) {\n\tconst { value, onDelete, availableItems, dataByTrackingId, placeholder, autoFocus = false, disabled = false } = props\n\tconst currentValue = value && value in dataByTrackingId ? value : undefined\n\tconst hasValue = isDefined(currentValue)\n\n\tconst handleOnChange = useEngineCallback(\n\t\t(trackingId: string, _final: boolean, reset: () => void) => {\n\t\t\tconst hasNewValue = trackingId in dataByTrackingId\n\t\t\tif (hasValue || hasNewValue) {\n\t\t\t\tif (props.actionId !== undefined) {\n\t\t\t\t\tprops.onChange(trackingId, props.actionId)\n\t\t\t\t} else {\n\t\t\t\t\tprops.onCreate(trackingId)\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Always reset, to disallow inexistent tracking ids in the input\n\t\t\treset()\n\t\t},\n\t\t[dataByTrackingId, hasValue, props.actionId, props.onChange, props.onCreate],\n\t)\n\treturn (\n\t\t<ComboBox\n\t\t\tautoFocus={autoFocus}\n\t\t\tautoCompleteEnabled\n\t\t\titems={availableItems}\n\t\t\tplaceholder={placeholder}\n\t\t\tonChange={handleOnChange}\n\t\t\twrapperClassName={doubleColumnClass}\n\t\t\tvalue={currentValue || \"\"}\n\t\t\tenabled={!disabled}\n\t\t\trightSlot={\n\t\t\t\tonDelete &&\n\t\t\t\t!disabled && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={styles.deleteIcon}\n\t\t\t\t\t\tonMouseDown={e => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={() => onDelete()}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t)\n})\n\ninterface RoutePathsForCompletion {\n\tdataByTrackingId: Record<string, TrackingIdForNode[]>\n\tcomboBoxItems: ComboBoxListItemOption[]\n\tscopeIdsByTrackingId: Record<string, NodeID[]>\n}\n\nexport function useTrackingIdsForCompletion(trackingEventType: TrackingEventType | undefined): RoutePathsForCompletion {\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst dataByTrackingId: Record<string, TrackingIdForNode[]> = {}\n\t\t\tconst comboBoxItems: ComboBoxListItemOption[] = []\n\t\t\tconst scopeIdsByTrackingId: Record<string, NodeID[]> = {}\n\n\t\t\t// @TODO external modules that receive tracking ids are not yet supported\n\t\t\tfor (const node of engine.tree.root.children) {\n\t\t\t\tif (!isLayoutTemplateNode(node) && !isSmartComponentNode(node) && !isWebPageNode(node)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst moduleType = parseModuleIdentifier(node.instanceIdentifier).type\n\t\t\t\tif (!moduleType) continue\n\n\t\t\t\tconst rawAnnotation = engine.stores.modulesStore\n\t\t\t\t\t.forType(moduleType)\n\t\t\t\t\t.getByStableName(node.id)\n\t\t\t\t\t?.annotations(null, \"default\")?.[AnnotationKey.FramerTrackingIds]\n\n\t\t\t\tconst trackingIdsAnnotation = parseTrackingIdsAnnotation(rawAnnotation)\n\t\t\t\tif (!trackingIdsAnnotation) continue\n\n\t\t\t\tfor (const annotation of trackingIdsAnnotation) {\n\t\t\t\t\t// If the type is not known, we still want to include it in the list\n\t\t\t\t\tif (annotation.type && annotation.type !== trackingEventType) continue\n\n\t\t\t\t\tlet currentItem = dataByTrackingId[annotation.trackingId]\n\t\t\t\t\tif (!currentItem) {\n\t\t\t\t\t\tcurrentItem = dataByTrackingId[annotation.trackingId] = []\n\t\t\t\t\t}\n\t\t\t\t\tcurrentItem.push(annotation)\n\n\t\t\t\t\t// For tracking ids that are associated with a node,\n\t\t\t\t\t// we want to collect the scope ids that we need to load\n\t\t\t\t\t// in order to access the node\n\t\t\t\t\tif (annotation.nodeId) {\n\t\t\t\t\t\tconst currentScopeIds = scopeIdsByTrackingId[annotation.trackingId] ?? []\n\t\t\t\t\t\tcurrentScopeIds.push(node.id)\n\t\t\t\t\t\tscopeIdsByTrackingId[annotation.trackingId] = currentScopeIds\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const trackingId in dataByTrackingId) {\n\t\t\t\tcomboBoxItems.push({ type: \"option\", value: trackingId })\n\t\t\t}\n\t\t\treturn { dataByTrackingId, scopeIdsByTrackingId, comboBoxItems }\n\t\t},\n\t\t[trackingEventType],\n\t\t[engine.stores.modulesStore, EngineChange.Tree],\n\t\t{ deepEqual: true },\n\t)\n}\n", "import \"TrackingIdComboBox.styles_15r4e12.wyw.css\"; export const deleteIcon = \"deleteIcon_dte0zm7\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport type { TrackingEventType } from \"document/models/CanvasTree/nodes/FunnelStepActionNode.ts\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport { getSupportedTrackingEventTypes, getTrackingEventTypeTitle } from \"../utils/trackingEventTypes.tsx\"\n\nexport function TrackingTypeDropdown({\n\tvalue,\n\tonSelect,\n\tdisabled = false,\n}: {\n\tvalue: TrackingEventType | undefined\n\tonSelect: (value: TrackingEventType) => void\n\tdisabled?: boolean\n}) {\n\treturn (\n\t\t<div className={doubleColumnClass}>\n\t\t\t<PopupButton enabled={!disabled}>\n\t\t\t\t{getSupportedTrackingEventTypes().map(option => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\ttitle={getTrackingEventTypeTitle(option)}\n\t\t\t\t\t\tselected={value === option}\n\t\t\t\t\t\tonSelect={disabled ? noop : onSelect}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</div>\n\t)\n}\n", "import { MetricsViewContext } from \"app/metrics.ts\"\nimport type { RemoteCursor } from \"document/RemoteUsers.ts\"\nimport engine from \"document/engine.ts\"\nimport { MagicColorContext } from \"feedback/MagicColorContext.tsx\"\nimport { isDraftThread } from \"feedback/model.ts\"\nimport type { CommentMetadataMap, MentionableUser, SelectionState, Thread, User } from \"feedback/types.ts\"\nimport React from \"react\"\nimport { EngineChange } from \"../../../EngineChanges.ts\"\nimport { createContainer } from \"../../utils/createContainer.ts\"\nimport { FeedbackHUD } from \"./FeedbackHUD.tsx\"\nimport { createFeedbackDispatcher } from \"./dispatcher.ts\"\n\ninterface State {\n\tmentionableUsers: readonly MentionableUser[]\n\tthreads: readonly Thread[]\n\tarchivedThreads: readonly Thread[]\n\tselection: SelectionState\n\tcommentMetadata: CommentMetadataMap\n\tcurrentUser: User | undefined\n\tisActive: boolean\n\tisDarkMode: boolean\n\tcursors: RemoteCursor[]\n\tisContextMenuOpen: boolean\n}\n\nexport const FeedbackHUDContainer = createContainer(\n\tclass extends React.PureComponent<{}, State> {\n\t\tstatic engineChangeKeys = [\n\t\t\tengine.stores.feedbackStore,\n\t\t\tEngineChange.RemoteUsersStore,\n\t\t\tEngineChange.Tool,\n\t\t\tengine.stores.toolStore,\n\t\t\tengine.stores.contextMenuStore,\n\t\t]\n\n\t\tstatic override contextType = MetricsViewContext\n\t\tdeclare context: React.ContextType<typeof MetricsViewContext>\n\n\t\tstatic calculateState(): State {\n\t\t\tconst { canvasStore, remoteUsers, toolStore, contextMenuStore } = engine.stores\n\t\t\tcanvasStore.assertInteractive()\n\n\t\t\tconst { threads, archivedThreads, currentUser, selectionState, commentMetadata, mentionableUsers } =\n\t\t\t\tengine.stores.feedbackStore\n\n\t\t\treturn {\n\t\t\t\tmentionableUsers,\n\t\t\t\tthreads,\n\t\t\t\tarchivedThreads,\n\t\t\t\tisActive: toolStore.feedbackModeActive,\n\t\t\t\tcurrentUser,\n\t\t\t\tselection: selectionState,\n\t\t\t\tcommentMetadata,\n\t\t\t\tisDarkMode: remoteUsers.isDarkMode,\n\t\t\t\tcursors: remoteUsers.cursors,\n\t\t\t\tisContextMenuOpen: Boolean(contextMenuStore.menu),\n\t\t\t}\n\t\t}\n\n\t\toverride render() {\n\t\t\tconst {\n\t\t\t\tisActive,\n\t\t\t\tcurrentUser,\n\t\t\t\tthreads,\n\t\t\t\tarchivedThreads,\n\t\t\t\tselection,\n\t\t\t\tmentionableUsers,\n\t\t\t\tisContextMenuOpen,\n\t\t\t\t...rest\n\t\t\t} = this.state\n\t\t\tif (!isActive || !currentUser) return null\n\n\t\t\tconst dispatch = createFeedbackDispatcher({ metricsContext: this.context })\n\n\t\t\tconst filteredSelection =\n\t\t\t\tselection.threadId && isDraftThread(selection.threadId) ? { ...selection, threadId: undefined } : selection\n\t\t\treturn (\n\t\t\t\t<MagicColorContext.Provider value={{ isDarkMode: this.state.isDarkMode, cursors: this.state.cursors }}>\n\t\t\t\t\t<FeedbackHUD\n\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t\tthreads={threads}\n\t\t\t\t\t\tarchivedThreads={archivedThreads}\n\t\t\t\t\t\tcurrentUser={currentUser}\n\t\t\t\t\t\tselection={filteredSelection}\n\t\t\t\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\tdispatch={dispatch}\n\t\t\t\t\t/>\n\t\t\t\t</MagicColorContext.Provider>\n\t\t\t)\n\t\t}\n\t},\n)\n", "import { Suspense } from \"react\"\nimport type { Props as FeedbackSidebarProps } from \"../../../../feedback/FeedbackSidebar.tsx\"\nimport { FeedbackSidebar } from \"../../../../feedback/FeedbackSidebar.tsx\"\nimport * as styles from \"./FeedbackHUD.styles.ts\"\n\nexport const FeedbackHUD = (props: FeedbackSidebarProps & { isContextMenuOpen: boolean }) => {\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Suspense fallback={null}>\n\t\t\t\t<FeedbackSidebar {...props} />\n\t\t\t</Suspense>\n\t\t</div>\n\t)\n}\n", "import {\n\tEmptyState,\n\tIconEmptyStateComment,\n\tIconInputDropdown,\n\tProjectBarButton,\n\tScroll,\n\tSpacer,\n\tSpinner,\n\tTranslatable as T,\n\tTabBar,\n} from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever, delay } from \"@framerjs/shared\"\nimport { noopAsync } from \"@framerjs/shared/src/noop.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { Panel } from \"document/components/chrome/properties/panels/Panel.tsx\"\nimport engine from \"document/engine.ts\"\nimport type React from \"react\"\nimport { useCallback, useState } from \"react\"\nimport * as styles from \"./FeedbackSidebar.styles.ts\"\nimport { FeedbackThread } from \"./FeedbackThread.tsx\"\nimport { FeedbackThreadSummary } from \"./FeedbackThreadSummary.tsx\"\nimport type { Dispatcher } from \"./actions.ts\"\nimport { FeedbackActionType } from \"./actions.ts\"\nimport { isLocalId } from \"./model.ts\"\nimport type { CommentMetadataMap, MentionableUser, Point, SelectionState, Thread, User } from \"./types.ts\"\nimport { Tab } from \"./types.ts\"\nimport { useCommentContextMenu } from \"./useCommentContextMenu.ts\"\nimport { getThreadPermalink } from \"./utils.ts\"\n\nconst tabs: Tab[] = [Tab.All, Tab.Archived]\n\nfunction convertTabName(tab: Tab) {\n\tswitch (tab) {\n\t\tcase Tab.All:\n\t\t\treturn \"Open\"\n\t\tcase Tab.Archived:\n\t\t\treturn \"Resolved\"\n\t\tdefault:\n\t\t\treturn assertNever(tab)\n\t}\n}\n\nexport interface Props {\n\tmentionableUsers: readonly MentionableUser[]\n\tcurrentUser: User\n\tthreads: readonly Thread[]\n\tarchivedThreads: readonly Thread[]\n\tselection: SelectionState\n\tcommentMetadata: CommentMetadataMap\n\tisContextMenuOpen: boolean\n\tdispatch?: Dispatcher\n}\n\nexport const FeedbackSidebar = ({\n\tmentionableUsers,\n\tcurrentUser,\n\tthreads,\n\tarchivedThreads,\n\tselection,\n\tcommentMetadata,\n\tisContextMenuOpen,\n\tdispatch = noopAsync,\n}: Props) => {\n\tconst thread =\n\t\tthreads.find(t => t.id === selection.threadId) || archivedThreads.find(t => t.id === selection.threadId)\n\n\tconst [isArchiveLoading, handleTabChange] = useArchiveLoader({\n\t\tdispatch,\n\t\thasArchivedThreads: archivedThreads.length > 0,\n\t})\n\n\tconst handleSelect = useCallback(\n\t\tasync (id: string) => {\n\t\t\tawait dispatch({ type: FeedbackActionType.ThreadSelect, id })\n\t\t},\n\t\t[dispatch],\n\t)\n\n\tconst handleThreadContextMenu = useThreadContextMenu({\n\t\tcurrentUserId: currentUser.id,\n\t\tthreads,\n\t\tarchivedThreads,\n\t\tdispatch,\n\t})\n\n\tconst handleCommentContextMenu = useCommentContextMenu({\n\t\tcurrentUserId: currentUser.id,\n\t\tthreads,\n\t\tarchivedThreads,\n\t\tcommentMetadata,\n\t\tdispatch,\n\t})\n\n\tconst toggleThreadStatus = useCallback(async () => {\n\t\tif (!thread) return\n\t\tif (isLocalId(thread.id)) return\n\t\tif (!thread.archived) {\n\t\t\t// Deselect immediately\u2014jump to list view!\n\t\t\tawait dispatch({\n\t\t\t\ttype: FeedbackActionType.ThreadSelect,\n\t\t\t\tid: undefined,\n\t\t\t})\n\t\t}\n\t\tawait dispatch({\n\t\t\ttype: FeedbackActionType.ThreadUpdate,\n\t\t\tid: thread.id,\n\t\t\tarchived: !thread.archived,\n\t\t})\n\t}, [dispatch, thread])\n\n\tconst isLoading = selection.tab === Tab.Archived && isArchiveLoading\n\tconst filtered = threadsForTab(selection.tab, threads, archivedThreads)\n\n\tconst displayTabDropdown = displayFeedbackPanelPicker(selection.tab, handleTabChange)\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t{thread ? (\n\t\t\t\t<FeedbackThread\n\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\tid={thread.id}\n\t\t\t\t\tcomments={thread.comments}\n\t\t\t\t\tselectedCommentId={selection.commentId}\n\t\t\t\t\tisArchived={thread.archived}\n\t\t\t\t\tseenUntil={selection.seenUntil}\n\t\t\t\t\tcommentMetadata={commentMetadata}\n\t\t\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\t\t\tdispatch={dispatch}\n\t\t\t\t\tonCommentContextMenu={handleCommentContextMenu}\n\t\t\t\t\tonThreadContextMenu={handleThreadContextMenu}\n\t\t\t\t\ttoggleThreadStatus={toggleThreadStatus}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Panel\n\t\t\t\t\t\tclassName={styles.panelHeader}\n\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t<TabBar className={styles.tabBar}>\n\t\t\t\t\t\t\t\t<T className={styles.tabBarTitle}>Comments</T>\n\t\t\t\t\t\t\t\t<ProjectBarButton\n\t\t\t\t\t\t\t\t\tclassName={styles.dropdownButton}\n\t\t\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t\t\t\ttitle={convertTabName(selection.tab)}\n\t\t\t\t\t\t\t\t\tonMouseDown={displayTabDropdown}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<T>{convertTabName(selection.tab)}</T>\n\t\t\t\t\t\t\t\t\t<Spacer size={8} />\n\t\t\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t\t\t</ProjectBarButton>\n\t\t\t\t\t\t\t</TabBar>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{tabContent(\n\t\t\t\t\t\tselection.tab,\n\t\t\t\t\t\tfiltered,\n\t\t\t\t\t\tcommentMetadata,\n\t\t\t\t\t\tisLoading,\n\t\t\t\t\t\tisContextMenuOpen,\n\t\t\t\t\t\thandleSelect,\n\t\t\t\t\t\thandleThreadContextMenu,\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction displayFeedbackPanelPicker(selected: Tab, onItemSelected: (value: Tab) => void) {\n\treturn (event: React.MouseEvent<HTMLButtonElement>) => {\n\t\tevent.stopPropagation()\n\t\tconst { right, bottom } = event.currentTarget.getBoundingClientRect()\n\t\tconst y = bottom + dimensions.values.inputSpacing\n\t\tconst menuOptions: MenuItemOptions[] = tabs.map(item => {\n\t\t\treturn {\n\t\t\t\tlabel: convertTabName(item),\n\t\t\t\tchecked: item === selected,\n\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\tonItemSelected(item)\n\t\t\t\t}),\n\t\t\t}\n\t\t})\n\t\tengine.stores.contextMenuStore.show(menuOptions, { location: { x: right, y } })\n\t}\n}\n\nfunction tabContent(\n\tselected: Tab,\n\tfiltered: readonly Thread[],\n\tcommentMetadata: CommentMetadataMap,\n\tisLoading: boolean,\n\tisContextMenuOpen: boolean,\n\thandleSelect: (id: string) => Promise<void>,\n\thandleThreadContextMenu: (threadId: string, point: Point) => void,\n) {\n\tlet content: React.ReactNode | undefined\n\n\tif (isLoading) {\n\t\tcontent = <Spinner size=\"normal\" />\n\t} else if (filtered.length === 0) {\n\t\tcontent = (\n\t\t\t<EmptyState\n\t\t\t\tcenter\n\t\t\t\ticonLarge\n\t\t\t\ticon={\n\t\t\t\t\t<div className={styles.iconContainer}>\n\t\t\t\t\t\t<IconEmptyStateComment />\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\ticonColor={colors.tint}\n\t\t\t\ttitle=\"Comments\"\n\t\t\t\tbody={\n\t\t\t\t\tselected === Tab.All ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<T>Add comments by clicking</T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<T>anywhere on the Canvas.</T>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<T>There are no resolved</T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<T>comments yet.</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} else {\n\t\tcontent = (\n\t\t\t<Scroll>\n\t\t\t\t<ul className={styles.threadSummaryList}>\n\t\t\t\t\t{filtered.map(t => (\n\t\t\t\t\t\t<FeedbackThreadSummary\n\t\t\t\t\t\t\tid={t.id}\n\t\t\t\t\t\t\tkey={t.id}\n\t\t\t\t\t\t\tComponent=\"li\"\n\t\t\t\t\t\t\tcomments={t.comments}\n\t\t\t\t\t\t\tseenUntil={t.seenUntil}\n\t\t\t\t\t\t\tcommentMetadata={commentMetadata}\n\t\t\t\t\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\t\t\tonContextMenu={handleThreadContextMenu}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ul>\n\t\t\t</Scroll>\n\t\t)\n\t}\n\n\treturn <div className={styles.tabContent}>{content}</div>\n}\n\nfunction useArchiveLoader({\n\thasArchivedThreads,\n\tdispatch,\n}: {\n\thasArchivedThreads: boolean\n\tdispatch: Dispatcher\n}): [boolean, (tab: Tab) => void] {\n\tconst [isArchiveLoading, setIsArchiveLoading] = useState(false)\n\tconst handleTabChange = useCallback(\n\t\t(tab: Tab) => {\n\t\t\tconst loading = dispatch({ type: FeedbackActionType.TabChange, tab })\n\n\t\t\tif (tab !== Tab.Archived) return\n\t\t\tif (!hasArchivedThreads) {\n\t\t\t\tsetIsArchiveLoading(true)\n\t\t\t}\n\t\t\t// Show loading spinner for at least 0.5 seconds to avoid\n\t\t\t// flashing the UI.\n\t\t\tPromise.all([delay(500), loading])\n\t\t\t\t.then(() => setIsArchiveLoading(false))\n\t\t\t\t.catch(() => setIsArchiveLoading(false))\n\t\t},\n\t\t[hasArchivedThreads, dispatch],\n\t)\n\n\treturn [isArchiveLoading, handleTabChange]\n}\n\nfunction threadsForTab(tab: Tab, threads: readonly Thread[], archivedThreads: readonly Thread[]): readonly Thread[] {\n\tswitch (tab) {\n\t\tcase Tab.All:\n\t\t\treturn threads\n\t\tcase Tab.Archived:\n\t\t\treturn archivedThreads\n\t\tdefault:\n\t\t\treturn assertNever(tab)\n\t}\n}\n\nfunction useThreadContextMenu({\n\tcurrentUserId,\n\tthreads,\n\tarchivedThreads,\n\tdispatch,\n}: {\n\tcurrentUserId: string\n\tthreads: readonly Thread[]\n\tarchivedThreads: readonly Thread[]\n\tdispatch: Dispatcher\n}): (threadId: string, point: Point) => void {\n\treturn useCallback(\n\t\tasync (threadId: string, point: Point) => {\n\t\t\tconst target = threads.concat(archivedThreads).find(t => t.id === threadId)\n\t\t\tif (!target) return\n\n\t\t\tconst canDeleteThread =\n\t\t\t\t!isLocalId(threadId) && target.comments[0] && target.comments[0].author.id === currentUserId\n\n\t\t\tconst items: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Copy Link\",\n\t\t\t\t\tenabled: !isLocalId(threadId),\n\t\t\t\t\tclick: () => dispatch({ type: FeedbackActionType.Copy, data: getThreadPermalink({ threadId }) }),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Reopen\",\n\t\t\t\t\tvisible: target.archived,\n\t\t\t\t\tclick: () =>\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\ttype: FeedbackActionType.ThreadUpdate,\n\t\t\t\t\t\t\tid: target.id,\n\t\t\t\t\t\t\tarchived: false,\n\t\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Delete\",\n\t\t\t\t\tenabled: canDeleteThread, // Thread should not be visible, but let's be extra safe\n\t\t\t\t\tclick: () =>\n\t\t\t\t\t\tdispatch({\n\t\t\t\t\t\t\ttype: FeedbackActionType.ThreadDelete,\n\t\t\t\t\t\t\tid: threadId,\n\t\t\t\t\t\t\thasMultipleComments: target.comments.length > 1,\n\t\t\t\t\t\t}),\n\t\t\t\t\tvisible: canDeleteThread,\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tawait dispatch({ type: FeedbackActionType.ContextMenuOpen, items, point })\n\t\t},\n\t\t[threads, archivedThreads, dispatch, currentUserId],\n\t)\n}\n", "import \"FeedbackSidebar.styles_1awhrxp.wyw.css\"; export const container = \"container_c8i9p19\";\nexport const tabBar = \"tabBar_t1yzys4a\";\nexport const tabBarTitle = \"tabBarTitle_t13xrehq\";\nexport const tabContent = \"tabContent_t4nt997\";\nexport const panelHeader = \"panelHeader_p1eje8kk\";\nexport const dropdownButton = \"dropdownButton_d1uaogtb\";\nexport const iconContainer = \"iconContainer_icmrhez\";\nexport const threadSummaryList = \"threadSummaryList_t1itnxvf\";", "import { ProjectBarButton, TabBar } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { noopAsync } from \"@framerjs/shared/src/noop.ts\"\nimport { Map as ImmutableMap } from \"immutable\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { FeedbackComment, FeedbackCommentWrapper } from \"./FeedbackComment.tsx\"\nimport { EditFeedbackCommentForm, FeedbackCommentForm } from \"./FeedbackCommentForm.tsx\"\nimport * as styles from \"./FeedbackThread.styles.ts\"\nimport type { Dispatcher } from \"./actions.ts\"\nimport { FeedbackActionType } from \"./actions.ts\"\nimport { isLocalId } from \"./model.ts\"\nimport type { Comment, CommentMetadataMap, Mention, MentionableUser, Point } from \"./types.ts\"\nimport { useScrollLock } from \"./useScrollLock.ts\"\nimport { hasSendError, isEditing } from \"./utils.ts\"\n\nexport interface Props {\n\tmentionableUsers: readonly MentionableUser[]\n\tid: string\n\tcomments: readonly Comment[]\n\tseenUntil?: Date | undefined\n\tcommentMetadata?: CommentMetadataMap\n\tselectedCommentId?: string | undefined\n\tisArchived?: boolean\n\tisContextMenuOpen: boolean\n\tdispatch?: Dispatcher\n\tonCommentContextMenu: (_: { threadId: string; commentId: string; point: Point }) => void\n\tonThreadContextMenu: (threadId: string, point: Point) => void\n\ttoggleThreadStatus: () => Promise<void>\n}\n\nexport const FeedbackThread = ({\n\tmentionableUsers,\n\tid,\n\tcomments,\n\tseenUntil = undefined,\n\tcommentMetadata = ImmutableMap(),\n\tisArchived = false,\n\tselectedCommentId = undefined,\n\tisContextMenuOpen,\n\tdispatch = noopAsync,\n\tonCommentContextMenu,\n\tonThreadContextMenu,\n\ttoggleThreadStatus,\n}: Props) => {\n\tassert(comments.length > 0, \"There must be at least one comment\")\n\tconst { scrollContainer, scrollOffset, handleScroll } = useScrollLock()\n\n\tconst handleSubmit = useCallback(\n\t\tasync (value: string, mentions: Mention[]) => {\n\t\t\tscrollOffset.current = null\n\t\t\tawait dispatch({ type: FeedbackActionType.CommentCreate, threadId: id, text: value, mentions })\n\t\t},\n\t\t[id, dispatch, scrollOffset],\n\t)\n\n\tconst handleCancel = useCallback(() => dispatch({ type: FeedbackActionType.ThreadSelect, id: undefined }), [dispatch])\n\n\tconst handleCommentContextMenu = useCallback(\n\t\t(commentId: string, point: Point) => {\n\t\t\tonCommentContextMenu({ threadId: id, commentId, point })\n\t\t},\n\t\t[onCommentContextMenu, id],\n\t)\n\n\tconst handleThreadContextMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tconst rect = event.currentTarget.getBoundingClientRect()\n\t\t\tconst point = {\n\t\t\t\tx: rect.right - 4,\n\t\t\t\ty: rect.bottom + 10,\n\t\t\t}\n\t\t\tonThreadContextMenu(id, point)\n\t\t},\n\t\t[onThreadContextMenu, id],\n\t)\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<TabBar className={styles.threadTabBar}>\n\t\t\t\t<ProjectBarButton onClick={handleCancel}>\n\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\">\n\t\t\t\t\t\t<title>Back</title>\n\t\t\t\t\t\t<path\n\t\t\t\t\t\t\td=\"M6 1 2 5l4 4\"\n\t\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\t\tstrokeWidth=\"1.75\"\n\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t</ProjectBarButton>\n\t\t\t\t<div className={styles.rightActions}>\n\t\t\t\t\t<ProjectBarButton onClick={toggleThreadStatus}>\n\t\t\t\t\t\t{isArchived ? \"Reopen\" : <IconResolveComment />}\n\t\t\t\t\t</ProjectBarButton>\n\t\t\t\t\t{!isArchived && (\n\t\t\t\t\t\t<ProjectBarButton className={styles.menuButton} onClick={handleThreadContextMenu}>\n\t\t\t\t\t\t\t<IconMore />\n\t\t\t\t\t\t</ProjectBarButton>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</TabBar>\n\t\t\t<div ref={scrollContainer} className={styles.scroll} onScroll={handleScroll}>\n\t\t\t\t<ul className={styles.replies}>\n\t\t\t\t\t<ThreadItems\n\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t\tthreadId={id}\n\t\t\t\t\t\tcomments={comments}\n\t\t\t\t\t\tseenUntil={seenUntil}\n\t\t\t\t\t\tcommentMetadata={commentMetadata}\n\t\t\t\t\t\tselectedCommentId={selectedCommentId}\n\t\t\t\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\t\t\t\tonContextMenu={handleCommentContextMenu}\n\t\t\t\t\t\tdispatch={dispatch}\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t{!isArchived && (\n\t\t\t\t<div className={styles.form}>\n\t\t\t\t\t<FeedbackCommentForm\n\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t\tonCancel={handleCancel}\n\t\t\t\t\t\tonSubmit={handleSubmit}\n\t\t\t\t\t\tdisabled={isLocalId(id)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction IconResolveComment() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\">\n\t\t\t<title>Resolve Comment</title>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeDasharray=\"11.33\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\tstrokeWidth=\"1.75\"\n\t\t\t\td=\"M 1 5.5 L 4 8 L 9 1.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconMore() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\">\n\t\t\t<title>More Actions</title>\n\t\t\t<path\n\t\t\t\td=\"M 10 13.5 C 10.828 13.5 11.5 14.172 11.5 15 C 11.5 15.828 10.828 16.5 10 16.5 C 9.172 16.5 8.5 15.828 8.5 15 C 8.5 14.172 9.172 13.5 10 13.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 15 13.5 C 15.828 13.5 16.5 14.172 16.5 15 C 16.5 15.828 15.828 16.5 15 16.5 C 14.172 16.5 13.5 15.828 13.5 15 C 13.5 14.172 14.172 13.5 15 13.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 20 13.5 C 20.828 13.5 21.5 14.172 21.5 15 C 21.5 15.828 20.828 16.5 20 16.5 C 19.172 16.5 18.5 15.828 18.5 15 C 18.5 14.172 19.172 13.5 20 13.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction ThreadItems({\n\tmentionableUsers,\n\tthreadId,\n\tcomments,\n\tseenUntil,\n\tcommentMetadata,\n\tselectedCommentId,\n\tisContextMenuOpen,\n\tdispatch,\n\tonContextMenu,\n}: {\n\tmentionableUsers: readonly MentionableUser[]\n\tthreadId: string\n\tcomments: readonly Comment[]\n\tseenUntil: Date | undefined\n\tcommentMetadata: CommentMetadataMap\n\tselectedCommentId: string | undefined\n\tisContextMenuOpen: boolean\n\tdispatch: Dispatcher\n\tonContextMenu?: (commentId: string, point: Point) => void\n}) {\n\tconst feed = comments.map(c => {\n\t\tlet comment: React.ReactElement\n\t\tif (isEditing(c, commentMetadata)) {\n\t\t\t/* eslint-disable react/jsx-no-bind */\n\t\t\tcomment = (\n\t\t\t\t<FeedbackCommentWrapper key={c.id} comment={c}>\n\t\t\t\t\t<EditFeedbackCommentForm\n\t\t\t\t\t\tmentionableUsers={mentionableUsers}\n\t\t\t\t\t\tdefaultValue={c.text}\n\t\t\t\t\t\tonSubmit={(text, mentions) =>\n\t\t\t\t\t\t\tdispatch({ type: FeedbackActionType.CommentUpdate, id: c.id, threadId, text, mentions })\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonCancel={() => dispatch({ type: FeedbackActionType.CommentEditCancel, id: c.id, threadId })}\n\t\t\t\t\t/>\n\t\t\t\t</FeedbackCommentWrapper>\n\t\t\t)\n\t\t\t/* eslint-enable react/jsx-no-bind */\n\t\t} else {\n\t\t\tcomment = c.deletedBy ? (\n\t\t\t\t<li key={c.id} className={styles.deletedComment} />\n\t\t\t) : (\n\t\t\t\t<FeedbackComment\n\t\t\t\t\tkey={c.id}\n\t\t\t\t\tComponent=\"li\"\n\t\t\t\t\tcomment={c}\n\t\t\t\t\tfocus={selectedCommentId === c.id}\n\t\t\t\t\tisEdited={isEdited(c)}\n\t\t\t\t\thasSendError={hasSendError(c, commentMetadata)}\n\t\t\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\tisUnread={!seenUntil || seenUntil < c.createdAt}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\treturn comment\n\t})\n\treturn <>{feed}</>\n}\n\nfunction isEdited({ createdAt, updatedAt }: { createdAt: Date; updatedAt: Date | undefined }): boolean {\n\tif (!updatedAt) return false\n\treturn updatedAt.getTime() > createdAt.getTime()\n}\n", "import { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { useCallback } from \"react\"\nimport { scrollIntoView } from \"../utils/scroll-into-view-if-needed/index.ts\"\nimport * as styles from \"./FeedbackComment.styles.ts\"\nimport { FeedbackActiveStatus, FeedbackErrorStatus, FeedbackItem } from \"./FeedbackItem.tsx\"\nimport { containsOnlyEmoji } from \"./markup.ts\"\nimport type { Comment, Point } from \"./types.ts\"\nimport { useSafeComment } from \"./useFeedbackCommentEditorView.ts\"\n\ninterface Props {\n\tcomment: Comment\n\tfocus?: boolean\n\tisUnread?: boolean\n\tisEdited?: boolean\n\thasSendError?: boolean\n\tisContextMenuOpen?: boolean\n\tonContextMenu?: (commentId: string, point: Point) => void\n\tComponent?: React.ElementType\n\tchildren?: React.ReactNode\n}\n\nexport const FeedbackComment = ({ children, ...props }: Props) => {\n\tconst text = props.comment.text\n\tconst { html, textContent } = useSafeComment(text)\n\tconst hasOnlyEmoji = containsOnlyEmoji(textContent)\n\treturn (\n\t\t<FeedbackCommentWrapper {...props}>\n\t\t\t<div\n\t\t\t\tclassName={cx(styles.comment, hasOnlyEmoji && styles.hasOnlyEmoji)}\n\t\t\t\t// biome-ignore lint/security/noDangerouslySetInnerHtml: intentional\n\t\t\t\tdangerouslySetInnerHTML={{ __html: html }}\n\t\t\t/>\n\t\t\t{children}\n\t\t</FeedbackCommentWrapper>\n\t)\n}\n\nexport const FeedbackCommentWrapper = ({\n\tComponent = \"div\",\n\tcomment,\n\tfocus = false,\n\tisUnread = false,\n\tisEdited = false,\n\thasSendError = false,\n\tisContextMenuOpen = false,\n\tonContextMenu,\n\tchildren,\n}: Props) => {\n\tconst handleContextMenu = useCallback(\n\t\t(point: Point) => {\n\t\t\tif (onContextMenu) {\n\t\t\t\tonContextMenu(comment.id, point)\n\t\t\t}\n\t\t},\n\t\t[comment, onContextMenu],\n\t)\n\n\tconst determineStatus = () => {\n\t\tif (hasSendError) {\n\t\t\treturn <FeedbackErrorStatus>Failed to send</FeedbackErrorStatus>\n\t\t} else if (isUnread) {\n\t\t\treturn <FeedbackActiveStatus>New</FeedbackActiveStatus>\n\t\t} else if (isEdited) {\n\t\t\treturn \"Edited\"\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\tconst status = determineStatus()\n\n\tconst scrollIntoViewEffect = useCallback(\n\t\t(node: HTMLElement | null) => {\n\t\t\tif (node && focus) {\n\t\t\t\tscrollIntoView(node, { behavior: \"auto\", block: \"center\", inline: \"start\" })\n\t\t\t}\n\t\t},\n\t\t[focus],\n\t)\n\n\treturn (\n\t\t<FeedbackItem\n\t\t\tref={scrollIntoViewEffect}\n\t\t\tComponent={Component}\n\t\t\tclassName={cx(focus && styles.hasFocus)}\n\t\t\tid={comment.id}\n\t\t\tdate={comment.createdAt}\n\t\t\tauthor={comment.author}\n\t\t\tstatus={status}\n\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t>\n\t\t\t{children}\n\t\t</FeedbackItem>\n\t)\n}\n", "import \"FeedbackComment.styles_bovcop.wyw.css\"; export const comment = \"comment_c1bumop8\";\nexport const hasOnlyEmoji = \"hasOnlyEmoji_hpf1swh\";\nexport const hasFocus = \"hasFocus_h1rov6j7\";", "import { truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { forwardRef, useCallback, useEffect, useState } from \"react\"\nimport { formatDate } from \"web/lib/Project.ts\"\nimport { formatDistanceToNowShort } from \"web/pages/project/lib/formatDistanceToNowShort.ts\"\nimport { CommentAvatar } from \"./CommentAvatar.tsx\"\nimport * as styles from \"./FeedbackItem.styles.ts\"\nimport type { Point, User } from \"./types.ts\"\n\ninterface Props {\n\tComponent?: React.ElementType\n\tclassName?: string\n\tauthor: User\n\tid: string\n\tchildren: React.ReactNode\n\tdate: Date\n\tstatus?: React.ReactNode\n\tisContextMenuOpen?: boolean\n\tonSelect?: () => void\n\tonContextMenu?: (point: Point) => void\n}\n\nexport const FeedbackItem = forwardRef(function FeedbackItem<T>(\n\t{\n\t\tComponent = \"div\",\n\t\tclassName,\n\t\tauthor,\n\t\tdate,\n\t\tstatus,\n\t\tisContextMenuOpen = false,\n\t\tonSelect,\n\t\tonContextMenu,\n\t\tchildren,\n\t}: Props,\n\tref: React.Ref<T>,\n) {\n\tconst handleSelect: React.MouseEventHandler<Element> = useCallback(\n\t\tevt => {\n\t\t\t// Do no dispatch event if context menu handler was called.\n\t\t\tif (onSelect && !evt.defaultPrevented) {\n\t\t\t\tonSelect()\n\t\t\t}\n\t\t},\n\t\t[onSelect],\n\t)\n\n\tconst [disclosureItemState, setDisclosureItemState] = useState<{\n\t\ttriggeredViaButtonClick: boolean\n\t\tisOpen: boolean\n\t}>({ triggeredViaButtonClick: false, isOpen: false })\n\n\tuseEffect(() => {\n\t\tif (!isContextMenuOpen) {\n\t\t\tsetDisclosureItemState({ triggeredViaButtonClick: false, isOpen: false })\n\t\t}\n\t}, [isContextMenuOpen])\n\n\tconst handleContextMenu = useCallback(\n\t\t(evt: React.MouseEvent<Element>, { viaButtonClick }: { viaButtonClick: boolean }) => {\n\t\t\tevt.preventDefault()\n\t\t\tevt.stopPropagation()\n\n\t\t\tsetDisclosureItemState({ triggeredViaButtonClick: viaButtonClick, isOpen: true })\n\n\t\t\tconst rect = evt.currentTarget.getBoundingClientRect()\n\t\t\tconst position = viaButtonClick ? { x: rect.left + 20, y: rect.bottom - 10 } : { x: evt.clientX, y: evt.clientY }\n\t\t\tonContextMenu?.(position)\n\t\t},\n\t\t[onContextMenu],\n\t)\n\n\tconst InnerWrapper = onSelect ? \"button\" : \"div\"\n\treturn (\n\t\t<Component ref={ref} className={cx(className, styles.container)}>\n\t\t\t<InnerWrapper\n\t\t\t\tclassName={cx(onSelect && styles.button)}\n\t\t\t\tonClick={handleSelect}\n\t\t\t\tonContextMenu={event => handleContextMenu(event, { viaButtonClick: false })}\n\t\t\t>\n\t\t\t\t<article className={styles.content}>\n\t\t\t\t\t<div className={styles.title}>\n\t\t\t\t\t\t<CommentAvatar author={author} />\n\t\t\t\t\t\t<div className={styles.attribution}>\n\t\t\t\t\t\t\t<span className={cx(truncateWithEllipsis, styles.author)}>{author.name}</span>{\" \"}\n\t\t\t\t\t\t\t<div className={styles.timeStatus}>\n\t\t\t\t\t\t\t\t<time dateTime={date.toDateString()} title={formatDate(date)}>\n\t\t\t\t\t\t\t\t\t{formatDistanceToNowShort(date, { addSuffix: true, justNow: true })}\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t{status ? (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<p className={styles.statusDivider}> \u30FB </p>\n\t\t\t\t\t\t\t\t\t\t<p className={styles.status}>{status}</p>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{onContextMenu && (\n\t\t\t\t\t\t\t<DisclosureIcon\n\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\tstyles.disclosureIcon,\n\t\t\t\t\t\t\t\t\tdisclosureItemState.isOpen && styles.disclosureIconVisible,\n\t\t\t\t\t\t\t\t\tdisclosureItemState.triggeredViaButtonClick && styles.disclosureIconActive,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tonClick={event => handleContextMenu(event, { viaButtonClick: true })}\n\t\t\t\t\t\t\t\tonContextMenu={event => handleContextMenu(event, { viaButtonClick: true })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t{children}\n\t\t\t\t</article>\n\t\t\t</InnerWrapper>\n\t\t</Component>\n\t)\n})\n\nexport function FeedbackActiveStatus({ children }: { children?: React.ReactNode }) {\n\treturn <span className={styles.statusActive}>{children}</span>\n}\n\nexport function FeedbackErrorStatus({ children }: { children?: React.ReactNode }) {\n\treturn <span className={styles.statusError}>{children}</span>\n}\n\nconst DisclosureIcon = (props: React.SVGProps<SVGSVGElement>) => {\n\treturn (\n\t\t<svg {...props} xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" tabIndex={-1}>\n\t\t\t<title>Open context menu</title>\n\t\t\t<path\n\t\t\t\td=\"M 15 0 C 23.284 0 30 6.716 30 15 C 30 23.284 23.284 30 15 30 C 6.716 30 0 23.284 0 15 C 0 6.716 6.716 0 15 0 Z\"\n\t\t\t\tfill=\"none\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tclassName={styles.disclosureIconPath}\n\t\t\t\td=\"M 10 13.5 C 10.828 13.5 11.5 14.172 11.5 15 C 11.5 15.828 10.828 16.5 10 16.5 C 9.172 16.5 8.5 15.828 8.5 15 C 8.5 14.172 9.172 13.5 10 13.5 Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tclassName={styles.disclosureIconPath}\n\t\t\t\td=\"M 15 13.5 C 15.828 13.5 16.5 14.172 16.5 15 C 16.5 15.828 15.828 16.5 15 16.5 C 14.172 16.5 13.5 15.828 13.5 15 C 13.5 14.172 14.172 13.5 15 13.5 Z\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tclassName={styles.disclosureIconPath}\n\t\t\t\td=\"M 20 13.5 C 20.828 13.5 21.5 14.172 21.5 15 C 21.5 15.828 20.828 16.5 20 16.5 C 19.172 16.5 18.5 15.828 18.5 15 C 18.5 14.172 19.172 13.5 20 13.5 Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"FeedbackItem.styles_sobvfx.wyw.css\"; export const disclosureIconPath = \"disclosureIconPath_dcyg3a2\";\nexport const disclosureIconActive = \"disclosureIconActive_d1hyfbpw\";\nexport const disclosureIconVisible = \"disclosureIconVisible_dlyucyj\";\nexport const disclosureIcon = \"disclosureIcon_d1i5x7i4\";\nexport const container = \"container_c1pzgksq\";\nexport const button = \"button_bnai86q\";\nexport const content = \"content_c1k3ury\";\nexport const title = \"title_t1lzfsov\";\nexport const attribution = \"attribution_a15ie07g\";\nexport const author = \"author_a19kvlas\";\nexport const timeStatus = \"timeStatus_t1qkg9ba\";\nexport const statusDivider = \"statusDivider_sprgmfd\";\nexport const status = \"status_ska7s4p\";\nexport const statusActive = \"statusActive_sa83fi2\";\nexport const statusError = \"statusError_svincbr\";", "'use strict';\n\nvar anObject = require('./_an-object');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar toInteger = require('./_to-integer');\nvar advanceStringIndex = require('./_advance-string-index');\nvar regExpExec = require('./_regexp-exec-abstract');\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&`']|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&`']|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n  return it === undefined ? it : String(it);\n};\n\n// @@replace logic\nrequire('./_fix-re-wks')('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {\n  return [\n    // `String.prototype.replace` method\n    // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n    function replace(searchValue, replaceValue) {\n      var O = defined(this);\n      var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n      return fn !== undefined\n        ? fn.call(searchValue, O, replaceValue)\n        : $replace.call(String(O), searchValue, replaceValue);\n    },\n    // `RegExp.prototype[@@replace]` method\n    // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n    function (regexp, replaceValue) {\n      var res = maybeCallNative($replace, regexp, this, replaceValue);\n      if (res.done) return res.value;\n\n      var rx = anObject(regexp);\n      var S = String(this);\n      var functionalReplace = typeof replaceValue === 'function';\n      if (!functionalReplace) replaceValue = String(replaceValue);\n      var global = rx.global;\n      if (global) {\n        var fullUnicode = rx.unicode;\n        rx.lastIndex = 0;\n      }\n      var results = [];\n      while (true) {\n        var result = regExpExec(rx, S);\n        if (result === null) break;\n        results.push(result);\n        if (!global) break;\n        var matchStr = String(result[0]);\n        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n      }\n      var accumulatedResult = '';\n      var nextSourcePosition = 0;\n      for (var i = 0; i < results.length; i++) {\n        result = results[i];\n        var matched = String(result[0]);\n        var position = max(min(toInteger(result.index), S.length), 0);\n        var captures = [];\n        // NOTE: This is equivalent to\n        //   captures = result.slice(1).map(maybeToString)\n        // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n        // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n        // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n        for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n        var namedCaptures = result.groups;\n        if (functionalReplace) {\n          var replacerArgs = [matched].concat(captures, position, S);\n          if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n          var replacement = String(replaceValue.apply(undefined, replacerArgs));\n        } else {\n          replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n        }\n        if (position >= nextSourcePosition) {\n          accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n          nextSourcePosition = position + matched.length;\n        }\n      }\n      return accumulatedResult + S.slice(nextSourcePosition);\n    }\n  ];\n\n    // https://tc39.github.io/ecma262/#sec-getsubstitution\n  function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n    var tailPos = position + matched.length;\n    var m = captures.length;\n    var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n    if (namedCaptures !== undefined) {\n      namedCaptures = toObject(namedCaptures);\n      symbols = SUBSTITUTION_SYMBOLS;\n    }\n    return $replace.call(replacement, symbols, function (match, ch) {\n      var capture;\n      switch (ch.charAt(0)) {\n        case '$': return '$';\n        case '&': return matched;\n        case '`': return str.slice(0, position);\n        case \"'\": return str.slice(tailPos);\n        case '<':\n          capture = namedCaptures[ch.slice(1, -1)];\n          break;\n        default: // \\d\\d?\n          var n = +ch;\n          if (n === 0) return match;\n          if (n > m) {\n            var f = floor(n / 10);\n            if (f === 0) return match;\n            if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n            return match;\n          }\n          capture = captures[n - 1];\n      }\n      return capture === undefined ? '' : capture;\n    });\n  }\n});\n", "'use strict';\nvar $export = require('./_export');\nvar $indexOf = require('./_array-includes')(false);\nvar $native = [].indexOf;\nvar NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;\n\n$export($export.P + $export.F * (NEGATIVE_ZERO || !require('./_strict-method')($native)), 'Array', {\n  // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])\n  indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n    return NEGATIVE_ZERO\n      // convert -0 to +0\n      ? $native.apply(this, arguments) || 0\n      : $indexOf(this, searchElement, arguments[1]);\n  }\n});\n", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar cashtag = /[a-z]{1,6}(?:[._][a-z]{1,2})?/i;\nexport default cashtag;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar punct = /\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$/;\nexport default punct;", "var global = require('./_global');\nvar inheritIfRequired = require('./_inherit-if-required');\nvar dP = require('./_object-dp').f;\nvar gOPN = require('./_object-gopn').f;\nvar isRegExp = require('./_is-regexp');\nvar $flags = require('./_flags');\nvar $RegExp = global.RegExp;\nvar Base = $RegExp;\nvar proto = $RegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n// \"new\" creates a new object, old webkit buggy here\nvar CORRECT_NEW = new $RegExp(re1) !== re1;\n\nif (require('./_descriptors') && (!CORRECT_NEW || require('./_fails')(function () {\n  re2[require('./_wks')('match')] = false;\n  // RegExp constructor can alter flags and IsRegExp works correct with @@match\n  return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';\n}))) {\n  $RegExp = function RegExp(p, f) {\n    var tiRE = this instanceof $RegExp;\n    var piRE = isRegExp(p);\n    var fiU = f === undefined;\n    return !tiRE && piRE && p.constructor === $RegExp && fiU ? p\n      : inheritIfRequired(CORRECT_NEW\n        ? new Base(piRE && !fiU ? p.source : p, f)\n        : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)\n      , tiRE ? this : proto, $RegExp);\n  };\n  var proxy = function (key) {\n    key in $RegExp || dP($RegExp, key, {\n      configurable: true,\n      get: function () { return Base[key]; },\n      set: function (it) { Base[key] = it; }\n    });\n  };\n  for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);\n  proto.constructor = $RegExp;\n  $RegExp.prototype = proto;\n  require('./_redefine')(global, 'RegExp', $RegExp);\n}\n\nrequire('./_set-species')('RegExp');\n", "import \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.array.index-of\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Builds a RegExp\nexport default function (regex, map, flags) {\n  flags = flags || '';\n\n  if (typeof regex !== 'string') {\n    if (regex.global && flags.indexOf('g') < 0) {\n      flags += 'g';\n    }\n\n    if (regex.ignoreCase && flags.indexOf('i') < 0) {\n      flags += 'i';\n    }\n\n    if (regex.multiline && flags.indexOf('m') < 0) {\n      flags += 'm';\n    }\n\n    regex = regex.source;\n  }\n\n  return new RegExp(regex.replace(/#\\{(\\w+)\\}/g, function (match, name) {\n    var newRegex = map[name] || '';\n\n    if (typeof newRegex !== 'string') {\n      newRegex = newRegex.source;\n    }\n\n    return newRegex;\n  }), flags);\n}", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar spacesGroup = /\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000/;\nexport default spacesGroup;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport spacesGroup from './spacesGroup';\nexport default regexSupplant(/[#{spacesGroup}]/, {\n  spacesGroup: spacesGroup\n});", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport cashtag from './cashtag';\nimport punct from './punct';\nimport regexSupplant from '../lib/regexSupplant';\nimport spaces from './spaces';\nvar validCashtag = regexSupplant('(^|#{spaces})(\\\\$)(#{cashtag})(?=$|\\\\s|[#{punct}])', {\n  cashtag: cashtag,\n  spaces: spaces,\n  punct: punct\n}, 'gi');\nexport default validCashtag;", "'use strict';\n\nvar anObject = require('./_an-object');\nvar toLength = require('./_to-length');\nvar advanceStringIndex = require('./_advance-string-index');\nvar regExpExec = require('./_regexp-exec-abstract');\n\n// @@match logic\nrequire('./_fix-re-wks')('match', 1, function (defined, MATCH, $match, maybeCallNative) {\n  return [\n    // `String.prototype.match` method\n    // https://tc39.github.io/ecma262/#sec-string.prototype.match\n    function match(regexp) {\n      var O = defined(this);\n      var fn = regexp == undefined ? undefined : regexp[MATCH];\n      return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n    },\n    // `RegExp.prototype[@@match]` method\n    // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n    function (regexp) {\n      var res = maybeCallNative($match, regexp, this);\n      if (res.done) return res.value;\n      var rx = anObject(regexp);\n      var S = String(this);\n      if (!rx.global) return regExpExec(rx, S);\n      var fullUnicode = rx.unicode;\n      rx.lastIndex = 0;\n      var A = [];\n      var n = 0;\n      var result;\n      while ((result = regExpExec(rx, S)) !== null) {\n        var matchStr = String(result[0]);\n        A[n] = matchStr;\n        if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n        n++;\n      }\n      return n === 0 ? null : A;\n    }\n  ];\n});\n", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar hashSigns = /[#\uFF03]/;\nexport default hashSigns;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport hashSigns from './hashSigns';\nimport regexSupplant from '../lib/regexSupplant';\nvar endHashtagMatch = regexSupplant(/^(?:#{hashSigns}|:\\/\\/)/, {\n  hashSigns: hashSigns\n});\nexport default endHashtagMatch;", "import \"core-js/modules/es6.regexp.constructor\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nvar validCCTLD = regexSupplant(RegExp('(?:(?:' + '\uD55C\uAD6D|\u9999\u6E2F|\u6FB3\u9580|\u65B0\u52A0\u5761|\u53F0\u7063|\u53F0\u6E7E|\u4E2D\u570B|\u4E2D\u56FD|\u10D2\u10D4|\u0EA5\u0EB2\u0EA7|\u0E44\u0E17\u0E22|\u0DBD\u0D82\u0D9A\u0DCF|\u0D2D\u0D3E\u0D30\u0D24\u0D02|\u0CAD\u0CBE\u0CB0\u0CA4|\u0C2D\u0C3E\u0C30\u0C24\u0C4D|\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD|\u0B87\u0BB2\u0B99\u0BCD\u0B95\u0BC8|\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE|\u0B2D\u0B3E\u0B30\u0B24|' + '\u0AAD\u0ABE\u0AB0\u0AA4|\u0A2D\u0A3E\u0A30\u0A24|\u09AD\u09BE\u09F0\u09A4|\u09AD\u09BE\u09B0\u09A4|\u09AC\u09BE\u0982\u09B2\u09BE|\u092D\u093E\u0930\u094B\u0924|\u092D\u093E\u0930\u0924\u092E\u094D|\u092D\u093E\u0930\u0924|\u0680\u0627\u0631\u062A|\u067E\u0627\u06A9\u0633\u062A\u0627\u0646|\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627|\u0645\u0644\u064A\u0633\u064A\u0627|\u0645\u0635\u0631|\u0642\u0637\u0631|\u0641\u0644\u0633\u0637\u064A\u0646|\u0639\u0645\u0627\u0646|' + '\u0639\u0631\u0627\u0642|\u0633\u0648\u0631\u064A\u0629|\u0633\u0648\u062F\u0627\u0646|\u062A\u0648\u0646\u0633|\u0628\u06BE\u0627\u0631\u062A|\u0628\u0627\u0631\u062A|\u0627\u06CC\u0631\u0627\u0646|\u0627\u0645\u0627\u0631\u0627\u062A|\u0627\u0644\u0645\u063A\u0631\u0628|\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629|\u0627\u0644\u062C\u0632\u0627\u0626\u0631|\u0627\u0644\u0628\u062D\u0631\u064A\u0646|\u0627\u0644\u0627\u0631\u062F\u0646|\u0570\u0561\u0575|\u049B\u0430\u0437|' + '\u0443\u043A\u0440|\u0441\u0440\u0431|\u0440\u0444|\u043C\u043E\u043D|\u043C\u043A\u0434|\u0435\u044E|\u0431\u0435\u043B|\u0431\u0433|\u03B5\u03C5|\u03B5\u03BB|zw|zm|za|yt|ye|ws|wf|vu|vn|vi|vg|ve|vc|va|uz|uy|us|um|uk|' + 'ug|ua|tz|tw|tv|tt|tr|tp|to|tn|tm|tl|tk|tj|th|tg|tf|td|tc|sz|sy|sx|sv|su|st|ss|sr|so|sn|sm|sl|' + 'sk|sj|si|sh|sg|se|sd|sc|sb|sa|rw|ru|rs|ro|re|qa|py|pw|pt|ps|pr|pn|pm|pl|pk|ph|pg|pf|pe|pa|om|' + 'nz|nu|nr|np|no|nl|ni|ng|nf|ne|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|mn|mm|ml|mk|mh|mg|mf|' + 'me|md|mc|ma|ly|lv|lu|lt|ls|lr|lk|li|lc|lb|la|kz|ky|kw|kr|kp|kn|km|ki|kh|kg|ke|jp|jo|jm|je|it|' + 'is|ir|iq|io|in|im|il|ie|id|hu|ht|hr|hn|hm|hk|gy|gw|gu|gt|gs|gr|gq|gp|gn|gm|gl|gi|gh|gg|gf|ge|' + 'gd|gb|ga|fr|fo|fm|fk|fj|fi|eu|et|es|er|eh|eg|ee|ec|dz|do|dm|dk|dj|de|cz|cy|cx|cw|cv|cu|cr|co|' + 'cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|bz|by|bw|bv|bt|bs|br|bq|bo|bn|bm|bl|bj|bi|bh|bg|bf|be|bd|bb|' + 'ba|az|ax|aw|au|at|as|ar|aq|ao|an|am|al|ai|ag|af|ae|ad|ac' + ')(?=[^0-9a-zA-Z@+-]|$))'));\nexport default validCCTLD;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar directionalMarkersGroup = /\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/;\nexport default directionalMarkersGroup;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar invalidCharsGroup = /\\uFFFE\\uFEFF\\uFFFF/;\nexport default invalidCharsGroup;", "import \"core-js/modules/es6.regexp.replace\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// simple string interpolation\nexport default function (str, map) {\n  return str.replace(/#\\{(\\w+)\\}/g, function (match, name) {\n    return map[name] || '';\n  });\n}", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport directionalMarkersGroup from './directionalMarkersGroup';\nimport invalidCharsGroup from './invalidCharsGroup';\nimport punct from './punct';\nimport spacesGroup from './spacesGroup';\nimport stringSupplant from '../lib/stringSupplant';\nvar invalidDomainChars = stringSupplant('#{punct}#{spacesGroup}#{invalidCharsGroup}#{directionalMarkersGroup}', {\n  punct: punct,\n  spacesGroup: spacesGroup,\n  invalidCharsGroup: invalidCharsGroup,\n  directionalMarkersGroup: directionalMarkersGroup\n});\nexport default invalidDomainChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport invalidDomainChars from './invalidDomainChars';\nimport regexSupplant from '../lib/regexSupplant';\nvar validDomainChars = regexSupplant(/[^#{invalidDomainChars}]/, {\n  invalidDomainChars: invalidDomainChars\n});\nexport default validDomainChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validDomainChars from './validDomainChars';\nvar validDomainName = regexSupplant(/(?:(?:#{validDomainChars}(?:-|#{validDomainChars})*)?#{validDomainChars}\\.)/, {\n  validDomainChars: validDomainChars\n});\nexport default validDomainName;", "import \"core-js/modules/es6.regexp.constructor\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nvar validGTLD = regexSupplant(RegExp('(?:(?:' + '\uC0BC\uC131|\uB2F7\uCEF4|\uB2F7\uB137|\u9999\u683C\u91CC\u62C9|\u9910\u5385|\u98DF\u54C1|\u98DE\u5229\u6D66|\u96FB\u8A0A\u76C8\u79D1|\u96C6\u56E2|\u901A\u8CA9|\u8D2D\u7269|\u8C37\u6B4C|\u8BFA\u57FA\u4E9A|\u8054\u901A|\u7F51\u7EDC|\u7F51\u7AD9|\u7F51\u5E97|\u7F51\u5740|\u7EC4\u7EC7\u673A\u6784|\u79FB\u52A8|\u73E0\u5B9D|\u70B9\u770B|\u6E38\u620F|\u6DE1\u9A6C\u9521|\u673A\u6784|\u66F8\u7C4D|\u65F6\u5C1A|\u65B0\u95FB|' + '\u653F\u5E9C|\u653F\u52A1|\u62DB\u8058|\u624B\u8868|\u624B\u673A|\u6211\u7231\u4F60|\u6148\u5584|\u5FAE\u535A|\u5E7F\u4E1C|\u5DE5\u884C|\u5BB6\u96FB|\u5A31\u4E50|\u5929\u4E3B\u6559|\u5927\u62FF|\u5927\u4F17\u6C7D\u8F66|\u5728\u7EBF|\u5609\u91CC\u5927\u9152\u5E97|\u5609\u91CC|\u5546\u6807|\u5546\u5E97|\u5546\u57CE|\u516C\u76CA|\u516C\u53F8|\u516B\u5366|\u5065\u5EB7|\u4FE1\u606F|\u4F5B\u5C71|\u4F01\u4E1A|' + '\u4E2D\u6587\u7F51|\u4E2D\u4FE1|\u4E16\u754C|\u30DD\u30A4\u30F3\u30C8|\u30D5\u30A1\u30C3\u30B7\u30E7\u30F3|\u30BB\u30FC\u30EB|\u30B9\u30C8\u30A2|\u30B3\u30E0|\u30B0\u30FC\u30B0\u30EB|\u30AF\u30E9\u30A6\u30C9|\u307F\u3093\u306A|\u0E04\u0E2D\u0E21|\u0938\u0902\u0917\u0920\u0928|\u0928\u0947\u091F|\u0915\u0949\u092E|\u0647\u0645\u0631\u0627\u0647|\u0645\u0648\u0642\u0639|\u0645\u0648\u0628\u0627\u064A\u0644\u064A|\u0643\u0648\u0645|' + '\u0643\u0627\u062B\u0648\u0644\u064A\u0643|\u0639\u0631\u0628|\u0634\u0628\u0643\u0629|\u0628\u064A\u062A\u0643|\u0628\u0627\u0632\u0627\u0631|\u0627\u0644\u0639\u0644\u064A\u0627\u0646|\u0627\u0631\u0627\u0645\u0643\u0648|\u0627\u062A\u0635\u0627\u0644\u0627\u062A|\u0627\u0628\u0648\u0638\u0628\u064A|\u05E7\u05D5\u05DD|\u0441\u0430\u0439\u0442|\u0440\u0443\u0441|\u043E\u0440\u0433|\u043E\u043D\u043B\u0430\u0439\u043D|\u043C\u043E\u0441\u043A\u0432\u0430|\u043A\u043E\u043C|' + '\u043A\u0430\u0442\u043E\u043B\u0438\u043A|\u0434\u0435\u0442\u0438|zuerich|zone|zippo|zip|zero|zara|zappos|yun|youtube|you|yokohama|yoga|yodobashi|' + 'yandex|yamaxun|yahoo|yachts|xyz|xxx|xperia|xin|xihuan|xfinity|xerox|xbox|wtf|wtc|wow|world|' + 'works|work|woodside|wolterskluwer|wme|winners|wine|windows|win|williamhill|wiki|wien|whoswho|' + 'weir|weibo|wedding|wed|website|weber|webcam|weatherchannel|weather|watches|watch|warman|' + 'wanggou|wang|walter|walmart|wales|vuelos|voyage|voto|voting|vote|volvo|volkswagen|vodka|' + 'vlaanderen|vivo|viva|vistaprint|vista|vision|visa|virgin|vip|vin|villas|viking|vig|video|' + 'viajes|vet|versicherung|verm\u00F6gensberatung|verm\u00F6gensberater|verisign|ventures|vegas|vanguard|' + 'vana|vacations|ups|uol|uno|university|unicom|uconnect|ubs|ubank|tvs|tushu|tunes|tui|tube|trv|' + 'trust|travelersinsurance|travelers|travelchannel|travel|training|trading|trade|toys|toyota|' + 'town|tours|total|toshiba|toray|top|tools|tokyo|today|tmall|tkmaxx|tjx|tjmaxx|tirol|tires|tips|' + 'tiffany|tienda|tickets|tiaa|theatre|theater|thd|teva|tennis|temasek|telefonica|telecity|tel|' + 'technology|tech|team|tdk|tci|taxi|tax|tattoo|tatar|tatamotors|target|taobao|talk|taipei|tab|' + 'systems|symantec|sydney|swiss|swiftcover|swatch|suzuki|surgery|surf|support|supply|supplies|' + 'sucks|style|study|studio|stream|store|storage|stockholm|stcgroup|stc|statoil|statefarm|' + 'statebank|starhub|star|staples|stada|srt|srl|spreadbetting|spot|sport|spiegel|space|soy|sony|' + 'song|solutions|solar|sohu|software|softbank|social|soccer|sncf|smile|smart|sling|skype|sky|' + 'skin|ski|site|singles|sina|silk|shriram|showtime|show|shouji|shopping|shop|shoes|shiksha|shia|' + 'shell|shaw|sharp|shangrila|sfr|sexy|sex|sew|seven|ses|services|sener|select|seek|security|' + 'secure|seat|search|scot|scor|scjohnson|science|schwarz|schule|school|scholarships|schmidt|' + 'schaeffler|scb|sca|sbs|sbi|saxo|save|sas|sarl|sapo|sap|sanofi|sandvikcoromant|sandvik|samsung|' + 'samsclub|salon|sale|sakura|safety|safe|saarland|ryukyu|rwe|run|ruhr|rugby|rsvp|room|rogers|' + 'rodeo|rocks|rocher|rmit|rip|rio|ril|rightathome|ricoh|richardli|rich|rexroth|reviews|review|' + 'restaurant|rest|republican|report|repair|rentals|rent|ren|reliance|reit|reisen|reise|rehab|' + 'redumbrella|redstone|red|recipes|realty|realtor|realestate|read|raid|radio|racing|qvc|quest|' + 'quebec|qpon|pwc|pub|prudential|pru|protection|property|properties|promo|progressive|prof|' + 'productions|prod|pro|prime|press|praxi|pramerica|post|porn|politie|poker|pohl|pnc|plus|' + 'plumbing|playstation|play|place|pizza|pioneer|pink|ping|pin|pid|pictures|pictet|pics|piaget|' + 'physio|photos|photography|photo|phone|philips|phd|pharmacy|pfizer|pet|pccw|pay|passagens|' + 'party|parts|partners|pars|paris|panerai|panasonic|pamperedchef|page|ovh|ott|otsuka|osaka|' + 'origins|orientexpress|organic|org|orange|oracle|open|ooo|onyourside|online|onl|ong|one|omega|' + 'ollo|oldnavy|olayangroup|olayan|okinawa|office|off|observer|obi|nyc|ntt|nrw|nra|nowtv|nowruz|' + 'now|norton|northwesternmutual|nokia|nissay|nissan|ninja|nikon|nike|nico|nhk|ngo|nfl|nexus|' + 'nextdirect|next|news|newholland|new|neustar|network|netflix|netbank|net|nec|nba|navy|natura|' + 'nationwide|name|nagoya|nadex|nab|mutuelle|mutual|museum|mtr|mtpc|mtn|msd|movistar|movie|mov|' + 'motorcycles|moto|moscow|mortgage|mormon|mopar|montblanc|monster|money|monash|mom|moi|moe|moda|' + 'mobily|mobile|mobi|mma|mls|mlb|mitsubishi|mit|mint|mini|mil|microsoft|miami|metlife|merckmsd|' + 'meo|menu|men|memorial|meme|melbourne|meet|media|med|mckinsey|mcdonalds|mcd|mba|mattel|' + 'maserati|marshalls|marriott|markets|marketing|market|map|mango|management|man|makeup|maison|' + 'maif|madrid|macys|luxury|luxe|lupin|lundbeck|ltda|ltd|lplfinancial|lpl|love|lotto|lotte|' + 'london|lol|loft|locus|locker|loans|loan|llp|llc|lixil|living|live|lipsy|link|linde|lincoln|' + 'limo|limited|lilly|like|lighting|lifestyle|lifeinsurance|life|lidl|liaison|lgbt|lexus|lego|' + 'legal|lefrak|leclerc|lease|lds|lawyer|law|latrobe|latino|lat|lasalle|lanxess|landrover|land|' + 'lancome|lancia|lancaster|lamer|lamborghini|ladbrokes|lacaixa|kyoto|kuokgroup|kred|krd|kpn|' + 'kpmg|kosher|komatsu|koeln|kiwi|kitchen|kindle|kinder|kim|kia|kfh|kerryproperties|' + 'kerrylogistics|kerryhotels|kddi|kaufen|juniper|juegos|jprs|jpmorgan|joy|jot|joburg|jobs|jnj|' + 'jmp|jll|jlc|jio|jewelry|jetzt|jeep|jcp|jcb|java|jaguar|iwc|iveco|itv|itau|istanbul|ist|' + 'ismaili|iselect|irish|ipiranga|investments|intuit|international|intel|int|insure|insurance|' + 'institute|ink|ing|info|infiniti|industries|inc|immobilien|immo|imdb|imamat|ikano|iinet|ifm|' + 'ieee|icu|ice|icbc|ibm|hyundai|hyatt|hughes|htc|hsbc|how|house|hotmail|hotels|hoteles|hot|' + 'hosting|host|hospital|horse|honeywell|honda|homesense|homes|homegoods|homedepot|holiday|' + 'holdings|hockey|hkt|hiv|hitachi|hisamitsu|hiphop|hgtv|hermes|here|helsinki|help|healthcare|' + 'health|hdfcbank|hdfc|hbo|haus|hangout|hamburg|hair|guru|guitars|guide|guge|gucci|guardian|' + 'group|grocery|gripe|green|gratis|graphics|grainger|gov|got|gop|google|goog|goodyear|goodhands|' + 'goo|golf|goldpoint|gold|godaddy|gmx|gmo|gmbh|gmail|globo|global|gle|glass|glade|giving|gives|' + 'gifts|gift|ggee|george|genting|gent|gea|gdn|gbiz|gay|garden|gap|games|game|gallup|gallo|' + 'gallery|gal|fyi|futbol|furniture|fund|fun|fujixerox|fujitsu|ftr|frontier|frontdoor|frogans|' + 'frl|fresenius|free|fox|foundation|forum|forsale|forex|ford|football|foodnetwork|food|foo|fly|' + 'flsmidth|flowers|florist|flir|flights|flickr|fitness|fit|fishing|fish|firmdale|firestone|fire|' + 'financial|finance|final|film|fido|fidelity|fiat|ferrero|ferrari|feedback|fedex|fast|fashion|' + 'farmers|farm|fans|fan|family|faith|fairwinds|fail|fage|extraspace|express|exposed|expert|' + 'exchange|everbank|events|eus|eurovision|etisalat|esurance|estate|esq|erni|ericsson|equipment|' + 'epson|epost|enterprises|engineering|engineer|energy|emerck|email|education|edu|edeka|eco|eat|' + 'earth|dvr|dvag|durban|dupont|duns|dunlop|duck|dubai|dtv|drive|download|dot|doosan|domains|' + 'doha|dog|dodge|doctor|docs|dnp|diy|dish|discover|discount|directory|direct|digital|diet|' + 'diamonds|dhl|dev|design|desi|dentist|dental|democrat|delta|deloitte|dell|delivery|degree|' + 'deals|dealer|deal|dds|dclk|day|datsun|dating|date|data|dance|dad|dabur|cyou|cymru|cuisinella|' + 'csc|cruises|cruise|crs|crown|cricket|creditunion|creditcard|credit|cpa|courses|coupons|coupon|' + 'country|corsica|coop|cool|cookingchannel|cooking|contractors|contact|consulting|construction|' + 'condos|comsec|computer|compare|company|community|commbank|comcast|com|cologne|college|coffee|' + 'codes|coach|clubmed|club|cloud|clothing|clinique|clinic|click|cleaning|claims|cityeats|city|' + 'citic|citi|citadel|cisco|circle|cipriani|church|chrysler|chrome|christmas|chloe|chintai|cheap|' + 'chat|chase|charity|channel|chanel|cfd|cfa|cern|ceo|center|ceb|cbs|cbre|cbn|cba|catholic|' + 'catering|cat|casino|cash|caseih|case|casa|cartier|cars|careers|career|care|cards|caravan|car|' + 'capitalone|capital|capetown|canon|cancerresearch|camp|camera|cam|calvinklein|call|cal|cafe|' + 'cab|bzh|buzz|buy|business|builders|build|bugatti|budapest|brussels|brother|broker|broadway|' + 'bridgestone|bradesco|box|boutique|bot|boston|bostik|bosch|boots|booking|book|boo|bond|bom|' + 'bofa|boehringer|boats|bnpparibas|bnl|bmw|bms|blue|bloomberg|blog|blockbuster|blanco|' + 'blackfriday|black|biz|bio|bingo|bing|bike|bid|bible|bharti|bet|bestbuy|best|berlin|bentley|' + 'beer|beauty|beats|bcn|bcg|bbva|bbt|bbc|bayern|bauhaus|basketball|baseball|bargains|barefoot|' + 'barclays|barclaycard|barcelona|bar|bank|band|bananarepublic|banamex|baidu|baby|azure|axa|aws|' + 'avianca|autos|auto|author|auspost|audio|audible|audi|auction|attorney|athleta|associates|asia|' + 'asda|arte|art|arpa|army|archi|aramco|arab|aquarelle|apple|app|apartments|aol|anz|anquan|' + 'android|analytics|amsterdam|amica|amfam|amex|americanfamily|americanexpress|alstom|alsace|' + 'ally|allstate|allfinanz|alipay|alibaba|alfaromeo|akdn|airtel|airforce|airbus|aigo|aig|agency|' + 'agakhan|africa|afl|afamilycompany|aetna|aero|aeg|adult|ads|adac|actor|active|aco|accountants|' + 'accountant|accenture|academy|abudhabi|abogado|able|abc|abbvie|abbott|abb|abarth|aarp|aaa|' + 'onion' + ')(?=[^0-9a-zA-Z@+-]|$))'));\nexport default validGTLD;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validPunycode = /(?:xn--[\\-0-9a-z]+)/;\nexport default validPunycode;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validDomainChars from './validDomainChars';\nvar validSubdomain = regexSupplant(/(?:(?:#{validDomainChars}(?:[_-]|#{validDomainChars})*)?#{validDomainChars}\\.)/, {\n  validDomainChars: validDomainChars\n});\nexport default validSubdomain;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validCCTLD from './validCCTLD';\nimport validDomainName from './validDomainName';\nimport validGTLD from './validGTLD';\nimport validPunycode from './validPunycode';\nimport validSubdomain from './validSubdomain';\nvar validDomain = regexSupplant(/(?:#{validSubdomain}*#{validDomainName}(?:#{validGTLD}|#{validCCTLD}|#{validPunycode}))/, {\n  validDomainName: validDomainName,\n  validSubdomain: validSubdomain,\n  validGTLD: validGTLD,\n  validCCTLD: validCCTLD,\n  validPunycode: validPunycode\n});\nexport default validDomain;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validPortNumber = /[0-9]+/;\nexport default validPortNumber;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar cyrillicLettersAndMarks = /\\u0400-\\u04FF/;\nexport default cyrillicLettersAndMarks;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar latinAccentChars = /\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF/;\nexport default latinAccentChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport cyrillicLettersAndMarks from './cyrillicLettersAndMarks';\nimport latinAccentChars from './latinAccentChars';\nimport regexSupplant from '../lib/regexSupplant';\nvar validGeneralUrlPathChars = regexSupplant(/[a-z#{cyrillicLettersAndMarks}0-9!\\*';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&#{latinAccentChars}]/i, {\n  cyrillicLettersAndMarks: cyrillicLettersAndMarks,\n  latinAccentChars: latinAccentChars\n});\nexport default validGeneralUrlPathChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validGeneralUrlPathChars from './validGeneralUrlPathChars'; // Allow URL paths to contain up to two nested levels of balanced parens\n//  1. Used in Wikipedia URLs like /Primer_(film)\n//  2. Used in IIS sessions like /S(dfd346)/\n//  3. Used in Rdio URLs like /track/We_Up_(Album_Version_(Edited))/\n\nvar validUrlBalancedParens = regexSupplant('\\\\(' + '(?:' + '#{validGeneralUrlPathChars}+' + '|' + // allow one nested level of balanced parentheses\n'(?:' + '#{validGeneralUrlPathChars}*' + '\\\\(' + '#{validGeneralUrlPathChars}+' + '\\\\)' + '#{validGeneralUrlPathChars}*' + ')' + ')' + '\\\\)', {\n  validGeneralUrlPathChars: validGeneralUrlPathChars\n}, 'i');\nexport default validUrlBalancedParens;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport cyrillicLettersAndMarks from './cyrillicLettersAndMarks';\nimport latinAccentChars from './latinAccentChars';\nimport regexSupplant from '../lib/regexSupplant';\nimport validUrlBalancedParens from './validUrlBalancedParens'; // Valid end-of-path chracters (so /foo. does not gobble the period).\n// 1. Allow =&# for empty URL parameters and other URL-join artifacts\n\nvar validUrlPathEndingChars = regexSupplant(/[\\+\\-a-z#{cyrillicLettersAndMarks}0-9=_#\\/#{latinAccentChars}]|(?:#{validUrlBalancedParens})/i, {\n  cyrillicLettersAndMarks: cyrillicLettersAndMarks,\n  latinAccentChars: latinAccentChars,\n  validUrlBalancedParens: validUrlBalancedParens\n});\nexport default validUrlPathEndingChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validGeneralUrlPathChars from './validGeneralUrlPathChars';\nimport validUrlBalancedParens from './validUrlBalancedParens';\nimport validUrlPathEndingChars from './validUrlPathEndingChars'; // Allow @ in a url, but only in the middle. Catch things like http://example.com/@user/\n\nvar validUrlPath = regexSupplant('(?:' + '(?:' + '#{validGeneralUrlPathChars}*' + '(?:#{validUrlBalancedParens}#{validGeneralUrlPathChars}*)*' + '#{validUrlPathEndingChars}' + ')|(?:@#{validGeneralUrlPathChars}+/)' + ')', {\n  validGeneralUrlPathChars: validGeneralUrlPathChars,\n  validUrlBalancedParens: validUrlBalancedParens,\n  validUrlPathEndingChars: validUrlPathEndingChars\n}, 'i');\nexport default validUrlPath;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport directionalMarkersGroup from './directionalMarkersGroup';\nimport invalidCharsGroup from './invalidCharsGroup';\nimport regexSupplant from '../lib/regexSupplant';\nvar validUrlPrecedingChars = regexSupplant(/(?:[^A-Za-z0-9@\uFF20$#\uFF03#{invalidCharsGroup}]|[#{directionalMarkersGroup}]|^)/, {\n  invalidCharsGroup: invalidCharsGroup,\n  directionalMarkersGroup: directionalMarkersGroup\n});\nexport default validUrlPrecedingChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validUrlQueryChars = /[a-z0-9!?\\*'@\\(\\);:&=\\+\\$\\/%#\\[\\]\\-_\\.,~|]/i;\nexport default validUrlQueryChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validUrlQueryEndingChars = /[a-z0-9\\-_&=#\\/]/i;\nexport default validUrlQueryEndingChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validDomain from './validDomain';\nimport validPortNumber from './validPortNumber';\nimport validUrlPath from './validUrlPath';\nimport validUrlPrecedingChars from './validUrlPrecedingChars';\nimport validUrlQueryChars from './validUrlQueryChars';\nimport validUrlQueryEndingChars from './validUrlQueryEndingChars';\nvar extractUrl = regexSupplant('(' + // $1 total match\n'(#{validUrlPrecedingChars})' + // $2 Preceeding chracter\n'(' + // $3 URL\n'(https?:\\\\/\\\\/)?' + // $4 Protocol (optional)\n'(#{validDomain})' + // $5 Domain(s)\n'(?::(#{validPortNumber}))?' + // $6 Port number (optional)\n'(\\\\/#{validUrlPath}*)?' + // $7 URL Path\n'(\\\\?#{validUrlQueryChars}*#{validUrlQueryEndingChars})?' + // $8 Query String\n')' + ')', {\n  validUrlPrecedingChars: validUrlPrecedingChars,\n  validDomain: validDomain,\n  validPortNumber: validPortNumber,\n  validUrlPath: validUrlPath,\n  validUrlQueryChars: validUrlQueryChars,\n  validUrlQueryEndingChars: validUrlQueryEndingChars\n}, 'gi');\nexport default extractUrl;", "'use strict';\n\nvar isRegExp = require('./_is-regexp');\nvar anObject = require('./_an-object');\nvar speciesConstructor = require('./_species-constructor');\nvar advanceStringIndex = require('./_advance-string-index');\nvar toLength = require('./_to-length');\nvar callRegExpExec = require('./_regexp-exec-abstract');\nvar regexpExec = require('./_regexp-exec');\nvar fails = require('./_fails');\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\nrequire('./_fix-re-wks')('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n  var internalSplit;\n  if (\n    'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n    'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n    'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n    '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n    '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n    ''[$SPLIT](/.?/)[LENGTH]\n  ) {\n    // based on es5-shim implementation, need to rework it\n    internalSplit = function (separator, limit) {\n      var string = String(this);\n      if (separator === undefined && limit === 0) return [];\n      // If `separator` is not a regex, use native split\n      if (!isRegExp(separator)) return $split.call(string, separator, limit);\n      var output = [];\n      var flags = (separator.ignoreCase ? 'i' : '') +\n                  (separator.multiline ? 'm' : '') +\n                  (separator.unicode ? 'u' : '') +\n                  (separator.sticky ? 'y' : '');\n      var lastLastIndex = 0;\n      var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n      // Make `global` and avoid `lastIndex` issues by working with a copy\n      var separatorCopy = new RegExp(separator.source, flags + 'g');\n      var match, lastIndex, lastLength;\n      while (match = regexpExec.call(separatorCopy, string)) {\n        lastIndex = separatorCopy[LAST_INDEX];\n        if (lastIndex > lastLastIndex) {\n          output.push(string.slice(lastLastIndex, match.index));\n          if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n          lastLength = match[0][LENGTH];\n          lastLastIndex = lastIndex;\n          if (output[LENGTH] >= splitLimit) break;\n        }\n        if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n      }\n      if (lastLastIndex === string[LENGTH]) {\n        if (lastLength || !separatorCopy.test('')) output.push('');\n      } else output.push(string.slice(lastLastIndex));\n      return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n    };\n  // Chakra, V8\n  } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n    internalSplit = function (separator, limit) {\n      return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n    };\n  } else {\n    internalSplit = $split;\n  }\n\n  return [\n    // `String.prototype.split` method\n    // https://tc39.github.io/ecma262/#sec-string.prototype.split\n    function split(separator, limit) {\n      var O = defined(this);\n      var splitter = separator == undefined ? undefined : separator[SPLIT];\n      return splitter !== undefined\n        ? splitter.call(separator, O, limit)\n        : internalSplit.call(String(O), separator, limit);\n    },\n    // `RegExp.prototype[@@split]` method\n    // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n    //\n    // NOTE: This cannot be properly polyfilled in engines that don't support\n    // the 'y' flag.\n    function (regexp, limit) {\n      var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n      if (res.done) return res.value;\n\n      var rx = anObject(regexp);\n      var S = String(this);\n      var C = speciesConstructor(rx, RegExp);\n\n      var unicodeMatching = rx.unicode;\n      var flags = (rx.ignoreCase ? 'i' : '') +\n                  (rx.multiline ? 'm' : '') +\n                  (rx.unicode ? 'u' : '') +\n                  (SUPPORTS_Y ? 'y' : 'g');\n\n      // ^(? + rx + ) is needed, in combination with some S slicing, to\n      // simulate the 'y' flag.\n      var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n      var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n      if (lim === 0) return [];\n      if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n      var p = 0;\n      var q = 0;\n      var A = [];\n      while (q < S.length) {\n        splitter.lastIndex = SUPPORTS_Y ? q : 0;\n        var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n        var e;\n        if (\n          z === null ||\n          (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n        ) {\n          q = advanceStringIndex(S, q, unicodeMatching);\n        } else {\n          A.push(S.slice(p, q));\n          if (A.length === lim) return A;\n          for (var i = 1; i <= z.length - 1; i++) {\n            A.push(z[i]);\n            if (A.length === lim) return A;\n          }\n          q = p = e;\n        }\n      }\n      A.push(S.slice(p));\n      return A;\n    }\n  ];\n});\n", "import \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.regexp.match\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport punycode from 'punycode';\nimport validAsciiDomain from '../regexp/validAsciiDomain';\nvar MAX_DOMAIN_LABEL_LENGTH = 63;\nvar PUNYCODE_ENCODED_DOMAIN_PREFIX = 'xn--'; // This is an extremely lightweight implementation of domain name validation according to RFC 3490\n// Our regexes handle most of the cases well enough\n// See https://tools.ietf.org/html/rfc3490#section-4.1 for details\n\nvar idna = {\n  toAscii: function toAscii(domain) {\n    if (domain.substring(0, 4) === PUNYCODE_ENCODED_DOMAIN_PREFIX && !domain.match(validAsciiDomain)) {\n      // Punycode encoded url cannot contain non ASCII characters\n      return;\n    }\n\n    var labels = domain.split('.');\n\n    for (var i = 0; i < labels.length; i++) {\n      var label = labels[i];\n      var punycodeEncodedLabel = punycode.toASCII(label);\n\n      if (punycodeEncodedLabel.length < 1 || punycodeEncodedLabel.length > MAX_DOMAIN_LABEL_LENGTH) {\n        // DNS label has invalid length\n        return;\n      }\n    }\n\n    return labels.join('.');\n  }\n};\nexport default idna;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport latinAccentChars from './latinAccentChars';\nimport regexSupplant from '../lib/regexSupplant';\nimport validCCTLD from './validCCTLD';\nimport validGTLD from './validGTLD';\nimport validPunycode from './validPunycode';\nvar validAsciiDomain = regexSupplant(/(?:(?:[\\-a-z0-9#{latinAccentChars}]+)\\.)+(?:#{validGTLD}|#{validCCTLD}|#{validPunycode})/gi, {\n  latinAccentChars: latinAccentChars,\n  validGTLD: validGTLD,\n  validCCTLD: validCCTLD,\n  validPunycode: validPunycode\n});\nexport default validAsciiDomain;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validUrlQueryChars from './validUrlQueryChars';\nimport validUrlQueryEndingChars from './validUrlQueryEndingChars';\nvar validTcoUrl = regexSupplant(/^https?:\\/\\/t\\.co\\/([a-z0-9]+)(?:\\?#{validUrlQueryChars}*#{validUrlQueryEndingChars})?/, {\n  validUrlQueryChars: validUrlQueryChars,\n  validUrlQueryEndingChars: validUrlQueryEndingChars\n}, 'i');\nexport default validTcoUrl;", "'use strict';\nvar $export = require('./_export');\nvar aFunction = require('./_a-function');\nvar toObject = require('./_to-object');\nvar fails = require('./_fails');\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n  // IE8-\n  test.sort(undefined);\n}) || !fails(function () {\n  // V8 bug\n  test.sort(null);\n  // Old WebKit\n}) || !require('./_strict-method')($sort)), 'Array', {\n  // 22.1.3.25 Array.prototype.sort(comparefn)\n  sort: function sort(comparefn) {\n    return comparefn === undefined\n      ? $sort.call(toObject(this))\n      : $sort.call(toObject(this), aFunction(comparefn));\n  }\n});\n", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Generated from unicode_regex/unicode_regex_groups.scala, same as objective c's \\p{L}\\p{M}\nvar astralLetterAndMarks = /\\ud800[\\udc00-\\udc0b\\udc0d-\\udc26\\udc28-\\udc3a\\udc3c\\udc3d\\udc3f-\\udc4d\\udc50-\\udc5d\\udc80-\\udcfa\\uddfd\\ude80-\\ude9c\\udea0-\\uded0\\udee0\\udf00-\\udf1f\\udf30-\\udf40\\udf42-\\udf49\\udf50-\\udf7a\\udf80-\\udf9d\\udfa0-\\udfc3\\udfc8-\\udfcf]|\\ud801[\\udc00-\\udc9d\\udd00-\\udd27\\udd30-\\udd63\\ude00-\\udf36\\udf40-\\udf55\\udf60-\\udf67]|\\ud802[\\udc00-\\udc05\\udc08\\udc0a-\\udc35\\udc37\\udc38\\udc3c\\udc3f-\\udc55\\udc60-\\udc76\\udc80-\\udc9e\\udd00-\\udd15\\udd20-\\udd39\\udd80-\\uddb7\\uddbe\\uddbf\\ude00-\\ude03\\ude05\\ude06\\ude0c-\\ude13\\ude15-\\ude17\\ude19-\\ude33\\ude38-\\ude3a\\ude3f\\ude60-\\ude7c\\ude80-\\ude9c\\udec0-\\udec7\\udec9-\\udee6\\udf00-\\udf35\\udf40-\\udf55\\udf60-\\udf72\\udf80-\\udf91]|\\ud803[\\udc00-\\udc48]|\\ud804[\\udc00-\\udc46\\udc7f-\\udcba\\udcd0-\\udce8\\udd00-\\udd34\\udd50-\\udd73\\udd76\\udd80-\\uddc4\\uddda\\ude00-\\ude11\\ude13-\\ude37\\udeb0-\\udeea\\udf01-\\udf03\\udf05-\\udf0c\\udf0f\\udf10\\udf13-\\udf28\\udf2a-\\udf30\\udf32\\udf33\\udf35-\\udf39\\udf3c-\\udf44\\udf47\\udf48\\udf4b-\\udf4d\\udf57\\udf5d-\\udf63\\udf66-\\udf6c\\udf70-\\udf74]|\\ud805[\\udc80-\\udcc5\\udcc7\\udd80-\\uddb5\\uddb8-\\uddc0\\ude00-\\ude40\\ude44\\ude80-\\udeb7]|\\ud806[\\udca0-\\udcdf\\udcff\\udec0-\\udef8]|\\ud808[\\udc00-\\udf98]|\\ud80c[\\udc00-\\udfff]|\\ud80d[\\udc00-\\udc2e]|\\ud81a[\\udc00-\\ude38\\ude40-\\ude5e\\uded0-\\udeed\\udef0-\\udef4\\udf00-\\udf36\\udf40-\\udf43\\udf63-\\udf77\\udf7d-\\udf8f]|\\ud81b[\\udf00-\\udf44\\udf50-\\udf7e\\udf8f-\\udf9f]|\\ud82c[\\udc00\\udc01]|\\ud82f[\\udc00-\\udc6a\\udc70-\\udc7c\\udc80-\\udc88\\udc90-\\udc99\\udc9d\\udc9e]|\\ud834[\\udd65-\\udd69\\udd6d-\\udd72\\udd7b-\\udd82\\udd85-\\udd8b\\uddaa-\\uddad\\ude42-\\ude44]|\\ud835[\\udc00-\\udc54\\udc56-\\udc9c\\udc9e\\udc9f\\udca2\\udca5\\udca6\\udca9-\\udcac\\udcae-\\udcb9\\udcbb\\udcbd-\\udcc3\\udcc5-\\udd05\\udd07-\\udd0a\\udd0d-\\udd14\\udd16-\\udd1c\\udd1e-\\udd39\\udd3b-\\udd3e\\udd40-\\udd44\\udd46\\udd4a-\\udd50\\udd52-\\udea5\\udea8-\\udec0\\udec2-\\udeda\\udedc-\\udefa\\udefc-\\udf14\\udf16-\\udf34\\udf36-\\udf4e\\udf50-\\udf6e\\udf70-\\udf88\\udf8a-\\udfa8\\udfaa-\\udfc2\\udfc4-\\udfcb]|\\ud83a[\\udc00-\\udcc4\\udcd0-\\udcd6]|\\ud83b[\\ude00-\\ude03\\ude05-\\ude1f\\ude21\\ude22\\ude24\\ude27\\ude29-\\ude32\\ude34-\\ude37\\ude39\\ude3b\\ude42\\ude47\\ude49\\ude4b\\ude4d-\\ude4f\\ude51\\ude52\\ude54\\ude57\\ude59\\ude5b\\ude5d\\ude5f\\ude61\\ude62\\ude64\\ude67-\\ude6a\\ude6c-\\ude72\\ude74-\\ude77\\ude79-\\ude7c\\ude7e\\ude80-\\ude89\\ude8b-\\ude9b\\udea1-\\udea3\\udea5-\\udea9\\udeab-\\udebb]|\\ud840[\\udc00-\\udfff]|\\ud841[\\udc00-\\udfff]|\\ud842[\\udc00-\\udfff]|\\ud843[\\udc00-\\udfff]|\\ud844[\\udc00-\\udfff]|\\ud845[\\udc00-\\udfff]|\\ud846[\\udc00-\\udfff]|\\ud847[\\udc00-\\udfff]|\\ud848[\\udc00-\\udfff]|\\ud849[\\udc00-\\udfff]|\\ud84a[\\udc00-\\udfff]|\\ud84b[\\udc00-\\udfff]|\\ud84c[\\udc00-\\udfff]|\\ud84d[\\udc00-\\udfff]|\\ud84e[\\udc00-\\udfff]|\\ud84f[\\udc00-\\udfff]|\\ud850[\\udc00-\\udfff]|\\ud851[\\udc00-\\udfff]|\\ud852[\\udc00-\\udfff]|\\ud853[\\udc00-\\udfff]|\\ud854[\\udc00-\\udfff]|\\ud855[\\udc00-\\udfff]|\\ud856[\\udc00-\\udfff]|\\ud857[\\udc00-\\udfff]|\\ud858[\\udc00-\\udfff]|\\ud859[\\udc00-\\udfff]|\\ud85a[\\udc00-\\udfff]|\\ud85b[\\udc00-\\udfff]|\\ud85c[\\udc00-\\udfff]|\\ud85d[\\udc00-\\udfff]|\\ud85e[\\udc00-\\udfff]|\\ud85f[\\udc00-\\udfff]|\\ud860[\\udc00-\\udfff]|\\ud861[\\udc00-\\udfff]|\\ud862[\\udc00-\\udfff]|\\ud863[\\udc00-\\udfff]|\\ud864[\\udc00-\\udfff]|\\ud865[\\udc00-\\udfff]|\\ud866[\\udc00-\\udfff]|\\ud867[\\udc00-\\udfff]|\\ud868[\\udc00-\\udfff]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86a[\\udc00-\\udfff]|\\ud86b[\\udc00-\\udfff]|\\ud86c[\\udc00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d]|\\ud87e[\\udc00-\\ude1d]|\\udb40[\\udd00-\\uddef]/;\nexport default astralLetterAndMarks;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Generated from unicode_regex/unicode_regex_groups.scala, same as objective c's \\p{L}\\p{M}\nvar bmpLetterAndMarks = /A-Za-z\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0300-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u0483-\\u052f\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06df-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710-\\u074a\\u074d-\\u07b1\\u07ca-\\u07f5\\u07fa\\u0800-\\u082d\\u0840-\\u085b\\u08a0-\\u08b2\\u08e4-\\u0963\\u0971-\\u0983\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bc-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09ce\\u09d7\\u09dc\\u09dd\\u09df-\\u09e3\\u09f0\\u09f1\\u0a01-\\u0a03\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a59-\\u0a5c\\u0a5e\\u0a70-\\u0a75\\u0a81-\\u0a83\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abc-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ad0\\u0ae0-\\u0ae3\\u0b01-\\u0b03\\u0b05-\\u0b0c\\u0b0f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\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb9\\u0ebb-\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0ec8-\\u0ecd\\u0edc-\\u0edf\\u0f00\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f3e-\\u0f47\\u0f49-\\u0f6c\\u0f71-\\u0f84\\u0f86-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u103f\\u1050-\\u108f\\u109a-\\u109d\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u135d-\\u135f\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16f1-\\u16f8\\u1700-\\u170c\\u170e-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176c\\u176e-\\u1770\\u1772\\u1773\\u1780-\\u17d3\\u17d7\\u17dc\\u17dd\\u180b-\\u180d\\u1820-\\u1877\\u1880-\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1920-\\u192b\\u1930-\\u193b\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a1b\\u1a20-\\u1a5e\\u1a60-\\u1a7c\\u1a7f\\u1aa7\\u1ab0-\\u1abe\\u1b00-\\u1b4b\\u1b6b-\\u1b73\\u1b80-\\u1baf\\u1bba-\\u1bf3\\u1c00-\\u1c37\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1cd0-\\u1cd2\\u1cd4-\\u1cf6\\u1cf8\\u1cf9\\u1d00-\\u1df5\\u1dfc-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u20d0-\\u20f0\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2183\\u2184\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d7f-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2de0-\\u2dff\\u2e2f\\u3005\\u3006\\u302a-\\u302f\\u3031-\\u3035\\u303b\\u303c\\u3041-\\u3096\\u3099\\u309a\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua672\\ua674-\\ua67d\\ua67f-\\ua69d\\ua69f-\\ua6e5\\ua6f0\\ua6f1\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua7ad\\ua7b0\\ua7b1\\ua7f7-\\ua827\\ua840-\\ua873\\ua880-\\ua8c4\\ua8e0-\\ua8f7\\ua8fb\\ua90a-\\ua92d\\ua930-\\ua953\\ua960-\\ua97c\\ua980-\\ua9c0\\ua9cf\\ua9e0-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa36\\uaa40-\\uaa4d\\uaa60-\\uaa76\\uaa7a-\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaef\\uaaf2-\\uaaf6\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab5f\\uab64\\uab65\\uabc0-\\uabea\\uabec\\uabed\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf870-\\uf87f\\uf882\\uf884-\\uf89f\\uf8b8\\uf8c1-\\uf8d6\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe00-\\ufe0f\\ufe20-\\ufe2d\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc/;\nexport default bmpLetterAndMarks;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar nonBmpCodePairs = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/gm;\nexport default nonBmpCodePairs;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport astralLetterAndMarks from './astralLetterAndMarks';\nimport bmpLetterAndMarks from './bmpLetterAndMarks';\nimport nonBmpCodePairs from './nonBmpCodePairs';\nimport regexSupplant from '../lib/regexSupplant'; // A hashtag must contain at least one unicode letter or mark, as well as numbers, underscores, and select special characters.\n\nvar hashtagAlpha = regexSupplant(/(?:[#{bmpLetterAndMarks}]|(?=#{nonBmpCodePairs})(?:#{astralLetterAndMarks}))/, {\n  bmpLetterAndMarks: bmpLetterAndMarks,\n  nonBmpCodePairs: nonBmpCodePairs,\n  astralLetterAndMarks: astralLetterAndMarks\n});\nexport default hashtagAlpha;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar astralNumerals = /\\ud801[\\udca0-\\udca9]|\\ud804[\\udc66-\\udc6f\\udcf0-\\udcf9\\udd36-\\udd3f\\uddd0-\\uddd9\\udef0-\\udef9]|\\ud805[\\udcd0-\\udcd9\\ude50-\\ude59\\udec0-\\udec9]|\\ud806[\\udce0-\\udce9]|\\ud81a[\\ude60-\\ude69\\udf50-\\udf59]|\\ud835[\\udfce-\\udfff]/;\nexport default astralNumerals;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar bmpNumerals = /0-9\\u0660-\\u0669\\u06f0-\\u06f9\\u07c0-\\u07c9\\u0966-\\u096f\\u09e6-\\u09ef\\u0a66-\\u0a6f\\u0ae6-\\u0aef\\u0b66-\\u0b6f\\u0be6-\\u0bef\\u0c66-\\u0c6f\\u0ce6-\\u0cef\\u0d66-\\u0d6f\\u0de6-\\u0def\\u0e50-\\u0e59\\u0ed0-\\u0ed9\\u0f20-\\u0f29\\u1040-\\u1049\\u1090-\\u1099\\u17e0-\\u17e9\\u1810-\\u1819\\u1946-\\u194f\\u19d0-\\u19d9\\u1a80-\\u1a89\\u1a90-\\u1a99\\u1b50-\\u1b59\\u1bb0-\\u1bb9\\u1c40-\\u1c49\\u1c50-\\u1c59\\ua620-\\ua629\\ua8d0-\\ua8d9\\ua900-\\ua909\\ua9d0-\\ua9d9\\ua9f0-\\ua9f9\\uaa50-\\uaa59\\uabf0-\\uabf9\\uff10-\\uff19/;\nexport default bmpNumerals;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar hashtagSpecialChars = /_\\u200c\\u200d\\ua67e\\u05be\\u05f3\\u05f4\\uff5e\\u301c\\u309b\\u309c\\u30a0\\u30fb\\u3003\\u0f0b\\u0f0c\\xb7/;\nexport default hashtagSpecialChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport astralLetterAndMarks from './astralLetterAndMarks';\nimport astralNumerals from './astralNumerals';\nimport bmpLetterAndMarks from './bmpLetterAndMarks';\nimport bmpNumerals from './bmpNumerals';\nimport hashtagSpecialChars from './hashtagSpecialChars';\nimport nonBmpCodePairs from './nonBmpCodePairs';\nimport regexSupplant from '../lib/regexSupplant';\nvar hashtagAlphaNumeric = regexSupplant(/(?:[#{bmpLetterAndMarks}#{bmpNumerals}#{hashtagSpecialChars}]|(?=#{nonBmpCodePairs})(?:#{astralLetterAndMarks}|#{astralNumerals}))/, {\n  bmpLetterAndMarks: bmpLetterAndMarks,\n  bmpNumerals: bmpNumerals,\n  hashtagSpecialChars: hashtagSpecialChars,\n  nonBmpCodePairs: nonBmpCodePairs,\n  astralLetterAndMarks: astralLetterAndMarks,\n  astralNumerals: astralNumerals\n});\nexport default hashtagAlphaNumeric;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar codePoint = /(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/;\nexport default codePoint;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport codePoint from './codePoint';\nimport hashtagAlphaNumeric from './hashtagAlphaNumeric';\nimport regexSupplant from '../lib/regexSupplant';\nvar hashtagBoundary = regexSupplant(/(?:^|\\uFE0E|\\uFE0F|$|(?!#{hashtagAlphaNumeric}|&)#{codePoint})/, {\n  codePoint: codePoint,\n  hashtagAlphaNumeric: hashtagAlphaNumeric\n});\nexport default hashtagBoundary;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport hashSigns from './hashSigns';\nimport hashtagAlpha from './hashtagAlpha';\nimport hashtagAlphaNumeric from './hashtagAlphaNumeric';\nimport hashtagBoundary from './hashtagBoundary';\nimport regexSupplant from '../lib/regexSupplant';\nvar validHashtag = regexSupplant(/(#{hashtagBoundary})(#{hashSigns})(?!\\uFE0F|\\u20E3)(#{hashtagAlphaNumeric}*#{hashtagAlpha}#{hashtagAlphaNumeric}*)/gi, {\n  hashtagBoundary: hashtagBoundary,\n  hashSigns: hashSigns,\n  hashtagAlphaNumeric: hashtagAlphaNumeric,\n  hashtagAlpha: hashtagAlpha\n});\nexport default validHashtag;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar atSigns = /[@\uFF20]/;\nexport default atSigns;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport atSigns from './atSigns';\nimport latinAccentChars from './latinAccentChars';\nimport regexSupplant from '../lib/regexSupplant';\nvar endMentionMatch = regexSupplant(/^(?:#{atSigns}|[#{latinAccentChars}]|:\\/\\/)/, {\n  atSigns: atSigns,\n  latinAccentChars: latinAccentChars\n});\nexport default endMentionMatch;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validMentionPrecedingChars = /(?:^|[^a-zA-Z0-9_!#$%&*@\uFF20]|(?:^|[^a-zA-Z0-9_+~.-])(?:rt|RT|rT|Rt):?)/;\nexport default validMentionPrecedingChars;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport atSigns from './atSigns';\nimport regexSupplant from '../lib/regexSupplant';\nimport validMentionPrecedingChars from './validMentionPrecedingChars';\nvar validMentionOrList = regexSupplant('(#{validMentionPrecedingChars})' + // $1: Preceding character\n'(#{atSigns})' + // $2: At mark\n'([a-zA-Z0-9_]{1,20})' + // $3: Screen name\n'(/[a-zA-Z][a-zA-Z0-9_-]{0,24})?', // $4: List (optional)\n{\n  validMentionPrecedingChars: validMentionPrecedingChars,\n  atSigns: atSigns\n}, 'g');\nexport default validMentionOrList;", "'use strict';\nrequire('./es6.regexp.flags');\nvar anObject = require('./_an-object');\nvar $flags = require('./_flags');\nvar DESCRIPTORS = require('./_descriptors');\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n  require('./_redefine')(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (require('./_fails')(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n  define(function toString() {\n    var R = anObject(this);\n    return '/'.concat(R.source, '/',\n      'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n  });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n  define(function toString() {\n    return $toString.call(this);\n  });\n}\n", "var DateProto = Date.prototype;\nvar INVALID_DATE = 'Invalid Date';\nvar TO_STRING = 'toString';\nvar $toString = DateProto[TO_STRING];\nvar getTime = DateProto.getTime;\nif (new Date(NaN) + '' != INVALID_DATE) {\n  require('./_redefine')(DateProto, TO_STRING, function toString() {\n    var value = getTime.call(this);\n    // eslint-disable-next-line no-self-compare\n    return value === value ? $toString.call(this) : INVALID_DATE;\n  });\n}\n", "'use strict';\n// 19.1.3.6 Object.prototype.toString()\nvar classof = require('./_classof');\nvar test = {};\ntest[require('./_wks')('toStringTag')] = 'z';\nif (test + '' != '[object z]') {\n  require('./_redefine')(Object.prototype, 'toString', function toString() {\n    return '[object ' + classof(this) + ']';\n  }, true);\n}\n", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport atSigns from './atSigns';\nimport regexSupplant from '../lib/regexSupplant';\nimport spaces from './spaces';\nvar validReply = regexSupplant(/^(?:#{spaces})*#{atSigns}([a-zA-Z0-9_]{1,20})/, {\n  atSigns: atSigns,\n  spaces: spaces\n});\nexport default validReply;", "// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)\nvar $export = require('./_export');\n\n$export($export.S, 'Array', { isArray: require('./_is-array') });\n", "'use strict';\nvar $export = require('./_export');\nvar $reduce = require('./_array-reduce');\n\n$export($export.P + $export.F * !require('./_strict-method')([].reduce, true), 'Array', {\n  // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])\n  reduce: function reduce(callbackfn /* , initialValue */) {\n    return $reduce(this, callbackfn, arguments.length, arguments[1], false);\n  }\n});\n", "var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n  CSSRuleList: true, // TODO: Not spec compliant, should be false.\n  CSSStyleDeclaration: false,\n  CSSValueList: false,\n  ClientRectList: false,\n  DOMRectList: false,\n  DOMStringList: false,\n  DOMTokenList: true,\n  DataTransferItemList: false,\n  FileList: false,\n  HTMLAllCollection: false,\n  HTMLCollection: false,\n  HTMLFormElement: false,\n  HTMLSelectElement: false,\n  MediaList: true, // TODO: Not spec compliant, should be false.\n  MimeTypeArray: false,\n  NamedNodeMap: false,\n  NodeList: true,\n  PaintRequestList: false,\n  Plugin: false,\n  PluginArray: false,\n  SVGLengthList: false,\n  SVGNumberList: false,\n  SVGPathSegList: false,\n  SVGPointList: false,\n  SVGStringList: false,\n  SVGTransformList: false,\n  SourceBufferList: false,\n  StyleSheetList: true, // TODO: Not spec compliant, should be false.\n  TextTrackCueList: false,\n  TextTrackList: false,\n  TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n  var NAME = collections[i];\n  var explicit = DOMIterables[NAME];\n  var Collection = global[NAME];\n  var proto = Collection && Collection.prototype;\n  var key;\n  if (proto) {\n    if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n    if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n    Iterators[NAME] = ArrayValues;\n    if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n  }\n}\n", "import \"core-js/modules/es6.array.reduce\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.array.iterator\";\nimport \"core-js/modules/es6.object.to-string\";\nimport \"core-js/modules/es6.object.keys\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport configs from './configs';\nimport extractUrlsWithIndices from './extractUrlsWithIndices';\nimport getCharacterWeight from './lib/getCharacterWeight';\nimport hasInvalidCharacters from './hasInvalidCharacters';\nimport modifyIndicesFromUTF16ToUnicode from './modifyIndicesFromUTF16ToUnicode'; // TODO: WEB-19861 Replace with public package after it is open sourced\n\nimport { parse as extractEmojiWithIndices } from 'twemoji-parser';\nimport urlHasHttps from './regexp/urlHasHttps';\n/**\n * [parseTweet description]\n * @param  {string} text tweet text to parse\n * @param  {Object} options config options to pass\n * @return {Object} Fields in response described below:\n *\n * Response fields:\n * weightedLength {int} the weighted length of tweet based on weights specified in the config\n * valid {bool} If tweet is valid\n * permillage {float} permillage of the tweet over the max length specified in config\n * validRangeStart {int} beginning of valid text\n * validRangeEnd {int} End index of valid part of the tweet text (inclusive) in utf16\n * displayRangeStart {int} beginning index of display text\n * displayRangeEnd {int} end index of display text (inclusive) in utf16\n */\n\nvar parseTweet = function parseTweet() {\n  var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : configs.defaults;\n  var mergedOptions = Object.keys(options).length ? options : configs.defaults;\n  var defaultWeight = mergedOptions.defaultWeight,\n      emojiParsingEnabled = mergedOptions.emojiParsingEnabled,\n      scale = mergedOptions.scale,\n      maxWeightedTweetLength = mergedOptions.maxWeightedTweetLength,\n      transformedURLLength = mergedOptions.transformedURLLength;\n  var normalizedText = typeof String.prototype.normalize === 'function' ? text.normalize() : text; // Hash all entities by their startIndex for fast lookup\n\n  var urlEntitiesMap = transformEntitiesToHash(extractUrlsWithIndices(normalizedText));\n  var emojiEntitiesMap = emojiParsingEnabled ? transformEntitiesToHash(extractEmojiWithIndices(normalizedText)) : [];\n  var tweetLength = normalizedText.length;\n  var weightedLength = 0;\n  var validDisplayIndex = 0;\n  var valid = true; // Go through every character and calculate weight\n\n  for (var charIndex = 0; charIndex < tweetLength; charIndex++) {\n    // If a url begins at the specified index handle, add constant length\n    if (urlEntitiesMap[charIndex]) {\n      var _urlEntitiesMap$charI = urlEntitiesMap[charIndex],\n          url = _urlEntitiesMap$charI.url,\n          indices = _urlEntitiesMap$charI.indices;\n      weightedLength += transformedURLLength * scale;\n      charIndex += url.length - 1;\n    } else if (emojiParsingEnabled && emojiEntitiesMap[charIndex]) {\n      var _emojiEntitiesMap$cha = emojiEntitiesMap[charIndex],\n          emoji = _emojiEntitiesMap$cha.text,\n          _indices = _emojiEntitiesMap$cha.indices;\n      weightedLength += defaultWeight;\n      charIndex += emoji.length - 1;\n    } else {\n      charIndex += isSurrogatePair(normalizedText, charIndex) ? 1 : 0;\n      weightedLength += getCharacterWeight(normalizedText.charAt(charIndex), mergedOptions);\n    } // Only test for validity of character if it is still valid\n\n\n    if (valid) {\n      valid = !hasInvalidCharacters(normalizedText.substring(charIndex, charIndex + 1));\n    }\n\n    if (valid && weightedLength <= maxWeightedTweetLength * scale) {\n      validDisplayIndex = charIndex;\n    }\n  }\n\n  weightedLength = weightedLength / scale;\n  valid = valid && weightedLength > 0 && weightedLength <= maxWeightedTweetLength;\n  var permillage = Math.floor(weightedLength / maxWeightedTweetLength * 1000);\n  var normalizationOffset = text.length - normalizedText.length;\n  validDisplayIndex += normalizationOffset;\n  return {\n    weightedLength: weightedLength,\n    valid: valid,\n    permillage: permillage,\n    validRangeStart: 0,\n    validRangeEnd: validDisplayIndex,\n    displayRangeStart: 0,\n    displayRangeEnd: text.length > 0 ? text.length - 1 : 0\n  };\n};\n\nvar transformEntitiesToHash = function transformEntitiesToHash(entities) {\n  return entities.reduce(function (map, entity) {\n    map[entity.indices[0]] = entity;\n    return map;\n  }, {});\n};\n\nvar isSurrogatePair = function isSurrogatePair(text, cIndex) {\n  // Test if a character is the beginning of a surrogate pair\n  if (cIndex < text.length - 1) {\n    var c = text.charCodeAt(cIndex);\n    var cNext = text.charCodeAt(cIndex + 1);\n    return 0xd800 <= c && c <= 0xdbff && 0xdc00 <= cNext && cNext <= 0xdfff;\n  }\n\n  return false;\n};\n\nexport default parseTweet;", "// 19.1.2.14 Object.keys(O)\nvar toObject = require('./_to-object');\nvar $keys = require('./_object-keys');\n\nrequire('./_object-sap')('keys', function () {\n  return function keys(it) {\n    return $keys(toObject(it));\n  };\n});\n", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport invalidCharsGroup from './invalidCharsGroup';\nimport regexSupplant from '../lib/regexSupplant';\nvar invalidChars = regexSupplant(/[#{invalidCharsGroup}]/, {\n  invalidCharsGroup: invalidCharsGroup\n});\nexport default invalidChars;", "var $export = require('./_export');\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperty: require('./_object-dp').f });\n", "var $export = require('./_export');\n// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)\n$export($export.S + $export.F * !require('./_descriptors'), 'Object', { defineProperties: require('./_object-dps') });\n", "// https://github.com/tc39/proposal-object-getownpropertydescriptors\nvar $export = require('./_export');\nvar ownKeys = require('./_own-keys');\nvar toIObject = require('./_to-iobject');\nvar gOPD = require('./_object-gopd');\nvar createProperty = require('./_create-property');\n\n$export($export.S, 'Object', {\n  getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n    var O = toIObject(object);\n    var getDesc = gOPD.f;\n    var keys = ownKeys(O);\n    var result = {};\n    var i = 0;\n    var key, desc;\n    while (keys.length > i) {\n      desc = getDesc(O, key = keys[i++]);\n      if (desc !== undefined) createProperty(result, key, desc);\n    }\n    return result;\n  }\n});\n", "'use strict';\nvar $export = require('./_export');\nvar $forEach = require('./_array-methods')(0);\nvar STRICT = require('./_strict-method')([].forEach, true);\n\n$export($export.P + $export.F * !STRICT, 'Array', {\n  // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])\n  forEach: function forEach(callbackfn /* , thisArg */) {\n    return $forEach(this, callbackfn, arguments[1]);\n  }\n});\n", "'use strict';\nvar $export = require('./_export');\nvar $filter = require('./_array-methods')(2);\n\n$export($export.P + $export.F * !require('./_strict-method')([].filter, true), 'Array', {\n  // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])\n  filter: function filter(callbackfn /* , thisArg */) {\n    return $filter(this, callbackfn, arguments[1]);\n  }\n});\n", "'use strict';\n// ECMAScript 6 symbols shim\nvar global = require('./_global');\nvar has = require('./_has');\nvar DESCRIPTORS = require('./_descriptors');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar META = require('./_meta').KEY;\nvar $fails = require('./_fails');\nvar shared = require('./_shared');\nvar setToStringTag = require('./_set-to-string-tag');\nvar uid = require('./_uid');\nvar wks = require('./_wks');\nvar wksExt = require('./_wks-ext');\nvar wksDefine = require('./_wks-define');\nvar enumKeys = require('./_enum-keys');\nvar isArray = require('./_is-array');\nvar anObject = require('./_an-object');\nvar isObject = require('./_is-object');\nvar toObject = require('./_to-object');\nvar toIObject = require('./_to-iobject');\nvar toPrimitive = require('./_to-primitive');\nvar createDesc = require('./_property-desc');\nvar _create = require('./_object-create');\nvar gOPNExt = require('./_object-gopn-ext');\nvar $GOPD = require('./_object-gopd');\nvar $GOPS = require('./_object-gops');\nvar $DP = require('./_object-dp');\nvar $keys = require('./_object-keys');\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = 'prototype';\nvar HIDDEN = wks('_hidden');\nvar TO_PRIMITIVE = wks('toPrimitive');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared('symbol-registry');\nvar AllSymbols = shared('symbols');\nvar OPSymbols = shared('op-symbols');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n  return _create(dP({}, 'a', {\n    get: function () { return dP(this, 'a', { value: 7 }).a; }\n  })).a != 7;\n}) ? function (it, key, D) {\n  var protoDesc = gOPD(ObjectProto, key);\n  if (protoDesc) delete ObjectProto[key];\n  dP(it, key, D);\n  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n  sym._k = tag;\n  return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {\n  return typeof it == 'symbol';\n} : function (it) {\n  return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n  anObject(it);\n  key = toPrimitive(key, true);\n  anObject(D);\n  if (has(AllSymbols, key)) {\n    if (!D.enumerable) {\n      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n      it[HIDDEN][key] = true;\n    } else {\n      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n      D = _create(D, { enumerable: createDesc(0, false) });\n    } return setSymbolDesc(it, key, D);\n  } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n  anObject(it);\n  var keys = enumKeys(P = toIObject(P));\n  var i = 0;\n  var l = keys.length;\n  var key;\n  while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n  return it;\n};\nvar $create = function create(it, P) {\n  return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n  var E = isEnum.call(this, key = toPrimitive(key, true));\n  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n  it = toIObject(it);\n  key = toPrimitive(key, true);\n  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n  var D = gOPD(it, key);\n  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n  return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n  var names = gOPN(toIObject(it));\n  var result = [];\n  var i = 0;\n  var key;\n  while (names.length > i) {\n    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n  } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n  var IS_OP = it === ObjectProto;\n  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n  var result = [];\n  var i = 0;\n  var key;\n  while (names.length > i) {\n    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n  } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n  $Symbol = function Symbol() {\n    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');\n    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n    var $set = function (value) {\n      if (this === ObjectProto) $set.call(OPSymbols, value);\n      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n      setSymbolDesc(this, tag, createDesc(1, value));\n    };\n    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n    return wrap(tag);\n  };\n  redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n    return this._k;\n  });\n\n  $GOPD.f = $getOwnPropertyDescriptor;\n  $DP.f = $defineProperty;\n  require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;\n  require('./_object-pie').f = $propertyIsEnumerable;\n  $GOPS.f = $getOwnPropertySymbols;\n\n  if (DESCRIPTORS && !require('./_library')) {\n    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n  }\n\n  wksExt.f = function (name) {\n    return wrap(wks(name));\n  };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n  // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n  // 19.4.2.1 Symbol.for(key)\n  'for': function (key) {\n    return has(SymbolRegistry, key += '')\n      ? SymbolRegistry[key]\n      : SymbolRegistry[key] = $Symbol(key);\n  },\n  // 19.4.2.5 Symbol.keyFor(sym)\n  keyFor: function keyFor(sym) {\n    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');\n    for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n  },\n  useSetter: function () { setter = true; },\n  useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n  // 19.1.2.2 Object.create(O [, Properties])\n  create: $create,\n  // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n  defineProperty: $defineProperty,\n  // 19.1.2.3 Object.defineProperties(O, Properties)\n  defineProperties: $defineProperties,\n  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n  // 19.1.2.7 Object.getOwnPropertyNames(O)\n  getOwnPropertyNames: $getOwnPropertyNames,\n  // 19.1.2.8 Object.getOwnPropertySymbols(O)\n  getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\nvar FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });\n\n$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {\n  getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n    return $GOPS.f(toObject(it));\n  }\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n  var S = $Symbol();\n  // MS Edge converts symbol values to JSON as {}\n  // WebKit converts symbol values to JSON as null\n  // V8 throws on boxed symbols\n  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n  stringify: function stringify(it) {\n    var args = [it];\n    var i = 1;\n    var replacer, $replacer;\n    while (arguments.length > i) args.push(arguments[i++]);\n    $replacer = replacer = args[1];\n    if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n    if (!isArray(replacer)) replacer = function (key, value) {\n      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n      if (!isSymbol(value)) return value;\n    };\n    args[1] = replacer;\n    return _stringify.apply($JSON, args);\n  }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n", "import \"core-js/modules/es6.object.define-property\";\nimport \"core-js/modules/es6.object.define-properties\";\nimport \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.array.for-each\";\nimport \"core-js/modules/es6.array.filter\";\nimport \"core-js/modules/es6.symbol\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.array.iterator\";\nimport \"core-js/modules/es6.object.to-string\";\nimport \"core-js/modules/es6.object.keys\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport configs from './configs';\nimport getTweetLength from './getTweetLength';\nimport hasInvalidCharacters from './hasInvalidCharacters';\nexport default function (text) {\n  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : configs.defaults;\n\n  if (!text) {\n    return 'empty';\n  }\n\n  var mergedOptions = _objectSpread({}, configs.defaults, {}, options);\n\n  var maxLength = mergedOptions.maxWeightedTweetLength; // Determine max length independent of URL length\n\n  if (getTweetLength(text, mergedOptions) > maxLength) {\n    return 'too_long';\n  }\n\n  if (hasInvalidCharacters(text)) {\n    return 'invalid_characters';\n  }\n\n  return false;\n}", "import \"core-js/modules/es6.regexp.match\";\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from './lib/regexSupplant';\nimport validMentionOrList from './regexp/validMentionOrList';\nvar VALID_LIST_RE = regexSupplant(/^#{validMentionOrList}$/, {\n  validMentionOrList: validMentionOrList\n});\nexport default function (usernameList) {\n  var match = usernameList.match(VALID_LIST_RE); // Must have matched and had nothing before or after\n\n  return !!(match && match[1] == '' && match[4]);\n}", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnreserved = /[a-z\\u0400-\\u04FF0-9\\-._~]/i;\nexport default validateUrlUnreserved;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlPctEncoded = /(?:%[0-9a-f]{2})/i;\nexport default validateUrlPctEncoded;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlSubDelims = /[!$&'()*+,;=]/i;\nexport default validateUrlSubDelims;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlUnreserved from './validateUrlUnreserved';\nimport validateUrlPctEncoded from './validateUrlPctEncoded';\nimport validateUrlSubDelims from './validateUrlSubDelims';\nvar validateUrlUserinfo = regexSupplant('(?:' + '#{validateUrlUnreserved}|' + '#{validateUrlPctEncoded}|' + '#{validateUrlSubDelims}|' + ':' + ')*', {\n  validateUrlUnreserved: validateUrlUnreserved,\n  validateUrlPctEncoded: validateUrlPctEncoded,\n  validateUrlSubDelims: validateUrlSubDelims\n}, 'i');\nexport default validateUrlUserinfo;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDomainSegment = /(?:[a-z0-9](?:[a-z0-9\\-]*[a-z0-9])?)/i;\nexport default validateUrlDomainSegment;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDomainTld = /(?:[a-z](?:[a-z0-9\\-]*[a-z0-9])?)/i;\nexport default validateUrlDomainTld;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlSubDomainSegment = /(?:[a-z0-9](?:[a-z0-9_\\-]*[a-z0-9])?)/i;\nexport default validateUrlSubDomainSegment;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlDomainSegment from './validateUrlDomainSegment';\nimport validateUrlDomainTld from './validateUrlDomainTld';\nimport validateUrlSubDomainSegment from './validateUrlSubDomainSegment';\nvar validateUrlDomain = regexSupplant(/(?:(?:#{validateUrlSubDomainSegment}\\.)*(?:#{validateUrlDomainSegment}\\.)#{validateUrlDomainTld})/i, {\n  validateUrlSubDomainSegment: validateUrlSubDomainSegment,\n  validateUrlDomainSegment: validateUrlDomainSegment,\n  validateUrlDomainTld: validateUrlDomainTld\n});\nexport default validateUrlDomain;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDecOctet = /(?:[0-9]|(?:[1-9][0-9])|(?:1[0-9]{2})|(?:2[0-4][0-9])|(?:25[0-5]))/i;\nexport default validateUrlDecOctet;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlDecOctet from './validateUrlDecOctet';\nvar validateUrlIpv4 = regexSupplant(/(?:#{validateUrlDecOctet}(?:\\.#{validateUrlDecOctet}){3})/i, {\n  validateUrlDecOctet: validateUrlDecOctet\n});\nexport default validateUrlIpv4;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Punting on real IPv6 validation for now\nvar validateUrlIpv6 = /(?:\\[[a-f0-9:\\.]+\\])/i;\nexport default validateUrlIpv6;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlIpv4 from './validateUrlIpv4';\nimport validateUrlIpv6 from './validateUrlIpv6'; // Punting on IPvFuture for now\n\nvar validateUrlIp = regexSupplant('(?:' + '#{validateUrlIpv4}|' + '#{validateUrlIpv6}' + ')', {\n  validateUrlIpv4: validateUrlIpv4,\n  validateUrlIpv6: validateUrlIpv6\n}, 'i');\nexport default validateUrlIp;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlDomain from './validateUrlDomain';\nimport validateUrlIp from './validateUrlIp';\nvar validateUrlHost = regexSupplant('(?:' + '#{validateUrlIp}|' + '#{validateUrlDomain}' + ')', {\n  validateUrlIp: validateUrlIp,\n  validateUrlDomain: validateUrlDomain\n}, 'i');\nexport default validateUrlHost;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlPort = /[0-9]{1,5}/;\nexport default validateUrlPort;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlUserinfo from './validateUrlUserinfo';\nimport validateUrlHost from './validateUrlHost';\nimport validateUrlPort from './validateUrlPort';\nvar validateUrlAuthority = regexSupplant( // $1 userinfo\n'(?:(#{validateUrlUserinfo})@)?' + // $2 host\n'(#{validateUrlHost})' + // $3 port\n'(?::(#{validateUrlPort}))?', {\n  validateUrlUserinfo: validateUrlUserinfo,\n  validateUrlHost: validateUrlHost,\n  validateUrlPort: validateUrlPort\n}, 'i');\nexport default validateUrlAuthority;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlUnreserved from './validateUrlUnreserved';\nimport validateUrlPctEncoded from './validateUrlPctEncoded';\nimport validateUrlSubDelims from './validateUrlSubDelims'; // These URL validation pattern strings are based on the ABNF from RFC 3986\n\nvar validateUrlPchar = regexSupplant('(?:' + '#{validateUrlUnreserved}|' + '#{validateUrlPctEncoded}|' + '#{validateUrlSubDelims}|' + '[:|@]' + ')', {\n  validateUrlUnreserved: validateUrlUnreserved,\n  validateUrlPctEncoded: validateUrlPctEncoded,\n  validateUrlSubDelims: validateUrlSubDelims\n}, 'i');\nexport default validateUrlPchar;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlPchar from './validateUrlPchar';\nvar validateUrlFragment = regexSupplant(/(#{validateUrlPchar}|\\/|\\?)*/i, {\n  validateUrlPchar: validateUrlPchar\n});\nexport default validateUrlFragment;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlPchar from './validateUrlPchar';\nvar validateUrlPath = regexSupplant(/(\\/#{validateUrlPchar}*)*/i, {\n  validateUrlPchar: validateUrlPchar\n});\nexport default validateUrlPath;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlPchar from './validateUrlPchar';\nvar validateUrlQuery = regexSupplant(/(#{validateUrlPchar}|\\/|\\?)*/i, {\n  validateUrlPchar: validateUrlPchar\n});\nexport default validateUrlQuery;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant'; // Modified version of RFC 3986 Appendix B\n\nvar validateUrlUnencoded = regexSupplant('^' + // Full URL\n'(?:' + '([^:/?#]+):\\\\/\\\\/' + // $1 Scheme\n')?' + '([^/?#]*)' + // $2 Authority\n'([^?#]*)' + // $3 Path\n'(?:' + '\\\\?([^#]*)' + // $4 Query\n')?' + '(?:' + '#(.*)' + // $5 Fragment\n')?$', 'i');\nexport default validateUrlUnencoded;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnicodeSubDomainSegment = /(?:(?:[a-z0-9]|[^\\u0000-\\u007f])(?:(?:[a-z0-9_\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\nexport default validateUrlUnicodeSubDomainSegment;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnicodeDomainSegment = /(?:(?:[a-z0-9]|[^\\u0000-\\u007f])(?:(?:[a-z0-9\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\nexport default validateUrlUnicodeDomainSegment;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Unencoded internationalized domains - this doesn't check for invalid UTF-8 sequences\nvar validateUrlUnicodeDomainTld = /(?:(?:[a-z]|[^\\u0000-\\u007f])(?:(?:[a-z0-9\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\nexport default validateUrlUnicodeDomainTld;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlUnicodeSubDomainSegment from './validateUrlUnicodeSubDomainSegment';\nimport validateUrlUnicodeDomainSegment from './validateUrlUnicodeDomainSegment';\nimport validateUrlUnicodeDomainTld from './validateUrlUnicodeDomainTld'; // Unencoded internationalized domains - this doesn't check for invalid UTF-8 sequences\n\nvar validateUrlUnicodeDomain = regexSupplant(/(?:(?:#{validateUrlUnicodeSubDomainSegment}\\.)*(?:#{validateUrlUnicodeDomainSegment}\\.)#{validateUrlUnicodeDomainTld})/i, {\n  validateUrlUnicodeSubDomainSegment: validateUrlUnicodeSubDomainSegment,\n  validateUrlUnicodeDomainSegment: validateUrlUnicodeDomainSegment,\n  validateUrlUnicodeDomainTld: validateUrlUnicodeDomainTld\n});\nexport default validateUrlUnicodeDomain;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlIp from './validateUrlIp';\nimport validateUrlUnicodeDomain from './validateUrlUnicodeDomain';\nvar validateUrlUnicodeHost = regexSupplant('(?:' + '#{validateUrlIp}|' + '#{validateUrlUnicodeDomain}' + ')', {\n  validateUrlIp: validateUrlIp,\n  validateUrlUnicodeDomain: validateUrlUnicodeDomain\n}, 'i');\nexport default validateUrlUnicodeHost;", "// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nimport regexSupplant from '../lib/regexSupplant';\nimport validateUrlUserinfo from './validateUrlUserinfo';\nimport validateUrlUnicodeHost from './validateUrlUnicodeHost';\nimport validateUrlPort from './validateUrlPort';\nvar validateUrlUnicodeAuthority = regexSupplant( // $1 userinfo\n'(?:(#{validateUrlUserinfo})@)?' + // $2 host\n'(#{validateUrlUnicodeHost})' + // $3 port\n'(?::(#{validateUrlPort}))?', {\n  validateUrlUserinfo: validateUrlUserinfo,\n  validateUrlUnicodeHost: validateUrlUnicodeHost,\n  validateUrlPort: validateUrlPort\n}, 'i');\nexport default validateUrlUnicodeAuthority;", "'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n  this._t = String(iterated); // target\n  this._i = 0;                // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n  var O = this._t;\n  var index = this._i;\n  var point;\n  if (index >= O.length) return { value: undefined, done: true };\n  point = $at(O, index);\n  this._i += point.length;\n  return { value: point, done: false };\n});\n", "'use strict';\nvar ctx = require('./_ctx');\nvar $export = require('./_export');\nvar toObject = require('./_to-object');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar toLength = require('./_to-length');\nvar createProperty = require('./_create-property');\nvar getIterFn = require('./core.get-iterator-method');\n\n$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {\n  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n  from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n    var O = toObject(arrayLike);\n    var C = typeof this == 'function' ? this : Array;\n    var aLen = arguments.length;\n    var mapfn = aLen > 1 ? arguments[1] : undefined;\n    var mapping = mapfn !== undefined;\n    var index = 0;\n    var iterFn = getIterFn(O);\n    var length, result, step, iterator;\n    if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n    // if object isn't iterable or it's array with default iterator - use simple case\n    if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n      for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n      }\n    } else {\n      length = toLength(O.length);\n      for (result = new C(length); length > index; index++) {\n        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n      }\n    }\n    result.length = index;\n    return result;\n  }\n});\n", "import emojiRegex from \"emoji-regex\"\nimport { escapeHTML } from \"library/render/utils/dom.ts\"\nimport twittertext from \"twitter-text\"\n\n/**\n * Provides HTML markup for use with Reacts dangerouslySetInnerHTML\n * prop. Will escape HTML entities in `text` and mark up paragraphs and\n * links within the text.\n */\nexport function commentMarkup(text: string): { __html: string } {\n\treturn { __html: formatComment(text) }\n}\n\nfunction formatComment(text: string): string {\n\treturn escapeHTML(text)\n\t\t.split(\"\\n\\n\")\n\t\t.map(block => `<p>${formatBlock(block)}</p>`)\n\t\t.join(\"\")\n}\n\n// Replace single newlines with <br> tags and urls with <a>.\nfunction formatBlock(text: string): string {\n\treturn text.split(\"\\n\").map(formatLinks).join(\"<br/>\")\n}\n\nfunction formatLinks(text: string): string {\n\tconst urls = twittertext.extractUrlsWithIndices(text, { extractUrlsWithoutProtocol: true })\n\tconst parts: string[] = []\n\n\tlet lastIndex = 0\n\turls.forEach(({ url, indices: [start, end] }) => {\n\t\tparts.push(text.slice(lastIndex, start), `<a href=\"${url}\" target=\"_blank\" title=\"${url}\">${shortenURL(url)}</a>`)\n\t\tlastIndex = end\n\t})\n\n\tparts.push(text.slice(lastIndex))\n\n\treturn parts.join(\"\")\n}\n\n/** Truncates longer urls for a cleaner display in messages */\nfunction shortenURL(url: string): string {\n\ttry {\n\t\tconst { hostname, pathname } = new URL(url)\n\t\tlet shortpath = pathname === \"/\" ? \"\" : pathname\n\t\t// 40 characters is about the length of a line, but\n\t\t// we don't truncate domains (just the path).\n\t\tif (`${hostname}${shortpath}`.length > 40 && shortpath.length >= 16) {\n\t\t\tshortpath = \"/\u2026\" + shortpath.slice(-14)\n\t\t}\n\t\treturn `${hostname}${shortpath}`\n\t} catch (e) {\n\t\treturn url\n\t}\n}\n\n// Create the regular expression lazily.\nconst getEmojiRegex = (() => {\n\tlet re: RegExp | undefined\n\treturn () => re || (re = emojiRegex())\n})()\n\nexport function containsOnlyEmoji(text: string): boolean {\n\tconst textWithoutWhitespace = text.replaceAll(/\\s+/gu, \"\")\n\n\t// Empty strings don't have emoji.\n\tif (!textWithoutWhitespace) return false\n\n\t// Return false if we have anything left after removing emojis.\n\tconst textWithoutEmojiOrWhitespace = textWithoutWhitespace.replaceAll(getEmojiRegex(), \"\").trim()\n\tif (textWithoutEmojiOrWhitespace) return false\n\n\t// 0-9 and # are technically emoji, so we also fail the check if we find\n\t// such in the string.\n\t// https://github.com/mathiasbynens/emoji-regex/issues/33#issuecomment-373674579\n\tconst hasAnyNonEmojis = /[\\d#]/u.test(text)\n\tif (hasAnyNonEmojis) return false\n\n\t// It's all emojis! \uD83E\uDD73\n\treturn true\n}\n", "import \"FeedbackThread.styles_18rl3ct.wyw.css\"; export const container = \"container_c1eav373\";\nexport const threadTabBar = \"threadTabBar_t1pzdvx1\";\nexport const scroll = \"scroll_siiknjz\";\nexport const form = \"form_ftnvcvk\";\nexport const replies = \"replies_rs9no9m\";\nexport const deletedComment = \"deletedComment_dlx0vez\";\nexport const rightActions = \"rightActions_r1utgf48\";\nexport const menuButton = \"menuButton_m3og139\";", "import { useCallback, useLayoutEffect, useRef } from \"react\"\n\nexport function useScrollLock() {\n\t// Anchor message scrolling to bottom of view and retain position\n\t// while back-scrolling. NOTE: this does not currently take into account\n\t// messages inserted above the current offset.\n\tconst scrollOffset = useRef<number | null>(null)\n\tconst scrollContainer = useRef<HTMLDivElement | null>(null)\n\n\tuseLayoutEffect(() => {\n\t\tconst el = scrollContainer.current\n\t\tif (!el) {\n\t\t\treturn\n\t\t}\n\t\tif (scrollOffset.current === null) {\n\t\t\tel.scrollTop = el.scrollHeight - el.offsetHeight\n\t\t} else {\n\t\t\tel.scrollTop = scrollOffset.current\n\t\t}\n\t})\n\n\tconst handleScroll = useCallback(() => {\n\t\tconst el = scrollContainer.current\n\t\tif (!el) {\n\t\t\treturn\n\t\t}\n\t\tscrollOffset.current = isScrolledToBottom(el) ? null : el.scrollTop\n\t}, [])\n\n\treturn { scrollOffset, scrollContainer, handleScroll }\n}\n\nfunction isScrolledToBottom(el: HTMLElement, fuzz = 5) {\n\treturn Math.abs(el.scrollHeight - el.offsetHeight - el.scrollTop) <= fuzz\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { countAndNoun } from \"utils/countAndNoun.ts\"\nimport { FeedbackActiveStatus, FeedbackErrorStatus, FeedbackItem } from \"./FeedbackItem.tsx\"\nimport * as styles from \"./FeedbackThreadSummary.styles.ts\"\nimport { containsOnlyEmoji } from \"./markup.ts\"\nimport type { Comment, CommentMetadataMap, Point } from \"./types.ts\"\nimport { useSafeComment } from \"./useFeedbackCommentEditorView.ts\"\nimport { getUnreadCommentsForThread, hasSendError } from \"./utils.ts\"\n\nexport interface Props {\n\tid: string\n\tComponent?: React.ElementType\n\tcomments: readonly Comment[]\n\tseenUntil?: Date\n\tcommentMetadata: CommentMetadataMap\n\tisContextMenuOpen: boolean\n\tonSelect?: (id: string) => void\n\tonContextMenu?: (id: string, point: Point) => void\n}\n\nexport function FeedbackThreadSummary({\n\tid,\n\tComponent = \"div\",\n\tseenUntil,\n\tcomments,\n\tonSelect,\n\tcommentMetadata,\n\tisContextMenuOpen,\n\tonContextMenu,\n}: Props) {\n\tconst [comment, ...replies] = comments\n\tassert(comment, \"Comment must be defined\")\n\tconst hasCommentsWithSendError = comments.some(threadComment => hasSendError(threadComment, commentMetadata))\n\tconst unreadComments = useMemo(() => getUnreadCommentsForThread({ seenUntil, comments }), [seenUntil, comments])\n\n\tconst { html, textContent } = useSafeComment(comment.text)\n\tconst hasOnlyEmoji = containsOnlyEmoji(textContent)\n\n\tconst handleSelect = useCallback(() => {\n\t\tif (onSelect) {\n\t\t\tonSelect(id)\n\t\t}\n\t}, [id, onSelect])\n\n\tconst handleContextMenu = useCallback(\n\t\t(point: Point) => {\n\t\t\tif (onContextMenu) {\n\t\t\t\tonContextMenu(id, point)\n\t\t\t}\n\t\t},\n\t\t[id, onContextMenu],\n\t)\n\n\tconst status = getStatus({\n\t\thasUnreadComments: unreadComments.length > 0,\n\t\thasReplies: replies.length > 0,\n\t\thasCommentsWithSendError,\n\t})\n\n\tconst threadDate = useMemo(() => {\n\t\tconst lastComment = comments.at(-1)\n\t\tassert(lastComment, \"Last comment must be defined\")\n\t\treturn lastComment.createdAt\n\t}, [comments])\n\n\treturn (\n\t\t<FeedbackItem\n\t\t\tComponent={Component}\n\t\t\tclassName={styles.container}\n\t\t\tauthor={comment.author}\n\t\t\tid={comment.id}\n\t\t\tdate={threadDate}\n\t\t\tstatus={status}\n\t\t\tisContextMenuOpen={isContextMenuOpen}\n\t\t\tonSelect={handleSelect}\n\t\t\tonContextMenu={handleContextMenu}\n\t\t>\n\t\t\t<div className={cx(styles.comment, hasOnlyEmoji && styles.hasOnlyEmoji)}>\n\t\t\t\t{/* biome-ignore lint/security/noDangerouslySetInnerHtml: <explanation> */}\n\t\t\t\t{hasOnlyEmoji ? textContent : <div dangerouslySetInnerHTML={{ __html: html }} />}\n\t\t\t</div>\n\t\t\t<Replies comments={replies} numberOfUnreadComments={unreadComments.length} />\n\t\t</FeedbackItem>\n\t)\n}\n\nfunction getStatus({\n\thasUnreadComments,\n\thasReplies,\n\thasCommentsWithSendError,\n}: {\n\thasUnreadComments: boolean\n\thasReplies: boolean\n\thasCommentsWithSendError: boolean\n}): React.ReactNode | null {\n\tif (hasCommentsWithSendError) {\n\t\treturn <FeedbackErrorStatus>Failed to send</FeedbackErrorStatus>\n\t}\n\tif (hasUnreadComments && !hasReplies) {\n\t\treturn <FeedbackActiveStatus>New</FeedbackActiveStatus>\n\t}\n\treturn null\n}\n\nfunction Replies({ comments, numberOfUnreadComments }: { comments: Comment[]; numberOfUnreadComments: number }) {\n\tconst notDeletedComments = comments.filter(c => !c.deletedBy)\n\tif (notDeletedComments.length === 0) return null\n\tconst hasUnreadComments = numberOfUnreadComments > 0\n\tconst commentsCount = hasUnreadComments ? numberOfUnreadComments : notDeletedComments.length\n\tconst replyCount = Math.min(commentsCount, 999)\n\n\tconst replySingular = hasUnreadComments ? \"new reply\" : \"reply\"\n\tconst replyPlural = hasUnreadComments ? \"new replies\" : \"replies\"\n\treturn (\n\t\t<div className={cx(styles.repliesContainer)}>\n\t\t\t<div className={cx(styles.repliesCounterLabel, hasUnreadComments && styles.isUnread)}>\n\t\t\t\t<p className={styles.repliesCounter}>{countAndNoun(replyCount, replySingular, replyPlural)}</p>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "import \"FeedbackThreadSummary.styles_jucihn.wyw.css\"; \"FeedbackThreadSummary_styles0_f1k039hb\";\nexport const isUnread = \"isUnread_i1jn74p3\";\nexport const comment = \"comment_cxxcdlz\";\nexport const hasOnlyEmoji = \"hasOnlyEmoji_hr04njs\";\nexport const repliesContainer = \"repliesContainer_r1q7sdz8\";\nexport const repliesCounterLabel = \"repliesCounterLabel_r1elzcyk\";\nexport const repliesCounter = \"repliesCounter_r94lihl\";\nexport const container = \"container_c129v7zq\";", "import \"FeedbackHUD.styles_1jomblr.wyw.css\"; export const container = \"container_ct6c6y2\";", "import type { VerifiedControlDescription, VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport {\n\tButton,\n\tEmptyState,\n\tReadOnlyContext,\n\tScroll,\n\tStack,\n\tTranslatable as T,\n\tTextArea,\n\tTextInput,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisTextNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { formSelectGenericOptionLabels } from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { getLayoutDirectionValue } from \"document/utils/getLayoutDirectionValue.ts\"\nimport { migrateTextToRichTextNode } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { memo } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { IconMagic } from \"../localization/IconMagic.tsx\"\nimport { getAncestorControlsForKeyPath } from \"../localization/ancestorControlKeyPath.ts\"\nimport { canBeBatchTranslated } from \"../localization/canBeBatchTranslated.ts\"\nimport type { LocalizationSource, LocalizationSourceRichTextNode } from \"../localization/getLocalizationSources.ts\"\nimport { isImageSource, isOverlayOnlyRichTextSource } from \"../localization/getLocalizationSources.ts\"\nimport { getLocalizationSourcesForNode } from \"../localization/getLocalizationSourcesForNode.ts\"\nimport { getNameForDefaultLocale } from \"../localization/getNameForDefaultLocale.ts\"\nimport { useActiveScopeVisibleInLocale } from \"../localization/useActiveScopeVisibleInLocale.tsx\"\nimport { useLocalizedValueEditingState } from \"../localization/useLocalizedValueEditingState.ts\"\nimport { ImagePopoutButton } from \"../shared/ImagePopoutButton.tsx\"\nimport { showAiCreditLimitModalIfReached } from \"../shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport {\n\tupsellLocalizationTranslationLimit,\n\tupsellTranslatableWordLimit,\n} from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport * as styles from \"./LocalizedValuePanel.styles.ts\"\nimport { Panel } from \"./panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"./panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderMinus } from \"./panels/icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./panels/icons/IconSectionHeaderPlus.tsx\"\nimport { PanelRow } from \"./rows/PanelRow.tsx\"\nimport { doubleColumnClass, spanAllColumnClass } from \"./utils/doubleColumn.styles.ts\"\n\nexport const LocalizedValuePanel = memo(function LocalizedValuePanel() {\n\tconst isReadOnly = useIsViewOnly(\"canEditContent\")\n\n\tconst activeCanvasLocale = useDeprecatedEngineState([EngineChange.Tree, engine.stores.chromeStore], () => {\n\t\tconst { canvasLocaleId } = engine.stores.chromeStore\n\t\treturn engine.tree.root.getNonDefaultLocale(canvasLocaleId)\n\t})\n\n\tconst localizationSourceState = useDeprecatedEngineState(\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle, engine.stores.selectionStore],\n\t\t() => {\n\t\t\tconst locales = engine.tree.root.locales\n\t\t\tif (!locales || engine.stores.selectionStore.nodes.length !== 1) return null\n\t\t\tconst [node] = engine.stores.selectionStore.nodes\n\t\t\tif (!node) return null\n\n\t\t\tconst sources = getLocalizationSourcesForNode(node, engine)\n\n\t\t\treturn { node, sources, locales }\n\t\t},\n\t)\n\n\tif (!activeCanvasLocale || !localizationSourceState) return null\n\n\tif (isTextNode(localizationSourceState.node)) {\n\t\tconst { node } = localizationSourceState\n\n\t\tconst handleUpdate = engine.scheduler.wrapHandler(() => {\n\t\t\tconst migrationInfo = migrateTextToRichTextNode(engine, node)\n\t\t\tif (!migrationInfo) return\n\n\t\t\tengine.stores.selectionStore.set(migrationInfo.idToSelect)\n\t\t})\n\n\t\treturn (\n\t\t\t<Stack justifyContent=\"center\" alignItems=\"center\" className={styles.panelContainer}>\n\t\t\t\t<EmptyState\n\t\t\t\t\tclassName={styles.legacyTextMessage}\n\t\t\t\t\tbody={<T>This text layer must be updated to be translated.</T>}\n\t\t\t\t\tbutton={\n\t\t\t\t\t\t<Button bold enabled={!isReadOnly} variant=\"withDepthPrimary\" onClick={handleUpdate}>\n\t\t\t\t\t\t\tUpdate\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<LocalizedValueRows\n\t\t\tactiveCanvasLocale={activeCanvasLocale}\n\t\t\tsources={localizationSourceState.sources}\n\t\t\tlocales={localizationSourceState.locales}\n\t\t/>\n\t)\n})\n\nfunction isSingleOverlayOnlyRichTextSource(sources: LocalizationSource[]): boolean {\n\tif (sources.length !== 1) return false\n\tconst source = sources[0]\n\tif (!source) return false\n\treturn isOverlayOnlyRichTextSource(source)\n}\n\nfunction LocalizedValueRows({\n\tsources,\n\tlocales,\n\tactiveCanvasLocale,\n}: {\n\tsources: LocalizationSource[]\n\tlocales: readonly Locale[]\n\tactiveCanvasLocale: Locale\n}) {\n\tconst isViewOnly = useIsViewOnly(\"canEditContent\")\n\n\tconst isVisibleInLocale = useActiveScopeVisibleInLocale()\n\n\tconst batchTranslatableItems = sources.filter(source =>\n\t\tcanBeBatchTranslated(activeCanvasLocale, source, engine.stores.previewStore.framerSiteId),\n\t)\n\n\tfunction openBatchTranslateModal() {\n\t\tif (showModalIfAiDisabled(engine, \"properties\")) return\n\t\tif (showAiCreditLimitModalIfReached(engine, \"properties\")) return\n\t\tif (upsellTranslatableWordLimit(engine, \"properties\")) return\n\n\t\tconst keyPaths = new Set(batchTranslatableItems.map(item => item.keyPath))\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.BatchTranslate,\n\t\t\tlocalesWithKeyPaths: [{ locale: activeCanvasLocale, keyPaths }],\n\t\t\tsource: \"localization_table\",\n\t\t})\n\t}\n\n\tif (isSingleOverlayOnlyRichTextSource(sources)) return null\n\n\treturn (\n\t\t<Stack direction=\"column\" gap={0} className={styles.panelContainer}>\n\t\t\t<Scroll className={styles.scroll}>\n\t\t\t\t<ReadOnlyContext.Provider value={isViewOnly || !isVisibleInLocale}>\n\t\t\t\t\t{sources.map(source =>\n\t\t\t\t\t\tsource.type === ClassDiscriminator.RichTextNode && source.textType === \"text\" ? (\n\t\t\t\t\t\t\t<LocalizedTextNodeValueRow\n\t\t\t\t\t\t\t\tkey={source.keyPath}\n\t\t\t\t\t\t\t\tsource={source}\n\t\t\t\t\t\t\t\tlocales={locales}\n\t\t\t\t\t\t\t\tactiveCanvasLocale={activeCanvasLocale}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<LocalizedValueRow\n\t\t\t\t\t\t\t\tkey={source.keyPath}\n\t\t\t\t\t\t\t\tsource={source}\n\t\t\t\t\t\t\t\tlocales={locales}\n\t\t\t\t\t\t\t\talwaysExpanded={sources.length === 1}\n\t\t\t\t\t\t\t\tactiveCanvasLocale={activeCanvasLocale}\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</ReadOnlyContext.Provider>\n\t\t\t</Scroll>\n\t\t\t{batchTranslatableItems.length > 0 && (\n\t\t\t\t<Stack padding={dimensions.css.panelPadding} className={styles.footer}>\n\t\t\t\t\t<Button onClick={openBatchTranslateModal} enabled={isVisibleInLocale}>\n\t\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\" gap={2}>\n\t\t\t\t\t\t\t<IconMagic active={false} />\n\t\t\t\t\t\t\t<span>{batchTranslatableItems.length === 1 ? Dictionary.Translate : `${Dictionary.Translate} All`}</span>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction getTitleForSource(source: LocalizationSource): string {\n\tconst sourceType = source.type\n\tswitch (sourceType) {\n\t\tcase ControlType.Enum:\n\t\t\treturn Dictionary.Option\n\t\tcase ControlType.String:\n\t\tcase ControlType.Link:\n\t\tcase \"slug\":\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Image: {\n\t\t\tconst node = engine.tree.get(source.nodeId)\n\t\t\tif (!node) return \"\"\n\n\t\t\tlet controls: VerifiedPropertyControls | undefined\n\n\t\t\tif (isCollectionItemNode(node)) {\n\t\t\t\tconst collection = engine.tree.get(node.parentid)\n\t\t\t\tcontrols = isCollectionNode(collection)\n\t\t\t\t\t? collection.getPropertyControls(engine.tree, engine.componentLoader)\n\t\t\t\t\t: undefined\n\t\t\t} else if (isCodeComponentNode(node)) {\n\t\t\t\tconst component = engine.componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\t\t\t\tcontrols = component?.properties\n\t\t\t}\n\n\t\t\tif (!controls) return \"\"\n\n\t\t\tconst control = controls[source.controlPropKey]\n\t\t\tlet name = control?.title ?? titleCase(source.controlPropKey)\n\n\t\t\tif (!source.ancestorControlKeyPath) return name\n\n\t\t\tlet currentControl: VerifiedControlDescription | undefined = control\n\t\t\tconst ancestorControls = getAncestorControlsForKeyPath(source.ancestorControlKeyPath)\n\t\t\tfor (const ancestorControl of ancestorControls) {\n\t\t\t\tif (!currentControl) return name\n\t\t\t\tif (ancestorControl.type === ControlType.Array) {\n\t\t\t\t\tif (currentControl.type !== ControlType.Array) return name\n\t\t\t\t\tcurrentControl = currentControl.control\n\t\t\t\t}\n\t\t\t\tif (ancestorControl.type === ControlType.Object) {\n\t\t\t\t\tif (currentControl.type !== ControlType.Object) return name\n\t\t\t\t\tcurrentControl = currentControl.controls[ancestorControl.key]\n\t\t\t\t\tif (currentControl) {\n\t\t\t\t\t\tname = currentControl.title ?? titleCase(ancestorControl.key)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn name\n\t\t}\n\t\tcase ClassDiscriminator.RichTextNode:\n\t\t\treturn Dictionary.Content\n\t\tcase ClassDiscriminator.FrameNode:\n\t\t\treturn \"Fill\"\n\t\tcase \"nodeLink\":\n\t\t\treturn Dictionary.Link\n\t\tcase ClassDiscriminator.RootNode:\n\t\t\treturn Dictionary.Site\n\t\tcase ClassDiscriminator.WebPageNode:\n\t\t\treturn Dictionary.PageSettings\n\t\tcase ClassDiscriminator.FormPlainTextInputNode:\n\t\t\treturn Dictionary.Placeholder\n\t\tcase ClassDiscriminator.FormSelectNode:\n\t\t\treturn Dictionary.Option\n\t\tcase \"formSelectGenericOption\":\n\t\t\treturn formSelectGenericOptionLabels[source.key]\n\t\tcase ClassDiscriminator.RouteSegmentNode:\n\t\t\treturn \"Page Path Segment\"\n\t\tcase \"prefix\": {\n\t\t\treturn \"Prefix\"\n\t\t}\n\t\tcase \"suffix\": {\n\t\t\treturn \"Suffix\"\n\t\t}\n\t\tcase \"convertFromBoolean\": {\n\t\t\tif (source.property === \"fallback\") return Dictionary.Fallback\n\t\t\treturn `When ${source.property === \"truthy\" ? Dictionary.Yes : Dictionary.No}`\n\t\t}\n\t\tcase \"convertFromEnum\": {\n\t\t\tif (source.isDefaultCase) {\n\t\t\t\treturn Dictionary.Fallback\n\t\t\t}\n\n\t\t\treturn \"Option\"\n\t\t}\n\t\tdefault:\n\t\t\tshouldBeNever(sourceType)\n\t\t\treturn \"\"\n\t}\n}\n\n// Persist expanded state during a session\nconst interactiveExpandedKeyPaths = new Set<string>()\n\nfunction LocalizedValueRow({\n\tsource,\n\tlocales,\n\tactiveCanvasLocale,\n\talwaysExpanded,\n}: {\n\tsource: LocalizationSource\n\tlocales: readonly Locale[]\n\tactiveCanvasLocale: Locale\n\talwaysExpanded: boolean\n}) {\n\tconst {\n\t\tisRichText,\n\t\toriginalInputValue,\n\t\toriginalInputPlaceholder,\n\t\tinputValue,\n\t\tinputEnabled,\n\t\tinputHidden,\n\t\tinputPlaceholder,\n\t\tupdate,\n\n\t\timageEnabled,\n\t\toriginalImageValue,\n\t\timageValue,\n\t\timageFallback,\n\t\thandleImageUpload,\n\t\tupdateAssetSize,\n\t\tclearImage,\n\n\t\timagePositionX,\n\t\timagePositionY,\n\t\timageSupportsFocalPoint,\n\t\thandleFocalPointChange,\n\t\toriginalImagePositionX,\n\t\toriginalImagePositionY,\n\t} = useLocalizedValueEditingState(engine, activeCanvasLocale, locales, source, \"properties_panel\")\n\n\tconst [isInteractiveExpanded, setExpanded] = React.useState(interactiveExpandedKeyPaths.has(source.keyPath))\n\n\tconst isLocalized = isString(inputValue)\n\n\tconst isExpanded = isInteractiveExpanded || isLocalized || alwaysExpanded\n\tconst canToggleExpand = !isLocalized && !alwaysExpanded\n\n\tconst defaultLocaleName = useDeprecatedEngineState(EngineChange.Tree, () => getNameForDefaultLocale(engine.tree))\n\n\tconst isImage = isImageSource(source)\n\n\tfunction handleInputFocus(event: React.SyntheticEvent) {\n\t\tif (upsellLocalizationTranslationLimit(engine, source, activeCanvasLocale, \"properties\")) {\n\t\t\tevent.preventDefault()\n\t\t\treturn\n\t\t}\n\n\t\tif (event.type !== \"focus\") return\n\n\t\t// If the user has just added another translation, the LocalizationStore\n\t\t// hasn't updated yet. We need to wait for the next frame to decide if\n\t\t// we need to show the upsell.\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tupsellLocalizationTranslationLimit(engine, source, activeCanvasLocale, \"properties\")\n\t\t})\n\t}\n\n\tfunction handleImagePopoutBeforePresent() {\n\t\treturn !upsellLocalizationTranslationLimit(engine, source, activeCanvasLocale, \"properties\")\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Panel\n\t\t\t\theader={\n\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\ttitle={getTitleForSource(source)}\n\t\t\t\t\t\tclickable={canToggleExpand}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!canToggleExpand) return\n\t\t\t\t\t\t\tsetExpanded(currentlyExpanded => {\n\t\t\t\t\t\t\t\tconst newIsExpanded = !currentlyExpanded\n\t\t\t\t\t\t\t\tif (newIsExpanded) {\n\t\t\t\t\t\t\t\t\tinteractiveExpandedKeyPaths.add(source.keyPath)\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tinteractiveExpandedKeyPaths.delete(source.keyPath)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn newIsExpanded\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\t{canToggleExpand && (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t\t{isExpanded ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{!isRichText && isExpanded && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{isImage && (\n\t\t\t\t\t\t\t<PanelRow title={defaultLocaleName}>\n\t\t\t\t\t\t\t\t<ReadOnlyContext.Provider value>\n\t\t\t\t\t\t\t\t\t<ImagePopoutButton\n\t\t\t\t\t\t\t\t\t\ttitle={defaultLocaleName}\n\t\t\t\t\t\t\t\t\t\timageReference={originalImageValue ?? \"\"}\n\t\t\t\t\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\t\t\t\t\tonChangeAssetSize={noop}\n\t\t\t\t\t\t\t\t\t\tpositionX={originalImagePositionX}\n\t\t\t\t\t\t\t\t\t\tpositionY={originalImagePositionY}\n\t\t\t\t\t\t\t\t\t\tonChangeFocalPosition={imageSupportsFocalPoint ? noop : undefined}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!inputHidden && (\n\t\t\t\t\t\t\t<PanelRow title={isImage ? \"\" : defaultLocaleName}>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tvalue={originalInputValue}\n\t\t\t\t\t\t\t\t\tplaceholder={originalInputPlaceholder}\n\t\t\t\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{isImage && (\n\t\t\t\t\t\t\t<PanelRow title={activeCanvasLocale.name}>\n\t\t\t\t\t\t\t\t<ReadOnlyContext.Provider value={!imageEnabled}>\n\t\t\t\t\t\t\t\t\t<ImagePopoutButton\n\t\t\t\t\t\t\t\t\t\ttitle={activeCanvasLocale.name}\n\t\t\t\t\t\t\t\t\t\timageReference={imageValue ?? imageFallback ?? \"\"}\n\t\t\t\t\t\t\t\t\t\tpreviewDimmed={!imageValue}\n\t\t\t\t\t\t\t\t\t\tonChange={handleImageUpload}\n\t\t\t\t\t\t\t\t\t\tonChangeAssetSize={updateAssetSize}\n\t\t\t\t\t\t\t\t\t\tonBeforePresent={handleImagePopoutBeforePresent}\n\t\t\t\t\t\t\t\t\t\tpositionX={imagePositionX}\n\t\t\t\t\t\t\t\t\t\tpositionY={imagePositionY}\n\t\t\t\t\t\t\t\t\t\tonChangeFocalPosition={handleFocalPointChange}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttitle={Dictionary.Clear}\n\t\t\t\t\t\t\t\t\t\tonClick={clearImage}\n\t\t\t\t\t\t\t\t\t\tstyle={{ width: \"100%\" }}\n\t\t\t\t\t\t\t\t\t\tenabled={imageEnabled && Boolean(imageValue)}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!inputHidden && (\n\t\t\t\t\t\t\t<PanelRow title={isImage ? \"\" : activeCanvasLocale.name}>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tvalue={inputValue ?? \"\"}\n\t\t\t\t\t\t\t\t\tplaceholder={inputPlaceholder}\n\t\t\t\t\t\t\t\t\tenabled={inputEnabled}\n\t\t\t\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\t\t\tonFocus={handleInputFocus}\n\t\t\t\t\t\t\t\t\t// This will prevent a flicker because the input gets focused and\n\t\t\t\t\t\t\t\t\t// unfocused right away.\n\t\t\t\t\t\t\t\t\tonMouseDown={handleInputFocus}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{isRichText && isExpanded && (\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\tenabled={inputEnabled}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tif (upsellLocalizationTranslationLimit(engine, source, activeCanvasLocale, \"properties\")) {\n\t\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tengine.stores.chromeStore.setOverlay({\n\t\t\t\t\t\t\t\t\ttype: \"localization\",\n\t\t\t\t\t\t\t\t\tkeyPath: source.keyPath,\n\t\t\t\t\t\t\t\t\tsingleColumn: true,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tclassName={spanAllColumnClass}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tOpen Overlay\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t</Panel>\n\t\t</>\n\t)\n}\n\nfunction LocalizedTextNodeValueRow({\n\tsource,\n\tlocales,\n\tactiveCanvasLocale,\n}: {\n\tsource: LocalizationSourceRichTextNode\n\tlocales: readonly Locale[]\n\tactiveCanvasLocale: Locale\n}) {\n\tconst { originalInputValue, originalInputPlaceholder, inputValue, inputEnabled, inputPlaceholder, update } =\n\t\tuseLocalizedValueEditingState(engine, activeCanvasLocale, locales, source, \"properties_panel\")\n\n\tconst { defaultLocaleName, defaultLocaleLayoutDirection, activeLocaleLayoutDirection } = useEngineState(\n\t\t() => {\n\t\t\tconst defaultLocale = engine.tree.root.getDefaultLocale()\n\t\t\tconst adaptLayoutToTextDirection = engine.tree.root.adaptLayoutToTextDirection\n\t\t\treturn {\n\t\t\t\tdefaultLocaleName: getNameForDefaultLocale(engine.tree),\n\t\t\t\tdefaultLocaleLayoutDirection: getLayoutDirectionValue(defaultLocale, adaptLayoutToTextDirection),\n\t\t\t\tactiveLocaleLayoutDirection: getLayoutDirectionValue(activeCanvasLocale, adaptLayoutToTextDirection),\n\t\t\t}\n\t\t},\n\t\t[activeCanvasLocale],\n\t\tEngineChange.Tree,\n\t)\n\n\tif (source.textType !== \"text\") return null\n\n\tfunction handleInputFocus(event: React.SyntheticEvent) {\n\t\tif (upsellLocalizationTranslationLimit(engine, source, activeCanvasLocale, \"properties\")) {\n\t\t\tevent.preventDefault()\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Panel header={<PanelSectionHeader title={defaultLocaleName} />}>\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tminRows={6}\n\t\t\t\t\t\tvalue={originalInputValue}\n\t\t\t\t\t\tplaceholder={originalInputPlaceholder}\n\t\t\t\t\t\tonChange={noop}\n\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\tclassName={spanAllColumnClass}\n\t\t\t\t\t\tdirection={defaultLocaleLayoutDirection}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t</Panel>\n\t\t\t<Panel header={<PanelSectionHeader title={activeCanvasLocale.name} />}>\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tminRows={6}\n\t\t\t\t\t\tvalue={inputValue ?? \"\"}\n\t\t\t\t\t\tplaceholder={inputPlaceholder}\n\t\t\t\t\t\tconstantChange={false}\n\t\t\t\t\t\tenabled={inputEnabled}\n\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\tclassName={spanAllColumnClass}\n\t\t\t\t\t\tonFocus={handleInputFocus}\n\t\t\t\t\t\t// This will prevent a flicker because the input gets focused and\n\t\t\t\t\t\t// unfocused right away.\n\t\t\t\t\t\tonMouseDown={handleInputFocus}\n\t\t\t\t\t\tdirection={activeLocaleLayoutDirection}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t</Panel>\n\t\t</>\n\t)\n}\n", "import \"LocalizedValuePanel.styles_1qjgqts.wyw.css\"; export const panelContainer = \"panelContainer_p17hazpv\";\nexport const scroll = \"scroll_sygg8wd\";\nexport const footer = \"footer_f134wfyn\";\nexport const legacyTextMessage = \"legacyTextMessage_l1csjwnx\";", "import React from \"react\"\n\nexport const IconSectionHeaderMinus = React.memo(function IconSectionHeaderMinus() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\">\n\t\t\t<path\n\t\t\t\td=\"M 0 4.75 C 0 4.336 0.336 4 0.75 4 L 8.75 4 C 9.164 4 9.5 4.336 9.5 4.75 L 9.5 4.75 C 9.5 5.164 9.164 5.5 8.75 5.5 L 0.75 5.5 C 0.336 5.5 0 5.164 0 4.75 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n})\n", "import React from \"react\"\nimport { ContentPanelSectionHeader } from \"../../contentPanel/ContentPanelSectionHeader.tsx\"\nimport * as classes from \"./SizePresetRow.styles.ts\"\n\ninterface SizePresetInfo<T> {\n\twidth: number\n\theight: number\n\ttype?: T\n}\n\ninterface SizePresetHeaderProps<T> {\n\ttitle: string\n\texpanded: boolean\n\ttype: T\n\tonClick: (type: T) => void\n}\n\nfunction SizePresetHeader<T>({ title, expanded, type, onClick }: SizePresetHeaderProps<T>) {\n\tconst onClickHandler = () => onClick(type)\n\n\treturn (\n\t\t<ContentPanelSectionHeader\n\t\t\tkey={title}\n\t\t\ttitle={title}\n\t\t\tonClick={onClickHandler}\n\t\t\tcollapsed={!expanded}\n\t\t\tclassName={classes.sizePresetHeader}\n\t\t/>\n\t)\n}\n\ninterface SizePresetRowGroupProps {\n\tstyle?: React.CSSProperties\n\tchildren: React.ReactNode\n}\n\nexport function SizePresetRowGroup({ style, children }: SizePresetRowGroupProps) {\n\treturn (\n\t\t<div className={classes.sizePresetRowGroup} style={style}>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n\ninterface SizePresetRowProps<T> extends SizePresetInfo<T> {\n\ttitle: string\n\tonClick: (info: SizePresetInfo<T>) => void\n}\n\nfunction SizePresetRow<T>({ title, width, height, type, onClick }: SizePresetRowProps<T>) {\n\tconst onClickHandler = () => onClick({ type, width, height })\n\n\treturn (\n\t\t<div className={classes.sizePresetRow} onClick={onClickHandler}>\n\t\t\t{title}\n\t\t\t<span className={classes.sizePresetRowDetail}>{`${width} \u00D7 ${height}`}</span>\n\t\t</div>\n\t)\n}\n\n// This is the only way to keep the generic T working while memoizing the components\nconst MemoSizePresetRow = React.memo(SizePresetRow) as typeof SizePresetRow\nconst MemoSizePresetHeader = React.memo(SizePresetHeader) as typeof SizePresetHeader\nexport { MemoSizePresetHeader as SizePresetHeader, MemoSizePresetRow as SizePresetRow }\n", "import \"ContentPanelSectionHeader.styles_1r4lkoq.wyw.css\"; export const header = \"header_h1m6bixy\";\nexport const headerCollapsed = \"headerCollapsed_h1s15jyp\";\nexport const title = \"title_toyeaw6\";", "import { IconSectionCollapsed } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport * as styles from \"./ContentPanelSectionHeader.styles.ts\"\n\nconst contentItemIndention = 16\n\ninterface Props extends React.HTMLAttributes<HTMLDivElement> {\n\ttitle: string\n\tcollapsed: boolean\n\tindentionLevel?: number\n}\n\nexport function ContentPanelSectionHeader({ title, collapsed, indentionLevel, style, className, ...rest }: Props) {\n\tlet combinedStyle = style\n\n\tif (indentionLevel) {\n\t\tcombinedStyle = {\n\t\t\t...style,\n\t\t\tpaddingLeft: `calc(${contentItemIndention}px * ${indentionLevel})`,\n\t\t}\n\t}\n\n\treturn (\n\t\t<div className={cx(styles.header, collapsed && styles.headerCollapsed, className)} style={combinedStyle} {...rest}>\n\t\t\t<IconSectionCollapsed />\n\t\t\t<div className={styles.title}>{title}</div>\n\t\t</div>\n\t)\n}\n", "import \"SizePresetRow.styles_1pvjhc8.wyw.css\"; export const sizePresetHeader = \"sizePresetHeader_s1u92per\";\nexport const sizePresetRowGroup = \"sizePresetRowGroup_s1tlh1vy\";\nexport const sizePresetRow = \"sizePresetRow_s187ty6d\";\nexport const sizePresetRowDetail = \"sizePresetRowDetail_s1rmynba\";", "import { Scroll } from \"@framerjs/fresco\"\nimport { AutoSized } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport {\n\tcreateScreenWithPreset,\n\tcreateWrappingFrame,\n\tsuggestedRect,\n} from \"document/components/tools/utils/FramesHelper.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { FramePresetCategory, FramePresetID } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport {\n\tframePresetCategories,\n\tframePresetsByCategory,\n\tgetFramePresetCategory,\n} from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { SizePresetHeader, SizePresetRow, SizePresetRowGroup } from \"./rows/SizePresetRow.tsx\"\n\ninterface Props {\n\tnodes: CanvasNode[]\n}\n\nexport function FramePresetsPanel({ nodes }: Props) {\n\tconst { propertiesPanelStore, canvasStore, selectionStore, scopeStore, persistedUserDefaults } = engine.stores\n\tconst { expandedFrameCategories: expandedCategories } = propertiesPanelStore.useState()\n\n\tconst addFramePresetHandler = useEngineCallback(\n\t\t(info: { width: number; height: number; type?: FramePresetID }) => {\n\t\t\tconst rect = suggestedRect(\n\t\t\t\tengine.tree,\n\t\t\t\tscopeStore.active,\n\t\t\t\tinfo,\n\t\t\t\tnodes.map(node => node.id),\n\t\t\t)\n\n\t\t\tconst newNodeID = info.type ? createScreenWithPreset(engine, rect, info.type) : createWrappingFrame(engine, rect)\n\n\t\t\trecord(\"layout_frame\", {\n\t\t\t\twidth: rect.width,\n\t\t\t\theight: rect.height,\n\t\t\t\tpresetDeviceType: info.type,\n\t\t\t\tpresetDeviceTypeCategory: getFramePresetCategory(info.type),\n\t\t\t\tsource: \"props_panel\",\n\t\t\t})\n\n\t\t\tengine.exitTool()\n\t\t\tcanvasStore.zoomToCenter(rect, {\n\t\t\t\tmaxZoom: 1,\n\t\t\t\tanimated: persistedUserDefaults.animateOnZoom,\n\t\t\t})\n\t\t\tselectionStore.set(newNodeID, { switchToLayers: true, switchToProperties: true })\n\t\t},\n\t\t[nodes],\n\t)\n\n\treturn (\n\t\t<div style={styleWrapper}>\n\t\t\t<Scroll style={style}>\n\t\t\t\t{framePresetCategories.map((framePresetCategory: FramePresetCategory) => {\n\t\t\t\t\tconst isExpanded = expandedCategories.has(framePresetCategory)\n\n\t\t\t\t\tconst items: JSX.Element[] = [\n\t\t\t\t\t\t<SizePresetHeader\n\t\t\t\t\t\t\tkey={`${framePresetCategory}-header`}\n\t\t\t\t\t\t\ttitle={framePresetCategory}\n\t\t\t\t\t\t\texpanded={isExpanded}\n\t\t\t\t\t\t\ttype={framePresetCategory}\n\t\t\t\t\t\t\tonClick={engine.stores.propertiesPanelStore.toggleFrameCategory}\n\t\t\t\t\t\t/>,\n\t\t\t\t\t]\n\n\t\t\t\t\tif (isExpanded) {\n\t\t\t\t\t\tconst framePresets = framePresetsByCategory[framePresetCategory]\n\n\t\t\t\t\t\titems.push(\n\t\t\t\t\t\t\t<SizePresetRowGroup key={`${framePresetCategory}-group`}>\n\t\t\t\t\t\t\t\t{framePresets.map(framePreset => (\n\t\t\t\t\t\t\t\t\t<SizePresetRow\n\t\t\t\t\t\t\t\t\t\tkey={framePreset.id}\n\t\t\t\t\t\t\t\t\t\ttitle={framePreset.title}\n\t\t\t\t\t\t\t\t\t\twidth={framePreset.screenWidth}\n\t\t\t\t\t\t\t\t\t\theight={framePreset.screenHeight}\n\t\t\t\t\t\t\t\t\t\ttype={framePreset.id}\n\t\t\t\t\t\t\t\t\t\tonClick={addFramePresetHandler}\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</SizePresetRowGroup>,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<AutoSized key={`${framePresetCategory}-autosize`} dependencies={isExpanded}>\n\t\t\t\t\t\t\t{items}\n\t\t\t\t\t\t</AutoSized>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</Scroll>\n\t\t</div>\n\t)\n}\n\n// Helpers\n\nconst styleWrapper: React.CSSProperties = {\n\tdisplay: \"flex\",\n\tflexDirection: \"column\",\n\theight: \"100%\",\n}\n\nconst style: React.CSSProperties = {\n\tpadding: `0 ${dimensions.css.panelPadding} ${dimensions.css.panelPadding}`,\n\tflexGrow: 1,\n\theight: 1,\n}\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReducedPolygon } from \"document/models/CanvasTree/traits/WithPolygon.ts\"\nimport { withPolygon } from \"document/models/CanvasTree/traits/WithPolygon.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React from \"react\"\n\ninterface Props extends ReducedPolygon {\n\texpandedSelectionForShapeGeometryIds: NodeID[]\n}\n\nexport class PolygonSidesPanel extends React.PureComponent<Props> {\n\tonChange = engine.scheduler.wrapHandler((polygonSides: number) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.expandedSelectionForShapeGeometryIds, withPolygon)\n\t\tnodes.forEach(node => node.set({ polygonSides }))\n\t})\n\n\toverride render() {\n\t\tconst { onlyPolygonNodes, polygonSides } = this.props\n\n\t\tif (!onlyPolygonNodes || isNotFound(polygonSides)) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Sides\">\n\t\t\t\t<NumberInputWithTicker value={polygonSides} onChange={this.onChange} min={3} max={100} />\n\t\t\t\t<Slider value={polygonSides} min={3} max={8} onChange={this.onChange} />\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReducedSizeToFit } from \"document/models/CanvasTree/traits/WithSizeToFit.ts\"\nimport { withSizeToFit } from \"document/models/CanvasTree/traits/WithSizeToFit.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props extends ReducedSizeToFit {\n\tnodeIds: NodeID[]\n\tonlyShapeContainerNodes: boolean\n}\n\nexport const ShapeSizeToFitContentPanel = React.memo(({ nodeIds, onlyShapeContainerNodes, sizeToFit }: Props) => {\n\tif (!onlyShapeContainerNodes) return null\n\n\tconst updateSizeToFit = engine.scheduler.wrapHandler((newSizeToFit: boolean) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withSizeToFit)\n\t\tnodes.forEach(node => node.set({ sizeToFit: newSizeToFit }))\n\t})\n\n\treturn (\n\t\t<PanelRow title=\" \">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem title=\"Auto\" identifier={true} selected={sizeToFit === true} onSelect={updateSizeToFit} />\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\ttitle=\"Fixed\"\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\tselected={sizeToFit === false}\n\t\t\t\t\tonSelect={updateSizeToFit}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReducedSpikes } from \"document/models/CanvasTree/traits/WithSpikes.ts\"\nimport { withSpikes } from \"document/models/CanvasTree/traits/WithSpikes.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React from \"react\"\n\ninterface Props extends ReducedSpikes {\n\texpandedSelectionForShapeGeometryIds: NodeID[]\n}\n\nexport class StarSpikesPanel extends React.PureComponent<Props> {\n\tonChangeSpikeCount = engine.scheduler.wrapHandler((value: number) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.expandedSelectionForShapeGeometryIds, withSpikes)\n\t\tnodes.forEach(node => node.set({ spikeCount: value }))\n\t})\n\n\tonChangeSpikeDepth = engine.scheduler.wrapHandler((value: number) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.expandedSelectionForShapeGeometryIds, withSpikes)\n\t\tnodes.forEach(node => node.set({ spikeDepth: value }))\n\t})\n\n\toverride render() {\n\t\tconst { onlyNodesWithSpikes, spikeCount, spikeDepth } = this.props\n\n\t\tif (!onlyNodesWithSpikes || isNotFound(spikeCount) || isNotFound(spikeDepth)) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Points\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={spikeCount}\n\t\t\t\t\tonChange={this.onChangeSpikeCount}\n\t\t\t\t\tmin={2}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tdefaultValue={5}\n\t\t\t\t/>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={spikeDepth}\n\t\t\t\t\tonChange={this.onChangeSpikeDepth}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tdefaultValue={50}\n\t\t\t\t\tunit=\"%\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { ElectronWebRendering, ElectronWebRenderingV2, channelToParentFrame } from \"@framerjs/framer-services\"\nimport type { Logger } from \"@framerjs/shared\"\nimport { assert, getLogger } from \"@framerjs/shared\"\n\nexport class CustomWindow {\n\tprivate static deprecatedServicePromise?: Promise<ElectronWebRendering.Interface>\n\tprivate static servicePromise?: Promise<ElectronWebRenderingV2.Interface>\n\tprivate static currentWindow?: CustomWindow\n\n\tprivate static async serviceIfAvailable(): Promise<\n\t\tElectronWebRendering.Interface | ElectronWebRenderingV2.Interface | undefined\n\t> {\n\t\t// Discover on the parent context only once, and assume discovery is almost instant (because in-app)\n\t\tCustomWindow.deprecatedServicePromise =\n\t\t\tCustomWindow.deprecatedServicePromise ?? ElectronWebRendering.on(channelToParentFrame).discover({ timeout: 1000 })\n\t\tCustomWindow.servicePromise =\n\t\t\tCustomWindow.servicePromise ?? ElectronWebRenderingV2.on(channelToParentFrame).discover({ timeout: 1000 })\n\n\t\ttry {\n\t\t\tconst service = await Promise.any([CustomWindow.servicePromise, CustomWindow.deprecatedServicePromise])\n\t\t\treturn service\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tstatic async isAvailable(): Promise<boolean> {\n\t\treturn !!(await CustomWindow.serviceIfAvailable())\n\t}\n\n\tstatic async new(options: ElectronWebRendering.WindowOptions): Promise<CustomWindow> {\n\t\t// Close existing window if one exists\n\t\tif (CustomWindow.currentWindow) {\n\t\t\tCustomWindow.currentWindow.contentWindow.close()\n\t\t\tCustomWindow.currentWindow = undefined\n\t\t}\n\n\t\tconst service = await CustomWindow.serviceIfAvailable()\n\t\tassert(service, \"CustomWindow is not available\")\n\n\t\tconst log = getLogger(\"electron-window\")\n\t\tconst windowRef = await service.willOpenWindow(options)\n\t\tlog.debug(\"opening window...\")\n\t\tconst contentWindow = window.open(options.url, \"_blank\") ?? undefined\n\n\t\tassert(contentWindow, \"Couldn't open a new DOM window\")\n\n\t\tlog.debug(\"opened window\", contentWindow)\n\n\t\tCustomWindow.currentWindow = new CustomWindow(log, service, windowRef, contentWindow)\n\t\treturn CustomWindow.currentWindow\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly log: Logger,\n\t\tprivate readonly windowService: ElectronWebRendering.Interface | ElectronWebRenderingV2.Interface,\n\t\tprivate readonly windowRef: ElectronWebRendering.WindowReference,\n\n\t\t/** DOM Window instance wrapped by the custom window, analogue to IFrame/contentWindow. */\n\t\treadonly contentWindow: Window,\n\t) {}\n\n\tasync openSaveDialog({\n\t\tcount,\n\t\tpathname,\n\t}: ElectronWebRendering.SaveDialogOptions): Promise<ElectronWebRendering.SaveDialogValue> {\n\t\treturn this.windowService.openSaveDialog({ count, pathname })\n\t}\n\n\tasync collectMetrics(): Promise<ElectronWebRendering.MetricList> {\n\t\treturn this.windowService.collectMetrics()\n\t}\n\n\tasync writeToClipboard(options: Omit<ElectronWebRendering.ClipboardOptions, \"ref\">): Promise<void> {\n\t\treturn this.windowService.writeToClipboard({ ...options, ref: this.windowRef })\n\t}\n\n\tasync writeToDisk(options: Omit<ElectronWebRenderingV2.SnapshotOptions, \"ref\">): Promise<void> {\n\t\tthis.log.debug(\"capture....\", this.windowRef)\n\t\treturn this.windowService.writeToDisk({ ...options, ref: this.windowRef })\n\t}\n\n\tasync getImageData(options: Omit<ElectronWebRenderingV2.SnapshotOptions, \"ref\">): Promise<string> {\n\t\tif (\"getImageData\" in this.windowService) {\n\t\t\tconst data = await this.windowService.getImageData({ ...options, ref: this.windowRef })\n\t\t\treturn data.imageData\n\t\t}\n\t\treturn Promise.reject(new Error(\"getImageData is not available\"))\n\t}\n}\n", "import type { ElectronWebRenderingV2 } from \"@framerjs/framer-services\"\nimport { ResolvablePromise, getLogger } from \"@framerjs/shared\"\nimport { CanvasTreeVersion } from \"document/models/CanvasTree/CanvasTreeVersion.ts\"\nimport { CustomWindow } from \"electron-features/CustomWindow.ts\"\nimport type { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport { sandboxInterface } from \"utils/rpc/shared/definitions.ts\"\nimport { SandboxRPC } from \"./SandboxRPC.ts\"\nimport type { SandboxConfig } from \"./sandboxConfig.ts\"\n\nexport type WindowSnapshotOptions = Omit<ElectronWebRenderingV2.SnapshotOptions, \"ref\">\nexport type WindowClipboardOptions = Omit<ElectronWebRenderingV2.ClipboardOptions, \"ref\">\n\n/**\n * Represents a sandbox rendered inside a standalone window.\n */\nexport class WindowSandbox extends SandboxRPC {\n\tstatic async isAvailable(): Promise<boolean> {\n\t\treturn CustomWindow.isAvailable()\n\t}\n\n\tprivate log = getLogger(\"window-sandbox\")\n\tprivate windowPromise = new ResolvablePromise<CustomWindow>()\n\n\tconstructor(\n\t\tconfig: SandboxConfig,\n\t\trenderTarget: RenderTarget,\n\t\toptions: Omit<ElectronWebRenderingV2.WindowOptions, \"url\">,\n\t) {\n\t\tsuper()\n\t\tvoid this.start(config, renderTarget, options)\n\t}\n\n\tprivate async start(\n\t\tconfig: SandboxConfig,\n\t\trenderTarget: RenderTarget,\n\t\toptions: Omit<ElectronWebRenderingV2.WindowOptions, \"url\">,\n\t) {\n\t\ttry {\n\t\t\tconst window = await CustomWindow.new({ ...options, url: config.url })\n\n\t\t\tthis.log.debug(\"WindowSandbox: created custom window\")\n\t\t\tthis.windowPromise.resolve(window)\n\n\t\t\tawait this.controller.connect({ target: window.contentWindow, url: config.origin })\n\t\t\tawait this.controller.getRemote(sandboxInterface.channels.renderer).initialize(CanvasTreeVersion, renderTarget)\n\t\t} catch (error) {\n\t\t\tthis.log.error(\"WindowSandbox.start():\", error)\n\t\t\tthis.windowPromise.reject(error)\n\t\t}\n\t}\n\n\tasync openSaveDialog({\n\t\tcount,\n\t\tpathname,\n\t}: ElectronWebRenderingV2.SaveDialogOptions): Promise<ElectronWebRenderingV2.SaveDialogValue> {\n\t\tconst customWindow = await this.windowPromise\n\t\treturn customWindow.openSaveDialog({ count, pathname })\n\t}\n\n\tasync collectMetrics(): Promise<ElectronWebRenderingV2.MetricList> {\n\t\tconst customWindow = await this.windowPromise\n\t\treturn customWindow.collectMetrics()\n\t}\n\n\tasync writeToClipboard(options: WindowClipboardOptions): Promise<void> {\n\t\tconst customWindow = await this.windowPromise\n\t\treturn customWindow.writeToClipboard(options)\n\t}\n\n\tasync writeToDisk(options: WindowSnapshotOptions): Promise<void> {\n\t\tconst customWindow = await this.windowPromise\n\t\treturn customWindow.writeToDisk(options)\n\t}\n\n\tasync getImageData(options: WindowSnapshotOptions): Promise<string> {\n\t\tconst customWindow = await this.windowPromise\n\t\treturn customWindow.getImageData(options)\n\t}\n}\n", "import * as FramerEvents from \"@framerjs/framer-events\"\nimport type { ElectronWebRendering } from \"@framerjs/framer-services\"\nimport type { NodeSnapshotOptions } from \"./NodeRenderer.ts\"\n\ninterface ImageExporterMetric {\n\treadonly durationMs: number\n\treadonly format: string\n\treadonly exportCount: number\n\treadonly success: boolean\n\treadonly scope: string\n\treadonly errorReason: string | null\n\treadonly sizeKb: number\n\treadonly hasSavedToDisk: boolean\n\treadonly nodeWidth: number\n\treadonly nodeHeight: number\n}\n\ntype ImageSnapshotOptions = NodeSnapshotOptions\n\nexport class ExportMetrics {\n\tstatic trackError(reason: string) {\n\t\tFramerEvents.triggerExportBitmapEvent({\n\t\t\texportCount: 0,\n\t\t\tsuccess: false,\n\t\t\tscope: \"selection\",\n\t\t\terrorReason: reason,\n\t\t})\n\t}\n\n\tprivate metricsMap = new Map<string, Partial<ImageExporterMetric>>()\n\n\tprivate createErrorReason({ sizeKb, hasSavedToDisk }: Partial<ImageExporterMetric>) {\n\t\tif (!hasSavedToDisk) {\n\t\t\treturn \"Export success, but no file was written\"\n\t\t}\n\n\t\tif (sizeKb === 0) {\n\t\t\treturn \"Export success, but the file is 0kb\"\n\t\t}\n\n\t\treturn\n\t}\n\n\tprivate createId({ nodeId, pixelRatio }: { readonly nodeId: string; readonly pixelRatio: number }) {\n\t\treturn nodeId + \"-\" + pixelRatio\n\t}\n\n\tmergeElectronMetrics(metrics: readonly ElectronWebRendering.Metric[]) {\n\t\tfor (const metric of metrics) {\n\t\t\tconst id = this.createId({ nodeId: metric.nodeId, pixelRatio: metric.pixelRatio })\n\t\t\tconst previousMetric = this.metricsMap.get(id)\n\n\t\t\tif (!previousMetric) continue\n\n\t\t\tthis.metricsMap.set(id, {\n\t\t\t\t...previousMetric,\n\t\t\t\tsizeKb: metric.kb,\n\t\t\t\tsuccess: metric.hasSavedToDisk,\n\t\t\t})\n\t\t}\n\t}\n\n\tadd(options: ImageSnapshotOptions, metrics: Partial<ImageExporterMetric>) {\n\t\tconst id = this.createId({ nodeId: options.nodeId, pixelRatio: options?.pixelRatio ?? 1 })\n\t\tconst previousMetrics = this.metricsMap.get(id) ?? {}\n\n\t\tthis.metricsMap.set(id, {\n\t\t\t...previousMetrics,\n\t\t\t...metrics,\n\t\t})\n\t}\n\n\ttrack() {\n\t\tfor (const [_, metric] of this.metricsMap) {\n\t\t\tconst errorReason = this.createErrorReason({\n\t\t\t\tsizeKb: metric.sizeKb ?? 0,\n\t\t\t\thasSavedToDisk: metric.hasSavedToDisk ?? false,\n\t\t\t})\n\n\t\t\tFramerEvents.triggerExportBitmapEvent({\n\t\t\t\tdurationMs: metric.durationMs,\n\t\t\t\tformat: metric.format,\n\t\t\t\texportCount: metric.exportCount,\n\t\t\t\tsuccess: metric.success,\n\t\t\t\tscope: metric.scope,\n\t\t\t\tsizeKb: metric.sizeKb,\n\t\t\t\terrorReason: metric.errorReason ?? errorReason,\n\t\t\t})\n\t\t}\n\n\t\tthis.metricsMap.clear()\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { WithExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { exportName } from \"utils/exportCommon.tsx\"\nimport type { ProgressOptions } from \"web/lib/toaster.ts\"\nimport { toast, toastProgress } from \"web/lib/toaster.ts\"\n\ntype ExportNode = CanvasNode & WithExport\n\nexport function showUnsupportedFiles() {\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"warning\",\n\t\tprimaryText: \"This file format\",\n\t\tsecondaryText: \"is unsupported.\",\n\t\tkey: \"image-export-unsupported\",\n\t\ticon: \"warning\",\n\t\tduration: 2000,\n\t})\n}\n\nexport function showServiceUnavailable() {\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"error\",\n\t\tprimaryText: \"Please update\",\n\t\tsecondaryText: \"to the latest version.\",\n\t\tkey: \"image-export-not-available\",\n\t\ticon: \"error\",\n\t\tduration: 2000,\n\t})\n}\n\nexport async function process(componentLoader: AnyComponentLoader, nodes: ExportNode[], callback: () => Promise<void>) {\n\tnodes = nodes.filter(node => {\n\t\tfor (const option of node.exportOptions) {\n\t\t\tif (option.enabled) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t})\n\n\tconst amount = nodes.length\n\tconst nodeToExport = nodes[0]\n\tassert(nodeToExport, \"Node must be defined\")\n\tconst nodeName = exportName(componentLoader, nodeToExport)\n\n\tconst extensions = new Set()\n\tfor (const node of nodes) {\n\t\tfor (const option of node.exportOptions) {\n\t\t\tif (option.enabled) {\n\t\t\t\textensions.add(option.type)\n\t\t\t}\n\t\t}\n\t}\n\n\tconst ext = Array.from(extensions).join(\", \")\n\n\tconst options: ProgressOptions = {\n\t\tkey: \"export-nodes-progress\",\n\n\t\tprogress: {\n\t\t\tvariant: \"progress\",\n\t\t\t...(amount === 1\n\t\t\t\t? {\n\t\t\t\t\t\tprimaryText: nodeName,\n\t\t\t\t\t\tsecondaryText: `is exporting as ${ext}\u2026`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tprimaryText: `${amount} layers`,\n\t\t\t\t\t\tsecondaryText: `are exporting as ${ext}\u2026`,\n\t\t\t\t\t}),\n\t\t},\n\n\t\tsuccess: {\n\t\t\tvariant: \"success\",\n\t\t\t...(amount === 1\n\t\t\t\t? {\n\t\t\t\t\t\tprimaryText: nodeName,\n\t\t\t\t\t\tsecondaryText: \"has been exported.\",\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tprimaryText: `${amount} layers`,\n\t\t\t\t\t\tsecondaryText: \"have been exported.\",\n\t\t\t\t\t}),\n\t\t},\n\n\t\terror: {\n\t\t\tvariant: \"error\",\n\t\t\t...(amount === 1\n\t\t\t\t? {\n\t\t\t\t\t\tprimaryText: \"Unable to export\",\n\t\t\t\t\t\tsecondaryText: `${nodeName}.`,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tprimaryText: \"Unable to export\",\n\t\t\t\t\t\tsecondaryText: \"your layers.\",\n\t\t\t\t\t}),\n\t\t},\n\t}\n\n\tawait toastProgress(options, callback)\n}\n", "import { assert, assertNever, getLogger, isElectron, isWindows } from \"@framerjs/shared\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport {\n\ttype WindowClipboardOptions,\n\tWindowSandbox,\n\ttype WindowSnapshotOptions,\n} from \"canvas-sandbox-renderer/WindowSandbox.ts\"\nimport { sandboxConfig } from \"canvas-sandbox-renderer/sandboxConfig.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { ExportOptions } from \"document/models/CanvasTree/index.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { WithExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { RenderTarget } from \"library/render/types/RenderEnvironment.ts\"\nimport { exportName, sanitizedFilename } from \"utils/exportCommon.tsx\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ExportMetrics } from \"./ExportMetrics.tsx\"\nimport type { NodeSnapshotOptions } from \"./NodeRenderer.ts\"\nimport { NodeRenderer } from \"./NodeRenderer.ts\"\nimport * as exporterToast from \"./exporterToast.ts\"\n\nconst log = getLogger(\"export\")\n\nconst pathSeparator = isWindows() ? \"\\\\\" : \"/\"\n\ntype ImageSnapshotOptions = NodeSnapshotOptions & Omit<WindowSnapshotOptions, \"rect\" | \"ref\">\ntype ImageClipboardOptions = Omit<WindowClipboardOptions, \"rect\" | \"ref\" | \"svgString\">\ntype ImageDataOptions = Omit<WindowClipboardOptions, \"rect\" | \"ref\" | \"svgString\">\n\ntype ExportNode = CanvasNode & WithExport\n\n// TODO: Should be removed once all supported files have been implemented\nconst unsupportedFiles = new Set()\nunsupportedFiles.add(\"html\")\nunsupportedFiles.add(\"webp\")\n\nexport class ImageExporter extends NodeRenderer<WindowSandbox> {\n\t/**\n\t * Returns whether `ImageExporter.whenAvailable()` is expected to return an exporter.\n\t */\n\tstatic isAvailable = isElectron()\n\n\t/**\n\t * Returns the shared exporter, if the needed functionality is available.\n\t * @param toastIfNot If set to true, show an instructional toast if export is not available.\n\t */\n\tstatic async whenAvailable(\n\t\t{ toastIfNot }: { toastIfNot: boolean } = { toastIfNot: false },\n\t\tengine: VekterEngine,\n\t): Promise<ImageExporter | undefined> {\n\t\tconst isWindowSandboxAvailable = await WindowSandbox.isAvailable()\n\n\t\tif (this.isAvailable && isWindowSandboxAvailable) {\n\t\t\tthis.shared = this.shared ?? new ImageExporter(engine)\n\t\t\treturn this.shared\n\t\t}\n\n\t\tif (toastIfNot) {\n\t\t\tExportMetrics.trackError(\"ServiceChannel miss-match error. Unable to establish a connection.\")\n\t\t\texporterToast.showServiceUnavailable()\n\t\t}\n\t}\n\n\tstatic async exportNodes(nodes: ExportNode[], engine: VekterEngine) {\n\t\tconst exporter = await ImageExporter.whenAvailable({ toastIfNot: true }, engine)\n\t\tassert(exporter, \"Expected image exporter to be available\")\n\n\t\tconst hasUnsupportedFile = exporter.hasUnsupportedFiles(nodes)\n\t\tif (hasUnsupportedFile) {\n\t\t\treturn exporterToast.showUnsupportedFiles()\n\t\t}\n\n\t\tconst response = await exporter.openSaveDialog(nodes)\n\t\tconst filePath = response?.filePath\n\n\t\tif (filePath) {\n\t\t\tawait exporterToast.process(engine.componentLoader, nodes, async () => {\n\t\t\t\tawait exporter.exportNodes(nodes, filePath)\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate static shared?: ImageExporter\n\tprivate constructor(engine: VekterEngine) {\n\t\tsuper(\n\t\t\tnew WindowSandbox(sandboxConfig.canvas, RenderTarget.export, {\n\t\t\t\twidth: 100,\n\t\t\t\theight: 100,\n\t\t\t\toffscreen: !employeesOnlySettings.isOn(\"sandboxExportDebugging\"),\n\t\t\t}),\n\t\t\tengine,\n\t\t)\n\t}\n\n\t// A class that abstracts metric collection and tracking\n\tprivate exportMetrics = new ExportMetrics()\n\n\t// TODO: Should be removed once all supported files have been implemented\n\tprivate hasUnsupportedFiles(nodes: ExportNode[]) {\n\t\tfor (const node of nodes) {\n\t\t\tfor (const option of node.exportOptions) {\n\t\t\t\tif (unsupportedFiles.has(option.type) && option.enabled) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\tprivate async exportNodes(nodes: ExportNode[], dialogFilePath: string) {\n\t\t// Collect snapshots options from the nodes' export settings\n\t\tconst snapshots: ImageSnapshotOptions[] = []\n\t\tconst count = this.getCount(nodes)\n\n\t\tfor (const node of nodes) {\n\t\t\tfor (const option of node.exportOptions) {\n\t\t\t\tif (!option.enabled) continue\n\n\t\t\t\tconst extension = option.type\n\t\t\t\tconst namePath = this.createNamePath(node, option)\n\n\t\t\t\t// Snapshot options\n\t\t\t\tconst nodeId = node.id\n\t\t\t\tconst pixelRatio = option.scale\n\t\t\t\tconst pathname = count === 1 ? this.verifyNamePath(namePath, dialogFilePath) : namePath\n\n\t\t\t\tswitch (extension) {\n\t\t\t\t\tcase \"png\":\n\t\t\t\t\t\tsnapshots.push({\n\t\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\t\tpixelRatio,\n\t\t\t\t\t\t\ttype: \"image/png\",\n\t\t\t\t\t\t\tpathname,\n\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\tdialogFilePath,\n\t\t\t\t\t\t\tp3: this.engine.stores.persistedUserDefaults.p3,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\n\t\t\t\t\tcase \"jpg\":\n\t\t\t\t\t\tsnapshots.push({\n\t\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\t\tpixelRatio,\n\t\t\t\t\t\t\ttype: \"image/jpeg\",\n\t\t\t\t\t\t\tpathname,\n\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\tdialogFilePath,\n\t\t\t\t\t\t\tp3: this.engine.stores.persistedUserDefaults.p3,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\n\t\t\t\t\tcase \"svg\":\n\t\t\t\t\t\tsnapshots.push({\n\t\t\t\t\t\t\tnodeId,\n\t\t\t\t\t\t\tpixelRatio,\n\t\t\t\t\t\t\ttype: \"image/svg+xml\",\n\t\t\t\t\t\t\tpathname,\n\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\tdialogFilePath,\n\t\t\t\t\t\t\tp3: this.engine.stores.persistedUserDefaults.p3,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(extension)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet snapshotError: unknown\n\n\t\tfor (const snapshot of snapshots) {\n\t\t\tconst initTime = performance.now()\n\t\t\tlog.debug(\"snapshotting export\", snapshot)\n\n\t\t\ttry {\n\t\t\t\tawait this.writeToDisk(snapshot)\n\n\t\t\t\tthis.exportMetrics.add(snapshot, {\n\t\t\t\t\tdurationMs: Math.floor(performance.now() - initTime),\n\t\t\t\t\terrorReason: null,\n\t\t\t\t\tformat: snapshot.type,\n\t\t\t\t\texportCount: count,\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tscope: \"selection\",\n\t\t\t\t})\n\t\t\t} catch (error) {\n\t\t\t\tthis.exportMetrics.add(snapshot, {\n\t\t\t\t\tdurationMs: Math.floor(performance.now() - initTime),\n\t\t\t\t\terrorReason: \"Exporting snapshoting failed\",\n\t\t\t\t\tformat: snapshot.type,\n\t\t\t\t\texportCount: count,\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tscope: \"selection\",\n\t\t\t\t})\n\n\t\t\t\t// Re-throw the error later so we can still track the error\n\t\t\t\tsnapshotError = error\n\t\t\t}\n\t\t}\n\n\t\t// Track collected snapshot data in FramerEvents\n\t\tconst { metrics } = await this.renderer.sandbox.collectMetrics()\n\n\t\tthis.exportMetrics.mergeElectronMetrics(metrics)\n\t\tthis.exportMetrics.track()\n\n\t\tif (snapshotError) throw snapshotError\n\t}\n\n\tprivate createNamePath(node: ExportNode, options: ExportOptions) {\n\t\t// Name/path for the export\n\t\tconst name = sanitizedFilename(exportName(this.engine.componentLoader, node)) || \"export\"\n\t\tconst slash = options.nameExtension.lastIndexOf(\"/\")\n\t\tconst prefix = slash >= 0 ? options.nameExtension.slice(0, slash + 1) : \"\"\n\t\tconst nameSuffix = options.nameExtension.slice(slash + 1)\n\t\tconst extension = options.type\n\n\t\treturn prefix + name + nameSuffix + \".\" + extension\n\t}\n\n\tprivate getCount(nodes: ExportNode[]) {\n\t\tlet count = 0\n\n\t\tfor (const node of nodes) {\n\t\t\tfor (const option of node.exportOptions) {\n\t\t\t\tif (option.enabled) count++\n\t\t\t}\n\t\t}\n\n\t\treturn count\n\t}\n\n\tprivate async openSaveDialog(nodes: ExportNode[]) {\n\t\tfor (const node of nodes) {\n\t\t\tfor (const option of node.exportOptions) {\n\t\t\t\tif (option.enabled) {\n\t\t\t\t\treturn this.renderer.sandbox.openSaveDialog({\n\t\t\t\t\t\tcount: this.getCount(nodes),\n\t\t\t\t\t\tpathname: this.createNamePath(node, option),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Compares the name of the node namePath against the name provided in\n\t * Electron's SaveDialog. This is only necessary for a single asset export\n\t * where renaming is necessary. We need this comparison as Electron's\n\t * save dialog cant handle names with slashes. E.g icon/design/plus.png\n\t */\n\tprivate verifyNamePath(namePath: string, dialogFilePath: string) {\n\t\tconst namePathExtensions = namePath.split(\"/\")\n\t\tconst namePathFileName = namePathExtensions[namePathExtensions.length - 1]\n\t\tassert(isString(namePathFileName), `Filename must be defined: ${namePathExtensions}`)\n\n\t\t// On Windows, the dialogFilePath is split by backslashes and on other platforms, the dialogFilePath\n\t\t// is split by forward slashes.\n\t\tconst dirExtensions = dialogFilePath.split(pathSeparator)\n\t\tconst dialogFileName = dirExtensions[dirExtensions.length - 1]\n\t\tassert(isString(dialogFileName), `Filename must be defined: ${dirExtensions}`)\n\t\tconst hasNotTheSameFileName = namePathFileName.toLowerCase() !== dialogFileName.toLowerCase()\n\n\t\tif (hasNotTheSameFileName) {\n\t\t\t// Don't forget that there might be a folder name in the namePath\n\t\t\tconst pathname = namePathExtensions.slice(0, -1).join(pathSeparator)\n\t\t\tconst namePathWithoutFileName = pathname ? pathname + pathSeparator + dialogFileName : dialogFileName\n\n\t\t\treturn namePathWithoutFileName\n\t\t}\n\n\t\treturn namePath\n\t}\n\n\tasync writeToDisk(options: ImageSnapshotOptions): Promise<void> {\n\t\tconst rect = await this.prepareNodeSnapshot(options)\n\t\t// Track node rect dimensions\n\t\tthis.exportMetrics.add(options, {\n\t\t\tnodeWidth: rect.width,\n\t\t\tnodeHeight: rect.height,\n\t\t})\n\n\t\tif (options.type === \"image/svg+xml\") {\n\t\t\tconst svgString = this.renderToSVG(options)\n\t\t\treturn this.renderer.sandbox.writeToDisk({ ...options, rect, svgString })\n\t\t}\n\n\t\treturn this.renderer.sandbox.writeToDisk({ ...options, rect })\n\t}\n\n\tasync writeToClipboard(options: ImageClipboardOptions): Promise<void> {\n\t\tconst rect = await this.prepareNodeSnapshot(options)\n\t\t// Track node rect dimensions\n\t\tthis.exportMetrics.add(options, {\n\t\t\tnodeWidth: rect.width,\n\t\t\tnodeHeight: rect.height,\n\t\t})\n\n\t\tif (options.type === \"image/svg+xml\") {\n\t\t\tconst svgString = this.renderToSVG({ nodeId: options.nodeId })\n\t\t\treturn this.renderer.sandbox.writeToClipboard({ ...options, rect, svgString })\n\t\t}\n\n\t\treturn this.renderer.sandbox.writeToClipboard({ ...options, rect })\n\t}\n\n\tasync getImageData(options: ImageDataOptions): Promise<string> {\n\t\tconst rect = await this.prepareNodeSnapshot(options)\n\n\t\tif (options.type === \"image/svg+xml\") {\n\t\t\t// TODO does this makes sense?\n\t\t\tconst svgString = this.renderToSVG({ nodeId: options.nodeId })\n\t\t\treturn svgString\n\t\t}\n\n\t\treturn this.renderer.sandbox.getImageData({ ...options, rect })\n\t}\n}\n", "import type { ScrollOffsetRestorationCache } from \"@framerjs/fresco\"\nimport { InputHashContext, ReadOnlyContext, ScrollWithOffsetRestoration } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EmployeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { Experiment, experiments } from \"app/experiments.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport { PolygonSidesPanel } from \"document/components/chrome/properties/panels/PolygonSidesPanel.tsx\"\nimport { ShapeSizeToFitContentPanel } from \"document/components/chrome/properties/panels/ShapeSizeToFitContentPanel.tsx\"\nimport { StarSpikesPanel } from \"document/components/chrome/properties/panels/StarSpikesPanel.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\tisFound,\n\tisFoundAndNotMixed,\n\tisFoundAndNotUndefined,\n\tisNotFound,\n} from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isSupportedEffectScopeType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { SupportedVariablePropertiesProvider } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport { type Properties, reduceProperties } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport { scopeTypeSupportsA11yFeatures } from \"document/models/CanvasTree/traits/utils/scopeTypeSupportsA11yFeatures.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ImageExporter } from \"export/ImageExporter.ts\"\nimport type { EditorState } from \"prosemirror-state\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { LayoutTemplatePropsPanel } from \"./LayoutTemplatePropsPanel.tsx\"\nimport { PathProperties } from \"./PathProperties.tsx\"\nimport { AccessibilityPanel } from \"./panels/AccessibilityPanel.tsx\"\nimport { AlignmentHeader } from \"./panels/AlignmentHeader.tsx\"\nimport { BackdropPanel } from \"./panels/BackdropPanel.tsx\"\nimport { BorderPanel } from \"./panels/BorderPanel.tsx\"\nimport { BreakpointEffectsPanel } from \"./panels/BreakpointEffectsPanel.tsx\"\nimport { CodeComponentControlPropsPanel } from \"./panels/CodeComponentControlPropsPanel.tsx\"\nimport { CodeExportPanel } from \"./panels/CodeExportPanelContainer.tsx\"\nimport { CodeOverridesPanel } from \"./panels/CodeOverridesPanel.tsx\"\nimport { CornerPanel } from \"./panels/CornerPanel.tsx\"\nimport { CursorPanel } from \"./panels/CursorPanel.tsx\"\nimport { CustomizationsPanel } from \"./panels/CustomizationsPanel.tsx\"\nimport { DOMLayoutDebugPanel } from \"./panels/DOMLayoutDebugPanel.tsx\"\nimport { DataLoaderVariantsPanel } from \"./panels/DataLoaderVariantsPanel.tsx\"\nimport { DataRepeaterPanel } from \"./panels/DataRepeaterPanel.tsx\"\nimport { EmbedPresetPanel } from \"./panels/EmbedPresetPanel.tsx\"\nimport { EventsPanel } from \"./panels/EventsPanel.tsx\"\nimport { ExportPanel } from \"./panels/ExportPanel.tsx\"\nimport { FillPanel } from \"./panels/FillPanel.tsx\"\nimport { FiltersPanel } from \"./panels/FiltersPanel.tsx\"\nimport { FloatingPositionPanel } from \"./panels/FloatingPositionPanel.tsx\"\nimport { FormContainerPanel } from \"./panels/FormContainerPanel.tsx\"\nimport { FormInputPanel } from \"./panels/FormInputPanel.tsx\"\nimport { FormInputStyleRows } from \"./panels/FormInputStyleRows.tsx\"\nimport { FormVariantsPanel } from \"./panels/FormVariantsPanel.tsx\"\nimport { GridItemPositionPanel } from \"./panels/GridItemPositionPanel.tsx\"\nimport { GridItemSpanRows } from \"./panels/GridItemSpanRows.tsx\"\nimport { KitsCustomizationsPanel } from \"./panels/KitsCustomizationsPanel.tsx\"\nimport { LinkPanel } from \"./panels/LinkPanel.tsx\"\nimport { OverflowPanel } from \"./panels/OverflowPanel.tsx\"\nimport { OverlayGridPanel } from \"./panels/OverlayGridPanel.tsx\"\nimport { OverlaysPanel } from \"./panels/OverlaysPanel.tsx\"\nimport { OverridePanel } from \"./panels/OverridePanel.tsx\"\nimport { OverscrollBehaviorPanel } from \"./panels/OverscrollBehaviorPanel.tsx\"\nimport { PaddingRow } from \"./panels/PaddingRow.tsx\"\nimport { Panel } from \"./panels/Panel.tsx\"\nimport { PositionPanel } from \"./panels/PositionPanel.tsx\"\nimport { PositionPanelHeader, PositionStickyRows } from \"./panels/PositionStickyRows.tsx\"\nimport { PresetAndOrientationPanel } from \"./panels/PresetAndOrientationPanel.tsx\"\nimport { RepeatPanel } from \"./panels/RepeatPanel.tsx\"\nimport { ResizeToFitContentPanel } from \"./panels/ResizeToFitContentPanel.tsx\"\nimport { ScrollTargetPanel } from \"./panels/ScrollTargetPanel.tsx\"\nimport { SelectionPropertiesPanel } from \"./panels/SelectionPropertiesPanel.tsx\"\nimport { ShaderControlPropsPanel } from \"./panels/ShaderControlPropsPanel.tsx\"\nimport { ShadowPanel } from \"./panels/ShadowPanel.tsx\"\nimport { ShapeBooleanPanel } from \"./panels/ShapeBooleanPanel.tsx\"\nimport { SizePanel } from \"./panels/SizePanel.tsx\"\nimport { StackAndGridLayoutPanel } from \"./panels/StackAndGridLayoutPanel.tsx\"\nimport { LayoutTemplateBreakpointLayoutPanel } from \"./panels/StackLayoutRows.tsx\"\nimport { StrokePanel } from \"./panels/StrokePanel.tsx\"\nimport { StyleHeader } from \"./panels/StyleHeader.tsx\"\nimport { TextPanel } from \"./panels/TextPanel.tsx\"\nimport { TransformsPanel } from \"./panels/TransformsPanel.tsx\"\nimport { TriggerActionsPanel } from \"./panels/TriggerActionsPanel.tsx\"\nimport { TypographyPanel } from \"./panels/TypographyPanel.tsx\"\nimport { BlendModeRow } from \"./rows/BlendModeRow.tsx\"\nimport { DraggableRow } from \"./rows/DraggableRow.tsx\"\nimport { DragEffectRow } from \"./rows/EffectRows/DragEffectRow.tsx\"\nimport { EffectsHeader } from \"./rows/EffectRows/EffectsHeader.tsx\"\nimport { FlowEffectRow } from \"./rows/EffectRows/FlowEffectRow.tsx\"\nimport { HoverEffectRow, PressEffectRow } from \"./rows/EffectRows/GestureEffectRow.tsx\"\nimport { LightboxEffectRow } from \"./rows/EffectRows/LightboxEffectRow.tsx\"\nimport { LoopEffectRow } from \"./rows/EffectRows/LoopEffectRow.tsx\"\nimport { StrokeEffectRow } from \"./rows/EffectRows/StrokeEffectRow.tsx\"\nimport { StyleAppearEffectRow } from \"./rows/EffectRows/StyleAppearEffectRow.tsx\"\nimport { StyleTransformEffectRow } from \"./rows/EffectRows/StyleTransformEffectRow.tsx\"\nimport { TextEffectRow } from \"./rows/EffectRows/TextEffectRow.tsx\"\nimport { TickerEffectRow } from \"./rows/EffectRows/TickerEffectRow.tsx\"\nimport { VariantAppearEffectRow } from \"./rows/EffectRows/VariantAppearEffectRow.tsx\"\nimport { FillOpacityRow } from \"./rows/FillOpacityRow.tsx\"\nimport { FormInputFocusedStyleRow } from \"./rows/FormInputFocusedStyleRow.tsx\"\nimport { FormBooleanCheckedEffectRow } from \"./rows/FormInputRows/FormBooleanCheckedEffectRow.tsx\"\nimport { InputIconRow } from \"./rows/FormInputRows/InputIconRow.tsx\"\nimport { InputInvalidTextColorRow } from \"./rows/FormInputRows/InputInvalidTextColorRow.tsx\"\nimport { InputPlaceholderColorRow } from \"./rows/FormInputRows/InputPlaceholderColorRow.tsx\"\nimport { ImageRenderingRow } from \"./rows/ImageRenderingRow.tsx\"\nimport { MasksRow } from \"./rows/MasksRow.tsx\"\nimport { OpacityRow } from \"./rows/OpacityRow.tsx\"\nimport { ComputedValuesSupportedProvider } from \"./rows/PanelRow.tsx\"\nimport { ParallaxEffectRow } from \"./rows/ParallaxRow.tsx\"\nimport { PointerEventsRow } from \"./rows/PointerEventsRow.tsx\"\nimport { PositionTypeRow } from \"./rows/PositionTypeRow.tsx\"\nimport { ScrollbarsRow } from \"./rows/ScrollbarsRow.tsx\"\nimport { ConstraintsPanelHeader, SizeConstraintsRow } from \"./rows/SizeConstraintsRow.tsx\"\nimport { TapHighlightRow } from \"./rows/TapHighlightRow.tsx\"\nimport { TextSelectionRow } from \"./rows/TextSelectionRow.tsx\"\nimport { Rotation2DRow } from \"./rows/TransformRows/RotationRow.tsx\"\nimport { TransitionRow } from \"./rows/TransitionRow.tsx\"\nimport { UserSelectRow } from \"./rows/UserSelectRow.tsx\"\nimport { ViewTransitionNoneRow } from \"./rows/ViewTransitionNoneRow.tsx\"\nimport { VisibilityRow } from \"./rows/VisibilityRow.tsx\"\nimport { ZIndexRow } from \"./rows/ZIndexRow.tsx\"\nimport { VariantOverrideContextProvider } from \"./utils/VariantOverrideContext.tsx\"\nimport { getResolvedRotationValue } from \"./utils/getResolvedVariableValues.ts\"\n\n// This cache is defined outside of the component to make it persist across mounts.\nconst scrollOffsetRestorationCache: ScrollOffsetRestorationCache = new Map()\n\ninterface Props {\n\tnodes: CanvasNode[]\n\tselection: NodeID[]\n\t/**\n\t * Used to re-render PropertiesPanel when an external module component\n\t * is inserted on the canvas and the module is loaded\n\t */\n\tselectedLoadedModulesComponentsHash: string\n\tcomponentHash: string\n\ttool: Tools\n\tproseMirrorState: EditorState | null\n\treadOnly: boolean\n\tdisplayGrids: boolean\n\tscopeType: ScopeType\n\tscopeId: NodeID\n\t/** The module identifier of the layout template applied on the current scope */\n\tactiveLayoutTemplateId: LocalModuleExportIdentifierString | undefined | null\n\t/** Trigger rerender when layout template props has been updated on the active scope */\n\tactiveLayoutTemplateUpdate: number\n\tallNodesShareVariableContext: boolean\n\t/** Used only to force rendering when layout measurements are updated */\n\tdomLayoutUpdate: number\n\talignToParent: boolean\n\tisWireframerKitPage: boolean\n}\n\nexport class NodeProperties extends React.PureComponent<Props> {\n\trenderEditorOverlayProperties(properties: Properties) {\n\t\tconst { nodes, alignToParent, readOnly, scopeType } = this.props\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AlignmentHeader nodes={nodes} alignToParent={alignToParent} enabled={false} />\n\t\t\t\t{properties.onlyNodesWithTriggerActions && (\n\t\t\t\t\t<TriggerActionsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tselectedEventKey={properties.overlayTriggerEventKey}\n\t\t\t\t\t\ttriggerActions={properties.triggerActions}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<BackdropPanel\n\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\tbackdropFillEnabled={properties.backdropFillEnabled}\n\t\t\t\t\tbackdropFill={properties.backdropFill}\n\t\t\t\t\tbackdropEnterTransition={properties.backdropEnterTransition}\n\t\t\t\t\tbackdropExitTransition={properties.backdropExitTransition}\n\t\t\t\t\tbackdropTransitionLocked={properties.backdropTransitionLocked}\n\t\t\t\t\tbackdropDismissible={properties.backdropDismissible}\n\t\t\t\t\tblockDocumentScrolling={properties.blockDocumentScrolling}\n\t\t\t\t\tzIndex={properties.zIndex ?? 0}\n\t\t\t\t/>\n\t\t\t</>\n\t\t)\n\t}\n\n\tpositionPanel(properties: Properties) {\n\t\treturn (\n\t\t\t<PositionPanel\n\t\t\t\twithoutDescendantIds={properties.withoutDescendantIds}\n\t\t\t\tonlyCanvasFrameNodes={properties.onlyCanvasFrameNodes}\n\t\t\t\tconstraintsLocked={properties.constraintsLocked}\n\t\t\t\tx={properties.x}\n\t\t\t\ty={properties.y}\n\t\t\t\tright={properties.right}\n\t\t\t\tbottom={properties.bottom}\n\t\t\t\tpinTop={properties.pinTop}\n\t\t\t\tpinLeft={properties.pinLeft}\n\t\t\t\tpinRight={properties.pinRight}\n\t\t\t\tpinBottom={properties.pinBottom}\n\t\t\t\tcanSetLeft={properties.canSetLeft}\n\t\t\t\tcanSetRight={properties.canSetRight}\n\t\t\t\tcanSetTop={properties.canSetTop}\n\t\t\t\tcanSetBottom={properties.canSetBottom}\n\t\t\t\tanyShapeNode={properties.anyShapeNode}\n\t\t\t\tcanSetVerticalPins={properties.canSetVerticalPins}\n\t\t\t\tcanSetHorizontalPins={properties.canSetHorizontalPins}\n\t\t\t/>\n\t\t)\n\t}\n\n\tpositionTypeRow(properties: Properties) {\n\t\tconst { scopeType } = this.props\n\t\tconst title = properties.onlyShapeAndGraphicNodes ? (isNotFound(properties.x) ? \"Position\" : \"\") : undefined\n\t\tif (!properties.onlyNodesWithPositionType) return null\n\n\t\treturn (\n\t\t\t<PositionTypeRow\n\t\t\t\ttitle={title}\n\t\t\t\tnodeIds={properties.withoutDescendantIds}\n\t\t\t\tpositionTypes={properties.positionTypes}\n\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\tonlyNodesInsideStackOrGrid={properties.onlyNodesInsideStackOrGrid}\n\t\t\t\tonlyNodesWithPositionFixed={!!properties.onlyNodesWithPositionFixed}\n\t\t\t\tscopeType={scopeType}\n\t\t\t/>\n\t\t)\n\t}\n\n\tsizePanel(properties: Properties) {\n\t\tconst { selection, scopeType } = this.props\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<SizePanel\n\t\t\t\t\twithoutDescendantIds={properties.withoutDescendantIds}\n\t\t\t\t\twidthTypes={properties.widthTypes}\n\t\t\t\t\theightTypes={properties.heightTypes}\n\t\t\t\t\tcurrentVariantWidthType={properties.currentVariantWidthType}\n\t\t\t\t\tcurrentVariantHeightType={properties.currentVariantHeightType}\n\t\t\t\t\twidth={properties.width}\n\t\t\t\t\theight={properties.height}\n\t\t\t\t\tonlyTextNodes={properties.onlyTextNodes}\n\t\t\t\t\tonlyRichTextNodes={properties.onlyRichTextNodes}\n\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\taspectRatioEnabled={properties.aspectRatioEnabled}\n\t\t\t\t\taspectRatioLocked={properties.aspectRatioLocked}\n\t\t\t\t\tonlyShapeAndGraphicNodes={properties.onlyShapeAndGraphicNodes}\n\t\t\t\t\tonlyCodeComponentNodes={properties.onlyCodeComponentNodes}\n\t\t\t\t\tonlyShaderNodes={properties.onlyShaderNodes}\n\t\t\t\t\tcanSetWidthToPercentage={properties.canSetWidthToPercentage}\n\t\t\t\t\tcanSetHeightToPercentage={properties.canSetHeightToPercentage}\n\t\t\t\t\tcanSetWidthToFillParent={properties.canSetWidthToFillParent}\n\t\t\t\t\tcanSetHeightToFillParent={properties.canSetHeightToFillParent}\n\t\t\t\t\tcanSetWidthToAuto={properties.canSetWidthToAuto}\n\t\t\t\t\tcanSetHeightToAuto={properties.canSetHeightToAuto}\n\t\t\t\t\tcanSetWidthToFixed={properties.canSetWidthToFixed}\n\t\t\t\t\tcanSetHeightToFixed={properties.canSetHeightToFixed}\n\t\t\t\t\tcanSetWidthToViewport={properties.canSetWidthToViewport}\n\t\t\t\t\tcanSetHeightToViewport={properties.canSetHeightToViewport}\n\t\t\t\t\tcanSetWidthToFitImage={properties.canSetWidthToFitImage}\n\t\t\t\t\tcanSetHeightToFitImage={properties.canSetHeightToFitImage}\n\t\t\t\t\tcanSetSizeToDefault={properties.canSetSizeToDefault}\n\t\t\t\t\tanyShapeNode={properties.anyShapeNode}\n\t\t\t\t\tanyAutoSizingNode={properties.anyAutoSizingNode}\n\t\t\t\t\tallNodeIds={properties.allNodeIds}\n\t\t\t\t\tfontSizeUnits={properties.textProperties?.fontSizeUnits}\n\t\t\t\t\tselection={selection}\n\t\t\t\t/>\n\t\t\t\t{properties.onlyNodesWithSizeConstraints && (\n\t\t\t\t\t<SizeConstraintsRow\n\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tonlyGroundNodeDescendants={properties.onlyGroundNodeDescendants}\n\t\t\t\t\t\tmaxWidth={properties.maxWidth}\n\t\t\t\t\t\tmaxHeight={properties.maxHeight}\n\t\t\t\t\t\tminHeight={properties.minHeight}\n\t\t\t\t\t\tminWidth={properties.minWidth}\n\t\t\t\t\t\tmaxWidthUnits={properties.maxWidthUnits}\n\t\t\t\t\t\tmaxHeightUnits={properties.maxHeightUnits}\n\t\t\t\t\t\tminHeightUnits={properties.minHeightUnits}\n\t\t\t\t\t\tminWidthUnits={properties.minWidthUnits}\n\t\t\t\t\t\twidthTypes={properties.widthTypes}\n\t\t\t\t\t\theightTypes={properties.heightTypes}\n\t\t\t\t\t\tanyFormInputNodes={properties.anyFormInputNodes}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n\n\trenderEditorDesignProperties(properties: Properties) {\n\t\tconst {\n\t\t\tnodes,\n\t\t\tselection,\n\t\t\tdisplayGrids,\n\t\t\tscopeType,\n\t\t\tscopeId,\n\t\t\tactiveLayoutTemplateId,\n\t\t\ttool,\n\t\t\talignToParent,\n\t\t\treadOnly,\n\t\t\tisWireframerKitPage,\n\t\t} = this.props\n\n\t\tconst rotationValue = getResolvedRotationValue(properties.rotation)\n\t\tconst onlyNodesWithPositionSticky =\n\t\t\tproperties.onlyNodesInsideStackOrGrid &&\n\t\t\tproperties.positionTypes.size === 1 &&\n\t\t\tproperties.positionTypes.has(\"sticky\")\n\t\tconst showRotation2DRow =\n\t\t\tproperties.onlyNodesWithRotation && (!properties.anyNodesWithTransforms || properties.onlyGroundNodes)\n\t\tconst gridBentoFitEnabled = experiments.isOn(\"gridBentoFit\")\n\t\tconst canUpdateVerticalAlignment =\n\t\t\tproperties.gridItemFillCellHeight !== true ||\n\t\t\t(!gridBentoFitEnabled && properties.anyGridItemParentWithRowHeightFitContent)\n\t\tconst canUpdateHorizontalAlignment = properties.gridItemFillCellWidth !== true\n\t\tconst selectionHasPositionControls =\n\t\t\tisFound(properties.x) ||\n\t\t\t(properties.positionTypes.size === 1 && properties.positionTypes.has(\"sticky\")) ||\n\t\t\t(properties.onlyGridItemNodes && (canUpdateVerticalAlignment || canUpdateHorizontalAlignment))\n\n\t\tconst showPositionPanel =\n\t\t\t!properties.onlySlotPropertyNodes &&\n\t\t\t!properties.onlyNodesWithFloatingPosition &&\n\t\t\t(onlyNodesWithPositionSticky || selectionHasPositionControls || properties.onlyNodesWithPositionType)\n\t\tconst panelTitle = framePanelTitle(properties, this.props)\n\n\t\t// When any selected breakpoint is using a layout template, only show the typography panel when editing a layout\n\t\t// template. Otherwise, we always show for this panel for breakpoint nodes.\n\t\tconst showTypographyPanel = properties.onlyBreakpointNodes && !properties.anyBreakpointsWithLayoutTemplate\n\n\t\tconst showEffectsPanel = properties.onlyNodesWithPageEffects && isSupportedEffectScopeType(scopeType)\n\t\tconst textProperties = properties.textProperties\n\n\t\tconst showCodeOverridePanel = properties.anyBreakpointsWithLayoutTemplate\n\t\t\t? properties.codeOverrideEnabled === true\n\t\t\t: true\n\n\t\tconst kitsExperimentIsOn = experiments.isOn(\"wireframerKits\")\n\t\tconst isKitProject = projectFeatures.isOn(\"kit\")\n\t\tconst showKitsCustomizationsPanel =\n\t\t\tproperties.onlyNodesWithCustomizations && kitsExperimentIsOn && isKitProject && isWireframerKitPage\n\n\t\t// We still support the current default Wireframer kit project for backwards compatibility.\n\t\tconst isOldKitProject = properties.onlyNodesWithCustomizations && !kitsExperimentIsOn && isKitProject\n\n\t\treturn (\n\t\t\t<InputHashContext.Provider value={properties.selectionHash}>\n\t\t\t\t<AlignmentHeader nodes={nodes} alignToParent={alignToParent} enabled={!readOnly} />\n\t\t\t\t<ShapeBooleanPanel nodes={nodes} properties={properties} enabled={!readOnly} />\n\t\t\t\t{!readOnly &&\n\t\t\t\tscopeType === ScopeType.WebPage &&\n\t\t\t\t// The falsy side of the ternary ensures that the current kit project used to\n\t\t\t\t// populate wireframer's built in sections can add sections even when the scope\n\t\t\t\t// is not a kit page.\n\t\t\t\tshowKitsCustomizationsPanel ? (\n\t\t\t\t\t<KitsCustomizationsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tcustomizationsCategory={properties.customizationsCategory}\n\t\t\t\t\t\tcustomizationsRules={properties.customizationsRules}\n\t\t\t\t\t/>\n\t\t\t\t) : isOldKitProject ? (\n\t\t\t\t\t<CustomizationsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tcustomizationsSectionId={properties.customizationsSectionId}\n\t\t\t\t\t\tcustomizationsDescription={properties.customizationsDescription}\n\t\t\t\t\t\tcustomizations={properties.customizations}\n\t\t\t\t\t\tanyReplicaVariantOrReplicaVariantChild={properties.anyReplicaVariantOrReplicaVariantChild}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t\t{properties.onlyNodesWithFloatingPosition && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{properties.onlyNodesWithTriggerActions && (\n\t\t\t\t\t\t\t<TriggerActionsPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\tselectedEventKey={properties.overlayTriggerEventKey}\n\t\t\t\t\t\t\t\ttriggerActions={properties.triggerActions}\n\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<FloatingPositionPanel\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tfloatingPlacement={properties.floatingPlacement}\n\t\t\t\t\t\t\tfloatingAlignment={properties.floatingAlignment}\n\t\t\t\t\t\t\tfloatingOffsetX={properties.floatingOffsetX}\n\t\t\t\t\t\t\tfloatingOffsetY={properties.floatingOffsetY}\n\t\t\t\t\t\t\tfloatingSafeArea={properties.floatingSafeArea}\n\t\t\t\t\t\t\tfloatingCollisionDetection={properties.floatingCollisionDetection}\n\t\t\t\t\t\t\tfloatingCollisionPadding={properties.floatingCollisionPadding}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t<EventsPanel\n\t\t\t\t\tnodes={nodes}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tproperties={properties}\n\t\t\t\t\tselection={selection}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t/>\n\t\t\t\t{properties.onlyNodesWithLink &&\n\t\t\t\t\t!properties.anyFormContainerNodes &&\n\t\t\t\t\t!properties.onlyBreakpointNodes &&\n\t\t\t\t\tscopeType !== ScopeType.CanvasPage &&\n\t\t\t\t\tscopeType !== ScopeType.DesignPage && (\n\t\t\t\t\t\t<LinkPanel\n\t\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tlink={properties.link}\n\t\t\t\t\t\t\tlinkOpenInNewTab={properties.linkOpenInNewTab}\n\t\t\t\t\t\t\tlinkSmoothScroll={properties.linkSmoothScroll}\n\t\t\t\t\t\t\tlinkClickTrackingId={properties.linkClickTrackingId}\n\t\t\t\t\t\t\tlinkRelValues={properties.linkRelValues}\n\t\t\t\t\t\t\tlinkPreserveParams={properties.linkPreserveParams}\n\t\t\t\t\t\t\ttrackingIdAIPrompt={properties.trackingIdAIPrompt}\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tonlyNodesWithLinkOptions={properties.onlyNodesWithLinkOptions}\n\t\t\t\t\t\t\tonlyNodesWithLinkSupportingComputedValues={properties.onlyNodesWithLinkSupportingComputedValues}\n\t\t\t\t\t\t\tanyExternalLinks={properties.anyExternalLinks}\n\t\t\t\t\t\t\tanyScrollTargets={properties.anyScrollTargets}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t{properties.onlyBreakpointNodes && scopeType === ScopeType.WebPage && (\n\t\t\t\t\t<LayoutTemplatePropsPanel\n\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\tactiveLayoutTemplateId={activeLayoutTemplateId}\n\t\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t\t\tcontrolPropsIdentifier={properties.controlPropsWithIdentifier?.identifier}\n\t\t\t\t\t\tcontrolProps={properties.controlPropsWithIdentifier?.controlProps}\n\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.onlyGroundNodes || properties.onlyShapeAndGraphicNodes ? (\n\t\t\t\t\t<Panel\n\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t<ConstraintsPanelHeader\n\t\t\t\t\t\t\t\ttitle={panelTitle}\n\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\tminHeight={properties.minHeight}\n\t\t\t\t\t\t\t\tminWidth={properties.minWidth}\n\t\t\t\t\t\t\t\tmaxHeight={properties.maxHeight}\n\t\t\t\t\t\t\t\tmaxWidth={properties.maxWidth}\n\t\t\t\t\t\t\t\tminHeightUnits={properties.minHeightUnits}\n\t\t\t\t\t\t\t\tminWidthUnits={properties.minWidthUnits}\n\t\t\t\t\t\t\t\tmaxHeightUnits={properties.maxHeightUnits}\n\t\t\t\t\t\t\t\tmaxWidthUnits={properties.maxWidthUnits}\n\t\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\t\tonlyNodesWithSizeConstraints={properties.onlyNodesWithSizeConstraints}\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\t{properties.onlyFrameNodes && scopeType === ScopeType.CanvasPage && (\n\t\t\t\t\t\t\t<PresetAndOrientationPanel\n\t\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\t\tonlyCanvasFrameNodes={properties.onlyCanvasFrameNodes}\n\t\t\t\t\t\t\t\tframePresetsInSelection={properties.framePresetsInSelection}\n\t\t\t\t\t\t\t\trotation={rotationValue}\n\t\t\t\t\t\t\t\torientation={properties.orientation}\n\t\t\t\t\t\t\t\torientationEnabled={properties.orientationEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{this.positionPanel(properties)}\n\t\t\t\t\t\t{properties.onlyShapeAndGraphicNodes && this.positionTypeRow(properties)}\n\t\t\t\t\t\t{this.sizePanel(properties)}\n\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"showDOMLayoutDebuggingPanel\">\n\t\t\t\t\t\t\t<DOMLayoutDebugPanel withoutDescendantIds={properties.withoutDescendantIds} />\n\t\t\t\t\t\t</EmployeesOnlySettings>\n\t\t\t\t\t\t{scopeType !== ScopeType.VectorSet ? (\n\t\t\t\t\t\t\t<ShapeSizeToFitContentPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tonlyShapeContainerNodes={properties.onlyShapeContainerNodes}\n\t\t\t\t\t\t\t\tsizeToFit={properties.sizeToFit}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : properties.onlyShapeContainerNodes ? (\n\t\t\t\t\t\t\t<FillPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\taltAttribute={properties.altAttribute}\n\t\t\t\t\t\t\t\tanyNodesWithFill={properties.anyNodesWithFill}\n\t\t\t\t\t\t\t\tanyNodeWithNonOptionalFill={properties.anyNodeWithNonOptionalFill}\n\t\t\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\t\t\tfillColor={properties.fillColor}\n\t\t\t\t\t\t\t\tfillEnabled={properties.fillEnabled}\n\t\t\t\t\t\t\t\tfillGradientCSS={properties.fillGradientCSS}\n\t\t\t\t\t\t\t\tfillImage={properties.fillImage}\n\t\t\t\t\t\t\t\tfillImagePositionX={properties.fillImagePositionX}\n\t\t\t\t\t\t\t\tfillImagePositionY={properties.fillImagePositionY}\n\t\t\t\t\t\t\t\tfillImageResize={properties.fillImageResize}\n\t\t\t\t\t\t\t\tfillImages={properties.fillImages}\n\t\t\t\t\t\t\t\tfillImageTileSize={properties.fillImageTileSize}\n\t\t\t\t\t\t\t\tfillType={properties.fillType}\n\t\t\t\t\t\t\t\tgradientFillSupported={properties.gradientFillSupported}\n\t\t\t\t\t\t\t\tonlyFrameNodes={properties.onlyFrameNodes}\n\t\t\t\t\t\t\t\tonlyNodesSupportingConicGradient={properties.onlyNodesSupportingConicGradient}\n\t\t\t\t\t\t\t\tonlyNodesSupportingImageFill={properties.onlyNodesSupportingImageFill}\n\t\t\t\t\t\t\t\tonlyNodesWithAltAttribute={properties.onlyNodesWithAltAttribute}\n\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\t// Kit fill image alts\n\t\t\t\t\t\t\t\tfillImageAlts={properties.fillImageAlts}\n\t\t\t\t\t\t\t\tonlyNodesSupportingFillImageAlts={properties.onlyNodesSupportingFillImageAlts}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<StarSpikesPanel\n\t\t\t\t\t\t\texpandedSelectionForShapeGeometryIds={properties.expandedSelectionForShapeGeometryIds}\n\t\t\t\t\t\t\tonlyNodesWithSpikes={properties.onlyNodesWithSpikes}\n\t\t\t\t\t\t\tspikeCount={properties.spikeCount}\n\t\t\t\t\t\t\tspikeDepth={properties.spikeDepth}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PolygonSidesPanel\n\t\t\t\t\t\t\texpandedSelectionForShapeGeometryIds={properties.expandedSelectionForShapeGeometryIds}\n\t\t\t\t\t\t\tonlyPolygonNodes={properties.onlyPolygonNodes}\n\t\t\t\t\t\t\tpolygonSides={properties.polygonSides}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{isFound(properties.overlayGrid) && (\n\t\t\t\t\t\t\t<OverlayGridPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.withoutDescendantIds}\n\t\t\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\t\t\toverlayGrid={properties.overlayGrid}\n\t\t\t\t\t\t\t\tonlyCanvasFrameNodes={properties.onlyCanvasFrameNodes}\n\t\t\t\t\t\t\t\tdisplayGrids={displayGrids}\n\t\t\t\t\t\t\t\trotation={rotationValue}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Panel>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{showPositionPanel && (\n\t\t\t\t\t\t\t<Panel\n\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t<PositionPanelHeader\n\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\tpositionTypes={properties.positionTypes}\n\t\t\t\t\t\t\t\t\t\tpositionStickyTop={properties.positionStickyTop}\n\t\t\t\t\t\t\t\t\t\tpositionStickyRight={properties.positionStickyRight}\n\t\t\t\t\t\t\t\t\t\tpositionStickyBottom={properties.positionStickyBottom}\n\t\t\t\t\t\t\t\t\t\tpositionStickyLeft={properties.positionStickyLeft}\n\t\t\t\t\t\t\t\t\t\tisWebPage={scopeType === ScopeType.WebPage}\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\t\t{selectionHasPositionControls && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t{properties.onlyGridItemNodes && !properties.anyGridItemParentWithMasonryLayout && (\n\t\t\t\t\t\t\t\t\t\t\t<GridItemPositionPanel\n\t\t\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\t\t\tgridItemFillCellWidth={properties.gridItemFillCellWidth}\n\t\t\t\t\t\t\t\t\t\t\t\tgridItemFillCellHeight={properties.gridItemFillCellHeight}\n\t\t\t\t\t\t\t\t\t\t\t\tgridItemHorizontalAlignment={properties.gridItemHorizontalAlignment}\n\t\t\t\t\t\t\t\t\t\t\t\tgridItemVerticalAlignment={properties.gridItemVerticalAlignment}\n\t\t\t\t\t\t\t\t\t\t\t\tanyGridItemParentWithRowHeightFitContent={properties.anyGridItemParentWithRowHeightFitContent}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t{this.positionPanel(properties)}\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\t{this.positionTypeRow(properties)}\n\t\t\t\t\t\t\t\t{onlyNodesWithPositionSticky ? (\n\t\t\t\t\t\t\t\t\t<PositionStickyRows\n\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\tpositionTypes={properties.positionTypes}\n\t\t\t\t\t\t\t\t\t\tpositionStickyTop={properties.positionStickyTop}\n\t\t\t\t\t\t\t\t\t\tpositionStickyRight={properties.positionStickyRight}\n\t\t\t\t\t\t\t\t\t\tpositionStickyBottom={properties.positionStickyBottom}\n\t\t\t\t\t\t\t\t\t\tpositionStickyLeft={properties.positionStickyLeft}\n\t\t\t\t\t\t\t\t\t\tisWebPage={scopeType === ScopeType.WebPage}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</Panel>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!properties.onlySlotPropertyNodes && (\n\t\t\t\t\t\t\t<Panel\n\t\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t\t<ConstraintsPanelHeader\n\t\t\t\t\t\t\t\t\t\ttitle=\"Size\"\n\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t\tminHeight={properties.minHeight}\n\t\t\t\t\t\t\t\t\t\tminWidth={properties.minWidth}\n\t\t\t\t\t\t\t\t\t\tmaxHeight={properties.maxHeight}\n\t\t\t\t\t\t\t\t\t\tmaxWidth={properties.maxWidth}\n\t\t\t\t\t\t\t\t\t\tminHeightUnits={properties.minHeightUnits}\n\t\t\t\t\t\t\t\t\t\tminWidthUnits={properties.minWidthUnits}\n\t\t\t\t\t\t\t\t\t\tmaxHeightUnits={properties.maxHeightUnits}\n\t\t\t\t\t\t\t\t\t\tmaxWidthUnits={properties.maxWidthUnits}\n\t\t\t\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\t\t\t\tonlyNodesWithSizeConstraints={properties.onlyNodesWithSizeConstraints}\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\t\t{properties.onlyGridItemNodes && !properties.anyGridItemParentWithMasonryLayout && (\n\t\t\t\t\t\t\t\t\t<GridItemSpanRows\n\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\tgridItemColumnSpan={properties.gridItemColumnSpan}\n\t\t\t\t\t\t\t\t\t\tgridItemRowSpan={properties.gridItemRowSpan}\n\t\t\t\t\t\t\t\t\t\tanyGridItemParentWithRowHeightFitContent={properties.anyGridItemParentWithRowHeightFitContent}\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\t{this.sizePanel(properties)}\n\t\t\t\t\t\t\t\t<EmployeesOnlySettings isOn=\"showDOMLayoutDebuggingPanel\">\n\t\t\t\t\t\t\t\t\t<DOMLayoutDebugPanel withoutDescendantIds={properties.withoutDescendantIds} />\n\t\t\t\t\t\t\t\t</EmployeesOnlySettings>\n\t\t\t\t\t\t\t\t{!properties.onlyFrameNodes && !properties.anyFormInputNodes && (\n\t\t\t\t\t\t\t\t\t<ResizeToFitContentPanel\n\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\tavailable={properties.resizeToFitContentActionAvailable}\n\t\t\t\t\t\t\t\t\t\tenabled={properties.resizeToFitContentActionEnabled && !readOnly}\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</Panel>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{properties.collectionOptions &&\n\t\t\t\t\tisFoundAndNotMixed(properties.dataIdentifier) &&\n\t\t\t\t\tisFoundAndNotMixed(properties.dataRepeaterArray) &&\n\t\t\t\t\tisString(properties.repeaterId) &&\n\t\t\t\t\tisString(properties.repeaterOriginalId) && (\n\t\t\t\t\t\t<DataRepeaterPanel\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\trepeaterId={properties.repeaterId}\n\t\t\t\t\t\t\trepeaterOriginalId={properties.repeaterOriginalId}\n\t\t\t\t\t\t\tdataIdentifier={properties.dataIdentifier}\n\t\t\t\t\t\t\tdataRepeaterArray={properties.dataRepeaterArray}\n\t\t\t\t\t\t\tcollectionFilters={properties.collectionOptions.collectionFilters}\n\t\t\t\t\t\t\tcollectionFiltersOperator={properties.collectionOptions.collectionFiltersOperator}\n\t\t\t\t\t\t\tcollectionOrder={properties.collectionOptions.collectionOrder}\n\t\t\t\t\t\t\tcollectionReverse={properties.collectionOptions.collectionReverse}\n\t\t\t\t\t\t\tcollectionStartOffset={properties.collectionOptions.collectionStartOffset}\n\t\t\t\t\t\t\tcollectionLimit={properties.collectionOptions.collectionLimit}\n\t\t\t\t\t\t\tcollectionPaginationPageSize={properties.collectionOptions.collectionPaginationPageSize}\n\t\t\t\t\t\t\tanyReplicaOrReplicaChild={properties.anyReplicaOrReplicaChild}\n\t\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t<Experiment isOn=\"nodeLevelRepeat\">\n\t\t\t\t\t{isString(properties.repeatId) &&\n\t\t\t\t\t\tisString(properties.repeatOriginalId) &&\n\t\t\t\t\t\tisFoundAndNotMixed(properties.repeatArray) && (\n\t\t\t\t\t\t\t<RepeatPanel\n\t\t\t\t\t\t\t\trepeatId={properties.repeatId}\n\t\t\t\t\t\t\t\trepeatOriginalId={properties.repeatOriginalId}\n\t\t\t\t\t\t\t\trepeatArray={properties.repeatArray}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t</Experiment>\n\t\t\t\t{properties.onlyNodesWithLayout &&\n\t\t\t\t\t(properties.onlyBreakpointNodes && scopeType === ScopeType.LayoutTemplate ? (\n\t\t\t\t\t\t<LayoutTemplateBreakpointLayoutPanel\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tstackAlignment={properties.stackAlignment}\n\t\t\t\t\t\t\tpadding={properties.padding}\n\t\t\t\t\t\t\tpaddingPerSide={properties.paddingPerSide}\n\t\t\t\t\t\t\tpaddingTop={properties.paddingTop}\n\t\t\t\t\t\t\tpaddingRight={properties.paddingRight}\n\t\t\t\t\t\t\tpaddingBottom={properties.paddingBottom}\n\t\t\t\t\t\t\tpaddingLeft={properties.paddingLeft}\n\t\t\t\t\t\t\tgap={properties.gap}\n\t\t\t\t\t\t\tgapAxis={properties.gapAxis}\n\t\t\t\t\t\t\trowGap={properties.rowGap}\n\t\t\t\t\t\t\tcolumnGap={properties.columnGap}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<StackAndGridLayoutPanel\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tselectionDidChange={properties.selectionDidChange}\n\t\t\t\t\t\t\tlayout={properties.layout}\n\t\t\t\t\t\t\tstackDirection={properties.stackDirection}\n\t\t\t\t\t\t\tstackDistribution={properties.stackDistribution}\n\t\t\t\t\t\t\tstackAlignment={properties.stackAlignment}\n\t\t\t\t\t\t\tstackWrapEnabled={properties.stackWrapEnabled}\n\t\t\t\t\t\t\tpadding={properties.padding}\n\t\t\t\t\t\t\tpaddingPerSide={properties.paddingPerSide}\n\t\t\t\t\t\t\tpaddingTop={properties.paddingTop}\n\t\t\t\t\t\t\tpaddingRight={properties.paddingRight}\n\t\t\t\t\t\t\tpaddingBottom={properties.paddingBottom}\n\t\t\t\t\t\t\tpaddingLeft={properties.paddingLeft}\n\t\t\t\t\t\t\theightTypes={properties.heightTypes}\n\t\t\t\t\t\t\tanyDataRepeater={properties.anyDataRepeater}\n\t\t\t\t\t\t\tanyNodeWithTickerEffect={properties.anyNodeWithTickerEffect}\n\t\t\t\t\t\t\tgridColumnCount={properties.gridColumnCount}\n\t\t\t\t\t\t\tgridAlignment={properties.gridAlignment}\n\t\t\t\t\t\t\tgridColumnWidthType={properties.gridColumnWidthType}\n\t\t\t\t\t\t\tgridColumnWidth={properties.gridColumnWidth}\n\t\t\t\t\t\t\tgridColumnMinWidth={properties.gridColumnMinWidth}\n\t\t\t\t\t\t\tgridRowCount={properties.gridRowCount}\n\t\t\t\t\t\t\tcomputedRowCount={properties.computedRowCount}\n\t\t\t\t\t\t\tgridRowHeightType={properties.gridRowHeightType}\n\t\t\t\t\t\t\tgridRowHeight={properties.gridRowHeight}\n\t\t\t\t\t\t\tgap={properties.gap}\n\t\t\t\t\t\t\tgapAxis={properties.gapAxis}\n\t\t\t\t\t\t\trowGap={properties.rowGap}\n\t\t\t\t\t\t\tcolumnGap={properties.columnGap}\n\t\t\t\t\t\t\tgridType={properties.gridType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t{showTypographyPanel && (\n\t\t\t\t\t<TypographyPanel nodeIds={properties.allNodeIds} rootFontSize={properties.rootFontSize} />\n\t\t\t\t)}\n\t\t\t\t{properties.onlyFormContainerNodes && (\n\t\t\t\t\t<FormContainerPanel\n\t\t\t\t\t\toriginalIds={properties.allOriginalIds}\n\t\t\t\t\t\tformSaveId={properties.formSaveId}\n\t\t\t\t\t\tformOnSuccessRedirectUrl={properties.formOnSuccessRedirectUrl}\n\t\t\t\t\t\tformSubmitTrackingId={properties.formSubmitTrackingId}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.onlyFormInputNodes && (\n\t\t\t\t\t<FormInputPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\toriginalIds={properties.allOriginalIds}\n\t\t\t\t\t\tformBooleanInputValue={properties.formBooleanInputValue}\n\t\t\t\t\t\tformInputAutofillEnabled={properties.formInputAutofillEnabled}\n\t\t\t\t\t\tformInputAutoFocus={properties.formInputAutoFocus}\n\t\t\t\t\t\tformInputFontColor={properties.formInputFontColor}\n\t\t\t\t\t\tformInputFontFamily={properties.formInputFontFamily}\n\t\t\t\t\t\tformInputFontLetterSpacing={properties.formInputFontLetterSpacing}\n\t\t\t\t\t\tformInputFontLetterSpacingUnit={properties.formInputFontLetterSpacingUnit}\n\t\t\t\t\t\tformInputFontLineHeight={properties.formInputFontLineHeight}\n\t\t\t\t\t\tformInputFontLineHeightUnit={properties.formInputFontLineHeightUnit}\n\t\t\t\t\t\tformInputFontSelector={properties.formInputFontSelector}\n\t\t\t\t\t\tformInputFontSize={properties.formInputFontSize}\n\t\t\t\t\t\tformInputFontSizeUnit={properties.formInputFontSizeUnit}\n\t\t\t\t\t\tformInputFontStyle={properties.formInputFontStyle}\n\t\t\t\t\t\tformInputFontTextAlignment={properties.formInputFontTextAlignment}\n\t\t\t\t\t\tformInputFontWeight={properties.formInputFontWeight}\n\t\t\t\t\t\tformInputOpenTypeFontFeatures={properties.formInputOpenTypeFontFeatures}\n\t\t\t\t\t\tformInputVariationAxes={properties.formInputVariationAxes}\n\t\t\t\t\t\tformInputHidden={properties.formInputHidden}\n\t\t\t\t\t\tformInputName={properties.formInputName}\n\t\t\t\t\t\tformInputPlaceholder={properties.formInputPlaceholder}\n\t\t\t\t\t\tformInputRequired={properties.formInputRequired}\n\t\t\t\t\t\tformInputStep={properties.formInputStep}\n\t\t\t\t\t\tformInputValue={properties.formInputValue}\n\t\t\t\t\t\tformSelectOptions={properties.formSelectOptions}\n\t\t\t\t\t\tformTextAreaResizable={properties.formTextAreaResizable}\n\t\t\t\t\t\tformTextInputMaxNumber={properties.formTextInputMaxNumber}\n\t\t\t\t\t\tformTextInputMinNumber={properties.formTextInputMinNumber}\n\t\t\t\t\t\tformInputMaxLength={properties.formInputMaxLength}\n\t\t\t\t\t\tformTextInputType={properties.formTextInputType}\n\t\t\t\t\t\tonlyFormInputNodesWithPlaceholder={properties.onlyFormInputNodesWithPlaceholder}\n\t\t\t\t\t\tonlyFormTextAreaNodes={properties.onlyFormTextAreaNodes}\n\t\t\t\t\t\tonlyNodesWithBooleanInputType={properties.onlyNodesWithBooleanInputType}\n\t\t\t\t\t\tonlyNodesWithFormInputStep={properties.onlyNodesWithFormInputStep}\n\t\t\t\t\t\tonlyNodesWithSelect={properties.onlyNodesWithSelect}\n\t\t\t\t\t\tanyNodeWithSelect={properties.anyNodeWithSelect}\n\t\t\t\t\t\tanyRadioButton={properties.anyRadioButton}\n\t\t\t\t\t\tonlyNodesWithTextInputType={properties.onlyNodesWithTextInputType}\n\t\t\t\t\t\tonlyNodesWithAutofillEnabled={properties.onlyNodesWithAutofillEnabled}\n\t\t\t\t\t\tonlyNodesWithRequired={properties.onlyNodesWithRequired}\n\t\t\t\t\t\tbindingType={properties.bindingType}\n\t\t\t\t\t\tvariableBinding={properties.variableBinding}\n\t\t\t\t\t\tallItemsLabel={properties.allItemsLabel}\n\t\t\t\t\t\tbooleanTrueLabel={properties.booleanTrueLabel}\n\t\t\t\t\t\tbooleanFalseLabel={properties.booleanFalseLabel}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{showEffectsPanel && (\n\t\t\t\t\t<EffectsHeader\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\tdragEffectEnabled={properties.dragEffectEnabled}\n\t\t\t\t\t\twhileHoverEnabled={properties.whileHoverEnabled}\n\t\t\t\t\t\tloopEffectEnabled={properties.loopEffectEnabled}\n\t\t\t\t\t\tflowEffectEnabled={properties.flowEffectEnabled}\n\t\t\t\t\t\tparallaxEnabled={properties.parallaxEnabled}\n\t\t\t\t\t\twhileTapEnabled={properties.whileTapEnabled}\n\t\t\t\t\t\tstyleAppearEffectEnabled={properties.styleAppearEffectEnabled}\n\t\t\t\t\t\tstyleTransformEffectEnabled={properties.styleTransformEffectEnabled}\n\t\t\t\t\t\ttextEffectEnabled={properties.textEffectEnabled}\n\t\t\t\t\t\tanyNodesWithImageFill={properties.anyNodesWithImageFill}\n\t\t\t\t\t\tanyNodeWithTickerEffectAncestor={properties.anyNodeWithTickerEffectAncestor}\n\t\t\t\t\t\tappearEffectEnabled={properties.appearEffectEnabled}\n\t\t\t\t\t\tlightboxEffectEnabled={properties.lightboxEffectEnabled}\n\t\t\t\t\t\tonlyNodesWithDragEffect={properties.onlyNodesWithDragEffect}\n\t\t\t\t\t\tonlyNodesWithWhileHover={properties.onlyNodesWithWhileHover}\n\t\t\t\t\t\tonlyNodesWithLoopEffect={properties.onlyNodesWithLoopEffect}\n\t\t\t\t\t\tonlyNodesWithFlowEffect={properties.onlyNodesWithFlowEffect}\n\t\t\t\t\t\tonlyNodesWithParallax={properties.onlyNodesWithParallax}\n\t\t\t\t\t\tonlyNodesWithWhileTap={properties.onlyNodesWithWhileTap}\n\t\t\t\t\t\tonlyNodesWithStyleAppearEffect={properties.onlyNodesWithStyleAppearEffect}\n\t\t\t\t\t\tonlyNodesWithStyleTransformEffect={properties.onlyNodesWithStyleTransformEffect}\n\t\t\t\t\t\tonlyNodesWithVariantAppearEffect={properties.onlyNodesWithVariantAppearEffect}\n\t\t\t\t\t\tonlyNodesWithTextEffect={properties.onlyNodesWithTextEffect}\n\t\t\t\t\t\tonlyNodesInAnOverlay={properties.onlyNodesInAnOverlay}\n\t\t\t\t\t\tonlyNodesWithStrokeEffect={properties.onlyNodesWithStrokeEffect}\n\t\t\t\t\t\tonlyNodesWithLightboxEffect={properties.onlyNodesWithLightboxEffect}\n\t\t\t\t\t\tonlyNodesWithTickerEffect={properties.onlyNodesWithTickerEffect}\n\t\t\t\t\t\tstrokeEffectEnabled={properties.strokeEffectEnabled}\n\t\t\t\t\t\tstyleAppearEffectTrigger={properties.styleAppearEffectTrigger}\n\t\t\t\t\t\ttickerEffectEnabled={properties.tickerEffectEnabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t<StrokeEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tonlyNodesWithStrokeEffect={properties.onlyNodesWithStrokeEffect}\n\t\t\t\t\t\t\tstrokeEffectEnabled={properties.strokeEffectEnabled}\n\t\t\t\t\t\t\tstrokeEffectLength={properties.strokeEffectLength}\n\t\t\t\t\t\t\tstrokeEffectOffset={properties.strokeEffectOffset}\n\t\t\t\t\t\t\tstrokeEffectGap={properties.strokeEffectGap}\n\t\t\t\t\t\t\tstrokeEffectTransition={properties.strokeEffectTransition}\n\t\t\t\t\t\t\tstrokeEffectLoop={properties.strokeEffectLoop}\n\t\t\t\t\t\t\tstrokeEffectLoopType={properties.strokeEffectLoopType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\ttextEffectScrollTarget={properties.textEffectScrollTarget}\n\t\t\t\t\t\t\ttextEffectTrigger={properties.textEffectTrigger}\n\t\t\t\t\t\t\tonlyNodesWithTextEffect={properties.onlyNodesWithTextEffect}\n\t\t\t\t\t\t\tanyNodesWithTextFit={properties.textProperties?.anyNodesWithTextFit}\n\t\t\t\t\t\t\tanyNodesWithGradientFill={properties.textProperties?.anyNodesWithGradientFill}\n\t\t\t\t\t\t\tanyNodesWithRelativeDates={properties.textProperties?.anyNodesWithRelativeDates}\n\t\t\t\t\t\t\ttextEffectEnabled={properties.textEffectEnabled}\n\t\t\t\t\t\t\ttextEffectType={properties.textEffectType}\n\t\t\t\t\t\t\ttextEffectTokenization={properties.textEffectTokenization}\n\t\t\t\t\t\t\ttextEffectThreshold={properties.textEffectThreshold}\n\t\t\t\t\t\t\ttextEffectScrollTargetCollectionItem={properties.textEffectScrollTargetCollectionItem}\n\t\t\t\t\t\t\ttextEffectReplay={properties.textEffectReplay}\n\t\t\t\t\t\t\ttextEffectDelay={properties.textEffectDelay}\n\t\t\t\t\t\t\ttextEffectOpacity={properties.textEffectOpacity}\n\t\t\t\t\t\t\ttextEffectX={properties.textEffectX}\n\t\t\t\t\t\t\ttextEffectY={properties.textEffectY}\n\t\t\t\t\t\t\ttextEffectScale={properties.textEffectScale}\n\t\t\t\t\t\t\ttextEffectRotate3d={properties.textEffectRotate3d}\n\t\t\t\t\t\t\ttextEffectRotate={properties.textEffectRotate}\n\t\t\t\t\t\t\ttextEffectRotateX={properties.textEffectRotateX}\n\t\t\t\t\t\t\ttextEffectRotateY={properties.textEffectRotateY}\n\t\t\t\t\t\t\ttextEffectSkewX={properties.textEffectSkewX}\n\t\t\t\t\t\t\ttextEffectSkewY={properties.textEffectSkewY}\n\t\t\t\t\t\t\ttextEffectBlur={properties.textEffectBlur}\n\t\t\t\t\t\t\ttextEffectTransition={properties.textEffectTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<StyleAppearEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tonlyNodesInAnOverlay={properties.onlyNodesInAnOverlay}\n\t\t\t\t\t\t\tonlyNodesWithStyleAppearEffect={properties.onlyNodesWithStyleAppearEffect}\n\t\t\t\t\t\t\tonlyNodesWithFloatingPosition={properties.onlyNodesWithFloatingPosition}\n\t\t\t\t\t\t\tonlyRepeatedNodes={properties.onlyRepeatedNodes}\n\t\t\t\t\t\t\tstyleAppearEffectScrollTarget={properties.styleAppearEffectScrollTarget}\n\t\t\t\t\t\t\tstyleAppearEffectTrigger={properties.styleAppearEffectTrigger}\n\t\t\t\t\t\t\tstyleAppearEffectEnabled={properties.styleAppearEffectEnabled}\n\t\t\t\t\t\t\tstyleAppearEffectThreshold={properties.styleAppearEffectThreshold}\n\t\t\t\t\t\t\tstyleAppearEffectAnimateOnce={properties.styleAppearEffectAnimateOnce}\n\t\t\t\t\t\t\tstyleAppearEffectLocked={properties.styleAppearEffectLocked}\n\t\t\t\t\t\t\tstyleAppearEffectScrollTargetCollectionItem={properties.styleAppearEffectScrollTargetCollectionItem}\n\t\t\t\t\t\t\tstyleAppearEffectScrollDirection={properties.styleAppearEffectScrollDirection}\n\t\t\t\t\t\t\tstyleAppearEffectOpacity={properties.styleAppearEffectOpacity}\n\t\t\t\t\t\t\tstyleAppearEffectX={properties.styleAppearEffectX}\n\t\t\t\t\t\t\tstyleAppearEffectY={properties.styleAppearEffectY}\n\t\t\t\t\t\t\tstyleAppearEffectScale={properties.styleAppearEffectScale}\n\t\t\t\t\t\t\tstyleAppearEffectRotate={properties.styleAppearEffectRotate}\n\t\t\t\t\t\t\tstyleAppearEffectRotateX={properties.styleAppearEffectRotateX}\n\t\t\t\t\t\t\tstyleAppearEffectRotateY={properties.styleAppearEffectRotateY}\n\t\t\t\t\t\t\tstyleAppearEffectPerspective={properties.styleAppearEffectPerspective}\n\t\t\t\t\t\t\tstyleAppearEffectTransition={properties.styleAppearEffectTransition}\n\t\t\t\t\t\t\tenterEffectEnabled={properties.enterEffectEnabled}\n\t\t\t\t\t\t\tenterEffectOpacity={properties.enterEffectOpacity}\n\t\t\t\t\t\t\tenterEffectX={properties.enterEffectX}\n\t\t\t\t\t\t\tenterEffectY={properties.enterEffectY}\n\t\t\t\t\t\t\tenterEffectScale={properties.enterEffectScale}\n\t\t\t\t\t\t\tenterEffectRotate3d={properties.enterEffectRotate3d}\n\t\t\t\t\t\t\tenterEffectRotate={properties.enterEffectRotate}\n\t\t\t\t\t\t\tenterEffectRotateX={properties.enterEffectRotateX}\n\t\t\t\t\t\t\tenterEffectRotateY={properties.enterEffectRotateY}\n\t\t\t\t\t\t\tenterEffectSkewX={properties.enterEffectSkewX}\n\t\t\t\t\t\t\tenterEffectSkewY={properties.enterEffectSkewY}\n\t\t\t\t\t\t\tenterEffectTransition={properties.enterEffectTransition}\n\t\t\t\t\t\t\texitEffectEnabled={properties.exitEffectEnabled}\n\t\t\t\t\t\t\texitEffectOpacity={properties.exitEffectOpacity}\n\t\t\t\t\t\t\texitEffectX={properties.exitEffectX}\n\t\t\t\t\t\t\texitEffectY={properties.exitEffectY}\n\t\t\t\t\t\t\texitEffectScale={properties.exitEffectScale}\n\t\t\t\t\t\t\texitEffectRotate3d={properties.exitEffectRotate3d}\n\t\t\t\t\t\t\texitEffectRotate={properties.exitEffectRotate}\n\t\t\t\t\t\t\texitEffectRotateX={properties.exitEffectRotateX}\n\t\t\t\t\t\t\texitEffectRotateY={properties.exitEffectRotateY}\n\t\t\t\t\t\t\texitEffectSkewX={properties.exitEffectSkewX}\n\t\t\t\t\t\t\texitEffectSkewY={properties.exitEffectSkewY}\n\t\t\t\t\t\t\texitEffectTransition={properties.exitEffectTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<HoverEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tonlyFrameNodes={properties.onlyFrameNodes}\n\t\t\t\t\t\t\tonlyNodesWithWhileHover={properties.onlyNodesWithWhileHover}\n\t\t\t\t\t\t\twhileHoverBoxShadow={properties.whileHoverBoxShadow}\n\t\t\t\t\t\t\twhileHoverBoxShadowCount={properties.whileHoverBoxShadowCount}\n\t\t\t\t\t\t\twhileHoverEnabled={properties.whileHoverEnabled}\n\t\t\t\t\t\t\twhileHoverOpacity={properties.whileHoverOpacity}\n\t\t\t\t\t\t\twhileHoverX={properties.whileHoverX}\n\t\t\t\t\t\t\twhileHoverY={properties.whileHoverY}\n\t\t\t\t\t\t\twhileHoverScale={properties.whileHoverScale}\n\t\t\t\t\t\t\twhileHoverRotate3d={properties.whileHoverRotate3d}\n\t\t\t\t\t\t\twhileHoverRotate={properties.whileHoverRotate}\n\t\t\t\t\t\t\twhileHoverRotateX={properties.whileHoverRotateX}\n\t\t\t\t\t\t\twhileHoverRotateY={properties.whileHoverRotateY}\n\t\t\t\t\t\t\twhileHoverSkewX={properties.whileHoverSkewX}\n\t\t\t\t\t\t\twhileHoverSkewY={properties.whileHoverSkewY}\n\t\t\t\t\t\t\twhileHoverBackgroundColor={properties.whileHoverBackgroundColor}\n\t\t\t\t\t\t\twhileHoverTransition={properties.whileHoverTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PressEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tonlyFrameNodes={properties.onlyFrameNodes}\n\t\t\t\t\t\t\tonlyNodesWithWhileTap={properties.onlyNodesWithWhileTap}\n\t\t\t\t\t\t\twhileTapBoxShadow={properties.whileTapBoxShadow}\n\t\t\t\t\t\t\twhileTapBoxShadowCount={properties.whileTapBoxShadowCount}\n\t\t\t\t\t\t\twhileTapEnabled={properties.whileTapEnabled}\n\t\t\t\t\t\t\twhileTapOpacity={properties.whileTapOpacity}\n\t\t\t\t\t\t\twhileTapX={properties.whileTapX}\n\t\t\t\t\t\t\twhileTapY={properties.whileTapY}\n\t\t\t\t\t\t\twhileTapScale={properties.whileTapScale}\n\t\t\t\t\t\t\twhileTapRotate3d={properties.whileTapRotate3d}\n\t\t\t\t\t\t\twhileTapRotate={properties.whileTapRotate}\n\t\t\t\t\t\t\twhileTapRotateX={properties.whileTapRotateX}\n\t\t\t\t\t\t\twhileTapRotateY={properties.whileTapRotateY}\n\t\t\t\t\t\t\twhileTapSkewX={properties.whileTapSkewX}\n\t\t\t\t\t\t\twhileTapSkewY={properties.whileTapSkewY}\n\t\t\t\t\t\t\twhileTapBackgroundColor={properties.whileTapBackgroundColor}\n\t\t\t\t\t\t\twhileTapTransition={properties.whileTapTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<LoopEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tonlyNodesWithLoopEffect={properties.onlyNodesWithLoopEffect}\n\t\t\t\t\t\t\tloopEffectEnabled={properties.loopEffectEnabled}\n\t\t\t\t\t\t\tloopEffectRepeatType={properties.loopEffectRepeatType}\n\t\t\t\t\t\t\tloopEffectRepeatDelay={properties.loopEffectRepeatDelay}\n\t\t\t\t\t\t\tloopEffectOpacity={properties.loopEffectOpacity}\n\t\t\t\t\t\t\tloopEffectX={properties.loopEffectX}\n\t\t\t\t\t\t\tloopEffectY={properties.loopEffectY}\n\t\t\t\t\t\t\tloopEffectScale={properties.loopEffectScale}\n\t\t\t\t\t\t\tloopEffectRotate3d={properties.loopEffectRotate3d}\n\t\t\t\t\t\t\tloopEffectRotate={properties.loopEffectRotate}\n\t\t\t\t\t\t\tloopEffectRotateX={properties.loopEffectRotateX}\n\t\t\t\t\t\t\tloopEffectRotateY={properties.loopEffectRotateY}\n\t\t\t\t\t\t\tloopEffectSkewX={properties.loopEffectSkewX}\n\t\t\t\t\t\t\tloopEffectSkewY={properties.loopEffectSkewY}\n\t\t\t\t\t\t\tloopEffectTransition={properties.loopEffectTransition}\n\t\t\t\t\t\t\tloopEffectPauseOffscreen={properties.loopEffectPauseOffscreen}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<DragEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tonlyNodesWithDragEffect={properties.onlyNodesWithDragEffect}\n\t\t\t\t\t\t\tdragEffectEnabled={properties.dragEffectEnabled}\n\t\t\t\t\t\t\tdragEffectFreeform={properties.dragEffectFreeform}\n\t\t\t\t\t\t\tdragEffectSnapBack={properties.dragEffectSnapBack}\n\t\t\t\t\t\t\tdragEffectMomentum={properties.dragEffectMomentum}\n\t\t\t\t\t\t\tdragEffectTransition={properties.dragEffectTransition}\n\t\t\t\t\t\t\tdragEffectConstraintElement={properties.dragEffectConstraintElement}\n\t\t\t\t\t\t\tdragEffectConstraintItem={properties.dragEffectConstraintItem}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<LightboxEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tanyNodesWithImageFill={properties.anyNodesWithImageFill}\n\t\t\t\t\t\t\tonlyNodesWithLightboxEffect={properties.onlyNodesWithLightboxEffect}\n\t\t\t\t\t\t\tlightboxEffectEnabled={properties.lightboxEffectEnabled}\n\t\t\t\t\t\t\tlightboxEffectPadding={properties.lightboxEffectPadding}\n\t\t\t\t\t\t\tlightboxEffectPaddingPerSide={properties.lightboxEffectPaddingPerSide}\n\t\t\t\t\t\t\tlightboxEffectPaddingTop={properties.lightboxEffectPaddingTop}\n\t\t\t\t\t\t\tlightboxEffectPaddingRight={properties.lightboxEffectPaddingRight}\n\t\t\t\t\t\t\tlightboxEffectPaddingBottom={properties.lightboxEffectPaddingBottom}\n\t\t\t\t\t\t\tlightboxEffectPaddingLeft={properties.lightboxEffectPaddingLeft}\n\t\t\t\t\t\t\tlightboxEffectMaxWidth={properties.lightboxEffectMaxWidth}\n\t\t\t\t\t\t\tlightboxEffectZIndex={properties.lightboxEffectZIndex}\n\t\t\t\t\t\t\tlightboxEffectBackdrop={properties.lightboxEffectBackdrop}\n\t\t\t\t\t\t\tlightboxEffectTransition={properties.lightboxEffectTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TickerEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tanyNodeWithTickerEffect={properties.anyNodeWithTickerEffect}\n\t\t\t\t\t\t\tanyNodeWithTickerEffectAncestor={properties.anyNodeWithTickerEffectAncestor}\n\t\t\t\t\t\t\tonlyNodesWithTickerEffect={properties.onlyNodesWithTickerEffect}\n\t\t\t\t\t\t\ttickerEffectEnabled={properties.tickerEffectEnabled}\n\t\t\t\t\t\t\ttickerEffectVelocity={properties.tickerEffectVelocity}\n\t\t\t\t\t\t\ttickerEffectHoverModifier={properties.tickerEffectHoverModifier}\n\t\t\t\t\t\t\ttickerEffectDirectionModifier={properties.tickerEffectDirectionModifier}\n\t\t\t\t\t\t\ttickerEffectDraggable={properties.tickerEffectDraggable}\n\t\t\t\t\t\t\tonlyNodesWithLayout={properties.onlyNodesWithLayout}\n\t\t\t\t\t\t\tlayout={properties.layout}\n\t\t\t\t\t\t\tstackDirection={properties.stackDirection}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ParallaxEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tonlyNodesWithParallax={properties.onlyNodesWithParallax}\n\t\t\t\t\t\t\tparallaxEnabled={properties.parallaxEnabled}\n\t\t\t\t\t\t\tparallaxSpeed={properties.parallaxSpeed}\n\t\t\t\t\t\t\tparallaxAdjustPosition={properties.parallaxAdjustPosition}\n\t\t\t\t\t\t\tparallaxOffset={properties.parallaxOffset}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<StyleTransformEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tonlyNodesWithStyleTransformEffect={properties.onlyNodesWithStyleTransformEffect}\n\t\t\t\t\t\t\tstyleTransformEffectTrigger={properties.styleTransformEffectTrigger}\n\t\t\t\t\t\t\tstyleTransformEffectScrollTargets={properties.styleTransformEffectScrollTargets}\n\t\t\t\t\t\t\tstyleTransformEffectScrollTargetCount={properties.styleTransformEffectScrollTargetCount}\n\t\t\t\t\t\t\tstyleTransformEffectEnabled={properties.styleTransformEffectEnabled}\n\t\t\t\t\t\t\tstyleTransformEffectViewportThreshold={properties.styleTransformEffectViewportThreshold}\n\t\t\t\t\t\t\tstyleTransformEffectTransitionEnabled={properties.styleTransformEffectTransitionEnabled}\n\t\t\t\t\t\t\tstyleTransformEffectTransition={properties.styleTransformEffectTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VariantAppearEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tcodeComponentIdentifiers={properties.codeComponentIdentifiers}\n\t\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\t\tonlyNodesWithVariantAppearEffect={properties.onlyNodesWithVariantAppearEffect}\n\t\t\t\t\t\t\tappearEffectAnimateOnce={properties.appearEffectAnimateOnce}\n\t\t\t\t\t\t\tappearEffectEnabled={properties.appearEffectEnabled}\n\t\t\t\t\t\t\tappearEffectObscuredVariantId={properties.appearEffectObscuredVariantId}\n\t\t\t\t\t\t\tappearEffectScrollDirection={properties.appearEffectScrollDirection}\n\t\t\t\t\t\t\tappearEffectScrollDirectionTarget={properties.appearEffectScrollDirectionTarget}\n\t\t\t\t\t\t\tappearEffectScrollTargetCount={properties.appearEffectScrollTargetCount}\n\t\t\t\t\t\t\tappearEffectScrollTargets={properties.appearEffectScrollTargets}\n\t\t\t\t\t\t\tappearEffectThreshold={properties.appearEffectThreshold}\n\t\t\t\t\t\t\tappearEffectTrigger={properties.appearEffectTrigger}\n\t\t\t\t\t\t\tappearEffectVisibleVariantId={properties.appearEffectVisibleVariantId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<FlowEffectRow\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tonlyNodesWithFlowEffect={properties.onlyNodesWithFlowEffect}\n\t\t\t\t\t\t\tflowEffectEnabled={properties.flowEffectEnabled}\n\t\t\t\t\t\t\tflowEffectTransition={properties.flowEffectTransition}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</EffectsHeader>\n\t\t\t\t)}\n\t\t\t\t{(scopeType === ScopeType.WebPage ||\n\t\t\t\t\tscopeType === ScopeType.SmartComponent ||\n\t\t\t\t\tscopeType === ScopeType.LayoutTemplate) &&\n\t\t\t\t\tnodes.length === 1 &&\n\t\t\t\t\t!properties.onlyNodesInAnOverlay &&\n\t\t\t\t\tproperties.onlyNodesSupportingOverlayTrigger && (\n\t\t\t\t\t\t<OverlaysPanel\n\t\t\t\t\t\t\tnodes={nodes}\n\t\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\twhileOpenEffectVariant={properties.whileOpenEffectVariant}\n\t\t\t\t\t\t\tcodeComponentIdentifiers={properties.codeComponentIdentifiers}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t<Experiment isOn=\"overridesWithPropertyControls\">\n\t\t\t\t\t{properties.onlyNodesWithCodeOverrides && (\n\t\t\t\t\t\t<CodeOverridesPanel\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\t\t\tcodeOverrides={properties.codeOverrides}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Experiment>\n\t\t\t\t{!properties.anyFormInputNodes && properties.onlyNodesWithCursor && (\n\t\t\t\t\t<CursorPanel\n\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tonlyGroundNodes={false}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tcustomCursorVariant={properties.customCursorVariant}\n\t\t\t\t\t\tcursor={properties.cursor}\n\t\t\t\t\t\tcustomCursorType={properties.customCursorType}\n\t\t\t\t\t\tcustomCursorSmartComponentId={properties.customCursorSmartComponentId}\n\t\t\t\t\t\tcustomCursorFollow={properties.customCursorFollow}\n\t\t\t\t\t\tcustomCursorOffsetX={properties.customCursorOffsetX}\n\t\t\t\t\t\tcustomCursorOffsetY={properties.customCursorOffsetY}\n\t\t\t\t\t\tcustomCursorTransitionEnabled={properties.customCursorTransitionEnabled}\n\t\t\t\t\t\tcustomCursorTransition={properties.customCursorTransition}\n\t\t\t\t\t\tcustomCursorPlacement={properties.customCursorPlacement}\n\t\t\t\t\t\tcustomCursorAlignment={properties.customCursorAlignment}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.onlyBreakpointNodes && (\n\t\t\t\t\t<BreakpointEffectsPanel\n\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\tpageEffects={properties.pageEffects}\n\t\t\t\t\t\tonlyNodesWithFlowEffect={properties.onlyNodesWithFlowEffect}\n\t\t\t\t\t\tflowEffectEnabled={properties.flowEffectEnabled}\n\t\t\t\t\t\tflowEffectTransition={properties.flowEffectTransition}\n\t\t\t\t\t\tsupportsPageEffects={scopeType === ScopeType.WebPage}\n\t\t\t\t\t\tanyBreakpointWithLayoutTemplate={properties.anyBreakpointsWithLayoutTemplate}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{!properties.anyBreakpointsWithLayoutTemplate &&\n\t\t\t\t\t!properties.onlySlotPropertyNodes &&\n\t\t\t\t\t!(scopeType === ScopeType.VectorSet && properties.onlyShapeContainerNodes) && (\n\t\t\t\t\t\t<Panel\n\t\t\t\t\t\t\theader={\n\t\t\t\t\t\t\t\t<StyleHeader\n\t\t\t\t\t\t\t\t\tallNodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tbackgroundBlur={properties.backgroundBlur}\n\t\t\t\t\t\t\t\t\tblendingMode={properties.blendingMode}\n\t\t\t\t\t\t\t\t\tblur={properties.blur}\n\t\t\t\t\t\t\t\t\tborderEnabled={properties.borderEnabled}\n\t\t\t\t\t\t\t\t\tbrightness={properties.brightness}\n\t\t\t\t\t\t\t\t\tcontrast={properties.contrast}\n\t\t\t\t\t\t\t\t\tdraggable={properties.draggable}\n\t\t\t\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\t\t\t\tfillOpacity={properties.fillOpacity}\n\t\t\t\t\t\t\t\t\tgrayscale={properties.grayscale}\n\t\t\t\t\t\t\t\t\thideScrollbars={properties.hideScrollbars}\n\t\t\t\t\t\t\t\t\thueRotate={properties.hueRotate}\n\t\t\t\t\t\t\t\t\timageRendering={properties.imageRendering}\n\t\t\t\t\t\t\t\t\tinvert={properties.invert}\n\t\t\t\t\t\t\t\t\tmasks={properties.masks}\n\t\t\t\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\t\t\t\tonlyNodesWithDraggable={properties.onlyNodesWithDraggable}\n\t\t\t\t\t\t\t\t\tonlyNodesWithFilters={properties.onlyNodesWithFilters}\n\t\t\t\t\t\t\t\t\tonlyNodesWithImageRendering={properties.onlyNodesWithImageRendering}\n\t\t\t\t\t\t\t\t\tonlyNodesWithMask={properties.onlyNodesWithMask}\n\t\t\t\t\t\t\t\t\tonlyNodesWithOverflow={properties.onlyNodesWithOverflow}\n\t\t\t\t\t\t\t\t\tonlyNodesWithOverscrollBehavior={properties.onlyNodesWithOverscrollBehavior}\n\t\t\t\t\t\t\t\t\tonlyNodesWithPointerEvents={properties.onlyNodesWithPointerEvents}\n\t\t\t\t\t\t\t\t\tonlyNodesWithScrollbars={properties.onlyNodesWithScrollbars}\n\t\t\t\t\t\t\t\t\tonlyNodesWithTapHighlight={properties.onlyNodesWithTapHighlight}\n\t\t\t\t\t\t\t\t\tonlyNodesWithTextSelection={properties.onlyNodesWithTextSelection}\n\t\t\t\t\t\t\t\t\tonlyNodesWithTransition={properties.onlyNodesWithTransition}\n\t\t\t\t\t\t\t\t\tonlyNodesWithUserSelect={properties.onlyNodesWithUserSelect}\n\t\t\t\t\t\t\t\t\tonlyNodesWithViewTransitionNone={properties.onlyNodesWithViewTransitionNone}\n\t\t\t\t\t\t\t\t\tonlyNonGestureVariants={properties.onlyNonGestureVariants}\n\t\t\t\t\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\t\t\t\t\toverflow={properties.overflow}\n\t\t\t\t\t\t\t\t\toverflowX={properties.overflowX}\n\t\t\t\t\t\t\t\t\toverflowY={properties.overflowY}\n\t\t\t\t\t\t\t\t\toverscrollBehavior={properties.overscrollBehavior}\n\t\t\t\t\t\t\t\t\tpointerEvents={properties.pointerEvents}\n\t\t\t\t\t\t\t\t\tradius={properties.radius}\n\t\t\t\t\t\t\t\t\tradiusPerCorner={properties.radiusPerCorner}\n\t\t\t\t\t\t\t\t\tcornerShape={properties.cornerShape}\n\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\tsaturate={properties.saturate}\n\t\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\t\tsepia={properties.sepia}\n\t\t\t\t\t\t\t\t\tshadows={properties.shadows}\n\t\t\t\t\t\t\t\t\ttapHighlightColor={properties.tapHighlightColor}\n\t\t\t\t\t\t\t\t\ttextSelection={properties.textSelection}\n\t\t\t\t\t\t\t\t\ttransition={properties.transition}\n\t\t\t\t\t\t\t\t\tuserSelect={properties.userSelect}\n\t\t\t\t\t\t\t\t\tviewTransitionNone={properties.viewTransitionNone}\n\t\t\t\t\t\t\t\t\tzIndex={properties.zIndex}\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\t\t{properties.onlyNodesWithFormInputFontStyles && (\n\t\t\t\t\t\t\t\t<FormInputStyleRows\n\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tformInputFontColor={properties.formInputFontColor}\n\t\t\t\t\t\t\t\t\tformInputFontFamily={properties.formInputFontFamily}\n\t\t\t\t\t\t\t\t\tformInputFontSize={properties.formInputFontSize}\n\t\t\t\t\t\t\t\t\tformInputFontSizeUnit={properties.formInputFontSizeUnit}\n\t\t\t\t\t\t\t\t\tformInputFontWeight={properties.formInputFontWeight}\n\t\t\t\t\t\t\t\t\tformInputFontSelector={properties.formInputFontSelector}\n\t\t\t\t\t\t\t\t\tformInputFontStyle={properties.formInputFontStyle}\n\t\t\t\t\t\t\t\t\tformInputFontLetterSpacing={properties.formInputFontLetterSpacing}\n\t\t\t\t\t\t\t\t\tformInputFontLetterSpacingUnit={properties.formInputFontLetterSpacingUnit}\n\t\t\t\t\t\t\t\t\tformInputFontLineHeight={properties.formInputFontLineHeight}\n\t\t\t\t\t\t\t\t\tformInputFontLineHeightUnit={properties.formInputFontLineHeightUnit}\n\t\t\t\t\t\t\t\t\tformInputFontTextAlignment={properties.formInputFontTextAlignment}\n\t\t\t\t\t\t\t\t\tformInputOpenTypeFontFeatures={properties.formInputOpenTypeFontFeatures}\n\t\t\t\t\t\t\t\t\tformInputVariationAxes={properties.formInputVariationAxes}\n\t\t\t\t\t\t\t\t\tformInputIconImage={properties.formInputIconImage}\n\t\t\t\t\t\t\t\t\tformInputIconColor={properties.formInputIconColor}\n\t\t\t\t\t\t\t\t\tonlyNodesWithInputIconRow={properties.onlyNodesWithInputIconRow}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{properties.onlyFormInputNodesWithPlaceholderColor && (\n\t\t\t\t\t\t\t\t<InputPlaceholderColorRow\n\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tformInputPlaceholderColor={properties.formInputPlaceholderColor}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{properties.onlyNodesWithFormInputInvalidStyles &&\n\t\t\t\t\t\t\t\tisFoundAndNotUndefined(properties.formInputInvalidTextColor) && (\n\t\t\t\t\t\t\t\t\t<InputInvalidTextColorRow\n\t\t\t\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\t\tformInputInvalidTextColor={properties.formInputInvalidTextColor}\n\t\t\t\t\t\t\t\t\t\tonlyNodesWithSelect={properties.onlyNodesWithSelect}\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{scopeType === ScopeType.SmartComponent && properties.onlyNonGestureVariants && (\n\t\t\t\t\t\t\t\t<TransitionRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\ttraitType={TraitType.Transition}\n\t\t\t\t\t\t\t\t\ttransition={properties.transition}\n\t\t\t\t\t\t\t\t\tonlyGroundNodeDescendants={properties.onlyGroundNodeDescendants}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<OpacityRow nodeIds={properties.allNodeIds} opacity={properties.opacity} />\n\t\t\t\t\t\t\t{!properties.anyFormInputNodes && (\n\t\t\t\t\t\t\t\t<VisibilityRow nodeIds={properties.withoutDescendantIds} visible={properties.visible} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<FillPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\t\t\tanyNodesWithFill={properties.anyNodesWithFill}\n\t\t\t\t\t\t\t\tanyNodeWithNonOptionalFill={properties.anyNodeWithNonOptionalFill}\n\t\t\t\t\t\t\t\tonlyNodesSupportingImageFill={properties.onlyNodesSupportingImageFill}\n\t\t\t\t\t\t\t\tonlyFrameNodes={properties.onlyFrameNodes}\n\t\t\t\t\t\t\t\tfillColor={properties.fillColor}\n\t\t\t\t\t\t\t\tfillEnabled={properties.fillEnabled}\n\t\t\t\t\t\t\t\tfillType={properties.fillType}\n\t\t\t\t\t\t\t\tfillImage={properties.fillImage}\n\t\t\t\t\t\t\t\tfillImages={properties.fillImages}\n\t\t\t\t\t\t\t\tgradientFillSupported={properties.gradientFillSupported}\n\t\t\t\t\t\t\t\tfillImageResize={properties.fillImageResize}\n\t\t\t\t\t\t\t\tfillImagePositionX={properties.fillImagePositionX}\n\t\t\t\t\t\t\t\tfillImagePositionY={properties.fillImagePositionY}\n\t\t\t\t\t\t\t\tfillImageTileSize={properties.fillImageTileSize}\n\t\t\t\t\t\t\t\taltAttribute={properties.altAttribute}\n\t\t\t\t\t\t\t\tonlyNodesWithAltAttribute={properties.onlyNodesWithAltAttribute}\n\t\t\t\t\t\t\t\tonlyNodesSupportingConicGradient={properties.onlyNodesSupportingConicGradient}\n\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\tfillGradientCSS={properties.fillGradientCSS}\n\t\t\t\t\t\t\t\t// Kit fill image alts\n\t\t\t\t\t\t\t\tfillImageAlts={properties.fillImageAlts}\n\t\t\t\t\t\t\t\tonlyNodesSupportingFillImageAlts={properties.onlyNodesSupportingFillImageAlts}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FillOpacityRow nodeIds={properties.allNodeIds} fillOpacity={properties.fillOpacity} />\n\t\t\t\t\t\t\t{properties.onlyNodesWithOverflow && (\n\t\t\t\t\t\t\t\t<OverflowPanel\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\toverflow={properties.overflow}\n\t\t\t\t\t\t\t\t\toverflowX={properties.overflowX}\n\t\t\t\t\t\t\t\t\toverflowY={properties.overflowY}\n\t\t\t\t\t\t\t\t\tonlyTextNodes={properties.onlyAnyTextNodes}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t<CornerPanel\n\t\t\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\t\t\texpandedSelectionForShapeGeometryIds={properties.expandedSelectionForShapeGeometryIds}\n\t\t\t\t\t\t\t\tradius={properties.radius}\n\t\t\t\t\t\t\t\tradiusTopLeft={properties.radiusTopLeft}\n\t\t\t\t\t\t\t\tradiusTopRight={properties.radiusTopRight}\n\t\t\t\t\t\t\t\tradiusBottomRight={properties.radiusBottomRight}\n\t\t\t\t\t\t\t\tradiusBottomLeft={properties.radiusBottomLeft}\n\t\t\t\t\t\t\t\tonlyRelativeRadiusNodes={properties.onlyRelativeRadiusNodes}\n\t\t\t\t\t\t\t\tradiusPerCorner={properties.radiusPerCorner}\n\t\t\t\t\t\t\t\tselectionDidChange={properties.selectionDidChange}\n\t\t\t\t\t\t\t\tcornerShape={properties.cornerShape}\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t{properties.onlyFormInputNodes && (\n\t\t\t\t\t\t\t\t<PaddingRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tpadding={properties.padding}\n\t\t\t\t\t\t\t\t\tpaddingBottom={properties.paddingBottom}\n\t\t\t\t\t\t\t\t\tpaddingLeft={properties.paddingLeft}\n\t\t\t\t\t\t\t\t\tpaddingPerSide={properties.paddingPerSide}\n\t\t\t\t\t\t\t\t\tpaddingRight={properties.paddingRight}\n\t\t\t\t\t\t\t\t\tpaddingTop={properties.paddingTop}\n\t\t\t\t\t\t\t\t\tonlyFormInputNodes\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{showRotation2DRow && (\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * We don't render the 2D rotation row for nodes that\n\t\t\t\t\t\t\t\t * support transforms (they have a 3d rotation row in\n\t\t\t\t\t\t\t\t * the transforms panel). But we still need the 2D\n\t\t\t\t\t\t\t\t * rotation row for nodes that support only 2D rotation\n\t\t\t\t\t\t\t\t * (e.g. SVGNode).\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\t<Rotation2DRow\n\t\t\t\t\t\t\t\t\twithoutDescendantIds={properties.withoutDescendantIds}\n\t\t\t\t\t\t\t\t\trotation={properties.rotation}\n\t\t\t\t\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\t\t\t\t\tonlyNodesWithRotation={properties.onlyNodesWithRotation}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{properties.onlyNodesWithInputIconRow && isFound(properties.formInputIconImage) && (\n\t\t\t\t\t\t\t\t<InputIconRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tformInputIconImage={properties.formInputIconImage}\n\t\t\t\t\t\t\t\t\tformInputIconColor={properties.formInputIconColor}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<BorderPanel\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tborderEnabled={properties.borderEnabled}\n\t\t\t\t\t\t\t\tborderColor={properties.borderColor}\n\t\t\t\t\t\t\t\tborderPerSide={properties.borderPerSide}\n\t\t\t\t\t\t\t\tborderTop={properties.borderTop}\n\t\t\t\t\t\t\t\tborderRight={properties.borderRight}\n\t\t\t\t\t\t\t\tborderBottom={properties.borderBottom}\n\t\t\t\t\t\t\t\tborderLeft={properties.borderLeft}\n\t\t\t\t\t\t\t\tborderWidth={properties.borderWidth}\n\t\t\t\t\t\t\t\tborderStyle={properties.borderStyle}\n\t\t\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{textProperties ? null : (\n\t\t\t\t\t\t\t\t<ShadowPanel\n\t\t\t\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\t\t\t\tanyNodesWithShadows={properties.anyNodesWithShadows}\n\t\t\t\t\t\t\t\t\tshadows={properties.shadows}\n\t\t\t\t\t\t\t\t\tonlyNodesSupportingShadowSpread={properties.onlyNodesSupportingShadowSpread}\n\t\t\t\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={properties.onlyNodesSupportingRealisticShadows}\n\t\t\t\t\t\t\t\t\tonlyNodesSupportingShadowInset={properties.onlyNodesSupportingShadowInset}\n\t\t\t\t\t\t\t\t\tanyShapeNode={properties.anyShapeNode}\n\t\t\t\t\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<BlendModeRow nodeIds={properties.allNodeIds} blendingMode={properties.blendingMode} />\n\t\t\t\t\t\t\t<FiltersPanel\n\t\t\t\t\t\t\t\tallNodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tblur={properties.blur}\n\t\t\t\t\t\t\t\tbackgroundBlur={properties.backgroundBlur}\n\t\t\t\t\t\t\t\tbrightness={properties.brightness}\n\t\t\t\t\t\t\t\tcontrast={properties.contrast}\n\t\t\t\t\t\t\t\tgrayscale={properties.grayscale}\n\t\t\t\t\t\t\t\thueRotate={properties.hueRotate}\n\t\t\t\t\t\t\t\tinvert={properties.invert}\n\t\t\t\t\t\t\t\tsaturate={properties.saturate}\n\t\t\t\t\t\t\t\tsepia={properties.sepia}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ZIndexRow\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tpositionStickyEnabled={properties.positionTypes.has(\"sticky\")}\n\t\t\t\t\t\t\t\tonlyNodesWithFloatingPosition={properties.onlyNodesWithFloatingPosition}\n\t\t\t\t\t\t\t\tzIndex={properties.zIndex}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PointerEventsRow\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tonlyNodesWithPointerEvents={properties.onlyNodesWithPointerEvents}\n\t\t\t\t\t\t\t\tpointerEvents={properties.pointerEvents}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ImageRenderingRow\n\t\t\t\t\t\t\t\tonlyNodesWithImageRendering={properties.onlyNodesWithImageRendering}\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\timageRendering={properties.imageRendering}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<UserSelectRow\n\t\t\t\t\t\t\t\tonlyNodesWithUserSelect={properties.onlyNodesWithUserSelect}\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tuserSelect={properties.userSelect}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<DraggableRow\n\t\t\t\t\t\t\t\tonlyNodesWithDraggable={properties.onlyNodesWithDraggable}\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\tdraggable={properties.draggable}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ScrollbarsRow\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\thideScrollbars={properties.hideScrollbars}\n\t\t\t\t\t\t\t\tonlyNodesWithScrollbars={properties.onlyNodesWithScrollbars}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{properties.onlyNodesWithMask && <MasksRow masks={properties.masks} nodeIds={properties.allNodeIds} />}\n\t\t\t\t\t\t\t{properties.onlyNodesWithOverscrollBehavior && (\n\t\t\t\t\t\t\t\t<OverscrollBehaviorPanel\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\toverscrollBehavior={properties.overscrollBehavior}\n\t\t\t\t\t\t\t\t\tonlyNodesWithOverscrollBehavior={properties.onlyNodesWithOverscrollBehavior}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<TapHighlightRow\n\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\ttapHighlightColor={properties.tapHighlightColor}\n\t\t\t\t\t\t\t\tonlyNodesWithTapHighlight={properties.onlyNodesWithTapHighlight}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{properties.onlyFormInputNodes && (\n\t\t\t\t\t\t\t\t<FormInputFocusedStyleRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tformInputFocusedBackgroundColor={properties.formInputFocusedBackgroundColor}\n\t\t\t\t\t\t\t\t\tformInputFocusedBorderColor={properties.formInputFocusedBorderColor}\n\t\t\t\t\t\t\t\t\tformInputFocusedBorderWidth={properties.formInputFocusedBorderWidth}\n\t\t\t\t\t\t\t\t\tformInputFocusedBorderStyle={properties.formInputFocusedBorderStyle}\n\t\t\t\t\t\t\t\t\tformInputFocusedBoxShadow={properties.formInputFocusedBoxShadow}\n\t\t\t\t\t\t\t\t\tformInputFocusedTransition={properties.formInputFocusedTransition}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{properties.onlyNodesWithBooleanInputType && (\n\t\t\t\t\t\t\t\t<FormBooleanCheckedEffectRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tformBooleanInputType={properties.formBooleanInputType}\n\t\t\t\t\t\t\t\t\tformInputIconImage={properties.formInputIconImage}\n\t\t\t\t\t\t\t\t\tformInputIconColor={properties.formInputIconColor}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedBoxShadow={properties.formBooleanInputCheckedBoxShadow}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedFillColor={properties.formBooleanInputCheckedFillColor}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedBorderColor={properties.formBooleanInputCheckedBorderColor}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedBorderWidth={properties.formBooleanInputCheckedBorderWidth}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedBorderStyle={properties.formBooleanInputCheckedBorderStyle}\n\t\t\t\t\t\t\t\t\tformBooleanInputCheckedTransition={properties.formBooleanInputCheckedTransition}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{scopeType === ScopeType.LayoutTemplate && properties.onlyNodesWithViewTransitionNone && (\n\t\t\t\t\t\t\t\t<ViewTransitionNoneRow\n\t\t\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\t\t\tviewTransitionNone={properties.viewTransitionNone}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{properties.onlyNodesWithTextSelection && (\n\t\t\t\t\t\t\t\t<TextSelectionRow textSelection={properties.textSelection} nodeIds={properties.allNodeIds} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Panel>\n\t\t\t\t\t)}\n\t\t\t\t{properties.anyNodesWithTransforms && properties.onlyGroundNodeDescendants && (\n\t\t\t\t\t<TransformsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tscale={properties.scale}\n\t\t\t\t\t\trotateX={properties.rotateX}\n\t\t\t\t\t\trotateY={properties.rotateY}\n\t\t\t\t\t\trotate3d={properties.rotate3d}\n\t\t\t\t\t\tskewX={properties.skewX}\n\t\t\t\t\t\tskewY={properties.skewY}\n\t\t\t\t\t\ttranslateZ={properties.translateZ}\n\t\t\t\t\t\tperspective={properties.perspective}\n\t\t\t\t\t\trotation={properties.rotation}\n\t\t\t\t\t\ttransformOriginX={properties.transformOriginX}\n\t\t\t\t\t\ttransformOriginY={properties.transformOriginY}\n\t\t\t\t\t\tbackfaceVisibility={properties.backfaceVisibility}\n\t\t\t\t\t\ttransformStylePreserve3d={properties.transformStylePreserve3d}\n\t\t\t\t\t\tonlyNodesWithTransformOrigin={properties.onlyNodesWithTransformOrigin}\n\t\t\t\t\t\tonlyNodesWithRotation={properties.onlyNodesWithRotation}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<StrokePanel\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\tstrokeEnabled={properties.strokeEnabled}\n\t\t\t\t\tstrokeAlignmentValues={properties.strokeAlignmentValues}\n\t\t\t\t\tstrokeWidth={properties.strokeWidth}\n\t\t\t\t\tstrokeColor={properties.strokeColor}\n\t\t\t\t\tlineJoin={properties.lineJoin}\n\t\t\t\t\tlineCap={properties.lineCap}\n\t\t\t\t\tstrokeDashArray={properties.strokeDashArray}\n\t\t\t\t\tstrokeDashOffset={properties.strokeDashOffset}\n\t\t\t\t/>\n\t\t\t\t{properties.onlyNodesWithFormVariants && (\n\t\t\t\t\t<FormVariantsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\tcodeComponentIdentifiers={properties.codeComponentIdentifiers}\n\t\t\t\t\t\tonlyNodesWithFormVariants={false}\n\t\t\t\t\t\tformButtonSuccessVariant={properties.formButtonSuccessVariant}\n\t\t\t\t\t\tformButtonPendingVariant={properties.formButtonPendingVariant}\n\t\t\t\t\t\tformButtonErrorVariant={properties.formButtonErrorVariant}\n\t\t\t\t\t\tformButtonIncompleteVariant={properties.formButtonIncompleteVariant}\n\t\t\t\t\t\tformButtonSuccessVariantEnabled={properties.formButtonSuccessVariantEnabled}\n\t\t\t\t\t\tformButtonPendingVariantEnabled={properties.formButtonPendingVariantEnabled}\n\t\t\t\t\t\tformButtonErrorVariantEnabled={properties.formButtonErrorVariantEnabled}\n\t\t\t\t\t\tformButtonIncompleteVariantEnabled={properties.formButtonIncompleteVariantEnabled}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.onlyNodesWithDataLoaderVariants && (\n\t\t\t\t\t<DataLoaderVariantsPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\tcodeComponentIdentifiers={properties.codeComponentIdentifiers}\n\t\t\t\t\t\tdataLoaderDisabledVariant={properties.dataLoaderDisabledVariant}\n\t\t\t\t\t\tdataLoaderLoadingVariant={properties.dataLoaderLoadingVariant}\n\t\t\t\t\t\tdataLoaderDisabledVariantEnabled={properties.dataLoaderDisabledVariantEnabled}\n\t\t\t\t\t\tdataLoaderLoadingVariantEnabled={properties.dataLoaderLoadingVariantEnabled}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.onlyCodeComponentNodes && properties.controlPropsWithIdentifier && (\n\t\t\t\t\t<CodeComponentControlPropsPanel\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tcodeComponentIdentifier={properties.controlPropsWithIdentifier.identifier}\n\t\t\t\t\t\tcodeComponentIdentifiers={properties.codeComponentIdentifiers}\n\t\t\t\t\t\tcodeComponentControlProps={properties.controlPropsWithIdentifier.controlProps}\n\t\t\t\t\t\tanyReplicaVariantOrReplicaVariantChild={properties.anyReplicaVariantOrReplicaVariantChild}\n\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\ttriggerActions={properties.triggerActions}\n\t\t\t\t\t\tdynamicVectorSetIdentifier={properties.dynamicVectorSetIdentifier}\n\t\t\t\t\t\tsupportsComputedValues={scopeType !== ScopeType.DesignPage}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<Experiment isOn=\"shaders\">\n\t\t\t\t\t{properties.onlyShaderNodes && properties.controlPropsWithIdentifier && (\n\t\t\t\t\t\t<ShaderControlPropsPanel\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\t\tanyReplicaVariantOrReplicaVariantChild={properties.anyReplicaVariantOrReplicaVariantChild}\n\t\t\t\t\t\t\tmoduleIdentifier={properties.controlPropsWithIdentifier.identifier}\n\t\t\t\t\t\t\tshaderControlProps={properties.controlPropsWithIdentifier.controlProps}\n\t\t\t\t\t\t\thiddenBecauseUnsetControlKeys={properties.controlPropsWithIdentifier.hiddenBecauseUnsetControlKeys}\n\t\t\t\t\t\t\tsupportsComputedValues={scopeType !== ScopeType.DesignPage}\n\t\t\t\t\t\t\tshaderMouseEnabled={properties.shaderMouseEnabled}\n\t\t\t\t\t\t\tshaderMouseSpringOptions={properties.shaderMouseSpringOptions}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Experiment>\n\n\t\t\t\t{textProperties && (\n\t\t\t\t\t<TextPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tonlyRichTextNodes={properties.onlyRichTextNodes}\n\t\t\t\t\t\tonlyNodesWithHTMLContent={textProperties.onlyNodesWithHTMLContent}\n\t\t\t\t\t\tonlyInEditor={textProperties.onlyInEditor}\n\t\t\t\t\t\tanyNodeWithParagraphSpacing={textProperties.anyNodeWithParagraphSpacing}\n\t\t\t\t\t\t// Node properties\n\t\t\t\t\t\ttextContent={textProperties.textContent}\n\t\t\t\t\t\tverticalAlignment={textProperties.verticalAlignment}\n\t\t\t\t\t\tparagraphSpacing={textProperties.paragraphSpacing}\n\t\t\t\t\t\tfills={textProperties.fills}\n\t\t\t\t\t\ttextTruncation={properties.textTruncation}\n\t\t\t\t\t\t// Style presets\n\t\t\t\t\t\ttextStylePresets={textProperties.textStylePresets}\n\t\t\t\t\t\tassignedTextStylePresets={textProperties.assignedTextStylePresets}\n\t\t\t\t\t\tlinkStylePresets={textProperties.linkStylePresets}\n\t\t\t\t\t\thasAssignedLinkStylePreset={textProperties.hasAssignedLinkStylePreset}\n\t\t\t\t\t\tblockquoteStylePresets={textProperties.blockquoteStylePresets}\n\t\t\t\t\t\thasAssignedBlockquoteStylePreset={textProperties.hasAssignedBlockquoteStylePreset}\n\t\t\t\t\t\ttableStylePresets={textProperties.tableStylePresets}\n\t\t\t\t\t\thasAssignedTableStylePreset={textProperties.hasAssignedTableStylePreset}\n\t\t\t\t\t\tinlineCodeStylePresets={textProperties.inlineCodeStylePresets}\n\t\t\t\t\t\thasAssignedInlineCodeStylePreset={textProperties.hasAssignedInlineCodeStylePreset}\n\t\t\t\t\t\tanchorLinkStylePresets={textProperties.anchorLinkStylePresets}\n\t\t\t\t\t\thasAssignedAnchorLinkStylePreset={textProperties.hasAssignedAnchorLinkStylePreset}\n\t\t\t\t\t\tanchorLinkOffsetY={textProperties.anchorLinkOffsetY}\n\t\t\t\t\t\t// Text style\n\t\t\t\t\t\tfonts={textProperties.fonts}\n\t\t\t\t\t\ttextColor={textProperties.textColor}\n\t\t\t\t\t\ttextBackgroundColor={textProperties.textBackgroundColor}\n\t\t\t\t\t\ttextBackgroundRadius={textProperties.textBackgroundRadius}\n\t\t\t\t\t\ttextBackgroundCornerShape={textProperties.textBackgroundCornerShape}\n\t\t\t\t\t\ttextBackgroundPadding={textProperties.textBackgroundPadding}\n\t\t\t\t\t\tfontSize={textProperties.fontSize}\n\t\t\t\t\t\tfontSizeUnits={textProperties.fontSizeUnits}\n\t\t\t\t\t\tletterSpacingValue={textProperties.letterSpacingValue}\n\t\t\t\t\t\tletterSpacingUnits={textProperties.letterSpacingUnits}\n\t\t\t\t\t\ttextTransforms={textProperties.textTransforms}\n\t\t\t\t\t\ttextDecoration={textProperties.textDecoration}\n\t\t\t\t\t\ttextDecorationStyle={textProperties.textDecorationStyle}\n\t\t\t\t\t\ttextDecorationColor={textProperties.textDecorationColor}\n\t\t\t\t\t\ttextDecorationThickness={textProperties.textDecorationThickness}\n\t\t\t\t\t\ttextDecorationOffset={textProperties.textDecorationOffset}\n\t\t\t\t\t\ttextDecorationSkipInk={textProperties.textDecorationSkipInk}\n\t\t\t\t\t\tlineHeightValue={textProperties.lineHeightValue}\n\t\t\t\t\t\tlineHeightUnits={textProperties.lineHeightUnits}\n\t\t\t\t\t\ttextAlignment={textProperties.textAlignment}\n\t\t\t\t\t\ttextFitScale={textProperties.textFitScale}\n\t\t\t\t\t\ttextStrokeColor={textProperties.textStrokeColor}\n\t\t\t\t\t\ttextStrokeWidth={textProperties.textStrokeWidth}\n\t\t\t\t\t\topenTypeFontFeatures={textProperties.openTypeFontFeatures}\n\t\t\t\t\t\tvariationAxes={textProperties.variationAxes}\n\t\t\t\t\t\t// Shadows\n\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\tanyNodesWithShadows={properties.anyNodesWithShadows}\n\t\t\t\t\t\tshadows={properties.shadows}\n\t\t\t\t\t\tonlyNodesSupportingShadowSpread={properties.onlyNodesSupportingShadowSpread}\n\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={properties.onlyNodesSupportingRealisticShadows}\n\t\t\t\t\t\tonlyNodesSupportingShadowInset={properties.onlyNodesSupportingShadowInset}\n\t\t\t\t\t\tonlyNodesWithTextFit={textProperties.onlyNodesWithTextFit}\n\t\t\t\t\t\ttextWrapBalance={textProperties.textWrapBalance}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{properties.selectionColorProperties.size > 0 && (\n\t\t\t\t\t<SelectionPropertiesPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tselectionColorProperties={properties.selectionColorProperties}\n\t\t\t\t\t\tselectionHash={properties.selectionHash}\n\t\t\t\t\t\tonlyTextNodes={Boolean(textProperties)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{textProperties && properties.onlyRichTextNodes && textProperties.onlyNodesWithHTMLContent && (\n\t\t\t\t\t<EmbedPresetPanel nodeIds={properties.allNodeIds} />\n\t\t\t\t)}\n\t\t\t\t{properties.onlyGroundNodeDescendants &&\n\t\t\t\t\tproperties.onlyNodesWithScrollTarget &&\n\t\t\t\t\t(scopeType === ScopeType.WebPage ||\n\t\t\t\t\t\t(scopeType === ScopeType.DesignPage && experiments.isOn(\"effectsInDesignPages\"))) && (\n\t\t\t\t\t\t<ScrollTargetPanel\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\telementId={properties.elementId}\n\t\t\t\t\t\t\tscrollMarginTop={properties.scrollMarginTop}\n\t\t\t\t\t\t\tscrollTargetEnabled={properties.scrollTargetEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t{scopeTypeSupportsA11yFeatures(scopeType) &&\n\t\t\t\t!properties.anyBreakpointNode &&\n\t\t\t\t!properties.anyFormContainerNodes &&\n\t\t\t\tproperties.anyNodesWithA11ySupport ? (\n\t\t\t\t\t<AccessibilityPanel\n\t\t\t\t\t\tanyNodesWithLinks={properties.anyNodesWithLinks}\n\t\t\t\t\t\tariaLabel={properties.ariaLabel}\n\t\t\t\t\t\tdescription={properties.description}\n\t\t\t\t\t\thtmlTags={properties.htmlTags}\n\t\t\t\t\t\thtmlTextTags={properties.htmlTextTags}\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\tonlyNodesWithAriaLabel={properties.onlyNodesWithAriaLabel}\n\t\t\t\t\t\tonlyNodesWithFillImage={properties.onlyNodesWithFillImage}\n\t\t\t\t\t\tonlyNodesWithHTMLTag={properties.onlyNodesWithHTMLTag}\n\t\t\t\t\t\tonlyNodesWithLinks={properties.onlyNodesWithLinks}\n\t\t\t\t\t\tonlyNodesWithFormButton={properties.onlyNodesWithFormButton}\n\t\t\t\t\t\tonlyNodesWithFormAncestor={properties.onlyNodesWithFormAncestor}\n\t\t\t\t\t\tonlyNodesWithTabIndex={properties.onlyNodesWithTabIndex}\n\t\t\t\t\t\tonlyNodesWithTitleAndDescription={properties.onlyNodesWithTitleAndDescription}\n\t\t\t\t\t\tonlyNodesWithListParents={properties.onlyNodesWithListParents}\n\t\t\t\t\t\tonlyRichTextNodes={properties.onlyRichTextNodes}\n\t\t\t\t\t\tonlyNodesWithDataNosnippet={properties.onlyNodesWithDataNosnippet}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\ttabIndex={properties.tabIndex}\n\t\t\t\t\t\tdataNosnippet={properties.dataNosnippet}\n\t\t\t\t\t\ttitle={properties.title}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t\t<Experiment isNotOn=\"overridesWithPropertyControls\">\n\t\t\t\t\t{showCodeOverridePanel && (\n\t\t\t\t\t\t<OverridePanel\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tcodeOverrideEnabled={properties.codeOverrideEnabled}\n\t\t\t\t\t\t\tcodeOverrideBareModuleIdentifiers={properties.codeOverrideBareModuleIdentifiers}\n\t\t\t\t\t\t\tcodeOverrideModuleExportNames={properties.codeOverrideModuleExportNames}\n\t\t\t\t\t\t\tallNodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tcomponentHash={this.props.componentHash}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</Experiment>\n\t\t\t</InputHashContext.Provider>\n\t\t)\n\t}\n\n\trenderDefaultDesignProperties(properties: Properties) {\n\t\tconst { nodes, selection, readOnly } = this.props\n\n\t\tif (properties.onlyNodesWithBackdrop) return this.renderEditorOverlayProperties(properties)\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{this.renderEditorDesignProperties(properties)}\n\t\t\t\t<ReadOnlyContext.Provider value={false}>\n\t\t\t\t\t{ImageExporter.isAvailable && (\n\t\t\t\t\t\t<ExportPanel\n\t\t\t\t\t\t\tnodes={nodes}\n\t\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\t\tisViewOnly={readOnly}\n\t\t\t\t\t\t\tselectionHash={properties.selectionHash}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{engine.stores.persistedUserDefaults.showHandoff && <CodeExportPanel nodes={nodes} isViewOnly={readOnly} />}\n\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t</>\n\t\t)\n\t}\n\n\toverride render() {\n\t\tconst { tool, displayGrids, allNodesShareVariableContext, readOnly, scopeType } = this.props\n\n\t\tif (!allNodesShareVariableContext) return null\n\n\t\tconst properties = reduceProperties(\n\t\t\tengine.tree,\n\t\t\tengine.stores.treeStore.getDataTreeOrPartialTree(),\n\t\t\tengine.componentLoader,\n\t\t\tthis.props.nodes,\n\t\t\tscopeType,\n\t\t\tdisplayGrids,\n\t\t\tengine.stores.modulesStore,\n\t\t)\n\n\t\treturn (\n\t\t\t<ScrollWithOffsetRestoration\n\t\t\t\trestorationID={properties.selectionHash}\n\t\t\t\trestorationCache={scrollOffsetRestorationCache}\n\t\t\t\tstyle={scrollStyle}\n\t\t\t>\n\t\t\t\t<ReadOnlyContext.Provider value={readOnly}>\n\t\t\t\t\t<SupportedVariablePropertiesProvider value={properties.propertiesSupportingVariables}>\n\t\t\t\t\t\t<ComputedValuesSupportedProvider value={scopeType !== ScopeType.VectorSet}>\n\t\t\t\t\t\t\t<VariantOverrideContextProvider\n\t\t\t\t\t\t\t\tvariantOverrideKeys={properties.variantOverrideKeys}\n\t\t\t\t\t\t\t\tvariantOverrideTraitTypes={properties.variantOverrideTraitTypes}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{tool === Tools.Path ? (\n\t\t\t\t\t\t\t\t\t<PathProperties properties={properties} readOnly={readOnly} scopeType={scopeType} />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\tthis.renderDefaultDesignProperties(properties)\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</VariantOverrideContextProvider>\n\t\t\t\t\t\t</ComputedValuesSupportedProvider>\n\t\t\t\t\t</SupportedVariablePropertiesProvider>\n\t\t\t\t</ReadOnlyContext.Provider>\n\t\t\t</ScrollWithOffsetRestoration>\n\t\t)\n\t}\n}\n\n// Styles\n\nconst scrollStyle: React.CSSProperties = {\n\tpadding: `0 ${dimensions.css.panelPadding} ${dimensions.css.panelPadding}`,\n\theight: \"100%\",\n}\n\nfunction framePanelTitle({ onlyShapeNodes, onlyShapeContainerNodes, onlyVariants }: Properties, { scopeType }: Props) {\n\tif (onlyShapeNodes) {\n\t\treturn Dictionary.Shape\n\t} else if (onlyShapeContainerNodes) {\n\t\tif (scopeType === ScopeType.VectorSet) return Dictionary.Vector\n\t\treturn Dictionary.ViewBox\n\t} else if (scopeType === ScopeType.WebPage || scopeType === ScopeType.LayoutTemplate) {\n\t\tif (onlyVariants) {\n\t\t\treturn Dictionary.Breakpoint\n\t\t}\n\t} else if (scopeType === ScopeType.CanvasPage) {\n\t\treturn Dictionary.Screen\n\t}\n\n\treturn \"Position & Size\"\n}\n", "import { InputHashContext } from \"@framerjs/fresco\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport type { ReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport {\n\tapplyLayoutTemplate,\n\tclearCustomCursorFromGroundNode,\n\tensureAllBreakpointsAreVerticalStack,\n\tremoveFlowEffectFromBreakpoints,\n} from \"export/exportLayoutTemplates.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { LayoutTemplateSelector } from \"./LayoutTemplateSelector.tsx\"\nimport { CodeComponentControlPropsPanel } from \"./panels/CodeComponentControlPropsPanel.tsx\"\nimport { Panel } from \"./panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"./panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderMinus } from \"./panels/icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./panels/icons/IconSectionHeaderPlus.tsx\"\n\ninterface Props {\n\tscopeId: NodeID\n\tactiveLayoutTemplateId: string | undefined | null\n\tenabled: boolean\n\tcontrolPropsIdentifier: string | undefined\n\tcontrolProps: ReducedControlProps | undefined\n\tcomponentHash: string\n}\n\nexport const LayoutTemplatePropsPanel = React.memo(function LayoutTemplatePropsPanel({\n\tscopeId,\n\tactiveLayoutTemplateId,\n\tenabled,\n\tcontrolPropsIdentifier,\n\tcontrolProps,\n\tcomponentHash,\n}: Props) {\n\tconst hasLayoutTemplate = Boolean(activeLayoutTemplateId)\n\tconst onMouseDown = React.useCallback(() => {\n\t\tif (hasLayoutTemplate) {\n\t\t\tremoveLayoutTemplate(scopeId)\n\t\t} else {\n\t\t\tresetLayoutTemplate(scopeId)\n\t\t}\n\t}, [hasLayoutTemplate, scopeId])\n\n\tconst nodeIds = React.useMemo(() => [scopeId], [scopeId])\n\n\treturn (\n\t\t<InputHashContext.Provider value={scopeId}>\n\t\t\t<Panel\n\t\t\t\theader={\n\t\t\t\t\t<PanelSectionHeader title={Dictionary.Template} clickable={enabled} onMouseDown={onMouseDown}>\n\t\t\t\t\t\t{enabled && (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t\t{hasLayoutTemplate ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{hasLayoutTemplate && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<LayoutTemplateSelector\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tactiveLayoutTemplateId={activeLayoutTemplateId}\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{controlPropsIdentifier && controlPropsIdentifier === activeLayoutTemplateId && controlProps && (\n\t\t\t\t\t\t\t<CodeComponentControlPropsPanel\n\t\t\t\t\t\t\t\tinlinePanel\n\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\tscopeType={ScopeType.WebPage}\n\t\t\t\t\t\t\t\tcodeComponentIdentifier={controlPropsIdentifier}\n\t\t\t\t\t\t\t\tcodeComponentControlProps={controlProps}\n\t\t\t\t\t\t\t\tanyReplicaVariantOrReplicaVariantChild={false}\n\t\t\t\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\t\t\t\tsupportsComputedValues={false}\n\t\t\t\t\t\t\t\tsupportsVariables={false}\n\t\t\t\t\t\t\t\tdynamicVectorSetIdentifier={undefined}\n\t\t\t\t\t\t\t\ttriggerActions={undefined}\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</Panel>\n\t\t</InputHashContext.Provider>\n\t)\n})\n\nconst resetLayoutTemplate = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\tconst scope = engine.tree.get(scopeId)\n\tif (!scope || !isWebPageNode(scope) || !scope.isLoaded()) return\n\n\tassert(scope.isLoaded(), \"Scope must be loaded to reset layout template.\")\n\n\tconst rootLayoutTemplate = engine.tree.root.layoutTemplateIdentifier\n\t// If there's already a layout template applied on the home page (root), set the value back to undefined, so it would inherit the root value.\n\tif (rootLayoutTemplate) {\n\t\tscope.set({ layoutTemplateIdentifier: undefined })\n\t\tensureAllBreakpointsAreVerticalStack(engine.tree, scope)\n\t\tclearCustomCursorFromGroundNode(engine.tree, scope)\n\t\tremoveFlowEffectFromBreakpoints(engine.tree, scope)\n\t\treturn\n\t}\n\n\t// Otherwise, apply the first available template.\n\tengine.tree.beginAllowPartialScopeAccess()\n\tconst firstAvailableLayoutTemplate = engine.tree.root.find(child => isLayoutTemplateNode(child))\n\tengine.tree.endAllowPartialScopeAccess()\n\n\tif (firstAvailableLayoutTemplate) {\n\t\tvoid applyLayoutTemplate(engine, scope, firstAvailableLayoutTemplate).catch(unhandledError)\n\t\treturn\n\t}\n\n\t// If there's no layout template, prompt to create one.\n\tengine.stores.modalStore.push({\n\t\ttype: ModalType.CreateLayoutTemplate,\n\t\tsource: \"properties\",\n\t\twebPage: scope,\n\t\tonConfirm: async (name: string) => {\n\t\t\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\t\t\tvoid applyLayoutTemplate(engine, scope, () =>\n\t\t\t\tContextAction.createLayoutTemplate(engine.tree, \"properties\", name),\n\t\t\t).catch(unhandledError)\n\t\t},\n\t})\n})\n\nconst removeLayoutTemplate = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\tconst scope = engine.tree.get(scopeId)\n\tif (!scope || !withLayoutTemplate(scope)) return\n\tif (scope.id === engine.tree.root.homePageNodeId) {\n\t\tengine.tree.root.set({ layoutTemplateIdentifier: undefined })\n\t\t// Technically home page cannot have layout template override, but we reset it just in case.\n\t\tscope.set({ layoutTemplateIdentifier: undefined })\n\t\trecord(\"layout_template_unapply\", { onHomePage: true })\n\t} else {\n\t\tscope.set({ layoutTemplateIdentifier: null })\n\t\trecord(\"layout_template_unapply\", { onHomePage: false })\n\t}\n})\n", "import { isErrorDefinition, type ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { IconAlert, PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport {\n\terrorIdentifierFromModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PanelRow } from \"./rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"./utils/doubleColumn.styles.ts\"\n\nfunction selectTemplate(scopeId: NodeID, identifier: string) {\n\tif (!isLocalModuleIdentifier(identifier) || !isModuleExportIdentifier(identifier)) return\n\n\tconst scope = engine.tree.get(scopeId)\n\tif (!withLayoutTemplate(scope)) return\n\n\tengine.scheduler.process(() => {\n\t\tif (scope.id === engine.tree.root.homePageNodeId) {\n\t\t\tengine.tree.root.set({ layoutTemplateIdentifier: identifier })\n\t\t\trecord(\"layout_template_apply\", { onHomePage: true })\n\t\t} else {\n\t\t\tscope.set({ layoutTemplateIdentifier: identifier })\n\t\t\trecord(\"layout_template_apply\", { onHomePage: false })\n\t\t}\n\t})\n}\n\n// `errorForIdentifier` fabricates \"does not exist\" errors for local modules that have not been evaluated yet.\n// Layout templates are local modules, so validate them against the tree before showing the selector warning state.\nfunction layoutTemplateSelectorHasWarning(\n\tcomponentLoader: ComponentLoader,\n\ttree: CanvasTree,\n\tactiveLayoutTemplateId: string | undefined | null,\n): boolean {\n\tif (!activeLayoutTemplateId) return false\n\n\tconst parsedIdentifier = parseModuleIdentifier(activeLayoutTemplateId)\n\tif (!isLocalModuleIdentifier(parsedIdentifier)) {\n\t\treturn componentLoader.errorForIdentifier(activeLayoutTemplateId) !== null\n\t}\n\n\tconst errorIdentifier = errorIdentifierFromModuleIdentifier(parsedIdentifier)\n\tif (isErrorDefinition(componentLoader.componentForIdentifier(errorIdentifier))) return true\n\n\t// Local layout template modules can be missing from the component loader while lazy evaluation is still running.\n\tconst layoutTemplateNode = tree.getNodeWithTrait(parsedIdentifier.localIdName, isLayoutTemplateNode)\n\tif (layoutTemplateNode) return false\n\n\treturn true\n}\n\ninterface Props {\n\tscopeId: NodeID\n\tactiveLayoutTemplateId: string | undefined | null\n\tenabled: boolean\n}\n\nexport const LayoutTemplateSelector = React.memo(function LayoutTemplateSelector({\n\tscopeId,\n\tactiveLayoutTemplateId,\n\tenabled,\n}: Props) {\n\tconst localLayoutTemplatesNameByIdentifier = useEngineState(\n\t\t() => engine.stores.treeStore.getPartialIndexes().localLayoutTemplatesNameByIdentifier,\n\t\t[],\n\t\tEngineChange.LocalLayoutTemplates,\n\t)\n\tconst onSelect = (identifier: string) => selectTemplate(scopeId, identifier)\n\n\tconst hasError = useEngineState(\n\t\t() => layoutTemplateSelectorHasWarning(engine.componentLoader, engine.tree, activeLayoutTemplateId),\n\t\t[activeLayoutTemplateId],\n\t\tEngineChange.ActiveBundle,\n\t)\n\n\tfunction renderRows() {\n\t\tconst rows: React.ReactNode[] = []\n\t\tfor (const identifier in localLayoutTemplatesNameByIdentifier) {\n\t\t\tif (!isLocalModuleIdentifier(identifier) || !isModuleExportIdentifier(identifier)) continue\n\t\t\tconst name = localLayoutTemplatesNameByIdentifier[identifier] ?? Dictionary.Template\n\t\t\trows.push(\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\tkey={identifier}\n\t\t\t\t\tidentifier={identifier}\n\t\t\t\t\ttitle={name}\n\t\t\t\t\tselected={identifier === activeLayoutTemplateId}\n\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\t\treturn rows\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Layout}>\n\t\t\t<PopupButton\n\t\t\t\tenabled={enabled}\n\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\thasWarning={hasError}\n\t\t\t\tpreview={hasError ? <IconAlert /> : undefined}\n\t\t\t>\n\t\t\t\t{renderRows()}\n\t\t\t</PopupButton>\n\t\t</PanelRow>\n\t)\n})\n", "import type { ReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport { useReadOnly } from \"@framerjs/fresco\"\nimport { assert, type ModuleExportIdentifierString, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { CodeComponentNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { moduleIdentifierToLocalComponentId } from \"document/models/CanvasTree/nodes/utils/moduleIdentifierToLocalComponentId.ts\"\nimport { isSmartComponentNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tcreateTriggerActionWithDefaultTrigger,\n\thasTriggerActions,\n\twithTriggerActions,\n} from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTriggerActions } from \"document/models/CanvasTree/traits/utils/reduceTriggerActions.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProp } from \"document/models/controlProps/getControlProps.ts\"\nimport type { ReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useControlHiddenState } from \"document/useControlHiddenState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { showAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { showTriggerUpsell } from \"../../shared/UpsellModal/utils/triggerUpsellModals.ts\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { VectorSetItemRow, useVectorSetInfo } from \"../codeComponentRows/VectorSetItemControlPropRow.tsx\"\nimport { controlPropRowNeedsHiddenState } from \"../codeComponentRows/utils/controlPropRowNeedsHiddenState.ts\"\nimport { shouldHideControlRow } from \"../codeComponentRows/utils/shouldHideControlRow.ts\"\nimport { useCodeComponentEditRow } from \"../rows/CodeComponentEditRow.tsx\"\nimport { useSelectedNodeVariants } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderSubtitle } from \"./PanelSectionHeaderSubtitle.tsx\"\nimport { TriggerActionRows, triggerActionPopoutId } from \"./TriggerActionsPanel.tsx\"\nimport { getControlIcons } from \"./utils/getControlIcons.ts\"\nimport { PanelElementId } from \"./utils/highlightPanel.ts\"\nimport { useControlUploadHandler } from \"./utils/useControlUploadHandler.ts\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\tcodeComponentIdentifier: string\n\tdynamicVectorSetIdentifier: Reduced<VariableReference | undefined>\n\tcodeComponentIdentifiers?: Set<ModuleExportIdentifierString>\n\tcodeComponentControlProps: ReducedControlProps\n\tanyReplicaVariantOrReplicaVariantChild: boolean\n\t// The component hash isn\u2019t really used, we added it to break memoization.\n\tcomponentHash: string\n\t/** Whether to render it as an individual panel, or inline it in other panels. Defaults to false. */\n\tinlinePanel?: boolean\n\t/** Whether to allow computed values. Defaults to true. */\n\tsupportsComputedValues?: boolean\n\t/** Whether to allow variables. Defaults to true. */\n\tsupportsVariables?: boolean\n\ttriggerActions: ReducedTriggerActions[\"triggerActions\"]\n}\n\nexport const CodeComponentControlPropsPanel = React.memo(function CodeComponentControlPropsPanel({\n\tnodeIds,\n\tscopeType,\n\tcodeComponentIdentifier,\n\tcodeComponentIdentifiers,\n\tdynamicVectorSetIdentifier,\n\tcodeComponentControlProps,\n\tanyReplicaVariantOrReplicaVariantChild,\n\tcomponentHash,\n\ttriggerActions,\n\tinlinePanel = false,\n\tsupportsVariables = true,\n\tsupportsComputedValues = true,\n}: Props) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst readOnly = useReadOnly()\n\tconst component = engine.componentLoader.reactComponentForIdentifier(codeComponentIdentifier)\n\n\tconst changeHandler = useEngineCallback(\n\t\t(controlKey: string, getUpdate: (controlProp: ControlProp) => ControlProp, nodesToUpdate: NodeID[]) => {\n\t\t\t// If we become read only while editing, just ignore the change. This can often happen\n\t\t\t// if we get the change event from a blur event. And the blur event because the user got\n\t\t\t// disconnected, or lost editing permissions.\n\t\t\tif (engine.tree.isViewOnly) return\n\n\t\t\tassert(component)\n\t\t\tengine.setEditReason(\"component_property\")\n\t\t\tconst nodes = engine.tree.getNodes<CodeComponentNode>(nodesToUpdate)\n\t\t\tconst control = component.properties[controlKey]\n\t\t\tassert(control)\n\n\t\t\tconst defaultValue = getControlProp(control, undefined)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tconst currentControlProp = getControlProp(control, node.getRawControlProp(controlKey))\n\t\t\t\tassert(currentControlProp)\n\t\t\t\tconst updatedControlProp = getUpdate(currentControlProp)\n\n\t\t\t\t// For web page nodes, we try to clear the control so that it would start inherit the default changes\n\t\t\t\t// from within the layout template again.\n\t\t\t\tif (isWebPageNode(node) && isEqual(defaultValue, updatedControlProp)) {\n\t\t\t\t\tnode.setControlProp(controlKey, undefined)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnode.setControlProp(controlKey, updatedControlProp)\n\t\t\t}\n\t\t},\n\t\t[component, engine],\n\t)\n\n\tconst uploadHandler = useControlUploadHandler(changeHandler, nodeIds)\n\n\tconst hiddenState = useControlHiddenState(nodeIds)\n\n\tconst vectorSetInfo = useVectorSetInfo(codeComponentIdentifier)\n\tconst isVector = Boolean(vectorSetInfo)\n\n\tconst enumControlKeyToControlReferenceInfo = useEnumControlKeyToControlReferenceInfo(\n\t\tcodeComponentIdentifier,\n\t\tcomponent,\n\t)\n\n\tconst editButtonRow = useCodeComponentEditRow(nodeIds, codeComponentIdentifier, vectorSetInfo)\n\n\tif (!component) return null\n\n\tconst rows: JSX.Element[] = []\n\n\t// A Vector module supports a special control that allows selecting the Item from the Set,\n\t// changing the identifier.\n\tconst key = vectorSetInfo?.moduleId ?? codeComponentIdentifier\n\tif (isVector && codeComponentIdentifiers && isModuleExportIdentifier(codeComponentIdentifier)) {\n\t\trows.push(\n\t\t\t<VectorSetItemRow\n\t\t\t\tkey=\"vectorSet\"\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tcodeComponentIdentifier={codeComponentIdentifier}\n\t\t\t\tdynamicVectorSetIdentifier={dynamicVectorSetIdentifier}\n\t\t\t\tactiveIdentifiers={codeComponentIdentifiers}\n\t\t\t/>,\n\t\t)\n\t}\n\n\tconst hasDynamicVectorInstance = isVector && Boolean(dynamicVectorSetIdentifier)\n\n\tfor (const controlKey in component.properties) {\n\t\tconst control = component.properties[controlKey]\n\t\tassert(control)\n\t\tconst reducedControlProp = codeComponentControlProps[controlKey]\n\t\tif (!reducedControlProp) continue\n\n\t\t// Component instances are not supported by variants\n\t\tif (anyReplicaVariantOrReplicaVariantChild && control.type === ControlType.Slot) continue\n\n\t\tif (shouldHideControlRow(control, controlKey, nodeIds, hasDynamicVectorInstance, hiddenState)) continue\n\n\t\tconst enumControlReferenceInfo = enumControlKeyToControlReferenceInfo.get(controlKey)\n\n\t\trows.push(\n\t\t\t<ControlPropRow\n\t\t\t\tkey={controlKey}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tcontrolKey={controlKey}\n\t\t\t\tcontrol={control}\n\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\tcontrolSourceIdentifier={enumControlReferenceInfo?.controlSourceIdentifier ?? codeComponentIdentifier}\n\t\t\t\tcontrolSourceControlKey={enumControlReferenceInfo?.controlKey ?? controlKey}\n\t\t\t\tonChange={changeHandler}\n\t\t\t\tonImageUpload={uploadHandler}\n\t\t\t\thiddenControlsByNodeId={controlPropRowNeedsHiddenState(control.type) ? hiddenState : undefined}\n\t\t\t\ticons={getControlIcons(control, codeComponentControlProps)}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tcontrolKeyIsTraitTypeKey\n\t\t\t\tsupportsVariables={supportsVariables}\n\t\t\t\tsupportsComputedValues={supportsComputedValues}\n\t\t\t/>,\n\t\t)\n\n\t\tif (controlKey === \"variant\" && control.type === ControlType.Enum) {\n\t\t\trows.push(\n\t\t\t\t<TriggerActions\n\t\t\t\t\tkey=\"triggerActions\"\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\ttriggerActions={triggerActions}\n\t\t\t\t\tcomponent={component}\n\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\tcodeComponentIdentifier={codeComponentIdentifier}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\t}\n\n\tif (inlinePanel) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{rows}\n\t\t\t\t{editButtonRow}\n\t\t\t</>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Panel\n\t\t\tkey={key}\n\t\t\tid={PanelElementId.CodeComponentPanel}\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title={vectorSetInfo?.name ?? component?.name ?? \"\"}>\n\t\t\t\t\t<PanelSectionHeaderSubtitle title={isVector ? Dictionary.Vector : Dictionary.Component} />\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{rows}\n\t\t\t{editButtonRow}\n\t\t</Panel>\n\t)\n})\n\ninterface TriggerActionRowsProps {\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\ttriggerActions: ReducedTriggerActions[\"triggerActions\"]\n\tcomponent: ReactComponentDefinition | null\n\tcomponentHash: string\n\tcodeComponentIdentifier: string\n\treadOnly: boolean\n}\nfunction TriggerActions({\n\tnodeIds,\n\tscopeType,\n\ttriggerActions,\n\tcomponent,\n\tcomponentHash,\n\tcodeComponentIdentifier,\n\treadOnly,\n}: TriggerActionRowsProps) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst variants = useSelectedNodeVariants({\n\t\tid: nodeIds[0],\n\t\tcomponentHash,\n\t\tcodeComponentIdentifiers: new Set([codeComponentIdentifier]),\n\t})\n\tconst hasVariants = variants.length > 1\n\n\tconst onAddTrigger = useEngineCallback(() => {\n\t\tconst node = engine.tree.get(nodeIds[0])\n\t\tif (!node || !withTriggerActions(node)) return\n\n\t\tif (hasVariants) {\n\t\t\tif (showTriggerUpsell(engine, \"properties\")) return\n\t\t\tif (showAnalyticsEventsUpsell(engine, \"properties\")) return\n\t\t}\n\n\t\tconst variantControlDescription = component?.properties.variant\n\t\tif (!variantControlDescription || variantControlDescription.type !== ControlType.Enum) return\n\t\tconst defaultVariant = variantControlDescription.options[0]\n\t\tif (!isString(defaultVariant)) return\n\n\t\tconst currentActions = node.triggerActions ?? []\n\t\tconst newTriggerAction = createTriggerActionWithDefaultTrigger({\n\t\t\ttype: \"setComponentVariant\",\n\t\t\tvariant: defaultVariant,\n\t\t})\n\t\tnode.set({\n\t\t\ttriggerActions: [...currentActions, newTriggerAction],\n\t\t})\n\n\t\trecord(\"trigger_actions_create\", {\n\t\t\tactionType: \"setComponentVariant\",\n\t\t\ttriggerCount: currentActions.length + 1,\n\t\t})\n\n\t\tconst popoutId = triggerActionPopoutId(newTriggerAction.id)\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(popoutId)\n\t}, [engine, nodeIds, hasVariants, component?.properties.variant])\n\n\tif (nodeIds.length > 1) return null\n\tconst node = engine.tree.get(nodeIds[0])\n\tif (!node || !withTriggerActions(node)) return null\n\tif (variants.length < 2 && !hasTriggerActions(node)) return null\n\n\treturn (\n\t\t<TriggerActionRows\n\t\t\tnodeIds={nodeIds}\n\t\t\tscopeType={scopeType}\n\t\t\ttriggerActions={triggerActions}\n\t\t\treadOnly={readOnly}\n\t\t\tonAddTrigger={onAddTrigger}\n\t\t\tvariants={variants}\n\t\t/>\n\t)\n}\n\ntype EnumControlKeyToControlReferenceInfo = Map<string, ControlReferenceInfo>\n\nfunction useEnumControlKeyToControlReferenceInfo(\n\tcodeComponentIdentifier: string,\n\tcomponent: ReactComponentDefinition | null,\n): EnumControlKeyToControlReferenceInfo {\n\tconst engine = useAndAssertVekterEngine()\n\n\treturn useEngineState(\n\t\t() => {\n\t\t\tconst result: EnumControlKeyToControlReferenceInfo = new Map()\n\t\t\tif (!component) return result\n\n\t\t\tconst localComponentId = moduleIdentifierToLocalComponentId(codeComponentIdentifier)\n\t\t\tconst smartComponentNode = localComponentId\n\t\t\t\t? engine.tree.getNodeWithTrait(localComponentId, isSmartComponentNode)\n\t\t\t\t: undefined\n\n\t\t\tfor (const controlKey in component.properties) {\n\t\t\t\tconst control = component.properties[controlKey]\n\t\t\t\tif (control?.type !== ControlType.Enum) continue\n\n\t\t\t\tconst variable = smartComponentNode?.getVariable(controlKey)\n\n\t\t\t\tif (variable?.type === \"controlReference\") {\n\t\t\t\t\tresult.set(controlKey, {\n\t\t\t\t\t\tcontrolSourceIdentifier: variable.entityIdentifier,\n\t\t\t\t\t\tcontrolKey: variable.controlKey,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result\n\t\t},\n\t\t[codeComponentIdentifier, component],\n\t\t[EngineChange.Tree],\n\t\t{ deepEqual: true },\n\t)\n}\n", "import { AddOnLicenseType, ProjectLicenseType, getAddOnLicenseTypeName, openNewTab } from \"@framerjs/app-shared\"\nimport type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { enterpriseUpsellURL } from \"utils/staticURLs.ts\"\n\n/**\n * Shows the trigger upsell modal if the user is not able to use triggers.\n * Returns true if a modal was shown, otherwise returns false.\n */\nexport function showTriggerUpsell(engine: VekterEngine, source: ModalOpenSource): boolean {\n\tassert(engine.stores.projectStore.project, \"Project should be defined\")\n\tconst { settings, license, usage } = engine.stores.projectStore.project\n\n\tconst canUseTriggers = settings.featureFlags.canUseTriggers ?? \"off\"\n\n\t// Feature is available, no upsell needed\n\tif (canUseTriggers === \"on\") {\n\t\treturn false\n\t}\n\n\t// Note: this is not possible, but we handle this here in case we\u2019ve\n\t// accidentally misconfigured license overrides for the Enterprise plan.\n\tconst isEnterprise = license.type === ProjectLicenseType.EnterpriseSite\n\tif (isEnterprise) {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\ttitle: \"Triggers\",\n\t\t\tdescription:\n\t\t\t\t\"Triggers aren\u2019t included in your current plan. Please contact your account manager to enable this feature.\",\n\t\t\tsource,\n\t\t\tconfirmLabel: Dictionary.ContactUs,\n\t\t\tcancelLabel: Dictionary.MaybeLater,\n\t\t\tonConfirm: () => openNewTab(enterpriseUpsellURL),\n\t\t})\n\t\treturn true\n\t}\n\n\tconst addOnName = getAddOnLicenseTypeName(AddOnLicenseType.AdvancedAnalytics)\n\n\t// User can buy an add-on to unlock triggers\n\tif (canUseTriggers === \"upsell\") {\n\t\tconst eventsUsage = Math.max(\n\t\t\tusage.advancedAnalytics?.currentMonth ?? 0,\n\t\t\tusage.advancedAnalytics?.previousMonth ?? 0,\n\t\t\t1,\n\t\t)\n\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.ConfirmAcquireAddOn,\n\t\t\ttitle: \"Triggers\",\n\t\t\tdescription: `Buy the ${addOnName} ${Dictionary.AddOn} to run A/B tests, add triggers and funnels, and boost your overall conversion rates.`,\n\t\t\taddonInfo: {\n\t\t\t\taddonLicenseType: AddOnLicenseType.AdvancedAnalytics,\n\t\t\t\tquantity: eventsUsage,\n\t\t\t},\n\t\t\tsource,\n\t\t})\n\t\treturn true\n\t}\n\n\t// User needs to be on a different plan\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tupsellFeature: UpsellFeature.canUseTriggers,\n\t\ttitle: \"Triggers\",\n\t\tdescription: `Upgrade and buy the ${addOnName} ${Dictionary.AddOn} to run A/B tests, add triggers and funnels, and boost conversion rates.`,\n\t\tsource,\n\t})\n\treturn true\n}\n", "import { AnnotationKey, hasAnnotation } from \"@framerjs/framer-runtime/crossorigin\"\nimport { Button, useReadOnly } from \"@framerjs/fresco\"\nimport { parseModuleIdentifier } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { isBuiltInVectorSet } from \"document/components/unlinking/utils.ts\"\nimport { isBuiltInFramerModule } from \"document/components/utils/defaultComponents.ts\"\nimport { editActionForNodes } from \"document/components/utils/editActionForNodes.ts\"\nimport {\n\tgetEditInPluginLabel,\n\tgetPluginManifestFromModuleIdentifier,\n\tshouldEditViaPlugin,\n} from \"document/components/utils/plugins.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\nimport type { VectorSetInfo } from \"utils/vectorSets.ts\"\nimport { getEditButtonTitle } from \"../panels/utils/getEditButtonTitle.ts\"\nimport { spanAllColumns } from \"../utils/FormContainerPanel.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nexport function useCodeComponentEditRow(nodeIds: NodeID[], identifier: string, vectorInfo: VectorSetInfo | undefined) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst moduleIdentifier = useMemo(() => parseModuleIdentifier(identifier), [identifier])\n\n\tconst pluginManifest = useEngineState(\n\t\t() =>\n\t\t\tgetPluginManifestFromModuleIdentifier(\n\t\t\t\tengine.stores.treeStore,\n\t\t\t\tengine.stores.modulesStore,\n\t\t\t\tengine.stores.pluginStore,\n\t\t\t\tmoduleIdentifier,\n\t\t\t),\n\t\t[moduleIdentifier],\n\t\t[EngineChange.Tree, engine.stores.pluginStore], // No ModulesStore because it's only a fallback\n\t)\n\n\tconst editViaPlugin = useMemo(() => {\n\t\tif (!pluginManifest) return false\n\t\treturn shouldEditViaPlugin(engine.stores.modulesStore, moduleIdentifier)\n\t}, [moduleIdentifier, pluginManifest])\n\n\tconst isSingleSelection = nodeIds.length === 1\n\tconst component = engine.componentLoader.componentForIdentifier(identifier)\n\tif (!component) return null\n\n\tconst isUnlinkingDisabled = hasAnnotation(component.annotations, AnnotationKey.FramerDisableUnlink)\n\n\tconst isBuiltInFramerVectorSet = vectorInfo ? isBuiltInVectorSet(vectorInfo.moduleId) : false\n\n\tconst showEditButton =\n\t\tisSingleSelection &&\n\t\tmoduleIdentifier &&\n\t\t!isUnlinkingDisabled &&\n\t\t!isBuiltInFramerVectorSet &&\n\t\t!isBuiltInFramerModule(identifier)\n\n\tif (!showEditButton) return null\n\n\tfunction handleEditClick() {\n\t\tconst editAction = editActionForNodes(engine, nodeIds, \"none\")\n\t\teditAction()\n\t}\n\n\treturn (\n\t\t<PanelRow>\n\t\t\t<Button\n\t\t\t\ttitle={\n\t\t\t\t\tpluginManifest && editViaPlugin\n\t\t\t\t\t\t? getEditInPluginLabel(pluginManifest)\n\t\t\t\t\t\t: getEditButtonTitle(engine, moduleIdentifier, isReadOnly)\n\t\t\t\t}\n\t\t\t\tonClick={handleEditClick}\n\t\t\t\tstyle={spanAllColumns}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import \"FormContainerPanel.styles_npyqm5.wyw.css\"; export const spanAllColumns = {\n  gridColumn: \"1 / -1\"\n};\nexport const upsellCopy = \"upsellCopy_u17iskix\";", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CodeComponentNode, NodeID, SmartComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tgetSmartComponentForCodeComponent,\n\tisLocalSmartComponentInstance,\n} from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\nexport interface VariantOption {\n\tid: string\n\ttitle: string\n}\n\n// Create a const empty array to be used whenever there are no variants. This\n// ensures that memoization works as expected.\nconst NO_VARIANT_OPTIONS: VariantOption[] = []\nObject.freeze(NO_VARIANT_OPTIONS)\n\nfunction localSmartComponentVariants(scope: SmartComponentNode | undefined): VariantOption[] {\n\tconst variants: VariantOption[] = []\n\n\tif (isSmartComponentNode(scope)) {\n\t\tfor (const variant of scope.getTopLevelVariants()) {\n\t\t\tvariants.push({ id: variant.id, title: variant.resolveValue(\"name\") ?? Dictionary.Variant })\n\t\t}\n\t}\n\n\tif (variants.length === 0) return NO_VARIANT_OPTIONS\n\treturn variants\n}\n\nfunction externalComponentVariant(componentLoader: ComponentLoader, node: CodeComponentNode): VariantOption[] {\n\tconst def = componentLoader.componentForIdentifier(node.codeComponentIdentifier)\n\tif (!def) return NO_VARIANT_OPTIONS\n\tconst control = def.properties.variant\n\tif (!control || !(\"options\" in control)) return NO_VARIANT_OPTIONS\n\tconst variants: VariantOption[] = []\n\n\tfor (let index = 0; index < control.options.length; index++) {\n\t\tconst id = control.options[index]?.toString()\n\t\tif (!id) continue\n\t\tconst title = control.optionTitles?.[index] ?? fallbackTitleForOption(id)\n\t\tvariants.push({ id, title: title })\n\t}\n\n\tif (variants.length === 0) return NO_VARIANT_OPTIONS\n\n\treturn variants\n}\n\n/**\n * Will return a list of variant options. But will be empty if a local smart component scope has not\n * loaded yet. Will update once the full document has loaded.\n */\nexport function useSelectedNodeVariants({\n\tid,\n\tcodeComponentIdentifiers,\n\tcomponentHash,\n}: {\n\tid: NodeID | undefined\n\tcodeComponentIdentifiers: Set<string>\n\tcomponentHash: string\n}): VariantOption[] {\n\tconst singleCodeComponent = codeComponentIdentifiers.size === 1\n\treturn useDeprecatedEngineState(\n\t\t[engine.stores.loadingStore, EngineChange.Tree],\n\t\t() => {\n\t\t\tif (!engine.stores.loadingStore.hasMinimalEditableData) return NO_VARIANT_OPTIONS\n\n\t\t\tconst node = engine.tree.get(id)\n\t\t\tif (!node || !isCodeComponentNode(node) || !singleCodeComponent) return NO_VARIANT_OPTIONS\n\n\t\t\tif (isLocalSmartComponentInstance(node)) {\n\t\t\t\tconst smartComponentScope = getSmartComponentForCodeComponent(engine.tree, node)\n\t\t\t\tif (smartComponentScope && !smartComponentScope.isLoaded()) {\n\t\t\t\t\tvoid smartComponentScope.load()\n\t\t\t\t}\n\t\t\t\treturn localSmartComponentVariants(smartComponentScope?.loaded)\n\t\t\t}\n\n\t\t\treturn externalComponentVariant(engine.componentLoader, node)\n\t\t},\n\t\t[id, singleCodeComponent, componentHash],\n\t)\n}\n\n/**\n * Given the id of a Smart Component Node, return the list of its variants in a format that the\n * <VariantSelector/> component can display. Will return an empty list if the smart component scope\n * has not loaded yet. But then also trigger it to load quickly and update once loaded.\n */\nexport function useSmartComponentVariants(id: Reduced<NodeID | undefined>): VariantOption[] {\n\tusePreloadedScope(id)\n\treturn useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => {\n\t\t\tif (!isString(id)) return NO_VARIANT_OPTIONS\n\n\t\t\tconst smartComponentNode = engine.tree.get(id)\n\t\t\tconst variants: VariantOption[] = []\n\t\t\tif (isSmartComponentNode(smartComponentNode) && smartComponentNode.isLoaded()) {\n\t\t\t\tfor (const variant of smartComponentNode.getTopLevelVariants()) {\n\t\t\t\t\tvariants.push({ id: variant.id, title: variant.resolveValue(\"name\") ?? Dictionary.Variant })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (variants.length === 0) return NO_VARIANT_OPTIONS\n\t\t\treturn variants\n\t\t},\n\t\t[id],\n\t)\n}\n", "import \"PanelSectionHeaderSubtitle.styles_u60sec.wyw.css\"; export const subtitle = \"subtitle_sxfteui\";", "import { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport * as styles from \"./PanelSectionHeaderSubtitle.styles.ts\"\n\ninterface Props extends React.HTMLAttributes<HTMLDivElement> {\n\ttitle: string\n}\n\nexport function PanelSectionHeaderSubtitle({ className, title, ...rest }: Props) {\n\treturn (\n\t\t<div className={cx(className, styles.subtitle)} {...rest}>\n\t\t\t{title}\n\t\t</div>\n\t)\n}\n", "import { IconInteraction, Scroll, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { List } from \"@framerjs/shared\"\nimport { isMixed } from \"@framerjs/shared/src/Mixed.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype TriggerAction,\n\tcreateTriggerActionWithDefaultTrigger,\n\tgetDuplicatedTriggerAction,\n\twithTriggerActions,\n} from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tNotFound,\n\ttype Reduced,\n\tisFoundAndNotMixed,\n\tisFoundAndNotUndefined,\n\tisNotFound,\n} from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTriggerActions } from \"document/models/CanvasTree/traits/utils/reduceTriggerActions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { type Trigger, getTriggerTitle } from \"library/utils/triggerActions.ts\"\nimport React, { useCallback, useRef } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { showAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { showTriggerUpsell } from \"../../shared/UpsellModal/utils/triggerUpsellModals.ts\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport type { VariantOption } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { OverlayTriggerRow, useOverlayEventKeyState } from \"./OverlayTriggerRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { TrackingIdRow } from \"./TrackingIdRow.tsx\"\nimport { TriggerConditionsPanel } from \"./TriggerConditionsPanel.tsx\"\nimport { TriggerInteractionsPanel } from \"./TriggerInteractionsPanel.tsx\"\nimport { IconAgentInteraction } from \"./icons/IconAgentInteraction.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { eventKeyToDisplayName } from \"./utils/eventKeyToDisplayName.ts\"\nimport { useCopyPasteTriggerActions } from \"./utils/useCopyPasteTriggerActions.ts\"\n\ninterface Props extends Omit<ReducedTriggerActions, \"onlyNodesWithTriggerActions\"> {\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\tselectedEventKey: Reduced<string>\n\treadOnly: boolean\n}\n\nexport const TriggerActionsPanel = React.memo(function TriggerActionsPanel({\n\tnodeIds,\n\tscopeType,\n\tselectedEventKey,\n\ttriggerActions,\n\treadOnly,\n}: Props) {\n\tconst overlayTriggerRowProps = useOverlayEventKeyState(\n\t\tisNotFound(selectedEventKey) ? \"\" : selectedEventKey,\n\t\tnodeIds,\n\t\ttrue,\n\t)\n\tconst engine = useAndAssertVekterEngine()\n\tconst addTrigger = useEngineCallback(() => {\n\t\tif (readOnly) return\n\n\t\tif (showTriggerUpsell(engine, \"properties\")) return\n\t\tif (showAnalyticsEventsUpsell(engine, \"properties\")) return\n\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\tif (nodes.length === 0) return\n\t\tconst newTriggerAction = createTriggerActionWithDefaultTrigger({ type: \"showOverlay\" })\n\t\tnodes.forEach(node => {\n\t\t\tconst currentActions = node.triggerActions ?? []\n\t\t\tnode.set({\n\t\t\t\ttriggerActions: [...currentActions, newTriggerAction],\n\t\t\t})\n\t\t\trecord(\"trigger_actions_create\", {\n\t\t\t\tactionType: \"showOverlay\",\n\t\t\t\ttriggerCount: currentActions.length + 1,\n\t\t\t})\n\t\t})\n\n\t\tconst popoutId = triggerActionPopoutId(newTriggerAction.id)\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(popoutId)\n\t}, [nodeIds, readOnly])\n\n\tconst node = engine.tree.get(nodeIds[0])\n\tconst triggerNode = engine.tree.get(node?.parentid)\n\tif (!node || !triggerNode) return null\n\tconst canAddInteraction = !isBreakpointVariant(triggerNode)\n\tconst canShowMenu = !readOnly && canAddInteraction && !isFoundAndNotUndefined(overlayTriggerRowProps.eventKey)\n\n\tconst showMenu = (event: React.MouseEvent) => {\n\t\tif (!canShowMenu) return\n\n\t\tconst overlayActions: MenuItemOptions[] = overlayTriggerRowProps.groupedEventKeys\n\t\t\t? overlayTriggerRowProps.groupedEventKeys.flatMap(group => [\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\t...group.map(eventKey => ({\n\t\t\t\t\t\tlabel: eventKeyToDisplayName(eventKey, overlayTriggerRowProps.displayNameMap, true),\n\t\t\t\t\t\tvisible: canAddInteraction,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tif (isNotFound(overlayTriggerRowProps.eventKey) || isMixed(overlayTriggerRowProps.eventKey)) {\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\toverlayTriggerRowProps.handleChangeEventKey(\n\t\t\t\t\t\t\t\toverlayTriggerRowProps.triggerNodeId,\n\t\t\t\t\t\t\t\toverlayTriggerRowProps.eventKey,\n\t\t\t\t\t\t\t\teventKey,\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\n\t\tengine.stores.contextMenuStore.show(overlayActions, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\tif (nodeIds.length !== 1) return null\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title=\"Show On\" clickable={canShowMenu} onClick={showMenu}>\n\t\t\t\t\t{canShowMenu && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t<OverlayTriggerRow {...overlayTriggerRowProps} />\n\t\t\t<TriggerActionRows\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\ttriggerActions={triggerActions}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tonAddTrigger={addTrigger}\n\t\t\t/>\n\t\t</Panel>\n\t)\n})\n\nexport interface TriggerActionRowProps {\n\tindex: number\n\tnodeId: NodeID\n\tscopeType: ScopeType\n\ttriggerAction: TriggerAction\n\thasMultipleTriggerActions: boolean\n\tonAddTriggerAction: () => void\n\tonRemoveTriggerAction: (id?: string) => void\n\tonChangeTriggerAction: (newTriggerAction: TriggerAction) => void\n\tonDuplicateTriggerAction: (triggerAction: TriggerAction, index: number) => void\n\tcanPasteTriggerActions: () => Promise<boolean>\n\tcanCopyTriggerActions: () => boolean\n\tcopyTriggerAction: (index: number) => void\n\tcopyAllTriggerActions: () => void\n\tpasteTriggerActions: (index?: number) => Promise<void>\n\tpasteAllTitle: () => Promise<string>\n\tvariants?: VariantOption[]\n\treadOnly: boolean\n}\n\nexport interface TriggerConditionRowProps<\n\tT extends keyof Pick<Trigger, \"cookies\" | \"urlParams\" | \"pageCount\" | \"includeRoutes\" | \"excludeRoutes\" | \"schedule\">,\n> {\n\tvalue: Exclude<Trigger[T], undefined>\n\tonChange: (value: Trigger[T] | undefined) => void\n\treadOnly: boolean\n}\n\nexport const triggerActionPopoutId = (id: string) => `triggerActionPopout-${id}`\n\ninterface TriggerActionRowsProps extends Omit<Props, \"selectedEventKey\"> {\n\tonAddTrigger: () => void\n\tvariants?: VariantOption[]\n}\nexport function TriggerActionRows({\n\tnodeIds,\n\tscopeType,\n\ttriggerActions,\n\treadOnly,\n\tvariants,\n\tonAddTrigger,\n}: TriggerActionRowsProps) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst onRemoveTriggerAction = useEngineCallback(\n\t\t(triggerActionId?: string) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\t\tif (nodes.length === 0) return\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst currentActions = node.triggerActions ?? []\n\t\t\t\tconst currentActionType = currentActions.find(action => action.id === triggerActionId)?.action.type\n\t\t\t\tnode.set({\n\t\t\t\t\ttriggerActions: triggerActionId ? currentActions.filter(action => action.id !== triggerActionId) : [],\n\t\t\t\t})\n\n\t\t\t\tif (currentActionType) {\n\t\t\t\t\trecord(\"trigger_actions_delete\", {\n\t\t\t\t\t\tactionType: currentActionType,\n\t\t\t\t\t\ttriggerCount: currentActions.length - 1,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst onChangeTriggerAction = useEngineCallback(\n\t\t(newTriggerAction: TriggerAction) => {\n\t\t\tif (readOnly) return\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tconst currentActions = node?.triggerActions ?? []\n\t\t\t\tconst index = currentActions.findIndex(action => action.id === newTriggerAction.id)\n\t\t\t\tif (index === -1) continue\n\n\t\t\t\tnode.set({\n\t\t\t\t\ttriggerActions: [...currentActions.slice(0, index), newTriggerAction, ...currentActions.slice(index + 1)],\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds, readOnly],\n\t)\n\n\tconst onDuplicateTriggerAction = useEngineCallback(\n\t\t(triggerAction: TriggerAction, index: number) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tnode.set({\n\t\t\t\t\ttriggerActions: List.insert(\n\t\t\t\t\t\tnode.triggerActions ?? [],\n\t\t\t\t\t\tindex,\n\t\t\t\t\t\tgetDuplicatedTriggerAction(engine, node, triggerAction),\n\t\t\t\t\t) as TriggerAction[],\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\tconst {\n\t\tcanPasteTriggerActions,\n\t\tpasteTriggerActions,\n\t\tcanCopyTriggerActions,\n\t\tcopyAllTriggerActions,\n\t\tcopyTriggerAction,\n\t\tclipboardItemsLength,\n\t} = useCopyPasteTriggerActions(nodeIds)\n\n\tif (nodeIds.length > 1) return null\n\tconst node = engine.tree.get(nodeIds[0])\n\tif (!node || !withTriggerActions(node)) return null\n\tif (!isFoundAndNotMixed(triggerActions)) return null\n\n\tconst pasteAllTitle = async () => ((await clipboardItemsLength()) > 1 ? Dictionary.PasteAll : Dictionary.Paste)\n\n\treturn (\n\t\t<>\n\t\t\t{triggerActions?.map((triggerAction, index) => (\n\t\t\t\t<TriggerActionRow\n\t\t\t\t\tkey={triggerAction.id}\n\t\t\t\t\tindex={index}\n\t\t\t\t\thasMultipleTriggerActions={triggerActions?.length > 1}\n\t\t\t\t\tnodeId={node.id}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\t\tonAddTriggerAction={onAddTrigger}\n\t\t\t\t\tonRemoveTriggerAction={onRemoveTriggerAction}\n\t\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\t\tonDuplicateTriggerAction={onDuplicateTriggerAction}\n\t\t\t\t\tcanPasteTriggerActions={canPasteTriggerActions}\n\t\t\t\t\tcanCopyTriggerActions={canCopyTriggerActions}\n\t\t\t\t\tcopyTriggerAction={copyTriggerAction}\n\t\t\t\t\tcopyAllTriggerActions={copyAllTriggerActions}\n\t\t\t\t\tpasteTriggerActions={pasteTriggerActions}\n\t\t\t\t\tpasteAllTitle={pasteAllTitle}\n\t\t\t\t\tvariants={variants}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t{!readOnly && (\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle={triggerActions?.length ? \" \" : Dictionary.Trigger}\n\t\t\t\t\tcopyEnabled={triggerActions && triggerActions.length > 1 ? canCopyTriggerActions : undefined}\n\t\t\t\t\tonCopy={triggerActions && triggerActions.length > 1 ? copyAllTriggerActions : undefined}\n\t\t\t\t\tcopyTitle={Dictionary.CopyAll}\n\t\t\t\t\tpasteEnabled={canPasteTriggerActions}\n\t\t\t\t\tonPaste={() => void pasteTriggerActions()}\n\t\t\t\t\tpasteTitle={pasteAllTitle}\n\t\t\t\t>\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\ttype=\"trigger\"\n\t\t\t\t\t\tonClick={onAddTrigger}\n\t\t\t\t\t\tonContextMenu={event => {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\tevent.stopPropagation()\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\nfunction TriggerActionRow({\n\tindex,\n\tnodeId,\n\tscopeType,\n\ttriggerAction,\n\thasMultipleTriggerActions,\n\tonAddTriggerAction,\n\tonRemoveTriggerAction,\n\tonChangeTriggerAction,\n\tonDuplicateTriggerAction,\n\tcanPasteTriggerActions,\n\tcanCopyTriggerActions,\n\tcopyTriggerAction,\n\tcopyAllTriggerActions,\n\tpasteTriggerActions,\n\tpasteAllTitle,\n\tvariants,\n\treadOnly,\n}: TriggerActionRowProps) {\n\tconst navigationTitle = Dictionary.Trigger\n\tconst engine = useAndAssertVekterEngine()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst title = getTriggerTitle(triggerAction.trigger)\n\tconst initialTriggerActionRef = useRef<TriggerAction>(triggerAction)\n\n\tconst showContextMenu = async (event: React.MouseEvent) => {\n\t\tif (readOnly) return\n\n\t\t// Prevent native context menu from showing up\n\t\tevent.preventDefault()\n\n\t\t// Prevent row context menu from showing up\n\t\tevent.stopPropagation()\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Copy,\n\t\t\t\t\tclick: () => copyTriggerAction(index),\n\t\t\t\t\tenabled: canCopyTriggerActions,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: await pasteAllTitle(),\n\t\t\t\t\tclick: () => pasteTriggerActions(index),\n\t\t\t\t\tenabled: canPasteTriggerActions,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Duplicate,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tonDuplicateTriggerAction(triggerAction, index)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tclick: () => onRemoveTriggerAction(triggerAction.id),\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={index === 0 ? navigationTitle : \" \"}\n\t\t\tonAdd={onAddTriggerAction}\n\t\t\tonDelete={() => onRemoveTriggerAction()}\n\t\t\tdeleteTitle={hasMultipleTriggerActions ? Dictionary.RemoveAll : Dictionary.Remove}\n\t\t\tcopyEnabled={canCopyTriggerActions}\n\t\t\tonCopy={copyAllTriggerActions}\n\t\t\tpasteEnabled={canPasteTriggerActions}\n\t\t\tonPaste={() => pasteTriggerActions()}\n\t\t\tcopyTitle={hasMultipleTriggerActions ? Dictionary.CopyAll : Dictionary.Copy}\n\t\t\tpasteTitle={pasteAllTitle}\n\t\t>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={triggerActionPopoutId(triggerAction.id)}\n\t\t\t\ttitle={title}\n\t\t\t\tnavigationTitle={navigationTitle}\n\t\t\t\tdisplayDivider\n\t\t\t\tpopout={\n\t\t\t\t\t<TriggerActionPopout\n\t\t\t\t\t\tnodeId={nodeId}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentInteraction /> : <IconInteraction />}\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t\tonPresent={() => {\n\t\t\t\t\tinitialTriggerActionRef.current = triggerAction\n\t\t\t\t}}\n\t\t\t\tonDismiss={() => {\n\t\t\t\t\tif (triggerAction.trigger === initialTriggerActionRef.current.trigger) return\n\n\t\t\t\t\trecord(\"trigger_actions_update\", {\n\t\t\t\t\t\tactionType: triggerAction.action.type,\n\t\t\t\t\t\thasTrackingId: Boolean(triggerAction.trigger.trackingId),\n\t\t\t\t\t\tcookieRuleCount: triggerAction.trigger.cookies?.rules?.length,\n\t\t\t\t\t\turlParamRuleCount: triggerAction.trigger.urlParams?.rules?.length,\n\t\t\t\t\t\tpageCount: triggerAction.trigger.pageCount,\n\t\t\t\t\t\tscheduleRuleCount: triggerAction.trigger.schedule?.startAt ? 1 : 0,\n\t\t\t\t\t\tscheduleTimezone: triggerAction.trigger.schedule?.timezone,\n\t\t\t\t\t\tincludeRoutesCount: triggerAction.trigger.includeRoutes?.length,\n\t\t\t\t\t\texcludeRoutesCount: triggerAction.trigger.excludeRoutes?.length,\n\t\t\t\t\t\teventHistoryRuleCount: triggerAction.trigger.eventHistory?.length,\n\t\t\t\t\t\thasTriggerInvokeRule: triggerAction.trigger.eventHistory?.some(rule => rule.eventType === \"trigger_invoke\"),\n\t\t\t\t\t\thasFormSubmitRule: triggerAction.trigger.eventHistory?.some(rule => rule.eventType === \"form_submit\"),\n\t\t\t\t\t\thasClickRule: triggerAction.trigger.eventHistory?.some(rule => rule.eventType === \"click\"),\n\t\t\t\t\t\texitRuleType: triggerAction.trigger.interactions.find(condition => condition.type === \"exit\")?.exitType,\n\t\t\t\t\t\tdelayRuleType: triggerAction.trigger.interactions.find(condition => condition.type === \"delay\")?.delayType,\n\t\t\t\t\t\thasScrollRule: triggerAction.trigger.interactions.some(condition => condition.type === \"scrollPercentage\"),\n\t\t\t\t\t})\n\t\t\t\t}}\n\t\t\t\tonContextMenu={showContextMenu}\n\t\t\t\tonDelete={() => onRemoveTriggerAction(triggerAction.id)}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction TriggerActionPopout({\n\tnodeId,\n\tscopeType,\n\ttriggerAction,\n\tonChangeTriggerAction,\n\tvariants,\n\treadOnly,\n}: Pick<\n\tTriggerActionRowProps,\n\t\"nodeId\" | \"scopeType\" | \"triggerAction\" | \"onChangeTriggerAction\" | \"variants\" | \"readOnly\"\n>) {\n\tconst onSelectVariant = useCallback(\n\t\t(variantId: NodeID) => {\n\t\t\tif (triggerAction.action.type !== \"setComponentVariant\") return\n\t\t\tonChangeTriggerAction({\n\t\t\t\t...triggerAction,\n\t\t\t\taction: { type: \"setComponentVariant\", variant: variantId },\n\t\t\t})\n\t\t},\n\t\t[triggerAction, onChangeTriggerAction],\n\t)\n\n\treturn (\n\t\t<Scroll>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={`calc(${dimensions.css.inputSpacing} / 2)`}\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: colors.panelText,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<Panel>\n\t\t\t\t\t{variants && triggerAction.action.type === \"setComponentVariant\" && (\n\t\t\t\t\t\t<PanelRow title=\"Set Variant\">\n\t\t\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\t\t\ttopLevelVariants={variants}\n\t\t\t\t\t\t\t\tselection={new Set([triggerAction.action.variant])}\n\t\t\t\t\t\t\t\tonSelect={onSelectVariant}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t\t<TrackingIdRow\n\t\t\t\t\t\taiPrompt={NotFound}\n\t\t\t\t\t\ttrackingId={triggerAction.trigger.trackingId}\n\t\t\t\t\t\tcanRemove={false}\n\t\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\t\ttrigger: {\n\t\t\t\t\t\t\t\t\t...triggerAction.trigger,\n\t\t\t\t\t\t\t\t\ttrackingId: isString(value) ? value : \"\",\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</Panel>\n\t\t\t\t<TriggerConditionsPanel\n\t\t\t\t\tnodeId={nodeId}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t\t<TriggerInteractionsPanel\n\t\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Scroll>\n\t)\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { createAndAssignActionVariableToNode } from \"document/components/tools/utils/createAndAssignActionVariableToNode.ts\"\nimport engine from \"document/engine.ts\"\nimport { isShowOverlayActionWithId } from \"document/models/CanvasTree/actions/overlayActions.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isOverlayNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { setupOverlayAction } from \"document/models/CanvasTree/nodes/utils/overlayCreationHelpers.ts\"\nimport { isFixedOrRelativeOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport {\n\tgetSmartComponentForCodeComponent,\n\tisLocalSmartComponentInstance,\n} from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { withFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tgetFrameEventKeys,\n\tisValidFixedOverlayTrigger,\n\twithFrameEvents,\n} from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport React from \"react\"\nimport { changeActionEventKey, eventsForNode, findActionOnNodeEvent, removeEventAction } from \"../utils/eventActions.ts\"\nimport { EventActionTriggerRow } from \"./EventActionTriggerRow.tsx\"\nimport type { EventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\nimport { getMemoEventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\n\ninterface ConditionalProps {\n\ttriggerNodeId: NodeID\n\thandleChangeEventKey: (\n\t\ttriggerNodeId: NodeID,\n\t\tcurrentEventKey: string | undefined,\n\t\tnewEventKey: string | undefined,\n\t) => void\n\thandleRemoveEventKey: undefined | ((triggerNodeId: NodeID, eventKey: string) => void)\n\tgroupedEventKeys: string[][]\n\tdisplayNameMap: EventKeyToDisplayNameMap\n}\n\ntype OverlayTriggerRowProps = {\n\teventKey: Reduced<string> | undefined\n} & (ConditionalProps | { [K in keyof ConditionalProps]: undefined })\n\nexport const OverlayTriggerRow = React.memo(function OverlayTriggerRow({\n\teventKey,\n\ttriggerNodeId,\n\thandleChangeEventKey,\n\thandleRemoveEventKey,\n\tgroupedEventKeys,\n\tdisplayNameMap,\n}: OverlayTriggerRowProps) {\n\tif (!triggerNodeId || isMixed(eventKey) || isNotFound(eventKey) || !eventKey) return null\n\n\tconst triggerNode = engine.tree.getNode(triggerNodeId)\n\tif (!triggerNode) return null\n\n\tconst isNodeWithFrameEvents = withFrameEvents(triggerNode)\n\treturn (\n\t\t<EventActionTriggerRow\n\t\t\ttitle=\"Interaction\"\n\t\t\tnodeId={triggerNode.id}\n\t\t\teventKey={eventKey}\n\t\t\teventKeys={groupedEventKeys}\n\t\t\t// It's required for general event action updates where EventActionTriggerRow is used for elsewhere (to find\n\t\t\t// the target action). But we search for the right action to update using the overlay id, so the index is\n\t\t\t// not needed here.\n\t\t\tindex={0}\n\t\t\tonChange={handleChangeEventKey}\n\t\t\tonRemove={handleRemoveEventKey}\n\t\t\tisCanvasPage={false}\n\t\t\teventKeyToDisplayNameMap={displayNameMap}\n\t\t\tisNodeWithFrameEvents={isNodeWithFrameEvents}\n\t\t/>\n\t)\n})\n\nfunction getGroupedEventKeysAndDisplayNameMap(\n\tcomponentLoader: ComponentLoader,\n\ttriggerNode: CanvasNode,\n): {\n\tgroupedEventKeys: string[][]\n\tdisplayNameMap: EventKeyToDisplayNameMap\n} {\n\tconst displayNameMap = isCodeComponentNode(triggerNode)\n\t\t? (getMemoEventKeyToDisplayNameMap(componentLoader, triggerNode) ?? {})\n\t\t: {}\n\tconst nodeEvents = eventsForNode(componentLoader, triggerNode)\n\tconst eventKeys = Object.keys(nodeEvents)\n\n\tif (withFrameEvents(triggerNode)) {\n\t\treturn {\n\t\t\tgroupedEventKeys: [getFrameEventKeys(triggerNode).filter(isValidFixedOverlayTrigger)],\n\t\t\tdisplayNameMap: { onMouseEnter: Dictionary.Hover },\n\t\t}\n\t}\n\t// We can't alternate external smart components\n\tif (!isLocalSmartComponentInstance(triggerNode)) {\n\t\treturn { groupedEventKeys: [eventKeys], displayNameMap }\n\t}\n\n\t// For any local triggers, reorganize the displayed event keys so that the Tap & Hover options are always on the top. If\n\t// such options don't exist, create them in the list, we will create such event key for the user on change.\n\tlet tapEventKey: string | undefined = undefined\n\tlet hoverEventKey: string | undefined = undefined\n\tconst otherEventKeys: string[] = []\n\tconst hoverAndTapGroup: string[] = []\n\n\tfor (const eventKey of eventKeys) {\n\t\t// We renamed \"Tap\" to \"Click\" in the dictionary. So we check if the trigger event is named either \"Tap\" or \"Click\"\n\t\t// to handle cases where both names are present in existing components.\n\t\tif (displayNameMap[eventKey] === Dictionary.Click || displayNameMap[eventKey] === \"Tap\") {\n\t\t\ttapEventKey = eventKey\n\t\t\tcontinue\n\t\t}\n\n\t\tif (displayNameMap[eventKey] === Dictionary.Hover) {\n\t\t\thoverEventKey = eventKey\n\t\t\tcontinue\n\t\t}\n\n\t\totherEventKeys.push(eventKey)\n\t}\n\n\tif (hoverEventKey) {\n\t\thoverAndTapGroup.push(hoverEventKey)\n\t} else {\n\t\thoverAndTapGroup.push(\"onMouseEnter\")\n\t\tdisplayNameMap[\"onMouseEnter\"] = Dictionary.Hover\n\t}\n\n\tif (tapEventKey) {\n\t\thoverAndTapGroup.push(tapEventKey)\n\t} else {\n\t\thoverAndTapGroup.push(\"onTap\")\n\t\tdisplayNameMap[\"onTap\"] = Dictionary.Click\n\t}\n\n\treturn { groupedEventKeys: [hoverAndTapGroup, otherEventKeys], displayNameMap }\n}\n\nexport function useOverlayEventKeyState(\n\tselectedEventKey: Reduced<string>,\n\tselection: NodeID[],\n\tcanRemoveEventKey = false,\n): OverlayTriggerRowProps {\n\t// Updating the event key only updates the parent, which isn't selected.\n\t// That means that the properties are not going to be reduced to reflect the\n\t// change. To ensure that we render the selected event key, we store it in\n\t// state, and manually set it on user input. This avoids forcing a render in\n\t// the NodeProperties panel.\n\tconst [eventKey, setEventKey] = React.useState<Reduced<string> | undefined>(selectedEventKey)\n\tReact.useEffect(() => {\n\t\tif (eventKey === selectedEventKey) return\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\tsetEventKey(selectedEventKey)\n\t}, [eventKey, selectedEventKey])\n\n\tconst emptyResult: OverlayTriggerRowProps = {\n\t\teventKey,\n\t\ttriggerNodeId: undefined,\n\t\thandleChangeEventKey: undefined,\n\t\thandleRemoveEventKey: undefined,\n\t\tgroupedEventKeys: undefined,\n\t\tdisplayNameMap: undefined,\n\t}\n\n\tif (isNotFound(eventKey) || isMixed(eventKey)) return emptyResult\n\tif (selection.length !== 1 || !selection[0]) return emptyResult\n\n\tconst singleNode = engine.tree.getNode(selection[0])\n\tif (!singleNode) return emptyResult\n\n\tconst triggerNode = engine.tree.getParent(singleNode.id)\n\tif (!triggerNode) return emptyResult\n\n\tconst { groupedEventKeys, displayNameMap } = getGroupedEventKeysAndDisplayNameMap(engine.componentLoader, triggerNode)\n\n\tconst handleChangeEventKey = engine.scheduler.wrapHandler(\n\t\t(triggerNodeId: NodeID, currentEventKey: string | undefined, newEventKey?: string) => {\n\t\t\tconst currentTriggerNode = engine.tree.getNode(triggerNodeId)\n\t\t\tif (!currentTriggerNode) return\n\n\t\t\t// We don't support overlay action override\n\t\t\tconst originalTriggerNodeId = currentTriggerNode.getPrimaryId()\n\t\t\tconst originalTriggerNode = engine.tree.getNode(originalTriggerNodeId)\n\t\t\tif (!originalTriggerNode) return\n\n\t\t\tconst overlayId = singleNode.getPrimaryId()\n\t\t\tconst predicate = isShowOverlayActionWithId(overlayId)\n\t\t\t// You can have only one overlay action per event key\n\t\t\tconst foundOverlayAction = currentEventKey\n\t\t\t\t? findActionOnNodeEvent(eventsForNode(engine.componentLoader, originalTriggerNode), currentEventKey, predicate)\n\t\t\t\t: undefined\n\n\t\t\tif (currentEventKey && !foundOverlayAction) return\n\t\t\tconst index = foundOverlayAction?.index ?? 0\n\n\t\t\tlet hasEventKey = false\n\t\t\tconst nodeEvents = eventsForNode(engine.componentLoader, originalTriggerNode)\n\t\t\tif (!newEventKey || newEventKey in nodeEvents) {\n\t\t\t\thasEventKey = true\n\t\t\t}\n\n\t\t\tconst changeAction = (actionEventKey: string | undefined) => {\n\t\t\t\tupsertActionEventKey(originalTriggerNode.id, overlayId, currentEventKey, actionEventKey, index)\n\n\t\t\t\t// This is updating the parent, not the selected node, so we need to\n\t\t\t\t// render it locally.\n\t\t\t\tsetEventKey(actionEventKey)\n\n\t\t\t\tconst relativeOverlay = engine.tree.getNodeWithTrait(singleNode.id, withFloatingPosition)\n\t\t\t\tif (!relativeOverlay || !withFrameEvents(currentTriggerNode)) return\n\n\t\t\t\trelativeOverlay.set({\n\t\t\t\t\tfloatingSafeArea: actionEventKey === \"onMouseEnter\",\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (newEventKey && !hasEventKey && isLocalSmartComponentInstance(originalTriggerNode)) {\n\t\t\t\tconst smartComponentNode = getSmartComponentForCodeComponent(engine.tree, originalTriggerNode)\n\t\t\t\tengine.loadScopesThenProcess([smartComponentNode], ([loadedSmartComponentNode]) => {\n\t\t\t\t\t// We do nothing if the smart component no longer exists.\n\t\t\t\t\tif (!loadedSmartComponentNode) return\n\n\t\t\t\t\tconst variableId = createAndAssignActionVariableToNode(\n\t\t\t\t\t\tengine.tree,\n\t\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\t\tloadedSmartComponentNode.getPrimaryVariant(),\n\t\t\t\t\t\tnewEventKey,\n\t\t\t\t\t\tdisplayNameMap[newEventKey],\n\t\t\t\t\t\tengine.stores.codeGenerationStore,\n\t\t\t\t\t)\n\t\t\t\t\tassert(variableId, \"Should be able to create event key for local smart component node\")\n\t\t\t\t\tchangeAction(variableId)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tchangeAction(newEventKey)\n\t\t\t}\n\t\t},\n\t)\n\n\treturn {\n\t\teventKey,\n\t\ttriggerNodeId: triggerNode.id,\n\t\thandleChangeEventKey,\n\t\thandleRemoveEventKey: canRemoveEventKey\n\t\t\t? (id, currentEventKey) => handleChangeEventKey(id, currentEventKey, undefined)\n\t\t\t: undefined,\n\t\tgroupedEventKeys,\n\t\tdisplayNameMap,\n\t}\n}\n\nfunction upsertActionEventKey(\n\ttriggerNodeId: NodeID,\n\toverlayId: NodeID,\n\tcurrentEventKey: string | undefined,\n\tnewEventKey: string | undefined,\n\tindex: number,\n) {\n\tif (currentEventKey === newEventKey) return\n\tif (currentEventKey && !newEventKey) {\n\t\tremoveEventAction(engine, triggerNodeId, currentEventKey, index)\n\t\treturn\n\t}\n\n\tif (!currentEventKey && newEventKey) {\n\t\tconst originalTriggerNode = engine.tree.get(triggerNodeId)\n\t\tif (!originalTriggerNode || (!withFrameEvents(originalTriggerNode) && !isCodeComponentNode(originalTriggerNode))) {\n\t\t\treturn\n\t\t}\n\t\tconst overlay = engine.tree.getNodeWithTrait(overlayId, isFixedOrRelativeOverlay)\n\t\tif (!overlay) return\n\n\t\tsetupOverlayAction(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tisOverlayNode(overlay)\n\t\t\t\t? HardCodedCodeIdentifier.showOverlayAction\n\t\t\t\t: HardCodedCodeIdentifier.showRelativeOverlayAction,\n\t\t\toverlay,\n\t\t\tnewEventKey,\n\t\t\toriginalTriggerNode,\n\t\t)\n\t\treturn\n\t}\n\n\tif (currentEventKey && newEventKey) {\n\t\tchangeActionEventKey(engine, triggerNodeId, currentEventKey, newEventKey, index)\n\t}\n}\n\nexport const OverlayTriggerRowTesting = {\n\tgetGroupedEventKeysAndDisplayNameMap,\n}\n", "import \"TriggerActionsPanel.styles_sc153u.wyw.css\"; export const rowDivider = \"rowDivider_r1rziwqz\";", "import { NumberInputWithTickerAndStepper, SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { TriggerAction } from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport type { TriggerEventHistoryRule } from \"library/utils/triggerActions.ts\"\nimport { TrackingIdComboBox, useTrackingIdsForCompletion } from \"../../analytics/components/TrackingIdComboBox.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./TriggerActionsPanel.styles.ts\"\nimport type { TriggerActionRowProps } from \"./TriggerActionsPanel.tsx\"\n\nexport function TriggerConditionFrequencyRow({\n\ttriggerAction,\n\tonChangeTriggerAction,\n\treadOnly,\n}: Pick<TriggerActionRowProps, \"triggerAction\" | \"onChangeTriggerAction\" | \"readOnly\">) {\n\tconst frequencyRule = triggerAction.trigger.eventHistory?.find(rule => rule.eventType === \"trigger_invoke\")\n\tconst frequencyValue = Math.round((frequencyRule?.withinMs ?? 0) / days(1))\n\n\tif (!frequencyRule) return null\n\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t<PanelRow\n\t\t\t\ttitle=\"Repeat\"\n\t\t\t\tonDelete={() => updateEventHistoryRule(triggerAction, onChangeTriggerAction, frequencyRule.id, undefined)}\n\t\t\t>\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={frequencyValue}\n\t\t\t\t\tlabel=\"Days\"\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tupdateEventHistoryRule(triggerAction, onChangeTriggerAction, frequencyRule.id, {\n\t\t\t\t\t\t\twithinMs: value * days(1),\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t\tdefaultValue={30}\n\t\t\t\t\tmin={1}\n\t\t\t\t\tmax={365}\n\t\t\t\t\tprecision={0}\n\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</div>\n\t)\n}\n\nexport function TriggerConditionEventHistoryRows<T extends \"form_submit\" | \"click\">({\n\teventType,\n\ttriggerAction,\n\tonChangeTriggerAction,\n\treadOnly,\n}: Pick<TriggerActionRowProps, \"triggerAction\" | \"onChangeTriggerAction\" | \"readOnly\"> & { eventType: T }) {\n\tconst updateRule = (id: string, updatedRule: Partial<TriggerEventHistoryRule> | undefined) => {\n\t\tupdateEventHistoryRule(triggerAction, onChangeTriggerAction, id, updatedRule)\n\t}\n\n\tconst rules = triggerAction.trigger.eventHistory?.filter(rule => rule.eventType === eventType)\n\n\tif (!rules?.length) return null\n\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t{rules.map(rule => (\n\t\t\t\t<EventHistoryTrackingIdRows key={rule.id} {...rule} onUpdateRule={updateRule} readOnly={readOnly} />\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nfunction EventHistoryTrackingIdRows({\n\tid,\n\teventId,\n\teventType,\n\truleType,\n\tonUpdateRule,\n\treadOnly,\n}: TriggerEventHistoryRule & {\n\tonUpdateRule: (id: string, updatedRule: Partial<TriggerEventHistoryRule> | undefined) => void\n\treadOnly: boolean\n}) {\n\tassert(eventType === \"click\" || eventType === \"form_submit\", \"Invalid event type\")\n\tconst { dataByTrackingId, comboBoxItems } = useTrackingIdsForCompletion(eventType)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\ttitle={eventType === \"click\" ? Dictionary.Link : Dictionary.Form}\n\t\t\t\tonDelete={() => onUpdateRule(id, undefined)}\n\t\t\t>\n\t\t\t\t<TrackingIdComboBox\n\t\t\t\t\tvalue={eventId}\n\t\t\t\t\tonCreate={trackingId => onUpdateRule(id, { eventId: trackingId })}\n\t\t\t\t\tavailableItems={comboBoxItems}\n\t\t\t\t\tdataByTrackingId={dataByTrackingId}\n\t\t\t\t\tplaceholder=\"Tracking ID\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={eventType === \"click\" ? Dictionary.Clicked : Dictionary.Submitted}>\n\t\t\t\t<SegmentedControl style={doubleColumn} enabled={!readOnly}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"seen\"\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={ruleType === \"seen\"}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tonUpdateRule(id, { ruleType: \"seen\" })\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"not-seen\"\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={ruleType === \"not-seen\"}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tonUpdateRule(id, { ruleType: \"not-seen\" })\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction updateEventHistoryRule(\n\ttriggerAction: TriggerAction,\n\tonChangeTriggerAction: (triggerAction: TriggerAction) => void,\n\tid: string,\n\tupdatedRule: Partial<TriggerEventHistoryRule> | undefined,\n) {\n\tconst rules = triggerAction.trigger.eventHistory\n\tif (!rules) return\n\n\tif (!updatedRule) {\n\t\tonChangeTriggerAction({\n\t\t\t...triggerAction,\n\t\t\ttrigger: {\n\t\t\t\t...triggerAction.trigger,\n\t\t\t\teventHistory: rules.filter(rule => rule.id !== id),\n\t\t\t},\n\t\t})\n\t} else {\n\t\tconst index = rules?.findIndex(rule => rule.id === id) ?? -1\n\t\tconst rule = rules?.[index]\n\t\tif (!rule) return\n\n\t\tonChangeTriggerAction({\n\t\t\t...triggerAction,\n\t\t\ttrigger: {\n\t\t\t\t...triggerAction.trigger,\n\t\t\t\teventHistory: [...rules.slice(0, index), { ...rule, ...updatedRule }, ...rules.slice(index + 1)],\n\t\t\t},\n\t\t})\n\t}\n}\n\nfunction days(value: number) {\n\treturn value * 24 * 60 * 60 * 1000\n}\n", "import { PopupButton, PopupButtonItem, SegmentedControl, SegmentedControlItem, TextInput } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { KeyValueRule } from \"library/utils/triggerActions.ts\"\nimport React from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./TriggerActionsPanel.styles.ts\"\nimport type { TriggerConditionRowProps } from \"./TriggerActionsPanel.tsx\"\n\ninterface TriggerConditionKeyValueRowsProps extends TriggerConditionRowProps<\"cookies\" | \"urlParams\"> {\n\ttitle: string\n\tplaceholder: string\n}\n\nexport function TriggerConditionKeyValueRows({\n\ttitle,\n\tplaceholder,\n\tvalue,\n\tonChange,\n\treadOnly,\n}: TriggerConditionKeyValueRowsProps) {\n\tconst updateRule = (index: number, newRule: Partial<KeyValueRule>) => {\n\t\tonChange({ ...value, rules: value.rules.map((rule, i) => (i === index ? { ...rule, ...newRule } : rule)) })\n\t}\n\tconst removeRule = (index: number) => {\n\t\tonChange({ ...value, rules: value.rules.filter((_, i) => i !== index) })\n\t}\n\n\tif (value.rules.length === 0) return null\n\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t{value.rules.map((rule, index) => (\n\t\t\t\t<React.Fragment key={rule.id}>\n\t\t\t\t\t<PanelRow title={title} onDelete={() => removeRule(index)}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\tvalue={rule.key ?? \"\"}\n\t\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\t\tonChange={key => {\n\t\t\t\t\t\t\t\tupdateRule(index, { key })\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t\t<PopupButton title={Dictionary.Type} enabled={!readOnly} wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tidentifier=\"set\"\n\t\t\t\t\t\t\t\ttitle=\"Set\"\n\t\t\t\t\t\t\t\tselected={rule.type === \"set\"}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { type: \"set\" })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tidentifier=\"not-set\"\n\t\t\t\t\t\t\t\ttitle=\"Not Set\"\n\t\t\t\t\t\t\t\tselected={rule.type === \"not-set\"}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { type: \"not-set\" })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tidentifier=\"equals\"\n\t\t\t\t\t\t\t\ttitle=\"Equals\"\n\t\t\t\t\t\t\t\tselected={rule.type === \"equals\"}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { type: \"equals\", value: \"\" })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t{rule.type === \"equals\" && (\n\t\t\t\t\t\t<PanelRow title={Dictionary.Value}>\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\t\tvalue={rule.value ?? \"\"}\n\t\t\t\t\t\t\t\tonChange={newValue => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { value: newValue })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t</React.Fragment>\n\t\t\t))}\n\t\t\t{value.rules.length >= 2 && (\n\t\t\t\t<PanelRow title=\"Match\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn} enabled={!readOnly}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier=\"or\"\n\t\t\t\t\t\t\ttitle={Dictionary.Any}\n\t\t\t\t\t\t\tselected={value.operator === \"or\"}\n\t\t\t\t\t\t\tonSelect={() => onChange({ ...value, operator: \"or\" })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier=\"and\"\n\t\t\t\t\t\t\ttitle={Dictionary.All}\n\t\t\t\t\t\t\tselected={value.operator === \"and\"}\n\t\t\t\t\t\t\tonSelect={() => onChange({ ...value, operator: \"and\" })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport * as styles from \"./TriggerActionsPanel.styles.ts\"\nimport type { TriggerConditionRowProps } from \"./TriggerActionsPanel.tsx\"\n\nexport function TriggerConditionPageCountRow({ value, onChange, readOnly }: TriggerConditionRowProps<\"pageCount\">) {\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t<PanelRow title=\"Visited\" onDelete={() => onChange(undefined)}>\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tlabel={value === 1 ? Dictionary.Page : Dictionary.Pages}\n\t\t\t\t\tmin={1}\n\t\t\t\t\tmax={99}\n\t\t\t\t\tprecision={0}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\tlabelShort=\"Pages\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</div>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { isLinkToWebPage } from \"library/modules/LinkToWebPage.ts\"\nimport type { RouteRule } from \"library/utils/triggerActions.ts\"\nimport React from \"react\"\nimport { LinkInput } from \"../../shared/LinkInput.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./TriggerActionsPanel.styles.ts\"\nimport type { TriggerConditionRowProps } from \"./TriggerActionsPanel.tsx\"\n\nexport function TriggerConditionRouteRows({\n\ttitle,\n\tvalue,\n\tonChange,\n\treadOnly,\n}: TriggerConditionRowProps<\"includeRoutes\" | \"excludeRoutes\"> & { title: string }) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst updateRule = (index: number, newRule: Partial<RouteRule>) => {\n\t\tconst oldRule = value[index]\n\t\tif (!oldRule) return\n\t\tonChange([...value.slice(0, index), { ...oldRule, ...newRule }, ...value.slice(index + 1)])\n\t}\n\n\tconst removeRule = (index: number) => {\n\t\tonChange([...value.slice(0, index), ...value.slice(index + 1)])\n\t}\n\n\tif (value.length === 0) return null\n\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t{value.map((rule, index) => (\n\t\t\t\t<React.Fragment key={rule.id}>\n\t\t\t\t\t<PanelRow title={title} onDelete={readOnly ? undefined : () => removeRule(index)}>\n\t\t\t\t\t\t<LinkInput\n\t\t\t\t\t\t\ttree={engine.tree}\n\t\t\t\t\t\t\tlink={rule.route as LinkToWebPage | undefined}\n\t\t\t\t\t\t\tsupportsPageLinks\n\t\t\t\t\t\t\tsupportsVariables={false}\n\t\t\t\t\t\t\tvariableInfo={null}\n\t\t\t\t\t\t\tonChange={newValue => {\n\t\t\t\t\t\t\t\tupdateRule(index, { route: isLinkToWebPage(newValue) ? newValue : undefined })\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t\t<SegmentedControl style={doubleColumn} enabled={!readOnly}>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tidentifier=\"wildcard\"\n\t\t\t\t\t\t\t\ttitle=\"Wildcard\"\n\t\t\t\t\t\t\t\tselected={rule.wildcard === true}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { wildcard: true })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tidentifier=\"exact\"\n\t\t\t\t\t\t\t\ttitle=\"Exact\"\n\t\t\t\t\t\t\t\tselected={rule.wildcard === false}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateRule(index, { wildcard: false })\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</React.Fragment>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { ComboBox, DateInput, TimeInput } from \"@framerjs/fresco\"\nimport { format as formatDate } from \"date-fns\"\nimport type { Trigger } from \"library/utils/triggerActions.ts\"\nimport { isDefined } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport * as styles from \"./TriggerActionsPanel.styles.ts\"\n\nconst tzSplitRegex = /[+-](?=\\d\\d:\\d\\d$)/u\nconst visitorTimeZoneLabel = \"Visitor\"\nexport const defaultTriggerConditionTimeZone = \"user\"\n\nexport const formatTimestampWithoutTZ = (date: Date) => formatDate(date, \"yyyy-MM-dd'T'HH:mm:ss\")\n\ninterface TriggerConditionScheduleRowsProps {\n\tvalue: Exclude<Trigger[\"schedule\"], undefined>\n\tonChange: (value: Trigger[\"schedule\"] | undefined) => void\n\treadOnly: boolean\n}\nexport function TriggerConditionScheduleRows({ value, onChange, readOnly }: TriggerConditionScheduleRowsProps) {\n\tif (!value?.startAt && !value?.endAt) return null\n\n\treturn (\n\t\t<div className={styles.rowDivider}>\n\t\t\t<DateAndTimeRows\n\t\t\t\ttitle=\"Start At\"\n\t\t\t\tdate={value.startAt}\n\t\t\t\tonChangeDate={newValue =>\n\t\t\t\t\tonChange({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tstartAt: newValue,\n\t\t\t\t\t\tstartAtOffset: newValue ? getTZOffset(newValue, value.timezone) : undefined,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tonDelete={() => onChange({ ...value, startAt: undefined, startAtOffset: undefined })}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t\t<DateAndTimeRows\n\t\t\t\ttitle=\"End At\"\n\t\t\t\tdate={value.endAt}\n\t\t\t\tonChangeDate={newValue =>\n\t\t\t\t\tonChange({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tendAt: newValue,\n\t\t\t\t\t\tendAtOffset: newValue ? getTZOffset(newValue, value.timezone) : undefined,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tonDelete={() => onChange({ ...value, endAt: undefined, endAtOffset: undefined })}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t\t<TimezoneRow\n\t\t\t\tvalue={value.timezone}\n\t\t\t\tonChange={newTimezone =>\n\t\t\t\t\tonChange({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\ttimezone: newTimezone,\n\t\t\t\t\t\tstartAtOffset: value.startAt ? getTZOffset(value.startAt, newTimezone) : undefined,\n\t\t\t\t\t\tendAtOffset: value.endAt ? getTZOffset(value.endAt, newTimezone) : undefined,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\ninterface DateAndTimeRowsProps {\n\ttitle: string\n\tdate: string | undefined\n\tonChangeDate: (value: string | undefined) => void\n\tonDelete: () => void\n\treadOnly: boolean\n}\nfunction DateAndTimeRows({ title, date, onChangeDate, onDelete, readOnly }: DateAndTimeRowsProps) {\n\tif (!date) return null\n\n\t// We always strip the timezone and treat it like a local date to ensure every user sees the same date and time.\n\t// The timezone is merged only only the visitor's machine when evaulating the rule.\n\tconst withoutTZ = stripTZ(date)\n\t// Time input forces us to work with UTC date strings, so we fake it to avoid DST issues\n\tconst timeString = `${withoutTZ}Z`\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title={title} onDelete={onDelete}>\n\t\t\t\t<DateInput\n\t\t\t\t\tvalue={withoutTZ}\n\t\t\t\t\tonChange={newValue => {\n\t\t\t\t\t\tonChangeDate(mergeDateAndTime(newValue, timeString))\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<TimeInput\n\t\t\t\t\tvalue={timeString}\n\t\t\t\t\tonChange={newValue => {\n\t\t\t\t\t\tonChangeDate(mergeDateAndTime(timeString, newValue))\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\n/** Non-exhaustive list just to help with searching */\nconst commonTZAbbreviations = {\n\t\"Africa/Johannesburg\": \"SAST\",\n\t\"Africa/Lagos\": \"WAT\",\n\t\"Africa/Maputo\": \"CAT\",\n\t\"Africa/Nairobi\": \"EAT\",\n\t\"Africa/Windhoek\": \"CAT\",\n\t\"America/Anchorage\": \"AKST\",\n\t\"America/Barbados\": \"AST\",\n\t\"America/Chicago\": \"CST\",\n\t\"America/Denver\": \"MST\",\n\t\"America/Edmonton\": \"MST\",\n\t\"America/Halifax\": \"AST\",\n\t\"America/Los_Angeles\": \"PST\",\n\t\"America/New_York\": \"EST\",\n\t\"America/Phoenix\": \"MST\",\n\t\"America/St_Johns\": \"NST\",\n\t\"America/Toronto\": \"EST\",\n\t\"America/Vancouver\": \"PST\",\n\t\"Asia/Hong_Kong\": \"HKT\",\n\t\"Asia/Jakarta\": \"WIB\",\n\t\"Asia/Jayapura\": \"WIT\",\n\t\"Asia/Jerusalem\": \"IST\",\n\t\"Asia/Karachi\": \"PKT\",\n\t\"Asia/Kolkata\": \"IST\",\n\t\"Asia/Macau\": \"CST\",\n\t\"Asia/Makassar\": \"WITA\",\n\t\"Asia/Seoul\": \"KST\",\n\t\"Asia/Shanghai\": \"CST\",\n\t\"Asia/Taipei\": \"CST\",\n\t\"Asia/Tokyo\": \"JST\",\n\t\"Australia/Adelaide\": \"ACST\",\n\t\"Australia/Brisbane\": \"AEST\",\n\t\"Australia/Darwin\": \"ACST\",\n\t\"Australia/Hobart\": \"AEST\",\n\t\"Australia/Melbourne\": \"AEST\",\n\t\"Australia/Perth\": \"AWST\",\n\t\"Australia/Sydney\": \"AEST\",\n\t\"Europe/Amsterdam\": \"CET\",\n\t\"Europe/Berlin\": \"CET\",\n\t\"Europe/Brussels\": \"CET\",\n\t\"Europe/Bucharest\": \"EET\",\n\t\"Europe/Budapest\": \"CET\",\n\t\"Europe/Chisinau\": \"EET\",\n\t\"Europe/Copenhagen\": \"CET\",\n\t\"Europe/Dublin\": \"GMT\",\n\t\"Europe/Gibraltar\": \"CET\",\n\t\"Europe/Helsinki\": \"EET\",\n\t\"Europe/Kyiv\": \"EET\",\n\t\"Europe/Lisbon\": \"WET\",\n\t\"Europe/London\": \"GMT\",\n\t\"Europe/Madrid\": \"CET\",\n\t\"Europe/Moscow\": \"MSK\",\n\t\"Europe/Oslo\": \"CET\",\n\t\"Europe/Paris\": \"CET\",\n\t\"Europe/Prague\": \"CET\",\n\t\"Europe/Riga\": \"EET\",\n\t\"Europe/Rome\": \"CET\",\n\t\"Europe/Sofia\": \"EET\",\n\t\"Europe/Stockholm\": \"CET\",\n\t\"Europe/Tallinn\": \"EET\",\n\t\"Europe/Vienna\": \"CET\",\n\t\"Europe/Vilnius\": \"EET\",\n\t\"Europe/Warsaw\": \"CET\",\n\t\"Europe/Zurich\": \"CET\",\n\t\"Pacific/Adelaide\": \"AEST\",\n\t\"Pacific/Auckland\": \"NZST\",\n\t\"Pacific/Brisbane\": \"AEST\",\n\t\"Pacific/Darwin\": \"ACST\",\n\t\"Pacific/Hobart\": \"AEDT\",\n\t\"Pacific/Honolulu\": \"HST\",\n\t\"Pacific/Melbourne\": \"AEDT\",\n\t\"Pacific/Perth\": \"AWST\",\n\t\"Pacific/Sydney\": \"AEDT\",\n\t\"Pacific/Tokyo\": \"JST\",\n} as const satisfies Record<string, string>\nconst currentUserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone\nconst availableTimezones = Intl.supportedValuesOf(\"timeZone\")\nconst availableTimezonesSet = new Set(availableTimezones)\nconst timezoneOptions: ComboBoxListItem[] = [\n\t{\n\t\ttype: \"option\" as const,\n\t\tvalue: visitorTimeZoneLabel,\n\t},\n\tavailableTimezonesSet.has(currentUserTimeZone)\n\t\t? {\n\t\t\t\ttype: \"option\" as const,\n\t\t\t\tvalue: formatTimezoneLabel(currentUserTimeZone),\n\t\t\t\tlabel: getTimezoneAbbreviation(currentUserTimeZone),\n\t\t\t}\n\t\t: undefined,\n\t...availableTimezones\n\t\t.filter(timezone => timezone !== currentUserTimeZone)\n\t\t.map(timezone => ({\n\t\t\ttype: \"option\" as const,\n\t\t\tvalue: formatTimezoneLabel(timezone),\n\t\t\tlabel: getTimezoneAbbreviation(timezone),\n\t\t})),\n].filter(isDefined)\n\ninterface TimezoneSelectorProps {\n\tvalue: string | undefined\n\tonChange: (value: string | undefined) => void\n\treadOnly: boolean\n}\n\nfunction TimezoneRow({ value, onChange, readOnly }: TimezoneSelectorProps) {\n\tconst handleTimezoneChange = (newValue: string, final: boolean, reset: () => void) => {\n\t\tif (!final) return\n\t\tconst resolvedValue = valueFromTimezoneLabel(newValue)\n\t\tif (!availableTimezonesSet.has(resolvedValue) && resolvedValue !== \"user\") {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tonChange(resolvedValue)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Time Zone\">\n\t\t\t<ComboBox\n\t\t\t\titems={timezoneOptions}\n\t\t\t\tvalue={formatTimezoneLabel(value)}\n\t\t\t\tonChange={handleTimezoneChange}\n\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\tenabled={!readOnly}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction mergeDateAndTime(date: string | undefined, time: string | undefined) {\n\tif (!date) return time\n\tif (!time) return date\n\n\ttry {\n\t\tconst onlyDate = formatDate(new Date(date), \"yyyy-MM-dd\")\n\t\tconst timeDate = new Date(time)\n\t\tconst onlyTime = `${timeDate.getUTCHours().toString().padStart(2, \"0\")}:${timeDate.getUTCMinutes().toString().padStart(2, \"0\")}:00`\n\t\tconst merged = new Date(`${onlyDate}T${onlyTime}`)\n\n\t\treturn formatTimestampWithoutTZ(merged)\n\t} catch {\n\t\treturn formatTimestampWithoutTZ(new Date())\n\t}\n}\n\nfunction stripTZ(date: string) {\n\tif (date.endsWith(\"Z\")) return date.slice(0, -1)\n\tconst split = date.split(tzSplitRegex)\n\tif (split[0] && split.length === 2) return split[0]\n\treturn date\n}\n\nexport function getTZOffset(date: string, tz: string | undefined) {\n\tconst timeZone = tz ?? defaultTriggerConditionTimeZone\n\ttry {\n\t\tconst fmt = new Intl.DateTimeFormat(\"en-US\", {\n\t\t\ttimeZone,\n\t\t\ttimeZoneName: \"shortOffset\",\n\t\t})\n\t\tconst offset = fmt.formatToParts(new Date(date)).find(part => part.type === \"timeZoneName\")?.value\n\t\tif (!offset) return undefined\n\n\t\t// offset is like GMT, GMT+2 or GMT-3:45 and it needs to be like Z, +02:00 or -03:45\n\t\tif (offset === \"GMT\") return \"Z\"\n\t\tconst rawOffset = offset.slice(4)\n\t\tconst sign = offset[3]\n\t\tconst [hours, minutes = \"\"] = rawOffset.split(\":\")\n\n\t\tif (!sign || !hours) return undefined\n\t\t// Some CI machines are reporting GMT+0 for Europe/London. We can ignore minutes because there are no zones 0 < zone < 1\n\t\tif (hours === \"0\") return \"Z\"\n\n\t\treturn `${sign}${hours.padStart(2, \"0\")}:${minutes.padStart(2, \"0\")}`\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction formatTimezoneLabel(timezone: string | undefined = defaultTriggerConditionTimeZone) {\n\tif (timezone === \"user\") return visitorTimeZoneLabel\n\treturn timezone.replace(/_/gu, \" \")\n}\n\nfunction valueFromTimezoneLabel(label: string) {\n\tif (label === visitorTimeZoneLabel) return \"user\"\n\treturn label.replace(/ /gu, \"_\")\n}\n\nfunction getTimezoneAbbreviation(timezone: string) {\n\treturn timezone in commonTZAbbreviations\n\t\t? commonTZAbbreviations[timezone as keyof typeof commonTZAbbreviations]\n\t\t: undefined\n}\n\nexport const testing = {\n\tstripTZ,\n\tformatTimezoneLabel,\n\tgetTimezoneAbbreviation,\n\tvalueFromTimezoneLabel,\n}\n", "import type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { type NodeID, randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { type TriggerAction, defaultRepeatWithinMs } from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { type Trigger, getTriggerTargetId } from \"library/utils/triggerActions.ts\"\nimport type React from \"react\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport type { TriggerActionRowProps } from \"./TriggerActionsPanel.tsx\"\nimport { TriggerConditionEventHistoryRows, TriggerConditionFrequencyRow } from \"./TriggerConditionEventHistoryRows.tsx\"\nimport { TriggerConditionKeyValueRows } from \"./TriggerConditionKeyValueRows.tsx\"\nimport { TriggerConditionPageCountRow } from \"./TriggerConditionPageCountRow.tsx\"\nimport { TriggerConditionRouteRows } from \"./TriggerConditionRouteRows.tsx\"\nimport {\n\tTriggerConditionScheduleRows,\n\tdefaultTriggerConditionTimeZone,\n\tformatTimestampWithoutTZ,\n\tgetTZOffset,\n} from \"./TriggerConditionScheduleRows.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nexport function TriggerConditionsPanel({\n\tnodeId,\n\tscopeType,\n\ttriggerAction,\n\tonChangeTriggerAction,\n\treadOnly,\n}: Pick<TriggerActionRowProps, \"nodeId\" | \"scopeType\" | \"triggerAction\" | \"onChangeTriggerAction\" | \"readOnly\">) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst showContextMenu = !readOnly\n\t\t? getShowContextMenu(engine, nodeId, scopeType, triggerAction, onChangeTriggerAction)\n\t\t: undefined\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title=\"Conditions\" clickable={Boolean(showContextMenu)} onMouseDown={showContextMenu}>\n\t\t\t\t\t{showContextMenu && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{triggerAction.trigger.eventHistory?.length ? (\n\t\t\t\t<TriggerConditionFrequencyRow\n\t\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{triggerAction.trigger.cookies?.rules?.length ? (\n\t\t\t\t<TriggerConditionKeyValueRows\n\t\t\t\t\ttitle=\"Cookie\"\n\t\t\t\t\tplaceholder=\"session\"\n\t\t\t\t\tvalue={triggerAction.trigger.cookies}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\ttrigger: {\n\t\t\t\t\t\t\t\t...triggerAction.trigger,\n\t\t\t\t\t\t\t\tcookies: value?.rules.length === 0 ? undefined : value,\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\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{triggerAction.trigger.urlParams?.rules?.length ? (\n\t\t\t\t<TriggerConditionKeyValueRows\n\t\t\t\t\ttitle=\"Parameter\"\n\t\t\t\t\tplaceholder=\"utm_campaign\"\n\t\t\t\t\tvalue={triggerAction.trigger.urlParams}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\ttrigger: {\n\t\t\t\t\t\t\t\t...triggerAction.trigger,\n\t\t\t\t\t\t\t\turlParams: value?.rules.length === 0 ? undefined : value,\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\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{triggerAction.trigger.pageCount ? (\n\t\t\t\t<TriggerConditionPageCountRow\n\t\t\t\t\tvalue={triggerAction.trigger.pageCount}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\ttrigger: { ...triggerAction.trigger, pageCount: value },\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{triggerAction.trigger.schedule && (\n\t\t\t\t<TriggerConditionScheduleRows\n\t\t\t\t\tvalue={triggerAction.trigger.schedule}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tconst newSchedule = value?.startAt || value?.endAt ? value : undefined\n\t\t\t\t\t\tonChangeTriggerAction({ ...triggerAction, trigger: { ...triggerAction.trigger, schedule: newSchedule } })\n\t\t\t\t\t}}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{triggerAction.trigger.includeRoutes?.length ? (\n\t\t\t\t<TriggerConditionRouteRows\n\t\t\t\t\ttitle=\"Include\"\n\t\t\t\t\tvalue={triggerAction.trigger.includeRoutes}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\ttrigger: {\n\t\t\t\t\t\t\t\t...triggerAction.trigger,\n\t\t\t\t\t\t\t\tincludeRoutes: value?.length === 0 ? undefined : value,\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\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{triggerAction.trigger.excludeRoutes?.length ? (\n\t\t\t\t<TriggerConditionRouteRows\n\t\t\t\t\ttitle=\"Exclude\"\n\t\t\t\t\tvalue={triggerAction.trigger.excludeRoutes}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonChangeTriggerAction({\n\t\t\t\t\t\t\t...triggerAction,\n\t\t\t\t\t\t\ttrigger: {\n\t\t\t\t\t\t\t\t...triggerAction.trigger,\n\t\t\t\t\t\t\t\texcludeRoutes: value?.length === 0 ? undefined : value,\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\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t<TriggerConditionEventHistoryRows\n\t\t\t\teventType=\"form_submit\"\n\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t\t<TriggerConditionEventHistoryRows\n\t\t\t\teventType=\"click\"\n\t\t\t\ttriggerAction={triggerAction}\n\t\t\t\tonChangeTriggerAction={onChangeTriggerAction}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t</Panel>\n\t)\n}\n\nfunction getShowContextMenu(\n\tengine: VekterEngine,\n\tnodeId: NodeID,\n\tscopeType: ScopeType,\n\ttriggerAction: TriggerAction,\n\tonChangeTriggerAction: (triggerAction: TriggerAction) => void,\n) {\n\treturn (event: React.MouseEvent) => {\n\t\tconst immutableTriggerUpdate = (changes: Partial<Trigger>) => {\n\t\t\tonChangeTriggerAction({\n\t\t\t\t...triggerAction,\n\t\t\t\ttrigger: { ...triggerAction.trigger, ...changes },\n\t\t\t})\n\t\t}\n\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Repeat\",\n\t\t\t\tenabled: !triggerAction.trigger.eventHistory?.some(rule => rule.eventType === \"trigger_invoke\"),\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\teventHistory: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\t\teventType: \"trigger_invoke\",\n\t\t\t\t\t\t\t\truleType: \"not-seen\",\n\t\t\t\t\t\t\t\teventId: getTriggerTargetId(nodeId, triggerAction.action.type),\n\t\t\t\t\t\t\t\twithinMs: defaultRepeatWithinMs,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...(triggerAction.trigger.eventHistory ?? []),\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: \"Cookie\",\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\tcookies: {\n\t\t\t\t\t\t\trules: [...(triggerAction.trigger.cookies?.rules ?? []), { id: randomID(), key: \"\", type: \"set\" }],\n\t\t\t\t\t\t\toperator: triggerAction.trigger.cookies?.operator ?? \"and\",\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: \"Parameter\",\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\turlParams: {\n\t\t\t\t\t\t\trules: [...(triggerAction.trigger.urlParams?.rules ?? []), { id: randomID(), key: \"\", type: \"set\" }],\n\t\t\t\t\t\t\toperator: triggerAction.trigger.urlParams?.operator ?? \"and\",\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: \"Visited Pages\",\n\t\t\t\tenabled: !triggerAction.trigger.pageCount,\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\tpageCount: 1,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Start At\",\n\t\t\t\tenabled: !triggerAction.trigger.schedule?.startAt,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst startAt = triggerAction.trigger.schedule?.endAt ?? formatTimestampWithoutTZ(new Date())\n\t\t\t\t\tconst timezone = triggerAction.trigger.schedule?.timezone ?? defaultTriggerConditionTimeZone\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\tschedule: {\n\t\t\t\t\t\t\t...triggerAction.trigger.schedule,\n\t\t\t\t\t\t\ttimezone,\n\t\t\t\t\t\t\tstartAt,\n\t\t\t\t\t\t\tstartAtOffset: getTZOffset(startAt, timezone),\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: \"End At\",\n\t\t\t\tenabled: !triggerAction.trigger.schedule?.endAt,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst endAt = triggerAction.trigger.schedule?.startAt ?? formatTimestampWithoutTZ(new Date())\n\t\t\t\t\tconst timezone = triggerAction.trigger.schedule?.timezone ?? defaultTriggerConditionTimeZone\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\tschedule: {\n\t\t\t\t\t\t\t...triggerAction.trigger.schedule,\n\t\t\t\t\t\t\ttimezone,\n\t\t\t\t\t\t\tendAt,\n\t\t\t\t\t\t\tendAtOffset: getTZOffset(endAt, timezone),\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: \"Form Submit\",\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\teventHistory: [\n\t\t\t\t\t\t\t...(triggerAction.trigger.eventHistory ?? []),\n\t\t\t\t\t\t\t{ id: randomID(), eventType: \"form_submit\", eventId: \"\", ruleType: \"not-seen\" },\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: \"Link Click\",\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\teventHistory: [\n\t\t\t\t\t\t\t...(triggerAction.trigger.eventHistory ?? []),\n\t\t\t\t\t\t\t{ id: randomID(), eventType: \"click\", eventId: \"\", ruleType: \"not-seen\" },\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{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: \"Include Page\",\n\t\t\t\tvisible: scopeType === ScopeType.LayoutTemplate,\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\tincludeRoutes: [\n\t\t\t\t\t\t\t...(triggerAction.trigger.includeRoutes ?? []),\n\t\t\t\t\t\t\t{ id: randomID(), route: undefined, wildcard: 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: \"Exclude Page\",\n\t\t\t\tvisible: scopeType === ScopeType.LayoutTemplate,\n\t\t\t\tclick: () => {\n\t\t\t\t\timmutableTriggerUpdate({\n\t\t\t\t\t\texcludeRoutes: [\n\t\t\t\t\t\t\t...(triggerAction.trigger.excludeRoutes ?? []),\n\t\t\t\t\t\t\t{ id: randomID(), route: undefined, wildcard: 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]\n\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t})\n\t}\n}\n", "import {\n\tNumberInputWithTicker,\n\tNumberInputWithTickerAndStepper,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tSlider,\n} from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport {\n\ttype TriggerAction,\n\tcreateDefaultTriggerInteraction,\n} from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport type { TriggerInteraction, TypedTriggerInteraction } from \"library/utils/triggerActions.ts\"\nimport type React from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport type { TriggerActionRowProps } from \"./TriggerActionsPanel.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nexport function TriggerInteractionsPanel({\n\ttriggerAction,\n\tonChangeTriggerAction,\n\treadOnly,\n}: Pick<TriggerActionRowProps, \"triggerAction\" | \"onChangeTriggerAction\" | \"readOnly\">) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst addInteraction = useEngineCallback(\n\t\t(newInteraction: TriggerInteraction) => {\n\t\t\tconst newTrigger = {\n\t\t\t\t...triggerAction.trigger,\n\t\t\t\tinteractions: [...triggerAction.trigger.interactions, newInteraction],\n\t\t\t}\n\t\t\tonChangeTriggerAction({\n\t\t\t\t...triggerAction,\n\t\t\t\ttrigger: newTrigger,\n\t\t\t})\n\t\t},\n\t\t[triggerAction, onChangeTriggerAction],\n\t)\n\n\tconst updateInteraction = useEngineCallback(\n\t\t(updatedInteraction: TriggerInteraction) => {\n\t\t\tconst newTrigger = {\n\t\t\t\t...triggerAction.trigger,\n\t\t\t\tinteractions: triggerAction.trigger.interactions.map(interaction =>\n\t\t\t\t\tinteraction.id === updatedInteraction.id ? updatedInteraction : interaction,\n\t\t\t\t),\n\t\t\t}\n\t\t\tonChangeTriggerAction({\n\t\t\t\t...triggerAction,\n\t\t\t\ttrigger: newTrigger,\n\t\t\t})\n\t\t},\n\t\t[triggerAction, onChangeTriggerAction],\n\t)\n\n\tconst removeInteraction = useEngineCallback(\n\t\t(interactionId: string) => {\n\t\t\tconst newTrigger = {\n\t\t\t\t...triggerAction.trigger,\n\t\t\t\tinteractions: triggerAction.trigger.interactions.filter(interaction => interaction.id !== interactionId),\n\t\t\t}\n\t\t\tonChangeTriggerAction({\n\t\t\t\t...triggerAction,\n\t\t\t\ttrigger: newTrigger,\n\t\t\t})\n\t\t},\n\t\t[triggerAction, onChangeTriggerAction],\n\t)\n\n\tconst showContextMenu = !readOnly ? getShowContextMenu(engine, triggerAction, addInteraction) : undefined\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title=\"Interactions\" clickable={Boolean(showContextMenu)} onMouseDown={showContextMenu}>\n\t\t\t\t\t{showContextMenu && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{triggerAction.trigger.interactions.map((interaction, interactionIndex) => (\n\t\t\t\t<TriggerInteractionRow\n\t\t\t\t\tkey={interaction.id}\n\t\t\t\t\tinteraction={interaction}\n\t\t\t\t\tindex={interactionIndex}\n\t\t\t\t\tisLast={interactionIndex === triggerAction.trigger.interactions.length - 1}\n\t\t\t\t\tonUpdate={updateInteraction}\n\t\t\t\t\tonRemove={removeInteraction}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\t\t\t))}\n\t\t</Panel>\n\t)\n}\n\nfunction getShowContextMenu(\n\tengine: VekterEngine,\n\ttriggerAction: TriggerAction,\n\taddInteraction: (interaction: TriggerInteraction) => void,\n) {\n\treturn (event: React.MouseEvent) => {\n\t\tconst hasSiteDelay = triggerAction.trigger.interactions.some(\n\t\t\tinteraction => interaction.type === \"delay\" && interaction.delayType === \"site\",\n\t\t)\n\t\tconst hasPageDelay = triggerAction.trigger.interactions.some(\n\t\t\tinteraction => interaction.type === \"delay\" && interaction.delayType === \"page\",\n\t\t)\n\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Time\",\n\t\t\t\tenabled: !hasSiteDelay || !hasPageDelay,\n\t\t\t\tclick: () => {\n\t\t\t\t\taddInteraction({\n\t\t\t\t\t\t...createDefaultTriggerInteraction(\"delay\"),\n\t\t\t\t\t\tdelayType: hasSiteDelay ? \"page\" : \"site\",\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Scroll\",\n\t\t\t\tenabled: !triggerAction.trigger.interactions.some(interaction => interaction.type === \"scrollPercentage\"),\n\t\t\t\tclick: () => {\n\t\t\t\t\taddInteraction(createDefaultTriggerInteraction(\"scrollPercentage\"))\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Exit\",\n\t\t\t\tenabled: !triggerAction.trigger.interactions.some(interaction => interaction.type === \"exit\"),\n\t\t\t\tclick: () => {\n\t\t\t\t\taddInteraction(createDefaultTriggerInteraction(\"exit\"))\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t})\n\t}\n}\n\ninterface InteractionRowProps<T extends TriggerInteraction[\"type\"] = TriggerInteraction[\"type\"]> {\n\tinteraction: TypedTriggerInteraction<T>\n\tindex: number\n\tonUpdate: (updatedInteraction: TypedTriggerInteraction<T>) => void\n\tonRemove: (interactionId: string) => void\n\treadOnly: boolean\n}\n\nfunction TriggerInteractionRow({ isLast, interaction, ...props }: InteractionRowProps & { isLast: boolean }) {\n\tconst renderInteractionRows = () => {\n\t\tswitch (interaction.type) {\n\t\t\tcase \"delay\":\n\t\t\t\treturn <DelayInteractionRow interaction={interaction} {...props} />\n\t\t\tcase \"scrollPercentage\":\n\t\t\t\treturn <ScrollPercentageInteractionRow interaction={interaction} {...props} />\n\t\t\tcase \"exit\":\n\t\t\t\treturn <ExitInteractionRow interaction={interaction} {...props} />\n\t\t\tdefault:\n\t\t\t\treturn null\n\t\t}\n\t}\n\n\tconst { onUpdate, readOnly } = props\n\n\treturn (\n\t\t<>\n\t\t\t{renderInteractionRows()}\n\t\t\t{!isLast && (\n\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t<PopupButton\n\t\t\t\t\t\ttitle={(interaction.operator ?? \"and\") === \"and\" ? \"And\" : \"Or\"}\n\t\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"and\"\n\t\t\t\t\t\t\ttitle=\"And\"\n\t\t\t\t\t\t\tselected={(interaction.operator ?? \"and\") === \"and\"}\n\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\t\t\toperator: \"and\",\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\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"or\"\n\t\t\t\t\t\t\ttitle=\"Or\"\n\t\t\t\t\t\t\tselected={(interaction.operator ?? \"and\") === \"or\"}\n\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\t\t\toperator: \"or\",\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</PopupButton>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nfunction DelayInteractionRow({ interaction, onUpdate, onRemove, readOnly }: InteractionRowProps<\"delay\">) {\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Time\" onDelete={() => onRemove(interaction.id)}>\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={interaction.delayMs / 1000}\n\t\t\t\t\tonChange={value => {\n\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\tdelayMs: value * 1000,\n\t\t\t\t\t\t})\n\t\t\t\t\t}}\n\t\t\t\t\tunit=\"s\"\n\t\t\t\t\tmin={1}\n\t\t\t\t\tmax={3600}\n\t\t\t\t\tprecision={0}\n\t\t\t\t\tenabled={!readOnly}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"site\"\n\t\t\t\t\t\ttitle={Dictionary.Site}\n\t\t\t\t\t\tselected={interaction.delayType === \"site\"}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\t\tdelayType: \"site\",\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<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"page\"\n\t\t\t\t\t\ttitle={Dictionary.Page}\n\t\t\t\t\t\tselected={interaction.delayType === \"page\"}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\t\tdelayType: \"page\",\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</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction ScrollPercentageInteractionRow({\n\tinteraction,\n\tonUpdate,\n\tonRemove,\n\treadOnly,\n}: InteractionRowProps<\"scrollPercentage\">) {\n\treturn (\n\t\t<PanelRow title=\"Scroll\" onDelete={() => onRemove(interaction.id)}>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tvalue={interaction.scrollPercentage}\n\t\t\t\tonChange={value => {\n\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\tscrollPercentage: value,\n\t\t\t\t\t})\n\t\t\t\t}}\n\t\t\t\tunit=\"%\"\n\t\t\t\tmin={0}\n\t\t\t\tmax={100}\n\t\t\t\tprecision={0}\n\t\t\t\tenabled={!readOnly}\n\t\t\t/>\n\t\t\t<Slider\n\t\t\t\tvalue={interaction.scrollPercentage}\n\t\t\t\tonChange={value => {\n\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\tscrollPercentage: value,\n\t\t\t\t\t})\n\t\t\t\t}}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nconst exitTypes = {\n\tmouseleave: \"Mouse Out\",\n\tvisibilitychange: \"Page Hide\",\n\tall: \"Both\",\n}\nconst exitTypeKeys = objectKeys(exitTypes)\n\nfunction ExitInteractionRow({ interaction, onUpdate, onRemove, readOnly }: InteractionRowProps<\"exit\">) {\n\tconst exitTypeTitle = exitTypes[interaction.exitType]\n\n\treturn (\n\t\t<PanelRow title=\"Exit\" onDelete={() => onRemove(interaction.id)}>\n\t\t\t<PopupButton title={exitTypeTitle} enabled={!readOnly} wrapperClassName={doubleColumnClass}>\n\t\t\t\t{exitTypeKeys.map(key => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\tidentifier={key}\n\t\t\t\t\t\ttitle={exitTypes[key]}\n\t\t\t\t\t\tselected={interaction.exitType === key}\n\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\tonUpdate({\n\t\t\t\t\t\t\t\t...interaction,\n\t\t\t\t\t\t\t\texitType: key,\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</PopupButton>\n\t\t</PanelRow>\n\t)\n}\n", "import { List } from \"@framerjs/shared\"\nimport { CanvasTree, type NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\ttype TriggerAction,\n\tgetDuplicatedTriggerAction,\n\twithTriggerActions,\n} from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useCopyPasteArrayProperty } from \"./useCopyPasteArrayProperty.ts\"\nexport function useCopyPasteTriggerActions(nodeIds: NodeID[]) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst canCopyTriggerActions = useCallback(() => isClipboardSupported(), [])\n\tconst [\n\t\tcanPasteTriggerActions,\n\t\t_pasteAllTriggerActions,\n\t\t_pasteTriggerAction,\n\t\tcopyAllTriggerActions,\n\t\tcopyTriggerAction,\n\t\tclipboardItemsLength,\n\t] = useCopyPasteArrayProperty(TraitType.TriggerActions, nodeIds, canCopyTriggerActions, canCopyTriggerActions)\n\n\tconst pasteTriggerActions = async (index?: number) => {\n\t\tconst stylesData = await Clipboard.getStyleData(undefined)\n\t\tif (!stylesData) return\n\n\t\tconst styleTree = CanvasTree.fromJS(stylesData.tree, engine.componentLoader)\n\t\tif (!styleTree || !withTriggerActions(styleTree.root)) return\n\t\tconst triggerActions = styleTree.root.triggerActions\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTriggerActions)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst duplicatedTriggerActions = triggerActions?.map(triggerAction =>\n\t\t\t\t\tgetDuplicatedTriggerAction(engine, node, triggerAction),\n\t\t\t\t)\n\t\t\t\tnode.set({\n\t\t\t\t\ttriggerActions: isUndefined(index)\n\t\t\t\t\t\t? duplicatedTriggerActions\n\t\t\t\t\t\t: (List.replace(node.triggerActions ?? [], index, duplicatedTriggerActions) as TriggerAction[]),\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\treturn {\n\t\tcanPasteTriggerActions,\n\t\tpasteTriggerActions,\n\t\tcanCopyTriggerActions,\n\t\tcopyAllTriggerActions,\n\t\tcopyTriggerAction,\n\t\tclipboardItemsLength,\n\t}\n}\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport { assert } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { updateImageControlPropWithNewImage } from \"document/models/controlProps/updateImageControlPropWithNewImage.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\n\ntype ChangeHandler = (\n\tcontrolKey: string,\n\tgetUpdate: (controlProp: ControlProp) => ControlProp,\n\tnodesToUpdate: NodeID[],\n) => void\n\n/**\n * Hook to handle image uploads for control props.\n * Returns a callback that can be passed to ControlPropRow's onImageUpload prop.\n */\nexport function useControlUploadHandler(\n\tchangeHandler: ChangeHandler,\n\tnodeIds: NodeID[],\n): (upload: Promise<AssetReference | null>, controlKey: string) => Promise<void> {\n\treturn React.useCallback(\n\t\tasync (upload: Promise<AssetReference | null>, controlKey: string) => {\n\t\t\tconst nodeIdsToUpdate = nodeIds\n\n\t\t\tconst reference = await upload\n\t\t\tif (!reference) return\n\n\t\t\tchangeHandler(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrentControlProp => {\n\t\t\t\t\tassert(currentControlProp.type === ControlType.Image)\n\t\t\t\t\treturn updateImageControlPropWithNewImage(currentControlProp, reference)\n\t\t\t\t},\n\t\t\t\tnodeIdsToUpdate,\n\t\t\t)\n\t\t},\n\t\t[changeHandler, nodeIds],\n\t)\n}\n", "import { ContextAlignment } from \"document/components/utils/contextAlignmentActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PathSegmentSelector, PointRounding, SegmentHandleSelector } from \"document/stores/PathSelectionStore.ts\"\nimport { PathSelectionType } from \"document/stores/PathSelectionStore.ts\"\nimport React from \"react\"\nimport { AlignmentRow } from \"../rows/AlignmentRow/AlignmentRow.tsx\"\n\ninterface Props {\n\tsegmentSelection: PathSegmentSelector[]\n\tselectionType: PathSelectionType\n\tsegmentHandle: SegmentHandleSelector | null\n\tpointRounding: PointRounding\n}\n\nexport class PathAlignmentHeader extends React.PureComponent<Props, {}> {\n\talignAction = (alignmentType: ContextAlignment.AlignOption) => {\n\t\tconst { segmentSelection } = this.props\n\t\tContextAlignment.alignPathSegments(engine.tree, segmentSelection, alignmentType)\n\t}\n\n\tdistributeAction = (distributionType: ContextAlignment.DistributeOption) => {\n\t\tconst { segmentSelection } = this.props\n\t\tContextAlignment.distributePathSegments(engine.tree, segmentSelection, distributionType)\n\t}\n\n\toverride render() {\n\t\tconst { segmentSelection, segmentHandle, selectionType } = this.props\n\n\t\tconst selectingCurvesOrHandles = selectionType === PathSelectionType.Curves || segmentHandle !== null\n\n\t\tconst alignEnabled = !selectingCurvesOrHandles && segmentSelection.length > 0\n\t\tconst distEnabled = !selectingCurvesOrHandles && segmentSelection.length > 2\n\n\t\treturn (\n\t\t\t<AlignmentRow\n\t\t\t\talignActionsEnabled={alignEnabled}\n\t\t\t\tdistributeActionsEnabled={distEnabled}\n\t\t\t\talignAction={this.alignAction}\n\t\t\t\tdistributeAction={this.distributeAction}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import {\n\tbuttonIsLeftClick,\n\tsyntheticClickHandlerForMouseDown,\n\tusePrefersMouseDown,\n} from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { cx } from \"@linaria/core\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport { getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { ContextAlignment } from \"document/components/utils/contextAlignmentActions.ts\"\nimport React from \"react\"\nimport { getAcceleratorTokenSeparator, getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport * as styles from \"./AlignmentRow.styles.ts\"\nimport { IconAlignBottom } from \"./icons/IconAlignBottom.tsx\"\nimport { IconAlignCenter } from \"./icons/IconAlignCenter.tsx\"\nimport { IconAlignLeft } from \"./icons/IconAlignLeft.tsx\"\nimport { IconAlignMiddle } from \"./icons/IconAlignMiddle.tsx\"\nimport { IconAlignRight } from \"./icons/IconAlignRight.tsx\"\nimport { IconAlignTop } from \"./icons/IconAlignTop.tsx\"\nimport { IconDistributeHorizontal } from \"./icons/IconDistributeHorizontal.tsx\"\nimport { IconDistributeVertical } from \"./icons/IconDistributeVertical.tsx\"\nimport { NewIconAlignBottom } from \"./icons/NewIconAlignBottom.tsx\"\nimport { NewIconAlignCenter } from \"./icons/NewIconAlignCenter.tsx\"\nimport { NewIconAlignLeft } from \"./icons/NewIconAlignLeft.tsx\"\nimport { NewIconAlignMiddle } from \"./icons/NewIconAlignMiddle.tsx\"\nimport { NewIconAlignRight } from \"./icons/NewIconAlignRight.tsx\"\nimport { NewIconAlignTop } from \"./icons/NewIconAlignTop.tsx\"\nimport { NewIconDistributeHorizontal } from \"./icons/NewIconDistributeHorizontal.tsx\"\nimport { NewIconDistributeVertical } from \"./icons/NewIconDistributeVertical.tsx\"\n\ntype ButtonType =\n\t| {\n\t\t\taction: Extract<AppAction, `align${string}`>\n\t\t\tIcon: React.ComponentType\n\t\t\toption: ContextAlignment.AlignOption\n\t  }\n\t| {\n\t\t\taction: Extract<AppAction, `distribute${string}`>\n\t\t\tIcon: React.ComponentType\n\t\t\toption: ContextAlignment.DistributeOption\n\t  }\n\nconst buttons: ButtonType[] = [\n\t{ action: \"alignLeft\", Icon: IconAlignLeft, option: \"Left\" },\n\t{ action: \"alignCenter\", Icon: IconAlignCenter, option: \"Center\" },\n\t{ action: \"alignRight\", Icon: IconAlignRight, option: \"Right\" },\n\t{ action: \"alignTop\", Icon: IconAlignTop, option: \"Top\" },\n\t{ action: \"alignMiddle\", Icon: IconAlignMiddle, option: \"Middle\" },\n\t{ action: \"alignBottom\", Icon: IconAlignBottom, option: \"Bottom\" },\n\t{ action: \"distributeHorizontal\", Icon: IconDistributeHorizontal, option: \"Horizontally\" },\n\t{ action: \"distributeVertical\", Icon: IconDistributeVertical, option: \"Vertically\" },\n]\n\nconst newButtons: ButtonType[] = [\n\t{ action: \"alignLeft\", Icon: NewIconAlignLeft, option: \"Left\" },\n\t{ action: \"alignCenter\", Icon: NewIconAlignCenter, option: \"Center\" },\n\t{ action: \"alignRight\", Icon: NewIconAlignRight, option: \"Right\" },\n\t{ action: \"alignTop\", Icon: NewIconAlignTop, option: \"Top\" },\n\t{ action: \"alignMiddle\", Icon: NewIconAlignMiddle, option: \"Middle\" },\n\t{ action: \"alignBottom\", Icon: NewIconAlignBottom, option: \"Bottom\" },\n\t{ action: \"distributeHorizontal\", Icon: NewIconDistributeHorizontal, option: \"Horizontally\" },\n\t{ action: \"distributeVertical\", Icon: NewIconDistributeVertical, option: \"Vertically\" },\n]\n\ninterface Props {\n\talignActionsEnabled: boolean\n\tdistributeActionsEnabled: boolean\n\talignAction: (type: ContextAlignment.AlignOption) => void\n\tdistributeAction: (type: ContextAlignment.DistributeOption) => void\n}\n\nexport const AlignmentRow = React.memo(\n\t({ alignActionsEnabled, distributeActionsEnabled, alignAction, distributeAction }: Props) => {\n\t\tconst preferMouseDown = usePrefersMouseDown()\n\t\tconst agentExperimentOn = useExperimentIsOn(\"agent\")\n\n\t\tconst alignmentButtons = agentExperimentOn ? newButtons : buttons\n\n\t\treturn (\n\t\t\t<div className={styles.wrapper}>\n\t\t\t\t<div className={styles.container}>\n\t\t\t\t\t{alignmentButtons.map(buttonProps => {\n\t\t\t\t\t\tconst enabled = isAlignButton(buttonProps) ? alignActionsEnabled : distributeActionsEnabled\n\t\t\t\t\t\tconst handler = () => {\n\t\t\t\t\t\t\tif (!enabled) return\n\n\t\t\t\t\t\t\tif (isAlignButton(buttonProps)) {\n\t\t\t\t\t\t\t\talignAction(buttonProps.option)\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdistributeAction(buttonProps.option)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t// biome-ignore lint/nursery/noStaticElementInteractions:\n\t\t\t\t\t\t\t// biome-ignore lint/a11y/useKeyWithClickEvents: historically not a button, but buttons in this part of the UI don't tab cycle correctly, so switching to a button is more confusing UX currently\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={buttonProps.action}\n\t\t\t\t\t\t\t\tclassName={cx(\"alignment-button\", alignActionsEnabled && styles.buttonStyleActive)}\n\t\t\t\t\t\t\t\ttitle={getTooltip(buttonProps.action)}\n\t\t\t\t\t\t\t\tonMouseDown={preferMouseDown ? event => buttonIsLeftClick(event.button) && handler() : undefined}\n\t\t\t\t\t\t\t\tonClick={preferMouseDown ? syntheticClickHandlerForMouseDown(handler) : handler}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<buttonProps.Icon />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t},\n)\n\nfunction getTooltip(actionType: AppAction) {\n\tconst actionAccelerator = getActionAccelerator(actionType)\n\tconst actionLabel = actionLabels[actionType]\n\n\tif (!actionAccelerator) return actionLabel\n\n\treturn [actionLabel, getAcceleratorTokens(actionAccelerator).join(getAcceleratorTokenSeparator())].join(\"  \")\n}\n\nfunction isAlignButton(buttonProps: ButtonType): buttonProps is Extract<ButtonType, { action: `align${string}` }> {\n\treturn buttonProps.action.startsWith(\"align\")\n}\n", "import \"AlignmentRow.styles_9s7h4d.wyw.css\"; export const wrapper = \"wrapper_w1pbb96s\";\nexport const container = \"container_c1dnyo6f\";\nexport const buttonStyleActive = \"buttonStyleActive_b9f5udu\";", "export function IconAlignBottom() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 0 13.5 C 0 13.224 0.224 13 0.5 13 L 15.5 13 C 15.776 13 16 13.224 16 13.5 L 16 13.5 C 16 13.776 15.776 14 15.5 14 L 0.5 14 C 0.224 14 0 13.776 0 13.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 5 2 C 5 0.895 5.895 0 7 0 L 9 0 C 10.105 0 11 0.895 11 2 L 11 9 C 11 10.105 10.105 11 9 11 L 7 11 C 5.895 11 5 10.105 5 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconAlignCenter() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"15\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 7 0.5 C 7 0.224 7.224 0 7.5 0 L 7.5 0 C 7.776 0 8 0.224 8 0.5 L 8 15.5 C 8 15.776 7.776 16 7.5 16 L 7.5 16 C 7.224 16 7 15.776 7 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 1 7 C 1 5.895 1.895 5 3 5 L 12 5 C 13.105 5 14 5.895 14 7 L 14 9 C 14 10.105 13.105 11 12 11 L 3 11 C 1.895 11 1 10.105 1 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconAlignLeft() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 0.5 0 C 0.776 0 1 0.224 1 0.5 L 1 15.5 C 1 15.776 0.776 16 0.5 16 L 0.5 16 C 0.224 16 0 15.776 0 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 3 7 C 3 5.895 3.895 5 5 5 L 12 5 C 13.105 5 14 5.895 14 7 L 14 9 C 14 10.105 13.105 11 12 11 L 5 11 C 3.895 11 3 10.105 3 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconAlignMiddle() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"13\">\n\t\t\t<path\n\t\t\t\td=\"M 0 6.5 C 0 6.224 0.224 6 0.5 6 L 15.5 6 C 15.776 6 16 6.224 16 6.5 L 16 6.5 C 16 6.776 15.776 7 15.5 7 L 0.5 7 C 0.224 7 0 6.776 0 6.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 5 2 C 5 0.895 5.895 0 7 0 L 9 0 C 10.105 0 11 0.895 11 2 L 11 11 C 11 12.105 10.105 13 9 13 L 7 13 C 5.895 13 5 12.105 5 11 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconAlignRight() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 13 0.5 C 13 0.224 13.224 0 13.5 0 L 13.5 0 C 13.776 0 14 0.224 14 0.5 L 14 15.5 C 14 15.776 13.776 16 13.5 16 L 13.5 16 C 13.224 16 13 15.776 13 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 0 7 C 0 5.895 0.895 5 2 5 L 9 5 C 10.105 5 11 5.895 11 7 L 11 9 C 11 10.105 10.105 11 9 11 L 2 11 C 0.895 11 0 10.105 0 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconAlignTop() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 15.5 0 C 15.776 0 16 0.224 16 0.5 L 16 0.5 C 16 0.776 15.776 1 15.5 1 L 0.5 1 C 0.224 1 0 0.776 0 0.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 5 5 C 5 3.895 5.895 3 7 3 L 9 3 C 10.105 3 11 3.895 11 5 L 11 12 C 11 13.105 10.105 14 9 14 L 7 14 C 5.895 14 5 13.105 5 12 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconDistributeHorizontal() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 0.5 0 C 0.776 0 1 0.224 1 0.5 L 1 15.5 C 1 15.776 0.776 16 0.5 16 L 0.5 16 C 0.224 16 0 15.776 0 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 11 0.5 C 11 0.224 11.224 0 11.5 0 L 11.5 0 C 11.776 0 12 0.224 12 0.5 L 12 15.5 C 12 15.776 11.776 16 11.5 16 L 11.5 16 C 11.224 16 11 15.776 11 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 3 5 C 3 3.895 3.895 3 5 3 L 7 3 C 8.105 3 9 3.895 9 5 L 9 11 C 9 12.105 8.105 13 7 13 L 5 13 C 3.895 13 3 12.105 3 11 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconDistributeVertical() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"12\">\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 15.5 0 C 15.776 0 16 0.224 16 0.5 L 16 0.5 C 16 0.776 15.776 1 15.5 1 L 0.5 1 C 0.224 1 0 0.776 0 0.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 0 11.5 C 0 11.224 0.224 11 0.5 11 L 15.5 11 C 15.776 11 16 11.224 16 11.5 L 16 11.5 C 16 11.776 15.776 12 15.5 12 L 0.5 12 C 0.224 12 0 11.776 0 11.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 3 5 C 3 3.895 3.895 3 5 3 L 11 3 C 12.105 3 13 3.895 13 5 L 13 7 C 13 8.105 12.105 9 11 9 L 5 9 C 3.895 9 3 8.105 3 7 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignBottom() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"14\">\n\t\t\t<title>Align Bottom</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 13.5 C 0 13.224 0.224 13 0.5 13 L 15.5 13 C 15.776 13 16 13.224 16 13.5 L 16 13.5 C 16 13.776 15.776 14 15.5 14 L 0.5 14 C 0.224 14 0 13.776 0 13.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 5 2 C 5 0.895 5.895 0 7 0 L 9 0 C 10.105 0 11 0.895 11 2 L 11 9 C 11 10.105 10.105 11 9 11 L 7 11 C 5.895 11 5 10.105 5 9 Z\"\n\t\t\t\t\t\tid=\"a1554z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1555z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1554z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1554z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1555z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignCenter() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"15\" height=\"16\">\n\t\t\t<title>Align Center</title>\n\t\t\t<path d=\"M 7 0.5 C 7 0.224 7.224 0 7.5 0 L 7.5 0 C 7.776 0 8 0.224 8 0.5 L 8 6 L 7 6 Z\" fill=\"currentColor\" />\n\t\t\t<path\n\t\t\t\td=\"M 7 10 L 8 10 L 8 15.5 C 8 15.776 7.776 16 7.5 16 L 7.5 16 C 7.224 16 7 15.776 7 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 1 7 C 1 5.895 1.895 5 3 5 L 12 5 C 13.105 5 14 5.895 14 7 L 14 9 C 14 10.105 13.105 11 12 11 L 3 11 C 1.895 11 1 10.105 1 9 Z\"\n\t\t\t\t\t\tid=\"a1534z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1535z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1534z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1534z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1535z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignLeft() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"14\" height=\"16\">\n\t\t\t<title>Align Left</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 0.5 0 C 0.776 0 1 0.224 1 0.5 L 1 15.5 C 1 15.776 0.776 16 0.5 16 L 0.5 16 C 0.224 16 0 15.776 0 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 3 7 C 3 5.895 3.895 5 5 5 L 12 5 C 13.105 5 14 5.895 14 7 L 14 9 C 14 10.105 13.105 11 12 11 L 5 11 C 3.895 11 3 10.105 3 9 Z\"\n\t\t\t\t\t\tid=\"a1538z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1539z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1538z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1538z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1539z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignMiddle() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"13\">\n\t\t\t<title>Align Middle</title>\n\t\t\t<path d=\"M 0 6.5 C 0 6.224 0.224 6 0.5 6 L 6 6 L 6 7 L 0.5 7 C 0.224 7 0 6.776 0 6.5 Z\" fill=\"currentColor\" />\n\t\t\t<path\n\t\t\t\td=\"M 10 6 L 15.5 6 C 15.776 6 16 6.224 16 6.5 L 16 6.5 C 16 6.776 15.776 7 15.5 7 L 10 7 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 5 2 C 5 0.895 5.895 0 7 0 L 9 0 C 10.105 0 11 0.895 11 2 L 11 11 C 11 12.105 10.105 13 9 13 L 7 13 C 5.895 13 5 12.105 5 11 Z\"\n\t\t\t\t\t\tid=\"a1550z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1551z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1550z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1550z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1551z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignRight() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"14\" height=\"16\">\n\t\t\t<title>Align Right</title>\n\t\t\t<path\n\t\t\t\td=\"M 13 0.5 C 13 0.224 13.224 0 13.5 0 L 13.5 0 C 13.776 0 14 0.224 14 0.5 L 14 15.5 C 14 15.776 13.776 16 13.5 16 L 13.5 16 C 13.224 16 13 15.776 13 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 0 7 C 0 5.895 0.895 5 2 5 L 9 5 C 10.105 5 11 5.895 11 7 L 11 9 C 11 10.105 10.105 11 9 11 L 2 11 C 0.895 11 0 10.105 0 9 Z\"\n\t\t\t\t\t\tid=\"a1542z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1543z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1542z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1542z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1543z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconAlignTop() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"14\">\n\t\t\t<title>Align Top</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 15.5 0 C 15.776 0 16 0.224 16 0.5 L 16 0.5 C 16 0.776 15.776 1 15.5 1 L 0.5 1 C 0.224 1 0 0.776 0 0.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 5 5 C 5 3.895 5.895 3 7 3 L 9 3 C 10.105 3 11 3.895 11 5 L 11 12 C 11 13.105 10.105 14 9 14 L 7 14 C 5.895 14 5 13.105 5 12 Z\"\n\t\t\t\t\t\tid=\"a1546z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1547z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1546z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1546z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1547z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconDistributeHorizontal() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"12\" height=\"16\">\n\t\t\t<title>Distribute Horizontal</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 0.5 0 C 0.776 0 1 0.224 1 0.5 L 1 15.5 C 1 15.776 0.776 16 0.5 16 L 0.5 16 C 0.224 16 0 15.776 0 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 11 0.5 C 11 0.224 11.224 0 11.5 0 L 11.5 0 C 11.776 0 12 0.224 12 0.5 L 12 15.5 C 12 15.776 11.776 16 11.5 16 L 11.5 16 C 11.224 16 11 15.776 11 15.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 3 5 C 3 3.895 3.895 3 5 3 L 7 3 C 8.105 3 9 3.895 9 5 L 9 11 C 9 12.105 8.105 13 7 13 L 5 13 C 3.895 13 3 12.105 3 11 Z\"\n\t\t\t\t\t\tid=\"a1560z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1561z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1560z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1560z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1561z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function NewIconDistributeVertical() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" xmlnsXlink=\"http://www.w3.org/1999/xlink\" width=\"16\" height=\"12\">\n\t\t\t<title>Distribute Vertical</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 0.5 C 0 0.224 0.224 0 0.5 0 L 15.5 0 C 15.776 0 16 0.224 16 0.5 L 16 0.5 C 16 0.776 15.776 1 15.5 1 L 0.5 1 C 0.224 1 0 0.776 0 0.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 0 11.5 C 0 11.224 0.224 11 0.5 11 L 15.5 11 C 15.776 11 16 11.224 16 11.5 L 16 11.5 C 16 11.776 15.776 12 15.5 12 L 0.5 12 C 0.224 12 0 11.776 0 11.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 3 5 C 3 3.895 3.895 3 5 3 L 11 3 C 12.105 3 13 3.895 13 5 L 13 7 C 13 8.105 12.105 9 11 9 L 5 9 C 3.895 9 3 8.105 3 7 Z\"\n\t\t\t\t\t\tid=\"a1566z\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"a1567z\">\n\t\t\t\t\t\t<use xlinkHref=\"#a1566z\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\txlinkHref=\"#a1566z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity=\"0.3\"\n\t\t\t\t\tclipPath=\"url(#a1567z)\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport {\n\tgroupPathSegmentSelectors,\n\thandleUpdate,\n\tsegmentHandlePoint,\n} from \"document/components/tools/pathEdit/utils/index.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PathNode } from \"document/models/CanvasTree/index.ts\"\nimport { nodeIDFromString } from \"document/models/CanvasTree/index.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound, isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { PathSegmentSelector, SegmentHandleSelector } from \"document/stores/PathSelectionStore.ts\"\nimport { PathSelectionType } from \"document/stores/PathSelectionStore.ts\"\nimport type { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { roundedNumber } from \"library/render/utils/roundedNumber.ts\"\nimport React from \"react\"\nimport { commonPropertyValue } from \"utils/commonValue.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tpathSelection: PathSegmentSelector[]\n\tsegmentHandle: SegmentHandleSelector | null\n\tselectionType: PathSelectionType\n}\n\nexport class PathPointPositionRow extends React.PureComponent<Props, {}> {\n\tchangeX = engine.scheduler.wrapHandler((value: number) => {\n\t\tthis.newValue(value, true)\n\t})\n\n\tchangeY = engine.scheduler.wrapHandler((value: number) => {\n\t\tthis.newValue(value, false)\n\t})\n\n\tnewValue = (value: number, xValueDidChange: boolean) => {\n\t\tconst tree = engine.tree\n\t\tconst { pathSelection, segmentHandle } = this.props\n\n\t\tif (segmentHandle) {\n\t\t\tconst point = segmentHandlePoint(tree, segmentHandle)\n\t\t\tif (!point) return\n\n\t\t\tif (xValueDidChange) {\n\t\t\t\tpoint.x = value\n\t\t\t} else {\n\t\t\t\tpoint.y = value\n\t\t\t}\n\n\t\t\tconst node = tree.get<PathNode>(segmentHandle.id)\n\t\t\tif (!node) return\n\t\t\tconst pathSegments = handleUpdate(tree, segmentHandle, point)\n\t\t\tnode.set(node.updateForPath({ pathSegments }))\n\t\t} else {\n\t\t\tconst selectedIndexesPerNode = groupPathSegmentSelectors(pathSelection)\n\n\t\t\tfor (const nodeId in selectedIndexesPerNode) {\n\t\t\t\tconst node = tree.getNode<PathNode>(nodeIDFromString(nodeId))\n\t\t\t\tif (!node) continue\n\n\t\t\t\tconst selectedIndexes = selectedIndexesPerNode[nodeId]\n\t\t\t\tconst pathSegments = node.pathSegments.map((vecPoint: PathSegment, index: number) => {\n\t\t\t\t\tconst partOfSelection = selectedIndexes.includes(index)\n\t\t\t\t\tif (partOfSelection) {\n\t\t\t\t\t\tif (xValueDidChange) {\n\t\t\t\t\t\t\treturn vecPoint.merge({ x: value - node.x })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn vecPoint.merge({ y: value - node.y })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn vecPoint\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\toverride render() {\n\t\tconst tree = engine.tree\n\t\tconst { pathSelection, segmentHandle, selectionType } = this.props\n\n\t\tlet xValue: Reduced<number> = NotFound\n\t\tlet yValue: Reduced<number> = NotFound\n\n\t\tif (selectionType === PathSelectionType.Segments) {\n\t\t\tif (segmentHandle) {\n\t\t\t\tconst point = segmentHandlePoint(tree, segmentHandle)\n\t\t\t\tif (point) {\n\t\t\t\t\txValue = point.x\n\t\t\t\t\tyValue = point.y\n\t\t\t\t}\n\t\t\t} else if (pathSelection.length) {\n\t\t\t\tconst pathSegmentsAnchors = pathSelection.map(vecPointSelector => {\n\t\t\t\t\tconst node = tree.getNode(vecPointSelector.id) as PathNode\n\t\t\t\t\tconst vectorPoint = node.pathSegments[vecPointSelector.index]\n\t\t\t\t\tconst offset = { x: node.x, y: node.y }\n\t\t\t\t\treturn Point.add(vectorPoint, offset)\n\t\t\t\t})\n\n\t\t\t\txValue = commonPropertyValue(pathSegmentsAnchors, \"x\")\n\t\t\t\tyValue = commonPropertyValue(pathSegmentsAnchors, \"y\")\n\t\t\t}\n\t\t}\n\n\t\tif (isNumber(xValue)) {\n\t\t\txValue = roundedNumber(xValue, 2)\n\t\t}\n\t\tif (isNumber(yValue)) {\n\t\t\tyValue = roundedNumber(yValue, 2)\n\t\t}\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Position\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tlabel=\"X\"\n\t\t\t\t\tvalue={notFoundToUndefined(xValue)}\n\t\t\t\t\tonChange={this.changeX}\n\t\t\t\t\tenabled={isFound(xValue)}\n\t\t\t\t/>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tlabel=\"Y\"\n\t\t\t\t\tvalue={notFoundToUndefined(yValue)}\n\t\t\t\t\tonChange={this.changeY}\n\t\t\t\t\tenabled={isFound(yValue)}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { AutoSized } from \"@framerjs/fresco/layout-transitions\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { groupPathSegmentSelectors } from \"document/components/tools/pathEdit/utils/index.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PathNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound, isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport type { PathSegmentSelector } from \"document/stores/PathSelectionStore.ts\"\nimport { PathSelectionType } from \"document/stores/PathSelectionStore.ts\"\nimport type { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport React from \"react\"\n\ninterface Props {\n\tpathSelection: PathSegmentSelector[]\n\tselectionType: PathSelectionType\n\tselectionDidChange?: boolean\n}\n\nexport class PathSegmentRadiusRow extends React.PureComponent<Props> {\n\tonChangeRadius = engine.scheduler.wrapHandler((radius: number) => {\n\t\tconst update = { radius }\n\t\tconst { pathSelection } = this.props\n\n\t\tconst selectedIndexesPerNode = groupPathSegmentSelectors(pathSelection)\n\t\tfor (const nodeId in selectedIndexesPerNode) {\n\t\t\tconst node = engine.tree.getNode<PathNode>(nodeId)\n\t\t\tif (!node) continue\n\t\t\tconst selectedIndexes = selectedIndexesPerNode[nodeId]\n\t\t\tconst pathSegments = node.pathSegments.map((segment: PathSegment, index: number) => {\n\t\t\t\tconst notPartOfSelection = !selectedIndexes?.includes(index)\n\t\t\t\tif (notPartOfSelection) {\n\t\t\t\t\treturn segment\n\t\t\t\t}\n\t\t\t\treturn segment.merge(update)\n\t\t\t})\n\n\t\t\tnode.set(node.updateForPath({ pathSegments }))\n\t\t}\n\t})\n\n\toverride render() {\n\t\tconst tree = engine.tree\n\t\tconst { selectionType, pathSelection } = this.props\n\t\tconst result: { radius: Reduced<number> } = { radius: NotFound }\n\t\tlet allowRadiusControl = selectionType !== PathSelectionType.Curves\n\n\t\tif (allowRadiusControl) {\n\t\t\tconst selectedIndexesPerNode = groupPathSegmentSelectors(pathSelection)\n\t\t\tconst ids = Object.keys(selectedIndexesPerNode)\n\t\t\tfor (const id of ids) {\n\t\t\t\tconst node = tree.getNode(id) as PathNode\n\t\t\t\tconst selectedIndexes = selectedIndexesPerNode[id]\n\t\t\t\tPath.reduceRadius(node.pathSegments, node.pathClosed, result, selectedIndexes)\n\t\t\t}\n\n\t\t\tallowRadiusControl = isFound(result.radius)\n\t\t}\n\n\t\treturn (\n\t\t\t<AutoSized dependencies={allowRadiusControl}>\n\t\t\t\t{allowRadiusControl && (\n\t\t\t\t\t<PanelRow title=\"Radius\">\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={notFoundToUndefined(result.radius)}\n\t\t\t\t\t\t\tonChange={this.onChangeRadius}\n\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Slider value={notFoundToUndefined(result.radius)} onChange={this.onChangeRadius} max={50} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t</AutoSized>\n\t\t)\n\t}\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { PathPointPositionRow } from \"document/components/chrome/properties/rows/PathPointPositionRow.tsx\"\nimport { PathSegmentRadiusRow } from \"document/components/chrome/properties/rows/PathSegmentRadiusRow.tsx\"\nimport type { PathSelectionState } from \"document/stores/PathSelectionStore.ts\"\nimport React from \"react\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PathCurvePanel } from \"./PathCurvePanel.tsx\"\n\ninterface Props extends PathSelectionState {\n\tselectionDidChange?: boolean\n}\n\nexport class PathPanel extends React.PureComponent<Props> {\n\toverride render() {\n\t\tconst { segmentSelection, segmentHandle, selectionType, selectionDidChange } = this.props\n\n\t\treturn (\n\t\t\t<Panel header={<PanelSectionHeader title={<T>Path</T>} />}>\n\t\t\t\t<PathPointPositionRow\n\t\t\t\t\tpathSelection={segmentSelection}\n\t\t\t\t\tsegmentHandle={segmentHandle}\n\t\t\t\t\tselectionType={selectionType}\n\t\t\t\t/>\n\t\t\t\t<PathCurvePanel\n\t\t\t\t\tsegmentSelection={segmentSelection}\n\t\t\t\t\tsegmentHandle={segmentHandle}\n\t\t\t\t\tselectionType={selectionType}\n\t\t\t\t/>\n\t\t\t\t<PathSegmentRadiusRow\n\t\t\t\t\tpathSelection={segmentSelection}\n\t\t\t\t\tselectionType={selectionType}\n\t\t\t\t\tselectionDidChange={!selectionDidChange}\n\t\t\t\t/>\n\t\t\t</Panel>\n\t\t)\n\t}\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport type { Writeable } from \"@framerjs/shared\"\nimport { assert, List } from \"@framerjs/shared\"\nimport { groupPathSegmentSelectors } from \"document/components/tools/pathEdit/utils/index.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PathNode } from \"document/models/CanvasTree/index.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { PathSegmentSelector, SegmentHandleSelector } from \"document/stores/PathSelectionStore.ts\"\nimport { PathSelectionType } from \"document/stores/PathSelectionStore.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 React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { IconPathCurveDisconnected } from \"./icons/IconPathCurveDisconnected.tsx\"\nimport { IconPathCurveMirrored } from \"./icons/IconPathCurveMirrored.tsx\"\nimport { IconPathCurveStraight } from \"./icons/IconPathCurveStraight.tsx\"\n\ninterface Props {\n\tsegmentSelection: PathSegmentSelector[]\n\tsegmentHandle: SegmentHandleSelector | null\n\tselectionType: PathSelectionType\n}\n\nconst updateMirroringType = engine.scheduler.wrapHandler(\n\t(mirrorType: HandleMirroring, { segmentSelection, segmentHandle, selectionType }: Props) => {\n\t\tif (selectionType === PathSelectionType.Curves) return\n\n\t\tif (segmentHandle) {\n\t\t\tconst node = engine.tree.get<PathNode>(segmentHandle.id)\n\t\t\tif (!node) return\n\n\t\t\tconst pathSegments = List.update(node.pathSegments, segmentHandle.index, () => {\n\t\t\t\treturn updateSegment(node.pathSegments, segmentHandle.index, mirrorType)\n\t\t\t})\n\n\t\t\tnode.set(node.updateForPath({ pathSegments }))\n\t\t} else {\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 = engine.tree.getNode<PathNode>(nodeId)\n\t\t\t\tif (!node) continue\n\n\t\t\t\tconst currentSegments = node.pathSegments\n\n\t\t\t\tconst pathSegments = node.pathSegments.map((segment: PathSegment, segmentIndex: number) => {\n\t\t\t\t\tconst partOfSelection = selectedIndexes.includes(segmentIndex)\n\t\t\t\t\tif (!partOfSelection) return segment\n\n\t\t\t\t\treturn updateSegment(currentSegments, segmentIndex, mirrorType)\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\nexport function PathCurvePanel(props: Props) {\n\tconst { selectionType, segmentHandle, segmentSelection } = props\n\n\tconst latestPropsRef = React.useRef(props)\n\tlatestPropsRef.current = props\n\n\tlet commonMirrorType: Reduced<HandleMirroring> = NotFound\n\n\tif (selectionType !== PathSelectionType.Curves) {\n\t\tlet mirroringTypes: HandleMirroring[]\n\n\t\tif (segmentHandle) {\n\t\t\tconst node = engine.tree.getNode(segmentHandle.id) as PathNode\n\t\t\tconst segment = node.pathSegments[segmentHandle.index]\n\t\t\tassert(segment, \"Expected segment at segmentHandle.index\")\n\t\t\tmirroringTypes = [segment.handleMirroring]\n\t\t} else {\n\t\t\tmirroringTypes = segmentSelection.map(segmentSelector => {\n\t\t\t\tconst node = engine.tree.getNode(segmentSelector.id) as PathNode\n\t\t\t\tconst pathSegment = node.pathSegments[segmentSelector.index]\n\t\t\t\tassert(pathSegment, \"Expected pathSegment at segmentSelector.index\")\n\t\t\t\treturn pathSegment.handleMirroring\n\t\t\t})\n\t\t}\n\n\t\tcommonMirrorType = commonValue(mirroringTypes)\n\t}\n\n\tconst updateHandleMirroring = React.useCallback((type: HandleMirroring) => {\n\t\tupdateMirroringType(type, latestPropsRef.current)\n\t}, [])\n\n\treturn (\n\t\t<PanelRow title=\"Curve\">\n\t\t\t<SegmentedControl\n\t\t\t\tstyle={doubleColumn}\n\t\t\t\tenabled={selectionType !== PathSelectionType.Curves && segmentSelection.length > 0}\n\t\t\t>\n\t\t\t\t<SegmentedControlItem<HandleMirroring>\n\t\t\t\t\ttitle=\"Straight Corner\"\n\t\t\t\t\tidentifier=\"straight\"\n\t\t\t\t\tselected={commonMirrorType === \"straight\"}\n\t\t\t\t\tonSelect={updateHandleMirroring}\n\t\t\t\t>\n\t\t\t\t\t<IconPathCurveStraight />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem<HandleMirroring>\n\t\t\t\t\ttitle=\"Mirrored Handles\"\n\t\t\t\t\tidentifier=\"symmetric\"\n\t\t\t\t\tselected={commonMirrorType === \"symmetric\"}\n\t\t\t\t\tonSelect={updateHandleMirroring}\n\t\t\t\t>\n\t\t\t\t\t<IconPathCurveMirrored />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem<HandleMirroring>\n\t\t\t\t\ttitle=\"Disconnected Handles\"\n\t\t\t\t\tidentifier=\"disconnected\"\n\t\t\t\t\tselected={commonMirrorType === \"disconnected\"}\n\t\t\t\t\tonSelect={updateHandleMirroring}\n\t\t\t\t>\n\t\t\t\t\t<IconPathCurveDisconnected />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n\nfunction updateSegment(\n\tcurrentSegments: readonly PathSegment[],\n\tsegmentIndex: number,\n\tcommonMirrorType: HandleMirroring,\n) {\n\tconst segment = currentSegments[segmentIndex]\n\tassert(segment, \"Expected segment at segmentIndex\")\n\n\tswitch (commonMirrorType) {\n\t\tcase \"disconnected\":\n\t\tcase \"symmetric\": {\n\t\t\tconst update: Writeable<Partial<PathSegment>> = {\n\t\t\t\thandleMirroring: commonMirrorType,\n\t\t\t}\n\n\t\t\tconst noHandleIn = segment.handleInX === 0 && segment.handleInY === 0\n\t\t\tconst noHandleOut = segment.handleOutX === 0 && segment.handleOutY === 0\n\n\t\t\tif (\n\t\t\t\tsegment.handleMirroring === \"straight\" ||\n\t\t\t\t(update.handleMirroring === \"symmetric\" && noHandleIn && noHandleOut)\n\t\t\t) {\n\t\t\t\tconst control1 = PathSegment.curveDefault(currentSegments, segmentIndex)\n\t\t\t\tconst control2 = Point.reverse(control1)\n\n\t\t\t\tupdate.handleOutX = control1.x\n\t\t\t\tupdate.handleOutY = control1.y\n\t\t\t\tupdate.handleInX = control2.x\n\t\t\t\tupdate.handleInY = control2.y\n\t\t\t} else if (update.handleMirroring === \"symmetric\") {\n\t\t\t\tif (noHandleIn) {\n\t\t\t\t\tupdate.handleInX = -segment.handleOutX\n\t\t\t\t\tupdate.handleInY = -segment.handleOutY\n\t\t\t\t} else if (noHandleOut) {\n\t\t\t\t\tupdate.handleOutX = -segment.handleInX\n\t\t\t\t\tupdate.handleOutY = -segment.handleInY\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn segment.merge(update)\n\t\t}\n\t\tdefault:\n\t\t\treturn segment.merge({\n\t\t\t\thandleMirroring: \"straight\",\n\t\t\t\thandleOutX: 0,\n\t\t\t\thandleOutY: 0,\n\t\t\t\thandleInX: 0,\n\t\t\t\thandleInY: 0,\n\t\t\t})\n\t}\n}\n", "export function IconPathCurveDisconnected() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"14\">\n\t\t\t<g transform=\"translate(0 0.5)\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 11 3.5 L 11 3.5 C 7.223 4.759 4.259 7.723 3 11.5 L 3 11.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstrokeOpacity={0.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path d=\"M 11 3.5 L 18 10.5\" fill=\"transparent\" strokeWidth=\"1.5\" stroke=\"currentColor\" strokeLinecap=\"round\" />\n\t\t\t\t<path d=\"M 3 3.5 L 11 3.5\" fill=\"transparent\" strokeWidth=\"1.5\" stroke=\"currentColor\" strokeLinecap=\"round\" />\n\t\t\t\t<path\n\t\t\t\t\td=\"M 11 0 C 12.933 0 14.5 1.567 14.5 3.5 C 14.5 5.433 12.933 7 11 7 C 9.067 7 7.5 5.433 7.5 3.5 C 7.5 1.567 9.067 0 11 0 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 2 1.5 C 3.105 1.5 4 2.395 4 3.5 C 4 4.605 3.105 5.5 2 5.5 C 0.895 5.5 0 4.605 0 3.5 C 0 2.395 0.895 1.5 2 1.5 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 18 8.5 C 19.105 8.5 20 9.395 20 10.5 C 20 11.605 19.105 12.5 18 12.5 C 16.895 12.5 16 11.605 16 10.5 C 16 9.395 16.895 8.5 18 8.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", "export function IconPathCurveMirrored() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"14\">\n\t\t\t<g transform=\"translate(0 0.5)\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 11 3.5 L 11 3.5 C 7.223 4.759 4.259 7.723 3 11.5 L 3 11.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstrokeOpacity={0.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 11 3.5 L 11 3.5 C 14.777 4.759 17.741 7.723 19 11.5 L 19 11.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstrokeOpacity={0.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path d=\"M 3 3.5 L 19 3.5\" fill=\"transparent\" strokeWidth=\"1.5\" stroke=\"currentColor\" strokeLinecap=\"round\" />\n\t\t\t\t<path\n\t\t\t\t\td=\"M 11 0 C 12.933 0 14.5 1.567 14.5 3.5 C 14.5 5.433 12.933 7 11 7 C 9.067 7 7.5 5.433 7.5 3.5 C 7.5 1.567 9.067 0 11 0 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 2 1.5 C 3.105 1.5 4 2.395 4 3.5 C 4 4.605 3.105 5.5 2 5.5 C 0.895 5.5 0 4.605 0 3.5 C 0 2.395 0.895 1.5 2 1.5 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 20 1.5 C 21.105 1.5 22 2.395 22 3.5 C 22 4.605 21.105 5.5 20 5.5 C 18.895 5.5 18 4.605 18 3.5 C 18 2.395 18.895 1.5 20 1.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", "export function IconPathCurveStraight() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"14\">\n\t\t\t<g transform=\"translate(2 1.5)\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 7 3.5 L 0 10.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstrokeOpacity={0.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 7 3.5 L 14 10.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\tstrokeOpacity={0.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 7 0 C 8.933 0 10.5 1.567 10.5 3.5 C 10.5 5.433 8.933 7 7 7 C 5.067 7 3.5 5.433 3.5 3.5 C 3.5 1.567 5.067 0 7 0 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 { InputHashContext } from \"@framerjs/fresco\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { PathAlignmentHeader } from \"document/components/chrome/properties/panels/PathAlignmentHeader.tsx\"\nimport { PathPanel } from \"document/components/chrome/properties/panels/PathPanel.tsx\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Properties } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport type { PathSelectionState } from \"document/stores/PathSelectionStore.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { FillPanel } from \"./panels/FillPanel.tsx\"\nimport { Panel } from \"./panels/Panel.tsx\"\nimport { ShadowPanel } from \"./panels/ShadowPanel.tsx\"\nimport { StrokePanel } from \"./panels/StrokePanel.tsx\"\nimport { StyleHeader } from \"./panels/StyleHeader.tsx\"\n\ninterface Props {\n\tproperties: Properties\n\treadOnly: boolean\n\tscopeType: ScopeType\n}\n\nclass PathProperties extends React.PureComponent<Props, PathSelectionState> {\n\tstatic engineChangeKeys = [EngineChange.PathSelection]\n\n\tstatic calculateState(): PathSelectionState {\n\t\treturn engine.stores.pathSelectionStore.state\n\t}\n\n\toverride render() {\n\t\tconst { properties, readOnly, scopeType } = this.props\n\t\tconst { segmentSelection } = this.state\n\t\tconst selectionHash = segmentSelection.map(s => `${s.id}-${s.index}`).join(\"\")\n\n\t\treturn (\n\t\t\t<InputHashContext.Provider value={selectionHash}>\n\t\t\t\t<PathAlignmentHeader {...this.state} />\n\t\t\t\t<PathPanel selectionDidChange={properties.selectionDidChange} {...this.state} />\n\t\t\t\t<Panel\n\t\t\t\t\theader={\n\t\t\t\t\t\t<StyleHeader\n\t\t\t\t\t\t\tallNodeIds={properties.allNodeIds}\n\t\t\t\t\t\t\tbackgroundBlur={properties.backgroundBlur}\n\t\t\t\t\t\t\tblendingMode={properties.blendingMode}\n\t\t\t\t\t\t\tblur={properties.blur}\n\t\t\t\t\t\t\tborderEnabled={properties.borderEnabled}\n\t\t\t\t\t\t\tbrightness={properties.brightness}\n\t\t\t\t\t\t\tcontrast={properties.contrast}\n\t\t\t\t\t\t\tdraggable={properties.draggable}\n\t\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\t\tfillOpacity={properties.fillOpacity}\n\t\t\t\t\t\t\tgrayscale={properties.grayscale}\n\t\t\t\t\t\t\thideScrollbars={properties.hideScrollbars}\n\t\t\t\t\t\t\thueRotate={properties.hueRotate}\n\t\t\t\t\t\t\timageRendering={properties.imageRendering}\n\t\t\t\t\t\t\tinvert={properties.invert}\n\t\t\t\t\t\t\tmasks={properties.masks}\n\t\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\t\tonlyNodesWithDraggable={properties.onlyNodesWithDraggable}\n\t\t\t\t\t\t\tonlyNodesWithFilters={properties.onlyNodesWithFilters}\n\t\t\t\t\t\t\tonlyNodesWithImageRendering={properties.onlyNodesWithImageRendering}\n\t\t\t\t\t\t\tonlyNodesWithMask={properties.onlyNodesWithMask}\n\t\t\t\t\t\t\tonlyNodesWithOverflow={properties.onlyNodesWithOverflow}\n\t\t\t\t\t\t\tonlyNodesWithOverscrollBehavior={properties.onlyNodesWithOverscrollBehavior}\n\t\t\t\t\t\t\tonlyNodesWithPointerEvents={properties.onlyNodesWithPointerEvents}\n\t\t\t\t\t\t\tonlyNodesWithScrollbars={properties.onlyNodesWithScrollbars}\n\t\t\t\t\t\t\tonlyNodesWithTapHighlight={properties.onlyNodesWithTapHighlight}\n\t\t\t\t\t\t\tonlyNodesWithTextSelection={properties.onlyNodesWithTextSelection}\n\t\t\t\t\t\t\tonlyNodesWithTransition={properties.onlyNodesWithTransition}\n\t\t\t\t\t\t\tonlyNodesWithUserSelect={properties.onlyNodesWithUserSelect}\n\t\t\t\t\t\t\tonlyNodesWithViewTransitionNone={properties.onlyNodesWithViewTransitionNone}\n\t\t\t\t\t\t\tonlyNonGestureVariants={properties.onlyNonGestureVariants}\n\t\t\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\t\t\toverflow={properties.overflow}\n\t\t\t\t\t\t\toverflowX={properties.overflowX}\n\t\t\t\t\t\t\toverflowY={properties.overflowY}\n\t\t\t\t\t\t\toverscrollBehavior={properties.overscrollBehavior}\n\t\t\t\t\t\t\tpointerEvents={properties.pointerEvents}\n\t\t\t\t\t\t\tradius={properties.radius}\n\t\t\t\t\t\t\tradiusPerCorner={properties.radiusPerCorner}\n\t\t\t\t\t\t\tcornerShape={properties.cornerShape}\n\t\t\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\t\t\tsaturate={properties.saturate}\n\t\t\t\t\t\t\tsepia={properties.sepia}\n\t\t\t\t\t\t\tshadows={properties.shadows}\n\t\t\t\t\t\t\ttapHighlightColor={properties.tapHighlightColor}\n\t\t\t\t\t\t\ttextSelection={properties.textSelection}\n\t\t\t\t\t\t\ttransition={properties.transition}\n\t\t\t\t\t\t\tuserSelect={properties.userSelect}\n\t\t\t\t\t\t\tviewTransitionNone={properties.viewTransitionNone}\n\t\t\t\t\t\t\tzIndex={properties.zIndex}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<FillPanel\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\tanyNodesWithFill={properties.anyNodesWithFill}\n\t\t\t\t\t\tanyNodeWithNonOptionalFill={properties.anyNodeWithNonOptionalFill}\n\t\t\t\t\t\tonlyFrameNodes={properties.onlyFrameNodes}\n\t\t\t\t\t\tonlyNodesSupportingConicGradient={properties.onlyNodesSupportingConicGradient}\n\t\t\t\t\t\tfillColor={properties.fillColor}\n\t\t\t\t\t\tfillEnabled={properties.fillEnabled}\n\t\t\t\t\t\tfillImage={properties.fillImage}\n\t\t\t\t\t\tfillImages={properties.fillImages}\n\t\t\t\t\t\tfillType={properties.fillType}\n\t\t\t\t\t\tgradientFillSupported={properties.gradientFillSupported}\n\t\t\t\t\t\tfillImageResize={properties.fillImageResize}\n\t\t\t\t\t\taltAttribute={properties.altAttribute}\n\t\t\t\t\t\tonlyNodesWithAltAttribute={properties.onlyNodesWithAltAttribute}\n\t\t\t\t\t\tfillGradientCSS={properties.fillGradientCSS}\n\t\t\t\t\t\tfillImagePositionX={properties.fillImagePositionX}\n\t\t\t\t\t\tfillImagePositionY={properties.fillImagePositionY}\n\t\t\t\t\t\tfillImageTileSize={properties.fillImageTileSize}\n\t\t\t\t\t\tonlyNodesSupportingImageFill={properties.onlyNodesSupportingImageFill}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t// Kit fill image alts\n\t\t\t\t\t\tfillImageAlts={properties.fillImageAlts}\n\t\t\t\t\t\tonlyNodesSupportingFillImageAlts={properties.onlyNodesSupportingFillImageAlts}\n\t\t\t\t\t/>\n\t\t\t\t\t<ShadowPanel\n\t\t\t\t\t\tanyNodesWithShadows={properties.anyNodesWithShadows}\n\t\t\t\t\t\tanyShapeNode={properties.anyShapeNode}\n\t\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\tonlyBreakpointNodes={properties.onlyBreakpointNodes}\n\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={properties.onlyNodesSupportingRealisticShadows}\n\t\t\t\t\t\tonlyNodesSupportingShadowInset={properties.onlyNodesSupportingShadowInset}\n\t\t\t\t\t\tonlyNodesSupportingShadowSpread={properties.onlyNodesSupportingShadowSpread}\n\t\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\t\tshadows={properties.shadows}\n\t\t\t\t\t/>\n\t\t\t\t</Panel>\n\t\t\t\t<StrokePanel\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t\texpandedSelectionForShapeStylesIds={properties.expandedSelectionForShapeStylesIds}\n\t\t\t\t\tonlyShapeNodes={properties.onlyShapeNodes}\n\t\t\t\t\tstrokeEnabled={properties.strokeEnabled}\n\t\t\t\t\tstrokeAlignmentValues={properties.strokeAlignmentValues}\n\t\t\t\t\tstrokeWidth={properties.strokeWidth}\n\t\t\t\t\tstrokeColor={properties.strokeColor}\n\t\t\t\t\tlineJoin={properties.lineJoin}\n\t\t\t\t\tlineCap={properties.lineCap}\n\t\t\t\t\tstrokeDashArray={properties.strokeDashArray}\n\t\t\t\t\tstrokeDashOffset={properties.strokeDashOffset}\n\t\t\t\t/>\n\t\t\t</InputHashContext.Provider>\n\t\t)\n\t}\n}\n\nconst container = createContainer(PathProperties)\nexport { container as PathProperties }\n", "import {\n\tIconLineCapButt,\n\tIconLineCapRound,\n\tIconLineCapSquare,\n\tIconLineJoinBevel,\n\tIconLineJoinMiter,\n\tIconLineJoinRound,\n\tNumberInputWithTicker,\n\tNumberInputWithTickerAndStepper,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport { isMixed } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport type { WithStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport type { ReducedStroke } from \"document/models/CanvasTree/traits/utils/reduceStroke.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { toastIncompatibleStrokWidthAndShadows } from \"document/utils/toastIncompatibleStrokeWidthAndShadows.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { LineCap, LineJoin } from \"library/render/types/Stroke.ts\"\nimport type { StrokeAlignment } from \"library/render/types/StrokeAlignment.ts\"\nimport React, { useCallback } from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { evalMath } from \"utils/evalMath.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { trackingMetadata } from \"../../shared/ColorPicker/trackingMetadata.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { PanelSectionHeaderWithTraits } from \"./PanelSectionHeaderWithTraits.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { addStrokeForNodes } from \"./utils/addStrokeForNodes.ts\"\n\nconst strokeTraitTypes = [TraitType.Stroke]\nconst colorTraitKeys = [\"strokeColor\"]\nconst widthTraitKeys = [\"strokeWidth\"]\nconst alignmentTraitKeys = [\"strokeAlignment\"]\nconst arrayTraitKeys = [\"strokeDashArray\", \"strokeDashOffset\"]\nconst capTraitKeys = [\"lineCap\"]\nconst joinTraitKeys = [\"lineJoin\"]\n\ninterface Props extends Omit<ReducedStroke, \"strokeMiterLimit\" | \"pathsAreClosed\"> {\n\treadOnly: boolean\n\texpandedSelectionForShapeStylesIds: NodeID[]\n\tonlyShapeNodes: boolean\n}\n\ntype StrokeUpdate = Partial<WithStroke>\n\nconst strokeAlignmentOptions: readonly StrokeAlignment[] = [\"center\", \"inside\"]\nconst lineCapOptions: readonly LineCap[] = [\"butt\", \"round\", \"square\"]\nconst lineJoinOptions: readonly LineJoin[] = [\"miter\", \"round\", \"bevel\"]\n\nexport const StrokePanel = React.memo(function StrokePanel(props: Props) {\n\tconst {\n\t\treadOnly,\n\t\texpandedSelectionForShapeStylesIds,\n\t\tonlyShapeNodes,\n\t\tstrokeEnabled,\n\t\tstrokeAlignmentValues,\n\t\tstrokeWidth,\n\t\tstrokeColor,\n\t\tlineJoin,\n\t\tlineCap,\n\t\tstrokeDashArray,\n\t} = props\n\n\tconst getNodes = useCallback(\n\t\t() => engine.tree.getNodesWithTrait(expandedSelectionForShapeStylesIds, withStroke),\n\t\t[expandedSelectionForShapeStylesIds],\n\t)\n\n\tconst onAdd = useEngineCallback(() => {\n\t\tif (readOnly) return\n\t\tconst nodeIds = getNodes().map(node => node.id)\n\t\taddStrokeForNodes(engine, nodeIds)\n\t}, [readOnly, getNodes])\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tif (readOnly) return\n\t\tgetNodes().forEach(node => node.set({ strokeEnabled: false }))\n\t}, [readOnly, getNodes])\n\n\tconst onStrokeColorChange = useEngineCallback(\n\t\t(newStrokeColor: string | DynamicValue) => {\n\t\t\tgetNodes().forEach(node => {\n\t\t\t\tconst update: StrokeUpdate = { strokeColor: newStrokeColor }\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst createStrokeColorVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Color,\n\t\t\t\tname: Dictionary.Color,\n\t\t\t\tinitialValue: isString(strokeColor) ? strokeColor : \"black\",\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tonStrokeColorChange(variableRef)\n\t\t},\n\t\t[strokeColor, onStrokeColorChange],\n\t)\n\n\tconst removeStrokeColorDynamicValue = useEngineCallback(() => {\n\t\tif (!isVariableReference(strokeColor)) return\n\t\tconst variableValue = getVariableValue(engine, strokeColor)\n\t\tconst strokeColorValue = isString(variableValue) ? variableValue : \"black\"\n\t\tonStrokeColorChange(strokeColorValue)\n\t}, [strokeColor, onStrokeColorChange])\n\n\tconst onStrokeWidthChange = useEngineCallback(\n\t\t(newStrokeWidth: number | VariableReference) => {\n\t\t\tlet anyNodesWithShadows: boolean = false\n\t\t\tgetNodes().forEach(node => {\n\t\t\t\tnode.set({ strokeWidth: newStrokeWidth })\n\t\t\t\tanyNodesWithShadows ||= hasBoxShadow(node)\n\t\t\t})\n\n\t\t\tif (anyNodesWithShadows && isVariableReference(newStrokeWidth)) {\n\t\t\t\ttoastIncompatibleStrokWidthAndShadows()\n\t\t\t}\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst createStrokeWidthVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: \"Width\",\n\t\t\t\tinitialValue: isNumber(strokeWidth) ? strokeWidth : 1,\n\t\t\t\toptions: { min: 0 },\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tonStrokeWidthChange(variableRef)\n\t\t},\n\t\t[strokeWidth, onStrokeWidthChange],\n\t)\n\n\tconst removeStrokeWidthVariable = useEngineCallback(() => {\n\t\tif (!isVariableReference(strokeWidth)) return\n\t\tconst variableValue = getVariableValue(engine, strokeWidth)\n\t\tconst strokeWidthValue = isNumber(variableValue) ? variableValue : 1\n\t\tonStrokeWidthChange(strokeWidthValue)\n\t}, [strokeWidth, onStrokeWidthChange])\n\n\tconst onDashArrayChange = useEngineCallback(\n\t\t(value: number, dashArray: string | undefined) => {\n\t\t\tconst newStrokeDashArray = dashArray ? evalDashValue(dashArray).join(\", \") : `${value}`\n\t\t\tgetNodes().forEach(node => node.set({ strokeDashArray: newStrokeDashArray }))\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst onSelectCap = useEngineCallback(\n\t\t(newLineCap: LineCap) => {\n\t\t\tgetNodes().forEach(node => node.set({ lineCap: newLineCap }))\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst onSelectJoin = useEngineCallback(\n\t\t(newLineJoin: LineJoin) => {\n\t\t\tgetNodes().forEach(node => node.set({ lineJoin: newLineJoin }))\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst onSelectAlignment = useEngineCallback(\n\t\t(strokeAlignment: StrokeAlignment) => {\n\t\t\tgetNodes().forEach(node => {\n\t\t\t\tif (!withShape(node)) return\n\t\t\t\tif (!Path.isClosed(node.calculatedPaths())) return\n\t\t\t\tnode.set({ strokeAlignment })\n\t\t\t})\n\t\t},\n\t\t[getNodes],\n\t)\n\n\tconst supportsColorVariable = useSupportsVariable(\"strokeColor\")\n\tconst supportsWidthVariable = useSupportsVariable(\"strokeWidth\")\n\tif (!onlyShapeNodes) return null\n\tif (isNotFound(strokeEnabled)) return null\n\n\t// Stroke alignment can only be set when the path is closed\n\tconst strokeAlignmentEnabled = strokeAlignmentValues.size > 0\n\n\tconst isExpanded = isMixed(strokeEnabled) || strokeEnabled === true\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeaderWithTraits\n\t\t\t\t\ttraits={strokeTraitTypes}\n\t\t\t\t\ttitle=\"Stroke\"\n\t\t\t\t\tclickable={!readOnly}\n\t\t\t\t\tonClick={isExpanded ? onDelete : onAdd}\n\t\t\t\t>\n\t\t\t\t\t{isExpanded ? (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderMinus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeaderWithTraits>\n\t\t\t}\n\t\t>\n\t\t\t{isExpanded && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow\n\t\t\t\t\t\ttitle=\"Color\"\n\t\t\t\t\t\ttraitTypeKeys={colorTraitKeys}\n\t\t\t\t\t\tsupportsVariables={supportsColorVariable}\n\t\t\t\t\t\tvariableType={ControlType.Color}\n\t\t\t\t\t\tonCreateVariable={createStrokeColorVariable}\n\t\t\t\t\t\tonRemoveDynamicValue={removeStrokeColorDynamicValue}\n\t\t\t\t\t\tonSelectVariable={onStrokeColorChange}\n\t\t\t\t\t\tdynamicValue={isDynamicValue(strokeWidth) ? strokeWidth : null}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isDynamicValue(strokeColor) ? (\n\t\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\t\ttitle=\"Stroke\"\n\t\t\t\t\t\t\t\tvalue={strokeColor}\n\t\t\t\t\t\t\t\texpectedType={ControlType.Color}\n\t\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\t\tpopoutId=\"strokeColorTransform\"\n\t\t\t\t\t\t\t\tonRemove={removeStrokeColorDynamicValue}\n\t\t\t\t\t\t\t\tonChangeDynamicValue={onStrokeColorChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ColorPopoutButton\n\t\t\t\t\t\t\t\tnavigationTitle=\"Color\"\n\t\t\t\t\t\t\t\tvalue={strokeColor}\n\t\t\t\t\t\t\t\tonChange={onStrokeColorChange}\n\t\t\t\t\t\t\t\ttrackingMetadata={trackingMetadata(expandedSelectionForShapeStylesIds, \"strokeColor\")}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow\n\t\t\t\t\t\ttitle=\"Width\"\n\t\t\t\t\t\ttraitTypeKeys={widthTraitKeys}\n\t\t\t\t\t\tsupportsVariables={supportsWidthVariable}\n\t\t\t\t\t\tvariableType={ControlType.Number}\n\t\t\t\t\t\tonCreateVariable={createStrokeWidthVariable}\n\t\t\t\t\t\tonRemoveDynamicValue={removeStrokeWidthVariable}\n\t\t\t\t\t\tonSelectVariable={onStrokeWidthChange}\n\t\t\t\t\t\tdynamicValue={isVariableReference(strokeWidth) ? strokeWidth : null}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isVariableReference(strokeWidth) ? (\n\t\t\t\t\t\t\t<VariableReferenceButton\n\t\t\t\t\t\t\t\ttitle=\"Stroke\"\n\t\t\t\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\t\t\t\tonRemove={removeStrokeWidthVariable}\n\t\t\t\t\t\t\t\treference={strokeWidth}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\t\tvalue={notFoundToUndefined(strokeWidth)}\n\t\t\t\t\t\t\t\tonChange={onStrokeWidthChange}\n\t\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Align\" traitTypeKeys={alignmentTraitKeys}>\n\t\t\t\t\t\t<PopupButton wrapperStyle={doubleColumn} enabled={strokeAlignmentEnabled}>\n\t\t\t\t\t\t\t{strokeAlignmentOptions.map(alignmentOption => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\tkey={alignmentOption}\n\t\t\t\t\t\t\t\t\t\tidentifier={alignmentOption}\n\t\t\t\t\t\t\t\t\t\tselected={\n\t\t\t\t\t\t\t\t\t\t\t!strokeAlignmentEnabled\n\t\t\t\t\t\t\t\t\t\t\t\t? alignmentOption === \"center\"\n\t\t\t\t\t\t\t\t\t\t\t\t: strokeAlignmentValues.has(alignmentOption)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\ttitle={capitalizeFirstLetter}\n\t\t\t\t\t\t\t\t\t\tonSelect={onSelectAlignment}\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</PopupButton>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Array\" traitTypeKeys={arrayTraitKeys}>\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={notFoundToUndefined(strokeDashArray)}\n\t\t\t\t\t\t\tonChange={onDashArrayChange}\n\t\t\t\t\t\t\twrapperStyle={doubleColumn}\n\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Cap\" key=\"cap-row\" traitTypeKeys={capTraitKeys}>\n\t\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t\t{lineCapOptions.map(lineCapOption => {\n\t\t\t\t\t\t\t\tconst Icon = lineCapIcon(lineCapOption)\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\t\tkey={lineCapOption}\n\t\t\t\t\t\t\t\t\t\tidentifier={lineCapOption}\n\t\t\t\t\t\t\t\t\t\ttitle={lineCapTitle(lineCapOption)}\n\t\t\t\t\t\t\t\t\t\tselected={lineCap === lineCapOption}\n\t\t\t\t\t\t\t\t\t\tonSelect={onSelectCap}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Icon />\n\t\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Join\" key=\"join-row\" traitTypeKeys={joinTraitKeys}>\n\t\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t\t{lineJoinOptions.map(lineJoinOption => {\n\t\t\t\t\t\t\t\tconst Icon = lineJoinIcon(lineJoinOption)\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\t\tkey={lineJoinOption}\n\t\t\t\t\t\t\t\t\t\tidentifier={lineJoinOption}\n\t\t\t\t\t\t\t\t\t\ttitle={lineJoinTitle(lineJoinOption)}\n\t\t\t\t\t\t\t\t\t\tselected={lineJoin === lineJoinOption}\n\t\t\t\t\t\t\t\t\t\tonSelect={onSelectJoin}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Icon />\n\t\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n\nfunction lineCapTitle(lineCap: LineCap): string {\n\tswitch (lineCap) {\n\t\tcase \"butt\":\n\t\t\treturn \"Butt\"\n\t\tcase \"round\":\n\t\t\treturn \"Round\"\n\t\tcase \"square\":\n\t\t\treturn \"Square\"\n\t}\n}\n\nfunction lineCapIcon(lineCap: LineCap): React.FunctionComponent {\n\tswitch (lineCap) {\n\t\tcase \"butt\":\n\t\t\treturn IconLineCapButt\n\t\tcase \"round\":\n\t\t\treturn IconLineCapRound\n\t\tdefault:\n\t\t\treturn IconLineCapSquare\n\t}\n}\n\nfunction lineJoinTitle(lineJoin: LineJoin): string {\n\tswitch (lineJoin) {\n\t\tcase \"miter\":\n\t\t\treturn \"Miter\"\n\t\tcase \"round\":\n\t\t\treturn \"Round\"\n\t\tcase \"bevel\":\n\t\t\treturn \"Bevel\"\n\t}\n}\n\nfunction lineJoinIcon(lineJoin: LineJoin): React.FunctionComponent {\n\tswitch (lineJoin) {\n\t\tcase \"miter\":\n\t\t\treturn IconLineJoinMiter\n\t\tcase \"round\":\n\t\t\treturn IconLineJoinRound\n\t\tcase \"bevel\":\n\t\t\treturn IconLineJoinBevel\n\t}\n}\n\nfunction evalDashValue(value: string): number[] {\n\treturn value\n\t\t.split(\",\")\n\t\t.map(evalMath)\n\t\t.map(v => (isNumber(v) ? v : 0))\n}\n", "// First pass: whitelist characters.\nconst MathCharMatcher = /^[\\d.+\\-*/]+$/u\n\n// Second pass: support numbers, decimals without leading 0 or plus, minus, times, divide\nconst MathExprMatcher = /^(?:\\d+(?:\\.\\d+)?|\\.\\d+|[-+/*])+$/u\n\nexport function evalMath(expr: string): number {\n\t// Remove all whitespace\n\tconst stripped = expr.replace(/\\s/gu, \"\")\n\n\t// Return if string contains non-expression characters.\n\tif (!MathCharMatcher.test(stripped) || !MathExprMatcher.test(stripped)) {\n\t\treturn NaN\n\t}\n\t// Insert spaces between all numbers and math charaters\n\t// to avoid inserting comments or postfix/prefix operators\n\tconst spaced = stripped.split(/([^\\d.])/).join(\" \")\n\n\ttry {\n\t\tconst result = Function(`return ${spaced}`)()\n\t\treturn typeof result === \"number\" ? result : NaN\n\t} catch (e) {\n\t\t// Ignore errors.\n\t}\n\n\treturn NaN\n}\n", "import engine from \"document/engine.ts\"\nimport type { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport React from \"react\"\nimport {\n\tcanResetReplicaOverrides,\n\tcheckOnlyReplicaAndReplicaChildren,\n\tonResetReplicaOverrides,\n} from \"../utils/resetOverrides.ts\"\nimport type { PanelSectionHeaderProps } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\ninterface Props extends PanelSectionHeaderProps {\n\ttraits: TraitType[]\n}\n\nexport const PanelSectionHeaderWithTraits = ({ traits, children, ...rest }: Props) => {\n\tconst displayContextMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tconst onlyReplicaAndReplicaChildren = checkOnlyReplicaAndReplicaChildren(engine)\n\t\t\tif (!onlyReplicaAndReplicaChildren) return\n\n\t\t\tconst { clientX: x, clientY: y } = event\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Reset Overrides\",\n\t\t\t\t\t\tclick: () => onResetReplicaOverrides(engine, traits),\n\t\t\t\t\t\tenabled: onlyReplicaAndReplicaChildren && canResetReplicaOverrides(engine, traits),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ location: { x, y } },\n\t\t\t)\n\t\t},\n\t\t[traits],\n\t)\n\n\treturn (\n\t\t<PanelSectionHeader {...rest} onContextMenu={displayContextMenu}>\n\t\t\t{children}\n\t\t</PanelSectionHeader>\n\t)\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withPath } from \"document/models/CanvasTree/traits/WithPath.ts\"\nimport type { WithStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isFiniteNumber } from \"library/render/utils/isFiniteNumber.ts\"\n\nexport const addStrokeForNodes = (engine: VekterEngine, nodeIds: NodeID[]) => {\n\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStroke)\n\n\tnodes.forEach(node => {\n\t\tconst update: Partial<WithStroke> = { strokeEnabled: true }\n\n\t\tif (!isFiniteNumber(node.strokeWidth)) update.strokeWidth = 1\n\t\tif (!node.strokeAlignment) update.strokeAlignment = \"center\"\n\t\tif (!node.strokeColor) update.strokeColor = withPath(node) ? \"#09F\" : \"#AAA\"\n\t\tif (!node.lineJoin) update.lineJoin = \"miter\"\n\t\tif (!node.lineCap) update.lineCap = \"butt\"\n\t\tif (!isFiniteNumber(node.strokeMiterLimit)) update.strokeMiterLimit = 4\n\t\tif (!node.strokeDashArray) update.strokeDashArray = \"0\"\n\t\tif (!isFiniteNumber(node.strokeDashOffset)) update.strokeDashOffset = 0\n\n\t\tnode.set(update)\n\t})\n\n\tpopoutWindow.navigation.presentPopoutOnRegistration(\"stroke\")\n}\n", "import type { WithFilters } from \"../WithFilters.ts\"\n\nexport function titleForFilter(filter: keyof WithFilters) {\n\tswitch (filter) {\n\t\tcase \"brightness\":\n\t\t\treturn \"Brightness\"\n\t\tcase \"contrast\":\n\t\t\treturn \"Contrast\"\n\t\tcase \"grayscale\":\n\t\t\treturn \"Grayscale\"\n\t\tcase \"hueRotate\":\n\t\t\treturn \"Hue\"\n\t\tcase \"invert\":\n\t\t\treturn \"Invert\"\n\t\tcase \"saturate\":\n\t\t\treturn \"Saturate\"\n\t\tcase \"sepia\":\n\t\t\treturn \"Sepia\"\n\t\tcase \"blur\":\n\t\t\treturn \"Blur\"\n\t\tcase \"backgroundBlur\":\n\t\t\treturn \"BG Blur\"\n\t}\n}\n\nexport function defaultForFilter(filter: keyof WithFilters) {\n\tswitch (filter) {\n\t\tcase \"contrast\":\n\t\tcase \"saturate\":\n\t\tcase \"brightness\":\n\t\t\treturn 100\n\t\tcase \"grayscale\":\n\t\tcase \"invert\":\n\t\tcase \"sepia\":\n\t\tcase \"hueRotate\":\n\t\t\treturn 0\n\t\tcase \"blur\":\n\t\tcase \"backgroundBlur\":\n\t\t\treturn 5\n\t\tdefault:\n\t\t\treturn 20\n\t}\n}\n", "import { assert } from \"@framerjs/document-migrations/src/utils/assert.ts\"\nimport { Translatable as T } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { recordCornerShapeUpdate } from \"document/components/utils/recordCornerShapeUpdate.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isBlendingModeValue, withBlending } from \"document/models/CanvasTree/traits/WithBlending.ts\"\nimport { isBorderOptional, isOptionalBorderVisible } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport {\n\ttype ReducedCornerShape,\n\tcornerShapeDefaultsWhenAdded,\n\tcornerShapeTitle,\n\twithCornerShape,\n} from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { draggableDefaultEnabledValueFor, withDraggable } from \"document/models/CanvasTree/traits/WithDraggable.ts\"\nimport { withFillOpacity } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport {\n\timageRenderingAddedDefaults,\n\tisImageRenderingValue,\n\twithImageRendering,\n} from \"document/models/CanvasTree/traits/WithImageRendering.ts\"\nimport {\n\tgetOverflowCompatibleWith,\n\tisOverflowValue,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport {\n\tisOverscrollBehavior,\n\toverscrollBehaviorAddedDefaults,\n\twithOverscrollBehavior,\n} from \"document/models/CanvasTree/traits/WithOverscrollBehavior.ts\"\nimport {\n\tisPointerEventsValue,\n\tpointerEventsAddedDefaults,\n\twithPointerEvents,\n} from \"document/models/CanvasTree/traits/WithPointerEvents.ts\"\nimport type { ReducedRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { isOptionalRadiusVisible, isRadiusOptional, withRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport type { ReducedRadiusPerCorner } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { withScrollbars } from \"document/models/CanvasTree/traits/WithScrollbars.ts\"\nimport { tapHighlightAddedDefaults, withTapHighlight } from \"document/models/CanvasTree/traits/WithTapHighlight.ts\"\nimport {\n\tisTextSelection,\n\ttextSelectionAddedDefaults,\n\twithTextSelection,\n} from \"document/models/CanvasTree/traits/WithTextSelection.ts\"\nimport { withTransition } from \"document/models/CanvasTree/traits/WithTransition.ts\"\nimport {\n\tisUserSelectValue,\n\tuserSelectAddedDefaults,\n\twithUserSelect,\n} from \"document/models/CanvasTree/traits/WithUserSelect.ts\"\nimport { isReplicaVariantOrReplicaVariantChild, withVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\ttype ReducedViewTransitionNone,\n\twithViewTransitionNone,\n} from \"document/models/CanvasTree/traits/WithViewTransitionNone.ts\"\nimport { isFound, isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { defaultForFilter, titleForFilter } from \"document/models/CanvasTree/traits/utils/filterHelpers.ts\"\nimport type { ReducedBlending } from \"document/models/CanvasTree/traits/utils/reduceBlending.ts\"\nimport type { ReducedBorder } from \"document/models/CanvasTree/traits/utils/reduceBorder.ts\"\nimport type { ReducedDraggable } from \"document/models/CanvasTree/traits/utils/reduceDraggable.ts\"\nimport type { ReducedFillOpacity } from \"document/models/CanvasTree/traits/utils/reduceFillOpacity.ts\"\nimport type { ReducedFilters } from \"document/models/CanvasTree/traits/utils/reduceFilters.ts\"\nimport type { ReducedImageRendering } from \"document/models/CanvasTree/traits/utils/reduceImageRendering.ts\"\nimport type { ReducedMasks } from \"document/models/CanvasTree/traits/utils/reduceMasks.ts\"\nimport type { ReducedOverflow } from \"document/models/CanvasTree/traits/utils/reduceOverflow.ts\"\nimport type { ReducedOverscrollBehavior } from \"document/models/CanvasTree/traits/utils/reduceOverscrollBehavior.ts\"\nimport type { ReducedPointerEvents } from \"document/models/CanvasTree/traits/utils/reducePointerEvents.ts\"\nimport type { ReducedScrollbars } from \"document/models/CanvasTree/traits/utils/reduceScrollbars.ts\"\nimport type { ReducedShadows } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport { isOptionalShadowVisible, isShadowOptional } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { ReducedTapHighlight } from \"document/models/CanvasTree/traits/utils/reduceTapHighlight.ts\"\nimport type { ReducedTextSelection } from \"document/models/CanvasTree/traits/utils/reduceTextSelection.ts\"\nimport type { ReducedTransition } from \"document/models/CanvasTree/traits/utils/reduceTransition.ts\"\nimport type { ReducedUserSelect } from \"document/models/CanvasTree/traits/utils/reduceUserSelect.ts\"\nimport type { ReducedZIndex } from \"document/models/CanvasTree/traits/utils/reduceZIndex.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { defaultDurationBasedSpringTransition, isTransition } from \"document/models/Transition.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { isArray, isBoolean, isNull, isNumber, isString } from \"utils/typeChecks.ts\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { TEXT_SELECTION_POPOUT_ID } from \"../rows/TextSelectionRow.tsx\"\nimport { getResolvedFilterValues } from \"../utils/getResolvedVariableValues.ts\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { addBorderForNodes } from \"./utils/addBorderForNodes.ts\"\nimport { addMaskForNodes } from \"./utils/addMaskForNodes.ts\"\nimport { addShadowForNodes } from \"./utils/addShadowForNodes.ts\"\nimport { addZIndexForNodes } from \"./utils/addZIndexForNodes.ts\"\nimport { filterKeys } from \"./utils/getFilters.ts\"\n\nfunction isFilterVisible(filterKey: keyof WithFilters, props: Props): boolean {\n\tconst filterValue = props[filterKey]\n\treturn isFound(filterValue)\n}\n\nfunction getStyleVisibility(props: Props) {\n\tconst {\n\t\tblendingMode,\n\t\tborderEnabled,\n\t\thideScrollbars,\n\t\timageRendering,\n\t\tfillOpacity,\n\t\tonlyBreakpointNodes,\n\t\tonlyNodesWithDraggable,\n\t\tonlyNodesWithImageRendering,\n\t\tonlyNodesWithMask,\n\t\tonlyNodesWithOverflow,\n\t\tonlyNodesWithPointerEvents,\n\t\tonlyNodesWithScrollbars,\n\t\tonlyNodesWithTextSelection,\n\t\tonlyNodesWithTapHighlight,\n\t\tonlyNodesWithUserSelect,\n\t\tonlyNonGestureVariants,\n\t\tonlyNodesWithViewTransitionNone,\n\t\tonlyShapeNodes,\n\t\toverflow,\n\t\toverflowX,\n\t\toverflowY,\n\t\tradius,\n\t\tcornerShape,\n\t\tscopeType,\n\t\ttextSelection,\n\t\tshadows,\n\t\ttapHighlightColor,\n\t\ttransition,\n\t\tviewTransitionNone,\n\t\tzIndex,\n\t\toverscrollBehavior,\n\t\tonlyNodesWithOverscrollBehavior,\n\t} = props\n\n\t// FIXME: These visibility rules are inconsistent, because they sometimes\n\t// use `onlyNodesWith` and sometimes `isFound`. The current thinking is that\n\t// it would be better to have simpler reducers in favor of technically more\n\t// correct behavior on multiselect, so we should simplify the pointerEvents\n\t// and userSelect reducers and use `isFound` here too\n\n\tconst isNonCanvasScope = scopeType !== ScopeType.CanvasPage\n\n\tconst blendingModeVisible = isFound(blendingMode)\n\tconst borderVisible = isBorderOptional(borderEnabled, onlyBreakpointNodes)\n\tconst filtersVisible = filterKeys.some(filterKey => isFilterVisible(filterKey, props))\n\tconst maskVisible = onlyNodesWithMask\n\tconst overflowVisible = isFound(overflow) && onlyNodesWithOverflow\n\tconst overflowXVisible = isFound(overflowX) && onlyNodesWithOverflow\n\tconst overflowYVisible = isFound(overflowY) && onlyNodesWithOverflow\n\tconst pointerEventsVisible = isNonCanvasScope && onlyNodesWithPointerEvents\n\tconst radiusVisible = isRadiusOptional(radius, onlyBreakpointNodes)\n\tconst cornerShapeVisible = isFound(cornerShape)\n\tconst scrollbarsVisible = isFound(hideScrollbars) && onlyNodesWithScrollbars\n\tconst shadowsVisible = isShadowOptional(shadows, onlyBreakpointNodes, onlyShapeNodes)\n\tconst transitionVisible = isFound(transition) && scopeType === ScopeType.SmartComponent && onlyNonGestureVariants\n\tconst userSelectVisible = isNonCanvasScope && onlyNodesWithUserSelect\n\tconst zIndexVisible = isNonCanvasScope && isFound(zIndex)\n\tconst draggableVisible = isNonCanvasScope && onlyNodesWithDraggable\n\tconst viewTransitionNoneVisible =\n\t\tisFound(viewTransitionNone) && onlyNodesWithViewTransitionNone && scopeType === ScopeType.LayoutTemplate\n\tconst tapHighlightVisible = isFound(tapHighlightColor) && onlyNodesWithTapHighlight\n\tconst selectionVisible = isFound(textSelection) && onlyNodesWithTextSelection\n\tconst imageRenderingVisible = isFound(imageRendering) && onlyNodesWithImageRendering\n\tconst fillOpacityVisible = isFound(fillOpacity)\n\tconst overscrollBehaviorVisible = isFound(overscrollBehavior) && onlyNodesWithOverscrollBehavior\n\n\tconst anyStyleVisible =\n\t\tblendingModeVisible ||\n\t\tborderVisible ||\n\t\tfiltersVisible ||\n\t\tmaskVisible ||\n\t\toverflowVisible ||\n\t\toverflowXVisible ||\n\t\toverflowYVisible ||\n\t\tpointerEventsVisible ||\n\t\tradiusVisible ||\n\t\tcornerShapeVisible ||\n\t\tscrollbarsVisible ||\n\t\tshadowsVisible ||\n\t\ttransitionVisible ||\n\t\tuserSelectVisible ||\n\t\tzIndexVisible ||\n\t\tdraggableVisible ||\n\t\tviewTransitionNoneVisible ||\n\t\ttapHighlightVisible ||\n\t\tselectionVisible ||\n\t\timageRenderingVisible ||\n\t\tfillOpacityVisible ||\n\t\toverscrollBehaviorVisible\n\n\treturn {\n\t\tanyStyleVisible,\n\t\tblendingModeVisible,\n\t\tborderVisible,\n\t\tfiltersVisible,\n\t\tmaskVisible,\n\t\toverflowVisible,\n\t\toverflowXVisible,\n\t\toverflowYVisible,\n\t\tpointerEventsVisible,\n\t\tradiusVisible,\n\t\tcornerShapeVisible,\n\t\tscrollbarsVisible,\n\t\tshadowsVisible,\n\t\ttransitionVisible,\n\t\tuserSelectVisible,\n\t\tzIndexVisible,\n\t\tdraggableVisible,\n\t\ttapHighlightVisible,\n\t\tviewTransitionNoneVisible,\n\t\tselectionVisible,\n\t\timageRenderingVisible,\n\t\tfillOpacityVisible,\n\t} as const\n}\n\nfunction getInheritedTransition(node: CanvasNode): Transition | undefined {\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (withVariant(ancestor)) {\n\t\t\tif (isTransition(ancestor.variantTransition)) {\n\t\t\t\treturn ancestor.variantTransition\n\t\t\t}\n\t\t\t// Early returning because the transition property won't be visible for variants, and we\n\t\t\t// don't want to use properties that are not visible in the UI.\n\t\t\treturn\n\t\t}\n\n\t\tif (withTransition(ancestor) && isTransition(ancestor.transition)) {\n\t\t\treturn ancestor.transition\n\t\t}\n\t}\n}\n\nexport function getStyleAdditionMenuItems(props: Props): {\n\tallStyleItems: MenuItemOptions[]\n} {\n\tconst {\n\t\tallNodeIds,\n\t\tblendingMode,\n\t\tborderEnabled,\n\t\texpandedSelectionForShapeStylesIds,\n\t\thideScrollbars,\n\t\tmasks,\n\t\tonlyNodesWithFilters,\n\t\tonlyNodesWithOverscrollBehavior,\n\t\toverflow,\n\t\toverflowX,\n\t\toverflowY,\n\t\toverscrollBehavior,\n\t\tpointerEvents,\n\t\tradius,\n\t\tradiusPerCorner,\n\t\tcornerShape,\n\t\tshadows,\n\t\ttransition,\n\t\tuserSelect,\n\t\tzIndex,\n\t\tdraggable,\n\t\tviewTransitionNone,\n\t\ttapHighlightColor,\n\t\ttextSelection,\n\t\timageRendering,\n\t\tfillOpacity,\n\t} = props\n\n\tconst isSquircleExperimentOn = experiments.isOn(\"squircle\")\n\n\tconst resolvedFilters = getResolvedFilterValues(props)\n\tconst optionalBorderVisible = isOptionalBorderVisible(borderEnabled)\n\tconst hasPointerEvents =\n\t\tisPointerEventsValue(pointerEvents) || isMixed(pointerEvents) || isDynamicValue(pointerEvents)\n\tconst optionalShadowVisible = isOptionalShadowVisible(shadows)\n\tconst optionalRadiusVisible = isOptionalRadiusVisible(radius, radiusPerCorner)\n\tconst hasCornerShape = isNumber(cornerShape) || isDynamicValue(cornerShape)\n\tconst hasUserSelect = isUserSelectValue(userSelect) || isDynamicValue(userSelect) || isMixed(userSelect)\n\tconst hasDraggable = isFoundAndNotUndefined(draggable)\n\tconst hasOverscroll =\n\t\tisOverscrollBehavior(overscrollBehavior) || isDynamicValue(overscrollBehavior) || isMixed(overscrollBehavior)\n\tconst hasZIndex = isNumber(zIndex) || isDynamicValue(zIndex)\n\tconst hasOverflow = isOverflowValue(overflow) || isDynamicValue(overflow) || isMixed(overflow)\n\tconst hasOverflowX = isOverflowValue(overflowX) || isDynamicValue(overflowX) || isMixed(overflowX)\n\tconst hasOverflowY = isOverflowValue(overflowY) || isDynamicValue(overflowY) || isMixed(overflowY)\n\tconst hasScrollbars = isBoolean(hideScrollbars) || isDynamicValue(hideScrollbars)\n\tconst hasTransition = isTransition(transition) || isMixed(transition) || isDynamicValue(transition)\n\tconst hasBlendingMode = isBlendingModeValue(blendingMode) || isDynamicValue(blendingMode) || isMixed(blendingMode)\n\tconst hasMask = isArray(masks) || isMixed(masks)\n\tconst hasTapHighlight = isString(tapHighlightColor) || isDynamicValue(tapHighlightColor) || isMixed(tapHighlightColor)\n\tconst hasViewTransitionNone = isBoolean(viewTransitionNone) || isMixed(viewTransitionNone)\n\tconst hasTextSelection = isTextSelection(textSelection) || isNull(textSelection) || isMixed(textSelection)\n\tconst hasImageRendering =\n\t\tisImageRenderingValue(imageRendering) || isDynamicValue(imageRendering) || isMixed(imageRendering)\n\tconst hasFillOpacity = isNumber(fillOpacity) || isDynamicValue(fillOpacity) || isMixed(fillOpacity)\n\n\tconst {\n\t\tborderVisible,\n\t\tradiusVisible,\n\t\tcornerShapeVisible,\n\t\tshadowsVisible,\n\t\tpointerEventsVisible,\n\t\tuserSelectVisible,\n\t\tdraggableVisible,\n\t\tzIndexVisible,\n\t\toverflowVisible,\n\t\toverflowXVisible,\n\t\toverflowYVisible,\n\t\tscrollbarsVisible,\n\t\tblendingModeVisible,\n\t\ttransitionVisible,\n\t\tmaskVisible,\n\t\ttapHighlightVisible,\n\t\tviewTransitionNoneVisible,\n\t\tselectionVisible,\n\t\timageRenderingVisible,\n\t\tfillOpacityVisible,\n\t} = getStyleVisibility(props)\n\n\tconst regularStyleItems: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: \"Blending\",\n\t\t\tvisible: blendingModeVisible,\n\t\t\tchecked: hasBlendingMode,\n\t\t\tenabled: !hasBlendingMode,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withBlending)\n\t\t\t\tnodes.forEach(node => node.set({ blendingMode: \"multiply\" }))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Border\",\n\t\t\tvisible: borderVisible,\n\t\t\tchecked: optionalBorderVisible,\n\t\t\tenabled: !optionalBorderVisible,\n\t\t\tclick: () => addBorderForNodes(engine, allNodeIds),\n\t\t},\n\t\t{\n\t\t\tlabel: \"Draggable\",\n\t\t\tvisible: draggableVisible,\n\t\t\tchecked: hasDraggable,\n\t\t\tenabled: !hasDraggable,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withDraggable)\n\t\t\t\tnodes.forEach(node => node.set({ draggable: draggableDefaultEnabledValueFor(node) }))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Fill Alpha\",\n\t\t\tvisible: fillOpacityVisible,\n\t\t\tchecked: hasFillOpacity,\n\t\t\tenabled: !hasFillOpacity,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withFillOpacity)\n\t\t\t\tnodes.forEach(node => node.set({ fillOpacity: 1 }))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Filters\",\n\t\t\tvisible: onlyNodesWithFilters,\n\t\t\tsubmenu: filterKeys.map(filterKey => {\n\t\t\t\tconst hasFilter = isNumber(resolvedFilters[filterKey])\n\t\t\t\tconst filterVisible = isFilterVisible(filterKey, props)\n\t\t\t\treturn {\n\t\t\t\t\tlabel: titleForFilter(filterKey),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withFilters)\n\t\t\t\t\t\tnodes.forEach(node => node.set({ [filterKey]: defaultForFilter(filterKey) }))\n\t\t\t\t\t},\n\t\t\t\t\tvisible: filterVisible,\n\t\t\t\t\tenabled: !hasFilter,\n\t\t\t\t\tchecked: hasFilter,\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tlabel: \"Image Rendering\",\n\t\t\tvisible: imageRenderingVisible,\n\t\t\tchecked: hasImageRendering,\n\t\t\tenabled: !hasImageRendering,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withImageRendering)\n\t\t\t\tnodes.forEach(node => node.set(imageRenderingAddedDefaults))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Mask\",\n\t\t\tvisible: maskVisible,\n\t\t\tchecked: hasMask,\n\t\t\tenabled: !hasMask,\n\t\t\tclick: () => {\n\t\t\t\taddMaskForNodes(engine.tree, allNodeIds, masks)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Overflow\",\n\t\t\tvisible: overflowVisible,\n\t\t\tchecked: hasOverflow,\n\t\t\tenabled: !hasOverflow,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withOverflow)\n\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t// If there is an overflowX or overflowY, prefer the same value to avoid\n\t\t\t\t\t// surprising behavior.\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\toverflow: getOverflowCompatibleWith(node, \"overflowX\", \"overflowY\", { preferSame: 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: \"Overflow X\",\n\t\t\tvisible: overflowXVisible,\n\t\t\tchecked: hasOverflowX,\n\t\t\tenabled: !hasOverflowX,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withOverflow)\n\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\tnode.set({ overflowX: getOverflowCompatibleWith(node, \"overflowY\", \"overflow\") })\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Overflow Y\",\n\t\t\tvisible: overflowYVisible,\n\t\t\tchecked: hasOverflowY,\n\t\t\tenabled: !hasOverflowY,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withOverflow)\n\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\tnode.set({ overflowY: getOverflowCompatibleWith(node, \"overflowX\", \"overflow\") })\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Overscroll\",\n\t\t\tvisible: onlyNodesWithOverscrollBehavior,\n\t\t\tchecked: hasOverscroll,\n\t\t\tenabled: !hasOverscroll,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withOverscrollBehavior)\n\t\t\t\tnodes.forEach(node => node.set(overscrollBehaviorAddedDefaults))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Page Effect\",\n\t\t\tvisible: viewTransitionNoneVisible,\n\t\t\tchecked: hasViewTransitionNone,\n\t\t\tenabled: !hasViewTransitionNone,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withViewTransitionNone)\n\t\t\t\tnodes.forEach(node => node.set({ viewTransitionNone: true }))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Pointer Events\",\n\t\t\tvisible: pointerEventsVisible,\n\t\t\tchecked: hasPointerEvents,\n\t\t\tenabled: !hasPointerEvents,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withPointerEvents)\n\t\t\t\tnodes.forEach(node => node.set(pointerEventsAddedDefaults))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Radius\",\n\t\t\tvisible: radiusVisible,\n\t\t\tchecked: optionalRadiusVisible,\n\t\t\tenabled: !optionalRadiusVisible,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withRadius)\n\t\t\t\tnodes.forEach(node => node.set({ radius: 0 }))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Scrollbars\",\n\t\t\tvisible: scrollbarsVisible,\n\t\t\tchecked: hasScrollbars,\n\t\t\tenabled: !hasScrollbars,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withScrollbars)\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\tif (isReplicaVariantOrReplicaVariantChild(node)) {\n\t\t\t\t\t\tconst originalNode = engine.tree.getNode(node.originalid)\n\t\t\t\t\t\tif (!originalNode) return\n\t\t\t\t\t\tassert(withScrollbars(originalNode))\n\t\t\t\t\t\toriginalNode.set({ hideScrollbars: true })\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tnode.set({ hideScrollbars: true })\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Selection\",\n\t\t\tvisible: selectionVisible,\n\t\t\tchecked: hasTextSelection,\n\t\t\tenabled: !hasTextSelection,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withTextSelection)\n\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\treturn node.set({ textSelection: textSelectionAddedDefaults.textSelection })\n\t\t\t\t})\n\t\t\t\tpopoutWindow.navigation.presentPopout(TEXT_SELECTION_POPOUT_ID)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Shadows\",\n\t\t\tvisible: shadowsVisible,\n\t\t\tchecked: optionalShadowVisible,\n\t\t\tenabled: !optionalShadowVisible,\n\t\t\tclick: () => addShadowForNodes(engine, expandedSelectionForShapeStylesIds, shadows),\n\t\t},\n\t\t{\n\t\t\tlabel: cornerShapeTitle,\n\t\t\tvisible: isSquircleExperimentOn && cornerShapeVisible,\n\t\t\tchecked: hasCornerShape,\n\t\t\tenabled: !hasCornerShape && optionalRadiusVisible,\n\t\t\tclick: () => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(allNodeIds, withCornerShape)) {\n\t\t\t\t\tnode.set(cornerShapeDefaultsWhenAdded)\n\t\t\t\t\trecordCornerShapeUpdate(node, { value: cornerShapeDefaultsWhenAdded.cornerShape, isAddition: true })\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Tap Color\",\n\t\t\tvisible: tapHighlightVisible,\n\t\t\tchecked: hasTapHighlight,\n\t\t\tenabled: !hasTapHighlight,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withTapHighlight)\n\t\t\t\tnodes.forEach(node => node.set(tapHighlightAddedDefaults))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Transition\",\n\t\t\tvisible: transitionVisible,\n\t\t\tchecked: hasTransition,\n\t\t\tenabled: !hasTransition,\n\t\t\tclick: () => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(allNodeIds, withTransition)) {\n\t\t\t\t\tconst inheritedTransition = getInheritedTransition(node)\n\t\t\t\t\tconst newTransition = inheritedTransition ?? defaultDurationBasedSpringTransition\n\t\t\t\t\tnode.set({ transition: newTransition })\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"User Select\",\n\t\t\tvisible: userSelectVisible,\n\t\t\tchecked: hasUserSelect,\n\t\t\tenabled: !hasUserSelect,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(allNodeIds, withUserSelect)\n\t\t\t\tnodes.forEach(node => node.set(userSelectAddedDefaults))\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Z Index\",\n\t\t\tvisible: zIndexVisible,\n\t\t\tchecked: hasZIndex,\n\t\t\tenabled: !hasZIndex,\n\t\t\tclick: () => addZIndexForNodes(engine, allNodeIds),\n\t\t},\n\t]\n\n\treturn { allStyleItems: regularStyleItems }\n}\n\ninterface Props\n\textends\n\t\tPick<ReducedBorder, \"borderEnabled\">,\n\t\tPick<ReducedShadows, \"shadows\">,\n\t\tPick<ReducedRadiusPerCorner, \"radiusPerCorner\">,\n\t\tPick<ReducedMasks, \"masks\">,\n\t\tReducedFilters,\n\t\tReducedImageRendering,\n\t\tReducedPointerEvents,\n\t\tReducedUserSelect,\n\t\tReducedZIndex,\n\t\tReducedRadius,\n\t\tReducedCornerShape,\n\t\tReducedBlending,\n\t\tReducedTransition,\n\t\tReducedOverscrollBehavior,\n\t\tReducedOverflow,\n\t\tReducedScrollbars,\n\t\tReducedViewTransitionNone,\n\t\tReducedDraggable,\n\t\tReducedTapHighlight,\n\t\tReducedFillOpacity,\n\t\tReducedTextSelection {\n\tallNodeIds: NodeID[]\n\tscopeType?: ScopeType\n\tonlyBreakpointNodes: boolean\n\tonlyShapeNodes: boolean\n\texpandedSelectionForShapeStylesIds: NodeID[]\n\treadOnly: boolean\n\tonlyNodesWithScrollbars: boolean\n\tonlyNodesWithMask: boolean\n\tonlyNonGestureVariants: boolean\n}\n\n/**\n * @name StyleHeader This is the main entry component of the menu\n * layer that you receive when you click on the header of the Styles\n * Panel.\n */\nexport const StyleHeader = React.memo(function StyleHeader(props: Props) {\n\tconst { anyStyleVisible } = getStyleVisibility(props)\n\tconst canAddStyle = anyStyleVisible\n\n\tconst displayMenu = (event: React.MouseEvent) => {\n\t\tif (props.readOnly) return\n\t\tconst { allStyleItems } = getStyleAdditionMenuItems(props)\n\t\tengine.stores.contextMenuStore.show(allStyleItems, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\treturn (\n\t\t<PanelSectionHeader\n\t\t\ttitle={<T>Styles</T>}\n\t\t\tclickable={canAddStyle && !props.readOnly}\n\t\t\tonMouseDown={canAddStyle ? displayMenu : undefined}\n\t\t>\n\t\t\t{canAddStyle && (\n\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t)}\n\t\t</PanelSectionHeader>\n\t)\n})\n", "import { Stack } from \"@framerjs/fresco\"\nimport { IconTextSelection } from \"@framerjs/fresco/src/icons/IconTextSelection\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTextSelection } from \"document/models/CanvasTree/traits/utils/reduceTextSelection.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React, { useCallback } from \"react\"\nimport {\n\tcanReadClipboardWithoutPromptingUser,\n\tclipboardReadType,\n\tclipboardWrite,\n\tisClipboardSupported,\n} from \"utils/clipboard/clipboard.ts\"\nimport { isNull, isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport {\n\ttype WithTextSelection,\n\tisTextSelection,\n\ttextSelectionAddedDefaults,\n\twithTextSelection,\n} from \"../../../../models/CanvasTree/traits/WithTextSelection.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { TextSelectionValueRows } from \"../panels/TextSelectionValueRows.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nexport const TEXT_SELECTION_POPOUT_ID = \"text-selection-popout\"\n\nconst TraitTypes = [TraitType.TextSelection]\n\ninterface Props extends Omit<ReducedTextSelection, \"onlyNodesWithTextSelection\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const TextSelectionRow = React.memo(function SelectionRow(props: Props) {\n\tconst { textSelection } = props\n\n\tconst canCopySelection = isTextSelection(textSelection) && isClipboardSupported()\n\n\tconst canPasteSelection = useCallback(async () => {\n\t\tif (!isClipboardSupported()) return false\n\t\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\t\tconst value = await clipboardReadType(\"application/x-framer-text-selection\")\n\t\treturn isObject(value) && isTextSelection(value.selection)\n\t}, [])\n\n\tconst copySelection = useCallback(async () => {\n\t\tif (!isTextSelection(textSelection)) return\n\t\tawait clipboardWrite({\n\t\t\t\"application/x-framer-text-selection\": { selection: textSelection },\n\t\t})\n\t}, [textSelection])\n\n\tconst pasteSelection = useCallback(async () => {\n\t\tconst value = await clipboardReadType(\"application/x-framer-text-selection\")\n\t\tif (!isObject(value)) return false\n\t\tconst { selection } = value\n\n\t\tif (!isTextSelection(selection)) return false\n\t\tengine.scheduler.process(() => {\n\t\t\tengine.tree.getNodesWithTrait(props.nodeIds, withTextSelection).forEach(node => {\n\t\t\t\tnode.set({ textSelection: selection })\n\t\t\t})\n\t\t})\n\t}, [props.nodeIds])\n\n\tconst update = useEngineCallback(\n\t\t(newSelection: WithTextSelection[\"textSelection\"]) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withTextSelection)\n\t\t\tnodes.forEach(node => node.set({ textSelection: newSelection }))\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst toggleSelection = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withTextSelection)\n\n\t\tconst shouldAdd = isNull(textSelection) || isMixed(textSelection)\n\t\tfor (const node of nodes) {\n\t\t\tif (shouldAdd && isTextSelection(node.textSelection)) continue\n\n\t\t\tnode.set({\n\t\t\t\ttextSelection: shouldAdd ? textSelectionAddedDefaults.textSelection : null,\n\t\t\t})\n\t\t}\n\n\t\tif (shouldAdd) {\n\t\t\tpopoutWindow.navigation.presentPopout(TEXT_SELECTION_POPOUT_ID)\n\t\t}\n\t}, [props.nodeIds, textSelection])\n\n\tconst updateSelectionColor = useEngineCallback(\n\t\t(newSelectionColor: string) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withTextSelection)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tif (!node.textSelection || isVariableReference(node.textSelection)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn node.set({ textSelection: { ...node.textSelection, color: newSelectionColor } })\n\t\t\t})\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst updateSelectionBackgroundColor = useEngineCallback(\n\t\t(newSelectionBackdropColor: string) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withTextSelection)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tif (!node.textSelection || isVariableReference(node.textSelection)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn node.set({\n\t\t\t\t\ttextSelection: { ...node.textSelection, backgroundColor: newSelectionBackdropColor },\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst deleteSelection = useCallback(() => {\n\t\tupdate(undefined)\n\t}, [update])\n\n\tconst isHidden = isUndefined(textSelection) || isNotFound(textSelection)\n\n\tif (isHidden) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Selection\"\n\t\t\tonDelete={deleteSelection}\n\t\t\tonCopy={copySelection}\n\t\t\tcopyEnabled={canCopySelection}\n\t\t\tonPaste={pasteSelection}\n\t\t\tpasteEnabled={canPasteSelection}\n\t\t\ttraitTypes={TraitTypes}\n\t\t>\n\t\t\t{isNull(textSelection) || isMixed(textSelection) ? (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"textSelection\" onClick={toggleSelection} />\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={TEXT_SELECTION_POPOUT_ID}\n\t\t\t\t\tnavigationTitle=\"Selection\"\n\t\t\t\t\ttitle={isMixed(textSelection.color) || isMixed(textSelection.backgroundColor) ? \"Mixed\" : \"Colors\"}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tonDelete={toggleSelection}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper color=\"white\" background={colors.tint}>\n\t\t\t\t\t\t\t<IconTextSelection />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextSelectionValueRows\n\t\t\t\t\t\t\t\ttextSelection={textSelection}\n\t\t\t\t\t\t\t\tupdateSelectionColor={updateSelectionColor}\n\t\t\t\t\t\t\t\tupdateSelectionBackgroundColor={updateSelectionBackgroundColor}\n\t\t\t\t\t\t\t\tdisplayInPopover={false}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import type { TextSelection } from \"document/models/CanvasTree/traits/WithTextSelection.ts\"\nimport type { ReducedSubPropertyRecord } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\n\ninterface Props {\n\ttextSelection: ReducedSubPropertyRecord<TextSelection>\n\tupdateSelectionColor: (color: string) => void\n\tupdateSelectionBackgroundColor: (color: string) => void\n\tdisplayInPopover: boolean\n}\n\nexport const TextSelectionValueRows = ({\n\ttextSelection: selection,\n\tupdateSelectionColor,\n\tupdateSelectionBackgroundColor,\n\tdisplayInPopover,\n}: Props) => (\n\t<>\n\t\t<PanelRow title=\"Color\">\n\t\t\t<ColorPopoutButton\n\t\t\t\tnavigationTitle=\"Color\"\n\t\t\t\tvalue={selection.color}\n\t\t\t\tonChange={updateSelectionColor}\n\t\t\t\tcurrentType=\"color\"\n\t\t\t\tdisplayInPopover={displayInPopover}\n\t\t\t\tshowAlphaInButton\n\t\t\t/>\n\t\t</PanelRow>\n\t\t<PanelRow title=\"Background\">\n\t\t\t<ColorPopoutButton\n\t\t\t\tnavigationTitle=\"Background\"\n\t\t\t\tvalue={selection.backgroundColor}\n\t\t\t\tonChange={updateSelectionBackgroundColor}\n\t\t\t\tcurrentType=\"color\"\n\t\t\t\tdisplayInPopover={displayInPopover}\n\t\t\t\tshowAlphaInButton\n\t\t\t/>\n\t\t</PanelRow>\n\t</>\n)\n", "import { assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue, isComputedValueFromFetchData } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { getFetchFallbackValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport type { WithRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { computeValue } from \"document/models/CanvasTree/traits/utils/computeValue.ts\"\nimport type { Properties } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\n\nfunction resolveDynamicValue(dynamicValue: DynamicValue): unknown {\n\tif (isVariableReference(dynamicValue)) {\n\t\treturn getVariableValue(engine, dynamicValue)\n\t}\n\n\tif (isComputedValue(dynamicValue)) {\n\t\tif (isComputedValueFromFetchData(dynamicValue)) {\n\t\t\t// This is mainly used for resolving filter values where Fetch Data\n\t\t\t// Dynamic values are not used. So it is safe to fallback to the\n\t\t\t// fallback value.\n\t\t\treturn getFetchFallbackValue(dynamicValue.startValue)\n\t\t}\n\n\t\tconst getVariableReferenceValue = (variableReference: VariableReference) => {\n\t\t\treturn getVariableValue(engine, variableReference)\n\t\t}\n\t\tconst computedValue = computeValue(\n\t\t\tdynamicValue,\n\t\t\t{ getVariableReferenceValue },\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t\treturn computedValue\n\t}\n\n\tassertNever(dynamicValue, \"All dynamic value types should be resolved\")\n}\n\nexport type ResolvedRotation = Exclude<WithRotation[\"rotation\"], DynamicValue> | undefined\n\nexport function getResolvedRotationValue(rotation: Properties[\"rotation\"]): ResolvedRotation {\n\tif (!isDynamicValue(rotation)) {\n\t\tif (isUndefined(rotation)) return 0\n\t\treturn isNumber(rotation) ? rotation : undefined\n\t}\n\tconst resolvedRotation = resolveDynamicValue(rotation)\n\treturn isNumber(resolvedRotation) ? resolvedRotation : undefined\n}\n\ninterface UnresolvedFilters {\n\tblur: Properties[\"blur\"]\n\tbackgroundBlur: Properties[\"backgroundBlur\"]\n\tbrightness: Properties[\"brightness\"]\n\tcontrast: Properties[\"contrast\"]\n\tgrayscale: Properties[\"grayscale\"]\n\thueRotate: Properties[\"hueRotate\"]\n\tinvert: Properties[\"invert\"]\n\tsaturate: Properties[\"saturate\"]\n\tsepia: Properties[\"sepia\"]\n}\n\ntype ResolvedFilters = { [K in keyof UnresolvedFilters]: Exclude<WithFilters[K], DynamicValue> }\n\nexport function getResolvedFilterValues(filters: UnresolvedFilters) {\n\tconst resolvedValues: ResolvedFilters = {\n\t\tblur: undefined,\n\t\tbackgroundBlur: undefined,\n\t\tbrightness: undefined,\n\t\tcontrast: undefined,\n\t\tgrayscale: undefined,\n\t\thueRotate: undefined,\n\t\tinvert: undefined,\n\t\tsaturate: undefined,\n\t\tsepia: undefined,\n\t}\n\n\tfor (const filterKey in filters) {\n\t\tconst value = filters[filterKey]\n\t\tif (isNumber(value)) {\n\t\t\tresolvedValues[filterKey] = value\n\t\t} else if (isDynamicValue(value)) {\n\t\t\tconst resolvedValue = resolveDynamicValue(value)\n\t\t\tif (isNumber(resolvedValue)) {\n\t\t\t\tresolvedValues[filterKey] = resolvedValue\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resolvedValues\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isOverlayNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { getDefaultZIndex, withZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport {\n\tisPositionAbsolute,\n\tisPositionFixed,\n\tisPositionSticky,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\n\nexport function addZIndexForNodes(engine: VekterEngine, nodeIds: NodeID[]) {\n\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withZIndex)) {\n\t\tif (isVariant(node)) continue\n\n\t\tconst parent = engine.tree.getParent(node.id)\n\t\tconst startingZIndex = isOverlayNode(parent) ? (parent.resolveValue(\"zIndex\") ?? 0) : 0\n\n\t\tconst zIndex =\n\t\t\tstartingZIndex +\n\t\t\tgetDefaultZIndex(\n\t\t\t\tisPositionSticky(node) || isPositionFixed(node) || isPositionAbsolute(node),\n\t\t\t\thasFloatingPosition(node),\n\t\t\t)\n\n\t\tnode.set({ zIndex })\n\t}\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ariaLabelEnabledDefaults, withAriaLabel } from \"document/models/CanvasTree/traits/WithAriaLabel.ts\"\nimport {\n\twithDataNosnippet,\n\twithDataNosnippetEnabledDefaults,\n} from \"document/models/CanvasTree/traits/WithDataNosnippet.ts\"\nimport { htmlTagEnabledDefaults, withHTMLTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport { htmlTextTagEnabledDefaults, withHTMLTextTag } from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport { withTabIndex, withTabIndexEnabledDefaults } from \"document/models/CanvasTree/traits/WithTabIndex.ts\"\nimport {\n\ttitleAndDescriptionEnabledDefaults,\n\twithTitleAndDescription,\n} from \"document/models/CanvasTree/traits/WithTitleAndDescription.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedAriaLabel } from \"document/models/CanvasTree/traits/utils/reduceAriaLabel.ts\"\nimport type { ReducedDataNosnippet } from \"document/models/CanvasTree/traits/utils/reduceDataNosnippet.ts\"\nimport type { ReducedHTMLTags } from \"document/models/CanvasTree/traits/utils/reduceHTMLTags.ts\"\nimport type { ReducedTabIndex } from \"document/models/CanvasTree/traits/utils/reduceTabIndex.ts\"\nimport type { ReducedTitleAndDescription } from \"document/models/CanvasTree/traits/utils/reduceTitleAndDescription.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useExpandedStateUntilInputHashChanges } from \"utils/useExpandedStateUntilInputHashChanges.ts\"\nimport { AriaLabelRow } from \"../rows/AccessibilityRows/AriaLabelRow.tsx\"\nimport { DataNosnippetRow } from \"../rows/AccessibilityRows/DataNosnippetRow.tsx\"\nimport { HtmlTagRow } from \"../rows/AccessibilityRows/HtmlTagRow.tsx\"\nimport { HtmlTextTagRow } from \"../rows/AccessibilityRows/HtmlTextTagRow.tsx\"\nimport { TabIndexRow } from \"../rows/AccessibilityRows/TabIndexRow.tsx\"\nimport { TitleAndDescriptionRow } from \"../rows/AccessibilityRows/TitleAndDescriptionRow.tsx\"\nimport { AccessibilityLabel } from \"../rows/AccessibilityRows/utils.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ninterface AccessibilityPanelProps\n\textends ReducedAriaLabel, ReducedTitleAndDescription, ReducedHTMLTags, ReducedDataNosnippet, ReducedTabIndex {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\tonlyNodesWithFillImage: boolean\n\tonlyRichTextNodes: boolean\n}\n\nexport const AccessibilityPanel = React.memo(function AccessibilityPanel(props: AccessibilityPanelProps) {\n\tconst {\n\t\treadOnly,\n\t\tonlyNodesWithLinks,\n\t\tnodeIds,\n\t\tonlyNodesWithAriaLabel,\n\t\tonlyNodesWithTabIndex,\n\t\tonlyNodesWithTitleAndDescription,\n\t\tonlyNodesWithListParents,\n\t\tonlyRichTextNodes,\n\t\tonlyNodesWithDataNosnippet,\n\t\tonlyNodesWithFormButton,\n\t\tonlyNodesWithFormAncestor,\n\t\tariaLabel,\n\t\tonlyNodesWithHTMLTag,\n\t\ttabIndex,\n\t\ttitle,\n\t\thtmlTags,\n\t\tdescription,\n\t\thtmlTextTags,\n\t\tdataNosnippet,\n\t} = props\n\n\tconst [dataNoSnippetForceExpanded, setDataNoSnippetForceExpanded] = useExpandedStateUntilInputHashChanges()\n\n\tconst isLink = onlyNodesWithLinks\n\n\tconst addA11yFeature = React.useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tif (readOnly) return\n\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (event.button === 2) return\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: AccessibilityLabel.HtmlTag,\n\t\t\t\t\t\tvisible: !onlyRichTextNodes && onlyNodesWithHTMLTag,\n\t\t\t\t\t\tenabled: !isLink && htmlTags.size === 0,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withHTMLTag)) {\n\t\t\t\t\t\t\t\tnode.set({ ...htmlTagEnabledDefaults })\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: AccessibilityLabel.HtmlTextTag,\n\t\t\t\t\t\tvisible: onlyRichTextNodes,\n\t\t\t\t\t\tenabled: htmlTextTags.size === 0,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withHTMLTextTag)) {\n\t\t\t\t\t\t\t\tnode.set({ ...htmlTextTagEnabledDefaults })\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: AccessibilityLabel.AriaLabel,\n\t\t\t\t\t\tvisible: onlyNodesWithAriaLabel,\n\t\t\t\t\t\tenabled: isNotFound(ariaLabel) || isUndefined(ariaLabel),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withAriaLabel)) {\n\t\t\t\t\t\t\t\tnode.set({ ...ariaLabelEnabledDefaults })\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: AccessibilityLabel.TabIndex,\n\t\t\t\t\t\tvisible: onlyNodesWithTabIndex,\n\t\t\t\t\t\tenabled: isNotFound(tabIndex) || isUndefined(tabIndex),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTabIndex)) {\n\t\t\t\t\t\t\t\tnode.set({ ...withTabIndexEnabledDefaults })\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: AccessibilityLabel.TitleAndDescription,\n\t\t\t\t\t\tvisible: onlyNodesWithTitleAndDescription,\n\t\t\t\t\t\tenabled: (isNotFound(title) || isUndefined(title)) && (isNotFound(description) || isUndefined(description)),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTitleAndDescription)) {\n\t\t\t\t\t\t\t\tnode.set({ ...titleAndDescriptionEnabledDefaults })\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: AccessibilityLabel.GoogleBot,\n\t\t\t\t\t\tvisible: onlyNodesWithDataNosnippet,\n\t\t\t\t\t\tenabled: isUndefined(dataNosnippet) && !dataNoSnippetForceExpanded,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withDataNosnippet)) {\n\t\t\t\t\t\t\t\tnode.set({ ...withDataNosnippetEnabledDefaults })\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tariaLabel,\n\t\t\tdataNosnippet,\n\t\t\tdataNoSnippetForceExpanded,\n\t\t\tdescription,\n\t\t\thtmlTags.size,\n\t\t\thtmlTextTags.size,\n\t\t\tisLink,\n\t\t\tnodeIds,\n\t\t\tonlyNodesWithAriaLabel,\n\t\t\tonlyNodesWithDataNosnippet,\n\t\t\tonlyNodesWithHTMLTag,\n\t\t\tonlyNodesWithTabIndex,\n\t\t\tonlyNodesWithTitleAndDescription,\n\t\t\tonlyRichTextNodes,\n\t\t\treadOnly,\n\t\t\ttabIndex,\n\t\t\ttitle,\n\t\t],\n\t)\n\n\tconst hasHTMLTag = !onlyRichTextNodes && (htmlTags.size > 0 || isLink)\n\tconst hasHTMLTextTag = onlyRichTextNodes && htmlTextTags.size > 0\n\tconst hasAriaLabel = onlyNodesWithAriaLabel && !isNotFound(ariaLabel) && !isUndefined(ariaLabel)\n\tconst hasTabIndex = onlyNodesWithTabIndex && !isNotFound(tabIndex) && !isUndefined(tabIndex)\n\tconst hasDataNosnippet = onlyNodesWithDataNosnippet && !isNotFound(dataNosnippet) && !isUndefined(dataNosnippet)\n\tconst shouldShowDataNosnippet = hasDataNosnippet || dataNoSnippetForceExpanded\n\tconst hasTitleOrDescription =\n\t\t(onlyNodesWithTitleAndDescription && !isNotFound(title) && !isUndefined(title)) ||\n\t\t(!isNotFound(description) && !isUndefined(description))\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title={<T>Accessibility</T>} clickable={!readOnly} onMouseDown={addA11yFeature}>\n\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{hasHTMLTag && (\n\t\t\t\t<HtmlTagRow\n\t\t\t\t\tonlyNodesWithLinks={onlyNodesWithLinks}\n\t\t\t\t\tonlyNodesWithFormButton={onlyNodesWithFormButton}\n\t\t\t\t\tonlyNodesWithFormAncestor={onlyNodesWithFormAncestor}\n\t\t\t\t\thtmlTags={htmlTags}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tonlyNodesWithListParents={onlyNodesWithListParents}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{hasHTMLTextTag && (\n\t\t\t\t<HtmlTextTagRow\n\t\t\t\t\tonlyNodesWithLinks={onlyNodesWithLinks}\n\t\t\t\t\tonlyNodesWithListParents={onlyNodesWithListParents}\n\t\t\t\t\thtmlTextTags={htmlTextTags}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{hasAriaLabel && <AriaLabelRow nodeIds={nodeIds} ariaLabel={ariaLabel} />}\n\t\t\t{hasTabIndex && <TabIndexRow nodeIds={nodeIds} tabIndex={tabIndex} />}\n\t\t\t{hasTitleOrDescription && <TitleAndDescriptionRow nodeIds={nodeIds} description={description} title={title} />}\n\t\t\t{shouldShowDataNosnippet && (\n\t\t\t\t<DataNosnippetRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tdataNosnippet={dataNosnippet}\n\t\t\t\t\tsetKeepExpanded={setDataNoSnippetForceExpanded}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { useInputHash } from \"@framerjs/fresco\"\nimport { useCallback, useState } from \"react\"\n\n/**\n * This hook is used to track the expanded state of a panel. It automatically resets the expanded\n * state when the input hash changes.\n */\nexport function useExpandedStateUntilInputHashChanges() {\n\tconst inputHash = useInputHash()\n\tconst [isExpandedForHash, setIsExpandedForHash] = useState<string | null>(null)\n\tconst isExpanded = isExpandedForHash === inputHash\n\n\tif (isExpandedForHash !== null && !isExpanded) {\n\t\tsetIsExpandedForHash(null)\n\t}\n\n\tconst setExpanded = useCallback(\n\t\t(expand: boolean) => {\n\t\t\tsetIsExpandedForHash(expand ? inputHash : null)\n\t\t},\n\t\t[inputHash],\n\t)\n\n\treturn [isExpanded, setExpanded] as const\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithAriaLabel } from \"document/models/CanvasTree/traits/WithAriaLabel.ts\"\nimport { withAriaLabel } from \"document/models/CanvasTree/traits/WithAriaLabel.ts\"\nimport type { ReducedAriaLabel } from \"document/models/CanvasTree/traits/utils/reduceAriaLabel.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./../PanelRow.tsx\"\nimport { AccessibilityLabel } from \"./utils.ts\"\n\ninterface AriaLabelRowProps extends Pick<ReducedAriaLabel, \"ariaLabel\"> {\n\tnodeIds: string[]\n}\n\nconst traitTypeKeys: [keyof WithAriaLabel] = [\"ariaLabel\"]\nconst computedAriaLabelPopoutId = \"computed-aria-label\"\n\nexport function AriaLabelRow({ nodeIds, ariaLabel }: AriaLabelRowProps) {\n\tconst handleUpdateAriaLabel = useUpdateAriaLabel(nodeIds)\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tname: traitTypeKeys[0],\n\t\t\t\tinitialValue: isString(ariaLabel) ? ariaLabel : \"\",\n\t\t\t})\n\t\t\tif (variableRef) handleUpdateAriaLabel(variableRef)\n\t\t},\n\t\t[ariaLabel, handleUpdateAriaLabel],\n\t)\n\tconst deleteAriaLabel = React.useCallback(() => handleUpdateAriaLabel(undefined), [handleUpdateAriaLabel])\n\tconst selectComputedValue = React.useCallback(\n\t\t(value: ComputedValue) => {\n\t\t\thandleUpdateAriaLabel(value)\n\t\t\tpopoutWindow.navigation.presentPopout(computedAriaLabelPopoutId)\n\t\t},\n\t\t[handleUpdateAriaLabel],\n\t)\n\tconst removeDynamicValue = React.useCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\tif (isVariableReference(dynamicValue)) {\n\t\t\t\tconst variableValue = getVariableValue(engine, dynamicValue)\n\t\t\t\thandleUpdateAriaLabel(isString(variableValue) ? variableValue : \"\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\thandleUpdateAriaLabel(\"\")\n\t\t},\n\t\t[handleUpdateAriaLabel],\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\ttitle={AccessibilityLabel.AriaLabel}\n\t\t\tonDelete={deleteAriaLabel}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(ariaLabel) ? ariaLabel : null}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonSelectVariable={handleUpdateAriaLabel}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tvariableType={ControlType.String}\n\t\t\tvariableCreationType={ControlType.String}\n\t\t\tvariableReferenceType={ControlType.String}\n\t\t\tcomputedValuePopoutId={computedAriaLabelPopoutId}\n\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t>\n\t\t\t{isDynamicValue(ariaLabel) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\tvalue={ariaLabel}\n\t\t\t\t\ttitle={AccessibilityLabel.AriaLabel}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.String}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={handleUpdateAriaLabel}\n\t\t\t\t\tpopoutId={computedAriaLabelPopoutId}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TextInput value={isString(ariaLabel) ? ariaLabel : \"\"} onChange={handleUpdateAriaLabel} style={doubleColumn} />\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction useUpdateAriaLabel(nodeIds: NodeID[]): (ariaLabel: WithAriaLabel[\"ariaLabel\"]) => void {\n\treturn useEngineCallback(\n\t\tnewValue => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withAriaLabel)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (node.ariaLabel === newValue) continue\n\t\t\t\tnode.set({ ariaLabel: newValue })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n", "import { PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithDataNosnippet } from \"document/models/CanvasTree/traits/WithDataNosnippet.ts\"\nimport { withDataNosnippet } from \"document/models/CanvasTree/traits/WithDataNosnippet.ts\"\nimport type { ReducedDataNosnippet } from \"document/models/CanvasTree/traits/utils/reduceDataNosnippet.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { getOriginalNodes } from \"utils/getOriginalNodes.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { AccessibilityLabel } from \"./utils.ts\"\n\nconst traitTypeKeys: (keyof WithDataNosnippet)[] = [\"dataNosnippet\"]\n\ninterface Props extends Omit<ReducedDataNosnippet, \"onlyNodesWithDataNosnippet\"> {\n\tnodeIds: NodeID[]\n\tsetKeepExpanded: React.Dispatch<React.SetStateAction<boolean>>\n}\n\nexport const DataNosnippetRow = React.memo(function DataNosnippetRow({\n\tnodeIds,\n\tdataNosnippet,\n\tsetKeepExpanded,\n}: Props) {\n\tconst updateValue = useEngineCallback(\n\t\t(newDataNosnippet: true | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withDataNosnippet)\n\t\t\tconst originalNodes = getOriginalNodes(engine.tree, nodes)\n\t\t\toriginalNodes.forEach(node => node.set({ dataNosnippet: newDataNosnippet }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst updateDataNosnippet = React.useCallback(\n\t\t(newValue: \"no-snippet\" | \"none\") => {\n\t\t\tupdateValue(newValue === \"no-snippet\" ? true : undefined)\n\t\t\tsetKeepExpanded(true)\n\t\t},\n\t\t[setKeepExpanded, updateValue],\n\t)\n\n\tconst deleteDataNosnippet = React.useCallback(() => {\n\t\tupdateValue(undefined)\n\t\tsetKeepExpanded(false)\n\t}, [setKeepExpanded, updateValue])\n\n\treturn (\n\t\t<PanelRow traitTypeKeys={traitTypeKeys} title={AccessibilityLabel.GoogleBot} onDelete={deleteDataNosnippet}>\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButtonDisplayTitle displayTitle={dataNosnippet ? \"Skip\" : \"Include\"}>\n\t\t\t\t\t<PopupButton mixed={isMixed(dataNosnippet)}>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"no-snippet\"\n\t\t\t\t\t\t\ttitle=\"Skip (data-nosnippet)\"\n\t\t\t\t\t\t\tselected={dataNosnippet === true}\n\t\t\t\t\t\t\tonSelect={updateDataNosnippet}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"none\"\n\t\t\t\t\t\t\ttitle=\"Include (default)\"\n\t\t\t\t\t\t\tselected={isUndefined(dataNosnippet)}\n\t\t\t\t\t\t\tonSelect={updateDataNosnippet}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</PopupButtonDisplayTitle>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n})\n", "import type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isReplicaVariantOrReplicaVariantChild } from \"document/models/CanvasTree/traits/WithVariant.ts\"\n\n/**\n * Returns the same nodes except for variant replica (child) nodes, which are replaced by their\n * original (primary) node.\n */\nexport function getOriginalNodes<T extends CanvasNode>(tree: CanvasTree, nodes: T[]): T[] {\n\tconst result: T[] = []\n\n\tconst seenNodes: Set<NodeID> = new Set()\n\n\tfor (const node of nodes) {\n\t\tif (seenNodes.has(node.id)) continue\n\t\tseenNodes.add(node.id)\n\n\t\tif (!isReplicaVariantOrReplicaVariantChild(node)) {\n\t\t\tresult.push(node)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (seenNodes.has(node.originalid)) continue\n\t\tseenNodes.add(node.originalid)\n\n\t\tconst originalNode = tree.get<T>(node.originalid)\n\t\tif (!originalNode) continue\n\t\tresult.push(originalNode)\n\t}\n\n\treturn result\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariantFormButtonSource } from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport type { WithHTMLTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport { HTMLTag, allHTMLTags, withHTMLTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport type { ReducedHTMLTags } from \"document/models/CanvasTree/traits/utils/reduceHTMLTags.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { getOriginalNodes } from \"utils/getOriginalNodes.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { AccessibilityLabel } from \"./utils.ts\"\n\ninterface HtmlTagRowProps extends Omit<ReducedHTMLTags, \"htmlTextTags\" | \"anyNodesWithLinks\" | \"onlyNodesWithHTMLTag\"> {\n\tnodeIds: string[]\n\tonlyNodesWithForm?: boolean\n}\n\nconst traitTypeKeys: (keyof WithHTMLTag)[] = [\"htmlTag\"]\n\nexport function HtmlTagRow({\n\tnodeIds,\n\tonlyNodesWithLinks,\n\tonlyNodesWithFormButton,\n\tonlyNodesWithFormAncestor,\n\tonlyNodesWithListParents,\n\thtmlTags,\n}: HtmlTagRowProps) {\n\tconst updateHTMLTag = useUpdateHtmlTag(nodeIds)\n\tconst deleteHTMLTag = React.useCallback(() => updateHTMLTag(undefined), [updateHTMLTag])\n\tconst canDeleteHTMLTag = !onlyNodesWithLinks && !onlyNodesWithListParents\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\ttitle={AccessibilityLabel.HtmlTag}\n\t\t\tonDelete={canDeleteHTMLTag ? deleteHTMLTag : undefined}\n\t\t>\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButton enabled={canDeleteHTMLTag}>\n\t\t\t\t\t{onlyNodesWithFormButton ? (\n\t\t\t\t\t\t<PopupButtonItem key=\"button\" title=\"button\" selected enabled={false} />\n\t\t\t\t\t) : onlyNodesWithLinks ? (\n\t\t\t\t\t\t<PopupButtonItem key=\"a\" title=\"a\" selected enabled={false} />\n\t\t\t\t\t) : onlyNodesWithListParents ? (\n\t\t\t\t\t\t<PopupButtonItem key=\"li\" title=\"li\" selected enabled={false} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\tallHTMLTags.map(tag => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={tag}\n\t\t\t\t\t\t\t\tidentifier={tag}\n\t\t\t\t\t\t\t\ttitle={tag}\n\t\t\t\t\t\t\t\tselected={htmlTags.has(tag)}\n\t\t\t\t\t\t\t\tonSelect={updateHTMLTag}\n\t\t\t\t\t\t\t\tenabled={tag === HTMLTag.label ? onlyNodesWithFormAncestor : true}\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</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\nfunction useUpdateHtmlTag(nodeIds: NodeID[]): (tag: HTMLTag | undefined) => void {\n\treturn useEngineCallback(\n\t\t(tag: HTMLTag) => {\n\t\t\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withHTMLTag)\n\t\t\tconst originalNodes = getOriginalNodes(tree, nodes)\n\t\t\tconst update: WithHTMLTag = { htmlTag: tag }\n\n\t\t\toriginalNodes.forEach(node => {\n\t\t\t\tif (isVariantFormButtonSource(tree, node)) return\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n", "import { PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed } 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 { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { HTMLTextTag, WithHTMLTextTag } from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport {\n\tdefaultHTMLTextTag,\n\thtmlTextTags as supportedHTMLTextTags,\n\twithHTMLTextTag,\n} from \"document/models/CanvasTree/traits/WithHTMLTextTag.ts\"\nimport type { ReducedHTMLTags } from \"document/models/CanvasTree/traits/utils/reduceHTMLTags.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useMemo } from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport * as styles from \"./HtmlTextTagRow.styles.ts\"\nimport { AccessibilityLabel } from \"./utils.ts\"\n\ninterface HtmlTextTagRowProps extends Omit<\n\tReducedHTMLTags,\n\t\"htmlTags\" | \"anyNodesWithLinks\" | \"onlyNodesWithHTMLTag\" | \"onlyNodesWithFormButton\" | \"onlyNodesWithFormAncestor\"\n> {\n\tnodeIds: NodeID[]\n}\n\nconst traitTypeKeys: (keyof WithHTMLTextTag)[] = [\"htmlTextTag\"]\n/**\n * @name HtmlTextTagRow\n * A row component to select container HTML Text elements\n */\nexport function HtmlTextTagRow({\n\tnodeIds,\n\tonlyNodesWithLinks,\n\thtmlTextTags,\n\tonlyNodesWithListParents,\n}: HtmlTextTagRowProps) {\n\tconst updateHTMLTextTag = useUpdateHTMLTextTag(nodeIds)\n\tconst displayTitle = useMemo(() => {\n\t\tconst value = commonValue(htmlTextTags)\n\t\tif (isMixed(value)) return Dictionary.Mixed\n\t\tif (isString(value)) return value\n\t\treturn defaultHTMLTextTag\n\t}, [htmlTextTags])\n\n\treturn (\n\t\t<PanelRow traitTypeKeys={traitTypeKeys} title={AccessibilityLabel.HtmlTextTag}>\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButtonDisplayTitle\n\t\t\t\t\tdisplayTitle={\n\t\t\t\t\t\tonlyNodesWithListParents && (\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<span className={styles.listItemPrefixPart}>li</span>\n\t\t\t\t\t\t\t\t<span className={styles.listItemPrefixPart}>\u203A</span>\n\t\t\t\t\t\t\t\t<span>{displayTitle}</span>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<PopupButton enabled={!onlyNodesWithLinks}>\n\t\t\t\t\t\t{onlyNodesWithLinks ? (\n\t\t\t\t\t\t\t<PopupButtonItem key=\"a\" title=\"a\" selected enabled={false} />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tsupportedHTMLTextTags.map(tag => (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={tag}\n\t\t\t\t\t\t\t\t\tidentifier={tag}\n\t\t\t\t\t\t\t\t\ttitle={tag}\n\t\t\t\t\t\t\t\t\tselected={htmlTextTags.has(tag)}\n\t\t\t\t\t\t\t\t\tonSelect={updateHTMLTextTag}\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</PopupButton>\n\t\t\t\t</PopupButtonDisplayTitle>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\nfunction useUpdateHTMLTextTag(nodeIds: NodeID[]): (tag: HTMLTextTag) => void {\n\treturn useEngineCallback(\n\t\t(tag: HTMLTextTag) => {\n\t\t\tconst nodes = engine.tree.getNodes(nodeIds)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\tnode.setTextBlockTag(tag, true)\n\t\t\t\t}\n\n\t\t\t\tif (withHTMLTextTag(node)) {\n\t\t\t\t\tnode.set({ htmlTextTag: tag })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n", "import \"HtmlTextTagRow.styles_1pavlsf.wyw.css\"; export const listItemPrefixPart = \"listItemPrefixPart_l11uxpyu\";", "import { Button, NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithTabIndex } from \"document/models/CanvasTree/traits/WithTabIndex.ts\"\nimport { withTabIndex } from \"document/models/CanvasTree/traits/WithTabIndex.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedTabIndex } from \"document/models/CanvasTree/traits/utils/reduceTabIndex.ts\"\nimport { getNodePropertyControlDescription } from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { AccessibilityLabel } from \"./utils.ts\"\n\ninterface TabIndexRowProps extends Omit<ReducedTabIndex, \"onlyNodesWithTabIndex\"> {\n\tnodeIds: NodeID[]\n}\n\nconst traitTypeKeys: [keyof WithTabIndex] = [\"tabIndex\"]\n// A negative value (usually tabindex=\"-1\") means that the element is not reachable via sequential keyboard navigation\n// but there is no benefit to setting it less than -1 as all negative values are treated as the same\nconst minTabIndex = -1\nconst maxTabIndex = 5\nconst computedTabIndexPopoutId = \"computed-tab-index\"\n\nexport function TabIndexRow({ nodeIds, tabIndex }: TabIndexRowProps) {\n\tconst updateTabIndex = useUpdateTabIndex(nodeIds)\n\tconst clearTabIndex = React.useCallback(() => updateTabIndex(undefined), [updateTabIndex])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: AccessibilityLabel.TabIndex,\n\t\t\t\tinitialValue: isNumber(tabIndex) ? tabIndex : 0,\n\t\t\t\toptions: {\n\t\t\t\t\tmin: minTabIndex,\n\t\t\t\t\tmax: maxTabIndex,\n\t\t\t\t\tdisplayStepper: true,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (variableRef) updateTabIndex(variableRef)\n\t\t},\n\t\t[tabIndex, updateTabIndex],\n\t)\n\tconst selectComputedValue = React.useCallback(\n\t\t(value: ComputedValue) => {\n\t\t\tupdateTabIndex(value)\n\t\t\tpopoutWindow.navigation.presentPopout(computedTabIndexPopoutId)\n\t\t},\n\t\t[updateTabIndex],\n\t)\n\tconst removeDynamicValue = React.useCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\tif (isVariableReference(dynamicValue)) {\n\t\t\t\tconst variableValue = getVariableValue(engine, dynamicValue)\n\t\t\t\tupdateTabIndex(isNumber(variableValue) ? variableValue : undefined)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tupdateTabIndex(undefined)\n\t\t},\n\t\t[updateTabIndex],\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\ttitle={AccessibilityLabel.TabIndex}\n\t\t\tonDelete={clearTabIndex}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(tabIndex) ? tabIndex : null}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonSelectVariable={updateTabIndex}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tvariableType={ControlType.Number}\n\t\t\tvariableCreationType={ControlType.Number}\n\t\t\tvariableReferenceType={ControlType.Number}\n\t\t\tcomputedValuePopoutId={computedTabIndexPopoutId}\n\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t>\n\t\t\t{isDynamicValue(tabIndex) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\tvalue={tabIndex}\n\t\t\t\t\ttitle={AccessibilityLabel.TabIndex}\n\t\t\t\t\toutputControl={tabIndexControl}\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tonChangeDynamicValue={updateTabIndex}\n\t\t\t\t\tpopoutId={computedTabIndexPopoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={notFoundToUndefined(tabIndex)}\n\t\t\t\t\t\tonChange={updateTabIndex}\n\t\t\t\t\t\tonClear={clearTabIndex}\n\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\tmin={minTabIndex}\n\t\t\t\t\t\tmax={maxTabIndex}\n\t\t\t\t\t\tplaceholder={isMixed(tabIndex) ? Dictionary.Mixed : \"\"}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button title={Dictionary.Clear} enabled={tabIndex !== undefined} onClick={clearTabIndex} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction useUpdateTabIndex(nodeIds: NodeID[]): (tabIndex: WithTabIndex[\"tabIndex\"]) => void {\n\treturn useEngineCallback(\n\t\t(tabIndex: WithTabIndex[\"tabIndex\"]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTabIndex)) {\n\t\t\t\tnode.set({ tabIndex })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nconst tabIndexControl = getNodePropertyControlDescription(\"tabIndex\")\n", "import { isString } from \"@framerjs/assets/src/utils.ts\"\nimport { TextArea, TextInput } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithTitleAndDescription } from \"document/models/CanvasTree/traits/WithTitleAndDescription.ts\"\nimport { withTitleAndDescription } from \"document/models/CanvasTree/traits/WithTitleAndDescription.ts\"\nimport type { ReducedTitleAndDescription } from \"document/models/CanvasTree/traits/utils/reduceTitleAndDescription.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\ninterface TitleAndDescriptionsRowProps extends Omit<ReducedTitleAndDescription, \"onlyNodesWithTitleAndDescription\"> {\n\tnodeIds: NodeID[]\n}\n\nexport function TitleAndDescriptionRow({ nodeIds, title, description }: TitleAndDescriptionsRowProps) {\n\tconst updateTitle = useUpdateTitle(nodeIds)\n\tconst updateDescription = useUpdateDescription(nodeIds)\n\tconst deleteTitleAndDescription = useDeleteTitleAndDescription(nodeIds)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Title\" onDelete={deleteTitleAndDescription}>\n\t\t\t\t<TextInput value={isString(title) ? title : \"\"} onChange={updateTitle} style={doubleColumn} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Description\" onDelete={deleteTitleAndDescription}>\n\t\t\t\t<TextArea value={isString(description) ? description : \"\"} onChange={updateDescription} style={doubleColumn} />\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction useUpdateTitle(nodeIds: NodeID[]): (title: string) => void {\n\treturn useEngineCallback(\n\t\t(newTitle: WithTitleAndDescription[\"title\"]) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTitleAndDescription)\n\t\t\tnodes.forEach(node => node.set({ title: newTitle }))\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nfunction useUpdateDescription(nodeIds: NodeID[]): (title: string) => void {\n\treturn useEngineCallback(\n\t\t(newDescription: WithTitleAndDescription[\"description\"]) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTitleAndDescription)\n\t\t\tnodes.forEach(node => node.set({ description: newDescription }))\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nfunction useDeleteTitleAndDescription(nodeIds: NodeID[]): () => void {\n\treturn useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTitleAndDescription)\n\t\tnodes.forEach(node => node.set({ title: undefined, description: undefined }))\n\t}, [nodeIds])\n}\n", "import { ContextAlignment } from \"document/components/utils/contextAlignmentActions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport React from \"react\"\nimport { AlignmentRow } from \"../rows/AlignmentRow/AlignmentRow.tsx\"\n\ninterface Props {\n\tnodes: CanvasNode[]\n\talignToParent: boolean\n\tenabled: boolean\n}\n\nexport class AlignmentHeader extends React.Component<Props> {\n\talignAction = (alignmentType: ContextAlignment.AlignOption) => {\n\t\tconst { nodes } = this.props\n\t\tContextAlignment.align(engine.tree, nodes, alignmentType)\n\t}\n\n\tdistributeAction = (distributionType: ContextAlignment.DistributeOption) => {\n\t\tconst { nodes } = this.props\n\t\tContextAlignment.distribute(engine.tree, nodes, distributionType)\n\t}\n\n\toverride render() {\n\t\tconst { nodes, alignToParent, enabled } = this.props\n\t\tconst withoutDescendants = engine.tree.withoutDescendants(nodes)\n\n\t\tconst alignEnabled = ContextAlignment.alignEnabled(engine.tree, withoutDescendants, alignToParent)\n\t\tconst distEnabled = ContextAlignment.distributeEnabled(engine.tree, withoutDescendants, alignToParent)\n\n\t\treturn (\n\t\t\t<AlignmentRow\n\t\t\t\talignActionsEnabled={enabled && alignEnabled}\n\t\t\t\tdistributeActionsEnabled={enabled && distEnabled}\n\t\t\t\talignAction={this.alignAction}\n\t\t\t\tdistributeAction={this.distributeAction}\n\t\t\t/>\n\t\t)\n\t}\n}\n", "import { Button, SegmentedControl, SegmentedControlItem, Translatable as T } from \"@framerjs/fresco\"\nimport { type Mixed, shouldBeNever } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isOverlayNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isValidOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tbackdropPresets,\n\tdefaultBackdropTransition,\n\tfallbackBackdropTransition,\n\twithBackdrop,\n} from \"document/models/CanvasTree/traits/WithBackdrop.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedBackdrop } from \"document/models/CanvasTree/traits/utils/reduceBackdrop.ts\"\nimport type { ReducedEffectTransition } from \"document/models/CanvasTree/traits/utils/reduceEffectTransition.ts\"\nimport type { ReducedZIndex } from \"document/models/CanvasTree/traits/utils/reduceZIndex.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { isTransition } from \"document/models/Transition.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isBoolean, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { FillPopoutButton } from \"../../shared/ColorPicker/FillPopoutButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { TransitionPopoutButton } from \"../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { Padlock } from \"../inputs/Padlock.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { ZIndexRow } from \"../rows/ZIndexRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./BackdropPanel.styles.ts\"\nimport { BackdropPresetRow } from \"./BackdropPresetRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\nconst traitTypes = [TraitType.Overlay]\nconst transitionTraitTypes = [TraitType.OverlayTransition]\nconst variableTypes: VariableType[] = [ControlType.Color]\n\nfunction reducedTransitionOrFallback(\n\ttransition: ReducedBackdrop[\"backdropEnterTransition\"],\n): ReducedEffectTransition | Mixed {\n\treturn isNotFound(transition) || isUndefined(transition) ? { ...fallbackBackdropTransition } : transition\n}\n\ninterface Props extends Omit<ReducedBackdrop, \"onlyNodesWithBackdrop\">, Pick<ReducedZIndex, \"zIndex\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const BackdropPanel = React.memo(function BackdropPanel({\n\tnodeIds,\n\tbackdropFill,\n\tbackdropFillEnabled,\n\tbackdropEnterTransition,\n\tbackdropExitTransition,\n\tbackdropTransitionLocked,\n\tbackdropDismissible,\n\tblockDocumentScrolling,\n\tzIndex,\n}: Props) {\n\tconst hasCommonFill = backdropFillEnabled === true\n\n\tconst enableBackdrop = engine.scheduler.wrapHandler(() => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node =>\n\t\t\tnode.set({\n\t\t\t\tbackdropFill: node.backdropFill ?? backdropPresets.instant().backdropFill,\n\t\t\t\tbackdropFillEnabled: true,\n\t\t\t}),\n\t\t)\n\t})\n\n\tconst removeBackdrop = engine.scheduler.wrapHandler(() => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => node.set({ backdropFillEnabled: false }))\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler(() => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\ttype: ControlType.Color,\n\t\t\tname: \"backdrop\",\n\t\t\tinitialValue: isString(backdropFill) ? backdropFill : \"white\",\n\t\t\tscopeId: engine.stores.scopeStore.active.id,\n\t\t})\n\n\t\tif (!variableRef) return\n\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropFill: variableRef, backdropFillEnabled: true })\n\t\t})\n\t})\n\n\tconst onRemoveDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(backdropFill)) return\n\n\t\tif (isVariableReference(backdropFill)) {\n\t\t\tconst variableValue = getVariableValue(engine, backdropFill)\n\t\t\tconst newBackdrop = isString(variableValue) ? variableValue : \"white\"\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({ backdropFill: newBackdrop })\n\t\t\t})\n\t\t} else if (isComputedValue(backdropFill)) {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({ backdropFill: \"white\" })\n\t\t\t})\n\t\t} else {\n\t\t\tshouldBeNever(backdropFill)\n\t\t}\n\t})\n\n\tconst onChangeDynamicValue = engine.scheduler.wrapHandler((dynamicValue: DynamicValue) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropFill: dynamicValue, backdropFillEnabled: true })\n\t\t})\n\t})\n\n\tconst onFillColorChange = engine.scheduler.wrapHandler((color: string) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropFillEnabled: true, backdropFill: color })\n\t\t})\n\t})\n\n\tconst onEnterTransitionChange = engine.scheduler.wrapHandler((transition: Transition) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropEnterTransition: transition })\n\t\t})\n\t})\n\n\tconst onExitTransitionChange = engine.scheduler.wrapHandler((transition: Transition) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropExitTransition: transition })\n\t\t})\n\t})\n\n\tconst toggleTransitionLocked = engine.scheduler.wrapHandler(() => {\n\t\tif (!backdropTransitionLocked) {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({\n\t\t\t\t\tbackdropExitTransition: undefined,\n\t\t\t\t\tbackdropTransitionLocked: true,\n\t\t\t\t})\n\t\t\t})\n\t\t} else {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({\n\t\t\t\t\tbackdropExitTransition: isTransition(backdropEnterTransition)\n\t\t\t\t\t\t? backdropEnterTransition\n\t\t\t\t\t\t: defaultBackdropTransition,\n\t\t\t\t\tbackdropTransitionLocked: false,\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t})\n\n\tconst toggleBlockDocumentScrolling = engine.scheduler.wrapHandler((value: boolean) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t// This prop is not overridable.\n\t\t\tconst originalNode = engine.tree.getNode(node.getPrimaryId())\n\t\t\tif (!originalNode) return\n\t\t\tif (!isOverlayNode(originalNode)) return\n\t\t\toriginalNode.set({\n\t\t\t\tblockDocumentScrolling: value,\n\t\t\t})\n\t\t})\n\t})\n\n\tconst anyDisabledOverlay = nodeIds.some(nodeId => {\n\t\tconst node = engine.tree.getNode(nodeId)\n\t\tif (!node || !isOverlayNode(node)) return true\n\t\treturn !isValidOverlay(node, engine.tree)\n\t})\n\n\tif (anyDisabledOverlay) return null\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title={<T>Overlay</T>} />}>\n\t\t\t<BackdropPresetRow\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tbackdropFillEnabled={backdropFillEnabled}\n\t\t\t\tbackdropFill={backdropFill}\n\t\t\t\tbackdropEnterTransition={backdropEnterTransition}\n\t\t\t\tbackdropExitTransition={backdropExitTransition}\n\t\t\t\tbackdropTransitionLocked={backdropTransitionLocked}\n\t\t\t\tbackdropDismissible={backdropDismissible}\n\t\t\t\tblockDocumentScrolling={blockDocumentScrolling}\n\t\t\t/>\n\t\t\t<PanelRow\n\t\t\t\ttitle=\"Fill\"\n\t\t\t\tonAdd={enableBackdrop}\n\t\t\t\taddEnabled={!hasCommonFill}\n\t\t\t\tonDelete={removeBackdrop}\n\t\t\t\tdeleteEnabled={hasCommonFill}\n\t\t\t\ttraitTypes={traitTypes}\n\t\t\t\tvariableType={variableTypes}\n\t\t\t\tonCreateVariable={createVariable}\n\t\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\t\tdynamicValue={isDynamicValue(backdropFill) ? backdropFill : null}\n\t\t\t\tonSelectVariable={onChangeDynamicValue}\n\t\t\t\tsupportsVariables\n\t\t\t>\n\t\t\t\t{hasCommonFill ? (\n\t\t\t\t\tisDynamicValue(backdropFill) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\ttitle=\"Fill\"\n\t\t\t\t\t\t\tvalue={backdropFill}\n\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\texpectedType={variableTypes}\n\t\t\t\t\t\t\tpopoutId=\"backdropFillValueTransform\"\n\t\t\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\t\t\tonChangeDynamicValue={onChangeDynamicValue}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<FillPopoutButton\n\t\t\t\t\t\t\tvalue={isString(backdropFill) ? backdropFill : \"\"}\n\t\t\t\t\t\t\tcurrentType=\"color\"\n\t\t\t\t\t\t\tonChange={onFillColorChange}\n\t\t\t\t\t\t\tonClearFill={removeBackdrop}\n\t\t\t\t\t\t\tclearFillEnabled\n\t\t\t\t\t\t\ttrackingMetadata={{ nodeType: \"overlay\", nodeProperty: \"backdrop\" }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"fill\" onClick={enableBackdrop} />\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t<DismissBackdropRow backdropDismissible={backdropDismissible} nodeIds={nodeIds} />\n\t\t\t<PanelRow title=\"Enter\" traitTypes={transitionTraitTypes}>\n\t\t\t\t<Padlock\n\t\t\t\t\tlocked={backdropTransitionLocked === true}\n\t\t\t\t\tonClick={toggleTransitionLocked}\n\t\t\t\t\tinline={false}\n\t\t\t\t\ttitle=\"Transitions\"\n\t\t\t\t/>\n\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={backdropTransitionLocked === true ? \"Enter & Exit\" : \"Enter\"}\n\t\t\t\t\ttransition={reducedTransitionOrFallback(backdropEnterTransition)}\n\t\t\t\t\tonChange={onEnterTransitionChange}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Exit\" traitTypes={transitionTraitTypes}>\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={backdropTransitionLocked === true ? \"Enter & Exit\" : \"Exit\"}\n\t\t\t\t\ttransition={\n\t\t\t\t\t\tbackdropTransitionLocked === true\n\t\t\t\t\t\t\t? reducedTransitionOrFallback(backdropEnterTransition)\n\t\t\t\t\t\t\t: reducedTransitionOrFallback(backdropExitTransition)\n\t\t\t\t\t}\n\t\t\t\t\tonChange={backdropTransitionLocked ? onEnterTransitionChange : onExitTransitionChange}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<ZIndexRow\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tzIndex={zIndex}\n\t\t\t\tpositionStickyEnabled={false}\n\t\t\t\tonlyNodesWithFloatingPosition={false}\n\t\t\t/>\n\t\t\t<PanelRow title=\"Page Scroll\">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"Auto\"\n\t\t\t\t\t\tonSelect={toggleBlockDocumentScrolling}\n\t\t\t\t\t\tselected={blockDocumentScrolling === false}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle=\"Block\"\n\t\t\t\t\t\tonSelect={toggleBlockDocumentScrolling}\n\t\t\t\t\t\tselected={blockDocumentScrolling !== false}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<Button\n\t\t\t\t\t\ttitle=\"Done\"\n\t\t\t\t\t\tonClick={() => engine.stores.overlayStore.exitEditMode(engine.stores.selectionStore)}\n\t\t\t\t\t\tclassName={styles.doneButton}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</Panel>\n\t)\n})\n\nfunction DismissBackdropRow({ backdropDismissible, nodeIds }: Pick<Props, \"backdropDismissible\" | \"nodeIds\">) {\n\tconst onChange = engine.scheduler.wrapHandler((value: boolean) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropDismissible: value })\n\t\t})\n\t})\n\n\tconst onCreateVariable = engine.scheduler.wrapHandler(() => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"backdropDismissible\",\n\t\t\tinitialValue: isBoolean(backdropDismissible) ? backdropDismissible : true,\n\t\t\tscopeId: engine.stores.scopeStore.active.id,\n\t\t})\n\n\t\tif (!variableRef) return\n\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropFill: variableRef, backdropFillEnabled: true })\n\t\t})\n\t})\n\n\tconst onRemoveVariableReference = engine.scheduler.wrapHandler(() => {\n\t\tif (isVariableReference(backdropDismissible)) {\n\t\t\tconst variableValue = getVariableValue(engine, backdropDismissible)\n\t\t\tconst newBackdrop = isBoolean(variableValue) ? variableValue : true\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({ backdropDismissible: newBackdrop })\n\t\t\t})\n\t\t} else if (isComputedValue(backdropDismissible)) {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\t\tnode.set({ backdropDismissible: true })\n\t\t\t})\n\t\t}\n\t})\n\n\tconst onChangeDynamicValue = engine.scheduler.wrapHandler((dynamicValue: DynamicValue) => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withBackdrop).forEach(node => {\n\t\t\tnode.set({ backdropDismissible: dynamicValue })\n\t\t})\n\t})\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Dismissible\"\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveVariableReference}\n\t\t\tdynamicValue={isDynamicValue(backdropDismissible) ? backdropDismissible : null}\n\t\t\tonSelectVariable={onChangeDynamicValue}\n\t\t\tsupportsVariables\n\t\t>\n\t\t\t{isDynamicValue(backdropDismissible) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Dismissible\"\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\tvalue={backdropDismissible}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId=\"backdropDismissibleValueTransform\"\n\t\t\t\t\tonRemove={onRemoveVariableReference}\n\t\t\t\t\tonChangeDynamicValue={onChangeDynamicValue}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={backdropDismissible === true}\n\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={backdropDismissible === false}\n\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { IconAnimatedLock, useReadOnly } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport * as styles from \"./Padlock.styles.ts\"\n\ninterface Props {\n\tlocked: boolean\n\tonClick: () => void\n\tinline: boolean\n\ttitle: string\n\tenabled?: boolean\n}\n\nfunction getTitle(locked: boolean, enabled: boolean, title: string) {\n\tif (!enabled) return locked ? `Locked ${title}` : `Unlocked ${title}`\n\treturn locked ? `Unlock ${title}` : `Lock ${title}`\n}\n\nexport const Padlock = React.memo(function Padlock({ locked, inline, title, enabled = true, onClick }: Props) {\n\tconst isReadOnly = useReadOnly()\n\tconst disabled = isReadOnly || !enabled\n\tconst clickHandlers = useClickHandlers(onClick)\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cx(\n\t\t\t\tstyles.padlockWrapper,\n\t\t\t\tinline && styles.padlockWrapperInline,\n\t\t\t\tlocked && enabled && styles.padlockWrapperActive,\n\t\t\t\tdisabled && styles.readOnly,\n\t\t\t)}\n\t\t\t{...(disabled ? null : clickHandlers)}\n\t\t\ttitle={getTitle(locked, enabled, title)}\n\t\t\tdata-testid=\"padlock\"\n\t\t>\n\t\t\t{!inline && (\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"12\"\n\t\t\t\t\theight=\"70\"\n\t\t\t\t\tclassName={styles.padlockConnector}\n\t\t\t\t\trole=\"presentation\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 5.75 22 L 5.75 18.75 C 5.75 17.093 7.093 15.75 8.75 15.75 L 11 15.75\"\n\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\t\tstroke={colors.padLockConnector}\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t/>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 5.75 47.75 L 5.75 51 C 5.75 52.657 7.093 54 8.75 54 L 11 54\"\n\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\t\t\tstroke={colors.padLockConnector}\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t)}\n\t\t\t<IconAnimatedLock active={locked} />\n\t\t</div>\n\t)\n})\n", "import \"Padlock.styles_15szvgd.wyw.css\"; export const padlockWrapper = \"padlockWrapper_p1l06jvx\";\nexport const readOnly = \"readOnly_rdhqa0y\";\nexport const padlockWrapperActive = \"padlockWrapperActive_pb60jvh\";\nexport const padlockWrapperInline = \"padlockWrapperInline_pzefot4\";\nexport const padlockConnector = \"padlockConnector_p8c7y0f\";", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tfloatingZIndex,\n\tgetDefaultZIndex,\n\tisValidZIndex,\n\tmaxZIndex,\n\tminZIndex,\n\twithZIndex,\n} from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport {\n\tisPositionAbsolute,\n\tisPositionFixed,\n\tisPositionSticky,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { ReducedZIndex } from \"document/models/CanvasTree/traits/utils/reduceZIndex.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"z-index-popout\"\n\ninterface ZIndexRowProps extends ReducedZIndex {\n\tnodeIds: NodeID[]\n\tpositionStickyEnabled: boolean\n\tonlyNodesWithFloatingPosition: boolean\n}\n\nconst traitTypes = [TraitType.ZIndex]\n\nexport const ZIndexRow = React.memo(function ZIndexRow({\n\tnodeIds,\n\tpositionStickyEnabled,\n\tonlyNodesWithFloatingPosition,\n\tzIndex,\n}: ZIndexRowProps): JSX.Element | null {\n\tconst canCopyZIndex = !isMixed(zIndex)\n\tconst [canPasteZIndex, pasteZIndex, copyZIndex] = useCopyAndPasteSingleProperty(\n\t\tTraitType.ZIndex,\n\t\tnodeIds,\n\t\tcanCopyZIndex,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withZIndex)) {\n\t\t\t\tif (isVariant(node)) continue\n\t\t\t\t// `z-index` respect `sticky` position and prohibit to give it a value less than 1\n\t\t\t\tconst isSticky = isPositionSticky(node)\n\t\t\t\tconst zIndexValue = isValidZIndex(value, isSticky, hasFloatingPosition(node))\n\t\t\t\t\t? value\n\t\t\t\t\t: getDefaultZIndex(isSticky || isPositionFixed(node) || isPositionAbsolute(node), hasFloatingPosition(node))\n\t\t\t\tnode.set({ zIndex: zIndexValue })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst clearValue = useEngineCallback((): void => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withZIndex)) {\n\t\t\tif (isVariant(node)) continue\n\t\t\tnode.set({ zIndex: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(zIndex)) return\n\t\tupdateValue(getDefaultZIndex(positionStickyEnabled, onlyNodesWithFloatingPosition))\n\t}, [zIndex, positionStickyEnabled, onlyNodesWithFloatingPosition, updateValue])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isNumber(zIndex) ? zIndex : 0,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: \"zIndex\",\n\t\t\t\toptions: { min: minZIndex, max: floatingZIndex, step: 1 },\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withZIndex)) {\n\t\t\t\tif (isVariant(node)) continue\n\t\t\t\tnode.set({ zIndex: variableRef })\n\t\t\t}\n\t\t},\n\t\t[zIndex, nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withZIndex).forEach(node => {\n\t\t\t\tnode.set({ zIndex: dynamicValue })\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectComputedValue = (computedValue: ComputedValue) => {\n\t\tupdateDynamicValue(computedValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tif (!isNumber(zIndex) && !isDynamicValue(zIndex)) return null\n\n\tconst min = positionStickyEnabled ? 1 : minZIndex\n\tconst max = onlyNodesWithFloatingPosition ? floatingZIndex : maxZIndex\n\tconst defaultZIndex = positionStickyEnabled ? 1 : 0\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Z Index\"\n\t\t\ttraitTypes={traitTypes}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(zIndex) ? zIndex : null}\n\t\t\tvariableType={ControlType.Number}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t\tonDelete={clearValue}\n\t\t\tonCopy={copyZIndex}\n\t\t\tonPaste={pasteZIndex}\n\t\t\tcopyEnabled={canCopyZIndex}\n\t\t\tpasteEnabled={canPasteZIndex}\n\t\t>\n\t\t\t{isDynamicValue(zIndex) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Z Index\"\n\t\t\t\t\tvalue={zIndex}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\tdefaultValue={defaultZIndex}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tmin={min}\n\t\t\t\t\t\tonChange={updateValue}\n\t\t\t\t\t\tonClear={clearValue}\n\t\t\t\t\t\tvalue={zIndex}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tprecision={0}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import \"BackdropPanel.styles_17h164x.wyw.css\"; export const doneButton = \"doneButton_d15ste0y\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithBackdrop } from \"document/models/CanvasTree/traits/WithBackdrop.ts\"\nimport { backdropPresets, withBackdrop } from \"document/models/CanvasTree/traits/WithBackdrop.ts\"\nimport type { ReducedBackdrop } from \"document/models/CanvasTree/traits/utils/reduceBackdrop.ts\"\nimport { hash } from \"library/utils/string.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\nconst presetKeys = Object.keys(backdropPresets)\n\nconst hashes = {}\nfor (const key in backdropPresets) {\n\tconst presetHash = hash(JSON.stringify(backdropPresets[key]()))\n\thashes[presetHash] = key\n}\n\ninterface Props extends Omit<ReducedBackdrop, \"onlyNodesWithBackdrop\"> {\n\tnodeIds: NodeID[]\n}\n\nconst setBackdropPreset = engine.scheduler.wrapHandler((nodeIds: NodeID[], preset: keyof typeof backdropPresets) => {\n\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\tconst update: Partial<WithBackdrop> = { ...backdropPresets[preset]() }\n\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withBackdrop)\n\tnodes.forEach(node => node.set(update))\n})\n\n/** \uD83D\uDEA8 Exported for testing. */\nexport const getPreset = ({\n\tbackdropFill,\n\tbackdropDismissible,\n\tbackdropFillEnabled,\n\tbackdropEnterTransition,\n\tbackdropExitTransition,\n\tbackdropTransitionLocked,\n}: Omit<Props, \"nodeIds\" | \"blockDocumentScrolling\">) => {\n\tconst presetHash = hash(\n\t\tJSON.stringify({\n\t\t\tbackdropFill,\n\t\t\tbackdropDismissible,\n\t\t\tbackdropFillEnabled,\n\t\t\tbackdropEnterTransition,\n\t\t\tbackdropExitTransition,\n\t\t\tbackdropTransitionLocked,\n\t\t}),\n\t)\n\n\treturn hashes[presetHash] ?? null\n}\n\nexport function BackdropPresetRow({ nodeIds, ...backdrop }: Props) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: Does this really not need exhaustive deps?\n\tconst preset = React.useMemo<string | null>(() => getPreset(backdrop), [...Object.values(backdrop)])\n\n\treturn (\n\t\t<PanelRow title=\"Preset\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t{presetKeys.map((option: keyof typeof backdropPresets) => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\ttitle={titleCase(option)}\n\t\t\t\t\t\t\tselected={preset === option}\n\t\t\t\t\t\t\tonSelect={() => setBackdropPreset(nodeIds, option)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t\t<PopupButtonItem type=\"divider\" visible={isNull(preset)} />\n\t\t\t\t\t<PopupButtonItem title=\"Custom\" selected visible={isNull(preset)} />\n\t\t\t\t</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import { NumberInputWithTicker, SegmentedControl, SegmentedControlItem, Slider, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { DEFAULT_PAGE_EFFECT_TOKEN } from \"document/models/CanvasTree/traits/WithPageEffects.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { AllReducedEffects } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { canPastePageEffects, canPasteSinglePageEffect } from \"document/models/CanvasTree/traits/utils/pageEffects.ts\"\nimport type { ReducedPageEffects } from \"document/models/CanvasTree/traits/utils/reducePageEffect.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type { PageEffect, PageTransition, RoutePageEffects } from \"library/router/pageEffects/types.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { MaskPopoutButton } from \"../../shared/MaskPopout/MaskPopout.tsx\"\nimport { UnitNumberInputRow } from \"../../shared/MaskPopout/UnitNumberInputRow.tsx\"\nimport { trackPageEffect } from \"../../shared/PageEffects/tracking.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { TransitionPopoutButton } from \"../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { FusedNumberInputs } from \"../inputs/FusedNumberInputs.tsx\"\nimport { EffectPreviewIcon } from \"../rows/EffectRows/EffectPreviewIcon.tsx\"\nimport { FlowEffectRow, flowEffectPopoutId } from \"../rows/EffectRows/FlowEffectRow.tsx\"\nimport { enableFlowEffect } from \"../rows/EffectRows/shared/utils.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { getWebPageModulesToRegenerate } from \"../utils/regenerateModulesForLayoutTemplateFlowEffect.ts\"\nimport { ROTATE_MAX_VALUE, ROTATE_MIN_VALUE, rotate3dLabels } from \"../utils/rotate.ts\"\nimport { PageEffectPreset, defaultPageTransition, pageEffectPresets } from \"./PageEffectsPresetRow.tsx\"\nimport { PageEffectRouteSelector, getPageEffectRouteLabel } from \"./PageEffectsRouteSelector.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nconst THIS_PAGE_TRANSITION_ID = \"thisPage\"\n\nconst rotationKeys: Partial<keyof PageTransition>[] = [\"rotateX\", \"rotateY\", \"rotate\"]\n\nconst pageTransitionPanelId = (name: string) => `pageTransition-${name}`\nconst pageEffectPanelId = (routeId: string) => `pageEffect-${routeId}`\n\nconst orderEffectIds = (routes: string[]) => (a: string, b: string) => {\n\treturn routes.indexOf(a) - routes.indexOf(b)\n}\n\nfunction getCurrentPrimaryBreakpoint() {\n\tconst activeScopeNode = engine.stores.scopeStore.active\n\tif (!isWebPageNode(activeScopeNode)) return\n\treturn activeScopeNode.getPrimaryVariant()\n}\n\ninterface PageEffectOptionsProps {\n\trouteId: string\n\teffect: PageEffect\n\tavailableRouteIds: string[]\n\tcanAddGlobalPageEffect: boolean\n}\n\ntype OnPageTransitionChange = <T extends keyof PageTransition>(key: T, value: PageTransition[T]) => void\n\ninterface PageTransitionRowProps {\n\tid: string\n\tpageTransition?: PageTransition\n\ttitle: string\n\tnavigationTitle: string\n\tbuttonTitle: string\n\tonChange: OnPageTransitionChange\n\tonAdd?: VoidFunction\n\tonDelete?: VoidFunction\n}\n\nfunction PageEffectStylePopout(props: PageTransition & { onChange: OnPageTransitionChange }) {\n\tconst { onChange, opacity, scale, x, y, rotate3d, rotate, rotateX, rotateY, mask, transition } = props\n\n\tconst onChangeValue = <T extends keyof PageTransition>(key: T) => {\n\t\treturn (value: PageTransition[T]) => onChange(key, value)\n\t}\n\n\tconst onChangeRotate = (value: number) => {\n\t\tonChange(\"rotate3d\", false)\n\t\tonChange(\"rotate\", value)\n\t}\n\n\tconst onChangeRotate3DValue = useCallback(\n\t\t(index: number, value: number) => {\n\t\t\tconst rotationKey = rotationKeys[index]\n\n\t\t\tif (rotationKey) {\n\t\t\t\tonChange(rotationKey, value)\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t)\n\n\treturn (\n\t\t<Stack gap={0} padding={0}>\n\t\t\t<PanelRow title={Dictionary.Opacity}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(opacity)}\n\t\t\t\t\tdefaultValue={defaultPageTransition.opacity}\n\t\t\t\t\tonChange={onChangeValue(\"opacity\")}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={1}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(opacity)} min={0} max={1} onChange={onChangeValue(\"opacity\")} step={0.1} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Scale}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(scale)}\n\t\t\t\t\tdefaultValue={defaultPageTransition.scale}\n\t\t\t\t\tonChange={onChangeValue(\"scale\")}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={10}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(scale)} min={0} max={10} onChange={onChangeValue(\"scale\")} step={0.1} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Rotate}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={rotate3d ? undefined : notFoundToUndefined(rotate)}\n\t\t\t\t\tdefaultValue={defaultPageTransition.rotate}\n\t\t\t\t\tonChange={onChangeRotate}\n\t\t\t\t\tmin={ROTATE_MIN_VALUE}\n\t\t\t\t\tmax={ROTATE_MAX_VALUE}\n\t\t\t\t\tstep={1}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControl>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"2D\"\n\t\t\t\t\t\tselected={!rotate3d}\n\t\t\t\t\t\tonSelect={onChangeValue(\"rotate3d\")}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem identifier={true} title=\"3D\" selected={rotate3d} onSelect={onChangeValue(\"rotate3d\")} />\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{rotate3d && (\n\t\t\t\t<PanelRow title=\"\">\n\t\t\t\t\t<FusedNumberInputs\n\t\t\t\t\t\tlabels={rotate3dLabels}\n\t\t\t\t\t\tvalues={[notFoundToUndefined(rotateX), notFoundToUndefined(rotateY), notFoundToUndefined(rotate)]}\n\t\t\t\t\t\tdefaultValues={[defaultPageTransition.rotateX, defaultPageTransition.rotateY, defaultPageTransition.rotate]}\n\t\t\t\t\t\tminValue={ROTATE_MIN_VALUE}\n\t\t\t\t\t\tmaxValue={ROTATE_MAX_VALUE}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tonValueChange={onChangeRotate3DValue}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t<UnitNumberInputRow title=\"Offset X\" value={x} onChange={onChangeValue(\"x\")} />\n\t\t\t<UnitNumberInputRow title=\"Offset Y\" value={y} onChange={onChangeValue(\"y\")} />\n\n\t\t\t<PanelRow title={Dictionary.Mask}>\n\t\t\t\t<MaskPopoutButton\n\t\t\t\t\ttitle={Dictionary.Mask}\n\t\t\t\t\tmask={mask}\n\t\t\t\t\tonChange={onChangeValue(\"mask\")}\n\t\t\t\t\tpopoutId=\"page-effect-mask\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\ttransition={transition}\n\t\t\t\t\tonChange={onChangeValue(\"transition\")}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\nfunction PageTransitionRow({\n\tid,\n\ttitle,\n\tnavigationTitle,\n\tpageTransition,\n\tbuttonTitle,\n\tonAdd,\n\tonDelete,\n\tonChange,\n}: PageTransitionRowProps) {\n\treturn (\n\t\t<PanelRow title={title}>\n\t\t\t{pageTransition ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={pageTransitionPanelId(id)}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageEffectStylePopout {...pageTransition} onChange={onChange} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t}\n\t\t\t\t\tnavigationTitle={navigationTitle}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\ttitle={buttonTitle}\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion onClick={onAdd} type=\"pageEffectExit\" />\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction usePageEffectHandler<A, B>(\n\tupdatePageEffects: (pageEffects: RoutePageEffects, argA: A, argB?: B) => RoutePageEffects | null,\n\tdependencies: unknown[],\n): (argA: A, argB?: B) => void {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: @TODO: Does this really not need exhaustive deps?\n\treturn useEngineCallback((argA: A, argB: B) => {\n\t\tconst page = getCurrentPrimaryBreakpoint()\n\t\tif (!page) return\n\n\t\tconst newPageEffects = updatePageEffects({ ...page.pageEffects }, argA, argB)\n\n\t\tif (newPageEffects !== null) {\n\t\t\tpage.set({ pageEffects: newPageEffects })\n\t\t}\n\t}, dependencies)\n}\n\nfunction PageEffectOptions({ effect, routeId, availableRouteIds, canAddGlobalPageEffect }: PageEffectOptionsProps) {\n\tconst onChange = usePageEffectHandler(\n\t\t<K extends keyof PageEffect>(pageEffects: RoutePageEffects, key: K, value: PageEffect[K]) => {\n\t\t\tconst newEffect = { ...effect, [key]: value }\n\t\t\tif (routeId === DEFAULT_PAGE_EFFECT_TOKEN) {\n\t\t\t\tengine.tree.root.set({ globalPageEffect: newEffect })\n\t\t\t} else {\n\t\t\t\tpageEffects[routeId] = newEffect\n\t\t\t}\n\n\t\t\treturn pageEffects\n\t\t},\n\t\t[routeId, effect],\n\t)\n\tconst changePageTransition = (name: \"exit\" | \"enter\") => (key: string, value: any) => {\n\t\tconst pageTransition = effect[name]\n\n\t\tif (pageTransition) {\n\t\t\tonChange(name, {\n\t\t\t\t...pageTransition,\n\t\t\t\t[key]: value,\n\t\t\t})\n\t\t}\n\t}\n\n\tconst onPresetSelect = usePageEffectHandler(\n\t\t(pageEffects: RoutePageEffects, presetEffect: PageEffect) => {\n\t\t\tconst newEffect = { ...presetEffect }\n\t\t\tif (routeId === DEFAULT_PAGE_EFFECT_TOKEN) {\n\t\t\t\tengine.tree.root.set({ globalPageEffect: newEffect })\n\t\t\t\treturn null\n\t\t\t} else {\n\t\t\t\tpageEffects[routeId] = newEffect\n\t\t\t}\n\n\t\t\treturn pageEffects\n\t\t},\n\t\t[routeId],\n\t)\n\n\tconst onRouteSelect = usePageEffectHandler(\n\t\t(pageEffects: RoutePageEffects, newRouteId: string) => {\n\t\t\tif (availableRouteIds.indexOf(newRouteId) === -1 && newRouteId !== DEFAULT_PAGE_EFFECT_TOKEN) {\n\t\t\t\treturn null\n\t\t\t}\n\n\t\t\t// Delete old effect\n\t\t\tif (routeId === DEFAULT_PAGE_EFFECT_TOKEN) {\n\t\t\t\tengine.tree.root.set({ globalPageEffect: undefined })\n\t\t\t} else {\n\t\t\t\tdelete pageEffects[routeId]\n\t\t\t}\n\n\t\t\t// Save new effect\n\t\t\tif (newRouteId === DEFAULT_PAGE_EFFECT_TOKEN) {\n\t\t\t\tengine.tree.root.set({ globalPageEffect: effect })\n\t\t\t} else {\n\t\t\t\tpageEffects[newRouteId] = effect\n\t\t\t}\n\n\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(pageEffectPanelId(newRouteId))\n\n\t\t\treturn pageEffects\n\t\t},\n\t\t[routeId, availableRouteIds],\n\t)\n\n\tconst addExitTransition = () => {\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(pageTransitionPanelId(THIS_PAGE_TRANSITION_ID))\n\t\tonChange(\"exit\", pageEffectPresets.crossfade.preset.enter)\n\t}\n\n\tconst deleteExitTransition = () => {\n\t\tonChange(\"exit\", undefined)\n\t}\n\n\tconst nextPageTitle = routeId === DEFAULT_PAGE_EFFECT_TOKEN ? \"Any Page\" : \"Next Page\"\n\n\t/**\n\t * When adding URL targeting and supporting multiple page effects, move to popout\n\t */\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PageEffectRouteSelector\n\t\t\t\trouteId={routeId}\n\t\t\t\tonSelect={onRouteSelect}\n\t\t\t\tavailableRouteIds={availableRouteIds}\n\t\t\t\tcanAddGlobalPageEffect={canAddGlobalPageEffect}\n\t\t\t/>\n\t\t\t<PageEffectPreset effect={effect} onSelect={onPresetSelect} />\n\t\t\t<PageTransitionRow\n\t\t\t\tid={THIS_PAGE_TRANSITION_ID}\n\t\t\t\ttitle=\"This Page\"\n\t\t\t\tnavigationTitle=\"This Page\"\n\t\t\t\tbuttonTitle=\"Exit\"\n\t\t\t\tonChange={changePageTransition(\"exit\")}\n\t\t\t\tonAdd={addExitTransition}\n\t\t\t\tonDelete={deleteExitTransition}\n\t\t\t\tpageTransition={effect.exit}\n\t\t\t/>\n\t\t\t<PageTransitionRow\n\t\t\t\tid=\"nextPage\"\n\t\t\t\ttitle={nextPageTitle}\n\t\t\t\tnavigationTitle={nextPageTitle}\n\t\t\t\tbuttonTitle=\"Enter\"\n\t\t\t\tonChange={changePageTransition(\"enter\")}\n\t\t\t\tpageTransition={effect.enter}\n\t\t\t/>\n\t\t\t<DescriptionRow description=\"Page Effects work in Chrome versions 116+\" />\n\t\t</Stack>\n\t)\n}\n\nfunction getNodeId(node: { id: NodeID }) {\n\treturn node.id\n}\n\nfunction getPageEffectsState() {\n\treturn {\n\t\tallRouteIds: [\n\t\t\t...engine.stores.scopeStore.getWebPageNodesWithoutCollection().map(getNodeId),\n\t\t\t...engine.stores.scopeStore.getWebPageNodesWithCollection().map(getNodeId),\n\t\t],\n\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\tglobalPageEffect: engine.tree.root.globalPageEffect,\n\t}\n}\n\nfunction usePageEffectsState() {\n\treturn useDeprecatedEngineState([EngineChange.Tree, EngineChange.ActiveBundle], getPageEffectsState, undefined, true)\n}\n\nfunction shouldShowRegenerationModalForFlowEffect(selection: NodeID[]): boolean {\n\tif (!experiments.isOn(\"flowEffectInLayoutTemplates\")) return false\n\n\tconst activeScope = engine.stores.scopeStore.active\n\tif (!isLayoutTemplateNode(activeScope)) return false\n\n\tconst isFlowEffectOnLayoutTemplateBreakpoint = selection.some(id => {\n\t\tconst node = engine.tree.get(id)\n\t\treturn isBreakpointVariant(node) && node.parentid === activeScope.id\n\t})\n\tif (!isFlowEffectOnLayoutTemplateBreakpoint) return false\n\n\tconst { stats } = getWebPageModulesToRegenerate(engine.stores.modulesStore, engine.stores.treeStore)\n\treturn stats.modulesToRegenerate > 0\n}\n\ninterface Props extends Pick<\n\tAllReducedEffects,\n\t\"onlyNodesWithFlowEffect\" | \"flowEffectEnabled\" | \"flowEffectTransition\"\n> {\n\treadOnly: boolean\n\tselection: NodeID[]\n\tsupportsPageEffects: boolean\n\tanyBreakpointWithLayoutTemplate: boolean\n}\n\nconst defaultPageEffects: RoutePageEffects = {}\n\nexport const BreakpointEffectsPanel = React.memo(function BreakpointEffectsPanel({\n\treadOnly,\n\tselection,\n\tonlyNodesWithFlowEffect,\n\tflowEffectEnabled,\n\tflowEffectTransition,\n\tsupportsPageEffects,\n\tpageEffects = defaultPageEffects,\n\tanyBreakpointWithLayoutTemplate,\n}: Props & ReducedPageEffects) {\n\tconst supportsFlowEffect = useExperimentIsOn(\"flowEffect\") && onlyNodesWithFlowEffect\n\tconst addPageEffect = usePageEffectHandler((newPageEffects: RoutePageEffects, newRouteId: string) => {\n\t\tconst isGlobalPageEffect = newRouteId === DEFAULT_PAGE_EFFECT_TOKEN\n\t\ttrackPageEffect({ action: \"add\", routeType: isGlobalPageEffect ? \"global\" : \"single\" })\n\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(pageEffectPanelId(newRouteId))\n\n\t\tif (isGlobalPageEffect) {\n\t\t\tengine.tree.root.set({ globalPageEffect: pageEffectPresets.crossfade.preset })\n\t\t\treturn null\n\t\t} else {\n\t\t\tnewPageEffects[newRouteId] = pageEffectPresets.crossfade.preset\n\t\t}\n\n\t\treturn newPageEffects\n\t}, [])\n\n\tconst deletePageEffect = usePageEffectHandler((newPageEffects: RoutePageEffects, deletedRouteId: string) => {\n\t\tconst isGlobalPageEffect = deletedRouteId === DEFAULT_PAGE_EFFECT_TOKEN\n\t\ttrackPageEffect({ action: \"remove\", routeType: isGlobalPageEffect ? \"global\" : \"single\" })\n\n\t\tif (isGlobalPageEffect) {\n\t\t\tengine.tree.root.set({ globalPageEffect: undefined })\n\t\t\treturn null\n\t\t}\n\n\t\t// Always delete \"All Pages\" effects on route - this is just to briefly support\n\t\t// Page Effects added when \"All Pages\" was supported per-route.\n\t\tdelete newPageEffects[deletedRouteId]\n\n\t\treturn newPageEffects\n\t}, [])\n\n\tconst contextMenuAddEffectHandler = useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tif (readOnly) return\n\n\t\t\tconst effectsMenu: MenuItemOptions[] = []\n\t\t\tif (isClipboardSupported()) {\n\t\t\t\teffectsMenu.push(\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Copy,\n\t\t\t\t\t\tclick: async () => Clipboard.copyPageEffects(pageEffects as RoutePageEffects),\n\t\t\t\t\t\tenabled: Boolean(!isMixed(pageEffects) && !isNotFound(pageEffects) && Object.keys(pageEffects).length),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Paste,\n\t\t\t\t\t\tclick: async () => Clipboard.pastePageEffects(engine, selection),\n\t\t\t\t\t\tenabled: await canPastePageEffects(engine.tree, selection),\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t\tengine.stores.contextMenuStore.show(effectsMenu, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[readOnly, pageEffects, selection],\n\t)\n\n\tconst currentPageId = engine.stores.scopeStore.useState(state => state.active.id)\n\tconst { allRouteIds, homePageNodeId, globalPageEffect } = usePageEffectsState()\n\tconst isHomePage = homePageNodeId === currentPageId\n\n\tconst resolvedPageEffects = React.useMemo<RoutePageEffects>(() => {\n\t\t// If mixed we will not display the panel anyway so we can simplify here and return the default page effects.\n\t\tif (pageEffects === undefined || isNotFound(pageEffects) || isMixed(pageEffects)) {\n\t\t\treturn defaultPageEffects\n\t\t}\n\t\treturn pageEffects\n\t}, [pageEffects])\n\n\tconst copyPageEffect = useCallback(\n\t\t(routeId: string) => {\n\t\t\tconst routeEffect = routeId === DEFAULT_PAGE_EFFECT_TOKEN ? globalPageEffect : resolvedPageEffects[routeId]\n\t\t\tif (!routeEffect) return\n\n\t\t\treturn Clipboard.copyPageEffects({\n\t\t\t\t[routeId]: routeEffect,\n\t\t\t})\n\t\t},\n\t\t[resolvedPageEffects, globalPageEffect],\n\t)\n\n\tconst pasteSinglePageEffect = useCallback(\n\t\t(routeId: string) => {\n\t\t\treturn Clipboard.pastePageEffects(engine, selection, routeId)\n\t\t},\n\t\t[selection],\n\t)\n\n\tconst canAddGlobalPageEffect = !globalPageEffect && isHomePage\n\n\tconst availableRouteIds: string[] = React.useMemo(() => {\n\t\treturn allRouteIds.filter(routeId => {\n\t\t\treturn !resolvedPageEffects[routeId] && routeId !== currentPageId\n\t\t})\n\t}, [resolvedPageEffects, allRouteIds, currentPageId])\n\n\tconst orderedRouteIds = Object.keys(resolvedPageEffects).sort(orderEffectIds(allRouteIds))\n\tconst nextAvailableRoute = availableRouteIds[0]\n\tconst canAddPageEffect = supportsPageEffects && (canAddGlobalPageEffect || Boolean(nextAvailableRoute))\n\tconst canAddFlowEffect = supportsFlowEffect && !flowEffectEnabled && !anyBreakpointWithLayoutTemplate\n\tconst canAddEffect = canAddPageEffect || canAddFlowEffect\n\tconst hasDisplayedGlobalPageEffect = globalPageEffect && isHomePage\n\tconst showFlowEffect = supportsFlowEffect && (canAddFlowEffect || flowEffectEnabled === true)\n\n\tconst onAdd = useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n\t\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"All Pages\",\n\t\t\t\t\tdescription: \"Animate between all pages\",\n\t\t\t\t\tvisible: supportsPageEffects && isHomePage,\n\t\t\t\t\tenabled: canAddGlobalPageEffect,\n\t\t\t\t\tclick: () => addPageEffect(DEFAULT_PAGE_EFFECT_TOKEN),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Single Page\",\n\t\t\t\t\tdescription: \"Animate to a specific page\",\n\t\t\t\t\tvisible: canAddPageEffect,\n\t\t\t\t\tenabled: Boolean(nextAvailableRoute),\n\t\t\t\t\tclick: () => nextAvailableRoute && addPageEffect(nextAvailableRoute),\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Flow,\n\t\t\t\t\tdescription: \"Animate nested sections\",\n\t\t\t\t\tvisible: showFlowEffect,\n\t\t\t\t\tenabled: canAddFlowEffect,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst enableAndShowPopout = () => {\n\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(flowEffectPopoutId)\n\t\t\t\t\t\t\tenableFlowEffect(selection)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (shouldShowRegenerationModalForFlowEffect(selection)) {\n\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.LayoutTemplateFlowEffectRegeneration,\n\t\t\t\t\t\t\t\tsource: \"properties\",\n\t\t\t\t\t\t\t\tonSuccess: enableAndShowPopout,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tenableAndShowPopout()\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\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[\n\t\t\tcanAddGlobalPageEffect,\n\t\t\tnextAvailableRoute,\n\t\t\taddPageEffect,\n\t\t\tisHomePage,\n\t\t\tselection,\n\t\t\tcanAddPageEffect,\n\t\t\tsupportsPageEffects,\n\t\t\tcanAddFlowEffect,\n\t\t\tshowFlowEffect,\n\t\t],\n\t)\n\n\tif (!supportsPageEffects && !showFlowEffect) return null\n\n\t/**\n\t * This doesn't currently support breakpoint overrides, and as effects on root\n\t * nodes they can't yet be mixed or not found.\n\t */\n\tif (isMixed(pageEffects)) return null\n\n\tif (hasDisplayedGlobalPageEffect) {\n\t\torderedRouteIds.unshift(DEFAULT_PAGE_EFFECT_TOKEN)\n\t}\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle=\"Effects\"\n\t\t\t\t\tclickable={canAddEffect && !readOnly}\n\t\t\t\t\tonClick={canAddEffect ? onAdd : undefined}\n\t\t\t\t\tonContextMenu={contextMenuAddEffectHandler}\n\t\t\t\t>\n\t\t\t\t\t{canAddEffect ? (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t) : null}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{orderedRouteIds.map(routeId => {\n\t\t\t\tconst routeEffect = routeId === DEFAULT_PAGE_EFFECT_TOKEN ? globalPageEffect : resolvedPageEffects[routeId]\n\t\t\t\tif (!routeEffect) return null\n\n\t\t\t\tconst title = getPageEffectRouteLabel(routeId)\n\n\t\t\t\treturn (\n\t\t\t\t\t<PanelRow\n\t\t\t\t\t\tkey={routeId}\n\t\t\t\t\t\ttitle={Dictionary.Page}\n\t\t\t\t\t\tonCopy={() => copyPageEffect(routeId)}\n\t\t\t\t\t\tcopyEnabled={isClipboardSupported()}\n\t\t\t\t\t\tonPaste={() => pasteSinglePageEffect(routeId)}\n\t\t\t\t\t\tpasteEnabled={() => canPasteSinglePageEffect(engine.tree, selection)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\tid={pageEffectPanelId(routeId)}\n\t\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t\t\tnavigationTitle=\"Page Effect\"\n\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t<PageEffectOptions\n\t\t\t\t\t\t\t\t\tavailableRouteIds={availableRouteIds}\n\t\t\t\t\t\t\t\t\tcanAddGlobalPageEffect={canAddGlobalPageEffect}\n\t\t\t\t\t\t\t\t\teffect={routeEffect}\n\t\t\t\t\t\t\t\t\trouteId={routeId}\n\t\t\t\t\t\t\t\t\tkey={routeId}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\tonDelete={() => deletePageEffect(routeId)}\n\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)\n\t\t\t})}\n\t\t\t{supportsFlowEffect && flowEffectEnabled && (\n\t\t\t\t<FlowEffectRow\n\t\t\t\t\tnodeIds={selection}\n\t\t\t\t\tonlyNodesWithFlowEffect={onlyNodesWithFlowEffect}\n\t\t\t\t\tflowEffectEnabled={flowEffectEnabled}\n\t\t\t\t\tflowEffectTransition={flowEffectTransition}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { IconEffect, NumberInputWithTicker, PopupButton, PopupButtonItem, Slider } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type {\n\tAngularDirection,\n\tBlindsMask,\n\tCircleMask,\n\tConicMask,\n\tInsetMask,\n\tMask,\n\tWipeMask,\n} from \"library/router/pageEffects/types.ts\"\nimport { useCallback } from \"react\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { ButtonWithPreviewContent } from \"../ButtonWithPreviewContent.tsx\"\nimport { PopoutButton } from \"../PopoutButton.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../PopoutWindow.tsx\"\nimport { MaskPreview } from \"./MaskPreview.tsx\"\nimport { UnitNumberInputRow } from \"./UnitNumberInputRow.tsx\"\n\nconst maskLabel = {\n\tcircle: \"Circle\",\n\tconic: \"Conic\",\n\tinset: \"Inset\",\n\tblinds: \"Blinds\",\n\twipe: \"Wipe\",\n}\n\ntype OnMaskChange = (mask: Mask | undefined) => void\n\nconst center = {\n\tx: \"50%\",\n\ty: \"50%\",\n} as const\n\nconst defaultSweepAngle = 360\n\nconst defaultAngle = 0\n\nfunction getDefaultMask(type: Mask[\"type\"]): Mask {\n\tswitch (type) {\n\t\tcase \"conic\": {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\tangle: defaultAngle,\n\t\t\t\tsweepAngle: defaultSweepAngle,\n\t\t\t\tangularDirection: \"clockwise\",\n\t\t\t\t...center,\n\t\t\t}\n\t\t}\n\t\tcase \"circle\": {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\t...center,\n\t\t\t}\n\t\t}\n\t\tcase \"inset\": {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\t...center,\n\t\t\t\tround: 0,\n\t\t\t}\n\t\t}\n\t\tcase \"blinds\": {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\tangle: defaultAngle,\n\t\t\t\twidth: \"20%\",\n\t\t\t}\n\t\t}\n\t\tcase \"wipe\": {\n\t\t\treturn {\n\t\t\t\ttype,\n\t\t\t\tangle: defaultAngle,\n\t\t\t\twidth: \"0%\",\n\t\t\t}\n\t\t}\n\t}\n}\n\ninterface MaskPopoutProps {\n\tmask?: Mask\n\tonChange: OnMaskChange\n}\n\nfunction hasAngle(mask: Mask): mask is ConicMask | BlindsMask | WipeMask {\n\treturn \"angle\" in mask\n}\n\nfunction hasSweepAngle(mask: Mask): mask is ConicMask {\n\treturn \"sweepAngle\" in mask\n}\n\nfunction hasWidth(mask: Mask): mask is BlindsMask | WipeMask {\n\treturn \"width\" in mask\n}\n\nfunction hasOriginX(mask: Mask): mask is CircleMask | InsetMask | ConicMask {\n\treturn \"x\" in mask\n}\n\nfunction hasOriginY(mask: Mask): mask is CircleMask | InsetMask | ConicMask {\n\treturn \"y\" in mask\n}\n\nfunction hasAngularDirection(mask: Mask): mask is ConicMask {\n\treturn \"angularDirection\" in mask\n}\n\nfunction MaskPopout({ mask = getDefaultMask(\"circle\"), onChange }: MaskPopoutProps) {\n\tconst onChangeValue = <T extends Mask = Mask>(key: keyof T) => {\n\t\treturn (value: T[typeof key]) => {\n\t\t\tonChange({\n\t\t\t\t...mask,\n\t\t\t\t[key]: value,\n\t\t\t})\n\t\t}\n\t}\n\n\tconst onChangeType = useCallback((type: Mask[\"type\"]) => onChange(getDefaultMask(type)), [onChange])\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tpaddingTop: `calc(${dimensions.css.inputSpacing} / 2)`,\n\t\t\t\tpaddingBottom: dimensions.css.inputSpacing,\n\t\t\t\tpaddingLeft: dimensions.css.popoverPadding,\n\t\t\t\tpaddingRight: dimensions.css.popoverPadding,\n\t\t\t}}\n\t\t>\n\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"blinds\"\n\t\t\t\t\t\t\ttitle={maskLabel.blinds}\n\t\t\t\t\t\t\tselected={mask.type === \"blinds\"}\n\t\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"circle\"\n\t\t\t\t\t\t\ttitle={maskLabel.circle}\n\t\t\t\t\t\t\tselected={mask.type === \"circle\"}\n\t\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"conic\"\n\t\t\t\t\t\t\ttitle={maskLabel.conic}\n\t\t\t\t\t\t\tselected={mask.type === \"conic\"}\n\t\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"inset\"\n\t\t\t\t\t\t\ttitle={maskLabel.inset}\n\t\t\t\t\t\t\tselected={mask.type === \"inset\"}\n\t\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tidentifier=\"wipe\"\n\t\t\t\t\t\t\ttitle={maskLabel.wipe}\n\t\t\t\t\t\t\tselected={mask.type === \"wipe\"}\n\t\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t\t{hasAngle(mask) ? (\n\t\t\t\t<PanelRow title=\"Angle\">\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={mask.angle}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tmax={360}\n\t\t\t\t\t\tdefaultValue={defaultAngle}\n\t\t\t\t\t\tonChange={onChangeValue<typeof mask>(\"angle\")}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tlabel=\"deg\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider value={mask.angle} min={0} step={1} max={360} onChange={onChangeValue<typeof mask>(\"angle\")} />\n\t\t\t\t</PanelRow>\n\t\t\t) : null}\n\t\t\t{hasSweepAngle(mask) ? (\n\t\t\t\t<PanelRow title=\"Sweep\">\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={mask.sweepAngle}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tmax={360}\n\t\t\t\t\t\tdefaultValue={defaultSweepAngle}\n\t\t\t\t\t\tonChange={onChangeValue<typeof mask>(\"sweepAngle\")}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tlabel=\"deg\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider\n\t\t\t\t\t\tvalue={mask.sweepAngle}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tmax={360}\n\t\t\t\t\t\tonChange={onChangeValue<typeof mask>(\"sweepAngle\")}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t) : null}\n\t\t\t{hasAngularDirection(mask) ? (\n\t\t\t\t<PanelRow title=\"Direction\">\n\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t<PopupButtonItem<AngularDirection>\n\t\t\t\t\t\t\t\tidentifier=\"clockwise\"\n\t\t\t\t\t\t\t\ttitle=\"Clockwise\"\n\t\t\t\t\t\t\t\tselected={mask.angularDirection === \"clockwise\"}\n\t\t\t\t\t\t\t\tonSelect={onChangeValue<typeof mask>(\"angularDirection\")}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButtonItem<AngularDirection>\n\t\t\t\t\t\t\t\tidentifier=\"counter-clockwise\"\n\t\t\t\t\t\t\t\ttitle=\"Counter Clockwise\"\n\t\t\t\t\t\t\t\tselected={mask.angularDirection === \"counter-clockwise\"}\n\t\t\t\t\t\t\t\tonSelect={onChangeValue<typeof mask>(\"angularDirection\")}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelRow>\n\t\t\t) : null}\n\t\t\t{hasWidth(mask) ? (\n\t\t\t\t<UnitNumberInputRow title=\"Width\" min={0} value={mask.width} onChange={onChangeValue<typeof mask>(\"width\")} />\n\t\t\t) : null}\n\t\t\t{hasOriginX(mask) ? (\n\t\t\t\t<UnitNumberInputRow title=\"Origin X\" value={mask.x} onChange={onChangeValue<typeof mask>(\"x\")} />\n\t\t\t) : null}\n\t\t\t{hasOriginY(mask) ? (\n\t\t\t\t<UnitNumberInputRow title=\"Origin Y\" value={mask.y} onChange={onChangeValue<typeof mask>(\"y\")} />\n\t\t\t) : null}\n\t\t\t{mask ? <MaskPreview mask={mask} /> : null}\n\t\t</div>\n\t)\n}\n\ninterface MaskPopoutButtonProps {\n\ttitle: string\n\tmask: Mask | undefined\n\tonChange: OnMaskChange\n\tpopoutId: string\n}\n\nexport function MaskPopoutButton({ title, mask, onChange, popoutId }: MaskPopoutButtonProps) {\n\tconst popoutColor = !mask ? colors.inputLabel : undefined\n\n\tconst addMask = () => {\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(popoutId)\n\t\tonChange(getDefaultMask(\"circle\"))\n\t}\n\n\treturn (\n\t\t<div style={doubleColumn}>\n\t\t\t{mask ? (\n\t\t\t\t<PopoutButton\n\t\t\t\t\tid={popoutId}\n\t\t\t\t\tpopout={<MaskPopout mask={mask} onChange={onChange} />}\n\t\t\t\t\tnavigationTitle={title}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tstyle={{ width: \"100%\" }}\n\t\t\t\t>\n\t\t\t\t\t<ButtonWithPreviewContent\n\t\t\t\t\t\ttitle={maskLabel[mask.type]}\n\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={popoutColor} borderColor={popoutColor}>\n\t\t\t\t\t\t\t\t<IconEffect />\n\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonDelete={() => onChange(undefined)}\n\t\t\t\t\t/>\n\t\t\t\t</PopoutButton>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion onClick={addMask} type=\"effect\" />\n\t\t\t)}\n\t\t</div>\n\t)\n}\n", "import { cx } from \"@linaria/core\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { DOMKeyframesDefinition } from \"framer-motion\"\nimport { animate } from \"framer-motion\"\nimport type { CircleMask, InsetMask, Mask, WipeMask } from \"library/router/pageEffects/types.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { useEffect, useRef, useState } from \"react\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../../properties/utils/doubleColumn.styles.ts\"\nimport * as styles from \"./MaskPreview.styles.ts\"\n\ninterface Props {\n\tmask: Mask\n}\n\nfunction calcMaskPosition(mask: InsetMask | CircleMask, element: HTMLElement) {\n\tconst [x, xUnit] = parseCSSDimension(mask.x)\n\tconst [y, yUnit] = parseCSSDimension(mask.y)\n\treturn {\n\t\tx: xUnit === \"px\" ? x : element.offsetWidth * (x / 100),\n\t\ty: yUnit === \"px\" ? y : element.offsetHeight * (y / 100),\n\t}\n}\n\nfunction wipeGradient(progress: number, mask: WipeMask) {\n\tconst angle = mask.angle + 90 + \"deg\"\n\tlet gradient = `linear-gradient(${angle}, `\n\tgradient += `black calc(calc(0% - ${mask.width}) + calc(calc(100% + ${mask.width}) * ${progress})), `\n\tgradient += `transparent calc(calc(100% + ${mask.width}) * ${progress}))`\n\treturn gradient\n}\n\nexport function MaskPreview({ mask }: Props) {\n\tconst ref = useRef<HTMLDivElement>(null)\n\tconst [forceRenderCount, setForceRenderCount] = useState(0)\n\tconst maskDependency = JSON.stringify(mask)\n\n\t// Disabling as all the potential changes within mask are combined as maskDependency.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: see above\n\tuseEffect(() => {\n\t\tif (!ref.current) return\n\n\t\tconst target: DOMKeyframesDefinition = {}\n\t\tconst { type } = mask\n\n\t\tswitch (type) {\n\t\t\tcase \"inset\": {\n\t\t\t\tconst { x, y } = calcMaskPosition(mask, ref.current)\n\t\t\t\tconst right = ref.current.offsetWidth - x\n\t\t\t\tconst bottom = ref.current.offsetHeight - y\n\t\t\t\ttarget.clipPath = [\n\t\t\t\t\t`inset(${y}px ${right}px ${bottom}px ${x}px round ${mask.round}px)`,\n\t\t\t\t\t`inset(0px 0px 0px 0px round 0)`,\n\t\t\t\t]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"circle\": {\n\t\t\t\tconst { x, y } = calcMaskPosition(mask, ref.current)\n\t\t\t\tconst endRadius = Math.hypot(\n\t\t\t\t\tMath.max(x, ref.current.offsetWidth - x),\n\t\t\t\t\tMath.max(y, ref.current.offsetHeight - y),\n\t\t\t\t)\n\t\t\t\ttarget.clipPath = [`circle(0px at ${x}px ${y}px)`, `circle(${endRadius}px at ${x}px ${y}px)`]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"conic\": {\n\t\t\t\tconst isBlackToTransparent = mask.angularDirection === \"clockwise\"\n\t\t\t\tconst firstColor = isBlackToTransparent ? \"black\" : \"transparent\"\n\t\t\t\tconst secondColor = isBlackToTransparent ? \"transparent\" : \"black\"\n\n\t\t\t\tlet startGradient = `conic-gradient(from `\n\t\t\t\tstartGradient += `${mask.angle}deg at ${mask.x} ${mask.y}, `\n\t\t\t\tlet endGradient = startGradient\n\t\t\t\tlet originPercentage = 0\n\t\t\t\tlet targetPercentage = (mask.sweepAngle / 360) * 100\n\n\t\t\t\tif (!isBlackToTransparent) {\n\t\t\t\t\t;[originPercentage, targetPercentage] = [targetPercentage, originPercentage]\n\t\t\t\t}\n\n\t\t\t\tstartGradient += `${firstColor} 0%, ${firstColor} ${originPercentage}%, `\n\t\t\t\tstartGradient += `${secondColor} ${originPercentage}%, ${secondColor} 100%)`\n\n\t\t\t\tendGradient += `${firstColor} 0%, ${firstColor} ${targetPercentage}%, `\n\t\t\t\tendGradient += `${secondColor} ${targetPercentage}%, ${secondColor} 100%)`\n\n\t\t\t\ttarget.maskImage = target.webkitMaskImage = [startGradient, endGradient]\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"blinds\": {\n\t\t\t\tconst angle = mask.angle + 90 + \"deg\"\n\t\t\t\tlet startGradient = `repeating-linear-gradient(${angle}, `\n\t\t\t\tlet endGradient = startGradient\n\t\t\t\tconst [, widthUnit] = parseCSSDimension(mask.width)\n\n\t\t\t\tstartGradient += `black 0px, black 0${widthUnit}, `\n\t\t\t\tstartGradient += `transparent 0${widthUnit}, transparent ${mask.width})`\n\t\t\t\tendGradient += `black 0px, black ${mask.width}, `\n\t\t\t\tendGradient += `transparent ${mask.width}, transparent ${mask.width})`\n\n\t\t\t\ttarget.maskImage = target.webkitMaskImage = [startGradient, endGradient]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"wipe\": {\n\t\t\t\ttarget.maskImage = target.webkitMaskImage = [wipeGradient(0, mask), wipeGradient(1, mask)]\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tassertNever(type)\n\t\t\t}\n\t\t}\n\n\t\tconst animation = animate(ref.current, target, { delay: 0.3, duration: 1 })\n\n\t\treturn () => animation.stop()\n\t}, [forceRenderCount, maskDependency])\n\n\treturn (\n\t\t<PanelRow title=\"Preview\">\n\t\t\t<div\n\t\t\t\tclassName={cx(doubleColumnClass, styles.container)}\n\t\t\t\tonClick={() => setForceRenderCount(forceRenderCount + 1)}\n\t\t\t>\n\t\t\t\t<div ref={ref} className={styles.mask} />\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import \"MaskPreview.styles_rv3fdt.wyw.css\"; export const container = \"container_c1jfasnz\";\nexport const mask = \"mask_m4ssrw4\";", "import { NumberInputWithTicker, PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { CSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { PanelRow } from \"../../properties/rows/PanelRow.tsx\"\n\ninterface Props {\n\ttitle: string\n\tvalue: CSSDimension<\"px\" | \"%\">\n\tonChange: (value: CSSDimension<\"px\" | \"%\">) => void\n\tmin?: number\n\tmax?: number\n}\n\nexport function UnitNumberInputRow({ title, value, onChange, min, max }: Props) {\n\tconst isPx = value.endsWith(\"px\")\n\n\tconst onChangeOffset = (newOffset: number, rawValue: string | undefined) => {\n\t\tconst [, prevUnit] = parseCSSDimension<\"px\" | \"%\">(value)\n\n\t\tlet newUnit: \"px\" | \"%\" = prevUnit\n\t\tif (rawValue) {\n\t\t\tconst [, rawUnit] = parseCSSDimension(rawValue)\n\t\t\tif (prevUnit !== rawUnit && (rawUnit === \"px\" || rawUnit === \"%\")) {\n\t\t\t\tnewUnit = rawUnit\n\t\t\t}\n\t\t}\n\n\t\tonChange(createCSSDimension<\"px\" | \"%\">(newOffset, newUnit))\n\t}\n\n\tconst onChangeUnit = (unit: \"px\" | \"%\") => {\n\t\tonChange(createCSSDimension<\"px\" | \"%\">(parseFloat(value), unit))\n\t}\n\n\treturn (\n\t\t<PanelRow title={title}>\n\t\t\t<NumberInputWithTicker value={isPx ? parseFloat(value) : value} onChange={onChangeOffset} min={min} max={max} />\n\t\t\t<PopupButtonDisplayTitle displayTitle={isPx ? \"Fixed\" : \"Rel\"}>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t<PopupButtonItem identifier=\"px\" title=\"Fixed\" selected={isPx} onSelect={onChangeUnit} />\n\t\t\t\t\t<PopupButtonItem identifier=\"%\" title=\"Relative\" selected={!isPx} onSelect={onChangeUnit} />\n\t\t\t\t</PopupButton>\n\t\t\t</PopupButtonDisplayTitle>\n\t\t</PanelRow>\n\t)\n}\n", "import { record } from \"web/lib/tracker.ts\"\n\ninterface PageEffectTypeTrackingData {\n\taction: \"add\" | \"remove\"\n\trouteType: \"global\" | \"single\"\n}\n\nexport function trackPageEffect(data: PageEffectTypeTrackingData) {\n\trecord(\"page_effect_update\", data)\n}\n", "import { IconEffect } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { IconAgentEffect } from \"document/components/chrome/properties/panels/icons/IconAgentEffect.tsx\"\n\nexport function EffectPreviewIcon() {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\treturn agentExperimentEnabled ? <IconAgentEffect /> : <IconEffect />\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { TransitionPopoutButton } from \"document/components/chrome/shared/TransitionEditor/TransitionPopout.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFlowEffect } from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport { withFlowEffect } from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedFlowEffect } from \"document/models/CanvasTree/traits/utils/reduceFlowEffect.ts\"\nimport { defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { DescriptionRow } from \"../../codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\nfunction updateOnFlowEffectChange<K extends keyof WithFlowEffect>(\n\tnodeIds: string[],\n\tupdateKey: K,\n\tvalue: WithFlowEffect[K],\n) {\n\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFlowEffect)) {\n\t\tconst update = { [updateKey]: value }\n\t\tnode.set(update)\n\t\ttrackEffectUpdate(EffectType.Flow, update)\n\t}\n}\n\nfunction useOnFlowEffectChange<K extends keyof WithFlowEffect>(nodeIds: string[], fixedKey: K) {\n\treturn useEngineCallback(\n\t\t(value: WithFlowEffect[K]) => updateOnFlowEffectChange(nodeIds, fixedKey, value),\n\t\t[nodeIds, fixedKey],\n\t)\n}\n\nfunction FlowEffectPopout(props: Omit<Props, \"onlyNodesWithFlowEffect\" | \"flowEffectEnabled\">) {\n\tconst { nodeIds, flowEffectTransition } = props\n\n\tconst transitionHandler = useOnFlowEffectChange(nodeIds, \"flowEffectTransition\")\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t{flowEffectTransition ? (\n\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\t\ttransition={flowEffectTransition}\n\t\t\t\t\t\tonChange={transitionHandler}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\ttype=\"tween\"\n\t\t\t\t\t\tonClick={() => transitionHandler(defaultDurationBasedSpringTransition)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow description=\"Animate content near interactive sections.\" />\n\t\t</Stack>\n\t)\n}\n\ninterface Props extends ReducedFlowEffect {\n\tnodeIds: NodeID[]\n}\n\nexport const flowEffectPopoutId = \"flowEffect\"\n\nexport const FlowEffectRow = React.memo(function FlowEffectRow({\n\tnodeIds,\n\tonlyNodesWithFlowEffect,\n\tflowEffectEnabled,\n\t...effect\n}: Props) {\n\tconst onDelete = useRemoveEffect(EffectType.Flow, nodeIds)\n\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Flow, { flowEffectEnabled: true })\n\tif (!onlyNodesWithFlowEffect || flowEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Flow} title={Dictionary.Flow} onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={flowEffectPopoutId}\n\t\t\t\tpopout={<FlowEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Flow Effect\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\nimport { useEffectTitle } from \"./useEffectTitle.tsx\"\nimport { createCanPasteEffectHandler, createPasteEffectHandler, useExitEffectPreviewOnUnmount } from \"./utils.ts\"\n\ninterface Props {\n\ttype: EffectType\n\ttitle: string\n\tonDelete: () => void\n\tonCopy: () => void\n\tselection: NodeID[]\n}\n\nexport const EffectRow = React.memo(function EffectRow({\n\ttitle,\n\ttype,\n\tonDelete,\n\tonCopy,\n\tselection,\n\tchildren,\n}: React.PropsWithChildren<Props>) {\n\tconst canCopyEffect = isClipboardSupported()\n\tconst pasteEffect = createPasteEffectHandler(selection)\n\tconst canPasteEffect = createCanPasteEffectHandler(selection)\n\tconst panelTitle = useEffectTitle(type, title)\n\n\tuseExitEffectPreviewOnUnmount()\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={panelTitle}\n\t\t\ttraitTypeKeys={effectConfig[type].traitKeys}\n\t\t\tonDelete={onDelete}\n\t\t\tonCopy={onCopy}\n\t\t\tcopyEnabled={canCopyEffect}\n\t\t\tonPaste={pasteEffect(type)}\n\t\t\tpasteEnabled={canPasteEffect(type)}\n\t\t>\n\t\t\t{children}\n\t\t</PanelRow>\n\t)\n})\n", "import type { WithStyleAppearEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport React from \"react\"\n\nconst defaultScrollTitles = {\n\t[EffectType.Appear]: \" \",\n\t[EffectType.Parallax]: \" \",\n\t[EffectType.StyleTransform]: \" \",\n\t[EffectType.SetVariant]: \" \",\n}\n\nfunction getPanelTitles({\n\thasStyleAppearEffectRow,\n\thasParallaxEffectRow,\n\thasTransformEffectRow,\n\tcommonStyleAppearEffectTrigger,\n\tonlyNodesInAnOverlay,\n}: {\n\thasStyleAppearEffectRow: boolean\n\thasParallaxEffectRow: boolean\n\thasTransformEffectRow: boolean\n\tcommonStyleAppearEffectTrigger: Reduced<WithStyleAppearEffect[\"styleAppearEffectTrigger\"]>\n\tonlyNodesInAnOverlay: boolean\n}): Partial<Record<EffectType, string>> {\n\t// Nodes in an overlay show a suggestion for an appear effect if none\n\t// exists.\n\tif (hasStyleAppearEffectRow || onlyNodesInAnOverlay) {\n\t\tif (\n\t\t\tcommonStyleAppearEffectTrigger === EffectTrigger.OnMount ||\n\t\t\t(!hasStyleAppearEffectRow && onlyNodesInAnOverlay)\n\t\t) {\n\t\t\treturn {\n\t\t\t\t[EffectType.Appear]: \"Appear\",\n\t\t\t\t[EffectType.Parallax]: \"Scroll\",\n\t\t\t\t[EffectType.StyleTransform]: !hasParallaxEffectRow ? \"Scroll\" : \" \",\n\t\t\t\t[EffectType.SetVariant]: !hasParallaxEffectRow && !hasTransformEffectRow ? \"Scroll\" : \" \",\n\t\t\t}\n\t\t}\n\n\t\treturn { ...defaultScrollTitles, [EffectType.Appear]: \"Scroll\" }\n\t}\n\n\tif (hasParallaxEffectRow) return { ...defaultScrollTitles, [EffectType.Parallax]: \"Scroll\" }\n\tif (hasTransformEffectRow) return { ...defaultScrollTitles, [EffectType.StyleTransform]: \"Scroll\" }\n\n\treturn { ...defaultScrollTitles, [EffectType.SetVariant]: \"Scroll\" }\n}\n\nconst EffectTitleOverrideContext = React.createContext<(type: EffectType) => string | undefined>(() => undefined)\n\ninterface Props {\n\thasStyleAppearEffectRow: boolean\n\thasParallaxEffectRow: boolean\n\thasTransformEffectRow: boolean\n\tcommonStyleAppearEffectTrigger: Reduced<WithStyleAppearEffect[\"styleAppearEffectTrigger\"]>\n\tonlyNodesInAnOverlay: boolean\n}\n\n/**\n * The titles of effect rows depend on what other effect rows are present. To\n * maintain this consistency, we determine the titles at one point for\n * descendent rows. This allows us to avoid passing all effect props into unique\n * effect rows just to determine individual titles.\n */\nexport function EffectTitleProvider({ children, ...props }: React.PropsWithChildren<Props>) {\n\tconst titles = getPanelTitles(props)\n\n\tconst effectTitles = React.useCallback((effectType: EffectType) => titles?.[effectType], [titles])\n\n\treturn <EffectTitleOverrideContext.Provider value={effectTitles}>{children}</EffectTitleOverrideContext.Provider>\n}\n\nexport const useEffectTitle = (type: EffectType, title: string) => {\n\tconst override = React.useContext(EffectTitleOverrideContext)\n\treturn override?.(type) ?? title\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { WithDragEffect } from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport {\n\ttype WithFlowEffect,\n\tisNodeInFlowEffect,\n\twithFlowEffect,\n} from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport type { WithLightboxEffect } from \"document/models/CanvasTree/traits/WithLightboxEffect.ts\"\nimport type { WithLoopEffect } from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport type { WithParallax } from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport type { WithStrokeEffect } from \"document/models/CanvasTree/traits/WithStrokeEffect.ts\"\nimport type { WithStyleAppearEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport type { WithStyleTransformEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport type { WithTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport type { WithTickerEffect } from \"document/models/CanvasTree/traits/WithTickerEffect.ts\"\nimport type { WithVariantAppearEffect } from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport type { WithWhileHover } from \"document/models/CanvasTree/traits/WithWhileHover.ts\"\nimport type { WithWhileTap } from \"document/models/CanvasTree/traits/WithWhileTap.ts\"\nimport { convertTriggerToStringForTracking } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { AllEffects, AllReducedEffects } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { type Transition, defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { canReadClipboardWithoutPromptingUser, isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { clipboardReadType } from \"utils/clipboard/index.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\ntype Config = typeof effectConfig\n\nfunction transitionLabelForTracking(transition: Transition | undefined) {\n\tif (!transition) return\n\n\tconst { type } = transition\n\tif (type === false) return \"instant\"\n\tif (type === \"spring\" && transition.durationBasedSpring === true) return \"duration-based-spring\"\n\treturn type\n}\n\n/**\n * Consolidates all of the tracking for effects.\n *\n * The update is cast to the trait. This is safe because typescript does check\n * that calls to this function pass the trait check for the provided EffectType,\n * but can't determine that the update is of that type in the if blocks due to\n * extending the enum.\n */\nexport function trackEffectUpdate<T extends EffectType>(effect: T, update: Partial<Config[T][\"defaults\"]>): void {\n\tif (effect === EffectType.Appear) {\n\t\tconst values = update as Partial<WithStyleAppearEffect>\n\t\trecord(\"interactive_effect_style_appear_update\", {\n\t\t\texitEffectEnabled: values.exitEffectEnabled,\n\t\t\texitEffectOpacity: values.exitEffectOpacity,\n\t\t\texitEffectX: values.exitEffectX,\n\t\t\texitEffectY: values.exitEffectY,\n\t\t\texitEffectScale: values.exitEffectScale,\n\t\t\texitEffectRotate: values.exitEffectRotate,\n\t\t\texitEffectRotateX: values.exitEffectRotateX,\n\t\t\texitEffectRotateY: values.exitEffectRotateY,\n\t\t\texitEffectPerspective: values.exitEffectPerspective,\n\t\t\tenterEffectEnabled: values.enterEffectEnabled,\n\t\t\tenterEffectRotate: values.enterEffectRotate,\n\t\t\tenterEffectRotateX: values.enterEffectRotateX,\n\t\t\tenterEffectRotateY: values.enterEffectRotateY,\n\t\t\tenterEffectPerspective: values.enterEffectPerspective,\n\t\t\tstyleAppearEffectLocked: values.styleAppearEffectLocked,\n\t\t\tstyleAppearEffectEnabled: values.styleAppearEffectEnabled,\n\t\t\tstyleAppearEffectThreshold: values.styleAppearEffectThreshold,\n\t\t\tstyleAppearEffectAnimateOnce: values.styleAppearEffectAnimateOnce,\n\t\t\tstyleAppearEffectTrigger: convertTriggerToStringForTracking(values.styleAppearEffectTrigger),\n\t\t\tstyleAppearEffectOpacity: values.enterEffectOpacity,\n\t\t\tstyleAppearEffectX: values.enterEffectX,\n\t\t\tstyleAppearEffectY: values.enterEffectY,\n\t\t\tstyleAppearEffectScale: values.enterEffectScale,\n\t\t\t// We can't track the transition prop as an object, so we only send the\n\t\t\t// type, because the transition props don't provide much value anyway\n\t\t\tstyleAppearEffectTransition: transitionLabelForTracking(values.enterEffectTransition),\n\t\t\texitEffectTransition: transitionLabelForTracking(values.exitEffectTransition),\n\t\t})\n\t} else if (effect === EffectType.Parallax) {\n\t\tconst values = update as Partial<WithParallax>\n\t\trecord(\"interactive_effect_parallax_update\", {\n\t\t\tparallaxEnabled: values.parallaxEnabled,\n\t\t\tparallaxSpeed: values.parallaxSpeed,\n\t\t\tparallaxAdjustPosition: values.parallaxAdjustPosition,\n\t\t\tparallaxOffset: values.parallaxOffset,\n\t\t})\n\t} else if (effect === EffectType.SetVariant) {\n\t\tconst values = update as Partial<WithVariantAppearEffect>\n\t\trecord(\"interactive_effect_variant_appear_update\", {\n\t\t\tappearEffectEnabled: values.appearEffectEnabled,\n\t\t\tappearEffectVisibleVariantId: values.appearEffectVisibleVariantId,\n\t\t\tappearEffectObscuredVariantId: values.appearEffectObscuredVariantId,\n\t\t\tappearEffectThreshold: values.appearEffectThreshold,\n\t\t\tappearEffectAnimateOnce: values.appearEffectAnimateOnce,\n\t\t})\n\t} else if (effect === EffectType.StyleTransform) {\n\t\tconst values = update as Partial<WithStyleTransformEffect>\n\t\trecord(\"interactive_effect_transform_update\", {\n\t\t\tstyleTransformEffectEnabled: values.styleTransformEffectEnabled,\n\t\t\tstyleTransformEffectViewportThreshold: values.styleTransformEffectViewportThreshold,\n\t\t\tstyleTransformEffectTransitionEnabled: values.styleTransformEffectTransitionEnabled,\n\t\t\tstyleTransformEffectScrollTargetCount: values.styleTransformEffectScrollTargets?.length ?? 0,\n\t\t\tstyleTransformEffectTrigger: convertTriggerToStringForTracking(values.styleTransformEffectTrigger),\n\t\t})\n\t} else if (effect === EffectType.Drag) {\n\t\tconst values = update as Partial<WithDragEffect>\n\t\trecord(\"interactive_effect_drag_update\", {\n\t\t\tdragEffectEnabled: values.dragEffectEnabled,\n\t\t\tdragEffectFreeform: values.dragEffectFreeform,\n\t\t\tdragEffectMomentum: values.dragEffectMomentum,\n\t\t\tdragEffectSnapBack: values.dragEffectSnapBack,\n\t\t\tdragEffectConstraintElement: !!values?.dragEffectConstraintElement,\n\t\t})\n\t} else if (effect === EffectType.Loop) {\n\t\tconst values = update as Partial<WithLoopEffect>\n\t\trecord(\"interactive_effect_loop_update\", {\n\t\t\tloopEffectEnabled: values.loopEffectEnabled,\n\t\t\tloopEffectRepeatType: values.loopEffectRepeatType,\n\t\t\tloopEffectRepeatDelay: values.loopEffectRepeatDelay,\n\t\t\tloopEffectOpacity: values.loopEffectOpacity,\n\t\t\tloopEffectX: values.loopEffectX,\n\t\t\tloopEffectY: values.loopEffectY,\n\t\t\tloopEffectScale: values.loopEffectScale,\n\t\t\tloopEffectRotate3d: values.loopEffectEnabled,\n\t\t\tloopEffectRotate: values.loopEffectRotate,\n\t\t\tloopEffectRotateX: values.loopEffectRotateX,\n\t\t\tloopEffectRotateY: values.loopEffectRotateY,\n\t\t\tloopEffectTransition: transitionLabelForTracking(values.loopEffectTransition),\n\t\t\tloopEffectPauseOffscreen: values.loopEffectPauseOffscreen,\n\t\t})\n\t} else if (effect === EffectType.Flow) {\n\t\tconst values = update as Partial<WithFlowEffect>\n\t\trecord(\"interactive_effect_layout_group_update\", {\n\t\t\tflowEffectEnabled: values.flowEffectEnabled,\n\t\t\tflowEffectTransition: transitionLabelForTracking(values.flowEffectTransition),\n\t\t})\n\t} else if (effect === EffectType.Hover) {\n\t\tconst values = update as Partial<WithWhileHover>\n\t\trecord(\"interactive_effect_hover_update\", {\n\t\t\twhileHoverEnabled: values.whileHoverEnabled,\n\t\t\twhileHoverOpacity: values.whileHoverOpacity,\n\t\t\twhileHoverX: values.whileHoverX,\n\t\t\twhileHoverY: values.whileHoverY,\n\t\t\twhileHoverScale: values.whileHoverScale,\n\t\t\twhileHoverRotate3d: values.whileHoverRotate3d,\n\t\t\twhileHoverRotate: values.whileHoverRotate,\n\t\t\twhileHoverRotateX: values.whileHoverRotateX,\n\t\t\twhileHoverRotateY: values.whileHoverRotateY,\n\t\t\twhileHoverBackgroundColor: values.whileHoverBackgroundColor,\n\t\t\twhileHoverBoxShadow: !!values.whileHoverBoxShadow,\n\t\t\twhileHoverTransition: transitionLabelForTracking(values.whileHoverTransition),\n\t\t})\n\t} else if (effect === EffectType.Tap) {\n\t\tconst values = update as Partial<WithWhileTap>\n\t\trecord(\"interactive_effect_tap_update\", {\n\t\t\twhileTapEnabled: values.whileTapEnabled,\n\t\t\twhileTapOpacity: values.whileTapOpacity,\n\t\t\twhileTapX: values.whileTapX,\n\t\t\twhileTapY: values.whileTapY,\n\t\t\twhileTapScale: values.whileTapScale,\n\t\t\twhileTapRotate3d: values.whileTapRotate3d,\n\t\t\twhileTapRotate: values.whileTapRotate,\n\t\t\twhileTapRotateX: values.whileTapRotateX,\n\t\t\twhileTapRotateY: values.whileTapRotateY,\n\t\t\twhileTapBackgroundColor: values.whileTapBackgroundColor,\n\t\t\twhileTapBoxShadow: !!values.whileTapBoxShadow,\n\t\t\twhileTapTransition: transitionLabelForTracking(values.whileTapTransition),\n\t\t})\n\t} else if (effect === EffectType.Text) {\n\t\tconst values = update as Partial<WithTextEffect>\n\t\trecord(\"interactive_effect_text_update\", {\n\t\t\ttextEffectEnabled: values.textEffectEnabled,\n\t\t\ttextEffectType: values.textEffectType,\n\t\t\ttextEffectTokenization: values.textEffectTokenization,\n\t\t\ttextEffectTrigger: convertTriggerToStringForTracking(values.textEffectTrigger),\n\t\t\ttextEffectThreshold: values.textEffectThreshold,\n\t\t\ttextEffectOpacity: values.textEffectOpacity,\n\t\t\ttextEffectX: values.textEffectX,\n\t\t\ttextEffectY: values.textEffectY,\n\t\t\ttextEffectScale: values.textEffectScale,\n\t\t\ttextEffectRotate3d: values.textEffectRotate3d,\n\t\t\ttextEffectRotate: values.textEffectRotate,\n\t\t\ttextEffectRotateX: values.textEffectRotateX,\n\t\t\ttextEffectRotateY: values.textEffectRotateY,\n\t\t\ttextEffectSkewX: values.textEffectSkewX,\n\t\t\ttextEffectSkewY: values.textEffectSkewY,\n\t\t\ttextEffectBlur: values.textEffectBlur,\n\t\t\ttextEffectTransition: transitionLabelForTracking(values.textEffectTransition),\n\t\t\ttextEffectReplay: values.textEffectReplay,\n\t\t})\n\t} else if (effect === EffectType.Stroke) {\n\t\tconst values = update as Partial<WithStrokeEffect>\n\t\trecord(\"interactive_effect_stroke_update\", {\n\t\t\tstrokeEffectEnabled: values.strokeEffectEnabled,\n\t\t\tstrokeEffectLength: values.strokeEffectLength,\n\t\t\tstrokeEffectGap: values.strokeEffectGap,\n\t\t\tstrokeEffectOffset: values.strokeEffectOffset,\n\t\t\tstrokeEffectLoop: values.strokeEffectLoop,\n\t\t\tstrokeEffectLoopType: values.strokeEffectLoopType,\n\t\t\tstrokeEffectTransition: transitionLabelForTracking(values.strokeEffectTransition),\n\t\t})\n\t} else if (effect === EffectType.Lightbox) {\n\t\tconst values = update as Partial<WithLightboxEffect>\n\t\trecord(\"interactive_effect_lightbox_update\", {\n\t\t\tlightboxEffectEnabled: values.lightboxEffectEnabled,\n\t\t\tlightboxEffectPadding: values.lightboxEffectPadding,\n\t\t\tlightboxEffectPaddingPerSide: values.lightboxEffectPaddingPerSide,\n\t\t\tlightboxEffectPaddingTop: values.lightboxEffectPaddingTop,\n\t\t\tlightboxEffectPaddingRight: values.lightboxEffectPaddingRight,\n\t\t\tlightboxEffectPaddingBottom: values.lightboxEffectPaddingBottom,\n\t\t\tlightboxEffectPaddingLeft: values.lightboxEffectPaddingLeft,\n\t\t\tlightboxEffectMaxWidth: values.lightboxEffectMaxWidth,\n\t\t\tlightboxEffectZIndex: values.lightboxEffectZIndex,\n\t\t\t// We can't track dynamic values. We could track a string like \"dynamic-value\" but we\n\t\t\t// haven't done that before.\n\t\t\tlightboxEffectBackdrop: !isDynamicValue(values.lightboxEffectBackdrop)\n\t\t\t\t? values.lightboxEffectBackdrop\n\t\t\t\t: undefined,\n\t\t\tlightboxEffectTransition: transitionLabelForTracking(values.lightboxEffectTransition),\n\t\t})\n\t} else if (effect === EffectType.Ticker) {\n\t\tconst values = update as Partial<WithTickerEffect>\n\t\trecord(\"interactive_effect_ticker_update\", {\n\t\t\ttickerEffectEnabled: values.tickerEffectEnabled,\n\t\t\ttickerEffectVelocity: !isDynamicValue(values.tickerEffectVelocity) ? values.tickerEffectVelocity : undefined,\n\t\t\ttickerEffectHoverModifier: !isDynamicValue(values.tickerEffectHoverModifier)\n\t\t\t\t? values.tickerEffectHoverModifier\n\t\t\t\t: undefined,\n\t\t\ttickerEffectDirectionModifier: !isDynamicValue(values.tickerEffectDirectionModifier)\n\t\t\t\t? values.tickerEffectDirectionModifier === \"reverse\"\n\t\t\t\t\t? -1\n\t\t\t\t\t: 1\n\t\t\t\t: undefined,\n\t\t})\n\t} else {\n\t\tassertNever(effect)\n\t}\n}\n\nexport const createCopyEffectHandler =\n\t(\n\t\t/**\n\t\t * Provide all reduced effect values for the current selection. When\n\t\t * copying a specific effect, all valid values for that specific effect\n\t\t * will be extracted from these values.\n\t\t */\n\t\tvalues: Partial<AllReducedEffects>,\n\t\tonCopy: (effects: Partial<AllEffects>) => void,\n\t) =>\n\t<T extends EffectType>(effect: T, overrides: Partial<(typeof effectConfig)[T][\"defaults\"]>) => {\n\t\treturn engine.scheduler.wrapHandler(() => {\n\t\t\tconst { getEffectForCopy } = effectConfig[effect]\n\n\t\t\tconst effectForClipboard = getEffectForCopy(values)\n\n\t\t\tObject.assign(effectForClipboard, overrides)\n\n\t\t\tonCopy(effectForClipboard)\n\t\t})\n\t}\n\nexport const createCanPasteEffectHandler = (selection: NodeID[]) => {\n\treturn (effect: EffectType) => {\n\t\treturn async () => {\n\t\t\tif (!isClipboardSupported()) return false\n\t\t\t// In Safari we cannot access the clipboard on right-click, that's why we assume the\n\t\t\t// happy flow here, and enable pasting even if we cannot read the clipboard.\n\t\t\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\t\t\tconst { withEffect, recordHasEffect } = effectConfig[effect]\n\t\t\tconst values = await clipboardReadType(\"application/x-framer-effects\")\n\t\t\tif (!isObject(values) || !recordHasEffect(values)) return false\n\t\t\treturn selection.every(nodeId => {\n\t\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\t\tif (node) return withEffect(node)\n\t\t\t})\n\t\t}\n\t}\n}\n\nexport const createPasteEffectHandler = (selection: NodeID[]) => {\n\t// Returns a void function that can be called by when a context menu is\n\t// presented to inform whether or not the paste menu item is enabled.\n\treturn (effect: EffectType) => {\n\t\treturn async () => {\n\t\t\tconst values = await clipboardReadType(\"application/x-framer-effects\")\n\t\t\tif (!isObject(values)) return\n\t\t\tconst { defaults, enabledDefaults, withEffect, recordHasEffect } = effectConfig[effect]\n\t\t\tif (!recordHasEffect(values)) return\n\t\t\tconst effectCopy: Partial<AllEffects> = { ...enabledDefaults }\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(selection, withEffect)) {\n\t\t\t\t\tfor (const key in defaults) {\n\t\t\t\t\t\teffectCopy[key] = values[key]\n\t\t\t\t\t}\n\n\t\t\t\t\tnode.set(values)\n\t\t\t\t\ttrackEffectUpdate(effect, values)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t}\n}\n\nexport const enableEffect = engine.scheduler.wrapHandler(\n\t<T extends EffectType>(effect: T, ids: NodeID[], overrides?: Partial<(typeof effectConfig)[T][\"defaults\"]>) => {\n\t\tconst { defaults, enabledDefaults, withEffect } = effectConfig[effect]\n\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(ids, withEffect)) {\n\t\t\tconst update = { ...defaults }\n\n\t\t\tfor (const key in enabledDefaults) {\n\t\t\t\tupdate[key] = node[key] ?? enabledDefaults[key]\n\t\t\t}\n\n\t\t\tconst values = { ...update, ...overrides }\n\t\t\tnode.set(values)\n\t\t\ttrackEffectUpdate(effect, values)\n\t\t}\n\t},\n)\n\nexport function useRemoveEffect(effect: EffectType, ids: NodeID[]) {\n\treturn useEngineCallback(() => {\n\t\tconst { defaults, withEffect } = effectConfig[effect]\n\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(ids, withEffect)) {\n\t\t\tnode.set({ ...defaults })\n\t\t\ttrackEffectUpdate(effect, defaults)\n\t\t}\n\t}, [ids, effect])\n}\n\n// This is called by `onDismiss` of a popout window both after an event handler\n// _and_ when react unmounts the component. Which is why we can't use\n// engine.scheduler.wrapHandler, but use engine.processWhenReady here\nexport const exitEffectPreview = () => {\n\tengine.scheduler.processWhenReady(() => engine.stores.effectStore.exitPreview())\n}\n\n/**\n * Ensure that the effect preview is disabled if the entire popover is unmounted\n * without navigating away from the Effect Popout. This can happen if the\n * selection changes.\n */\nexport function useExitEffectPreviewOnUnmount() {\n\tReact.useEffect(() => {\n\t\tconst { effectStore } = engine.stores\n\t\treturn () => {\n\t\t\tif (!effectStore.activeEffect) return\n\t\t\tengine.scheduler.runBeforeNextFrame(() => effectStore.exitPreview())\n\t\t}\n\t}, [])\n}\n\nexport function enableFlowEffect(ids: NodeID[]) {\n\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & WithFlowEffect>(ids, withFlowEffect)) {\n\t\tconst isNestedFlowEffect = isNodeInFlowEffect(node)\n\t\tconst transition = isNestedFlowEffect ? undefined : defaultDurationBasedSpringTransition\n\t\tenableEffect(EffectType.Flow, [node.id], { flowEffectEnabled: true, flowEffectTransition: transition })\n\t}\n}\n", "export const rotate3dLabels: [string, string, string] = [\"X\", \"Y\", \"Z\"]\n\n/**\n * Used for rotation values that should be capped between -360000 and 360000 degrees.\n * While rotation technically supports unlimited values, extremely large numbers\n * can lead to precision/rendering issues. These bounds provide a \"semi-unlimited\"\n * feel while preventing potential bugs.\n */\nexport const ROTATE_MIN_VALUE = -360000\nexport const ROTATE_MAX_VALUE = 360000\n", "import { PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { PageEffect, PageTransition, WipeMask } from \"library/router/pageEffects/types.ts\"\nimport type React from \"react\"\nimport { useMemo } from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\nconst CUSTOM_TITLE = \"Custom\"\n\ninterface PresetOption {\n\tlabel: string\n\tpreset: PageEffect\n}\n\ninterface PresetSection {\n\tlabel: string\n\toptions: {\n\t\t[key: string]: PresetOption\n\t}\n}\n\nexport const defaultPageTransition: PageTransition = {\n\tx: \"0px\",\n\ty: \"0px\",\n\tscale: 1,\n\topacity: 1,\n\trotate3d: false,\n\trotate: 0,\n\trotateX: 0,\n\trotateY: 0,\n\tmask: undefined,\n\ttransition: {\n\t\ttype: \"tween\",\n\t\tdelay: 0,\n\t\tduration: 0.2,\n\t\tease: [0.27, 0, 0.51, 1],\n\t\tstiffness: 400,\n\t\tdamping: 30,\n\t\tmass: 1,\n\t},\n}\n\nconst pushTransition = { ...defaultPageTransition.transition, duration: 0.4 }\n\nconst wipeMask = (angle: number): WipeMask => ({\n\ttype: \"wipe\",\n\tangle,\n\twidth: \"100%\",\n})\n\nconst optionKey: keyof PresetOption = \"preset\"\nfunction isPresetOption(item: PresetOption | PresetSection): item is PresetOption {\n\treturn optionKey in item\n}\n\n/**\n * We're currently displaying all presets in a flat native menu but this structure\n * will allow us to easily move over to a nested Menu in a later PR.\n */\nexport const pageEffectPresets = Object.freeze({\n\tcrossfade: {\n\t\tlabel: \"Crossfade\",\n\t\tpreset: { enter: { ...defaultPageTransition, opacity: 0 } },\n\t},\n\tfadeOutIn: {\n\t\tlabel: \"Fade Out & In\",\n\t\tpreset: {\n\t\t\texit: {\n\t\t\t\t...defaultPageTransition,\n\t\t\t\topacity: 0,\n\t\t\t\ttransition: { ...defaultPageTransition.transition, delay: defaultPageTransition.transition.duration },\n\t\t\t},\n\t\t\tenter: { ...defaultPageTransition, opacity: 0 },\n\t\t},\n\t},\n\tslide: {\n\t\tlabel: \"Slide\",\n\t\toptions: {\n\t\t\tleft: {\n\t\t\t\tlabel: \"Left\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, x: \"100px\" } },\n\t\t\t},\n\t\t\tup: {\n\t\t\t\tlabel: \"Up\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, y: \"100px\" } },\n\t\t\t},\n\t\t\tright: {\n\t\t\t\tlabel: \"Right\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, x: \"-100px\" } },\n\t\t\t},\n\t\t\tdown: {\n\t\t\t\tlabel: \"Down\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, y: \"-100px\" } },\n\t\t\t},\n\t\t},\n\t},\n\tpush: {\n\t\tlabel: \"Push\",\n\t\toptions: {\n\t\t\tleft: {\n\t\t\t\tlabel: \"Left\",\n\t\t\t\tpreset: {\n\t\t\t\t\texit: { ...defaultPageTransition, x: \"-100%\", transition: pushTransition },\n\t\t\t\t\tenter: { ...defaultPageTransition, x: \"100%\", transition: pushTransition },\n\t\t\t\t},\n\t\t\t},\n\t\t\tup: {\n\t\t\t\tlabel: \"Up\",\n\t\t\t\tpreset: {\n\t\t\t\t\texit: { ...defaultPageTransition, y: \"-100%\", transition: pushTransition },\n\t\t\t\t\tenter: { ...defaultPageTransition, y: \"100%\", transition: pushTransition },\n\t\t\t\t},\n\t\t\t},\n\t\t\tright: {\n\t\t\t\tlabel: \"Right\",\n\t\t\t\tpreset: {\n\t\t\t\t\texit: { ...defaultPageTransition, x: \"100%\", transition: pushTransition },\n\t\t\t\t\tenter: { ...defaultPageTransition, x: \"-100%\", transition: pushTransition },\n\t\t\t\t},\n\t\t\t},\n\t\t\tdown: {\n\t\t\t\tlabel: \"Down\",\n\t\t\t\tpreset: {\n\t\t\t\t\texit: { ...defaultPageTransition, y: \"100%\" },\n\t\t\t\t\tenter: { ...defaultPageTransition, y: \"-100%\" },\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\twipe: {\n\t\tlabel: \"Wipe\",\n\t\toptions: {\n\t\t\tleft: {\n\t\t\t\tlabel: \"Left\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, mask: wipeMask(180), transition: pushTransition } },\n\t\t\t},\n\t\t\tup: {\n\t\t\t\tlabel: \"Up\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, mask: wipeMask(270), transition: pushTransition } },\n\t\t\t},\n\t\t\tright: {\n\t\t\t\tlabel: \"Right\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, mask: wipeMask(0), transition: pushTransition } },\n\t\t\t},\n\t\t\tdown: {\n\t\t\t\tlabel: \"Down\",\n\t\t\t\tpreset: { enter: { ...defaultPageTransition, mask: wipeMask(90), transition: pushTransition } },\n\t\t\t},\n\t\t},\n\t},\n})\n\ninterface Props {\n\teffect: PageEffect\n\tonSelect: (effect: PageEffect) => void\n}\n\nconst presetsAsStrings: { [key: string]: string } = {}\nfor (const key in pageEffectPresets) {\n\tconst option = pageEffectPresets[key]\n\tif (isPresetOption(option)) {\n\t\tpresetsAsStrings[key] = JSON.stringify(option.preset)\n\t} else {\n\t\tfor (const subkey in option.options) {\n\t\t\tpresetsAsStrings[key + subkey] = JSON.stringify(option.options[subkey].preset)\n\t\t}\n\t}\n}\n\ninterface PresetOptionsMetadata {\n\tdisplayTitle: string\n\toptions: React.ReactNode[]\n}\n\nconst buildPresetOptions =\n\t(effectAsString: string, onSelect: Props[\"onSelect\"], submenuKey = \"\") =>\n\t(metadata: PresetOptionsMetadata, key: string): PresetOptionsMetadata => {\n\t\tconst section = pageEffectPresets[submenuKey]\n\t\tconst option = section && !isPresetOption(section) ? section.options[key] : pageEffectPresets[key]\n\n\t\tif (isPresetOption(option)) {\n\t\t\tconst isSelected = effectAsString === presetsAsStrings[submenuKey + key]\n\t\t\tconst displayTitle = submenuKey ? `${pageEffectPresets[submenuKey].label} ${option.label}` : option.label\n\n\t\t\tif (isSelected) {\n\t\t\t\tmetadata.displayTitle = displayTitle\n\t\t\t}\n\n\t\t\tmetadata.options.push(\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\tkey={submenuKey + key}\n\t\t\t\t\tidentifier={submenuKey + key}\n\t\t\t\t\ttitle={displayTitle}\n\t\t\t\t\tselected={isSelected}\n\t\t\t\t\tonSelect={() => onSelect(option.preset)}\n\t\t\t\t/>,\n\t\t\t)\n\t\t} else {\n\t\t\tconst { displayTitle, options } = Object.keys(option.options).reduce(\n\t\t\t\tbuildPresetOptions(effectAsString, onSelect, key),\n\t\t\t\t{ displayTitle: CUSTOM_TITLE, options: [] },\n\t\t\t)\n\n\t\t\tif (displayTitle !== CUSTOM_TITLE) {\n\t\t\t\tmetadata.displayTitle = displayTitle\n\t\t\t}\n\n\t\t\tmetadata.options.push(...options)\n\t\t}\n\n\t\treturn metadata\n\t}\n\nfunction useBuildOptions(effectAsString: string, onSelect: Props[\"onSelect\"]) {\n\treturn useMemo(() => {\n\t\treturn Object.keys(pageEffectPresets).reduce(buildPresetOptions(effectAsString, onSelect), {\n\t\t\tdisplayTitle: CUSTOM_TITLE,\n\t\t\toptions: [],\n\t\t})\n\t}, [effectAsString, onSelect])\n}\n\nexport function PageEffectPreset({ effect, onSelect }: Props) {\n\tconst { displayTitle, options } = useBuildOptions(JSON.stringify(effect), onSelect)\n\tconst isCustomEffect = displayTitle === CUSTOM_TITLE\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Preset\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButtonDisplayTitle displayTitle={displayTitle}>\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t{options}\n\t\t\t\t\t\t\t<PopupButtonItem type=\"divider\" visible={isCustomEffect} />\n\t\t\t\t\t\t\t<PopupButtonItem title=\"Custom\" selected visible={isCustomEffect} />\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t</PopupButtonDisplayTitle>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n", "import type { ComboBoxListItem, ComboBoxListItemSection } from \"@framerjs/fresco\"\nimport { ComboBox } from \"@framerjs/fresco\"\nimport { usePageComboBoxListItems } from \"document/components/utils/usePageComboBoxListItems.ts\"\nimport { getTitleForWebPageId } from \"document/components/utils/webPageTitles.ts\"\nimport engine from \"document/engine.ts\"\nimport { DEFAULT_PAGE_EFFECT_TOKEN } from \"document/models/CanvasTree/traits/WithPageEffects.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props {\n\trouteId: string\n\tavailableRouteIds: string[]\n\tonSelect: (routeId: string) => void\n\tcanAddGlobalPageEffect: boolean\n}\n\nconst globalDefaultLabel = \"All Pages\"\n\nconst globalDefaultItem: ComboBoxListItem = {\n\ttype: \"option\",\n\ttitle: globalDefaultLabel,\n\tvalue: DEFAULT_PAGE_EFFECT_TOKEN,\n}\n\nexport function getPageEffectRouteLabel(routeId: string) {\n\treturn routeId === DEFAULT_PAGE_EFFECT_TOKEN\n\t\t? globalDefaultLabel\n\t\t: getTitleForWebPageId(engine.tree, engine.componentLoader, routeId)\n}\n\nfunction filterAvailableRoutes(\n\titems: readonly ComboBoxListItem[],\n\tavailableRouteIds: string[],\n\taddGlobalPageEffect?: boolean,\n) {\n\tconst filtered: ComboBoxListItem[] = addGlobalPageEffect ? [globalDefaultItem] : []\n\tfor (const item of items) {\n\t\tif (item.type === \"section\") {\n\t\t\tconst sectionItems = filterAvailableRoutes(item.items, availableRouteIds)\n\t\t\tif (sectionItems.length) {\n\t\t\t\tfiltered.push({ ...item, items: sectionItems } as ComboBoxListItemSection)\n\t\t\t}\n\t\t} else if (availableRouteIds.indexOf(item.value) !== -1) {\n\t\t\tfiltered.push(item)\n\t\t}\n\t}\n\n\treturn filtered\n}\n\nfunction usePageEffectRoutes(availableRouteIds: string[], canAddGlobalPageEffect: boolean) {\n\tconst items = usePageComboBoxListItems({ includeDesignPages: false, includeKitPages: false })\n\tconst filteredItems = filterAvailableRoutes(items, availableRouteIds, canAddGlobalPageEffect)\n\n\treturn filteredItems\n}\n\nexport function PageEffectRouteSelector({ routeId, availableRouteIds, onSelect, canAddGlobalPageEffect }: Props) {\n\tconst items = usePageEffectRoutes([routeId, ...availableRouteIds], canAddGlobalPageEffect)\n\n\treturn (\n\t\t<PanelRow title=\"Target\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<ComboBox rightChevron items={items} value={getPageEffectRouteLabel(routeId)} onChange={onSelect} />\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import { EmptyState, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { EngineChangeFlag } from \"document/EngineChanges.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { copyCSSForNodeEnabled } from \"document/models/CanvasTree/traits/utils/styleForNode.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport React from \"react\"\nimport { CodeExportPanel } from \"./CodeExportPanel.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport type { CSSExportType, SVGExportType, TransitionExportType } from \"./types.ts\"\nimport { CodeType } from \"./types.ts\"\n\ninterface ContainerProps {\n\treadonly nodes: CanvasNode[]\n\treadonly isViewOnly: boolean\n}\n\ninterface ContainerState {\n\treadonly showAllProps: boolean\n\treadonly selectedCSSType: CSSExportType\n\treadonly selectedSVGType: SVGExportType\n\treadonly selectedTransitionType: TransitionExportType | undefined\n\treadonly activeBundleHash: string\n\treadonly loadedExternalModules: Set<string>\n}\n\nclass CodeExportPanelContainer extends React.PureComponent<ContainerProps, ContainerState> {\n\tstatic engineChangeKeys: EngineChangeFlag[] = [\n\t\tEngineChange.UserDefaultsStore,\n\t\tEngineChange.ActiveBundle,\n\t\tengine.stores.loadedExternalModulesStore,\n\t\tengine.stores.codeEditorStore,\n\t]\n\n\tstatic calculateState(): ContainerState {\n\t\tconst { persistedUserDefaults, componentsStore, loadedExternalModulesStore } = engine.stores\n\t\treturn {\n\t\t\tshowAllProps: persistedUserDefaults.exportShowAllProps,\n\t\t\tselectedCSSType: persistedUserDefaults.exportCSSType,\n\t\t\tselectedSVGType: persistedUserDefaults.exportSVGType,\n\t\t\tselectedTransitionType: persistedUserDefaults.exportTransitionType,\n\t\t\t// We need to update the components definition in getCodeComponentNodeInfo\n\t\t\tactiveBundleHash: componentsStore.activeBundleHash,\n\t\t\tloadedExternalModules: loadedExternalModulesStore.loadedExternalModules,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst { nodes, isViewOnly } = this.props\n\t\tif (!nodes || nodes.length === 0) return null\n\t\t// If selection contains both vectors and frames, prioritize CSS code\n\t\tconst cssNodes: CanvasNode[] = []\n\t\tconst svgNodes: CanvasNode[] = []\n\t\tconst codeComponentNodes: CodeComponentNode[] = []\n\n\t\tnodes.forEach(node => {\n\t\t\tif (isCodeComponentNode(node) && !node.codeComponentIdentifier.startsWith(\"framer/\")) {\n\t\t\t\tcodeComponentNodes.push(node)\n\t\t\t}\n\t\t\t// checking SVG first for graphic containers\n\t\t\telse if (isExportableAsSVG(node)) {\n\t\t\t\tsvgNodes.push(node)\n\t\t\t} else if (copyCSSForNodeEnabled(node)) {\n\t\t\t\tcssNodes.push(node)\n\t\t\t}\n\t\t})\n\n\t\tlet type = CodeType.CSS\n\t\tlet filteredNodes: CanvasNode[] = cssNodes\n\t\tif (codeComponentNodes.length > 0) {\n\t\t\ttype = CodeType.Code\n\t\t\tfilteredNodes = codeComponentNodes\n\t\t} else if (cssNodes.length === 0 && svgNodes.length > 0) {\n\t\t\ttype = CodeType.SVG\n\t\t\tfilteredNodes = svgNodes\n\t\t}\n\n\t\tif (filteredNodes.length > 10) {\n\t\t\t// Rendering too many nodes in this panel can significantly slow down Framer.\n\t\t\treturn (\n\t\t\t\t<Panel testId=\"codeexportpanel\" header={<PanelSectionHeader title={<T>{Dictionary.Handoff}</T>} />}>\n\t\t\t\t\t<EmptyState leftAlign body={<T>Select fewer layers to use {Dictionary.Handoff}.</T>} />\n\t\t\t\t</Panel>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t<CodeExportPanel\n\t\t\t\tnodes={filteredNodes}\n\t\t\t\tcodeType={type}\n\t\t\t\tshowAllProps={this.state.showAllProps}\n\t\t\t\tselectedCSSType={this.state.selectedCSSType}\n\t\t\t\tselectedSVGType={this.state.selectedSVGType}\n\t\t\t\tselectedTransitionType={this.state.selectedTransitionType}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t/>\n\t\t)\n\t}\n}\n\nconst container = createContainer(CodeExportPanelContainer)\nexport { container as CodeExportPanel }\n", "/* eslint-disable jsx-a11y/no-noninteractive-tabindex */\nimport type { ComponentLoader, EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { isNavigationAnimationHidden } from \"@framerjs/framer-runtime\"\nimport { Button, CopyButton, DropdownButton, Scroll, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport {\n\tassert,\n\tModuleType,\n\tassertNever,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { MetricsViewContext } from \"app/metrics.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { isPartialTransition, toVekterTransition } from \"document/models/Transition.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport type { Spring, Tween } from \"framer-motion\"\nimport { motion, useMotionValue } from \"framer-motion\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getModuleImportStatement } from \"modules/utils.ts\"\nimport React from \"react\"\nimport { clearSelectionInsideElement } from \"utils/clearSelectionIfInsideElement.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { eventsForNode } from \"../utils/eventActions.ts\"\nimport { CSSCode } from \"./CSSCode.tsx\"\nimport * as styles from \"./CodeExportPanel.styles.ts\"\nimport { CodeExportPanelEmptyState, CodeExportPanelEmptyStateType } from \"./CodeExportPanelEmptyState.tsx\"\nimport { ComponentCode } from \"./ComponentCode.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { SVGCode } from \"./SVGCode.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { CSSExportType, CodeType, SVGExportType, Syntax, TransitionExportType } from \"./types.ts\"\n\nconst cssExportTypes = [CSSExportType.CSS, CSSExportType.JSX]\nconst svgExportTypes = [SVGExportType.SVG, SVGExportType.JSX]\nconst transitionExportTypes = [TransitionExportType.Motion, TransitionExportType.Swift]\n\ninterface TransitionExportItem {\n\treadonly label: string\n\treadonly value: Transition\n}\n\ninterface Props {\n\treadonly nodes: CanvasNode[]\n\treadonly codeType: CodeType\n\treadonly showAllProps: boolean\n\treadonly selectedCSSType: CSSExportType\n\treadonly selectedSVGType: SVGExportType\n\treadonly selectedTransitionType: TransitionExportType | undefined\n\treadonly isViewOnly: boolean\n}\n\nexport function CodeExportPanel({\n\tnodes,\n\tcodeType,\n\tshowAllProps,\n\tselectedCSSType,\n\tselectedSVGType,\n\tselectedTransitionType,\n\tisViewOnly,\n}: Props) {\n\tconst nodesHash = React.useMemo(() => nodes.map(node => node.id).join(\"\"), [nodes])\n\tconst codeContainerRef = React.useRef<HTMLDivElement>(null)\n\tconst metricsView = React.useContext(MetricsViewContext)\n\tconst fadeOutOpacity = useMotionValue(1)\n\tconst [code, setCode] = React.useState<string | null>(null)\n\tconst [isPanelOpen, setPanelOpen] = React.useState(isViewOnly)\n\n\tfunction togglePanelOpen() {\n\t\tsetPanelOpen(!isPanelOpen)\n\t}\n\n\tconst handleScroll = React.useCallback(\n\t\t(event: React.UIEvent<HTMLDivElement>) => {\n\t\t\tconst target = event.currentTarget\n\t\t\tconst scrollX = target.scrollLeft\n\t\t\tconst scrollLength = target.scrollWidth - target.clientWidth\n\t\t\tconst percentage = (scrollLength - scrollX) / scrollLength\n\t\t\tlet opacity = percentage\n\t\t\tif (opacity > 1) {\n\t\t\t\topacity = 1\n\t\t\t} else if (opacity < 0) {\n\t\t\t\topacity = 0\n\t\t\t}\n\t\t\tfadeOutOpacity.set(opacity)\n\t\t},\n\t\t[fadeOutOpacity],\n\t)\n\n\t// This effect shouldn't have type nor code as dependencies. If you switch\n\t// from one svg to another, the scroll position won't change and the copy\n\t// button is not reset properly. There is no risk for an infinite loop\n\t// because we check if renderedCode is equal to code before setting it\n\tReact.useEffect(() => {\n\t\tif (codeType === CodeType.Code) return\n\t\tconst renderedCode = getRenderedCodeInDiv(codeContainerRef)\n\t\tif (!renderedCode || code === renderedCode) return\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\tsetCode(renderedCode)\n\t\tif (codeContainerRef.current) codeContainerRef.current.scrollLeft = 0\n\t})\n\n\tReact.useEffect(() => {\n\t\t// Fix text selection issue on unmount\n\t\treturn fixTextSelectionCursor\n\t}, [])\n\n\tconst isCodeComponent = codeType === CodeType.Code\n\tconst isSVG = codeType === CodeType.SVG\n\tconst selectedCSSOrSVGType = isSVG ? selectedSVGType : selectedCSSType\n\n\tconst contentStyle: React.CSSProperties = {\n\t\twhiteSpace: isSVG ? \"pre\" : \"pre-wrap\",\n\t}\n\n\tconst horizontalFadeOut = isSVG ? <motion.div className={styles.fadeOut} style={{ opacity: fadeOutOpacity }} /> : null\n\n\tconst codeBlocks = nodes.map((node, idx) => {\n\t\tlet name = node.resolveValue(\"name\") || getDefaultName(engine.componentLoader, node)\n\t\tif (name && name.length > 20) {\n\t\t\tname = isTextNode(node) ? \"text\" : getDefaultName(engine.componentLoader, node)\n\t\t}\n\t\tif (isSVG) {\n\t\t\treturn (\n\t\t\t\t<SVGCode\n\t\t\t\t\tkey={`code-${node.id}-${idx}`}\n\t\t\t\t\tnode={node}\n\t\t\t\t\tname={name}\n\t\t\t\t\ttype={selectedSVGType}\n\t\t\t\t\tbreakline={idx < nodes.length - 1}\n\t\t\t\t/>\n\t\t\t)\n\t\t} else {\n\t\t\treturn (\n\t\t\t\t<CSSCode\n\t\t\t\t\tkey={`code-${node.id}-${idx}`}\n\t\t\t\t\tnode={node}\n\t\t\t\t\tname={name}\n\t\t\t\t\ttype={selectedCSSType}\n\t\t\t\t\tbreakline={idx < nodes.length - 1}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t})\n\n\tconst transitions = React.useMemo(() => {\n\t\tconst list: TransitionExportItem[] = []\n\n\t\tfor (const node of nodes) {\n\t\t\tconst nodeEvents = eventsForNode(engine.componentLoader, node)\n\n\t\t\tfor (const key in nodeEvents) {\n\t\t\t\tconst event = nodeEvents[key]\n\t\t\t\tassert(event, \"Key from for/in must have value in nodeEvents\")\n\t\t\t\tscrapeTransitionFromEvent(event, key, list)\n\t\t\t}\n\n\t\t\tif (isCodeComponentNode(node)) {\n\t\t\t\tconst controlProps = node.getRawControlProps()\n\t\t\t\tfor (const key in controlProps) {\n\t\t\t\t\tif (nodeEvents[key]) continue\n\n\t\t\t\t\tconst value = controlProps[key]?.value\n\t\t\t\t\tif (isPartialTransition(value)) {\n\t\t\t\t\t\tlist.push({\n\t\t\t\t\t\t\tlabel: `// ${key}`,\n\t\t\t\t\t\t\tvalue: toVekterTransition(value),\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\treturn list\n\t}, [nodes])\n\n\tconst hasTransitions = transitions.length > 0\n\n\tconst handleCopy = React.useCallback(() => {\n\t\tif (!codeContainerRef || !codeContainerRef.current) return\n\t\tconst text = codeContainerRef.current.textContent || codeContainerRef.current.innerText\n\n\t\tif (hasTransitions && selectedTransitionType) {\n\t\t\tClipboard.copyText(text).catch(unhandledError)\n\t\t} else if (codeType === CodeType.SVG) {\n\t\t\tClipboard.copySVG(text).catch(unhandledError)\n\t\t} else if (codeType === CodeType.CSS) {\n\t\t\tClipboard.copyCSS(text).catch(unhandledError)\n\t\t}\n\t}, [hasTransitions, selectedTransitionType, codeType])\n\n\tif (!nodes || nodes.length === 0) return null\n\n\tlet content: React.ReactElement | null = null\n\n\tif (hasTransitions && selectedTransitionType) {\n\t\tconst ExportComponent =\n\t\t\tselectedTransitionType === TransitionExportType.Motion ? MotionTransitions : SwiftTransitions\n\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t<div\n\t\t\t\t\tref={codeContainerRef}\n\t\t\t\t\t// biome-ignore lint/a11y/noNoninteractiveTabindex: Removing this will break copy/paste\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t\tclassName={cx(\"wantsNativeTextAction\", styles.contentWrapper, styles.syntaxHighlight)}\n\t\t\t\t>\n\t\t\t\t\t<ExportComponent transitions={transitions} />\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.transitionButtonContainer}>\n\t\t\t\t\t<CopyButton\n\t\t\t\t\t\tkey={`${nodesHash}-${selectedTransitionType}`}\n\t\t\t\t\t\ttitle=\"Copy Transition\"\n\t\t\t\t\t\tfullWidth\n\t\t\t\t\t\tonClick={handleCopy}\n\t\t\t\t\t\tdata-metric-id=\"handoff-copy-transition\"\n\t\t\t\t\t\tdata-metric-view={metricsView}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t)\n\t} else if (isCodeComponent) {\n\t\tcontent = renderCodeComponentHandoff({\n\t\t\tnodes,\n\t\t\tnodesHash,\n\t\t\tshowAllProps,\n\t\t\tsetCode,\n\t\t\tmetricsView,\n\t\t})\n\t} else {\n\t\tcontent = (\n\t\t\t<>\n\t\t\t\t<div className={cx(styles.contentWrapper)} style={contentStyle}>\n\t\t\t\t\t{/* wrap content so fadeout won't scroll with content */}\n\t\t\t\t\t<Scroll\n\t\t\t\t\t\tref={codeContainerRef}\n\t\t\t\t\t\tdirection=\"horizontal\"\n\t\t\t\t\t\ttabIndex={0} // @NOTE: do not remove tabIndex={0}, otherwise copy text won't work!\n\t\t\t\t\t\tid={handoffCodeId}\n\t\t\t\t\t\tclassName={cx(\"wantsNativeTextAction\", styles.syntaxHighlight)}\n\t\t\t\t\t\tonScroll={handleScroll}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isSVG && selectedSVGType === SVGExportType.JSX ? wrapContentWithImport(codeBlocks) : codeBlocks}\n\t\t\t\t\t</Scroll>\n\t\t\t\t\t{horizontalFadeOut}\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.buttonContainer}>\n\t\t\t\t\t<CopyButton\n\t\t\t\t\t\tkey={`${nodesHash}-${selectedCSSOrSVGType}`}\n\t\t\t\t\t\ttitle={`Copy ${selectedCSSOrSVGType}`}\n\t\t\t\t\t\tonClick={handleCopy}\n\t\t\t\t\t\tfullWidth\n\t\t\t\t\t\tdata-metric-id={`handoff-copy-${codeType}-${selectedCSSOrSVGType}`}\n\t\t\t\t\t\tdata-metric-view={metricsView}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t)\n\t}\n\n\tif (!content) return null\n\n\tconst dropdownLabel = getDropdownLabel({\n\t\tcodeType,\n\t\thasTransitions,\n\t\tshowAllProps,\n\t\tselectedCSSType,\n\t\tselectedSVGType,\n\t\tselectedTransitionType,\n\t})\n\n\tconst displayTypeDropdown = displayExportTypeDropdown({\n\t\tcodeType,\n\t\thasTransitions,\n\t\tshowAllProps,\n\t\tselectedCSSType,\n\t\tselectedSVGType,\n\t\tselectedTransitionType,\n\t\tmetricsView,\n\t})\n\n\treturn (\n\t\t<Panel\n\t\t\ttestId=\"codeexportpanel\"\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={\n\t\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={8}>\n\t\t\t\t\t\t\t<T>{Dictionary.Handoff}</T>\n\n\t\t\t\t\t\t\t{isPanelOpen ? <DropdownButton title={dropdownLabel} onMouseDown={displayTypeDropdown} /> : null}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t}\n\t\t\t\t\tclickable\n\t\t\t\t\tonClick={togglePanelOpen}\n\t\t\t\t>\n\t\t\t\t\t<PanelSectionHeaderButton onClick={togglePanelOpen}>\n\t\t\t\t\t\t{isPanelOpen ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{isPanelOpen ? content : null}\n\t\t</Panel>\n\t)\n}\n\ninterface GetDropdownLabelOptions {\n\treadonly codeType: CodeType\n\treadonly hasTransitions: boolean\n\treadonly showAllProps: boolean\n\treadonly selectedCSSType: CSSExportType\n\treadonly selectedSVGType: SVGExportType\n\treadonly selectedTransitionType: TransitionExportType | undefined\n}\n\nfunction getDropdownLabel({\n\tcodeType,\n\thasTransitions,\n\tshowAllProps,\n\tselectedCSSType,\n\tselectedSVGType,\n\tselectedTransitionType,\n}: GetDropdownLabelOptions) {\n\tif (hasTransitions && selectedTransitionType) {\n\t\treturn selectedTransitionType\n\t}\n\n\tswitch (codeType) {\n\t\tcase CodeType.CSS:\n\t\t\treturn selectedCSSType\n\n\t\tcase CodeType.SVG:\n\t\t\treturn selectedSVGType\n\n\t\tcase CodeType.Code:\n\t\t\treturn showAllProps ? \"All Props\" : \"Used Props\"\n\n\t\tdefault:\n\t\t\tassertNever(codeType)\n\t}\n}\n\ninterface DisplayExportTypeDropownOptions {\n\treadonly codeType: CodeType\n\treadonly hasTransitions: boolean\n\treadonly showAllProps: boolean\n\treadonly selectedCSSType: CSSExportType\n\treadonly selectedSVGType: SVGExportType\n\treadonly selectedTransitionType: TransitionExportType | undefined\n\treadonly metricsView: MetricsInteractionViews\n}\n\nfunction displayExportTypeDropdown({\n\tcodeType,\n\thasTransitions,\n\tshowAllProps,\n\tselectedCSSType,\n\tselectedSVGType,\n\tselectedTransitionType,\n\tmetricsView,\n}: DisplayExportTypeDropownOptions) {\n\treturn (event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\n\t\tconst { clientX, clientY } = event\n\t\tconst menuOptions: MenuItemOptions[] = []\n\n\t\tconst isTransitionSelected = Boolean(hasTransitions && selectedTransitionType)\n\n\t\tif (codeType === CodeType.CSS) {\n\t\t\tfor (const exportType of cssExportTypes) {\n\t\t\t\tmenuOptions.push({\n\t\t\t\t\tlabel: exportType,\n\t\t\t\t\tchecked: !isTransitionSelected && exportType === selectedCSSType,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportTransitionType = undefined\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportCSSType = exportType\n\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tid: `handoff-setting-${codeType}-${exportType}`,\n\t\t\t\t\t\t\tpage: metricsView,\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\tif (codeType === CodeType.SVG) {\n\t\t\tfor (const exportType of svgExportTypes) {\n\t\t\t\tmenuOptions.push({\n\t\t\t\t\tlabel: exportType,\n\t\t\t\t\tchecked: !isTransitionSelected && exportType === selectedSVGType,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportTransitionType = undefined\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportSVGType = exportType\n\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tid: `handoff-setting-${codeType}-${exportType}`,\n\t\t\t\t\t\t\tpage: metricsView,\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\tif (codeType === CodeType.Code) {\n\t\t\tmenuOptions.push(\n\t\t\t\t{\n\t\t\t\t\tlabel: \"All Props\",\n\t\t\t\t\tchecked: !isTransitionSelected && showAllProps,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportTransitionType = undefined\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportShowAllProps = true\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Used Props\",\n\t\t\t\t\tchecked: !isTransitionSelected && !showAllProps,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportTransitionType = undefined\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportShowAllProps = false\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tif (hasTransitions) {\n\t\t\tfor (const exportType of transitionExportTypes) {\n\t\t\t\tmenuOptions.push({\n\t\t\t\t\tlabel: exportType,\n\t\t\t\t\tchecked: exportType === selectedTransitionType,\n\t\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\tengine.stores.persistedUserDefaults.exportTransitionType = exportType\n\n\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\tid: `handoff-motionsetting-${exportType}`,\n\t\t\t\t\t\t\tpage: metricsView,\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\tengine.stores.contextMenuStore.show(menuOptions, { location: { x: clientX, y: clientY } })\n\t}\n}\n\ninterface RenderCodeComponentHandoffOptions {\n\treadonly nodes: CanvasNode[]\n\treadonly nodesHash: string\n\treadonly showAllProps: boolean\n\treadonly metricsView: MetricsInteractionViews\n\tsetCode(code: string): void\n}\n\nfunction renderCodeComponentHandoff({\n\tnodes,\n\tnodesHash,\n\tshowAllProps,\n\tmetricsView,\n}: RenderCodeComponentHandoffOptions) {\n\tconst codeComponentNodes = nodes.filter(isCodeComponentNode)\n\tconst content = getCodeComponentNodeInfo(engine.componentLoader, codeComponentNodes)\n\n\tif (!content) return null\n\tconst { component, isExternal } = content\n\n\tconst handleEditCode = () => {\n\t\tif (!component || !component.file) return\n\t\tengine.stores.codeEditorStore.editFile(component.file)\n\t}\n\n\tlet emptyState: CodeExportPanelEmptyStateType | undefined\n\tlet button: React.ReactElement | null = null\n\n\tif (!component) {\n\t\temptyState = CodeExportPanelEmptyStateType.multiSelect\n\t\treturn <CodeExportPanelEmptyState type={emptyState} />\n\t}\n\n\tconst parsedId = parseModuleIdentifier(component.identifier)\n\tconst persistedModule = engine.stores.modulesStore.getPersistedModuleByLocalIdentifier(component.identifier)\n\n\tconst handleCopyImport = () => {\n\t\tif (!persistedModule) return\n\t\tconst importStatement = getModuleImportStatement({\n\t\t\tkind: \"external\",\n\t\t\tspecifier: `${persistedModule.importURL}@${persistedModule.saveId}`,\n\t\t\ttitle: persistedModule.title,\n\t\t\texports: persistedModule.exports,\n\t\t})\n\t\tClipboard.copyText(importStatement.toString()).catch(unhandledError)\n\t\trecord(\"ui_interaction\", {\n\t\t\tid: UIInteraction.copyImportStatement,\n\t\t\tpage: metricsView,\n\t\t})\n\t}\n\n\tif (isLocalModuleIdentifier(parsedId) && parsedId.type === ModuleType.Canvas) {\n\t\temptyState = CodeExportPanelEmptyStateType.internal\n\t\tbutton = <CopyButton key={nodesHash} title=\"Copy Import\" onClick={handleCopyImport} variant=\"default\" fullWidth />\n\t} else if (isExternal) {\n\t\temptyState = CodeExportPanelEmptyStateType.external\n\t} else if (isLocalModuleIdentifier(parsedId)) {\n\t\temptyState = CodeExportPanelEmptyStateType.internal\n\t\tbutton = (\n\t\t\t<Button\n\t\t\t\ttitle=\"View Source Code\"\n\t\t\t\tonClick={handleEditCode}\n\t\t\t\tvariant=\"default\"\n\t\t\t\tclassName={styles.fullWidth}\n\t\t\t\tdata-metric-id=\"handoff-view-code\"\n\t\t\t\tdata-metric-view={metricsView}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconst firstNode = codeComponentNodes[0]\n\tassert(firstNode, \"Expected at least one code component node when content exists\")\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tid={handoffCodeId}\n\t\t\t\t// biome-ignore lint/a11y/noNoninteractiveTabindex: Removing this will break copy/paste\n\t\t\t\ttabIndex={0}\n\t\t\t\tclassName={cx(\"wantsNativeTextAction\", styles.contentWrapper, styles.syntaxHighlight)}\n\t\t\t>\n\t\t\t\t<ComponentCode node={firstNode} componentDefinition={component} showAllProps={showAllProps} />\n\t\t\t</div>\n\t\t\t<div className={styles.buttonContainer}>{button}</div>\n\t\t</>\n\t)\n}\n\ninterface CodeComponentPanelContent {\n\tcomponent: EntityDefinition | null\n\tisExternal: boolean\n}\n\nconst getCodeComponentNodeInfo = (\n\tcomponentLoader: ComponentLoader,\n\tnodes: CodeComponentNode[],\n): CodeComponentPanelContent | null => {\n\tif (nodes.length === 0) return null\n\n\tif (nodes.length > 1) {\n\t\treturn {\n\t\t\tcomponent: null,\n\t\t\tisExternal: false,\n\t\t}\n\t} else {\n\t\tconst node = nodes[0]\n\t\tassert(node, \"Expected node after length checks\")\n\t\tconst component = componentLoader.componentForIdentifier(node.codeComponentIdentifier)\n\t\tif (!component) return null\n\n\t\tconst isExternal =\n\t\t\t!isLocalModuleIdentifier(node.codeComponentIdentifier) &&\n\t\t\tcomponent.packageIdentifier !== componentLoader.localPackageIdentifier()\n\t\treturn {\n\t\t\tcomponent,\n\t\t\tisExternal,\n\t\t}\n\t}\n}\n\nconst getRenderedCodeInDiv = (divRef: React.RefObject<HTMLDivElement>): string | null => {\n\tif (!divRef || !divRef.current) return null\n\tconst codeDiv = divRef.current\n\treturn codeDiv.textContent || codeDiv.innerText\n}\n\nconst wrapContentWithImport = (content: React.ReactElement[]) => {\n\treturn (\n\t\t<>\n\t\t\t<span className={Syntax.Keyword}>\n\t\t\t\timport <span className={Syntax.Number}>*</span> as <span className={Syntax.Identifier}>React</span> from{\" \"}\n\t\t\t\t<span className={Syntax.String}>&quot;react&quot;</span>\n\t\t\t</span>\n\t\t\t{\"\\n\".repeat(2)}\n\t\t\t{content}\n\t\t</>\n\t)\n}\n\nconst handoffCodeId = \"handoff-code\"\n\n// When dragging, Safari will always show the text cursor when there is an element with \"user-select: text\" (wantsNativeTextAction)\n// present anywhere in the document. Here we make sure to clear the current DOM selection if the current range is contained by the handoff code element.\nfunction fixTextSelectionCursor() {\n\tconst handoffCodeElement = document.getElementById(handoffCodeId)\n\tif (handoffCodeElement) clearSelectionInsideElement(handoffCodeElement)\n}\n\nconst actionData = {\n\t\"framer/useNavigate\": {\n\t\tname: \"Navigation\",\n\t\tisTransitionHidden: isNavigationAnimationHidden,\n\t},\n}\n\ninterface FlatControlData {\n\t[key: string]: unknown\n}\n\nfunction flattenControlValues(controls: RawControlProps): FlatControlData {\n\tconst flatControlValues: Record<string, unknown> = {}\n\n\tfor (const key in controls) {\n\t\tconst controlProp = controls[key]\n\t\tif (!controlProp) continue\n\t\tflatControlValues[key] = controlProp.value\n\t}\n\n\treturn flatControlValues\n}\n\nfunction scrapeTransitionFromEvent(actions: EventAction[], key: string, list: TransitionExportItem[]) {\n\tconst name = titleCase(key)\n\tif (!actions.length) return\n\n\tconst numActions = actions.length\n\tfor (let actionIndex = 0; actionIndex < numActions; actionIndex++) {\n\t\tconst action = actions[actionIndex]\n\t\tassert(action !== undefined, \"Expected action at index within loop bounds\")\n\t\tconst { actionIdentifier, controls } = action\n\t\tconst { name: actionName, isTransitionHidden } = actionData[actionIdentifier as keyof typeof actionData] || {}\n\t\tconst isHidden = isTransitionHidden ? isTransitionHidden(flattenControlValues(controls)) : false\n\n\t\tif (isHidden) continue\n\n\t\tfor (const controlKey in controls) {\n\t\t\tconst controlProp = controls[controlKey]\n\t\t\tif (!controlProp) continue\n\t\t\tconst { value, type } = controlProp\n\t\t\tif (type !== ControlType.Transition || !isPartialTransition(value)) continue\n\n\t\t\tlist.push({\n\t\t\t\tlabel: `// ${name}${actionName ? ` - ${actionName}` : \"\"}`,\n\t\t\t\tvalue: toVekterTransition(value),\n\t\t\t})\n\t\t}\n\t}\n}\n\ninterface TransitionCodeProps {\n\ttransitions: TransitionExportItem[]\n}\n\nfunction SwiftTransitions({ transitions }: TransitionCodeProps) {\n\treturn (\n\t\t<>\n\t\t\t{transitions.map(({ label, value }, i) => {\n\t\t\t\tconst code: React.ReactNode[] = [\"Animation.\"]\n\t\t\t\tconst isSpring = value.type === \"spring\"\n\n\t\t\t\tif (isSpring) {\n\t\t\t\t\tconst { mass, stiffness, damping } = value as Spring\n\t\t\t\t\tcode.push(\n\t\t\t\t\t\t<span className={Syntax.Selector}>interpolatingSpring</span>,\n\t\t\t\t\t\t\"(\\n  \",\n\t\t\t\t\t\t<span className={Syntax.Keyword}>mass</span>,\n\t\t\t\t\t\t\": \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{mass}</span>,\n\t\t\t\t\t\t\",\\n  \",\n\t\t\t\t\t\t<span className={Syntax.Keyword}>stiffness</span>,\n\t\t\t\t\t\t\": \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{stiffness}</span>,\n\t\t\t\t\t\t\",\\n  \",\n\t\t\t\t\t\t<span className={Syntax.Keyword}>damping</span>,\n\t\t\t\t\t\t\": \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{damping}</span>,\n\t\t\t\t\t\t\"\\n)\",\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tconst { ease, duration } = value as Tween\n\t\t\t\t\tconst [x1, y1, x2, y2] = ease as [number, number, number, number]\n\t\t\t\t\tcode.push(\n\t\t\t\t\t\t<span className={Syntax.Selector}>timingCurve</span>,\n\t\t\t\t\t\t\"(\\n  \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{x1}</span>,\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{y1}</span>,\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{x2}</span>,\n\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{y2}</span>,\n\t\t\t\t\t\t\",\\n  \",\n\t\t\t\t\t\t<span className={Syntax.Keyword}>duration</span>,\n\t\t\t\t\t\t\": \",\n\t\t\t\t\t\t<span className={Syntax.Number}>{duration}</span>,\n\t\t\t\t\t\t`\\n)`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tif (value.delay) {\n\t\t\t\t\tcode.push(\n\t\t\t\t\t\t\"\\n  .\",\n\t\t\t\t\t\t<span className={Syntax.Selector}>delay</span>,\n\t\t\t\t\t\t\"(\",\n\t\t\t\t\t\t<span className={Syntax.Number}>{value.delay}</span>,\n\t\t\t\t\t\t\")\",\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<AnnotatedCode key={label} label={label} index={i}>\n\t\t\t\t\t\t<span className={Syntax.Identifier}>{code}</span>\n\t\t\t\t\t</AnnotatedCode>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n\nconst universalKeys: (keyof Transition)[] = [\"type\", \"delay\"]\nconst tweenKeys: (keyof Transition)[] = [...universalKeys, \"duration\", \"ease\"]\nconst springKeys: (keyof Transition)[] = [...universalKeys, \"stiffness\", \"damping\", \"mass\"]\n\nfunction MotionTransitions({ transitions }: TransitionCodeProps) {\n\treturn (\n\t\t<>\n\t\t\t{transitions.map(({ label, value }, i) => {\n\t\t\t\tconst keys = value.type === \"tween\" ? tweenKeys : springKeys\n\t\t\t\tconst code = keys.map(key => {\n\t\t\t\t\tlet output: JSX.Element | null = null\n\t\t\t\t\tconst fieldValue = value[key]\n\n\t\t\t\t\tswitch (typeof fieldValue) {\n\t\t\t\t\t\tcase \"string\": {\n\t\t\t\t\t\t\toutput = <span className={Syntax.String}>{`\"${fieldValue}\"`}</span>\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"number\": {\n\t\t\t\t\t\t\toutput = <span className={Syntax.Number}>{fieldValue}</span>\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase \"object\": {\n\t\t\t\t\t\t\tif (Array.isArray(fieldValue)) {\n\t\t\t\t\t\t\t\toutput = (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<span className={Syntax.Identifier}>[</span>\n\t\t\t\t\t\t\t\t\t\t{fieldValue.map((num: number, curveIndex: number) => (\n\t\t\t\t\t\t\t\t\t\t\t<React.Fragment key={`${curveIndex}${curveIndex !== 3}`}>\n\t\t\t\t\t\t\t\t\t\t\t\t<span className={Syntax.Number}>{num}</span>\n\t\t\t\t\t\t\t\t\t\t\t\t{curveIndex !== 3 && <span className={Syntax.Identifier}>{`, `}</span>}\n\t\t\t\t\t\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t<span className={Syntax.Identifier}>]</span>\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\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<React.Fragment key={`${key}`}>\n\t\t\t\t\t\t\t<span className={Syntax.Keyword}>{key}</span>\n\t\t\t\t\t\t\t<span className={Syntax.Comment}>:</span> {output}\n\t\t\t\t\t\t\t<span className={Syntax.Comment}>{`,\\n`}</span>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t)\n\t\t\t\t})\n\n\t\t\t\treturn (\n\t\t\t\t\t<AnnotatedCode key={label} label={label} index={i}>\n\t\t\t\t\t\t{code}\n\t\t\t\t\t</AnnotatedCode>\n\t\t\t\t)\n\t\t\t})}\n\t\t</>\n\t)\n}\n\ninterface AnnotatedCodeProps {\n\tchildren: React.ReactNode\n\tlabel: string\n\tindex: number\n}\n\nfunction AnnotatedCode({ children, label, index }: AnnotatedCodeProps) {\n\treturn (\n\t\t<div key={label}>\n\t\t\t{index !== 0 && `\\n`}\n\t\t\t<span className={Syntax.Comment}>\n\t\t\t\t{label}\n\t\t\t\t{`\\n`}\n\t\t\t</span>\n\t\t\t{children}\n\t\t</div>\n\t)\n}\n", "/** Fixes an issue where a text cursor is shown when clicking and dragging anywhere in the UI. */\nexport function clearSelectionInsideElement(element: Element) {\n\tconst selection = window.getSelection()\n\tif (!selection || selection.rangeCount <= 0) return\n\n\tconst range = selection.getRangeAt(0)\n\tconst elementContainsSelection = range.commonAncestorContainer && element.contains(range.commonAncestorContainer)\n\n\tif (elementContainsSelection) {\n\t\tselection.removeAllRanges()\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport engine from \"document/engine.ts\"\n/* eslint-disable react/jsx-no-comment-textnodes */\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { getCSSDeclarationBlockForNode } from \"document/models/CanvasTree/traits/utils/styleForNode.ts\"\nimport React from \"react\"\nimport { camelCaseToCSS, lowerCaseFirstChar, upperCaseFirstChar } from \"utils/names.ts\"\nimport { sanitizedSelectorName, sanitizedVariableName, uniqueVariableName } from \"utils/sanitizedVariableName.ts\"\nimport { CSSExportType, Syntax } from \"./types.ts\"\n\ninterface Props {\n\tnode: CanvasNode\n\tname: string\n\ttype: CSSExportType\n\tbreakline?: boolean\n\tstyle?: React.CSSProperties\n}\n\nexport const CSSCode = React.memo(({ node, name, type, breakline = true, style }: Props) => {\n\tconst { tree, componentLoader } = engine\n\treturn (\n\t\t<div style={style}>\n\t\t\t{renderStyledCSS(tree, componentLoader, node, name, type)}\n\t\t\t{breakline && \"\\n\".repeat(2)}\n\t\t</div>\n\t)\n})\n\nconst renderStyledCSS = (\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tnode: CanvasNode,\n\tname: string,\n\ttype: CSSExportType,\n) => {\n\tconst cssInfo = getCSSDeclarationBlockForNode(tree, componentLoader, node, type)\n\tconst indentation = \" \".repeat(2)\n\tconst css = cssInfo.map((cssRule, idx) => {\n\t\tconst className = cssRule.type === \"number\" ? Syntax.Number : Syntax.String\n\t\tconst divider = type === CSSExportType.CSS ? \";\" : \",\"\n\t\treturn (\n\t\t\t<span key={`${cssRule}-${idx}`}>\n\t\t\t\t{\"\\n\"}\n\t\t\t\t{indentation}\n\t\t\t\t<span key={cssRule.prop} className={Syntax.Punctuation}>\n\t\t\t\t\t<span className={Syntax.Keyword}>{cssRule.prop}</span>: <span className={className}>{cssRule.value}</span>\n\t\t\t\t\t{divider}\n\t\t\t\t\t{cssRule.comment && <span className={Syntax.Comment}> /* {cssRule.comment} */</span>}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t)\n\t})\n\treturn type === CSSExportType.CSS ? wrapCSSInSelector(name, css) : wrapCSSInReact(name, css)\n}\n\nconst wrapCSSInSelector = (name: string, css: React.ReactElement[]) => {\n\tname = nodeNameToCSSSelector(name)\n\treturn (\n\t\t<>\n\t\t\t<span className={Syntax.Selector}>{`.${name}`}</span>\n\t\t\t<span className={Syntax.Comment}>{` {`}</span>\n\t\t\t{css}\n\t\t\t{\"\\n\"}\n\t\t\t<span className={Syntax.Comment}>{\"}\"}</span>\n\t\t</>\n\t)\n}\n\nconst wrapCSSInReact = (name: string, css: React.ReactElement[]) => {\n\tname = nodeNameToVariableName(name)\n\treturn (\n\t\t<>\n\t\t\t<span className={Syntax.Storage}>const </span>\n\t\t\t<span className={Syntax.Class}>{name}</span>\n\t\t\t<span className={Syntax.Punctuation}>{` = {`}</span>\n\t\t\t{css}\n\t\t\t{\"\\n\"}\n\t\t\t<span className={Syntax.Punctuation}>{`}`}</span>\n\t\t</>\n\t)\n}\n\nconst nodeNameToCSSSelector = (name: string) => {\n\tname = sanitizedSelectorName(name) || \"frame\"\n\tconst words = name.split(\"_\").map(word => {\n\t\tlet result = word\n\t\tresult = lowerCaseFirstChar(result)\n\t\treturn camelCaseToCSS(result)\n\t})\n\tname = words.join(\"-\")\n\tname = name.replace(/^-|-$/gu, \"_\")\n\treturn name\n}\n\nconst nodeNameToVariableName = (name: string) => {\n\tconst fallbackName = \"styles\"\n\tname = sanitizedVariableName(name) || fallbackName\n\tconst words = name.split(\"_\").map((word, idx) => {\n\t\tif (idx === 0) return word\n\t\treturn upperCaseFirstChar(word)\n\t})\n\tname = words.join(\"\")\n\tname = lowerCaseFirstChar(name)\n\tname = uniqueVariableName(name, []) || fallbackName\n\treturn name\n}\n", "import { EmptyState } from \"@framerjs/fresco\"\nimport type React from \"react\"\n\nexport enum CodeExportPanelEmptyStateType {\n\tmultiSelect,\n\tinternal,\n\texternal,\n}\n\ninterface Props {\n\ttype: CodeExportPanelEmptyStateType\n\tbutton?: React.ReactElement\n}\n\nexport function CodeExportPanelEmptyState({ type, button }: Props) {\n\treturn <EmptyState body={messageForType(type)} button={button} leftAlign />\n}\n\nfunction messageForType(type: CodeExportPanelEmptyStateType) {\n\tswitch (type) {\n\t\tcase CodeExportPanelEmptyStateType.multiSelect:\n\t\t\treturn \"Select code components individually to copy their code.\"\n\t\tcase CodeExportPanelEmptyStateType.external:\n\t\t\treturn \"Copy the code of this component downloaded from the Store.\"\n\t\tcase CodeExportPanelEmptyStateType.internal:\n\t\t\treturn \"View and edit the code of this component in the editor.\"\n\t}\n}\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport type { AnyComponentLoader, EntityDefinition, VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { isNavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport type { CanvasTree, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDrawableNode } from \"document/models/CanvasTree/index.ts\"\nimport { mapVariableProps } from \"document/models/CanvasTree/nodes/CodeComponentNode.ts\"\nimport { getSlotItemsBySlotKey } from \"document/models/CanvasTree/nodes/utils/slotUtils.ts\"\nimport { isResponsiveImage } from \"document/models/CanvasTree/traits/ResponsiveImage.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getHumanReadableKey } from \"document/models/CanvasTree/traits/mixins/withControlPropsTrait.ts\"\nimport { migrateTokenCSSVariableInValue } from \"document/models/CanvasTree/traits/utils/cssVariables.ts\"\nimport { isTokenCSSVariable } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport {\n\tgetControlPropValueResolvers,\n\tgetResolvedControlPropValues,\n} from \"document/models/controlProps/getResolvedControlPropValues.ts\"\nimport { ConvertColor } from \"library/render/types/Color/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isShallowEqualArray } from \"library/render/utils/isShallowEqualArray.ts\"\nimport { useMemo } from \"react\"\nimport { safeTagName } from \"utils/names.ts\"\nimport { isArray, isBoolean, isNumber, isObject, isReadonlyArray, isString } from \"utils/typeChecks.ts\"\nimport { eventsForNode } from \"../utils/eventActions.ts\"\nimport { FoldablePropertyRow } from \"./FoldablePropertyRow.tsx\"\nimport type { ArrayItemDisplayProperty, DisplayProperty, EventHandler, ObjectPropertyDisplayProperty } from \"./types.ts\"\nimport { Syntax } from \"./types.ts\"\n\nconst lineBreak = \"\\n\"\n\ninterface Props {\n\tnode: CodeComponentNode\n\tcomponentDefinition: EntityDefinition\n\t/* show all props or hide undefined props */\n\tshowAllProps: boolean\n}\n\nexport const ComponentCode = ({ node, componentDefinition, showAllProps }: Props) => {\n\tconst { overrides, defaults } = useProperties(node, componentDefinition)\n\n\tconst usedProps = renderAttributes(overrides, showAllProps)\n\tconst defaultProps = renderAttributes(defaults, showAllProps)\n\n\treturn (\n\t\t<span className={Syntax.Punctuation}>\n\t\t\t{\"<\"}\n\t\t\t<span className={Syntax.Class}>{safeTagName(componentDefinition.name)}</span>\n\t\t\t{usedProps}\n\t\t\t{usedProps.length > 0 || defaultProps.length > 0 ? lineBreak + \"  \" : \" \"}\n\t\t\t{defaultProps.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t{/* biome-ignore lint/suspicious/noCommentText: intentional */}\n\t\t\t\t\t<span className={Syntax.Comment}>// Using default values:</span>\n\t\t\t\t\t{defaultProps}\n\t\t\t\t\t{lineBreak}\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{\"/>\"}\n\t\t</span>\n\t)\n}\n\ntype DisplayProperties = Record<string, DisplayProperty | null>\n\n/**\n * Code Export always needs to map React props even if the canvas rendering does\n * not require it anymore.\n */\nfunction getPropertyMapping(componentLoader: AnyComponentLoader, node: CodeComponentNode): Record<VariableID, string> {\n\tconst definition = componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\tif (!definition) return {}\n\n\tconst { annotations } = definition\n\tif (!annotations) return {}\n\n\tconst value = annotations[AnnotationKey.FramerVariables] || annotations[AnnotationKey.FramerVariablesDeprecated]\n\tif (!value) return {}\n\n\ttry {\n\t\treturn JSON.parse(value)\n\t} catch (_err) {\n\t\treturn {}\n\t}\n}\n\n// Get properties with values grouped in overrides and defaults,\n// populate unimplemented props with default values.\nexport function useProperties(\n\tnode: CodeComponentNode,\n\tdefinition: EntityDefinition,\n): {\n\toverrides: DisplayProperties\n\tdefaults: DisplayProperties\n} {\n\tconst codeComponentProps = node.getCodeComponentProps(engine.componentLoader)\n\tconst propertyMapping = getPropertyMapping(engine.componentLoader, node)\n\tconst actions = eventsForNode(engine.componentLoader, node)\n\tconst mappedActions = mapVariableProps(engine.componentLoader, node.codeComponentIdentifier, actions)\n\tconst controls = definition.properties\n\n\tconst defaultValues = useMemo(() => {\n\t\t// Empty raw controls because we want to get the default values\n\t\tconst rawControls = {}\n\t\treturn getResolvedControlPropValues(\n\t\t\tcontrols,\n\t\t\tgetControlProps(controls, rawControls),\n\t\t\tgetControlPropValueResolvers({\n\t\t\t\tassetResolverWithHash: null,\n\t\t\t\tvariableValueResolver: node.cache,\n\t\t\t\tgetVariableControlByReference: ref => node.cache.getVariableControlByReference(ref),\n\t\t\t\tgetResolvedFetchDataValue: undefined,\n\t\t\t\tgetCanvasTree: () => engine.tree,\n\t\t\t\tcomponentLoader: engine.componentLoader,\n\t\t\t}),\n\t\t)\n\t}, [controls, node])\n\n\tconst controlProps = node.getControlProps(controls)\n\n\tconst overrides: DisplayProperties = {}\n\tconst defaults: DisplayProperties = {}\n\n\tfor (const key in controls) {\n\t\tconst control = controls[key]\n\t\tif (!control) continue\n\n\t\tconst humanReadableKey = getHumanReadableKey(propertyMapping, key)\n\t\tconst controlProp = controlProps[key]\n\n\t\tif (control.type === ControlType.EventHandler) {\n\t\t\tdefaults[humanReadableKey] = getDisplayProperty({\n\t\t\t\ttree: engine.tree,\n\t\t\t\tcontrolDescription: control,\n\t\t\t\tvalue: mappedActions[humanReadableKey],\n\t\t\t\tcontrolProp: undefined,\n\t\t\t})\n\n\t\t\tcontinue\n\t\t}\n\n\t\t// Convert properties and group them for rendering\n\n\t\tlet value: unknown = undefined\n\t\tif (control.type === ControlType.Slot && key === \"children\") {\n\t\t\t// When collecting props in node.getCodeComponentProps we skip the key \"children\",\n\t\t\t// so we need to collect the slots explicitly here.\n\t\t\t// Also any non-ComponentInstance/Array prop with the name \"children\" will be ignored by the handoff,\n\t\t\t// because it won't work for the code component anyway\n\t\t\tvalue = getSlotItemsBySlotKey(engine.tree, node, engine.componentLoader).children?.map(slotItem => slotItem.node)\n\t\t} else {\n\t\t\tvalue = codeComponentProps[humanReadableKey]\n\t\t}\n\n\t\tconst defaultValue = defaultValues[key]\n\t\tif (isValueSameAsDefault(control.type, value, defaultValue)) {\n\t\t\tdefaults[humanReadableKey] = getDisplayProperty({\n\t\t\t\ttree: engine.tree,\n\t\t\t\tcontrolDescription: control,\n\t\t\t\tvalue,\n\t\t\t\tcontrolProp,\n\t\t\t})\n\t\t} else {\n\t\t\toverrides[humanReadableKey] = getDisplayProperty({\n\t\t\t\ttree: engine.tree,\n\t\t\t\tcontrolDescription: control,\n\t\t\t\tvalue,\n\t\t\t\tcontrolProp,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn { overrides, defaults }\n}\n\nexport function isValueSameAsDefault(controlType: ControlType, value: unknown, defaultValue: unknown) {\n\tswitch (controlType) {\n\t\t// Image/File don't support defaultValue,\n\t\t// so we just check if the value is empty\n\t\tcase ControlType.File:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn value === undefined || value === \"\"\n\t\tcase ControlType.Array:\n\t\t\t// Default array values are converted to ArrayValue in defaultCodeComponentProps, so we need to flatten it first.\n\t\t\t// ControlType.Array only accept flat types, so a shallow equal should be sufficient here\n\t\t\tif (Array.isArray(defaultValue) && Array.isArray(value)) {\n\t\t\t\tconst flatDefaultValues = defaultValue.map(item => item.value)\n\t\t\t\treturn isShallowEqualArray(value, flatDefaultValues)\n\t\t\t}\n\t\t\t// If a ComponentInstance/Array type property is not implemented and doesn't have a default value defined,\n\t\t\t// the actual value will be an empty array, while its defaultValue would be undefined.\n\t\t\t// We show the empty array in the handoff, but when grouping the properties we still consider it using the default value.\n\t\t\treturn defaultValue === undefined && (value === undefined || isEmptyArray(value))\n\t\tcase ControlType.EventHandler:\n\t\tcase ControlType.ComponentInstance:\n\t\tcase ControlType.Slot:\n\t\t\t// EventHandler/ComponentInstance don't support defaultValue,\n\t\t\t// so we just check if the value is empty\n\t\t\treturn value === undefined || isEmptyArray(value)\n\t\tdefault:\n\t\t\treturn defaultValue === value\n\t}\n}\n\nfunction isEmptyArray(value: unknown): value is never[] {\n\treturn Array.isArray(value) && value.length === 0\n}\n\n/** Returns the variant name for variants */\nfunction getValueOrVariantName(control: VerifiedControlDescription, value: unknown): unknown {\n\tif (control.type !== ControlType.Enum) return value\n\tif (control.title !== \"Variant\") return value\n\tif (!control.optionTitles) return value\n\tif (!isString(value)) return value\n\tconst index = control.options.indexOf(value)\n\tconst variantDisplayTitle = control.optionTitles[index]\n\treturn isString(variantDisplayTitle) ? variantDisplayTitle : value\n}\n\n// Controls return null have invalid values (or are types we want to ignore like ControlType.Transition) and will be ignored\nexport function getDisplayProperty({\n\ttree,\n\tcontrolDescription,\n\tcontrolProp,\n\tvalue,\n}: {\n\ttree: CanvasTree\n\tcontrolDescription: VerifiedControlDescription\n\tcontrolProp: ControlProp | undefined\n\tvalue: unknown\n}): DisplayProperty | null {\n\tconst controlType = controlDescription.type\n\tswitch (controlType) {\n\t\tcase ControlType.Number:\n\t\tcase ControlType.FusedNumber: {\n\t\t\tif (!isNumber(value) && value !== undefined) return null\n\t\t\treturn { controlType, value }\n\t\t}\n\t\tcase ControlType.Boolean: {\n\t\t\tif (!isBoolean(value) && value !== undefined) return null\n\t\t\treturn { controlType, value }\n\t\t}\n\t\tcase ControlType.Color: {\n\t\t\tif (value === undefined) return { controlType, value }\n\t\t\tif (!isString(value)) return null\n\t\t\t// Because CodeComponentNode makes this conversion, we need to make it here as well.\n\t\t\tlet migratedValue: string\n\t\t\tif (isTokenCSSVariable(value)) {\n\t\t\t\tmigratedValue = migrateTokenCSSVariableInValue(engine.tree, value)\n\t\t\t} else {\n\t\t\t\tmigratedValue = ConvertColor.toRgbString(value)\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tcontrolType,\n\t\t\t\tvalue: wrapStringValueInQuotes(controlDescription, migratedValue),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.String:\n\t\tcase ControlType.Enum: {\n\t\t\tvalue = getValueOrVariantName(controlDescription, value)\n\t\t\tif (!isString(value) && value !== undefined) return null\n\t\t\tif (value === undefined) return { controlType, value }\n\t\t\treturn {\n\t\t\t\tcontrolType,\n\t\t\t\tvalue: wrapStringValueInQuotes(controlDescription, value),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.File:\n\t\tcase ControlType.Image: {\n\t\t\tvalue = isResponsiveImage(value) ? value.src : value\n\t\t\tif (!isString(value) && value !== undefined) return null\n\n\t\t\tconst assetReference = isString(controlProp?.value) ? parseAssetReference(controlProp.value) : undefined\n\t\t\tconst originalFilename = assetReference?.originalFilename ?? undefined\n\t\t\treturn { controlType, originalFilename, value }\n\t\t}\n\t\tcase ControlType.EventHandler: {\n\t\t\tif (!Array.isArray(value) || value.length === 0) return { controlType, handlers: undefined }\n\t\t\tconst handlers: EventHandler[] = []\n\t\t\tvalue.forEach((action: EventAction) => {\n\t\t\t\tconst actionEntity = engine.componentLoader.componentForIdentifier(action.actionIdentifier)\n\t\t\t\tif (!actionEntity) return\n\t\t\t\thandlers.push({\n\t\t\t\t\tpackageIdentifier: actionEntity.packageIdentifier,\n\t\t\t\t\tfile: actionEntity.file,\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tisNavigationAction(action) && action.controls.type?.value === \"previous\"\n\t\t\t\t\t\t\t? \"Transition Back\"\n\t\t\t\t\t\t\t: actionEntity.name,\n\t\t\t\t})\n\t\t\t})\n\t\t\treturn { controlType, handlers }\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (value === undefined) return { controlType, items: [] }\n\t\t\tif (!isArray(value)) return null\n\n\t\t\tconst items: ArrayItemDisplayProperty[] = []\n\t\t\tvalue.forEach((itemValue, idx) => {\n\t\t\t\tconst displayProperty = getDisplayProperty({\n\t\t\t\t\ttree,\n\t\t\t\t\tcontrolDescription: controlDescription.control,\n\t\t\t\t\tvalue: itemValue,\n\t\t\t\t\tcontrolProp:\n\t\t\t\t\t\tcontrolProp?.type === ControlType.Array && isReadonlyArray(controlProp.value)\n\t\t\t\t\t\t\t? controlProp.value[idx]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t})\n\t\t\t\tif (\n\t\t\t\t\tdisplayProperty &&\n\t\t\t\t\tdisplayProperty.controlType !== ControlType.EventHandler &&\n\t\t\t\t\tdisplayProperty.controlType !== ControlType.Array\n\t\t\t\t) {\n\t\t\t\t\titems.push(displayProperty)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\treturn { controlType, items }\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\tif (!isObject(value)) return null\n\n\t\t\tconst objectValue = value\n\n\t\t\tconst properties: Record<string, ObjectPropertyDisplayProperty> = {}\n\n\t\t\tObject.entries(controlDescription.controls).forEach(([objectKey, objectPropertyControl]) => {\n\t\t\t\tconst propertyDisplayValue = getDisplayProperty({\n\t\t\t\t\ttree,\n\t\t\t\t\tcontrolDescription: objectPropertyControl,\n\t\t\t\t\tvalue: objectValue[objectKey],\n\t\t\t\t\tcontrolProp:\n\t\t\t\t\t\tcontrolProp?.type === ControlType.Object && isObject(controlProp.value)\n\t\t\t\t\t\t\t? controlProp.value[objectKey]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t})\n\t\t\t\tif (!propertyDisplayValue) return\n\t\t\t\tswitch (propertyDisplayValue.controlType) {\n\t\t\t\t\tcase ControlType.Object:\n\t\t\t\t\tcase ControlType.Array:\n\t\t\t\t\tcase ControlType.ComponentInstance:\n\t\t\t\t\tcase ControlType.FusedNumber:\n\t\t\t\t\tcase ControlType.EventHandler:\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tproperties[objectKey] = propertyDisplayValue\n\t\t\t})\n\n\t\t\treturn { controlType, properties }\n\t\t}\n\t\tcase ControlType.Slot: {\n\t\t\tfunction getSlotItemDisplayProperty(\n\t\t\t\trawValue: unknown,\n\t\t\t): Extract<DisplayProperty, { controlType: ControlType.ComponentInstance }> | null {\n\t\t\t\tconst instanceId = Array.isArray(rawValue) && rawValue.length === 1 ? rawValue[0] : rawValue\n\t\t\t\tconst instance = tree.getNode(instanceId)\n\t\t\t\tif (!instance || !isDrawableNode(instance)) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontrolType: ControlType.ComponentInstance,\n\t\t\t\t\t\tid: undefined,\n\t\t\t\t\t\tname: undefined,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tcontrolType: ControlType.ComponentInstance,\n\t\t\t\t\tid: instance.id,\n\t\t\t\t\tname: instance.resolveValue(\"name\") || getDefaultName(engine.componentLoader, instance),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (controlDescription.maxCount === 1) {\n\t\t\t\treturn getSlotItemDisplayProperty(value)\n\t\t\t}\n\n\t\t\tif (!isArray(value)) return null\n\n\t\t\tconst items: ArrayItemDisplayProperty[] = []\n\t\t\tvalue.forEach(itemValue => {\n\t\t\t\tconst displayProperty = getSlotItemDisplayProperty(itemValue)\n\t\t\t\tif (!displayProperty) return\n\t\t\t\titems.push(displayProperty)\n\t\t\t})\n\n\t\t\treturn { controlType: ControlType.Array, items }\n\t\t}\n\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nfunction renderAttributes(properties: Record<string, DisplayProperty | null>, showAllProps: boolean) {\n\treturn Object.keys(properties)\n\t\t.sort()\n\t\t.map(propName => {\n\t\t\tconst prop = properties[propName]\n\t\t\tif (!prop) return null\n\t\t\tif (!showAllProps && shouldHideProperty(prop)) return null\n\t\t\treturn <FoldablePropertyRow key={`attribute-${propName}`} name={propName} prop={prop} />\n\t\t})\n\t\t.filter(Boolean)\n}\n\nfunction shouldHideProperty(prop: DisplayProperty) {\n\tswitch (prop.controlType) {\n\t\tcase ControlType.ComponentInstance:\n\t\t\treturn prop.name === undefined\n\t\tcase ControlType.Array:\n\t\t\treturn prop.items === undefined\n\t\tcase ControlType.Object:\n\t\t\treturn Object.keys(prop.properties).length === 0\n\t\tcase ControlType.EventHandler:\n\t\t\treturn prop.handlers === undefined\n\t\tdefault:\n\t\t\treturn prop.value === undefined\n\t}\n}\n\nfunction wrapStringValueInQuotes(propDescription: VerifiedControlDescription, value: string) {\n\treturn propDescription.type === ControlType.String && propDescription.displayTextArea && value.length > 0\n\t\t? \"`\" + value + \"`\"\n\t\t: `\"` + value + `\"`\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { localPackageFallbackIdentifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport { IconCaret } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { getAssetResolver } from \"renderer/getAssetResolver.ts\"\nimport { isBoolean, isNumber } from \"utils/typeChecks.ts\"\nimport * as styles from \"./FoldablePropertyRow.styles.ts\"\nimport type { DisplayProperty } from \"./types.ts\"\nimport { Syntax } from \"./types.ts\"\n\ninterface Props {\n\tname: string\n\tprop: DisplayProperty\n}\n\nconst indentation = \" \".repeat(2)\n\nexport const FoldablePropertyRow = ({ name, prop }: Props) => {\n\tconst [folded, setFolded] = React.useState<boolean>(true)\n\tconst shouldShowFoldHandle = canFoldValues(prop)\n\tconst toggleFold = () => {\n\t\tsetFolded(value => !value)\n\t}\n\n\tconst value = shouldShowFoldHandle && folded ? codeFold(prop) : renderValue(prop)\n\tconst isRegularString = \"value\" in prop && typeof prop.value === \"string\" && prop.value.startsWith(`\"`)\n\n\treturn (\n\t\t<span>\n\t\t\t{\"\\n\"}\n\t\t\t{shouldShowFoldHandle && (\n\t\t\t\t<span className={styles.foldHandle} role=\"presentation\" onClick={toggleFold}>\n\t\t\t\t\t<IconCaret isActive={folded} direction=\"right\" width={8} height={8} />\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t{indentation}\n\t\t\t<span className={Syntax.Keyword}>{name}</span>=\n\t\t\t{isRegularString ? (\n\t\t\t\tvalue\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{\"{\"}\n\t\t\t\t\t{value}\n\t\t\t\t\t{\"}\"}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</span>\n\t)\n}\n\nfunction codeFold(prop: DisplayProperty) {\n\tswitch (prop.controlType) {\n\t\tcase ControlType.Object:\n\t\t\treturn `{\u2026}`\n\t\tcase ControlType.Array:\n\t\tdefault:\n\t\t\treturn `[\u2026]`\n\t}\n}\n\nfunction canFoldValues(prop: DisplayProperty): boolean {\n\tswitch (prop.controlType) {\n\t\tcase ControlType.Array: {\n\t\t\tconst { items } = prop\n\t\t\tif (!items || items.length < 2) return false\n\t\t\tconst itemType = items[0]?.controlType\n\t\t\tswitch (itemType) {\n\t\t\t\tcase ControlType.ComponentInstance:\n\t\t\t\tcase ControlType.Image:\n\t\t\t\tcase ControlType.File:\n\t\t\t\tcase ControlType.Object:\n\t\t\t\t\treturn true\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\treturn Object.keys(prop.properties).length > 0\n\t\t}\n\t\tcase ControlType.EventHandler: {\n\t\t\treturn !!prop.handlers && prop.handlers.length > 1\n\t\t}\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nfunction renderValue(prop: DisplayProperty, indentationLevel = 1): JSX.Element {\n\tswitch (prop.controlType) {\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.File: {\n\t\t\tif (!prop.value) return <UndefinedValue />\n\t\t\treturn <FileValue name={prop.originalFilename} value={prop.value} />\n\t\t}\n\t\tcase ControlType.ComponentInstance: {\n\t\t\tif (!prop.id) return <UndefinedValue />\n\t\t\treturn <ComponentInstanceValue id={prop.id} name={prop.name} />\n\t\t}\n\t\tcase ControlType.EventHandler: {\n\t\t\tif (!prop.handlers) {\n\t\t\t\treturn <UndefinedValue />\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ArrayValue\n\t\t\t\t\tcanFold={canFoldValues(prop)}\n\t\t\t\t\titems={prop.handlers}\n\t\t\t\t\tindentationLevel={indentationLevel}\n\t\t\t\t\t// eslint-disable-next-line react/jsx-no-bind\n\t\t\t\t\trenderItem={item => (\n\t\t\t\t\t\t<EventHandlerValue\n\t\t\t\t\t\t\tkey={`${item.packageIdentifier}_${item.file}_${item.value}`}\n\t\t\t\t\t\t\tpackageIdentifier={item.packageIdentifier}\n\t\t\t\t\t\t\tfile={item.file}\n\t\t\t\t\t\t\tname={item.value}\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\tcase ControlType.Array: {\n\t\t\tconst { items } = prop\n\t\t\tif (!items) return <UndefinedValue />\n\t\t\tconst canFold = canFoldValues(prop)\n\t\t\tconst content = (\n\t\t\t\t<ArrayValue\n\t\t\t\t\tcanFold={canFold}\n\t\t\t\t\titems={items}\n\t\t\t\t\tindentationLevel={indentationLevel}\n\t\t\t\t\t// eslint-disable-next-line react/jsx-no-bind\n\t\t\t\t\trenderItem={item => renderValue(item, indentationLevel + 1)}\n\t\t\t\t/>\n\t\t\t)\n\t\t\treturn <>[{content}]</>\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\tconst { properties } = prop\n\t\t\tconst canFold = canFoldValues(prop)\n\t\t\treturn (\n\t\t\t\t<ObjectValue\n\t\t\t\t\tcanFold={canFold}\n\t\t\t\t\tproperties={properties}\n\t\t\t\t\tindentationLevel={indentationLevel}\n\t\t\t\t\t// eslint-disable-next-line react/jsx-no-bind\n\t\t\t\t\trenderItem={item => renderValue(item, indentationLevel + 1)}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\n\t\tdefault:\n\t\t\treturn <span className={getClassNameByValueType(prop.value)}>{getRenderValue(prop.value)}</span>\n\t}\n}\n\nfunction getClassNameByValueType(value: string | number | boolean | undefined) {\n\tif (isNumber(value) || isBoolean(value) || value === undefined) return Syntax.Number\n\treturn Syntax.String\n}\n\nfunction getRenderValue(value: string | number | boolean | undefined) {\n\tif (isBoolean(value)) return value ? \"true\" : \"false\"\n\tif (value === undefined) return \"undefined\"\n\treturn value\n}\n\nconst UndefinedValue = () => {\n\treturn <span className={Syntax.Number}>undefined</span>\n}\n\nconst ComponentInstanceValue = ({ id, name }: { id: string; name: string | undefined }) => {\n\tconst handleMouseEnter = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.treeStore.setHighlight(id)\n\t})\n\tconst handleMouseLeave = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.treeStore.setHighlight(null)\n\t})\n\n\tconst instanceName = name || \"instance\"\n\treturn (\n\t\t<span className={styles.chip} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>\n\t\t\t<span className={Syntax.Class}>{instanceName}</span>\n\t\t</span>\n\t)\n}\n\nconst EventHandlerValue = ({\n\tpackageIdentifier,\n\tfile,\n\tname,\n}: {\n\tpackageIdentifier: string\n\tfile: string | undefined\n\tname: string\n}) => {\n\tconst clickable = packageIdentifier === localPackageFallbackIdentifier && file\n\tconst handleClick = engine.scheduler.wrapHandler(() => {\n\t\tif (!clickable || !file) return\n\t\tengine.stores.codeEditorStore.editFile(file)\n\t})\n\n\treturn (\n\t\t<span className={cx(styles.chip, clickable && styles.clickable)} role=\"presentation\" onClick={handleClick}>\n\t\t\t<span className={Syntax.Class}>{name}</span>\n\t\t</span>\n\t)\n}\n\nconst FileValue = ({ name, value }: { name: string | undefined; value: string }) => {\n\tconst originalFilename = name || \"image\"\n\n\tconst resolveAsset = getAssetResolver()\n\tif (resolveAsset) {\n\t\tconst resolvedValue = resolveAsset(value, {})\n\t\tif (resolvedValue) {\n\t\t\tvalue = resolvedValue\n\t\t}\n\t}\n\n\tconst reviewFile = () => {\n\t\topenNewTab(value)\n\t}\n\n\treturn (\n\t\t<span\n\t\t\tclassName={cx(styles.chip, styles.clickable, styles.link, Syntax.Class)}\n\t\t\trole=\"presentation\"\n\t\t\tonClick={reviewFile}\n\t\t>\n\t\t\t{originalFilename}\n\t\t</span>\n\t)\n}\n\ninterface ArrayValueProps<T> {\n\tcanFold: boolean\n\titems: T[]\n\trenderItem: (item: T) => JSX.Element\n\tindentationLevel: number\n}\n\nfunction ArrayValue<T>({ canFold, items, renderItem, indentationLevel }: ArrayValueProps<T>) {\n\tconst currentIndentation = canFold ? indentation.repeat(indentationLevel + 1) : \"\"\n\tconst breakline = canFold ? \"\\n\" : \"\"\n\treturn (\n\t\t<>\n\t\t\t{breakline}\n\t\t\t{items.map((item, idx) => (\n\t\t\t\t<React.Fragment key={`item-${idx}`}>\n\t\t\t\t\t{currentIndentation}\n\t\t\t\t\t{renderItem(item)}\n\t\t\t\t\t{idx < items.length - 1 && `, `}\n\t\t\t\t\t{breakline}\n\t\t\t\t</React.Fragment>\n\t\t\t))}\n\t\t\t{canFold && indentation}\n\t\t</>\n\t)\n}\n\ninterface ObjectValueProps<T> {\n\tcanFold: boolean\n\tproperties: Record<string, T>\n\trenderItem: (item: T) => JSX.Element\n\tindentationLevel: number\n}\n\nfunction ObjectValue<T>({ canFold, properties, renderItem, indentationLevel }: ObjectValueProps<T>) {\n\tconst currentIndentation = canFold ? indentation.repeat(indentationLevel) : \"\"\n\tconst currentPropertyIndentation = canFold ? indentation.repeat(indentationLevel + 1) : \"\"\n\tconst breakline = canFold ? \"\\n\" : \"\"\n\tconst propertiesCount = Object.keys(properties).length\n\treturn (\n\t\t<>\n\t\t\t{`{`}\n\t\t\t{breakline}\n\t\t\t{Object.entries(properties).map(([key, item], idx) => (\n\t\t\t\t<React.Fragment key={`item-${idx}`}>\n\t\t\t\t\t{currentPropertyIndentation}\n\t\t\t\t\t<span className={Syntax.Keyword}>{key}</span>\n\t\t\t\t\t{\": \"}\n\t\t\t\t\t{renderItem(item)}\n\t\t\t\t\t{idx < propertiesCount - 1 && `, `}\n\t\t\t\t\t{breakline}\n\t\t\t\t</React.Fragment>\n\t\t\t))}\n\t\t\t{currentIndentation}\n\t\t\t{`}`}\n\t\t</>\n\t)\n}\n", "import \"FoldablePropertyRow.styles_25glmu.wyw.css\"; export const foldHandle = \"foldHandle_f1i70zsj\";\nexport const chip = \"chip_cujhtqq\";\nexport const clickable = \"clickable_c93eniw\";\nexport const link = \"link_l1ojtula\";", "import engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport React from \"react\"\nimport { safeComponentName, svgAttrToCamelCase } from \"utils/names.ts\"\nimport { renderNodeToSVG } from \"utils/renderNodeToSVG.tsx\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport { SVGExportType, Syntax } from \"./types.ts\"\n\ninterface Props {\n\tnode: CanvasNode\n\tname: string\n\ttype: SVGExportType\n\tbreakline?: boolean\n\tstyle?: React.CSSProperties\n}\n\nexport const SVGCode = React.memo(({ node, name, type, breakline = true, style }: Props) => {\n\tconst { isDarkMode } = useDarkMode()\n\treturn (\n\t\t<div style={style}>\n\t\t\t{renderSVGCode(node, name, type, isDarkMode)}\n\t\t\t{breakline && \"\\n\".repeat(2)}\n\t\t</div>\n\t)\n})\n\ninterface SyntaxData {\n\ttype: \"start\" | \"end\"\n\tname: string\n\tattributes: { [key: string]: string | number }\n\tlevel: number\n}\n\nconst renderSVGCode = (node: CanvasNode, name: string, type: SVGExportType, isDarkMode: boolean) => {\n\tif (!node || !isExportableAsSVG(node)) return null\n\tconst svgCode = renderNodeToSVG({\n\t\tnode,\n\t\tisDarkMode,\n\t\tcomponentLoader: engine.componentLoader,\n\t\tcombinedVariableValueMap: node.cache.getUnsafeCombinedVariableValueMap(),\n\t})\n\tconst data = parseSVGString(svgCode, type)\n\tif (!data) return null\n\tlet prevTag = \"\"\n\tconst svg = data.map((tag, idx) => {\n\t\tif (!prevTag) {\n\t\t\tprevTag = tag.name\n\t\t}\n\t\tconst isSelfClosing = tag.type === \"end\" && tag.name === prevTag\n\t\tprevTag = tag.name\n\t\tlet level = tag.level\n\t\tif (type === SVGExportType.JSX) {\n\t\t\tlevel += 2 // indent inside the function wrapper\n\t\t}\n\t\tconst indentation = isSelfClosing ? null : \" \".repeat(2).repeat(level)\n\t\tconst attributes = Object.keys(tag.attributes).map((key, attributeIdx) => {\n\t\t\treturn (\n\t\t\t\t<React.Fragment key={`${key}-${attributeIdx}`}>\n\t\t\t\t\t{\" \"}\n\t\t\t\t\t<span className={Syntax.Keyword}>{key}</span>=<span className={Syntax.String}>{tag.attributes[key]}</span>\n\t\t\t\t</React.Fragment>\n\t\t\t)\n\t\t})\n\t\treturn (\n\t\t\t<span key={`${tag}-${idx}`}>\n\t\t\t\t{!isSelfClosing && idx !== 0 && \"\\n\"}\n\t\t\t\t{indentation}\n\t\t\t\t<span key={`${tag.type}-${tag.name}-${idx}`} className={Syntax.Punctuation}>\n\t\t\t\t\t{`<${tag.type === \"end\" ? \"/\" : \"\"}`}\n\t\t\t\t\t<span className={Syntax.Tag}>{tag.name}</span>\n\t\t\t\t\t{attributes}\n\t\t\t\t\t{`>`}\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t)\n\t})\n\n\treturn type === SVGExportType.JSX ? wrapSVGInReact(name, svg) : wrapSVGInComment(name, svg)\n}\n\nconst parseSVGString = (str: string, type: SVGExportType = SVGExportType.SVG): SyntaxData[] | null => {\n\tconst seen: string[] = []\n\tlet level = 0\n\tconst regex = /<[^>]*>/gu\n\tconst lines = str.match(regex)\n\tconst result: SyntaxData[] = []\n\n\tif (!lines) return null\n\tlines.forEach(line => {\n\t\tconst endTagMatches = line.match(/<\\/(.*)>/u)\n\t\tif (endTagMatches) {\n\t\t\tconst endingTagName = endTagMatches[1]\n\t\t\tif (endingTagName && seen.pop() === endingTagName) {\n\t\t\t\tlevel--\n\t\t\t\tresult.push({ type: \"end\", name: endingTagName, attributes: {}, level })\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tconst tokenStr = line.replace(\"<\", \"\").replace(\">\", \"\")\n\t\tif (!tokenStr) return\n\t\tconst isSelfClosingTag = tokenStr.endsWith(\"/\")\n\t\tconst tokens = /([a-z]*)\\s*?(.*)/iu.exec(tokenStr)\n\t\tif (!tokens) return\n\t\tconst [, tagName, rest] = tokens\n\n\t\tconst attributes = {}\n\t\tif (rest) {\n\t\t\tconst reg = /[^=\\s]*=\"[^\"]*\"/g\n\t\t\tconst pairs = rest.match(reg)\n\t\t\tif (!pairs) return\n\t\t\tpairs.forEach(pair => {\n\t\t\t\tconst keyValuePair = getKeyValueFromAttributeString(pair)\n\t\t\t\tconst [key, value] = keyValuePair\n\n\t\t\t\tif (type === SVGExportType.JSX) {\n\t\t\t\t\tconst newKey = svgAttrToCamelCase(key)\n\t\t\t\t\tattributes[newKey] = value\n\t\t\t\t} else {\n\t\t\t\t\tattributes[key] = value\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\tresult.push({ type: \"start\", name: tagName, attributes, level })\n\n\t\tif (isSelfClosingTag) {\n\t\t\tresult.push({ type: \"end\", name: tagName, attributes: {}, level })\n\t\t} else {\n\t\t\tseen.push(tagName)\n\t\t\tlevel++\n\t\t}\n\t})\n\treturn result\n}\n\nconst wrapSVGInReact = (name: string, svg: React.ReactElement[]): React.ReactElement => {\n\tname = safeComponentName(name)\n\tname = name.replace(/_/gu, \"\")\n\tconst indentation = \" \".repeat(2)\n\treturn (\n\t\t<>\n\t\t\t<span className={Syntax.Punctuation}>\n\t\t\t\t<span className={Syntax.Keyword}>export </span>\n\t\t\t\t<span className={Syntax.Storage}>function</span> <span className={Syntax.Class}>{name}</span>() {`{`}\n\t\t\t</span>\n\t\t\t{\"\\n\"}\n\t\t\t{indentation}\n\t\t\t<span className={Syntax.Punctuation}>\n\t\t\t\t<span className={Syntax.Keyword}>return</span> (\n\t\t\t</span>\n\t\t\t{\"\\n\"}\n\t\t\t{svg}\n\t\t\t{\"\\n\"}\n\t\t\t{indentation}\n\t\t\t<span className={Syntax.Punctuation}>)</span>\n\t\t\t{\"\\n\"}\n\t\t\t<span className={Syntax.Punctuation}>{`}`}</span>\n\t\t</>\n\t)\n}\n\nconst wrapSVGInComment = (name: string, svg: React.ReactElement[]) => {\n\treturn (\n\t\t<>\n\t\t\t<span className={Syntax.Comment}>{`<!-- ${name} -->`}</span>\n\t\t\t{\"\\n\"}\n\t\t\t{svg}\n\t\t</>\n\t)\n}\n\nconst getKeyValueFromAttributeString = (str: string) => {\n\tconst [key, value] = str.split(\"=\")\n\treturn [key, value] as const\n}\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport { isHocDefinition } from \"@framerjs/framer-runtime\"\nimport { Button, IconEffect, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, List, isEmptyObject, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { Panel } from \"document/components/chrome/properties/panels/Panel.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { CodeOverride, WithCodeOverridesExperiment } from \"document/models/CanvasTree/traits/WithCodeOverrides.ts\"\nimport { withCodeOverridesExperiment } from \"document/models/CanvasTree/traits/WithCodeOverrides.ts\"\nimport type { ReducedCodeOverrides } from \"document/models/CanvasTree/traits/utils/reduceCodeOverrides.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProp, getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport { getReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { CodeFileCreationType } from \"document/stores/ModalStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useRef } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { getOriginalNodes } from \"utils/getOriginalNodes.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { spanAllColumns } from \"../utils/FormContainerPanel.styles.ts\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ninterface Props extends Omit<ReducedCodeOverrides, \"onlyNodesWithCodeOverrides\"> {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\tscopeType: ScopeType\n}\n\nexport const CodeOverridesPanel = React.memo(function CodeOverridesPanel({\n\tnodeIds,\n\treadOnly,\n\tcodeOverrides,\n\tscopeType,\n}: Props) {\n\tconst codeOverridesRef = useRef(codeOverrides)\n\n\tcodeOverridesRef.current = codeOverrides\n\n\tconst updateNodesWithCodeOverrides = useEngineCallback(\n\t\t(update: WithCodeOverridesExperiment) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withCodeOverridesExperiment)\n\t\t\tconst originalNodes = getOriginalNodes(engine.tree, nodes)\n\t\t\toriginalNodes.forEach(node => node.set(update))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeOverride = useEngineCallback(\n\t\t(index: number) => {\n\t\t\tif (!codeOverridesRef.current) return\n\n\t\t\tlet nodeOverrides: readonly CodeOverride[] | undefined = List.remove(codeOverridesRef.current, index)\n\t\t\tif (nodeOverrides.length === 0) nodeOverrides = undefined\n\n\t\t\tupdateNodesWithCodeOverrides({ codeOverrides: nodeOverrides })\n\t\t},\n\t\t[updateNodesWithCodeOverrides],\n\t)\n\n\tconst localPackage = engine.componentLoader.localPackageIdentifier()\n\n\tconst addOverride = useEngineCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (readOnly) return\n\n\t\t\tconst usedOverrideIdentifiers = new Set(codeOverridesRef.current?.map(({ identifier }) => identifier))\n\t\t\tconst availableOverrides = new Set<ModuleExportIdentifierString>()\n\t\t\tconst idToName = new Map<string, string>()\n\n\t\t\tfor (const component of engine.componentLoader.getAllEntities()) {\n\t\t\t\tif (!isHocDefinition(component)) continue\n\t\t\t\tif (isEmptyObject(component.properties)) continue\n\n\t\t\t\tconst moduleIdentifier = parseModuleIdentifier(component.identifier)\n\t\t\t\tif (!moduleIdentifier) continue\n\t\t\t\tif (moduleIdentifier.kind !== \"externalModuleExport\" && moduleIdentifier.kind !== \"localModuleExport\") {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tidToName.set(component.identifier, component.name)\n\n\t\t\t\tif (usedOverrideIdentifiers.has(moduleIdentifier.value)) continue\n\n\t\t\t\tavailableOverrides.add(moduleIdentifier.value)\n\t\t\t}\n\n\t\t\tconst location = { x: event.clientX, y: event.clientY + 14 }\n\t\t\tconst menu: MenuItemOptions[] = []\n\t\t\tconst existingOverrides = codeOverridesRef.current ?? []\n\n\t\t\tfor (const identifier of availableOverrides) {\n\t\t\t\tconst label = idToName.get(identifier)\n\n\t\t\t\tmenu.push({\n\t\t\t\t\tlabel,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tupdateNodesWithCodeOverrides({\n\t\t\t\t\t\t\tcodeOverrides: [\n\t\t\t\t\t\t\t\t...existingOverrides,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\t\t\tidentifier,\n\t\t\t\t\t\t\t\t\tcontrols: {},\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\tmenu.push({ type: \"separator\" })\n\t\t\tmenu.push({\n\t\t\t\tlabel: \"Add Override\",\n\t\t\t\tclick: async () => {\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.CodeFileCreation,\n\t\t\t\t\t\tsource: \"main_menu\",\n\t\t\t\t\t\tcreationType: CodeFileCreationType.Override,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tengine.stores.contextMenuStore.show(menu, { location })\n\t\t},\n\t\t[readOnly, localPackage, updateNodesWithCodeOverrides],\n\t)\n\n\tconst updateOverrideControls = (id: string) => {\n\t\treturn (controlKey: string, getUpdate: (current: ControlProp) => ControlProp) => {\n\t\t\tif (!codeOverridesRef.current) return\n\t\t\tconst index = codeOverridesRef.current.findIndex(o => o.id === id)\n\t\t\tconst targetOverride = codeOverridesRef.current[index]\n\t\t\tassert(targetOverride)\n\n\t\t\tconst controls = engine.componentLoader.componentForIdentifier(targetOverride.identifier)?.properties\n\t\t\tassert(controls)\n\t\t\tconst control = controls[controlKey]\n\t\t\tassert(control)\n\n\t\t\tconst currentControlProp = getControlProp(control, targetOverride.controls[controlKey])\n\t\t\tassert(currentControlProp)\n\t\t\tconst controlProp = getUpdate(currentControlProp)\n\n\t\t\tconst override = {\n\t\t\t\t...targetOverride,\n\t\t\t\tcontrols: {\n\t\t\t\t\t...targetOverride.controls,\n\t\t\t\t\t[controlKey]: controlProp,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tconst newOverrides = [...codeOverridesRef.current]\n\t\t\tnewOverrides[index] = override\n\t\t\tupdateNodesWithCodeOverrides({ codeOverrides: newOverrides })\n\t\t}\n\t}\n\n\tconst updateOverrideImage = (id: string) => {\n\t\tconst updateControl = updateOverrideControls(id)\n\t\treturn async (upload: Promise<AssetReference | null>, prop: string) => {\n\t\t\tconst reference = await upload\n\t\t\tif (!reference) return\n\t\t\tupdateControl(prop, () => ({ type: ControlType.Image, value: reference }))\n\t\t}\n\t}\n\n\tconst reorderOverrides = useEngineCallback(\n\t\t(from: number, to: number) => {\n\t\t\tif (!codeOverridesRef.current) return\n\n\t\t\tupdateNodesWithCodeOverrides({ codeOverrides: List.move(codeOverridesRef.current, from, to) })\n\t\t},\n\t\t[updateNodesWithCodeOverrides],\n\t)\n\n\tconst overrideTitles = useDeprecatedEngineState(\n\t\tEngineChange.ActiveBundle,\n\t\t() => {\n\t\t\tif (!codeOverrides) return {}\n\n\t\t\tconst overrideTitles: Record<string, string> = {}\n\t\t\tfor (const definition of engine.componentLoader.getAllEntities()) {\n\t\t\t\toverrideTitles[definition.identifier] = definition.name\n\t\t\t}\n\t\t\treturn overrideTitles\n\t\t},\n\t\t[codeOverrides],\n\t)\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title={<T>Overrides</T>} onClick={addOverride} clickable={!readOnly}>\n\t\t\t\t\t<PanelSectionHeaderButton onClick={addOverride}>\n\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{codeOverrides && (\n\t\t\t\t<Sortable items={codeOverrides} removeItem={removeOverride} moveItem={reorderOverrides} keyForItem={getId}>\n\t\t\t\t\t{({ item, index }) => {\n\t\t\t\t\t\tconst name = overrideTitles[item.identifier] ?? Dictionary.Unknown\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PanelRow withReorderControl reorderColumnCount={1}>\n\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t<CodeOverridePopout\n\t\t\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\t\t\tidentifier={item.identifier}\n\t\t\t\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\t\t\t\toverride={item}\n\t\t\t\t\t\t\t\t\t\t\tonChange={updateOverrideControls(item.id)}\n\t\t\t\t\t\t\t\t\t\t\tonImageUpload={updateOverrideImage(item.id)}\n\t\t\t\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tnavigationTitle={name}\n\t\t\t\t\t\t\t\t\ttitle={name}\n\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\tdoubleColumn={false}\n\t\t\t\t\t\t\t\t\tonDelete={() => removeOverride(index)}\n\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t\t\t<IconEffect />\n\t\t\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\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</PanelRow>\n\t\t\t\t\t\t)\n\t\t\t\t\t}}\n\t\t\t\t</Sortable>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n\ninterface PopoutProps {\n\tnodeIds: NodeID[]\n\tidentifier: string\n\toverride: CodeOverride\n\tscopeType: ScopeType\n\tonChange: (controlKey: string, getUpdate: (current: ControlProp) => ControlProp) => void\n\tonImageUpload: (value: Promise<AssetReference | null>, prop: string) => void\n}\n\nfunction CodeOverridePopout(props: PopoutProps) {\n\tconst { identifier, override, nodeIds, onChange, onImageUpload, scopeType } = props\n\n\tconst controls = useDeprecatedEngineState(\n\t\tEngineChange.ActiveBundle,\n\t\t() => {\n\t\t\tconst def = engine.componentLoader.componentForIdentifier(identifier)\n\t\t\treturn def?.properties\n\t\t},\n\t\t[identifier],\n\t)\n\n\tif (!controls) return null\n\n\tconst rows: JSX.Element[] = []\n\n\tconst controlProps = getControlProps(controls, override.controls)\n\tconst reducedControlProps = getReducedControlProps(controls, [controlProps])\n\n\tfor (const controlKey in reducedControlProps) {\n\t\tconst control = controls[controlKey]\n\t\tassert(control)\n\t\tconst reducedControlProp = reducedControlProps[controlKey]\n\t\tassert(reducedControlProp)\n\n\t\trows.push(\n\t\t\t<ControlPropRow\n\t\t\t\tkey={identifier}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tcontrol={control}\n\t\t\t\tonChange={onChange}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tcontrolKey={controlKey}\n\t\t\t\tonImageUpload={onImageUpload}\n\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\thiddenControlsByNodeId={undefined}\n\t\t\t\tcontrolSourceIdentifier={identifier}\n\t\t\t/>,\n\t\t)\n\t}\n\n\tfunction edit() {\n\t\tconst definition = engine.componentLoader.componentForIdentifier(identifier)\n\t\tif (!definition) return\n\t\tengine.stores.codeEditorStore.editFile(definition.file)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t{rows}\n\t\t\t<PanelRow>\n\t\t\t\t<Button id=\"edit-code-button\" title=\"Edit Code\" enabled onClick={edit} style={buttonStyle} />\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\nconst buttonStyle: React.CSSProperties = {\n\t...spanAllColumns,\n\tpadding: \"0 0.6em\",\n}\n", "import { Translatable as T, useReadOnly } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { CustomCursorType, withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedCursor } from \"document/models/CanvasTree/traits/utils/reduceCursor.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport {\n\tcanReadClipboardWithoutPromptingUser,\n\tclipboardReadType,\n\tisClipboardSupported,\n} from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { CursorRow } from \"../rows/CursorRow.tsx\"\nimport { CustomCursorRow } from \"../rows/CustomCursorRow.tsx\"\nimport { CustomCursorVariantRow } from \"../rows/CustomCursorVariantRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport {\n\tbuildCursorPanelMenu,\n\tscopeSupportsCustomCursorVariants,\n\tscopeSupportsCustomCursors,\n} from \"./utils/buildCursorPanelMenu.ts\"\n\nasync function canPaste(tree: CanvasTree, selection: NodeID[]) {\n\t// In Safari we cannot access the clipboard on right-click, that's why we assume the\n\t// happy flow here, and enable pasting even if we cannot read the clipboard.\n\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\tconst values = await clipboardReadType(\"application/x-framer-cursors\")\n\tif (!isObject(values)) return false\n\n\t// All nodes in the selection must support the WithCursor trait in order to\n\t// allow pasting.\n\treturn selection.every(id => {\n\t\tconst node = tree.get(id)\n\t\treturn node ? withCursor(node) : true\n\t})\n}\n\ninterface Props extends Omit<ReducedCursor, \"onlyNodesWithCursor\"> {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tonlyGroundNodes: boolean\n\tscopeType: ScopeType\n}\n\nexport const CursorPanel = React.memo(function CursorPanel({\n\tnodeIds,\n\tscopeId,\n\tonlyGroundNodes,\n\tcursor,\n\tscopeType,\n\tcustomCursorVariant,\n\tcustomCursorType,\n\tcustomCursorSmartComponentId,\n\tcustomCursorFollow,\n\tcustomCursorOffsetX,\n\tcustomCursorOffsetY,\n\tcustomCursorTransitionEnabled,\n\tcustomCursorTransition,\n\tcustomCursorPlacement,\n\tcustomCursorAlignment,\n}: Props) {\n\tconst readonly = useReadOnly()\n\n\tconst showMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (readonly || event.button === 2) return\n\n\t\t\tconst template = buildCursorPanelMenu({\n\t\t\t\tnodeIds,\n\t\t\t\tcustomCursorType,\n\t\t\t\tonlyGroundNodes,\n\t\t\t\tscopeType,\n\t\t\t\tcursor,\n\t\t\t})\n\t\t\tengine.stores.contextMenuStore.show(template, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[readonly, nodeIds, customCursorType, onlyGroundNodes, scopeType, cursor],\n\t)\n\n\tconst onContextMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (readonly || !isClipboardSupported()) return\n\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withCursor)\n\t\t\tconst singleNode = nodes[0]\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Copy\",\n\t\t\t\t\t\tclick: async () => singleNode && Clipboard.copyCursors(singleNode),\n\t\t\t\t\t\tenabled: singleNode && nodes.length === 1,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Paste\",\n\t\t\t\t\t\tclick: async () => Clipboard.pasteCursors(engine, nodeIds),\n\t\t\t\t\t\tenabled: await canPaste(engine.tree, nodeIds),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[nodeIds, readonly],\n\t)\n\n\tconst addCursor = useEngineCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (readonly || event.button === 2) return\n\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\tnode.set({ cursor: \"pointer\" })\n\t\t\t\trecord(\"css_cursor_create\", {})\n\t\t\t}\n\t\t},\n\t\t[nodeIds, readonly],\n\t)\n\n\tconst hasCursor = !isNotFound(cursor) && !isUndefined(cursor)\n\tconst scopeWithCursors = scopeSupportsCustomCursors(scopeType)\n\tconst hasCustomCursor =\n\t\tscopeWithCursors && (isVariableReference(customCursorType) || customCursorType === CustomCursorType.Component)\n\tconst hasCustomCursorVariant =\n\t\tscopeSupportsCustomCursorVariants(scopeType) && customCursorType === CustomCursorType.Variant\n\n\tconst hasAnyCustomCursor = hasCustomCursor || hasCustomCursorVariant\n\tconst showPlusButton = scopeWithCursors ? !hasAnyCustomCursor || !hasCursor : !hasCursor\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Cursor</T>}\n\t\t\t\t\tclickable={showPlusButton && !readonly}\n\t\t\t\t\tonMouseDown={showPlusButton ? (scopeWithCursors ? showMenu : addCursor) : undefined}\n\t\t\t\t\tonContextMenu={scopeWithCursors ? onContextMenu : addCursor}\n\t\t\t\t>\n\t\t\t\t\t{showPlusButton && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{hasCursor && <CursorRow nodeIds={nodeIds} cursor={cursor} />}\n\t\t\t{hasCustomCursor && (\n\t\t\t\t<CustomCursorRow\n\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tcustomCursorType={customCursorType}\n\t\t\t\t\tcustomCursorVariant={customCursorVariant}\n\t\t\t\t\tcustomCursorSmartComponentId={customCursorSmartComponentId}\n\t\t\t\t\tcustomCursorFollow={customCursorFollow}\n\t\t\t\t\tcustomCursorOffsetX={customCursorOffsetX}\n\t\t\t\t\tcustomCursorOffsetY={customCursorOffsetY}\n\t\t\t\t\tcustomCursorTransitionEnabled={customCursorTransitionEnabled}\n\t\t\t\t\tcustomCursorTransition={customCursorTransition}\n\t\t\t\t\tcustomCursorPlacement={customCursorPlacement}\n\t\t\t\t\tcustomCursorAlignment={customCursorAlignment}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{hasCustomCursorVariant && (\n\t\t\t\t<CustomCursorVariantRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tcustomCursorVariant={customCursorVariant}\n\t\t\t\t\tcustomCursorSmartComponentId={customCursorSmartComponentId}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport type { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst objectToString = Object.prototype.toString;\n\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isError(wat: unknown): wat is Error {\n  switch (objectToString.call(wat)) {\n    case '[object Error]':\n    case '[object Exception]':\n    case '[object DOMException]':\n      return true;\n    default:\n      return isInstanceOf(wat, Error);\n  }\n}\n/**\n * Checks whether given value is an instance of the given built-in class.\n *\n * @param wat The value to be checked\n * @param className\n * @returns A boolean representing the result.\n */\nfunction isBuiltin(wat: unknown, className: string): boolean {\n  return objectToString.call(wat) === `[object ${className}]`;\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isErrorEvent(wat: unknown): boolean {\n  return isBuiltin(wat, 'ErrorEvent');\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMError(wat: unknown): boolean {\n  return isBuiltin(wat, 'DOMError');\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMException(wat: unknown): boolean {\n  return isBuiltin(wat, 'DOMException');\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isString(wat: unknown): wat is string {\n  return isBuiltin(wat, 'String');\n}\n\n/**\n * Checks whether given string is parameterized\n * {@link isParameterizedString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isParameterizedString(wat: unknown): wat is ParameterizedString {\n  return (\n    typeof wat === 'object' &&\n    wat !== null &&\n    '__sentry_template_string__' in wat &&\n    '__sentry_template_values__' in wat\n  );\n}\n\n/**\n * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPrimitive(wat: unknown): wat is Primitive {\n  return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal, or a class instance.\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPlainObject(wat: unknown): wat is Record<string, unknown> {\n  return isBuiltin(wat, 'Object');\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isEvent(wat: unknown): wat is PolymorphicEvent {\n  return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isElement(wat: unknown): boolean {\n  return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isRegExp(wat: unknown): wat is RegExp {\n  return isBuiltin(wat, 'RegExp');\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nexport function isThenable(wat: any): wat is PromiseLike<any> {\n  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n  return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isSyntheticEvent(wat: unknown): boolean {\n  return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n\n/**\n * Checks whether given value is NaN\n * {@link isNaN}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isNaN(wat: unknown): boolean {\n  return typeof wat === 'number' && wat !== wat;\n}\n\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nexport function isInstanceOf(wat: any, base: any): boolean {\n  try {\n    return wat instanceof base;\n  } catch (_e) {\n    return false;\n  }\n}\n\ninterface VueViewModel {\n  // Vue3\n  __isVue?: boolean;\n  // Vue2\n  _isVue?: boolean;\n}\n/**\n * Checks whether given value's type is a Vue ViewModel.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isVueViewModel(wat: unknown): boolean {\n  // Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.\n  return !!(typeof wat === 'object' && wat !== null && ((wat as VueViewModel).__isVue || (wat as VueViewModel)._isVue));\n}\n", "import type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport {\n\tComboBox,\n\tIconComponentSmall,\n\tNumberInputWithTicker,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { isString } from \"@sentry/utils\"\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 { isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { CustomCursor, WithCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport {\n\tCustomCursorType,\n\tDEFAULT_CURSOR_OFFSET,\n\tcursorDefaults,\n\textractCustomCursorProperties,\n\twithCursor,\n} from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { FloatingPlacement } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { maintainRelativeOffset } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedCursor } from \"document/models/CanvasTree/traits/utils/reduceCursor.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { TransitionPopoutButton } from \"../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { useSmartComponentVariants } from \"./EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { FloatingAlignmentRow } from \"./FloatingAlignmentRow.tsx\"\nimport { FloatingPlacementRow } from \"./FloatingPlacementRow.tsx\"\nimport type { PanelRowAPI } from \"./PanelRow.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\nimport { useCopyPasteCustomCursor } from \"./utils/useCopyPasteCustomCursor.ts\"\n\nconst hideTransitionTypeControl: Transition[\"type\"][] = []\n\nexport type CustomCursorChangeHandler = (\n\tgetUpdate: (current: CustomCursor | undefined) => CustomCursor | undefined,\n) => void\n\nconst useCustomCursorCallback = <T extends keyof WithCursor>(key: T, onChange: CustomCursorChangeHandler) => {\n\treturn React.useCallback(\n\t\t(value: WithCursor[T]) =>\n\t\t\tonChange((cursor = cursorDefaults) => {\n\t\t\t\treturn { ...cursor, [key]: value }\n\t\t\t}),\n\t\t[onChange, key],\n\t)\n}\n\nfunction sortByTitle(a: ComboBoxListItem, b: ComboBoxListItem) {\n\tif (isUndefined(a.title)) return -1\n\tif (isUndefined(b.title)) return -1\n\treturn a.title.localeCompare(b.title, undefined, { numeric: true })\n}\n\nfunction useCursorComponentOptions(selectedId: Reduced<NodeID> | undefined) {\n\treturn useDeprecatedEngineState(\n\t\t[EngineChange.Tree],\n\t\t() => {\n\t\t\tconst items: ComboBoxListItem[] = []\n\t\t\tconst selected = isString(selectedId) ? engine.tree.get(selectedId)?.resolveValue(\"name\") : undefined\n\n\t\t\tfor (let index = 0; index < engine.tree.root.children.length; index++) {\n\t\t\t\tconst node = engine.tree.root.children.at(index)\n\t\t\t\tif (!isSmartComponentNode(node)) continue\n\n\t\t\t\titems.push({\n\t\t\t\t\ttype: \"option\",\n\t\t\t\t\tvalue: node.id,\n\t\t\t\t\ttitle: node.resolveValue(\"name\") ?? Dictionary.Component,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tcomponents: items.sort(sortByTitle),\n\t\t\t\tvalue: selected ?? undefined,\n\t\t\t}\n\t\t},\n\t\t[],\n\t\ttrue,\n\t)\n}\n\ninterface Props extends Omit<ReducedCursor, \"cursor\" | \"customCursorSmartComponentId\" | \"onlyNodesWithCursor\"> {\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\tscopeId: NodeID\n\tcustomCursorSmartComponentId: Reduced<NodeID> | undefined\n}\n\nexport const CustomCursorPopout = React.memo(function CursorPopout({\n\tcustomCursorFollow,\n\tcustomCursorOffsetX,\n\tcustomCursorOffsetY,\n\tcustomCursorSmartComponentId,\n\tcustomCursorVariant,\n\tcustomCursorAlignment,\n\tcustomCursorPlacement,\n\tcustomCursorTransition,\n\tcustomCursorTransitionEnabled,\n\tonChange,\n}: Omit<Props, \"nodeIds\"> & { onChange: CustomCursorChangeHandler }) {\n\tconst onSelectCursorBehavior = useCustomCursorCallback(\"customCursorFollow\", onChange)\n\tconst onChangeOffsetX = useCustomCursorCallback(\"customCursorOffsetX\", onChange)\n\tconst onChangeOffsetY = useCustomCursorCallback(\"customCursorOffsetY\", onChange)\n\tconst toggleTransition = useCustomCursorCallback(\"customCursorTransitionEnabled\", onChange)\n\tconst handleTransition = useCustomCursorCallback(\"customCursorTransition\", onChange)\n\tconst handleAlignment = useCustomCursorCallback(\"customCursorAlignment\", onChange)\n\tconst handleChangeVariant = useCustomCursorCallback(\"customCursorVariant\", onChange)\n\n\tconst handleInstance = React.useCallback(\n\t\t(id: NodeID) => {\n\t\t\tonChange((currentValue = cursorDefaults) => {\n\t\t\t\tconst smartComponent = engine.tree.get(id)\n\t\t\t\tif (!isSmartComponentNode(smartComponent)) return currentValue\n\n\t\t\t\t// Regenerate if it has display: contents, to remove the\n\t\t\t\t// display: contents div.\n\t\t\t\tconst component = engine.componentLoader.componentForIdentifier(smartComponent.instanceIdentifier)\n\t\t\t\tif (component?.annotations?.framerDisplayContentsDiv !== \"false\") {\n\t\t\t\t\tvoid engine.stores.codeGenerationStore.forceComponentUpdate(smartComponent.id)\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...currentValue,\n\t\t\t\t\tcustomCursorType: CustomCursorType.Component,\n\t\t\t\t\tcustomCursorSmartComponentId: id,\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst handlePlacement = React.useCallback(\n\t\t(placement: FloatingPlacement) => {\n\t\t\tonChange((cursor = cursorDefaults) => {\n\t\t\t\tconst currentX = cursor.customCursorOffsetX ?? DEFAULT_CURSOR_OFFSET\n\t\t\t\tconst currentY = cursor.customCursorOffsetY ?? DEFAULT_CURSOR_OFFSET\n\n\t\t\t\tconst { x = currentX, y = currentY } = maintainRelativeOffset(cursor.customCursorPlacement, placement, {\n\t\t\t\t\tx: currentX,\n\t\t\t\t\ty: currentY,\n\t\t\t\t})\n\n\t\t\t\treturn {\n\t\t\t\t\t...cursor,\n\t\t\t\t\tcustomCursorPlacement: placement,\n\t\t\t\t\tcustomCursorOffsetX: x,\n\t\t\t\t\tcustomCursorOffsetY: y,\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst { components, value } = useCursorComponentOptions(customCursorSmartComponentId)\n\tconst topLevelVariants = useSmartComponentVariants(customCursorSmartComponentId)\n\tconst hasCustomCursor = isString(customCursorSmartComponentId)\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.panelPadding}>\n\t\t\t<PanelRow title=\"Component\">\n\t\t\t\t<ComboBox\n\t\t\t\t\trightChevron\n\t\t\t\t\tconstantChange\n\t\t\t\t\tautoCompleteEnabled\n\t\t\t\t\titems={components}\n\t\t\t\t\tvalue={value ?? \"\"}\n\t\t\t\t\tplaceholder=\"Component\u2026\"\n\t\t\t\t\tonChange={handleInstance}\n\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\talignSelf=\"end\"\n\t\t\t\t\topenOnFocus={false}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t{hasCustomCursor && topLevelVariants.length > 1 && (\n\t\t\t\t<PanelRow title=\"Variant\">\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={customCursorVariant}\n\t\t\t\t\t\tonSelect={handleChangeVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t<PanelRow title=\"Cursor\">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle=\"Follow\"\n\t\t\t\t\t\tselected={customCursorFollow === true}\n\t\t\t\t\t\tonSelect={onSelectCursorBehavior}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"Replace\"\n\t\t\t\t\t\tselected={customCursorFollow === false}\n\t\t\t\t\t\tonSelect={onSelectCursorBehavior}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{hasCustomCursor && (\n\t\t\t\t<>\n\t\t\t\t\t{customCursorFollow && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<FloatingPlacementRow floatingPlacement={customCursorPlacement} onChange={handlePlacement} />\n\t\t\t\t\t\t\t<FloatingAlignmentRow\n\t\t\t\t\t\t\t\tfloatingPlacement={customCursorPlacement}\n\t\t\t\t\t\t\t\tfloatingAlignment={customCursorAlignment}\n\t\t\t\t\t\t\t\tonChange={handleAlignment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PanelRow title=\"Offset\">\n\t\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\t\tvalue={notFoundToUndefined(customCursorOffsetX) ?? DEFAULT_CURSOR_OFFSET}\n\t\t\t\t\t\t\t\t\tdefaultValue={DEFAULT_CURSOR_OFFSET}\n\t\t\t\t\t\t\t\t\tonChange={onChangeOffsetX}\n\t\t\t\t\t\t\t\t\tlabelShort=\"X\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\t\tvalue={notFoundToUndefined(customCursorOffsetY) ?? DEFAULT_CURSOR_OFFSET}\n\t\t\t\t\t\t\t\t\tdefaultValue={DEFAULT_CURSOR_OFFSET}\n\t\t\t\t\t\t\t\t\tonChange={onChangeOffsetY}\n\t\t\t\t\t\t\t\t\tlabelShort=\"Y\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<PanelRow title=\"Transition\">\n\t\t\t\t\t\t{customCursorTransitionEnabled === true ? (\n\t\t\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\t\t\ttitle=\"Transition\"\n\t\t\t\t\t\t\t\ttransition={customCursorTransition}\n\t\t\t\t\t\t\t\tonChange={handleTransition}\n\t\t\t\t\t\t\t\tonDelete={() => toggleTransition(false)}\n\t\t\t\t\t\t\t\tshowType={hideTransitionTypeControl}\n\t\t\t\t\t\t\t\tshowDelay={false}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"spring\" onClick={() => toggleTransition(true)} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n\nexport function getCursorTitle(id: Reduced<NodeID | undefined>) {\n\tif (isNotFound(id) || isUndefined(id)) return Dictionary.Component\n\tif (isMixed(id)) return Dictionary.Mixed\n\n\tconst node = engine.tree.get(id)\n\treturn node?.resolveValue(\"name\") || Dictionary.Component\n}\n\nfunction supportsCustomCursorVariables(scopeType: ScopeType) {\n\treturn scopeType === ScopeType.SmartComponent || scopeType === ScopeType.LayoutTemplate\n}\n\nexport const CUSTOM_CURSOR_COMPONENT_POPOUT_ID = \"custom-cursor-component\"\n\nconst canCopyCustomCursor = (props: Props) => () => {\n\tlet key: keyof Props\n\tfor (key in props) {\n\t\tif (isMixed(props[key])) return false\n\t}\n\treturn true\n}\n\nconst traitTypes = [TraitType.CustomCursor]\n\nexport const CustomCursorRow = React.memo(function CustomCursorRow(props: Props) {\n\tconst { nodeIds, scopeId, scopeType, customCursorSmartComponentId, customCursorType } = props\n\tconst panelRowRef = React.useRef<PanelRowAPI | null>(null)\n\tconst supportsVariables = supportsCustomCursorVariables(scopeType)\n\n\tconst handleDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tnode.set({ customCursorType: undefined })\n\n\t\t\trecord(\"custom_cursor_remove\", { cursorType: \"component\" })\n\n\t\t\t// Walk the descendants and remove any custom cursor variants from\n\t\t\t// them, since they will no longer be valid as they depended on this\n\t\t\t// ancestor.\n\t\t\tfor (const { node: child, skipChildren } of node.walkWithSkipChildren()) {\n\t\t\t\tif (!withCursor(child) || child === node) continue\n\t\t\t\tif (child.customCursorType === CustomCursorType.Component) {\n\t\t\t\t\t// If the component provides it's own custom cursor component,\n\t\t\t\t\t// don't walk it's descendants. They can continue to safely set\n\t\t\t\t\t// the cursor variant of this node.\n\t\t\t\t\tskipChildren()\n\t\t\t\t} else if (child.customCursorType === CustomCursorType.Variant) {\n\t\t\t\t\t// Otherwise disable the cursor variant.\n\t\t\t\t\tchild.set({ customCursorType: undefined })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}, [nodeIds])\n\n\tconst [canPasteCursor, pasteCursor, copyCursor] = useCopyPasteCustomCursor(\n\t\tprops.nodeIds,\n\t\tCustomCursorType.Component,\n\t\tcanCopyCustomCursor(props),\n\t)\n\n\tconst displayVariableAssignmentOptions = useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n\t\tpanelRowRef.current?.displayPrimaryMenu?.(e)\n\t}, [])\n\n\tconst removeVariable = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tnode.set({ customCursorType: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst createVariable = useEngineCallback(() => {\n\t\tif (!supportsVariables) return\n\n\t\tconst variable = createVariableInScope({\n\t\t\ttype: ControlType.CustomCursor,\n\t\t\tengine,\n\t\t\tshowEditor: true,\n\t\t\tname: Dictionary.Cursor,\n\t\t\tinitialValue: undefined,\n\t\t\tscopeId,\n\t\t})\n\n\t\tif (!variable) return\n\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tnode.set({ customCursorType: variable })\n\t\t}\n\t}, [nodeIds, scopeId, supportsVariables])\n\n\tconst selectVariable = useCallback(\n\t\t(variableReference: VariableReference) => {\n\t\t\tif (!supportsVariables) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\tnode.set({ customCursorType: variableReference })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, supportsVariables],\n\t)\n\n\tconst onChange = useEngineCallback(\n\t\t(getUpdate: (current: CustomCursor | undefined) => CustomCursor | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\tconst value = getUpdate(extractCustomCursorProperties(node))\n\t\t\t\tif (value) node.set(value)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst dynamicValue = isVariableReference(customCursorType) ? customCursorType : null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Custom\"\n\t\t\tonDelete={handleDelete}\n\t\t\tonCopy={copyCursor}\n\t\t\tonPaste={pasteCursor}\n\t\t\tcopyEnabled={canCopyCustomCursor(props)}\n\t\t\tpasteEnabled={canPasteCursor}\n\t\t\tvariableType={ControlType.CustomCursor}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeVariable}\n\t\t\tdynamicValue={dynamicValue}\n\t\t\tonSelectVariable={selectVariable}\n\t\t\ttraitTypes={traitTypes}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tpanelRowApiRef={panelRowRef}\n\t\t>\n\t\t\t{isVariableReference(customCursorType) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\tonRemove={removeVariable}\n\t\t\t\t\texpectedType={ControlType.CustomCursor}\n\t\t\t\t\treference={customCursorType}\n\t\t\t\t/>\n\t\t\t) : // Smart Components *only* support variables, not values.\n\t\t\tscopeType === ScopeType.SmartComponent ? (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"customCursor\" onClick={displayVariableAssignmentOptions} />\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={CUSTOM_CURSOR_COMPONENT_POPOUT_ID}\n\t\t\t\t\tpopout={<CustomCursorPopout {...props} onChange={onChange} />}\n\t\t\t\t\tnavigationTitle=\"Cursor\"\n\t\t\t\t\tonDelete={handleDelete}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<IconComponentSmall />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t\ttitle={getCursorTitle(customCursorSmartComponentId)}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import {\n\tIconAlignBottom,\n\tIconAlignCenter,\n\tIconAlignLeft,\n\tIconAlignMiddle,\n\tIconAlignRight,\n\tIconAlignTop,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport type { FloatingAlignment, FloatingPlacement } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isHorizontalPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst alignments: FloatingAlignment[] = [\"start\", \"center\", \"end\"]\n\nfunction alignmentIcon(\n\talignment: FloatingAlignment,\n\tplacement: Set<FloatingPlacement>,\n): React.FunctionComponent | undefined {\n\tconst commonPlacement = commonValue(placement)\n\tif (!isMixed(commonPlacement) && isFound(commonPlacement) && isHorizontalPosition(commonPlacement)) {\n\t\tswitch (alignment) {\n\t\t\tcase \"start\":\n\t\t\t\treturn IconAlignTop\n\t\t\tcase \"center\":\n\t\t\t\treturn IconAlignMiddle\n\t\t\tcase \"end\":\n\t\t\t\treturn IconAlignBottom\n\t\t\tdefault:\n\t\t\t\tassertNever(alignment)\n\t\t}\n\t}\n\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn IconAlignLeft\n\t\tcase \"center\":\n\t\t\treturn IconAlignCenter\n\t\tcase \"end\":\n\t\t\treturn IconAlignRight\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\nexport const FloatingAlignmentRow = React.memo(function FloatingAlignmentRow({\n\tfloatingPlacement,\n\tfloatingAlignment,\n\tonChange,\n}: {\n\tfloatingPlacement: Set<FloatingPlacement>\n\tfloatingAlignment: Reduced<FloatingAlignment | undefined>\n\tonChange: (alignment: FloatingAlignment) => void\n}) {\n\treturn (\n\t\t<PanelRow title=\"Align\">\n\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t{alignments.map(alignment => {\n\t\t\t\t\tconst Icon = alignmentIcon(alignment, floatingPlacement)\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tkey={alignment}\n\t\t\t\t\t\t\tidentifier={alignment}\n\t\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\t\tselected={floatingAlignment === alignment}\n\t\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{Icon && <Icon />}\n\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { FloatingPlacement } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst placements: FloatingPlacement[] = [\"top\", \"right\", \"bottom\", \"left\"]\n\nfunction IconPosition({ placement }: { placement: Set<FloatingPlacement> }) {\n\tconst commonPlacement = commonValue(placement)\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 4 3 C 4 2.448 4.448 2 5 2 L 11 2 C 11.552 2 12 2.448 12 3 L 12 3 C 12 3.552 11.552 4 11 4 L 5 4 C 4.448 4 4 3.552 4 3 Z\"\n\t\t\t\tfill=\"#ffffff\"\n\t\t\t\topacity={commonPlacement === \"top\" ? 1 : 0.4}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 12 5 C 12 4.448 12.448 4 13 4 L 13 4 C 13.552 4 14 4.448 14 5 L 14 11 C 14 11.552 13.552 12 13 12 L 13 12 C 12.448 12 12 11.552 12 11 Z\"\n\t\t\t\tfill=\"#ffffff\"\n\t\t\t\topacity={commonPlacement === \"right\" ? 1 : 0.4}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 4 13 C 4 12.448 4.448 12 5 12 L 11 12 C 11.552 12 12 12.448 12 13 L 12 13 C 12 13.552 11.552 14 11 14 L 5 14 C 4.448 14 4 13.552 4 13 Z\"\n\t\t\t\tfill=\"#ffffff\"\n\t\t\t\topacity={commonPlacement === \"bottom\" ? 1 : 0.4}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 2 5 C 2 4.448 2.448 4 3 4 L 3 4 C 3.552 4 4 4.448 4 5 L 4 11 C 4 11.552 3.552 12 3 12 L 3 12 C 2.448 12 2 11.552 2 11 Z\"\n\t\t\t\tfill=\"#ffffff\"\n\t\t\t\topacity={commonPlacement === \"left\" ? 1 : 0.4}\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport const FloatingPlacementRow = React.memo(function FloatingPositionRow({\n\tfloatingPlacement,\n\tonChange,\n}: {\n\tfloatingPlacement: Set<FloatingPlacement>\n\tonChange: (placement: FloatingPlacement) => void\n}) {\n\treturn (\n\t\t<PanelRow title=\"Position\">\n\t\t\t<PopupButton\n\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<IconPosition placement={floatingPlacement} />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{placements.map((position: FloatingPlacement) => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={position}\n\t\t\t\t\t\tidentifier={position}\n\t\t\t\t\t\ttitle={titleCase(position)}\n\t\t\t\t\t\tselected={floatingPlacement.has(position)}\n\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</PanelRow>\n\t)\n})\n", "import { assertNever, unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { CustomCursorType, withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport React from \"react\"\nimport {\n\tcanReadClipboardWithoutPromptingUser,\n\tclipboardReadType,\n\tisClipboardSupported,\n} from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isObject } from \"utils/typeChecks.ts\"\n\nfunction cursorPropsForType(customCursorType: CustomCursorType, value: Partial<WithCursor>): Partial<WithCursor> {\n\tswitch (customCursorType) {\n\t\tcase CustomCursorType.Variant:\n\t\t\treturn {\n\t\t\t\tcustomCursorType,\n\t\t\t\tcustomCursorVariant: value.customCursorVariant,\n\t\t\t}\n\t\tcase CustomCursorType.Component:\n\t\t\treturn {\n\t\t\t\tcustomCursorType,\n\t\t\t\tcustomCursorVariant: value.customCursorVariant,\n\t\t\t\tcustomCursorFollow: value.customCursorFollow,\n\t\t\t\tcustomCursorOffsetX: value.customCursorOffsetX,\n\t\t\t\tcustomCursorOffsetY: value.customCursorOffsetY,\n\t\t\t\tcustomCursorPlacement: value.customCursorPlacement,\n\t\t\t\tcustomCursorAlignment: value.customCursorAlignment,\n\t\t\t\tcustomCursorTransition: value.customCursorTransition,\n\t\t\t\tcustomCursorTransitionEnabled: value.customCursorTransitionEnabled,\n\t\t\t\tcustomCursorSmartComponentId: value.customCursorSmartComponentId,\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(customCursorType)\n\t}\n}\n\nconst customCursorKey: keyof WithCursor = \"customCursorType\"\n\nconst canPasteCursor = async (type: CustomCursorType) => {\n\tif (!isClipboardSupported()) return false\n\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\tconst cursors = await clipboardReadType(\"application/x-framer-cursors\")\n\tif (!isObject(cursors)) return false\n\treturn customCursorKey in cursors && cursors.customCursorType === type\n}\n\nconst copyCursor = async (type: CustomCursorType, ids: NodeID[], canCopy: () => boolean) => {\n\tconst nodes = engine.tree.getNodesWithTrait(ids, withCursor)\n\tif (nodes.length !== 1 || !canCopy()) return\n\tconst node = nodes[0]\n\tif (!node) return\n\n\tawait Clipboard.copyCursors(cursorPropsForType(type, node))\n}\n\nconst pasteCursor = (type: CustomCursorType, ids: NodeID[]) => {\n\tclipboardReadType(\"application/x-framer-cursors\")\n\t\t.then(cursors => {\n\t\t\tif (!isObject(cursors)) return false\n\t\t\tconst value = cursorPropsForType(type, cursors)\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(ids, withCursor)) node.set(value)\n\t\t})\n\t\t.catch(unhandledError)\n}\n\nexport function useCopyPasteCustomCursor(ids: NodeID[], type: CustomCursorType, canCopy: () => boolean) {\n\treturn React.useMemo(() => {\n\t\treturn [() => canPasteCursor(type), () => pasteCursor(type, ids), () => copyCursor(type, ids, canCopy)] as const\n\t}, [type, ids, canCopy])\n}\n", "import { IconComponentSmall, Stack, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { isString } from \"@sentry/utils\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { CustomCursorType, withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedCursor } from \"document/models/CanvasTree/traits/utils/reduceCursor.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { useSmartComponentVariants } from \"./EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\nimport { useCopyPasteCustomCursor } from \"./utils/useCopyPasteCustomCursor.ts\"\n\nconst useCustomCursorCallback = <T extends keyof WithCursor>(key: T, nodeIds: NodeID[]) => {\n\treturn useEngineCallback(\n\t\t(value: WithCursor[T]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\tnode.set({ [key]: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, key],\n\t)\n}\n\nfunction customCursorSmartComponentTitle(id: Reduced<NodeID | undefined>) {\n\tif (isNotFound(id) || isUndefined(id)) return Dictionary.Component\n\tif (isMixed(id)) return Dictionary.Mixed\n\treturn engine.tree.get(id)?.resolveValue(\"name\") ?? Dictionary.Component\n}\n\nfunction customCursorVariantTitle(id: Reduced<NodeID | undefined>, variant: Set<NodeID | undefined>) {\n\tif (isNotFound(id) || isUndefined(id)) return Dictionary.Variant\n\tif (isMixed(id)) return Dictionary.Mixed\n\n\tconst commonVariant = commonValue(variant)\n\tif (isString(commonVariant)) return engine.tree.get(commonVariant)?.resolveValue(\"name\") ?? Dictionary.Variant\n\tif (isMixed(commonVariant)) return Dictionary.Mixed\n\n\treturn Dictionary.Component\n}\n\ninterface Props extends Pick<ReducedCursor, \"customCursorVariant\" | \"customCursorSmartComponentId\"> {\n\tnodeIds: NodeID[]\n}\n\nconst CustomCursorPopout = React.memo(function CursorPopout({\n\tnodeIds,\n\tcustomCursorVariant,\n\tcomponentId,\n}: Props & { componentId: Reduced<NodeID | undefined> }) {\n\tconst handleChangeVariant = useCustomCursorCallback(\"customCursorVariant\", nodeIds)\n\tconst topLevelVariants = useSmartComponentVariants(componentId)\n\tconst title = customCursorSmartComponentTitle(componentId)\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.panelPadding}>\n\t\t\t<PanelRow title=\"Component\">\n\t\t\t\t<TextInput\n\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\tvalue={title}\n\t\t\t\t\tenabled={false}\n\t\t\t\t\tdisabledIsReadOnly={false}\n\t\t\t\t\treadOnly={true}\n\t\t\t\t\t// This input is used purely for display purposes, so\n\t\t\t\t\t// onChange has no effect.\n\t\t\t\t\tonChange={noop}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Variant\">\n\t\t\t\t<VariantSelector\n\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\tselection={customCursorVariant}\n\t\t\t\t\tonSelect={handleChangeVariant}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n})\n\nexport const CUSTOM_CURSOR_VARIANT_POPOUT_ID = \"custom-cursor-variant\"\n\nconst canCopyCustomCursorVariant = (props: Props) => () => Object.keys(props).every(key => !isMixed(props[key]))\n\nexport const CustomCursorVariantRow = React.memo(function CustomCursorRow(props: Props) {\n\tconst { nodeIds, customCursorVariant, customCursorSmartComponentId } = props\n\n\tconst handleDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tif (node.customCursorType !== CustomCursorType.Variant) continue\n\t\t\tnode.set({ customCursorType: undefined })\n\t\t\trecord(\"custom_cursor_remove\", { cursorType: \"variant\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst [canPasteCursor, pasteCursor, copyCursor] = useCopyPasteCustomCursor(\n\t\tprops.nodeIds,\n\t\tCustomCursorType.Variant,\n\t\tcanCopyCustomCursorVariant(props),\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Variant\"\n\t\t\tonDelete={handleDelete}\n\t\t\tonCopy={copyCursor}\n\t\t\tonPaste={pasteCursor}\n\t\t\tcopyEnabled={canCopyCustomCursorVariant(props)}\n\t\t\tpasteEnabled={canPasteCursor}\n\t\t>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tenabled={isString(customCursorSmartComponentId)}\n\t\t\t\tid={CUSTOM_CURSOR_VARIANT_POPOUT_ID}\n\t\t\t\tpopout={<CustomCursorPopout {...props} componentId={customCursorSmartComponentId} />}\n\t\t\t\tnavigationTitle=\"Variant\"\n\t\t\t\tonDelete={handleDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<IconComponentSmall />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t\ttitle={customCursorVariantTitle(customCursorSmartComponentId, customCursorVariant)}\n\t\t\t\tdisplayDivider\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n})\n", "import type { MenuItemOptions } from \"app/menu.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { CustomCursorType, withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { getAncestorProvidingCursorComponent } from \"document/models/CanvasTree/traits/utils/reduceCursor.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { CURSOR_POPOUT_ID } from \"../../rows/CursorRow.tsx\"\nimport { CUSTOM_CURSOR_COMPONENT_POPOUT_ID } from \"../../rows/CustomCursorRow.tsx\"\nimport { CUSTOM_CURSOR_VARIANT_POPOUT_ID } from \"../../rows/CustomCursorVariantRow.tsx\"\n\n/**\n * We won't have reduced an ancestor custom cursor if the node doesn't have any\n * cursor yet, so we have to determine the value when displaying the menu.\n */\nfunction canAddCustomCursorVariantControl(nodeIds: NodeID[]) {\n\tlet currentCursorSmartComponentId: string | undefined | null = null\n\tfor (const id of nodeIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!node) continue\n\t\tconst nextAncestor = getAncestorProvidingCursorComponent(engine.tree, node)\n\t\tif (currentCursorSmartComponentId === null) {\n\t\t\tcurrentCursorSmartComponentId = nextAncestor?.customCursorSmartComponentId\n\t\t} else if (currentCursorSmartComponentId !== nextAncestor?.customCursorSmartComponentId) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn !!currentCursorSmartComponentId\n}\n\nexport function scopeSupportsCustomCursors(scopeType: ScopeType) {\n\treturn (\n\t\tscopeType === ScopeType.WebPage || scopeType === ScopeType.SmartComponent || scopeType === ScopeType.LayoutTemplate\n\t)\n}\n\nexport function scopeSupportsCustomCursorVariants(scopeType: ScopeType) {\n\treturn scopeType === ScopeType.WebPage || scopeType === ScopeType.LayoutTemplate\n}\n\nexport function buildCursorPanelMenu({\n\tnodeIds,\n\tcustomCursorType,\n\tonlyGroundNodes,\n\tscopeType,\n\tcursor,\n}: {\n\tcustomCursorType: Reduced<CustomCursorType | VariableReference | undefined>\n\tcursor: Reduced<WithCursor[\"cursor\"]> | undefined\n\tnodeIds: NodeID[]\n\tonlyGroundNodes: boolean\n\tscopeType: ScopeType\n}): MenuItemOptions[] {\n\tconst setVariantVisible = !onlyGroundNodes && scopeSupportsCustomCursorVariants(scopeType)\n\tconst hasAnyCustomCursor = !(isNotFound(customCursorType) || isUndefined(customCursorType))\n\n\tconst setVariantEnabled = setVariantVisible && !hasAnyCustomCursor && canAddCustomCursorVariantControl(nodeIds)\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Web Cursor\",\n\t\t\tdescription: \"Pick a default cursor\",\n\t\t\tenabled: isNotFound(cursor) || isUndefined(cursor),\n\t\t\tvisible: true,\n\t\t\tclick: () => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\t\tnode.set({ cursor: \"pointer\" })\n\t\t\t\t}\n\t\t\t\trecord(\"css_cursor_create\", {})\n\t\t\t\tpopoutWindow.navigation.presentPopout(CURSOR_POPOUT_ID)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Custom Cursor\",\n\t\t\tdescription: \"Pick a component\",\n\t\t\tenabled: !hasAnyCustomCursor,\n\t\t\tvisible: scopeSupportsCustomCursors(scopeType),\n\t\t\tclick: () => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\t\tnode.set({ customCursorType: CustomCursorType.Component })\n\t\t\t\t}\n\t\t\t\trecord(\"custom_cursor_create\", { cursorType: \"component\" })\n\t\t\t\tpopoutWindow.navigation.presentPopout(CUSTOM_CURSOR_COMPONENT_POPOUT_ID)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Set Variant\",\n\t\t\tdescription: \"Animate your cursor\",\n\t\t\tenabled: setVariantEnabled,\n\t\t\tvisible: setVariantVisible,\n\t\t\tclick: () => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\t\t\tnode.set({ customCursorType: CustomCursorType.Variant })\n\t\t\t\t}\n\t\t\t\trecord(\"custom_cursor_create\", { cursorType: \"variant\" })\n\t\t\t\tpopoutWindow.navigation.presentPopout(CUSTOM_CURSOR_VARIANT_POPOUT_ID)\n\t\t\t},\n\t\t},\n\t]\n}\n", "import { Stack, Translatable as T, TextArea, TextInput } from \"@framerjs/fresco\"\nimport { assert, isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isCodeComponentNode, isFrameNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Customization, ReducedCustomizations } from \"document/models/CanvasTree/traits/WithCustomizations.ts\"\nimport {\n\tisCustomizable,\n\tisIconContentCustomization,\n\tisTextContentCustomization,\n} from \"document/models/CanvasTree/traits/WithCustomizations.ts\"\nimport { isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isFoundAndNotMixed, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React, { useMemo } from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\ninterface Props extends Omit<\n\tReducedCustomizations,\n\t\"onlyNodesWithCustomizations\" | \"customizationsRules\" | \"customizationsCategory\"\n> {\n\tnodeIds: NodeID[]\n\tanyReplicaVariantOrReplicaVariantChild: boolean\n}\n\nexport const CustomizationsPanel = React.memo(function CustomizationsPanel({\n\tnodeIds,\n\tcustomizationsSectionId,\n\tcustomizationsDescription,\n\tcustomizations,\n}: Props) {\n\tconst sectionConfigProps = useMemo(() => {\n\t\t// Validate that we have a singular section config.\n\t\tif (!isFoundAndNotMixed(customizationsDescription)) return null\n\t\tif (!isFoundAndNotMixed(customizationsSectionId)) return null\n\t\t// Validate that we just have one node selected that is the direct child\n\t\t// of a primary variant ground node.\n\t\tconst nodeId = nodeIds[0]\n\t\tif (!nodeId || nodeIds.length !== 1) return null\n\t\tconst node = engine.tree.get(nodeId)\n\t\tif (!isFrameNode(node) && !isCodeComponentNode(node)) return null\n\t\tif (!isCustomizable(node)) return null\n\t\tconst parent = engine.tree.get(node.parentid)\n\t\tif (!parent) return null\n\t\tif (!isPrimaryVariant(parent)) return null\n\t\t// Return the current section config as props for the config UI.\n\t\treturn {\n\t\t\tnodeId: node.id,\n\t\t\tsectionId: customizationsSectionId,\n\t\t\tdescription: customizationsDescription,\n\t\t} satisfies SectionConfigProps\n\t}, [customizationsDescription, customizationsSectionId, nodeIds])\n\n\tconst contentConfigProps = useMemo(() => {\n\t\t// Validate that we have a singular section config.\n\t\tif (!isFoundAndNotMixed(customizations)) return null\n\t\t// Validate that we just have one node selected that is the direct child\n\t\t// of a primary variant ground node.\n\t\tconst nodeId = nodeIds[0]\n\t\tif (!nodeId || nodeIds.length !== 1) return null\n\n\t\tconst node = engine.tree.get(nodeId)\n\t\tif (!isCustomizable(node)) return null\n\n\t\tif (!isRichTextNode(node) && isCodeComponentNode(node) && !node.isVectorInstance) return null\n\t\tconst parent = engine.tree.get(node.parentid)\n\t\tif (!parent) return null\n\n\t\tconst commonCustomization = commonValue(customizations)\n\t\tif (isMixed(commonCustomization)) return null\n\t\tif (isNotFound(commonCustomization)) {\n\t\t\treturn { nodeId: node.id, customization: undefined } satisfies ContentConfigProps\n\t\t}\n\n\t\tif (!isTextContentCustomization(commonCustomization) && !isIconContentCustomization(commonCustomization)) {\n\t\t\treturn null\n\t\t}\n\t\treturn { nodeId: node.id, customization: commonCustomization } satisfies ContentConfigProps\n\t}, [customizations, nodeIds])\n\n\tif (!sectionConfigProps && !contentConfigProps) return null\n\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title={<T>AI Section</T>} />}>\n\t\t\t{sectionConfigProps && <SectionConfig {...sectionConfigProps} />}\n\t\t\t{contentConfigProps && <ContentConfig {...contentConfigProps} />}\n\t\t</Panel>\n\t)\n})\n\ninterface SectionConfigProps {\n\tnodeId: NodeID\n\tsectionId: string | undefined\n\tdescription: string | undefined\n}\n\nfunction SectionConfig({ nodeId, sectionId, description }: SectionConfigProps) {\n\tfunction setSectionId(value: string, final: boolean) {\n\t\tif (!final) return\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\tassert(isCustomizable(node))\n\t\t\tnode.set({ customizationsSectionId: value || undefined })\n\t\t})\n\t}\n\n\tfunction resetSectionId() {\n\t\tconst node = engine.tree.get(nodeId)\n\t\tassert(isCustomizable(node))\n\t\tnode.set({ customizationsSectionId: undefined })\n\t}\n\n\tfunction setDescription(value: string | undefined, final: boolean) {\n\t\tif (!final) return\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\tassert(isCustomizable(node))\n\t\t\tnode.set({ customizationsDescription: value || undefined })\n\t\t})\n\t}\n\n\tfunction resetDescription() {\n\t\tconst node = engine.tree.get(nodeId)\n\t\tassert(isCustomizable(node))\n\t\tnode.set({ customizationsDescription: undefined })\n\t}\n\n\treturn (\n\t\t<Stack gap={0} padding={0}>\n\t\t\t<PanelRow title=\"Identifier\" onResetToDefault={resetSectionId}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<TextInput value={sectionId ?? \"\"} onChange={setSectionId} placeholder=\"my_section\" />\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Description\" onResetToDefault={resetDescription}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<TextArea value={description ?? \"\"} onChange={setDescription} placeholder=\"A description of the section\" />\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\ninterface ContentConfigProps {\n\tnodeId: NodeID\n\tcustomization: Customization | undefined\n}\n\nfunction ContentConfig({ nodeId, customization }: ContentConfigProps) {\n\tfunction setFieldPath(fieldPath: string, final: boolean, reset: () => void) {\n\t\tif (!final) return\n\t\tif (!fieldPath) {\n\t\t\treset()\n\t\t\treturn\n\t\t}\n\n\t\tsetCustomization(nodeId, { type: \"content\", property: \"textContent\", fieldPath })\n\t}\n\n\tfunction resetFieldPath() {\n\t\tsetCustomization(nodeId, undefined)\n\t}\n\n\treturn (\n\t\t<Stack gap={0} padding={0}>\n\t\t\t<PanelRow title=\"Field Path\" onResetToDefault={resetFieldPath}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<TextInput value={customization?.fieldPath ?? \"\"} onChange={setFieldPath} placeholder=\"myField\" />\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\nfunction setCustomization(nodeId: NodeID, customization: Omit<Customization, \"id\" | \"fieldType\"> | undefined) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst node = engine.tree.get(nodeId)\n\t\tif (!isCustomizable(node)) return\n\n\t\tif (!customization) {\n\t\t\tnode.set({ customizations: undefined })\n\t\t\treturn\n\t\t}\n\n\t\tnode.set({ customizations: [{ ...customization, id: randomID(), fieldType: fieldTypeForNode(node) }] })\n\t})\n}\n\nfunction fieldTypeForNode(node: CanvasNode) {\n\tif (isRichTextNode(node)) {\n\t\treturn \"text\"\n\t} else if (isCodeComponentNode(node) && node.isVectorInstance) {\n\t\treturn \"icon\"\n\t} else {\n\t\tassert(false, \"Unsupported node type\")\n\t}\n}\n", "import { Button, CheckboxRow, NumberInputWithTicker, TextInput } from \"@framerjs/fresco\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport { getCanvasBoundingRectCached } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props {\n\twithoutDescendantIds: NodeID[]\n}\n\nexport const DOMLayoutDebugPanel = ({ withoutDescendantIds: nodeIds }: Props) => {\n\tconst [, forceRender] = React.useState(0)\n\tconst { treeStore, layoutCache } = engine.stores\n\n\tconst selected = treeStore.tree.getNodes(nodeIds)\n\tconst node = selected.length === 1 ? selected[0] : null\n\tif (!node) return null\n\n\tconst layoutRect = layoutCache.getRect(node.id)\n\tconst canvasRect = getCanvasBoundingRectCached(treeStore.tree, node)\n\n\tconst nodeUsesDOMRect = withDOMLayout(node) && node.usesDOMRectCached()\n\n\tconst onLayoutRectXOverride = engine.scheduler.wrapHandler((value: number) => {\n\t\toverrideLayoutRect(selected[0], { x: value })\n\t\tforceRender(v => v + 1)\n\t})\n\tconst onLayoutRectYOverride = engine.scheduler.wrapHandler((value: number) => {\n\t\toverrideLayoutRect(selected[0], { y: value })\n\t\tforceRender(v => v + 1)\n\t})\n\tconst onLayoutRectWidthOverride = engine.scheduler.wrapHandler((value: number) => {\n\t\toverrideLayoutRect(selected[0], { width: value })\n\t\tforceRender(v => v + 1)\n\t})\n\tconst onLayoutRectHeightOverride = engine.scheduler.wrapHandler((value: number) => {\n\t\toverrideLayoutRect(selected[0], { height: value })\n\t\tforceRender(v => v + 1)\n\t})\n\n\tconst onLogNode = async () => {\n\t\tconst measurements = await engine.canvasSandbox?.sandbox.renderer.measureNodes([node.id])\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.log(\"node\", node.id, measurements?.[0]?.layoutMetrics)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{layoutRect && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"DOM Rect\">\n\t\t\t\t\t\t<NumberInputWithTicker label=\"W\" value={String(layoutRect.width)} onChange={onLayoutRectWidthOverride} />\n\t\t\t\t\t\t<NumberInputWithTicker label=\"H\" value={String(layoutRect.height)} onChange={onLayoutRectHeightOverride} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t\t<NumberInputWithTicker label=\"X\" step={0.1} value={String(layoutRect.x)} onChange={onLayoutRectXOverride} />\n\t\t\t\t\t\t<NumberInputWithTicker label=\"Y\" step={0.1} value={String(layoutRect.y)} onChange={onLayoutRectYOverride} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t\t<CheckboxRow title=\"In Use\" value={nodeUsesDOMRect} onChange={() => {}} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{canvasRect && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"Canvas Rect\">\n\t\t\t\t\t\t<NumberInputWithTicker label=\"W\" value={String(canvasRect.width)} onChange={() => {}} />\n\t\t\t\t\t\t<NumberInputWithTicker label=\"H\" value={String(canvasRect.height)} onChange={() => {}} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t\t<NumberInputWithTicker label=\"X\" value={String(canvasRect.x)} onChange={() => {}} />\n\t\t\t\t\t\t<NumberInputWithTicker label=\"Y\" value={String(canvasRect.y)} onChange={() => {}} />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<PanelRow title=\"Node ID\">\n\t\t\t\t<TextInput style={doubleColumn} value={node.id} onChange={() => {}} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\" \">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<Button title=\"Log Node\" onClick={onLogNode} style={{ width: \"100%\" }} />\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction overrideLayoutRect(node: CanvasNode, override: Partial<Rect>) {\n\tconst { layoutCache, treeStore } = engine.stores\n\tconst currentRect = layoutCache.getRect(node.id) || { x: 0, y: 0, width: 0, height: 0 }\n\tconst rectWithOverride: Rect = { ...currentRect, ...override }\n\n\tconst affected: string[] = []\n\tconst domRects = layoutCache.getRects(node.id)\n\tif (domRects) domRects.set(node.id, rectWithOverride)\n\n\taffected.push(node.id)\n\n\tif (node.cache.parentDirected) {\n\t\tconst parent = treeStore.tree.getNode(node.parentid)\n\t\tif (!parent) return\n\n\t\tconst index = parent.children?.findIndex(n => n.id === node.id)\n\t\tconst childrenRects = layoutCache.getChildrenRects(parent.id)\n\t\tif (childrenRects && index !== undefined) {\n\t\t\tchildrenRects[index] = rectWithOverride\n\t\t\taffected.push(parent.id)\n\t\t}\n\t}\n\ttreeStore.syncNodeCacheWithDOMLayout(new Set(affected))\n}\n", "import { Translatable as T, useReadOnly } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tReducedDataLoaderVariants,\n\tWithDataLoaderVariants,\n} from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { withDataLoaderVariants } from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { useSelectedNodeVariants } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ntype DataLoaderVariant = keyof Pick<WithDataLoaderVariants, \"dataLoaderDisabledVariant\" | \"dataLoaderLoadingVariant\">\n\nconst removeDataLoaderVariantUpdate: Record<DataLoaderVariant, Partial<WithDataLoaderVariants>> = {\n\tdataLoaderDisabledVariant: { dataLoaderDisabledVariant: undefined, dataLoaderDisabledVariantEnabled: undefined },\n\tdataLoaderLoadingVariant: { dataLoaderLoadingVariant: undefined, dataLoaderLoadingVariantEnabled: undefined },\n}\n\nfunction useRemoveDataLoaderVariant(nodeIds: NodeID[], dataLoaderVariant: DataLoaderVariant) {\n\treturn useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withDataLoaderVariants)) {\n\t\t\tnode.set(removeDataLoaderVariantUpdate[dataLoaderVariant])\n\t\t}\n\t}, [nodeIds, dataLoaderVariant])\n}\n\nfunction useSetDataLoaderVariant(nodeIds: NodeID[], dataLoaderVariant: DataLoaderVariant) {\n\treturn useEngineCallback(\n\t\t(variant: string) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withDataLoaderVariants)) {\n\t\t\t\tnode.set({ [dataLoaderVariant]: variant })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, dataLoaderVariant],\n\t)\n}\n\ninterface Props extends Omit<ReducedDataLoaderVariants, \"onlyNodesWithDataLoaderVariants\"> {\n\tnodeIds: NodeID[]\n\tcodeComponentIdentifiers: Set<string>\n\tcomponentHash: string\n}\n\nexport const DataLoaderVariantsPanel = React.memo(function DataLoaderVariantsPanel({\n\tnodeIds,\n\tdataLoaderDisabledVariant,\n\tdataLoaderLoadingVariant,\n\tdataLoaderDisabledVariantEnabled,\n\tdataLoaderLoadingVariantEnabled,\n\tcodeComponentIdentifiers,\n\tcomponentHash,\n}: Props) {\n\tconst readonly = useReadOnly()\n\n\tconst showMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Loading\",\n\t\t\t\t\t\tenabled: isNotFound(dataLoaderLoadingVariantEnabled) || isUndefined(dataLoaderLoadingVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withDataLoaderVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ dataLoaderLoadingVariantEnabled: true })\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: \"Hidden\",\n\t\t\t\t\t\tenabled: isNotFound(dataLoaderDisabledVariantEnabled) || isUndefined(dataLoaderDisabledVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withDataLoaderVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ dataLoaderDisabledVariantEnabled: true })\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[dataLoaderDisabledVariantEnabled, dataLoaderLoadingVariantEnabled, nodeIds],\n\t)\n\n\tconst hasAllDataLoaderVariants = dataLoaderDisabledVariantEnabled === true && dataLoaderLoadingVariantEnabled === true\n\n\tconst showPlusButton = !hasAllDataLoaderVariants\n\n\tconst removeLoadingVariant = useRemoveDataLoaderVariant(nodeIds, \"dataLoaderLoadingVariant\")\n\tconst removeDisabledVariant = useRemoveDataLoaderVariant(nodeIds, \"dataLoaderDisabledVariant\")\n\n\tconst setLoadingVariant = useSetDataLoaderVariant(nodeIds, \"dataLoaderLoadingVariant\")\n\tconst setDisabledVariant = useSetDataLoaderVariant(nodeIds, \"dataLoaderDisabledVariant\")\n\n\tconst singleNodeId = nodeIds[0]\n\tconst topLevelVariants = useSelectedNodeVariants({\n\t\tid: singleNodeId,\n\t\tcomponentHash,\n\t\tcodeComponentIdentifiers,\n\t})\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Loading State</T>}\n\t\t\t\t\tclickable={showPlusButton && !readonly}\n\t\t\t\t\tonMouseDown={showPlusButton ? showMenu : undefined}\n\t\t\t\t>\n\t\t\t\t\t{showPlusButton && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{dataLoaderLoadingVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Loading\" onDelete={removeLoadingVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={dataLoaderLoadingVariant}\n\t\t\t\t\t\tonSelect={setLoadingVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{dataLoaderDisabledVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Hidden\" onDelete={removeDisabledVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={dataLoaderDisabledVariant}\n\t\t\t\t\t\tonSelect={setDisabledVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { Button, NumberInputWithTicker } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, 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 {\n\tisArrayRepeater,\n\tisCollectionRepeater,\n\tisDataRepeater,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { withCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport type { HasAnyDataSource } from \"document/models/CanvasTree/traits/WithRepeaterDataSource.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ToastKey } from \"document/utils/ToastKey.ts\"\nimport React from \"react\"\nimport type { RepeaterDataSource } from \"utils/swapDataSource.ts\"\nimport { swapDataSource } from \"utils/swapDataSource.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { RepeaterSourcePopupButton } from \"../inputs/RepeaterSourcePopupButton.tsx\"\nimport { CollectionFiltersRow } from \"../rows/CollectionFiltersRow.tsx\"\nimport { CollectionOrderRow } from \"../rows/CollectionOrderRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { RepeaterCanvasEmptyStateRow } from \"../rows/RepeaterCanvasEmptyStateRow.tsx\"\nimport { RepeaterPaginationRow } from \"../rows/RepeaterPaginationRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { PanelElementId } from \"./utils/highlightPanel.ts\"\n\nconst limitKeys: (keyof WithCollectionOptions)[] = [\"collectionLimit\"]\nconst startOffsetKeys: (keyof WithCollectionOptions)[] = [\"collectionStartOffset\"]\n\nconst defaultCollectionStartOffset = 1\n\nfunction useCollectionOptionsUpdate(nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(update: Partial<WithCollectionOptions>) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withCollectionOptions)\n\t\t\tnodes.forEach(node => node.set(update))\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\ninterface Props extends Omit<WithCollectionOptions, \"collectionRepeatedItemId\" | \"repeatedItemId\"> {\n\trepeaterId: NodeID\n\trepeaterOriginalId: NodeID\n\treadOnly: boolean\n\tdataIdentifier: ModuleExportIdentifierString | undefined\n\tdataRepeaterArray: VariableReference | undefined\n\tanyReplicaOrReplicaChild: boolean\n\tcomponentHash: string\n}\n\nexport const DataRepeaterPanel = React.memo(function DataRepeaterPanel({\n\trepeaterId,\n\trepeaterOriginalId,\n\treadOnly,\n\tdataIdentifier,\n\tdataRepeaterArray,\n\tcollectionLimit,\n\tcollectionFilters,\n\tcollectionFiltersOperator,\n\tcollectionOrder,\n\tcollectionReverse,\n\tcollectionStartOffset,\n\tcollectionPaginationPageSize,\n\tanyReplicaOrReplicaChild,\n}: Props) {\n\tconst hasCollectionSelected = isString(dataIdentifier)\n\n\tconst updateCollectionOptions = useCollectionOptionsUpdate([repeaterId])\n\n\tconst onChangeStartOffset = React.useCallback(\n\t\t(newCollectionStartOffset: number) => updateCollectionOptions({ collectionStartOffset: newCollectionStartOffset }),\n\t\t[updateCollectionOptions],\n\t)\n\tconst onChangeLimit = React.useCallback(\n\t\t(newCollectionLimit: number) => updateCollectionOptions({ collectionLimit: newCollectionLimit }),\n\t\t[updateCollectionOptions],\n\t)\n\tconst clearStartOffset = React.useCallback(\n\t\t() => updateCollectionOptions({ collectionStartOffset: undefined }),\n\t\t[updateCollectionOptions],\n\t)\n\tconst clearLimit = React.useCallback(\n\t\t() => updateCollectionOptions({ collectionLimit: undefined }),\n\t\t[updateCollectionOptions],\n\t)\n\n\tconst undefinedStartOffset = isUndefined(collectionStartOffset)\n\tconst undefinedLimit = isUndefined(collectionLimit)\n\tconst canAddOptions = (undefinedStartOffset || undefinedLimit) && hasCollectionSelected\n\n\tconst displayOptions = (event: React.MouseEvent) => {\n\t\tif (readOnly || !canAddOptions) return\n\t\tconst { contextMenuStore, selectionOutlineTracker, treeStore } = engine.stores\n\t\tcontextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Start Offset\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst node = treeStore.tree.getNodeWithTrait(repeaterId, isCollectionRepeater)\n\t\t\t\t\t\tassert(node, \"Cannot find repeater node\")\n\t\t\t\t\t\tnode.set({ collectionStartOffset: defaultCollectionStartOffset })\n\t\t\t\t\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t\t\t\t\t},\n\t\t\t\t\tvisible: undefinedStartOffset,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Limit\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst node = treeStore.tree.getNodeWithTrait(repeaterId, isCollectionRepeater)\n\t\t\t\t\t\tassert(node, \"Cannot find repeater node\")\n\t\t\t\t\t\tnode.set({ collectionLimit: 3 })\n\t\t\t\t\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t\t\t\t\t},\n\t\t\t\t\tvisible: undefinedLimit,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\tconst updateDataSource = useEngineCallback(\n\t\t(toDataSource: HasAnyDataSource) => {\n\t\t\tif (readOnly || anyReplicaOrReplicaChild) return\n\n\t\t\ttoast({ key: ToastKey.InsertedExternalDataSourceToastKey, type: \"remove\" })\n\n\t\t\tconst node = engine.tree.getNodeWithTrait(repeaterId, isDataRepeater)\n\t\t\tassert(node, \"Cannot find repeater node\")\n\t\t\tassert(!isReplicaOrReplicaChild(node), \"Cannot swap data source of replicas\")\n\n\t\t\tlet fromDataSource: RepeaterDataSource\n\t\t\tif (isCollectionRepeater(node)) {\n\t\t\t\tfromDataSource = { dataIdentifier: node.dataIdentifier }\n\t\t\t} else if (isArrayRepeater(node)) {\n\t\t\t\tfromDataSource = { dataRepeaterArray: node.dataRepeaterArray }\n\t\t\t} else {\n\t\t\t\tassertNever(node, \"All data repeaters should be handled\")\n\t\t\t}\n\n\t\t\tswapDataSource({\n\t\t\t\tengine,\n\t\t\t\tprovider: node,\n\t\t\t\tfromDataSource,\n\t\t\t\ttoDataSource,\n\t\t\t})\n\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\t},\n\t\t[repeaterId, readOnly, anyReplicaOrReplicaChild],\n\t)\n\n\treturn (\n\t\t<Panel\n\t\t\tid={PanelElementId.DataRepeaterPanel}\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={Dictionary.Content}\n\t\t\t\t\tclickable={canAddOptions && !readOnly}\n\t\t\t\t\tonMouseDown={displayOptions}\n\t\t\t\t>\n\t\t\t\t\t{canAddOptions && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t<PanelRow title={Dictionary.Source}>\n\t\t\t\t<RepeaterSourcePopupButton\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\t\tdataRepeaterArray={dataRepeaterArray}\n\t\t\t\t\tenabled={!anyReplicaOrReplicaChild}\n\t\t\t\t\tonChangeDataSource={updateDataSource}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t{anyReplicaOrReplicaChild && <DescriptionRow description=\"Can be selected in the primary variant only.\" />}\n\n\t\t\t<RepeaterCanvasEmptyStateRow repeaterId={repeaterId} />\n\n\t\t\t{hasCollectionSelected && (\n\t\t\t\t<>\n\t\t\t\t\t<CollectionFiltersRow\n\t\t\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\t\t\tfilterData={collectionFilters}\n\t\t\t\t\t\tfiltersOperator={collectionFiltersOperator}\n\t\t\t\t\t\tonChange={updateCollectionOptions}\n\t\t\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t\t\t/>\n\t\t\t\t\t<CollectionOrderRow\n\t\t\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\t\t\torder={collectionOrder}\n\t\t\t\t\t\treverse={collectionReverse}\n\t\t\t\t\t\tonChange={updateCollectionOptions}\n\t\t\t\t\t/>\n\t\t\t\t\t<RepeaterPaginationRow\n\t\t\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t\t\t\tpaginationPageSize={collectionPaginationPageSize}\n\t\t\t\t\t\tonChange={updateCollectionOptions}\n\t\t\t\t\t\tanyReplicaOrReplicaChild={anyReplicaOrReplicaChild}\n\t\t\t\t\t/>\n\t\t\t\t\t{!undefinedStartOffset && (\n\t\t\t\t\t\t<PanelRow title=\"Start at\" traitTypeKeys={startOffsetKeys}>\n\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\t\t\tvalue={collectionStartOffset}\n\t\t\t\t\t\t\t\tdefaultValue={defaultCollectionStartOffset}\n\t\t\t\t\t\t\t\tonChange={onChangeStartOffset}\n\t\t\t\t\t\t\t\tonClear={clearStartOffset}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button enabled={!readOnly} onClick={clearStartOffset}>\n\t\t\t\t\t\t\t\tRemove\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t\t{!undefinedLimit && (\n\t\t\t\t\t\t<PanelRow title=\"Limit to\" traitTypeKeys={limitKeys}>\n\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\t\t\tvalue={collectionLimit}\n\t\t\t\t\t\t\t\tonChange={onChangeLimit}\n\t\t\t\t\t\t\t\tonClear={clearLimit}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button enabled={!readOnly} onClick={clearLimit}>\n\t\t\t\t\t\t\t\tRemove\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { removeEmptySegmentsRecursive } from \"document/components/chrome/Pages/utils/commons.ts\"\nimport { createRouteSegment } from \"document/components/chrome/Pages/utils/createRouteSegment.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"document/components/chrome/Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { getUniquePagePath } from \"document/components/utils/getUniquePagePath.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { AnyWebPageNode, CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableProviderControlMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type {\n\tHasCollectionDataSource,\n\tWithCollectionDataSource,\n} from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\thasCollectionDataSource,\n\twithCollectionDataSource,\n} from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type {\n\tWithAnyDataSource,\n\tWithDataRepeaterArray,\n} from \"document/models/CanvasTree/traits/WithRepeaterDataSource.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { withVariableProvider } from \"document/models/CanvasTree/traits/WithVariableProvider.ts\"\nimport {\n\tcontrolDescriptionFromVariable,\n\tisArrayOfObjectControlDescription,\n\tisArrayVariable,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { EagerVariableProviderMap } from \"document/models/CanvasTree/traits/utils/EagerVariableProviderMap.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { escapeRegExp } from \"modules/rewriteRelativeImports.ts\"\nimport { hasPathVariableShape } from \"utils/pathVariables.ts\"\nimport type { NonUndefinedRecord } from \"./NonUndefined.ts\"\nimport { forEachVariableReferenceOfNode, generateVariableReferenceUpdateForNode } from \"./updateDynamicValues.ts\"\n\nexport type ArrayRepeaterDataSource = NonUndefinedRecord<WithDataRepeaterArray> & { dataIdentifier?: never }\nexport type CollectionRepeaterDataSource = NonUndefinedRecord<WithCollectionDataSource> & { dataRepeaterArray?: never }\nexport type RepeaterDataSource = ArrayRepeaterDataSource | CollectionRepeaterDataSource\n\nfunction getAllCollectionAndArrayControls(engine: VekterEngine): VariableProviderControlMap {\n\tconst allCollectionDataControls = new EagerVariableProviderMap<VerifiedControlDescription>()\n\tconst allSmartComponents = engine.stores.scopeStore.getSmartComponentNodes()\n\n\tengine.componentLoader.getData().forEach(dataDefinition => {\n\t\tfor (const key in dataDefinition.properties) {\n\t\t\tconst control = dataDefinition.properties[key]\n\t\t\tif (!control) continue\n\t\t\tallCollectionDataControls.set(key, control)\n\n\t\t\tif (isArrayOfObjectControlDescription(control)) {\n\t\t\t\tfor (const itemControlKey in control.control.controls) {\n\t\t\t\t\tconst itemControl = control.control.controls[itemControlKey]\n\t\t\t\t\tif (!itemControl) continue\n\t\t\t\t\tallCollectionDataControls.set(itemControlKey, itemControl)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\tfor (const node of allSmartComponents) {\n\t\tconst arrayVariables = node.variables.filter(isArrayVariable)\n\t\tfor (const variable of arrayVariables) {\n\t\t\tconst control = controlDescriptionFromVariable(\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tvariable,\n\t\t\t\tScopeType.SmartComponent,\n\t\t\t)\n\t\t\tif (!control) continue\n\t\t\tallCollectionDataControls.set(variable.id, control)\n\t\t}\n\t}\n\n\treturn allCollectionDataControls\n}\n\ntype VerifiedControlType = VerifiedControlDescription[\"type\"]\n\nfunction controlTypesAreCompatible(controlTypeA: VerifiedControlType, controlTypeB: VerifiedControlType): boolean {\n\tswitch (controlTypeA) {\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\t\treturn controlTypeB === ControlType.Image || controlTypeB === ControlType.ResponsiveImage\n\t\tdefault:\n\t\t\treturn controlTypeA === controlTypeB\n\t}\n}\n\nfunction isVariableProvidedByNode(\n\tvariableReference: VariableReference,\n\tprovider: CanvasNode & WithAnyDataSource,\n): boolean {\n\tif (!variableReference.providerId) return isScopeNode(provider)\n\treturn variableReference.providerId === provider.id\n}\n\nexport function swapDataSourceForWebPage({\n\tengine,\n\twebPageNodeId,\n\ttoDataSource,\n}: {\n\tengine: VekterEngine\n\twebPageNodeId: NodeID\n\ttoDataSource: HasCollectionDataSource\n}) {\n\tconst webPageNode = engine.tree.getNodeWithTrait(webPageNodeId, isWebPageNode)\n\tif (!webPageNode) return\n\n\tconst controlWebPageId = webPageNode.abTestingParentId ?? webPageNode.id\n\tconst controlWebPage = engine.tree.getNodeWithTrait(controlWebPageId, isWebPageNode)\n\tif (!controlWebPage) return\n\n\tconst abVariants = webPageNode.getAbTestingChildren(engine.tree)\n\tconst allVariants = abVariants ? [controlWebPage, ...abVariants] : [controlWebPage]\n\tengine.loadScopesThenProcess(allVariants, loadedNodes => {\n\t\tfor (const provider of loadedNodes) {\n\t\t\tif (!provider || !hasCollectionDataSource(provider)) continue\n\t\t\tconst fromDataSource = { dataIdentifier: provider.dataIdentifier }\n\t\t\tswapDataSource({ engine, provider, fromDataSource, toDataSource })\n\t\t}\n\t})\n}\n\nexport function swapDataSource({\n\tengine,\n\tprovider,\n\tfromDataSource,\n\ttoDataSource,\n}: {\n\tengine: VekterEngine\n\tprovider: CanvasNode & WithAnyDataSource\n\tfromDataSource: RepeaterDataSource\n\ttoDataSource: RepeaterDataSource\n}) {\n\tassert(!isReplicaOrReplicaChild(provider), \"Cannot swap data source of replicas\")\n\n\t// The following should never happen but we can't reproduce the issue and early returning should\n\t// not harm anyone.\n\tif (fromDataSource === toDataSource) return\n\n\tconst toControlMap = getVariableControlMap(engine, toDataSource)\n\n\tif (!toControlMap) return\n\n\t// Get all used variable ids which matches the current provider.\n\tconst unmappedVariableIds = getUsedVariablesForProvider(engine, provider)\n\tconst remappedVariableIds = remapVariableIds(engine, unmappedVariableIds, toControlMap)\n\n\t// Remap variable reference ids\n\tfor (const node of provider.walk()) {\n\t\tconst nodeUpdate = generateVariableReferenceUpdateForNode(engine.tree, node, variableReference => {\n\t\t\t// Only remap variable references which are provided by the current provider\n\t\t\tif (!isVariableProvidedByNode(variableReference, provider)) return\n\n\t\t\t// Only update variable references which id is remapped\n\t\t\tconst updatedId = remappedVariableIds.get(variableReference.id)\n\t\t\tif (!updatedId) return\n\n\t\t\treturn createVariableReference(updatedId, provider.id)\n\t\t})\n\t\tif (nodeUpdate) node.set(nodeUpdate)\n\t}\n\n\t// Update the dataIdentifier before we update the route segments below, to ensure that the path variables are\n\t// handled correctly.\n\tengine.tree.current(provider)?.set({\n\t\tdataIdentifier: toDataSource.dataIdentifier,\n\t\tdataRepeaterArray: toDataSource.dataRepeaterArray,\n\t})\n\n\tconst latestProvider = engine.tree.current(provider)\n\tif (!latestProvider || !withCollectionDataSource(latestProvider)) return\n\n\t// Update page path if it contains a slug\n\t// TODO Check and handle shallow/fully loaded scope state\n\tif (isWebPageNode(latestProvider) && latestProvider.isLoaded()) {\n\t\tassert(toDataSource.dataIdentifier, \"A collection data source is expected\")\n\t\tconst fromData = engine.componentLoader.dataForIdentifier(fromDataSource.dataIdentifier)\n\t\tconst toData = engine.componentLoader.dataForIdentifier(toDataSource.dataIdentifier)\n\n\t\tif (!fromData || !toData) return\n\n\t\tconst pagePath = getRawWebPagePath(engine.tree, latestProvider)\n\t\tif (pagePath) {\n\t\t\tconst fromSlugKey = fromData.annotations?.[AnnotationKey.FramerSlug]\n\t\t\tconst toSlugKey = toData.annotations?.[AnnotationKey.FramerSlug]\n\t\t\tassert(toSlugKey, \"Web pages only allow switching to collections that contains slugs\")\n\t\t\tif (fromSlugKey) {\n\t\t\t\tconst regexp = new RegExp(`:${escapeRegExp(fromSlugKey)}\\\\b`, \"g\")\n\t\t\t\tconst updatedPagePath = pagePath.replaceAll(regexp, `:${toSlugKey}`)\n\t\t\t\tconst { path: uniquePath } = getUniquePagePath(\n\t\t\t\t\tupdatedPagePath,\n\t\t\t\t\tengine.tree,\n\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\tlatestProvider,\n\t\t\t\t)\n\n\t\t\t\tif (uniquePath !== pagePath) {\n\t\t\t\t\tupdateRouteSegmentsAfterSwapDataSource(engine, latestProvider, toDataSource.dataIdentifier, uniquePath)\n\t\t\t\t\t// Also update the pagePath as a fallback in case we need the data for regenerating route\n\t\t\t\t\t// segments. @TODO: Can be removed when we get rid of the deprecated pagePath prop.\n\t\t\t\t\tengine.tree.current(latestProvider)?.set({ pagePath: uniquePath })\n\t\t\t\t} else {\n\t\t\t\t\tretargetLeafSegmentForUnchangedPath(engine, latestProvider, toDataSource.dataIdentifier)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction getVariableControlMap(\n\tengine: VekterEngine,\n\tdataSource: RepeaterDataSource,\n): VariableProviderControlMap | undefined {\n\tif (dataSource.dataIdentifier) {\n\t\tconst dataDefinition = engine.componentLoader.dataForIdentifier(dataSource.dataIdentifier)\n\t\tif (!dataDefinition) return\n\t\treturn new EagerVariableProviderMap<VerifiedControlDescription>(Object.entries(dataDefinition.properties))\n\t}\n\tif (dataSource.dataRepeaterArray) {\n\t\t// Need to load the variable from reference here then convert its items to a control map\n\t\tconst node = engine.tree.get(dataSource.dataRepeaterArray.providerId)\n\t\tassert(withVariableProvider(node), \"Node should have provide variables\")\n\t\tconst controlMap = node.getProvidedControlMap(\n\t\t\tengine.tree,\n\t\t\tundefined,\n\t\t\tengine.componentLoader,\n\t\t\tengine.componentLoader.activeBundleHash,\n\t\t)\n\t\tif (!controlMap) return\n\t\tconst control = controlMap.get(dataSource.dataRepeaterArray.id)\n\t\tif (!isArrayOfObjectControlDescription(control)) return\n\n\t\treturn new EagerVariableProviderMap<VerifiedControlDescription>(Object.entries(control.control.controls))\n\t}\n}\n\nfunction updateRouteSegmentsAfterSwapDataSource(\n\tengine: VekterEngine,\n\twebPageNode: AnyWebPageNode,\n\ttoDataIdentifier: ModuleExportIdentifierString,\n\tfullPath: string,\n) {\n\tconst existingRouteSegment = getRouteSegmentNodeByWebPageId(engine.tree, webPageNode.id)\n\tassert(existingRouteSegment, \"Could not find route segment for web page\", webPageNode.id)\n\n\t// Create create new segments with the new path & dataIdentifier\n\tcreateRouteSegment(engine.tree, engine.componentLoader, webPageNode, toDataIdentifier, fullPath)\n\t// Disassociate the page with the existing route segment\n\texistingRouteSegment.set({ webPageId: undefined })\n\t// If the existing segment is empty, remove it\n\tremoveEmptySegmentsRecursive(existingRouteSegment.id, engine.tree)\n}\n\n/**\n * When the page path text is unchanged (e.g. both collections share the same\n * FramerSlug annotation), retarget this page's leaf :slug segment in place.\n *\n * Skipped when the segment has descendants: its dataIdentifier governs slug\n * validation for every descendant page (see getLinkToWebPageFromPath), so\n * flipping it would break their link resolution.\n */\nfunction retargetLeafSegmentForUnchangedPath(\n\tengine: VekterEngine,\n\twebPageNode: AnyWebPageNode,\n\ttoDataIdentifier: ModuleExportIdentifierString,\n) {\n\tconst leaf = getRouteSegmentNodeByWebPageId(engine.tree, webPageNode.id)\n\tif (!leaf) return\n\tif (!hasPathVariableShape(leaf.segment)) return\n\tif (leaf.children.length > 0) return\n\n\tleaf.set({ dataIdentifier: toDataIdentifier })\n}\n\nfunction getUsedVariablesForProvider(engine: VekterEngine, provider: CanvasNode & WithAnyDataSource) {\n\tconst result = new Set<NodeID>()\n\n\tfor (const node of provider.walk()) {\n\t\tforEachVariableReferenceOfNode(\n\t\t\tengine.tree,\n\t\t\tnode,\n\t\t\t\"excludeInherited\",\n\t\t\t\"readsRawNodeData\",\n\t\t\tundefined,\n\t\t\tvariableReference => {\n\t\t\t\tif (isVariableProvidedByNode(variableReference, provider)) {\n\t\t\t\t\tresult.add(variableReference.id)\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\t}\n\n\treturn result\n}\n\nfunction remapVariableIds(\n\tengine: VekterEngine,\n\tunmappedVariableIds: Set<string>,\n\ttoControlMap: VariableProviderControlMap,\n) {\n\tconst allMappableControls = getAllCollectionAndArrayControls(engine)\n\tconst remappedVariableIds = new Map<NodeID, NodeID>()\n\n\t// 1. Check if variable exists in new data, if so we don't need to remap.\n\tfor (const id of unmappedVariableIds) {\n\t\tif (toControlMap.has(id)) {\n\t\t\tunmappedVariableIds.delete(id)\n\t\t}\n\t}\n\n\t// 2. Check if a variable exists in the new data with the same name and type, if so remap\n\tfor (const id of unmappedVariableIds) {\n\t\tconst existingControl = allMappableControls.get(id)\n\t\tif (!existingControl || !existingControl.title) continue\n\n\t\tconst lowerCaseTitle = existingControl.title.toLowerCase()\n\n\t\tfor (const [toControlId, toControl] of toControlMap) {\n\t\t\tif (!toControl || !toControl.title) continue\n\t\t\tif (!controlTypesAreCompatible(toControl.type, existingControl.type)) continue\n\t\t\tif (toControl.title.toLowerCase() !== lowerCaseTitle) continue\n\n\t\t\tremappedVariableIds.set(id, toControlId)\n\t\t\tunmappedVariableIds.delete(id)\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// 3. Fallback to first available variable with the same type\n\tfor (const id of unmappedVariableIds) {\n\t\tconst existingControl = allMappableControls.get(id)\n\t\tif (!existingControl) continue\n\n\t\tfor (const [toControlId, toControl] of toControlMap) {\n\t\t\tif (!toControl) continue\n\t\t\tif (!controlTypesAreCompatible(toControl.type, existingControl.type)) continue\n\n\t\t\tremappedVariableIds.set(id, toControlId)\n\t\t\tunmappedVariableIds.delete(id)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn remappedVariableIds\n}\n", "import type { PopupButtonProps } from \"@framerjs/fresco\"\nimport { PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useAvailableCollections } from \"document/components/utils/useAvailableCollections.ts\"\nimport { useExternalDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tcreateVariableReference,\n\tisVariableReferenceEqual,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { HasAnyDataSource } from \"document/models/CanvasTree/traits/WithRepeaterDataSource.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useMemo } from \"react\"\nimport { isNestedVariableId } from \"utils/collectionReferenceUtils.ts\"\nimport type { ArrayRepeaterDataSource, CollectionRepeaterDataSource } from \"utils/swapDataSource.ts\"\nimport { getVariableFromInfo, useVariableProviderInfo } from \"../useVariableProviderInfo.ts\"\n\ninterface Props extends Pick<PopupButtonProps, \"className\" | \"enabled\"> {\n\tdataIdentifier: ModuleExportIdentifierString | undefined\n\tdataRepeaterArray: VariableReference | undefined\n\tonChangeDataSource: (newDataSource: HasAnyDataSource) => void\n}\n\ninterface OptionBase {\n\tname: string\n}\ntype ArrayRepeaterDataSourceOption = OptionBase & ArrayRepeaterDataSource\ntype CollectionRepeaterDataSourceOption = OptionBase & CollectionRepeaterDataSource\n\nexport function RepeaterSourcePopupButton({\n\tclassName,\n\tdataIdentifier,\n\tdataRepeaterArray,\n\tenabled,\n\tonChangeDataSource,\n}: Props) {\n\tconst nodeLevelRepeatEnabled = useExperimentIsOn(\"nodeLevelRepeat\")\n\tconst hasSelectedArrayVariable = Boolean(dataRepeaterArray)\n\t// When node-level repeat is enabled we hide array sources only if no array is currently selected.\n\tconst includeArrayVariables = hasSelectedArrayVariable || !nodeLevelRepeatEnabled\n\tconst availableCollections = useAvailableCollections()\n\tconst externalData = useExternalDataForIdentifier(dataIdentifier)\n\tconst variableInfo = useVariableProviderInfo()\n\n\tconst dataRepeaterArrayVariable = useMemo(() => {\n\t\tif (dataRepeaterArray) {\n\t\t\treturn getVariableFromInfo(dataRepeaterArray, variableInfo)\n\t\t}\n\t}, [dataRepeaterArray, variableInfo])\n\n\tconst hasExternalData = Boolean(externalData)\n\tconst isArrayVariableMissing = hasSelectedArrayVariable && !dataRepeaterArrayVariable\n\n\tconst availableArrayVariableSources = useMemo(() => {\n\t\tconst dataSources: ArrayRepeaterDataSourceOption[] = []\n\t\tconst nearestProviderId: NodeID | undefined = variableInfo?.providerIds[0]\n\n\t\tfor (const [providerId, variableMap] of variableInfo?.combined ?? []) {\n\t\t\tif (providerId !== nearestProviderId) continue\n\t\t\tfor (const [variableId, variable] of variableMap) {\n\t\t\t\tif (variable.type !== ControlType.Array) continue\n\t\t\t\t// We have made a decision to not show nested variables for the moment because\n\t\t\t\t// in this flat list the user can't easily see which variable is nested in which\n\t\t\t\t// provider. When we need to show nested variables we will switch to the variable\n\t\t\t\t// picker that shows the full list of variables.\n\t\t\t\tif (isNestedVariableId(variableId)) continue\n\n\t\t\t\tdataSources.push({\n\t\t\t\t\tname: variable.name,\n\t\t\t\t\tdataRepeaterArray: createVariableReference(variableId, providerId),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn dataSources\n\t}, [variableInfo])\n\n\tconst availableCollectionSources = useMemo(() => {\n\t\tconst dataSources: CollectionRepeaterDataSourceOption[] = []\n\t\tfor (const collection of availableCollections) {\n\t\t\tif (!collection) continue\n\t\t\tif (!collection.properties) continue\n\n\t\t\tdataSources.push({\n\t\t\t\tname: collection.name,\n\t\t\t\tdataIdentifier: collection.identifier,\n\t\t\t})\n\t\t}\n\t\treturn dataSources\n\t}, [availableCollections])\n\n\tconst hasCollections = availableCollectionSources.length > 0\n\tconst hasArrayVariables = includeArrayVariables && availableArrayVariableSources.length > 0\n\tconst hasCurrentSelection = Boolean(dataIdentifier || dataRepeaterArray)\n\n\treturn (\n\t\t<PopupButtonDisplayTitle\n\t\t\tclassName={className}\n\t\t\tdisplayTitle={hasCurrentSelection && !hasExternalData ? undefined : Dictionary.SelectEllipsis}\n\t\t>\n\t\t\t<PopupButton enabled={enabled}>\n\t\t\t\t<PopupButtonItem\n\t\t\t\t\ttitle={Dictionary.Missing}\n\t\t\t\t\tenabled={false}\n\t\t\t\t\tselected={isArrayVariableMissing}\n\t\t\t\t\tvisible={isArrayVariableMissing}\n\t\t\t\t/>\n\t\t\t\t<PopupButtonItem selected={hasExternalData} enabled={false} title=\"External\" visible={hasExternalData} />\n\t\t\t\t<PopupButtonItem type=\"divider\" visible={isArrayVariableMissing || hasExternalData} />\n\t\t\t\t<PopupButtonItem title={Dictionary.Collections} visible={hasCollections && hasArrayVariables} />\n\t\t\t\t{availableCollectionSources.map(source => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={source.dataIdentifier}\n\t\t\t\t\t\tidentifier={source.dataIdentifier}\n\t\t\t\t\t\ttitle={source.name}\n\t\t\t\t\t\tselected={source.dataIdentifier === dataIdentifier}\n\t\t\t\t\t\tonSelect={() => onChangeDataSource(source)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t\t<PopupButtonItem type=\"divider\" visible={hasCollections && hasArrayVariables} />\n\t\t\t\t<PopupButtonItem title={Dictionary.Galleries} visible={hasArrayVariables} />\n\t\t\t\t{hasArrayVariables &&\n\t\t\t\t\tavailableArrayVariableSources.map(source => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={source.dataRepeaterArray.id}\n\t\t\t\t\t\t\tidentifier={source.dataRepeaterArray.id}\n\t\t\t\t\t\t\ttitle={source.name}\n\t\t\t\t\t\t\tselected={isVariableReferenceEqual(source.dataRepeaterArray, dataRepeaterArray)}\n\t\t\t\t\t\t\tonSelect={() => onChangeDataSource(source)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</PopupButtonDisplayTitle>\n\t)\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, assertNever, hostInfo, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { collectionIdKey } from \"code-generation/components/cms/dataIdKeys.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getTabIdentifier, labelHTML } from \"document/components/chrome/insertSidebar/dataSources/utils.tsx\"\nimport { createVariableWithTree } from \"document/components/chrome/properties/utils/createVariableInScope.ts\"\nimport { type CanvasNode, type CanvasTree, CodeComponentNode, type NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CanvasChildList } from \"document/models/CanvasTree/nodes/ChildList.ts\"\nimport FrameNode from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { RichTextNode } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { FormBooleanInputNode } from \"document/models/CanvasTree/nodes/forms/FormBooleanInputNode.ts\"\nimport { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport { FormSelectNode } from \"document/models/CanvasTree/nodes/forms/FormSelectNode.ts\"\nimport type { ComputedValueFromVariable } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { ValueTransform } from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport { getUsedVariableReferencesFromValueTransform } from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport { type VariableReference, createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { HTMLTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport { type WithPins, isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { VariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tformCheckboxCheckedEffectDefaults,\n\tformCheckboxCheckedIconDefaults,\n} from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport {\n\tdefaultAddedInputIconColor,\n\tdefaultTextInputIconImage,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport { defaultFormInputPlaceholderColor } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport type { InputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { inputHasDefaultIcon } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport {\n\tformBooleanInputStyleCreateDefaults,\n\tformInputStyleCreateDefaults,\n\tformSelectStyleCreateDefaults,\n} from \"document/models/CanvasTree/traits/forms/utils.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { isCollectionControlType } from \"document/models/controlProps/CollectionControlType.ts\"\nimport type {\n\tCollectionReferenceControlProp,\n\tMultiCollectionReferenceControlProp,\n\tStringControlProp,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { plural, singular } from \"pluralize\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getRepeatedItemIdUpdate } from \"utils/repeaterUtils.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport type { FieldOption } from \"./CollectionFiltersRow.tsx\"\n\ninterface DynamicFilterPresetContext {\n\tengine: VekterEngine\n\trepeaterOriginalId: NodeID\n\tfieldOption: FieldOption\n}\n\nconst dynamicFilterPresets = {\n\tbooleanCheckbox: { label: Dictionary.Checkbox, createFilter: insertBooleanCheckboxFilter },\n\tbooleanDropdown: { label: \"Dropdown\", createFilter: insertBooleanDropdownFilter },\n\ttextInput: { label: \"Search Field\", createFilter: insertTextInputFilter },\n\tnumberInput: { label: \"Number Field\", createFilter: insertNumberInputFilter },\n\tdateInput: { label: \"Date Picker\", createFilter: insertDateInputFilter },\n\tisSetCheckbox: { label: Dictionary.Checkbox, createFilter: insertIsSetCheckBoxFilter },\n\ttabs: { label: \"Tabs\", createFilter: insertReferenceTabsFilter },\n\ttoggles: { label: \"Toggles\", createFilter: insertReferenceTogglesFilter },\n\treferenceDropdown: { label: \"Dropdown\", createFilter: insertReferenceDropdownFilter },\n\treferenceCheckboxGroup: { label: \"Checkboxes\", createFilter: insertReferenceCheckboxGroupFilter },\n\tenumDropdown: { label: \"Dropdown\", createFilter: insertEnumDropdownFilter },\n} as const\n\ntype DynamicFilterPresetType = keyof typeof dynamicFilterPresets\n\ninterface DynamicFilterPreset {\n\tlabel: string\n\tpresetType: DynamicFilterPresetType\n\tcreateFilter: (context: DynamicFilterPresetContext) => Promise<ValueTransform[] | null>\n}\n\nfunction getPreset(presetType: DynamicFilterPresetType): DynamicFilterPreset {\n\treturn { ...dynamicFilterPresets[presetType], presetType }\n}\n\nexport function getDynamicFilterPresets(controlType: ControlType): DynamicFilterPreset[] {\n\tif (!isCollectionControlType(controlType)) return []\n\tswitch (controlType) {\n\t\tcase ControlType.String:\n\t\t\treturn [getPreset(\"textInput\")]\n\n\t\tcase ControlType.Boolean:\n\t\t\treturn [getPreset(\"booleanCheckbox\"), getPreset(\"booleanDropdown\")]\n\n\t\tcase ControlType.Number:\n\t\t\treturn [getPreset(\"numberInput\")]\n\n\t\tcase ControlType.Date:\n\t\t\treturn [getPreset(\"dateInput\")]\n\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.File:\n\t\tcase ControlType.Array:\n\t\t\treturn [getPreset(\"isSetCheckbox\")]\n\n\t\tcase ControlType.CollectionReference:\n\t\t\treturn [\n\t\t\t\tgetPreset(\"tabs\"),\n\t\t\t\tgetPreset(\"toggles\"),\n\t\t\t\tgetPreset(\"referenceDropdown\"),\n\t\t\t\tgetPreset(\"referenceCheckboxGroup\"),\n\t\t\t]\n\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\treturn [\n\t\t\t\tgetPreset(\"tabs\"),\n\t\t\t\tgetPreset(\"toggles\"),\n\t\t\t\tgetPreset(\"referenceDropdown\"),\n\t\t\t\tgetPreset(\"referenceCheckboxGroup\"),\n\t\t\t]\n\n\t\tcase ControlType.Enum:\n\t\t\treturn [getPreset(\"enumDropdown\")]\n\n\t\t// To be implemented\n\t\tcase ControlType.Color:\n\t\t\treturn []\n\n\t\t// Unsupported CMS fields\n\t\tcase ControlType.Object:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn []\n\n\t\tdefault:\n\t\t\treturn assertNever(controlType)\n\t}\n}\n\nasync function insertTextInputFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(fieldControl.type === ControlType.String, \"Text input filters can only be created for string fields\")\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable => variable.type === ControlType.String,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tname: fieldName,\n\t\t\t\tinitialValue: \"\",\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst textInputNode = createPlainTextInputNode({\n\t\ttype: \"text\",\n\t\tvariableBinding: variableRef,\n\t\tplaceholder: Dictionary.SearchEllipsis,\n\t\ticon: defaultTextInputIconImage,\n\t})\n\n\tconst labeledInput = createLabeledInputWrapper(textInputNode, fieldName)\n\n\tconst inserted = insertNodeAbove({\n\t\tnodeToInsert: labeledInput,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\ttree: engine.tree,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"contains\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertNumberInputFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(fieldControl.type === ControlType.Number, \"Number input filters can only be created for number fields\")\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable => variable.type === ControlType.Number,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: fieldName,\n\t\t\t\tinitialValue: 0,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t\toptions: {\n\t\t\t\t\tmin: fieldControl.min,\n\t\t\t\t\tmax: fieldControl.max,\n\t\t\t\t\tstep: fieldControl.step,\n\t\t\t\t},\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst textInputNode = createPlainTextInputNode({\n\t\ttype: \"number\",\n\t\tvariableBinding: variableRef,\n\t\tplaceholder: \"Number\u2026\",\n\t})\n\n\tconst labeledInput = createLabeledInputWrapper(textInputNode, fieldName)\n\n\tconst inserted = insertNodeAbove({\n\t\tnodeToInsert: labeledInput,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\ttree: engine.tree,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertDateInputFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(fieldControl.type === ControlType.Date, \"Date input filters can only be created for date fields\")\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable => variable.type === ControlType.Date,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Date,\n\t\t\t\tname: `After ${fieldName}`,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst textInputNode = createPlainTextInputNode({\n\t\ttype: \"date\",\n\t\tvariableBinding: variableRef,\n\t\tplaceholder: \"\",\n\t})\n\n\tconst labeledInput = createLabeledInputWrapper(textInputNode, `After ${fieldName}`)\n\n\tconst inserted = insertNodeAbove({\n\t\tnodeToInsert: labeledInput,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\ttree: engine.tree,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"isAfter\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nfunction addBooleanVariable({\n\tengine,\n\trepeaterOriginalId,\n\tfieldName,\n\tfieldOption,\n}: {\n\tengine: VekterEngine\n\trepeaterOriginalId: NodeID\n\tfieldName: string\n\tfieldOption: FieldOption\n}) {\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable => variable.type === ControlType.Boolean,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tname: fieldName,\n\t\t\t\tinitialValue: true,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst checkboxNode = new FormBooleanInputNode({\n\t\theight: 16,\n\t\twidth: 16,\n\t\taspectRatio: 1,\n\t\theightType: DimensionType.FixedNumber,\n\t\twidthType: DimensionType.FixedNumber,\n\t\tformBooleanInputType: \"checkbox\",\n\t\tformBooleanInputValue: false,\n\t\tbindingType: \"variable\",\n\t\tvariableBinding: variableRef,\n\t\t...formBooleanInputStyleCreateDefaults,\n\t\t...formCheckboxCheckedEffectDefaults,\n\t\t...formCheckboxCheckedIconDefaults,\n\t})\n\n\tconst labelNode = createCheckboxLabelWrapper(checkboxNode, fieldName)\n\n\tconst inserted = insertNodeAbove({\n\t\tnodeToInsert: labelNode,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\ttree: engine.tree,\n\t})\n\tif (!inserted) return null\n\n\treturn variableRef\n}\n\nasync function insertBooleanDropdownFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldName = getFieldName(fieldOption)\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable => variable.type === ControlType.Boolean,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tname: fieldName,\n\t\t\t\tinitialValue: true,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst inserted = insertLabeledSelectNode({\n\t\ttree: engine.tree,\n\t\tfieldName,\n\t\tvariableRef,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertIsSetCheckBoxFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldName = getFieldName(fieldOption)\n\tconst variableRef = addBooleanVariable({ engine, repeaterOriginalId, fieldName: `Has ${fieldName}`, fieldOption })\n\tif (!variableRef) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"isSet\",\n\t\t},\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertBooleanCheckboxFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldName = getFieldName(fieldOption)\n\tconst variableRef = addBooleanVariable({ engine, repeaterOriginalId, fieldName, fieldOption })\n\tif (!variableRef) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nfunction getReferenceCollectionTitleVariableId(\n\tengine: VekterEngine,\n\tdataIdentifier: ModuleExportIdentifierString,\n): string | null {\n\tconst referencedCollection = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\tif (!referencedCollection) return null\n\n\tconst slugVariable = referencedCollection.getSlugVariable()\n\tconst titleVariable = referencedCollection.getTitleVariable() ?? slugVariable\n\treturn titleVariable?.id ?? null\n}\n\ninterface InsertReferenceFilterSelectorOptions {\n\tengine: VekterEngine\n\trepeaterOriginalId: NodeID\n\tdataIdentifier: ModuleExportIdentifierString\n\tvariableRef: VariableReference\n\tcollectionTitleVariableId: string\n\tselectedTransformName: \"equals\" | \"contains\"\n\tfieldName: string\n\tshowAllAction?: EventAction\n\tcreateSelectControlProp: (repeaterId: NodeID) => CollectionReferenceControlProp | MultiCollectionReferenceControlProp\n}\n\nasync function insertReferenceFilterSelector(options: InsertReferenceFilterSelectorOptions): Promise<boolean> {\n\tconst {\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tdataIdentifier,\n\t\tvariableRef,\n\t\tcollectionTitleVariableId,\n\t\tselectedTransformName,\n\t\tfieldName,\n\t\tshowAllAction,\n\t\tcreateSelectControlProp,\n\t} = options\n\tconst codeComponentIdentifier = await getTabIdentifier(engine)\n\tconst repeaterId = randomID()\n\n\tconst selectAction: EventAction = {\n\t\tidentifier: randomID(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.setVariableValueAction,\n\t\tcontrols: {\n\t\t\tvariableId: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: variableRef.id,\n\t\t\t} satisfies StringControlProp,\n\t\t\tvalue: createSelectControlProp(repeaterId),\n\t\t},\n\t}\n\n\tconst { isProduction } = hostInfo\n\tconst activeVariantId = isProduction ? \"EjrEPdBHr\" : \"UhGazSmtI\"\n\tconst inactiveVariantId = isProduction ? \"Xe0iocdhe\" : \"KiV3cB2cL\"\n\tconst titleVariableId = isProduction ? \"mXpY5N3RA\" : \"N1pEIbzkx\"\n\tconst clickActionId = isProduction ? \"eAHGXWjyh\" : \"hMh8CA8FZ\"\n\n\tlet showAllComponent: CodeComponentNode | null = null\n\tif (showAllAction) {\n\t\tshowAllComponent = new CodeComponentNode({\n\t\t\tcodeComponentIdentifier,\n\t\t\theightType: DimensionType.Auto,\n\t\t\twidthType: DimensionType.Auto,\n\t\t\t...prefixControlProps({\n\t\t\t\tvariant: {\n\t\t\t\t\ttype: ControlType.Enum,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\ttype: \"computedValue\",\n\t\t\t\t\t\toutputType: ControlType.Enum,\n\t\t\t\t\t\tstartValue: variableRef,\n\t\t\t\t\t\ttransforms: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"valueTransform\",\n\t\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\t\tname: \"isSet\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"valueTransform\",\n\t\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\t\tname: \"convertFromBoolean\",\n\t\t\t\t\t\t\t\ttruthy: inactiveVariantId,\n\t\t\t\t\t\t\t\tfalsy: activeVariantId,\n\t\t\t\t\t\t\t\toutputType: ControlType.Enum,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} satisfies ComputedValueFromVariable,\n\t\t\t\t},\n\t\t\t\t[titleVariableId]: {\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tvalue: Dictionary.All,\n\t\t\t\t},\n\t\t\t\t[clickActionId]: { type: ControlType.EventHandler, value: [showAllAction] },\n\t\t\t}),\n\t\t})\n\t}\n\n\tconst optionComponent = new CodeComponentNode({\n\t\tcodeComponentIdentifier,\n\t\theightType: DimensionType.Auto,\n\t\twidthType: DimensionType.Auto,\n\t\t...prefixControlProps({\n\t\t\tvariant: {\n\t\t\t\ttype: ControlType.Enum,\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"computedValue\",\n\t\t\t\t\toutputType: ControlType.Enum,\n\t\t\t\t\tstartValue: variableRef,\n\t\t\t\t\ttransforms: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"valueTransform\",\n\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\tname: selectedTransformName,\n\t\t\t\t\t\t\tvalue: createVariableReference(collectionIdKey, repeaterId),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"valueTransform\",\n\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\tname: \"convertFromBoolean\",\n\t\t\t\t\t\t\ttruthy: activeVariantId,\n\t\t\t\t\t\t\tfalsy: inactiveVariantId,\n\t\t\t\t\t\t\toutputType: ControlType.Enum,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t} satisfies ComputedValueFromVariable,\n\t\t\t},\n\t\t\t[titleVariableId]: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: createVariableReference(collectionTitleVariableId, repeaterId),\n\t\t\t},\n\t\t\t[clickActionId]: { type: ControlType.EventHandler, value: [selectAction] },\n\t\t}),\n\t})\n\n\tconst referencedCollectionRepeater = new FrameNode({\n\t\tid: repeaterId,\n\t\tdataIdentifier,\n\t\tlayout: \"stack\",\n\t\twidthType: DimensionType.Percentage,\n\t\twidth: 1,\n\t\theightType: DimensionType.Auto,\n\t\theight: 100,\n\t\tstackDirection: \"horizontal\",\n\t\tstackDistribution: \"start\",\n\t\tstackAlignment: \"center\",\n\t\tstackWrapEnabled: true,\n\t\tgap: 10,\n\t\tfillEnabled: false,\n\t\t...getRepeatedItemIdUpdate(optionComponent.id),\n\t\tchildren: new CanvasChildList(showAllComponent ? [showAllComponent, optionComponent] : [optionComponent]),\n\t})\n\n\tconst labeledWrapper = createLabeledGroupWrapper(referencedCollectionRepeater, fieldName)\n\n\treturn engine.scheduler.processWhenReadyAsync(() =>\n\t\tinsertNodeAbove({\n\t\t\tnodeToInsert: labeledWrapper,\n\t\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\t\ttree: engine.tree,\n\t\t}),\n\t)\n}\n\nasync function insertReferenceTabsFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(\n\t\tfieldControl.type === ControlType.MultiCollectionReference || fieldControl.type === ControlType.CollectionReference,\n\t\t\"Expected collection reference or multi collection reference\",\n\t)\n\tassert(isModuleExportIdentifier(fieldControl.dataIdentifier), \"Expected data identifier\")\n\tconst dataIdentifier = fieldControl.dataIdentifier\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable =>\n\t\t\tvariable.type === ControlType.CollectionReference && variable.dataIdentifier === dataIdentifier,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? singular(fieldName) : fieldName,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tdataIdentifier,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst titleVariableId = getReferenceCollectionTitleVariableId(engine, dataIdentifier)\n\tif (!titleVariableId) return null\n\n\tconst showAllAction: EventAction = {\n\t\tidentifier: randomID(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.setVariableValueAction,\n\t\tcontrols: {\n\t\t\tvariableId: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue: variableRef.id,\n\t\t\t} satisfies StringControlProp,\n\t\t\tvalue: {\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tvalue: undefined,\n\t\t\t} satisfies CollectionReferenceControlProp,\n\t\t},\n\t}\n\n\tvoid insertReferenceFilterSelector({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tdataIdentifier,\n\t\tvariableRef,\n\t\tcollectionTitleVariableId: titleVariableId,\n\t\tselectedTransformName: \"equals\",\n\t\tfieldName,\n\t\tshowAllAction,\n\t\tcreateSelectControlProp: repeaterId =>\n\t\t\t({\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\tvalue: createVariableReference(collectionIdKey, repeaterId),\n\t\t\t}) satisfies CollectionReferenceControlProp,\n\t})\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? \"contains\" : \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertReferenceTogglesFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(\n\t\tfieldControl.type === ControlType.MultiCollectionReference || fieldControl.type === ControlType.CollectionReference,\n\t\t\"Expected collection reference or multi collection reference\",\n\t)\n\tassert(isModuleExportIdentifier(fieldControl.dataIdentifier), \"Expected data identifier\")\n\tconst dataIdentifier = fieldControl.dataIdentifier\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable =>\n\t\t\tvariable.type === ControlType.MultiCollectionReference && variable.dataIdentifier === dataIdentifier,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tname: fieldControl.type === ControlType.CollectionReference ? plural(fieldName) : fieldName,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tdataIdentifier,\n\t\t\t\toptional: true,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst titleVariableId = getReferenceCollectionTitleVariableId(engine, dataIdentifier)\n\tif (!titleVariableId) return null\n\n\tvoid insertReferenceFilterSelector({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tdataIdentifier,\n\t\tvariableRef,\n\t\tcollectionTitleVariableId: titleVariableId,\n\t\tselectedTransformName: \"contains\",\n\t\tfieldName,\n\t\tcreateSelectControlProp: repeaterId =>\n\t\t\t({\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\tvalue: {\n\t\t\t\t\ttype: \"computedValue\",\n\t\t\t\t\toutputType: ControlType.MultiCollectionReference,\n\t\t\t\t\tstartValue: variableRef,\n\t\t\t\t\ttransforms: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"valueTransform\",\n\t\t\t\t\t\t\tid: randomID(),\n\t\t\t\t\t\t\tname: \"toggleInList\",\n\t\t\t\t\t\t\tvalue: createVariableReference(collectionIdKey, repeaterId),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t} satisfies ComputedValueFromVariable,\n\t\t\t}) satisfies MultiCollectionReferenceControlProp,\n\t})\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? \"containsAll\" : \"isIncludedIn\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nfunction createPlainTextInputNode({\n\ttype,\n\tvariableBinding,\n\tplaceholder,\n\ticon,\n}: {\n\ttype: InputType\n\tvariableBinding: VariableReference\n\tplaceholder: string\n\ticon?: string\n}) {\n\tconst needsDefaultIconColor = inputHasDefaultIcon(type) || icon !== undefined\n\treturn new FormPlainTextInputNode({\n\t\t...formInputStyleCreateDefaults,\n\t\tformInputPlaceholderColor: defaultFormInputPlaceholderColor,\n\t\t...(needsDefaultIconColor ? { formInputIconColor: defaultAddedInputIconColor } : {}),\n\t\tformInputIconImage: icon,\n\t\tformInputFontColor: \"#222\",\n\t\theight: 40,\n\t\twidth: 1,\n\t\theightType: DimensionType.FixedNumber,\n\t\twidthType: DimensionType.FractionOfFreeSpace,\n\t\tformTextInputType: type,\n\t\tformInputValue: \"\",\n\t\tformInputPlaceholder: placeholder,\n\t\tbindingType: \"variable\",\n\t\tvariableBinding,\n\t})\n}\n\nasync function insertReferenceDropdownFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tif (\n\t\tfieldControl.type !== ControlType.MultiCollectionReference &&\n\t\tfieldControl.type !== ControlType.CollectionReference\n\t) {\n\t\treturn null\n\t}\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable =>\n\t\t\tvariable.type === ControlType.CollectionReference && variable.dataIdentifier === fieldControl.dataIdentifier,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tdataIdentifier: fieldControl.dataIdentifier as ModuleExportIdentifierString,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tisAssigned: true,\n\t\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? singular(fieldName) : fieldName,\n\t\t\t\toptional: true,\n\t\t\t\trequired: false,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst inserted = insertLabeledSelectNode({\n\t\ttree: engine.tree,\n\t\tfieldName,\n\t\tvariableRef,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? \"contains\" : \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nasync function insertEnumDropdownFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tassert(fieldControl.type === ControlType.Enum, \"Enum dropdown filters can only be created for enum fields\")\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable =>\n\t\t\tvariable.type === \"controlReference\" &&\n\t\t\tvariable.expectedType === ControlType.Enum &&\n\t\t\tvariable.entityIdentifier === fieldOption.dataIdentifier &&\n\t\t\tvariable.controlKey === fieldOption.itemKey,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\ttype: \"controlReference\",\n\t\t\t\tentityIdentifier: fieldOption.dataIdentifier,\n\t\t\t\tcontrolKey: fieldOption.itemKey,\n\t\t\t\texpectedType: ControlType.Enum,\n\t\t\t\toptional: true,\n\t\t\t\tinitialValue: undefined,\n\t\t\t\tscopeId,\n\t\t\t\tname: fieldName,\n\t\t\t\tisAssigned: true,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst inserted = insertLabeledSelectNode({\n\t\ttree: engine.tree,\n\t\tfieldName,\n\t\tvariableRef,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: \"equals\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nfunction insertLabeledSelectNode({\n\ttree,\n\tfieldName,\n\tvariableRef,\n\tplaceAboveNodeId,\n}: {\n\ttree: CanvasTree\n\tfieldName: string\n\tvariableRef: VariableReference\n\tplaceAboveNodeId: NodeID\n}): boolean {\n\tconst selectNode = new FormSelectNode({\n\t\theight: 40,\n\t\twidth: 1,\n\t\twidthType: DimensionType.FractionOfFreeSpace,\n\t\theightType: DimensionType.FixedNumber,\n\t\tbindingType: \"variable\",\n\t\tvariableBinding: variableRef,\n\t\t...formSelectStyleCreateDefaults,\n\t\tformInputFontColor: \"#222\",\n\t})\n\n\tconst labeledInput = createLabeledInputWrapper(selectNode, fieldName)\n\n\treturn insertNodeAbove({\n\t\tnodeToInsert: labeledInput,\n\t\tplaceAboveNodeId,\n\t\ttree,\n\t})\n}\n\nasync function insertReferenceCheckboxGroupFilter({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n}: DynamicFilterPresetContext): Promise<ValueTransform[] | null> {\n\tconst fieldControl = fieldOption.control\n\tconst fieldName = getFieldName(fieldOption)\n\tif (\n\t\tfieldControl.type !== ControlType.MultiCollectionReference &&\n\t\tfieldControl.type !== ControlType.CollectionReference\n\t) {\n\t\treturn null\n\t}\n\tassert(isModuleExportIdentifier(fieldControl.dataIdentifier), \"Expected data identifier\")\n\tconst dataIdentifier = fieldControl.dataIdentifier\n\n\tconst variableRef = getOrCreateFilterVariableRef({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable: variable =>\n\t\t\tvariable.type === ControlType.MultiCollectionReference && variable.dataIdentifier === dataIdentifier,\n\t\tcreateVariable: scopeId =>\n\t\t\tcreateVariableWithTree(engine.tree, {\n\t\t\t\tdataIdentifier,\n\t\t\t\tinitialValue: [],\n\t\t\t\tisAssigned: true,\n\t\t\t\tname: fieldControl.type === ControlType.CollectionReference ? plural(fieldName) : fieldName,\n\t\t\t\toptional: true,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t}),\n\t})\n\tif (!variableRef) return null\n\n\tconst referencedCollection = getCollectionForIdentifier(engine.tree, dataIdentifier)\n\tif (!referencedCollection) return null\n\n\tconst slugVariable = referencedCollection.getSlugVariable()\n\tconst titleVariable = referencedCollection.getTitleVariable() ?? slugVariable\n\tif (!titleVariable) return null\n\n\tconst repeaterId = randomID()\n\n\tconst checkboxNode = new FormBooleanInputNode({\n\t\theight: 16,\n\t\twidth: 16,\n\t\taspectRatio: 1,\n\t\theightType: DimensionType.FixedNumber,\n\t\twidthType: DimensionType.FixedNumber,\n\t\tformBooleanInputType: \"checkbox\",\n\t\tbindingType: \"variable\",\n\t\tvariableBinding: variableRef,\n\t\t...formBooleanInputStyleCreateDefaults,\n\t\t...formCheckboxCheckedEffectDefaults,\n\t\t...formCheckboxCheckedIconDefaults,\n\t})\n\n\tconst labelNode = createCheckboxLabelWrapper(checkboxNode, Dictionary.Content, {\n\t\ttextContent: createVariableReference(titleVariable.id, repeaterId),\n\t})\n\n\tconst checkboxGroupRepeater = new FrameNode({\n\t\tid: repeaterId,\n\t\tdataIdentifier,\n\t\tlayout: \"stack\",\n\t\twidthType: DimensionType.Auto,\n\t\theightType: DimensionType.Auto,\n\t\theight: 100,\n\t\tstackDirection: \"vertical\",\n\t\tstackDistribution: \"start\",\n\t\tstackAlignment: \"start\",\n\t\tgap: 8,\n\t\tfillEnabled: false,\n\t\t...getRepeatedItemIdUpdate(labelNode.id),\n\t\tchildren: new CanvasChildList([labelNode]),\n\t})\n\n\tconst labeledWrapper = createLabeledGroupWrapper(checkboxGroupRepeater, fieldName)\n\n\tconst inserted = insertNodeAbove({\n\t\tnodeToInsert: labeledWrapper,\n\t\tplaceAboveNodeId: repeaterOriginalId,\n\t\ttree: engine.tree,\n\t})\n\tif (!inserted) return null\n\n\treturn [\n\t\t{\n\t\t\tid: randomID(),\n\t\t\ttype: \"valueTransform\",\n\t\t\tname: fieldControl.type === ControlType.MultiCollectionReference ? \"containsAny\" : \"isIncludedIn\",\n\t\t\tvalue: variableRef,\n\t\t},\n\t]\n}\n\nfunction insertNodeAbove({\n\tnodeToInsert,\n\tplaceAboveNodeId,\n\ttree,\n}: {\n\tnodeToInsert: CanvasNode & WithPins\n\tplaceAboveNodeId: NodeID\n\ttree: CanvasTree\n}) {\n\tconst parentNode = tree.getParent(placeAboveNodeId)\n\n\tif (parentNode) {\n\t\tconst placeAboveNodeIndex =\n\t\t\tparentNode.children?.findIndex((child: CanvasNode) => child.id === placeAboveNodeId) ?? -1\n\t\tassert(placeAboveNodeIndex >= 0, \"Expected node to be a child of its parent\")\n\n\t\ttree.insertNode(nodeToInsert, parentNode.id, placeAboveNodeIndex)\n\t\treturn true\n\t}\n\n\tconst placeAboveNode = tree.getNode(placeAboveNodeId)\n\tif (!placeAboveNode) return false\n\n\t// If we're outside a breakpoint (no parent), we must use fixed width\n\tif (nodeToInsert.widthType !== DimensionType.FixedNumber) {\n\t\tnodeToInsert.set({\n\t\t\twidth: tree.getRect(placeAboveNode).width,\n\t\t\twidthType: DimensionType.FixedNumber,\n\t\t})\n\t}\n\n\tconst scopeNode = tree.getScopeNodeFor(placeAboveNode)\n\tif (!scopeNode) return false\n\n\tif (isPinnable(placeAboveNode) && isPinnable(nodeToInsert)) {\n\t\tnodeToInsert.set({\n\t\t\tleft: placeAboveNode.left ?? 0,\n\t\t\ttop: (placeAboveNode.top ?? 0) - 100,\n\t\t})\n\t}\n\n\tconst placeAboveNodeIndex = scopeNode.children.findIndex(groundNode => groundNode.id === placeAboveNodeId)\n\tif (placeAboveNodeIndex < 0) return false\n\n\ttree.insertNode(nodeToInsert, scopeNode.id, placeAboveNodeIndex)\n\treturn true\n}\n\nfunction createLabeledInputWrapper(inputNode: CanvasNode, label: string): FrameNode {\n\treturn new FrameNode({\n\t\t...inputLabelWrapperDefaults,\n\t\tchildren: new CanvasChildList([createLabelTextNode(label), inputNode]),\n\t})\n}\n\nfunction createLabeledGroupWrapper(contentNode: CanvasNode, label: string): FrameNode {\n\treturn new FrameNode({\n\t\t...groupLabelWrapperDefaults,\n\t\tchildren: new CanvasChildList([createLabelTextNode(label), contentNode]),\n\t})\n}\n\nfunction createCheckboxLabelWrapper(\n\tcheckboxNode: FormBooleanInputNode,\n\tlabel: string,\n\tlabelExtraProps?: Partial<RichTextNode>,\n): FrameNode {\n\treturn new FrameNode({\n\t\t...checkboxLabelDefaults,\n\t\tchildren: new CanvasChildList([checkboxNode, createLabelTextNode(label, labelExtraProps)]),\n\t})\n}\n\nfunction createLabelTextNode(label: string, extraProps?: Partial<RichTextNode>): RichTextNode {\n\treturn new RichTextNode({\n\t\theightType: DimensionType.Auto,\n\t\twidthType: DimensionType.Auto,\n\t\tuserSelect: \"none\",\n\t\thtml: labelHTML(label, \"#666\"),\n\t\t...extraProps,\n\t})\n}\n\nfunction getFieldName(fieldOption: FieldOption): string {\n\treturn fieldOption.control.title ?? titleCase(fieldOption.itemKey)\n}\n\nfunction findReusableVariableRefForField({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n\tisMatchingVariable,\n}: {\n\tengine: VekterEngine\n\trepeaterOriginalId: NodeID\n\tfieldOption: FieldOption\n\tisMatchingVariable: (variable: VariableDefinition) => boolean\n}): VariableReference | null {\n\tconst repeaterNode = engine.tree.getNode(repeaterOriginalId)\n\tif (!repeaterNode || !withCollectionOptions(repeaterNode)) return null\n\tif (!repeaterNode.collectionFilters?.filters) return null\n\n\tconst scopeNode = engine.tree.getScopeNodeFor(repeaterNode)\n\tif (!withVariables(scopeNode)) return null\n\n\tfor (const filter of repeaterNode.collectionFilters.filters) {\n\t\tif (filter.itemKey !== fieldOption.itemKey) continue\n\n\t\tfor (const transform of filter.transforms) {\n\t\t\tfor (const variableRef of getUsedVariableReferencesFromValueTransform(transform)) {\n\t\t\t\tif (variableRef.providerId && variableRef.providerId !== scopeNode.id) continue\n\n\t\t\t\tconst variable = scopeNode.getVariable(variableRef.id)\n\t\t\t\tif (!variable) continue\n\t\t\t\tif (!isMatchingVariable(variable)) continue\n\n\t\t\t\treturn createVariableReference(variable.id, scopeNode.id)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null\n}\n\nfunction getOrCreateFilterVariableRef({\n\tengine,\n\trepeaterOriginalId,\n\tfieldOption,\n\tisMatchingVariable,\n\tcreateVariable,\n}: {\n\tengine: VekterEngine\n\trepeaterOriginalId: NodeID\n\tfieldOption: FieldOption\n\tisMatchingVariable: (variable: VariableDefinition) => boolean\n\tcreateVariable: (scopeId: NodeID) => VariableReference | null\n}): VariableReference | null {\n\tconst reusableVariableRef = findReusableVariableRefForField({\n\t\tengine,\n\t\trepeaterOriginalId,\n\t\tfieldOption,\n\t\tisMatchingVariable,\n\t})\n\tif (reusableVariableRef) return reusableVariableRef\n\n\tconst repeaterNode = engine.tree.getNode(repeaterOriginalId)\n\tif (!repeaterNode) return null\n\n\tconst scopeNode = engine.tree.getScopeNodeFor(repeaterNode)\n\tif (!withVariables(scopeNode)) return null\n\n\treturn createVariable(scopeNode.id)\n}\n\nconst groupLabelWrapperDefaults: Partial<FrameNode> = {\n\tlayout: \"stack\",\n\tgap: 8,\n\tstackDirection: \"vertical\",\n\tstackDistribution: \"start\",\n\tstackAlignment: \"start\",\n\theightType: DimensionType.Auto,\n\twidth: 1,\n\twidthType: DimensionType.Percentage,\n\tpadding: 0,\n\tpaddingPerSide: false,\n\tfillEnabled: false,\n}\n\nconst inputLabelWrapperDefaults: Partial<FrameNode> = {\n\tlayout: \"stack\",\n\tgap: 8,\n\tstackDirection: \"vertical\",\n\tstackDistribution: \"start\",\n\tstackAlignment: \"start\",\n\theightType: DimensionType.Auto,\n\twidth: 180,\n\twidthType: DimensionType.FixedNumber,\n\tpadding: 0,\n\tpaddingPerSide: false,\n\tfillEnabled: false,\n\thtmlTag: HTMLTag.label,\n}\n\nconst checkboxLabelDefaults: Partial<FrameNode> = {\n\tlayout: \"stack\",\n\tgap: 10,\n\tstackDirection: \"horizontal\",\n\tstackDistribution: \"start\",\n\tstackAlignment: \"center\",\n\theight: 40,\n\theightType: DimensionType.Auto,\n\twidthType: DimensionType.Auto,\n\tpadding: 0,\n\tpaddingPerSide: false,\n\tfillEnabled: false,\n\thtmlTag: HTMLTag.label,\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport {\n\tButton,\n\tIconComputedValue,\n\tPopupButton,\n\tPopupButtonItem,\n\tScroll,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n\ttype StackProps,\n} from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport { emptyArray } from \"@framerjs/shared/src/emptyArray.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getDynamicFilterPresets } from \"document/components/chrome/properties/rows/dynamicFilterPresets.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport type { LoadedWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tValueTransform,\n\tValueTransformName,\n\tValueTransformType,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport {\n\tgetEnabledValueTransformNames,\n\tgetInputTypesForValueTransformName,\n\tgetOutputTypesForValueTransformName,\n\tgetUsedVariableReferencesFromValueTransform,\n\tisQueryableValueTransformName,\n\tisValueTransformType,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type {\n\tCollectionFilter,\n\tCollectionFilterData,\n\tCollectionFilterOperator,\n\tWithCollectionOptions,\n} from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { defaultFiltersOperator } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport type { VariableID, VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tconvertControlTypeToVariableType,\n\tisVariableDefinition,\n\twithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tcreateNegateTransform,\n\tcreateValueTransformWithName,\n} from \"document/models/CanvasTree/traits/utils/valueTransformUtils.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { isCollectionNavigationVariableId } from \"document/utils/CollectionItemVariables.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport type { ControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback, useMemo, useRef } from \"react\"\nimport { isTopLevelIdVariableId } from \"utils/collectionReferenceUtils.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { getNegatedLabel } from \"utils/getNegatedLabel.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { forEachVariableReferenceOfNode } from \"utils/updateDynamicValues.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { IconCollectionFilters } from \"../../shared/CollectionContentIcons.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { dividerAbove } from \"../../shared/ValueTransformChain.styles.ts\"\nimport { ValueTransformChain } from \"../../shared/ValueTransformChain.tsx\"\nimport { iconForVariableType } from \"../../shared/utils/iconForVariable.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst filtersKeys: (keyof WithCollectionOptions)[] = [\"collectionFilters\"]\n\nconst rowTitle = \"Filters\"\n\nconst operatorOptions: CollectionFilterOperator[] = [\"all\", \"any\"]\n\ninterface Props {\n\tdataIdentifier: ModuleExportIdentifierString\n\tfilterData: CollectionFilterData | undefined\n\tfiltersOperator: CollectionFilterOperator | undefined\n\tonChange: (update: Partial<WithCollectionOptions>) => void\n\trepeaterOriginalId: NodeID\n}\n\nexport const CollectionFiltersRow = React.memo(function CollectionFiltersRow({\n\tdataIdentifier,\n\tfilterData,\n\tfiltersOperator,\n\tonChange,\n\trepeaterOriginalId,\n}: Props) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst allFilters = filterData?.filters ?? emptyArray<CollectionFilter>()\n\n\tconst allFiltersRef = useRef(allFilters)\n\tallFiltersRef.current = allFilters\n\n\tconst collectionData = useDataForIdentifier(dataIdentifier)\n\n\tconst addFilter = useCallback(\n\t\t(itemKey: string | null = null, transforms: ValueTransform[] = [], openFilterDetail = true) => {\n\t\t\tconst newFilterId = randomID()\n\n\t\t\tconst newFilter: CollectionFilter = {\n\t\t\t\tid: newFilterId,\n\t\t\t\titemKey,\n\t\t\t\ttransforms,\n\t\t\t}\n\n\t\t\tconst filters = [...allFilters, newFilter]\n\t\t\tconst newFilterData: CollectionFilterData = { filters }\n\n\t\t\tonChange({ collectionFilters: newFilterData })\n\t\t\tif (openFilterDetail) {\n\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(newFilterId)\n\t\t\t} else if (allFilters.length === 0) {\n\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(\"filters\")\n\t\t\t}\n\t\t},\n\t\t[allFilters, onChange],\n\t)\n\n\tconst updateFilter = useCallback(\n\t\t(updatedFilter: CollectionFilter) => {\n\t\t\tconst filters = allFilters.map((filter: CollectionFilter) =>\n\t\t\t\tfilter.id === updatedFilter.id ? updatedFilter : filter,\n\t\t\t)\n\t\t\tconst newFilterData: CollectionFilterData = { filters }\n\t\t\tonChange({ collectionFilters: newFilterData })\n\t\t},\n\t\t[allFilters, onChange],\n\t)\n\n\tconst handleRemoveFilter = useCallback(\n\t\t(...ids: NodeID[]) => {\n\t\t\tconst filtersToRemove = allFilters.filter((filter: CollectionFilter) => ids.includes(filter.id))\n\n\t\t\tconst removeFilter = () => {\n\t\t\t\t// Read from allFiltersRef to get the latest state, so that if someone else adds a filter while the\n\t\t\t\t// modal is open, we preserve it when clicking Delete.\n\t\t\t\tconst currentFilters = allFiltersRef.current\n\n\t\t\t\tconst remainingFilters = currentFilters.filter((filter: CollectionFilter) => !ids.includes(filter.id))\n\n\t\t\t\tif (remainingFilters.length === 0) {\n\t\t\t\t\tonChange({ collectionFiltersOperator: \"all\" })\n\t\t\t\t\tpopoutWindow.navigation.close()\n\t\t\t\t}\n\n\t\t\t\tconst newFilterData: CollectionFilterData = { filters: remainingFilters }\n\t\t\t\tonChange({ collectionFilters: newFilterData })\n\t\t\t}\n\n\t\t\tconst anyFilterInUse = isAnyFilterInUse(engine, filtersToRemove, repeaterOriginalId)\n\n\t\t\tif (anyFilterInUse) {\n\t\t\t\tconst isPlural = filtersToRemove.length > 1\n\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\tsource: \"delete_collection_filter\",\n\t\t\t\t\ttitle: isPlural ? \"Delete Dynamic Filters\" : \"Delete Dynamic Filter\",\n\t\t\t\t\tdescription: isPlural\n\t\t\t\t\t\t? \"Interacting with layers linked to these filters will no longer apply filtering.\"\n\t\t\t\t\t\t: \"Interacting with layers linked to this filter will no longer apply filtering.\",\n\t\t\t\t\tconfirmLabel: Dictionary.Delete,\n\t\t\t\t\tcancelLabel: Dictionary.Cancel,\n\t\t\t\t\tvariant: \"destructive\",\n\t\t\t\t\tonConfirm: removeFilter,\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tremoveFilter()\n\t\t\t}\n\t\t},\n\t\t[allFilters, onChange, repeaterOriginalId],\n\t)\n\n\tconst setFiltersOperator = useCallback(\n\t\t(operator: CollectionFilterOperator) => {\n\t\t\tonChange({ collectionFiltersOperator: operator })\n\t\t},\n\t\t[onChange],\n\t)\n\n\tif (!collectionData) return null\n\n\treturn (\n\t\t<PanelRow title={rowTitle} traitTypeKeys={filtersKeys}>\n\t\t\t<CollectionFilterListPopoutButton\n\t\t\t\tcollectionData={collectionData}\n\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\tfilters={allFilters}\n\t\t\t\tfiltersOperator={filtersOperator}\n\t\t\t\tsetFiltersOperator={setFiltersOperator}\n\t\t\t\tupdateFilter={updateFilter}\n\t\t\t\tremoveFilter={handleRemoveFilter}\n\t\t\t\taddFilter={addFilter}\n\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n})\n\nfunction isNonEmptyString(value: unknown): value is string {\n\treturn isString(value) && value.length > 0\n}\n\nfunction popoutButtonTitle(collectionData: DataDefinition, filter: CollectionFilter): string {\n\tif (!filter.itemKey) return Dictionary.Inactive\n\tconst control = collectionData.properties[filter.itemKey]\n\tif (!control) return Dictionary.Inactive\n\n\tconst firstTransform = filter.transforms[0] as (typeof filter.transforms)[0] | undefined\n\n\tconst title = control.title ? titleCase(control.title) : titleCase(filter.itemKey)\n\n\tif (firstTransform) {\n\t\tswitch (firstTransform.name) {\n\t\t\tcase \"equals\": {\n\t\t\t\tswitch (control.type) {\n\t\t\t\t\tcase ControlType.Boolean: {\n\t\t\t\t\t\tconst isNegated = firstTransform.value === false\n\t\t\t\t\t\treturn getNegatedLabel(title, isNegated)\n\t\t\t\t\t}\n\t\t\t\t\tcase ControlType.Enum: {\n\t\t\t\t\t\tif (!isNonEmptyString(firstTransform.value)) break\n\n\t\t\t\t\t\tconst optionIndex = control.options.findIndex(option => option === firstTransform.value)\n\t\t\t\t\t\tconst optionTitle = control.optionTitles?.[optionIndex] ?? fallbackTitleForOption(firstTransform.value)\n\n\t\t\t\t\t\tconst secondTransform = filter.transforms[1] as (typeof filter.transforms)[1] | undefined\n\t\t\t\t\t\tconst isNegated = secondTransform?.name === \"negate\"\n\t\t\t\t\t\treturn getNegatedLabel(optionTitle, isNegated)\n\t\t\t\t\t}\n\t\t\t\t\tcase ControlType.String:\n\t\t\t\t\t\tif (isNonEmptyString(firstTransform.value)) {\n\t\t\t\t\t\t\treturn firstTransform.value\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"startsWith\":\n\t\t\t\tif (isNonEmptyString(firstTransform.value)) return `${firstTransform.value}\u2026`\n\t\t\t\tbreak\n\t\t\tcase \"endsWith\":\n\t\t\t\tif (isNonEmptyString(firstTransform.value)) return `\u2026${firstTransform.value}`\n\t\t\t\tbreak\n\t\t\tcase \"contains\":\n\t\t\t\tif (control.type === ControlType.String && isNonEmptyString(firstTransform.value)) {\n\t\t\t\t\treturn `\u2026${firstTransform.value}\u2026`\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase \"negate\":\n\t\t\t\tif (control.type === ControlType.Boolean) return getNegatedLabel(title)\n\t\t}\n\t}\n\n\treturn title\n}\n\nfunction filtersPopoutButtonTitle(collectionData: DataDefinition, filters: readonly CollectionFilter[]): string {\n\tif (filters.length > 1) return Dictionary.Multiple\n\n\tconst filter = filters[0]\n\tif (!filter) return Dictionary.AddEllipsis\n\n\treturn popoutButtonTitle(collectionData, filter)\n}\n\nfunction getVariableTypeForFilter(collectionData: DataDefinition, filter: CollectionFilter): VariableType | null {\n\tif (!filter.itemKey) return null\n\tconst control = collectionData.properties[filter.itemKey]\n\tif (!control) return null\n\treturn convertControlTypeToVariableType(control.type)\n}\n\nfunction getFilterIconAndType(\n\tcollectionData: DataDefinition,\n\tfilter: CollectionFilter,\n\tagentExperimentEnabled: boolean,\n): JSX.Element {\n\tconst type = getVariableTypeForFilter(collectionData, filter)\n\tif (!type) {\n\t\tif (agentExperimentEnabled) return <IconCollectionFilters />\n\t\treturn <IconComputedValue />\n\t}\n\treturn iconForVariableType(type, { compactStringIcon: agentExperimentEnabled, agentExperimentEnabled })\n}\n\nfunction FilterPopoutButtonPreview({\n\ticon,\n\tcompact = false,\n\tsuggestion = false,\n}: {\n\ticon: React.ReactNode\n\tcompact?: boolean\n\tsuggestion?: boolean\n}) {\n\treturn (\n\t\t<PopoutButtonPreviewIconWrapper\n\t\t\tcolor=\"transparent\"\n\t\t\tbackground={suggestion ? colors.swatchBackgroundPlaceholderForBorder : colors.tint}\n\t\t\tstrokedIcon={compact}\n\t\t>\n\t\t\t{icon}\n\t\t</PopoutButtonPreviewIconWrapper>\n\t)\n}\n\nfunction shouldUseCompactFilterPreview(\n\tcollectionData: DataDefinition,\n\tfilter: CollectionFilter,\n\tagentExperimentEnabled: boolean,\n) {\n\treturn agentExperimentEnabled && getVariableTypeForFilter(collectionData, filter) === ControlType.String\n}\n\nfunction collectionFilterPopoutButtonPreview(\n\tcollectionData: DataDefinition,\n\tfilter: CollectionFilter,\n\tagentExperimentEnabled: boolean,\n) {\n\tconst icon = getFilterIconAndType(collectionData, filter, agentExperimentEnabled)\n\n\treturn (\n\t\t<FilterPopoutButtonPreview\n\t\t\ticon={icon}\n\t\t\tcompact={shouldUseCompactFilterPreview(collectionData, filter, agentExperimentEnabled)}\n\t\t/>\n\t)\n}\n\ninterface CollectionFilterListPopoutButtonProps {\n\tcollectionData: DataDefinition\n\tdataIdentifier: ModuleExportIdentifierString\n\tfilters: readonly CollectionFilter[]\n\tfiltersOperator: CollectionFilterOperator | undefined\n\tsetFiltersOperator: (operator: CollectionFilterOperator) => void\n\tupdateFilter: (filter: CollectionFilter) => void\n\tremoveFilter: (...ids: NodeID[]) => void\n\taddFilter: (itemKey?: string | null, transforms?: ValueTransform[], openFilterDetail?: boolean) => void\n\trepeaterOriginalId: NodeID\n\tagentExperimentEnabled: boolean\n}\n\nfunction CollectionFilterListPopoutButton({\n\tcollectionData,\n\tdataIdentifier,\n\tfilters,\n\tfiltersOperator,\n\tsetFiltersOperator,\n\tupdateFilter,\n\tremoveFilter,\n\taddFilter,\n\trepeaterOriginalId,\n\tagentExperimentEnabled,\n}: CollectionFilterListPopoutButtonProps) {\n\tconst fieldOptions = useMemo(() => getFieldOptions(collectionData, dataIdentifier), [collectionData, dataIdentifier])\n\n\tconst removeAllFilters = () => removeFilter(...filters.map(filter => filter.id))\n\tconst onDelete = filters.length > 0 ? removeAllFilters : undefined\n\n\tconst popoutElement = useMemo(\n\t\t() => (\n\t\t\t<CollectionFilterListPopout\n\t\t\t\tcollectionData={collectionData}\n\t\t\t\tdataIdentifier={dataIdentifier}\n\t\t\t\tfilters={filters}\n\t\t\t\tfiltersOperator={filtersOperator}\n\t\t\t\tsetFiltersOperator={setFiltersOperator}\n\t\t\t\tupdateFilter={updateFilter}\n\t\t\t\tremoveFilter={removeFilter}\n\t\t\t\taddFilter={addFilter}\n\t\t\t\tfieldOptions={fieldOptions}\n\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t/>\n\t\t),\n\t\t[\n\t\t\tcollectionData,\n\t\t\tdataIdentifier,\n\t\t\tfilters,\n\t\t\tfiltersOperator,\n\t\t\tsetFiltersOperator,\n\t\t\tupdateFilter,\n\t\t\tremoveFilter,\n\t\t\taddFilter,\n\t\t\tfieldOptions,\n\t\t\trepeaterOriginalId,\n\t\t\tagentExperimentEnabled,\n\t\t],\n\t)\n\n\tif (filters.length === 0) {\n\t\treturn (\n\t\t\t<AddCollectionFilterButton\n\t\t\t\tfieldOptions={fieldOptions}\n\t\t\t\taddFilter={addFilter}\n\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PopoutButtonWithPreview\n\t\t\tdisplayDivider\n\t\t\tid=\"filters\"\n\t\t\ttitle={filtersPopoutButtonTitle(collectionData, filters)}\n\t\t\tnavigationTitle=\"Filters\"\n\t\t\tonDelete={onDelete}\n\t\t\tsuggestion={false}\n\t\t\tpreview={\n\t\t\t\t<FilterPopoutButtonPreview icon={agentExperimentEnabled ? <IconCollectionFilters /> : <IconComputedValue />} />\n\t\t\t}\n\t\t\tpopout={popoutElement}\n\t\t/>\n\t)\n}\n\ninterface CollectionFilterListPopoutProps extends CollectionFilterListPopoutButtonProps {\n\tfieldOptions: FieldOption[]\n}\n\nfunction CollectionFilterListPopout({\n\tcollectionData,\n\tfilters,\n\tfiltersOperator,\n\tsetFiltersOperator,\n\tupdateFilter,\n\tremoveFilter,\n\taddFilter,\n\tfieldOptions,\n\trepeaterOriginalId,\n\tagentExperimentEnabled,\n}: CollectionFilterListPopoutProps) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst noFilters = filters.length === 0\n\tconst hasPageVariables = useEngineState(\n\t\t() => {\n\t\t\tconst activeScope = engine.stores.scopeStore.active\n\t\t\treturn withVariables(activeScope) && activeScope.variables.some(isVariableDefinition)\n\t\t},\n\t\t[],\n\t\t[engine.stores.scopeStore, EngineChange.Tree],\n\t)\n\n\tconst openVariablesModal = useCallback(() => {\n\t\tengine.stores.modalStore.set({ type: ModalType.Variables, source: \"collection_filters\" })\n\t}, [])\n\n\treturn (\n\t\t<Scroll>\n\t\t\t<Stack gap={0}>\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t>\n\t\t\t\t\t<PanelRow title=\"Match\">\n\t\t\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t\t\t{operatorOptions.map(operator => (\n\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\tkey={operator}\n\t\t\t\t\t\t\t\t\ttitle={titleCase(operator)}\n\t\t\t\t\t\t\t\t\tidentifier={operator}\n\t\t\t\t\t\t\t\t\tselected={(filtersOperator ?? defaultFiltersOperator) === operator}\n\t\t\t\t\t\t\t\t\tonSelect={setFiltersOperator}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t{filters.map((filter, idx) => (\n\t\t\t\t\t\t<PanelRow key={filter.id} title={idx === 0 ? rowTitle : \" \"} traitTypeKeys={filtersKeys}>\n\t\t\t\t\t\t\t<CollectionFilterPopoutButton\n\t\t\t\t\t\t\t\tcollectionData={collectionData}\n\t\t\t\t\t\t\t\tfilter={filter}\n\t\t\t\t\t\t\t\tonChange={updateFilter}\n\t\t\t\t\t\t\t\tremoveFilter={removeFilter}\n\t\t\t\t\t\t\t\tfieldOptions={fieldOptions}\n\t\t\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t))}\n\t\t\t\t\t<PanelRow title={noFilters ? rowTitle : \" \"}>\n\t\t\t\t\t\t<AddCollectionFilterButton\n\t\t\t\t\t\t\tfieldOptions={fieldOptions}\n\t\t\t\t\t\t\taddFilter={addFilter}\n\t\t\t\t\t\t\trepeaterOriginalId={repeaterOriginalId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Stack>\n\t\t\t\t{hasPageVariables && (\n\t\t\t\t\t<Stack padding={dimensions.css.panelPadding} className={dividerAbove}>\n\t\t\t\t\t\t<Button onClick={openVariablesModal}>Edit Variables</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Scroll>\n\t)\n}\n\ninterface CollectionFilterPopoutProps {\n\tcollectionData: DataDefinition\n\tfilter: CollectionFilter\n\tonChange: (filter: CollectionFilter) => void\n\tremoveFilter: (...ids: NodeID[]) => void\n\tfieldOptions: FieldOption[]\n\tagentExperimentEnabled: boolean\n}\n\nfunction CollectionFilterPopoutButton({\n\tcollectionData,\n\tfilter,\n\tonChange,\n\tremoveFilter,\n\tfieldOptions,\n\tagentExperimentEnabled,\n}: CollectionFilterPopoutProps) {\n\tconst useCompactPreview = shouldUseCompactFilterPreview(collectionData, filter, agentExperimentEnabled)\n\n\treturn (\n\t\t<PopoutButtonWithPreview\n\t\t\tdisplayDivider\n\t\t\tid={filter.id}\n\t\t\ttitle={popoutButtonTitle(collectionData, filter)}\n\t\t\tnavigationTitle=\"Filter\"\n\t\t\tonDelete={() => removeFilter(filter.id)}\n\t\t\tpreview={collectionFilterPopoutButtonPreview(collectionData, filter, agentExperimentEnabled)}\n\t\t\tstrokedIconPreview={useCompactPreview}\n\t\t\tpopout={\n\t\t\t\t<CollectionFilterPopout\n\t\t\t\t\tcollectionData={collectionData}\n\t\t\t\t\tfilter={filter}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\tremoveFilter={removeFilter}\n\t\t\t\t\tfieldOptions={fieldOptions}\n\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t)\n}\n\ninterface AddCollectionFilterButtonProps {\n\tfieldOptions: FieldOption[]\n\taddFilter: (itemKey?: string | null, transforms?: ValueTransform[], openFilterDetail?: boolean) => void\n\trepeaterOriginalId: NodeID\n}\n\nfunction AddCollectionFilterButton({ fieldOptions, addFilter, repeaterOriginalId }: AddCollectionFilterButtonProps) {\n\tconst engine = useAndAssertVekterEngine()\n\n\tconst handleMouseDown = (event: React.MouseEvent) => {\n\t\tconst clientRect = event.currentTarget.getBoundingClientRect()\n\n\t\tconst nonNegatedFields = fieldOptions.filter(fieldOption => !fieldOption.isNegated)\n\n\t\tconst menuOptions: MenuItemOptions[] = nonNegatedFields.map(fieldOption => {\n\t\t\tconst isSelfReference = isTopLevelIdVariableId(fieldOption.itemKey)\n\t\t\tconst dynamicFilterPresets = isSelfReference ? [] : getDynamicFilterPresets(fieldOption.control.type)\n\t\t\tconst dynamicMenuItems: MenuItemOptions[] = []\n\n\t\t\tif (dynamicFilterPresets.length > 0) {\n\t\t\t\tdynamicMenuItems.push({\n\t\t\t\t\tlabel: \"Dynamic\",\n\t\t\t\t\tenabled: false,\n\t\t\t\t})\n\n\t\t\t\tfor (const preset of dynamicFilterPresets) {\n\t\t\t\t\tdynamicMenuItems.push({\n\t\t\t\t\t\tlabel: preset.label,\n\t\t\t\t\t\tclick: async () => {\n\t\t\t\t\t\t\tconst transforms = await preset.createFilter({\n\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\trepeaterOriginalId,\n\t\t\t\t\t\t\t\tfieldOption,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tif (!transforms) return\n\n\t\t\t\t\t\t\taddFilter(fieldOption.itemKey, transforms, false)\n\t\t\t\t\t\t\trecord(\"dynamic_filter_created\", {\n\t\t\t\t\t\t\t\tpresetType: preset.presetType,\n\t\t\t\t\t\t\t\tcontrolType: fieldOption.control.type,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\n\t\t\t\tdynamicMenuItems.push({ type: \"separator\" })\n\t\t\t}\n\n\t\t\tdynamicMenuItems.push({\n\t\t\t\tlabel: \"Static\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst defaultTransform = getDefaultTransformForField(fieldOption)\n\t\t\t\t\taddFilter(fieldOption.itemKey, [defaultTransform])\n\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(\"filters\")\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn {\n\t\t\t\tlabel: fieldOption.control.title,\n\t\t\t\tsubmenu: dynamicMenuItems,\n\t\t\t}\n\t\t})\n\n\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\tlocation: {\n\t\t\t\tx: clientRect.left,\n\t\t\t\ty: clientRect.top,\n\t\t\t\twidth: clientRect.width,\n\t\t\t\theight: clientRect.height,\n\t\t\t},\n\t\t})\n\t}\n\n\treturn (\n\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\ttype=\"collectionFilter\"\n\t\t\tonMouseDown={handleMouseDown}\n\t\t\trole=\"button\"\n\t\t\taria-label=\"Add Filter\"\n\t\t/>\n\t)\n}\n\nfunction canCreateTransformForField(fieldOption: FieldOption, name: ValueTransformName): boolean {\n\tconst inputTypes = getInputTypesForValueTransformName(name)\n\treturn Boolean(inputTypes?.includes(fieldOption.control.type))\n}\n\nfunction getDefaultTransformForField(fieldOption: FieldOption): ValueTransform {\n\tif (canCreateTransformForField(fieldOption, \"equals\")) {\n\t\treturn createValueTransformWithName({\n\t\t\tname: \"equals\",\n\t\t\tinput: fieldOption.control.type,\n\t\t\toutput: ControlType.Boolean,\n\t\t})\n\t}\n\n\tif (canCreateTransformForField(fieldOption, \"containsAny\")) {\n\t\treturn createValueTransformWithName({\n\t\t\tname: \"containsAny\",\n\t\t\tinput: fieldOption.control.type,\n\t\t\toutput: ControlType.Boolean,\n\t\t})\n\t}\n\n\tif (canCreateTransformForField(fieldOption, \"contains\")) {\n\t\treturn createValueTransformWithName({\n\t\t\tname: \"contains\",\n\t\t\tinput: fieldOption.control.type,\n\t\t\toutput: ControlType.Boolean,\n\t\t})\n\t}\n\n\treturn createValueTransformWithName({\n\t\tname: \"isSet\",\n\t\tinput: fieldOption.control.type,\n\t\toutput: ControlType.Boolean,\n\t})\n}\n\nconst valueTransformNamesWithBooleanOutput = getEnabledValueTransformNames().filter(valueTransformName =>\n\tgetOutputTypesForValueTransformName(valueTransformName).includes(ControlType.Boolean),\n)\n\nconst typesThatCanBecomeBoolean = new Set<ValueTransformType>([ControlType.Boolean])\n\nvalueTransformNamesWithBooleanOutput.forEach(valueTransformName => {\n\tconst inputTypes = getInputTypesForValueTransformName(valueTransformName)\n\tif (!inputTypes) return\n\tinputTypes.forEach(inputType => {\n\t\ttypesThatCanBecomeBoolean.add(inputType)\n\t})\n})\n\nconst supportedTransformNames = getEnabledValueTransformNames().filter(isQueryableValueTransformName)\n\ntype FieldOptionControl = Extract<ControlDescription, { type: ValueTransformType }>\n\nfunction isFieldOptionControl(control: ControlDescription): control is FieldOptionControl {\n\treturn isValueTransformType(control.type)\n}\n\nexport interface FieldOption {\n\titemKey: string\n\tcontrol: FieldOptionControl\n\tisNegated: boolean\n\tdataIdentifier: ModuleExportIdentifierString\n}\n\nfunction getFieldOptions(collectionData: DataDefinition, dataIdentifier: ModuleExportIdentifierString): FieldOption[] {\n\tconst result: FieldOption[] = []\n\n\tfor (const itemKey in collectionData.properties) {\n\t\t// Auto generated Previous and Next fields should never be used for filtering\n\t\tif (isCollectionNavigationVariableId(itemKey)) continue\n\n\t\tconst control = collectionData.properties[itemKey]\n\t\tif (!control) continue\n\n\t\tif (!isFieldOptionControl(control)) continue\n\t\tif (!typesThatCanBecomeBoolean.has(control.type)) continue\n\n\t\tconst fieldOption: FieldOption = { itemKey, control, isNegated: false, dataIdentifier }\n\t\tresult.push(fieldOption)\n\n\t\tconst canBeNegated = control.type === ControlType.Boolean\n\t\tif (canBeNegated) {\n\t\t\tresult.push({ ...fieldOption, isNegated: true })\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunction CollectionFilterPopout({ collectionData, filter, onChange, fieldOptions }: CollectionFilterPopoutProps) {\n\tconst anyFieldOptionsAvailable = fieldOptions.length > 0\n\tconst selectedFieldOption = fieldOptions.find(fieldOption => filter.itemKey === fieldOption.itemKey)\n\tconst anyFieldOptionSelected = Boolean(selectedFieldOption)\n\n\tconst onSelectItemKey = (itemKey: string, isNegated: boolean) => {\n\t\tconst newlySelectedFieldOption = fieldOptions.find(fieldOption => fieldOption.itemKey === itemKey)\n\t\tassert(newlySelectedFieldOption, \"Field option with item key should exist\")\n\t\tconst newlySelectedFieldControl = newlySelectedFieldOption.control\n\n\t\tconst newFilter = { ...filter, itemKey }\n\t\tconst newInputType = newlySelectedFieldControl.type\n\n\t\tif (newInputType === ControlType.Boolean) {\n\t\t\t// Booleans only need a transform when negated\n\t\t\tnewFilter.transforms = isNegated ? [createNegateTransform()] : []\n\t\t\t// Type changed so we need to change the transforms\n\t\t} else if (!isCompatibleInputType(selectedFieldOption?.control, newlySelectedFieldControl)) {\n\t\t\tconst valueTransformName = getEnabledValueTransformNames().find(name => {\n\t\t\t\tconst supportedInputTypes = getInputTypesForValueTransformName(name)\n\t\t\t\tif (!supportedInputTypes || !supportedInputTypes.includes(newInputType)) return false\n\t\t\t\treturn getOutputTypesForValueTransformName(name).includes(ControlType.Boolean)\n\t\t\t})\n\t\t\tassert(\n\t\t\t\tvalueTransformName,\n\t\t\t\t`A value transform should exist that can convert ${newInputType} into a ${ControlType.Boolean}`,\n\t\t\t)\n\t\t\tconst transform = createValueTransformWithName({\n\t\t\t\tname: valueTransformName,\n\t\t\t\tinput: newlySelectedFieldControl,\n\t\t\t\toutput: ControlType.Boolean,\n\t\t\t})\n\t\t\tnewFilter.transforms = [transform]\n\t\t}\n\n\t\tonChange(newFilter)\n\t}\n\n\tconst onChangeTransforms = (transforms: ValueTransform[]) => {\n\t\tonChange({ ...filter, transforms })\n\t}\n\n\tconst selectedFieldIsNegated =\n\t\tselectedFieldOption?.control.type === ControlType.Boolean && filter.transforms[0]?.name === \"negate\"\n\n\tlet paddingBottom: StackProps[\"paddingBottom\"] | undefined\n\tif (selectedFieldOption) {\n\t\tconst transformCount = filter.transforms.length\n\t\tconst hasTransforms = selectedFieldIsNegated ? transformCount > 1 : transformCount > 0\n\t\tpaddingBottom = hasTransforms ? 0 : `calc(${dimensions.css.panelPadding} + ${dimensions.css.inputSpacing} / 2)`\n\t} else {\n\t\tpaddingBottom = dimensions.css.inputSpacing\n\t}\n\n\treturn (\n\t\t<Scroll>\n\t\t\t<Stack gap={0}>\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\t>\n\t\t\t\t\t<PanelRow title={Dictionary.Field}>\n\t\t\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tselected={!anyFieldOptionSelected}\n\t\t\t\t\t\t\t\tvisible={!anyFieldOptionSelected}\n\t\t\t\t\t\t\t\ttitle={anyFieldOptionsAvailable ? Dictionary.SelectEllipsis : \"None Available\"}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButtonItem type=\"divider\" visible={!anyFieldOptionSelected} />\n\t\t\t\t\t\t\t{fieldOptions.map(({ itemKey, control, isNegated }) => {\n\t\t\t\t\t\t\t\tconst title = control.title ? titleCase(control.title) : titleCase(itemKey)\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\t\tkey={itemKey + isNegated}\n\t\t\t\t\t\t\t\t\t\ttitle={getNegatedLabel(title, isNegated)}\n\t\t\t\t\t\t\t\t\t\tselected={filter.itemKey === itemKey && selectedFieldIsNegated === isNegated}\n\t\t\t\t\t\t\t\t\t\tonSelect={() => onSelectItemKey(itemKey, isNegated)}\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</PopupButton>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Stack>\n\t\t\t\t{selectedFieldOption && (\n\t\t\t\t\t<ValueTransformChain\n\t\t\t\t\t\tpropName={selectedFieldOption.itemKey}\n\t\t\t\t\t\tmainInputType={selectedFieldOption.control.type}\n\t\t\t\t\t\tvariableIsNegated={selectedFieldIsNegated}\n\t\t\t\t\t\ttransforms={filter.transforms}\n\t\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\t\tonChangeTransforms={onChangeTransforms}\n\t\t\t\t\t\tinputControl={selectedFieldOption.control}\n\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\tinputControlKey={selectedFieldOption.itemKey}\n\t\t\t\t\t\tinputControlSourceIdentifier={collectionData.identifier}\n\t\t\t\t\t\tsupportedTransformNames={supportedTransformNames}\n\t\t\t\t\t\tsupportsRelativeDates={false}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Scroll>\n\t)\n}\n\nfunction isCompatibleInputType(\n\tpreviousInputControl: FieldOption[\"control\"] | undefined,\n\tnextInputControl: FieldOption[\"control\"],\n) {\n\t// If we don't have a previous input control, they can't be compatible.\n\tif (isUndefined(previousInputControl)) return false\n\n\t// If the input control types are different, they can't be compatible.\n\tif (previousInputControl.type !== nextInputControl.type) return false\n\n\t// If the input control is a [multi-]collection reference, they are only\n\t// compatible if they have the same data identifier.\n\tif (\n\t\tpreviousInputControl.type !== ControlType.CollectionReference &&\n\t\tpreviousInputControl.type !== ControlType.MultiCollectionReference\n\t) {\n\t\treturn true\n\t}\n\tassert(\n\t\tnextInputControl.type === ControlType.CollectionReference ||\n\t\t\tnextInputControl.type === ControlType.MultiCollectionReference,\n\t\t\"Unreachable state\",\n\t)\n\n\treturn previousInputControl.dataIdentifier === nextInputControl.dataIdentifier\n}\n\nfunction isAnyFilterInUse(\n\tengine: VekterEngine,\n\tfiltersToRemove: readonly CollectionFilter[],\n\trepeaterOriginalId: NodeID,\n): boolean {\n\tconst repeaterNode = engine.tree.getNode(repeaterOriginalId)\n\tif (!repeaterNode) return false\n\n\tconst scopeNode = engine.tree.getScopeNodeFor(repeaterNode)\n\tif (!scopeNode || !isWebPageNode(scopeNode)) return false\n\n\tconst loadedWebPage = scopeNode.loaded\n\tif (!loadedWebPage) return false\n\n\tconst webPageVariableIds = getWebPageVariableIdsFromFilters(filtersToRemove, scopeNode.id)\n\tif (webPageVariableIds.size === 0) return false\n\n\tfor (const variableId of webPageVariableIds) {\n\t\tif (isVariableUsedOutsideFilters(engine, variableId, loadedWebPage, repeaterOriginalId)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunction getWebPageVariableIdsFromFilters(filters: readonly CollectionFilter[], scopeId: NodeID): Set<VariableID> {\n\tconst result = new Set<VariableID>()\n\n\tfor (const filter of filters) {\n\t\tfor (const transform of filter.transforms) {\n\t\t\tconst variableRefs = getUsedVariableReferencesFromValueTransform(transform)\n\n\t\t\tfor (const ref of variableRefs) {\n\t\t\t\tif (ref.providerId !== scopeId) continue\n\t\t\t\tresult.add(ref.id)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunction isVariableUsedOutsideFilters(\n\tengine: VekterEngine,\n\tvariableId: VariableID,\n\twebPageNode: LoadedWebPageNode,\n\trepeaterNodeId: NodeID,\n): boolean {\n\tfor (const node of webPageNode.loaded.descendants()) {\n\t\tif (node.id === repeaterNodeId) continue\n\n\t\tlet found = false\n\t\tforEachVariableReferenceOfNode(\n\t\t\tengine.tree,\n\t\t\tnode,\n\t\t\t\"excludeInherited\",\n\t\t\t\"readsRawNodeData\",\n\t\t\tundefined,\n\t\t\t(variableReference: VariableReference) => {\n\t\t\t\tif (variableReference.id === variableId) {\n\t\t\t\t\tfound = true\n\t\t\t\t}\n\t\t\t},\n\t\t)\n\n\t\tif (found) return true\n\t}\n\n\treturn false\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CachedDataSourceVariables } from \"document/models/CanvasTree/nodes/utils/getDataSourceVariablesFromDataDefinition.ts\"\nimport { getDataSourceVariablesFromDataDefinitionCached } from \"document/models/CanvasTree/nodes/utils/getDataSourceVariablesFromDataDefinition.ts\"\nimport { emptyControlMap, emptyVariableMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\n\ninterface State {\n\tdataIdentifier: ModuleExportIdentifierString | undefined\n\tvariables: CachedDataSourceVariables\n}\n\nconst noDataSourceVariables: CachedDataSourceVariables = {\n\tvariableMap: emptyVariableMap,\n\tcontrolMap: emptyControlMap,\n}\n\nexport function useDataSourceVariablesFromDataDefinition(\n\tdataIdentifier: ModuleExportIdentifierString | undefined,\n): CachedDataSourceVariables {\n\tconst getState = useCallback((): State => {\n\t\tif (!dataIdentifier) {\n\t\t\treturn {\n\t\t\t\tdataIdentifier,\n\t\t\t\tvariables: noDataSourceVariables,\n\t\t\t}\n\t\t}\n\n\t\tconst variables = getDataSourceVariablesFromDataDefinitionCached(\n\t\t\tdataIdentifier,\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tengine.componentLoader.activeBundleHash,\n\t\t)\n\n\t\treturn { dataIdentifier, variables }\n\t}, [dataIdentifier])\n\n\tconst [state, setState] = useState(getState)\n\n\tuseEffect(() => {\n\t\tconst token = engine.scheduler.changes.observe(EngineChange.Tree, EngineChange.ActiveBundle, () => {\n\t\t\tsetState(previousState => {\n\t\t\t\tconst newState = getState()\n\t\t\t\tif (newState.dataIdentifier !== previousState.dataIdentifier) return previousState\n\t\t\t\tif (previousState.variables === newState.variables) return previousState\n\t\t\t\treturn newState\n\t\t\t})\n\t\t})\n\n\t\treturn () => {\n\t\t\tengine.scheduler.changes.removeObserver(token)\n\t\t}\n\t}, [getState])\n\n\tif (dataIdentifier !== state.dataIdentifier) {\n\t\tconst newState = getState()\n\t\tsetState(newState)\n\t\treturn newState.variables\n\t}\n\n\treturn state.variables\n}\n", "import type { VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { IconOrder, PopupButton, PopupButtonItem, PopupButtonMenu, Stack } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, List } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { useDataSourceVariablesFromDataDefinition } from \"document/components/utils/useDataSourceVariablesFromDataDefinition.ts\"\nimport engine from \"document/engine.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableProviderVariableMap } from \"document/models/CanvasTree/traits/VariableProvider.ts\"\nimport type {\n\tCollectionOrder,\n\tCollectionOrderDirection,\n\tCollectionOrderItem,\n\tWithCollectionOptions,\n} from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { defaultOrderDirection } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tconvertControlTypeToVariableType,\n\tvariableSupportsSorting,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { nextItemVariableId, previousItemVariableId } from \"document/utils/CollectionItemVariables.ts\"\nimport type { ControlDescription } from \"library/index.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport {\n\tgetParentVariableId,\n\tisNestedVariableSelected,\n\tisReferenceToTailVariableId,\n} from \"utils/collectionReferenceUtils.ts\"\nimport { getId } from \"utils/getId.ts\"\nimport { isDefined, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ButtonWithPreview } from \"../../shared/ButtonWithPreview.tsx\"\nimport { IconCollectionSorting } from \"../../shared/CollectionContentIcons.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { iconForVariableType } from \"../../shared/utils/iconForVariable.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport type { VariableTree } from \"../utils/useDisplayVariableAssignmentOptions.ts\"\nimport { getVariableTree } from \"../utils/useDisplayVariableAssignmentOptions.ts\"\nimport * as styles from \"./CollectionOrderRow.styles.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst traitTypeKeys: (keyof WithCollectionOptions)[] = [\"collectionOrder\", \"collectionReverse\"]\n\nconst defaultOrder: CollectionOrder = []\n\ninterface CollectionOrderRowProps {\n\tdataIdentifier: ModuleExportIdentifierString\n\torder: CollectionOrder | undefined\n\treverse: boolean | undefined\n\tonChange(update: Partial<WithCollectionOptions>): void\n}\n\nexport function CollectionOrderRow({\n\tdataIdentifier,\n\torder = defaultOrder,\n\treverse,\n\tonChange,\n}: CollectionOrderRowProps) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst { variableMap, controlMap } = useDataSourceVariablesFromDataDefinition(dataIdentifier)\n\n\tconst addItem = useCallback(() => {\n\t\tconst orderId = randomID()\n\n\t\tconst newItem: CollectionOrderItem = {\n\t\t\tid: orderId,\n\t\t\titemKey: null,\n\t\t\tdirection: defaultOrderDirection,\n\t\t}\n\n\t\tonChange({\n\t\t\tcollectionOrder: List.push(order, newItem),\n\t\t})\n\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(orderId)\n\t}, [onChange, order])\n\n\tconst moveItem = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\tonChange({\n\t\t\t\tcollectionOrder: List.move(order, from, to),\n\t\t\t})\n\t\t},\n\t\t[onChange, order],\n\t)\n\n\tconst removeItem = useCallback(\n\t\t(index: number) => {\n\t\t\tonChange({\n\t\t\t\tcollectionOrder: List.remove(order, index),\n\t\t\t})\n\t\t},\n\t\t[onChange, order],\n\t)\n\n\tconst removeReverse = useCallback(() => {\n\t\tonChange({\n\t\t\tcollectionReverse: undefined,\n\t\t})\n\t}, [onChange])\n\n\tif (reverse) {\n\t\treturn (\n\t\t\t<PanelRow title=\"Sorting\" traitTypeKeys={traitTypeKeys}>\n\t\t\t\t<ButtonWithPreview\n\t\t\t\t\tdoubleColumn\n\t\t\t\t\ttitle=\"Reverse\"\n\t\t\t\t\tclassName={styles.reverseButton}\n\t\t\t\t\ttabIndex={0}\n\t\t\t\t\tonDelete={removeReverse}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.tint} color=\"transparent\">\n\t\t\t\t\t\t\t{agentExperimentEnabled ? (\n\t\t\t\t\t\t\t\t<IconCollectionSorting className={styles.reverseButtonIcon} />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<IconOrder className={styles.reverseButtonIcon} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Sorting\" traitTypeKeys={traitTypeKeys}>\n\t\t\t<Stack className={doubleColumnClass}>\n\t\t\t\t{order.length > 0 && (\n\t\t\t\t\t<Sortable\n\t\t\t\t\t\tenabled={order.length > 1}\n\t\t\t\t\t\tclassName={styles.sortableList}\n\t\t\t\t\t\titems={order}\n\t\t\t\t\t\tmoveItem={moveItem}\n\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\tremoveItem={removeItem}\n\t\t\t\t\t\tonDragStart={popoutWindow.close}\n\t\t\t\t\t>\n\t\t\t\t\t\t{({ item, index }) => {\n\t\t\t\t\t\t\tfunction changeItem(update: Partial<CollectionOrderItem>) {\n\t\t\t\t\t\t\t\tconst newItem: CollectionOrderItem = {\n\t\t\t\t\t\t\t\t\t...item,\n\t\t\t\t\t\t\t\t\t...update,\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tonChange({\n\t\t\t\t\t\t\t\t\tcollectionOrder: List.replace(order, index, newItem),\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlet control: VerifiedControlDescription | undefined\n\t\t\t\t\t\t\tlet parentControl: VerifiedControlDescription | undefined\n\t\t\t\t\t\t\tif (item.itemKey) {\n\t\t\t\t\t\t\t\tcontrol = controlMap.get(item.itemKey)\n\n\t\t\t\t\t\t\t\tconst parentId = getParentVariableId(item.itemKey)\n\t\t\t\t\t\t\t\tif (parentId) {\n\t\t\t\t\t\t\t\t\tparentControl = controlMap.get(parentId)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\tid={item.id}\n\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\ttitle={parentControl?.title ?? control?.title ?? Dictionary.Inactive}\n\t\t\t\t\t\t\t\t\tnavigationTitle=\"Order\"\n\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.tint} color=\"transparent\">\n\t\t\t\t\t\t\t\t\t\t\t{getOrderPreview(parentControl ?? control, agentExperimentEnabled)}\n\t\t\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t<OrderItemPopout\n\t\t\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\t\t\t\t\tparentControl={parentControl}\n\t\t\t\t\t\t\t\t\t\t\tvariableMap={variableMap}\n\t\t\t\t\t\t\t\t\t\t\tonChange={changeItem}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonDelete={() => removeItem(index)}\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</Sortable>\n\t\t\t\t)}\n\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"collectionOrder\" onClick={addItem} />\n\t\t\t</Stack>\n\t\t</PanelRow>\n\t)\n}\n\ninterface OrderItemPopoutProps {\n\titem: CollectionOrderItem\n\tcontrol: ControlDescription | undefined\n\tparentControl: ControlDescription | undefined\n\tvariableMap: VariableProviderVariableMap\n\tonChange(update: Partial<CollectionOrderItem>): void\n}\n\nfunction OrderItemPopout({ item, control, parentControl, variableMap, onChange }: OrderItemPopoutProps) {\n\tconst onSelectItemKey = useCallback(\n\t\t(key: VariableID) => {\n\t\t\tonChange({\n\t\t\t\titemKey: key,\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst onSelectDirection = useCallback(\n\t\t(newDirection: CollectionOrderDirection) => {\n\t\t\tonChange({\n\t\t\t\tdirection: newDirection,\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst menuOptions = useMemo(() => {\n\t\tconst { children } = getVariableTree(variableMap)\n\t\tassert(children, \"Variable tree should have children\")\n\n\t\treturn getMenuOptions(children, item, onSelectItemKey)\n\t}, [variableMap, item, onSelectItemKey])\n\n\tconst showSelectItemKeyMenu = useCallback(\n\t\t(event: React.SyntheticEvent<HTMLButtonElement>) => {\n\t\t\tconst clientRect = event.currentTarget.getBoundingClientRect()\n\n\t\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\t\tlocation: {\n\t\t\t\t\tx: clientRect.left + dimensions.values.contextMenuOffsetX,\n\t\t\t\t\ty: clientRect.bottom,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[menuOptions],\n\t)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title={Dictionary.Field}>\n\t\t\t\t<PopupButtonMenu\n\t\t\t\t\twrapperClassName={doubleColumnClass}\n\t\t\t\t\ttitle={parentControl?.title ?? control?.title ?? Dictionary.SelectEllipsis}\n\t\t\t\t\tonShowMenu={showSelectItemKeyMenu}\n\t\t\t\t\tenabled={menuOptions.length > 0}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t{control && (\n\t\t\t\t<PanelRow title=\"Order\">\n\t\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\ttitle={getOrderDirectionTitle(control, \"asc\")}\n\t\t\t\t\t\t\tidentifier=\"asc\"\n\t\t\t\t\t\t\tselected={item.direction === \"asc\"}\n\t\t\t\t\t\t\tonSelect={onSelectDirection}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\ttitle={getOrderDirectionTitle(control, \"desc\")}\n\t\t\t\t\t\t\tidentifier=\"desc\"\n\t\t\t\t\t\t\tselected={item.direction === \"desc\"}\n\t\t\t\t\t\t\tonSelect={onSelectDirection}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction getMenuOption(\n\t{ variable, children }: VariableTree,\n\titem: CollectionOrderItem,\n\tonSelectItemKey: (key: VariableID) => void,\n): MenuItemOptions | undefined {\n\tif (isUndefined(variable)) return\n\tif (isReferenceToTailVariableId(variable.id, previousItemVariableId)) return\n\tif (isReferenceToTailVariableId(variable.id, nextItemVariableId)) return\n\n\tif (children) {\n\t\tconst submenu = getMenuOptions(children, item, onSelectItemKey)\n\t\tif (submenu.length === 0) return\n\n\t\treturn {\n\t\t\tlabel: variable.name,\n\t\t\tchecked: isString(item.itemKey) && isNestedVariableSelected(item.itemKey, variable.id),\n\t\t\tsubmenu,\n\t\t}\n\t}\n\n\tif (!variableSupportsSorting(variable)) return\n\n\treturn {\n\t\tlabel: variable.name,\n\t\tchecked: item.itemKey === variable.id,\n\t\tclick() {\n\t\t\tonSelectItemKey(variable.id)\n\t\t},\n\t}\n}\n\nfunction getMenuOptions(\n\tchildren: Record<VariableID, VariableTree>,\n\titem: CollectionOrderItem,\n\tonSelectItemKey: (key: VariableID) => void,\n) {\n\treturn Object.values(children)\n\t\t.map(node => getMenuOption(node, item, onSelectItemKey))\n\t\t.filter(isDefined)\n}\n\nfunction getOrderDirectionTitle(control: ControlDescription, direction: CollectionOrderDirection) {\n\tconst isAscending = direction === \"asc\"\n\n\tswitch (control.type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn isAscending ? Dictionary.AscendingBoolean : Dictionary.DescendingBoolean\n\t\tcase ControlType.Date:\n\t\t\treturn isAscending ? Dictionary.AscendingDate : Dictionary.DescendingDate\n\t\tcase ControlType.Number:\n\t\t\treturn isAscending ? Dictionary.AscendingNumber : Dictionary.DescendingNumber\n\t\tcase ControlType.String:\n\t\t\treturn isAscending ? Dictionary.AscendingString : Dictionary.DescendingString\n\t\tdefault:\n\t\t\treturn isAscending ? Dictionary.Ascending : Dictionary.Descending\n\t}\n}\n\nfunction getOrderPreview(control: VerifiedControlDescription | undefined, agentExperimentEnabled: boolean) {\n\tif (control) {\n\t\tconst variableType = convertControlTypeToVariableType(control.type)\n\n\t\tif (variableType) {\n\t\t\treturn iconForVariableType(variableType, { compactStringIcon: agentExperimentEnabled, agentExperimentEnabled })\n\t\t}\n\t}\n\n\tif (agentExperimentEnabled) return <IconCollectionSorting />\n\treturn <IconOrder />\n}\n", "import \"CollectionOrderRow.styles_cu9gu7.wyw.css\"; export const reverseButton = \"reverseButton_rnqg5fo\";\nexport const reverseButtonIcon = \"reverseButtonIcon_r1u5enio\";\nexport const sortableList = \"sortableList_s1dmzxz7\";", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { memo } from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\trepeaterId: NodeID\n}\n\nexport const RepeaterCanvasEmptyStateRow = memo(function RepeaterCanvasDisplayModeRow({ repeaterId }: Props) {\n\tconst isShowingEmptyState = engine.stores.repeaterStore\n\t\t.useState(state => state.repeatersShowingEmptyState)\n\t\t.has(repeaterId)\n\n\tconst showEmptyState = useEngineCallback(() => {\n\t\tengine.stores.repeaterStore.showEmptyState(repeaterId)\n\t}, [repeaterId])\n\tconst hideEmptyState = useEngineCallback(() => {\n\t\tengine.stores.repeaterStore.hideEmptyState(repeaterId)\n\t}, [repeaterId])\n\n\treturn (\n\t\t<PanelRow title={Dictionary.State}>\n\t\t\t<SegmentedControl readOnly={false} style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle={Dictionary.Default}\n\t\t\t\t\tselected={isShowingEmptyState === false}\n\t\t\t\t\tonSelect={hideEmptyState}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle={Dictionary.Empty}\n\t\t\t\t\tselected={isShowingEmptyState === true}\n\t\t\t\t\tonSelect={showEmptyState}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { IconLoadMore, NumberInputWithTickerAndStepper, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { getRelatedReplicaNodes } from \"code-generation/utils/isOnlyVisibleInCurrentVariant.ts\"\nimport { displayRepeaterContextMenu } from \"document/components/utils/displayRepeaterContextMenu.ts\"\nimport {\n\tdefaultPaginationPageSize,\n\tresetPaginationPageSizeReplicaOverrides,\n} from \"document/components/utils/pagination.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WithCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { removeLoadMoreActions } from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { IconCollectionPagination } from \"../../shared/CollectionContentIcons.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst paginationKeys: (keyof WithCollectionOptions)[] = [\"collectionPaginationPageSize\"]\n\ninterface Props {\n\trepeaterOriginalId: NodeID\n\tpaginationPageSize: number | undefined\n\tonChange: (update: Partial<WithCollectionOptions>) => void\n\tanyReplicaOrReplicaChild: boolean\n}\n\nexport const RepeaterPaginationRow = React.memo(function RepeaterPaginationRow({\n\trepeaterOriginalId,\n\tpaginationPageSize,\n\tanyReplicaOrReplicaChild,\n\tonChange,\n}: Props) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst removePagination = useEngineCallback(() => {\n\t\tonChange({ collectionPaginationPageSize: undefined })\n\n\t\tconst repeaterNode = engine.tree.getNodeWithTrait(repeaterOriginalId, isCollectionRepeater)\n\t\tif (!repeaterNode) return\n\n\t\t// Reset pagination page size across all replicas\n\t\tresetPaginationPageSizeReplicaOverrides(engine.tree, repeaterNode)\n\n\t\t// Remove any load more actions from any frame within the repeater\n\t\tfor (const node of repeaterNode.walk()) {\n\t\t\tremoveLoadMoreActions(engine.tree, engine.componentLoader, node)\n\n\t\t\tfor (const { relatedNode } of getRelatedReplicaNodes(engine.tree, node)) {\n\t\t\t\tremoveLoadMoreActions(engine.tree, engine.componentLoader, relatedNode)\n\t\t\t}\n\t\t}\n\n\t\t// If there's a spinner in the tree for the repeater, remove it\n\t\tif (repeaterNode.dataSourceLoaderId) {\n\t\t\tengine.tree.remove(repeaterNode.dataSourceLoaderId)\n\t\t\trepeaterNode.set({ dataSourceLoaderId: undefined })\n\t\t}\n\n\t\tpopoutWindow.navigation.close()\n\t}, [repeaterOriginalId, onChange])\n\n\t// Replicas should only be allowed to change the pagination page size.\n\tconst onDelete = !anyReplicaOrReplicaChild ? removePagination : undefined\n\n\tconst paginationDisabled = !isNumber(paginationPageSize)\n\tconst title = popoutTitle(paginationPageSize, paginationDisabled)\n\n\tconst addPagination = useEngineCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tevent.stopPropagation()\n\n\t\t\tconst repeaterNode = engine.tree.getNodeWithTrait(repeaterOriginalId, isCollectionRepeater)\n\t\t\tif (!repeaterNode) return\n\n\t\t\tdisplayRepeaterContextMenu({ x: event.clientX, y: event.clientY }, engine, repeaterNode, \"pagination\")\n\t\t},\n\t\t[repeaterOriginalId],\n\t)\n\n\t// It should not be possible to add pagination to a data repeater in a replica.\n\tif (paginationDisabled && anyReplicaOrReplicaChild) {\n\t\treturn null\n\t}\n\n\tif (paginationDisabled) {\n\t\treturn (\n\t\t\t<PanelRow title={Dictionary.Pagination}>\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"pagination\" onMouseDown={addPagination} />\n\t\t\t</PanelRow>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Pagination} traitTypeKeys={paginationKeys}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tid=\"load-more\"\n\t\t\t\ttitle={title}\n\t\t\t\tnavigationTitle={Dictionary.Pagination}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<LoadMorePopoutButtonPreview\n\t\t\t\t\t\ticon={agentExperimentEnabled ? <IconCollectionPagination /> : <IconLoadMore />}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tpopout={<PaginationPageSizePopout paginationPageSize={paginationPageSize} onChange={onChange} />}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n})\n\nfunction popoutTitle(paginationPageSize: number | undefined, paginationDisabled: boolean) {\n\tif (!paginationPageSize || paginationDisabled) {\n\t\treturn Dictionary.AddEllipsis\n\t}\n\n\treturn `${paginationPageSize} Items`\n}\n\nfunction LoadMorePopoutButtonPreview({ icon }: { icon: React.ReactNode }) {\n\treturn (\n\t\t<PopoutButtonPreviewIconWrapper color=\"white\" background={colors.tint}>\n\t\t\t{icon}\n\t\t</PopoutButtonPreviewIconWrapper>\n\t)\n}\n\ninterface PaginationPageSizePopoutProps {\n\tpaginationPageSize: number\n\tonChange: (update: Partial<WithCollectionOptions>) => void\n}\n\nfunction PaginationPageSizePopout({ paginationPageSize, onChange }: PaginationPageSizePopoutProps) {\n\tconst handlePageSizeChange = React.useCallback(\n\t\t(pageSize: number) => {\n\t\t\tconst collectionPaginationPageSize = Math.max(1, Math.round(pageSize))\n\t\t\tonChange({ collectionPaginationPageSize })\n\t\t},\n\t\t[onChange],\n\t)\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.panelPadding}>\n\t\t\t<PanelRow title=\"Items\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={paginationPageSize}\n\t\t\t\t\tdefaultValue={defaultPaginationPageSize}\n\t\t\t\t\tonChange={handlePageSizeChange}\n\t\t\t\t\tmin={1}\n\t\t\t\t\tprecision={0}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow\n\t\t\t\twithMargin={false}\n\t\t\t\tdescription=\"Enabling infinite scroll with footers can impact site SEO. [Learn more](https://www.framer.com/help/articles/infinite-scrolling-and-seo/)\"\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport { TableStylePresetNode } from \"document/models/CanvasTree/nodes/TableStylePresetNode.ts\"\nimport {\n\tisComponentPresetNode,\n\tisImageStylePresetNode,\n\tisRichTextNode,\n\tisTableStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport React from \"react\"\nimport { getDefaultComponentPreset, insertComponentPreset } from \"utils/componentPresetUtils.ts\"\nimport { getDefaultImageStylePreset, insertImageStylePreset } from \"utils/imageStylePresetUtils.ts\"\nimport { getDefaultTableStylePreset, insertTableStylePreset } from \"utils/tableStylePresetUtils.ts\"\nimport { SelectEmbedPresetRow } from \"../rows/SelectEmbedPresetRow.tsx\"\nimport { SelectNodeImageStylePresetRow } from \"../rows/SelectNodeImageStylePresetRow.tsx\"\nimport { SelectNodeTableStylePresetRow } from \"../rows/SelectNodeTableStylePresetRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { selectImageStylePreset } from \"./SelectImageStyleEntityAssetPopout.tsx\"\nimport { selectTableStylePreset } from \"./SelectTableStyleEntityAssetPopout.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { useComponentsWithPresets } from \"./utils/useComponentsWithPresets.ts\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n}\n\nexport function EmbedPresetPanel({ nodeIds }: Props) {\n\tconst popoutIdPrefix = React.useId()\n\tconst componentsWithPresets = useComponentsWithPresets()\n\n\tconst selectionState = useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => {\n\t\t\tconst componentsWithPresetsState = {\n\t\t\t\teveryWithPresets: true,\n\t\t\t\tsomeWithPresets: false,\n\t\t\t\tnameToState: new Map(\n\t\t\t\t\tcomponentsWithPresets.map(component => [\n\t\t\t\t\t\tcomponent.name,\n\t\t\t\t\t\t{ ids: new Set<string>(), presets: new Array<ComponentPresetNode>() },\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tconst imageState = { ids: new Set<string>(), presets: new Array<ImageStylePresetNode>() }\n\t\t\tconst tableState = { ids: new Set<string>(), presets: new Array<TableStylePresetNode>() }\n\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tfor (const component of componentsWithPresets) {\n\t\t\t\t\tconst presetId = node.getComponentPreset(component.componentIdentifier)\n\t\t\t\t\tif (presetId !== undefined) {\n\t\t\t\t\t\tcomponentsWithPresetsState.nameToState.get(component.name)?.ids.add(presetId)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (node.stylePresetImage !== undefined) imageState.ids.add(node.stylePresetImage)\n\n\t\t\t\tif (node.stylePresetTable !== undefined) tableState.ids.add(node.stylePresetTable)\n\t\t\t}\n\n\t\t\tfor (const component of componentsWithPresets) {\n\t\t\t\tconst componentState = componentsWithPresetsState.nameToState.get(component.name)\n\t\t\t\tif (componentState === undefined) continue\n\t\t\t\tcomponentState.presets = engine.tree.getNodesWithTrait(componentState.ids, isComponentPresetNode)\n\t\t\t\tcomponentsWithPresetsState.everyWithPresets &&= componentState.presets.length > 0\n\t\t\t\tcomponentsWithPresetsState.someWithPresets ||= componentState.presets.length > 0\n\t\t\t}\n\n\t\t\timageState.presets = engine.tree.getNodesWithTrait(imageState.ids, isImageStylePresetNode)\n\t\t\ttableState.presets = engine.tree.getNodesWithTrait(tableState.ids, isTableStylePresetNode)\n\n\t\t\treturn { componentsWithPresets: componentsWithPresetsState, image: imageState, table: tableState }\n\t\t},\n\t\t[componentsWithPresets, nodeIds],\n\t)\n\n\tconst hasImagePresets = selectionState.image.presets.length > 0\n\tconst hasTablePresets = selectionState.table.presets.length > 0\n\n\tconst showMenu = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\tcomponentsWithPresets\n\t\t\t\t\t.map<MenuItemOptions>(component => {\n\t\t\t\t\t\tconst presetsCount =\n\t\t\t\t\t\t\tselectionState.componentsWithPresets.nameToState.get(component.name)?.presets.length ?? 0\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlabel: component.name,\n\t\t\t\t\t\t\tenabled: presetsCount === 0,\n\t\t\t\t\t\t\tchecked: presetsCount > 0,\n\t\t\t\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\t\t\tconst preset =\n\t\t\t\t\t\t\t\t\tgetDefaultComponentPreset(engine.tree, component.componentIdentifier) ??\n\t\t\t\t\t\t\t\t\tComponentPresetNode.createDefault(component)\n\n\t\t\t\t\t\t\t\tinsertComponentPreset(engine, preset)\n\n\t\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)) {\n\t\t\t\t\t\t\t\t\tnode.setComponentPreset(preset.componentIdentifier, preset.id)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopout(`${popoutIdPrefix}-${component.componentIdentifier}`)\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.concat(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: Dictionary.Image,\n\t\t\t\t\t\t\tenabled: !hasImagePresets,\n\t\t\t\t\t\t\tchecked: hasImagePresets,\n\t\t\t\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\t\t\tconst preset = getDefaultImageStylePreset(engine.tree) ?? new ImageStylePresetNode()\n\n\t\t\t\t\t\t\t\tinsertImageStylePreset(engine, preset)\n\t\t\t\t\t\t\t\tselectImageStylePreset(nodeIds, preset)\n\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopout(`${popoutIdPrefix}-image`)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: Dictionary.Table,\n\t\t\t\t\t\t\tenabled: !hasTablePresets,\n\t\t\t\t\t\t\tchecked: hasTablePresets,\n\t\t\t\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\t\t\tconst preset = getDefaultTableStylePreset(engine.tree) ?? TableStylePresetNode.createDefault()\n\n\t\t\t\t\t\t\t\tinsertTableStylePreset(engine, preset)\n\t\t\t\t\t\t\t\tselectTableStylePreset(nodeIds, preset)\n\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopout(`${popoutIdPrefix}-table`)\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tcomponentsWithPresets,\n\t\t\thasImagePresets,\n\t\t\thasTablePresets,\n\t\t\tnodeIds,\n\t\t\tpopoutIdPrefix,\n\t\t\tselectionState.componentsWithPresets.nameToState,\n\t\t],\n\t)\n\n\tconst somePresetsLeftForSelection = !(\n\t\tselectionState.componentsWithPresets.everyWithPresets &&\n\t\thasImagePresets &&\n\t\thasTablePresets\n\t)\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>{Dictionary.Cms} Styles</T>}\n\t\t\t\t\tonMouseDown={somePresetsLeftForSelection ? showMenu : undefined}\n\t\t\t\t\tclickable={somePresetsLeftForSelection}\n\t\t\t\t>\n\t\t\t\t\t{somePresetsLeftForSelection && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{componentsWithPresets.map(component => {\n\t\t\t\tconst componentSelectionState = selectionState.componentsWithPresets.nameToState.get(component.name)\n\n\t\t\t\tif (componentSelectionState === undefined || componentSelectionState.presets.length === 0) return null\n\n\t\t\t\treturn (\n\t\t\t\t\t<SelectEmbedPresetRow\n\t\t\t\t\t\tkey={component.componentIdentifier}\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tcomponent={component}\n\t\t\t\t\t\tpopoutId={`${popoutIdPrefix}-${component.componentIdentifier}`}\n\t\t\t\t\t\tselectedIds={componentSelectionState.ids}\n\t\t\t\t\t\tselectedPresets={componentSelectionState.presets}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\n\t\t\t{hasImagePresets && (\n\t\t\t\t<SelectNodeImageStylePresetRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tpopoutId={`${popoutIdPrefix}-image`}\n\t\t\t\t\tselectedIds={selectionState.image.ids}\n\t\t\t\t\tselectedPresets={selectionState.image.presets}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{hasTablePresets && (\n\t\t\t\t<SelectNodeTableStylePresetRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tpopoutId={`${popoutIdPrefix}-table`}\n\t\t\t\t\tselectedIds={selectionState.table.ids}\n\t\t\t\t\tselectedPresets={selectionState.table.presets}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Panel>\n\t)\n}\n", "import { IconLayerComponent } from \"@framerjs/fresco\"\nimport { colors, palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { prefixComponentPresetKey } from \"document/models/CanvasTree/traits/WithComponentPresets.ts\"\nimport { useMemo } from \"react\"\nimport type { ComponentWithPreset } from \"utils/getComponentsWithPresets.ts\"\nimport { IconAgentComponent } from \"../../agentPanel/components/IconAgentComponent.tsx\"\nimport { IconAgentVideo } from \"../../agentPanel/components/IconAgentVideo.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PresetIcon } from \"../../shared/PresetIcon.tsx\"\nimport { SelectComponentStyleEntityAssetPopout } from \"../panels/SelectComponentStyleEntityAssetPopout.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tcomponent: ComponentWithPreset\n\tpopoutId: string\n\tselectedIds: Set<string>\n\tselectedPresets: ComponentPresetNode[]\n}\n\nexport function SelectEmbedPresetRow({ nodeIds, component, popoutId, selectedPresets, selectedIds }: Props) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst traitTypeKeys = useMemo(\n\t\t() => [prefixComponentPresetKey(component.componentIdentifier)],\n\t\t[component.componentIdentifier],\n\t)\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\tfor (const node of nodes) {\n\t\t\tnode.setComponentPreset(component.componentIdentifier, undefined)\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title={component.name} traitTypeKeys={traitTypeKeys}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tid={popoutId}\n\t\t\t\tnavigationTitle={component.name}\n\t\t\t\ttitle={getComponentPresetsTitle(selectedPresets)}\n\t\t\t\tpopout={\n\t\t\t\t\t<SelectComponentStyleEntityAssetPopout component={component} nodeIds={nodeIds} selectedIds={selectedIds} />\n\t\t\t\t}\n\t\t\t\tpreview={\n\t\t\t\t\t<ComponentPresetIcon\n\t\t\t\t\t\tcomponent={component}\n\t\t\t\t\t\tisSelected={true}\n\t\t\t\t\t\tagentExperimentEnabled={agentExperimentEnabled}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tonDelete={deselectPreset}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction getComponentPresetsTitle(selectedPresets: ComponentPresetNode[]) {\n\tswitch (selectedPresets.length) {\n\t\tcase 0:\n\t\t\treturn Dictionary.SelectEllipsis\n\n\t\tcase 1:\n\t\t\treturn selectedPresets[0]?.resolveValue(\"name\") ?? Dictionary.Unknown\n\n\t\tdefault:\n\t\t\treturn Dictionary.Mixed\n\t}\n}\n\ninterface ComponentPresetIconProps {\n\tcomponent: ComponentWithPreset\n\tisSelected?: boolean\n\tagentExperimentEnabled: boolean\n}\n\nfunction ComponentPresetIcon({ component, isSelected = true, agentExperimentEnabled }: ComponentPresetIconProps) {\n\treturn (\n\t\t<PresetIcon\n\t\t\tbackground={isSelected ? palette.blue60 : colors.stylesPresetsIconBackground}\n\t\t\ticon={getComponentIcon(component.name, agentExperimentEnabled)}\n\t\t/>\n\t)\n}\n\nfunction getComponentIcon(name: string, agentExperimentEnabled: boolean) {\n\tconst lowerName = name.toLowerCase()\n\n\tconst style = { width: 12, height: 12, overflow: \"visible\" }\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\" style={style}>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 3.5 2.5 L 0 6 L 3.5 9.5 M 8.5 2.5 L 12 6 L 8.5 9.5\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\tstrokeLinejoin=\"round\"\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\tif (!agentExperimentEnabled) {\n\t\t\treturn (\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\" style={style}>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 3.501 1.369 C 2.834 0.983 2 1.464 2 2.234 L 2 9.766 C 2 10.536 2.834 11.017 3.501 10.631 L 10.005 6.865 C 10.67 6.48 10.67 5.52 10.005 5.135 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t)\n\t\t}\n\n\t\treturn <IconAgentVideo style={style} />\n\t}\n\n\tif (!agentExperimentEnabled) return <IconLayerComponent style={style} />\n\n\treturn <IconAgentComponent style={style} />\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { CMSEntityTypeRootNode } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { isComponentPresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { createComponentPreset } from \"utils/componentPresetUtils.ts\"\nimport type { ComponentWithPreset } from \"utils/getComponentsWithPresets.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { getComponentType } from \"../../assets/utils/getComponentType.ts\"\nimport { usePresetAssetRows } from \"../../assets/utils/usePresetAssetRows.ts\"\nimport { createComponentPresetItemContextMenuItems } from \"../utils/getComponentPresetRowProps.tsx\"\nimport { EditComponentPresetPopout } from \"./EditComponentPresetPopout.tsx\"\nimport {\n\ttype EditStyleEntityAssetPopoutProps,\n\tSelectStyleEntityAssetPopoutContent,\n} from \"./SelectStyleEntityAssetPopoutContent.tsx\"\n\nfunction isComponentPreset(preset: ComponentWithPreset) {\n\treturn (node: CanvasNode) => isComponentPresetNode(node) && node.componentIdentifier === preset.componentIdentifier\n}\n\ninterface SelectComponentStyleEntityAssetPopoutProps {\n\tcomponent: ComponentWithPreset\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nexport function SelectComponentStyleEntityAssetPopout({\n\tcomponent,\n\tnodeIds,\n\tselectedIds,\n}: SelectComponentStyleEntityAssetPopoutProps) {\n\tconst { rows, hasAnyItems, hasUnreferencedItems, typeRootId, searchValue, setSearchValue, hasSearch } =\n\t\tusePresetAssetRows(\n\t\t\t() => PresetsListNode.getNodes(engine.tree),\n\t\t\t() => CMSEntityTypeRootNode.get(engine.tree),\n\t\t\tid => {\n\t\t\t\tconst reference = engine.tree.getNodeWithTrait(id, isComponentPresetNode)\n\t\t\t\tif (!reference) return\n\t\t\t\treturn {\n\t\t\t\t\tcomponentType: getComponentType(reference, [component]),\n\t\t\t\t} as const\n\t\t\t},\n\t\t\tisComponentPreset(component),\n\t\t)\n\n\tconst handleCreateComponentPresetStyle = useEngineCallback(() => {\n\t\tcreateComponentPreset(engine, component, preset => selectComponentPreset(nodeIds, preset))\n\t}, [nodeIds, component])\n\n\tconst handleSelect = useEngineCallback(\n\t\t(id: NodeID) => {\n\t\t\tconst preset = engine.tree.get<ComponentPresetNode>(id)\n\t\t\tif (isNull(preset)) return\n\n\t\t\tselectComponentPreset(nodeIds, preset)\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\treturn (\n\t\t<SelectStyleEntityAssetPopoutContent\n\t\t\trows={rows}\n\t\t\thasAnyItems={hasAnyItems}\n\t\t\thasUnreferencedItems={hasUnreferencedItems}\n\t\t\ttypeRootId={typeRootId}\n\t\t\tsearchValue={searchValue}\n\t\t\tsetSearchValue={setSearchValue}\n\t\t\thasSearch={hasSearch}\n\t\t\tselectedIds={selectedIds}\n\t\t\tPopout={EditComponentStyleEntityAssetPopout}\n\t\t\tcreateItemContextMenuItems={createComponentPresetItemContextMenuItems}\n\t\t\tonCreate={handleCreateComponentPresetStyle}\n\t\t\tonSelect={handleSelect}\n\t\t/>\n\t)\n}\n\nfunction EditComponentStyleEntityAssetPopout({ id }: EditStyleEntityAssetPopoutProps) {\n\tconst preset = useEngineState(() => engine.tree.get<ComponentPresetNode>(id), [], EngineChange.Tree)\n\n\tif (isNull(preset)) return null\n\n\treturn <EditComponentPresetPopout preset={preset} />\n}\n\nconst selectComponentPreset = engine.scheduler.wrapHandler((nodeIds: NodeID[], preset: ComponentPresetNode) => {\n\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\n\tfor (const node of nodes) {\n\t\tnode.setComponentPreset(preset.componentIdentifier, preset.id)\n\t}\n})\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CMSEntityTypeRootNode } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { isImageStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { migrateTextNodes } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { createImageStylePreset } from \"utils/imageStylePresetUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { usePresetAssetRows } from \"../../assets/utils/usePresetAssetRows.ts\"\nimport { createImagePresetItemContextMenuItems } from \"../utils/getImageStylePresetRowProps.tsx\"\nimport { EditImageStylePresetPopout } from \"./EditImageStylePresetPopout.tsx\"\nimport {\n\ttype EditStyleEntityAssetPopoutProps,\n\tSelectStyleEntityAssetPopoutContent,\n} from \"./SelectStyleEntityAssetPopoutContent.tsx\"\n\ninterface SelectImageStyleEntityAssetPopoutProps {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst imageStyleRowMeta = { componentType: \"image\" } as const\nObject.freeze(imageStyleRowMeta)\n\nexport const selectImageStylePreset = engine.scheduler.wrapHandler(\n\t(nodeIds: string[], preset: ImageStylePresetNode) => {\n\t\tconst anyTextNodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\t\tconst richTextNodes = migrateTextNodes(engine, anyTextNodes)\n\n\t\tfor (const node of richTextNodes) {\n\t\t\tnode.setNodeImageStylePreset(preset)\n\t\t}\n\n\t\trecord(\"styles_preset_add\", {\n\t\t\ttag: \"img\",\n\t\t\tname: preset.getName(),\n\t\t\tid: preset.id,\n\t\t})\n\n\t\tengine.stores.selectionStore.set(richTextNodes)\n\t},\n)\n\nexport function SelectImageStyleEntityAssetPopout({ nodeIds, selectedIds }: SelectImageStyleEntityAssetPopoutProps) {\n\tconst { rows, hasAnyItems, hasUnreferencedItems, typeRootId, searchValue, setSearchValue, hasSearch } =\n\t\tusePresetAssetRows(\n\t\t\t() => PresetsListNode.getNodes(engine.tree),\n\t\t\t() => CMSEntityTypeRootNode.get(engine.tree),\n\t\t\t() => imageStyleRowMeta,\n\t\t\tisImageStylePresetNode,\n\t\t)\n\n\tconst handleCreateImagePresetStyle = useEngineCallback(() => {\n\t\tcreateImageStylePreset(engine, {\n\t\t\tonCreate(preset) {\n\t\t\t\tselectImageStylePreset(nodeIds, preset)\n\t\t\t},\n\t\t})\n\t}, [nodeIds])\n\n\tconst handleSelect = useEngineCallback(\n\t\t(id: NodeID) => {\n\t\t\tconst preset = engine.tree.get<ImageStylePresetNode>(id)\n\t\t\tif (isNull(preset)) return\n\n\t\t\tselectImageStylePreset(nodeIds, preset)\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\treturn (\n\t\t<SelectStyleEntityAssetPopoutContent\n\t\t\trows={rows}\n\t\t\thasAnyItems={hasAnyItems}\n\t\t\thasUnreferencedItems={hasUnreferencedItems}\n\t\t\ttypeRootId={typeRootId}\n\t\t\tsearchValue={searchValue}\n\t\t\tsetSearchValue={setSearchValue}\n\t\t\thasSearch={hasSearch}\n\t\t\tselectedIds={selectedIds}\n\t\t\tPopout={EditImageStyleEntityAssetPopout}\n\t\t\tcreateItemContextMenuItems={createImagePresetItemContextMenuItems}\n\t\t\tonCreate={handleCreateImagePresetStyle}\n\t\t\tonSelect={handleSelect}\n\t\t/>\n\t)\n}\n\nfunction EditImageStyleEntityAssetPopout({ id }: EditStyleEntityAssetPopoutProps) {\n\tconst preset = useEngineState(() => engine.tree.get<ImageStylePresetNode>(id), [], EngineChange.Tree)\n\n\tif (isNull(preset)) return null\n\n\treturn <EditImageStylePresetPopout preset={preset} />\n}\n", "import { IconImageStylePreset } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { IconAgentLayerImage } from \"../../layers/AgentLayerIcons.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PresetIcon } from \"../../shared/PresetIcon.tsx\"\nimport { SelectImageStyleEntityAssetPopout } from \"../panels/SelectImageStyleEntityAssetPopout.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst traitTypeKeys = [\"stylePresetImage\"] as const\n\ninterface Props {\n\tnodeIds: string[]\n\tpopoutId: string\n\tselectedIds: Set<string>\n\tselectedPresets: ImageStylePresetNode[]\n}\n\nexport function SelectNodeImageStylePresetRow({ nodeIds, popoutId, selectedIds, selectedPresets }: Props) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetImage: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Image\" traitTypeKeys={traitTypeKeys}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tid={popoutId}\n\t\t\t\tnavigationTitle=\"Image Styles\"\n\t\t\t\ttitle={getImageStylePresetsTitle(selectedPresets)}\n\t\t\t\tpopout={<SelectImageStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\tpreview={\n\t\t\t\t\t<PresetIcon\n\t\t\t\t\t\ticon={agentExperimentEnabled ? <IconAgentLayerImage /> : <IconImageStylePreset />}\n\t\t\t\t\t\tbackground={colors.alternativePresetIcon}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tonDelete={deselectPreset}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction getImageStylePresetsTitle(presets: ImageStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.SelectEllipsis\n\n\treturn preset.getName()\n}\n", "import \"SelectNodeTableStylePresetRow.styles_rn7ih3.wyw.css\"; export const popoutButtonIconWrapper = \"popoutButtonIconWrapper_p1qg5y3k\";", "import { IconTableStylePreset } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { TableStylePresetNode } from \"document/models/CanvasTree/nodes/TableStylePresetNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { IconAgentLayerGrid } from \"../../layers/IconAgentLayerGrid.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { SelectTableStyleEntityAssetPopout } from \"../panels/SelectTableStyleEntityAssetPopout.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\nimport * as styles from \"./SelectNodeTableStylePresetRow.styles.ts\"\n\nconst traitTypeKeys = [\"stylePresetTable\"] as const\n\ninterface Props {\n\tnodeIds: string[]\n\tpopoutId: string\n\tselectedIds: Set<string>\n\tselectedPresets: readonly TableStylePresetNode[]\n}\n\nexport function SelectNodeTableStylePresetRow({ nodeIds, popoutId, selectedIds, selectedPresets }: Props) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetTable: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Table\" traitTypeKeys={traitTypeKeys}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tdisplayDivider\n\t\t\t\tid={popoutId}\n\t\t\t\tnavigationTitle=\"Table Styles\"\n\t\t\t\ttitle={getTableStylePresetsTitle(selectedPresets)}\n\t\t\t\tpopout={<SelectTableStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\tpreview={\n\t\t\t\t\t<div className={styles.popoutButtonIconWrapper}>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentLayerGrid /> : <IconTableStylePreset />}\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\tonDelete={deselectPreset}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction getTableStylePresetsTitle(presets: readonly TableStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.SelectEllipsis\n\n\treturn preset.getName()\n}\n", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { Button, Translatable as T } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { createAndAssignActionVariableToNode } from \"document/components/tools/utils/createAndAssignActionVariableToNode.ts\"\nimport engine from \"document/engine.ts\"\nimport { hasEvents } from \"document/models/CanvasTree/actions/actions.ts\"\nimport { isShowOverlayAction } from \"document/models/CanvasTree/actions/overlayActions.ts\"\nimport { isResetVariableValuesAction } from \"document/models/CanvasTree/actions/resetVariablesActions.ts\"\nimport {\n\tisSetVariableValueAction,\n\tisValidVariableForSetVariableValueAction,\n} from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport type { CanvasNode, CodeComponentNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { isCodeComponentNode, isDataRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tgetSmartComponentForCodeComponent,\n\tisLocalSmartComponentInstance,\n\tisSmartComponentInstance,\n} from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { hasPaginationEnabled } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { onTapEventKey, withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isGestureOrGestureVariantChild } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { WithFormInputEvents } from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport {\n\tisFormInputEventKey,\n\twithFormInputEvents,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputEvents.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { Properties } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useState } from \"react\"\nimport { isShallowArrayEqual } from \"utils/isShallowEqual.ts\"\nimport { getParentCollectionRepeater } from \"utils/repeaterUtils.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport {\n\taddActionToEventKey,\n\tchangeActionEventKey,\n\teventsForNode,\n\tremoveEventAction,\n\tupdateEventAction,\n} from \"../utils/eventActions.ts\"\nimport { onResetReplicaOverrides } from \"../utils/resetOverrides.ts\"\nimport { EventActionPopoutButton } from \"./EventActionPopoutButton.tsx\"\nimport * as styles from \"./EventsPanel.styles.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { displayActionsMenu } from \"./utils/displayActionsMenu.ts\"\nimport { eventKeyToDisplayName, getMemoEventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\nimport { relinkActionDataToAction } from \"./utils/relinkActionDataToAction.ts\"\n\nconst DEFAULT_MAX_EVENTS = 5\n\nfunction shouldRenderPanel(\n\tsingleNode: CanvasNode | null | undefined,\n\tproperties: Properties,\n\tscopeType: ScopeType,\n): singleNode is (CanvasNode & (WithFrameEvents | WithFormInputEvents)) | CodeComponentNode {\n\tif (!singleNode) return false\n\n\t// Hide the interactions panel for breakpoints nodes.\n\tif (properties.onlyBreakpointNodes) return false\n\n\t// Smart Component gesture variants do not support events.\n\tif (isGestureOrGestureVariantChild(singleNode)) {\n\t\treturn false\n\t}\n\n\t// Check if node supports events.\n\tif (!withFrameEvents(singleNode) && !isCodeComponentNode(singleNode) && !withFormInputEvents(singleNode)) {\n\t\treturn false\n\t}\n\n\t// Overlay actions are only enabled within overlays, and not for the overlays themselves.\n\tif (hasFloatingPosition(singleNode)) return false\n\n\t// Outside of design pages/web pages/layout templates, we always render the panel.\n\tif (scopeType !== ScopeType.DesignPage && scopeType !== ScopeType.WebPage && scopeType !== ScopeType.LayoutTemplate) {\n\t\treturn true\n\t}\n\n\t// Nodes within overlays can add an action to close the overlay.\n\tif (properties.onlyNodesInAnOverlay) return true\n\n\t// Within repeaters only render the panel if pagination is enabled.\n\tif (properties.onlyNodesInsideCollectionRepeater) {\n\t\tconst collectionRepeaterNode = getParentCollectionRepeater(engine.tree, singleNode)\n\t\tif (collectionRepeaterNode && hasPaginationEnabled(collectionRepeaterNode)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tconst scopeNode = engine.stores.scopeStore.active\n\tif (withVariables(scopeNode) && scopeNode.variables.find(isValidVariableForSetVariableValueAction)) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\ninterface Props {\n\tnodes: CanvasNode[]\n\tproperties: Properties\n\tselection: NodeID[]\n\tscopeType: ScopeType\n\treadOnly: boolean\n}\n\nexport function EventsPanel({ nodes, readOnly, properties, scopeType }: Props) {\n\tconst [showAll, setShowAll] = useState(false)\n\n\tconst allEventKeysRef = React.useRef<string[]>([])\n\n\tconst singleNode: CanvasNode | undefined = nodes.length === 1 ? nodes[0] : undefined\n\n\tif (!shouldRenderPanel(singleNode, properties, scopeType)) return null\n\n\tconst isNodeWithTitleCaseEvents = withFrameEvents(singleNode) || withFormInputEvents(singleNode)\n\tconst nodeEvents = eventsForNode(engine.componentLoader, singleNode)\n\n\tconst { isLocalSmartComponent, isExternalSmartComponent } = smartComponentInfo(singleNode)\n\tconst isAnySmartComponentInstance = isLocalSmartComponent || isExternalSmartComponent\n\n\tlet eventKeys = Object.keys(nodeEvents)\n\n\tif (eventKeys.length === 0 && !isLocalSmartComponent) return null\n\n\tconst unusedNodeEventKeys = eventKeys.filter(key => nodeEvents[key]?.length === 0)\n\n\t// memo event keys\n\tif (isShallowArrayEqual(eventKeys, allEventKeysRef.current)) {\n\t\teventKeys = allEventKeysRef.current\n\t} else {\n\t\tallEventKeysRef.current = eventKeys\n\t}\n\n\tconst overriddenKeys = TemplateHelper.overrideKeys(engine.tree, [singleNode])\n\n\tconst displayMap = isCodeComponentNode(singleNode)\n\t\t? getMemoEventKeyToDisplayNameMap(engine.componentLoader, singleNode)\n\t\t: null\n\n\tconst rows: JSX.Element[] = []\n\tconst usedPanelKeys: Set<string> = new Set()\n\n\teventKeys.forEach(eventKey => {\n\t\tconst actions = nodeEvents[eventKey]\n\t\tif (!actions || actions.length === 0) {\n\t\t\t// This is a replica override that removes all actions\n\t\t\tif (overriddenKeys.has(eventKey)) {\n\t\t\t\trows.push(\n\t\t\t\t\t<PanelRow key={eventKey} title={eventKeyToDisplayName(eventKey, displayMap)} traitTypeKeys={[eventKey]}>\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"action\" onClick={resetOverrideHandler(eventKey)} />\n\t\t\t\t\t</PanelRow>,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst handler = (event: React.MouseEvent) => addSuggestedEventHandler(event, singleNode, eventKey)\n\n\t\t\t// Suggest Smart Component triggers and restrict number of rows by default\n\t\t\tif (isAnySmartComponentInstance && (rows.length < DEFAULT_MAX_EVENTS || showAll)) {\n\t\t\t\trows.push(\n\t\t\t\t\t<PanelRow key={eventKey} title={eventKeyToDisplayName(eventKey, displayMap)} traitTypeKeys={[eventKey]}>\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"eventSuggestion\" onClick={handler} />\n\t\t\t\t\t</PanelRow>,\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (isAnySmartComponentInstance && rows.length === DEFAULT_MAX_EVENTS && !showAll) {\n\t\t\t\trows.push(\n\t\t\t\t\t<PanelRow key=\"showAllEvents\" title=\" \">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={styles.seeAllButtonClass}\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\tsetShowAll(true)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSee All\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</PanelRow>,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// Overlay actions are rendered in a separate panel, so the action index is not identical to their displayed\n\t\t// index.\n\t\tlet displayIndex = 0\n\t\tactions?.forEach((action, actionIndex) => {\n\t\t\tconst actionEntity = engine.componentLoader.componentForIdentifier(action.actionIdentifier)\n\n\t\t\t// The same action can end up in the list twice when using symbols\n\t\t\t//   1. Create primary and add an action to onTap\n\t\t\t//   2. Create a replica and change the event key to onTapStart\n\t\t\t//   3. Right click on the Tap event, and choose Reset Override\n\t\t\t//   4. Now the same action is applied to Tap and TapStart\n\t\t\t// The unique name function makes sure we don't use the same key multiple times. We can't add the event name\n\t\t\t// to the key, because that results in unmounting the popout when changing the event.\n\t\t\tconst panelKey = uniqueName(action.identifier, usedPanelKeys)\n\t\t\tusedPanelKeys.add(panelKey)\n\n\t\t\tif (isShowOverlayAction(action)) return\n\n\t\t\tconst shouldDisplayTitle = displayIndex === 0\n\n\t\t\tconst title = shouldDisplayTitle\n\t\t\t\t? eventKeyToDisplayName(eventKey, displayMap, isNodeWithTitleCaseEvents, true)\n\t\t\t\t: \" \"\n\n\t\t\trows.push(\n\t\t\t\t<PanelRow key={panelKey} title={title} traitTypeKeys={displayIndex === 0 ? [eventKey] : undefined}>\n\t\t\t\t\t<EventActionPopoutButton\n\t\t\t\t\t\ttitle={actionEntity?.name ?? \"Not Found\"}\n\t\t\t\t\t\teventKey={eventKey}\n\t\t\t\t\t\tallEventKeys={eventKeys}\n\t\t\t\t\t\tindex={actionIndex}\n\t\t\t\t\t\tnode={singleNode}\n\t\t\t\t\t\tnodeIds={properties.allNodeIds}\n\t\t\t\t\t\taction={action}\n\t\t\t\t\t\tonChange={updateItemHandler}\n\t\t\t\t\t\tonDelete={removeItemHandler}\n\t\t\t\t\t\tonReplace={replaceHandler}\n\t\t\t\t\t\tonChangeTrigger={onChangeTrigger}\n\t\t\t\t\t\teventKeyToDisplayNameMap={displayMap}\n\t\t\t\t\t\tshowInputValueRow={isFormInputEventKey(eventKey)}\n\t\t\t\t\t\tshowDelayRow={!isSetVariableValueAction(action) && !isResetVariableValuesAction(action)}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>,\n\t\t\t)\n\n\t\t\tdisplayIndex++\n\t\t})\n\t})\n\n\tconst allowAddingInteractions =\n\t\t(isLocalSmartComponent && eventKeys.length === 0) ||\n\t\tscopeType === ScopeType.SmartComponent ||\n\t\tscopeType === ScopeType.LayoutTemplate ||\n\t\tunusedNodeEventKeys.length > 0\n\n\tconst addInteractionsHandler = (event: React.MouseEvent) => {\n\t\tif (!allowAddingInteractions || readOnly) return\n\t\tassert(!getIsViewOnly(engine, \"canDesign\"), \"Adding interactions is not allowed in view only mode.\")\n\t\taddInteraction(event, eventKeys, singleNode)\n\t}\n\n\t// We don't want to show the interactions panel for collections lists, however we\n\t// do want to ensure that if someone has already added events or overlays to\n\t// their repeater, they can still remove them. If someone has already added\n\t// events to their repeater, they should still be able to remove them.\n\tif (rows.length === 0 && isDataRepeater(singleNode)) return null\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Interactions</T>}\n\t\t\t\t\tonMouseDown={addInteractionsHandler}\n\t\t\t\t\tclickable={allowAddingInteractions && !readOnly}\n\t\t\t\t>\n\t\t\t\t\t{allowAddingInteractions && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{rows}\n\t\t</Panel>\n\t)\n}\n\nfunction resetOverrideHandler(eventKey: string) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tonResetReplicaOverrides(engine, undefined, [eventKey])\n\t})\n}\n\nconst replaceHandler = engine.scheduler.wrapHandler(\n\t(\n\t\tnewActionEntity: EntityDefinition,\n\t\tcontrolOverrides: { [key: string]: ControlProp },\n\t\tnodeId: NodeID,\n\t\teventKey: string,\n\t\titemIndex: number,\n\t) => {\n\t\tconst node = engine.tree.getNode(nodeId)\n\t\tif (!node) return\n\t\tif (!isCodeComponentNode(node) && !withFrameEvents(node)) return\n\n\t\tconst nodeEvents = eventsForNode(engine.componentLoader, node)\n\t\tconst eventActions = nodeEvents[eventKey] ?? []\n\t\tconst actions: EventAction[] = [...eventActions]\n\n\t\tconst currentAction = actions[itemIndex]\n\t\tif (!currentAction) return\n\t\tconst newAction = relinkActionDataToAction(currentAction, newActionEntity, controlOverrides)\n\n\t\tactions[itemIndex] = newAction\n\n\t\tif (isCodeComponentNode(node)) {\n\t\t\tconst update = prefixControlProps({ [eventKey]: { type: ControlType.EventHandler, value: actions } })\n\t\t\tnode.set(update)\n\t\t} else {\n\t\t\tnode.set({ [eventKey]: actions })\n\t\t}\n\t},\n)\n\nconst onChangeTrigger = engine.scheduler.wrapHandler(\n\t(nodeId: string, currentEventKey: string, newEventKey: string, itemIndex: number) =>\n\t\tchangeActionEventKey(engine, nodeId, currentEventKey, newEventKey, itemIndex),\n)\n\nconst removeItemHandler = engine.scheduler.wrapHandler((nodeId: NodeID, eventKey: string, itemIndex: number) =>\n\tremoveEventAction(engine, nodeId, eventKey, itemIndex),\n)\n\nconst updateItemHandler = engine.scheduler.wrapHandler(\n\t(updatedAction: EventAction, nodeId: NodeID, eventKey: string, itemIndex: number) =>\n\t\tupdateEventAction(engine, updatedAction, nodeId, eventKey, itemIndex),\n)\n\nfunction addActionToNode(\n\tnode: (CanvasNode & (WithFrameEvents | WithFormInputEvents)) | CodeComponentNode,\n\teventKey: string,\n\tactionDefinition: EntityDefinition,\n\tcontrolOverrides?: { [key: string]: ControlProp },\n) {\n\tconst addNewAction = (eventKey: string) => {\n\t\tconst newAction = addActionToEventKey(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tnode,\n\t\t\teventKey,\n\t\t\tactionDefinition,\n\t\t\tcontrolOverrides,\n\t\t)\n\t\t// We do not want to open the event trigger popout because we are opening the variables modal instead\n\t\tif (newAction.actionIdentifier !== HardCodedCodeIdentifier.triggerEventAction) {\n\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(newAction.identifier)\n\t\t}\n\t}\n\n\t// If we need to create a new event in the smart component, we must ensure it has loaded first.\n\tif (!hasEvents(node, engine.componentLoader) && isLocalSmartComponentInstance(node)) {\n\t\tconst smartComponentNode = getSmartComponentForCodeComponent(engine.tree, node)\n\t\tengine.loadScopesThenProcess([smartComponentNode], ([loadedSmartComponentNode]) => {\n\t\t\t// We do nothing if the smart component no longer exists.\n\t\t\tif (!loadedSmartComponentNode) return\n\n\t\t\tconst frameEventKey = eventKey\n\t\t\tconst variableId = createAndAssignActionVariableToNode(\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tloadedSmartComponentNode.getPrimaryVariant(),\n\t\t\t\tframeEventKey,\n\t\t\t\tundefined,\n\t\t\t\tengine.stores.codeGenerationStore,\n\t\t\t)\n\t\t\tassert(variableId, \"Should be able to create event key for local smart component node\")\n\t\t\taddNewAction(variableId)\n\t\t})\n\t} else {\n\t\taddNewAction(eventKey)\n\t}\n}\n\nconst addActionHandler = engine.scheduler.wrapHandler(\n\t(\n\t\tnode: (CanvasNode & (WithFrameEvents | WithFormInputEvents)) | CodeComponentNode,\n\t\teventKey: string,\n\t\tactionDefinition: EntityDefinition,\n\t\tcontrolOverrides?: { [key: string]: ControlProp },\n\t) => addActionToNode(node, eventKey, actionDefinition, controlOverrides),\n)\n\nfunction addInteraction(\n\tevent: React.MouseEvent,\n\teventKeys: string[],\n\tnode: (CanvasNode & (WithFrameEvents | WithFormInputEvents)) | CodeComponentNode,\n) {\n\tassert(\n\t\teventKeys.length > 0 || isSmartComponentInstance(engine.tree, node),\n\t\t\"there must be at least one event key, or the node must be a smart component to display action addition menu\",\n\t)\n\tconst location = { x: event.clientX, y: event.clientY + 14 }\n\tconst key = eventKeys[0] ?? onTapEventKey // If no event exists try to create a variable for onTap\n\n\tdisplayActionsMenu(node.id, key, location, (eventKey, actionDefinition, controlOverrides) => {\n\t\taddActionHandler(node, eventKey, actionDefinition, controlOverrides)\n\t})\n}\n\nfunction addSuggestedEventHandler(event: React.MouseEvent, node: CanvasNode, eventKey: string) {\n\t// Event suggestion is only shown for component instances\n\tif (!isSmartComponentInstance(engine.tree, node)) return\n\n\tconst location = { x: event.clientX, y: event.clientY + 14 }\n\tdisplayActionsMenu(node.id, eventKey, location, (_eventKey, actionDefinition, controlOverrides) => {\n\t\taddActionHandler(node, _eventKey, actionDefinition, controlOverrides)\n\t})\n}\n\nfunction smartComponentInfo(node: CanvasNode) {\n\tconst isLocalSmartComponent = isLocalSmartComponentInstance(node)\n\tconst isExternalSmartComponent = !isLocalSmartComponent && isSmartComponentInstance(engine.tree, node)\n\n\treturn {\n\t\tisLocalSmartComponent,\n\t\tisExternalSmartComponent,\n\t}\n}\n", "import { transitionToTitle } from \"@framerjs/framer-runtime\"\nimport { IconEffect, IconGlobe, IconLoadMore, IconThunderbolt } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { isNavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport { isOpenURLAction } from \"document/models/CanvasTree/actions/openURLActions.ts\"\nimport { isSetVariableValueAction } from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport { isTriggerEventAction } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport { isSetVariantAction } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { nodeCanTriggerOverlay, nodeIsInOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { keyDownKey, withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getLink, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { isCollectionRepeaterDescendent } from \"utils/isRepeaterDescendent.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { shortcutKeyForAction } from \"../codeComponentRows/KeyInputRow.tsx\"\nimport type { EventActionPopoutProps } from \"./EventActionPopout.tsx\"\nimport { EventActionPopout } from \"./EventActionPopout.tsx\"\nimport { IconActionConsoleLog } from \"./icons/IconActionConsoleLog.tsx\"\nimport { IconActionGeneric } from \"./icons/IconActionGeneric.tsx\"\nimport { IconActionOpenURL } from \"./icons/IconActionOpenURL.tsx\"\nimport { IconAgentInteraction } from \"./icons/IconAgentInteraction.tsx\"\nimport { iconForNavigationAction } from \"./utils/iconForNavigationTransition.tsx\"\n\ninterface Props extends EventActionPopoutProps {\n\ttitle: string\n\tonDelete: (id: NodeID, prop: string, index: number) => void\n\tscopeType: ScopeType\n}\n\nfunction isEnabled(node: CanvasNode, eventKey: string, actionIdentifier: string, scopeType: ScopeType): boolean {\n\tswitch (scopeType) {\n\t\tcase ScopeType.SmartComponent:\n\t\tcase ScopeType.LayoutTemplate:\n\t\tcase ScopeType.VectorSet:\n\t\tcase ScopeType.WebPage: {\n\t\t\tif (withFrameEvents(node) && eventKey === keyDownKey) return false\n\t\t\tswitch (actionIdentifier) {\n\t\t\t\tcase HardCodedCodeIdentifier.setVariantAction:\n\t\t\t\tcase HardCodedCodeIdentifier.triggerEventAction:\n\t\t\t\t\treturn scopeType === ScopeType.SmartComponent\n\t\t\t\tcase HardCodedCodeIdentifier.setVariableValueAction:\n\t\t\t\t\treturn scopeType === ScopeType.SmartComponent || scopeType === ScopeType.WebPage\n\t\t\t\tcase HardCodedCodeIdentifier.resetVariableValuesAction:\n\t\t\t\t\treturn scopeType === ScopeType.SmartComponent || scopeType === ScopeType.WebPage\n\t\t\t\tcase HardCodedCodeIdentifier.setLocaleAction:\n\t\t\t\tcase HardCodedCodeIdentifier.openURLAction:\n\t\t\t\t\treturn true\n\t\t\t\tcase HardCodedCodeIdentifier.dismissOverlayAction:\n\t\t\t\t\treturn nodeIsInOverlay(node)\n\t\t\t\tcase HardCodedCodeIdentifier.showOverlayAction:\n\t\t\t\t\treturn (\n\t\t\t\t\t\tscopeType === ScopeType.WebPage && nodeCanTriggerOverlay(node, HardCodedCodeIdentifier.showOverlayAction)\n\t\t\t\t\t)\n\t\t\t\tcase HardCodedCodeIdentifier.showRelativeOverlayAction:\n\t\t\t\t\treturn nodeCanTriggerOverlay(node, HardCodedCodeIdentifier.showRelativeOverlayAction)\n\t\t\t\tcase HardCodedCodeIdentifier.loadMoreAction:\n\t\t\t\t\treturn isCollectionRepeaterDescendent(engine.tree, node)\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tcase ScopeType.CanvasPage:\n\t\t\tswitch (actionIdentifier) {\n\t\t\t\tcase HardCodedCodeIdentifier.triggerEventAction:\n\t\t\t\tcase HardCodedCodeIdentifier.setVariantAction:\n\t\t\t\t\treturn false\n\t\t\t\tdefault:\n\t\t\t\t\treturn true\n\t\t\t}\n\t\tcase ScopeType.DesignPage:\n\t\tcase ScopeType.Analytics:\n\t\tcase ScopeType.ContentManagement:\n\t\tcase ScopeType.LocalizationGlossary:\n\t\tcase ScopeType.Routes:\n\t\tcase ScopeType.CustomCode:\n\t\t\treturn false\n\t}\n}\n\nexport const EventActionPopoutButton = React.memo(function EventActionPopoutButton({\n\tonDelete,\n\ttitle,\n\tscopeType,\n\t...item\n}: Props) {\n\tconst { action, node, eventKey, index } = item\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst deleteHandler = () => {\n\t\tonDelete(node.id, eventKey, index)\n\t}\n\n\treturn (\n\t\t<PopoutButtonWithPreview\n\t\t\tid={action.identifier}\n\t\t\tpopout={<EventActionPopout {...item} scopeType={scopeType} />}\n\t\t\tnavigationTitle={title}\n\t\t\tdisplayDivider\n\t\t\tshortcutKey={shortcutKeyForAction(action)}\n\t\t\ttitle={titleForAction(title, action)}\n\t\t\tenabled={isEnabled(node, eventKey, action.actionIdentifier, scopeType)}\n\t\t\tpreview={\n\t\t\t\t<PopoutButtonPreviewIconWrapper>{iconForAction(action, agentExperimentEnabled)}</PopoutButtonPreviewIconWrapper>\n\t\t\t}\n\t\t\tonDelete={deleteHandler}\n\t\t/>\n\t)\n})\n\nfunction iconForAction(action: EventAction, agentExperimentEnabled: boolean) {\n\tif (isNavigationAction(action)) {\n\t\treturn iconForNavigationAction(action)\n\t}\n\n\tswitch (action.actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.openURLAction:\n\t\t\treturn <IconActionOpenURL />\n\t\tcase HardCodedCodeIdentifier.consoleLogAction:\n\t\t\treturn <IconActionConsoleLog />\n\t\tcase HardCodedCodeIdentifier.setVariantAction:\n\t\t\tif (agentExperimentEnabled) return <IconAgentInteraction />\n\t\t\treturn <IconEffect />\n\t\tcase HardCodedCodeIdentifier.triggerEventAction:\n\t\t\treturn <IconThunderbolt />\n\t\tcase HardCodedCodeIdentifier.dismissOverlayAction:\n\t\t\treturn <IconThunderbolt />\n\t\tcase HardCodedCodeIdentifier.setLocaleAction:\n\t\t\treturn <IconGlobe />\n\t\tcase HardCodedCodeIdentifier.loadMoreAction:\n\t\t\treturn <IconLoadMore />\n\t\tcase HardCodedCodeIdentifier.setVariableValueAction:\n\t\t\treturn <IconThunderbolt />\n\t\tcase HardCodedCodeIdentifier.resetVariableValuesAction:\n\t\t\treturn <IconThunderbolt />\n\t\t// Overlay actions don't use the EventActionPopoutButton, see\n\t\t// EventsPanel.\n\t\tdefault:\n\t\t\treturn <IconActionGeneric />\n\t}\n}\n\nfunction getVariableTitle(variableId: VariableID | undefined): string | null {\n\tif (!variableId) return null\n\tconst activeScope = engine.stores.scopeStore.active\n\tif (!activeScope || !withVariables(activeScope)) return null\n\tconst variable = activeScope.getVariable(variableId)\n\treturn variable ? variable.name : null\n}\n\nfunction titleForAction(title: string, action: EventAction): string {\n\tif (isTriggerEventAction(action)) {\n\t\tconst variableTitle = getVariableTitle(action.controls.id?.value)\n\t\tif (variableTitle) return variableTitle\n\t}\n\n\tif (isNavigationAction(action)) {\n\t\tconst { type, transition } = action.controls\n\t\tif (type?.value === \"previous\") return titleCase(type.value)\n\t\treturn transition?.value ? transitionToTitle(transition.value) : title\n\t}\n\n\tif (isOpenURLAction(action)) {\n\t\tconst link = getLink(action.controls.url)\n\t\tif (!isLinkToWebPage(link)) return title\n\t\tif (!link.webPageId) return title\n\t\tconst node = engine.tree.getNode(link.webPageId)\n\t\tif (!isWebPageNode(node)) {\n\t\t\treturn title\n\t\t}\n\t\tconst pagePath = getWebPagePath(engine.tree, node)\n\t\treturn pagePath ?? title\n\t}\n\n\tif (isSetVariantAction(action)) {\n\t\tswitch (action.controls.type?.value) {\n\t\t\tcase \"cycle\":\n\t\t\t\treturn \"Cycle Variant\"\n\t\t\tdefault: {\n\t\t\t\tconst id = action.controls.variantId?.value\n\t\t\t\tif (isString(id)) {\n\t\t\t\t\tconst variantNode = engine.tree.getNode(id)\n\t\t\t\t\tif (variantNode) {\n\t\t\t\t\t\treturn variantNode.resolveValue(\"name\") || getDefaultName(engine.componentLoader, variantNode)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn \"Set Variant\"\n\t\t\t}\n\t\t}\n\t}\n\n\tif (isSetVariableValueAction(action)) {\n\t\tconst variableTitle = getVariableTitle(action.controls.variableId.value)\n\t\tif (variableTitle) return `Set ${variableTitle}`\n\t}\n\n\treturn title\n}\n", "export function IconFile() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 2 3 C 2 1.895 2.895 1 4 1 L 8.5 1 L 8.5 6.5 L 14 6.5 L 14 13 C 14 14.105 13.105 15 12 15 L 4 15 C 2.895 15 2 14.105 2 13 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t\t<path d=\"M 9.5 2 L 9.5 5.5 L 13 5.5 Z\" fill=\"currentColor\" />\n\t\t</svg>\n\t)\n}\n", "import \"EventActionPopout.styles_12ondw5.wyw.css\"; export const emptyState = \"emptyState_e2lfmpk\";", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { DropdownButton, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { IconFile } from \"code-editor/icons/IconFile.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport type React from \"react\"\nimport * as styles from \"./EventActionPopout.styles.ts\"\nimport { EventActionProperties } from \"./EventActionProperties.tsx\"\nimport { displayActionsMenu } from \"./utils/displayActionsMenu.ts\"\nimport type { EventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\n\nfunction getActionName(identifier: string): string {\n\tconst segments = identifier.split(\"_\")\n\t// biome-ignore lint/style/noNonNullAssertion: last segment is guaranteed to exist\n\tconst lastSegment = segments.at(-1)!\n\treturn lastSegment\n}\n\nexport interface EventActionPopoutProps {\n\tnode: CanvasNode\n\tnodeIds: NodeID[]\n\taction: EventAction\n\teventKey: string // \"onTap\"\n\tallEventKeys: string[]\n\tindex: number\n\tscopeType: ScopeType\n\tonChange: (update: EventAction, nodeId: NodeID, prop: string, index: number) => void\n\tonReplace: (\n\t\tnewAction: EntityDefinition,\n\t\tcontrolOverrides: ControlProps,\n\t\tnodeId: NodeID,\n\t\tprop: string,\n\t\tindex: number,\n\t) => void\n\tonChangeTrigger: (nodeId: string, currentEventKey: string, newEventKey: string, index: number) => void\n\teventKeyToDisplayNameMap: EventKeyToDisplayNameMap | null\n\tshowTargetRow?: boolean\n\tshowTriggerRow?: boolean\n\tshowVariantRow?: boolean\n\tshowDelayRow?: boolean\n\tshowInputValueRow?: boolean\n}\n\nexport function EventActionPopout({\n\tnode,\n\tnodeIds,\n\taction,\n\teventKey,\n\tallEventKeys,\n\tindex,\n\tscopeType,\n\tonChange,\n\tonReplace,\n\tonChangeTrigger,\n\teventKeyToDisplayNameMap,\n\tshowTargetRow,\n\tshowTriggerRow,\n\tshowVariantRow,\n\tshowDelayRow,\n\tshowInputValueRow,\n}: EventActionPopoutProps) {\n\tconst actionEntity = engine.componentLoader.componentForIdentifier(action.actionIdentifier)\n\n\tif (!actionEntity) {\n\t\tconst actionName = getActionName(action.actionIdentifier)\n\n\t\tconst error = engine.componentLoader.errorForIdentifier(action.actionIdentifier)\n\t\tconst isLoading = !error\n\n\t\treturn (\n\t\t\t<div className={styles.emptyState}>\n\t\t\t\t<div style={codeIconWrapper}>\n\t\t\t\t\t<IconFile />\n\t\t\t\t</div>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<h2>Loading Action</h2>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h2>Action Not Found</h2>\n\t\t\t\t\t\tCannot find action named {actionName} in code.\n\t\t\t\t\t\t<DropdownButton\n\t\t\t\t\t\t\ttitle=\"Replace\"\n\t\t\t\t\t\t\tonClick={displayReplaceMenu(onReplace, node.id, eventKey, index)}\n\t\t\t\t\t\t\tstyle={dropdownStyle}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.popoverPadding}\n\t\t\tpaddingRight={dimensions.css.popoverPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<EventActionProperties\n\t\t\t\tnode={node}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\taction={action}\n\t\t\t\teventKey={eventKey}\n\t\t\t\tallEventKeys={allEventKeys}\n\t\t\t\tindex={index}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonChangeTrigger={onChangeTrigger}\n\t\t\t\teventKeyToDisplayNameMap={eventKeyToDisplayNameMap}\n\t\t\t\tshowTargetRow={showTargetRow}\n\t\t\t\tshowTriggerRow={showTriggerRow}\n\t\t\t\tshowVariantRow={showVariantRow}\n\t\t\t\tshowDelayRow={showDelayRow}\n\t\t\t\tshowInputValueRow={showInputValueRow}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\nconst codeIconWrapper: React.CSSProperties = {\n\twidth: 30,\n\theight: 30,\n\tmargin: dimensions.css.inputSpacing,\n\tdisplay: \"inline-flex\",\n\tjustifyContent: \"center\",\n\talignItems: \"center\",\n\tcolor: \"white\",\n\tbackground: colors.tint,\n\tborderRadius: \"50%\",\n}\n\nconst dropdownStyle: React.CSSProperties = { display: \"inline-flex\", color: colors.tint, fontSize: \"12px\" }\n\nfunction displayReplaceMenu(\n\treplaceHandler: EventActionPopoutProps[\"onReplace\"],\n\tnodeId: NodeID,\n\teventKey: string,\n\tindex: number,\n) {\n\treturn (event: React.MouseEvent) => {\n\t\tconst location = { x: event.clientX, y: event.clientY + 14 }\n\t\tdisplayActionsMenu(\n\t\t\tnodeId,\n\t\t\t\"\",\n\t\t\tlocation,\n\t\t\t(_eventKey: string, action: EntityDefinition, controlOverrides: ControlProps = {}) => {\n\t\t\t\treplaceHandler(action, controlOverrides, nodeId, eventKey, index)\n\t\t\t},\n\t\t)\n\t}\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\n\nexport function IconActionConsoleLog() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 0 8 C 0 3.582 3.582 0 8 0 L 8 0 C 12.418 0 16 3.582 16 8 L 16 8 C 16 12.418 12.418 16 8 16 L 8 16 C 3.582 16 0 12.418 0 8 Z\"\n\t\t\t\tfill={colors.tint}\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 8.25 11.25 L 11.25 11.25\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"#FFFFFF\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 5.5 4.5 L 8 7 L 5.5 9.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"#FFFFFF\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\n\nexport function IconActionGeneric() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path d=\"M0 8a8 8 0 0116 0A8 8 0 010 8z\" fill={colors.tint} />\n\t\t\t<path d=\"M8 7a1 1 0 110 2 1 1 0 010-2z\" fill=\"#FFF\" />\n\t\t\t<path d=\"M8 5a3 3 0 110 6 3 3 0 010-6z\" fill=\"transparent\" strokeWidth=\"1.5\" stroke=\"#FFF\" />\n\t\t</svg>\n\t)\n}\n", "import { colors } from \"@framerjs/fresco/tokens\"\n\nexport function IconActionOpenURL() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 8 0 C 12.418 0 16 3.582 16 8 C 16 12.418 12.418 16 8 16 C 3.582 16 0 12.418 0 8 C 0 3.582 3.582 0 8 0 Z\"\n\t\t\t\tfill={colors.tint}\n\t\t\t></path>\n\t\t\t<path d=\"M 5.5 10.5 L 10 6\" fill=\"transparent\" strokeWidth=\"1.5\" stroke=\"#FFFFFF\" strokeLinecap=\"round\"></path>\n\t\t\t<path\n\t\t\t\td=\"M 5.5 5.75 L 10.25 5.75 L 10.25 10\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"#FFFFFF\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionFadeSmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 5 8 C 5 5.791 6.791 4 9 4 L 9 4 C 11.209 4 13 5.791 13 8 L 13 8.063 L 13 8.063 C 13 8.58 12.58 9 12.063 9 L 5.938 9 C 5.42 9 5 8.58 5 8.063 L 5 8.063 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 6.5 10.75 L 11.5 10.75\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 8.5 13.25 L 9.5 13.25\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionFlipSmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 6.598 5.477 C 7.057 4.517 8.5 4.844 8.5 5.909 L 8.5 12 C 8.5 12.552 8.052 13 7.5 13 L 4.587 13 C 3.851 13 3.367 12.232 3.685 11.569 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 11.402 5.477 C 10.943 4.517 9.5 4.844 9.5 5.909 L 9.5 12 C 9.5 12.552 9.948 13 10.5 13 L 13.413 13 C 14.149 13 14.633 12.232 14.315 11.569 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionMagicMotionSmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 4.592 11.704 C 4.641 11.68 4.68 11.641 4.704 11.592 L 5.276 10.447 C 5.369 10.263 5.631 10.263 5.724 10.447 L 6.296 11.592 C 6.32 11.641 6.359 11.68 6.408 11.704 L 7.553 12.276 C 7.737 12.369 7.737 12.631 7.553 12.724 L 6.408 13.296 C 6.359 13.32 6.32 13.359 6.296 13.408 L 5.724 14.553 C 5.631 14.737 5.369 14.737 5.276 14.553 L 4.704 13.408 C 4.68 13.359 4.641 13.32 4.592 13.296 L 3.447 12.724 C 3.263 12.631 3.263 12.369 3.447 12.276 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 8.574 6.16 C 8.845 6.058 9.058 5.845 9.16 5.574 L 9.938 3.498 C 10.133 2.979 10.867 2.979 11.062 3.498 L 11.84 5.574 C 11.942 5.845 12.155 6.058 12.426 6.16 L 14.502 6.938 C 15.021 7.133 15.021 7.867 14.502 8.062 L 12.426 8.84 C 12.155 8.942 11.942 9.155 11.84 9.426 L 11.062 11.502 C 10.867 12.021 10.133 12.021 9.938 11.502 L 9.16 9.426 C 9.058 9.155 8.845 8.942 8.574 8.84 L 6.498 8.062 C 5.979 7.867 5.979 7.133 6.498 6.938 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionModalSmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 7 5.5 C 7 4.672 7.672 4 8.5 4 L 12.5 4 C 13.328 4 14 4.672 14 5.5 L 14 9.5 C 14 10.328 13.328 11 12.5 11 L 8 11 C 7.448 11 7 10.552 7 10 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 4 8.5 C 4 7.672 4.672 7 5.5 7 L 5.5 7 C 5.776 7 6 7.224 6 7.5 L 6 10.5 C 6 11.328 6.672 12 7.5 12 L 10.5 12 C 10.776 12 11 12.224 11 12.5 L 11 12.5 C 11 13.328 10.328 14 9.5 14 L 6 14 C 4.895 14 4 13.105 4 12 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionOverlaySmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 4 6 C 4 4.895 4.895 4 6 4 L 12 4 C 13.105 4 14 4.895 14 6 L 14 12 C 14 13.105 13.105 14 12 14 L 6 14 C 4.895 14 4 13.105 4 12 Z M 5.5 11.5 C 5.5 12.052 5.948 12.5 6.5 12.5 L 11.5 12.5 C 12.052 12.5 12.5 12.052 12.5 11.5 L 12.5 10 C 12.5 9.448 12.052 9 11.5 9 L 6.5 9 C 5.948 9 5.5 9.448 5.5 10 Z M 5.5 6.5 C 5.5 7.052 5.948 7.5 6.5 7.5 C 7.052 7.5 7.5 7.052 7.5 6.5 C 7.5 5.948 7.052 5.5 6.5 5.5 C 5.948 5.5 5.5 5.948 5.5 6.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionPrevious() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 9 5.5 L 5.5 9 L 9 12.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t></path>\n\t\t\t<path d=\"M 13 9 L 7 9\" fill=\"transparent\" strokeWidth=\"2\" stroke=\"currentColor\" strokeLinecap=\"round\"></path>\n\t\t</svg>\n\t)\n}\n", "export function IconTransitionPushSmall() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\">\n\t\t\t<path\n\t\t\t\td=\"M 7 5.5 C 7 4.672 7.672 4 8.5 4 L 12 4 C 12.828 4 13.5 4.672 13.5 5.5 L 13.5 12.5 C 13.5 13.328 12.828 14 12 14 L 8.5 14 C 7.672 14 7 13.328 7 12.5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 4 7.833 C 4 7.097 4.597 6.5 5.333 6.5 L 5.333 6.5 C 5.702 6.5 6 6.798 6 7.167 L 6 11.833 C 6 12.202 5.702 12.5 5.333 12.5 L 5.333 12.5 C 4.597 12.5 4 11.903 4 11.167 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "import { IconThunderbolt } from \"@framerjs/fresco\"\nimport type { NavigationAction } from \"document/models/CanvasTree/actions/navigationActions.ts\"\nimport { IconActionNavigate } from \"../icons/IconActionNavigate.tsx\"\nimport { IconTransitionFade } from \"../icons/IconTransitionFade.tsx\"\nimport { IconTransitionFadeSmall } from \"../icons/IconTransitionFadeSmall.tsx\"\nimport { IconTransitionFlip } from \"../icons/IconTransitionFlip.tsx\"\nimport { IconTransitionFlipSmall } from \"../icons/IconTransitionFlipSmall.tsx\"\nimport { IconTransitionMagicMotion } from \"../icons/IconTransitionMagicMotion.tsx\"\nimport { IconTransitionMagicMotionSmall } from \"../icons/IconTransitionMagicMotionSmall.tsx\"\nimport { IconTransitionModal } from \"../icons/IconTransitionModal.tsx\"\nimport { IconTransitionModalSmall } from \"../icons/IconTransitionModalSmall.tsx\"\nimport { IconTransitionOverlay } from \"../icons/IconTransitionOverlay.tsx\"\nimport { IconTransitionOverlaySmall } from \"../icons/IconTransitionOverlaySmall.tsx\"\nimport { IconTransitionPrevious } from \"../icons/IconTransitionPrevious.tsx\"\nimport { IconTransitionPush } from \"../icons/IconTransitionPush.tsx\"\nimport { IconTransitionPushSmall } from \"../icons/IconTransitionPushSmall.tsx\"\n\nexport function iconForNavigationAction(action: NavigationAction, small: boolean = true) {\n\tconst { transition } = action.controls\n\tif (action.controls.type?.value === \"previous\") return iconForTransitionType(\"previous\", small)\n\tif (!transition || !transition.value) return iconForTransitionType(\"instant\", small)\n\n\treturn iconForTransitionType(transition.value, small)\n}\n\nfunction iconForTransitionType(type: string, small: boolean) {\n\tswitch (type) {\n\t\tcase \"previous\":\n\t\t\treturn <IconTransitionPrevious />\n\t\tcase \"instant\":\n\t\t\treturn small ? <IconThunderbolt /> : <IconActionNavigate />\n\t\tcase \"fade\":\n\t\t\treturn small ? <IconTransitionFadeSmall /> : <IconTransitionFade />\n\t\tcase \"flip\":\n\t\t\treturn small ? <IconTransitionFlipSmall /> : <IconTransitionFlip />\n\t\tcase \"modal\":\n\t\t\treturn small ? <IconTransitionModalSmall /> : <IconTransitionModal />\n\t\tcase \"overlay\":\n\t\t\treturn small ? <IconTransitionOverlaySmall /> : <IconTransitionOverlay />\n\t\tcase \"magicMotion\":\n\t\t\treturn small ? <IconTransitionMagicMotionSmall /> : <IconTransitionMagicMotion />\n\t\tcase \"push\":\n\t\tdefault:\n\t\t\treturn small ? <IconTransitionPushSmall /> : <IconTransitionPush />\n\t}\n}\n", "import \"EventsPanel.styles_u6h5fj.wyw.css\"; export const seeAllButtonClass = \"seeAllButtonClass_sny7vu1\";", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\n\n// When an action can't be found, the user can relink the action to another one\n// The data for the overlapping control types should be taken along\nexport function relinkActionDataToAction(\n\tcurrentAction: EventAction,\n\tnewActionEntity: EntityDefinition,\n\tcontrolOverrides: ControlProps = {},\n): EventAction {\n\tconst currentControlProps = getControlProps(newActionEntity.properties, currentAction.controls)\n\n\treturn {\n\t\tidentifier: currentAction.identifier,\n\t\tactionIdentifier: newActionEntity.identifier,\n\t\tcontrols: {\n\t\t\t// Merging in the current raw action controls, because some custom first class actions\n\t\t\t// are misbehaving and haven't defined all of their controls. And otherwise this would\n\t\t\t// result in data loss. Ticket: https://github.com/framer/company/issues/32492\n\t\t\t...currentAction.controls,\n\t\t\t...currentControlProps,\n\t\t\t...controlOverrides,\n\t\t},\n\t}\n}\n", "import { IconInputDropdown, InputWrapper, TextInput } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { RefObject } from \"react\"\nimport React, { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport * as styles from \"./TypedInputField.styles.ts\"\n\ninterface Props {\n\tvalue: Reduced<string>\n\ttype: string\n\ttypeOptions: string[]\n\tonChangeValue: (value: string, final: boolean) => void\n\tonChangeType: (type: string) => void\n\tplaceHolder?: string\n\tcontainerStyle?: React.CSSProperties\n\tautoFocus?: boolean\n\tenabled?: boolean\n\t\"data-testid\"?: string\n\tonKeyDown?: React.KeyboardEventHandler | undefined\n}\n\nexport const TypedInputField = React.memo(\n\tReact.forwardRef(function TypedInputFieldFunctional(props: Props, forwardedRef: RefObject<HTMLInputElement>) {\n\t\tconst {\n\t\t\tvalue,\n\t\t\tonChangeValue,\n\t\t\tplaceHolder,\n\t\t\tcontainerStyle,\n\t\t\tautoFocus,\n\t\t\tenabled = true,\n\t\t\ttypeOptions,\n\t\t\ttype,\n\t\t\tonChangeType,\n\t\t} = props\n\t\tconst defaultRef = React.useRef<HTMLInputElement | null>(null)\n\t\tconst ref = forwardedRef ?? defaultRef\n\n\t\tconst showOptions = useCallback(\n\t\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\t\tconst items: MenuItemOptions[] = typeOptions.map(option => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tlabel: option,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tonChangeType(option)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tchecked: option === type,\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\tengine.stores.contextMenuStore.show(items, { location: { x: event.clientX, y: event.clientY } })\n\n\t\t\t\tif (ref.current) {\n\t\t\t\t\tref.current.focus()\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t},\n\t\t\t[typeOptions, ref, type, onChangeType],\n\t\t)\n\n\t\treturn (\n\t\t\t<InputWrapper style={containerStyle}>\n\t\t\t\t<TextInput\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\tvalue={isString(value) ? value : \"\"}\n\t\t\t\t\tonChange={onChangeValue}\n\t\t\t\t\tplaceholder={placeHolder}\n\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tdata-testid={props[\"data-testid\"]}\n\t\t\t\t\tonKeyDown={props.onKeyDown}\n\t\t\t\t/>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(styles.chevronContainer, enabled ? \"\" : styles.disabled)}\n\t\t\t\t\tonMouseDown={enabled ? showOptions : undefined}\n\t\t\t\t>\n\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t</div>\n\t\t\t</InputWrapper>\n\t\t)\n\t}),\n)\n", "import \"TypedInputField.styles_xky258.wyw.css\"; export const input = \"input_i11ge78e\";\nexport const chevronContainer = \"chevronContainer_c1ax0ih5\";\nexport const disabled = \"disabled_dvwxg3y\";", "import type { CanvasNode, ExportOptions } from \"document/models/CanvasTree/index.ts\"\nimport type { ExportType, WithExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\n\nexport const exportTypes: ExportType[] = [\"png\", \"jpg\", \"svg\"]\n\nexport function exportOptionId(option: ExportOptions) {\n\t// We add the index of the exportTypes to the ID, as a hack to influence sorting\n\treturn [option.scale.toFixed(1), exportTypes.indexOf(option.type), option.type, option.nameExtensionMode].join(\"::\")\n}\n\nexport function exportOptionUniqueId(id: string, idOccurrence: number) {\n\treturn id + \"::\" + idOccurrence\n}\n\nexport function exportOptionIndex(id: string, node: CanvasNode & WithExport) {\n\tconst counter: { [key: string]: number } = {}\n\n\treturn node.exportOptions.findIndex((option: ExportOptions) => {\n\t\tconst optionId = exportOptionId(option)\n\t\tif (typeof counter[optionId] === \"number\") counter[optionId]++\n\t\telse counter[optionId] = 0\n\t\tconst realId = optionId + \"::\" + counter[optionId]\n\t\treturn id === realId\n\t})\n}\n", "import { PopupButton, PopupButtonItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { List } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { TypedInputField } from \"document/components/chrome/properties/inputs/TypedInputField.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, ExportOptions, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tExportExtensionMode,\n\tExportOptionRow,\n\tExportScale,\n\tExportType,\n\tWithExport,\n} from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { withExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { exportOptionIndex, exportTypes } from \"document/models/CanvasTree/traits/utils/export.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\n\ninterface Props {\n\treadonly nodes: (CanvasNode & WithExport)[]\n\treadonly nodeIds: NodeID[]\n\treadonly uniqueId: string\n\treadonly row: ExportOptionRow\n\treadonly interactionEnabled: boolean\n\treadonly isViewOnly: boolean\n}\n\nexport const exportScales: ExportScale[] = [0.5, 1, 1.5, 2, 3, 4]\nconst popupScales = [\".5x\", \"1x\", \"1.5x\", \"2x\", \"3x\", \"4x\"]\nconst extensionModeOptions: ExportExtensionMode[] = [\"Suffix\", \"Folder\"]\n\nexport class ExportRow extends React.Component<Props> {\n\tnodes = () => engine.tree.getNodesWithTrait(this.props.nodeIds, withExport)\n\n\tonChangeRowType = engine.scheduler.wrapHandler((type: ExportType) => {\n\t\tconst options: Partial<ExportOptions> = { type }\n\t\tif (type === \"svg\") {\n\t\t\toptions.scale = 1\n\t\t}\n\t\tthis.updateExportOptions(options)\n\t})\n\n\tonChangeRowScale = engine.scheduler.wrapHandler((value: string) => {\n\t\tconst at = popupScales.indexOf(value)\n\t\tconst scale = exportScales[at]\n\t\tconst update: Partial<ExportOptions> = { scale }\n\t\tconst nameExtension = nameExtensionDefault(this.props.row, scale)\n\t\tif (nameExtension !== undefined) {\n\t\t\tupdate.nameExtension = nameExtension\n\t\t}\n\t\tthis.updateExportOptions(update)\n\t})\n\n\tonChangeRowNameExtension = engine.scheduler.wrapHandler((extension: string) => {\n\t\tthis.updateExportOptionsForEach(exportOption => {\n\t\t\tconst nameExtension = validNameExtension(extension, exportOption.nameExtensionMode)\n\t\t\treturn exportOption.updatedExportOptions({ nameExtension })\n\t\t})\n\t})\n\n\tonChangeExtensionMode = engine.scheduler.wrapHandler((nameExtensionMode: ExportExtensionMode) => {\n\t\tthis.updateExportOptionsForEach(exportOption => {\n\t\t\tconst nameExtension = nameExtensionForModeSwitch(exportOption, nameExtensionMode)\n\t\t\treturn exportOption.updatedExportOptions({ nameExtensionMode, nameExtension })\n\t\t})\n\t})\n\n\tupdateExportOptions(update: Partial<ExportOptions>) {\n\t\tthis.nodes().forEach(node => {\n\t\t\tconst index = exportOptionIndex(this.props.uniqueId, node)\n\t\t\tif (index === -1) return\n\t\t\tconst option = node.exportOptions[index]\n\t\t\tconst exportOptions = List.replace(node.exportOptions, index, option.updatedExportOptions(update))\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t}\n\n\tupdateExportOptionsForEach(cb: (current: ExportOptions) => ExportOptions) {\n\t\tthis.nodes().forEach(node => {\n\t\t\tconst index = exportOptionIndex(this.props.uniqueId, node)\n\t\t\tif (index === -1) return\n\t\t\tconst option = node.exportOptions[index]\n\t\t\tconst exportOptions = List.replace(node.exportOptions, index, cb(option))\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t}\n\n\tremove = engine.scheduler.wrapHandler(() => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tconst index = exportOptionIndex(this.props.uniqueId, node)\n\t\t\tif (index === -1) return\n\t\t\tconst exportOptions = List.remove(node.exportOptions, index)\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t})\n\n\tduplicate = engine.scheduler.wrapHandler(() => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tconst index = exportOptionIndex(this.props.uniqueId, node)\n\t\t\tif (index === -1) return\n\t\t\tconst option = node.exportOptions[index]\n\t\t\tconst exportOptions = List.insert(node.exportOptions, index + 1, option)\n\t\t\tif (!exportOptions) return\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t})\n\n\tonContextMenu = (event: React.MouseEvent<HTMLElement>) => {\n\t\tconst items = [\n\t\t\t{ label: \"Duplicate\", click: this.duplicate },\n\t\t\t{ label: \"Remove\", click: this.remove },\n\t\t]\n\t\tengine.stores.contextMenuStore.show(items, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\texportTypesForNodes(nodes: (CanvasNode & WithExport)[], row: ExportOptionRow): ExportType[] {\n\t\tfor (const node of nodes) {\n\t\t\tif (!isExportableAsSVG(node) && row.type !== \"svg\") {\n\t\t\t\treturn exportTypes.filter(type => type !== \"svg\")\n\t\t\t}\n\t\t}\n\t\treturn exportTypes\n\t}\n\n\toverride render() {\n\t\tconst { row, nodes, interactionEnabled, isViewOnly } = this.props\n\t\tconst types = this.exportTypesForNodes(nodes, row)\n\n\t\treturn (\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tonContextMenu={isViewOnly ? undefined : this.onContextMenu}\n\t\t\t\tpaddingTop={dimensions.css.panelGapSmall}\n\t\t\t\tpaddingBottom={dimensions.css.panelGapSmall}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t>\n\t\t\t\t<div style={{ flexGrow: 1, flexBasis: 1 }}>\n\t\t\t\t\t<PopupButton enabled={row.type !== \"svg\" && interactionEnabled && !isViewOnly} data-testid=\"export-scale\">\n\t\t\t\t\t\t{popupScales.map((popupScale, idx) => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={popupScale}\n\t\t\t\t\t\t\t\tidentifier={popupScale}\n\t\t\t\t\t\t\t\ttitle={popupScale}\n\t\t\t\t\t\t\t\tselected={exportScales.indexOf(row.scale) === idx}\n\t\t\t\t\t\t\t\tonSelect={this.onChangeRowScale}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\n\t\t\t\t<div style={{ flexGrow: 1, flexBasis: 1 }}>\n\t\t\t\t\t<TypedInputField\n\t\t\t\t\t\tplaceHolder={placeHolder(row.nameExtension, row.nameExtensionMode)}\n\t\t\t\t\t\tvalue={row.nameExtension}\n\t\t\t\t\t\tonChangeValue={this.onChangeRowNameExtension}\n\t\t\t\t\t\ttype={row.nameExtensionMode}\n\t\t\t\t\t\ttypeOptions={extensionModeOptions}\n\t\t\t\t\t\tonChangeType={this.onChangeExtensionMode}\n\t\t\t\t\t\tenabled={interactionEnabled && !isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div style={{ flexGrow: 1, flexBasis: 1 }}>\n\t\t\t\t\t<PopupButton enabled={interactionEnabled && !isViewOnly} data-testid=\"export-format\">\n\t\t\t\t\t\t{types.map(imageType => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={imageType}\n\t\t\t\t\t\t\t\tidentifier={imageType}\n\t\t\t\t\t\t\t\ttitle={imageType.toUpperCase()}\n\t\t\t\t\t\t\t\tselected={row.type === imageType}\n\t\t\t\t\t\t\t\tonSelect={this.onChangeRowType}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t)\n\t}\n}\n\n// Helpers\n\nfunction placeHolder(nameExtension: Reduced<string>, nameExtensionMode: ExportExtensionMode) {\n\tif (!isString(nameExtension)) return Dictionary.Mixed\n\tif (nameExtension.length > 0) return \"\"\n\treturn nameExtensionMode\n}\n\nfunction validNameExtension(extension: string, nameExtensionMode: ExportExtensionMode) {\n\tlet nameExtension = extension\n\tif (nameExtension.length) {\n\t\tconst lastChar = nameExtension[nameExtension.length - 1]\n\t\tif (lastChar === \"/\") {\n\t\t\tif (nameExtensionMode === \"Suffix\") nameExtension = nameExtension.slice(0, -1)\n\t\t} else {\n\t\t\tif (nameExtensionMode === \"Folder\") nameExtension = nameExtension + \"/\"\n\t\t}\n\t}\n\treturn nameExtension\n}\n\nfunction rowIsIos(row: ExportOptionRow | ExportOptions) {\n\tif (row.nameExtensionMode !== \"Suffix\") return false\n\tif (row.scale === 1 && !row.nameExtension) return true\n\tif (!row.nameExtension) return false\n\treturn row.nameExtension === iosDefaultExtension(row.scale)\n}\n\nfunction rowIsAndroid(row: ExportOptionRow | ExportOptions) {\n\tif (row.nameExtensionMode !== \"Folder\") return false\n\tif (row.scale === 0.5 && !row.nameExtension) return true\n\treturn row.nameExtension === androidDefaultExtension(row.scale)\n}\n\nfunction iosDefaultExtension(scale: ExportScale) {\n\tswitch (scale) {\n\t\tcase 0.5:\n\t\t\treturn \"@0.5x\"\n\t\tcase 1.5:\n\t\t\treturn \"@1.5x\"\n\t\tcase 2:\n\t\t\treturn \"@2x\"\n\t\tcase 3:\n\t\t\treturn \"@3x\"\n\t\tcase 4:\n\t\t\treturn \"@4x\"\n\t\tdefault:\n\t\t\treturn \"\"\n\t}\n}\n\nfunction androidDefaultExtension(scale: ExportScale) {\n\tswitch (scale) {\n\t\tcase 1:\n\t\t\treturn \"mdpi/\"\n\t\tcase 1.5:\n\t\t\treturn \"hdpi/\"\n\t\tcase 2:\n\t\t\treturn \"xhdpi/\"\n\t\tcase 3:\n\t\t\treturn \"xxhdpi/\"\n\t\tcase 4:\n\t\t\treturn \"xxxhdpi/\"\n\t\tdefault:\n\t\t\treturn \"\"\n\t}\n}\n\nfunction nameExtensionDefault(row: ExportOptionRow, toScale: ExportScale) {\n\tif (rowIsIos(row)) {\n\t\treturn iosDefaultExtension(toScale)\n\t} else if (rowIsAndroid(row)) {\n\t\treturn androidDefaultExtension(toScale)\n\t}\n}\n\nfunction nameExtensionForModeSwitch(row: ExportOptions, toMode: ExportExtensionMode) {\n\tif (toMode === \"Folder\") {\n\t\tif (rowIsIos(row)) return androidDefaultExtension(row.scale)\n\t} else if (toMode === \"Suffix\") {\n\t\tif (rowIsAndroid(row)) return iosDefaultExtension(row.scale)\n\t}\n\treturn validNameExtension(row.nameExtension, toMode)\n}\n", "import { assert, Mixed } from \"@framerjs/shared\"\nimport type { CanvasNode, ExportOptions } from \"document/models/CanvasTree/index.ts\"\nimport type { ExportOptionRow, WithExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { withExport } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { exportOptionId } from \"document/models/CanvasTree/traits/utils/export.ts\"\nimport type { ExportPreviewNode } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport type { Reduced } from \"./Reduced.ts\"\n\nexport interface ReduceExportResult {\n\texportRows?: ExportOptionRow[]\n\texportPreviewNode?: ExportPreviewNode | Mixed\n\texportCount: number\n\tcanExportAsSVG: boolean\n\texportableNodes: (CanvasNode & WithExport)[]\n\tonlyExportableNodes: boolean\n}\n\nexport function reduceExport(node: CanvasNode, result: ReduceExportResult) {\n\tif (!withExport(node)) return\n\n\t// Don't export for selection when contains children of repeaters\n\t// and those repeaters are not in selection\n\tconst hasAncestorRepeater = !!node.cache.ancestorRepeaterIds?.length\n\tif (hasAncestorRepeater) {\n\t\tresult.onlyExportableNodes = false\n\t\treturn\n\t}\n\n\tresult.exportableNodes.push(node)\n\n\tconst nodeIsExportableAsSVG = isExportableAsSVG(node)\n\n\tif (result.canExportAsSVG && !nodeIsExportableAsSVG) {\n\t\tresult.canExportAsSVG = false\n\t}\n\n\tconst isFirst = result.exportRows === undefined\n\tconst exportRows: ExportOptionRow[] = []\n\tlet anyEnabledExportOption = false\n\n\tpairExportOptions(result.exportRows || [], node.exportOptions, (id, idOccurrence, row, option) => {\n\t\tanyEnabledExportOption = anyEnabledExportOption || option?.enabled === true\n\n\t\tif (row) {\n\t\t\tif (option) {\n\t\t\t\tif (row.enabled !== optionShouldBeEnabled(option, nodeIsExportableAsSVG)) row.enabled = Mixed\n\t\t\t\tif (row.nameExtension !== option.nameExtension) row.nameExtension = Mixed\n\t\t\t} else if (row.enabled === true) {\n\t\t\t\trow.enabled = Mixed\n\t\t\t}\n\t\t\tif (row.type === \"svg\" && row.enabled === true && !nodeIsExportableAsSVG) {\n\t\t\t\trow.enabled = Mixed\n\t\t\t}\n\t\t\texportRows.push(row)\n\t\t} else if (option) {\n\t\t\tlet enabled: Reduced<boolean> = optionShouldBeEnabled(option, nodeIsExportableAsSVG)\n\t\t\tif (enabled && !isFirst) enabled = Mixed\n\t\t\tconst { type, scale, nameExtension, nameExtensionMode } = option\n\t\t\texportRows.push({\n\t\t\t\tid,\n\t\t\t\tuid: option.id,\n\t\t\t\tidOccurrence,\n\t\t\t\tenabled,\n\t\t\t\ttype,\n\t\t\t\tscale,\n\t\t\t\tnameExtension,\n\t\t\t\tnameExtensionMode,\n\t\t\t})\n\t\t} else {\n\t\t\tthrow new Error(\"Callback called with two null values\")\n\t\t}\n\t})\n\n\tresult.exportRows = exportRows\n\n\tif (anyEnabledExportOption === false) {\n\t\treturn\n\t}\n\n\tif (result.exportPreviewNode === undefined) {\n\t\tconst previewExportOption = node.exportOptions.find((option: ExportOptions) => {\n\t\t\treturn optionShouldBeEnabled(option, nodeIsExportableAsSVG)\n\t\t})\n\t\tif (previewExportOption) {\n\t\t\tconst exportOptions: readonly ExportOptions[] = [previewExportOption]\n\t\t\tresult.exportPreviewNode = { exportOptions, node }\n\t\t}\n\t} else {\n\t\tresult.exportPreviewNode = Mixed\n\t}\n\n\t// This node won't be exported, so don't count it\n\tif (!nodeIsExportableAsSVG && node.exportOptions.length === 1) {\n\t\tconst exportOption = node.exportOptions[0]\n\t\tassert(exportOption, \"Export option must be defined\")\n\t\tif (exportOption.type === \"svg\") return\n\t}\n\tresult.exportCount++\n}\n\nfunction optionShouldBeEnabled(option: ExportOptions, nodeIsExportableAsSVG: boolean): boolean {\n\treturn option.enabled && (option.type !== \"svg\" || nodeIsExportableAsSVG)\n}\n\nfunction pairExportOptions(\n\tresult: ExportOptionRow[],\n\tnodeOptions: readonly ExportOptions[],\n\tcallback: (id: string, occurrency: number, row: ExportOptionRow | null, nodeExport: ExportOptions | null) => void,\n) {\n\tconst groupedOptions: { [key: string]: ExportOptions[] } = {}\n\tconst groupedRows: { [key: string]: ExportOptionRow[] } = {}\n\tconst ids: string[] = []\n\n\tresult.forEach(row => {\n\t\tif (!ids.includes(row.id)) {\n\t\t\tids.push(row.id)\n\t\t}\n\t\tlet list = groupedRows[row.id]\n\t\tif (!list) {\n\t\t\tlist = groupedRows[row.id] = []\n\t\t}\n\t\tlist.push(row)\n\t})\n\tnodeOptions.forEach((row: ExportOptions) => {\n\t\tconst id = exportOptionId(row)\n\t\tif (!ids.includes(id)) {\n\t\t\tids.push(id)\n\t\t}\n\t\tlet list = groupedOptions[id]\n\t\tif (!list) {\n\t\t\tlist = groupedOptions[id] = []\n\t\t}\n\t\tlist.push(row)\n\t})\n\n\tids.sort().forEach(id => {\n\t\tconst options = groupedOptions[id] || []\n\t\tconst rows = groupedRows[id] || []\n\t\tconst count = Math.max(options.length, rows.length)\n\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tcallback(id, i, rows[i] || null, options[i] || null)\n\t\t}\n\t})\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithExportIncludesBackground } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { withExportIncludesBackground } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport type { ReducedRecord } from \"./Reduced.ts\"\nimport { reduceProperty } from \"./reduceProperty.ts\"\n\nexport interface ReduceExportIncludesBackgroundResult extends Omit<\n\tReducedRecord<WithExportIncludesBackground>,\n\t\"exportOptions\"\n> {\n\tonlyNodesWithExportIncludesBackground: boolean\n}\n\nexport function reduceExportIncludesBackground(node: CanvasNode, result: ReduceExportIncludesBackgroundResult) {\n\tif (!withExportIncludesBackground(node)) {\n\t\tresult.onlyNodesWithExportIncludesBackground = false\n\t\treturn\n\t}\n\n\treduceProperty(\"exportIncludesBackground\", result, node)\n}\n", "import { triggerExportBitmapEvent } from \"@framerjs/framer-events\"\nimport { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { AutoSized, Events, Sorted } from \"@framerjs/fresco/layout-transitions\"\nimport { List, isMixed } from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { ExportRow, exportScales } from \"document/components/chrome/properties/rows/ExportRow.tsx\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ExportOptions } from \"document/models/CanvasTree/index.ts\"\nimport { isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tExportOptionRow,\n\tExportScale,\n\tExportType,\n\tWithExport,\n} from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { exportOptionIndex, exportOptionUniqueId } from \"document/models/CanvasTree/traits/utils/export.ts\"\nimport type { ReduceExportResult } from \"document/models/CanvasTree/traits/utils/reduceExport.ts\"\nimport { reduceExport } from \"document/models/CanvasTree/traits/utils/reduceExport.ts\"\nimport type { ReduceExportIncludesBackgroundResult } from \"document/models/CanvasTree/traits/utils/reduceExportIncludesBackground.ts\"\nimport { reduceExportIncludesBackground } from \"document/models/CanvasTree/traits/utils/reduceExportIncludesBackground.ts\"\nimport { isExportableAsSVG } from \"document/models/CanvasTree/utils/isExportableAsSVG.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ImageExporter } from \"export/ImageExporter.ts\"\nimport React from \"react\"\nimport { exportName } from \"utils/exportCommon.tsx\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { ExportButton } from \"../inputs/ExportButton.tsx\"\nimport { ExportIncludesBackgroundRow } from \"../rows/ExportIncludesBackgroundRow.tsx\"\nimport * as styles from \"./ExportPanel.styles.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ninterface Props {\n\treadonly nodes: CanvasNode[]\n\treadonly selection: NodeID[]\n\treadonly isViewOnly: boolean\n\treadonly exportP3: boolean\n\treadonly selectionHash: string\n}\n\ninterface State extends ReduceExportIncludesBackgroundResult, ReduceExportResult {}\n\nexport function ExportPanel(props: Omit<Props, \"exportP3\">) {\n\tconst exportP3 = useEngineState(() => engine.stores.persistedUserDefaults.p3, [], [EngineChange.UserDefaultsStore])\n\treturn <ExportPanelInner {...props} exportP3={exportP3} selectionHash={props.selectionHash} />\n}\n\nclass ExportPanelInner extends React.Component<Props, State> {\n\toverride state: State = {\n\t\texportableNodes: [],\n\t\tonlyExportableNodes: true,\n\t\texportCount: 0,\n\t\tcanExportAsSVG: true,\n\t\tonlyNodesWithExportIncludesBackground: false,\n\t\texportPreviewNode: undefined,\n\t\texportRows: undefined,\n\t\texportIncludesBackground: NotFound,\n\t}\n\n\tstatic getDerivedStateFromProps({ nodes }: Props): State {\n\t\tconst state: State = {\n\t\t\texportableNodes: [],\n\t\t\tonlyExportableNodes: true,\n\t\t\texportCount: 0,\n\t\t\tcanExportAsSVG: true,\n\t\t\tonlyNodesWithExportIncludesBackground: nodes.length > 0,\n\t\t\texportPreviewNode: undefined,\n\t\t\texportRows: undefined,\n\t\t\texportIncludesBackground: NotFound,\n\t\t}\n\n\t\tnodes.forEach(node => {\n\t\t\treduceExport(node, state)\n\t\t\treduceExportIncludesBackground(node, state)\n\t\t})\n\n\t\tstate.exportRows = state.exportRows?.filter(row => row.enabled !== false)\n\n\t\treturn state\n\t}\n\n\tonAddRow = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\n\t\tif (!Events.isLeftMouseClick(event)) return\n\n\t\tconst { exportRows } = this.state\n\t\tif (!exportRows || exportRows.length === 0) {\n\t\t\tthis.onMakeExportable()\n\t\t\treturn\n\t\t}\n\t\tlet scale: ExportScale | undefined\n\t\tlet type: ExportType | undefined\n\t\t// Use slice(0) to make a shallow copy\n\t\tconst reversedExportRows = exportRows.slice(0).reverse()\n\t\tfor (const row of reversedExportRows) {\n\t\t\tif (row.type !== \"svg\") {\n\t\t\t\tscale = row.scale\n\t\t\t\ttype = row.type\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (isUndefined(type)) {\n\t\t\ttype = \"png\"\n\t\t}\n\t\tif (isUndefined(scale)) {\n\t\t\tscale = 1\n\t\t} else {\n\t\t\tscale = Math.floor(scale + 1) as ExportScale\n\t\t}\n\t\tif (!exportScales.includes(scale)) {\n\t\t\tscale = scale < 1 ? 1 : exportScales[exportScales.length - 1]\n\t\t}\n\t\tconst nameExtension = scale === 1 ? \"\" : `@${scale}x`\n\t\tconst toAdd: ExportOptions = ExportOptions.create({ enabled: true, type: type, scale, nameExtension })\n\n\t\tthis.state.exportableNodes.forEach(node => {\n\t\t\tconst exportOptions = node.exportOptions ? List.push(node.exportOptions, toAdd) : [toAdd]\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t})\n\n\tonMakeExportable = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.state.exportableNodes\n\n\t\tlet defaultType: ExportType = \"png\"\n\t\tif (nodes.every(isExportableAsSVG)) {\n\t\t\tdefaultType = \"svg\"\n\t\t}\n\n\t\tconst update: WithExport = {\n\t\t\texportOptions: [\n\t\t\t\tExportOptions.create({\n\t\t\t\t\tenabled: true,\n\t\t\t\t\ttype: defaultType,\n\t\t\t\t\tscale: 1,\n\t\t\t\t\tnameExtension: \"\",\n\t\t\t\t}),\n\t\t\t],\n\t\t}\n\n\t\tnodes.forEach(node => node.set(update))\n\t})\n\n\tdisplaySettingsDropdown = ({ clientX, clientY }: React.MouseEvent) => {\n\t\tconst { exportRows } = this.state\n\n\t\tconst menuOptions: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Remove All\",\n\t\t\t\tclick: this.removeAllExportOptions,\n\t\t\t\tenabled: !!exportRows && exportRows.length > 0,\n\t\t\t},\n\t\t]\n\n\t\tengine.stores.contextMenuStore.show(menuOptions, { location: { x: clientX, y: clientY } })\n\t}\n\n\tremoveAllExportOptions = engine.scheduler.wrapHandler(() => {\n\t\tthis.state.exportableNodes.forEach(node => {\n\t\t\tnode.set({ exportOptions: [] })\n\t\t})\n\t})\n\n\tremoveLastExportOption = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\t\tevent.stopPropagation()\n\n\t\tconst { exportRows } = this.state\n\t\tif (!exportRows || exportRows.length === 0) return\n\n\t\tconst row = exportRows[exportRows.length - 1]\n\t\tif (!row) return\n\n\t\tconst uniqueId = exportOptionUniqueId(row.id, row.idOccurrence)\n\n\t\tthis.state.exportableNodes.forEach(node => {\n\t\t\tconst index = exportOptionIndex(uniqueId, node)\n\t\t\tif (index === -1) return\n\t\t\tconst exportOptions = List.remove(node.exportOptions, index)\n\t\t\tnode.set({ exportOptions })\n\t\t})\n\t})\n\n\tonExport = async () => {\n\t\tif (!ImageExporter.isAvailable) return\n\n\t\ttriggerExportBitmapEvent({ scope: \"selection\" })\n\t\treturn ImageExporter.exportNodes(this.state.exportableNodes, engine)\n\t}\n\n\tsetExportP3 = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.persistedUserDefaults.p3 = true\n\t})\n\n\tsetExportSRGB = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.persistedUserDefaults.p3 = false\n\t})\n\n\toverride render() {\n\t\tconst { isViewOnly, selectionHash } = this.props\n\n\t\tconst {\n\t\t\texportRows = [],\n\t\t\tcanExportAsSVG,\n\t\t\texportableNodes,\n\t\t\tonlyExportableNodes,\n\t\t\texportCount,\n\t\t\tonlyNodesWithExportIncludesBackground,\n\t\t\texportIncludesBackground,\n\t\t} = this.state\n\n\t\t// Export canvas\n\t\tif (exportableNodes.length === 0 || !onlyExportableNodes) return null\n\n\t\tconst exportableNodeIds = exportableNodes.map(node => node.id)\n\n\t\treturn (\n\t\t\t<Panel\n\t\t\t\tkey={selectionHash}\n\t\t\t\theader={\n\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\ttitle=\"Export\"\n\t\t\t\t\t\tclickable={!isViewOnly}\n\t\t\t\t\t\tonClick={isViewOnly ? undefined : this.onAddRow}\n\t\t\t\t\t\tonContextMenu={isViewOnly ? undefined : this.displaySettingsDropdown}\n\t\t\t\t\t>\n\t\t\t\t\t\t{exportRows.length > 0 && !isViewOnly && (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton onClick={this.removeLastExportOption}>\n\t\t\t\t\t\t\t\t<IconSectionHeaderMinus />\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{exportableNodes.length > 0 && !isViewOnly && (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton onClick={this.onAddRow}>\n\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{exportRows.length > 0 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Sorted items={exportRows} keyForItem={exportRowKeyForItem}>\n\t\t\t\t\t\t\t{({ item: row }) => (\n\t\t\t\t\t\t\t\t<ExportRow\n\t\t\t\t\t\t\t\t\trow={row}\n\t\t\t\t\t\t\t\t\tnodeIds={exportableNodeIds}\n\t\t\t\t\t\t\t\t\tnodes={exportableNodes}\n\t\t\t\t\t\t\t\t\tuniqueId={exportOptionUniqueId(row.id, row.idOccurrence)}\n\t\t\t\t\t\t\t\t\tinteractionEnabled={row.type !== \"svg\" || canExportAsSVG}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Sorted>\n\n\t\t\t\t\t\t<div className={styles.exportWithColorSpace}>\n\t\t\t\t\t\t\t<ExportButton\n\t\t\t\t\t\t\t\ttitle={exportTitle(this.state)}\n\t\t\t\t\t\t\t\tonClick={this.onExport}\n\t\t\t\t\t\t\t\tenabled={exportCount > 0}\n\t\t\t\t\t\t\t\tclassName={styles.exportButton}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t\t<PopupButtonItem title=\"sRGB\" selected={!this.props.exportP3} onSelect={this.setExportSRGB} />\n\t\t\t\t\t\t\t\t<PopupButtonItem title=\"P3\" selected={this.props.exportP3} onSelect={this.setExportP3} />\n\t\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t<AutoSized dependencies={exportCount > 0 && onlyNodesWithExportIncludesBackground}>\n\t\t\t\t\t{exportCount > 0 && onlyNodesWithExportIncludesBackground && (\n\t\t\t\t\t\t<ExportIncludesBackgroundRow\n\t\t\t\t\t\t\tnodeIds={exportableNodeIds}\n\t\t\t\t\t\t\texportIncludesBackground={exportIncludesBackground}\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</AutoSized>\n\t\t\t</Panel>\n\t\t)\n\t}\n}\n\n// helpers\n\nfunction exportTitle(properties: State) {\n\tif (properties.exportCount === 0) return \"Export\"\n\tif (properties.exportPreviewNode && !isMixed(properties.exportPreviewNode)) {\n\t\tconst node = properties.exportPreviewNode.node\n\t\tlet name = exportName(engine.componentLoader, node)\n\t\tif (name.length > 20) {\n\t\t\tname = isTextNode(node) ? \"Text\" : getDefaultName(engine.componentLoader, node)\n\t\t}\n\t\treturn \"Export \" + name\n\t}\n\tconst extension = properties.exportCount > 1 ? \"s\" : \"\"\n\treturn \"Export \" + properties.exportCount + \" Layer\" + extension\n}\n\nconst exportRowKeyForItem = (row: ExportOptionRow) => row.uid\n", "import { Button, Spinner } from \"@framerjs/fresco\"\nimport { useState } from \"react\"\n\ninterface Props {\n\ttitle: string\n\tonClick: () => Promise<void>\n\tenabled: boolean\n\tclassName?: string\n}\n\nexport const ExportButton = ({ title, onClick, enabled, className }: Props) => {\n\tconst [inProgress, setInProgress] = useState(false)\n\n\treturn (\n\t\t<div className={className}>\n\t\t\t<Button\n\t\t\t\tid=\"export-button\"\n\t\t\t\ttitle={inProgress ? \"Exporting\u2026\" : title}\n\t\t\t\tstyle={{ width: \"100%\" }}\n\t\t\t\tenabled={!inProgress && enabled}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetInProgress(true)\n\t\t\t\t\tvoid onClick().finally(() => setInProgress(false))\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{inProgress && <Spinner />}\n\t\t\t</Button>\n\t\t</div>\n\t)\n}\n", "import { CheckBox, Stack } from \"@framerjs/fresco\"\nimport { colors, cursors, dimensions } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withExportIncludesBackground } from \"document/models/CanvasTree/traits/WithExport.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReduceExportIncludesBackgroundResult } from \"document/models/CanvasTree/traits/utils/reduceExportIncludesBackground.ts\"\nimport React from \"react\"\n\ninterface Props extends Pick<ReduceExportIncludesBackgroundResult, \"exportIncludesBackground\"> {\n\treadonly nodeIds: NodeID[]\n\treadonly isViewOnly: boolean\n}\n\nconst checkBoxId = \"exportInludesBackground\"\n\nexport const ExportIncludesBackgroundRow = React.memo(function ExportIncludesBackgroundRow({\n\tnodeIds,\n\texportIncludesBackground,\n\tisViewOnly,\n}: Props) {\n\tconst onChange = engine.scheduler.wrapHandler((newExportIncludesBackground: boolean) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withExportIncludesBackground)\n\t\tnodes.forEach(node => node.set({ exportIncludesBackground: newExportIncludesBackground }))\n\t})\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tpaddingTop={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.panelGapSmall}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tstyle={{ height: dimensions.css.inputHeightSmall }}\n\t\t>\n\t\t\t<CheckBox\n\t\t\t\tid={checkBoxId}\n\t\t\t\tvalue={notFoundToUndefined(exportIncludesBackground)}\n\t\t\t\tonChange={onChange}\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t/>\n\t\t\t<label htmlFor={checkBoxId} style={{ color: colors.panelText, cursor: cursors.button }}>\n\t\t\t\tInclude Background\n\t\t\t</label>\n\t\t</Stack>\n\t)\n})\n", "import \"ExportPanel.styles_ga5ds6.wyw.css\"; export const exportWithColorSpace = \"exportWithColorSpace_eljbzp8\";\nexport const exportButton = \"exportButton_e1duh9xg\";\nexport const exportButtonOld = \"exportButtonOld_e1vvgc7q\";", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { traitTypeMap } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { defaultForFilter, titleForFilter } from \"document/models/CanvasTree/traits/utils/filterHelpers.ts\"\nimport type { ReducedFilters } from \"document/models/CanvasTree/traits/utils/reduceFilters.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { filterKeys } from \"./utils/getFilters.ts\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\ninterface Props extends Omit<ReducedFilters, \"onlyNodesWithFilters\"> {\n\tallNodeIds: NodeID[]\n}\n\ninterface FilterRowProps {\n\tfilterKey: keyof WithFilters\n\tvalue: number | DynamicValue\n\tonChange: (key: keyof WithFilters, value: number | undefined) => void\n\n\tonCreateVariable: (scopeId: NodeID, filterKey: keyof WithFilters) => void\n\tonRemoveDynamicValue: (filterKey: keyof WithFilters) => void\n\tonChangeDynamicValue: (filterKey: keyof WithFilters, dynamicValue: DynamicValue) => void\n\tallNodeIds: NodeID[]\n}\n\nconst blurKeys = new Set<keyof WithFilters>([\"blur\", \"backgroundBlur\"])\n\nconst FilterRow = React.memo(function FilterRow({\n\tfilterKey,\n\tvalue,\n\tonChange,\n\tonCreateVariable,\n\tonRemoveDynamicValue,\n\tonChangeDynamicValue,\n\tallNodeIds,\n}: FilterRowProps) {\n\tconst traitType = traitTypeMap[filterKey]\n\tconst canCopyFilter = isNumber(value)\n\tconst [canPasteFilter, pasteFilter, copyFilter] = useCopyAndPasteSingleProperty(traitType, allNodeIds, canCopyFilter)\n\n\tconst onChangeHandler = (newValue: number) => {\n\t\tonChange(filterKey, newValue)\n\t}\n\n\tconst onDeleteHandler = () => {\n\t\tonChange(filterKey, undefined)\n\t}\n\n\tconst onCreateVariableHandler = (scopeId: NodeID) => {\n\t\tonCreateVariable(scopeId, filterKey)\n\t}\n\n\tconst onRemoveDynamicValueHandler = () => {\n\t\tonRemoveDynamicValue(filterKey)\n\t}\n\n\tconst onChangeDynamicValueHandler = (dynamicValue: DynamicValue) => {\n\t\tonChangeDynamicValue(filterKey, dynamicValue)\n\t}\n\n\tconst numberValue = isVariableReference(value) || isComputedValue(value) ? 0 : value\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\ttitle={titleForFilter(filterKey)}\n\t\t\t\tonDelete={onDeleteHandler}\n\t\t\t\ttraitTypeKeys={[filterKey]}\n\t\t\t\tvariableType={ControlType.Number}\n\t\t\t\tonCreateVariable={onCreateVariableHandler}\n\t\t\t\tonRemoveDynamicValue={onRemoveDynamicValueHandler}\n\t\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\t\tonSelectVariable={onChangeDynamicValueHandler}\n\t\t\t\tsupportsVariables\n\t\t\t\tonCopy={copyFilter}\n\t\t\t\tonPaste={pasteFilter}\n\t\t\t\tcopyEnabled={canCopyFilter}\n\t\t\t\tpasteEnabled={canPasteFilter}\n\t\t\t>\n\t\t\t\t{isDynamicValue(value) ? (\n\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\ttitle={titleForFilter(filterKey)}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\t\tpopoutId={filterKey + \"ValueTransform\"}\n\t\t\t\t\t\tonRemove={onRemoveDynamicValueHandler}\n\t\t\t\t\t\tonChangeDynamicValue={onChangeDynamicValueHandler}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tvalue={numberValue}\n\t\t\t\t\t\t\tonChange={onChangeHandler}\n\t\t\t\t\t\t\tunit={unitForFilter(filterKey)}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tmax={maxForFilter(filterKey)}\n\t\t\t\t\t\t\tdefaultValue={defaultForFilter(filterKey)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Slider value={numberValue} onChange={onChangeHandler} min={0} max={sliderMaxForFilter(filterKey)} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t{blurKeys.has(filterKey) && numberValue > 10 && (\n\t\t\t\t<DescriptionRow description=\"Large blur values can impact performance.\" />\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nexport class FiltersPanel extends React.PureComponent<Props> {\n\tnodes = () => engine.tree.getNodesWithTrait(this.props.allNodeIds, withFilters)\n\n\tonChange = engine.scheduler.wrapHandler((key: keyof WithFilters, value: number) => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tnode.set({ [key]: value })\n\t\t})\n\t})\n\n\tonCreateVariable = engine.scheduler.wrapHandler((scopeId: NodeID, filterKey: keyof WithFilters) => {\n\t\tconst value = this.props[filterKey]\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Number,\n\t\t\tname: filterKey,\n\t\t\tinitialValue: isNumber(value) ? value : 0,\n\t\t})\n\t\tif (!variableRef) return\n\t\tthis.nodes().forEach(node => node.set({ [filterKey]: variableRef }))\n\t})\n\n\tonRemoveDynamicValue = engine.scheduler.wrapHandler((filterKey: keyof WithFilters) => {\n\t\tconst value = this.props[filterKey]\n\t\tif (!isDynamicValue(value)) return\n\n\t\tif (isVariableReference(value)) {\n\t\t\tconst variableValue = getVariableValue(engine, value)\n\t\t\tconst filterValue = isNumber(variableValue)\n\t\t\t\t? Math.max(0, Math.min(1, variableValue))\n\t\t\t\t: defaultForFilter(filterKey)\n\t\t\tthis.nodes().forEach(node => node.set({ [filterKey]: filterValue }))\n\t\t} else if (isComputedValue(value)) {\n\t\t\tthis.nodes().forEach(node => node.set({ [filterKey]: defaultForFilter(filterKey) }))\n\t\t} else {\n\t\t\tshouldBeNever(value)\n\t\t}\n\t})\n\n\tonChangeDynamicValue = engine.scheduler.wrapHandler((filterKey: keyof WithFilters, dynamicValue: DynamicValue) => {\n\t\tthis.nodes().forEach(node => node.set({ [filterKey]: dynamicValue }))\n\t})\n\n\toverride render() {\n\t\treturn filterKeys\n\t\t\t.map(filterKey => {\n\t\t\t\tconst currentValue = this.props[filterKey]\n\t\t\t\tif (!isNumber(currentValue) && !isDynamicValue(currentValue)) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<FilterRow\n\t\t\t\t\t\tkey={filterKey}\n\t\t\t\t\t\tfilterKey={filterKey}\n\t\t\t\t\t\tvalue={currentValue}\n\t\t\t\t\t\tonChange={this.onChange}\n\t\t\t\t\t\tonCreateVariable={this.onCreateVariable}\n\t\t\t\t\t\tonRemoveDynamicValue={this.onRemoveDynamicValue}\n\t\t\t\t\t\tonChangeDynamicValue={this.onChangeDynamicValue}\n\t\t\t\t\t\tallNodeIds={this.props.allNodeIds}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})\n\t\t\t.filter(Boolean)\n\t}\n}\n\nfunction unitForFilter(filter: keyof WithFilters) {\n\tswitch (filter) {\n\t\tcase \"hueRotate\":\n\t\t\treturn \"\u00B0\"\n\t\tcase \"blur\":\n\t\tcase \"backgroundBlur\":\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\treturn \"%\"\n\t}\n}\n\nfunction maxForFilter(filter: keyof WithFilters): number | undefined {\n\tswitch (filter) {\n\t\tcase \"contrast\":\n\t\t\treturn undefined\n\t\tcase \"brightness\":\n\t\tcase \"saturate\":\n\t\t\treturn 200\n\t\tcase \"hueRotate\":\n\t\t\treturn 360\n\t\tdefault:\n\t\t\treturn 100\n\t}\n}\n\nfunction sliderMaxForFilter(filter: keyof WithFilters): number {\n\tif (filter === \"contrast\") return 200\n\tconst max = maxForFilter(filter)\n\treturn isNumber(max) ? max : 100\n}\n", "import {\n\tNumberInputWithTicker,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tFloatingAlignment,\n\tFloatingPlacement,\n\tWithFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tDEFAULT_FLOATING_COLLISION_PADDING,\n\tDEFAULT_FLOATING_OFFSET_X,\n\tDEFAULT_FLOATING_OFFSET_Y,\n\tmaintainRelativeOffset,\n\twithFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedFloatingPosition } from \"document/models/CanvasTree/traits/utils/reduceFloatingPosition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { FloatingAlignmentRow } from \"../rows/FloatingAlignmentRow.tsx\"\nimport { FloatingPlacementRow } from \"../rows/FloatingPlacementRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\nfunction useFloatingCollisionUpdate(nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: \"auto\" | \"none\") => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFloatingPosition)) {\n\t\t\t\tnode.set({ floatingCollisionDetection: value === \"auto\" })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nfunction useFloatingPositionUpdate<T extends WithFloatingPosition, K extends keyof T>(key: K, nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]>) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFloatingPosition)) {\n\t\t\t\tnode.set({ [key]: value })\n\t\t\t}\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\ninterface Props extends Omit<ReducedFloatingPosition, \"onlyNodesWithFloatingPosition\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const FloatingPositionPanel = React.memo(function FloatingPositionPanel({\n\tnodeIds,\n\tfloatingPlacement,\n\tfloatingAlignment,\n\tfloatingOffsetX,\n\tfloatingOffsetY,\n\tfloatingSafeArea,\n\tfloatingCollisionDetection,\n\tfloatingCollisionPadding,\n}: Props) {\n\tconst handleSelectPlacement = useEngineCallback(\n\t\t(placement: FloatingPlacement) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFloatingPosition)) {\n\t\t\t\tconst update: Partial<WithFloatingPosition> = {\n\t\t\t\t\tfloatingPlacement: placement,\n\t\t\t\t}\n\n\t\t\t\tif (node.floatingPlacement !== placement) {\n\t\t\t\t\tconst { x, y } = maintainRelativeOffset(node.floatingPlacement, placement, {\n\t\t\t\t\t\tx: node.floatingOffsetX,\n\t\t\t\t\t\ty: node.floatingOffsetY,\n\t\t\t\t\t})\n\t\t\t\t\tObject.assign(update, { floatingOffsetX: x, floatingOffsetY: y })\n\t\t\t\t}\n\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleAlignmentChange = useEngineCallback(\n\t\t(value: FloatingAlignment) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFloatingPosition)) {\n\t\t\t\tconst update: Partial<WithFloatingPosition> = {\n\t\t\t\t\tfloatingAlignment: value,\n\t\t\t\t}\n\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleOffsetXChange = useFloatingPositionUpdate(\"floatingOffsetX\", nodeIds)\n\tconst handleOffsetYChange = useFloatingPositionUpdate(\"floatingOffsetY\", nodeIds)\n\tconst handleSafeAreaChange = useFloatingPositionUpdate(\"floatingSafeArea\", nodeIds)\n\tconst handleCollisionPaddingChange = useFloatingPositionUpdate(\"floatingCollisionPadding\", nodeIds)\n\tconst handleCollisionDetectionChange = useFloatingCollisionUpdate(nodeIds)\n\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title=\"Overlay\" />}>\n\t\t\t<FloatingPlacementRow floatingPlacement={floatingPlacement} onChange={handleSelectPlacement} />\n\t\t\t<FloatingAlignmentRow\n\t\t\t\tfloatingAlignment={floatingAlignment}\n\t\t\t\tfloatingPlacement={floatingPlacement}\n\t\t\t\tonChange={handleAlignmentChange}\n\t\t\t/>\n\n\t\t\t<PanelRow title=\"Offset\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={isFound(floatingOffsetX) ? floatingOffsetX : undefined}\n\t\t\t\t\tdefaultValue={DEFAULT_FLOATING_OFFSET_X}\n\t\t\t\t\tonChange={handleOffsetXChange}\n\t\t\t\t\tlabel=\"X\"\n\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t/>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={isFound(floatingOffsetY) ? floatingOffsetY : undefined}\n\t\t\t\t\tdefaultValue={DEFAULT_FLOATING_OFFSET_Y}\n\t\t\t\t\tonChange={handleOffsetYChange}\n\t\t\t\t\tlabel=\"Y\"\n\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Dismiss\">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle=\"Auto\"\n\t\t\t\t\t\tselected={floatingSafeArea === true}\n\t\t\t\t\t\tonSelect={handleSafeAreaChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"Click\"\n\t\t\t\t\t\tselected={floatingSafeArea === false}\n\t\t\t\t\t\tonSelect={handleSafeAreaChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Collision\">\n\t\t\t\t<PopupButton>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"auto\"\n\t\t\t\t\t\ttitle=\"Auto\"\n\t\t\t\t\t\tselected={floatingCollisionDetection === true}\n\t\t\t\t\t\tonSelect={handleCollisionDetectionChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"none\"\n\t\t\t\t\t\ttitle=\"None\"\n\t\t\t\t\t\tselected={floatingCollisionDetection === false}\n\t\t\t\t\t\tonSelect={handleCollisionDetectionChange}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={isFound(floatingCollisionPadding) ? floatingCollisionPadding : 0}\n\t\t\t\t\tdefaultValue={DEFAULT_FLOATING_COLLISION_PADDING}\n\t\t\t\t\tonChange={handleCollisionPaddingChange}\n\t\t\t\t\tlabel=\"PX\"\n\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\tenabled={floatingCollisionDetection !== false}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Panel>\n\t)\n})\n", "import { emptyArray, unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useEffect, useMemo } from \"react\"\nimport { createAntispam } from \"../../traits/forms/formConfig.ts\"\nimport type { FormConfig, FormConfigDestination } from \"../../traits/forms/formConfig.ts\"\nimport type { NodeID } from \"../NodeID.ts\"\n\n/**\n * `undefined` = loading state (hasn't loaded yet)\n * `[]` = config is loaded, but related prop is not configured\n */\ninterface FormConfigState {\n\tdestinations: readonly FormConfigDestination[] | undefined\n\tantispam: FormConfig[\"antispam\"] | undefined\n}\n\ntype FormConfigUpdate = Partial<Pick<FormConfig, \"destinations\" | \"antispam\">>\n\n/**\n * useFormConfig is responsible for orchestrating persistence of updates\n * to a form's configuration to the backend (FramerFormsService). Both valid and\n * invalid destinations are persisted to the backend. Invalid destinations will\n * include an 'error' property in the response from the backend, detailing the\n * validation error. The backend will also return a save ID representing the\n * whole of the form config, and the save ID be written to the tree. The\n * advantage of this approach is that undo-ing and redo-ing the form config will\n * either cause a refetch of the previous form config (keyed by save ID) from\n * the backend if necessary, or otherwise reuse the in memory configuration for\n * that save ID.\n *\n * @returns The in-memory form config (destinations and antispam), and a change\n * handler that receives updates and persists them to the server.\n */\nexport function useFormConfig(\n\toriginalNodeIds: NodeID[],\n\t/**\n\t * We use formSaveId to trigger refetching the config when a remote session\n\t * updates the form config.\n\t */\n\tformSaveId?: string | undefined,\n): [FormConfigState, (update: FormConfigUpdate) => void] {\n\tconst { formsStore } = engine.stores\n\t// Re-render when the form configs version changes.\n\tconst formConfigsVersion = formsStore.useState(state => state.formConfigsVersion)\n\tconst singleNodeId = originalNodeIds[0]\n\n\tuseEffect(() => {\n\t\t// No need to request if we don't have a form save ID.\n\t\tif (!singleNodeId || !formSaveId) return\n\n\t\t// Request the latest config for the saveId. This won't trigger a\n\t\t// network request if it's already in memory. If it isn't, we will fetch\n\t\t// it and trigger a render by incrementing formConfigsVersion.\n\t\tformsStore.requestLatestFormConfig(singleNodeId, formSaveId).catch(unhandledError)\n\t}, [singleNodeId, formSaveId, formConfigsVersion])\n\n\tconst saveConfig = useCallback(\n\t\t(update: FormConfigUpdate) => {\n\t\t\tif (!singleNodeId) return\n\n\t\t\tformsStore.updateFormConfig(engine.tree, singleNodeId, update).catch(unhandledError)\n\t\t},\n\t\t[singleNodeId],\n\t)\n\n\tconst config = useMemo((): FormConfigState => {\n\t\tif (!singleNodeId) return { destinations: undefined, antispam: undefined }\n\t\t// Ensure that the memo is recalculated when the form configs version\n\t\t// changes without disabling the lint rule.\n\t\tconst _ = formConfigsVersion\n\t\tconst localConfig = formsStore.getLocalFormConfig(singleNodeId, formSaveId)\n\t\t// If there is a formSaveId, but not target config prop then we show a loading state in the undefined state\n\t\treturn {\n\t\t\tdestinations: localConfig?.destinations ?? (formSaveId ? undefined : emptyArray<FormConfigDestination>()),\n\t\t\tantispam: localConfig?.antispam ?? (formSaveId ? undefined : createAntispam()),\n\t\t}\n\t}, [formSaveId, singleNodeId, formConfigsVersion])\n\n\treturn [config, saveConfig]\n}\n", "import { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { IconFormAntispam, IconFormEmail, IconFormGoogleSheet, IconFormWebhook, Stack } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { List, assertNever, unhandledError } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useFormConfig } from \"document/models/CanvasTree/nodes/forms/useFormConfig.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { SendTo } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport {\n\tsendToValues,\n\ttitleForSendToOption,\n\twithFormContainer,\n} from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport type {\n\tFormConfigAntispamConfig,\n\tAntispamProvider,\n\tFormConfigDestination,\n\tFormConfigSpamProtectionAntispamConfig,\n\tFormConfigRecaptchaV3AntispamConfig,\n} from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport {\n\tcreateAntispam,\n\tcreateAntispamConfig,\n\tcreateDestination,\n\tgetAvailableAntispamProviders,\n\tisCaptchaAntispam,\n\tisCompatibleGoogleSheetDestinationUpdate,\n\tisCompatibleRecaptchaV3Update,\n\tisCompatibleSpamProtectionUpdate,\n\tisCompatibleVerifiedEmailDestinationUpdate,\n\tisCompatibleWebhookDestinationUpdate,\n\tisFormConfigGoogleSheetDestination,\n\tisFormConfigVerifiedEmailDestination,\n\tisFormConfigWebhookDestination,\n\tnormalizeAntispamConfigsForSpamProtectionAdvanced,\n} from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { NotFound, isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedFormContainer } from \"document/models/CanvasTree/traits/utils/reduceFormContainer.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { PopoutButtonPreviewIconWrapperProps } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithLoadingState } from \"../../shared/PopoutButtonWithLoadingState.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { FormAntispamPopout } from \"./FormAntispamPopout.tsx\"\nimport { FormDestinationPopout } from \"./FormDestinationPopout.tsx\"\nimport { FormSuccessRedirectPopoutButton } from \"./FormSuccessRedirectPopoutButton.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeaderWithTraits } from \"./PanelSectionHeaderWithTraits.tsx\"\nimport { TrackingIdRow } from \"./TrackingIdRow.tsx\"\nimport { PanelElementId } from \"./utils/highlightPanel.ts\"\n\ninterface Props extends Pick<ReducedFormContainer, \"formOnSuccessRedirectUrl\" | \"formSubmitTrackingId\"> {\n\toriginalIds: NodeID[]\n\tformSaveId: string | undefined\n}\n\nconst formContainerTraits = [TraitType.Form]\n\nexport function FormContainerPanel({ originalIds, formSaveId, formOnSuccessRedirectUrl, formSubmitTrackingId }: Props) {\n\tconst formAntispamEnabled = useExperimentIsOn(\"formAntispam\")\n\tconst recaptchaEnabled = useExperimentIsOn(\"formRecaptchaV3\")\n\tconst projectLicenseType = engine.stores.projectStore.useState(state => state.projectLicenseType)\n\tconst isFreePlan = projectLicenseType === ProjectLicenseType.FreeSite\n\tconst canUseSpamProtectionAdvanced = engine.stores.projectStore.useState(\n\t\tstate => state.featureFlags?.canUseSpamProtectionAdvanced === \"on\",\n\t)\n\n\tconst [{ destinations, antispam }, saveConfig] = useFormConfig(originalIds, formSaveId)\n\n\tconst allFormDestinations = useMemo(\n\t\t() => new Set(destinations?.map(destination => destination.type) ?? []),\n\t\t[destinations],\n\t)\n\n\tconst availableAntispamProviders = useMemo(\n\t\t() => getAvailableAntispamProviders({ formAntispamEnabled, recaptchaEnabled }),\n\t\t[formAntispamEnabled, recaptchaEnabled],\n\t)\n\n\tconst configuredAntispamConfigs = useMemo(() => {\n\t\tif (isUndefined(antispam)) return undefined\n\t\treturn normalizeAntispamConfigsForSpamProtectionAdvanced(\n\t\t\tantispam.configs,\n\t\t\tavailableAntispamProviders,\n\t\t\tcanUseSpamProtectionAdvanced,\n\t\t)\n\t}, [antispam, availableAntispamProviders, canUseSpamProtectionAdvanced])\n\n\tconst handleRedirectClear = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(originalIds, withFormContainer)\n\n\t\tnodes.forEach(node => {\n\t\t\tnode.set({ formOnSuccessRedirectUrl: undefined })\n\t\t})\n\t}, [originalIds])\n\n\tconst handleRedirectChange = useEngineCallback(\n\t\t(link: Link) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(originalIds, withFormContainer)\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tnode.set({ formOnSuccessRedirectUrl: link })\n\t\t\t})\n\t\t},\n\t\t[originalIds],\n\t)\n\n\tconst initializeRedirect = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(originalIds, withFormContainer)\n\n\t\tnodes.forEach(node => {\n\t\t\tif (!isUndefined(node.formOnSuccessRedirectUrl)) return\n\t\t\tnode.set({ formOnSuccessRedirectUrl: createLink({ url: \"/\" }) })\n\t\t})\n\t}, [originalIds])\n\n\tconst addDestination = useEngineCallback(\n\t\t(sendTo: SendTo) => {\n\t\t\tconst destination = createDestination(sendTo)\n\t\t\tsaveConfig({ destinations: List.push(destinations ?? [], destination) })\n\n\t\t\tpopoutWindow.navigation.presentPopout(`formdestination-${sendTo}`)\n\t\t},\n\t\t[destinations, saveConfig],\n\t)\n\n\tconst onDeleteDestination = useEngineCallback(\n\t\t(index: number) => {\n\t\t\tif (!destinations) return\n\t\t\tsaveConfig({ destinations: List.remove(destinations, index) })\n\t\t},\n\t\t[destinations, saveConfig],\n\t)\n\tconst displayContextMenuForDestination = useCallback(\n\t\t(event: React.MouseEvent, index: number) => {\n\t\t\tconst items = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Remove\",\n\t\t\t\t\tclick: () => onDeleteDestination(index),\n\t\t\t\t\tenabled: true,\n\t\t\t\t},\n\t\t\t]\n\t\t\tengine.stores.contextMenuStore.show(items, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[onDeleteDestination],\n\t)\n\n\tconst showDestinationMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tconst items = sendToValues.map(key => ({\n\t\t\t\tlabel: titleForSendToOption(key),\n\t\t\t\tclick: () => addDestination(key),\n\t\t\t\tenabled: !allFormDestinations.has(key),\n\t\t\t}))\n\t\t\tengine.stores.contextMenuStore.show(items, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[addDestination, allFormDestinations],\n\t)\n\n\tconst canAddDestination = allFormDestinations.size < 3\n\n\tconst onUpdateDestination = useEngineCallback(\n\t\t(update: Partial<FormConfigDestination>, index: number) => {\n\t\t\tconst updatedDestinations = getUpdatedDestinations(destinations, update, index)\n\t\t\tif (!updatedDestinations) return\n\n\t\t\tsaveConfig({ destinations: updatedDestinations })\n\t\t},\n\t\t[destinations, saveConfig],\n\t)\n\n\tconst onChangeFormSubmitTrackingId = useEngineCallback(\n\t\t(value: string) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(originalIds, withFormContainer)\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tnode.set({ formSubmitTrackingId: value })\n\t\t\t})\n\t\t},\n\t\t[originalIds],\n\t)\n\n\tconst addAntispam = useEngineCallback(\n\t\t(provider: AntispamProvider) => {\n\t\t\tconst nextAntispamConfigs = normalizeAntispamConfigsForSpamProtectionAdvanced(\n\t\t\t\t[...(configuredAntispamConfigs ?? []), createAntispamConfig(provider)],\n\t\t\t\tavailableAntispamProviders,\n\t\t\t\tcanUseSpamProtectionAdvanced,\n\t\t\t)\n\t\t\tsaveConfig({ antispam: createAntispam(nextAntispamConfigs) })\n\t\t\tpopoutWindow.navigation.presentPopout(`formantispam-${provider}`)\n\t\t},\n\t\t[availableAntispamProviders, canUseSpamProtectionAdvanced, configuredAntispamConfigs, saveConfig],\n\t)\n\n\tconst handleAntispamChange = useEngineCallback(\n\t\t(provider: AntispamProvider, update: Partial<FormConfigAntispamConfig>) => {\n\t\t\tconst nextAntispamConfigs = getUpdatedAntispamConfigs(\n\t\t\t\tconfiguredAntispamConfigs,\n\t\t\t\tprovider,\n\t\t\t\tupdate,\n\t\t\t\tavailableAntispamProviders,\n\t\t\t\tcanUseSpamProtectionAdvanced,\n\t\t\t)\n\t\t\tif (!nextAntispamConfigs) return\n\t\t\tsaveConfig({ antispam: createAntispam(nextAntispamConfigs) })\n\t\t},\n\t\t[availableAntispamProviders, canUseSpamProtectionAdvanced, configuredAntispamConfigs, saveConfig],\n\t)\n\n\tconst spamProtectionConfig = useMemo(\n\t\t() => configuredAntispamConfigs?.find(isSpamProtectionAntispam),\n\t\t[configuredAntispamConfigs],\n\t)\n\n\tconst spamProtectionEnabled = spamProtectionConfig ? spamProtectionConfig.mode !== \"disabled\" : false\n\n\tconst visibleAntispamConfigs = useMemo(() => {\n\t\tif (isUndefined(configuredAntispamConfigs)) return undefined\n\t\treturn configuredAntispamConfigs.filter(config => !isSpamProtectionAntispam(config) || config.mode !== \"disabled\")\n\t}, [configuredAntispamConfigs])\n\n\tconst unconfiguredAntispamProviders = useMemo(() => {\n\t\tif (isUndefined(configuredAntispamConfigs)) return []\n\n\t\tconst configuredProviders = new Set(configuredAntispamConfigs.map(config => config.provider))\n\t\treturn availableAntispamProviders.filter(provider => {\n\t\t\tif (configuredProviders.has(provider)) return false\n\t\t\tif (provider === \"recaptcha_v3\" && !spamProtectionEnabled) return false\n\t\t\treturn true\n\t\t})\n\t}, [availableAntispamProviders, configuredAntispamConfigs, spamProtectionEnabled])\n\n\tconst enableSpamProtection = useEngineCallback(() => {\n\t\tif (!spamProtectionConfig || spamProtectionConfig.mode !== \"disabled\") return\n\n\t\thandleAntispamChange(\"spam_protection\", { mode: \"basic\" })\n\t\tpopoutWindow.navigation.presentPopout(\"formantispam-spam_protection\")\n\t}, [handleAntispamChange, spamProtectionConfig])\n\n\tconst handleAntispamSuggestionClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (!spamProtectionEnabled) {\n\t\t\t\tenableSpamProtection()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst items = unconfiguredAntispamProviders.map(provider => ({\n\t\t\t\tlabel: titleForAntispamProvider(provider),\n\t\t\t\tclick: () => addAntispam(provider),\n\t\t\t\tenabled: true,\n\t\t\t}))\n\t\t\tif (items.length === 0) return\n\t\t\tengine.stores.contextMenuStore.show(items, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[addAntispam, enableSpamProtection, spamProtectionEnabled, unconfiguredAntispamProviders],\n\t)\n\n\tconst handleSpamProtectionDelete = useEngineCallback(() => {\n\t\tif (!spamProtectionEnabled) return\n\t\thandleAntispamChange(\"spam_protection\", { mode: \"disabled\" })\n\t}, [handleAntispamChange, spamProtectionEnabled])\n\n\tconst handleAntispamDelete = useEngineCallback(\n\t\t(provider: AntispamProvider) => {\n\t\t\tif (!configuredAntispamConfigs) return\n\n\t\t\tsaveConfig({\n\t\t\t\tantispam: createAntispam(\n\t\t\t\t\tnormalizeAntispamConfigsForSpamProtectionAdvanced(\n\t\t\t\t\t\tconfiguredAntispamConfigs.filter(config => config.provider !== provider),\n\t\t\t\t\t\tavailableAntispamProviders,\n\t\t\t\t\t\tcanUseSpamProtectionAdvanced,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t})\n\t\t},\n\t\t[availableAntispamProviders, canUseSpamProtectionAdvanced, configuredAntispamConfigs, saveConfig],\n\t)\n\n\tconst getAntispamDeleteHandler = useCallback(\n\t\t(antispamConfig: FormConfigAntispamConfig) => {\n\t\t\tif (isSpamProtectionAntispam(antispamConfig)) return handleSpamProtectionDelete\n\t\t\tif (availableAntispamProviders.length <= 1) return undefined\n\n\t\t\treturn () => handleAntispamDelete(antispamConfig.provider)\n\t\t},\n\t\t[availableAntispamProviders.length, handleAntispamDelete, handleSpamProtectionDelete],\n\t)\n\n\treturn (\n\t\t<Panel\n\t\t\tid={PanelElementId.FormPanel}\n\t\t\theader={<PanelSectionHeaderWithTraits title=\"Form\" traits={formContainerTraits} />}\n\t\t>\n\t\t\t<PanelRow title=\"Send To\">\n\t\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t\t{isUndefined(destinations) ? (\n\t\t\t\t\t\t<PopoutButtonWithLoadingState />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{destinations.map((destination, index) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\t\tid={`formdestination-${destination.type}`}\n\t\t\t\t\t\t\t\t\t\tkey={destination.id}\n\t\t\t\t\t\t\t\t\t\tautoFocusInside={false}\n\t\t\t\t\t\t\t\t\t\ttitle={prettyTitleForDestination(destination, true)}\n\t\t\t\t\t\t\t\t\t\tonContextMenu={event => displayContextMenuForDestination(event, index)}\n\t\t\t\t\t\t\t\t\t\tnavigationTitle={prettyTitleForDestination(destination)}\n\t\t\t\t\t\t\t\t\t\tonDelete={() => onDeleteDestination(index)}\n\t\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper {...propsForIconWrapper(destination)}>\n\t\t\t\t\t\t\t\t\t\t\t\t{iconForDestination(destination)}\n\t\t\t\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t\t<FormDestinationPopout\n\t\t\t\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\t\t\t\tdestination={destination}\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={onUpdateDestination}\n\t\t\t\t\t\t\t\t\t\t\t\tonDelete={() => onDeleteDestination(index)}\n\t\t\t\t\t\t\t\t\t\t\t\tisFreePlan={isFreePlan}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t}\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\t{canAddDestination && (\n\t\t\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"formDestination\" onClick={showDestinationMenu} />\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</Stack>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Redirect\">\n\t\t\t\t<FormSuccessRedirectPopoutButton\n\t\t\t\t\tformOnSuccessRedirectUrl={formOnSuccessRedirectUrl}\n\t\t\t\t\tonRemove={isFoundAndNotUndefined(formOnSuccessRedirectUrl) ? handleRedirectClear : undefined}\n\t\t\t\t\tonInitialize={initializeRedirect}\n\t\t\t\t\tonChange={handleRedirectChange}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t{formAntispamEnabled && (\n\t\t\t\t<PanelRow title=\"Antispam\">\n\t\t\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t\t\t{isUndefined(visibleAntispamConfigs) ? (\n\t\t\t\t\t\t\t<PopoutButtonWithLoadingState />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{visibleAntispamConfigs.map(antispamConfig => (\n\t\t\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\t\t\tid={`formantispam-${antispamConfig.provider}`}\n\t\t\t\t\t\t\t\t\t\tkey={antispamConfig.provider}\n\t\t\t\t\t\t\t\t\t\tautoFocusInside\n\t\t\t\t\t\t\t\t\t\ttitle={titleForAntispamConfig(antispamConfig, true)}\n\t\t\t\t\t\t\t\t\t\tnavigationTitle={titleForAntispamConfig(antispamConfig)}\n\t\t\t\t\t\t\t\t\t\tonDelete={getAntispamDeleteHandler(antispamConfig)}\n\t\t\t\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.tint}>\n\t\t\t\t\t\t\t\t\t\t\t\t<IconFormAntispam />\n\t\t\t\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t\t\t<FormAntispamPopout\n\t\t\t\t\t\t\t\t\t\t\t\tantispam={antispamConfig}\n\t\t\t\t\t\t\t\t\t\t\t\tonChange={update => handleAntispamChange(antispamConfig.provider, update)}\n\t\t\t\t\t\t\t\t\t\t\t\tcanUseSpamProtectionAdvanced={canUseSpamProtectionAdvanced}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t}\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\t{(!spamProtectionEnabled || unconfiguredAntispamProviders.length > 0) && (\n\t\t\t\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"formAntispam\" onClick={handleAntispamSuggestionClick} />\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</Stack>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t<TrackingIdRow\n\t\t\t\tsupportsVariables\n\t\t\t\tonChange={onChangeFormSubmitTrackingId}\n\t\t\t\ttrackingId={formSubmitTrackingId}\n\t\t\t\taiPrompt={NotFound} // TODO: Add AI prompt\n\t\t\t\tcanRemove={false}\n\t\t\t/>\n\t\t</Panel>\n\t)\n}\n\nfunction iconForDestination(destination: FormConfigDestination) {\n\tconst { type } = destination\n\tswitch (type) {\n\t\tcase \"verifiedEmail\":\n\t\t\treturn <IconFormEmail />\n\t\tcase \"webhook\":\n\t\t\treturn <IconFormWebhook />\n\t\tcase \"googlesheet\":\n\t\t\treturn <IconFormGoogleSheet />\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction propsForIconWrapper(destination: FormConfigDestination): PopoutButtonPreviewIconWrapperProps {\n\tconst { type } = destination\n\n\tswitch (type) {\n\t\tcase \"verifiedEmail\":\n\t\tcase \"webhook\":\n\t\t\treturn { background: colors.tint }\n\t\tcase \"googlesheet\":\n\t\t\treturn { color: colors.tint }\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction prettyTitleForDestination(destination: FormConfigDestination, short?: boolean): string {\n\tconst { type } = destination\n\tswitch (type) {\n\t\tcase \"verifiedEmail\":\n\t\t\treturn \"Email\"\n\t\tcase \"webhook\":\n\t\t\treturn \"Webhook\"\n\t\tcase \"googlesheet\":\n\t\t\treturn short ? \"Sheet\" : \"Google Sheets\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction titleForAntispamConfig(antispamConfig: FormConfigAntispamConfig, short?: boolean): string {\n\tif (isSpamProtectionAntispam(antispamConfig) && short) {\n\t\treturn antispamConfig.mode === \"advanced\" ? \"Advanced\" : \"Basic\"\n\t}\n\n\treturn titleForAntispamProvider(antispamConfig.provider, short)\n}\n\nfunction titleForAntispamProvider(provider: AntispamProvider, short?: boolean): string {\n\tswitch (provider) {\n\t\tcase \"spam_protection\":\n\t\t\treturn short ? \"Basic\" : \"Antispam\"\n\t\tcase \"recaptcha_v3\":\n\t\t\treturn \"reCAPTCHA v3\"\n\t\tdefault:\n\t\t\tassertNever(provider)\n\t}\n}\n\nfunction isSpamProtectionAntispam(\n\tantispamConfig: FormConfigAntispamConfig,\n): antispamConfig is Extract<FormConfigAntispamConfig, { provider: \"spam_protection\" }> {\n\treturn antispamConfig.provider === \"spam_protection\"\n}\n\nfunction getUpdatedDestinations(\n\tdestinations: readonly FormConfigDestination[] | undefined,\n\tupdate: Partial<FormConfigDestination>,\n\tindex: number,\n): readonly FormConfigDestination[] | undefined {\n\tif (!destinations) return\n\n\tconst destination = destinations.at(index)\n\tif (!destination) return\n\n\tif (isFormConfigVerifiedEmailDestination(destination) && isCompatibleVerifiedEmailDestinationUpdate(update)) {\n\t\treturn List.replace(destinations, index, { ...destination, ...update })\n\t}\n\n\tif (isFormConfigWebhookDestination(destination) && isCompatibleWebhookDestinationUpdate(update)) {\n\t\treturn List.replace(destinations, index, { ...destination, ...update })\n\t}\n\n\tif (isFormConfigGoogleSheetDestination(destination) && isCompatibleGoogleSheetDestinationUpdate(update)) {\n\t\treturn List.replace(destinations, index, { ...destination, ...update })\n\t}\n\n\tunhandledError(\n\t\t`incompatible form destination update: destination ${destination.type}, update ${JSON.stringify(update)}`,\n\t)\n}\n\nfunction getUpdatedAntispamConfigs(\n\tantispamConfigs: readonly FormConfigAntispamConfig[] | undefined,\n\tprovider: AntispamProvider,\n\tupdate: Partial<FormConfigAntispamConfig>,\n\tavailableProviders: readonly AntispamProvider[],\n\tcanUseSpamProtectionAdvanced: boolean,\n): readonly FormConfigAntispamConfig[] | undefined {\n\tif (!antispamConfigs) return\n\n\tconst index = antispamConfigs.findIndex(antispam => antispam.provider === provider)\n\tif (index === -1) return\n\n\tconst antispam = antispamConfigs[index]\n\tif (!antispam) return\n\n\tif (provider === \"recaptcha_v3\" && !isCaptchaAntispam(antispam)) {\n\t\tunhandledError(`incompatible antispam update: provider ${provider}, antispam ${JSON.stringify(antispam)}`)\n\t\treturn\n\t}\n\n\tswitch (antispam.provider) {\n\t\tcase \"spam_protection\": {\n\t\t\tif (!isCompatibleSpamProtectionUpdate(update)) break\n\t\t\tconst updatedAntispam: FormConfigSpamProtectionAntispamConfig = { ...antispam, ...update }\n\t\t\treturn normalizeAntispamConfigsForSpamProtectionAdvanced(\n\t\t\t\tList.replace(antispamConfigs, index, updatedAntispam),\n\t\t\t\tavailableProviders,\n\t\t\t\tcanUseSpamProtectionAdvanced,\n\t\t\t)\n\t\t}\n\t\tcase \"recaptcha_v3\": {\n\t\t\tif (!isCompatibleRecaptchaV3Update(update)) break\n\t\t\tconst updatedAntispam: FormConfigRecaptchaV3AntispamConfig = { ...antispam, ...update }\n\t\t\treturn normalizeAntispamConfigsForSpamProtectionAdvanced(\n\t\t\t\tList.replace(antispamConfigs, index, updatedAntispam),\n\t\t\t\tavailableProviders,\n\t\t\t\tcanUseSpamProtectionAdvanced,\n\t\t\t)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(antispam)\n\t}\n\n\tunhandledError(`incompatible antispam update: antispam ${antispam.provider}, update ${JSON.stringify(update)}`)\n}\n", "import \"PopoutButtonWithLoadingState.styles_1k227gy.wyw.css\"; export const button = \"button_bxj7wqy\";\nexport const spinner = \"spinner_s1c4te1n\";\nexport const spinnerWrapper = \"spinnerWrapper_s1vzdirb\";\nexport const spin = \"spin_soesomc\";", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { ButtonWithPreview } from \"./ButtonWithPreview.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"./PopoutButtonPreviewIconWrapper.tsx\"\nimport * as styles from \"./PopoutButtonWithLoadingState.styles.ts\"\n\nexport const PopoutButtonWithLoadingState = () => {\n\treturn (\n\t\t<ButtonWithPreview\n\t\t\ttitle={Dictionary.LoadingEllipsis}\n\t\t\tclassName={styles.button}\n\t\t\tsuggestion\n\t\t\tpreview={\n\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.formRedirectLinkIcon}>\n\t\t\t\t\t<div className={cx(styles.spinnerWrapper, styles.spin)}>\n\t\t\t\t\t\t<div className={styles.spinner}></div>\n\t\t\t\t\t</div>\n\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t}\n\t\t/>\n\t)\n}\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tIconInputClose,\n\tInputWrapper,\n\tNumberInputWithTicker,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tSlider,\n\tStack,\n\tTextInput,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type {\n\tAntispamFiltering,\n\tFormConfigAntispamConfig,\n\tFormConfigRecaptchaV3AntispamConfig,\n\tSpamProtectionMode,\n} from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport { isCaptchaAntispam, SecretStatus } from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport { debounce } from \"library/render/utils/debounce.ts\"\nimport { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { InlineDocumentation } from \"../../shared/InlineDocumentation.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./FormDestinationPopout.styles.ts\"\n\ninterface Props {\n\tantispam: FormConfigAntispamConfig\n\tonChange: (antispam: Partial<FormConfigAntispamConfig>) => void\n\tcanUseSpamProtectionAdvanced: boolean\n}\n\nexport function FormAntispamPopout({ antispam, onChange, canUseSpamProtectionAdvanced }: Props) {\n\tif (isCaptchaAntispam(antispam)) {\n\t\treturn <RecaptchaAntispamPopout antispam={antispam} onChange={onChange} />\n\t}\n\n\treturn (\n\t\t<SpamProtectionAntispamPopout\n\t\t\tantispam={antispam}\n\t\t\tonChange={onChange}\n\t\t\tcanUseSpamProtectionAdvanced={canUseSpamProtectionAdvanced}\n\t\t/>\n\t)\n}\n\ninterface SpamProtectionAntispamPopoutProps {\n\tantispam: Extract<FormConfigAntispamConfig, { provider: \"spam_protection\" }>\n\tonChange: (antispam: Partial<FormConfigAntispamConfig>) => void\n\tcanUseSpamProtectionAdvanced: boolean\n}\n\nfunction SpamProtectionAntispamPopout({\n\tantispam,\n\tonChange,\n\tcanUseSpamProtectionAdvanced,\n}: SpamProtectionAntispamPopoutProps) {\n\tconst typeDescription =\n\t\tantispam.mode === \"advanced\"\n\t\t\t? \"Advanced checks your submissions with AI.\"\n\t\t\t: \"Basic applies simple rules without AI.\"\n\n\tconst handleModeChange = (mode: SpamProtectionMode) => {\n\t\tif (mode === \"disabled\" || mode === antispam.mode) return\n\t\tif (mode === \"advanced\" && !canUseSpamProtectionAdvanced) return\n\t\tonChange({ mode })\n\t}\n\n\tconst handleFilteringChange = (filtering: AntispamFiltering) => {\n\t\tif (filtering === antispam.filtering) return\n\t\tonChange({ filtering })\n\t}\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.popoverPadding}>\n\t\t\t{canUseSpamProtectionAdvanced && (\n\t\t\t\t<PanelRow title={Dictionary.Type}>\n\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t<PopupButtonItem<SpamProtectionMode>\n\t\t\t\t\t\t\t\tidentifier=\"basic\"\n\t\t\t\t\t\t\t\ttitle=\"Basic\"\n\t\t\t\t\t\t\t\tselected={antispam.mode !== \"advanced\"}\n\t\t\t\t\t\t\t\tonSelect={handleModeChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PopupButtonItem<SpamProtectionMode>\n\t\t\t\t\t\t\t\tidentifier=\"advanced\"\n\t\t\t\t\t\t\t\ttitle=\"Advanced\"\n\t\t\t\t\t\t\t\tselected={antispam.mode === \"advanced\"}\n\t\t\t\t\t\t\t\tonSelect={handleModeChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PopupButton>\n\n\t\t\t\t\t\t<InlineDocumentation className={styles.fallbackHint}>{typeDescription}</InlineDocumentation>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t<PanelRow title=\"Filtering\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<SegmentedControl aria-label=\"Spam filtering behavior\">\n\t\t\t\t\t\t<SegmentedControlItem<AntispamFiltering>\n\t\t\t\t\t\t\ttitle=\"Block\"\n\t\t\t\t\t\t\tidentifier=\"block\"\n\t\t\t\t\t\t\tselected={antispam.filtering === \"block\"}\n\t\t\t\t\t\t\tonSelect={handleFilteringChange}\n\t\t\t\t\t\t\taria-label=\"Block spam submissions\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem<AntispamFiltering>\n\t\t\t\t\t\t\ttitle=\"Pass\"\n\t\t\t\t\t\t\tidentifier=\"pass\"\n\t\t\t\t\t\t\tselected={antispam.filtering === \"pass\"}\n\t\t\t\t\t\t\tonSelect={handleFilteringChange}\n\t\t\t\t\t\t\taria-label=\"Pass submissions, labelled as spam\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\n\t\t\t\t\t<InlineDocumentation className={styles.fallbackHint}>\n\t\t\t\t\t\tPass forwards labelled spam submissions to your destination.\n\t\t\t\t\t</InlineDocumentation>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\ninterface RecaptchaAntispamPopoutProps {\n\tantispam: FormConfigRecaptchaV3AntispamConfig\n\tonChange: (antispam: Partial<FormConfigAntispamConfig>) => void\n}\n\nfunction RecaptchaAntispamPopout({ antispam, onChange }: RecaptchaAntispamPopoutProps) {\n\tconst [secretStatus, setSecretStatus] = useState<SecretStatus>(() =>\n\t\tantispam.secretKey ? SecretStatus.Encrypted : SecretStatus.Empty,\n\t)\n\tconst [threshold, setThreshold] = useState(antispam.threshold)\n\tconst [previousThreshold, setPreviousThreshold] = useState(antispam.threshold)\n\n\tconst debouncedThresholdChange = useMemo(\n\t\t() =>\n\t\t\tdebounce((nextThreshold: number) => {\n\t\t\t\tonChange({ threshold: nextThreshold })\n\t\t\t}, 300),\n\t\t[onChange],\n\t)\n\n\tconst handleSiteKeyChange = useCallback(\n\t\t(siteKey: string) => {\n\t\t\tif (siteKey === antispam.siteKey) return\n\t\t\tonChange({ siteKey })\n\t\t},\n\t\t[onChange, antispam.siteKey],\n\t)\n\n\tconst handleSecretChange = useCallback(\n\t\t(secret: string) => {\n\t\t\tif (secret !== \"\") {\n\t\t\t\tsetSecretStatus(SecretStatus.Encrypting)\n\t\t\t\tonChange({ secretKey: secret })\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst handleRemoveSecret = useCallback(() => {\n\t\tsetSecretStatus(SecretStatus.Empty)\n\t\tonChange({ secretKey: \"\" })\n\t}, [onChange])\n\tconst removeSecretClickHandlers = useClickHandlers(handleRemoveSecret)\n\n\tconst handleThresholdChange = useCallback(\n\t\t(nextThreshold: number) => {\n\t\t\tsetThreshold(nextThreshold)\n\n\t\t\tif (nextThreshold === antispam.threshold) {\n\t\t\t\tdebouncedThresholdChange.cancel()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tdebouncedThresholdChange(nextThreshold)\n\t\t},\n\t\t[antispam.threshold, debouncedThresholdChange],\n\t)\n\n\tconst handleFilteringChange = useCallback(\n\t\t(filtering: AntispamFiltering) => {\n\t\t\tif (filtering === antispam.filtering) return\n\t\t\tonChange({ filtering })\n\t\t},\n\t\t[onChange, antispam.filtering],\n\t)\n\n\tuseEffect(() => {\n\t\tif (secretStatus !== SecretStatus.Encrypting) return\n\t\tif (!antispam.secretKey) return\n\n\t\t// We've received an encrypted secret from the server\n\t\t// Add a tiny delay to prolong the \"Encrypting\u2026\" state\n\t\t// so it doesn't flash\n\t\tconst timeout = setTimeout(setSecretStatus, 500, SecretStatus.Encrypted)\n\n\t\treturn () => clearTimeout(timeout)\n\t}, [antispam.secretKey, secretStatus])\n\n\tuseEffect(() => {\n\t\treturn () => debouncedThresholdChange.cancel()\n\t}, [debouncedThresholdChange])\n\n\tif (antispam.threshold !== previousThreshold) {\n\t\tsetPreviousThreshold(antispam.threshold)\n\t\tsetThreshold(antispam.threshold)\n\t}\n\n\treturn (\n\t\t<Stack gap={0} padding={dimensions.css.popoverPadding}>\n\t\t\t<PanelRow title=\"Site Key\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tvalue={antispam.siteKey}\n\t\t\t\t\t\t\tonChange={handleSiteKeyChange}\n\t\t\t\t\t\t\tplaceholder=\"Site key\"\n\t\t\t\t\t\t\tautoComplete=\"one-time-code\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Secret Key\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tsecretStatus === SecretStatus.Empty\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: secretStatus === SecretStatus.Encrypting\n\t\t\t\t\t\t\t\t\t\t? \"Encrypting\u2026\"\n\t\t\t\t\t\t\t\t\t\t: antispam.secretKey\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder=\"Secret key\"\n\t\t\t\t\t\t\ttype={secretStatus === SecretStatus.Encrypting ? \"text\" : \"password\"}\n\t\t\t\t\t\t\tonChange={handleSecretChange}\n\t\t\t\t\t\t\tenabled={secretStatus === SecretStatus.Empty}\n\t\t\t\t\t\t\tdisabledIsReadOnly={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{secretStatus === SecretStatus.Encrypted && (\n\t\t\t\t\t\t\t<div className={styles.closeWrapper} {...removeSecretClickHandlers} title=\"Remove\">\n\t\t\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Threshold\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={threshold}\n\t\t\t\t\tonChange={handleThresholdChange}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={1}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t\tdefaultValue={0.5}\n\t\t\t\t\taria-label=\"Score threshold\"\n\t\t\t\t/>\n\t\t\t\t<Slider\n\t\t\t\t\tvalue={threshold}\n\t\t\t\t\tonChange={handleThresholdChange}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={1}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t\taria-label=\"Score threshold\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Filtering\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<SegmentedControl aria-label=\"Spam filtering behavior\">\n\t\t\t\t\t\t<SegmentedControlItem<AntispamFiltering>\n\t\t\t\t\t\t\ttitle=\"Block\"\n\t\t\t\t\t\t\tidentifier=\"block\"\n\t\t\t\t\t\t\tselected={antispam.filtering === \"block\"}\n\t\t\t\t\t\t\tonSelect={handleFilteringChange}\n\t\t\t\t\t\t\taria-label=\"Block spam submissions\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem<AntispamFiltering>\n\t\t\t\t\t\t\ttitle=\"Pass\"\n\t\t\t\t\t\t\tidentifier=\"pass\"\n\t\t\t\t\t\t\tselected={antispam.filtering === \"pass\"}\n\t\t\t\t\t\t\tonSelect={handleFilteringChange}\n\t\t\t\t\t\t\taria-label=\"Pass submissions, labelled as spam\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\n\t\t\t\t\t<InlineDocumentation className={styles.fallbackHint}>\n\t\t\t\t\t\tPass forwards labelled spam submissions to your destination.\n\t\t\t\t\t</InlineDocumentation>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n", "import \"FormDestinationPopout.styles_1gmaezn.wyw.css\"; export const fallbackHint = \"fallbackHint_fdjw1oe\";\nexport const emailRecipientColumn = \"emailRecipientColumn_e1m44oii\";\nexport const closeWrapper = \"closeWrapper_c64hp9a\";\nexport const warningWrapper = \"warningWrapper_w1t2lqhj\";\nexport const clearButton = \"clearButton_c1phmysw\";\nexport const invalidEmailHint = \"invalidEmailHint_i18a25or\";", "import type { WindowWithCurrentUser } from \"@framerjs/app-shared\"\nimport { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, IconInputClose, IconWarning, InputWrapper, Stack, TextArea, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tFormConfigDestination,\n\tFormConfigGoogleSheetDestination,\n\tFormConfigVerifiedEmailDestination,\n\tFormConfigWebhookDestination,\n} from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport {\n\tSecretStatus,\n\tdefaultBody,\n\tdefaultSubject,\n\tencryptedSecret,\n\tisFormConfigGoogleSheetDestination,\n\tisFormConfigVerifiedEmailDestination,\n\tisFormConfigWebhookDestination,\n} from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport { isValidEmail } from \"web/lib/isValidEmail.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { InlineDocumentation } from \"../../shared/InlineDocumentation.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./FormDestinationPopout.styles.ts\"\nimport { GoogleSheetPreviewButton } from \"./FormGoogleSheetButton.tsx\"\n\ninterface Props {\n\tindex: number\n\tdestination: FormConfigDestination\n\tonChange: (destination: Partial<FormConfigDestination>, index: number) => void\n\tonDelete: () => void\n\tisFreePlan: boolean\n}\n\nconst currentUser = (window as WindowWithCurrentUser)?.framerUser\nconst maxRecipientEmails = 3\n\nexport function FormDestinationPopout({ index, destination, onChange, onDelete, isFreePlan }: Props) {\n\tconst changeDestination = useCallback(\n\t\t(update: Partial<FormConfigDestination>) => {\n\t\t\tonChange(update, index)\n\t\t},\n\t\t[index, onChange],\n\t)\n\n\treturn (\n\t\t<Stack gap={0} padding={`${dimensions.css.inputSpacing} ${dimensions.css.popoverPadding}`}>\n\t\t\t{isFormConfigVerifiedEmailDestination(destination) && (\n\t\t\t\t<EmailDestinationPopout\n\t\t\t\t\tdestination={destination}\n\t\t\t\t\tonChange={changeDestination}\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\tisFreePlan={isFreePlan}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{isFormConfigWebhookDestination(destination) && (\n\t\t\t\t<WebhookDestinationPopout destination={destination} onChange={changeDestination} />\n\t\t\t)}\n\t\t\t{isFormConfigGoogleSheetDestination(destination) && (\n\t\t\t\t<GoogleSheetDestinationPopout destination={destination} onChange={changeDestination} />\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\ninterface DestinationProps {\n\tdestination: FormConfigDestination\n\tonChange: (destination: Partial<FormConfigDestination>) => void\n\tonDelete?: () => void\n}\n\ninterface EmailDestinationProps extends DestinationProps {\n\tdestination: FormConfigVerifiedEmailDestination\n\tonDelete: () => void\n\tisFreePlan: boolean\n}\n\nfunction EmailDestinationPopout({ destination, onChange, onDelete, isFreePlan }: EmailDestinationProps) {\n\tconst emails = getRecipientEmails(destination, isFreePlan)\n\tconst [invalidEmailIndex, setInvalidEmailIndex] = useState<number | null>(null)\n\tconst [hasAddEmailError, setHasAddEmailError] = useState(false)\n\tconst subjectValue = valueWithFallback(destination.subject, defaultSubject)\n\tconst bodyValue = valueWithFallback(destination.body, defaultBody)\n\tconst emailNameValue = valueWithFallback(destination.name, Dictionary.Framer)\n\n\tconst removeRecipient = useCallback(\n\t\t(index: number) => {\n\t\t\tconst nextEmails = emails.filter((_, currentIndex) => currentIndex !== index)\n\t\t\tonChange({ emails: nextEmails })\n\t\t\tsetInvalidEmailIndex(current => {\n\t\t\t\tif (current === null) return null\n\t\t\t\tif (current === index) return null\n\t\t\t\tif (current > index) return current - 1\n\t\t\t\treturn current\n\t\t\t})\n\t\t},\n\t\t[emails, onChange],\n\t)\n\n\tconst handleEmailChange = useCallback(\n\t\t(index: number, newValue: string) => {\n\t\t\tconst trimmed = newValue.trim()\n\t\t\tconst updated = [...emails]\n\n\t\t\tif (!trimmed) {\n\t\t\t\tif (updated.length > 1) {\n\t\t\t\t\tremoveRecipient(index)\n\t\t\t\t} else {\n\t\t\t\t\tsetInvalidEmailIndex(current => (current === index ? null : current))\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!isValidEmail(trimmed)) {\n\t\t\t\tsetInvalidEmailIndex(index)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetInvalidEmailIndex(current => (current === index ? null : current))\n\n\t\t\tconst existing = updated[index]\n\t\t\tif (!existing || existing.email === trimmed) return\n\t\t\tupdated[index] = { email: trimmed }\n\t\t\tonChange({ emails: updated })\n\t\t},\n\t\t[emails, onChange, removeRecipient],\n\t)\n\n\tconst handleRecipientClear = useCallback(\n\t\t(index: number) => {\n\t\t\tif (emails.length > 1) {\n\t\t\t\tremoveRecipient(index)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tonDelete()\n\t\t},\n\t\t[emails, onDelete, removeRecipient],\n\t)\n\n\tconst handleAddEmail = useCallback(\n\t\t(newValue: string) => {\n\t\t\tconst trimmed = newValue.trim()\n\t\t\tif (!trimmed) {\n\t\t\t\tsetHasAddEmailError(false)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!isValidEmail(trimmed)) {\n\t\t\t\tsetHasAddEmailError(true)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (emails.length >= maxRecipientEmails) return\n\n\t\t\tsetHasAddEmailError(false)\n\t\t\tonChange({ emails: [...emails, { email: trimmed }] })\n\t\t},\n\t\t[onChange, emails],\n\t)\n\n\tconst handleEmailSubjectChange = useCallback(\n\t\t(newEmailSubject: string) => {\n\t\t\tif (newEmailSubject === subjectValue) return\n\t\t\tonChange({ subject: newEmailSubject })\n\t\t},\n\t\t[onChange, subjectValue],\n\t)\n\n\tconst handleEmailBodyChange = useCallback(\n\t\t(newEmailBody: string) => {\n\t\t\tif (newEmailBody === bodyValue) return\n\t\t\tonChange({ body: newEmailBody })\n\t\t},\n\t\t[onChange, bodyValue],\n\t)\n\n\tconst handleEmailNameChange = useCallback(\n\t\t(newEmailName: string) => {\n\t\t\tif (newEmailName === emailNameValue) return\n\t\t\tonChange({ name: newEmailName })\n\t\t},\n\t\t[onChange, emailNameValue],\n\t)\n\n\tconst handleVerificationClick = useCallback((event: React.MouseEvent, email: string) => {\n\t\tconst items = [\n\t\t\t{\n\t\t\t\tlabel: \"Not Verified\",\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Send Verification Email\",\n\t\t\t\tenabled: true,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst projectId = engine.stores.projectStore.project?.id\n\t\t\t\t\tapiFetcher\n\t\t\t\t\t\t.postRaw(`/forms/emails/verify`, JSON.stringify({ email, projectId }))\n\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\ttoast({ type: \"add\", variant: \"success\", text: \"Verification email sent\", icon: \"success\" })\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\t\t\ttoast({ type: \"add\", variant: \"error\", text: \"Failed to send verification email\", icon: \"error\" })\n\t\t\t\t\t\t\tunhandledError(error)\n\t\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\t\tengine.stores.contextMenuStore.show(items, {\n\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t})\n\t}, [])\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Recipient\">\n\t\t\t\t<div className={styles.emailRecipientColumn}>\n\t\t\t\t\t{emails.map((entry, index) => (\n\t\t\t\t\t\t<InputWrapper key={entry.email} hasError={invalidEmailIndex === index}>\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tvalue={entry.email}\n\t\t\t\t\t\t\t\tonChange={(value: string) => handleEmailChange(index, value)}\n\t\t\t\t\t\t\t\tplaceholder=\"jane@framer.com\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t\t\t\tclassName={styles.clearButton}\n\t\t\t\t\t\t\t\tonMouseDown={event => {\n\t\t\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\t\t\thandleRecipientClear(index)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\taria-label={`Remove recipient ${entry.email}`}\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t{entry.verified === false && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName={styles.warningWrapper}\n\t\t\t\t\t\t\t\t\tcolor=\"warning\"\n\t\t\t\t\t\t\t\t\tonMouseDown={e => handleVerificationClick(e, entry.email)}\n\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<IconWarning />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t))}\n\t\t\t\t\t{!isFreePlan && emails.length < maxRecipientEmails && (\n\t\t\t\t\t\t<InputWrapper hasError={hasAddEmailError}>\n\t\t\t\t\t\t\t<TextInput key={emails.length} value=\"\" onChange={handleAddEmail} placeholder=\"Add...\" />\n\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t)}\n\t\t\t\t\t{(invalidEmailIndex !== null || hasAddEmailError) && (\n\t\t\t\t\t\t<InlineDocumentation className={styles.invalidEmailHint}>Enter a valid email address.</InlineDocumentation>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Name\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput value={emailNameValue} onChange={handleEmailNameChange} placeholder={Dictionary.Framer} />\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Subject\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput value={subjectValue} onChange={handleEmailSubjectChange} placeholder={defaultSubject} />\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title=\"Body\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tvalue={bodyValue}\n\t\t\t\t\t\tonChange={handleEmailBodyChange}\n\t\t\t\t\t\tplaceholder={defaultBody}\n\t\t\t\t\t\tminRows={4}\n\t\t\t\t\t\tnewlinesOnEnter\n\t\t\t\t\t\tconstantChange={false}\n\t\t\t\t\t\tselectOnFocus={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction WebhookDestinationPopout({\n\tdestination,\n\tonChange,\n}: DestinationProps & { destination: FormConfigWebhookDestination }) {\n\tconst webhookUrlValue = !isUndefined(destination.webhookUrl) ? destination.webhookUrl : \"\"\n\tconst fallbackEmailValue = valueWithFallback(destination.fallbackEmail, currentUser.email)\n\tconst [webhookSecret, setWebhookSecret] = useState<SecretStatus>(() =>\n\t\tdestination.secret === encryptedSecret ? SecretStatus.Encrypted : SecretStatus.Empty,\n\t)\n\n\tconst handleWebhookURLChange = useCallback(\n\t\t(newWebhookURL: string) => {\n\t\t\tif (newWebhookURL === webhookUrlValue) return\n\t\t\tonChange({ webhookUrl: newWebhookURL })\n\t\t},\n\t\t[onChange, webhookUrlValue],\n\t)\n\tconst handleWebhookSecretChange = useCallback(\n\t\t(newWebhookSecret: string) => {\n\t\t\tif (newWebhookSecret !== \"\") {\n\t\t\t\tsetWebhookSecret(SecretStatus.Encrypting)\n\t\t\t\tonChange({ secret: newWebhookSecret })\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t)\n\tconst handleFallbackEmailChange = useCallback(\n\t\t(newFallbackEmail: string) => {\n\t\t\t{\n\t\t\t\tif (newFallbackEmail === fallbackEmailValue) return\n\t\t\t\tonChange({\n\t\t\t\t\tfallbackEmail: newFallbackEmail,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[onChange, fallbackEmailValue],\n\t)\n\tconst handleRemoveWebhookSecret = useCallback(() => {\n\t\tsetWebhookSecret(SecretStatus.Empty)\n\t\tonChange({ secret: \"\" })\n\t}, [onChange])\n\tconst removeWebhookSecretClickHandlers = useClickHandlers(handleRemoveWebhookSecret)\n\n\tuseEffect(() => {\n\t\tif (webhookSecret !== SecretStatus.Encrypting) return\n\t\tif (destination.secret !== encryptedSecret) return\n\n\t\t// We've received an encrypted secret from the server\n\t\t// Add a tiny delay to prolong the \"Encrypting\u2026\" state\n\t\t// so it doesn't flash\n\t\tconst timeout = setTimeout(setWebhookSecret, 500, SecretStatus.Encrypted)\n\n\t\treturn () => clearTimeout(timeout)\n\t}, [destination.secret, webhookSecret])\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"API\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput value={webhookUrlValue} placeholder=\"URL\" onChange={handleWebhookURLChange} />\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Secret\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\twebhookSecret === SecretStatus.Empty\n\t\t\t\t\t\t\t\t\t? \"\"\n\t\t\t\t\t\t\t\t\t: webhookSecret === SecretStatus.Encrypting\n\t\t\t\t\t\t\t\t\t\t? \"Encrypting\u2026\"\n\t\t\t\t\t\t\t\t\t\t: encryptedSecret\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplaceholder=\"Optional\"\n\t\t\t\t\t\t\ttype={webhookSecret === SecretStatus.Encrypting ? \"text\" : \"password\"}\n\t\t\t\t\t\t\tonChange={handleWebhookSecretChange}\n\t\t\t\t\t\t\tenabled={webhookSecret === SecretStatus.Empty}\n\t\t\t\t\t\t\tdisabledIsReadOnly={false}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{webhookSecret === SecretStatus.Encrypted && (\n\t\t\t\t\t\t\t<div className={styles.closeWrapper} {...removeWebhookSecretClickHandlers} title=\"Remove\">\n\t\t\t\t\t\t\t\t<IconInputClose />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Fallback}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput value={fallbackEmailValue} placeholder=\"jane@framer.com\" onChange={handleFallbackEmailChange} />\n\t\t\t\t\t</InputWrapper>\n\n\t\t\t\t\t<InlineDocumentation className={styles.fallbackHint}>\n\t\t\t\t\t\tIf the Webhook stops working, we\u2019ll let you know via this address.\n\t\t\t\t\t</InlineDocumentation>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction GoogleSheetDestinationPopout({\n\tdestination,\n\tonChange,\n}: DestinationProps & { destination: FormConfigGoogleSheetDestination }) {\n\tconst fallbackEmailValue = valueWithFallback(destination.fallbackEmail, currentUser.email)\n\n\tconst handleGoogleSheetChange = useCallback(\n\t\t(newGoogleSheet: Partial<FormConfigGoogleSheetDestination>) => onChange(newGoogleSheet),\n\t\t[onChange],\n\t)\n\tconst handleFallbackEmailChange = useCallback(\n\t\t(newFallbackEmail: string) => {\n\t\t\tif (newFallbackEmail === fallbackEmailValue) return\n\t\t\tonChange({\n\t\t\t\tfallbackEmail: newFallbackEmail,\n\t\t\t})\n\t\t},\n\t\t[onChange, fallbackEmailValue],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow title=\"Sheet\">\n\t\t\t\t<GoogleSheetPreviewButton documentId={destination.documentId} onChange={handleGoogleSheetChange} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Fallback}>\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput value={fallbackEmailValue} placeholder=\"jane@framer.com\" onChange={handleFallbackEmailChange} />\n\t\t\t\t\t</InputWrapper>\n\n\t\t\t\t\t<InlineDocumentation className={styles.fallbackHint}>\n\t\t\t\t\t\tIf Google Sheets stops working, we\u2019ll let you know via this address.\n\t\t\t\t\t</InlineDocumentation>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t</>\n\t)\n}\n\nfunction getRecipientEmails(\n\tdestination: FormConfigVerifiedEmailDestination,\n\tisFreePlan: boolean,\n): NonNullable<FormConfigVerifiedEmailDestination[\"emails\"]> {\n\tconst emails = destination.emails?.length ? destination.emails : [{ email: currentUser.email }]\n\t// Free plans are capped to 1 recipient, but can use any verified address.\n\treturn isFreePlan ? emails.slice(0, 1) : emails\n}\n\nfunction valueWithFallback(value: string | undefined, fallback: string): string {\n\tif (isString(value)) return value\n\treturn fallback\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { isBoolean, isObject } from \"utils/typeChecks.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\ninterface FormPostMessageEvent extends MessageEvent {\n\tdata: {\n\t\tsuccess: boolean\n\t\temail?: string\n\t}\n}\n\ninterface FormAuthenticationResponse {\n\texists: boolean\n\temail?: string\n\tauthLink?: string\n}\n\nasync function checkGoogleAuth(projectId: string): Promise<FormAuthenticationResponse> {\n\t// First we need to make a request to the forms service\n\t// which returns a URL to authenticate with Google if\n\t// the user is not already authenticated. If the user is\n\t// already authenticated, the response will contain { exists: true }\n\tconst response = await apiFetcher.get(`/forms/tokens/google-sheets`, { projectId })\n\treturn response as FormAuthenticationResponse\n}\n\nasync function deleteGoogleAuth(projectId: string) {\n\t// Removes the link between the google token and the framer user account, meaning that\n\t// the user can reauthenticate with gogole again if they wish. It does not remove\n\t// the token, which we keep around for safe keeping in the case of a rollback.\n\t// The checkGoogleAuth request will now return { exists: false } for the user\n\treturn apiFetcher.delete(`/forms/tokens/google-sheets?projectId=${projectId}`)\n}\n\nfunction isFormPostMessageEvent(event: MessageEvent): event is FormPostMessageEvent {\n\treturn isObject(event.data) && isBoolean(event.data.success)\n}\n\nexport function useGoogleAuth() {\n\tconst [loading, setLoading] = useState(true)\n\tconst [googleAccountEmail, setEmail] = useState<string | undefined>(undefined)\n\tconst [authLink, setAuthLink] = useState<string | undefined>(undefined)\n\tconst projectId = engine.remoteDocument?.projectId\n\n\tconst authenticate = useCallback(async () => {\n\t\tif (!projectId) return\n\n\t\tcheckGoogleAuth(projectId)\n\t\t\t.then(({ exists, authLink, email }) => {\n\t\t\t\tsetLoading(false)\n\t\t\t\tsetAuthLink(authLink)\n\n\t\t\t\tif (exists) {\n\t\t\t\t\tsetEmail(email)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t}, [projectId])\n\n\tuseEffect(() => {\n\t\tvoid authenticate()\n\t}, [authenticate])\n\n\t/**\n\t * Initiates the Google authentication flow The backend, namely FramerFormsService, actually handles the auth flow\n\t * entirely (including the token exchange). So therefore all the client needs to do is make a request to the backend\n\t * /tokens/google-sheets endpoint, which will return a URL to authenticate with Google, and then launch a popup\n\t * window with that URL for the user to authenticate. The popup window rendered by the backend will send a\n\t * .postMessage call back to the parent window with the account details if the user has successfully\n\t */\n\tconst connect = useCallback(async () => {\n\t\tif (!authLink) {\n\t\t\tawait authenticate()\n\t\t}\n\n\t\tconst parentWindowHeight = window.screen.height\n\t\tconst parentWindowWidth = window.screen.width\n\t\tconst popupWidth = 500\n\t\tconst popupHeight = 500\n\t\tconst windowFeatures = `left=${parentWindowWidth / 2 - popupWidth / 2},top=${\n\t\t\tparentWindowHeight / 2 - popupHeight / 2\n\t\t},width=${popupWidth},height=${popupHeight},popup=true`\n\n\t\tconst abort = new AbortController()\n\n\t\t// Listen to a .postMessage event from the oauth popup\n\t\t// which is sent when the user has successfully authenticated\n\t\t// with Google, or if they have closed the popup without\n\t\t// authenticating.\n\t\twindow.addEventListener(\n\t\t\t\"message\",\n\t\t\tengine.scheduler.wrapHandler(event => {\n\t\t\t\tif (!isFormPostMessageEvent(event)) return\n\n\t\t\t\tconst { success, email } = event.data\n\n\t\t\t\tif (success) {\n\t\t\t\t\tsetEmail(email)\n\t\t\t\t}\n\n\t\t\t\tabort.abort()\n\t\t\t}),\n\t\t\t{ signal: abort.signal },\n\t\t)\n\n\t\twindow.open(authLink, \"_blank\", windowFeatures)\n\t}, [authLink, authenticate])\n\n\tconst disconnect = useCallback(async () => {\n\t\tif (!projectId) return\n\n\t\tsetLoading(true)\n\t\tawait deleteGoogleAuth(projectId)\n\t\tsetLoading(false)\n\n\t\tsetEmail(undefined)\n\t}, [projectId])\n\n\treturn { googleAccountEmail, connect, disconnect, loading }\n}\n", "import { IconFormGoogleAccount, IconFormGoogleSheet, useReadOnly } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useGoogleAuth } from \"document/components/utils/useGoogleAuth.ts\"\nimport engine from \"document/engine.ts\"\nimport type { FormConfigGoogleSheetDestination } from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport { useCallback } from \"react\"\nimport { ButtonWithPreview } from \"../../shared/ButtonWithPreview.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithLoadingState } from \"../../shared/PopoutButtonWithLoadingState.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { FormCreateGoogleSheetPopout } from \"./FormCreateGoogleSheetPopout.tsx\"\n\ninterface Props extends Pick<FormConfigGoogleSheetDestination, \"documentId\"> {\n\tonChange: (update: Partial<FormConfigGoogleSheetDestination>) => void\n}\n\nconst newGoogleSheetPopoutId = \"new-google-sheet-popout\"\n\nexport function GoogleSheetPreviewButton({ documentId: googleSheetId, onChange }: Props) {\n\tconst isReadOnly = useReadOnly()\n\n\tconst { googleAccountEmail, connect: handleGoogleSheetConnection, disconnect, loading } = useGoogleAuth()\n\tconst openGoogleSheet = useCallback(() => {\n\t\tassert(googleSheetId, \"Google sheet ID is required to proceed\")\n\n\t\tconst url = `https://docs.google.com/spreadsheets/d/${googleSheetId}`\n\n\t\twindow.open(url, \"_blank\")\n\t}, [googleSheetId])\n\n\tconst handleSheetNameCreate = useCallback(\n\t\t(sheetName: string) => {\n\t\t\tonChange({ documentName: sheetName })\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst handleGoogleAuthDeletion = useCallback(async () => {\n\t\ttry {\n\t\t\tawait disconnect()\n\n\t\t\tonChange({\n\t\t\t\tdocumentName: undefined,\n\t\t\t\tdocumentId: undefined,\n\t\t\t})\n\t\t} catch (err) {\n\t\t\tunhandledError(err)\n\t\t}\n\t}, [disconnect, onChange])\n\n\tconst showDisconnectMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Disconnect,\n\t\t\t\t\t\tclick: handleGoogleAuthDeletion,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[handleGoogleAuthDeletion],\n\t)\n\n\tif (loading) {\n\t\treturn (\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopoutButtonWithLoadingState />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst isSheetConnected = !!googleSheetId\n\tif (isSheetConnected) {\n\t\treturn (\n\t\t\t<ButtonWithPreview\n\t\t\t\tdoubleColumn\n\t\t\t\tonPresent={openGoogleSheet}\n\t\t\t\tonDelete={handleGoogleAuthDeletion}\n\t\t\t\t// We cannot use the document name because it can get out of sync if users renamed it on google sheets\n\t\t\t\ttitle={Dictionary.Connected}\n\t\t\t\ttitleColor={colors.activeGoogleButtonText}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper color={colors.activeGoogleSheetIcon}>\n\t\t\t\t\t\t<IconFormGoogleSheet />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t}\n\n\tconst canAddSheet = !!googleAccountEmail\n\tif (canAddSheet) {\n\t\treturn (\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tenabled={!isReadOnly}\n\t\t\t\tid={newGoogleSheetPopoutId}\n\t\t\t\tnavigationTitle=\"New Sheet\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle={Dictionary.AddEllipsis}\n\t\t\t\ttitleColor={colors.popoutButtonTextPlaceholder}\n\t\t\t\tonContextMenu={showDisconnectMenu}\n\t\t\t\tpopout={<FormCreateGoogleSheetPopout onSubmit={handleSheetNameCreate} />}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper color={colors.swatchBackgroundPlaceholderForBorder}>\n\t\t\t\t\t\t<IconFormGoogleSheet />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ButtonWithPreview\n\t\t\tdoubleColumn\n\t\t\tenabled={!isReadOnly}\n\t\t\tonPresent={handleGoogleSheetConnection}\n\t\t\ttitle={Dictionary.ConnectEllipsis}\n\t\t\ttitleColor={colors.popoutButtonTextPlaceholder}\n\t\t\tpreview={\n\t\t\t\t<PopoutButtonPreviewIconWrapper color={colors.swatchBackgroundPlaceholderForBorder}>\n\t\t\t\t\t<IconFormGoogleAccount />\n\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t}\n\t\t/>\n\t)\n}\n", "import { Button, InputWrapper, Spinner, Stack, Text, TextInput } from \"@framerjs/fresco\"\nimport { dimensions, fonts } from \"@framerjs/fresco/tokens\"\nimport type React from \"react\"\nimport { useCallback, useState } from \"react\"\nimport * as styles from \"./FormCreateGoogleSheetPopout.styles.ts\"\n\ninterface Props {\n\tonSubmit: (sheetName: string) => void\n}\n\nexport function FormCreateGoogleSheetPopout({ onSubmit }: Props) {\n\tconst [name, setName] = useState(\"\")\n\tconst [submitting, setSubmitting] = useState(false)\n\n\tconst submitHandler = useCallback(() => {\n\t\tsetSubmitting(true)\n\t\tonSubmit(name)\n\t}, [name, onSubmit])\n\n\tconst keyDownHandler = useCallback(\n\t\t(event: React.KeyboardEvent) => {\n\t\t\tif (event.key === \"Enter\") submitHandler()\n\t\t},\n\t\t[submitHandler],\n\t)\n\n\treturn (\n\t\t<Stack gap={20} padding={dimensions.css.popoverPadding}>\n\t\t\t<InputWrapper large>\n\t\t\t\t<TextInput value={name} placeholder=\"My Form\" onChange={setName} onKeyDown={keyDownHandler} constantChange />\n\t\t\t</InputWrapper>\n\t\t\t<Text size={fonts.size.base} className={styles.secondaryText}>\n\t\t\t\tAll form submissions will be added\n\t\t\t\t<br />\n\t\t\t\tto this Google Sheet automatically.\n\t\t\t</Text>\n\t\t\t<Stack direction=\"row\">\n\t\t\t\t<Button\n\t\t\t\t\tonClick={submitHandler}\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tenabled={!submitting && name.length > 0}\n\t\t\t\t\tclassName={styles.grow}\n\t\t\t\t>\n\t\t\t\t\t{submitting ? <Spinner /> : \"Create\"}\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import \"FormCreateGoogleSheetPopout.styles_rc6tf6.wyw.css\"; export const secondaryText = \"secondaryText_sza3qzo\";\nexport const grow = \"grow_g1j0n38w\";", "import { IconPopupButtonLink, IconVariableLink, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { convertLinkToReadablePath } from \"document/components/utils/convertLinkToReadablePath.ts\"\nimport engine from \"document/engine.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { WithFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport type { Link } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isLinkToURL, isLinkedWebPageMissing } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedFormContainer } from \"document/models/CanvasTree/traits/utils/reduceFormContainer.ts\"\nimport { usePreloadLinkWebPage } from \"document/models/CanvasTree/traits/utils/usePreloadLinkWebPage.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PageLinkingRows } from \"./PageLinkingRows.tsx\"\n\ninterface Props extends Pick<ReducedFormContainer, \"formOnSuccessRedirectUrl\"> {\n\tonRemove?: () => void\n\tonInitialize: () => void\n\tonChange: (link: Link) => void\n}\n\nexport function FormSuccessRedirectPopoutButton({ formOnSuccessRedirectUrl, onRemove, onInitialize, onChange }: Props) {\n\tconst hasRedirect = isFoundAndNotUndefined(formOnSuccessRedirectUrl)\n\tconst linkTitle = useLinkTitle(formOnSuccessRedirectUrl)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<PopoutButtonWithPreview\n\t\t\ttitle={linkTitle}\n\t\t\tnavigationTitle=\"Success\"\n\t\t\tonPresent={!hasRedirect ? onInitialize : undefined}\n\t\t\ttitleColor={hasRedirect ? colors.buttonText : colors.popoutButtonTextPlaceholder}\n\t\t\tpopout={\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\tpaddingRight={dimensions.css.popoverPadding}\n\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\tpaddingLeft={dimensions.css.popoverPadding}\n\t\t\t\t>\n\t\t\t\t\t<PageLinkingRows\n\t\t\t\t\t\tlink={formOnSuccessRedirectUrl}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tsupportsPageLinks\n\t\t\t\t\t\tsupportsVariables\n\t\t\t\t\t\tsupportsSlugVariables\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t\tdisplayDivider\n\t\t\tonDelete={onRemove}\n\t\t\tpreviewWithoutWrapper={agentExperimentEnabled}\n\t\t\tpreview={<FormSuccessRedirectPreview agentExperimentEnabled={agentExperimentEnabled} hasRedirect={hasRedirect} />}\n\t\t/>\n\t)\n}\n\nfunction FormSuccessRedirectPreview({\n\tagentExperimentEnabled,\n\thasRedirect,\n}: {\n\tagentExperimentEnabled: boolean\n\thasRedirect: boolean\n}) {\n\tif (agentExperimentEnabled) {\n\t\tconst iconBackground = hasRedirect ? colors.tint : colors.formRedirectLinkIcon\n\n\t\treturn (\n\t\t\t<span style={{ display: \"flex\", marginLeft: 3, color: iconBackground }}>\n\t\t\t\t<IconVariableLink />\n\t\t\t</span>\n\t\t)\n\t}\n\n\treturn (\n\t\t<PopoutButtonPreviewIconWrapper background={hasRedirect ? colors.tint : colors.formRedirectLinkIcon}>\n\t\t\t<IconPopupButtonLink />\n\t\t</PopoutButtonPreviewIconWrapper>\n\t)\n}\n\nfunction useLinkTitle(redirectUrl: Reduced<WithFormContainer[\"formOnSuccessRedirectUrl\"]>) {\n\tusePreloadLinkWebPage(redirectUrl)\n\n\tconst tree = useEngineState(() => engine.tree, [], EngineChange.Tree)\n\n\tif (isMixed(redirectUrl)) return Dictionary.Mixed\n\tif (isUndefined(redirectUrl)) return Dictionary.AddEllipsis\n\tif (isDynamicValue(redirectUrl)) return Dictionary.Link\n\n\tconst readablePagePath = convertLinkToReadablePath(tree, redirectUrl, undefined, Dictionary.Home)\n\tif (readablePagePath) return readablePagePath\n\n\tconst webPageIdToRawPathMap = getRouteSegmentRootNode(tree).getWebPageIdToRawPathMap(tree)\n\tconst selectedPageMissing = isLinkedWebPageMissing(redirectUrl, webPageIdToRawPathMap)\n\n\tif (selectedPageMissing) return Dictionary.Missing\n\n\treturn isLinkToURL(redirectUrl) ? redirectUrl.url : \"\"\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isOptionalVariable, withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisFound,\n\tisFoundAndNotMixed,\n\tisFoundAndNotMixedAndNotUndefined,\n\tisFoundAndNotUndefined,\n} from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedFormBooleanInputType } from \"document/models/CanvasTree/traits/utils/reduceFormBooleanInputType.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport type { ReducedFormInputAutofillEnabled } from \"document/models/CanvasTree/traits/utils/reduceFormInputAutofillEnabled.ts\"\nimport type { ReducedFormInputPlaceholder } from \"document/models/CanvasTree/traits/utils/reduceFormInputPlaceholder.ts\"\nimport type { ReducedFormInputStep } from \"document/models/CanvasTree/traits/utils/reduceFormInputStep.ts\"\nimport type { ReducedFormInputFontStyles } from \"document/models/CanvasTree/traits/utils/reduceFormInputStyles.ts\"\nimport type { ReducedFormSelect } from \"document/models/CanvasTree/traits/utils/reduceFormSelect.ts\"\nimport type { ReducedFormTextInputType } from \"document/models/CanvasTree/traits/utils/reduceFormTextInputType.ts\"\nimport type { ReducedVariableBinding } from \"document/models/CanvasTree/traits/utils/reduceVariableBinding.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useMemo } from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { AllItemsLabelRow } from \"../rows/FormInputRows/AllItemsLabelRow.tsx\"\nimport { BooleanLabelRow } from \"../rows/FormInputRows/BooleanLabelRow.tsx\"\nimport { FormBooleanInputValueRow } from \"../rows/FormInputRows/FormInputBooleanRow.tsx\"\nimport { FormInputNumberRow } from \"../rows/FormInputRows/FormInputNumberRow.tsx\"\nimport { InputAutoFocusRow } from \"../rows/FormInputRows/InputAutoFocusRow.tsx\"\nimport { InputAutofillEnabledRow } from \"../rows/FormInputRows/InputAutofillEnabledRow.tsx\"\nimport { InputHiddenRow } from \"../rows/FormInputRows/InputHiddenRow.tsx\"\nimport { InputNameRow } from \"../rows/FormInputRows/InputNameRow.tsx\"\nimport { InputPlaceholderRow } from \"../rows/FormInputRows/InputPlaceholderRow.tsx\"\nimport { InputRequiredRow } from \"../rows/FormInputRows/InputRequiredRow.tsx\"\nimport { InputValueRow } from \"../rows/FormInputRows/InputValueRow.tsx\"\nimport { SelectOptionsRow } from \"../rows/FormInputRows/SelectOptionsRow.tsx\"\nimport { TextAreaResizableRow } from \"../rows/FormInputRows/TextAreaResizableRow.tsx\"\nimport { TextInputTypeRow } from \"../rows/FormInputRows/TextInputTypeRow.tsx\"\nimport { FormInputVariableBindingRow } from \"../rows/FormInputRows/VariableBindingRow.tsx\"\nimport { FormInputsHeader } from \"./FormInputsHeader.tsx\"\nimport { Panel } from \"./Panel.tsx\"\n\nexport interface FormInputPanelProps\n\textends\n\t\tOmit<ReducedFormInput, \"onlyFormInputNodes\" | \"anyFormInputNodes\">,\n\t\tReducedFormTextInputType,\n\t\tPick<ReducedFormInputPlaceholder, \"formInputPlaceholder\" | \"onlyFormInputNodesWithPlaceholder\">,\n\t\tOmit<ReducedFormInputFontStyles, \"onlyNodesWithFormInputFontStyles\">,\n\t\tPick<ReducedFormBooleanInputType, \"formBooleanInputValue\" | \"onlyNodesWithBooleanInputType\">,\n\t\tReducedFormInputAutofillEnabled,\n\t\tReducedFormInputStep,\n\t\tReducedFormSelect,\n\t\tReducedVariableBinding {\n\tnodeIds: NodeID[]\n}\n\ninterface Props extends FormInputPanelProps {\n\toriginalIds: NodeID[]\n}\n\nexport function FormInputPanel(props: Props) {\n\tconst { originalIds, nodeIds, bindingType, variableBinding } = props\n\n\tconst { boundVariable, variableProvider, boundVariableIsOptional } = useBoundVariable(\n\t\toriginalIds,\n\t\tisFoundAndNotMixedAndNotUndefined(variableBinding) ? variableBinding : undefined,\n\t)\n\n\tif (!isFoundAndNotMixed(bindingType)) return null\n\n\tconst boundToVariable = bindingType === \"variable\"\n\tconst boundVariableIsBoolean = boundVariable?.type === ControlType.Boolean\n\n\tconst autofillEnabledAvailable = props.onlyNodesWithAutofillEnabled && !boundToVariable\n\tconst autoFocusAvailable = isFound(props.formInputAutoFocus) && !boundToVariable\n\tconst booleanInputValueAvailable = props.onlyNodesWithBooleanInputType && !boundToVariable\n\tconst hiddenAvailable = isFound(props.formInputHidden) && !boundToVariable\n\tconst maxLengthAvailable = isFound(props.formInputMaxLength) && !boundToVariable\n\tconst maxNumberAvailable =\n\t\tprops.onlyNodesWithTextInputType && isFound(props.formTextInputMaxNumber) && !boundToVariable\n\tconst minNumberAvailable =\n\t\tprops.onlyNodesWithTextInputType && isFound(props.formTextInputMinNumber) && !boundToVariable\n\tconst stepAvailable = props.onlyNodesWithFormInputStep && isFound(props.formInputStep) && !boundToVariable\n\tconst valueAvailable = !props.anyNodeWithSelect && isFound(props.formInputValue) && !boundToVariable\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<FormInputsHeader\n\t\t\t\t\t{...props}\n\t\t\t\t\tautofillEnabledAvailable={autofillEnabledAvailable}\n\t\t\t\t\tautoFocusAvailable={autoFocusAvailable}\n\t\t\t\t\tbooleanInputValueAvailable={booleanInputValueAvailable}\n\t\t\t\t\thiddenAvailable={hiddenAvailable}\n\t\t\t\t\tmaxLengthAvailable={maxLengthAvailable}\n\t\t\t\t\tmaxNumberAvailable={maxNumberAvailable}\n\t\t\t\t\tminNumberAvailable={minNumberAvailable}\n\t\t\t\t\tstepAvailable={stepAvailable}\n\t\t\t\t\tvalueAvailable={valueAvailable}\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{boundToVariable && (\n\t\t\t\t<>\n\t\t\t\t\t<FormInputVariableBindingRow\n\t\t\t\t\t\toriginalNodeIds={originalIds}\n\t\t\t\t\t\tselectedVariable={boundVariable}\n\t\t\t\t\t\tvariableProvider={variableProvider}\n\t\t\t\t\t/>\n\t\t\t\t\t{boundVariableIsOptional && isFoundAndNotMixed(props.allItemsLabel) && (\n\t\t\t\t\t\t<AllItemsLabelRow allItemsLabel={props.allItemsLabel} nodeIds={nodeIds} />\n\t\t\t\t\t)}\n\t\t\t\t\t{boundVariableIsBoolean && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{isFoundAndNotMixed(props.booleanTrueLabel) && (\n\t\t\t\t\t\t\t\t<BooleanLabelRow type=\"true\" value={props.booleanTrueLabel} nodeIds={nodeIds} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isFoundAndNotMixed(props.booleanFalseLabel) && (\n\t\t\t\t\t\t\t\t<BooleanLabelRow type=\"false\" value={props.booleanFalseLabel} nodeIds={nodeIds} />\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\t{props.onlyNodesWithTextInputType && !boundToVariable && (\n\t\t\t\t<TextInputTypeRow formTextInputType={props.formTextInputType} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{!boundToVariable && <InputNameRow formInputName={props.formInputName} nodeIds={nodeIds} />}\n\t\t\t{valueAvailable && (isFoundAndNotUndefined(props.formInputValue) || props.anyRadioButton) && (\n\t\t\t\t<InputValueRow formInputValue={props.formInputValue} anyRadioButton={props.anyRadioButton} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{booleanInputValueAvailable && (\n\t\t\t\t<FormBooleanInputValueRow formBooleanInputValue={props.formBooleanInputValue} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{props.onlyFormInputNodesWithPlaceholder && (\n\t\t\t\t<InputPlaceholderRow formInputPlaceholder={props.formInputPlaceholder} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{!boundToVariable && props.onlyNodesWithRequired && (\n\t\t\t\t<InputRequiredRow formInputRequired={props.formInputRequired} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{props.onlyFormTextAreaNodes && (\n\t\t\t\t<TextAreaResizableRow formTextAreaResizable={props.formTextAreaResizable} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{!boundToVariable && isFoundAndNotMixed(props.formSelectOptions) && props.onlyNodesWithSelect && (\n\t\t\t\t<SelectOptionsRow\n\t\t\t\t\tselectedId={props.formInputValue}\n\t\t\t\t\toriginalIds={originalIds}\n\t\t\t\t\tformSelectOptions={props.formSelectOptions}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{hiddenAvailable && isFoundAndNotUndefined(props.formInputHidden) && (\n\t\t\t\t<InputHiddenRow formInputHidden={props.formInputHidden} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{maxLengthAvailable && isFoundAndNotUndefined(props.formInputMaxLength) && (\n\t\t\t\t<FormInputNumberRow property=\"formInputMaxLength\" value={props.formInputMaxLength} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{minNumberAvailable && isFoundAndNotUndefined(props.formTextInputMinNumber) && (\n\t\t\t\t<FormInputNumberRow property=\"formTextInputMinNumber\" value={props.formTextInputMinNumber} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{maxNumberAvailable && isFoundAndNotUndefined(props.formTextInputMaxNumber) && (\n\t\t\t\t<FormInputNumberRow property=\"formTextInputMaxNumber\" value={props.formTextInputMaxNumber} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{stepAvailable && isFoundAndNotUndefined(props.formInputStep) && (\n\t\t\t\t<FormInputNumberRow property=\"formInputStep\" value={props.formInputStep} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{autoFocusAvailable && isFoundAndNotUndefined(props.formInputAutoFocus) && (\n\t\t\t\t<InputAutoFocusRow formInputAutoFocus={props.formInputAutoFocus} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{autofillEnabledAvailable && isFoundAndNotUndefined(props.formInputAutofillEnabled) && (\n\t\t\t\t<InputAutofillEnabledRow formInputAutofillEnabled={props.formInputAutofillEnabled} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t</Panel>\n\t)\n}\n\nfunction useBoundVariable(originalIds: NodeID[], variableReference: VariableReference | undefined) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst scopeType = useEngineState(() => engine.stores.scopeStore.scopeType, [], [engine.stores.scopeStore])\n\n\tconst variableProvider = useMemo(() => {\n\t\tconst scopeNodes = originalIds.map(id => {\n\t\t\tconst node = engine.tree.getNode(id)\n\t\t\treturn node ? engine.tree.getScopeNodeFor(node) : null\n\t\t})\n\n\t\tconst scopeNode = commonValue(scopeNodes)\n\t\tif (!isFoundAndNotMixed(scopeNode)) return undefined\n\n\t\treturn withVariables(scopeNode) ? scopeNode : undefined\n\t}, [originalIds])\n\n\tconst boundVariable = useMemo(\n\t\t() => (variableReference ? variableProvider?.getVariable(variableReference.id) : undefined),\n\t\t[variableProvider, variableReference],\n\t)\n\n\tconst boundVariableIsOptional = boundVariable ? isOptionalVariable(boundVariable, scopeType) : false\n\n\treturn { boundVariable, variableProvider, boundVariableIsOptional }\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFormSelectNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tformSelectGenericOptionDefaults,\n\tformSelectGenericOptionLabels,\n} from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { doubleColumnClass } from \"../../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\ninterface Props {\n\tallItemsLabel: string\n\tnodeIds: NodeID[]\n}\n\nexport function AllItemsLabelRow({ allItemsLabel, nodeIds }: Props) {\n\tconst engine = useBaseEngine()\n\tconst handleChange = useEngineCallback(\n\t\t(value: string) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, isFormSelectNode)) {\n\t\t\t\tnode.set({ allItemsLabel: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\treturn (\n\t\t<PanelRow title={formSelectGenericOptionLabels.allItemsLabel}>\n\t\t\t<TextInput\n\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\tvalue={allItemsLabel}\n\t\t\t\tplaceholder={formSelectGenericOptionDefaults.allItemsLabel}\n\t\t\t\tonChange={handleChange}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFormSelectNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tformSelectGenericOptionDefaults,\n\tformSelectGenericOptionLabels,\n} from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { doubleColumnClass } from \"../../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\ninterface TrueLabelProps {\n\ttype: \"true\"\n\tvalue: string\n\tnodeIds: NodeID[]\n}\n\ninterface FalseLabelProps {\n\ttype: \"false\"\n\tvalue: string\n\tnodeIds: NodeID[]\n}\n\ntype Props = TrueLabelProps | FalseLabelProps\n\nexport function BooleanLabelRow({ type, value, nodeIds }: Props) {\n\tconst engine = useBaseEngine()\n\tconst handleChange = useEngineCallback(\n\t\t(newValue: string) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, isFormSelectNode)) {\n\t\t\t\tif (type === \"true\") {\n\t\t\t\t\tnode.set({ booleanTrueLabel: newValue })\n\t\t\t\t} else {\n\t\t\t\t\tnode.set({ booleanFalseLabel: newValue })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds, type],\n\t)\n\n\tconst label =\n\t\ttype === \"true\" ? formSelectGenericOptionLabels.booleanTrueLabel : formSelectGenericOptionLabels.booleanFalseLabel\n\tconst placeholder =\n\t\ttype === \"true\"\n\t\t\t? formSelectGenericOptionDefaults.booleanTrueLabel\n\t\t\t: formSelectGenericOptionDefaults.booleanFalseLabel\n\n\treturn (\n\t\t<PanelRow title={label}>\n\t\t\t<TextInput className={doubleColumnClass} value={value} placeholder={placeholder} onChange={handleChange} />\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { ReducedFormBooleanInputType } from \"document/models/CanvasTree/traits/utils/reduceFormBooleanInputType.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { isBoolean } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { useFormInputPropertyHandler, useRemoveFormInputDynamicValueHandler } from \"./utils.ts\"\n\nconst traits = [TraitType.FormBooleanInputValue]\n\ninterface Props extends Pick<ReducedFormBooleanInputType, \"formBooleanInputValue\"> {\n\tnodeIds: NodeID[]\n}\n\nconst popoutId = \"form-input-boolean-value-value-transform\"\nexport function FormBooleanInputValueRow({ formBooleanInputValue, nodeIds }: Props) {\n\tconst handleChange = useFormInputPropertyHandler(\"formBooleanInputValue\", nodeIds)\n\tconst handleBooleanChange = useEngineCallback((booleanValue: boolean) => handleChange(booleanValue), [handleChange])\n\tconst removeDynamicValue = useRemoveFormInputDynamicValueHandler(\"formBooleanInputValue\", nodeIds, isBoolean)\n\tconst onSelectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\thandleChange(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[handleChange],\n\t)\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tname: Dictionary.Checked,\n\t\t\t\tinitialValue: isBoolean(formBooleanInputValue) ? formBooleanInputValue : false,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\thandleChange(variableRef)\n\t\t},\n\t\t[handleChange, formBooleanInputValue],\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Checked}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tdynamicValue={isDynamicValue(formBooleanInputValue) ? formBooleanInputValue : null}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonSelectVariable={handleChange}\n\t\t\tsupportsComputedValues\n\t\t\tsupportsVariables\n\t\t\ttraitTypes={traits}\n\t\t\tvariableReferenceType={ControlType.Boolean}\n\t\t\tvariableType={ControlType.Boolean}\n\t\t>\n\t\t\t{isDynamicValue(formBooleanInputValue) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={Dictionary.Checked}\n\t\t\t\t\tvalue={formBooleanInputValue}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={handleChange}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={formBooleanInputValue === true}\n\t\t\t\t\t\tonSelect={handleBooleanChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={formBooleanInputValue === false}\n\t\t\t\t\t\tonSelect={handleBooleanChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithFormBooleanInputType } from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport { withFormBooleanInputType } from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport type { WithFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { WithFormInputIcon } from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport { withFormInputIcon } from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport type { WithFormInputInvalidStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputInvalidStyles.ts\"\nimport { withFormInputInvalidStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputInvalidStyles.ts\"\nimport type { WithFormInputStep } from \"document/models/CanvasTree/traits/forms/WithFormInputStep.ts\"\nimport { withFormInputStep } from \"document/models/CanvasTree/traits/forms/WithFormInputStep.ts\"\nimport type { WithFormSelect } from \"document/models/CanvasTree/traits/forms/WithFormSelect.ts\"\nimport { withFormSelect } from \"document/models/CanvasTree/traits/forms/WithFormSelect.ts\"\nimport type { WithFormTextInputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { withFormTextInputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\n\n// A subset of traits whose keys can be set by the handler hooks below.\nexport type AllFormInputTraits = Partial<WithFormInput> &\n\tWithFormBooleanInputType &\n\tWithFormInputIcon &\n\tWithFormInputInvalidStyles &\n\tWithFormInputStep &\n\tWithFormSelect &\n\tWithFormTextInputType\n\ntype FormInputTraitCheckByKey = {\n\t[K in keyof AllFormInputTraits]: (node: CanvasNode) => node is CanvasNode & Pick<AllFormInputTraits, K>\n}\n\n/**\n * Every key in AllFormTraits mapped to the trait check function for the trait\n * that contains that key. This is exhaustive, so will error if the key is\n * mapped to the wrong function, or a key is missing.\n */\nconst traitCheckForKey: FormInputTraitCheckByKey = {\n\t// WithFormInput\n\tformInputValue: withFormInput,\n\t// WithFormInputStep\n\tformInputStep: withFormInputStep,\n\t// WithFormInputIcon\n\tformInputIconImage: withFormInputIcon,\n\tformInputIconColor: withFormInputIcon,\n\t// WithFormInputType\n\tformTextInputType: withFormTextInputType,\n\tformTextAreaResizable: withFormTextInputType,\n\tformTextInputMaxNumber: withFormTextInputType,\n\tformTextInputMinNumber: withFormTextInputType,\n\tformInputMaxLength: withFormTextInputType,\n\t// WithFormBooleanInputType\n\tformBooleanInputType: withFormBooleanInputType,\n\tformBooleanInputValue: withFormBooleanInputType,\n\tformBooleanInputCheckedBorderColor: withFormBooleanInputType,\n\tformBooleanInputCheckedBorderStyle: withFormBooleanInputType,\n\tformBooleanInputCheckedBorderWidth: withFormBooleanInputType,\n\tformBooleanInputCheckedBoxShadow: withFormBooleanInputType,\n\tformBooleanInputCheckedFillColor: withFormBooleanInputType,\n\tformBooleanInputCheckedTransition: withFormBooleanInputType,\n\t// WithFormSelect\n\tformSelectOptions: withFormSelect,\n\t// WithFormInputInvalidStyles\n\tformInputInvalidTextColor: withFormInputInvalidStyles,\n}\n\n/**\n * Create a memoized callback that allows setting a form input property on a\n * node.\n */\nexport function useFormInputPropertyHandler<K extends keyof FormInputTraitCheckByKey>(key: K, nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: AllFormInputTraits[K]) => {\n\t\t\tconst withTrait = traitCheckForKey[key]\n\n\t\t\t// @ts-expect-error\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTrait)) {\n\t\t\t\t// Typescript loses the connection between the generic key, and\n\t\t\t\t// the value for that key when creating an object. This forces\n\t\t\t\t// us to cast the update. This is safe though as the\n\t\t\t\t// traitCheckForKey guarantees that the value of withTrait\n\t\t\t\t// limits nodes to those that do implement the provided key.\n\t\t\t\tnode.set({ [key]: value } as Partial<typeof node>)\n\t\t\t}\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\n/**\n * Create a memoized callback that allows removing a dynamic value from a node,\n * setting the default value if it's valid.\n */\nexport function useRemoveFormInputDynamicValueHandler<\n\tKey extends keyof FormInputTraitCheckByKey,\n\tValue extends AllFormInputTraits[Key],\n>(key: Key, nodeIds: NodeID[], isValue: (value: unknown) => value is Exclude<Value, DynamicValue>) {\n\treturn useEngineCallback(() => {\n\t\tconst withTrait = traitCheckForKey[key]\n\t\t// @ts-expect-error\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTrait)) {\n\t\t\t// @ts-expect-error\n\t\t\tconst value = node[key]\n\t\t\tif (!isDynamicValue(value)) continue\n\n\t\t\t// We try and obtain the underlying value from the variable\n\t\t\t// reference in order to show the same value in the property panel\n\t\t\t// as it was before the dynamic value was removed.\n\t\t\tconst defaultValue = isVariableReference(value) ? getVariableValue(engine, value) : undefined\n\t\t\t// Typescript loses the connection between the generic key, and the\n\t\t\t// value for that key when creating an object. This forces us to\n\t\t\t// cast the update. This is safe though as the traitCheckForKey\n\t\t\t// guarantees that the value of withTrait limits nodes to those that\n\t\t\t// do implement the provided key.\n\t\t\tnode.set({ [key]: isValue(defaultValue) ? defaultValue : undefined } as Partial<typeof node>)\n\t\t}\n\t}, [nodeIds, key, isValue])\n}\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React, { useCallback } from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport type { RecordWithOnlyKeysOfValueType } from \"utils/types.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { AllFormInputTraits } from \"./utils.ts\"\nimport { useFormInputPropertyHandler, useRemoveFormInputDynamicValueHandler } from \"./utils.ts\"\n\ntype FormInputNumberProperties = RecordWithOnlyKeysOfValueType<AllFormInputTraits, number>\n\nfunction titleForProperty(property: keyof FormInputNumberProperties) {\n\tswitch (property) {\n\t\tcase \"formTextInputMinNumber\":\n\t\t\treturn \"Min\"\n\t\tcase \"formTextInputMaxNumber\":\n\t\t\treturn \"Max\"\n\t\tcase \"formInputStep\":\n\t\t\treturn \"Step\"\n\t\tcase \"formInputMaxLength\":\n\t\t\treturn Dictionary.MaxLength\n\t\tdefault:\n\t\t\tassertNever(property)\n\t}\n}\n\nconst traitTypeMap: Record<keyof FormInputNumberProperties, TraitType[]> = {\n\tformTextInputMinNumber: [TraitType.FormTextInputTypeMin],\n\tformTextInputMaxNumber: [TraitType.FormTextInputTypeMax],\n\tformInputStep: [TraitType.FormInputStep],\n\tformInputMaxLength: [TraitType.FormInputMaxLength],\n}\n\nconst popoutId = \"form-input-number-value-transform\"\nexport function FormInputNumberRow({\n\tproperty,\n\tvalue,\n\tnodeIds,\n}: {\n\tproperty: keyof FormInputNumberProperties\n\tvalue: Reduced<number | DynamicValue | undefined>\n\tnodeIds: NodeID[]\n}) {\n\tconst attributePopoutId = `${popoutId}-${property}`\n\tconst handleChange = useFormInputPropertyHandler(property, nodeIds)\n\tconst removeDynamicValue = useRemoveFormInputDynamicValueHandler(property, nodeIds, isNumber)\n\tconst onSelectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\thandleChange(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(attributePopoutId)\n\t\t},\n\t\t[handleChange, attributePopoutId],\n\t)\n\n\tconst title = titleForProperty(property)\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: title,\n\t\t\t\tinitialValue: isNumber(value) ? value : 0,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\thandleChange(variableRef)\n\t\t},\n\t\t[handleChange, title, value],\n\t)\n\n\tconst removeValue = React.useCallback(() => handleChange(undefined), [handleChange])\n\n\tconst numericValue = isNumber(value) || isMixed(value) ? value : 0\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\tcomputedValuePopoutId={attributePopoutId}\n\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonSelectVariable={handleChange}\n\t\t\tsupportsComputedValues\n\t\t\tsupportsVariables\n\t\t\tonDelete={removeValue}\n\t\t\ttraitTypes={traitTypeMap[property]}\n\t\t\tvariableReferenceType={ControlType.Number}\n\t\t\tvariableType={ControlType.Number}\n\t\t>\n\t\t\t{isDynamicValue(value) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={handleChange}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTickerAndStepper value={numericValue} onChange={handleChange} step={1} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValueFromVariableReference } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { getFetchFallbackValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\n\nexport function getComputedValueStartValue(engine: VekterEngine, value: ComputedValue): unknown {\n\tif (isComputedValueFromVariableReference(value)) {\n\t\treturn getVariableValue(engine, value.startValue)\n\t}\n\n\treturn getFetchFallbackValue(value.startValue)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormInput, \"formInputAutoFocus\"> {}\n\nconst popoutId = \"form-input-auto-focus-value-transform\"\n\nexport function InputAutoFocusRow({ formInputAutoFocus, nodeIds }: Props) {\n\tconst autoFocusValue = Boolean(formInputAutoFocus)\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\tnode.set({ formInputAutoFocus: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleAutoFocusChange = useEngineCallback(\n\t\t(newAutoFocus: boolean | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\t\tnode.set({ formInputAutoFocus: newAutoFocus })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputAutoFocus)) return\n\t\tif (isVariableReference(formInputAutoFocus)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputAutoFocus)\n\t\t\thandleAutoFocusChange(!!variableValue)\n\t\t} else if (isComputedValue(formInputAutoFocus)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputAutoFocus)\n\t\t\thandleAutoFocusChange(!!variableValue)\n\t\t} else {\n\t\t\tshouldBeNever(formInputAutoFocus)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Auto Focus\",\n\t\t\tinitialValue: autoFocusValue,\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleAutoFocusChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\thandleAutoFocusChange(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Auto Focus\"\n\t\t\tvariableType={ControlType.String}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formInputAutoFocus) ? formInputAutoFocus : null}\n\t\t\tonSelectVariable={handleAutoFocusChange}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t\tonDelete={onDelete}\n\t\t>\n\t\t\t{isDynamicValue(formInputAutoFocus) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Auto Focus\"\n\t\t\t\t\tvalue={formInputAutoFocus}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={autoFocusValue === true}\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\tonSelect={handleAutoFocusChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={autoFocusValue === false}\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\tonSelect={handleAutoFocusChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInputAutofillEnabled } from \"document/models/CanvasTree/traits/forms/WithFormInputAutofillEnabled.ts\"\nimport type { ReducedFormInputAutofillEnabled } from \"document/models/CanvasTree/traits/utils/reduceFormInputAutofillEnabled.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { DescriptionRow } from \"../../codeComponentRows/DescriptionRow.tsx\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ntype Props = BaseRowProps & Omit<ReducedFormInputAutofillEnabled, \"onlyNodesWithAutofillEnabled\">\n\nconst popoutId = \"form-input-autofill-enabled-value-transform\"\n\nexport function InputAutofillEnabledRow({ formInputAutofillEnabled, nodeIds }: Props) {\n\tconst autoFillEnabledValue = Boolean(formInputAutofillEnabled)\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputAutofillEnabled)) {\n\t\t\tnode.set({ formInputAutofillEnabled: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleAutofillChange = useEngineCallback(\n\t\t(newAutofill: boolean | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputAutofillEnabled)) {\n\t\t\t\tnode.set({ formInputAutofillEnabled: newAutofill })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputAutofillEnabled)) return\n\t\tif (isVariableReference(formInputAutofillEnabled)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputAutofillEnabled)\n\t\t\thandleAutofillChange(!!variableValue)\n\t\t} else if (isComputedValue(formInputAutofillEnabled)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputAutofillEnabled)\n\t\t\thandleAutofillChange(!!variableValue)\n\t\t} else {\n\t\t\tshouldBeNever(formInputAutofillEnabled)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Auto Fill\",\n\t\t\tinitialValue: autoFillEnabledValue,\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleAutofillChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\thandleAutofillChange(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\ttitle=\"Auto Fill\"\n\t\t\t\tvariableType={ControlType.Boolean}\n\t\t\t\tonCreateVariable={createVariable}\n\t\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\t\tdynamicValue={isDynamicValue(formInputAutofillEnabled) ? formInputAutofillEnabled : null}\n\t\t\t\tonSelectVariable={handleAutofillChange}\n\t\t\t\tsupportsVariables\n\t\t\t\tsupportsComputedValues\n\t\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t\t\tonDelete={onDelete}\n\t\t\t>\n\t\t\t\t{isDynamicValue(formInputAutofillEnabled) ? (\n\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\ttitle=\"Auto Fill\"\n\t\t\t\t\t\tvalue={formInputAutofillEnabled}\n\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={autoFillEnabledValue === true}\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\tonSelect={handleAutofillChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={autoFillEnabledValue === false}\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\tonSelect={handleAutofillChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow description=\"Enables password managers to auto fill.\" />\n\t\t</>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormInput, \"formInputHidden\"> {}\n\nconst popoutId = \"form-input-hidden-value-transform\"\n\nexport function InputHiddenRow({ formInputHidden, nodeIds }: Props) {\n\tconst hiddenValue = Boolean(formInputHidden)\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\tnode.set({ formInputHidden: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst updateInputHidden = useEngineCallback(\n\t\t(newHidden: boolean | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\t\tnode.set({ formInputHidden: newHidden })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputHidden)) return\n\t\tif (isVariableReference(formInputHidden)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputHidden)\n\t\t\tupdateInputHidden(!!variableValue)\n\t\t} else if (isComputedValue(formInputHidden)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputHidden)\n\t\t\tupdateInputHidden(!!variableValue)\n\t\t} else {\n\t\t\tshouldBeNever(formInputHidden)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Hidden\",\n\t\t\tinitialValue: !!formInputHidden,\n\t\t})\n\t\tif (!variableRef) return\n\t\tupdateInputHidden(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\tupdateInputHidden(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Hidden\"\n\t\t\tvariableType={ControlType.String}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formInputHidden) ? formInputHidden : null}\n\t\t\tonSelectVariable={updateInputHidden}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonDelete={onDelete}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formInputHidden) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Hidden\"\n\t\t\t\t\tvalue={formInputHidden}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={hiddenValue === true}\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\tonSelect={updateInputHidden}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={hiddenValue === false}\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\tonSelect={updateInputHidden}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { InputWrapper, TextInput } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ninterface Props extends Pick<ReducedFormInput, \"formInputName\">, BaseRowProps {}\n\nconst popoutId = \"form-input-value-value-transform\"\n\nexport function InputNameRow({ formInputName, nodeIds }: Props) {\n\tconst handleNameChange = useEngineCallback(\n\t\t(value: string | DynamicValue) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\t\tnode.set({ formInputName: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputName)) return\n\t\tif (isVariableReference(formInputName)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputName)\n\t\t\thandleNameChange(isString(variableValue) ? variableValue : \"\")\n\t\t} else if (isComputedValue(formInputName)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputName)\n\t\t\thandleNameChange(isString(variableValue) ? variableValue : \"\")\n\t\t} else {\n\t\t\tshouldBeNever(formInputName)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.String,\n\t\t\tname: \"Name\",\n\t\t\tinitialValue: isString(formInputName) ? formInputName : \"\",\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleNameChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\thandleNameChange(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Name\"\n\t\t\tvariableType={ControlType.String}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formInputName) ? formInputName : null}\n\t\t\tonSelectVariable={handleNameChange}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formInputName) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Placeholder\"\n\t\t\t\t\tvalue={formInputName}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.String}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tvalue={isString(formInputName) ? formInputName : \"\"}\n\t\t\t\t\t\t\tplaceholder=\"Name\"\n\t\t\t\t\t\t\tonChange={handleNameChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport type { ReducedFormInputPlaceholder } from \"document/models/CanvasTree/traits/utils/reduceFormInputPlaceholder.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormInputPlaceholder, \"formInputPlaceholder\"> {}\n\nconst popoutId = \"form-input-placeholder-value-transform\"\n\nexport function InputPlaceholderRow({ formInputPlaceholder, nodeIds }: Props) {\n\tconst placeholderValue = isString(formInputPlaceholder) ? formInputPlaceholder : \"\"\n\n\tconst updatePlaceholder = useEngineCallback(\n\t\t(newPlaceholder: string | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputPlaceholder)) {\n\t\t\t\tnode.set({ formInputPlaceholder: newPlaceholder })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputPlaceholder)) return\n\t\tif (isVariableReference(formInputPlaceholder)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputPlaceholder)\n\t\t\tupdatePlaceholder(isString(variableValue) ? variableValue : \"\")\n\t\t} else if (isComputedValue(formInputPlaceholder)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputPlaceholder)\n\t\t\tupdatePlaceholder(isString(variableValue) ? variableValue : \"\")\n\t\t} else {\n\t\t\tshouldBeNever(formInputPlaceholder)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.String,\n\t\t\tname: \"Placeholder\",\n\t\t\tinitialValue: placeholderValue,\n\t\t})\n\t\tif (!variableRef) return\n\t\tupdatePlaceholder(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\tupdatePlaceholder(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Placeholder\"\n\t\t\tvariableType={ControlType.String}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(placeholderValue) ? placeholderValue : null}\n\t\t\tonSelectVariable={updatePlaceholder}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formInputPlaceholder) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Placeholder\"\n\t\t\t\t\tvalue={formInputPlaceholder}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.String}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<TextInput value={placeholderValue} placeholder=\"Placeholder\" onChange={updatePlaceholder} constantChange />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback } from \"react\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormInput, \"formInputRequired\"> {}\n\nconst popoutId = \"form-input-required-value-transform\"\n\nexport function InputRequiredRow({ formInputRequired, nodeIds }: Props) {\n\tconst handleRequiredChange = useEngineCallback(\n\t\t(value: boolean | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\t\tnode.set({ formInputRequired: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputRequired)) return\n\t\tif (isVariableReference(formInputRequired)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputRequired)\n\t\t\thandleRequiredChange(!!variableValue)\n\t\t} else if (isComputedValue(formInputRequired)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputRequired)\n\t\t\thandleRequiredChange(!!variableValue)\n\t\t} else {\n\t\t\tshouldBeNever(formInputRequired)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Required\",\n\t\t\tinitialValue: !!formInputRequired,\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleRequiredChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = useCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\thandleRequiredChange(dynamicValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[handleRequiredChange],\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Required\"\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formInputRequired) ? formInputRequired : null}\n\t\t\tonSelectVariable={handleRequiredChange}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formInputRequired) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Required\"\n\t\t\t\t\tvalue={formInputRequired}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={formInputRequired === true}\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\tonSelect={handleRequiredChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={formInputRequired !== true}\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\tonSelect={handleRequiredChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { TextInput } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumnClass } from \"../../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\nconst popoutId = \"form-input-value-value-transform\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormInput, \"formInputValue\" | \"anyRadioButton\"> {}\n\nexport function InputValueRow({ formInputValue, anyRadioButton, nodeIds }: Props) {\n\tconst inputValue = isString(formInputValue) ? formInputValue : \"\"\n\n\tconst onDelete = useCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\tnode.set({ formInputValue: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleValueChange = useEngineCallback(\n\t\t(value: string | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInput)) {\n\t\t\t\tnode.set({ formInputValue: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formInputValue)) return\n\t\tif (isVariableReference(formInputValue)) {\n\t\t\tconst variableValue = getVariableValue(engine, formInputValue)\n\t\t\thandleValueChange(isString(variableValue) ? variableValue : \"\")\n\t\t} else if (isComputedValue(formInputValue)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formInputValue)\n\t\t\thandleValueChange(isString(variableValue) ? variableValue : \"\")\n\t\t} else {\n\t\t\tshouldBeNever(formInputValue)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.String,\n\t\t\tname: \"Value\",\n\t\t\tinitialValue: inputValue,\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleValueChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (dynamicValue: DynamicValue) => {\n\t\thandleValueChange(dynamicValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Value\"\n\t\t\tonDelete={onDelete}\n\t\t\tdeleteEnabled={!anyRadioButton}\n\t\t\tvariableType={ControlType.String}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formInputValue) ? formInputValue : null}\n\t\t\tonSelectVariable={handleValueChange}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formInputValue) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Value\"\n\t\t\t\t\tvalue={formInputValue}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.String}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={setDynamicValueAndOpenPopout}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<TextInput\n\t\t\t\t\tconstantChange\n\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\tplaceholder=\"Value\"\n\t\t\t\t\tonChange={handleValueChange}\n\t\t\t\t\tclassName={doubleColumnClass}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { IconPopupButtonFormSelectDivider, IconPopupButtonFormSelectOption, Stack, useReadOnly } from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { List, assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"document/components/chrome/shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { FormSelectOption } from \"document/models/CanvasTree/traits/forms/WithFormSelect.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport type { ReducedFormSelect } from \"document/models/CanvasTree/traits/utils/reduceFormSelect.ts\"\nimport { useCallback } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport * as classes from \"../../panels/sortablePanelRows.styles.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { SelectOptionPopout } from \"./SelectOptionPopout.tsx\"\nimport { useFormInputPropertyHandler } from \"./utils.ts\"\n\nconst emptyOptions: readonly FormSelectOption[] = []\ninterface Props extends Pick<ReducedFormSelect, \"formSelectOptions\"> {\n\toriginalIds: NodeID[]\n\tselectedId: ReducedFormInput[\"formInputValue\"]\n}\n\nexport const SelectOptionsRow = ({ formSelectOptions, selectedId, originalIds }: Props) => {\n\tconst isReadOnly = useReadOnly()\n\n\tconst options: readonly FormSelectOption[] = isArray(formSelectOptions) ? formSelectOptions : emptyOptions\n\n\tconst updateFormSelectOptions = useFormInputPropertyHandler(\"formSelectOptions\", originalIds)\n\tconst updateFormInputValue = useFormInputPropertyHandler(\"formInputValue\", originalIds)\n\n\tconst handleAddItem = useCallback(() => {\n\t\taddItem(updateFormSelectOptions, options)\n\t}, [updateFormSelectOptions, options])\n\n\tconst handleMoveItem = useCallback(\n\t\t(from: number, to: number) => {\n\t\t\tmoveItem(updateFormSelectOptions, options, from, to)\n\t\t},\n\t\t[updateFormSelectOptions, options],\n\t)\n\n\tconst handleRemoveItem = useCallback(\n\t\t(index: number) => {\n\t\t\tremoveItem(updateFormSelectOptions, options, index)\n\t\t},\n\t\t[updateFormSelectOptions, options],\n\t)\n\n\tconst onChange = useCallback(\n\t\t(update: Partial<FormSelectOption>, optionId: NodeID) => {\n\t\t\tconst newOptions = options.map(option => {\n\t\t\t\tif (option.id === optionId) return { ...option, ...update }\n\t\t\t\treturn option\n\t\t\t})\n\n\t\t\tupdateFormSelectOptions(newOptions)\n\t\t},\n\t\t[updateFormSelectOptions, options],\n\t)\n\n\tconst displayContextMenu = (event: React.MouseEvent, index: number) => {\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Duplicate\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst option = options[index]\n\t\t\t\t\t\tif (!option) return\n\t\t\t\t\t\taddItem(updateFormSelectOptions, options, option)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t// @TODO: copy?\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Remove\",\n\t\t\t\t\tclick: () => removeItem(updateFormSelectOptions, options, index),\n\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Options\">\n\t\t\t<Stack style={doubleColumn}>\n\t\t\t\t{options.length > 0 && (\n\t\t\t\t\t<Sortable\n\t\t\t\t\t\tclassName={classes.sortable}\n\t\t\t\t\t\titems={options}\n\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\tmoveItem={handleMoveItem}\n\t\t\t\t\t\tremoveItem={handleRemoveItem}\n\t\t\t\t\t>\n\t\t\t\t\t\t{({ item: option, index }) => (\n\t\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\t\tid={option.id}\n\t\t\t\t\t\t\t\tkey={option.id}\n\t\t\t\t\t\t\t\ttitle={getPreviewTitle(option)}\n\t\t\t\t\t\t\t\tnavigationTitle={Dictionary.Option}\n\t\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t\t<SelectOptionPopout\n\t\t\t\t\t\t\t\t\t\t{...option}\n\t\t\t\t\t\t\t\t\t\tselectedId={selectedId}\n\t\t\t\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\t\t\t\tonSelectDefault={updateFormInputValue}\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\tdisplayDivider\n\t\t\t\t\t\t\t\tonDelete={() => handleRemoveItem(index)}\n\t\t\t\t\t\t\t\tonContextMenu={event => displayContextMenu(event, index)}\n\t\t\t\t\t\t\t\tpreview={<PopoutButtonPreviewIconWrapper>{getPreviewIcon(option.type)}</PopoutButtonPreviewIconWrapper>}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Sortable>\n\t\t\t\t)}\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"formSelectOption\" onClick={handleAddItem} />\n\t\t\t</Stack>\n\t\t</PanelRow>\n\t)\n}\n\nfunction getPreviewIcon(type: FormSelectOption[\"type\"]) {\n\tswitch (type) {\n\t\tcase \"option\":\n\t\t\treturn <IconPopupButtonFormSelectOption />\n\t\tcase \"divider\":\n\t\t\treturn <IconPopupButtonFormSelectDivider />\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction getPreviewTitle(option: FormSelectOption) {\n\tif (option.type === \"divider\") return Dictionary.Line\n\treturn option.title ?? Dictionary.Option\n}\n\nfunction createSelectOption(props: Partial<FormSelectOption>): FormSelectOption {\n\tconst { id, ...rest } = props\n\treturn {\n\t\tid: id ?? randomID(),\n\t\ttype: \"option\",\n\t\tvalue: undefined,\n\t\ttitle: undefined,\n\t\ttitleLocalized: undefined,\n\t\tdisabled: undefined,\n\t\t...rest,\n\t}\n}\n\nconst addItem = engine.scheduler.wrapHandler(\n\t(\n\t\tupdate: (value: readonly FormSelectOption[] | undefined) => void,\n\t\toptions: readonly FormSelectOption[],\n\t\tprops?: Partial<FormSelectOption>,\n\t) => {\n\t\tconst id = randomID()\n\t\tconst newOptions = List.push(options, createSelectOption({ ...props, id }))\n\t\tupdate(newOptions)\n\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(id)\n\t},\n)\n\nconst moveItem = engine.scheduler.wrapHandler(\n\t(\n\t\tupdate: (value: readonly FormSelectOption[] | undefined) => void,\n\t\toptions: readonly FormSelectOption[],\n\t\tfrom: number,\n\t\tto: number,\n\t) => {\n\t\tconst newOptions = List.move(options, from, to)\n\t\tupdate(newOptions)\n\t},\n)\n\nconst removeItem = engine.scheduler.wrapHandler(\n\t(\n\t\tupdate: (value: readonly FormSelectOption[] | undefined) => void,\n\t\toptions: readonly FormSelectOption[],\n\t\tindex: number,\n\t) => {\n\t\tconst newOptions = List.remove(options, index)\n\t\tupdate(newOptions)\n\t},\n)\n", "import { SegmentedControl, SegmentedControlItem, Stack, TextInput } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FormSelectOption } from \"document/models/CanvasTree/traits/forms/WithFormSelect.ts\"\nimport type { ReducedFormInput } from \"document/models/CanvasTree/traits/utils/reduceFormInput.ts\"\nimport React, { useCallback } from \"react\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\ninterface SelectOptionPopoutProps extends FormSelectOption {\n\tselectedId: ReducedFormInput[\"formInputValue\"]\n\tonChange: (update: Partial<FormSelectOption>, id: NodeID) => void\n\tonSelectDefault: (id: NodeID | undefined) => void\n}\n\nexport const SelectOptionPopout = React.memo(function SelectOptionPopout({\n\tid,\n\ttype,\n\tvalue,\n\ttitle,\n\tdisabled,\n\tselectedId,\n\tonChange,\n\tonSelectDefault,\n}: SelectOptionPopoutProps) {\n\tconst handleChange = useCallback(\n\t\t(update: Partial<FormSelectOption>) => {\n\t\t\tonChange(update, id)\n\t\t},\n\t\t[onChange, id],\n\t)\n\treturn (\n\t\t<Stack gap={0} padding={`${dimensions.css.inputSpacing} ${dimensions.css.popoverPadding}`}>\n\t\t\t<OptionTypeRow type={type} onChange={handleChange} />\n\t\t\t{type === \"option\" && (\n\t\t\t\t<>\n\t\t\t\t\t<OptionValueRow value={value} onChange={handleChange} />\n\t\t\t\t\t<OptionTitleRow title={title} onChange={handleChange} />\n\t\t\t\t\t<OptionEnabledRow disabled={disabled} onChange={handleChange} />\n\t\t\t\t\t<OptionSelectedRow id={id} selected={id === selectedId} onSelectDefault={onSelectDefault} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n\ntype UpdateSingleOptionProp = (value: Partial<FormSelectOption>) => void\n\ninterface OptionTypeRowProps {\n\ttype: FormSelectOption[\"type\"]\n\tonChange: UpdateSingleOptionProp\n}\nconst OptionTypeRow = React.memo(function OptionTypeRow({ type, onChange }: OptionTypeRowProps) {\n\tconst onSelect = (type: FormSelectOption[\"type\"]) => {\n\t\tonChange({ type })\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Type\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem identifier=\"option\" title=\"Text\" selected={type === \"option\"} onSelect={onSelect} />\n\t\t\t\t<SegmentedControlItem identifier=\"divider\" title=\"Line\" selected={type === \"divider\"} onSelect={onSelect} />\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n\ninterface OptionValueRowProps {\n\tvalue: FormSelectOption[\"value\"]\n\tonChange: UpdateSingleOptionProp\n}\n\nconst OptionValueRow = React.memo(function OptionValueRow({ value = \"\", onChange }: OptionValueRowProps) {\n\tconst handleChange = (value: string) => {\n\t\tonChange({ value })\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Value\">\n\t\t\t<TextInput value={value} constantChange style={doubleColumn} onChange={handleChange} />\n\t\t</PanelRow>\n\t)\n})\n\ninterface OptionTitleRowProps {\n\ttitle: FormSelectOption[\"title\"]\n\tonChange: UpdateSingleOptionProp\n}\n\nconst OptionTitleRow = React.memo(function OptionTitleRow({ title = \"\", onChange }: OptionTitleRowProps) {\n\tconst handleChange = (title: string) => {\n\t\tonChange({ title })\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Title\">\n\t\t\t<TextInput value={title} constantChange style={doubleColumn} onChange={handleChange} />\n\t\t</PanelRow>\n\t)\n})\n\nconst OptionEnabledRow = React.memo(function OptionEnabledRow({\n\tdisabled,\n\tonChange,\n}: {\n\tdisabled: FormSelectOption[\"disabled\"]\n\tonChange: UpdateSingleOptionProp\n}) {\n\tconst handleChange = (value: boolean) => {\n\t\tonChange({ disabled: value ? true : undefined })\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Enabled\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\tselected={disabled !== true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\tselected={disabled === true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n\nconst OptionSelectedRow = React.memo(function OptionSelectedRow({\n\tid,\n\tselected,\n\tonSelectDefault,\n}: {\n\tid: NodeID\n\tselected: boolean\n\tonSelectDefault: (id: NodeID | undefined) => void\n}) {\n\tconst handleChange = (value: boolean) => {\n\t\tonSelectDefault(value ? id : undefined)\n\t}\n\n\treturn (\n\t\t<PanelRow title=\"Default\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\tselected={selected === true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\tselected={selected !== true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { supportsSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport type { WithSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { withSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport type { WithFormTextInputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport {\n\tisFormTextAreaInput,\n\twithFormTextInputType,\n} from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport type { ReducedFormTextInputType } from \"document/models/CanvasTree/traits/utils/reduceFormTextInputType.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType, DimensionType } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\n\nconst popoutId = \"form-input-resize-value-transform\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormTextInputType, \"formTextAreaResizable\"> {}\n\nconst traitTypes = [TraitType.FormInputTextAreaResize]\n\nexport function TextAreaResizableRow({ formTextAreaResizable, nodeIds }: Props) {\n\tconst onDelete = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormTextInputType)) {\n\t\t\tnode.set({ formTextAreaResizable: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleTextAreaResizeOptionChange = useEngineCallback(\n\t\t(resizable: boolean | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, isFormTextAreaInput)) {\n\t\t\t\tif (!supportsSizeConstraints(node)) continue\n\t\t\t\tif (!withSizeDimensionType(node)) continue\n\n\t\t\t\tif (resizable === true) {\n\t\t\t\t\tnode.set(getResizableDefaultUpdates(engine.tree, node))\n\t\t\t\t} else {\n\t\t\t\t\tnode.set({ formTextAreaResizable: resizable })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(formTextAreaResizable)) return\n\t\tif (isVariableReference(formTextAreaResizable)) {\n\t\t\tconst variableValue = getVariableValue(engine, formTextAreaResizable)\n\t\t\thandleTextAreaResizeOptionChange(!!variableValue)\n\t\t} else if (isComputedValue(formTextAreaResizable)) {\n\t\t\tconst variableValue = getComputedValueStartValue(engine, formTextAreaResizable)\n\t\t\thandleTextAreaResizeOptionChange(!!variableValue)\n\t\t} else {\n\t\t\tshouldBeNever(formTextAreaResizable)\n\t\t}\n\t})\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Resizable\",\n\t\t\tinitialValue: !!formTextAreaResizable,\n\t\t})\n\t\tif (!variableRef) return\n\t\thandleTextAreaResizeOptionChange(variableRef)\n\t})\n\n\tconst setDynamicValueAndOpenPopout = useCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\thandleTextAreaResizeOptionChange(dynamicValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[handleTextAreaResizeOptionChange],\n\t)\n\n\tconst title = \"Resizable\"\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\ttraitTypes={traitTypes}\n\t\t\tonDelete={onDelete}\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(formTextAreaResizable) ? formTextAreaResizable : null}\n\t\t\tonSelectVariable={handleTextAreaResizeOptionChange}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(formTextAreaResizable) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tvalue={formTextAreaResizable}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={handleTextAreaResizeOptionChange}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={formTextAreaResizable === true}\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\tonSelect={handleTextAreaResizeOptionChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={formTextAreaResizable !== true}\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\tonSelect={handleTextAreaResizeOptionChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\ntype ResizableTextareaUpdate = Partial<\n\tPick<WithSizeDimensionType, \"heightType\"> &\n\t\tPick<WithSizeConstraints, \"minHeight\"> &\n\t\tPick<WithFormTextInputType, \"formTextAreaResizable\">\n>\n\nconst defaultMinHeight = 100\n\n// If resize=true, then we want to set a minimum height to the current on-canvas\n// rect height, or a default height, whichever is larger, and set the height\n// type to auto, so that when the user resizes the text area, they cannot resize\n// it to less than what is currently on canvas.\nexport function getResizableDefaultUpdates(\n\ttree: CanvasTree,\n\tnode: CanvasNode & WithFormTextInputType,\n): ResizableTextareaUpdate {\n\tconst rect = tree.getRect(node)\n\n\treturn {\n\t\tformTextAreaResizable: true,\n\t\tminHeight: rect.height > defaultMinHeight ? rect.height : defaultMinHeight,\n\t\theightType: DimensionType.Auto,\n\t}\n}\n", "import type { CreateVariableOptions } from \"document/components/chrome/properties/utils/createVariable.ts\"\nimport { ControlType } from \"library/index.ts\"\n\nexport type CreateNodePropertyControlReferenceOptions = Omit<\n\tExtract<CreateVariableOptions, { type: \"nodePropertyControlReference\" }>,\n\t\"initialValue\"\n>\n\nexport const stackDirectionVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"direction\",\n\tcontrolKey: \"stackDirection\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const stackDistributionVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"distribute\",\n\tcontrolKey: \"stackDistribution\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const stackAlignmentVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"align\",\n\tcontrolKey: \"stackAlignment\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const gridItemColumnSpanVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"columnSpan\",\n\tcontrolKey: \"gridItemColumnSpan\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const gridItemRowSpanVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"rowSpan\",\n\tcontrolKey: \"gridItemRowSpan\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const userSelectVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"userSelect\",\n\tcontrolKey: \"userSelect\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const imageRenderingVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"imageRendering\",\n\tcontrolKey: \"imageRendering\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const overscrollBehaviorVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"overscrollBehavior\",\n\tcontrolKey: \"overscrollBehavior\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const overflowVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"overflow\",\n\tcontrolKey: \"overflow\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const pointerEventsVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"pointerEvents\",\n\tcontrolKey: \"pointerEvents\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const blendingModeVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"blendingMode\",\n\tcontrolKey: \"blendingMode\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const textInputTypeVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"formTextInputType\",\n\tcontrolKey: \"formTextInputType\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n\nexport const tickerEffectDirectionModifierVariableDefinition: CreateNodePropertyControlReferenceOptions = {\n\ttype: \"nodePropertyControlReference\",\n\tname: \"direction\",\n\tcontrolKey: \"tickerEffectDirectionModifier\",\n\tentityIdentifier: \"framer/nodePropertyDefinitions\",\n\texpectedType: ControlType.Enum,\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport type { ControlReferenceInfo } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { supportsSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { withSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport type { InputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport {\n\tinputTypes,\n\tisTextInputType,\n\ttitleForTextInputTypeOption,\n\twithFormTextInputType,\n} from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport type { ReducedFormTextInputType } from \"document/models/CanvasTree/traits/utils/reduceFormTextInputType.ts\"\nimport { nodePropertyDefinitionEntityIdentifier } from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { textInputTypeVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React, { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { getResizableDefaultUpdates } from \"./TextAreaResizableRow.tsx\"\nimport type { BaseRowProps } from \"./types.ts\"\nimport { useRemoveFormInputDynamicValueHandler } from \"./utils.ts\"\n\ninterface Props extends BaseRowProps, Pick<ReducedFormTextInputType, \"formTextInputType\"> {}\n\nconst referenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"formTextInputType\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\nconst popoutId = \"text-input-type-value-transform\"\nconst inputTypeTraitTypes = [TraitType.FormTextInputType]\n\nexport const TextInputTypeRow = React.memo(function TextInputTypeRows({ formTextInputType, nodeIds }: Props) {\n\tconst onChange = useEngineCallback(\n\t\t(inputType: InputType | DynamicValue | undefined) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormTextInputType)) {\n\t\t\t\tif (!supportsSizeConstraints(node)) continue\n\t\t\t\tif (!withSizeDimensionType(node)) continue\n\n\t\t\t\tif (inputType === \"textarea\") {\n\t\t\t\t\tnode.set({ formTextInputType: inputType, ...getResizableDefaultUpdates(engine.tree, node) })\n\t\t\t\t} else {\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tformTextInputType: inputType,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\tconst removeDynamicValue = useRemoveFormInputDynamicValueHandler(\"formTextInputType\", nodeIds, isTextInputType)\n\tconst handleInputTypeChange = useEngineCallback((value: InputType | undefined) => onChange(value), [onChange])\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isString(formTextInputType) ? formTextInputType : \"text\",\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...textInputTypeVariableDefinition,\n\t\t\t\tname: \"Type\",\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tonChange(variableRef)\n\t\t},\n\t\t[formTextInputType, onChange],\n\t)\n\n\tconst onSelectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tonChange(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[onChange],\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Type\"\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tcontrolKey={referenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={referenceInfo.controlSourceIdentifier}\n\t\t\tdynamicValue={isDynamicValue(formTextInputType) ? formTextInputType : null}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonSelectVariable={onChange}\n\t\t\tsupportsComputedValues\n\t\t\tsupportsVariables\n\t\t\ttraitTypes={inputTypeTraitTypes}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tvariableType={ControlType.Enum}\n\t\t>\n\t\t\t{isDynamicValue(formTextInputType) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Type\"\n\t\t\t\t\tvalue={formTextInputType}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={onChange}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton mixed={isMixed(formTextInputType)}>\n\t\t\t\t\t\t{inputTypes.map(option => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={titleForTextInputTypeOption(option)}\n\t\t\t\t\t\t\t\tselected={formTextInputType === option}\n\t\t\t\t\t\t\t\tonSelect={handleInputTypeChange}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { VariableReferenceButton } from \"document/components/chrome/shared/VariableReferenceButton.tsx\"\nimport type { AnyScopeNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionRepeater, isFormPlainTextInputNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { createVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withVariableBinding } from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport type {\n\tVariableDefinition,\n\tVariableType,\n\tWithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisMultiCollectionReferenceVariableDefinition,\n\tisVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport type React from \"react\"\nimport { useCallback, useMemo } from \"react\"\nimport { getNearestAncestorRepeaterContext } from \"utils/repeaterUtils.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { getCompatibleVariableTypesForNodes, textInputTypeForVariable } from \"./formNodeVariableTypes.ts\"\n\ninterface Props {\n\toriginalNodeIds: NodeID[]\n\tselectedVariable: VariableDefinition | undefined\n\tvariableProvider: (AnyScopeNode & WithVariables) | undefined\n}\n\nexport function FormInputVariableBindingRow({ originalNodeIds, variableProvider, selectedVariable }: Props) {\n\tconst engine = useBaseEngine()\n\n\tconst expectedTypes = useMemo(\n\t\t() => getCompatibleVariableTypesForNodes(engine.tree, originalNodeIds),\n\t\t[originalNodeIds],\n\t)\n\n\tconst compatibleVariables = useMemo(\n\t\t() => getCompatibleVariables(engine.tree, variableProvider, originalNodeIds, expectedTypes),\n\t\t[originalNodeIds, variableProvider, expectedTypes],\n\t)\n\n\tconst variableReference: VariableReference = useMemo(() => {\n\t\tif (!selectedVariable || !variableProvider) {\n\t\t\t// A mock reference intended to force the \"Missing\" state from VariableReferenceButton\n\t\t\treturn { type: \"variableReference\", id: \"\" }\n\t\t}\n\n\t\treturn createVariableReference(selectedVariable.id, variableProvider.id)\n\t}, [selectedVariable, variableProvider])\n\n\tconst handleSelectVariable = useEngineCallback(\n\t\t(variableId: string) => {\n\t\t\tif (!variableProvider) return\n\n\t\t\tconst variable = compatibleVariables.find(({ id }) => id === variableId)\n\t\t\tassert(variable, `Variable ${variableId} not found`)\n\n\t\t\tconst newVariableBinding = createVariableReference(variableId, variableProvider.id)\n\n\t\t\tfor (const nodeId of originalNodeIds) {\n\t\t\t\tconst node = engine.tree.getNode(nodeId)\n\t\t\t\tif (node && withVariableBinding(node)) {\n\t\t\t\t\tassert(node.bindingType === \"variable\", \"Attempt to set a variableBinding on a non-variable-bound input node\")\n\t\t\t\t\tnode.set({ variableBinding: newVariableBinding })\n\n\t\t\t\t\tif (isFormPlainTextInputNode(node)) {\n\t\t\t\t\t\tnode.set({ formTextInputType: textInputTypeForVariable(variable) })\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[originalNodeIds, variableProvider, compatibleVariables],\n\t)\n\n\tconst hasVariables = compatibleVariables.length > 0\n\n\tconst showVariableMenu = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (!hasVariables) return\n\n\t\t\tconst menuItems = compatibleVariables.map(variable => ({\n\t\t\t\tlabel: variable.name,\n\t\t\t\tchecked: variable.id === selectedVariable?.id,\n\t\t\t\tclick: () => handleSelectVariable(variable.id),\n\t\t\t}))\n\n\t\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: { x: bounds.left, y: bounds.bottom },\n\t\t\t})\n\t\t},\n\t\t[compatibleVariables, selectedVariable, handleSelectVariable, hasVariables],\n\t)\n\n\tif (!expectedTypes) return null\n\n\treturn (\n\t\t<PanelRow title={Dictionary.Variable}>\n\t\t\t<VariableReferenceButton\n\t\t\t\texpectedType={expectedTypes}\n\t\t\t\treference={variableReference}\n\t\t\t\tonRemove={undefined}\n\t\t\t\tonShowMenu={hasVariables ? showVariableMenu : undefined}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nexport function getCompatibleVariables(\n\ttree: CanvasTree,\n\tvariableProvider: (AnyScopeNode & WithVariables) | undefined,\n\toriginalNodeIds: NodeID[],\n\texpectedTypes: readonly VariableType[] | undefined,\n): readonly VariableDefinition[] {\n\tif (!variableProvider || !expectedTypes) return []\n\n\tconst compatibleVariables = variableProvider.variables.filter((variable): variable is VariableDefinition => {\n\t\treturn isVariableDefinition(variable) && expectedTypes.includes(variable.type)\n\t})\n\n\tif (!expectedTypes.includes(ControlType.MultiCollectionReference)) return compatibleVariables\n\n\tconst multiRefVariables: VariableDefinition[] = []\n\tconst otherVariables: VariableDefinition[] = []\n\n\tfor (const variable of compatibleVariables) {\n\t\tif (isMultiCollectionReferenceVariableDefinition(variable)) {\n\t\t\tconst isCompatible = originalNodeIds.every(nodeId => {\n\t\t\t\tconst node = tree.getNode(nodeId)\n\t\t\t\tif (!node) return false\n\t\t\t\tconst repeaterContext = getNearestAncestorRepeaterContext(tree, node)\n\t\t\t\tif (!repeaterContext?.inRepeatedChild) return false\n\t\t\t\tif (!isCollectionRepeater(repeaterContext.repeater)) return false\n\t\t\t\treturn repeaterContext.repeater.dataIdentifier === variable.dataIdentifier\n\t\t\t})\n\n\t\t\tif (isCompatible) {\n\t\t\t\tmultiRefVariables.push(variable)\n\t\t\t}\n\t\t} else {\n\t\t\totherVariables.push(variable)\n\t\t}\n\t}\n\n\treturn multiRefVariables.length > 0 ? multiRefVariables : otherVariables\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport { withFormInputAutofillEnabled } from \"document/models/CanvasTree/traits/forms/WithFormInputAutofillEnabled.ts\"\nimport { withFormInputStep } from \"document/models/CanvasTree/traits/forms/WithFormInputStep.ts\"\nimport { withFormTextInputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport type React from \"react\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport type { FormInputPanelProps } from \"./FormInputPanel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ninterface FormInputsHeaderProps extends FormInputPanelProps, OptionalFormPropertyAvailability {}\n\nexport function FormInputsHeader(props: FormInputsHeaderProps) {\n\tconst shouldShowMenu = anyOptionalFormPropertyAvailable(props)\n\n\tconst displayMenu = (event: React.MouseEvent) => {\n\t\tconst isReadOnly = getIsViewOnly(engine, \"canDesign\")\n\n\t\tconst autoFocusPresent = isFoundAndNotUndefined(props.formInputAutoFocus)\n\t\tconst hiddenPresent = isFoundAndNotUndefined(props.formInputHidden)\n\t\tconst minPresent = isFoundAndNotUndefined(props.formTextInputMinNumber)\n\t\tconst maxPresent = isFoundAndNotUndefined(props.formTextInputMaxNumber)\n\t\tconst maxLengthPresent = isFoundAndNotUndefined(props.formInputMaxLength)\n\t\tconst valuePresent = isFoundAndNotUndefined(props.formInputValue)\n\t\tconst stepPresent = isFoundAndNotUndefined(props.formInputStep)\n\t\tconst autofillEnabledPresent = isFoundAndNotUndefined(props.formInputAutofillEnabled)\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Auto Fill\",\n\t\t\t\t\tchecked: autofillEnabledPresent,\n\t\t\t\t\tenabled: !autofillEnabledPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.autofillEnabledAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormInputAutofillEnabled)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputAutofillEnabled: true })\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: \"Auto Focus\",\n\t\t\t\t\tchecked: autoFocusPresent,\n\t\t\t\t\tenabled: !autoFocusPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.autoFocusAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormInput)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputAutoFocus: true })\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: Dictionary.Checked,\n\t\t\t\t\tvisible: props.booleanInputValueAvailable,\n\t\t\t\t\tchecked: true,\n\t\t\t\t\tenabled: false,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Hidden\",\n\t\t\t\t\tchecked: hiddenPresent,\n\t\t\t\t\tenabled: !hiddenPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.hiddenAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormInput)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputHidden: true })\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: Dictionary.MaxLength,\n\t\t\t\t\tchecked: maxLengthPresent,\n\t\t\t\t\tenabled: !maxLengthPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.maxLengthAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormTextInputType)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputMaxLength: 100 })\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: Dictionary.Max,\n\t\t\t\t\tchecked: maxPresent,\n\t\t\t\t\tenabled: !maxPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.maxNumberAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormTextInputType)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formTextInputMaxNumber: 10 })\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: Dictionary.Min,\n\t\t\t\t\tchecked: minPresent,\n\t\t\t\t\tenabled: !minPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.minNumberAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormTextInputType)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formTextInputMinNumber: 0 })\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: Dictionary.Step,\n\t\t\t\t\tchecked: stepPresent,\n\t\t\t\t\tenabled: !stepPresent && !isReadOnly,\n\t\t\t\t\tvisible: props.stepAvailable,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormInputStep)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputStep: 1 })\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: \"Value\",\n\t\t\t\t\tchecked: valuePresent,\n\t\t\t\t\tenabled: !valuePresent && !isReadOnly,\n\t\t\t\t\tvisible: props.valueAvailable && !props.anyRadioButton,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFormInput)\n\t\t\t\t\t\tnodes.forEach(node => {\n\t\t\t\t\t\t\tnode.set({ formInputValue: \"\" })\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\treturn (\n\t\t<PanelSectionHeader\n\t\t\tclickable={shouldShowMenu}\n\t\t\tonMouseDown={shouldShowMenu ? displayMenu : undefined}\n\t\t\ttitle={Dictionary.Input}\n\t\t>\n\t\t\t{shouldShowMenu && (\n\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t)}\n\t\t</PanelSectionHeader>\n\t)\n}\n\ntype OptionalFormProperty =\n\t| \"autofillEnabled\"\n\t| \"autoFocus\"\n\t| \"booleanInputValue\"\n\t| \"hidden\"\n\t| \"maxLength\"\n\t| \"maxNumber\"\n\t| \"minNumber\"\n\t| \"step\"\n\t| \"value\"\n\ntype OptionalFormPropertyAvailability = {\n\t[K in OptionalFormProperty as `${K}Available`]: boolean\n}\n\nconst optionalFormPropertyAvailabilityKeys = objectKeys<OptionalFormPropertyAvailability>({\n\tautofillEnabledAvailable: true,\n\tautoFocusAvailable: true,\n\tbooleanInputValueAvailable: true,\n\thiddenAvailable: true,\n\tmaxLengthAvailable: true,\n\tmaxNumberAvailable: true,\n\tminNumberAvailable: true,\n\tstepAvailable: true,\n\tvalueAvailable: true,\n})\n\nfunction anyOptionalFormPropertyAvailable(props: OptionalFormPropertyAvailability) {\n\treturn optionalFormPropertyAvailabilityKeys.some(key => props[key])\n}\n", "import { assert } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { toFontSizeCSSDimensionString } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport type { WithFormInputFontStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputTextStyles.ts\"\nimport { withFormInputFontStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputTextStyles.ts\"\nimport type { ReducedFormInputIcon } from \"document/models/CanvasTree/traits/utils/reduceFormInputIcon.ts\"\nimport type { ReducedFormInputFontStyles } from \"document/models/CanvasTree/traits/utils/reduceFormInputStyles.ts\"\nimport type { ControlProp, FontControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { FontControlPropValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType, fontStore } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ColorControlPropRow } from \"../codeComponentRows/ColorControlPropRow.tsx\"\nimport type { ControlPropChangeHandler } from \"../codeComponentRows/ControlPropRowChangeHandler.ts\"\nimport { FormFontRow } from \"./FormFontRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\ninterface FormContainerInputStylePopoutProps\n\textends Omit<ReducedFormInputFontStyles, \"onlyNodesWithFormInputFontStyles\">, ReducedFormInputIcon {\n\treadOnly: boolean\n\tnodeIds: NodeID[]\n}\n\nexport function FormInputStyleRows({ nodeIds, ...props }: FormContainerInputStylePopoutProps) {\n\tconst canCopyColor = isString(props.formInputFontColor)\n\n\tconst [canPasteColor, pasteColor, copyColor] = useCopyAndPasteSingleProperty(\n\t\tTraitType.FormInputColor,\n\t\tnodeIds,\n\t\tcanCopyColor,\n\t)\n\n\tconst onChangeInputTextStyles = useEngineCallback(\n\t\t(update: Partial<WithFormInputFontStyles>) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFontStyles)) {\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleFontChange: ControlPropChangeHandler<ControlType.Font> = useEngineCallback(\n\t\t(_: string, getUpdate: (current: FontControlProp) => FontControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFontStyles)) {\n\t\t\t\tconst currentValue: FontControlPropValue = {\n\t\t\t\t\tfontSelector: node.formInputFontSelector ? node.formInputFontSelector : \"\",\n\t\t\t\t\tfontSize: isUndefined(node.formInputFontSize)\n\t\t\t\t\t\t? node.formInputFontSize\n\t\t\t\t\t\t: toFontSizeCSSDimensionString(node.formInputFontSize),\n\t\t\t\t\tletterSpacing:\n\t\t\t\t\t\tisNumber(node.formInputFontLetterSpacing) && isString(node.formInputFontLetterSpacingUnit)\n\t\t\t\t\t\t\t? [node.formInputFontLetterSpacing, node.formInputFontLetterSpacingUnit]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tlineHeight:\n\t\t\t\t\t\tisNumber(node.formInputFontLineHeight) && isString(node.formInputFontLineHeightUnit)\n\t\t\t\t\t\t\t? [node.formInputFontLineHeight, node.formInputFontLineHeightUnit]\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\ttextAlignment: node.formInputFontTextAlignment,\n\t\t\t\t\topenTypeFontFeatures: node.formInputOpenTypeFontFeatures,\n\t\t\t\t\tvariationAxes: node.formInputVariationAxes,\n\t\t\t\t}\n\t\t\t\tconst update = getUpdate({ type: ControlType.Font, value: currentValue })\n\t\t\t\tconst value = update.value\n\t\t\t\tif (!value) return\n\t\t\t\tconst font = fontStore.getFontBySelector(value.fontSelector)\n\t\t\t\tif (!font) return\n\t\t\t\tnode.set({\n\t\t\t\t\tformInputFontSelector: value.fontSelector,\n\t\t\t\t\tformInputFontSize: value.fontSize,\n\t\t\t\t\tformInputFontFamily: font.cssFamilyName,\n\t\t\t\t\tformInputFontWeight: font.weight,\n\t\t\t\t\tformInputFontStyle: font.style,\n\t\t\t\t\tformInputFontLetterSpacing: value.letterSpacing ? value.letterSpacing[0] : undefined,\n\t\t\t\t\tformInputFontLetterSpacingUnit: value.letterSpacing ? value.letterSpacing[1] : undefined,\n\t\t\t\t\tformInputFontLineHeight: value.lineHeight ? value.lineHeight[0] : undefined,\n\t\t\t\t\tformInputFontLineHeightUnit: value.lineHeight ? value.lineHeight[1] : undefined,\n\t\t\t\t\tformInputFontTextAlignment: value.textAlignment,\n\t\t\t\t\tformInputOpenTypeFontFeatures: value.openTypeFontFeatures,\n\t\t\t\t\tformInputVariationAxes: value.variationAxes,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleFontColorChange = useCallback(\n\t\t({ value }: ControlProp) => {\n\t\t\tassert(isString(value), \"expected a string\")\n\t\t\tonChangeInputTextStyles({ formInputFontColor: value })\n\t\t},\n\t\t[onChangeInputTextStyles],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<FormFontRow\n\t\t\t\tpopoutId=\"form-input-font-popout\"\n\t\t\t\tfontSize={props.formInputFontSize}\n\t\t\t\tfontSizeUnit={props.formInputFontSizeUnit}\n\t\t\t\tfontFamily={props.formInputFontFamily}\n\t\t\t\tfontSelector={props.formInputFontSelector}\n\t\t\t\tfontLetterSpacing={props.formInputFontLetterSpacing}\n\t\t\t\tfontLetterSpacingUnit={props.formInputFontLetterSpacingUnit}\n\t\t\t\tfontLineHeight={props.formInputFontLineHeight}\n\t\t\t\tfontLineHeightUnit={props.formInputFontLineHeightUnit}\n\t\t\t\tfontTextAlignment={props.formInputFontTextAlignment}\n\t\t\t\topenTypeFontFeatures={props.formInputOpenTypeFontFeatures}\n\t\t\t\tvariationAxes={props.formInputVariationAxes}\n\t\t\t\tonChange={handleFontChange}\n\t\t\t\ttraitType={TraitType.FormInputFont}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\n\t\t\t<ColorControlPropRow\n\t\t\t\tcontrolKey=\"input-color\"\n\t\t\t\tcontrol={{ title: \"Color\", type: ControlType.Color }}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: props.formInputFontColor ?? null,\n\t\t\t\t\ttype: ControlType.Color,\n\t\t\t\t}}\n\t\t\t\tonChange={handleFontColorChange}\n\t\t\t\tonCopy={copyColor}\n\t\t\t\tonPaste={pasteColor}\n\t\t\t\tcopyEnabled={canCopyColor}\n\t\t\t\tpasteEnabled={canPasteColor}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\t\t</>\n\t)\n}\n", "import { assert, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { createComputedValue, isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { createFetchDataValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { getFallbackValue } from \"document/models/CanvasTree/traits/utils/codeComponentProps.ts\"\nimport type { ColorControlProp, ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedColorControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ColorControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useId, useMemo } from \"react\"\nimport { blurActiveElementAndPreventFocus } from \"utils/blurOnMouseDownAndPreventFocus.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { ColorPickerTrackingMetadata } from \"../../shared/ColorPicker/ColorPickerPopout.tsx\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport type { SupportsFetchDataValuesProps } from \"./WithSupportsFetchDataValuesProps.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\nconst controlType = ControlType.Color\n\nconst trackingMetaData: ColorPickerTrackingMetadata = {\n\tnodeType: \"CodeComponentNode\",\n\tnodeProperty: \"codeComponentProps\",\n}\n\ntype Props = SupportsFetchDataValuesProps & {\n\tcontrolKey: string\n\tcontrol: ColorControlDescription\n\tcontrolProp: ReducedColorControlProp\n\tdefaultValue?: ColorControlProp[\"value\"]\n\tonChange: (newValue: ControlProp, prop: string) => void\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n\tsortable?: boolean\n\tdisplayInPopover?: boolean\n\ttraitTypeKeys?: string[]\n\tsupportsVariables?: boolean\n\tsupportsComputedValues?: boolean\n\tpopoutId?: string\n\tonCopy?: () => void\n\tonPaste?: () => void\n\tpasteEnabled?: boolean | (() => Promise<boolean>)\n\tcopyEnabled?: boolean | (() => boolean)\n\tpreviewType?: \"fill\" | \"color\"\n\tallowP3?: boolean\n}\n\nexport function ColorControlPropRow({\n\tcontrol,\n\tcontrolKey,\n\tcontrolProp,\n\tdefaultValue: defaultValueOverride,\n\tonChange,\n\tonContextMenu,\n\tsortable,\n\ttraitTypeKeys,\n\tsupportsVariables = false,\n\tsupportsComputedValues = false,\n\tsupportsFetchDataValues = false,\n\tpopoutId,\n\tnodeIds: externalNodeIds,\n\tonCopy,\n\tonPaste,\n\tcopyEnabled,\n\tpasteEnabled,\n\tpreviewType = \"fill\",\n\tallowP3,\n}: Props) {\n\tconst { value } = controlProp\n\tconst title = control.title || titleCase(controlKey)\n\tconst defaultValue = isString(control.defaultValue) ? control.defaultValue : undefined\n\tconst isOptional = Boolean(control.optional)\n\n\tconst fallbackPopoutId = useId()\n\tconst computedValuePopoutId = useId()\n\n\tpopoutId ??= fallbackPopoutId\n\n\tconst nodeIds = useMemo(() => externalNodeIds ?? [], [externalNodeIds])\n\n\tconst changeValue = useCallback(\n\t\t(newValue: string | null | DynamicValue) => {\n\t\t\tonChange({ type: control.type, value: newValue }, controlKey)\n\t\t},\n\t\t[onChange, controlKey, control],\n\t)\n\n\tconst clearValue = useCallback(() => {\n\t\tassert(control.optional, \"Only optional controls can be cleared\")\n\t\tchangeValue(null)\n\t}, [changeValue, control])\n\n\tconst clearValueAndPreventFocus = useCallback(\n\t\t(event: React.MouseEvent | React.KeyboardEvent | undefined) => {\n\t\t\tblurActiveElementAndPreventFocus(event)\n\t\t\tclearValue()\n\t\t},\n\t\t[clearValue],\n\t)\n\n\tconst addColor = useCallback(() => {\n\t\tconst newValue = defaultValueOverride ?? defaultValue ?? getFallbackValue(control.type)\n\t\tchangeValue(newValue)\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(popoutId)\n\t}, [changeValue, defaultValue, defaultValueOverride, popoutId, control])\n\n\tconst resetToDefault = useCallback(() => {\n\t\tif (isString(defaultValue)) {\n\t\t\tchangeValue(defaultValue)\n\t\t}\n\t}, [changeValue, defaultValue])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst name = control.title || titleCase(controlKey)\n\t\t\tconst initialValue = isString(value) ? value : (defaultValue ?? \"white\")\n\t\t\tconst variableRef = createVariableInScope({ engine, scopeId, type: controlType, name, initialValue })\n\t\t\tif (variableRef) changeValue(variableRef)\n\t\t},\n\t\t[changeValue, control, value, defaultValue, controlKey],\n\t)\n\n\tconst selectComputedValue = useCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tchangeValue(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(computedValuePopoutId)\n\t\t},\n\t\t[changeValue, computedValuePopoutId],\n\t)\n\n\tconst selectFetchDataValue = useCallback(() => {\n\t\tconst fetchValue = createFetchDataValue({\n\t\t\ttype: ControlType.Color,\n\t\t\tvalue: isString(value) ? value : (defaultValue ?? \"white\"),\n\t\t})\n\n\t\tconst computedValue = createComputedValue(ControlType.Color, fetchValue, [])\n\t\tselectComputedValue(computedValue)\n\n\t\treturn computedValue\n\t}, [selectComputedValue, value, defaultValue])\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(value)) return\n\n\t\tif (isVariableReference(value)) {\n\t\t\tconst variableValue = getVariableValue(engine, value)\n\t\t\tconst newValue = isString(variableValue) ? variableValue : (defaultValue ?? \"white\")\n\t\t\tchangeValue(newValue)\n\t\t} else if (isComputedValue(value)) {\n\t\t\tchangeValue(defaultValue ?? \"white\")\n\t\t} else {\n\t\t\tshouldBeNever(value)\n\t\t}\n\t}, [changeValue, value, defaultValue])\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={sortable ? undefined : title}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonResetToDefault={!sortable ? resetToDefault : undefined}\n\t\t\tresetToDefaultEnabled={isString(defaultValue) && defaultValue !== value}\n\t\t\tvariableType={supportedVariableTypesByControlType[controlType]}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\tonSelectVariable={changeValue}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\twithReorderControl={sortable}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tsupportsComputedValues={supportsComputedValues}\n\t\t\tcomputedValuePopoutId={computedValuePopoutId}\n\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t\tsupportsFetchDataValues={supportsFetchDataValues}\n\t\t\tonSelectFetchDataValue={selectFetchDataValue}\n\t\t\treorderColumnCount={2}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\tdeleteEnabled={isOptional && value !== null}\n\t\t\tdeleteTitle={Dictionary.Clear}\n\t\t\tonDelete={clearValue}\n\t\t>\n\t\t\t{isDynamicValue(value) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={control}\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[controlType]}\n\t\t\t\t\tpopoutId={computedValuePopoutId}\n\t\t\t\t\tonChangeDynamicValue={changeValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tsupportsFetchDataValues={supportsFetchDataValues}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t/>\n\t\t\t) : isVariableReference(controlProp.value) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[controlType]}\n\t\t\t\t\treference={controlProp.value}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{isOptional && !value ? (\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type={previewType} onClick={addColor} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ColorPopoutButton\n\t\t\t\t\t\t\tid={popoutId}\n\t\t\t\t\t\t\tnavigationTitle={title}\n\t\t\t\t\t\t\tvalue={isString(value) ? value : \"\"}\n\t\t\t\t\t\t\tonChange={changeValue}\n\t\t\t\t\t\t\tonDelete={isOptional ? clearValueAndPreventFocus : undefined}\n\t\t\t\t\t\t\ttrackingMetadata={trackingMetaData}\n\t\t\t\t\t\t\tsortable={sortable}\n\t\t\t\t\t\t\tdeleteTitle={Dictionary.Clear}\n\t\t\t\t\t\t\tallowP3={allowP3}\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</PanelRow>\n\t)\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type {\n\tFontSizeUnit,\n\tLetterSpacingUnit,\n\tLineHeightUnit,\n\tTextAlignment,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isLineHeightUnit } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFoundAndNotMixed, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type {\n\tReducedFormInputFontSelectors,\n\tReducedFormInputOpenTypeFontFeatures,\n\tReducedFormInputVariationAxes,\n} from \"document/models/CanvasTree/traits/utils/reduceFormInputStyles.ts\"\nimport type { ReducedFontValue } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { FontControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { useMemo } from \"react\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlPropChangeHandler } from \"../codeComponentRows/ControlPropRowChangeHandler.ts\"\nimport { FontControlPropRow } from \"../codeComponentRows/FontControlPropRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\nconst emptyObject = {}\n\ninterface Props {\n\tpopoutId: string\n\tfontSize: Reduced<number>\n\tfontSizeUnit: Reduced<FontSizeUnit>\n\tfontFamily: Reduced<string | undefined>\n\tfontSelector: ReducedFormInputFontSelectors\n\tfontLineHeight: Reduced<number | undefined>\n\tfontLineHeightUnit: Reduced<string | undefined>\n\tfontTextAlignment: Reduced<TextAlignment | undefined>\n\tfontLetterSpacing: Reduced<number | undefined>\n\tfontLetterSpacingUnit: Reduced<LetterSpacingUnit | undefined>\n\topenTypeFontFeatures: ReducedFormInputOpenTypeFontFeatures\n\tvariationAxes: ReducedFormInputVariationAxes\n\tonChange: ControlPropChangeHandler<ControlType.Font>\n\ttraitType: TraitType\n\tnodeIds: NodeID[]\n}\n\nconst control: FontControlDescription = {\n\ttype: ControlType.Font,\n\tcontrols: \"extended\",\n\ttitle: \"Font\",\n\tdisplayFontSize: true,\n\tdisplayTextAlignment: true,\n\t// defaultFontType is necessary to ensure that the font control cannot\n\t// be cleared by the user.\n\tdefaultFontType: \"sans-serif\",\n}\n\nexport function FormFontRow({\n\tpopoutId,\n\tfontSelector,\n\tfontFamily,\n\tfontSize,\n\tfontSizeUnit,\n\tfontLetterSpacing,\n\tfontLetterSpacingUnit,\n\tfontLineHeight,\n\tfontLineHeightUnit,\n\tfontTextAlignment,\n\topenTypeFontFeatures,\n\tvariationAxes,\n\tonChange,\n\ttraitType,\n\tnodeIds,\n}: Props) {\n\tconst canCopy = isString(fontSelector) && isString(fontFamily) && isNumber(fontSize)\n\n\tconst [canPaste, paste, copy] = useCopyAndPasteSingleProperty(traitType, nodeIds, canCopy)\n\n\tconst fontSizeUnits = useMemo((): Set<FontSizeUnit> => {\n\t\tconst set = new Set<FontSizeUnit>()\n\t\tif (isFoundAndNotMixed(fontSizeUnit)) {\n\t\t\tset.add(fontSizeUnit)\n\t\t}\n\t\treturn set\n\t}, [fontSizeUnit])\n\n\tconst letterSpacingUnits = useMemo(() => {\n\t\tconst set = new Set<LetterSpacingUnit>()\n\t\tif (isFoundAndNotMixed(fontLetterSpacingUnit) && !isUndefined(fontLetterSpacingUnit)) {\n\t\t\tset.add(fontLetterSpacingUnit)\n\t\t}\n\t\treturn set\n\t}, [fontLetterSpacingUnit])\n\n\tconst lineHeightUnits = useMemo(() => {\n\t\tconst set = new Set<LineHeightUnit>()\n\t\tif (isLineHeightUnit(fontLineHeightUnit)) {\n\t\t\tset.add(fontLineHeightUnit)\n\t\t}\n\t\treturn set\n\t}, [fontLineHeightUnit])\n\n\tconst foundOpenTypeFontFeatures = useMemo(\n\t\t() => (isNotFound(openTypeFontFeatures) ? emptyObject : openTypeFontFeatures),\n\t\t[openTypeFontFeatures],\n\t)\n\n\tconst foundVariationAxes = useMemo(() => (isNotFound(variationAxes) ? emptyObject : variationAxes), [variationAxes])\n\n\tif (isNotFound(fontSelector)) {\n\t\treturn null\n\t}\n\n\tconst controlPropValue: ReducedFontValue = {\n\t\tfontSizeValue: fontSize,\n\t\tfontSizeUnits,\n\t\tfontSelector,\n\t\tletterSpacingUnits,\n\t\tletterSpacingValue: fontLetterSpacing,\n\t\tlineHeightUnits,\n\t\tlineHeightValue: fontLineHeight,\n\t\ttextAlignment: fontTextAlignment,\n\t\topenTypeFontFeatures: foundOpenTypeFontFeatures,\n\t\tvariationAxes: foundVariationAxes,\n\t}\n\n\treturn (\n\t\t<FontControlPropRow\n\t\t\tcontrolKey=\"form-input-font\"\n\t\t\tnodeIds={nodeIds}\n\t\t\tcontrol={control}\n\t\t\tcontrolProp={{\n\t\t\t\ttype: ControlType.Font,\n\t\t\t\tvalue: controlPropValue,\n\t\t\t}}\n\t\t\tonChange={onChange}\n\t\t\tcopyEnabled={canCopy}\n\t\t\tpopoutId={popoutId}\n\t\t\tpasteEnabled={canPaste}\n\t\t\tonCopy={copy}\n\t\t\tonPaste={paste}\n\t\t/>\n\t)\n}\n", "import type { LineHeightUnit } from \"@framerjs/document-migrations/src/types/V79.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { PanelRowResetReplicaOverridesOptions } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport { getClosestToRegularFont } from \"document/components/utils/getClosestToRegularFont.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tFontSizeCSSDimension,\n\tFontSizeUnit,\n\tLetterSpacing,\n\tLetterSpacingUnit,\n\tLineHeight,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { convertFontSizeValue } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { withFormInputFontStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputTextStyles.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { OpenTypeFeatureTag, OpenTypeFontFeatures } from \"document/models/CanvasTree/utils/openType.ts\"\nimport type { FontControlPropValue, FontValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport { defaultFontValuesForOptionalKeys, isFontValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport type { ReducedFontControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport type { ReadonlyFontFamily } from \"library/render/fonts/types.ts\"\nimport type { FontControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getSimilarFontForSelector, letterSpacingDefaultValue } from \"../panels/utils/textStyle.ts\"\nimport type { ControlPropChangeHandler } from \"./ControlPropRowChangeHandler.ts\"\nimport type { FontValueUpdate } from \"./FontPopout.tsx\"\nimport { FontPopoutButton } from \"./FontPopout.tsx\"\n\ninterface Props extends PanelRowResetReplicaOverridesOptions {\n\tcontrolKey: string\n\tcontrol: FontControlDescription\n\tcontrolProp: ReducedFontControlProp\n\tonChange: ControlPropChangeHandler<ControlType.Font>\n\tnodeIds: NodeID[]\n\tpopoutId?: string\n\tonCopy?: () => void\n\tonPaste?: () => void\n\tpasteEnabled?: boolean | (() => Promise<boolean>)\n\tcopyEnabled?: boolean | (() => boolean)\n}\n\nexport function FontControlPropRow({\n\tcontrol,\n\tcontrolKey,\n\tpopoutId: externalPopoutId,\n\tonChange,\n\tnodeIds,\n\tcontrolProp: { value: font },\n\tonCopy,\n\tonPaste,\n\tcopyEnabled,\n\tpasteEnabled,\n}: Props) {\n\tconst popoutId = useMemo(() => externalPopoutId ?? randomID(), [externalPopoutId])\n\n\tconst updateFontValue = useCallback(\n\t\t(update: FontValueUpdate) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrent => {\n\t\t\t\t\tconst value = updatedValue(control, current.value, update)\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Font,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[controlKey, nodeIds, onChange, control],\n\t)\n\n\tconst onDelete = useCallback(() => {\n\t\tonChange(controlKey, () => ({ type: ControlType.Font, value: undefined }), nodeIds)\n\t}, [controlKey, nodeIds, onChange])\n\n\tconst onAdd = useCallback(() => {\n\t\tonChange(\n\t\t\tcontrolKey,\n\t\t\t(current: { type: ControlType.Font; value: FontValue }) => {\n\t\t\t\tif (!isUndefined(current.value)) return current\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Font,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tfontSelector: engine.stores.documentSettingsStore.defaultTextStyle.font,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t},\n\t\t\tnodeIds,\n\t\t)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}, [popoutId, onChange, nodeIds, controlKey])\n\n\tconst onHighlightFontFamily = useCallback(\n\t\t(fontFamily: ReadonlyFontFamily) => {\n\t\t\tif (!experiments.isOn(\"fontPreview\")) return\n\n\t\t\tconst defaultSelector = getClosestToRegularFont(fontFamily).selector\n\t\t\tconst fontSelectorsByNodeId = new Map<NodeID, string>()\n\n\t\t\tfor (const nodeId of nodeIds) {\n\t\t\t\tconst node = engine.tree.get(nodeId)\n\t\t\t\tif (!node) continue\n\n\t\t\t\tlet currentSelector: string | undefined\n\n\t\t\t\tif (isCodeComponentNode(node)) {\n\t\t\t\t\tconst controlPropKey = prefixControlPropKey(controlKey)\n\t\t\t\t\tconst fontValue = node[controlPropKey]?.value as FontValue | undefined\n\t\t\t\t\tcurrentSelector = fontValue?.fontSelector\n\t\t\t\t} else if (withFormInputFontStyles(node)) {\n\t\t\t\t\tcurrentSelector = node.formInputFontSelector\n\t\t\t\t} else {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst previewSelector = getSimilarFontForSelector(currentSelector, fontFamily)?.selector ?? defaultSelector\n\t\t\t\tfontSelectorsByNodeId.set(nodeId, previewSelector)\n\t\t\t}\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.fontPreviewStore.enterPreview(fontSelectorsByNodeId, controlKey)\n\t\t\t})\n\t\t},\n\t\t[nodeIds, controlKey],\n\t)\n\n\tconst onHighlightEnd = useCallback(() => {\n\t\tif (!experiments.isOn(\"fontPreview\")) return\n\t\tengine.scheduler.processWhenReady(engine.stores.fontPreviewStore.exitPreview)\n\t}, [])\n\n\tconst onChangeFontFamily = useCallback(\n\t\t(fontFamily: ReadonlyFontFamily) => {\n\t\t\tconst defaultFont = getClosestToRegularFont(fontFamily)\n\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\tcurrent => {\n\t\t\t\t\tconst currentFontValue = current.value\n\t\t\t\t\tconst newSelector =\n\t\t\t\t\t\tgetSimilarFontForSelector(currentFontValue?.fontSelector, fontFamily)?.selector ?? defaultFont.selector\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Font,\n\t\t\t\t\t\tvalue: updatedValue(control, currentFontValue, { fontSelector: newSelector }),\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[control, controlKey, nodeIds, onChange],\n\t)\n\n\tconst title = control.title || titleCase(controlKey)\n\tconst canDelete = !isUndefined(font) && isUndefined(control.defaultFontType)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\tonDelete={onDelete}\n\t\t\tdeleteEnabled={canDelete}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t>\n\t\t\t<FontPopoutButton\n\t\t\t\ttitle={title || \"Font\"}\n\t\t\t\tfont={font}\n\t\t\t\tonChange={updateFontValue}\n\t\t\t\tonChangeFontFamily={onChangeFontFamily}\n\t\t\t\tonDelete={canDelete ? onDelete : undefined}\n\t\t\t\tonAdd={onAdd}\n\t\t\t\tpopoutId={popoutId}\n\t\t\t\tcontrol={control}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonHighlightFontFamily={onHighlightFontFamily}\n\t\t\t\tonHighlightEnd={onHighlightEnd}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n\nfunction updatedValue(\n\tcontrol: FontControlDescription,\n\tcurrent: FontControlPropValue,\n\tupdate: FontValueUpdate,\n): FontControlPropValue {\n\tconst {\n\t\tlineHeightValue,\n\t\tlineHeightUnit,\n\t\tletterSpacingValue,\n\t\tletterSpacingUnit,\n\t\topenTypeFontFeatures,\n\t\tfontSizeValue,\n\t\tfontSizeUnit,\n\t\tvariationAxes,\n\t\t...value\n\t} = update\n\tconst currentFontSize = current?.fontSize\n\tconst fontSize = updatedFontSize(currentFontSize, fontSizeValue, fontSizeUnit)\n\tconst lineHeight = updatedLineHeight(current?.lineHeight, lineHeightValue, lineHeightUnit)\n\tconst currentLetterSpacing = current?.letterSpacing\n\tconst letterSpacing = updatedLetterSpacing(currentLetterSpacing, letterSpacingValue, letterSpacingUnit)\n\n\tconst newOpenTypeFontFeatures =\n\t\t\"openTypeFontFeatures\" in update\n\t\t\t? updateOpenTypeFontFeatures(current?.openTypeFontFeatures, openTypeFontFeatures)\n\t\t\t: current?.openTypeFontFeatures\n\n\tconst newVariationAxes = \"variationAxes\" in update ? variationAxes : current?.variationAxes\n\n\tconst result = {\n\t\t...current,\n\t\t...value,\n\t\tfontSize,\n\t\tlineHeight,\n\t\tletterSpacing,\n\t\topenTypeFontFeatures: newOpenTypeFontFeatures,\n\t\tvariationAxes: newVariationAxes,\n\t}\n\tif (!isFontValue(result)) {\n\t\treturn\n\t}\n\n\tif (result.fontSize) {\n\t\tconst [_, unit] = parseCSSDimension(result.fontSize)\n\t\trecord(\"preset_font_size_update\", { unit })\n\t}\n\n\treturn defaultFontValuesForOptionalKeys(control, result)\n}\n\nfunction updateOpenTypeFontFeatures(\n\tcurrent: OpenTypeFontFeatures | undefined,\n\topenTypeFontFeature: FontValueUpdate[\"openTypeFontFeatures\"],\n) {\n\tif (isUndefined(openTypeFontFeature)) {\n\t\treturn undefined\n\t}\n\n\tconst newOpenTypeFontFeatures: Set<OpenTypeFeatureTag> | undefined = new Set(current)\n\tif (openTypeFontFeature.toggle) {\n\t\tnewOpenTypeFontFeatures.add(openTypeFontFeature.featureTag)\n\t} else {\n\t\tnewOpenTypeFontFeatures.delete(openTypeFontFeature.featureTag)\n\t}\n\n\treturn Array.from(newOpenTypeFontFeatures)\n}\n\nexport function updatedFontSize(\n\tcurrent: FontSizeCSSDimension | undefined,\n\tfontSizeValue: number | undefined,\n\tfontSizeUnit: FontSizeUnit | undefined,\n): FontSizeCSSDimension | undefined {\n\tif (isUndefined(fontSizeValue)) {\n\t\tif (isUndefined(fontSizeUnit) || isUndefined(current)) {\n\t\t\treturn current\n\t\t}\n\t\t// If the unit is being changed, we should do a simple conversion\n\t\t// so 20 px does not become 20 rem.\n\t\tconst [curValue, curUnit] = parseCSSDimension(current)\n\t\tconst convertedFontSizeValue = convertFontSizeValue(curValue, curUnit, fontSizeUnit)\n\t\treturn createCSSDimension(convertedFontSizeValue, fontSizeUnit)\n\t}\n\tif (isUndefined(fontSizeUnit)) {\n\t\tif (isUndefined(current)) {\n\t\t\t// When we set a value without a unit, give it a default unit\n\t\t\treturn createCSSDimension(fontSizeValue, \"px\")\n\t\t}\n\t\tconst [_, curUnit] = parseCSSDimension(current)\n\t\treturn createCSSDimension(fontSizeValue, curUnit)\n\t}\n\treturn createCSSDimension(fontSizeValue, fontSizeUnit)\n}\n\nfunction updatedLineHeight(\n\tcurrent: LineHeight | undefined,\n\tlineHeightValue: number | undefined,\n\tlineHeightUnit: LineHeightUnit | undefined,\n): LineHeight | undefined {\n\tif (isUndefined(lineHeightValue)) {\n\t\tif (isUndefined(lineHeightUnit) || isUndefined(current)) {\n\t\t\treturn current\n\t\t}\n\t\treturn [current[0], lineHeightUnit]\n\t}\n\tif (isUndefined(lineHeightUnit)) {\n\t\tif (isUndefined(current)) {\n\t\t\t// When we set a value without a unit, give it a default unit\n\t\t\treturn [lineHeightValue, \"em\"]\n\t\t}\n\t\treturn [lineHeightValue, current[1]]\n\t}\n\treturn [lineHeightValue, lineHeightUnit]\n}\n\nfunction updatedLetterSpacing(\n\tcurrent: LetterSpacing | undefined,\n\tletterSpacingValue: number | undefined,\n\tletterSpacingUnit: LetterSpacingUnit | undefined,\n): LetterSpacing | undefined {\n\tif (isUndefined(letterSpacingValue)) {\n\t\tif (isUndefined(letterSpacingUnit) || isUndefined(current)) {\n\t\t\treturn current\n\t\t}\n\n\t\tconst [value, unit] = current\n\t\t// Reset value back to 0 when switching unit\n\t\treturn [unit === letterSpacingUnit ? value : letterSpacingDefaultValue, letterSpacingUnit]\n\t}\n\n\tif (isUndefined(letterSpacingUnit)) {\n\t\tif (isUndefined(current)) {\n\t\t\t// When we set a value without a unit, give it a default unit\n\t\t\treturn [letterSpacingValue, \"px\"]\n\t\t}\n\t\treturn [letterSpacingValue, current[1]]\n\t}\n\treturn [letterSpacingValue, letterSpacingUnit]\n}\n", "import type { LineHeightUnit } from \"@framerjs/document-migrations/src/types/V79.ts\"\nimport { IconTextStylePreset, Stack } from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type { Mixed } from \"@framerjs/shared\"\nimport { isMixed, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FontSizeUnit, LetterSpacingUnit, TextAlignment } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport type { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFound, isFoundAndNotMixed, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { FontSelectors, ReducedFontVariationAxes } from \"document/models/CanvasTree/traits/utils/reduceText.ts\"\nimport type { OpenTypeFeatureTag } from \"document/models/CanvasTree/utils/openType.ts\"\nimport type { VariationAxesToValues, VariationAxisTag } from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport {\n\tgetFontVariantChanges,\n\tgetNonVariableFontSelector,\n\tisFontVariable,\n} from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport type { FontValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport type { ReducedFontValue } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { ReadonlyFont, ReadonlyFontFamily, ReadonlyFontVariationAxes } from \"library/render/fonts/types.ts\"\nimport type { FontControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React, { useEffect, useMemo } from \"react\"\nimport { containsMixedValue } from \"utils/containsMixedValue.ts\"\nimport { isDefined, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { useForceUpdate } from \"utils/useForceUpdate.ts\"\nimport { doubleColumn } from \"../../properties/utils/doubleColumn.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport {\n\tgetFontSizeUnitFromValue,\n\tgetLetterSpacingUnitFromValue,\n\tgetLineHeightUnitFromValue,\n\tsupportedFontSizeUnits,\n} from \"../panels/utils/textStyle.ts\"\nimport { FontRow } from \"../rows/FontRow.tsx\"\nimport { FontSizeRow } from \"../rows/FontSizeRow.tsx\"\nimport { LetterSpacingRow } from \"../rows/LetterSpacingRow.tsx\"\nimport { LineHeightRow } from \"../rows/LineHeightRow.tsx\"\nimport { OpenTypeRow } from \"../rows/OpenTypeRow.tsx\"\nimport { supportsOpenTypeFontFeature } from \"../rows/OpenTypeRow/utils/supportsOpenTypeFontFeature.ts\"\nimport { TextAlignmentRow } from \"../rows/TextAlignmentRow.tsx\"\nimport { VariableFontRow } from \"../rows/VariableFontRow/VariableFontRow.tsx\"\n\nexport type FontValueUpdate = Partial<\n\tOmit<FontValue, \"fontSize\" | \"lineHeight\" | \"letterSpacing\" | \"openTypeFontFeatures\" | \"variationAxes\"> & {\n\t\tfontSizeValue: number\n\t\tfontSizeUnit: FontSizeUnit\n\t\tlineHeightValue: number\n\t\tlineHeightUnit: LineHeightUnit\n\t\tletterSpacingValue: number\n\t\tletterSpacingUnit: LetterSpacingUnit\n\t\topenTypeFontFeatures: {\n\t\t\tfeatureTag: OpenTypeFeatureTag\n\t\t\ttoggle: boolean\n\t\t}\n\t\tvariationAxes: VariationAxesToValues | undefined\n\t}\n>\ninterface Props {\n\ttitle: string\n\tfont: ReducedFontValue\n\tpopoutId: string\n\tonChange: (font: FontValueUpdate) => void\n\tonChangeFontFamily: (fontFamily: ReadonlyFontFamily) => void\n\tonDelete?: () => void\n\tonAdd: () => void\n\tcontrol: FontControlDescription\n\tnodeIds: NodeID[]\n\tonHighlightFontFamily?: (fontFamily: ReadonlyFontFamily) => void\n\tonHighlightEnd?: () => void\n}\n\nexport function FontPopoutButton({\n\tfont: reducedFont,\n\ttitle,\n\tonChange,\n\tonChangeFontFamily,\n\tonAdd,\n\tonDelete,\n\tpopoutId,\n\tcontrol,\n\tnodeIds,\n\tonHighlightFontFamily,\n\tonHighlightEnd,\n}: Props) {\n\tconst font = getValueOfReducedFont(reducedFont)\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tuseLoadMissingFonts(font?.fontSelector)\n\treturn (\n\t\t<div style={doubleColumn}>\n\t\t\t{isUndefined(font) ? (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"font\" onClick={onAdd} />\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={popoutId}\n\t\t\t\t\ttitle={labelForFont(font)}\n\t\t\t\t\tnavigationTitle={title}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<FontPopout\n\t\t\t\t\t\t\tvalue={font}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonChangeFontFamily={onChangeFontFamily}\n\t\t\t\t\t\t\tcontrol={control}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\tonHighlightFontFamily={onHighlightFontFamily}\n\t\t\t\t\t\t\tonHighlightEnd={onHighlightEnd}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper background={colors.tint} strokedIcon={agentExperimentEnabled}>\n\t\t\t\t\t\t\t<IconTextStylePreset compact={agentExperimentEnabled} />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t\tstrokedIconPreview={agentExperimentEnabled}\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nfunction labelForFont(font: Exclude<ReducedFontValue, undefined>): string {\n\tif (isMixed(font)) return Dictionary.Mixed\n\n\tif (isNotFound(font) || isNotFound(font.fontSelector)) return Dictionary.AddEllipsis\n\n\tif (font.fontSelector.size > 1) return Dictionary.Mixed\n\n\tif (\n\t\tisMixed(font.fontSizeValue) ||\n\t\tisMixed(font.lineHeightValue) ||\n\t\tisMixed(font.letterSpacingValue) ||\n\t\tisMixed(font.textAlignment)\n\t) {\n\t\treturn Dictionary.Mixed\n\t}\n\n\tif (containsMixedValue(font.openTypeFontFeatures)) {\n\t\treturn Dictionary.Mixed\n\t}\n\n\tconst [firstSelector] = font.fontSelector\n\tif (!firstSelector) return Dictionary.AddEllipsis\n\n\tconst fontData = fontStore.getFontBySelector(firstSelector)\n\tif (!fontData) return \"Loading\u2026\"\n\n\treturn fontData.family.name\n}\n\nfunction getValueOfReducedFont(reducedFont: ReducedFontValue): Exclude<ReducedFontValue, Mixed | NotFound> | undefined {\n\tif (isUndefined(reducedFont) || !isFoundAndNotMixed(reducedFont)) {\n\t\treturn\n\t}\n\treturn reducedFont\n}\n\ninterface FontPopoutProps {\n\tvalue: Exclude<ReducedFontValue, undefined | Mixed | NotFound>\n\tonChange: (font: FontValueUpdate) => void\n\tonChangeFontFamily: (fontFamily: ReadonlyFontFamily) => void\n\tpopoutId?: string\n\tcontrol: FontControlDescription\n\tnodeIds: NodeID[]\n\tonHighlightFontFamily?: (fontFamily: ReadonlyFontFamily) => void\n\tonHighlightEnd?: () => void\n}\n\nconst FontPopout = React.memo(function FontPopout({\n\tvalue,\n\tpopoutId,\n\tonChange,\n\tonChangeFontFamily,\n\tcontrol,\n\tnodeIds,\n\tonHighlightFontFamily,\n\tonHighlightEnd,\n}: FontPopoutProps) {\n\tconst {\n\t\tfontSelector,\n\t\tfontSizeValue,\n\t\tfontSizeUnits,\n\t\tlineHeightValue,\n\t\tlineHeightUnits,\n\t\ttextAlignment,\n\t\tletterSpacingValue,\n\t\tletterSpacingUnits,\n\t\topenTypeFontFeatures,\n\t\tvariationAxes,\n\t} = value\n\n\tconst fonts: Set<string> = useMemo(() => {\n\t\treturn isFound(fontSelector) ? fontSelector : new Set()\n\t}, [fontSelector])\n\n\tconst openTypeFeatures = useMemo(() => {\n\t\treturn isFound(openTypeFontFeatures) ? openTypeFontFeatures : {}\n\t}, [openTypeFontFeatures])\n\n\tconst variationAxesValues: ReducedFontVariationAxes = useMemo(() => {\n\t\treturn isFound(variationAxes) ? variationAxes : {}\n\t}, [variationAxes])\n\n\tconst onChangeFont = (font: ReadonlyFont) => {\n\t\tconst update: FontValueUpdate = { fontSelector: font.selector }\n\t\tif (!isFontVariable(font)) {\n\t\t\tupdate.variationAxes = undefined\n\t\t}\n\t\tonChange(update)\n\t}\n\n\tconst onChangeFontSize = (size: number, rawValue?: string) => {\n\t\tconst update: FontValueUpdate = { fontSizeValue: size }\n\n\t\tconst fontSizeUnit = getFontSizeUnitFromValue(rawValue)\n\t\tif (fontSizeUnit) {\n\t\t\tupdate.fontSizeUnit = fontSizeUnit\n\t\t}\n\t\tonChange(update)\n\t}\n\n\tconst onChangeFontSizeUnit = (unit: FontSizeUnit) => {\n\t\tonChange({ fontSizeUnit: unit })\n\t}\n\tconst onChangeLineHeightValue = (lineHeight: number, rawValue?: string) => {\n\t\tconst update: FontValueUpdate = { lineHeightValue: lineHeight }\n\n\t\tconst lineHeightUnit = getLineHeightUnitFromValue(rawValue)\n\t\tif (lineHeightUnit) {\n\t\t\tupdate.lineHeightUnit = lineHeightUnit\n\t\t}\n\t\tonChange(update)\n\t}\n\tconst onChangeLineHeightUnit = (lineHeightUnit: LineHeightUnit) => {\n\t\tonChange({ lineHeightUnit })\n\t}\n\n\tconst onChangeTextAlignment = (alignment: TextAlignment) => {\n\t\tonChange({ textAlignment: alignment })\n\t}\n\n\tconst onChangeLetterSpacingValue = (letterSpacing: number, rawValue?: string) => {\n\t\tconst update: FontValueUpdate = { letterSpacingValue: letterSpacing }\n\n\t\tconst letterSpacingUnit = getLetterSpacingUnitFromValue(rawValue)\n\t\tif (letterSpacingUnit) {\n\t\t\tupdate.letterSpacingUnit = letterSpacingUnit\n\t\t}\n\t\tonChange(update)\n\t}\n\n\tconst onChangeLetterSpacingUnit = (letterSpacingUnit: LetterSpacingUnit) => {\n\t\tonChange({ letterSpacingUnit })\n\t}\n\n\tconst toggleOpenTypeFeature = useEngineCallback(\n\t\t(featureTag: OpenTypeFeatureTag, toggle: boolean) => {\n\t\t\tonChange({\n\t\t\t\topenTypeFontFeatures: {\n\t\t\t\t\tfeatureTag,\n\t\t\t\t\ttoggle,\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst onDeleteOpenTypeFontFeatures = useEngineCallback(() => {\n\t\tonChange({ openTypeFontFeatures: undefined })\n\t}, [onChange])\n\n\tconst onChangeVariationAxis = useEngineCallback(\n\t\t(\n\t\t\taxisTag: VariationAxisTag | VariationAxisTag[],\n\t\t\taxisValue: number | number[] | undefined,\n\t\t\tavailableAxes?: ReadonlyFontVariationAxes,\n\t\t) => {\n\t\t\t// Omit any Mixed values\n\t\t\tconst currentAxes: VariationAxesToValues = {}\n\t\t\tfor (const key in variationAxesValues) {\n\t\t\t\tconst value = variationAxesValues[key]\n\t\t\t\tif (isNumber(value)) currentAxes[key] = value\n\t\t\t}\n\n\t\t\t// If the font variant is not of type variable, we need to switch the current font to its variable version.\n\t\t\tconst { variationAxes, variableFontSelector } = getFontVariantChanges({\n\t\t\t\tfontSelectors: fonts,\n\t\t\t\taxisTag,\n\t\t\t\taxisValue,\n\t\t\t\tavailableAxes,\n\t\t\t\tcurrentAxes,\n\t\t\t})\n\n\t\t\tconst update: FontValueUpdate = { variationAxes }\n\t\t\tif (variableFontSelector) {\n\t\t\t\tupdate.fontSelector = variableFontSelector\n\t\t\t}\n\n\t\t\tonChange(update)\n\t\t},\n\t\t[onChange, variationAxesValues, fonts],\n\t)\n\n\tconst onDeleteVariationAxes = useEngineCallback(() => {\n\t\tconst update: FontValueUpdate = { variationAxes: undefined }\n\n\t\t// When removing variable font settings, reset the font to its closest non-variable variant.\n\t\t// E.g. Inter-Variable {wght: 400} -> Inter-Regular\n\t\tconst [firstFontSelector] = fonts\n\t\tif (firstFontSelector) {\n\t\t\tconst nonVariableFontSelector = getNonVariableFontSelector(firstFontSelector, variationAxesValues)\n\t\t\tif (nonVariableFontSelector) {\n\t\t\t\tupdate.fontSelector = nonVariableFontSelector\n\t\t\t}\n\t\t}\n\n\t\tonChange(update)\n\t}, [onChange, fonts, variationAxesValues])\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.popoverPadding}\n\t\t\tpaddingRight={dimensions.css.popoverPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<FontRow\n\t\t\t\tpopoutIdentifier={popoutId}\n\t\t\t\tselectedFonts={fonts}\n\t\t\t\tvariationAxes={variationAxes}\n\t\t\t\tonChange={onChangeFont}\n\t\t\t\tonChangeFontFamily={onChangeFontFamily}\n\t\t\t\tonHighlightFontFamily={onHighlightFontFamily}\n\t\t\t\tonHighlightEnd={onHighlightEnd}\n\t\t\t/>\n\t\t\t{control.displayFontSize && (\n\t\t\t\t<FontSizeRow\n\t\t\t\t\tfontSize={fontSizeValue}\n\t\t\t\t\tunits={fontSizeUnits}\n\t\t\t\t\tonChange={onChangeFontSize}\n\t\t\t\t\tonChangeUnit={onChangeFontSizeUnit}\n\t\t\t\t\tsupportedUnits={supportedFontSizeUnits}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{control.controls === \"extended\" && (\n\t\t\t\t<LineHeightRow\n\t\t\t\t\tvalue={lineHeightValue}\n\t\t\t\t\tunits={lineHeightUnits}\n\t\t\t\t\tonChangeValue={onChangeLineHeightValue}\n\t\t\t\t\tonChangeUnit={onChangeLineHeightUnit}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{control.displayTextAlignment && (\n\t\t\t\t<TextAlignmentRow textAlignment={textAlignment} onChange={onChangeTextAlignment} />\n\t\t\t)}\n\t\t\t{control.controls === \"extended\" && (\n\t\t\t\t<LetterSpacingRow\n\t\t\t\t\tvalue={letterSpacingValue}\n\t\t\t\t\tunits={letterSpacingUnits}\n\t\t\t\t\tonChangeValue={onChangeLetterSpacingValue}\n\t\t\t\t\tonChangeUnit={onChangeLetterSpacingUnit}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{control.controls === \"extended\" && supportsOpenTypeFontFeature(fonts) && (\n\t\t\t\t<OpenTypeRow\n\t\t\t\t\tfonts={fonts}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\topenTypeFontFeatures={openTypeFeatures}\n\t\t\t\t\tdisableCopyPaste\n\t\t\t\t\tonChange={toggleOpenTypeFeature}\n\t\t\t\t\tonDelete={onDeleteOpenTypeFontFeatures}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{control.controls === \"extended\" && (\n\t\t\t\t<VariableFontRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tfonts={fonts}\n\t\t\t\t\tvariationAxesValues={variationAxesValues}\n\t\t\t\t\tisPreset={false}\n\t\t\t\t\tonChange={onChangeVariationAxis}\n\t\t\t\t\tonDelete={onDeleteVariationAxes}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Stack>\n\t)\n})\n\nfunction useLoadMissingFonts(selectors: FontSelectors | undefined) {\n\tconst forceUpdate = useForceUpdate()\n\n\tuseEffect(() => {\n\t\tif (isNotFound(selectors) || !selectors || selectors.size === 0) return\n\t\tconst selectorArray = Array.from(selectors).filter(isDefined)\n\n\t\tfontStore\n\t\t\t.loadFonts(selectorArray)\n\t\t\t.then(({ newlyLoadedFontCount }) => {\n\t\t\t\tif (newlyLoadedFontCount > 0) forceUpdate()\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t}, [selectors, forceUpdate])\n}\n", "import { Translatable as T, useReadOnly } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReducedFormVariants, WithFormVariants } from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport { withFormVariants } from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { useSelectedNodeVariants } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ntype FormVariant = keyof Pick<\n\tWithFormVariants,\n\t\"formButtonIncompleteVariant\" | \"formButtonErrorVariant\" | \"formButtonPendingVariant\" | \"formButtonSuccessVariant\"\n>\n\nconst removeFormVariantUpdate: Record<FormVariant, Partial<WithFormVariants>> = {\n\tformButtonSuccessVariant: { formButtonSuccessVariant: undefined, formButtonSuccessVariantEnabled: undefined },\n\tformButtonPendingVariant: { formButtonPendingVariant: undefined, formButtonPendingVariantEnabled: undefined },\n\tformButtonErrorVariant: { formButtonErrorVariant: undefined, formButtonErrorVariantEnabled: undefined },\n\tformButtonIncompleteVariant: {\n\t\tformButtonIncompleteVariant: undefined,\n\t\tformButtonIncompleteVariantEnabled: undefined,\n\t},\n}\n\nfunction useRemoveFormVariant(nodeIds: NodeID[], formVariant: FormVariant) {\n\treturn useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\tnode.set(removeFormVariantUpdate[formVariant])\n\t\t}\n\t}, [nodeIds, formVariant])\n}\n\nfunction useSetFormVariant(nodeIds: NodeID[], formVariant: FormVariant) {\n\treturn useEngineCallback(\n\t\t(variant: string) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\t\tnode.set({ [formVariant]: variant })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, formVariant],\n\t)\n}\n\ninterface Props extends ReducedFormVariants {\n\tnodeIds: NodeID[]\n\tcodeComponentIdentifiers: Set<string>\n\tcomponentHash: string\n}\n\nexport const FormVariantsPanel = React.memo(function FormVariantsPanel({\n\tnodeIds,\n\tformButtonSuccessVariant,\n\tformButtonErrorVariant,\n\tformButtonPendingVariant,\n\tformButtonSuccessVariantEnabled,\n\tformButtonErrorVariantEnabled,\n\tformButtonPendingVariantEnabled,\n\tformButtonIncompleteVariant,\n\tformButtonIncompleteVariantEnabled,\n\tcodeComponentIdentifiers,\n\tcomponentHash,\n}: Props) {\n\tconst readonly = useReadOnly()\n\n\tconst showMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (readonly || event.button === 2) return\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Loading\",\n\t\t\t\t\t\tenabled: isNotFound(formButtonPendingVariantEnabled) || isUndefined(formButtonPendingVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ formButtonPendingVariantEnabled: true })\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: \"Success\",\n\t\t\t\t\t\tenabled: isNotFound(formButtonSuccessVariantEnabled) || isUndefined(formButtonSuccessVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ formButtonSuccessVariantEnabled: true })\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: \"Error\",\n\t\t\t\t\t\tenabled: isNotFound(formButtonErrorVariantEnabled) || isUndefined(formButtonErrorVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ formButtonErrorVariantEnabled: true })\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: \"Incomplete\",\n\t\t\t\t\t\tenabled: isNotFound(formButtonIncompleteVariantEnabled) || isUndefined(formButtonIncompleteVariantEnabled),\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormVariants)) {\n\t\t\t\t\t\t\t\tnode.set({ formButtonIncompleteVariantEnabled: true })\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\treadonly,\n\t\t\tformButtonPendingVariantEnabled,\n\t\t\tformButtonSuccessVariantEnabled,\n\t\t\tformButtonErrorVariantEnabled,\n\t\t\tformButtonIncompleteVariantEnabled,\n\t\t\tnodeIds,\n\t\t],\n\t)\n\n\tconst hasAllFormVariants =\n\t\tformButtonPendingVariantEnabled === true &&\n\t\tformButtonSuccessVariantEnabled === true &&\n\t\tformButtonErrorVariantEnabled === true &&\n\t\tformButtonIncompleteVariantEnabled === true\n\n\tconst showPlusButton = !hasAllFormVariants\n\n\tconst removePendingVariant = useRemoveFormVariant(nodeIds, \"formButtonPendingVariant\")\n\tconst removeErrorVariant = useRemoveFormVariant(nodeIds, \"formButtonErrorVariant\")\n\tconst removeSuccessVariant = useRemoveFormVariant(nodeIds, \"formButtonSuccessVariant\")\n\tconst removeIncompleteVariant = useRemoveFormVariant(nodeIds, \"formButtonIncompleteVariant\")\n\n\tconst setPendingVariant = useSetFormVariant(nodeIds, \"formButtonPendingVariant\")\n\tconst setSuccessVariant = useSetFormVariant(nodeIds, \"formButtonSuccessVariant\")\n\tconst setErrorVariant = useSetFormVariant(nodeIds, \"formButtonErrorVariant\")\n\tconst setIncompleteVariant = useSetFormVariant(nodeIds, \"formButtonIncompleteVariant\")\n\n\tconst singleNodeId = nodeIds[0]\n\tconst topLevelVariants = useSelectedNodeVariants({\n\t\tid: singleNodeId,\n\t\tcomponentHash,\n\t\tcodeComponentIdentifiers,\n\t})\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Form State</T>}\n\t\t\t\t\tclickable={showPlusButton && !readonly}\n\t\t\t\t\tonMouseDown={showPlusButton ? showMenu : undefined}\n\t\t\t\t>\n\t\t\t\t\t{showPlusButton && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{formButtonPendingVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Loading\" onDelete={removePendingVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={formButtonPendingVariant}\n\t\t\t\t\t\tonSelect={setPendingVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{formButtonSuccessVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Success\" onDelete={removeSuccessVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={formButtonSuccessVariant}\n\t\t\t\t\t\tonSelect={setSuccessVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{formButtonErrorVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Error\" onDelete={removeErrorVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={formButtonErrorVariant}\n\t\t\t\t\t\tonSelect={setErrorVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{formButtonIncompleteVariantEnabled && (\n\t\t\t\t<PanelRow title=\"Incomplete\" onDelete={removeIncompleteVariant}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={formButtonIncompleteVariant}\n\t\t\t\t\t\tonSelect={setIncompleteVariant}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { PopupButton, PopupButtonDisplayTitle, PopupButtonItem, useReadOnly } from \"@framerjs/fresco\"\nimport { Mixed, assertNever, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { type BaseEngine, useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { GridItemAlignment, WithGridItemLayout } from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport {\n\tgridItemAlignmentOptions,\n\tisSupportedGridItemAlignment,\n\twithGridItemLayout,\n} from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedGridItemLayout } from \"document/models/CanvasTree/traits/utils/reduceGridItemLayout.ts\"\nimport React from \"react\"\nimport { AlignmentGridInput } from \"../inputs/AlignmentGridInput.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport * as styles from \"./GridItemLayoutPanel.styles.ts\"\n\ninterface Props extends Pick<\n\tReducedGridItemLayout,\n\t| \"anyGridItemParentWithRowHeightFitContent\"\n\t| \"gridItemFillCellWidth\"\n\t| \"gridItemFillCellHeight\"\n\t| \"gridItemHorizontalAlignment\"\n\t| \"gridItemVerticalAlignment\"\n> {\n\tnodeIds: NodeID[]\n}\n\ntype ItemAlignmentOption = `${GridItemAlignment}-${GridItemAlignment}`\nconst itemAlignmentOptions: ItemAlignmentOption[] = [\n\t\"start-start\",\n\t\"start-center\",\n\t\"start-end\",\n\t\"center-start\",\n\t\"center-center\",\n\t\"center-end\",\n\t\"end-start\",\n\t\"end-center\",\n\t\"end-end\",\n]\nfunction getItemAlignmentOption(\n\thorizontalAlignment: Props[\"gridItemHorizontalAlignment\"],\n\tverticalAlignment: Props[\"gridItemVerticalAlignment\"],\n): ItemAlignmentOption | Mixed | undefined {\n\tif (isMixed(horizontalAlignment) || isMixed(verticalAlignment)) return Mixed\n\tif (!isFoundAndNotUndefined(horizontalAlignment) || !isFoundAndNotUndefined(verticalAlignment)) return undefined\n\n\treturn `${verticalAlignment}-${horizontalAlignment}`\n}\n\nfunction updateGridItemAlignment(engine: BaseEngine, nodeIds: NodeID[], newValue: ItemAlignmentOption | string) {\n\tconst [verticalAlignment, horizontalAlignment] = newValue.split(\"-\")\n\tconst update: Partial<WithGridItemLayout> = {}\n\n\tif (isSupportedGridItemAlignment(verticalAlignment)) {\n\t\tupdate.gridItemVerticalAlignment = verticalAlignment\n\t}\n\tif (isSupportedGridItemAlignment(horizontalAlignment)) {\n\t\tupdate.gridItemHorizontalAlignment = horizontalAlignment\n\t}\n\n\tif (Object.keys(update).length === 0) return\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withGridItemLayout).forEach(node => {\n\t\t\tnode.set(update)\n\t\t})\n\t})\n}\n\nfunction alignmentLabel(\n\taxis: \"vertical\" | \"horizontal\",\n\talignment: ReducedGridItemLayout[\"gridItemHorizontalAlignment\"] | ReducedGridItemLayout[\"gridItemVerticalAlignment\"],\n\tshort?: boolean,\n): string {\n\tif (!isSupportedGridItemAlignment(alignment)) return Dictionary.Mixed\n\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn axis === \"vertical\" ? Dictionary.Top : Dictionary.Left\n\t\tcase \"center\":\n\t\t\treturn short ? Dictionary.Mid : Dictionary.Middle\n\t\tcase \"end\":\n\t\t\treturn axis === \"vertical\" ? Dictionary.Bottom : Dictionary.Right\n\t\tdefault:\n\t\t\tassertNever(alignment)\n\t}\n}\n\nexport const GridItemPositionPanel = React.memo(function GritItemPositionPanel({\n\tnodeIds,\n\tanyGridItemParentWithRowHeightFitContent,\n\tgridItemFillCellWidth,\n\tgridItemFillCellHeight,\n\tgridItemHorizontalAlignment,\n\tgridItemVerticalAlignment,\n}: Props) {\n\tconst engine = useBaseEngine()\n\tconst isReadOnly = useReadOnly()\n\tconst gridBentoFitEnabled = useExperimentIsOn(\"gridBentoFit\")\n\n\tconst canUpdateVerticalAlignment =\n\t\tgridItemFillCellHeight !== true || (!gridBentoFitEnabled && anyGridItemParentWithRowHeightFitContent)\n\tconst canUpdateHorizontalAlignment = gridItemFillCellWidth !== true\n\n\tif (!canUpdateVerticalAlignment && !canUpdateHorizontalAlignment) return null\n\n\treturn (\n\t\t<PanelRow title=\"Position\">\n\t\t\t<AlignmentGridInput\n\t\t\t\toptions={itemAlignmentOptions}\n\t\t\t\tvalue={getItemAlignmentOption(gridItemHorizontalAlignment, gridItemVerticalAlignment)}\n\t\t\t\tonChange={value => {\n\t\t\t\t\tupdateGridItemAlignment(engine, nodeIds, value)\n\t\t\t\t}}\n\t\t\t\tdisabled={isReadOnly}\n\t\t\t/>\n\t\t\t<div className={styles.positionInputs}>\n\t\t\t\t<PopupButtonDisplayTitle displayTitle={alignmentLabel(\"vertical\", gridItemVerticalAlignment, true)}>\n\t\t\t\t\t<PopupButton enabled={canUpdateVerticalAlignment && !isReadOnly}>\n\t\t\t\t\t\t{gridItemAlignmentOptions.map(option => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={alignmentLabel(\"vertical\", option)}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateGridItemAlignment(engine, nodeIds, `${option}-`)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tselected={gridItemVerticalAlignment === option}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</PopupButtonDisplayTitle>\n\t\t\t\t<PopupButtonDisplayTitle displayTitle={alignmentLabel(\"horizontal\", gridItemHorizontalAlignment, true)}>\n\t\t\t\t\t<PopupButton enabled={canUpdateHorizontalAlignment && !isReadOnly}>\n\t\t\t\t\t\t{gridItemAlignmentOptions.map(option => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={alignmentLabel(\"horizontal\", option)}\n\t\t\t\t\t\t\t\tonSelect={() => {\n\t\t\t\t\t\t\t\t\tupdateGridItemAlignment(engine, nodeIds, `-${option}`)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tselected={gridItemHorizontalAlignment === option}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</PopupButtonDisplayTitle>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n})\n", "import \"AlignmentGridInput.styles_1ff3lqg.wyw.css\"; export const gridContainer = \"gridContainer_gue07jt\";\nexport const grid = \"grid_g1mlg42a\";\nexport const gridCell = \"gridCell_gjp44am\";\nexport const gridCellSelected = \"gridCellSelected_g57lg7n\";\nexport const gridCellDisabled = \"gridCellDisabled_gfjbfft\";", "import type { Mixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./AlignmentGridInput.styles.ts\"\n\nexport interface AlignmentGridInputProps<T> {\n\toptions: readonly T[]\n\tvalue: T | Mixed | undefined\n\tonChange: (value: T) => void\n\toptionLabel?: (option: T, index: number) => string\n\tdisabled?: boolean\n}\n\nexport function AlignmentGridInput<T = number>({\n\toptions,\n\tvalue,\n\tonChange,\n\toptionLabel,\n\tdisabled,\n}: AlignmentGridInputProps<T>) {\n\treturn (\n\t\t<div className={styles.gridContainer}>\n\t\t\t<div className={styles.grid}>\n\t\t\t\t{options.map((option, index) => (\n\t\t\t\t\t<button\n\t\t\t\t\t\tkey={typeof option === \"string\" ? option : `grid-alignment-${index}`}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\taria-label={optionLabel?.(option, index)}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.gridCell,\n\t\t\t\t\t\t\tvalue === option && styles.gridCellSelected,\n\t\t\t\t\t\t\tdisabled && styles.gridCellDisabled,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={() => onChange(option)}\n\t\t\t\t\t\t// tabbing doesn't really work in the property panel, disabling tabbing to prevent confusion\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "import \"GridItemLayoutPanel.styles_1c8b1bd.wyw.css\"; export const positionInputs = \"positionInputs_p1twl959\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { GridItemColumnSpan } from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport {\n\tgetTitleForSpanOption,\n\tgridColumnSpanOptions,\n\tgridRowSpanOptions,\n\tisGridItemColumnSpan,\n\tisGridItemRowSpan,\n\twithGridItemLayout,\n} from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedGridItemLayout } from \"document/models/CanvasTree/traits/utils/reduceGridItemLayout.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport {\n\tgridItemColumnSpanVariableDefinition,\n\tgridItemRowSpanVariableDefinition,\n} from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { type ControlReferenceInfo, DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\n\ntype SpanType = \"column\" | \"row\"\n\ninterface SpanOptionSelectorProps {\n\ttype: SpanType\n\tvalue: Reduced<GridItemColumnSpan>\n\tnodeIds: NodeID[]\n}\n\nfunction SpanOptionSelector({ type, value, nodeIds }: SpanOptionSelectorProps) {\n\tconst update = useEngineCallback(\n\t\t(newValue: GridItemColumnSpan) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withGridItemLayout)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (type === \"column\") {\n\t\t\t\t\tnode.set({ gridItemColumnSpan: newValue })\n\t\t\t\t} else {\n\t\t\t\t\tassert(isGridItemRowSpan(newValue), \"`gridItemRowSpan` only supports numbers\")\n\t\t\t\t\tnode.set({ gridItemRowSpan: newValue })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds, type],\n\t)\n\n\tconst spanOptions = type === \"column\" ? gridColumnSpanOptions : gridRowSpanOptions\n\n\treturn (\n\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t{spanOptions.map(spanOption => {\n\t\t\t\treturn (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={spanOption}\n\t\t\t\t\t\tidentifier={spanOption}\n\t\t\t\t\t\ttitle={getTitleForSpanOption(spanOption)}\n\t\t\t\t\t\tselected={value === spanOption}\n\t\t\t\t\t\tonSelect={update}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t})}\n\t\t</PopupButton>\n\t)\n}\n\nconst columnSpanControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"gridItemColumnSpan\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\nconst rowSpanControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"gridItemRowSpan\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\nconst dynamicColumnSpanPopoutId = \"dynamicColumnSpan\"\nconst dynamicRowSpanPopoutId = \"dynamicRowSpan\"\n\ninterface GridItemSpanProps extends Pick<\n\tReducedGridItemLayout,\n\t\"gridItemColumnSpan\" | \"gridItemRowSpan\" | \"anyGridItemParentWithRowHeightFitContent\"\n> {\n\tnodeIds: NodeID[]\n}\n\nexport const GridItemSpanRows = React.memo(function GridItemSpanRows({\n\tnodeIds,\n\tgridItemColumnSpan,\n\tgridItemRowSpan,\n\tanyGridItemParentWithRowHeightFitContent,\n}: GridItemSpanProps) {\n\tconst updateColumnSpan = useEngineCallback(\n\t\t(value: GridItemColumnSpan | DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withGridItemLayout)\n\t\t\tnodes.forEach(node => node.set({ gridItemColumnSpan: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst isgridBentoFitExperimentOn = useExperimentIsOn(\"gridBentoFit\")\n\n\tconst canSpanRows = isgridBentoFitExperimentOn || !anyGridItemParentWithRowHeightFitContent\n\n\tconst createColumnSpanVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...gridItemColumnSpanVariableDefinition,\n\t\t\t\tinitialValue: isGridItemColumnSpan(gridItemColumnSpan) ? gridItemColumnSpan : 1,\n\t\t\t})\n\n\t\t\tif (variableRef) updateColumnSpan(variableRef)\n\t\t},\n\t\t[updateColumnSpan, gridItemColumnSpan],\n\t)\n\n\tconst removeDynamicColumnSpan = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withGridItemLayout)\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isDynamicValue(node.gridItemColumnSpan)) continue\n\t\t\tnode.set({ gridItemColumnSpan: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst selectComputedColumnSpan = useEngineCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tupdateColumnSpan(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(dynamicColumnSpanPopoutId)\n\t\t},\n\t\t[updateColumnSpan],\n\t)\n\n\tconst updateRowSpan = useEngineCallback(\n\t\t(value: number | DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withGridItemLayout)\n\t\t\tnodes.forEach(node => node.set({ gridItemRowSpan: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst createRowSpanVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...gridItemRowSpanVariableDefinition,\n\t\t\t\tinitialValue: isNumber(gridItemRowSpan) ? gridItemRowSpan : 1,\n\t\t\t})\n\n\t\t\tif (variableRef) updateRowSpan(variableRef)\n\t\t},\n\t\t[updateRowSpan, gridItemRowSpan],\n\t)\n\n\tconst removeDynamicRowSpan = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withGridItemLayout)\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isDynamicValue(node.gridItemRowSpan)) continue\n\t\t\tnode.set({ gridItemRowSpan: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst selectComputedRowSpan = useEngineCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tupdateRowSpan(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(dynamicRowSpanPopoutId)\n\t\t},\n\t\t[updateRowSpan],\n\t)\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\tsupportsVariables\n\t\t\t\tsupportsComputedValues\n\t\t\t\ttitle={Dictionary.Columns}\n\t\t\t\tcomputedValuePopoutId={dynamicColumnSpanPopoutId}\n\t\t\t\tvariableType={ControlType.Enum}\n\t\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\t\tcontrolKey={columnSpanControlReferenceInfo.controlKey}\n\t\t\t\tcontrolSourceIdentifier={columnSpanControlReferenceInfo.controlSourceIdentifier}\n\t\t\t\tonCreateVariable={createColumnSpanVariable}\n\t\t\t\tonRemoveDynamicValue={removeDynamicColumnSpan}\n\t\t\t\tonSelectComputedValue={selectComputedColumnSpan}\n\t\t\t\tonSelectVariable={updateColumnSpan}\n\t\t\t\tdynamicValue={isDynamicValue(gridItemColumnSpan) ? gridItemColumnSpan : null}\n\t\t\t>\n\t\t\t\t{isDynamicValue(gridItemColumnSpan) ? (\n\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\ttitle={Dictionary.Columns}\n\t\t\t\t\t\tvalue={gridItemColumnSpan}\n\t\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\t\tonChangeDynamicValue={updateColumnSpan}\n\t\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"gridItemColumnSpan\")}\n\t\t\t\t\t\tonRemove={removeDynamicColumnSpan}\n\t\t\t\t\t\tpopoutId={dynamicColumnSpanPopoutId}\n\t\t\t\t\t\tcontrolReferenceInfo={columnSpanControlReferenceInfo}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SpanOptionSelector type=\"column\" value={gridItemColumnSpan} nodeIds={nodeIds} />\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t{canSpanRows && (\n\t\t\t\t<PanelRow\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\ttitle={Dictionary.Rows}\n\t\t\t\t\tcomputedValuePopoutId={dynamicRowSpanPopoutId}\n\t\t\t\t\tvariableType={ControlType.Enum}\n\t\t\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\t\t\tcontrolKey={rowSpanControlReferenceInfo.controlKey}\n\t\t\t\t\tcontrolSourceIdentifier={rowSpanControlReferenceInfo.controlSourceIdentifier}\n\t\t\t\t\tonCreateVariable={createRowSpanVariable}\n\t\t\t\t\tonRemoveDynamicValue={removeDynamicRowSpan}\n\t\t\t\t\tonSelectComputedValue={selectComputedRowSpan}\n\t\t\t\t\tonSelectVariable={updateRowSpan}\n\t\t\t\t\tdynamicValue={isDynamicValue(gridItemRowSpan) ? gridItemRowSpan : null}\n\t\t\t\t>\n\t\t\t\t\t{isDynamicValue(gridItemRowSpan) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\t\ttitle={Dictionary.Rows}\n\t\t\t\t\t\t\tvalue={gridItemRowSpan}\n\t\t\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\t\t\tonChangeDynamicValue={updateRowSpan}\n\t\t\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"gridItemRowSpan\")}\n\t\t\t\t\t\t\tonRemove={removeDynamicRowSpan}\n\t\t\t\t\t\t\tpopoutId={dynamicRowSpanPopoutId}\n\t\t\t\t\t\t\tcontrolReferenceInfo={rowSpanControlReferenceInfo}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<SpanOptionSelector type=\"row\" value={gridItemRowSpan} nodeIds={nodeIds} />\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import type { ComboBoxListItem, ComboBoxProps } from \"@framerjs/fresco\"\nimport { ComboBox, Stack, Translatable as T, TextArea } from \"@framerjs/fresco\"\nimport { assert, List } 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 { isCodeComponentNode, isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ReducedCustomizations } from \"document/models/CanvasTree/traits/WithCustomizations.ts\"\nimport {\n\tdefaultCustomizationCategories,\n\tgetSourceNodeForSection,\n\tisCustomizable,\n\twithCustomizations,\n} from \"document/models/CanvasTree/traits/WithCustomizations.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isFoundAndNotMixed } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React, { useMemo } from \"react\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport * as styles from \"./KitsCustomizationsPanel.styles.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\ninterface Props extends Omit<\n\tReducedCustomizations,\n\t\"onlyNodesWithCustomizations\" | \"customizationsSectionId\" | \"customizationsDescription\" | \"customizations\"\n> {\n\tnodeIds: NodeID[]\n}\n\nexport const KitsCustomizationsPanel = React.memo(function KitsCustomizationsPanel({\n\tnodeIds,\n\tcustomizationsRules,\n\tcustomizationsCategory,\n}: Props) {\n\tconst configuration = useMemo(() => {\n\t\tif (!isFoundAndNotMixed(customizationsRules)) return null\n\t\tif (!isFoundAndNotMixed(customizationsCategory)) return null\n\n\t\tconst nodeId = nodeIds[0]\n\t\tif (!nodeId || nodeIds.length !== 1) return null\n\t\tconst node = engine.tree.getNodeWithTrait(nodeId, isCustomizable)\n\n\t\tif (!node) return null\n\t\tif (!isFrameNode(node) && !isCodeComponentNode(node)) return null\n\n\t\t// Validate that the node is a kit section if it is child of the primary variant ground node\n\t\tconst parent = engine.tree.get(node.parentid)\n\t\tif (!parent) return null\n\t\tif (!isPrimaryVariant(parent)) return null\n\n\t\treturn {\n\t\t\tnodeId: node.id,\n\t\t\trules: customizationsRules,\n\t\t\tcategory: customizationsCategory,\n\t\t}\n\t}, [nodeIds, customizationsRules, customizationsCategory])\n\n\tif (!configuration) return null\n\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title={<T>Section</T>} />}>\n\t\t\t<Category nodeId={configuration.nodeId} category={configuration.category} />\n\t\t\t<Rules nodeId={configuration.nodeId} rules={configuration.rules} />\n\t\t</Panel>\n\t)\n})\n\ninterface CategoryProps {\n\tnodeId: NodeID\n\tcategory: string | undefined\n}\n\nconst defaultComboboxItems: ComboBoxListItem[] = defaultCustomizationCategories.map(value => ({\n\ttype: \"option\",\n\tvalue,\n}))\n\nfunction Category({ nodeId, category }: CategoryProps) {\n\tconst handleCategoryChange: ComboBoxProps[\"onChange\"] = useEngineCallback(\n\t\t(next, final, reset) => {\n\t\t\tif (!final) return\n\t\t\tconst trimmed = next.trim()\n\n\t\t\tconst node = engine.tree.getNodeWithTrait(nodeId, withCustomizations)\n\t\t\tif (!node) return reset()\n\t\t\tconst originalNode = isReplicaOrReplicaChild(node)\n\t\t\t\t? engine.tree.getNodeWithTrait(node.originalid, withCustomizations)\n\t\t\t\t: node\n\t\t\tif (!originalNode) return reset()\n\n\t\t\tconst sourceNode = getSourceNodeForSection(engine.tree, originalNode)\n\t\t\tif (!sourceNode) return reset()\n\n\t\t\tsourceNode.set({ customizationsCategory: trimmed.length ? trimmed : undefined })\n\t\t},\n\t\t[nodeId],\n\t)\n\n\treturn (\n\t\t<PanelRow title=\"Category\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<ComboBox\n\t\t\t\t\titems={defaultComboboxItems}\n\t\t\t\t\tvalue={category ?? \"\"}\n\t\t\t\t\tcheckedItems={category ? [category] : undefined}\n\t\t\t\t\tsearchItemValue\n\t\t\t\t\tclearSelectionOnEmptySearch\n\t\t\t\t\tonChange={handleCategoryChange}\n\t\t\t\t\tplaceholder=\"Category\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\ninterface RulesProps {\n\tnodeId: NodeID\n\trules: readonly string[] | undefined\n}\n\nconst MAX_RULES_COUNT = 10\n\nfunction Rules({ nodeId, rules }: RulesProps) {\n\tconst addRule = engine.scheduler.wrapHandler(() => {\n\t\tconst node = engine.tree.getNodeWithTrait(nodeId, isCustomizable)\n\t\tassert(node, \"Node must exist\")\n\t\tconst current = node.customizationsRules ?? []\n\t\tif (current.length >= MAX_RULES_COUNT) return\n\t\tnode.set({ customizationsRules: List.push(current, \"\") })\n\t})\n\n\tconst removeAllRules = engine.scheduler.wrapHandler(() => {\n\t\tconst node = engine.tree.getNodeWithTrait(nodeId, isCustomizable)\n\t\tassert(node, \"Node must exist\")\n\t\tnode.set({ customizationsRules: undefined })\n\t})\n\n\tconst removeRuleAt = engine.scheduler.wrapHandler((index: number) => {\n\t\tconst node = engine.tree.getNodeWithTrait(nodeId, isCustomizable)\n\t\tassert(node, \"Node must exist\")\n\t\tconst current = node.customizationsRules\n\t\tif (!current) return\n\t\tconst next = List.remove(current, index)\n\t\tnode.set({ customizationsRules: next.length === 0 ? undefined : next })\n\t})\n\n\tconst onChangeRuleAt = (index: number) => (value: string, final: boolean) => {\n\t\tif (!final) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst node = engine.tree.getNodeWithTrait(nodeId, isCustomizable)\n\t\t\tassert(node, \"Node must exist\")\n\t\t\tconst current = node.customizationsRules ?? []\n\t\t\tconst next = index < current.length ? List.replace(current, index, value) : current\n\t\t\tnode.set({ customizationsRules: next })\n\t\t})\n\t}\n\n\tconst displayContextMenuForItem = (event: React.MouseEvent, index: number) => {\n\t\tevent.preventDefault()\n\t\tevent.stopPropagation()\n\n\t\tengine.stores.contextMenuStore.show(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Add,\n\t\t\t\t\tclick: addRule,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\t\tclick: () => removeRuleAt(index),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Remove All\",\n\t\t\t\t\tclick: removeAllRules,\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t)\n\t}\n\n\tconst items = rules ?? []\n\tconst canAdd = items.length < MAX_RULES_COUNT\n\n\treturn (\n\t\t<PanelRow title=\"Rules\">\n\t\t\t<Stack gap={10} style={doubleColumn}>\n\t\t\t\t{items.map((value, index) => (\n\t\t\t\t\t<TextArea\n\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\tclassName={styles.textArea}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tonChange={onChangeRuleAt(index)}\n\t\t\t\t\t\tplaceholder={`Rule ${index + 1}`}\n\t\t\t\t\t\tconstantChange={false}\n\t\t\t\t\t\tautoResize\n\t\t\t\t\t\tminRows={1}\n\t\t\t\t\t\tonContextMenu={event => displayContextMenuForItem(event, index)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t\t{canAdd && <PopoutButtonWithPreviewSuggestion type=\"linkOptions\" onClick={addRule} />}\n\t\t\t</Stack>\n\t\t</PanelRow>\n\t)\n}\n", "import \"KitsCustomizationsPanel.styles_1uukozi.wyw.css\"; export const textArea = \"textArea_tkaycfi\";", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { KeyToOptionsMap, Overflow, WithOverflow } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport {\n\tallOverflowValues,\n\tisAxisOverflowCompatible,\n\tisOverflowValue,\n\ttitleForOverflowOption,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedOverflow } from \"document/models/CanvasTree/traits/utils/reduceOverflow.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport type { CreateNodePropertyControlReferenceOptions } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { overflowVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\nconst popoutId = \"overflow-popout\"\n\nconst referenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"overflow\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ntype OverflowTraits = TraitType.Overflow | TraitType.OverflowX | TraitType.OverflowY\nfunction variableInitialValue<T>(value: Reduced<T | undefined>, trait: OverflowTraits): Overflow {\n\tswitch (trait) {\n\t\tcase TraitType.Overflow:\n\t\t\treturn isOverflowValue(value) ? value : \"visible\"\n\t\tcase TraitType.OverflowX:\n\t\tcase TraitType.OverflowY:\n\t\t\treturn isOverflowValue(value) ? value : \"auto\"\n\t\tdefault:\n\t\t\tassertNever(trait)\n\t}\n}\n\nfunction getVariableDefinition(\n\ttrait: TraitType.Overflow | TraitType.OverflowX | TraitType.OverflowY,\n): CreateNodePropertyControlReferenceOptions {\n\tswitch (trait) {\n\t\tcase TraitType.Overflow:\n\t\tcase TraitType.OverflowX:\n\t\tcase TraitType.OverflowY:\n\t\t\t// All three overflow types shared the same variable definition so\n\t\t\t// that they can be reused amongst them.\n\t\t\treturn overflowVariableDefinition\n\t\tdefault:\n\t\t\tassertNever(trait)\n\t}\n}\n\ninterface Props extends Omit<ReducedOverflow, \"onlyNodesWithOverflow\"> {\n\tnodeIds: NodeID[]\n\tonlyTextNodes: boolean\n}\n\nconst traitTypeTitleMap = {\n\t[TraitType.Overflow]: \"Overflow\",\n\t[TraitType.OverflowX]: \"Overflow X\",\n\t[TraitType.OverflowY]: \"Overflow Y\",\n} as const\n\nconst OverflowRow = React.memo(function OverflowRow({\n\tnodeIds,\n\tvalue,\n\ttrait,\n\tonSelect,\n\tonRemove,\n\tenabled,\n\toptions,\n\tdisabledOptions,\n}: {\n\tnodeIds: NodeID[]\n\tvalue: Reduced<string | DynamicValue | undefined>\n\ttrait: TraitType.Overflow | TraitType.OverflowX | TraitType.OverflowY\n\tonSelect: (value: string) => void\n\tonRemove?: () => void\n\tenabled?: boolean\n\toptions: readonly Overflow[]\n\tdisabledOptions?: Set<Overflow>\n}) {\n\tconst canCopyOverflow = !isMixed(value) && isClipboardSupported()\n\tconst [canPasteOverflow, pasteOverflow, copyOverflow] = useCopyAndPasteSingleProperty(trait, nodeIds, canCopyOverflow)\n\n\tconst onRemoveDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withOverflow)) {\n\t\t\tconst nodeValue = node[trait]\n\t\t\tif (!isDynamicValue(nodeValue)) continue\n\n\t\t\t// We try and obtain the underlying value from the dynamic value\n\t\t\t// in order to show the same value in the property panel as it was\n\t\t\t// before the dynamic value was removed.\n\t\t\tconst replacementValue = isComputedValue(nodeValue)\n\t\t\t\t? getComputedValueStartValue(engine, nodeValue)\n\t\t\t\t: getVariableValue(engine, nodeValue)\n\n\t\t\tnode.set({ [trait]: isOverflowValue(replacementValue) ? replacementValue : undefined })\n\t\t}\n\t}, [nodeIds, trait])\n\n\tconst onCreateVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: variableInitialValue(value, trait),\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...getVariableDefinition(trait),\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withOverflow)) {\n\t\t\t\tnode.set({ [trait]: variableRef })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, trait, value],\n\t)\n\n\tconst onChangeDynamicValue = useEngineCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withOverflow).forEach(node => {\n\t\t\t\tnode.set({ [trait]: dynamicValue })\n\t\t\t})\n\t\t},\n\t\t[trait, nodeIds],\n\t)\n\n\tconst onSelectComputedValue = (computedValue: ComputedValue) => {\n\t\tonChangeDynamicValue(computedValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={traitTypeTitleMap[trait]}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\ttraitTypes={[trait]}\n\t\t\tonCopy={copyOverflow}\n\t\t\tonPaste={pasteOverflow}\n\t\t\tonDelete={onRemove}\n\t\t\tcopyEnabled={canCopyOverflow}\n\t\t\tpasteEnabled={canPasteOverflow}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tdynamicValue={isDynamicValue(value) ? value : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tonSelectVariable={onChangeDynamicValue}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tcontrolKey={referenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={referenceInfo.controlSourceIdentifier}\n\t\t>\n\t\t\t{isDynamicValue(value) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={capitalizeFirstLetter(trait)}\n\t\t\t\t\tvalue={value}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonChangeDynamicValue={onChangeDynamicValue}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"overflow\")}\n\t\t\t\t\tcontrolReferenceInfo={referenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton enabled={enabled} mixed={isMixed(value)}>\n\t\t\t\t\t\t{options.map(option => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={titleForOverflowOption(option)}\n\t\t\t\t\t\t\t\tselected={isOptionSelected(value, option)}\n\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\tenabled={!disabledOptions?.has(option)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n\nfunction isOptionSelected(value: Reduced<string | undefined>, option: string) {\n\t// undefined overflow should be displayed as \"visible\", matching the browser behavior.\n\tif (option === \"visible\") return value === undefined || value === option\n\treturn value === option\n}\n\nfunction useUpdateOverflow<T extends keyof WithOverflow>(key: T, nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: KeyToOptionsMap[T]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withOverflow)) {\n\t\t\t\tconst update: Partial<WithOverflow> = { [key]: value }\n\t\t\t\tif (key === \"overflow\" && isOverflowValue(value)) {\n\t\t\t\t\t// If the user selects an overflow value that is not compatible with the\n\t\t\t\t\t// overflowXY values, we remove the overflowXY values. Note: we allow the user\n\t\t\t\t\t// to select any possible overflow value in the main overflow (unlike in the\n\t\t\t\t\t// axes), so that they can switch between scrollable and non-scrollable overflow\n\t\t\t\t\t// values without having to first remove the overflowXY values. Otherwise, they\n\t\t\t\t\t// would be locked into either one of the compatible overflow value combination\n\t\t\t\t\t// pairs, without understanding why.\n\t\t\t\t\tif (isOverflowValue(node.overflowX) && !isAxisOverflowCompatible(value, node.overflowX)) {\n\t\t\t\t\t\tupdate.overflowX = undefined\n\t\t\t\t\t}\n\t\t\t\t\tif (isOverflowValue(node.overflowY) && !isAxisOverflowCompatible(value, node.overflowY)) {\n\t\t\t\t\t\tupdate.overflowY = undefined\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nconst useRemoveOverflow = (key: keyof WithOverflow, nodeIds: NodeID[]) => {\n\treturn useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withOverflow)) {\n\t\t\tnode.set({ [key]: undefined })\n\t\t}\n\t}, [key, nodeIds])\n}\n\nexport const OverflowPanel = React.memo(function OverflowPanel({\n\tnodeIds,\n\toverflow,\n\toverflowX,\n\toverflowY,\n\tonlyTextNodes,\n}: Props) {\n\tconst onSelectOverflow = useUpdateOverflow(\"overflow\", nodeIds)\n\tconst onSelectOverflowX = useUpdateOverflow(\"overflowX\", nodeIds)\n\tconst onSelectOverflowY = useUpdateOverflow(\"overflowY\", nodeIds)\n\n\tconst onRemoveOverflow = useRemoveOverflow(\"overflow\", nodeIds)\n\tconst onRemoveOverflowX = useRemoveOverflow(\"overflowX\", nodeIds)\n\tconst onRemoveOverflowY = useRemoveOverflow(\"overflowY\", nodeIds)\n\tconst overflowVisible = !onlyTextNodes || !isUndefined(overflow)\n\n\tconst overflowOptions = allOverflowValues\n\tconst disabledOptions = new Set<Overflow>()\n\n\tif (isOverflowValue(overflow)) {\n\t\t/**\n\t\t * We prevent incompatible overflow values from being combined between the overflow axes and\n\t\t * the main overflow by disabling them from the popup menu as needed in order to minimize\n\t\t * confusion that would arise from the browser automatically converting the scrollable\n\t\t * overflow values to the non-scrollable ones when these get combined.\n\t\t *\n\t\t * If the main overflow is not set, is Mixed, or is a dynamic value, we can't disable any options.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x#formal_definition\n\t\t *\n\t\t * NOTE: This needs to be kept in sync with @link{toAxisOverflow} and @link{isOverflowVisuallyHidden}.\n\t\t */\n\t\tfor (const option of allOverflowValues) {\n\t\t\tif (!isAxisOverflowCompatible(overflow, option)) {\n\t\t\t\tdisabledOptions.add(option)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{overflowVisible && (\n\t\t\t\t<OverflowRow\n\t\t\t\t\ttrait={TraitType.Overflow}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tvalue={overflow}\n\t\t\t\t\tonSelect={onSelectOverflow}\n\t\t\t\t\tonRemove={onlyTextNodes ? onRemoveOverflow : undefined}\n\t\t\t\t\toptions={overflowOptions}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{isFoundAndNotUndefined(overflowX) && (\n\t\t\t\t<OverflowRow\n\t\t\t\t\ttrait={TraitType.OverflowX}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tvalue={overflowX}\n\t\t\t\t\tonSelect={onSelectOverflowX}\n\t\t\t\t\tonRemove={onRemoveOverflowX}\n\t\t\t\t\toptions={allOverflowValues}\n\t\t\t\t\tdisabledOptions={disabledOptions}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{isFoundAndNotUndefined(overflowY) && (\n\t\t\t\t<OverflowRow\n\t\t\t\t\ttrait={TraitType.OverflowY}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tvalue={overflowY}\n\t\t\t\t\tonSelect={onSelectOverflowY}\n\t\t\t\t\tonRemove={onRemoveOverflowY}\n\t\t\t\t\toptions={allOverflowValues}\n\t\t\t\t\tdisabledOptions={disabledOptions}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { triggerGridsCreateEvent, triggerGridsDeleteEvent } from \"@framerjs/framer-events\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { OverlayGrid, WithOverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { defaultOverlayGrid, withOverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport type { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedOverlayGrids } from \"document/models/CanvasTree/traits/utils/reduceGrids.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isNumber, isObject, isString } from \"utils/typeChecks.ts\"\nimport { v4 as uuid } from \"uuid\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport type { ResolvedRotation } from \"../utils/getResolvedVariableValues.ts\"\nimport { OverlayGridPopoutButton } from \"./OverlayGridPopoutButton.tsx\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tselection: NodeID[]\n\tdisplayGrids: boolean\n\tonlyCanvasFrameNodes: boolean\n\trotation: ResolvedRotation\n\toverlayGrid: Exclude<ReducedOverlayGrids[\"overlayGrid\"], NotFound>\n}\n\nexport class OverlayGridPanel extends React.PureComponent<Props> {\n\tprivate nodes = (): (CanvasNode & WithOverlayGrid)[] =>\n\t\tengine.tree.getNodesWithTrait(this.props.nodeIds, withOverlayGrid)\n\n\tonAdd = engine.scheduler.wrapHandler(() => {\n\t\tconst identifier = uuid()\n\n\t\tthis.nodes().forEach((node, index) => {\n\t\t\tconst { width } = engine.tree.getRect(node)\n\n\t\t\t// Use an explicit identifier for the first grid to manage the popout.\n\t\t\tconst overlayGrid = defaultOverlayGrid(width, index === 0 ? identifier : undefined)\n\n\t\t\tnode.set({ overlayGrid })\n\t\t\ttriggerGridsCreateEvent({ gridId: overlayGrid.identifier, source: \"property_panel\" })\n\t\t})\n\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(identifier)\n\t})\n\n\tonChange = engine.scheduler.wrapHandler((key: keyof OverlayGrid, value: OverlayGrid[keyof OverlayGrid]) => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tif (!node?.overlayGrid) return\n\n\t\t\tnode.set({ overlayGrid: { ...node.overlayGrid, [key]: value } })\n\t\t})\n\t})\n\n\tonDelete = engine.scheduler.wrapHandler(() => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tif (!node.overlayGrid) return\n\t\t\tconst gridId = node?.overlayGrid?.identifier\n\t\t\tnode.set({ overlayGrid: undefined })\n\t\t\ttriggerGridsDeleteEvent({ gridId })\n\t\t})\n\t})\n\n\tonContextMenu = async (event: React.MouseEvent) => {\n\t\tconst nodes = this.nodes()\n\t\tif (nodes.length === 0) return\n\n\t\tconst isReadOnly = getIsViewOnly(engine, \"canDesign\")\n\t\tconst singleNode = nodes.length === 1 ? nodes[0] : null\n\t\tconst location = { x: event.clientX, y: event.clientY }\n\t\tconst clipboardGrid = await Clipboard.getGridOverlay()\n\n\t\tconst items = [\n\t\t\t{\n\t\t\t\tlabel: \"Copy\",\n\t\t\t\tenabled: singleNode ? !!this.props.overlayGrid : false,\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!singleNode) return\n\t\t\t\t\tClipboard.copyGridOverlay(singleNode.overlayGrid as any).catch(unhandledError)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Paste\",\n\t\t\t\tenabled: !isReadOnly && !!clipboardGrid,\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!clipboardGrid) return\n\n\t\t\t\t\tthis.nodes().forEach(node => {\n\t\t\t\t\t\tconst gridId = uuid()\n\t\t\t\t\t\ttriggerGridsCreateEvent({ gridId, source: \"paste\" })\n\t\t\t\t\t\tnode.set({ overlayGrid: { ...clipboardGrid, identifier: gridId } })\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Delete\",\n\t\t\t\tenabled: !isReadOnly && !!this.props.overlayGrid,\n\t\t\t\tclick: () => this.onDelete(),\n\t\t\t},\n\t\t]\n\t\tengine.stores.contextMenuStore.show(items, { location })\n\t}\n\n\toverride render() {\n\t\tconst { displayGrids, onlyCanvasFrameNodes, overlayGrid, rotation } = this.props\n\t\tif (!displayGrids || !onlyCanvasFrameNodes) return null\n\n\t\tconst enabled = isNumber(rotation) ? rotation === 0 : true\n\t\tif (!enabled) return null\n\n\t\treturn (\n\t\t\t<PanelRow title={Dictionary.Guides}>\n\t\t\t\t{isObject(overlayGrid) ? (\n\t\t\t\t\t<OverlayGridPopoutButton\n\t\t\t\t\t\tidentifier={isString(overlayGrid.identifier) ? overlayGrid.identifier : \"grid\"}\n\t\t\t\t\t\tgrid={overlayGrid}\n\t\t\t\t\t\tonChange={this.onChange}\n\t\t\t\t\t\tonDelete={this.onDelete}\n\t\t\t\t\t\tonContextMenu={this.onContextMenu}\n\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\ttype=\"grid-guides\"\n\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\tonClick={this.onAdd}\n\t\t\t\t\t\tonContextMenu={this.onContextMenu}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { IconGridColumn, IconGridRow, IconInputClose, truncateWithEllipsis, useReadOnly } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { OverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport type { OverlayGridProperty } from \"document/models/CanvasTree/traits/utils/reduceGrids.ts\"\nimport pluralize from \"pluralize\"\nimport React from \"react\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { PopoutButton } from \"../../shared/PopoutButton.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { OverlayGridPopout } from \"./OverlayGridPopout.tsx\"\nimport * as styles from \"./OverlayGridPopoutButton.styles.ts\"\nimport { IconAgentOverlayGridColumn, IconAgentOverlayGridRow } from \"./icons/IconAgentOverlayGrid.tsx\"\n\ninterface Props {\n\tgrid: OverlayGridProperty\n\tidentifier?: string\n\tenabled: boolean\n\tonDelete: () => void\n\tonChange: (key: keyof OverlayGrid, value: OverlayGrid[keyof OverlayGrid]) => void\n\tonContextMenu: (e: React.MouseEvent) => void\n}\n\nexport const OverlayGridPopoutButton = React.memo(function OverlayGridPopoutButton({\n\tenabled,\n\tidentifier,\n\tonDelete,\n\tonContextMenu,\n\t...gridItem\n}: Props) {\n\tconst isReadOnly = useReadOnly()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst { grid } = gridItem\n\n\tconst onKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === \"Delete\") onDelete()\n\t}\n\n\tconst onClickDelete = (event: React.MouseEvent) => {\n\t\t// Cancel opening of the popout\n\t\tevent.stopPropagation()\n\t\tonDelete()\n\t}\n\tconst disabledStyle = !enabled ? styles.disabled : undefined\n\treturn (\n\t\t<PopoutButton\n\t\t\tnavigationTitle={Dictionary.Guides}\n\t\t\tid={identifier}\n\t\t\tclassName={cx(styles.token, doubleColumnClass, disabledStyle)}\n\t\t\tdraggable={false}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tenabled={enabled}\n\t\t\tpopout={<OverlayGridPopout {...gridItem} />}\n\t\t\tdisplayDivider\n\t\t>\n\t\t\t<div className={cx(styles.iconWrapper, disabledStyle)}>{iconForGrid(grid, agentExperimentEnabled)}</div>\n\t\t\t<div className={cx(truncateWithEllipsis, styles.titleWrapper, disabledStyle)}>{titleForGrid(grid)}</div>\n\t\t\t{!isReadOnly && (\n\t\t\t\t<div\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\tonClick={onClickDelete}\n\t\t\t\t\ttitle={Dictionary.Delete}\n\t\t\t\t\tclassName={cx(styles.closeWrapper, disabledStyle)}\n\t\t\t\t>\n\t\t\t\t\t<IconInputClose />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PopoutButton>\n\t)\n})\n\nfunction titleForGrid(grid: OverlayGridProperty) {\n\tif (!isNumber(grid.count) || !isString(grid.type)) return Dictionary.Mixed\n\n\treturn `${grid.count} ${pluralize(grid.type === \"column\" ? Dictionary.Column : Dictionary.Row)}`\n}\n\nfunction iconForGrid(grid: OverlayGridProperty, agentExperimentEnabled: boolean) {\n\tif (!isString(grid.type)) return agentExperimentEnabled ? <IconAgentOverlayGridColumn /> : <IconGridColumn />\n\n\tswitch (grid.type) {\n\t\tcase \"row\":\n\t\t\treturn agentExperimentEnabled ? <IconAgentOverlayGridRow /> : <IconGridRow />\n\t\tcase \"column\":\n\t\t\treturn agentExperimentEnabled ? <IconAgentOverlayGridColumn /> : <IconGridColumn />\n\t\tdefault:\n\t\t\tassertNever(grid.type)\n\t}\n}\n", "import {\n\tIconAlignBottom,\n\tIconAlignCenter,\n\tIconAlignLeft,\n\tIconAlignMiddle,\n\tIconAlignRight,\n\tIconAlignTop,\n\tIconDistributeHorizontal,\n\tIconDistributeVertical,\n\tIconGridColumn,\n\tIconGridRow,\n\tNumberInputWithTicker,\n\tNumberInputWithTickerAndStepper,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tSlider,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type {\n\tOverlayDistribution,\n\tOverlayGrid,\n\tOverlayType,\n} from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { defaultOverlayGridColor } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { OverlayGridProperty } from \"document/models/CanvasTree/traits/utils/reduceGrids.ts\"\nimport { useCallback } from \"react\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { IconAgentOverlayGridColumn, IconAgentOverlayGridRow } from \"./icons/IconAgentOverlayGrid.tsx\"\n\ninterface Props {\n\tonChange: (key: keyof OverlayGrid, value: OverlayGrid[keyof OverlayGrid]) => void\n\tgrid: OverlayGridProperty\n}\n\nexport function OverlayGridPopout({ onChange, grid }: Props) {\n\tconst defaultColor = defaultOverlayGridColor()\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst onChangeType = useCallback((value: OverlayType) => onChange(\"type\", value), [onChange])\n\tconst onChangeCount = useCallback((value: number) => onChange(\"count\", value), [onChange])\n\tconst onChangeDistribution = useCallback((value: OverlayDistribution) => onChange(\"distribution\", value), [onChange])\n\tconst onChangeSize = useCallback((value: number) => onChange(\"size\", value), [onChange])\n\tconst onChangeGap = useCallback((value: number) => onChange(\"gap\", value), [onChange])\n\tconst onChangeMargin = useCallback((value: number) => onChange(\"margin\", value), [onChange])\n\tconst onChangeColor = useCallback((value: string) => onChange(\"color\", value), [onChange])\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.popoverPadding}\n\t\t\tpaddingRight={dimensions.css.popoverPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem<OverlayType>\n\t\t\t\t\t\tidentifier=\"column\"\n\t\t\t\t\t\ttitle={Dictionary.Columns}\n\t\t\t\t\t\tselected={grid.type === \"column\"}\n\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentOverlayGridColumn /> : <IconGridColumn />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem<OverlayType>\n\t\t\t\t\t\tidentifier=\"row\"\n\t\t\t\t\t\ttitle={Dictionary.Rows}\n\t\t\t\t\t\tselected={grid.type === \"row\"}\n\t\t\t\t\t\tonSelect={onChangeType}\n\t\t\t\t\t>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentOverlayGridRow /> : <IconGridRow />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Count\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={notFoundToUndefined(grid.count)}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={48}\n\t\t\t\t\tonChange={onChangeCount}\n\t\t\t\t\tstep={1}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Align\">\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem<OverlayDistribution>\n\t\t\t\t\t\tidentifier=\"left\"\n\t\t\t\t\t\ttitle=\"Left\"\n\t\t\t\t\t\tselected={grid.distribution === \"left\"}\n\t\t\t\t\t\tonSelect={onChangeDistribution}\n\t\t\t\t\t>\n\t\t\t\t\t\t{grid.type === \"column\" ? <IconAlignLeft /> : <IconAlignTop />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem<OverlayDistribution>\n\t\t\t\t\t\tidentifier=\"center\"\n\t\t\t\t\t\ttitle=\"Center\"\n\t\t\t\t\t\tselected={grid.distribution === \"center\"}\n\t\t\t\t\t\tonSelect={onChangeDistribution}\n\t\t\t\t\t>\n\t\t\t\t\t\t{grid.type === \"column\" ? <IconAlignCenter /> : <IconAlignMiddle />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem<OverlayDistribution>\n\t\t\t\t\t\tidentifier=\"right\"\n\t\t\t\t\t\ttitle=\"Right\"\n\t\t\t\t\t\tselected={grid.distribution === \"right\"}\n\t\t\t\t\t\tonSelect={onChangeDistribution}\n\t\t\t\t\t>\n\t\t\t\t\t\t{grid.type === \"column\" ? <IconAlignRight /> : <IconAlignBottom />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem<OverlayDistribution>\n\t\t\t\t\t\tidentifier=\"stretch\"\n\t\t\t\t\t\ttitle=\"Stretch\"\n\t\t\t\t\t\tselected={grid.distribution === \"stretch\"}\n\t\t\t\t\t\tonSelect={onChangeDistribution}\n\t\t\t\t\t>\n\t\t\t\t\t\t{grid.type === \"column\" ? <IconDistributeHorizontal /> : <IconDistributeVertical />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\n\t\t\t<PanelRow title={grid.type === \"row\" ? \"Height\" : \"Width\"}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={grid.distribution !== \"stretch\" ? notFoundToUndefined(grid.size) : Dictionary.Auto}\n\t\t\t\t\tonChange={onChangeSize}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tdefaultValue={100}\n\t\t\t\t\tenabled={grid.distribution !== \"stretch\"}\n\t\t\t\t/>\n\t\t\t\t<Slider\n\t\t\t\t\tvalue={notFoundToUndefined(grid.size)}\n\t\t\t\t\tmax={500}\n\t\t\t\t\tonChange={onChangeSize}\n\t\t\t\t\tenabled={grid.distribution !== \"stretch\"}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Gap\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(grid.gap)}\n\t\t\t\t\tonChange={onChangeGap}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tdefaultValue={engine.stores.persistedUserDefaults.layoutGap}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(grid.gap)} max={100} onChange={onChangeGap} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Margin\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(grid.margin)}\n\t\t\t\t\tonChange={onChangeMargin}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tdefaultValue={100}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(grid.margin)} max={200} onChange={onChangeMargin} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Color\">\n\t\t\t\t<ColorPopoutButton\n\t\t\t\t\tnavigationTitle=\"Color\"\n\t\t\t\t\tvalue={isFound(grid.color) ? grid.color : defaultColor}\n\t\t\t\t\tonChange={onChangeColor}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n", "import \"OverlayGridPopoutButton.styles_mbgs43.wyw.css\"; export const token = \"token_t1mudma9\";\nexport const iconWrapper = \"iconWrapper_ie9qdsa\";\nexport const titleWrapper = \"titleWrapper_t186obuy\";\nexport const closeWrapper = \"closeWrapper_c83hz6d\";\nexport const disabled = \"disabled_dzl2i9w\";", "import { IconOverlay } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport engine from \"document/engine.ts\"\nimport { isDismissOverlayAction, isShowOverlayAction } from \"document/models/CanvasTree/actions/overlayActions.ts\"\nimport type { CanvasNode, CodeComponentNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tcreateOverlayWithEvent,\n\tcreateOverlayWithTriggerAction,\n} from \"document/models/CanvasTree/nodes/utils/overlayCreationHelpers.ts\"\nimport {\n\tisFixedOrRelativeOverlay,\n\tnodeCanTriggerOverlay,\n} from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { getChildren, withChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport type { WithFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { hasTriggerActions } from \"document/models/CanvasTree/traits/WithTriggerActions.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { ReducedWhileOpenEffect } from \"document/models/CanvasTree/traits/WithWhileOpenEffect.ts\"\nimport { withWhileOpenEffect } from \"document/models/CanvasTree/traits/WithWhileOpenEffect.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { isShallowArrayEqual } from \"utils/isShallowEqual.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport { ButtonWithPreview } from \"../../shared/ButtonWithPreview.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { showAnalyticsEventsUpsell } from \"../../shared/UpsellModal/utils/analyticsEventsUpsellModals.ts\"\nimport { showTriggerUpsell } from \"../../shared/UpsellModal/utils/triggerUpsellModals.ts\"\nimport { VariantSelector } from \"../codeComponentRows/VariantSelector.tsx\"\nimport { useSelectedNodeVariants } from \"../rows/EffectRows/shared/useSelectedNodeVariants.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { eventsForNode } from \"../utils/eventActions.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport type { EventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\nimport { eventKeyToDisplayName, getMemoEventKeyToDisplayNameMap } from \"./utils/eventKeyToDisplayName.ts\"\n\ninterface Props extends Pick<ReducedWhileOpenEffect, \"whileOpenEffectVariant\"> {\n\tnodes: CanvasNode[]\n\tselection: NodeID[]\n\treadOnly: boolean\n\tscopeType: ScopeType\n\tcodeComponentIdentifiers: Set<string>\n\tcomponentHash: string\n}\n\ntype EventTitleToActions = Record<string, { action: EventAction; actionIndex: number; eventKey: string }[]>\n\nfunction getEventTitleToActions({\n\teventKeys,\n\tnodeEvents,\n\tdisplayNameMap,\n}: {\n\teventKeys: string[]\n\tnodeEvents: ReturnType<typeof eventsForNode>\n\tdisplayNameMap: EventKeyToDisplayNameMap | null\n}): { eventTitleToActions: EventTitleToActions; hasAnyShowOverlayActions: boolean } {\n\tconst eventTitleToActions: EventTitleToActions = {}\n\tlet hasAnyShowOverlayActions = false\n\tfor (const eventKey of eventKeys) {\n\t\tconst actions = nodeEvents[eventKey]\n\t\tif (!actions || !isArray(actions)) continue\n\n\t\tactions.forEach((action, actionIndex) => {\n\t\t\tif (!isShowOverlayAction(action) && !isDismissOverlayAction(action)) return\n\t\t\tconst overlayEventDisplayNameMap = { ...displayNameMap }\n\n\t\t\tif (isShowOverlayAction(action)) {\n\t\t\t\thasAnyShowOverlayActions = true\n\t\t\t\t// Rename \"Mouse Enter\" to \"Hover\" to make it more user friendly, also for relative overlays we already\n\t\t\t\t// handle dismissing on mouse leave.\n\t\t\t\toverlayEventDisplayNameMap.onMouseEnter = Dictionary.Hover\n\t\t\t}\n\n\t\t\tconst eventKeyTitle = eventKeyToDisplayName(eventKey, overlayEventDisplayNameMap)\n\t\t\tconst actionsWithTitle = eventTitleToActions[eventKeyTitle] ?? []\n\t\t\tactionsWithTitle.push({ action, actionIndex, eventKey })\n\t\t\teventTitleToActions[eventKeyTitle] = actionsWithTitle\n\t\t})\n\t}\n\n\treturn { eventTitleToActions, hasAnyShowOverlayActions }\n}\n\nexport const OverlaysPanel = React.memo(function OverlaysPanel({\n\tnodes,\n\treadOnly,\n\tscopeType,\n\tselection,\n\tcodeComponentIdentifiers,\n\twhileOpenEffectVariant,\n\tcomponentHash,\n}: Props) {\n\tconst singleNodeId = selection[0]\n\tconst topLevelVariants = useSelectedNodeVariants({\n\t\tid: singleNodeId,\n\t\tcomponentHash,\n\t\tcodeComponentIdentifiers,\n\t})\n\n\tconst setWhileOpenEffect = useEngineCallback(\n\t\t(id: string | undefined) => {\n\t\t\tif (selection.length > 1) return\n\n\t\t\tconst node = engine.tree.getNodeWithTrait(selection[0], withWhileOpenEffect)\n\t\t\tif (!node) return\n\n\t\t\tnode.set({ whileOpenEffectEnabled: true, whileOpenEffectVariant: id })\n\t\t},\n\t\t[selection],\n\t)\n\n\tconst removeWhileOpenEffect = useEngineCallback(() => {\n\t\tif (selection.length > 1) return\n\n\t\tconst node = engine.tree.getNodeWithTrait(selection[0], withWhileOpenEffect)\n\t\tif (!node) return\n\n\t\tnode.set({ whileOpenEffectEnabled: false, whileOpenEffectVariant: undefined })\n\t}, [selection])\n\n\tconst node = nodes[0]\n\tconst groupedOverlays = useGroupedOverlays(node)\n\n\tif (!node || !groupedOverlays) return null\n\n\tconst groupedOverlaysEntries = Object.entries(groupedOverlays)\n\n\tconst handleAddOverlay = (event: React.MouseEvent) => {\n\t\tif (readOnly) return\n\t\tconst isNodeWithFrameEvents = withFrameEvents(node)\n\t\tif (!isNodeWithFrameEvents && !isCodeComponentNode(node)) return\n\n\t\t// Relative overlay is the only type we support in Smart Components, no need to show the menu.\n\t\tif (scopeType === ScopeType.SmartComponent) {\n\t\t\tcreateOverlay(engine, HardCodedCodeIdentifier.showRelativeOverlayAction, node.id)\n\t\t\treturn\n\t\t}\n\n\t\tconst menu = getOverlayMenuItems(node, scopeType)\n\t\tif (!menu || menu.length === 0) return\n\t\tengine.stores.contextMenuStore.show(menu, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title=\"Overlays\" onMouseDown={handleAddOverlay} clickable={!readOnly}>\n\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{groupedOverlaysEntries.flatMap(([groupTitle, overlays]) =>\n\t\t\t\toverlays.map(({ overlayId, enabled }, index) => (\n\t\t\t\t\t<PanelRow key={overlayId} title={index === 0 ? groupTitle : \" \"}>\n\t\t\t\t\t\t<ButtonWithPreview\n\t\t\t\t\t\t\tdoubleColumn\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\ttitle={getOverlayName(overlayId)}\n\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t<IconOverlay />\n\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonPresent={() => enabled && showOverlay(overlayId, node.id)}\n\t\t\t\t\t\t\tonDelete={() => deleteOverlay(overlayId, node)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)),\n\t\t\t)}\n\t\t\t{groupedOverlaysEntries.length > 0 && topLevelVariants.length > 0 && (\n\t\t\t\t<PanelRow title=\"On Open\" onDelete={removeWhileOpenEffect}>\n\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\tselection={whileOpenEffectVariant}\n\t\t\t\t\t\tonSelect={setWhileOpenEffect}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n\nfunction useGroupedOverlays(node: CanvasNode | undefined) {\n\tconst nodeEvents = node ? eventsForNode(engine.componentLoader, node) : {}\n\tconst eventKeys = useMemoizedEventKeys(nodeEvents)\n\n\tif (!node) return undefined\n\n\tconst displayNameMap = isCodeComponentNode(node)\n\t\t? getMemoEventKeyToDisplayNameMap(engine.componentLoader, node)\n\t\t: null\n\n\tconst { eventTitleToActions } = getEventTitleToActions({\n\t\teventKeys,\n\t\tnodeEvents,\n\t\tdisplayNameMap,\n\t})\n\tconst groupedOverlays: Record<string, { overlayId: NodeID; enabled: boolean }[]> = {}\n\tconst overlayIds = new Set<NodeID>()\n\tfor (const eventKeyTitle in eventTitleToActions) {\n\t\tconst actionsInfo = eventTitleToActions[eventKeyTitle]\n\t\tif (!actionsInfo) continue\n\n\t\tfor (const actionInfo of actionsInfo) {\n\t\t\tif (!isShowOverlayAction(actionInfo.action)) continue\n\n\t\t\tconst overlayId = actionInfo.action.controls.overlay.value\n\t\t\toverlayIds.add(overlayId)\n\n\t\t\tgroupedOverlays[eventKeyTitle] ??= []\n\t\t\tgroupedOverlays[eventKeyTitle].push({\n\t\t\t\toverlayId,\n\t\t\t\tenabled: nodeCanTriggerOverlay(node, actionInfo.action.actionIdentifier),\n\t\t\t})\n\t\t}\n\t}\n\n\tfor (const child of getChildren(node)) {\n\t\tif (overlayIds.has(child.id)) continue\n\t\tif (!isFixedOrRelativeOverlay(child) || !hasTriggerActions(child)) continue\n\n\t\tgroupedOverlays.Trigger ??= []\n\t\tgroupedOverlays.Trigger.push({\n\t\t\toverlayId: child.id,\n\t\t\tenabled: nodeCanTriggerOverlay(node, HardCodedCodeIdentifier.showOverlayAction),\n\t\t})\n\t}\n\n\treturn groupedOverlays\n}\n\nfunction useMemoizedEventKeys(nodeEvents: ReturnType<typeof eventsForNode>) {\n\tconst allEventKeysRef = React.useRef<string[]>([])\n\tconst eventKeys = Object.keys(nodeEvents)\n\n\tif (!isShallowArrayEqual(eventKeys, allEventKeysRef.current)) {\n\t\tallEventKeysRef.current = eventKeys\n\t}\n\treturn allEventKeysRef.current\n}\n\nfunction getOverlayName(overlayNodeId: NodeID) {\n\tconst overlayNode = engine.tree.getNode(overlayNodeId)\n\tif (!overlayNode) return Dictionary.Missing\n\treturn overlayNode.resolveValue(\"name\") || getDefaultName(engine.componentLoader, overlayNode)\n}\n\nconst showOverlay = engine.scheduler.wrapHandler((overlayId: NodeID, triggerId: NodeID) => {\n\tconst node = engine.tree.get(overlayId)\n\tif (!node || !isFixedOrRelativeOverlay(node)) return\n\tengine.stores.overlayStore.showOverlay(engine.stores.selectionStore, node, triggerId)\n})\n\nconst deleteOverlay = engine.scheduler.wrapHandler((overlayId: NodeID, trigger: CanvasNode) => {\n\tconst { overlayStore, selectionStore } = engine.stores\n\n\tassert(\n\t\toverlayId !== trigger.cache.overlayAncestorId,\n\t\t\"Events Panel: Attempting to delete a trigger for a parent overlay.\",\n\t)\n\n\toverlayStore.delete(selectionStore, overlayId, trigger.id)\n\tselectionStore.set(trigger)\n})\n\nfunction getOverlayMenuItems(node: (CanvasNode & WithFrameEvents) | CodeComponentNode, scopeType: ScopeType) {\n\tconst menuItems: MenuItemOptions[] = []\n\n\tif (!withChildren(node)) return\n\n\tif (nodeCanTriggerOverlay(node, HardCodedCodeIdentifier.showRelativeOverlayAction)) {\n\t\tmenuItems.push({\n\t\t\tlabel: \"Relative\",\n\t\t\tdescription: \"Dropdowns, popovers\",\n\t\t\t// When node can use frame events, we simply add a default relative overlay to the hover trigger first, user can switch to different trigger on the overlay node.\n\t\t\tclick: () => createOverlay(engine, HardCodedCodeIdentifier.showRelativeOverlayAction, node.id),\n\t\t})\n\t}\n\n\tif (\n\t\tnodeCanTriggerOverlay(node, HardCodedCodeIdentifier.showOverlayAction) &&\n\t\t(scopeType === ScopeType.WebPage || scopeType === ScopeType.LayoutTemplate)\n\t) {\n\t\tmenuItems.push({\n\t\t\tlabel: \"Fixed\",\n\t\t\tdescription: \"Modals, toasts, videos\",\n\t\t\tclick: () => createOverlay(engine, HardCodedCodeIdentifier.showOverlayAction, node.id),\n\t\t})\n\t}\n\n\treturn menuItems\n}\n\nconst createOverlay = (\n\tengine: VekterEngine,\n\tactionIdentifier: HardCodedCodeIdentifier.showOverlayAction | HardCodedCodeIdentifier.showRelativeOverlayAction,\n\ttriggerId: NodeID,\n) => {\n\tconst parent = engine.tree.get(triggerId)\n\tif (!parent) return\n\n\tengine.scheduler.process(() => {\n\t\tlet overlay: ReturnType<typeof createOverlayWithEvent> | undefined\n\n\t\tif (isBreakpointVariant(parent)) {\n\t\t\tif (showTriggerUpsell(engine, \"properties\")) return\n\t\t\tif (showAnalyticsEventsUpsell(engine, \"properties\")) return\n\n\t\t\toverlay = createOverlayWithTriggerAction(engine.stores, actionIdentifier, triggerId)\n\t\t} else {\n\t\t\toverlay = createOverlayWithEvent(engine.componentLoader, engine.stores, actionIdentifier, triggerId)\n\t\t}\n\n\t\tif (!overlay) return\n\n\t\t// Show the overlay in the next frame, so that the overlay node and its replicas are created and expanded.\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tengine.stores.overlayStore.showOverlay(engine.stores.selectionStore, overlay, triggerId)\n\t\t})\n\t})\n}\n\nexport const OverlaysPanelTesting = {\n\tcreateOverlay,\n}\n", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport {\n\tassert,\n\ttype ModuleBareIdentifierString,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { CodeFileCreationType } from \"document/stores/ModalStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\n\ninterface Props {\n\tcomponentHash: string | number | null\n\tselectedBareModuleIdentifiers: Set<ModuleBareIdentifierString>\n\tplaceholder?: string\n\tonSelect: (bareModuleIdentifier: ModuleBareIdentifierString) => void\n}\n\nfunction isEntitySelected(entity: EntityDefinition, selectedBareModuleIdentifiers?: Set<ModuleBareIdentifierString>) {\n\tif (!selectedBareModuleIdentifiers) return false\n\n\tfor (const identifier of selectedBareModuleIdentifiers) {\n\t\tif (entity.identifier.startsWith(identifier)) return true\n\t}\n\treturn false\n}\n\nexport class FileRow extends React.Component<Props> {\n\tstatic getAvailableModules(allowNonPreferredTypeForBareModuleIdentifiers?: Set<ModuleBareIdentifierString>): {\n\t\tidentifiersByTitle: Map<string, ModuleBareIdentifierString>\n\t\ttitles: string[]\n\t\tbareModuleIdentifiers: Set<ModuleBareIdentifierString>\n\t} {\n\t\tconst titles: string[] = []\n\t\tconst identifiersByTitle = new Map<string, ModuleBareIdentifierString>()\n\t\tconst seenBareModuleIdentifiers = new Set<ModuleBareIdentifierString>()\n\n\t\tfor (const component of engine.componentLoader.getAllLocalModules()) {\n\t\t\tif (!isModuleExportIdentifier(component.identifier)) continue\n\t\t\tif (component.type !== \"component\" && component.type !== \"hoc\") continue\n\t\t\tif (component.type !== \"hoc\" && !isEntitySelected(component, allowNonPreferredTypeForBareModuleIdentifiers)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst parsed = parseModuleIdentifier(component.identifier)\n\n\t\t\tif (seenBareModuleIdentifiers.has(parsed.bareValue)) continue\n\t\t\tseenBareModuleIdentifiers.add(parsed.bareValue)\n\n\t\t\tconst title = component.file\n\t\t\ttitles.push(title)\n\t\t\tidentifiersByTitle.set(title, parsed.bareValue)\n\t\t}\n\n\t\treturn { identifiersByTitle, titles: titles.sort(), bareModuleIdentifiers: seenBareModuleIdentifiers }\n\t}\n\n\toverride render() {\n\t\tconst { selectedBareModuleIdentifiers, onSelect, placeholder = Dictionary.SelectEllipsis } = this.props\n\t\tconst nothingSelected = selectedBareModuleIdentifiers.size === 0\n\n\t\tconst { titles, identifiersByTitle } = FileRow.getAvailableModules(selectedBareModuleIdentifiers)\n\n\t\treturn (\n\t\t\t<PanelRow title=\"File\">\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey=\"select-module-key\"\n\t\t\t\t\t\t\ttitle={placeholder}\n\t\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\t\tselected={nothingSelected}\n\t\t\t\t\t\t\tvisible={nothingSelected}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{titles.map((title, idx) => {\n\t\t\t\t\t\t\tconst identifier = identifiersByTitle.get(title)\n\t\t\t\t\t\t\tassert(identifier, `No identifier found for title ${title}`)\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={`${idx}-${title}`}\n\t\t\t\t\t\t\t\t\tidentifier={identifier}\n\t\t\t\t\t\t\t\t\ttitle={labelForItem(identifier, title)}\n\t\t\t\t\t\t\t\t\tselected={selectedBareModuleIdentifiers.has(identifier)}\n\t\t\t\t\t\t\t\t\tonSelect={onSelect}\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\t<PopupButtonItem key=\"new-module-divider\" type=\"divider\" />\n\t\t\t\t\t\t<PopupButtonItem key=\"new-module-key\" title=\"New File\u2026\" onSelect={onCreate} />\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n\nfunction onCreate() {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.CodeFileCreation,\n\t\tsource: \"main_menu\",\n\t\tcreationType: CodeFileCreationType.Override,\n\t})\n}\n\nfunction labelForItem(identifier: ModuleBareIdentifierString, title: string) {\n\tif (isExternalModuleIdentifier(identifier)) {\n\t\treturn \"External\"\n\t}\n\treturn title.replace(/^\\.\\/(.*)\\.(?:tsx|ts|js)$/u, \"$1\")\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isLocalModuleIdentifier, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isFoundAndNotMixed, type Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React from \"react\"\nimport { PanelElementId } from \"../panels/utils/highlightPanel.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\n\ninterface Props {\n\tcomponentHash: string\n\tselectedBareModuleIdentifier: Reduced<string>\n\tselectedOverrideExportSpecifier: Reduced<string | undefined>\n\tonSelectOverride: (selectedOverrideIdentifier: string) => void\n}\n\ninterface AvailableOverride {\n\tname: string\n\tidentifier: string\n\texportSpecifier: string\n}\n\nexport class OverrideRow extends React.Component<Props> {\n\tprivate static getAvailableOverrides({\n\t\tforFile,\n\t\tallowNonPreferredTypeForOverride,\n\t}: {\n\t\tforFile: string\n\t\tallowNonPreferredTypeForOverride: Reduced<string | undefined>\n\t}): AvailableOverride[] {\n\t\tconst availableOverrides: AvailableOverride[] = []\n\n\t\tfor (const component of engine.componentLoader.getAllEntities()) {\n\t\t\tif (!isLocalModuleIdentifier(component.identifier) || !isModuleExportIdentifier(component.identifier)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (component.type !== \"component\" && component.type !== \"hoc\") continue\n\t\t\tif (component.type !== \"hoc\" && component.identifier !== allowNonPreferredTypeForOverride) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst parsed = parseModuleIdentifier(component.identifier)\n\t\t\tif (parsed.bareValue !== forFile) continue\n\n\t\t\tavailableOverrides.push({\n\t\t\t\tname: component.name,\n\t\t\t\tidentifier: component.identifier,\n\t\t\t\texportSpecifier: parsed.exportSpecifier,\n\t\t\t})\n\t\t}\n\n\t\treturn availableOverrides.sort((a, b) => a.name.localeCompare(b.name))\n\t}\n\n\toverride render() {\n\t\tconst { selectedBareModuleIdentifier, selectedOverrideExportSpecifier, onSelectOverride } = this.props\n\n\t\tif (!isFoundAndNotMixed(selectedBareModuleIdentifier)) return null\n\n\t\tconst availableOverrides = OverrideRow.getAvailableOverrides({\n\t\t\tforFile: selectedBareModuleIdentifier,\n\t\t\tallowNonPreferredTypeForOverride: selectedOverrideExportSpecifier,\n\t\t})\n\n\t\tconst selectedOverride = availableOverrides.find(\n\t\t\toverride => override.exportSpecifier === selectedOverrideExportSpecifier,\n\t\t)\n\n\t\tconst specifierStringFromProp = isFoundAndNotMixed(selectedOverrideExportSpecifier)\n\t\t\t? selectedOverrideExportSpecifier\n\t\t\t: undefined\n\t\tconst selectedOverrideMissing = specifierStringFromProp !== undefined && !selectedOverride\n\t\tconst nameFromIdentifier = selectedOverride?.exportSpecifier ?? specifierStringFromProp\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Override\" id={PanelElementId.CodeOverridePanel}>\n\t\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\tselectedOverrideMissing && nameFromIdentifier\n\t\t\t\t\t\t\t\t? `\u26A0 ${nameFromIdentifier} (missing)`\n\t\t\t\t\t\t\t\t: Dictionary.SelectEllipsis\n\t\t\t\t\t\t}\n\t\t\t\t\t\tselected={!selectedOverride}\n\t\t\t\t\t\tvisible={!selectedOverride}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem type=\"divider\" />\n\t\t\t\t\t{availableOverrides.map(override => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={override.identifier}\n\t\t\t\t\t\t\t\tidentifier={override.identifier}\n\t\t\t\t\t\t\t\ttitle={override.name}\n\t\t\t\t\t\t\t\tselected={selectedOverrideExportSpecifier === override.exportSpecifier}\n\t\t\t\t\t\t\t\tonSelect={onSelectOverride}\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</PopupButton>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n}\n", "import { triggerComponentCodeOverrideSetEvent } from \"@framerjs/framer-events\"\nimport { Button, ReadOnlyContext, Translatable as T } from \"@framerjs/fresco\"\nimport {\n\tassert,\n\ttype ModuleBareIdentifierString,\n\ttype ModuleExportIdentifierString,\n\tisExternalModuleIdentifier,\n\tisMixed,\n} from \"@framerjs/shared\"\nimport { Panel } from \"document/components/chrome/properties/panels/Panel.tsx\"\nimport { FileRow } from \"document/components/chrome/properties/rows/FileRow.tsx\"\nimport { OverrideRow } from \"document/components/chrome/properties/rows/OverrideRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReducedOverrides, WithCodeOverride } from \"document/models/CanvasTree/traits/WithCodeOverride.ts\"\nimport { withCodeOverride } from \"document/models/CanvasTree/traits/WithCodeOverride.ts\"\nimport { isReplicaVariantOrReplicaVariantChild } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport React from \"react\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { createCodeOverrideFile } from \"utils/createCodeOverride.ts\"\nimport { getFirstItemFromIterable } from \"utils/getFirstItemFromIterable.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { spanAllColumns } from \"../utils/FormContainerPanel.styles.ts\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nconst examplesFileName = \"Examples\"\n\ninterface State {\n\tbareModuleIdentifier: ModuleBareIdentifierString | undefined\n}\n\ninterface Props extends ReducedOverrides {\n\tallNodeIds: NodeID[]\n\treadOnly: boolean\n\tcomponentHash: string\n}\n\nexport class OverridePanel extends React.PureComponent<Props, State> {\n\tconstructor(props: Props) {\n\t\tsuper(props)\n\n\t\tthis.state = { bareModuleIdentifier: undefined }\n\t}\n\n\tupdateNodesWithOverride = (\n\t\tcodeOverrideEnabled: boolean | undefined,\n\t\tcodeOverrideIdentifier: ModuleExportIdentifierString | undefined,\n\t\tbareModuleIdentifier?: ModuleBareIdentifierString | undefined,\n\t) => {\n\t\tengine.setEditReason(\"overrides\")\n\n\t\tconst update: WithCodeOverride = {\n\t\t\tcodeOverrideEnabled: Boolean(codeOverrideEnabled),\n\t\t\tcodeOverrideIdentifier,\n\t\t}\n\n\t\tengine.tree.getNodesWithTrait(this.props.allNodeIds, withCodeOverride).forEach(node => {\n\t\t\tif (isReplicaVariantOrReplicaVariantChild(node)) {\n\t\t\t\tconst originalNode = engine.tree.getNode(node.originalid)\n\t\t\t\tif (!originalNode) return\n\t\t\t\tassert(withCodeOverride(originalNode))\n\t\t\t\toriginalNode.set(update)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnode.set(update)\n\t\t})\n\n\t\tthis.setState({ bareModuleIdentifier })\n\t}\n\n\tremoveConnection = engine.scheduler.wrapHandler((event: React.MouseEvent<HTMLDivElement>) => {\n\t\tevent.stopPropagation()\n\t\tthis.updateNodesWithOverride(false, undefined)\n\t})\n\n\tonSelectModule = engine.scheduler.wrapHandler((selectedModule: ModuleBareIdentifierString | null) => {\n\t\tthis.updateNodesWithOverride(true, undefined, selectedModule ?? undefined)\n\t})\n\n\tedit = () => {\n\t\tconst selectedModuleIdentifier = this.selectedModule()\n\t\tif (!isString(selectedModuleIdentifier)) return\n\t\tengine.stores.codeEditorStore.editFile(selectedModuleIdentifier)\n\t}\n\n\tselectedBareModuleIdentifiers(): Set<ModuleBareIdentifierString> {\n\t\tif (isString(this.state.bareModuleIdentifier)) {\n\t\t\treturn new Set([this.state.bareModuleIdentifier])\n\t\t}\n\n\t\tconst { bareModuleIdentifiers } = FileRow.getAvailableModules(this.props.codeOverrideBareModuleIdentifiers)\n\n\t\tconst availableSelectedModules = new Set<ModuleBareIdentifierString>()\n\t\tfor (const bareModuleIdentifier of this.props.codeOverrideBareModuleIdentifiers) {\n\t\t\tif (bareModuleIdentifiers.has(bareModuleIdentifier)) availableSelectedModules.add(bareModuleIdentifier)\n\t\t}\n\n\t\treturn availableSelectedModules\n\t}\n\n\tisEditableModule(identifier: ModuleBareIdentifierString): boolean {\n\t\treturn FileRow.getAvailableModules().bareModuleIdentifiers.has(identifier)\n\t}\n\n\tselectedModule = () => {\n\t\treturn commonValue(this.selectedBareModuleIdentifiers())\n\t}\n\n\tonSelectOverride = engine.scheduler.wrapHandler((selectedOverrideIdentifier: ModuleExportIdentifierString) => {\n\t\tconst module = this.selectedModule()\n\t\tif (isMixed(module) || isNotFound(module)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst overrideComponent = engine.componentLoader.componentForIdentifier(selectedOverrideIdentifier)\n\t\tif (!overrideComponent) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.updateNodesWithOverride(true, selectedOverrideIdentifier)\n\n\t\ttriggerComponentCodeOverrideSetEvent({})\n\t})\n\n\taddAction = engine.scheduler.wrapHandler((e: React.MouseEvent) => {\n\t\te.stopPropagation()\n\n\t\tthis.updateNodesWithOverride(true, undefined)\n\n\t\tconst { titles, identifiersByTitle } = FileRow.getAvailableModules()\n\n\t\tif (titles.length > 0) {\n\t\t\tconst identifier = identifiersByTitle.get(titles[0]!)\n\t\t\tthis.onSelectModule(identifier ?? null)\n\t\t\treturn\n\t\t}\n\n\t\tconst { name, content } = createCodeOverrideFile(examplesFileName)\n\t\tengine.stores.codeEditorStore.createFile({ path: name, content, openFile: false, openPreview: false })\n\t})\n\n\toverride render() {\n\t\tconst {\n\t\t\tcomponentHash,\n\t\t\tcodeOverrideEnabled,\n\t\t\tcodeOverrideBareModuleIdentifiers,\n\t\t\tcodeOverrideModuleExportNames,\n\t\t\treadOnly,\n\t\t} = this.props\n\n\t\tif (isNotFound(codeOverrideEnabled)) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst selectedBareModuleIdentifier = this.selectedModule()\n\t\tconst codeOverrideExportSpecifier = commonValue(codeOverrideModuleExportNames)\n\n\t\tconst panelOpen = codeOverrideEnabled === true\n\n\t\tconst editCodeButtonVisible =\n\t\t\tisString(selectedBareModuleIdentifier) && this.isEditableModule(selectedBareModuleIdentifier)\n\n\t\treturn (\n\t\t\t<Panel\n\t\t\t\theader={\n\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\ttitle={<T>Code Overrides</T>}\n\t\t\t\t\t\tonClick={panelOpen || readOnly ? undefined : this.addAction}\n\t\t\t\t\t\tclickable={!panelOpen && !readOnly}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PanelSectionHeaderButton onClick={panelOpen ? this.removeConnection : undefined}>\n\t\t\t\t\t\t\t{panelOpen ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{panelOpen && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<FileRow\n\t\t\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\t\t\tselectedBareModuleIdentifiers={this.selectedBareModuleIdentifiers()}\n\t\t\t\t\t\t\tonSelect={this.onSelectModule}\n\t\t\t\t\t\t\tplaceholder={getPlaceholder(\n\t\t\t\t\t\t\t\tcodeOverrideBareModuleIdentifiers,\n\t\t\t\t\t\t\t\tselectedBareModuleIdentifier,\n\t\t\t\t\t\t\t\tcodeOverrideExportSpecifier,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<OverrideRow\n\t\t\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\t\t\tselectedBareModuleIdentifier={selectedBareModuleIdentifier}\n\t\t\t\t\t\t\tselectedOverrideExportSpecifier={codeOverrideExportSpecifier}\n\t\t\t\t\t\t\tonSelectOverride={this.onSelectOverride}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{editCodeButtonVisible && (\n\t\t\t\t\t\t\t<ReadOnlyContext.Consumer>\n\t\t\t\t\t\t\t\t{isReadOnly => (\n\t\t\t\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t\t\t\t<Button title={isReadOnly ? \"View Code\" : \"Edit Code\"} onClick={this.edit} style={spanAllColumns} />\n\t\t\t\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</ReadOnlyContext.Consumer>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Panel>\n\t\t)\n\t}\n}\n\nfunction getPlaceholder(\n\tcodeOverrideFileBareModuleIdentifiers: Set<ModuleBareIdentifierString>,\n\tcodeOverrideFile: Reduced<string>,\n\tcodeOverrideExportSpecifier: Reduced<string | undefined>,\n): string | undefined {\n\t// NOTE: This will also trigger during load, but technically the file is then also \u201Cmissing\u201D\n\tif (isMixed(codeOverrideFile) && !isString(codeOverrideExportSpecifier)) {\n\t\treturn `\u26A0 Missing`\n\t}\n\n\t// FIXME: We should support external override modules better. So you can switch between them and pick specific overrides.\n\tconst isExternal =\n\t\tcodeOverrideFileBareModuleIdentifiers.size === 1 &&\n\t\tisExternalModuleIdentifier(getFirstItemFromIterable(codeOverrideFileBareModuleIdentifiers))\n\n\tif (isExternal) {\n\t\treturn \"External\"\n\t}\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { OverscrollBehavior } from \"document/models/CanvasTree/traits/WithOverscrollBehavior.ts\"\nimport {\n\tallOverscrollBehaviorValues,\n\tisOverscrollBehavior,\n\twithOverscrollBehavior,\n} from \"document/models/CanvasTree/traits/WithOverscrollBehavior.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedOverscrollBehavior } from \"document/models/CanvasTree/traits/utils/reduceOverscrollBehavior.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { overscrollBehaviorVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\nconst traitTypes = [TraitType.Overscroll]\n\nconst popoutId = \"overscroll-behaviour-popout\"\n\nconst overscrollBehaviorControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"overscrollBehavior\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface Props extends ReducedOverscrollBehavior {\n\tnodeIds: NodeID[]\n}\n\nexport const OverscrollBehaviorPanel = React.memo(function OverscrollBehaviorPanel({\n\tnodeIds,\n\toverscrollBehavior,\n\tonlyNodesWithOverscrollBehavior,\n}: Props) {\n\tconst canCopy = !isMixed(overscrollBehavior)\n\tconst [canPaste, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.Overscroll, nodeIds, canCopy)\n\n\tconst updateValue = engine.scheduler.wrapHandler((value: OverscrollBehavior | undefined) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withOverscrollBehavior)\n\t\tnodes.forEach(node => node.set({ overscrollBehavior: value }))\n\t})\n\n\tconst remove = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withOverscrollBehavior)\n\t\tnodes.forEach(node => node.set({ overscrollBehavior: undefined }))\n\t})\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withOverscrollBehavior)\n\t\t\tnodes.forEach(node => node.set({ overscrollBehavior: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectComputedValue = useEngineCallback(\n\t\t(computedValue: ComputedValue) => {\n\t\t\tupdateDynamicValue(computedValue)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[updateDynamicValue],\n\t)\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isOverscrollBehavior(overscrollBehavior) ? overscrollBehavior : undefined,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...overscrollBehaviorVariableDefinition,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[overscrollBehavior, updateDynamicValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(overscrollBehavior)) return\n\t\tif (isVariableReference(overscrollBehavior)) {\n\t\t\tconst variableValue = getVariableValue(engine, overscrollBehavior)\n\t\t\tconst overscrollValue = isOverscrollBehavior(variableValue) ? variableValue : \"none\"\n\t\t\tupdateValue(overscrollValue)\n\t\t} else if (isComputedValue(overscrollBehavior)) {\n\t\t\tupdateValue(\"none\")\n\t\t} else {\n\t\t\tshouldBeNever(overscrollBehavior)\n\t\t}\n\t}, [overscrollBehavior, updateValue])\n\n\tif (isNotFound(overscrollBehavior) || isUndefined(overscrollBehavior) || !onlyNodesWithOverscrollBehavior) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PanelRow\n\t\t\t\ttitle=\"Overscroll\"\n\t\t\t\ttraitTypes={traitTypes}\n\t\t\t\tonCopy={onCopy}\n\t\t\t\tonPaste={onPaste}\n\t\t\t\tonDelete={remove}\n\t\t\t\tcopyEnabled={canCopy}\n\t\t\t\tpasteEnabled={canPaste}\n\t\t\t\tsupportsVariables\n\t\t\t\tsupportsComputedValues\n\t\t\t\tonCreateVariable={createVariable}\n\t\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\t\tonSelectComputedValue={selectComputedValue}\n\t\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\t\tdynamicValue={isDynamicValue(overscrollBehavior) ? overscrollBehavior : null}\n\t\t\t\tvariableType={ControlType.Enum}\n\t\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\t\tcontrolKey={overscrollBehaviorControlReferenceInfo.controlKey}\n\t\t\t\tcontrolSourceIdentifier={overscrollBehaviorControlReferenceInfo.controlSourceIdentifier}\n\t\t\t>\n\t\t\t\t{isDynamicValue(overscrollBehavior) ? (\n\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\ttitle=\"Overscroll\"\n\t\t\t\t\t\tvalue={overscrollBehavior}\n\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"overscrollBehavior\")}\n\t\t\t\t\t\tcontrolReferenceInfo={overscrollBehaviorControlReferenceInfo}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t<PopupButton mixed={isMixed(overscrollBehavior)}>\n\t\t\t\t\t\t\t{allOverscrollBehaviorValues.map(option => (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\t\ttitle={titleCase(option)}\n\t\t\t\t\t\t\t\t\tselected={overscrollBehavior === option}\n\t\t\t\t\t\t\t\t\tonSelect={updateValue}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t<DescriptionRow description=\"This property needs Safari 16. [Learn More](https://www.framer.com/learn/modern-styles/).\" />\n\t\t</>\n\t)\n})\n", "import \"ConstraintsSimulation.styles_z8atnr.wyw.css\"; import { cx } from \"@linaria/core\";\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\";\nexport const container = cx(doubleColumnClass, \"container_cwzzbtz\");\nexport const parent = \"parent_ph90jhp\";\nexport const layer = \"layer_lrb0ybw\";", "import { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { FrameNode } from \"document/models/CanvasTree/index.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { FrameWithMotion } from \"library/render/presentation/Frame/FrameWithMotion.tsx\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type React from \"react\"\nimport * as styles from \"./ConstraintsSimulation.styles.ts\"\n\ninterface Props {\n\tnode: CanvasNode & WithPins\n}\n\nconst previewSize = 60\nconst smallerSize = previewSize - 20\n\nexport function ConstraintsSimulation(props: Props) {\n\tconst { node } = props\n\n\tconst parentSizeInfo = engine.tree.getParentSizeInfo(node)\n\tlet width = 20\n\tlet height = 20\n\tlet left: number | null = null\n\tlet right: number | null = null\n\tlet top: number | null = null\n\tlet bottom: number | null = null\n\n\tif (parentSizeInfo.sizing && parentSizeInfo.positioning) {\n\t\tconst nodeRect = node.rect(parentSizeInfo, true, engine.componentLoader)\n\t\tconst relativeSize = 60\n\t\tleft = node.left !== null ? (node.left / parentSizeInfo.positioning.width) * relativeSize : null\n\t\tright = node.right !== null ? (node.right / parentSizeInfo.positioning.width) * relativeSize : null\n\t\ttop = node.top !== null ? (node.top / parentSizeInfo.positioning.height) * relativeSize : null\n\t\tbottom = node.bottom !== null ? (node.bottom / parentSizeInfo.positioning.height) * relativeSize : null\n\t\twidth = (nodeRect.width / parentSizeInfo.sizing.width) * relativeSize\n\t\theight = (nodeRect.height / parentSizeInfo.sizing.height) * relativeSize\n\t}\n\tconst layer = new FrameNode({\n\t\twidth,\n\t\theight,\n\t\tleft,\n\t\tright,\n\t\ttop,\n\t\tbottom,\n\t\tcenterAnchorX: node.centerAnchorX,\n\t\tcenterAnchorY: node.centerAnchorY,\n\t\taspectRatio: withAspectRatio(node) ? node.aspectRatio : null,\n\t\twidthType: DimensionType.FixedNumber,\n\t\theightType: DimensionType.FixedNumber,\n\t})\n\tconst layerProps = layer.getProps(engine.componentLoader)\n\t// Disable our constraint calculation, so that the inner FrameWithMotion\n\t// behaves like in the preview\n\tlayerProps._constraints = { enabled: false }\n\n\treturn (\n\t\t<PanelRow title=\"Simulation\">\n\t\t\t<div className={styles.container}>\n\t\t\t\t<FrameWithMotion\n\t\t\t\t\tstyle={parentStyle}\n\t\t\t\t\tclassName={styles.parent}\n\t\t\t\t\tcenter\n\t\t\t\t\tz={0.00000001} // to fix painting issue in Safari\n\t\t\t\t\tanimate={{\n\t\t\t\t\t\twidth: [previewSize, previewSize, previewSize, smallerSize, previewSize],\n\t\t\t\t\t\theight: [previewSize, smallerSize, previewSize, previewSize, previewSize],\n\t\t\t\t\t}}\n\t\t\t\t\ttransition={{ ease: \"easeInOut\", duration: 2, repeat: Infinity, repeatType: \"loop\" }}\n\t\t\t\t>\n\t\t\t\t\t<FrameWithMotion {...layerProps} className={styles.layer} />\n\t\t\t\t</FrameWithMotion>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n\nconst parentStyle: React.CSSProperties = {\n\twidth: previewSize,\n\theight: previewSize,\n}\n", "import { AutoSized } from \"@framerjs/fresco/layout-transitions\"\nimport { ConstraintsSimulation } from \"document/components/chrome/properties/inputs/ConstraintsSimulation.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisShapeContainerNode,\n\tisStackOrGridComponent,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { withAutoSize } from \"document/models/CanvasTree/traits/WithAutoSize.ts\"\nimport {\n\tgetFloatingPositionProps,\n\thasFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithConstraints, WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedPins } from \"document/models/CanvasTree/traits/utils/reducePins.ts\"\nimport type { ReducedPosition } from \"document/models/CanvasTree/traits/utils/reducePosition.ts\"\nimport type { PinPosition } from \"document/models/ConstraintSolver.ts\"\nimport {\n\tallPinsAreActive,\n\tcanSetPins,\n\tguessConstraints,\n\tinactivateOpposingPin,\n\tupdateConstrainedFrame,\n} from \"document/models/ConstraintSolver.ts\"\nimport { shouldGuessPinToBottom } from \"document/models/shouldGuessPinToBottom.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { debounce } from \"library/render/utils/debounce.ts\"\nimport React from \"react\"\nimport { PositionRow } from \"../rows/PositionRow.tsx\"\nimport { getPinnableNodes, isConstrained } from \"./utils/getPinnedNodes.ts\"\nimport { togglePinForNodes } from \"./utils/togglePinForNodes.ts\"\n\n// Setting the displaySimulation flag will be debounced by this delay (in ms) to avoid the\n// constraints simulation flickering when the user accidentally hovers over the\n// position panel on their way to the alignment bar / other controls\nconst displaySimulationDelay = 60\n\nconst positionTraitTypes = [TraitType.Position]\n\ninterface Props extends ReducedPosition, Omit<ReducedPins, \"widthFactor\" | \"heightFactor\"> {\n\twithoutDescendantIds: NodeID[]\n\tonlyCanvasFrameNodes: boolean\n\tanyShapeNode: boolean\n}\n\ninterface State {\n\tdisplaySimulation: boolean\n}\n\nexport class PositionPanel extends React.PureComponent<Props, State> {\n\toverride state = { displaySimulation: false }\n\n\tprivate displaySimulationAfterDelay = debounce(() => {\n\t\tthis.setState({ displaySimulation: true })\n\t}, displaySimulationDelay)\n\n\toverride componentWillUnmount() {\n\t\tthis.displaySimulationAfterDelay.cancel()\n\t}\n\n\ttoggleAllPins = engine.scheduler.wrapHandler(() => {\n\t\tengine.setEditReason(\"PositionPanel\")\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\n\t\tconst maxActivePins = nodes.every(hasMaxActivePinsEnabled)\n\t\tthis.setState({ displaySimulation: true })\n\n\t\tconst tree = engine.tree\n\t\tnodes.forEach(node => {\n\t\t\tconst frame = tree.getRect(node)\n\n\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\t\tif (!parentSizeInfo.sizing) return\n\t\t\tconst newConstraints = node.constraints()\n\t\t\tnewConstraints.aspectRatio = null\n\n\t\t\tif (maxActivePins) {\n\t\t\t\tnewConstraints.top = false\n\t\t\t\tnewConstraints.bottom = false\n\t\t\t\tnewConstraints.left = false\n\t\t\t\tnewConstraints.right = false\n\t\t\t} else if (isShapeContainerNode(node) || (withAutoSize(node) && node.autoSize)) {\n\t\t\t\tconst guessedConstraints = guessConstraints(frame, parentSizeInfo, {\n\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, tree.getParent(node.id)),\n\t\t\t\t\tusesIntrinsicSize: true,\n\t\t\t\t})\n\t\t\t\tnewConstraints.left = guessedConstraints.left\n\t\t\t\tnewConstraints.right = !guessedConstraints.left\n\t\t\t\tnewConstraints.top = guessedConstraints.top\n\t\t\t\tnewConstraints.bottom = !guessedConstraints.top\n\t\t\t} else if (node.widthType === DimensionType.Auto || node.heightType === DimensionType.Auto) {\n\t\t\t\tconst guessedConstraints = guessConstraints(frame, parentSizeInfo, {\n\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, tree.getParent(node.id)),\n\t\t\t\t\tusesIntrinsicSize: true,\n\t\t\t\t})\n\t\t\t\tif (node.widthType === DimensionType.Auto) {\n\t\t\t\t\tnewConstraints.left = guessedConstraints.left\n\t\t\t\t\tnewConstraints.right = !guessedConstraints.left\n\t\t\t\t} else {\n\t\t\t\t\tnewConstraints.left = true\n\t\t\t\t\tnewConstraints.right = true\n\t\t\t\t}\n\t\t\t\tif (node.heightType === DimensionType.Auto) {\n\t\t\t\t\tnewConstraints.top = guessedConstraints.top\n\t\t\t\t\tnewConstraints.bottom = !guessedConstraints.top\n\t\t\t\t} else {\n\t\t\t\t\tnewConstraints.top = true\n\t\t\t\t\tnewConstraints.bottom = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewConstraints.top = true\n\t\t\t\tnewConstraints.bottom = true\n\t\t\t\tnewConstraints.left = true\n\t\t\t\tnewConstraints.right = true\n\t\t\t}\n\n\t\t\tconst isPinnedLeftAndRight = newConstraints.left && newConstraints.right\n\t\t\tconst isPinnedTopAndBottom = newConstraints.top && newConstraints.bottom\n\t\t\tconst pinnedToAllSides = isPinnedLeftAndRight && isPinnedTopAndBottom\n\t\t\tconst widthIsFlexible = newConstraints.widthType !== DimensionType.FixedNumber\n\t\t\tconst heightIsFlexible = newConstraints.heightType !== DimensionType.FixedNumber\n\n\t\t\t// When an element has a width/height which is not fixed, if we pin\n\t\t\t// it horizontally or vertically on both sides we want to make sure\n\t\t\t// it's being set correctly to fixed. This part is connected to\n\t\t\t// togglePinForNodes(), where we do not change the width/height when toggling the pins\n\t\t\t// except for the case just explained.\n\t\t\tif (isPinnedLeftAndRight && widthIsFlexible) newConstraints.widthType = DimensionType.FixedNumber\n\t\t\tif (isPinnedTopAndBottom && heightIsFlexible) newConstraints.heightType = DimensionType.FixedNumber\n\n\t\t\tconst update = updateConstrainedFrame({\n\t\t\t\trect: frame,\n\t\t\t\tparentSizeInfo,\n\t\t\t\tcurrentConstraints: newConstraints,\n\t\t\t\tconstraintsLocked: true,\n\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, tree.getParent(node.id)),\n\t\t\t\tupdateSize: pinnedToAllSides,\n\t\t\t\tfloatingPosition: hasFloatingPosition(node) ? getFloatingPositionProps(node) : null,\n\t\t\t})\n\t\t\t// Fix the pins is when manually setting them\n\t\t\tupdate.constraintsLocked = true\n\t\t\tnode.set(update, tree)\n\n\t\t\tif (withAspectRatio(node)) {\n\t\t\t\tnode.set({ aspectRatio: null })\n\t\t\t}\n\t\t})\n\t})\n\n\ttoggleOnePin = engine.scheduler.wrapHandler((pin: PinPosition) => {\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\tthis.setState({ displaySimulation: true })\n\n\t\tconst currentValue = this.props[pinEnabledKey(pin)]\n\t\tconst enable = currentValue !== true\n\n\t\ttogglePinForNodes(engine.tree, nodes, pin, enable)\n\t})\n\n\tsetPins = engine.scheduler.wrapHandler((direction: \"vertical\" | \"horizontal\", pins: PinPosition[]) => {\n\t\tengine.setEditReason(\"PositionPanel\")\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\n\t\tconst tree = engine.tree\n\t\tnodes.forEach(node => {\n\t\t\tif (!canSetPins(node, pins)) return\n\n\t\t\tconst newConstraints = node.constraints()\n\n\t\t\tif (pins.length === 0) {\n\t\t\t\tswitch (direction) {\n\t\t\t\t\tcase \"vertical\": {\n\t\t\t\t\t\tnewConstraints.top = false\n\t\t\t\t\t\tnewConstraints.bottom = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"horizontal\": {\n\t\t\t\t\t\tnewConstraints.left = false\n\t\t\t\t\t\tnewConstraints.right = false\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\tbreak\n\t\t\t\t}\n\t\t\t} else if (pins.length === 1) {\n\t\t\t\tnewConstraints[pins[0]] = true\n\t\t\t\tinactivateOpposingPin(newConstraints, pins[0])\n\t\t\t} else {\n\t\t\t\tpins.forEach(pin => {\n\t\t\t\t\tnewConstraints[pin] = true\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst frame = tree.getRect(node)\n\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\t\tif (!parentSizeInfo.sizing) return\n\t\t\tconst update = updateConstrainedFrame({\n\t\t\t\trect: frame,\n\t\t\t\tparentSizeInfo,\n\t\t\t\tcurrentConstraints: newConstraints,\n\t\t\t\tconstraintsLocked: true,\n\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, tree.getParent(node.id)),\n\t\t\t\tfloatingPosition: hasFloatingPosition(node) ? getFloatingPositionProps(node) : null,\n\t\t\t})\n\t\t\t// Disable layout guessing after manually setting pins\n\t\t\tupdate.constraintsLocked = true\n\t\t\tnode.set(update, tree)\n\n\t\t\t// If pinned to all sides after the update, unlock aspect ratio\n\t\t\tif (withAspectRatio(node) && allPinsAreActive(newConstraints)) {\n\t\t\t\tnode.set({ aspectRatio: null }, tree)\n\t\t\t}\n\t\t})\n\t})\n\n\tmouseLeave = (event: React.MouseEvent<HTMLElement>) => {\n\t\tthis.setState({ displaySimulation: false })\n\t\tevent.preventDefault()\n\t}\n\n\tconstraintsLockAction = engine.scheduler.wrapHandler(() => {\n\t\tengine.setEditReason(\"PositionPanel\")\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\tnodes.forEach(node => node.set({ constraintsLocked: this.props.constraintsLocked === false }))\n\t})\n\n\toverride render() {\n\t\tconst tree = engine.tree\n\t\tconst {\n\t\t\tx,\n\t\t\ty,\n\t\t\tright,\n\t\t\tbottom,\n\t\t\twithoutDescendantIds,\n\t\t\tpinTop,\n\t\t\tpinRight,\n\t\t\tpinBottom,\n\t\t\tpinLeft,\n\t\t\tcanSetLeft,\n\t\t\tcanSetRight,\n\t\t\tcanSetTop,\n\t\t\tcanSetBottom,\n\t\t\tanyShapeNode,\n\t\t} = this.props\n\n\t\tconst { displaySimulation } = this.state\n\n\t\tif (isNotFound(x)) return null\n\n\t\tlet preview: JSX.Element | null = null\n\n\t\tif (displaySimulation && withoutDescendantIds.length === 1) {\n\t\t\tconst firstNode = engine.tree.get(withoutDescendantIds[0])\n\n\t\t\tif (firstNode && isPinnable(firstNode) && isConstrained(tree, firstNode)) {\n\t\t\t\tpreview = <ConstraintsSimulation node={firstNode} />\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<PositionRow\n\t\t\t\t\tx={x}\n\t\t\t\t\ty={y}\n\t\t\t\t\tright={right}\n\t\t\t\t\tbottom={bottom}\n\t\t\t\t\twithoutDescendantIds={withoutDescendantIds}\n\t\t\t\t\tpinTop={pinTop}\n\t\t\t\t\tpinLeft={pinLeft}\n\t\t\t\t\tpinRight={pinRight}\n\t\t\t\t\tpinBottom={pinBottom}\n\t\t\t\t\tcanSetLeft={canSetLeft}\n\t\t\t\t\tcanSetRight={canSetRight}\n\t\t\t\t\tcanSetTop={canSetTop}\n\t\t\t\t\tcanSetBottom={canSetBottom}\n\t\t\t\t\tonAllPins={this.toggleAllPins}\n\t\t\t\t\tonOnePin={this.toggleOnePin}\n\t\t\t\t\tconstraintsAction={this.constraintsLockAction}\n\t\t\t\t\tmouseLeave={this.mouseLeave}\n\t\t\t\t\ttraitTypes={anyShapeNode ? undefined : positionTraitTypes}\n\t\t\t\t/>\n\t\t\t\t<AutoSized dependencies={preview !== null}>{preview}</AutoSized>\n\t\t\t</>\n\t\t)\n\t}\n}\n\nfunction activePinCount(node: CanvasNode & WithConstraints): number {\n\tconst constraints = node.constraints()\n\tlet pins = 0\n\tif (constraints.left) pins++\n\tif (constraints.right) pins++\n\tif (constraints.top) pins++\n\tif (constraints.bottom) pins++\n\treturn pins\n}\n\nfunction hasMaxActivePinsEnabled(node: CanvasNode & WithPins & WithConstraints) {\n\tconst pinCount = activePinCount(node)\n\tif (isShapeContainerNode(node)) {\n\t\treturn pinCount === 2\n\t}\n\tif (isStackOrGridComponent(node) || isCodeComponentNode(node) || isAnyTextNode(node)) {\n\t\tlet maxPinCount = 4\n\t\tif (node.heightType === DimensionType.Auto) maxPinCount--\n\t\tif (node.widthType === DimensionType.Auto) maxPinCount--\n\t\treturn pinCount === maxPinCount\n\t}\n\treturn pinCount === 4\n}\n\nfunction pinEnabledKey(type: PinPosition) {\n\tswitch (type) {\n\t\tcase \"top\":\n\t\t\treturn \"pinTop\"\n\t\tcase \"right\":\n\t\t\treturn \"pinRight\"\n\t\tcase \"bottom\":\n\t\t\treturn \"pinBottom\"\n\t\tcase \"left\":\n\t\t\treturn \"pinLeft\"\n\t\tdefault:\n\t\t\treturn type\n\t}\n}\n", "import { ReadOnlyContext } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedPins } from \"document/models/CanvasTree/traits/utils/reducePins.ts\"\nimport type { PinPosition } from \"document/models/ConstraintSolver.ts\"\nimport React from \"react\"\nimport * as classNames from \"./ConstraintsInput.styles.ts\"\nimport { IconPinHorizontal } from \"./icons/IconPinHorizontal.tsx\"\nimport { IconPinVertical } from \"./icons/IconPinVertical.tsx\"\n\nfunction isActive(pin: Reduced<boolean>) {\n\treturn pin === true || isMixed(pin)\n}\n\ninterface Props extends Omit<\n\tReducedPins,\n\t\"canSetVerticalPins\" | \"canSetHorizontalPins\" | \"constraintsLocked\" | \"widthFactor\" | \"heightFactor\"\n> {\n\tonAllPins: () => void\n\tonOnePin: (type: PinPosition) => void\n\tconstraintsAction: () => void\n\tmouseLeave?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport class ConstraintsInput extends React.PureComponent<Props> {\n\tactiveIndex = (state: boolean | null | undefined) => {\n\t\tswitch (state) {\n\t\t\tcase false:\n\t\t\t\treturn 0\n\t\t\tcase true:\n\t\t\t\treturn 1\n\t\t\tdefault:\n\t\t\t\treturn 2\n\t\t}\n\t}\n\n\tleftAction = () => {\n\t\tconst { canSetLeft, onOnePin } = this.props\n\t\tif (canSetLeft) onOnePin(\"left\")\n\t}\n\trightAction = () => {\n\t\tconst { canSetRight, onOnePin } = this.props\n\t\tif (canSetRight) onOnePin(\"right\")\n\t}\n\ttopAction = () => {\n\t\tconst { canSetTop, onOnePin } = this.props\n\t\tif (canSetTop) onOnePin(\"top\")\n\t}\n\tbottomAction = () => {\n\t\tconst { canSetBottom, onOnePin } = this.props\n\t\tif (canSetBottom) onOnePin(\"bottom\")\n\t}\n\n\toverride render() {\n\t\tconst { mouseLeave, onAllPins, pinTop, pinRight, pinBottom, pinLeft } = this.props\n\n\t\tconst enabled = pinTop !== undefined\n\t\tconst pinCenter = pinTop === false && pinRight === false && pinBottom === false && pinLeft === false\n\n\t\treturn (\n\t\t\t<ReadOnlyContext.Consumer>\n\t\t\t\t{readOnly => (\n\t\t\t\t\t<div className={cx(classNames.outerBox, readOnly && classNames.readonly)} onMouseLeave={mouseLeave}>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\ttitle=\"Toggle Pins\"\n\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\tclassNames.innerBox,\n\t\t\t\t\t\t\t\t\tenabled && classNames.innerBoxEnabled,\n\t\t\t\t\t\t\t\t\tpinCenter && classNames.pinCenter,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\tonClick={onAllPins}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{enabled ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\ttitle=\"Pin Left\"\n\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButton,\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButtonLeft,\n\t\t\t\t\t\t\t\t\t\t\tisActive(pinLeft) && classNames.pinButtonActive,\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\tonClick={this.leftAction}\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"constraintsinput-pin-left\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<IconPinHorizontal indeterminate={isMixed(pinLeft)} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\ttitle=\"Pin Right\"\n\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButton,\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButtonRight,\n\t\t\t\t\t\t\t\t\t\t\tisActive(pinRight) && classNames.pinButtonActive,\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\tonClick={this.rightAction}\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"constraintsinput-pin-right\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<IconPinHorizontal indeterminate={isMixed(pinRight)} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\ttitle=\"Pin Top\"\n\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButton,\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButtonTop,\n\t\t\t\t\t\t\t\t\t\t\tisActive(pinTop) && classNames.pinButtonActive,\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\tonClick={this.topAction}\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"constraintsinput-pin-top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<IconPinVertical indeterminate={isMixed(pinTop)} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\ttitle=\"Pin Bottom\"\n\t\t\t\t\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButton,\n\t\t\t\t\t\t\t\t\t\t\tclassNames.pinButtonBottom,\n\t\t\t\t\t\t\t\t\t\t\tisActive(pinBottom) && classNames.pinButtonActive,\n\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\tonClick={this.bottomAction}\n\t\t\t\t\t\t\t\t\t\tdata-testid=\"constraintsinput-pin-bottom\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<IconPinVertical indeterminate={isMixed(pinBottom)} />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Consumer>\n\t\t)\n\t}\n}\n", "import \"ConstraintsInput.styles_ulbgyo.wyw.css\"; export const pinButton = \"pinButton_pzi48cc\";\nexport const pinButtonActive = \"pinButtonActive_p1hi8rgh\";\nexport const pinButtonLeft = \"pinButtonLeft_pzj3ypn\";\nexport const pinButtonRight = \"pinButtonRight_pl8p78c\";\nexport const pinButtonTop = \"pinButtonTop_pp8g3xp\";\nexport const pinButtonBottom = \"pinButtonBottom_p19mt7t8\";\nexport const outerBox = \"outerBox_o1s6ak9d\";\nexport const readonly = \"readonly_rzjittb\";\nexport const innerBox = \"innerBox_i1sgn4ba\";\nexport const innerBoxEnabled = \"innerBoxEnabled_i1fqe89c\";\nexport const pinCenter = \"pinCenter_pntia8y\";", "interface Props {\n\tindeterminate: boolean\n}\n\nexport function IconPinHorizontal({ indeterminate }: Props) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"2\">\n\t\t\t{indeterminate ? (\n\t\t\t\t<path\n\t\t\t\t\td=\"M1 0a1 1 0 110 2 1 1 0 010-2zm4 0a1 1 0 110 2 1 1 0 010-2zm4 0a1 1 0 110 2 1 1 0 010-2z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<path d=\"M0 1a1 1 0 011-1h8a1 1 0 010 2H1a1 1 0 01-1-1z\" fill=\"currentColor\" />\n\t\t\t)}\n\t\t</svg>\n\t)\n}\n", "interface Props {\n\tindeterminate: boolean\n}\n\nexport function IconPinVertical({ indeterminate }: Props) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"2\" height=\"10\">\n\t\t\t{indeterminate ? (\n\t\t\t\t<path\n\t\t\t\t\td=\"M1 0a1 1 0 110 2 1 1 0 010-2zM1 4a1 1 0 110 2 1 1 0 010-2zM1 8a1 1 0 110 2 1 1 0 010-2z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<path d=\"M0 1a1 1 0 012 0v8a1 1 0 01-2 0z\" fill=\"currentColor\" />\n\t\t\t)}\n\t\t</svg>\n\t)\n}\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { ConstraintsInput } from \"document/components/chrome/properties/inputs/ConstraintsInput.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { type WithPins, isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithPosition } from \"document/models/CanvasTree/traits/WithPosition.ts\"\nimport { isFound, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { ReducedPinEdges } from \"document/models/CanvasTree/traits/utils/reducePins.ts\"\nimport type { ReducedPosition } from \"document/models/CanvasTree/traits/utils/reducePosition.ts\"\nimport { getConstraintsLocked } from \"document/models/CanvasTree/utils/getConstraintsLocked.ts\"\nimport type { PinPosition, Pins } from \"document/models/ConstraintSolver.ts\"\nimport { shouldGuessPinToBottom } from \"document/models/shouldGuessPinToBottom.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\nimport type { Rect } from \"library/index.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport React from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { getPinnableNodes } from \"../panels/utils/getPinnedNodes.ts\"\nimport { togglePinForNodes } from \"../panels/utils/togglePinForNodes.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\nimport * as styles from \"./PositionRow.styles.ts\"\n\n// these are here so they are constants equal by identity when given to react props\nconst labelX = \"X\"\nconst labelY = \"Y\"\nconst labelT = \"T\"\nconst labelL = \"L\"\nconst labelR = \"R\"\nconst labelB = \"B\"\n\ninterface Props extends ReducedPosition, ReducedPinEdges {\n\twithoutDescendantIds: NodeID[]\n\tonAllPins: () => void\n\tonOnePin: (type: PinPosition) => void\n\tconstraintsAction: () => void\n\tmouseLeave?: (event: React.MouseEvent<HTMLElement>) => void\n\ttraitTypes: TraitType[] | undefined\n}\n\nfunction isPinKey(key: keyof Pins | keyof WithPosition): key is keyof Pins {\n\treturn key === \"left\" || key === \"right\" || key === \"top\" || key === \"bottom\"\n}\n\nfunction isNodePinnedToBothSides(key: keyof Pins | keyof WithPosition, node: CanvasNode & WithPins): boolean {\n\tif (key === \"left\" || key === \"right\") return isNumber(node.left) && isNumber(node.right)\n\tif (key === \"top\" || key === \"bottom\") return isNumber(node.top) && isNumber(node.bottom)\n\treturn false\n}\n\nfunction keyToReducedKey(key: keyof Pins | keyof WithPosition): keyof ReducedPosition {\n\tswitch (key) {\n\t\tcase \"x\":\n\t\tcase \"left\":\n\t\t\treturn \"x\"\n\t\tcase \"y\":\n\t\tcase \"top\":\n\t\t\treturn \"y\"\n\t\tcase \"right\":\n\t\t\treturn \"right\"\n\t\tcase \"bottom\":\n\t\t\treturn \"bottom\"\n\t\tdefault:\n\t\t\tassertNever(key)\n\t}\n}\n\nfunction getNewRect(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tkey: keyof Pins | keyof WithPosition,\n\tvalue: number,\n): Rect | undefined {\n\tswitch (key) {\n\t\tcase \"x\":\n\t\tcase \"left\":\n\t\t\treturn { ...tree.getRect(node), x: value }\n\n\t\tcase \"y\":\n\t\tcase \"top\":\n\t\t\treturn { ...tree.getRect(node), y: value }\n\t\tcase \"right\": {\n\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\t\tif (!parentSizeInfo.positioning) return\n\n\t\t\tconst newRect = tree.getRect(node)\n\t\t\tnewRect.x = parentSizeInfo.positioning.width - value - newRect.width\n\t\t\treturn newRect\n\t\t}\n\t\tcase \"bottom\": {\n\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\t\tif (!parentSizeInfo.positioning) return\n\t\t\tconst newRect = tree.getRect(node)\n\t\t\tnewRect.y = parentSizeInfo.positioning.height - newRect.height - value\n\t\t\treturn newRect\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(key)\n\t}\n}\n\nexport class PositionRow extends React.PureComponent<Props> {\n\tpositionChange = engine.scheduler.wrapHandler(\n\t\t(key: keyof Pins | keyof WithPosition, value: number, reset: () => void) => {\n\t\t\tconst tree = engine.tree\n\n\t\t\tconst updatingPins = isPinKey(key)\n\t\t\tif (updatingPins) {\n\t\t\t\ttogglePinForNodes(tree, getPinnableNodes(this.props.withoutDescendantIds), key, true)\n\t\t\t}\n\n\t\t\tconst reducedPropKey = keyToReducedKey(key)\n\n\t\t\t// The reduced value might not change because of rounding despite the display value changes\n\t\t\t// in the input. For example, we round inline shape position to half pixels. If you change\n\t\t\t// 10.5 to 10.25, the reduced value would remain 10.5, and we need to reset the input value.\n\t\t\t// Only reset if the updated value is indeed the same as the current value, otherwise you\n\t\t\t// see an unneccessary flash of outdated value in the input before it updates.\n\t\t\tlet shouldResetInputDisplay: boolean = false\n\n\t\t\tconst nodes = updatingPins\n\t\t\t\t? getPinnableNodes(this.props.withoutDescendantIds)\n\t\t\t\t: tree.getNodes(this.props.withoutDescendantIds)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst parent = tree.getParent(node.id)\n\t\t\t\tif (isPositionRelative(node, parent)) return\n\n\t\t\t\tconst isPinnedToBothSides = isPinnable(node) && parent && isNodePinnedToBothSides(key, node)\n\t\t\t\tif (isPinnedToBothSides) {\n\t\t\t\t\tconst newValue = Math.round(value)\n\t\t\t\t\tnode.set({ [key]: newValue })\n\t\t\t\t\tif (newValue === this.props[reducedPropKey] && newValue !== value) {\n\t\t\t\t\t\tshouldResetInputDisplay = true\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst newRect = getNewRect(tree, node, key, value)\n\t\t\t\tif (!newRect) return\n\n\t\t\t\tconst nodeUpdate = node.updateForRect({\n\t\t\t\t\trect: newRect,\n\t\t\t\t\tparentSizeInfo: tree.getParentSizeInfo(node),\n\t\t\t\t\tconstraintsLocked: getConstraintsLocked(node),\n\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parent),\n\t\t\t\t})\n\t\t\t\tnode.set(nodeUpdate)\n\n\t\t\t\tif (nodeUpdate[key] === this.props[reducedPropKey] && nodeUpdate[key] !== value) {\n\t\t\t\t\tshouldResetInputDisplay = true\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (shouldResetInputDisplay) reset()\n\t\t},\n\t)\n\n\txChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"x\", value, reset)\n\n\tyChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"y\", value, reset)\n\n\tleftChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"left\", value, reset)\n\n\trightChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"right\", value, reset)\n\n\ttopChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"top\", value, reset)\n\n\tbottomChange = (value: number, _rawValue: string, reset: () => void) => this.positionChange(\"bottom\", value, reset)\n\n\tclearTopPin = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\ttogglePinForNodes(engine.tree, nodes, \"top\", false)\n\t})\n\n\tclearRightPin = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\ttogglePinForNodes(engine.tree, nodes, \"right\", false)\n\t})\n\n\tclearBottomPin = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\ttogglePinForNodes(engine.tree, nodes, \"bottom\", false)\n\t})\n\n\tclearLeftPin = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = getPinnableNodes(this.props.withoutDescendantIds)\n\t\ttogglePinForNodes(engine.tree, nodes, \"left\", false)\n\t})\n\n\toverride render() {\n\t\tconst {\n\t\t\tx,\n\t\t\ty,\n\t\t\tright,\n\t\t\tbottom,\n\t\t\tpinTop,\n\t\t\tpinLeft,\n\t\t\tpinRight,\n\t\t\tpinBottom,\n\t\t\tcanSetLeft,\n\t\t\tcanSetRight,\n\t\t\tcanSetTop,\n\t\t\tcanSetBottom,\n\t\t\ttraitTypes,\n\t\t} = this.props\n\n\t\tif (isNotFound(pinTop)) {\n\t\t\treturn (\n\t\t\t\t// Should not be able to reset position overrides when the frame is a ground node\n\t\t\t\t<PanelRow title=\"Position\">\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isFound(x) ? x : undefined}\n\t\t\t\t\t\tonChange={this.xChange}\n\t\t\t\t\t\tlabel={labelX}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t/>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isFound(y) ? y : undefined}\n\t\t\t\t\t\tonChange={this.yChange}\n\t\t\t\t\t\tlabel={labelY}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<PanelRow title=\" \" traitTypes={traitTypes}>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={pinTop === true ? notFoundToUndefined(y) : \"\"}\n\t\t\t\t\t\tplaceholder={isNumber(y) ? `${y}` : \"\"}\n\t\t\t\t\t\tonChange={this.topChange}\n\t\t\t\t\t\tonClear={this.clearTopPin}\n\t\t\t\t\t\tdefaultValue={isNumber(y) ? y : 0}\n\t\t\t\t\t\tlabel={labelT}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div />\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow className={styles.centerVertically}>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={pinLeft === true ? notFoundToUndefined(x) : \"\"}\n\t\t\t\t\t\tplaceholder={isNumber(x) ? `${x}` : \"\"}\n\t\t\t\t\t\tonChange={this.leftChange}\n\t\t\t\t\t\tonClear={this.clearLeftPin}\n\t\t\t\t\t\tdefaultValue={isNumber(x) ? x : 0}\n\t\t\t\t\t\tlabel={labelL}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t\twrapperClassName={styles.leftInput}\n\t\t\t\t\t/>\n\t\t\t\t\t<ConstraintsInput\n\t\t\t\t\t\tpinTop={pinTop}\n\t\t\t\t\t\tpinLeft={pinLeft}\n\t\t\t\t\t\tpinRight={pinRight}\n\t\t\t\t\t\tpinBottom={pinBottom}\n\t\t\t\t\t\tcanSetLeft={canSetLeft}\n\t\t\t\t\t\tcanSetRight={canSetRight}\n\t\t\t\t\t\tcanSetTop={canSetTop}\n\t\t\t\t\t\tcanSetBottom={canSetBottom}\n\t\t\t\t\t\tonAllPins={this.props.onAllPins}\n\t\t\t\t\t\tonOnePin={this.props.onOnePin}\n\t\t\t\t\t\tconstraintsAction={this.props.constraintsAction}\n\t\t\t\t\t\tmouseLeave={this.props.mouseLeave}\n\t\t\t\t\t/>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={pinRight === true ? notFoundToUndefined(right) : \"\"}\n\t\t\t\t\t\tplaceholder={isNumber(right) ? `${right}` : \"\"}\n\t\t\t\t\t\tonChange={this.rightChange}\n\t\t\t\t\t\tonClear={this.clearRightPin}\n\t\t\t\t\t\tdefaultValue={isNumber(right) ? right : 0}\n\t\t\t\t\t\tlabel={labelR}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title={\" \"}>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={pinBottom === true ? notFoundToUndefined(bottom) : \"\"}\n\t\t\t\t\t\tplaceholder={isNumber(bottom) ? `${bottom}` : \"\"}\n\t\t\t\t\t\tonChange={this.bottomChange}\n\t\t\t\t\t\tonClear={this.clearBottomPin}\n\t\t\t\t\t\tdefaultValue={isNumber(bottom) ? bottom : 0}\n\t\t\t\t\t\tlabel={labelB}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t/>\n\t\t\t\t\t<div />\n\t\t\t\t</PanelRow>\n\t\t\t</>\n\t\t)\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport { type CanvasNode, type CanvasTree, type NodeID, isDrawableNode } from \"document/models/CanvasTree/index.ts\"\nimport { type WithConstraints, type WithPins, isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\n\nexport function isConstrained(tree: CanvasTree, node: CanvasNode) {\n\tif (!node) {\n\t\treturn false\n\t}\n\n\tif (isDrawableNode(node) && isPinnable(node)) {\n\t\tconst parent = tree.getNodeParent(node)\n\t\treturn parent !== null\n\t} else {\n\t\treturn false\n\t}\n}\n\nexport function getPinnableNodes(withoutDescendantIds: NodeID[]) {\n\tconst nodes = engine.tree.getNodes(withoutDescendantIds)\n\treturn nodes.filter((node): node is CanvasNode & WithPins & WithConstraints => {\n\t\treturn isConstrained(engine.tree, node) && !isPositionRelative(node, engine.tree.getParent(node.id))\n\t})\n}\n", "import engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tgetFloatingPositionProps,\n\thasFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithConstraints, WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { PinPosition } from \"document/models/ConstraintSolver.ts\"\nimport { setConstraint, updateConstrainedFrame } from \"document/models/ConstraintSolver.ts\"\nimport { shouldGuessPinToBottom } from \"document/models/shouldGuessPinToBottom.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\n\nexport function togglePinForNodes(\n\ttree: CanvasTree,\n\tnodes: (CanvasNode & WithPins & WithConstraints)[],\n\tpin: PinPosition,\n\tenable: boolean,\n) {\n\tengine.setEditReason(\"togglePin\")\n\tnodes.forEach(node => {\n\t\tconst newConstraints = setConstraint(node, pin, enable)\n\n\t\tconst rect = tree.getRect(node)\n\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\tif (!parentSizeInfo.sizing) return\n\t\tconst isPinnedLeftAndRight = newConstraints.left && newConstraints.right\n\t\tconst isPinnedTopAndBottom = newConstraints.top && newConstraints.bottom\n\n\t\tconst update = updateConstrainedFrame({\n\t\t\trect,\n\t\t\tparentSizeInfo,\n\t\t\tcurrentConstraints: newConstraints,\n\t\t\tconstraintsLocked: true,\n\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, tree.getParent(node.id)),\n\t\t\tfloatingPosition: hasFloatingPosition(node) ? getFloatingPositionProps(node) : null,\n\t\t})\n\t\t// See also toggleAllPins() in the PositionPanel for more context. This\n\t\t// makes sure that if an element has a percentage width/height and\n\t\t// max-width/height set, then we do not change its size.\n\t\tif (!isPinnedLeftAndRight) delete update.width\n\t\tif (!isPinnedTopAndBottom) delete update.height\n\n\t\t// Disable layout guessing after manually setting pins\n\t\tupdate.constraintsLocked = true\n\n\t\tnode.set(update)\n\t})\n}\n", "import \"PositionRow.styles_8nyyin.wyw.css\"; export const centerVertically = \"centerVertically_cubjvx6\";\nexport const leftInputWidth = \"72.95%\";\nexport const leftInput = \"leftInput_l12a72rs\";", "import { NumberInput, Stepper, Translatable as T } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport { isPositionSticky } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { ReducedPositionType } from \"document/models/CanvasTree/traits/utils/reducePositionType.ts\"\nimport React from \"react\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\ninterface Props extends Omit<ReducedPositionType, \"onlyNodesWithPositionFixed\"> {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\tisWebPage: boolean\n}\n\nconst traits: TraitType[] = [TraitType.PositionType]\n\nexport class PositionStickyRows extends React.PureComponent<Props> {\n\tonChangePin = engine.scheduler.wrapHandler((update: Partial<WithPositionType>) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.nodeIds, isPositionSticky)\n\t\tnodes.forEach(node => node.set(update))\n\t})\n\n\tonChangeTop = (positionStickyTop: number) => this.onChangePin({ positionStickyTop })\n\tonChangeRight = (positionStickyRight: number) => this.onChangePin({ positionStickyRight })\n\tonChangeBottom = (positionStickyBottom: number) => this.onChangePin({ positionStickyBottom })\n\tonChangeLeft = (positionStickyLeft: number) => this.onChangePin({ positionStickyLeft })\n\tonClearTop = () => this.onChangePin({ positionStickyTop: undefined })\n\tonClearRight = () => this.onChangePin({ positionStickyRight: undefined })\n\tonClearBottom = () => this.onChangePin({ positionStickyBottom: undefined })\n\tonClearLeft = () => this.onChangePin({ positionStickyLeft: undefined })\n\n\toverride render() {\n\t\tconst { positionStickyTop, positionStickyRight, positionStickyBottom, positionStickyLeft } = this.props\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{(isNumber(positionStickyTop) || isMixed(positionStickyTop)) && (\n\t\t\t\t\t<PanelRow title=\"Top\" traitTypes={traits} onDelete={this.onClearTop}>\n\t\t\t\t\t\t<NumberInput value={positionStickyTop} onChange={this.onChangeTop} onClear={this.onClearTop} />\n\t\t\t\t\t\t<Stepper value={positionStickyTop} onChange={this.onChangeTop} step=\"nudge\" />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{(isNumber(positionStickyBottom) || isMixed(positionStickyBottom)) && (\n\t\t\t\t\t<PanelRow title=\"Bottom\" traitTypes={traits} onDelete={this.onClearBottom}>\n\t\t\t\t\t\t<NumberInput value={positionStickyBottom} onChange={this.onChangeBottom} onClear={this.onClearBottom} />\n\t\t\t\t\t\t<Stepper value={positionStickyBottom} onChange={this.onChangeBottom} step=\"nudge\" />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{(isNumber(positionStickyLeft) || isMixed(positionStickyLeft)) && (\n\t\t\t\t\t<PanelRow title=\"Left\" traitTypes={traits} onDelete={this.onClearLeft}>\n\t\t\t\t\t\t<NumberInput value={positionStickyLeft} onChange={this.onChangeLeft} onClear={this.onClearLeft} />\n\t\t\t\t\t\t<Stepper value={positionStickyLeft} onChange={this.onChangeLeft} step=\"nudge\" />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t\t{(isNumber(positionStickyRight) || isMixed(positionStickyRight)) && (\n\t\t\t\t\t<PanelRow title=\"Right\" traitTypes={traits} onDelete={this.onClearRight}>\n\t\t\t\t\t\t<NumberInput value={positionStickyRight} onChange={this.onChangeRight} onClear={this.onClearRight} />\n\t\t\t\t\t\t<Stepper value={positionStickyRight} onChange={this.onChangeRight} step=\"nudge\" />\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\t\t\t</>\n\t\t)\n\t}\n}\n\nconst positionStickyTop: keyof WithPositionType = \"positionStickyTop\"\nconst positionStickyBottom: keyof WithPositionType = \"positionStickyBottom\"\nconst positionStickyLeft: keyof WithPositionType = \"positionStickyLeft\"\nconst positionStickyRight: keyof WithPositionType = \"positionStickyRight\"\n\nconst stickyPinTitles = [\"Top\", \"Bottom\", \"Left\", \"Right\"]\nconst stickyPins = [positionStickyTop, positionStickyBottom, positionStickyLeft, positionStickyRight] as const\n\nexport const PositionPanelHeader = React.memo(function SizePanelHeader(props: Props) {\n\tconst { positionTypes, readOnly } = props\n\n\tconst shouldDisplayMenu =\n\t\tpositionTypes.size === 1 && positionTypes.has(\"sticky\") && stickyPins.some(key => isUndefined(props[key]))\n\n\tconst displayMenu = (event: React.MouseEvent) => {\n\t\tif (props.readOnly) return\n\n\t\tconst template: MenuItemOptions[] = stickyPins.map((key, i) => {\n\t\t\tconst pinValue = props[key]\n\t\t\treturn {\n\t\t\t\tlabel: stickyPinTitles[i],\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.tree.getNodesWithTrait(props.nodeIds, isPositionSticky).forEach(node => {\n\t\t\t\t\t\tnode.set({ [key]: 0 })\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t\tvisible: isUndefined(pinValue),\n\t\t\t}\n\t\t})\n\n\t\tengine.stores.contextMenuStore.show(template, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\treturn (\n\t\t<PanelSectionHeader\n\t\t\ttitle={<T>Position</T>}\n\t\t\tclickable={shouldDisplayMenu && !readOnly}\n\t\t\tonMouseDown={shouldDisplayMenu ? displayMenu : undefined}\n\t\t>\n\t\t\t{shouldDisplayMenu && (\n\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t)}\n\t\t</PanelSectionHeader>\n\t)\n})\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { FramePresetID } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport type { ReducedSizeProperties } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport React from \"react\"\nimport { FrameOrientationRow } from \"../rows/FrameOrientationRow.tsx\"\nimport { FramePresetPickerRow } from \"../rows/FramePresetPickerRow.tsx\"\nimport type { ResolvedRotation } from \"../utils/getResolvedVariableValues.ts\"\n\ninterface Props extends Pick<ReducedSizeProperties, \"orientation\" | \"orientationEnabled\"> {\n\tnodeIds: NodeID[]\n\tonlyCanvasFrameNodes: boolean\n\tframePresetsInSelection: (FramePresetID | null)[]\n\trotation: ResolvedRotation\n}\n\nexport const PresetAndOrientationPanel = React.memo(function PresetAndOrientationPanel({\n\tnodeIds,\n\tframePresetsInSelection,\n\tonlyCanvasFrameNodes,\n\torientation,\n\torientationEnabled,\n\trotation,\n}: Props) {\n\tif (!onlyCanvasFrameNodes) return null\n\treturn (\n\t\t<>\n\t\t\t<FramePresetPickerRow nodeIds={nodeIds} framePresetsInSelection={framePresetsInSelection} rotation={rotation} />\n\t\t\t<FrameOrientationRow nodeIds={nodeIds} orientation={orientation} orientationEnabled={orientationEnabled} />\n\t\t</>\n\t)\n})\n", "import { IconDeviceLandscape, IconDevicePortrait, SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ReducedSizeProperties } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport { Orientation } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props extends Pick<ReducedSizeProperties, \"orientation\" | \"orientationEnabled\"> {\n\tnodeIds: NodeID[]\n}\n\nexport class FrameOrientationRow extends React.PureComponent<Props> {\n\toverride render() {\n\t\tconst { nodeIds, orientation, orientationEnabled } = this.props\n\t\tif (nodeIds.length === 0) return null\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Orientation\">\n\t\t\t\t<SegmentedControl style={doubleColumn} enabled={orientationEnabled}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle=\"Portrait\"\n\t\t\t\t\t\tidentifier={Orientation.Portrait}\n\t\t\t\t\t\tselected={orientation === Orientation.Portrait}\n\t\t\t\t\t\tonSelect={this.updateOrientation}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconDevicePortrait />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\ttitle=\"Landscape\"\n\t\t\t\t\t\tidentifier={Orientation.Landscape}\n\t\t\t\t\t\tselected={orientation === Orientation.Landscape}\n\t\t\t\t\t\tonSelect={this.updateOrientation}\n\t\t\t\t\t>\n\t\t\t\t\t\t<IconDeviceLandscape />\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n\n\tupdateOrientation = engine.scheduler.wrapHandler((orientation: Orientation) => {\n\t\tconst { nodeIds, orientation: currentOrientation } = this.props\n\t\tif (orientation === currentOrientation) return\n\n\t\tconst makePortrait = orientation === Orientation.Portrait\n\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isFrameNode)\n\t\tnodes.forEach(node => {\n\t\t\tconst size = node.rect(null)\n\t\t\tconst max = Math.max(size.width, size.height)\n\t\t\tconst min = Math.min(size.width, size.height)\n\t\t\tconst aspectRatio = node.aspectRatio\n\n\t\t\tnode.set({\n\t\t\t\twidth: makePortrait ? min : max,\n\t\t\t\theight: makePortrait ? max : min,\n\t\t\t\taspectRatio: aspectRatio ? 1 / aspectRatio : aspectRatio,\n\t\t\t})\n\t\t})\n\t})\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WithFramePreset } from \"document/models/CanvasTree/traits/WithFramePreset.ts\"\nimport { withFramePreset } from \"document/models/CanvasTree/traits/WithFramePreset.ts\"\nimport type { FramePresetID } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { allFramePresets, getFramePreset } from \"document/models/CanvasTree/traits/utils/framePresets.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport React from \"react\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport type { ResolvedRotation } from \"../utils/getResolvedVariableValues.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tframePresetsInSelection: (FramePresetID | null)[]\n\trotation: ResolvedRotation\n}\n\nexport class FramePresetPickerRow extends React.PureComponent<Props> {\n\tnodes = (): (CanvasNode & WithFramePreset)[] => {\n\t\treturn engine.tree.getNodesWithTrait(this.props.nodeIds, withFramePreset)\n\t}\n\n\toverride render() {\n\t\tconst { rotation, framePresetsInSelection } = this.props\n\t\tconst uniqueFramePresets = new Set(framePresetsInSelection)\n\n\t\treturn (\n\t\t\t<PanelRow title=\"Device\">\n\t\t\t\t<PopupButton enabled={rotation === 0} wrapperClassName={doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey=\"no-device\"\n\t\t\t\t\t\ttitle=\"No Device\"\n\t\t\t\t\t\tselected={uniqueFramePresets.has(null)}\n\t\t\t\t\t\tonSelect={this.removeDevice}\n\t\t\t\t\t/>\n\t\t\t\t\t{allFramePresets.map(device => (\n\t\t\t\t\t\t<PopupButtonItem<string>\n\t\t\t\t\t\t\tkey={device.id}\n\t\t\t\t\t\t\tidentifier={device.id}\n\t\t\t\t\t\t\ttitle={device.title}\n\t\t\t\t\t\t\tselected={uniqueFramePresets.has(device.id)}\n\t\t\t\t\t\t\tonSelect={this.onChooseDevice}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t)\n\t}\n\n\tremoveDevice = engine.scheduler.wrapHandler(() => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tassert(isFrameNode(node))\n\t\t\tnode.set({ framePreset: null, previewSettings: null, isScreen: false })\n\t\t})\n\t})\n\n\tonChooseDevice = engine.scheduler.wrapHandler((framePreset: FramePresetID) => {\n\t\tconst device = getFramePreset(framePreset)\n\t\tif (!device) return\n\n\t\tconst { screenWidth, screenHeight, canRotate } = device\n\n\t\tthis.nodes().forEach(node => {\n\t\t\tassert(isFrameNode(node))\n\n\t\t\tconst size = node.rect(null)\n\t\t\tconst shouldFlipOrientation = canRotate && size.width > size.height\n\n\t\t\t// After the \"prototype component\" experiment merges, it will be\n\t\t\t// possible to set a preset on any old ground node frame. To ensure\n\t\t\t// the model stays consistent, when doing so we update `isScreen` to\n\t\t\t// true, since it may not be already/\n\t\t\tnode.set({\n\t\t\t\tisScreen: true,\n\t\t\t\tframePreset,\n\t\t\t\twidth: shouldFlipOrientation ? screenHeight : screenWidth,\n\t\t\t\theight: shouldFlipOrientation ? screenWidth : screenHeight,\n\t\t\t\twidthType: DimensionType.FixedNumber,\n\t\t\t\theightType: DimensionType.FixedNumber,\n\t\t\t\taspectRatio: null,\n\t\t\t})\n\t\t})\n\t})\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useBaseEngine } from \"document/base-engine/BaseEngine.ts\"\nimport { createVariableInScope } from \"document/components/chrome/properties/utils/createVariableInScope.ts\"\nimport { VariableReferenceButton } from \"document/components/chrome/shared/VariableReferenceButton.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype VariableReference,\n\tcreateVariableReference,\n\tisVariableReference,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { getChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport { type FillType, hasFillEnabled } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withRepeatArray } from \"document/models/CanvasTree/traits/WithRepeatArray.ts\"\nimport {\n\ttype VariableDefinition,\n\ttype VariableType,\n\tisArrayVariable,\n\twithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { useGetVariableMenuItems } from \"../utils/useDisplayVariableAssignmentOptions.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { createRepeatArrayVariableDefaults } from \"./utils/repeatPanelVariableDefaults.ts\"\n\ninterface Props {\n\trepeatId: NodeID\n\trepeatOriginalId: NodeID\n\trepeatArray: VariableReference | undefined\n}\n\nexport const RepeatPanel = React.memo(function RepeatPanel({ repeatId, repeatOriginalId, repeatArray }: Props) {\n\tconst engine = useBaseEngine()\n\tconst supportsVariables = useSupportsVariable(\"repeatArray\")\n\tconst enabled = repeatId === repeatOriginalId\n\tconst hasRepeatArray = isVariableReference(repeatArray)\n\tconst isReplicaWithoutRepeatArray = !enabled && !hasRepeatArray\n\tconst showPrimaryVariantOnlyDescription = !enabled && hasRepeatArray\n\n\tconst onChangeRepeatArray = useEngineCallback(\n\t\t(nextRepeatArray: VariableReference | undefined) => {\n\t\t\tassert(enabled, \"Repeat panel should only change array variables when enabled\")\n\t\t\tconst node = engine.tree.getNodeWithTrait(repeatOriginalId, withRepeatArray)\n\t\t\tnode?.set({ repeatArray: nextRepeatArray })\n\t\t},\n\t\t[repeatOriginalId, enabled],\n\t)\n\n\tconst onSelectRepeatArrayVariable = React.useCallback(\n\t\t(nextRepeatArray: VariableReference, _type: VariableType) => {\n\t\t\tonChangeRepeatArray(nextRepeatArray)\n\t\t},\n\t\t[onChangeRepeatArray],\n\t)\n\n\tconst onRemoveRepeatArrayDynamicValue = React.useCallback(\n\t\t(_dynamicValue: DynamicValue) => {\n\t\t\tonChangeRepeatArray(undefined)\n\t\t},\n\t\t[onChangeRepeatArray],\n\t)\n\n\tconst onCreateRepeatArrayVariable = useEngineCallback(\n\t\t(scopeId: NodeID, type: VariableType) => {\n\t\t\tassert(enabled, \"Repeat panel should only create array variables when enabled\")\n\t\t\tassert(type === ControlType.Array, \"Repeat panel should only create array variables\")\n\n\t\t\tconst repeatNode = engine.tree.get(repeatOriginalId)\n\t\t\tlet fillType: FillType | undefined\n\t\t\tlet fillImage: string | undefined\n\t\t\tlet fillColor: string | undefined\n\n\t\t\tif (repeatNode && hasFillEnabled(repeatNode)) {\n\t\t\t\tfillType = repeatNode.fillType\n\t\t\t\tswitch (fillType) {\n\t\t\t\t\tcase \"image\": {\n\t\t\t\t\t\tfillImage = isString(repeatNode.fillImage) ? repeatNode.fillImage : undefined\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"color\": {\n\t\t\t\t\t\tconst withoutChildren = getChildren(repeatNode).length === 0\n\t\t\t\t\t\t// Only use the fill color if the node has no children. Otherwise there's a\n\t\t\t\t\t\t// small chance that you want to actually override the fill color.\n\t\t\t\t\t\tif (isString(repeatNode.fillColor) && withoutChildren) {\n\t\t\t\t\t\t\tfillColor = repeatNode.fillColor\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}\n\t\t\t}\n\n\t\t\tconst repeatArrayVariableDefaults = createRepeatArrayVariableDefaults({\n\t\t\t\tfillType,\n\t\t\t\tfillImage,\n\t\t\t\tfillColor,\n\t\t\t})\n\n\t\t\tconst nextRepeatArray = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Array,\n\t\t\t\tshowEditor: false,\n\t\t\t\t...repeatArrayVariableDefaults,\n\t\t\t})\n\n\t\t\tif (!nextRepeatArray) return\n\n\t\t\tconst arrayVariableProvider = engine.tree.getNodeWithTrait(scopeId, withVariables)\n\t\t\tconst arrayVariable = arrayVariableProvider?.getVariable(nextRepeatArray.id)\n\t\t\tassert(arrayVariable && isArrayVariable(arrayVariable), \"Expected created variable to be an array variable\")\n\n\t\t\tconst firstItemVariable = arrayVariable.itemVariables[0]\n\t\t\tassert(firstItemVariable, \"Expected first item variable to be defined\")\n\n\t\t\tconst repeatNodeToUpdate = engine.tree.get(repeatOriginalId)\n\t\t\tif (repeatNodeToUpdate && hasFillEnabled(repeatNodeToUpdate)) {\n\t\t\t\tif (fillType === \"image\" && firstItemVariable.type === ControlType.Image) {\n\t\t\t\t\trepeatNodeToUpdate.set({\n\t\t\t\t\t\tfillImage: createVariableReference(firstItemVariable.id, repeatOriginalId),\n\t\t\t\t\t})\n\t\t\t\t} else if (fillType === \"color\" && firstItemVariable.type === ControlType.Color) {\n\t\t\t\t\trepeatNodeToUpdate.set({\n\t\t\t\t\t\tfillColor: createVariableReference(firstItemVariable.id, repeatOriginalId),\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tonChangeRepeatArray(nextRepeatArray)\n\t\t},\n\t\t[onChangeRepeatArray, repeatOriginalId, enabled],\n\t)\n\n\t// We don't want to repeat the node with a variable that is coming from the existing array.\n\tconst variableFilter = React.useCallback(\n\t\t(_variable: VariableDefinition, providerId: NodeID): boolean => {\n\t\t\treturn providerId !== repeatOriginalId\n\t\t},\n\t\t[repeatOriginalId],\n\t)\n\n\tconst getVariableMenuItems = useGetVariableMenuItems({\n\t\tsupportsVariables,\n\t\tvariableType: ControlType.Array,\n\t\tvariableCreationType: ControlType.Array,\n\t\tvariableReferenceType: ControlType.Array,\n\t\tdynamicValue: repeatArray ?? null,\n\t\tonCreateVariable: onCreateRepeatArrayVariable,\n\t\tonSelectVariable: onSelectRepeatArrayVariable,\n\t\tonRemoveDynamicValue: onRemoveRepeatArrayDynamicValue,\n\t\tsupportsComputedValues: undefined,\n\t\tcomputedValuePopoutId: undefined,\n\t\tonSelectComputedValue: undefined,\n\t\tcollectionReferenceDataIdentifier: undefined,\n\t\tvectorSetIdentifier: undefined,\n\t\tcontrolSourceIdentifier: undefined,\n\t\tcontrolKey: undefined,\n\t\tallowedFileTypes: undefined,\n\t\tdisplayTransformOptions: undefined,\n\t\tvariableFilter,\n\t})\n\n\tconst showAddButton = enabled && !hasRepeatArray\n\n\tconst showVariableMenu = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n\t\t\tconst variableMenuItems = getVariableMenuItems?.()\n\t\t\tif (!variableMenuItems || variableMenuItems.length === 0) return\n\n\t\t\tengine.stores.contextMenuStore.show(variableMenuItems, {\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t\tsubmenuPlacement: \"left-start\",\n\t\t\t})\n\t\t},\n\t\t[getVariableMenuItems],\n\t)\n\n\tif (!getVariableMenuItems || isReplicaWithoutRepeatArray) return null\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle=\"Repeat\"\n\t\t\t\t\tclickable={showAddButton}\n\t\t\t\t\tonMouseDown={showAddButton ? showVariableMenu : undefined}\n\t\t\t\t>\n\t\t\t\t\t{showAddButton && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{hasRepeatArray && (\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle={Dictionary.Variable}\n\t\t\t\t\tsupportsVariables={supportsVariables && enabled}\n\t\t\t\t\tdynamicValue={repeatArray}\n\t\t\t\t\tvariableType={ControlType.Array}\n\t\t\t\t\tonCreateVariable={onCreateRepeatArrayVariable}\n\t\t\t\t\tonSelectVariable={onSelectRepeatArrayVariable}\n\t\t\t\t\tonRemoveDynamicValue={onRemoveRepeatArrayDynamicValue}\n\t\t\t\t\tvariableFilter={variableFilter}\n\t\t\t\t>\n\t\t\t\t\t<VariableReferenceButton\n\t\t\t\t\t\texpectedType={ControlType.Array}\n\t\t\t\t\t\treference={repeatArray}\n\t\t\t\t\t\tonRemove={enabled ? onRemoveRepeatArrayDynamicValue : undefined}\n\t\t\t\t\t\thasError={!supportsVariables}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{showPrimaryVariantOnlyDescription && (\n\t\t\t\t<DescriptionRow description=\"Can be selected in the primary variant only.\" />\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { FillType } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type {\n\tArrayItemVariableDefinition,\n\tArrayVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type {\n\tArrayValue,\n\tObjectControlProp,\n\tStaticArrayControlPropValue,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { Color } from \"library/render/types/Color/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\ninterface RepeatArrayVariableDefaultsInput {\n\tfillType: FillType | undefined\n\tfillImage: string | undefined\n\tfillColor: string | undefined\n}\n\ntype RepeatArrayVariableDefaults = Pick<ArrayVariableDefinition, \"name\" | \"itemVariables\" | \"initialValue\">\n\nfunction getSecondaryColor(fillColor: string): string {\n\tconst fallbackColor = \"rgb(0, 0, 0)\"\n\n\tconst color = Color(fillColor)\n\tif (color.isValid === false) return fallbackColor\n\n\tconst secondaryColor = color.l > 0.5 ? Color.darken(color, 20) : Color.lighten(color, 20)\n\treturn secondaryColor.toValue()\n}\n\nfunction createImageArrayItem(itemVariableId: string, value: string | undefined): ArrayValue & ObjectControlProp {\n\treturn {\n\t\tid: randomID(),\n\t\ttype: ControlType.Object,\n\t\tvalue: {\n\t\t\t[itemVariableId]: {\n\t\t\t\ttype: ControlType.Image,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunction createColorArrayItem(itemVariableId: string, value: string): ArrayValue & ObjectControlProp {\n\treturn {\n\t\tid: randomID(),\n\t\ttype: ControlType.Object,\n\t\tvalue: {\n\t\t\t[itemVariableId]: {\n\t\t\t\ttype: ControlType.Color,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunction createTextArrayItem(itemVariableId: string, value: string): ArrayValue & ObjectControlProp {\n\treturn {\n\t\tid: randomID(),\n\t\ttype: ControlType.Object,\n\t\tvalue: {\n\t\t\t[itemVariableId]: {\n\t\t\t\ttype: ControlType.String,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunction createImageDefaults(fillImage: string): RepeatArrayVariableDefaults {\n\tconst itemVariableId = randomID()\n\tconst itemVariable: ArrayItemVariableDefinition = {\n\t\tid: itemVariableId,\n\t\tname: \"Image\",\n\t\ttype: ControlType.Image,\n\t\tinitialValue: undefined,\n\t}\n\n\tconst initialValue: StaticArrayControlPropValue = [\n\t\tcreateImageArrayItem(itemVariableId, fillImage),\n\t\tcreateImageArrayItem(itemVariableId, undefined),\n\t]\n\n\treturn {\n\t\tname: Dictionary.Gallery,\n\t\titemVariables: [itemVariable],\n\t\tinitialValue,\n\t}\n}\n\nfunction createColorDefaults(fillColor: string): RepeatArrayVariableDefaults {\n\tconst itemVariableId = randomID()\n\tconst defaultColor = getSecondaryColor(fillColor)\n\tconst itemVariable: ArrayItemVariableDefinition = {\n\t\tid: itemVariableId,\n\t\tname: \"Color\",\n\t\ttype: ControlType.Color,\n\t\tinitialValue: defaultColor,\n\t}\n\n\tconst initialValue: StaticArrayControlPropValue = [\n\t\tcreateColorArrayItem(itemVariableId, fillColor),\n\t\tcreateColorArrayItem(itemVariableId, defaultColor),\n\t]\n\n\treturn {\n\t\tname: Dictionary.List,\n\t\titemVariables: [itemVariable],\n\t\tinitialValue,\n\t}\n}\n\nfunction createTextDefaults(): RepeatArrayVariableDefaults {\n\tconst itemVariableId = randomID()\n\tconst itemVariable: ArrayItemVariableDefinition = {\n\t\tid: itemVariableId,\n\t\tname: \"Text\",\n\t\ttype: ControlType.String,\n\t\tinitialValue: \"A\",\n\t}\n\n\tconst initialValue: StaticArrayControlPropValue = [\n\t\tcreateTextArrayItem(itemVariableId, \"A\"),\n\t\tcreateTextArrayItem(itemVariableId, \"B\"),\n\t]\n\n\treturn {\n\t\tname: Dictionary.List,\n\t\titemVariables: [itemVariable],\n\t\tinitialValue,\n\t}\n}\n\nexport function createRepeatArrayVariableDefaults({\n\tfillType,\n\tfillImage,\n\tfillColor,\n}: RepeatArrayVariableDefaultsInput): RepeatArrayVariableDefaults {\n\tif (fillType === \"image\" && isString(fillImage)) {\n\t\treturn createImageDefaults(fillImage)\n\t}\n\n\tif (fillType === \"color\" && isString(fillColor) && Color(fillColor).isValid !== false) {\n\t\treturn createColorDefaults(fillColor)\n\t}\n\n\treturn createTextDefaults()\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { measureCodeComponentsAndSizeToFit } from \"document/models/CanvasTree/utils/sizeToFitContent.ts\"\nimport React from \"react\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\ninterface Props {\n\tnodeIds: NodeID[]\n\tavailable: boolean\n\tenabled: boolean\n}\n\nexport const ResizeToFitContentPanel = React.memo(function ResizeToFitContentPanel({\n\tnodeIds,\n\tavailable,\n\tenabled,\n}: Props) {\n\tconst sizeToFitContentActionHandler = React.useCallback(async () => {\n\t\tawait measureCodeComponentsAndSizeToFit(engine, engine.tree.getNodes(nodeIds))\n\t}, [nodeIds])\n\n\tif (!available) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<PanelRow title=\" \">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<Button\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\ttitle={Dictionary.FitContent}\n\t\t\t\t\tonClick={sizeToFitContentActionHandler}\n\t\t\t\t\tstyle={{ width: \"100%\" }}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n})\n", "import \"ScrollTargetPanel.styles_k2n92i.wyw.css\"; export const secondaryText = \"secondaryText_s1oo848\";\nexport const hash = \"hash_hrbihqz\";\nexport const input = \"input_itia4ax\";", "import {\n\tInputWrapper,\n\tNumberInputWithTickerAndStepper,\n\tTranslatable as T,\n\tText,\n\tTextInput,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { fonts } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithOverflow } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport { withOverflow } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { WithScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { withScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { isReplicaVariantOrReplicaVariantChild } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedScrollTarget } from \"document/models/CanvasTree/traits/utils/reduceScrollTarget.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { slugify } from \"library/utils/slugify.ts\"\nimport type React from \"react\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { Panel } from \"../panels/Panel.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { PanelSectionHeaderWithTraits } from \"./PanelSectionHeaderWithTraits.tsx\"\nimport * as styles from \"./ScrollTargetPanel.styles.ts\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nconst traitTypes = [TraitType.ScrollTarget]\n\ninterface Props extends Omit<ReducedScrollTarget, \"onlyNodesWithScrollTarget\"> {\n\treadOnly: boolean\n\tnodeIds: NodeID[]\n}\n\nfunction useScrollTargetUpdate<T extends keyof WithScrollTarget>(\n\tnodeIds: NodeID[],\n\tkey: T,\n\tspecificValue?: WithScrollTarget[T],\n) {\n\treturn useEngineCallback(\n\t\t(value?: WithScrollTarget[T] | React.MouseEvent<HTMLDivElement>) => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withScrollTarget).forEach(node => {\n\t\t\t\tconst update: Partial<WithScrollTarget & WithOverflow> = { [key]: specificValue ?? value }\n\t\t\t\tif (key === \"scrollTargetEnabled\" && specificValue) {\n\t\t\t\t\trecord(\"scroll_target_add\", { elementId: node.id })\n\t\t\t\t}\n\n\t\t\t\t// If scrollMarginTop is changed to a non-zero value, try to\n\t\t\t\t// prevent errors in chrome by setting overflow to visible.\n\t\t\t\t// https://bugs.chromium.org/p/chromium/issues/detail?id=1380731\n\t\t\t\t// NOTE: nodes with overflow \"clip\" are not affected by this bug and do not need\n\t\t\t\t// this workaround.\n\t\t\t\tif (key === \"scrollMarginTop\" && isNumber(value) && value > 0) {\n\t\t\t\t\tif (withOverflow(node) && node.overflow === \"hidden\") update.overflow = \"visible\"\n\t\t\t\t}\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds, key, specificValue],\n\t)\n}\n\nfunction usePrimaryVariantScrollTargetUpdate<T extends keyof WithScrollTarget>(\n\treadonly: boolean,\n\tnodeIds: NodeID[],\n\tkey: T,\n\tspecificValue?: WithScrollTarget[T],\n) {\n\treturn useEngineCallback(\n\t\t(value?: WithScrollTarget[T] | React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (readonly) return\n\n\t\t\tconst update = { [key]: specificValue ?? value }\n\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withScrollTarget).forEach(node => {\n\t\t\t\tif (isReplicaVariantOrReplicaVariantChild(node)) {\n\t\t\t\t\tconst originalNode = engine.tree.getNode<CanvasNode & WithScrollTarget>(node.originalid)\n\t\t\t\t\tif (!originalNode) return\n\t\t\t\t\tassert(withScrollTarget(originalNode))\n\t\t\t\t\toriginalNode.set(update)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[readonly, key, specificValue, nodeIds],\n\t)\n}\n\nexport function ScrollTargetPanel({ readOnly, nodeIds, elementId, scrollMarginTop = 0, scrollTargetEnabled }: Props) {\n\t// Element id name must be shared across variants so that a direct link to\n\t// an element always works even if the device size changes.\n\tconst onChangeElementId = usePrimaryVariantScrollTargetUpdate(readOnly, nodeIds, \"elementId\")\n\n\t// Additionally, for convenience we also automatically toggle scroll\n\t// sections in the primary variant to prevent accidentally only adding the\n\t// `id` in a breakpoint. This makes determining which elements can be\n\t// scrolled to straightforward, and not dependent on the active breakpoint.\n\tconst enableScrollTarget = usePrimaryVariantScrollTargetUpdate(readOnly, nodeIds, \"scrollTargetEnabled\", true)\n\tconst disableScrollTarget = usePrimaryVariantScrollTargetUpdate(readOnly, nodeIds, \"scrollTargetEnabled\", false)\n\n\t// Other properties can be changed depending on the variant.\n\tconst onChangeOffsetY = useScrollTargetUpdate(nodeIds, \"scrollMarginTop\")\n\tconst onClearOffsetY = useScrollTargetUpdate(nodeIds, \"scrollMarginTop\", undefined)\n\n\tconst enabled = scrollTargetEnabled === true\n\tconst name = isString(elementId) ? slugify(elementId) : \"\"\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeaderWithTraits\n\t\t\t\t\ttraits={traitTypes}\n\t\t\t\t\tclickable={!readOnly}\n\t\t\t\t\ttitle={<T>{Dictionary.ScrollSection}</T>}\n\t\t\t\t\tonClick={enabled ? disableScrollTarget : enableScrollTarget}\n\t\t\t\t>\n\t\t\t\t\t{enabled ? (\n\t\t\t\t\t\t<PanelSectionHeaderButton onClick={disableScrollTarget}>\n\t\t\t\t\t\t\t<IconSectionHeaderMinus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PanelSectionHeaderButton onClick={enableScrollTarget}>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeaderWithTraits>\n\t\t\t}\n\t\t>\n\t\t\t{enabled && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"Name\">\n\t\t\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t\t\t<InputWrapper>\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tsize={fonts.size.base}\n\t\t\t\t\t\t\t\t\tdisableSpacingCorrection\n\t\t\t\t\t\t\t\t\tclassName={cx(styles.secondaryText, truncateWithEllipsis, styles.hash)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t#\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\t\t\t\tplaceholder=\"name\"\n\t\t\t\t\t\t\t\t\tonChange={onChangeElementId}\n\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Offset Y\">\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tvalue={isFound(scrollMarginTop) ? scrollMarginTop : 0}\n\t\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\t\tonChange={onChangeOffsetY}\n\t\t\t\t\t\t\tonClear={onClearOffsetY}\n\t\t\t\t\t\t\tstepperStep={10}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Panel>\n\t)\n}\n", "import { Button, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { withChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport type { ReducedSelectionProperties } from \"document/models/CanvasTree/traits/utils/reduceSelectionProperties.ts\"\nimport { isGradient } from \"document/models/Gradient.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { cx } from \"library/index.ts\"\nimport React from \"react\"\nimport { isNonNull, isNull } from \"utils/typeChecks.ts\"\nimport { PopoutButtonBackgroundPreview } from \"../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { SelectionPropertiesColorPicker } from \"../inputs/SelectionPropertiesColorPicker.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport * as styles from \"./SelectionPropertiesPanel.styles.ts\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport {\n\ttype SelectionColorsMap,\n\ttype SelectionColorsMapValue,\n\ttype SelectionColorsSupportedPropertyValue,\n\tgetSortedColorArray,\n\tgetUpdateSelectionColorInitialState,\n\tisGradientUpdateSupported,\n\tupdateSelectionColor,\n} from \"./utils/selectionProperties.ts\"\n\nconst maxColorsToPreview = 4\nconst maxColorRowsAtStart = 10\n\ntype SelectionPropertiesPanelProps = Pick<ReducedSelectionProperties, \"selectionColorProperties\"> & {\n\tnodeIds: NodeID[]\n\tselectionHash: string\n\tonlyTextNodes: boolean\n}\n\nexport const SelectionPropertiesPanel = React.memo(function SelectionPropertiesPanel({\n\tselectionColorProperties,\n\tselectionHash,\n\tonlyTextNodes,\n\tnodeIds,\n}: SelectionPropertiesPanelProps) {\n\tconst [editingProperties, setEditingProperties] = React.useState<SelectionColorsMap | null>(null)\n\tconst [showAllColorsInList, setShowAllColorsInList] = React.useState(false)\n\tconst [colorToOpen, setColorToOpen] = React.useState<string>(\"\")\n\tconst activeProperties = editingProperties ?? selectionColorProperties\n\tconst colors = React.useMemo(() => getSortedColorArray(engine, activeProperties), [activeProperties])\n\tconst colorsCount = colors.length\n\tconst previewColors = React.useMemo(() => colors.slice(0, maxColorsToPreview), [colors])\n\tconst displayColors = React.useMemo(\n\t\t() => (showAllColorsInList ? colors : colors.slice(0, maxColorRowsAtStart)),\n\t\t[colors, showAllColorsInList],\n\t)\n\n\t// When the selection hash changes, we must reset this state so the \"See All\" button is shown again when deemed\n\t// necessary, as well as clear the color to potentially auto open.\n\t// biome-ignore lint/correctness/useExhaustiveDependencies(selectionHash): See above\n\tReact.useEffect(() => {\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\tsetShowAllColorsInList(false)\n\t\t// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect\n\t\tsetColorToOpen(\"\")\n\t}, [selectionHash])\n\n\tconst handleToggleExpanded = React.useCallback((newIsExpanded: boolean) => {\n\t\tsetIsExpanded(newIsExpanded)\n\t\tif (newIsExpanded === false) {\n\t\t\t// Whenever the toggle panel collapses, we must reset the state so the \"See All\" button is shown again,\n\t\t\t// as well as reset the state for which color to open.\n\t\t\tsetShowAllColorsInList(false)\n\t\t\tsetColorToOpen(\"\")\n\t\t}\n\t}, [])\n\n\tconst handleContextMenuForColorRow = useEngineCallback(\n\t\t(event: React.MouseEvent<HTMLElement>, nodeUpdateMap: SelectionColorsMapValue[\"nodeUpdateMap\"]) => {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\ttype: \"normal\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.stores.selectionStore.set(nodeUpdateMap.keys())\n\t\t\t\t\t},\n\t\t\t\t\tlabel: Dictionary.SelectLayers,\n\t\t\t\t},\n\t\t\t]\n\n\t\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t})\n\t\t},\n\t\t[],\n\t)\n\n\tconst onEndEdit = React.useCallback(() => {\n\t\tsetEditingProperties(null)\n\t}, [])\n\n\tconst isColorListExpandable = colorsCount > maxColorsToPreview\n\tconst [isExpanded, setIsExpanded] = React.useState(() => !isColorListExpandable)\n\n\tif (colorsCount === 0) return null\n\n\t// If there is only one node selected, we only want to show the panel if there's a text node with 2+ colors, or\n\t// there's a single node with children. The check occurs here instead of its parent to control when exactly the\n\t// panel closes in the text nodes case. If it was in the parent, it would close as soon as the colors collapse to\n\t// one row, which occurs after the `node.set()` happens (changing in the color picker), even if the user has not\n\t// finalized their selection by closing the color picker. The latter is what we would prefer. Here, we are\n\t// checking against the frozen selection properties map (which updates once the color picker is closed) as opposed\n\t// to the latest reduced properties map (which updates more often).\n\tif (nodeIds.length === 1) {\n\t\tif (onlyTextNodes) {\n\t\t\tif (colorsCount === 1) return null\n\t\t} else {\n\t\t\tconst singleNode = engine.tree.getNode(nodeIds[0])\n\t\t\tif (singleNode && (!withChildren(singleNode) || singleNode.children.length === 0)) return null\n\t\t}\n\t}\n\n\tconst showColorList = isExpanded || !isColorListExpandable\n\tconst showMoreColorsButton = !showAllColorsInList && colorsCount > maxColorRowsAtStart\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle=\"Selection\"\n\t\t\t\t\tclickable={isColorListExpandable}\n\t\t\t\t\tonClick={isColorListExpandable ? () => handleToggleExpanded(!isExpanded) : undefined}\n\t\t\t\t>\n\t\t\t\t\t{isColorListExpandable && (\n\t\t\t\t\t\t<PanelSectionHeaderButton onClick={() => handleToggleExpanded(!isExpanded)}>\n\t\t\t\t\t\t\t{isExpanded ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t<PanelRow title=\"Colors\">\n\t\t\t\t{showColorList ? (\n\t\t\t\t\t<Stack className={doubleColumnClass}>\n\t\t\t\t\t\t{displayColors.map(([propertyValue, mapValue]) => (\n\t\t\t\t\t\t\t<SelectionPropertiesColorRow\n\t\t\t\t\t\t\t\t// include selectionHash to ensure the color picker closes if the selection changes\n\t\t\t\t\t\t\t\tkey={`${selectionHash}-${propertyValue}`}\n\t\t\t\t\t\t\t\tvalue={mapValue.value}\n\t\t\t\t\t\t\t\tnodeUpdateMap={mapValue.nodeUpdateMap}\n\t\t\t\t\t\t\t\tonBeginEdit={() => {\n\t\t\t\t\t\t\t\t\tsetEditingProperties(selectionColorProperties)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonEndEdit={onEndEdit}\n\t\t\t\t\t\t\t\tonContextMenu={handleContextMenuForColorRow}\n\t\t\t\t\t\t\t\tautoOpenColorPicker={colorToOpen === propertyValue}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{showMoreColorsButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName={styles.seeAllButtonClass}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tsetColorToOpen(\"\")\n\t\t\t\t\t\t\t\t\tsetShowAllColorsInList(true)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSee All\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t) : (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={cx(doubleColumnClass, styles.previewStackClass)}\n\t\t\t\t\t\tgap={dimensions.css.contentItemPadding}\n\t\t\t\t\t\tpadding={dimensions.css.contentItemPadding}\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{previewColors.map(([propertyValue]) => (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={`${propertyValue}.preview.button`}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tclassName={styles.unsetButtonStylesClass}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\thandleToggleExpanded(true)\n\t\t\t\t\t\t\t\t\tsetEditingProperties(selectionColorProperties)\n\t\t\t\t\t\t\t\t\tsetColorToOpen(propertyValue)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PopoutButtonBackgroundPreview background={propertyValue} defaultBackgroundColor=\"transparent\" />\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tclassName={cx(styles.unsetButtonStylesClass, styles.previewCountClass)}\n\t\t\t\t\t\t\tonClick={() => handleToggleExpanded(true)}\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t+{colorsCount - maxColorsToPreview}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t</Panel>\n\t)\n})\n\nexport interface SelectionPropertiesColorRowProps extends SelectionColorsMapValue {\n\tonBeginEdit: () => void\n\tonEndEdit: () => void\n\tonContextMenu: (event: React.MouseEvent, nodeUpdateMap: SelectionColorsMapValue[\"nodeUpdateMap\"]) => void\n\tautoOpenColorPicker?: boolean\n}\nexport function SelectionPropertiesColorRow({\n\tvalue,\n\tnodeUpdateMap,\n\tonBeginEdit,\n\tonEndEdit,\n\tonContextMenu,\n\tautoOpenColorPicker,\n}: SelectionPropertiesColorRowProps) {\n\tconst initialState = React.useMemo(\n\t\t() => getUpdateSelectionColorInitialState(engine.tree, value, nodeUpdateMap),\n\t\t[value, nodeUpdateMap],\n\t)\n\tconst { onChange, getValueFromHistory, initHistory, resetHistory, resetKey } = useChangeHistory(value)\n\tconst handleChange = useEngineCallback(\n\t\t(newValue: SelectionColorsSupportedPropertyValue, final: boolean) => {\n\t\t\tengine.setEditReason(\"Selection Properties\")\n\t\t\tonChange(newValue, final)\n\t\t\tupdateSelectionColor(engine.tree, engine.componentLoader, initialState, nodeUpdateMap, newValue)\n\t\t},\n\t\t[onChange, nodeUpdateMap, initialState],\n\t)\n\n\tconst onBeginEditWithInit = React.useCallback(() => {\n\t\tinitHistory()\n\t\tonBeginEdit()\n\t}, [onBeginEdit, initHistory])\n\n\tconst onEndEditWithReset = React.useCallback(() => {\n\t\t// if we don't clear the history when the picker closes then we might get confused state\n\t\t// if they undo and start editing a different set of nodes\n\t\tresetHistory()\n\t\tonEndEdit()\n\t}, [resetHistory, onEndEdit])\n\n\tconst handleContextMenuForItem = useEngineCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tonContextMenu(event, nodeUpdateMap)\n\t\t},\n\t\t[nodeUpdateMap, onContextMenu],\n\t)\n\n\tconst gradientUpdateSupported = React.useMemo(\n\t\t() => isGradient(value) || isGradientUpdateSupported(engine.tree, nodeUpdateMap),\n\t\t[nodeUpdateMap, value],\n\t)\n\n\treturn (\n\t\t<SelectionPropertiesColorPicker\n\t\t\tkey={resetKey}\n\t\t\tvalue={getValueFromHistory(engine.getStateToken()) ?? value}\n\t\t\tonChange={handleChange}\n\t\t\tonBeginEdit={onBeginEditWithInit}\n\t\t\tonEndEdit={onEndEditWithReset}\n\t\t\tonContextMenu={handleContextMenuForItem}\n\t\t\tgradientUpdateSupported={gradientUpdateSupported}\n\t\t\tautoOpenColorPicker={autoOpenColorPicker}\n\t\t/>\n\t)\n}\n\n/**\n * To support undo/redo when the color picker is open we need to keep track of the edit history and then\n * match the current engine state to the history. This allows us to set the color picker state correctly\n * without having an updated color map.\n */\nfunction useChangeHistory(initialValue: SelectionColorsSupportedPropertyValue) {\n\tconst initialTokenRef = React.useRef<number | null>(null)\n\tconst historyRef = React.useRef<SelectionColorsSupportedPropertyValue[] | null>(null)\n\tconst dragStartTokenRef = React.useRef<number | null>(null)\n\n\tconst onChange = React.useCallback(\n\t\t(value: SelectionColorsSupportedPropertyValue, final: boolean) => {\n\t\t\tconst currentToken = engine.getStateToken()\n\t\t\tconst nextToken = currentToken + 1\n\t\t\tconst dragStartToken = dragStartTokenRef.current\n\t\t\tconst isDragging = !final\n\n\t\t\tif (!historyRef.current) {\n\t\t\t\thistoryRef.current = []\n\t\t\t\thistoryRef.current[currentToken] = initialValue\n\t\t\t}\n\n\t\t\tif (historyRef.current[nextToken]) {\n\t\t\t\thistoryRef.current.splice(nextToken)\n\t\t\t}\n\n\t\t\t// Start of drag\n\t\t\tif (isDragging && isNull(dragStartTokenRef.current)) {\n\t\t\t\thistoryRef.current[nextToken] = value\n\t\t\t\tdragStartTokenRef.current = nextToken\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Mid-drag change\n\t\t\tif (isDragging && isNonNull(dragStartToken)) {\n\t\t\t\thistoryRef.current[dragStartToken] = value\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// End of drag change\n\t\t\tif (!isDragging && isNonNull(dragStartToken)) {\n\t\t\t\thistoryRef.current[dragStartToken] = value\n\t\t\t\tdragStartTokenRef.current = null\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Discrete change\n\t\t\thistoryRef.current[nextToken] = value\n\t\t},\n\t\t[initialValue],\n\t)\n\n\tconst initHistory = React.useCallback(() => {\n\t\tinitialTokenRef.current = engine.getStateToken()\n\t}, [])\n\n\tconst resetHistory = React.useCallback(() => {\n\t\thistoryRef.current = null\n\t\tdragStartTokenRef.current = null\n\t\tinitialTokenRef.current = null\n\t}, [])\n\n\tconst getValueFromHistory = React.useCallback((token: number) => {\n\t\tif (!historyRef.current) return undefined\n\t\tconst val = historyRef.current[dragStartTokenRef.current ?? token]\n\t\treturn val\n\t}, [])\n\n\tconst currentToken = engine.getStateToken()\n\n\treturn {\n\t\tonChange,\n\t\tgetValueFromHistory,\n\t\tinitHistory,\n\t\tresetHistory,\n\t\t/**\n\t\t * Key used to force the color picker to close if we are out of our history range\n\t\t * (i.e. user undos to a point before the picker was opened, or redos beyond the history range)\n\t\t */\n\t\tresetKey:\n\t\t\tisNonNull(initialTokenRef.current) &&\n\t\t\tinitialTokenRef.current !== currentToken &&\n\t\t\t!getValueFromHistory(currentToken)\n\t\t\t\t? currentToken\n\t\t\t\t: undefined,\n\t}\n}\n", "import engine from \"document/engine.ts\"\nimport type { FillType } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { ConicGradient, isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport { isGradient } from \"document/models/Gradient.ts\"\nimport type { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { LinearGradient, isLinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { RadialGradient, isRadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport React from \"react\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport type { ColorPickerTab } from \"../../shared/ColorPicker/ColorPickerFillTypeTabs.tsx\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { PopoutContext } from \"../../shared/PopoutContext.ts\"\nimport { getDefaultGradientStops } from \"../panels/utils/getDefaultGradientStops.ts\"\nimport type { SelectionColorsSupportedPropertyValue } from \"../panels/utils/selectionProperties.ts\"\n\nconst popoutIdPrefix = \"selection-properties-color-picker\"\nconst colorPickerTabs: ColorPickerTab[] = [\"solid\", \"linear\", \"radial\", \"conic\"]\nconst colorPickerTabsWithoutGradient: ColorPickerTab[] = [\"solid\"]\n\nexport interface SelectionPropertiesColorPickerProps {\n\tvalue: SelectionColorsSupportedPropertyValue\n\tonChange: (newValue: SelectionColorsSupportedPropertyValue, final: boolean) => void\n\tonBeginEdit: () => void\n\tonEndEdit: () => void\n\tonContextMenu: (event: React.MouseEvent) => void\n\tgradientUpdateSupported: boolean\n\tautoOpenColorPicker?: boolean\n}\nexport function SelectionPropertiesColorPicker({\n\tvalue,\n\tonChange,\n\tonBeginEdit,\n\tonEndEdit,\n\tonContextMenu,\n\tgradientUpdateSupported,\n\tautoOpenColorPicker,\n}: SelectionPropertiesColorPickerProps) {\n\tconst [state, dispatch] = React.useReducer(\n\t\tselectionPropertiesColorPickerReducer,\n\t\tvalue,\n\t\tgetSelectionPropertiesColorPickerReducerInitialState,\n\t)\n\n\tconst popoutId = React.useId()\n\n\tconst popoutNavigation = React.useContext(PopoutContext)\n\n\tconst handleBeginEdit = React.useCallback(() => {\n\t\tonBeginEdit()\n\t\tdispatch({ type: \"reset\", value })\n\t}, [value, onBeginEdit])\n\n\tconst handleEndEdit = React.useCallback(() => {\n\t\tonEndEdit()\n\t\t// When setting a value that is not supported by all node/properties, such as a gradient, we may end up with\n\t\t// this component being reused, so we need to reset the state to ensure the displayed value is correct.\n\t\tdispatch({ type: \"reset\", value })\n\t}, [value, onEndEdit])\n\n\tconst handleChange = React.useCallback((newColor: string, gradientStopId: string | undefined, final: boolean) => {\n\t\tdispatch({ type: \"changeColor\", color: newColor, gradientStopId, isDragging: !final })\n\t}, [])\n\n\tconst handleChangeFillType = React.useCallback((fillType: FillType) => {\n\t\tdispatch({ type: \"changeFillType\", fillType })\n\t}, [])\n\n\tconst handleChangeColorStops = React.useCallback((stops: GradientColorStop[]) => {\n\t\tdispatch({ type: \"changeGradientStops\", stops })\n\t}, [])\n\n\t// If the state is not the initial value, then we must update the nodes.\n\tReact.useEffect(() => {\n\t\tif (state.isInitialValue) return\n\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tonChange(state.value, !state.isDragging)\n\t\t})\n\t}, [state.value, state.isInitialValue, state.isDragging, onChange])\n\n\tReact.useEffect(() => {\n\t\t// The value changed outside the component so we need to merge the state.\n\t\tdispatch({ type: \"resetOnExternalValueChange\", value })\n\t}, [value])\n\n\tReact.useEffect(() => {\n\t\tif (autoOpenColorPicker && popoutNavigation) {\n\t\t\tpopoutNavigation.presentPopout(popoutId)\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<ColorPopoutButton\n\t\t\tid={popoutId}\n\t\t\tvalue={state.value}\n\t\t\tcurrentType={state.fillType}\n\t\t\tfillGradientCSS={isGradient(state.value) ? state.value.toCSS() : undefined}\n\t\t\tonChange={handleChange}\n\t\t\tonChangeFillType={gradientUpdateSupported ? handleChangeFillType : undefined}\n\t\t\tonChangeColorStops={gradientUpdateSupported ? handleChangeColorStops : undefined}\n\t\t\tonPresent={handleBeginEdit}\n\t\t\tonDismiss={handleEndEdit}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\ttabsToShow={gradientUpdateSupported ? colorPickerTabs : colorPickerTabsWithoutGradient}\n\t\t\tshowAlphaInButton\n\t\t/>\n\t)\n}\n\nexport interface ReducerState extends Partial<\n\tPick<\n\t\tLinearGradient & RadialGradient & ConicGradient,\n\t\t\"angle\" | \"centerAnchorX\" | \"centerAnchorY\" | \"heightFactor\" | \"widthFactor\" | \"stops\"\n\t>\n> {\n\tfillType: FillType\n\tcolor: string\n\tvalue: SelectionColorsSupportedPropertyValue\n\t/** Avoid updating nodes if the value never changed */\n\tisInitialValue: boolean\n\tisDragging: boolean\n}\nexport type ReducerAction =\n\t| { type: \"changeColor\"; color: string; gradientStopId: string | undefined; isDragging: boolean }\n\t| { type: \"changeFillType\"; fillType: FillType }\n\t| { type: \"changeGradientStops\"; stops: GradientColorStop[] }\n\t| { type: \"reset\"; value: SelectionColorsSupportedPropertyValue }\n\t| { type: \"resetOnExternalValueChange\"; value: SelectionColorsSupportedPropertyValue }\nexport function selectionPropertiesColorPickerReducer(state: ReducerState, action: ReducerAction): ReducerState {\n\tif (action.type === \"reset\") {\n\t\t// only reset if the value somehow changed between edits\n\t\treturn action.value !== state.value ? getSelectionPropertiesColorPickerReducerInitialState(action.value) : state\n\t}\n\n\tconst newState = { ...state }\n\tnewState.isDragging = false\n\tnewState.isInitialValue = false\n\n\tswitch (action.type) {\n\t\tcase \"resetOnExternalValueChange\": {\n\t\t\t// The value changed externally, probably due to a undo/redo operation. We try to keep any existing non-active state\n\t\t\t// for example if the user was editing a gradient and undo switches it back to a color, we want the gradient to be\n\t\t\t// unchanged for when they switch back.\n\t\t\tconst initialState = getSelectionPropertiesColorPickerReducerInitialState(action.value)\n\t\t\tnewState.fillType = initialState.fillType\n\t\t\tnewState.isInitialValue = true\n\t\t\tnewState.value = initialState.value\n\n\t\t\tif (isString(action.value)) {\n\t\t\t\tnewState.color = initialState.color\n\t\t\t} else {\n\t\t\t\tnewState.angle = initialState.angle\n\t\t\t\tnewState.centerAnchorX = initialState.centerAnchorX\n\t\t\t\tnewState.centerAnchorY = initialState.centerAnchorY\n\t\t\t\tnewState.heightFactor = initialState.heightFactor\n\t\t\t\tnewState.widthFactor = initialState.widthFactor\n\t\t\t\tnewState.stops = initialState.stops\n\t\t\t}\n\n\t\t\treturn newState\n\t\t}\n\t\tcase \"changeColor\":\n\t\t\t// If the current state is a gradient, then the propagated stop is updated with the new color. `stops` should\n\t\t\t// be defined based on how the state is initialized for gradients or when changing to a gradient, but it\n\t\t\t// will not throw until we see a reason to.\n\t\t\tif (state.fillType !== \"color\" && isArray(state.stops)) {\n\t\t\t\t// `GradientToolManagerTool` incorrectly sets the selected gradient stop to the first stop of the first\n\t\t\t\t// active gradient of the selected nodes. This works fine for individual properties like fill, but not\n\t\t\t\t// for us rendering potentially multiple gradients that may be on descendants of the selected nodes.\n\t\t\t\t// If we can't find the selected stop, it is likely that it was set incorrectly by `GradientToolManagerTool`,\n\t\t\t\t// and we should default to the first stop of our gradient instead.\n\t\t\t\t// If a stop is clicked in the color picker, it is selected correctly. This is just for the initial state\n\t\t\t\t// when no stop has been manually selected.\n\t\t\t\t// TODO: This should be fixed in GradientToolManagerTool\n\t\t\t\tconst stop = state.stops.find(s => s.id === action.gradientStopId) ?? state.stops[0]\n\t\t\t\tconst stopId = stop?.id\n\t\t\t\tnewState.stops = state.stops.map(s => (s.id === stopId ? s.merge({ value: action.color }) : s))\n\t\t\t} else {\n\t\t\t\t// If the current state is not the gradient, then the color is updated directly, and the fill type is\n\t\t\t\t// set to solid color.\n\t\t\t\tnewState.color = action.color\n\t\t\t\tnewState.fillType = \"color\"\n\t\t\t}\n\t\t\t// mark dragging so we can track \"complete\" changes for undo/redo purposes\n\t\t\tnewState.isDragging = action.isDragging\n\t\t\tbreak\n\t\tcase \"changeFillType\":\n\t\t\tnewState.fillType = action.fillType\n\t\t\t// If we are changing the fill type to a gradient, and this color has never been a gradient during this\n\t\t\t// lifecycle, then we need to set the stops to an initial state based on the current color.\n\t\t\tif (newState.fillType !== \"color\" && !newState.stops) {\n\t\t\t\tnewState.stops = getDefaultGradientStops(newState.color)\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"changeGradientStops\":\n\t\t\tnewState.stops = action.stops\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(action)\n\t}\n\n\tnewState.value = getResolvedColorValue(newState)\n\n\treturn newState\n}\n\nexport function getSelectionPropertiesColorPickerReducerInitialState(\n\tvalue: SelectionColorsSupportedPropertyValue,\n): ReducerState {\n\treturn {\n\t\tvalue,\n\t\tcolor: isGradient(value) ? (value.stops?.[0]?.value ?? \"rgb(0, 0, 0)\") : value,\n\t\tfillType: getFillType(value),\n\t\tangle: isConicGradient(value) || isLinearGradient(value) ? value.angle : undefined,\n\t\tcenterAnchorX: isConicGradient(value) || isRadialGradient(value) ? value.centerAnchorX : undefined,\n\t\tcenterAnchorY: isConicGradient(value) || isRadialGradient(value) ? value.centerAnchorY : undefined,\n\t\theightFactor: isRadialGradient(value) ? value.heightFactor : undefined,\n\t\twidthFactor: isRadialGradient(value) ? value.widthFactor : undefined,\n\t\tstops: isGradient(value) ? value.stops : undefined,\n\t\tisInitialValue: true,\n\t\tisDragging: false,\n\t}\n}\n\nfunction getResolvedColorValue(state: ReducerState): SelectionColorsSupportedPropertyValue {\n\tswitch (state.fillType) {\n\t\tcase \"color\":\n\t\t// `image` fill type should never occur in this state, but we must account for it to avoid a crash.\n\t\tcase \"image\":\n\t\t\treturn state.color\n\t\tcase \"linear-gradient\":\n\t\t\treturn new LinearGradient({ angle: state.angle ?? 180, stops: state.stops })\n\t\tcase \"radial-gradient\":\n\t\t\treturn new RadialGradient({\n\t\t\t\tcenterAnchorX: state.centerAnchorX ?? 0.5,\n\t\t\t\tcenterAnchorY: state.centerAnchorY ?? 0.5,\n\t\t\t\theightFactor: state.heightFactor ?? 0.5,\n\t\t\t\twidthFactor: state.widthFactor ?? 0.5,\n\t\t\t\tstops: state.stops,\n\t\t\t})\n\t\tcase \"conic-gradient\":\n\t\t\treturn new ConicGradient({\n\t\t\t\tangle: state.angle ?? 0,\n\t\t\t\tcenterAnchorX: state.centerAnchorX ?? 0.5,\n\t\t\t\tcenterAnchorY: state.centerAnchorY ?? 0.5,\n\t\t\t\tstops: state.stops,\n\t\t\t})\n\t\tdefault:\n\t\t\tassertNever(state.fillType)\n\t}\n}\n\nfunction getFillType(value: SelectionColorsSupportedPropertyValue): FillType {\n\tif (isLinearGradient(value)) return \"linear-gradient\"\n\tif (isRadialGradient(value)) return \"radial-gradient\"\n\tif (isConicGradient(value)) return \"conic-gradient\"\n\n\treturn \"color\"\n}\n", "import \"SelectionPropertiesPanel.styles_t9oowj.wyw.css\"; export const previewStackClass = \"previewStackClass_paiyj2d\";\nexport const unsetButtonStylesClass = \"unsetButtonStylesClass_u19il2ad\";\nexport const previewCountClass = \"previewCountClass_p133213g\";\nexport const seeAllButtonClass = \"seeAllButtonClass_sfgtz4g\";", "import type { VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { Mixed, assert, emptyArray, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { TransitionPopoutButton } from \"document/components/chrome/shared/TransitionEditor/TransitionPopout.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport { type Reduced, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport {\n\ttype Transition,\n\tdefaultDurationBasedSpringTransition,\n\tfallbackPhysicsBasedSpringTransition,\n\tgetPhysicsBasedSpringOptions,\n} from \"document/models/Transition.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { getControlProp, getControlPropFallbackValue } from \"document/models/controlProps/getControlProps.ts\"\nimport type { ReducedControlProps } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useControlHiddenState } from \"document/useControlHiddenState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { SpringOptions } from \"framer-motion\"\nimport type { ShaderMouseDefault } from \"library/modules/defineShader.ts\"\nimport type { ControlDescription, WithHiddenWhenUnset } from \"library/render/types/PropertyControls.ts\"\nimport { isBoolean } from \"library/utils/utils.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { ControlPropRow } from \"../codeComponentRows/ControlPropRow.tsx\"\nimport { controlPropRowNeedsHiddenState } from \"../codeComponentRows/utils/controlPropRowNeedsHiddenState.ts\"\nimport { isHiddenRow } from \"../codeComponentRows/utils/isHiddenRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { PanelElementId } from \"./utils/highlightPanel.ts\"\nimport { useControlUploadHandler } from \"./utils/useControlUploadHandler.ts\"\n\nfunction isControlHiddenWhenUnset(control: ControlDescription): boolean {\n\tconst hiddenWhenUnset = \"hiddenWhenUnset\" satisfies keyof WithHiddenWhenUnset\n\treturn hiddenWhenUnset in control && control[hiddenWhenUnset] === true\n}\n\n/** Context menu to add `hiddenWhenUnset` controls. */\nfunction displayAddOptionalControlMenu(\n\tevent: React.MouseEvent,\n\thiddenControls: string[],\n\tproperties: VerifiedPropertyControls,\n\tnodeIds: NodeID[],\n) {\n\tconst template: MenuItemOptions[] = hiddenControls.map(controlKey => {\n\t\tconst control = properties[controlKey]\n\t\treturn {\n\t\t\tlabel: control?.title ?? titleCase(controlKey),\n\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\tif (!control) return\n\n\t\t\t\tconst hasDefaultValue = \"defaultValue\" in control && control.defaultValue !== undefined\n\t\t\t\tconst defaultOverride = hasDefaultValue ? undefined : getControlPropFallbackValue(control.type)\n\t\t\t\tconst controlProp = getControlProp(control, undefined, defaultOverride)\n\t\t\t\tassert(controlProp, \"Control prop not found\")\n\n\t\t\t\tengine.setEditReason(\"shader_property\")\n\t\t\t\tconst nodes = engine.tree.getNodes<ShaderNode>(nodeIds)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setControlProp(controlKey, controlProp)\n\t\t\t\t}\n\t\t\t}),\n\t\t}\n\t})\n\tengine.stores.contextMenuStore.show(template, { location: { x: event.clientX, y: event.clientY } })\n}\n\n/** Context menu for removing a `hiddenWhenUnset` control. */\nfunction displayRemoveOptionalControlMenu(event: React.MouseEvent, controlKey: string, nodeIds: NodeID[]) {\n\tengine.stores.contextMenuStore.show(\n\t\t[\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Remove,\n\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\tengine.setEditReason(\"shader_property\")\n\t\t\t\t\tfor (const node of engine.tree.getNodes<ShaderNode>(nodeIds)) {\n\t\t\t\t\t\tnode.setControlProp(controlKey, undefined)\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t},\n\t\t],\n\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t)\n}\n\ninterface ControlPanelSection {\n\tkey: string\n\ttitle: string\n\tisDefault: boolean\n\trows: React.ReactNode[]\n\tunsetOptionalControls: string[]\n}\n\ninterface SectionedControlKeys {\n\tsectionName: string\n\tcontrolKeys: string[]\n}\n\nexport function getControlKeysBySection(controls: VerifiedPropertyControls): SectionedControlKeys[] {\n\tconst controlKeysBySection = new Map<string, string[]>()\n\n\tfor (const controlKey in controls) {\n\t\tconst control = controls[controlKey]\n\t\tif (!control) continue\n\n\t\tconst section = control.section || \"\"\n\t\tconst controlKeys = controlKeysBySection.get(section)\n\n\t\tif (controlKeys) {\n\t\t\tcontrolKeys.push(controlKey)\n\t\t} else {\n\t\t\tcontrolKeysBySection.set(section, [controlKey])\n\t\t}\n\t}\n\n\tconst result: SectionedControlKeys[] = []\n\n\t// Ensure the default section comes first\n\tconst defaultSectionControlKeys = controlKeysBySection.get(\"\")\n\tif (defaultSectionControlKeys) {\n\t\tresult.push({ sectionName: \"\", controlKeys: defaultSectionControlKeys })\n\t\tcontrolKeysBySection.delete(\"\")\n\t}\n\n\tfor (const [sectionName, controlKeys] of controlKeysBySection) {\n\t\tresult.push({ sectionName, controlKeys })\n\t}\n\n\treturn result\n}\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tscopeType: ScopeType\n\tmoduleIdentifier: string\n\tshaderControlProps: ReducedControlProps\n\thiddenBecauseUnsetControlKeys: ReadonlySet<string>\n\tanyReplicaVariantOrReplicaVariantChild: boolean\n\t// The component hash isn\u2019t really used, we added it to break memoization.\n\tcomponentHash: string\n\t/** Whether to allow computed values. Defaults to true. */\n\tsupportsComputedValues?: boolean\n\t/** Whether to allow variables. Defaults to true. */\n\tsupportsVariables?: boolean\n\tshaderMouseEnabled?: Reduced<boolean | undefined>\n\tshaderMouseSpringOptions?: Reduced<SpringOptions | undefined>\n}\n\nexport const ShaderControlPropsPanel = React.memo(function ShaderControlPropsPanel({\n\tnodeIds,\n\tscopeType,\n\tmoduleIdentifier,\n\tshaderControlProps,\n\thiddenBecauseUnsetControlKeys,\n\tsupportsVariables = true,\n\tshaderMouseEnabled,\n\tshaderMouseSpringOptions,\n\tsupportsComputedValues = true,\n}: Props) {\n\tconst shaderDefinition = engine.componentLoader.shaderForIdentifier(moduleIdentifier)\n\n\t// Hidden state is only used for controls with dynamic `hidden` functions (computed in sandbox)\n\tconst hiddenState = useControlHiddenState(nodeIds)\n\n\tconst changeHandler = useEngineCallback(\n\t\t(controlKey: string, getUpdate: (controlProp: ControlProp) => ControlProp, nodesToUpdate: NodeID[]) => {\n\t\t\tif (engine.tree.isViewOnly) return\n\n\t\t\tassert(shaderDefinition)\n\t\t\tengine.setEditReason(\"shader_property\")\n\t\t\tconst nodes = engine.tree.getNodes<ShaderNode>(nodesToUpdate)\n\t\t\tconst control = shaderDefinition.properties[controlKey]\n\t\t\tassert(control)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tconst currentControlProp = getControlProp(control, node.getRawControlProp(controlKey))\n\t\t\t\tassert(currentControlProp)\n\t\t\t\tconst updatedControlProp = getUpdate(currentControlProp)\n\n\t\t\t\t// When hiddenWhenUnset is true and the value is cleared (set to null),\n\t\t\t\t// remove the control prop entirely so the default value is used\n\t\t\t\tif (isControlHiddenWhenUnset(control) && updatedControlProp.value === null) {\n\t\t\t\t\tnode.setControlProp(controlKey, undefined)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnode.setControlProp(controlKey, updatedControlProp)\n\t\t\t}\n\t\t},\n\t\t[shaderDefinition],\n\t)\n\n\tconst uploadHandler = useControlUploadHandler(changeHandler, nodeIds)\n\n\tconst createContextMenuHandler = React.useCallback(\n\t\t(controlKey: string) => (event: React.MouseEvent) => {\n\t\t\tdisplayRemoveOptionalControlMenu(event, controlKey, nodeIds)\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tif (!shaderDefinition) return null\n\n\tconst controlKeysBySection = getControlKeysBySection(shaderDefinition.properties)\n\n\tconst sections: ControlPanelSection[] = []\n\n\tfor (const { sectionName, controlKeys } of controlKeysBySection) {\n\t\tconst rows: React.ReactNode[] = []\n\n\t\tfor (const controlKey of controlKeys) {\n\t\t\tconst control = shaderDefinition.properties[controlKey]\n\t\t\tassert(control)\n\t\t\tconst reducedControlProp = shaderControlProps[controlKey]\n\t\t\tif (!reducedControlProp) continue\n\n\t\t\tif (isHiddenRow(controlKey, nodeIds, hiddenState)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isBoolean(control.hidden) && control.hidden) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (hiddenBecauseUnsetControlKeys.has(controlKey)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Show a \"remove\" menu item if the control has `hiddenWhenUnset`\n\t\t\tconst hasHiddenWhenUnset = isControlHiddenWhenUnset(control)\n\n\t\t\trows.push(\n\t\t\t\t<ControlPropRow\n\t\t\t\t\tkey={controlKey}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tcontrolKey={controlKey}\n\t\t\t\t\tcontrol={control}\n\t\t\t\t\tcontrolProp={reducedControlProp}\n\t\t\t\t\tcontrolSourceIdentifier={moduleIdentifier}\n\t\t\t\t\tonChange={changeHandler}\n\t\t\t\t\tonImageUpload={uploadHandler}\n\t\t\t\t\tonContextMenu={hasHiddenWhenUnset ? createContextMenuHandler(controlKey) : undefined}\n\t\t\t\t\thiddenControlsByNodeId={controlPropRowNeedsHiddenState(control.type) ? hiddenState : undefined}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tcontrolKeyIsTraitTypeKey\n\t\t\t\t\tsupportsVariables={supportsVariables}\n\t\t\t\t\tsupportsComputedValues={supportsComputedValues}\n\t\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\t\tallowP3={false}\n\t\t\t\t/>,\n\t\t\t)\n\t\t}\n\n\t\tconst unsetOptionalControls = controlKeys.filter(controlKey => hiddenBecauseUnsetControlKeys.has(controlKey))\n\n\t\tsections.push({\n\t\t\tkey: sectionName,\n\t\t\ttitle: sectionName || shaderDefinition?.title || Dictionary.Shader,\n\t\t\tisDefault: sectionName === \"\",\n\t\t\trows,\n\t\t\tunsetOptionalControls,\n\t\t})\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{sections.map(section => (\n\t\t\t\t<SectionPanel\n\t\t\t\t\tkey={section.key}\n\t\t\t\t\tsection={section}\n\t\t\t\t\tproperties={shaderDefinition.properties}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tpanelId={section.isDefault ? PanelElementId.ShaderPanel : undefined}\n\t\t\t\t/>\n\t\t\t))}\n\t\t\t{shaderDefinition.mouse && (\n\t\t\t\t<ShaderMouseSection\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\treducedEnabled={shaderMouseEnabled}\n\t\t\t\t\treducedSpringOptions={shaderMouseSpringOptions}\n\t\t\t\t\tmouse={shaderDefinition.mouse}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\nfunction SectionPanel({\n\tsection,\n\tproperties,\n\tnodeIds,\n\tpanelId,\n}: {\n\tsection: ControlPanelSection\n\tproperties: VerifiedPropertyControls\n\tnodeIds: NodeID[]\n\tpanelId?: PanelElementId\n}) {\n\tconst hasUnsetOptionals = section.unsetOptionalControls.length > 0\n\n\tconst handleAddButtonClick = React.useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tif (hasUnsetOptionals) {\n\t\t\t\tdisplayAddOptionalControlMenu(event, section.unsetOptionalControls, properties, nodeIds)\n\t\t\t}\n\t\t},\n\t\t[section.unsetOptionalControls, hasUnsetOptionals, properties, nodeIds],\n\t)\n\n\tif (section.rows.length === 0 && !hasUnsetOptionals) return null\n\n\treturn (\n\t\t<Panel\n\t\t\tid={panelId}\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={section.title}\n\t\t\t\t\tclickable={hasUnsetOptionals}\n\t\t\t\t\tonMouseDown={hasUnsetOptionals ? handleAddButtonClick : undefined}\n\t\t\t\t>\n\t\t\t\t\t{hasUnsetOptionals && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{section.rows}\n\t\t</Panel>\n\t)\n}\n\ninterface ShaderMouseSectionProps {\n\tnodeIds: NodeID[]\n\treducedEnabled: Reduced<boolean | undefined> | undefined\n\treducedSpringOptions: Reduced<SpringOptions | undefined> | undefined\n\tmouse: ShaderMouseDefault\n}\n\nfunction springOptionsToTransition(spring: SpringOptions): Transition {\n\treturn {\n\t\t...defaultDurationBasedSpringTransition,\n\t\t...spring,\n\t\tdurationBasedSpring: spring.duration !== undefined,\n\t}\n}\n\nconst hideTransitionTypeControl = emptyArray<Transition[\"type\"]>()\n\nfunction ShaderMouseSection({ nodeIds, reducedEnabled, reducedSpringOptions, mouse }: ShaderMouseSectionProps) {\n\tconst toggleEnabled = useEngineCallback(() => {\n\t\tengine.setEditReason(\"shader_property\")\n\t\tfor (const node of engine.tree.getNodes<ShaderNode>(nodeIds)) {\n\t\t\tconst current = node.shaderMouseEnabled ?? mouse === \"enabledByDefault\"\n\t\t\tnode.set({ shaderMouseEnabled: !current })\n\t\t}\n\t}, [nodeIds, mouse])\n\n\tconst handleTransitionChange = useEngineCallback(\n\t\t(value: Transition) => {\n\t\t\tengine.setEditReason(\"shader_property\")\n\t\t\tfor (const node of engine.tree.getNodes<ShaderNode>(nodeIds)) {\n\t\t\t\tnode.set({ shaderMouseSpringOptions: getPhysicsBasedSpringOptions(value) })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleTransitionDelete = useEngineCallback(() => {\n\t\tengine.setEditReason(\"shader_property\")\n\t\tfor (const node of engine.tree.getNodes<ShaderNode>(nodeIds)) {\n\t\t\tnode.set({ shaderMouseSpringOptions: undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst hasInstanceEnabled = !isNotFound(reducedEnabled) && reducedEnabled !== undefined\n\tconst enabled = hasInstanceEnabled ? reducedEnabled : mouse === \"enabledByDefault\"\n\tconst anyEnabled = isMixed(enabled) || enabled === true\n\n\tlet transition: Transition | typeof Mixed | undefined\n\tif (isMixed(reducedSpringOptions)) {\n\t\ttransition = Mixed\n\t} else if (!isNotFound(reducedSpringOptions) && reducedSpringOptions !== undefined) {\n\t\ttransition = springOptionsToTransition(reducedSpringOptions)\n\t}\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader title={Dictionary.Mouse} clickable onClick={toggleEnabled}>\n\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t{anyEnabled ? <IconSectionHeaderMinus /> : <IconSectionHeaderPlus />}\n\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{anyEnabled && (\n\t\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t\t{transition !== undefined ? (\n\t\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\t\tonChange={handleTransitionChange}\n\t\t\t\t\t\t\tonDelete={handleTransitionDelete}\n\t\t\t\t\t\t\tshowType={hideTransitionTypeControl}\n\t\t\t\t\t\t\tshowDelay={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\t\ttype=\"spring\"\n\t\t\t\t\t\t\tonClick={() => handleTransitionChange(fallbackPhysicsBasedSpringTransition)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Panel>\n\t)\n}\n", "import \"ShapeBooleanPanel.styles_1xu0bke.wyw.css\"; export const shapeBooleanPanel = \"shapeBooleanPanel_s1139n49\";\nexport const button = \"button_bnwjfv0\";\nexport const buttonEnabled = \"buttonEnabled_b1r1u47x\";\nexport const buttonActive = \"buttonActive_b1hx965w\";", "export function IconBooleanExclude() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 0 1 C 0 0.448 0.448 0 1 0 L 9 0 C 9.552 0 10 0.448 10 1 L 10 4 L 13 4 C 13.552 4 14 4.448 14 5 L 14 13 C 14 13.552 13.552 14 13 14 L 5 14 C 4.448 14 4 13.552 4 13 L 4 10 L 1 10 C 0.448 10 0 9.552 0 9 Z M 4 9 C 4 9.552 4.448 10 5 10 L 9 10 C 9.552 10 10 9.552 10 9 L 10 5 C 10 4.448 9.552 4 9 4 L 5 4 C 4.448 4 4 4.448 4 5 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 4 5 C 4 4.448 4.448 4 5 4 L 9 4 C 9.552 4 10 4.448 10 5 L 10 9 C 10 9.552 9.552 10 9 10 L 5 10 C 4.448 10 4 9.552 4 9 Z\"\n\t\t\t\topacity={0.5}\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconBooleanIntersect() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 0 1 C 0 0.448 0.448 0 1 0 L 9 0 C 9.552 0 10 0.448 10 1 L 10 4 L 13 4 C 13.552 4 14 4.448 14 5 L 14 13 C 14 13.552 13.552 14 13 14 L 5 14 C 4.448 14 4 13.552 4 13 L 4 10 L 1 10 C 0.448 10 0 9.552 0 9 Z M 4 9 C 4 9.552 4.448 10 5 10 L 9 10 C 9.552 10 10 9.552 10 9 L 10 5 C 10 4.448 9.552 4 9 4 L 5 4 C 4.448 4 4 4.448 4 5 Z\"\n\t\t\t\topacity={0.5}\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 4 5 C 4 4.448 4.448 4 5 4 L 9 4 C 9.552 4 10 4.448 10 5 L 10 9 C 10 9.552 9.552 10 9 10 L 5 10 C 4.448 10 4 9.552 4 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconBooleanJoin() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 13 4 C 13.552 4 14 4.448 14 5 L 14 13 C 14 13.552 13.552 14 13 14 L 5 14 C 4.448 14 4 13.552 4 13 L 4 11 L 9 11 C 10.105 11 11 10.105 11 9 L 11 4 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 0 1 C 0 0.448 0.448 0 1 0 L 9 0 C 9.552 0 10 0.448 10 1 L 10 3 L 5 3 C 3.895 3 3 3.895 3 5 L 3 10 L 1 10 C 0.448 10 0 9.552 0 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t\t<path d=\"M 4 5 C 4 4.448 4.448 4 5 4 L 10 4 L 10 9 C 10 9.552 9.552 10 9 10 L 4 10 Z\" fill=\"currentColor\"></path>\n\t\t</svg>\n\t)\n}\n", "export function IconBooleanSubtract() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<g>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 4 5 C 4 4.448 4.448 4 5 4 L 13 4 C 13.552 4 14 4.448 14 5 L 14 13 C 14 13.552 13.552 14 13 14 L 5 14 C 4.448 14 4 13.552 4 13 Z\"\n\t\t\t\t\topacity={0.5}\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t></path>\n\t\t\t\t<path\n\t\t\t\t\td=\"M 0 1 C 0 0.448 0.448 0 1 0 L 9 0 C 9.552 0 10 0.448 10 1 L 10 4 L 5 4 C 4.448 4 4 4.448 4 5 L 4 10 L 1 10 C 0.448 10 0 9.552 0 9 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t></path>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "export function IconBooleanUnite() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\">\n\t\t\t<path\n\t\t\t\td=\"M 0 1 C 0 0.448 0.448 0 1 0 L 9 0 C 9.552 0 10 0.448 10 1 L 10 4 L 13 4 C 13.552 4 14 4.448 14 5 L 14 13 C 14 13.552 13.552 14 13 14 L 5 14 C 4.448 14 4 13.552 4 13 L 4 10 L 1 10 C 0.448 10 0 9.552 0 9 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "import { cx } from \"@linaria/core\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport { getActionAccelerator } from \"app/AppAccelerators.ts\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport {\n\tperformShapeBooleanAction,\n\tshapeBooleanActionsEnabled,\n} from \"document/components/utils/performShapeBooleanAction.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { PathBooleanType, withBooleanPath } from \"document/models/CanvasTree/traits/WithPathBoolean.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { Properties } from \"document/models/CanvasTree/traits/utils/reduceProperties.ts\"\nimport { getAcceleratorTokens } from \"web/pages/project/lib/getAcceleratorLabel.ts\"\nimport * as classNames from \"./ShapeBooleanPanel.styles.ts\"\nimport { IconBooleanExclude } from \"./icons/IconBooleanExclude.tsx\"\nimport { IconBooleanIntersect } from \"./icons/IconBooleanIntersect.tsx\"\nimport { IconBooleanJoin } from \"./icons/IconBooleanJoin.tsx\"\nimport { IconBooleanSubtract } from \"./icons/IconBooleanSubtract.tsx\"\nimport { IconBooleanUnite } from \"./icons/IconBooleanUnite.tsx\"\n\nfunction getTooltip(actionType: AppAction) {\n\tconst actionLabel = actionLabels[actionType]\n\tif (!actionLabel) return \"\"\n\tconst actionAccelerator = getActionAccelerator(actionType)\n\tif (!actionAccelerator) return actionLabel\n\n\treturn actionLabel + \" \" + getAcceleratorTokens(actionAccelerator).join(\"\")\n}\n\nconst BOOLEAN_ACTIONS = [\n\t{\n\t\ttype: PathBooleanType.Unite,\n\t\ttitle: getTooltip(\"unite\"),\n\t\ticon: <IconBooleanUnite />,\n\t},\n\t{\n\t\ttype: PathBooleanType.Subtract,\n\t\ttitle: getTooltip(\"subtract\"),\n\t\ticon: <IconBooleanSubtract />,\n\t},\n\t{\n\t\ttype: PathBooleanType.Intersect,\n\t\ttitle: getTooltip(\"intersect\"),\n\t\ticon: <IconBooleanIntersect />,\n\t},\n\t{\n\t\ttype: PathBooleanType.Exclude,\n\t\ttitle: getTooltip(\"exclude\"),\n\t\ticon: <IconBooleanExclude />,\n\t},\n\t{\n\t\ttype: PathBooleanType.Join,\n\t\ttitle: getTooltip(\"join\"),\n\t\ticon: <IconBooleanJoin />,\n\t},\n]\n\ninterface Props {\n\tnodes: CanvasNode[]\n\tproperties: Properties\n\tenabled: boolean\n}\n\nexport const ShapeBooleanPanel = (props: Props) => {\n\tconst { properties, nodes, enabled } = props\n\n\tif (!properties.onlyShapeNodes) return null\n\n\tfunction getNodesWithoutDescendants() {\n\t\treturn engine.tree.getNodes(properties.withoutDescendantIds)\n\t}\n\n\tfunction performAction(type: PathBooleanType) {\n\t\tperformShapeBooleanAction(nodes, getNodesWithoutDescendants(), type)\n\t}\n\n\tconst actionsEnabled = shapeBooleanActionsEnabled(getNodesWithoutDescendants()) && enabled\n\n\tconst node = nodes[0]\n\tconst isSingleBooleanNode =\n\t\tnodes.length === 1 && node && withBooleanPath(node) && !isReplicaOrReplicaChild(node) && enabled\n\n\treturn (\n\t\t<div className={classNames.shapeBooleanPanel}>\n\t\t\t{BOOLEAN_ACTIONS.map(({ type, title, icon }) => {\n\t\t\t\tconst isActive = isSingleBooleanNode ? node.pathBoolean === type : actionsEnabled\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey={type}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tclassNames.button,\n\t\t\t\t\t\t\tactionsEnabled && classNames.buttonEnabled,\n\t\t\t\t\t\t\tisActive && classNames.buttonActive,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={actionsEnabled ? () => performAction(type) : undefined}\n\t\t\t\t\t\ttitle={title}\n\t\t\t\t\t>\n\t\t\t\t\t\t{icon}\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t})}\n\t\t</div>\n\t)\n}\n", "import \"DimensionInput.styles_1u9pxxq.wyw.css\"; export const popupButtonWrapperSites = \"popupButtonWrapperSites_p1sfsmo2\";\nexport const autoSizeValue = \"autoSizeValue_a1dk23pi\";", "import { NumberInputWithTicker, PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Mixed, assertNever, isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { NotFound, isFoundAndNotMixed } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { CanSetSizeProps } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport { DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport * as styles from \"./DimensionInput.styles.ts\"\nimport { DimensionTitle } from \"./DimensionTitle.ts\"\n\ntype ValueType = number | string | Mixed | undefined\n\ninterface Props {\n\tdimension: \"width\" | \"height\"\n\tdimensionTypes: Set<DimensionType>\n\tvalue: ValueType\n\tonChangeNumber: (value: number, rawValue: string | undefined, reset: () => void) => void\n\tonChangeDimension: (dimensionType: DimensionType) => void\n\tcanSetProps: CanSetSizeProps\n\tvalidRawValues: Set<string>\n}\n\nexport function DimensionInput({\n\tdimension,\n\tdimensionTypes,\n\tvalue,\n\tonChangeNumber,\n\tonChangeDimension,\n\tcanSetProps,\n\tvalidRawValues,\n}: Props) {\n\tconst commonDimensionType = commonValue(dimensionTypes)\n\tconst isAutoSizing = isFoundAndNotMixed(commonDimensionType) && isAutoDimensionType(commonDimensionType)\n\tconst isFraction = commonDimensionType === DimensionType.FractionOfFreeSpace\n\n\treturn (\n\t\t<>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tvalue={isAutoSizing && !isNumber(value) ? \"Auto\" : value}\n\t\t\t\tplaceholder={isAutoSizing && !isMixed(value) ? `${value}` : undefined}\n\t\t\t\tonChange={onChangeNumber}\n\t\t\t\tmin={0}\n\t\t\t\tstep={isFraction ? getFractionSizeIncrement(value) : \"nudge\"}\n\t\t\t\tclassName={cx(isAutoSizing && styles.autoSizeValue)}\n\t\t\t\tdata-testid={`sizepanel-${dimension}-input`}\n\t\t\t\tdefaultValue={isAutoSizing && isNumber(value) ? value : undefined}\n\t\t\t\tvalidRawValues={validRawValues}\n\t\t\t\tdisplayTicker={!isAutoSizing}\n\t\t\t/>\n\t\t\t<PopupButtonDisplayTitle displayTitle={shortTitle(dimensionTypes)}>\n\t\t\t\t<PopupButton wrapperClassName={styles.popupButtonWrapperSites} data-testid={`sizepanel-${dimension}-dropdown`}>\n\t\t\t\t\t{allDimensionTypes.map(dimensionType => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={dimensionType}\n\t\t\t\t\t\t\tidentifier={dimensionType}\n\t\t\t\t\t\t\ttitle={dimensionTitle(dimensionType)}\n\t\t\t\t\t\t\tvisible={dimensionTypeVisible(dimensionType, dimension, canSetProps)}\n\t\t\t\t\t\t\tenabled={dimensionTypeEnabled(dimensionType, dimension, canSetProps)}\n\t\t\t\t\t\t\tselected={dimensionTypes.has(dimensionType)}\n\t\t\t\t\t\t\tonSelect={onChangeDimension}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</PopupButtonDisplayTitle>\n\t\t</>\n\t)\n}\n\nexport function dimensionTypeEnabled(type: DimensionType, dimension: \"width\" | \"height\", options: CanSetSizeProps) {\n\tswitch (type) {\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToFixed : options.canSetHeightToFixed\n\t\tcase DimensionType.Percentage:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToPercentage : options.canSetHeightToPercentage\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToFillParent : options.canSetHeightToFillParent\n\t\tcase DimensionType.Auto:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToAuto : options.canSetHeightToAuto\n\t\tcase DimensionType.Viewport:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToViewport : options.canSetHeightToViewport\n\t\tcase DimensionType.FitImage:\n\t\t\treturn dimension === \"width\" ? options.canSetWidthToFitImage : options.canSetHeightToFitImage\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction dimensionTypeVisible(type: DimensionType, dimension: \"width\" | \"height\", canSetProps: CanSetSizeProps) {\n\tif (type === DimensionType.FitImage) {\n\t\treturn dimension === \"width\" ? canSetProps.canSetWidthToFitImage : canSetProps.canSetHeightToFitImage\n\t}\n\n\tif (type !== DimensionType.Viewport) return true\n\t// vw is less useful, hide it from the UI for now\n\treturn dimension === \"height\"\n}\n\nconst allDimensionTypes: DimensionType[] = [\n\tDimensionType.FixedNumber,\n\tDimensionType.Percentage,\n\tDimensionType.FractionOfFreeSpace,\n\tDimensionType.Auto,\n\tDimensionType.FitImage,\n\tDimensionType.Viewport,\n]\n\nfunction shortTitle(dimensions: Set<DimensionType>): string {\n\tconst commonDimension = commonValue(dimensions)\n\tswitch (commonDimension) {\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn \"Fixed\"\n\t\tcase DimensionType.Percentage:\n\t\t\treturn \"Rel\"\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\treturn \"Fill\"\n\t\tcase DimensionType.Auto:\n\t\t\treturn \"Fit\"\n\t\tcase DimensionType.Viewport:\n\t\t\treturn \"View\"\n\t\tcase DimensionType.FitImage:\n\t\t\treturn \"Auto\"\n\t\tcase Mixed:\n\t\tcase NotFound:\n\t\t\treturn Dictionary.Mixed\n\t\tdefault:\n\t\t\tassertNever(commonDimension, \"All resolved dimension types should be handled\")\n\t}\n}\n\nfunction dimensionTitle(type: DimensionType): DimensionTitle {\n\tswitch (type) {\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn DimensionTitle.FixedNumber\n\t\tcase DimensionType.Percentage:\n\t\t\treturn DimensionTitle.Percentage\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\treturn DimensionTitle.FractionOfFreeSpace\n\t\tcase DimensionType.Auto:\n\t\t\treturn DimensionTitle.Auto\n\t\tcase DimensionType.Viewport:\n\t\t\treturn DimensionTitle.Viewport\n\t\tcase DimensionType.FitImage:\n\t\t\treturn DimensionTitle.FitImage\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction getFractionSizeIncrement(value: ValueType): \"nudge\" | number {\n\tconst numValue = isString(value) ? parseFloat(value) : value\n\tif (!isNumber(numValue)) return \"nudge\"\n\treturn Number.isInteger(numValue) ? \"nudge\" : 0.1\n}\n", "import type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode, isTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type { Rect } from \"library/render/types/Rect.ts\"\n\n/**\n * Expands the width of a rect by a pixel if it's an auto-sized text node that's\n * about to be converted to fixed size.\n *\n * When a node uses a DOM rect, the size measured when it was\n * auto-sized is the actual painted size, which could be a tiny bit\n * smaller than the computed (layout) size of the text, so if we\n * were to use it in a size update, there's a chance that the text\n * would re-wrap. To avoid this, we do what styledText.calculateSize\n * does when we use Draft for size calculations, which is add 1.\n *\n * @param node\n * @param tree\n * @returns Rect\n */\n\nexport function adjustedRectForConversionToFixedSize(node: CanvasNode, tree: CanvasTree): Rect {\n\tconst rect = tree.getRect(node)\n\tif (!isTextNode(node) && !isRichTextNode(node)) return rect\n\tif (!node.usesDOMRectCached() || node.widthType !== DimensionType.Auto) return rect\n\n\trect.width += 1\n\treturn rect\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport { isGridComponent } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { adjustedRectForConversionToFixedSize } from \"./adjustedRectForConversionToFixedSize.ts\"\n\n/**\n * Converts collapsible children of the given grid nodes to fixed height.\n */\nexport function convertCollapsibleGridChildrenToFixedSize(gridIds: NodeID[]): boolean {\n\tlet didConvert = false\n\n\tfor (const id of gridIds) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isGridComponent(node)) continue\n\n\t\tfor (const child of node.children) {\n\t\t\tif (!isPinnable(child) || !withGridItemSize(child)) continue\n\t\t\tif (!couldCollapse(child)) continue\n\n\t\t\tconst rect = adjustedRectForConversionToFixedSize(child, engine.tree)\n\t\t\tchild.set({ heightType: DimensionType.FixedNumber, height: rect.height, gridItemFillCellHeight: false })\n\t\t\tdidConvert = true\n\t\t}\n\t}\n\n\tif (didConvert) showGridChildrenSetToFixedToast()\n\n\treturn didConvert\n}\n\nfunction showGridChildrenSetToFixedToast() {\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"info\",\n\t\tkey: \"setting-auto-height-fixed-grid-children\",\n\t\tprimaryText: \"Grid items set to fixed height\",\n\t\tsecondaryText: \"to prevent collapse.\",\n\t\ticon: \"thumbnail\",\n\t\tduration: 5000,\n\t\tshowCloseButton: \"always\",\n\t})\n}\n", "import {\n\tcreateAssetReferenceForImage,\n\tcreateAssetReferenceFromParseResult,\n\tparseAssetReference,\n} from \"@framerjs/assets\"\nimport { Mixed, assertNever } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { dimensionTypeEnabled } from \"document/components/chrome/properties/inputs/DimensionInput.tsx\"\nimport { trackDimensionTypeChange } from \"document/components/chrome/properties/panels/utils/trackDimensionTypeChange.ts\"\nimport { regenerateModulesForFitImage } from \"document/components/chrome/properties/utils/regenerateModulesForFitImage.ts\"\nimport {\n\tconvertChildrenToFixedSizeAlongDimension,\n\tdistributionSupportsGap,\n\tenableStackLayoutForNode,\n} from \"document/components/tools/utils/stackCreateHelper.ts\"\nimport { updateNodeSizeForEach } from \"document/components/utils/dimensions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID, ShapeContainerNode, VectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ReadonlyChildren } from \"document/models/CanvasTree/nodes/MutableNode.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport {\n\tisGridComponent,\n\tisShapeContainerNode,\n\tisStackComponent,\n\tisTextNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type WithAspectRatio, withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { type WithFill, withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { withFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithFramePreset } from \"document/models/CanvasTree/traits/WithFramePreset.ts\"\nimport { withFramePreset } from \"document/models/CanvasTree/traits/WithFramePreset.ts\"\nimport type { WithGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport type { WithLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { WithConstraints, WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { constrainHeight, constrainWidth } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport type { WithSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { autoAxisForAspectRatio } from \"document/models/CanvasTree/traits/collectStyles/collectAspectRatio.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isAutoSizedOnAnyDimension } from \"document/models/CanvasTree/traits/utils/autoSizeHelpers.ts\"\nimport {\n\thasLockedAspectRatio,\n\trelativeAxisRequiresFixedOpposingAxis,\n} from \"document/models/CanvasTree/traits/utils/layoutSupportsAspectRatio.ts\"\nimport { isPositionFixed, isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { CanSetSizeProps } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport { getSizeMinusPadding } from \"document/models/CanvasTree/traits/utils/sizeMinusPadding.ts\"\nimport { supportsViewportSizing } from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport type { PinPosition } from \"document/models/ConstraintSolver.ts\"\nimport type { Rect } from \"library/index.ts\"\nimport { DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNull, isNumber, isString } from \"utils/typeChecks.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { adjustedRectForConversionToFixedSize } from \"./adjustedRectForConversionToFixedSize.ts\"\nimport { convertCollapsibleGridChildrenToFixedSize } from \"./convertCollapsibleGridChildrenToFixedSize.ts\"\n\ntype Dimension = keyof WithSize\n\nconst dimensionToDimensionTypeKeyMap: Record<Dimension, keyof WithSizeDimensionType> = {\n\twidth: \"widthType\",\n\theight: \"heightType\",\n}\n\nexport function changeWidthDimension(\n\twithoutDescendantIds: NodeID[],\n\tdimensionType: DimensionType,\n\tcanSetProps: CanSetSizeProps,\n) {\n\tchangeDimensionType({ withoutDescendantIds, dimension: \"width\", dimensionType, canSetProps })\n}\n\nexport function changeHeightDimension(\n\twithoutDescendantIds: NodeID[],\n\tdimensionType: DimensionType,\n\tcanSetProps: CanSetSizeProps,\n) {\n\tchangeDimensionType({ withoutDescendantIds, dimension: \"height\", dimensionType, canSetProps })\n}\n\nexport function changeWidth(\n\twithoutDescendantIds: NodeID[],\n\twidth: Reduced<string | number>,\n\twidthTypes: Set<DimensionType>,\n\tvalue: number,\n\trawValue: string,\n\treset: () => void,\n\tcanSetProps: CanSetSizeProps,\n\tonChangeWidthDimension: (dimensionType: DimensionType) => void,\n) {\n\tchangeSize({\n\t\twithoutDescendantIds,\n\t\tdimension: \"width\",\n\t\tcurrentValue: width,\n\t\tcurrentDimensionTypes: widthTypes,\n\t\tvalue,\n\t\trawValue,\n\t\treset,\n\t\tcanSetProps,\n\t\tonChangeDimensionType: onChangeWidthDimension,\n\t})\n}\n\nexport function changeHeight(\n\twithoutDescendantIds: NodeID[],\n\theight: Reduced<string | number>,\n\theightTypes: Set<DimensionType>,\n\tvalue: number,\n\trawValue: string,\n\treset: () => void,\n\tcanSetProps: CanSetSizeProps,\n\tonChangeHeightDimension: (dimensionType: DimensionType) => void,\n) {\n\tchangeSize({\n\t\twithoutDescendantIds,\n\t\tdimension: \"height\",\n\t\tcurrentValue: height,\n\t\tcurrentDimensionTypes: heightTypes,\n\t\tvalue,\n\t\trawValue,\n\t\treset,\n\t\tcanSetProps,\n\t\tonChangeDimensionType: onChangeHeightDimension,\n\t})\n}\n\nfunction dimensionTypeKeyForDimension(dimension: Dimension) {\n\treturn dimensionToDimensionTypeKeyMap[dimension]\n}\n\nconst dimensionToOpposingDimensionMap: Record<Dimension, Dimension> = {\n\twidth: \"height\",\n\theight: \"width\",\n}\n\nfunction opposingDimensionForDimension(dimension: Dimension) {\n\treturn dimensionToOpposingDimensionMap[dimension]\n}\n\nconst dimensionToGridItemFillCellKeyMap: Record<Dimension, keyof WithGridItemSize> = {\n\twidth: \"gridItemFillCellWidth\",\n\theight: \"gridItemFillCellHeight\",\n}\n\nfunction gridItemFillCellKeyForDimension(dimension: Dimension): keyof WithGridItemSize {\n\treturn dimensionToGridItemFillCellKeyMap[dimension]\n}\n\nfunction splitShapes(withoutDescendants: CanvasNode[]) {\n\tconst shapes: (VectorNode | ShapeContainerNode)[] = []\n\tconst nodes: CanvasNode[] = []\n\n\tfor (let i = 0, il = withoutDescendants.length; i < il; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: loop\n\t\tconst node = withoutDescendants[i]!\n\t\tif (isVectorNode(node) || isShapeContainerNode(node)) {\n\t\t\tshapes.push(node)\n\t\t} else {\n\t\t\tnodes.push(node)\n\t\t}\n\t}\n\treturn { shapes, nodes }\n}\n\nfunction valueToDimensionType(value: string) {\n\tconst trimmedValue = value.trim().toLowerCase()\n\tif (trimmedValue === \"auto\") return DimensionType.Auto\n\tif (trimmedValue.endsWith(\"fr\")) return DimensionType.FractionOfFreeSpace\n\tif (trimmedValue.endsWith(\"%\")) return DimensionType.Percentage\n\tif (trimmedValue.endsWith(\"px\") || trimmedValue.endsWith(\"pt\")) return DimensionType.FixedNumber\n\tif (trimmedValue.endsWith(\"vw\") || trimmedValue.endsWith(\"vh\")) return DimensionType.Viewport\n\treturn null\n}\n\n// When entering a number we want to keep the existing dimension type, but only if that dimension type is a unit of a number\nfunction getCommonDimensionType(dimensionTypes: Set<DimensionType>): Reduced<DimensionType> {\n\tconst commonDimensionType = commonValue(dimensionTypes)\n\tswitch (commonDimensionType) {\n\t\tcase DimensionType.FixedNumber:\n\t\tcase DimensionType.Percentage:\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\tcase DimensionType.Viewport:\n\t\t\treturn commonDimensionType\n\t\tcase DimensionType.Auto:\n\t\tcase DimensionType.FitImage:\n\t\tcase Mixed:\n\t\tcase NotFound:\n\t\t\treturn Mixed\n\t\tdefault:\n\t\t\tassertNever(commonDimensionType)\n\t}\n}\n\nfunction resolveSizeConflictsInAutoSizedNodes(ids: Set<NodeID>) {\n\t// This set will keep track of stacks that did change in response to\n\t// conflict resolution\n\tconst autoSizedNodesWithResolvedConflicts = new Set<NodeID>([])\n\n\tfor (const id of ids) {\n\t\tconst node = engine.tree.getNode(id)\n\t\tif (resolveConflictInAutoSizedNode(node, \"width\")) {\n\t\t\tautoSizedNodesWithResolvedConflicts.add(id)\n\t\t}\n\t\tif (resolveConflictInAutoSizedNode(node, \"height\")) {\n\t\t\tautoSizedNodesWithResolvedConflicts.add(id)\n\t\t}\n\t}\n\n\treturn autoSizedNodesWithResolvedConflicts\n}\n\nfunction resolveConflictInAutoSizedNode(\n\tnode: (Readonly<CanvasNode> & ReadonlyChildren) | null,\n\tdimension: Dimension,\n): boolean {\n\tconst dimensionType = dimensionTypeKeyForDimension(dimension)\n\t// If the node isn't a stack, or it's empty, continue\n\tif (!node || !isPinnable(node) || !withLayout(node)) return false\n\tif (!node.children || node.children.length === 0) return false\n\n\t// We only need conflict resolution on auto-sized node\n\tif (!isAutoSizedOnAnyDimension(node)) return false\n\n\tif (node[dimensionType] !== DimensionType.Auto) return false\n\n\t// Handle grids conflicts when changing the height type. This can be done for widthType as\n\t// well, once couldCollapse handles width collapse.\n\tif (experiments.isOn(\"gridCollapseMacros\") && isGridComponent(node) && dimensionType === \"heightType\") {\n\t\tif (!couldCollapse(node)) return false\n\n\t\t// If node would collapse, convert to fixed using the current measured size to prevent collapse\n\t\tconst rect = engine.tree.getRect(node)\n\t\tconst update: Partial<WithPins> = {\n\t\t\t[dimensionType]: DimensionType.FixedNumber,\n\t\t\t[dimension]: rect[dimension],\n\t\t}\n\t\tnode.set(update)\n\t\treturn true\n\t}\n\n\tlet needsConversionToFixed = false\n\n\tconst isMainAxis =\n\t\t(dimensionType === \"widthType\" && (isDynamicValue(node.stackDirection) || node.stackDirection === \"horizontal\")) ||\n\t\t(dimensionType === \"heightType\" && (isDynamicValue(node.stackDirection) || node.stackDirection === \"vertical\"))\n\n\tif (isMainAxis) {\n\t\t// Resolve conflicts along the main axis\n\n\t\t// Any child that needs to be fraction or relative-size along\n\t\t// this axis will force the stack to convert to Fixed, otherwise\n\t\t// the child itself will collapse\n\t\tconst hasSomeFractionOrRelativeChildren = node.children.some(child => {\n\t\t\tconst latest = child.draftOrCurrent()\n\t\t\tif (!isPinnable(latest)) return false\n\t\t\t// Ignore invisible children as they don't have an impact on the size of the parent\n\t\t\tif (!latest.isVisible()) return false\n\t\t\t// Non-relative stack children only cause the stack to collapse if\n\t\t\t// they are the only child. If they are the only child, we will\n\t\t\t// render the stack with min sizes to prevent collapsing.\n\t\t\tif (!isPositionRelative(child, node)) return false\n\n\t\t\tconst childDimensionType = latest[dimensionType]\n\t\t\treturn childDimensionType === DimensionType.FractionOfFreeSpace || childDimensionType === DimensionType.Percentage\n\t\t})\n\n\t\tneedsConversionToFixed = hasSomeFractionOrRelativeChildren\n\t} else {\n\t\t// Resolve conflicts along the cross axis\n\n\t\t// If we have at least one non-fractional child we can be sure that the\n\t\t// stack will not collapse if the other children are fractional\n\t\tconst hasSomeNonFractionChildren = node.children.some(child => {\n\t\t\tconst latest = child.draftOrCurrent()\n\t\t\treturn isPinnable(latest) && latest[dimensionType] !== DimensionType.FractionOfFreeSpace\n\t\t})\n\n\t\t// But we'll still need conversion to fixed if one of the\n\t\t// children is relative-sized\n\t\tconst hasSomeRelativeChildren = node.children.some(child => {\n\t\t\tconst latest = child.draftOrCurrent()\n\t\t\t// Non-relative stack children only cause the stack to collapse if\n\t\t\t// they are the only child. If they are the only child, we will\n\t\t\t// render the stack with min sizes to prevent collapsing.\n\t\t\tif (!isPositionRelative(child, node)) return false\n\t\t\treturn isPinnable(latest) && latest[dimensionType] === DimensionType.Percentage\n\t\t})\n\n\t\tneedsConversionToFixed = !hasSomeNonFractionChildren || hasSomeRelativeChildren\n\t}\n\n\tif (!needsConversionToFixed) return false\n\n\t// To prevent the stack or its children from collapsing we'll take\n\t// the latest calculated size along the auto axis and convert it to Fixed\n\tconst rect = engine.tree.getRect(node)\n\tconst update: Partial<WithPins> = {\n\t\t[dimensionType]: DimensionType.FixedNumber,\n\t\t[dimension]: rect[dimension],\n\t}\n\n\tnode.set(update)\n\treturn true\n}\n\nfunction dimensionTypeFromRawValue(\n\trawValue: string,\n\tcurrentDimensionType: DimensionType,\n\tcurrentValue: number,\n): DimensionType | null {\n\tif (!rawValue) return null\n\tconst rawDimensionType = valueToDimensionType(rawValue)\n\tif (rawDimensionType !== null) {\n\t\treturn rawDimensionType\n\t} else if (currentDimensionType === DimensionType.FractionOfFreeSpace && currentValue > 50) {\n\t\t// Don't allow setting a fraction greater than 50 (as its probably\n\t\t// unlikely), and instead coerce to pixels, which is more likely the\n\t\t// user intention.\n\t\treturn DimensionType.FixedNumber\n\t}\n\n\treturn null\n}\n\nfunction allNodesAreFullSizeGridCells(nodes: CanvasNode[], dimension: Dimension) {\n\treturn nodes.every(node => {\n\t\tif (node.cache.parentDirected !== \"grid\") return false\n\t\tif (!withGridItemSize(node)) return false\n\t\treturn (\n\t\t\tnode[gridItemFillCellKeyForDimension(dimension)] &&\n\t\t\t(dimension === \"height\"\n\t\t\t\t? experiments.isOn(\"gridBentoFit\") || node.cache.parentDirectedRowHeightType !== \"fit\"\n\t\t\t\t: true)\n\t\t)\n\t})\n}\n\nfunction inferNewDimensionType({\n\twithoutDescendants,\n\tcurrentValue,\n\tcurrentDimensionTypes,\n\tvalue,\n\trawValue,\n\tdimension,\n}: {\n\twithoutDescendants: CanvasNode[]\n\tcurrentValue: Reduced<string | number>\n\tcurrentDimensionTypes: Set<DimensionType>\n\tvalue: number\n\trawValue: string\n\tdimension: Dimension\n}): DimensionType {\n\tlet dimensionType = DimensionType.FixedNumber\n\n\t// Infer the current dimension type from the current value. For example, when you have multiple selection, and you\n\t// are changing the value from '100%' (current is percentage) to `200`, we try to keep the percentage and update\n\t// the nodes to 200%.\n\tif (isString(currentValue)) {\n\t\tconst dimensionTypeFromCurrentValue = valueToDimensionType(currentValue)\n\t\tconst allFullSizeGridCells = allNodesAreFullSizeGridCells(withoutDescendants, dimension)\n\t\tif (allFullSizeGridCells) {\n\t\t\tdimensionType = DimensionType.FixedNumber\n\t\t} else if (dimensionTypeFromCurrentValue !== null) {\n\t\t\tdimensionType = dimensionTypeFromCurrentValue\n\t\t} else {\n\t\t\tconst commonDimensionType = getCommonDimensionType(currentDimensionTypes)\n\t\t\tif (isNumber(commonDimensionType)) dimensionType = commonDimensionType\n\t\t}\n\t}\n\n\t// If the input value indicates a dimension type (e.g. 1fr), that dimension type should take precedence,\n\tconst dimensionTypeFromNewValue = dimensionTypeFromRawValue(rawValue, dimensionType, value)\n\tconst isViewportWidth = dimensionTypeFromNewValue === DimensionType.Viewport && dimension === \"width\"\n\tif (!isNull(dimensionTypeFromNewValue) && !isViewportWidth) {\n\t\treturn dimensionTypeFromNewValue\n\t}\n\n\treturn dimensionType\n}\n\nfunction updateSizeToPercentage(\n\tnodes: CanvasNode[],\n\tdimension: Dimension,\n\tvalue: number,\n\tlayoutParentWithPotentialSizeConflicts: Set<NodeID>,\n) {\n\tnodes.forEach(node => {\n\t\tif (!isPinnable(node)) return\n\t\tconst nodeUpdate = getUpdatesForPercentageSize(node, dimension, value)\n\t\tif (!nodeUpdate) return\n\t\tnode.set(nodeUpdate)\n\n\t\tif (node.cache.parentDirected && node.parentid) {\n\t\t\tlayoutParentWithPotentialSizeConflicts.add(node.parentid)\n\t\t}\n\n\t\ttrackDimensionTypeChange(node, nodeUpdate, \"auto_size_panel\")\n\t})\n}\n\nfunction getUpdatesForPercentageSize(\n\tnode: CanvasNode,\n\tdimension: Dimension,\n\tvalue: number,\n): Partial<WithPins & WithGridItemSize> | undefined {\n\tif (!isPinnable(node)) return\n\n\tconst parent = engine.tree.getParent(node.id)\n\tif (!parent) return\n\n\tconst sizeFactor = value / 100\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.Percentage,\n\t\t[dimension]: sizeFactor,\n\t}\n\n\tif (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\t// Percentage nodes can't be pinned to both sides\n\tconst startPin: PinPosition = dimension === \"width\" ? \"left\" : \"top\"\n\tconst endPin: PinPosition = dimension === \"width\" ? \"right\" : \"bottom\"\n\tif (isNumber(node[startPin]) && isNumber(node[endPin])) {\n\t\tnodeUpdate[endPin] = null\n\t}\n\n\t// Resolve layout conflicts\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction updateSizeToFraction(\n\tnodes: CanvasNode[],\n\tdimension: Dimension,\n\tvalue: number,\n\tlayoutParentsWithPotentialSizeConflicts: Set<NodeID>,\n) {\n\tnodes.forEach(node => {\n\t\tif (!isPinnable(node)) return\n\t\tconst nodeUpdate = getUpdatesForFractionSize(node, dimension, value)\n\t\tif (!nodeUpdate) return\n\t\tnode.set(nodeUpdate)\n\n\t\tif (node.cache.parentDirected && node.parentid) {\n\t\t\tlayoutParentsWithPotentialSizeConflicts.add(node.parentid)\n\t\t}\n\n\t\ttrackDimensionTypeChange(node, nodeUpdate, \"auto_size_panel\")\n\t})\n}\n\nfunction getUpdatesForFractionSize(\n\tnode: CanvasNode,\n\tdimension: Dimension,\n\tvalue: number,\n): Partial<WithPins & WithGridItemSize> | undefined {\n\tlet nextValue = value\n\tif (nextValue === 0) nextValue = 1\n\tconst nodeUpdate: Partial<WithPins> = {\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.FractionOfFreeSpace,\n\t\t[dimension]: nextValue,\n\t}\n\n\t// Set gridItemFillCellWidth/Height to true without updating the width/height or the dimension value, so when\n\t// fill becomes invalid (e.g. grid row height changes from fixed to auto) we could reuse the old value.\n\tif (node.cache.parentDirected === \"grid\") {\n\t\treturn { [gridItemFillCellKeyForDimension(dimension)]: true }\n\t}\n\n\tif (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction updateSizeToFixed(nodes: CanvasNode[], dimension: Dimension, value: number) {\n\tconst { nodes: nonShapeNodes, shapes } = splitShapes(nodes)\n\n\tnonShapeNodes.forEach(node => {\n\t\tif (!isPinnable(node)) return\n\t\tconst nodeUpdate = getUpdatesForFixedSize(node, dimension, value)\n\t\tif (!nodeUpdate) return\n\t\tnode.set(nodeUpdate)\n\n\t\ttrackDimensionTypeChange(node, nodeUpdate, \"auto_size_panel\")\n\t})\n\n\t// Only shapes are now updated using this function, we should make the function more explicit\n\tupdateNodeSizeForEach(engine, shapes, () => {\n\t\tconst update = { [dimension]: Math.max(value, 1) }\n\t\treturn update\n\t})\n}\n\nfunction getUpdatesForFixedSize(\n\tnode: CanvasNode,\n\tdimension: Dimension,\n\tvalue: number,\n): Partial<WithPins & WithGridItemSize & WithFloatingPosition> | undefined {\n\tconst update = { [dimension]: Math.max(value, 1) }\n\n\tif (isTextNode(node)) {\n\t\tconst textNodeUpdate: Partial<WithPins> = {\n\t\t\t[dimension]: update[dimension],\n\t\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.FixedNumber,\n\t\t}\n\n\t\tif (dimension === \"height\") {\n\t\t\tconst { width } = adjustedRectForConversionToFixedSize(node.draftOrCurrent(), engine.tree)\n\t\t\t// When updating an auto-width TextNode with an explicit\n\t\t\t// height, we will set both widthType and heightType to\n\t\t\t// DimensionType.FixedNumber, even if we can technically\n\t\t\t// set just the height, because we assume that the Fixed\n\t\t\t// width / Fixed height use case is more popular than\n\t\t\t// the Auto width / Fixed height one.\n\t\t\tif (node.widthType === DimensionType.Auto) {\n\t\t\t\ttextNodeUpdate.width = width\n\t\t\t\ttextNodeUpdate.widthType = DimensionType.FixedNumber\n\t\t\t}\n\t\t}\n\n\t\treturn textNodeUpdate\n\t}\n\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {}\n\tif (isPinnable(node)) {\n\t\t// The node needs to be updated to the correct dimension type first, so updateForSize can return the\n\t\t// correct value\n\t\tnode.set({ [dimensionTypeKeyForDimension(dimension)]: DimensionType.FixedNumber })\n\t\tif (node.cache.parentDirected === \"grid\") {\n\t\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t\t}\n\t}\n\n\tconst constrainSize = dimension === \"width\" ? constrainWidth : constrainHeight\n\tconst parentSizeInfo = engine.tree.getParentSizeInfo(node)\n\tconst sizeUpdate = node.draftOrCurrent().updateForSize(\n\t\t{\n\t\t\t// Don't provide a context to ensure that fixed sizes aren't clamped\n\t\t\t// to relative constraints that will change dynamically.\n\t\t\t[dimension]: constrainSize(node, update[dimension] ?? 0, engine.componentLoader),\n\t\t},\n\t\tparentSizeInfo,\n\t)\n\n\t// Never allow the size panel to update the offset of a floating position\n\t// node, even if `updateForSize` suggests it.\n\tconst floatingPositionUpdate = withFloatingPosition(node)\n\t\t? {\n\t\t\t\tfloatingOffsetX: node.floatingOffsetX,\n\t\t\t\tfloatingOffsetY: node.floatingOffsetY,\n\t\t\t}\n\t\t: undefined\n\n\treturn {\n\t\t...nodeUpdate,\n\t\t...sizeUpdate,\n\t\t...floatingPositionUpdate,\n\t\t...getUpdateForAspectRatio(node, dimension, node.rect(parentSizeInfo)),\n\t}\n}\n\n// When a node has aspect ratio locked, 1 dimension informs the axis size, and\n// the other dimension is derived via aspect ratio. This derived axis is\n// measured by the canvas. In the document, this derived axis will still display\n// as Fixed and show the measured number. However, the actual dimension value\n// will be the last value, so could be a fraction or a stale px value.\n//\n// When the opposing axis to the derived axis is switched to be fixed, the\n// derived axis may become the axis that informs the size of the layer. In\n// this case, its size may be stale and we must update it to the latest value\n// to ensure nothing changes.\n//\n// Realistically this only happens when width was relative, height was switched\n// to relative, then switched to fixed, since we prefer using width to inform\n// height { @see autoAxisForAspectRatio }.\nfunction getUpdateForAspectRatio(node: CanvasNode, dimension: Dimension, rect: Rect) {\n\tif (!withAspectRatio(node) || !isPinnable(node)) return\n\tif (!hasLockedAspectRatio(node)) return\n\n\t// Somehow slot property children which have their aspect ratio locked don't resize correctly\n\t// when using the size inputs unless we early return here.\n\tif (node.__unsafeIsSlotPropertyChildNode()) return\n\n\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\tconst opposingDimensionType = node[dimensionTypeKeyForDimension(opposingAxis)]\n\n\t// We only wish to set the measured value if the opposing axis is fixed, and it\n\t// is the axis that we will use for auto measurement\n\tif (opposingDimensionType === DimensionType.FixedNumber && opposingAxis === autoAxisForAspectRatio(node)) {\n\t\treturn { [opposingAxis]: rect[opposingAxis] }\n\t}\n}\n\nfunction getUpdatesForViewportSize(\n\tnode: CanvasNode,\n\tdimension: Dimension,\n\tvalue: number,\n): Partial<WithPins & WithGridItemSize> | undefined {\n\tif (!isPinnable(node)) return\n\tif (!supportsViewportSizing(engine.tree, node)) return\n\n\tconst sizeFactor = value / 100\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.Viewport,\n\t\t[dimension]: sizeFactor,\n\t}\n\n\tif (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\t// Viewport nodes can't be pinned to both sides\n\tconst startPin: PinPosition = dimension === \"width\" ? \"left\" : \"top\"\n\tconst endPin: PinPosition = dimension === \"width\" ? \"right\" : \"bottom\"\n\tif (isNumber(node[startPin]) && isNumber(node[endPin])) {\n\t\tnodeUpdate[endPin] = null\n\t}\n\n\t// Resolve layout conflicts\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction updateSizeToViewport(nodes: CanvasNode[], dimension: Dimension, value: number) {\n\tnodes.forEach(node => {\n\t\tif (!isPinnable(node)) return\n\t\tconst nodeUpdate = getUpdatesForViewportSize(node, dimension, value)\n\t\tif (!nodeUpdate) return\n\t\tnode.set(nodeUpdate)\n\n\t\ttrackDimensionTypeChange(node, nodeUpdate, \"auto_size_panel\")\n\t})\n}\n\nfunction showParentDimensionChangeToast(parentsWithConflicts: Set<NodeID>, dimension: Dimension) {\n\tif (parentsWithConflicts.size > 0) {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"info\",\n\t\t\tkey: \"setting-dimension-causes-parent-change\",\n\t\t\tprimaryText: `Set parent ${dimension}`,\n\t\t\tsecondaryText: \"to fixed to avoid a collapse.\",\n\t\t\ticon: \"thumbnail\",\n\t\t\tduration: 5000,\n\t\t\tshowCloseButton: \"always\",\n\t\t})\n\t}\n}\n\nfunction changeSize({\n\twithoutDescendantIds,\n\tdimension,\n\tcurrentValue,\n\tcurrentDimensionTypes,\n\tvalue,\n\trawValue,\n\treset,\n\tcanSetProps,\n\tonChangeDimensionType,\n}: {\n\twithoutDescendantIds: NodeID[]\n\tdimension: Dimension\n\tcurrentValue: Reduced<string | number>\n\tcurrentDimensionTypes: Set<DimensionType>\n\tvalue: number\n\trawValue: string\n\treset: () => void\n\tcanSetProps: CanSetSizeProps\n\tonChangeDimensionType: (dimensionType: DimensionType) => void\n}) {\n\tengine.setEditReason(\"SizePanel\")\n\tconst withoutDescendants = engine.tree.getNodes(withoutDescendantIds)\n\n\tconst dimensionType = inferNewDimensionType({\n\t\twithoutDescendants,\n\t\tcurrentValue,\n\t\tcurrentDimensionTypes,\n\t\tvalue,\n\t\trawValue,\n\t\tdimension,\n\t})\n\n\tif (!dimensionTypeEnabled(dimensionType, dimension, canSetProps)) {\n\t\t// Handle fail\n\t\treset()\n\t\treturn\n\t}\n\n\tconst layoutParentsWithPotentialSizeConflicts = new Set<NodeID>([])\n\n\tswitch (dimensionType) {\n\t\tcase DimensionType.Percentage:\n\t\t\tupdateSizeToPercentage(withoutDescendants, dimension, value, layoutParentsWithPotentialSizeConflicts)\n\t\t\tbreak\n\t\tcase DimensionType.FractionOfFreeSpace: {\n\t\t\tupdateSizeToFraction(withoutDescendants, dimension, value, layoutParentsWithPotentialSizeConflicts)\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Auto: {\n\t\t\tonChangeDimensionType(DimensionType.Auto)\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.FixedNumber: {\n\t\t\tupdateSizeToFixed(withoutDescendants, dimension, value)\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.Viewport: {\n\t\t\tupdateSizeToViewport(withoutDescendants, dimension, value)\n\t\t\tbreak\n\t\t}\n\t\tcase DimensionType.FitImage: {\n\t\t\tonChangeDimensionType(DimensionType.FitImage)\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(dimensionType)\n\t}\n\n\tconst parentsWithConflicts = resolveSizeConflictsInAutoSizedNodes(layoutParentsWithPotentialSizeConflicts)\n\tshowParentDimensionChangeToast(parentsWithConflicts, dimension)\n}\n\ninterface ChangeDimensionTypeInput {\n\twithoutDescendantIds: NodeID[]\n\tdimension: Dimension\n\tdimensionType: DimensionType\n\tcanSetProps: CanSetSizeProps\n}\n\nfunction changeDimensionType({\n\twithoutDescendantIds,\n\tdimension,\n\tdimensionType,\n\tcanSetProps,\n}: ChangeDimensionTypeInput) {\n\tif (!dimensionTypeEnabled(dimensionType, dimension, canSetProps)) {\n\t\treturn\n\t}\n\n\tengine.setEditReason(\"SizePanel\")\n\tconst { tree } = engine\n\tconst withoutDescendants = tree.getNodes(withoutDescendantIds)\n\tconst layoutParentsWithPotentialSizeConflicts = new Set<NodeID>([])\n\n\tif (dimensionType === DimensionType.FitImage) {\n\t\tvoid regenerateModulesForFitImage(\n\t\t\t{\n\t\t\t\ttreeStore: engine.stores.treeStore,\n\t\t\t\tcodeGenerationStore: engine.stores.codeGenerationStore,\n\t\t\t\tscopeStore: engine.stores.scopeStore,\n\t\t\t\tmodulesStore: engine.stores.modulesStore,\n\t\t\t},\n\t\t\tengine.scheduler,\n\t\t\twithoutDescendants,\n\t\t)\n\t}\n\n\twithoutDescendants.forEach(node => {\n\t\tif (!isPinnable(node)) return\n\t\tlet update: Partial<WithPins & WithAspectRatio> | undefined = {}\n\n\t\t// Will expand a text node's rect slightly to prevent it from\n\t\t// re-wrapping when converting from auto to fixed\n\t\tconst rect = dimension === \"width\" ? adjustedRectForConversionToFixedSize(node, tree) : tree.getRect(node)\n\t\tswitch (dimensionType) {\n\t\t\tcase DimensionType.Auto: {\n\t\t\t\tif (!isGridComponent(node)) {\n\t\t\t\t\trecord(\"layout_stack\", { source: \"auto_size_panel\", layoutType: \"stack\" })\n\t\t\t\t\tconst dimensionTypeKey = dimensionTypeKeyForDimension(dimension)\n\t\t\t\t\tconst opposingDimensionTypeKey = dimensionTypeKeyForDimension(opposingDimensionForDimension(dimension))\n\t\t\t\t\tenableStackLayoutForNode(engine, node, {\n\t\t\t\t\t\t[opposingDimensionTypeKey]: node[opposingDimensionTypeKey],\n\t\t\t\t\t\t[dimensionTypeKey]: dimensionType,\n\t\t\t\t\t})\n\t\t\t\t\tconvertChildrenToFixedSizeAlongDimension(tree, dimension, node)\n\t\t\t\t} else if (\n\t\t\t\t\texperiments.isOn(\"gridCollapseMacros\") &&\n\t\t\t\t\tdimension === \"height\" &&\n\t\t\t\t\tisGridComponent(node) &&\n\t\t\t\t\tnode.gridRowHeightType === \"auto\" &&\n\t\t\t\t\tcouldCollapse(node, { heightType: DimensionType.Auto })\n\t\t\t\t) {\n\t\t\t\t\tconvertCollapsibleGridChildrenToFixedSize([node.id])\n\t\t\t\t}\n\n\t\t\t\t// Use the latest node as it is converted to a stack\n\t\t\t\tconst currentNode = node.draftOrCurrent()\n\t\t\t\tupdate = getUpdatesForDimensionTypeAuto(currentNode, dimension, rect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase DimensionType.FractionOfFreeSpace: {\n\t\t\t\tupdate = getUpdatesForDimensionTypeFraction(node, dimension)\n\t\t\t\tif (node.cache.parentDirected && node.parentid) {\n\t\t\t\t\tlayoutParentsWithPotentialSizeConflicts.add(node.parentid)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase DimensionType.FixedNumber:\n\t\t\t\tupdate = getUpdatesForDimensionTypeFixed(node, dimension, rect)\n\t\t\t\tbreak\n\t\t\tcase DimensionType.Percentage: {\n\t\t\t\tupdate = getUpdatesForDimensionTypePercentage(node, dimension, rect)\n\t\t\t\tif (!update) return\n\n\t\t\t\tif (node.cache.parentDirected && node.parentid) {\n\t\t\t\t\tlayoutParentsWithPotentialSizeConflicts.add(node.parentid)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase DimensionType.Viewport: {\n\t\t\t\tupdate = getUpdatesForDimensionTypeViewport(node, dimension)\n\t\t\t\tif (!update) return\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase DimensionType.FitImage: {\n\t\t\t\tupdate = getUpdatesForDimensionTypeFitImage(node, dimension, rect)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(dimensionType)\n\t\t}\n\n\t\t// If we're switching to a dimension type where locking aspect ratio isn't valid, clear it.\n\t\tif (withAspectRatio(node) && !isNull(node.aspectRatio) && isAutoDimensionType(dimensionType)) {\n\t\t\tupdate.aspectRatio = null\n\t\t}\n\n\t\tconst startPin: PinPosition = dimension === \"width\" ? \"left\" : \"top\"\n\t\tconst endPin: PinPosition = dimension === \"width\" ? \"right\" : \"bottom\"\n\t\tif (isPinnable(node) && isNumber(node[startPin]) && isNumber(node[endPin])) {\n\t\t\tupdate[endPin] = null\n\t\t}\n\n\t\ttrackDimensionTypeChange(node, update, \"auto_size_panel\")\n\t\tnode.set(update)\n\t})\n\n\tconst parentsWithConflicts = resolveSizeConflictsInAutoSizedNodes(layoutParentsWithPotentialSizeConflicts)\n\tshowParentDimensionChangeToast(parentsWithConflicts, dimension)\n}\n\nfunction getUpdatesForDimensionTypeAuto(\n\tnode: CanvasNode & WithPins,\n\tdimension: Dimension,\n\trect: Rect,\n): Partial<WithPins & WithFramePreset & WithLayout & WithGridItemSize> {\n\tconst nodeUpdate: Partial<WithPins & WithFramePreset & WithLayout & WithGridItemSize> = {\n\t\t[dimension]: rect[dimension],\n\t\t// Even though it has already been updated by\n\t\t// enableStackLayoutForNode, we also set the widthType here,\n\t\t// so it is tracked in the trackDimensionTypeChange later on\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.Auto,\n\t\t// aspect ratio will be removed, but we do need to retain the measured value of the opposing axis\n\t\t...getUpdateForAspectRatio(node, dimension, rect),\n\t}\n\n\t// Auto-sizing frames no longer follow the constraints of a preset, reset it to null.\n\tif (withFramePreset(node)) {\n\t\tnodeUpdate.framePreset = null\n\t}\n\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t}\n\n\t// Row height can't be auto (fill) when the grid itself is auto sizing\n\tif (\n\t\t!experiments.isOn(\"gridCollapseMacros\") &&\n\t\tdimension === \"height\" &&\n\t\tisGridComponent(node) &&\n\t\tnode.gridRowHeightType === \"auto\"\n\t) {\n\t\tnodeUpdate.gridRowHeightType = \"fixed\"\n\t}\n\n\tconst crossDimensionKey = opposingDimensionForDimension(dimension)\n\tconst crossDimensionTypeKey = dimensionTypeKeyForDimension(crossDimensionKey)\n\tif (node[crossDimensionTypeKey] === DimensionType.FitImage) {\n\t\tnodeUpdate[crossDimensionTypeKey] = DimensionType.FixedNumber\n\t\tnodeUpdate[crossDimensionKey] = rect[crossDimensionKey]\n\t}\n\n\t// When changing a fixed stack to auto, reset invalid distribution & gap\n\tconst flexDirection = dimension === \"width\" ? \"horizontal\" : \"vertical\"\n\tif (\n\t\tisStackComponent(node) &&\n\t\tnode.resolveValue(\"stackDirection\") === flexDirection &&\n\t\t!distributionSupportsGap(node.stackDistribution)\n\t) {\n\t\tnodeUpdate.stackDistribution = \"center\"\n\t\tnodeUpdate.gap = 0\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction getUpdatesForDimensionTypeFraction(node: CanvasNode & WithPins, dimension: Dimension) {\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t[dimension]: 1,\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.FractionOfFreeSpace,\n\t}\n\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = true\n\t} else if (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction getUpdatesForDimensionTypeFixed(\n\tnode: CanvasNode & WithPins & WithConstraints,\n\tdimension: Dimension,\n\trect: Rect,\n) {\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t[dimension]: Math.max(rect[dimension], 1),\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.FixedNumber,\n\t\t...getUpdateForAspectRatio(node, dimension, rect),\n\t}\n\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tnodeUpdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction getUpdatesForDimensionTypePercentage(\n\tnode: CanvasNode & WithPins,\n\tdimension: Dimension,\n\trect: Rect,\n): Partial<WithPins & WithGridItemSize> | undefined {\n\tconst tree = engine.tree\n\tconst parent = tree.getParent(node.id)\n\tif (!parent) return\n\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t[dimension]: 1,\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.Percentage,\n\t}\n\n\tconst gridItemFillCellKey = gridItemFillCellKeyForDimension(dimension)\n\tif (node.cache.parentDirected === \"grid\" && withGridItemSize(node) && node[gridItemFillCellKey]) {\n\t\tnodeUpdate[gridItemFillCellKey] = false\n\t} else {\n\t\tconst parentSize = isPositionFixed(node) ? tree.getParentSizeInfo(node)?.sizing : getSizeMinusPadding(tree, parent)\n\t\tif (!parentSize) return\n\t\tnodeUpdate[dimension] = rect[dimension] / Math.max(parentSize[dimension], 1)\n\t}\n\n\tif (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction getUpdatesForDimensionTypeViewport(\n\tnode: CanvasNode & WithPins,\n\tdimension: Dimension,\n): Partial<WithPins & WithGridItemSize> | undefined {\n\tif (!isPinnable(node)) return\n\tconst { tree } = engine\n\tif (!supportsViewportSizing(tree, node)) return\n\n\tconst nodeUpdate: Partial<WithPins & WithGridItemSize> = {\n\t\t// When changing the dimension type to viewport, always start with 100vw/vh\n\t\t[dimension]: 1,\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.Viewport,\n\t}\n\n\tconst gridItemFillCellKey = gridItemFillCellKeyForDimension(dimension)\n\tif (node.cache.parentDirected === \"grid\" && withGridItemSize(node) && node[gridItemFillCellKey]) {\n\t\tnodeUpdate[gridItemFillCellKey] = false\n\t}\n\n\tif (relativeAxisRequiresFixedOpposingAxis(node, dimension)) {\n\t\tconst opposingAxis = opposingDimensionForDimension(dimension)\n\t\tnodeUpdate[dimensionTypeKeyForDimension(opposingAxis)] = DimensionType.FixedNumber\n\t}\n\n\treturn nodeUpdate\n}\n\nfunction getUpdatesForDimensionTypeFitImage(\n\tnode: CanvasNode & WithPins,\n\tdimension: Dimension,\n\trect: Rect,\n): Partial<WithPins & WithGridItemSize & WithFill> {\n\tconst crossDimensionKey = opposingDimensionForDimension(dimension)\n\tconst crossDimensionTypeKey = dimensionTypeKeyForDimension(crossDimensionKey)\n\n\tconst update: Partial<WithPins & WithGridItemSize & WithFill> = {\n\t\t...(withFill(node) ? getImageUpdatesFromAsset(node) : undefined),\n\t\t[dimensionTypeKeyForDimension(dimension)]: DimensionType.FitImage,\n\t\t[dimension]: rect[dimension],\n\t\t[crossDimensionKey]:\n\t\t\tnode[crossDimensionKey] === DimensionType.FitImage ? DimensionType.FixedNumber : node[crossDimensionKey],\n\t}\n\n\tif (node.cache.parentDirected === \"grid\") {\n\t\tupdate[gridItemFillCellKeyForDimension(dimension)] = false\n\t}\n\n\tif (isAutoDimensionType(node[crossDimensionTypeKey])) {\n\t\tupdate[crossDimensionTypeKey] = DimensionType.FixedNumber\n\t\tupdate[crossDimensionKey] = rect[crossDimensionKey]\n\t}\n\n\treturn update\n}\n\n// While updating to fit image dimension type we take the opportunity to update to the latest asset reference format\n// this ensures that we will have width/height available in the parsed reference, removing the dependency on the assetMap\nfunction getImageUpdatesFromAsset(input: WithFill): Partial<WithFill> | undefined {\n\t// only process static images\n\tif (!isString(input.fillImage)) return undefined\n\n\tconst parsedAssetDetails = parseAssetReference(input.fillImage)\n\t// Asset reference already has intrinsic size information and doesn't need to be updated\n\tif (parsedAssetDetails?.intrinsicSize) return undefined\n\n\t// some older images will not be an asset reference, but just a filename like TbHjmgE7xxTvywDF7iIkjnQ9M.png\n\tconst identifier = parsedAssetDetails?.identifier ?? input.fillImage\n\tif (!identifier) return undefined\n\n\tconst asset = engine.stores.assetStore.assetMap.assetForKey(identifier)\n\tif (!asset || !asset.properties?.image) return undefined\n\n\tif (parsedAssetDetails) {\n\t\treturn {\n\t\t\tfillImage: createAssetReferenceFromParseResult({\n\t\t\t\t...parsedAssetDetails,\n\t\t\t\tintrinsicSize: asset.properties.image,\n\t\t\t}),\n\t\t}\n\t}\n\n\treturn {\n\t\tfillImage: createAssetReferenceForImage({\n\t\t\tidentifier,\n\t\t\toriginalFilename: asset.name,\n\t\t\tintrinsicSize: asset.properties.image,\n\t\t}),\n\t}\n}\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { Padlock } from \"document/components/chrome/properties/inputs/Padlock.tsx\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tchangeHeight,\n\tchangeHeightDimension,\n\tchangeWidth,\n\tchangeWidthDimension,\n} from \"document/models/CanvasTree/nodes/utils/sizeHelpers.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport type { WithSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFound, isFoundAndNotMixed } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { layoutSupportsAspectRatio } from \"document/models/CanvasTree/traits/utils/layoutSupportsAspectRatio.ts\"\nimport type { ReducedAspectRatio } from \"document/models/CanvasTree/traits/utils/reduceAspectRatio.ts\"\nimport type { CanSetSizeProps, ReducedSizeProperties } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport type { TextProperties } from \"document/models/CanvasTree/traits/utils/reduceText.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport React from \"react\"\nimport { SizeRow } from \"../rows/SizeRow/SizeRow.tsx\"\nimport { TextSizePresetsPanel } from \"./TextSizePresetsPanel.tsx\"\n\nconst sizeTraitTypes = [TraitType.Size]\nexport type SizeTraitTypeKeys = keyof WithSize | keyof WithSizeDimensionType\nconst allWidthTraitTypeKeys: SizeTraitTypeKeys[] = [\"width\", \"widthType\"]\nconst allHeightTraitTypeKeys: SizeTraitTypeKeys[] = [\"height\", \"heightType\"]\n\ninterface Props\n\textends\n\t\tCanSetSizeProps,\n\t\tReducedAspectRatio,\n\t\tPartial<Pick<TextProperties, \"fontSizeUnits\">>,\n\t\tPick<ReducedSizeProperties, \"width\" | \"height\"> {\n\twithoutDescendantIds: NodeID[]\n\twidthTypes: Set<DimensionType>\n\theightTypes: Set<DimensionType>\n\tcurrentVariantWidthType: Reduced<DimensionType>\n\tcurrentVariantHeightType: Reduced<DimensionType>\n\tonlyShapeAndGraphicNodes: boolean\n\tonlyTextNodes: boolean\n\tonlyRichTextNodes: boolean\n\tanyShapeNode: boolean\n\tanyAutoSizingNode: boolean\n\tonlyCodeComponentNodes: boolean\n\tonlyShaderNodes: boolean\n\tonlyBreakpointNodes: boolean\n\tselection: NodeID[]\n\tallNodeIds: NodeID[]\n}\n\nexport class SizePanel extends React.PureComponent<Props> {\n\tgetCanSetProps(): CanSetSizeProps {\n\t\treturn {\n\t\t\tcanSetWidthToFixed: this.props.canSetWidthToFixed,\n\t\t\tcanSetHeightToFixed: this.props.canSetHeightToFixed,\n\t\t\tcanSetWidthToPercentage: this.props.canSetWidthToPercentage,\n\t\t\tcanSetHeightToPercentage: this.props.canSetHeightToPercentage,\n\t\t\tcanSetWidthToFillParent: this.props.canSetWidthToFillParent,\n\t\t\tcanSetHeightToFillParent: this.props.canSetHeightToFillParent,\n\t\t\tcanSetWidthToAuto: this.props.canSetWidthToAuto,\n\t\t\tcanSetHeightToAuto: this.props.canSetHeightToAuto,\n\t\t\tcanSetWidthToViewport: this.props.canSetWidthToViewport,\n\t\t\tcanSetHeightToViewport: this.props.canSetHeightToViewport,\n\t\t\tcanSetWidthToFitImage: this.props.canSetWidthToFitImage,\n\t\t\tcanSetHeightToFitImage: this.props.canSetHeightToFitImage,\n\t\t\tcanSetSizeToDefault: this.props.canSetSizeToDefault,\n\t\t}\n\t}\n\n\twidthChange = engine.scheduler.wrapHandler((value: number, rawValue: string, reset: () => void) => {\n\t\tconst { width, widthTypes, withoutDescendantIds } = this.props\n\t\tchangeWidth(\n\t\t\twithoutDescendantIds,\n\t\t\twidth,\n\t\t\twidthTypes,\n\t\t\tvalue,\n\t\t\trawValue,\n\t\t\treset,\n\t\t\tthis.getCanSetProps(),\n\t\t\tthis.onChangeWidthDimension,\n\t\t)\n\t})\n\n\theightChange = engine.scheduler.wrapHandler((value: number, rawValue: string, reset: () => void) => {\n\t\tconst { height, heightTypes, withoutDescendantIds } = this.props\n\t\tchangeHeight(\n\t\t\twithoutDescendantIds,\n\t\t\theight,\n\t\t\theightTypes,\n\t\t\tvalue,\n\t\t\trawValue,\n\t\t\treset,\n\t\t\tthis.getCanSetProps(),\n\t\t\tthis.onChangeHeightDimension,\n\t\t)\n\t})\n\n\tonClickPadlock = engine.scheduler.wrapHandler(() => {\n\t\tconst tree = engine.tree\n\t\tconst { aspectRatioEnabled, withoutDescendantIds } = this.props\n\t\tconst withoutDescendants = engine.tree.getNodes(withoutDescendantIds)\n\n\t\tconst shouldEnableAspectRatio = aspectRatioEnabled !== true\n\n\t\twithoutDescendants.forEach(node => {\n\t\t\tif (!withAspectRatio(node)) return\n\t\t\tif (!layoutSupportsAspectRatio(node)) return\n\t\t\tconst rect = tree.getRect(node)\n\t\t\tconst width = Math.max(rect.width, 1)\n\t\t\tconst height = Math.max(rect.height, 1)\n\t\t\tconst ratio = width / height\n\t\t\tconst aspectRatio = shouldEnableAspectRatio ? ratio : null\n\n\t\t\tnode.set({ aspectRatio })\n\n\t\t\t// If we are disabling aspect ratio, and 1 dimension is relative,\n\t\t\t// and 1 is fixed, ensure that the fixed dimension is set to the\n\t\t\t// last measured size.\n\t\t\tif (!shouldEnableAspectRatio && isPinnable(node)) {\n\t\t\t\tif (node.widthType === DimensionType.FixedNumber && node.heightType !== DimensionType.FixedNumber) {\n\t\t\t\t\tnode.set({ width: rect.width })\n\t\t\t\t}\n\n\t\t\t\tif (node.heightType === DimensionType.FixedNumber && node.widthType !== DimensionType.FixedNumber) {\n\t\t\t\t\tnode.set({ height: rect.height })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isPinnable(node)) return\n\t\t\tconst constraints = node.constraints()\n\t\t\tconst isPinnedLeftAndRight = constraints.left && constraints.right\n\t\t\tconst hasRelativeWidth = isPinnedLeftAndRight || node.widthType !== DimensionType.FixedNumber\n\n\t\t\tif (shouldEnableAspectRatio && hasRelativeWidth) {\n\t\t\t\t// If aspect ratio is locked on a node that has 2 relative\n\t\t\t\t// dimensions, set height to fixed so that it can be informed by\n\t\t\t\t// width * aspect ratio.\n\t\t\t\tif (node.heightType !== DimensionType.FixedNumber) {\n\t\t\t\t\tnode.set({ heightType: DimensionType.FixedNumber, height: rect.height })\n\t\t\t\t}\n\t\t\t\t// If aspect ratio is locked on a node that has a relative width + pin top + pin bottom,\n\t\t\t\t// we unpin the bottom pin.\n\t\t\t\tif (constraints.top && constraints.bottom) {\n\t\t\t\t\tnode.set({ bottom: null, height: rect.height })\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n\n\t// Dimension types\n\n\tonChangeWidthDimension = engine.scheduler.wrapHandler((dimensionType: DimensionType) => {\n\t\tchangeWidthDimension(this.props.withoutDescendantIds, dimensionType, this.getCanSetProps())\n\t})\n\n\tonChangeHeightDimension = engine.scheduler.wrapHandler((dimensionType: DimensionType) => {\n\t\tchangeHeightDimension(this.props.withoutDescendantIds, dimensionType, this.getCanSetProps())\n\t})\n\n\toverride render() {\n\t\tconst {\n\t\t\twidth,\n\t\t\theight,\n\t\t\twidthTypes,\n\t\t\theightTypes,\n\t\t\tonlyShapeAndGraphicNodes,\n\t\t\tanyShapeNode,\n\t\t\tanyAutoSizingNode,\n\t\t\taspectRatioEnabled,\n\t\t\taspectRatioLocked,\n\t\t\tfontSizeUnits,\n\t\t} = this.props\n\n\t\tconst traitTypes: TraitType[] | undefined = anyShapeNode || anyAutoSizingNode ? undefined : sizeTraitTypes\n\n\t\tconst onlyPixelSize = onlyShapeAndGraphicNodes\n\n\t\tif (onlyPixelSize) {\n\t\t\treturn (\n\t\t\t\t<PanelRow title=\"Size\" traitTypes={traitTypes}>\n\t\t\t\t\t{isFound(aspectRatioEnabled) && (\n\t\t\t\t\t\t<Padlock\n\t\t\t\t\t\t\tlocked={aspectRatioEnabled === true}\n\t\t\t\t\t\t\tonClick={this.onClickPadlock}\n\t\t\t\t\t\t\tinline\n\t\t\t\t\t\t\ttitle=\"Aspect Ratio\"\n\t\t\t\t\t\t\tenabled={aspectRatioLocked !== true}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isFound(width) ? width : undefined}\n\t\t\t\t\t\tonChange={this.widthChange}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tlabel={onlyPixelSize ? \"W\" : undefined}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t\tdata-testid=\"sizepanel-width-input\"\n\t\t\t\t\t/>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={isFound(height) ? height : undefined}\n\t\t\t\t\t\tonChange={this.heightChange}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tlabel={onlyPixelSize ? \"H\" : undefined}\n\t\t\t\t\t\tstep=\"nudge\"\n\t\t\t\t\t\tdata-testid=\"sizepanel-height-input\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)\n\t\t}\n\n\t\tconst canSetProps = this.getCanSetProps()\n\t\tconst canUseTextSizePresetsPanel = !fontSizeUnits?.has(\"auto\")\n\n\t\t// If aspect ratio locking is enabled, then we just fallback to passing the Size\n\t\t// trait type which will mean that all size properties get reset (width, height, etc)\n\t\tconst widthTraitTypeKeys: SizeTraitTypeKeys[] | undefined =\n\t\t\tisFoundAndNotMixed(aspectRatioEnabled) && aspectRatioEnabled ? undefined : allWidthTraitTypeKeys\n\t\tconst heightTraitTypeKeys: SizeTraitTypeKeys[] | undefined =\n\t\t\tisFoundAndNotMixed(aspectRatioEnabled) && aspectRatioEnabled ? undefined : allHeightTraitTypeKeys\n\n\t\treturn (\n\t\t\t<React.Fragment>\n\t\t\t\t<SizeRow\n\t\t\t\t\tvalue={isFound(width) ? width : undefined}\n\t\t\t\t\tdimension=\"width\"\n\t\t\t\t\tonChange={this.widthChange}\n\t\t\t\t\tdimensionTypes={widthTypes}\n\t\t\t\t\tonChangeDimension={this.onChangeWidthDimension}\n\t\t\t\t\tcanSetProps={canSetProps}\n\t\t\t\t\ttraitTypes={traitTypes}\n\t\t\t\t\ttraitTypeKeys={widthTraitTypeKeys}\n\t\t\t\t>\n\t\t\t\t\t{isFound(aspectRatioEnabled) && (\n\t\t\t\t\t\t<Padlock\n\t\t\t\t\t\t\tlocked={aspectRatioEnabled === true}\n\t\t\t\t\t\t\tonClick={this.onClickPadlock}\n\t\t\t\t\t\t\tinline={false}\n\t\t\t\t\t\t\ttitle=\"Aspect Ratio\"\n\t\t\t\t\t\t\tenabled={aspectRatioLocked !== true}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</SizeRow>\n\t\t\t\t<SizeRow\n\t\t\t\t\tvalue={isFound(height) ? height : undefined}\n\t\t\t\t\tdimension=\"height\"\n\t\t\t\t\tdimensionTypes={heightTypes}\n\t\t\t\t\tonChange={this.heightChange}\n\t\t\t\t\tonChangeDimension={this.onChangeHeightDimension}\n\t\t\t\t\tcanSetProps={canSetProps}\n\t\t\t\t\ttraitTypes={traitTypes}\n\t\t\t\t\ttraitTypeKeys={heightTraitTypeKeys}\n\t\t\t\t/>\n\t\t\t\t{canUseTextSizePresetsPanel && (\n\t\t\t\t\t<TextSizePresetsPanel\n\t\t\t\t\t\tnodeIds={this.props.allNodeIds}\n\t\t\t\t\t\twidthTypes={this.props.widthTypes}\n\t\t\t\t\t\theightTypes={this.props.heightTypes}\n\t\t\t\t\t\tonlyTextNodes={this.props.onlyTextNodes}\n\t\t\t\t\t\tonlyRichTextNodes={this.props.onlyRichTextNodes}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</React.Fragment>\n\t\t)\n\t}\n}\n", "import type { Mixed } from \"@framerjs/shared\"\nimport type { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { CanSetSizeProps } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport type { DimensionType } from \"library/render/types/Constraints.ts\"\nimport type React from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { DimensionInput } from \"../../inputs/DimensionInput.tsx\"\nimport type { SizeTraitTypeKeys } from \"../../panels/SizePanel.tsx\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\ntype Props = React.PropsWithChildren<{\n\tdimension: \"width\" | \"height\"\n\tdimensionTypes: Set<DimensionType>\n\tvalue: number | string | Mixed | undefined\n\tonChange: (value: number, rawValue: string | undefined, reset: () => void) => void\n\tonChangeDimension: (dimensionType: DimensionType) => void\n\tcanSetProps: CanSetSizeProps\n\ttraitTypes: TraitType[] | undefined\n\ttraitTypeKeys: SizeTraitTypeKeys[] | undefined\n}>\n\nconst validRawValues = new Set([\"auto\"])\n\nexport function SizeRow({\n\tdimension,\n\tonChange,\n\tonChangeDimension,\n\tvalue,\n\tdimensionTypes,\n\tcanSetProps,\n\ttraitTypes,\n\tchildren,\n\ttraitTypeKeys,\n}: Props) {\n\treturn (\n\t\t<PanelRow title={capitalizeFirstLetter(dimension)} traitTypeKeys={traitTypeKeys} traitTypes={traitTypes}>\n\t\t\t{children}\n\t\t\t<DimensionInput\n\t\t\t\tvalue={value}\n\t\t\t\tdimension={dimension}\n\t\t\t\tdimensionTypes={dimensionTypes}\n\t\t\t\tcanSetProps={canSetProps}\n\t\t\t\tonChangeDimension={onChangeDimension}\n\t\t\t\tonChangeNumber={onChange}\n\t\t\t\tvalidRawValues={validRawValues}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentStackDirectionHorizontal(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=\"16\"\n\t\t\theight=\"16\"\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=\"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=\"M4.5 4.75 2.207 7.043a1 1 0 0 0 0 1.414L4.5 10.75M11.5 4.75l2.293 2.293a1 1 0 0 1 0 1.414L11.5 10.75M3 7.75h10\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentStackDirectionVertical(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=\"16\"\n\t\t\theight=\"16\"\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=\"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=\"m4.75 4.5 2.293-2.293a1 1 0 0 1 1.414 0L10.75 4.5M4.75 11.5l2.293 2.293a1 1 0 0 0 1.414 0L10.75 11.5M7.75 2.5v11\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "export function IconGrowFixed() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n\t\t\t<path fill=\"currentColor\" fillOpacity={0.25} d=\"M1 1h10v10H1z\"></path>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M1.5 0a1.5 1.5 0 11-.001 3.001A1.5 1.5 0 011.5 0zM10.5 0a1.5 1.5 0 11-.001 3.001A1.5 1.5 0 0110.5 0zM10.5 9a1.5 1.5 0 11-.001 3.001A1.5 1.5 0 0110.5 9zM1.5 9a1.5 1.5 0 11-.001 3.001A1.5 1.5 0 011.5 9z\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconGrowHorizontal() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<path\n\t\t\t\td=\"M 2 7.75 L 14 7.75\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 4 5 L 1 7.75 L 4 10.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t></path>\n\t\t\t<path\n\t\t\t\td=\"M 12 5 L 15 7.75 L 12 10.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t></path>\n\t\t</svg>\n\t)\n}\n", "export function IconGrowVertical() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\">\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.5\">\n\t\t\t\t<path d=\"M2.25 0v10M4.5 8.5l-2.25 2L0 8.5\" transform=\"translate(10.5 3)\"></path>\n\t\t\t</g>\n\t\t\t<g fill=\"currentColor\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M0 .75A.75.75 0 01.75 0h7.5a.75.75 0 010 1.5H.75A.75.75 0 010 .75zM0 4.25a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5H.75A.75.75 0 010 4.25zM0 7.75A.75.75 0 01.75 7h4.5a.75.75 0 010 1.5H.75A.75.75 0 010 7.75z\"\n\t\t\t\t\ttransform=\"translate(0 4)\"\n\t\t\t\t></path>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { IconAgentLayerViewBox } from \"document/components/chrome/layers/AgentLayerIcons.tsx\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { adjustedRectForConversionToFixedSize } from \"document/models/CanvasTree/nodes/utils/adjustedRectForConversionToFixedSize.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport type { WithGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { IconAgentStackDirectionHorizontal } from \"./icons/IconAgentStackDirectionHorizontal.tsx\"\nimport { IconAgentStackDirectionVertical } from \"./icons/IconAgentStackDirectionVertical.tsx\"\nimport { IconGrowFixed } from \"./icons/IconGrowFixed.tsx\"\nimport { IconGrowHorizontal } from \"./icons/IconGrowHorizontal.tsx\"\nimport { IconGrowVertical } from \"./icons/IconGrowVertical.tsx\"\nimport { trackDimensionTypeChange } from \"./utils/trackDimensionTypeChange.ts\"\n\nenum TextGrowPreset {\n\tAutoWidth, // Actually \"+ auto height\", but it's more commonly known as \"auto width\"\n\tAutoHeight,\n\tFixedSize,\n}\n\ninterface Props {\n\tnodeIds: NodeID[]\n\twidthTypes: Set<DimensionType>\n\theightTypes: Set<DimensionType>\n\tonlyTextNodes: boolean\n\tonlyRichTextNodes: boolean\n}\n\nexport function TextSizePresetsPanel({ nodeIds, onlyTextNodes, onlyRichTextNodes, widthTypes, heightTypes }: Props) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst onChangeGrowPreset = useEngineCallback(\n\t\t(preset: TextGrowPreset) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithPins & WithGridItemSize> = {}\n\t\t\t\tswitch (preset) {\n\t\t\t\t\tcase TextGrowPreset.AutoWidth: {\n\t\t\t\t\t\tupdate.widthType = DimensionType.Auto\n\t\t\t\t\t\tupdate.heightType = DimensionType.Auto\n\t\t\t\t\t\tif (node.gridItemFillCellWidth) update.gridItemFillCellWidth = false\n\t\t\t\t\t\tif (node.gridItemFillCellHeight) update.gridItemFillCellHeight = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase TextGrowPreset.AutoHeight: {\n\t\t\t\t\t\tconst { width } = adjustedRectForConversionToFixedSize(node, engine.tree)\n\t\t\t\t\t\tupdate.width = width\n\t\t\t\t\t\tupdate.widthType = DimensionType.FixedNumber\n\t\t\t\t\t\tupdate.heightType = DimensionType.Auto\n\t\t\t\t\t\tif (node.gridItemFillCellHeight) update.gridItemFillCellHeight = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase TextGrowPreset.FixedSize: {\n\t\t\t\t\t\tconst { width, height } = adjustedRectForConversionToFixedSize(node, engine.tree)\n\t\t\t\t\t\tupdate.width = width\n\t\t\t\t\t\tupdate.height = height\n\t\t\t\t\t\tupdate.widthType = DimensionType.FixedNumber\n\t\t\t\t\t\tupdate.heightType = DimensionType.FixedNumber\n\t\t\t\t\t\tif (node.gridItemFillCellWidth) update.gridItemFillCellWidth = false\n\t\t\t\t\t\tif (node.gridItemFillCellHeight) update.gridItemFillCellHeight = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttrackDimensionTypeChange(node, update, \"text_size_presets_panel\")\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tif (!onlyTextNodes && !onlyRichTextNodes) return null\n\n\tconst growPreset = getGrowPreset(widthTypes, heightTypes)\n\n\treturn (\n\t\t<PanelRow title=\"Grow\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={TextGrowPreset.AutoWidth}\n\t\t\t\t\ttitle=\"Auto Width\"\n\t\t\t\t\tselected={growPreset === TextGrowPreset.AutoWidth}\n\t\t\t\t\tonSelect={onChangeGrowPreset}\n\t\t\t\t>\n\t\t\t\t\t{agentExperimentEnabled ? <IconAgentStackDirectionHorizontal /> : <IconGrowHorizontal />}\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={TextGrowPreset.AutoHeight}\n\t\t\t\t\ttitle=\"Auto Height\"\n\t\t\t\t\tselected={growPreset === TextGrowPreset.AutoHeight}\n\t\t\t\t\tonSelect={onChangeGrowPreset}\n\t\t\t\t>\n\t\t\t\t\t{agentExperimentEnabled ? <IconAgentStackDirectionVertical /> : <IconGrowVertical />}\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={TextGrowPreset.FixedSize}\n\t\t\t\t\ttitle=\"Fixed Size\"\n\t\t\t\t\tselected={growPreset === TextGrowPreset.FixedSize}\n\t\t\t\t\tonSelect={onChangeGrowPreset}\n\t\t\t\t>\n\t\t\t\t\t{agentExperimentEnabled ? <IconAgentLayerViewBox /> : <IconGrowFixed />}\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n\nfunction getGrowPreset(widthTypes: Set<DimensionType>, heightTypes: Set<DimensionType>): TextGrowPreset {\n\tconst commonWidthType = commonValue(widthTypes)\n\tconst commonHeightType = commonValue(heightTypes)\n\n\tif (commonWidthType === DimensionType.Auto) return TextGrowPreset.AutoWidth\n\tif (commonHeightType === DimensionType.Auto) return TextGrowPreset.AutoHeight\n\n\treturn TextGrowPreset.FixedSize\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { ReducedLayout } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\nimport type { ReducedPadding } from \"document/models/CanvasTree/traits/utils/reducePadding.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { DimensionType } from \"library/render/types/Constraints.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { GridLayoutRows } from \"./GridLayoutRows.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { PanelSectionHeaderWithTraits } from \"./PanelSectionHeaderWithTraits.tsx\"\nimport { StackLayoutRows } from \"./StackLayoutRows.tsx\"\nimport { IconSectionHeaderMinus } from \"./icons/IconSectionHeaderMinus.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { disableStackAndGridLayout, enableGridLayout, enableStackLayout } from \"./utils/stackAndGridLayoutActions.ts\"\n\nconst stackTraitTypes = [TraitType.Padding, TraitType.Layout]\n\ninterface Props extends Omit<ReducedLayout, \"onlyNodesWithLayout\">, ReducedPadding {\n\tnodeIds: NodeID[]\n\treadOnly: boolean\n\tanyDataRepeater: boolean\n\tanyNodeWithTickerEffect: boolean\n\tselectionDidChange: boolean\n\theightTypes: Set<DimensionType>\n}\n\nconst layoutTypeTraitTypeKeys: (keyof WithLayout)[] = [\"layout\"]\n\nexport const StackAndGridLayoutPanel = React.memo(function StackAndGridLayoutPanel({\n\tnodeIds,\n\tanyDataRepeater,\n\tanyNodeWithTickerEffect,\n\tstackDirection,\n\tstackDistribution,\n\tstackAlignment,\n\tstackWrapEnabled,\n\tpadding,\n\tpaddingPerSide,\n\tpaddingTop,\n\tpaddingRight,\n\tpaddingBottom,\n\tpaddingLeft,\n\theightTypes,\n\tgridColumnCount,\n\tcomputedRowCount,\n\tgridAlignment,\n\tgridColumnWidthType,\n\tgridColumnWidth,\n\tgridColumnMinWidth,\n\tgridRowCount,\n\tgridRowHeightType,\n\tgridRowHeight,\n\tgap,\n\tgapAxis,\n\trowGap,\n\tcolumnGap,\n\tlayout,\n\treadOnly,\n\tgridType,\n}: Props) {\n\tconst canToggleStackAndGridEnabled = !anyDataRepeater && !anyNodeWithTickerEffect && !readOnly\n\n\tconst commonGridEnabled = layout === \"grid\"\n\tconst commonStackEnabled = layout === \"stack\"\n\tconst commonLayoutDisabled = isUndefined(layout)\n\n\tconst enableStackLayoutHandler = useEngineCallback(() => {\n\t\tenableStackLayout(engine, nodeIds)\n\t}, [nodeIds])\n\n\tconst enableGridLayoutHandler = useEngineCallback(() => {\n\t\tenableGridLayout(engine, nodeIds)\n\t}, [nodeIds])\n\n\tconst disableStackAndGridLayoutHandler = useEngineCallback(() => {\n\t\tif (!canToggleStackAndGridEnabled) return\n\t\tdisableStackAndGridLayout(engine, nodeIds)\n\t}, [nodeIds, canToggleStackAndGridEnabled])\n\n\tif (!canToggleStackAndGridEnabled && !commonStackEnabled && !commonGridEnabled) return null\n\n\tconst empty = !commonStackEnabled && !commonGridEnabled\n\n\tconst getToggleLayoutHandler = () => {\n\t\tif (!canToggleStackAndGridEnabled) return\n\t\tif (commonLayoutDisabled) return enableStackLayoutHandler\n\t\treturn disableStackAndGridLayoutHandler\n\t}\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeaderWithTraits\n\t\t\t\t\ttraits={stackTraitTypes}\n\t\t\t\t\ttitle=\"Layout\"\n\t\t\t\t\tclickable={canToggleStackAndGridEnabled}\n\t\t\t\t\tonClick={getToggleLayoutHandler()}\n\t\t\t\t>\n\t\t\t\t\t{canToggleStackAndGridEnabled &&\n\t\t\t\t\t\t(!commonLayoutDisabled ? (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton\n\t\t\t\t\t\t\t\tonClick={disableStackAndGridLayoutHandler}\n\t\t\t\t\t\t\t\tdata-testid=\"stacklayoutpanel-disable-stack-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<IconSectionHeaderMinus />\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton\n\t\t\t\t\t\t\t\tonClick={enableStackLayoutHandler}\n\t\t\t\t\t\t\t\tdata-testid=\"stacklayoutpanel-enable-stack-button\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t))}\n\t\t\t\t</PanelSectionHeaderWithTraits>\n\t\t\t}\n\t\t>\n\t\t\t{!empty && !anyNodeWithTickerEffect && (\n\t\t\t\t<PanelRow traitTypeKeys={layoutTypeTraitTypeKeys} title=\"Type\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle={Dictionary.Stack}\n\t\t\t\t\t\t\tselected={commonStackEnabled}\n\t\t\t\t\t\t\tonSelect={enableStackLayoutHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\ttitle={Dictionary.Grid}\n\t\t\t\t\t\t\tselected={commonGridEnabled}\n\t\t\t\t\t\t\tonSelect={enableGridLayoutHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t{commonStackEnabled && (\n\t\t\t\t<StackLayoutRows\n\t\t\t\t\tanyNodeWithTickerEffect={anyNodeWithTickerEffect}\n\t\t\t\t\tstackDirection={stackDirection}\n\t\t\t\t\tstackDistribution={stackDistribution}\n\t\t\t\t\tstackWrapEnabled={stackWrapEnabled}\n\t\t\t\t\tstackAlignment={stackAlignment}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\tgapAxis={gapAxis}\n\t\t\t\t\trowGap={rowGap}\n\t\t\t\t\tcolumnGap={columnGap}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tpadding={padding}\n\t\t\t\t\tpaddingPerSide={paddingPerSide}\n\t\t\t\t\tpaddingTop={paddingTop}\n\t\t\t\t\tpaddingRight={paddingRight}\n\t\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\t\tpaddingLeft={paddingLeft}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{commonGridEnabled && (\n\t\t\t\t<GridLayoutRows\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\theightTypes={heightTypes}\n\t\t\t\t\tgridAlignment={gridAlignment}\n\t\t\t\t\tgridColumnCount={gridColumnCount}\n\t\t\t\t\tgridRowCount={gridRowCount}\n\t\t\t\t\tcomputedRowCount={computedRowCount}\n\t\t\t\t\tgridColumnWidthType={gridColumnWidthType}\n\t\t\t\t\tgridColumnWidth={gridColumnWidth}\n\t\t\t\t\tgridColumnMinWidth={gridColumnMinWidth}\n\t\t\t\t\tgridRowHeightType={gridRowHeightType}\n\t\t\t\t\tgridRowHeight={gridRowHeight}\n\t\t\t\t\tgridType={gridType}\n\t\t\t\t\tgap={gap}\n\t\t\t\t\tgapAxis={gapAxis}\n\t\t\t\t\trowGap={rowGap}\n\t\t\t\t\tcolumnGap={columnGap}\n\t\t\t\t\tpadding={padding}\n\t\t\t\t\tpaddingPerSide={paddingPerSide}\n\t\t\t\t\tpaddingTop={paddingTop}\n\t\t\t\t\tpaddingRight={paddingRight}\n\t\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\t\tpaddingLeft={paddingLeft}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import engine from \"document/engine.ts\"\nimport type { WithLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\n\n/**\n * Some keys, like `gridType`, need to allow `undefined` as an input\n * for default values.\n */\ntype NullableKeys = keyof Pick<WithLayout, \"gridType\">\n\nexport function useLayoutUpdate<K extends keyof WithLayout>(key: K, nodeIds: string[]) {\n\treturn useEngineCallback(\n\t\t(value: K extends NullableKeys ? WithLayout[K] : NonNullable<WithLayout[K]>) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withLayout)\n\t\t\tnodes.forEach(node => node.set({ [key]: value }))\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n", "import { Mixed, isMixed } from \"@framerjs/shared\"\nimport { FocusedPropertyInputId } from \"document/components/chrome/properties/panels/utils/focusPropertyInput.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { TwoPixelNumberShorthand } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { type WithLayout, withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { NotFound, type Reduced, isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { GapAxis, ReducedLayout } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\nimport { getNodePropertyControlDescription } from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { GapInput } from \"../inputs/GapInput.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { useDynamicLayoutValueUpdate } from \"./utils/useDynamicLayoutValueUpdate.ts\"\nimport { useLayoutUpdate } from \"./utils/useLayoutUpdate.ts\"\n\nconst supportedVariableTypesNumberPreferred = [ControlType.Number, ControlType.Gap] as const\nconst supportedVariableTypesGapPreferred = [ControlType.Gap, ControlType.Number] as const\n\nconst gapTraitKeys = [\"gap\"] satisfies (keyof WithLayout)[]\nconst gapPopoutId = \"gap-popout\"\n\nfunction getGapWithFallback(value: unknown): number {\n\treturn isNumber(value) ? value : 0\n}\n\nfunction getCommonNumericGap(gap: ReducedLayout[\"gap\"]): Reduced<number> {\n\tif (isNotFound(gap)) return NotFound\n\tif (isMixed(gap)) return NotFound\n\tif (isDynamicValue(gap)) return NotFound\n\n\tconst segments = gap.split(\" \")\n\tif (segments.length === 1) {\n\t\tconst parsedGap = parseFloat(segments[0])\n\t\treturn isNumber(parsedGap) ? parsedGap : NotFound\n\t}\n\n\tif (segments.length !== 2) return NotFound\n\tconst [columnGap, rowGap] = segments as [string, string]\n\n\tconst parsedColumnGap = parseFloat(columnGap)\n\tif (!isNumber(parsedColumnGap)) return NotFound\n\n\tconst parsedRowGap = parseFloat(rowGap)\n\tif (parsedColumnGap !== parsedRowGap) return Mixed\n\n\treturn parsedColumnGap\n}\n\nfunction getVariableType(gapAxis: GapAxis): readonly VariableType[] | VariableType {\n\tif (gapAxis === \"both\") return supportedVariableTypesGapPreferred\n\treturn supportedVariableTypesNumberPreferred\n}\n\nfunction getVariableCreationType(gapAxis: GapAxis): VariableType | undefined {\n\tif (gapAxis === \"both\") return ControlType.Gap\n\treturn ControlType.Number\n}\n\nfunction canSetAsDefault(gap: ReducedLayout[\"gap\"]) {\n\tconst commonNumericGap = getCommonNumericGap(gap)\n\treturn isNumber(commonNumericGap)\n}\n\ninterface GapRowProps extends Pick<ReducedLayout, \"gap\" | \"gapAxis\" | \"columnGap\" | \"rowGap\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const GapRow = ({ nodeIds, gap, rowGap, columnGap, gapAxis }: GapRowProps) => {\n\tconst gapHandler = useLayoutUpdate(\"gap\", nodeIds)\n\n\tconst updateGapShorthand = useEngineCallback(\n\t\t(update: (current: TwoPixelNumberShorthand) => TwoPixelNumberShorthand) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withLayout)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tlet currentGap: TwoPixelNumberShorthand\n\t\t\t\tif (isDynamicValue(node.gap)) {\n\t\t\t\t\tcurrentGap = \"0px\"\n\t\t\t\t} else if (isNumber(node.gap)) {\n\t\t\t\t\tcurrentGap = `${node.gap}px`\n\t\t\t\t} else {\n\t\t\t\t\tcurrentGap = node.gap ?? \"0px\"\n\t\t\t\t}\n\t\t\t\tconst newGap = update(currentGap)\n\t\t\t\tnode.set({ gap: newGap })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst { onCreateVariable, onRemoveDynamicValue, onSelectComputedValue, onSelectVariableReference } =\n\t\tuseDynamicLayoutValueUpdate(\n\t\t\ttype => {\n\t\t\t\tif (type === ControlType.Number) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: ControlType.Number,\n\t\t\t\t\t\tname: \"gap\",\n\t\t\t\t\t\tinitialValue: getGapWithFallback(gapAxis === \"x\" ? columnGap : rowGap),\n\t\t\t\t\t\toptions: { min: 0 },\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\ttype: ControlType.Gap,\n\t\t\t\t\tname: \"gap\",\n\t\t\t\t\tinitialValue: isString(gap) ? gap : \"0px\",\n\t\t\t\t}\n\t\t\t},\n\t\t\tgapPopoutId,\n\t\t\tgapHandler,\n\t\t\tgetGapWithFallback,\n\t\t)\n\n\tconst updateDefault = useEngineCallback(() => {\n\t\tconst commonNumericGap = getCommonNumericGap(gap)\n\t\tif (!isNumber(commonNumericGap)) return\n\t\tengine.stores.persistedUserDefaults.layoutGap = commonNumericGap\n\t}, [gap])\n\n\tif (isNotFound(gap) || isNotFound(gapAxis)) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Gap\"\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\ttraitTypeKeys={gapTraitKeys}\n\t\t\tvariableType={getVariableType(gapAxis)}\n\t\t\tvariableCreationType={getVariableCreationType(gapAxis)}\n\t\t\tdynamicValue={isDynamicValue(gap) ? gap : null}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonSelectVariable={onSelectVariableReference}\n\t\t\tcomputedValuePopoutId={gapPopoutId}\n\t\t\tonSetAsDefault={updateDefault}\n\t\t\tsetAsDefaultVisible={canSetAsDefault(gap)}\n\t\t>\n\t\t\t{isDynamicValue(gap) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Gap\"\n\t\t\t\t\tvalue={gap}\n\t\t\t\t\tpopoutId={gapPopoutId}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={supportedVariableTypesNumberPreferred}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={gapHandler}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"gap\")}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<GapInput\n\t\t\t\t\tidForFocus={FocusedPropertyInputId.Gap}\n\t\t\t\t\tcolumnGap={columnGap}\n\t\t\t\t\trowGap={rowGap}\n\t\t\t\t\tactiveGapAxis={gapAxis}\n\t\t\t\t\tonChange={updateGapShorthand}\n\t\t\t\t\tcolumnGapTestId=\"layoutpanel-column-gap-input\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import {\n\tIconAlignCenter,\n\tIconAlignLeft,\n\tIconAlignRight,\n\tIconDots,\n\tNumberInputWithTicker,\n\tNumberInputWithTickerAndStepper,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { Experiment, useExperimentIsOn } from \"app/experiments.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { adjustedRectForConversionToFixedSize } from \"document/models/CanvasTree/nodes/utils/adjustedRectForConversionToFixedSize.ts\"\nimport { convertCollapsibleGridChildrenToFixedSize } from \"document/models/CanvasTree/nodes/utils/convertCollapsibleGridChildrenToFixedSize.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport { isGridComponent } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport type { GridItemAlignment } from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport { withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport {\n\ttype GridContentAlignment,\n\ttype GridType,\n\ttype WithLayout,\n\tcolumnMasonryGridType,\n} from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { type WithPins, isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isNonDeterministic } from \"document/models/CanvasTree/traits/utils/NonDeterministic.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedGridLayout } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\nimport type { ReducedPadding } from \"document/models/CanvasTree/traits/utils/reducePadding.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { layoutDefaults } from \"document/utils/LayoutDefaults.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isRepeatedItem } from \"utils/repeaterUtils.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { GapRow } from \"./GapRow.tsx\"\nimport { PaddingRow } from \"./PaddingRow.tsx\"\nimport { useLayoutUpdate } from \"./utils/useLayoutUpdate.ts\"\n\nconst gridItemAlignments: GridItemAlignment[] = [\"start\", \"center\", \"end\"]\n\ninterface GridLayoutRowsProps extends ReducedGridLayout, ReducedPadding {\n\tnodeIds: NodeID[]\n\theightTypes: Set<DimensionType>\n}\n\nconst gridTypeKey: (keyof WithLayout)[] = [\"gridType\"]\nconst gridColumnCountKey: (keyof WithLayout)[] = [\"gridColumnCount\"]\nconst gridRowCountKey: (keyof WithLayout)[] = [\"gridRowCount\"]\n\nexport function GridLayoutRows(props: GridLayoutRowsProps) {\n\tconst { nodeIds, gridColumnCount, computedRowCount, gridRowCount, gap, gapAxis, columnGap, rowGap, gridType } = props\n\n\tconst gridColumnCountHandler = useLayoutUpdate(\"gridColumnCount\", nodeIds)\n\tconst gridRowCountHandler = useLayoutUpdate(\"gridRowCount\", nodeIds)\n\tconst gridTypeHandler = useLayoutUpdate(\"gridType\", nodeIds)\n\n\tconst handleGridTypeChange = useEngineCallback(\n\t\t(value: GridType | undefined) => {\n\t\t\tif (value === columnMasonryGridType) {\n\t\t\t\tprepareParentAndChildrenForColumnMasonry(nodeIds)\n\t\t\t\trecord(\"layout_stack\", { source: \"stack_layout_panel\", layoutType: \"masonry\" })\n\t\t\t}\n\t\t\tgridTypeHandler(value)\n\t\t},\n\t\t[nodeIds, gridTypeHandler],\n\t)\n\n\tlet displayRows = gridRowCount\n\tif (isNumber(computedRowCount) && !isMixed(displayRows)) {\n\t\tdisplayRows = Math.max(computedRowCount, isNumber(gridRowCount) ? gridRowCount : 0)\n\t}\n\n\tconst hasMasonry = gridType === columnMasonryGridType\n\n\treturn (\n\t\t<>\n\t\t\t<Experiment isOn=\"masonryLayout\">\n\t\t\t\t<PanelRow traitTypeKeys={gridTypeKey} title={Dictionary.Masonry}>\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={columnMasonryGridType}\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={hasMasonry}\n\t\t\t\t\t\t\tonSelect={handleGridTypeChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={undefined}\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={!hasMasonry}\n\t\t\t\t\t\t\tonSelect={handleGridTypeChange}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t</Experiment>\n\t\t\t{(isNumber(gridColumnCount) || isMixed(gridColumnCount)) && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow traitTypeKeys={gridColumnCountKey} title={Dictionary.Columns}>\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tvalue={gridColumnCount}\n\t\t\t\t\t\t\tonChange={gridColumnCountHandler}\n\t\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\t\tdefaultValue={layoutDefaults.gridColumnCount}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t{!isNonDeterministic(computedRowCount) && !hasMasonry && (\n\t\t\t\t\t\t<PanelRow traitTypeKeys={gridRowCountKey} title={Dictionary.Rows}>\n\t\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\t\tvalue={notFoundToUndefined(displayRows)}\n\t\t\t\t\t\t\t\tonChange={gridRowCountHandler}\n\t\t\t\t\t\t\t\tmin={isNumber(computedRowCount) ? computedRowCount : 1}\n\t\t\t\t\t\t\t\tdefaultValue={layoutDefaults.gridRowCount}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<GapRow nodeIds={nodeIds} gap={gap} gapAxis={gapAxis} columnGap={columnGap} rowGap={rowGap} />\n\t\t\t<PaddingRow\n\t\t\t\tpadding={props.padding}\n\t\t\t\tpaddingPerSide={props.paddingPerSide}\n\t\t\t\tpaddingBottom={props.paddingBottom}\n\t\t\t\tpaddingLeft={props.paddingLeft}\n\t\t\t\tpaddingRight={props.paddingRight}\n\t\t\t\tpaddingTop={props.paddingTop}\n\t\t\t\tnodeIds={props.nodeIds}\n\t\t\t\tonlyFormInputNodes={false}\n\t\t\t/>\n\t\t\t{!hasMasonry && (\n\t\t\t\t<PanelRow title=\" \">\n\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\tid=\"advancedLayout\"\n\t\t\t\t\t\tpopout={<Popout {...props} />}\n\t\t\t\t\t\tnavigationTitle=\"Advanced Layout\"\n\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\ttitle=\"Advanced\"\n\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t<IconDots />\n\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\n/**\n * Helper function to prepare column masonry children. Fixed or auto sizing is preferred over relative sizing in order\n * to allow for correct distribution of children in columns when switching to masonry layout.\n * @param nodeIds - IDs of the nodes with column masonry layout whose children should be prepared.\n * @returns void\n */\nfunction prepareParentAndChildrenForColumnMasonry(nodeIds: NodeID[]) {\n\tfor (const id of nodeIds) {\n\t\tconst grid = engine.tree.get(id)\n\t\tif (!grid || !isGridComponent(grid)) continue\n\n\t\tfor (const child of grid.children) {\n\t\t\tif (!isPinnable(child)) continue\n\n\t\t\tif (isRepeatedItem(engine.tree, child)) {\n\t\t\t\tchild.set({\n\t\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Skipping children that would already be auto-sized based on their content\n\t\t\tif (child.heightType === DimensionType.Auto || child.heightType === DimensionType.FitImage) continue\n\n\t\t\tconst rect = adjustedRectForConversionToFixedSize(child, engine.tree)\n\n\t\t\tconst baseUpdate: Pick<WithPins, \"heightType\" | \"height\"> = {\n\t\t\t\theightType: DimensionType.FixedNumber,\n\t\t\t\theight: rect.height,\n\t\t\t}\n\n\t\t\tif (withGridItemSize(child)) {\n\t\t\t\tchild.set({\n\t\t\t\t\t...baseUpdate,\n\t\t\t\t\t// Clear the fill-height flag so the node panel reflects the correct height type\n\t\t\t\t\tgridItemFillCellHeight: undefined,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tchild.set(baseUpdate)\n\t\t}\n\n\t\t// Reset column count to a valid value that would cause the column count UI to be shown for masonry grids\n\t\tconst currentColumnCount = grid.gridColumnCount\n\t\tconst keepCurrentColumnCount = isNumber(currentColumnCount)\n\n\t\tconst rect = engine.tree.getRect(grid)\n\n\t\tgrid.set({\n\t\t\theightType: DimensionType.Auto,\n\t\t\tgridColumnCount: keepCurrentColumnCount ? currentColumnCount : layoutDefaults.gridColumnCount,\n\t\t\twidthType: DimensionType.FixedNumber,\n\t\t\twidth: rect.width,\n\t\t})\n\t}\n}\n\nfunction updateGridChildrenToFixedSize(nodeIds: NodeID[]) {\n\tfor (const id of nodeIds) {\n\t\tconst grid = engine.tree.get(id)\n\t\tif (!grid || !isGridComponent(grid)) continue\n\n\t\t// When setting grid row height to 'fit', children cannot have heights\n\t\t// relative to the cells, since the cell height is determined by the\n\t\t// largest cell item. To work around this, setting row height to fit\n\t\t// sets all children to a fixed size based on their measured rect.\n\t\tfor (const child of grid.children) {\n\t\t\tif (!isPinnable(child)) continue\n\t\t\tif (child.heightType !== DimensionType.Percentage && child.heightType !== DimensionType.FractionOfFreeSpace) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// A layer with aspect ratio lock may have a relative height, but\n\t\t\t// for the purposes of the grid, its height is considered to be\n\t\t\t// based on its width and aspect-ratio.\n\t\t\tif (withAspectRatio(child) && isNumber(child.aspectRatio)) continue\n\n\t\t\tconst rect = adjustedRectForConversionToFixedSize(child, engine.tree)\n\t\t\tchild.set({ heightType: DimensionType.FixedNumber, height: rect.height })\n\t\t}\n\t}\n}\n\nfunction Popout(props: GridLayoutRowsProps) {\n\tconst {\n\t\tnodeIds,\n\t\tgridColumnCount,\n\t\theightTypes,\n\t\tgridAlignment,\n\t\tgridColumnWidthType,\n\t\tgridColumnWidth,\n\t\tgridColumnMinWidth,\n\t\tgridRowHeightType,\n\t} = props\n\n\tconst commonHeightType = commonValue(heightTypes)\n\tconst gridAlignmentHandler = useLayoutUpdate(\"gridAlignment\", nodeIds)\n\tconst gridColumnWidthTypeHandler = useLayoutUpdate(\"gridColumnWidthType\", nodeIds)\n\tconst gridColumnWidthHandler = useLayoutUpdate(\"gridColumnWidth\", nodeIds)\n\tconst gridColumnMinWidthHandler = useLayoutUpdate(\"gridColumnMinWidth\", nodeIds)\n\tconst gridRowHeightTypeHandler = useLayoutUpdate(\"gridRowHeightType\", nodeIds)\n\tconst gridRowHeightHandler = useLayoutUpdate(\"gridRowHeight\", nodeIds)\n\tconst gridColumnCountHandler = useLayoutUpdate(\"gridColumnCount\", nodeIds)\n\tconst gridRowHeightAutoEnabled = useExperimentIsOn(\"gridBentoFill\") || commonHeightType !== DimensionType.Auto\n\tconst gridCollapseMacrosExperiment = useExperimentIsOn(\"gridCollapseMacros\")\n\tconst displayRowHeightInput = gridRowHeightType === \"fixed\"\n\tconst hasFixedColumnCount = isNumber(gridColumnCount)\n\n\tconst setFillContainerHandler = engine.scheduler.wrapHandler(() => {\n\t\tif (gridCollapseMacrosExperiment) {\n\t\t\tconst gridsToConvert = nodeIds.filter(id => {\n\t\t\t\tconst grid = engine.tree.get(id)\n\t\t\t\tif (!grid || !isGridComponent(grid)) return false\n\t\t\t\tif (grid.heightType !== DimensionType.Auto) return false\n\t\t\t\treturn couldCollapse(grid, { gridRowHeightType: \"auto\" })\n\t\t\t})\n\t\t\tconvertCollapsibleGridChildrenToFixedSize(gridsToConvert)\n\t\t}\n\t\tgridRowHeightTypeHandler(\"auto\")\n\t})\n\n\tconst setFitContentHandler = engine.scheduler.wrapHandler(() => {\n\t\tupdateGridChildrenToFixedSize(nodeIds)\n\t\tgridRowHeightTypeHandler(\"fit\")\n\t})\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title={Dictionary.Columns}>\n\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t<SegmentedControlItem<WithLayout[\"gridColumnCount\"]>\n\t\t\t\t\t\tidentifier=\"auto-fill\"\n\t\t\t\t\t\ttitle={Dictionary.Auto}\n\t\t\t\t\t\tselected={!hasFixedColumnCount}\n\t\t\t\t\t\tonSelect={gridColumnCountHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={3}\n\t\t\t\t\t\ttitle=\"Fixed\"\n\t\t\t\t\t\tselected={hasFixedColumnCount}\n\t\t\t\t\t\tonSelect={gridColumnCountHandler}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Width\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(gridColumnWidthType === \"minmax\" ? gridColumnMinWidth : gridColumnWidth)}\n\t\t\t\t\tonChange={gridColumnWidthType === \"minmax\" ? gridColumnMinWidthHandler : gridColumnWidthHandler}\n\t\t\t\t\tmin={1}\n\t\t\t\t/>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"minmax\"\n\t\t\t\t\t\ttitle={Dictionary.Min}\n\t\t\t\t\t\tselected={gridColumnWidthType === \"minmax\"}\n\t\t\t\t\t\tonSelect={gridColumnWidthTypeHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"fixed\"\n\t\t\t\t\t\ttitle=\"Fixed\"\n\t\t\t\t\t\tselected={gridColumnWidthType === \"fixed\"}\n\t\t\t\t\t\tonSelect={gridColumnWidthTypeHandler}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Height\">\n\t\t\t\t{displayRowHeightInput && (\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tmin={1}\n\t\t\t\t\t\tvalue={notFoundToUndefined(props.gridRowHeight)}\n\t\t\t\t\t\tonChange={gridRowHeightHandler}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<PopupButton wrapperClassName={displayRowHeightInput ? undefined : doubleColumnClass}>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\ttitle={Dictionary.Mixed}\n\t\t\t\t\t\tenabled={false}\n\t\t\t\t\t\tvisible={isMixed(gridRowHeightType)}\n\t\t\t\t\t\tselected={isMixed(gridRowHeightType)}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"fixed\"\n\t\t\t\t\t\ttitle=\"Fixed\"\n\t\t\t\t\t\tselected={gridRowHeightType === \"fixed\"}\n\t\t\t\t\t\tonSelect={gridRowHeightTypeHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"auto\"\n\t\t\t\t\t\ttitle=\"Fill Container\"\n\t\t\t\t\t\tenabled={gridRowHeightAutoEnabled}\n\t\t\t\t\t\tselected={gridRowHeightType === \"auto\"}\n\t\t\t\t\t\tonSelect={setFillContainerHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tidentifier=\"fit\"\n\t\t\t\t\t\ttitle={Dictionary.FitContent}\n\t\t\t\t\t\tselected={gridRowHeightType === \"fit\"}\n\t\t\t\t\t\tonSelect={setFitContentHandler}\n\t\t\t\t\t/>\n\t\t\t\t</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t{(gridColumnWidthType === \"fixed\" || hasFixedColumnCount) && (\n\t\t\t\t<PanelRow title=\"Align\">\n\t\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t\t{gridItemAlignments.map(alignment => {\n\t\t\t\t\t\t\tconst Icon = gridAlignmentIcon(alignment)\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\tkey={alignment}\n\t\t\t\t\t\t\t\t\tidentifier={alignment}\n\t\t\t\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\t\t\t\tselected={gridAlignment === alignment}\n\t\t\t\t\t\t\t\t\tonSelect={gridAlignmentHandler}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Icon />\n\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction gridAlignmentIcon(alignment: GridContentAlignment) {\n\tswitch (alignment) {\n\t\tcase \"start\":\n\t\t\treturn IconAlignLeft\n\t\tcase \"center\":\n\t\t\treturn IconAlignCenter\n\t\tcase \"end\":\n\t\t\treturn IconAlignRight\n\t}\n}\n", "import {\n\tIconDirectionHorizontal,\n\tIconDirectionVertical,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport { stackAlignmentIcon } from \"document/components/chrome/properties/utils/alignmentSegmentedControlIcons.tsx\"\nimport {\n\tapplySizeConstraintToChildren,\n\tconvertChildrenToFixedSizeAlongDimension,\n} from \"document/components/tools/utils/stackCreateHelper.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport {\n\tstackAlignments as alignments,\n\tdefaultStackAlignment,\n\tdefaultStackDirection,\n\tdefaultStackDistribution,\n\tstackDistributions as distributions,\n\tisStackAlignment,\n\tisStackDirection,\n\tisStackDistribution,\n\ttoFlexAlign,\n\ttoFlexDirection,\n\ttoFlexJustify,\n\ttoStackDirection,\n\ttoStackDistribution,\n\twithLayout,\n} from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { ReducedStackLayout } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\nimport type { ReducedPadding } from \"document/models/CanvasTree/traits/utils/reducePadding.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport {\n\tstackAlignmentVariableDefinition,\n\tstackDirectionVariableDefinition,\n\tstackDistributionVariableDefinition,\n} from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { StackAlignment, StackDirection, StackDistribution } from \"library/components/Stack/types.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { GapRow } from \"./GapRow.tsx\"\nimport { PaddingRow } from \"./PaddingRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeaderWithTraits } from \"./PanelSectionHeaderWithTraits.tsx\"\nimport { IconAgentStackDirectionHorizontal } from \"./icons/IconAgentStackDirectionHorizontal.tsx\"\nimport { IconAgentStackDirectionVertical } from \"./icons/IconAgentStackDirectionVertical.tsx\"\nimport { useDynamicLayoutValueUpdate } from \"./utils/useDynamicLayoutValueUpdate.ts\"\nimport { useLayoutUpdate } from \"./utils/useLayoutUpdate.ts\"\n\nconst distributionTraitKeys: (keyof WithLayout)[] = [\"stackDistribution\"]\nconst alignmentTraitKeys: (keyof WithLayout)[] = [\"stackAlignment\"]\nconst directionTraitKeys: (keyof WithLayout)[] = [\"stackDirection\"]\nconst wrapTraitKeys: (keyof WithLayout)[] = [\"stackWrapEnabled\"]\n\ninterface StackLayoutRowsProps extends ReducedStackLayout, ReducedPadding {\n\tnodeIds: NodeID[]\n\tanyNodeWithTickerEffect: boolean\n}\n\nexport function StackLayoutRows(props: StackLayoutRowsProps) {\n\tconst {\n\t\tstackDirection,\n\t\tstackDistribution,\n\t\tstackWrapEnabled,\n\t\tstackAlignment,\n\t\tgap,\n\t\tgapAxis,\n\t\tcolumnGap,\n\t\trowGap,\n\t\tnodeIds,\n\t\tanyNodeWithTickerEffect,\n\t} = props\n\n\tconst stackWrapHandler = useLayoutUpdate(\"stackWrapEnabled\", nodeIds)\n\n\treturn (\n\t\t<>\n\t\t\t<DirectionRow nodeIds={nodeIds} stackDirection={stackDirection} />\n\t\t\t{!anyNodeWithTickerEffect && <DistributionRow nodeIds={nodeIds} stackDistribution={stackDistribution} />}\n\t\t\t<AlignmentRow nodeIds={nodeIds} stackAlignment={stackAlignment} stackDirection={stackDirection} />\n\t\t\t{!anyNodeWithTickerEffect && (\n\t\t\t\t<PanelRow title=\"Wrap\" traitTypeKeys={wrapTraitKeys}>\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={stackWrapEnabled === true}\n\t\t\t\t\t\t\tonSelect={stackWrapHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={stackWrapEnabled === false}\n\t\t\t\t\t\t\tonSelect={stackWrapHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{shouldDisplayGap(stackDistribution, stackWrapEnabled) && (\n\t\t\t\t<GapRow nodeIds={nodeIds} gap={gap} gapAxis={gapAxis} columnGap={columnGap} rowGap={rowGap} />\n\t\t\t)}\n\t\t\t{!anyNodeWithTickerEffect && (\n\t\t\t\t<PaddingRow\n\t\t\t\t\tpadding={props.padding}\n\t\t\t\t\tpaddingPerSide={props.paddingPerSide}\n\t\t\t\t\tpaddingBottom={props.paddingBottom}\n\t\t\t\t\tpaddingLeft={props.paddingLeft}\n\t\t\t\t\tpaddingRight={props.paddingRight}\n\t\t\t\t\tpaddingTop={props.paddingTop}\n\t\t\t\t\tnodeIds={props.nodeIds}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nconst stackTraitTypes = [TraitType.Padding, TraitType.Layout]\n\n/**\n * Layout Template variant show a reduced layout panel.\n */\nexport function LayoutTemplateBreakpointLayoutPanel(\n\tprops: Omit<\n\t\tStackLayoutRowsProps,\n\t\t\"stackDirection\" | \"stackDistribution\" | \"stackWrapEnabled\" | \"anyNodeWithTickerEffect\"\n\t>,\n) {\n\tconst {\n\t\tstackAlignment,\n\t\tgap,\n\t\tgapAxis,\n\t\tcolumnGap,\n\t\trowGap,\n\t\tnodeIds,\n\t\tpadding,\n\t\tpaddingPerSide,\n\t\tpaddingBottom,\n\t\tpaddingLeft,\n\t\tpaddingRight,\n\t\tpaddingTop,\n\t} = props\n\n\treturn (\n\t\t<Panel header={<PanelSectionHeaderWithTraits traits={stackTraitTypes} title={Dictionary.Layout} />}>\n\t\t\t<AlignmentRow nodeIds={nodeIds} stackAlignment={stackAlignment} stackDirection=\"vertical\" />\n\t\t\t<GapRow nodeIds={nodeIds} gap={gap} gapAxis={gapAxis} columnGap={columnGap} rowGap={rowGap} />\n\t\t\t<PaddingRow\n\t\t\t\tpadding={padding}\n\t\t\t\tpaddingPerSide={paddingPerSide}\n\t\t\t\tpaddingBottom={paddingBottom}\n\t\t\t\tpaddingLeft={paddingLeft}\n\t\t\t\tpaddingRight={paddingRight}\n\t\t\t\tpaddingTop={paddingTop}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\t\t</Panel>\n\t)\n}\n\nfunction getStackDirectionValueWithFallback(value: unknown): StackDirection {\n\treturn isStackDirection(value) ? value : defaultStackDirection\n}\n\nfunction flexDirectionToStackDirectionWithFallback(value: unknown): StackDirection {\n\treturn getStackDirectionValueWithFallback(toStackDirection(value))\n}\n\nconst stackDirectionPopoutId = \"stack-direction-popout\"\n\nconst directionControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"stackDirection\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface DirectionRowProps extends Pick<ReducedStackLayout, \"stackDirection\"> {\n\tnodeIds: NodeID[]\n}\n\nconst DirectionRow = ({ nodeIds, stackDirection }: DirectionRowProps) => {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst stackDirectionHandler = useEngineCallback(\n\t\t(value: StackDirection | DynamicValue) => {\n\t\t\tengine.tree.getNodes(nodeIds).forEach(node => {\n\t\t\t\tif (!withLayout(node) || !isPinnable(node)) return\n\n\t\t\t\t// If the direction is changed to dynamic, we apply size constraints to the child node to avoid the\n\t\t\t\t// stack from collapsing.\n\t\t\t\tif (!isDynamicValue(stackDirection) && isDynamicValue(value)) {\n\t\t\t\t\tif (node.widthType === DimensionType.Auto || node.heightType === DimensionType.Auto) {\n\t\t\t\t\t\tapplySizeConstraintToChildren(engine.tree, node)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// When switching direction we can run into a situation where\n\t\t\t\t\t// a child that was previously set to \"Fraction\" / \"Fill\" on a\n\t\t\t\t\t// cross axis now finds itself with the same dimension type\n\t\t\t\t\t// along a main axis, which isn't supported. To avoid this, we\n\t\t\t\t\t// convert all fractional/percentage children to \"Fixed\" on the\n\t\t\t\t\t// auto-sized axis when switching direction.\n\t\t\t\t\tif (node.widthType === DimensionType.Auto && value === \"horizontal\") {\n\t\t\t\t\t\tconvertChildrenToFixedSizeAlongDimension(engine.tree, \"width\", node)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (node.heightType === DimensionType.Auto && value === \"vertical\") {\n\t\t\t\t\t\tconvertChildrenToFixedSizeAlongDimension(engine.tree, \"height\", node)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnode.set({ stackDirection: value })\n\t\t\t})\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\t},\n\t\t[nodeIds, stackDirection],\n\t)\n\n\tconst { onCreateVariable, onRemoveDynamicValue, onSelectVariableReference, onSelectComputedValue } =\n\t\tuseDynamicLayoutValueUpdate(\n\t\t\t{\n\t\t\t\t...stackDirectionVariableDefinition,\n\t\t\t\tinitialValue: toFlexDirection(getStackDirectionValueWithFallback(stackDirection)),\n\t\t\t},\n\t\t\tstackDirectionPopoutId,\n\t\t\tstackDirectionHandler,\n\t\t\tflexDirectionToStackDirectionWithFallback,\n\t\t)\n\n\tconst handleSelectDirection = (direction: StackDirection) => stackDirectionHandler(direction)\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Direction}\n\t\t\ttraitTypeKeys={directionTraitKeys}\n\t\t\tsupportsVariables\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tdynamicValue={isDynamicValue(stackDirection) ? stackDirection : null}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={onSelectVariableReference}\n\t\t\tcontrolKey={directionControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={directionControlReferenceInfo.controlSourceIdentifier}\n\t\t\tsupportsComputedValues\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tcomputedValuePopoutId={stackDirectionPopoutId}\n\t\t>\n\t\t\t{isDynamicValue(stackDirection) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={Dictionary.Direction}\n\t\t\t\t\tvalue={stackDirection}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonChangeDynamicValue={stackDirectionHandler}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tpopoutId={stackDirectionPopoutId}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"stackDirection\")}\n\t\t\t\t\tcontrolReferenceInfo={directionControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"horizontal\"\n\t\t\t\t\t\ttitle={Dictionary.Horizontal}\n\t\t\t\t\t\tselected={stackDirection === \"horizontal\"}\n\t\t\t\t\t\tonSelect={handleSelectDirection}\n\t\t\t\t\t>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentStackDirectionHorizontal /> : <IconDirectionHorizontal />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier=\"vertical\"\n\t\t\t\t\t\ttitle={Dictionary.Vertical}\n\t\t\t\t\t\tselected={stackDirection === \"vertical\"}\n\t\t\t\t\t\tonSelect={handleSelectDirection}\n\t\t\t\t\t>\n\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentStackDirectionVertical /> : <IconDirectionVertical />}\n\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction getStackDistributionValueWithFallback(value: unknown): StackDistribution {\n\treturn isStackDistribution(value) ? value : defaultStackDistribution\n}\n\nfunction flexDistributionToStackDistributionWithFallback(value: unknown): StackDistribution {\n\treturn getStackDistributionValueWithFallback(toStackDistribution(value))\n}\n\nconst stackDistributionPopoutId = \"stack-distribution-popout\"\n\nconst distributionControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"stackDistribution\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface DistributionRowProps extends Pick<ReducedStackLayout, \"stackDistribution\"> {\n\tnodeIds: NodeID[]\n}\n\nconst DistributionRow = ({ nodeIds, stackDistribution }: DistributionRowProps) => {\n\tconst stackDistributionHandler = useLayoutUpdate(\"stackDistribution\", nodeIds)\n\n\tconst { onCreateVariable, onRemoveDynamicValue, onSelectVariableReference, onSelectComputedValue } =\n\t\tuseDynamicLayoutValueUpdate(\n\t\t\t{\n\t\t\t\t...stackDistributionVariableDefinition,\n\t\t\t\tinitialValue: toFlexJustify(getStackDistributionValueWithFallback(stackDistribution)),\n\t\t\t},\n\t\t\tstackDistributionPopoutId,\n\t\t\tstackDistributionHandler,\n\t\t\tflexDistributionToStackDistributionWithFallback,\n\t\t)\n\n\tconst handleSelectStackDistribution = (identifier: StackDistribution) => stackDistributionHandler(identifier)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Distribute\"\n\t\t\ttraitTypeKeys={distributionTraitKeys}\n\t\t\tsupportsVariables\n\t\t\tdynamicValue={isDynamicValue(stackDistribution) ? stackDistribution : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={onSelectVariableReference}\n\t\t\tcontrolKey={distributionControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={distributionControlReferenceInfo.controlSourceIdentifier}\n\t\t\tsupportsComputedValues\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tcomputedValuePopoutId={stackDistributionPopoutId}\n\t\t>\n\t\t\t{isDynamicValue(stackDistribution) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Distribute\"\n\t\t\t\t\tvalue={stackDistribution}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={stackDistributionHandler}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"stackDistribution\")}\n\t\t\t\t\tpopoutId={stackDistributionPopoutId}\n\t\t\t\t\tcontrolReferenceInfo={distributionControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t\t<PopupButton mixed={isMixed(stackDistribution)} data-testid=\"stacklayoutpanel-distribution-dropdown\">\n\t\t\t\t\t\t{distributions.map(distribution => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={distribution}\n\t\t\t\t\t\t\t\tidentifier={distribution}\n\t\t\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\t\t\tselected={stackDistribution === distribution}\n\t\t\t\t\t\t\t\tonSelect={handleSelectStackDistribution}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction getStackAlignmentValueWithFallback(value: unknown): StackAlignment {\n\treturn isStackAlignment(value) ? value : defaultStackAlignment\n}\n\nfunction flexAlignmentToStackAlignmentWithFallback(value: unknown): StackAlignment {\n\treturn getStackAlignmentValueWithFallback(toFlexAlign(value))\n}\n\nconst stackAlignmentPopoutId = \"stack-alignment-popout\"\n\nconst alignmentControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"stackAlignment\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface AlignmentRowProps extends Pick<ReducedStackLayout, \"stackDirection\" | \"stackAlignment\"> {\n\tnodeIds: NodeID[]\n}\nconst AlignmentRow = ({ nodeIds, stackDirection, stackAlignment }: AlignmentRowProps) => {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst stackAlignmentHandler = useLayoutUpdate(\"stackAlignment\", nodeIds)\n\tconst { onCreateVariable, onRemoveDynamicValue, onSelectVariableReference, onSelectComputedValue } =\n\t\tuseDynamicLayoutValueUpdate(\n\t\t\t{\n\t\t\t\t...stackAlignmentVariableDefinition,\n\t\t\t\tinitialValue: toFlexAlign(getStackAlignmentValueWithFallback(stackAlignment)),\n\t\t\t},\n\t\t\tstackAlignmentPopoutId,\n\t\t\tstackAlignmentHandler,\n\t\t\tflexAlignmentToStackAlignmentWithFallback,\n\t\t)\n\n\tconst handleSelectStackAlignment = (identifier: StackAlignment) => stackAlignmentHandler(identifier)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Align\"\n\t\t\ttraitTypeKeys={alignmentTraitKeys}\n\t\t\tsupportsVariables\n\t\t\tdynamicValue={isDynamicValue(stackAlignment) ? stackAlignment : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonSelectVariable={onSelectVariableReference}\n\t\t\tcontrolKey={alignmentControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={alignmentControlReferenceInfo.controlSourceIdentifier}\n\t\t\tsupportsComputedValues\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tcomputedValuePopoutId={stackAlignmentPopoutId}\n\t\t>\n\t\t\t{isDynamicValue(stackAlignment) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Align\"\n\t\t\t\t\tvalue={stackAlignment}\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\tonChangeDynamicValue={stackAlignmentHandler}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tpopoutId={stackAlignmentPopoutId}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"stackAlignment\")}\n\t\t\t\t\tcontrolReferenceInfo={alignmentControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : isString(stackDirection) ? (\n\t\t\t\t<SegmentedControl className={doubleColumnClass} data-testid=\"stacklayoutpanel-alignment-segmentedcontrol\">\n\t\t\t\t\t{alignments.map(alignment => {\n\t\t\t\t\t\tconst Icon = stackAlignmentIcon(alignment, stackDirection, agentExperimentEnabled)\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tkey={alignment}\n\t\t\t\t\t\t\t\tidentifier={alignment}\n\t\t\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\t\t\tselected={stackAlignment === alignment}\n\t\t\t\t\t\t\t\tonSelect={handleSelectStackAlignment}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{Icon && <Icon />}\n\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</SegmentedControl>\n\t\t\t) : (\n\t\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t\t<PopupButton mixed={isMixed(stackAlignment)} data-testid=\"stacklayoutpanel-alignment-dropdown\">\n\t\t\t\t\t\t{alignments.map(alignment => (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={alignment}\n\t\t\t\t\t\t\t\tidentifier={alignment}\n\t\t\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\t\t\tselected={stackAlignment === alignment}\n\t\t\t\t\t\t\t\tonSelect={handleSelectStackAlignment}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction shouldDisplayGap(\n\tstackDistribution: ReducedStackLayout[\"stackDistribution\"],\n\tstackWrapEnabled: ReducedStackLayout[\"stackWrapEnabled\"],\n): boolean {\n\tif (stackWrapEnabled === true) return true\n\tif (isDynamicValue(stackDistribution)) return true\n\tif (stackDistribution === \"start\" || stackDistribution === \"center\" || stackDistribution === \"end\") return true\n\n\treturn false\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithOverflow,\n\tcompatibleOverflowCounterpart,\n\tisNonClippingOverflowValue,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport {\n\ttype WithTextTruncation,\n\ttextTruncationAddedDefaults,\n\twithTextTruncation,\n} from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\n\nexport function addTextTruncationForNodes(nodeIds: NodeID[]) {\n\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTextTruncation)) {\n\t\tconst update: Partial<WithTextTruncation & WithOverflow> = { ...textTruncationAddedDefaults }\n\n\t\t// If the node supports overflow (as it should), its overflowY value needs to compute to a\n\t\t// clipping value in order for text truncation to work. Unless the property is a dynamic\n\t\t// value, we automatically set overflow to a clipping value.\n\t\tif (withOverflow(node)) {\n\t\t\tif (isNonClippingOverflowValue(node.overflowY)) {\n\t\t\t\t// If overflowY is already set as a non-clipping overflow, set it to the\n\t\t\t\t// compatible clipping counterpart (clip or hidden).\n\t\t\t\tupdate.overflowY = compatibleOverflowCounterpart[node.overflowY]\n\t\t\t} else if (isNonClippingOverflowValue(node.overflow)) {\n\t\t\t\t// Otherwise, if the main overflow is already set as a non-clipping overflow, set\n\t\t\t\t// overflowY to the compatible clipping counterpart (clip or hidden). Another option\n\t\t\t\t// would be to set the overflow directly, but by setting overflowY we can still\n\t\t\t\t// honor the original overflow value.\n\t\t\t\tupdate.overflowY = compatibleOverflowCounterpart[node.overflow]\n\t\t\t} else if (isUndefined(node.overflow)) {\n\t\t\t\t// Default to a clipping overflow. Here we set the main overflow instead of\n\t\t\t\t// overflowY, because in Framer, we prefer the simplicity of the main overflow short-hand.\n\t\t\t\tupdate.overflow = \"clip\"\n\t\t\t}\n\t\t}\n\n\t\tnode.set(update)\n\t}\n\trecord(\"ui_interaction\", { page: Pages.propertyPanel, id: UIInteraction.addTextTruncation })\n}\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { isMixed } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { TextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport {\n\ttextTruncationAddedDefaults,\n\twithTextTruncation,\n} from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { useMemo } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\n\ninterface Props {\n\tnodeIds: NodeID[]\n\ttextTruncation: Reduced<TextTruncation | undefined>\n\tsupportsCopyPaste?: boolean\n\tsupportsVariables?: boolean\n}\n\nexport function TextTruncationRow({\n\tnodeIds,\n\ttextTruncation,\n\tsupportsCopyPaste = false,\n\tsupportsVariables = false,\n}: Props) {\n\tconst isDynamic = isDynamicValue(textTruncation)\n\tconst canCopyTextTruncation = useMemo(\n\t\t() => supportsCopyPaste && isClipboardSupported() && !isMixed(textTruncation),\n\t\t[supportsCopyPaste, textTruncation],\n\t)\n\n\tconst [canPasteTextTruncation, pasteTextTruncation, copyTextTruncation] = useCopyAndPasteSingleProperty(\n\t\tTraitType.TextTruncation,\n\t\tnodeIds,\n\t\tcanCopyTextTruncation,\n\t)\n\n\tconst onChange = useEngineCallback(\n\t\t(value: number | VariableReference) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTextTruncation)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tnode.set({ textTruncation: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst onDelete = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTextTruncation)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ textTruncation: undefined })\n\t\t}\n\t\trecord(\"ui_interaction\", { page: Pages.propertyPanel, id: UIInteraction.removeTextTruncation })\n\t}, [nodeIds])\n\n\tconst onSelectVariable = engine.scheduler.wrapHandler((variableRef: VariableReference) => {\n\t\tif (!supportsVariables) return\n\t\tonChange(variableRef)\n\t})\n\n\tconst onCreateVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tif (!supportsVariables) return\n\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Number,\n\t\t\tname: Dictionary.Truncate,\n\t\t\tinitialValue: getInitialValueForVariable(textTruncation),\n\t\t\toptions: {\n\t\t\t\tmin: 1,\n\t\t\t\tstep: 1,\n\t\t\t\tdisplayStepper: true,\n\t\t\t},\n\t\t})\n\n\t\tif (variableRef) {\n\t\t\tonSelectVariable(variableRef)\n\t\t}\n\t})\n\n\tconst onRemoveDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(textTruncation)) return\n\t\tif (isVariableReference(textTruncation)) {\n\t\t\tconst variableValue = getVariableValue(engine, textTruncation)\n\t\t\tconst truncationValue = isNumber(variableValue) ? Math.max(1, Math.floor(variableValue)) : 1\n\t\t\tonChange(truncationValue)\n\t\t\treturn\n\t\t}\n\t\tonChange(textTruncationAddedDefaults.textTruncation)\n\t})\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Truncate}\n\t\t\tonDelete={onDelete}\n\t\t\tvariableType={ControlType.Number}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tdynamicValue={isDynamic ? textTruncation : null}\n\t\t\tonSelectVariable={onSelectVariable}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\ttraitTypes={[TraitType.TextTruncation]}\n\t\t\tcopyEnabled={canCopyTextTruncation}\n\t\t\tonCopy={supportsCopyPaste ? copyTextTruncation : undefined}\n\t\t\tpasteEnabled={canPasteTextTruncation}\n\t\t\tonPaste={supportsCopyPaste ? pasteTextTruncation : undefined}\n\t\t>\n\t\t\t{isVariableReference(textTruncation) && supportsVariables ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\treference={textTruncation}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={isDynamic ? undefined : notFoundToUndefined(textTruncation)}\n\t\t\t\t\tdefaultValue={1}\n\t\t\t\t\tonChange={onChange}\n\t\t\t\t\tmin={1}\n\t\t\t\t\tstep={1}\n\t\t\t\t\tlabelShort=\"L\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction getInitialValueForVariable(textTruncation: Reduced<TextTruncation | undefined>): number {\n\tif (isNumber(textTruncation)) return textTruncation\n\treturn textTruncationAddedDefaults.textTruncation\n}\n", "import type { AssetService } from \"@framerjs/assets\"\nimport {\n\tIconTextStylePreset,\n\tIconVerticalAlignBottom,\n\tIconVerticalAlignCenter,\n\tIconVerticalAlignTop,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tTranslatable as T,\n\tTextInput,\n} from \"@framerjs/fresco\"\nimport { colors, palette } from \"@framerjs/fresco/tokens\"\nimport { assert, ModuleType, assertNever, isMixed, localModuleIdForStableName, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { needsUpdateToBeCompatibleWithTextStyle } from \"code-generation/textStyleVersion.ts\"\nimport { addTextTruncationForNodes } from \"document/components/chrome/properties/panels/utils/addTextTruncationForNodes.ts\"\nimport { TextTruncationRow } from \"document/components/chrome/properties/rows/TextTruncationRow.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport { isRichTextEditTool } from \"document/components/tools/RichTextEditTool.ts\"\nimport { getClosestToRegularFont } from \"document/components/utils/getClosestToRegularFont.ts\"\nimport {\n\tdetectNaturalLanguageTitleFromValue,\n\tisMultiline,\n} from \"document/components/utils/getNaturalLanguageTitleForValue.ts\"\nimport { recordCornerShapeUpdate } from \"document/components/utils/recordCornerShapeUpdate.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport { applyDefaultPresets } from \"document/models/CanvasTree/nodes/RichTextNode.utils.ts\"\nimport { detachTextStylePresetsFromBreakpoints } from \"document/models/CanvasTree/nodes/utils/detachTextStylePresetsForBreakpoints.ts\"\nimport { type AnyTextNode, isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport {\n\ttype TextStylePresetPrimaryNode,\n\tisInlineCodeStylePresetNode,\n\tisRichTextNode,\n\tisTextNode,\n\tisTextStylePresetNode,\n\tisTextStylePresetPrimaryNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { updateHTMLText } from \"document/models/CanvasTree/nodes/utils/updateHTMLText.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { createComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { createFetchDataValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { cornerShapeDefaultsWhenAdded, cornerShapeTitle } from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { hasLabelTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport {\n\tparagraphSpacingAddedDefaults,\n\tparagraphSpacingDefaults,\n\twithParagraphSpacing,\n} from \"document/models/CanvasTree/traits/WithParagraphSpacing.ts\"\nimport type { WithRichText } from \"document/models/CanvasTree/traits/WithRichText.ts\"\nimport { getRichTextTagName, richTextTags } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { withShadow } from \"document/models/CanvasTree/traits/WithShadow.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { WithTextContent } from \"document/models/CanvasTree/traits/WithTextContent.ts\"\nimport { textFitDefaults } from \"document/models/CanvasTree/traits/WithTextFit.ts\"\nimport type {\n\tFontSize,\n\tLetterSpacing,\n\tLetterSpacingUnit,\n\tLineHeightUnit,\n\tRichTextFontSizeUnit,\n\tTextAlignment,\n\tWithTextStyle,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tfontSizeRoundingPerUnit,\n\tisTextDecoration,\n\tisTextTransform,\n\tisValidFontSizeUnit,\n\ttextBackgroundColorAddedDefault,\n\ttextBackgroundColorFromTextColor,\n\ttextDecorationAddedDefault,\n\ttextStrokeColorAddedDefault,\n\ttextStrokeWidthAddedDefault,\n\ttextStyleDefaults,\n\ttextTransformAddedDefault,\n\ttextTransformDefault,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { hasTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport type { WithTextVerticalAlignment } from \"document/models/CanvasTree/traits/WithTextVerticalAlignment.ts\"\nimport { supportsVerticalAlignment } from \"document/models/CanvasTree/traits/WithTextVerticalAlignment.ts\"\nimport { withTextWrapBalance } from \"document/models/CanvasTree/traits/WithTextWrapBalance.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getDefaultNameForVariable, withVariables } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isBreakpointVariant, isPrimaryVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport {\n\tisFoundAndNotMixed,\n\tisFoundAndNotMixedAndNotUndefined,\n\tisFoundAndNotUndefined,\n\tisNotFound,\n} from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedShadows } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { TextPropertiesBase } from \"document/models/CanvasTree/traits/utils/reduceText.ts\"\nimport type { ReducedTextTruncation } from \"document/models/CanvasTree/traits/utils/reduceTextTruncation.ts\"\nimport {\n\tdisableTextFit,\n\tenableTextFit,\n\tgetRichTextNodesRequiringTextFitUpdates,\n\tupdateTextFitViewBox,\n} from \"document/models/CanvasTree/traits/utils/textFitHelpers.ts\"\nimport type { OpenTypeFeatureTag } from \"document/models/CanvasTree/utils/openType.ts\"\nimport type { VariationAxisTag } from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport {\n\taddDefaultVariationAxesToSelector,\n\taddEncodedAxesToSelector,\n\tgetFontVariableSelectorFromFont,\n\tgetFontVariantChanges,\n\tgetNonVariableFontSelector,\n\tisFontVariable,\n\tupdateVariationAxes,\n} from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { migrateTextToRichTextNode } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { roundedNumber } from \"library/index.ts\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { ReadonlyFont, ReadonlyFontFamily, ReadonlyFontVariationAxes } from \"library/render/fonts/types.ts\"\nimport type { TextVerticalAlignment } from \"library/render/presentation/Text.tsx\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { BackgroundStyles } from \"prosemirror/styles.ts\"\nimport React, { type JSX } from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isShallowEqual } from \"utils/isShallowEqual.ts\"\nimport { isArray, isDefined, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { EngineChange } from \"../../../../EngineChanges.ts\"\nimport { useEngineState } from \"../../../../useEngineState.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { mainFontPopoutId } from \"../../shared/FontPopout/FontPopoutControls.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport { FontRow } from \"../rows/FontRow.tsx\"\nimport { FontSizeRow } from \"../rows/FontSizeRow.tsx\"\nimport { LetterSpacingRow } from \"../rows/LetterSpacingRow.tsx\"\nimport { LineHeightRow } from \"../rows/LineHeightRow.tsx\"\nimport { OpenTypeRow } from \"../rows/OpenTypeRow.tsx\"\nimport { supportsOpenTypeFontFeature } from \"../rows/OpenTypeRow/utils/supportsOpenTypeFontFeature.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { ParagraphSpacingRow, hasParagraphSpacing } from \"../rows/ParagraphSpacingRow.tsx\"\nimport {\n\tSelectNodeAnchorLinkStylePresetRow,\n\taddAnchorLinkStylePreset,\n} from \"../rows/SelectNodeAnchorLinkStylePresetRow.tsx\"\nimport {\n\tSelectNodeBlockquoteStylePresetRow,\n\taddBlockquoteStylePreset,\n} from \"../rows/SelectNodeBlockquoteStylePresetRow.tsx\"\nimport {\n\tSelectNodeInlineCodeStylePresetRow,\n\taddInlineCodeStylePreset,\n\tgetInlineCodeStylePresetsTitle,\n} from \"../rows/SelectNodeInlineCodeStylePresetRow.tsx\"\nimport { SelectNodeLinkStylePresetRow, addLinkStylePreset } from \"../rows/SelectNodeLinkStylePresetRow.tsx\"\nimport {\n\tSelectNodeTextStylePresetRow,\n\taddTextStylePreset,\n\tgetTextStylePresetsTitle,\n} from \"../rows/SelectNodeTextStylePresetRow.tsx\"\nimport { TextAlignmentRow } from \"../rows/TextAlignmentRow.tsx\"\nimport { TextBackgroundColorRow, hasTextBackgroundColor } from \"../rows/TextBackgroundColorRow.tsx\"\nimport { TextBackgroundCornerRows } from \"../rows/TextBackgroundCornerRows.tsx\"\nimport { TextBackgroundPaddingRow } from \"../rows/TextBackgroundPaddingRow.tsx\"\nimport { TextColorRow } from \"../rows/TextColorRow.tsx\"\nimport { TextDecorationRow, hasTextDecoration } from \"../rows/TextDecorationRow.tsx\"\nimport { textStrokePopoutId } from \"../rows/TextStrokePopoutButton.tsx\"\nimport { TextStrokeRow, hasTextStrokeRow } from \"../rows/TextStrokeRow.tsx\"\nimport { TextTransformRow, hasTextTransform } from \"../rows/TextTransformRow.tsx\"\nimport { TextWrapBalanceRow, hasTextWrapBalanceRow } from \"../rows/TextWrapBalanceRow.tsx\"\nimport type { VariableFontPopoutProps } from \"../rows/VariableFontRow/VariableFontPopout.tsx\"\nimport { VariableFontRow } from \"../rows/VariableFontRow/VariableFontRow.tsx\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { shouldUpdateDefaultStyle } from \"../utils/styledText.ts\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { SelectInlineCodeStyleEntityAssetPopout } from \"./SelectInlineCodeStyleEntityAssetPopout.tsx\"\nimport { SelectTextStyleEntityAssetPopout } from \"./SelectTextStyleEntityAssetPopout.tsx\"\nimport { ShadowPanel } from \"./ShadowPanel.tsx\"\nimport { disabled } from \"./TextPanel.styles.ts\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\nimport { addShadowForNodes } from \"./utils/addShadowForNodes.ts\"\nimport { addTextWrapBalanceForNodes } from \"./utils/addTextWrapBalanceForNodes.ts\"\nimport { getTextStylePresetBreakpointsFromTree } from \"./utils/getTextStylePresetBreakpoints.ts\"\nimport { textContentComputedValuePopoutId } from \"./utils/textContentComputedValuePopoutId.ts\"\nimport {\n\tgetFontSizeUnitFromValue,\n\tgetLetterSpacingUnitFromValue,\n\tgetLineHeightDefaultForUnit,\n\tgetLineHeightUnitFromValue,\n\tgetSimilarFontForSelector,\n\tletterSpacingDefaultValue,\n\tsupportedFontSizeUnits,\n} from \"./utils/textStyle.ts\"\n\nconst variableTypes: VariableType[] = [ControlType.String, ControlType.RichText]\nconst textContentTraitTypeKeys: (keyof WithRichText | keyof WithTextContent)[] = [\"htmlContent\", \"textContent\"]\n\nconst verticalAlignmentOptions: readonly TextVerticalAlignment[] = [\"top\", \"center\", \"bottom\"]\nconst verticalAlignmentIcons = [IconVerticalAlignTop, IconVerticalAlignCenter, IconVerticalAlignBottom]\n\ninterface Props\n\textends\n\t\tReducedShadows,\n\t\tReducedTextTruncation,\n\t\tOmit<\n\t\t\tTextPropertiesBase,\n\t\t\t\"autoSize\" | \"anyNodesWithTextFit\" | \"anyNodesWithGradientFill\" | \"anyNodesWithRelativeDates\"\n\t\t> {\n\tnodeIds: NodeID[]\n\tonlyRichTextNodes: boolean\n\treadOnly: boolean\n\t// Shadows\n\texpandedSelectionForShapeStylesIds: NodeID[]\n}\n\ninterface TextPanelOverloads {\n\tonChangeVariationAxis: VariableFontPopoutProps[\"onChange\"]\n}\n\nexport function TextPanel(props: Props) {\n\treturn <TextPanelClassComponent {...props} />\n}\n\nclass TextPanelClassComponent extends React.PureComponent<Props> implements TextPanelOverloads {\n\t/** Tracks the most recently requested font preview selector to avoid race conditions with async font loading */\n\tprivate pendingFontPreviewSelector: string | null = null\n\n\tnodes = () => engine.tree.getNodesWithTrait(this.props.nodeIds, isAnyTextNode)\n\n\tmigrateToRichTextNodesIfNeededAndApplyUpdate = (update: Partial<RichTextNode>) => {\n\t\tconst newSelection = new Set(engine.stores.selectionStore.ids)\n\t\tthis.nodes().forEach(node => {\n\t\t\tif (isRichTextNode(node)) {\n\t\t\t\tnode.set(update)\n\t\t\t} else {\n\t\t\t\tconst migrationInfo = migrateTextToRichTextNode(engine, node)\n\t\t\t\tif (migrationInfo) {\n\t\t\t\t\tengine.tree.get<RichTextNode>(migrationInfo.idToSelect)?.set(update)\n\t\t\t\t\tnewSelection.delete(node.id)\n\t\t\t\t\tnewSelection.add(migrationInfo.idToSelect)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tconst currentSelection = new Set(engine.stores.selectionStore.ids)\n\t\tif (!isShallowEqual(newSelection, currentSelection)) {\n\t\t\tengine.stores.selectionStore.set(newSelection)\n\t\t}\n\t\treturn newSelection\n\t}\n\n\tapplyDefaultPresets = (ids: Set<NodeID>) => {\n\t\t// If we assign a RichText variable we need to set the default\n\t\t// presets on this node so all styles are applied correctly.\n\t\tconst nodes = engine.tree.getNodesWithTrait(ids, isRichTextNode)\n\t\tfor (const node of nodes) {\n\t\t\tapplyDefaultPresets(engine.tree, node)\n\t\t}\n\t}\n\n\tonCreateTextContentVariable = engine.scheduler.wrapHandler((scopeId: NodeID, type: VariableType) => {\n\t\tconst component = engine.stores.scopeStore.active\n\t\tif (!withVariables(component)) return\n\n\t\t// If all of the nodes are descendants of a label group, we try to use\n\t\t// the name `Label` for the variable.\n\t\tconst isLabelDescendant = this.nodes().every(node => !!engine.tree.getAncestorThatMatches(node, hasLabelTag))\n\n\t\tswitch (type) {\n\t\t\tcase ControlType.String: {\n\t\t\t\tconst initialValue = isString(this.props.textContent) ? this.props.textContent : \"text\"\n\t\t\t\tconst name = isLabelDescendant ? Dictionary.Label : detectNaturalLanguageTitleFromValue(initialValue)\n\t\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\t\tengine,\n\t\t\t\t\tscopeId,\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tname,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\toptions: { displayTextArea: isMultiline(initialValue) },\n\t\t\t\t})\n\t\t\t\tif (!variableRef) break\n\t\t\t\tthis.nodes().forEach(node => {\n\t\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\t\tnode.set({ textContent: variableRef, htmlContent: undefined })\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnode.set({ textContent: variableRef })\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.RichText: {\n\t\t\t\tconst textContent = isString(this.props.textContent) ? this.props.textContent : \"text\"\n\t\t\t\tconst initialValue = `<p>${textContent}</p>`\n\t\t\t\tconst name = isLabelDescendant\n\t\t\t\t\t? Dictionary.Label\n\t\t\t\t\t: detectNaturalLanguageTitleFromValue(initialValue, getDefaultNameForVariable(ControlType.RichText))\n\t\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\t\tengine,\n\t\t\t\t\tscopeId,\n\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\tname,\n\t\t\t\t\tinitialValue,\n\t\t\t\t})\n\t\t\t\tif (!variableRef) break\n\n\t\t\t\tconst ids = this.migrateToRichTextNodesIfNeededAndApplyUpdate({\n\t\t\t\t\thtmlContent: variableRef,\n\t\t\t\t\ttextContent: undefined,\n\t\t\t\t\tshadows: undefined,\n\t\t\t\t})\n\t\t\t\tthis.applyDefaultPresets(ids)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t})\n\n\tonChangeDynamicValue = engine.scheduler.wrapHandler((dynamicValue: DynamicValue, outputType: VariableType) => {\n\t\tif (outputType === ControlType.String) {\n\t\t\tthis.migrateToRichTextNodesIfNeededAndApplyUpdate({\n\t\t\t\ttextContent: dynamicValue,\n\t\t\t\thtmlContent: undefined,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tif (outputType === ControlType.RichText) {\n\t\t\tassert(isVariableReference(dynamicValue), \"html content only supports variable references\")\n\t\t\tconst ids = this.migrateToRichTextNodesIfNeededAndApplyUpdate({\n\t\t\t\thtmlContent: dynamicValue,\n\t\t\t\ttextContent: undefined,\n\t\t\t\tshadows: undefined,\n\t\t\t})\n\t\t\tthis.applyDefaultPresets(ids)\n\t\t\treturn\n\t\t}\n\n\t\tthrow Error(`Text only supports string and rich text, received: ${outputType}`)\n\t})\n\n\tonSelectFetchDataValue = () => {\n\t\tconst currentValue = isString(this.props.textContent) ? this.props.textContent : \"\"\n\t\tconst fetchDataValue = createFetchDataValue({ type: ControlType.String, value: currentValue })\n\t\tconst computedValue = createComputedValue(ControlType.String, fetchDataValue, [])\n\t\tthis.onSelectComputedValue(computedValue)\n\n\t\treturn computedValue\n\t}\n\n\tonSelectComputedValue = (computedValue: ComputedValue) => {\n\t\tthis.onChangeDynamicValue(computedValue, computedValue.outputType)\n\t\tpopoutWindow.navigation.presentPopout(textContentComputedValuePopoutId)\n\t}\n\n\tonRemoveTextContentValue = engine.scheduler.wrapHandler(() => {\n\t\tthis.nodes().forEach(node => {\n\t\t\tif (isRichTextNode(node)) {\n\t\t\t\tnode.set({ textContent: undefined, htmlContent: undefined })\n\t\t\t} else {\n\t\t\t\tnode.set({ textContent: undefined })\n\t\t\t}\n\t\t})\n\t})\n\n\tonDetachTextStylePresets = engine.scheduler.wrapHandler(() => {\n\t\tconst presetIds = Array.from(this.props.textStylePresets).filter(isString)\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.nodeIds, isRichTextNode)\n\n\t\tfor (const presetId of presetIds) {\n\t\t\tconst presetNode = engine.tree.getNode(presetId)\n\n\t\t\t// If the preset is missing we can't detach it so we just remove it.\n\t\t\tif (!isTextStylePresetNode(presetNode)) {\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.removeTextStylePreset(presetId, true)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst presetBreakpoints = getTextStylePresetBreakpointsFromTree(engine.tree, presetNode)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tconst groundNode = engine.tree.getGroundNodeFor(node)\n\n\t\t\t\t// If the node is not in a breakpoint, detach using the base\n\t\t\t\t// text style preset.\n\t\t\t\tif (!isBreakpointVariant(groundNode)) {\n\t\t\t\t\tnode.detachTextStylePreset(presetNode, true)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// If the node is a primary breakpoint, detach text styles for all\n\t\t\t\t// rich text node replicas using the correct the breakpoint presets.\n\t\t\t\tif (isPrimaryVariant(groundNode)) {\n\t\t\t\t\tdetachTextStylePresetsFromBreakpoints(engine.tree, groundNode, node, presetBreakpoints, presetNode)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tassert(withSize(groundNode), \"Breakpoints should have sizes\")\n\n\t\t\t\t// If the node is inside a breakpoint that isn't the primary breakpoint,\n\t\t\t\t// detach text styles using only the one specific breakpoint preset.\n\t\t\t\tconst presetBreakpointToDetach =\n\t\t\t\t\t// Breakpoints are reversed so that the smallest width is\n\t\t\t\t\t// matched first.\n\t\t\t\t\t// FIXME: Use `Array.prototype.findLast` when it is available.\n\t\t\t\t\t[...presetBreakpoints]\n\t\t\t\t\t\t.reverse()\n\t\t\t\t\t\t.find(presetBreakpoint => (presetBreakpoint.breakpointWidth ?? 0) > groundNode.width) ?? presetNode\n\n\t\t\t\tnode.detachTextStylePreset(presetBreakpointToDetach, true)\n\t\t\t}\n\t\t}\n\t})\n\n\tonRemoveInlineCode = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.nodeIds, isRichTextNode)\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.removeInlineCode(true)\n\t\t}\n\t})\n\n\tonShowTextMenu = (event: React.MouseEvent, menuItems: MenuItemOptions[]) => {\n\t\tengine.stores.contextMenuStore.show(menuItems, { location: { x: event.clientX, y: event.clientY } })\n\t}\n\n\t/**\n\t * To support nodes that are rendering with a view box, some text panel\n\t * updates need to use a double engine frame to retrieve measurements from\n\t * the canvas with the latest update before updating the view box. This\n\t * method allows callbacks to run through this process in a single undo\n\t * group, preventing the panel from flashing during the intermediate engine\n\t * frame.\n\t */\n\tprivate measuredUpdateHandler = <T extends Function>(cb: T): T => {\n\t\treturn engine.scheduler.wrapHandler(async (...args: unknown[]) => {\n\t\t\tengine.beginUndoGroup()\n\n\t\t\ttry {\n\t\t\t\t// Await the task if its a promise, for instance if we are updating\n\t\t\t\t// the font family or weight.\n\t\t\t\tawait cb(...args)\n\t\t\t\tawait updateTextFitViewBox(engine, getRichTextNodesRequiringTextFitUpdates(engine, this.props.nodeIds))\n\t\t\t} finally {\n\t\t\t\tengine.scheduler.processWhenReady(() => engine.endUndoGroup())\n\t\t\t}\n\t\t}) as unknown as T\n\t}\n\n\tonTextChangeUpdateNodes = this.measuredUpdateHandler((text: string) => {\n\t\tconst nodes = this.nodes()\n\t\tif (engine.stores.toolStore.tool === Tools.RichTextEdit) {\n\t\t\tengine.exitTool()\n\t\t}\n\n\t\tfor (const node of nodes) {\n\t\t\t// Replicas are normally not deleted, but hidden. This is currently aligned with the\n\t\t\t// text tools, but we should consider what to do with replicas with empty text.\n\t\t\t// https://framer-team.slack.com/archives/CR3CYA1D4/p1751541457671449?thread_ts=1751540483.046719&cid=CR3CYA1D4\n\t\t\tif (text === \"\" && !isReplicaOrReplicaChild(node)) {\n\t\t\t\tengine.deleteNode(node.id)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (isTextNode(node)) {\n\t\t\t\tif (node.text === text) continue\n\t\t\t\tnode.set({ styledText: node.styledText.withUpdatedText(text) })\n\t\t\t}\n\n\t\t\tif (isRichTextNode(node)) {\n\t\t\t\tif (node.getTextContent() === text) continue\n\t\t\t\tnode.set({ html: updateHTMLText(node.html, text), textContent: undefined })\n\t\t\t}\n\t\t}\n\t})\n\n\toverride render() {\n\t\tconst {\n\t\t\tnodeIds,\n\t\t\treadOnly,\n\t\t\tonlyNodesWithHTMLContent,\n\t\t\tonlyInEditor,\n\t\t\tanyNodeWithParagraphSpacing,\n\t\t\ttextContent,\n\t\t\tverticalAlignment,\n\t\t\ttextStylePresets,\n\t\t\tassignedTextStylePresets,\n\t\t\tblockquoteStylePresets,\n\t\t\thasAssignedBlockquoteStylePreset,\n\t\t\tlinkStylePresets,\n\t\t\thasAssignedLinkStylePreset,\n\t\t\tanchorLinkStylePresets,\n\t\t\thasAssignedAnchorLinkStylePreset,\n\t\t\tinlineCodeStylePresets,\n\t\t\thasAssignedInlineCodeStylePreset,\n\t\t\tanchorLinkOffsetY,\n\t\t\tonlyRichTextNodes,\n\t\t\ttextTruncation,\n\t\t\t// Text styles\n\t\t\tfonts,\n\t\t\ttextColor,\n\t\t\ttextBackgroundColor,\n\t\t\ttextBackgroundRadius,\n\t\t\ttextBackgroundCornerShape,\n\t\t\ttextBackgroundPadding,\n\t\t\tfontSize,\n\t\t\tfontSizeUnits,\n\t\t\tletterSpacingValue,\n\t\t\tletterSpacingUnits,\n\t\t\ttextTransforms,\n\t\t\ttextDecoration,\n\t\t\ttextDecorationStyle,\n\t\t\ttextDecorationColor,\n\t\t\ttextDecorationThickness,\n\t\t\ttextDecorationOffset,\n\t\t\ttextDecorationSkipInk,\n\t\t\tlineHeightValue,\n\t\t\tlineHeightUnits,\n\t\t\ttextAlignment,\n\t\t\tparagraphSpacing,\n\t\t\tfills,\n\t\t\ttextFitScale,\n\t\t\ttextStrokeWidth,\n\t\t\ttextStrokeColor,\n\t\t\ttextWrapBalance,\n\t\t\topenTypeFontFeatures,\n\t\t\tvariationAxes,\n\t\t\t// Shadows\n\t\t\texpandedSelectionForShapeStylesIds,\n\t\t\tanyNodesWithShadows,\n\t\t\tshadows,\n\t\t\tonlyNodesSupportingShadowSpread,\n\t\t\tonlyNodesSupportingRealisticShadows,\n\t\t\tonlyNodesSupportingShadowInset,\n\t\t} = this.props\n\n\t\tconst isUsingInlineStyles = textStylePresets.has(undefined)\n\t\tconst onlyTextWithoutPresets = textStylePresets.size === 1 && isUsingInlineStyles\n\t\tconst isTextWithTextStylePreset = textStylePresets.size > 1 || !isUsingInlineStyles\n\n\t\tconst displayInlineStyleField = onlyTextWithoutPresets && !onlyNodesWithHTMLContent\n\n\t\tconst hasTextColorOverride =\n\t\t\tisString(textColor) || isMixed(textColor) || [...fills].some(fill => fill !== undefined)\n\n\t\tconst { menuItems, allAddedStylesVisible } = getStyleMenuItems(this.props)\n\n\t\tconst textMenuEnabled = !allAddedStylesVisible && !readOnly\n\t\tconst agentExperimentEnabled = experiments.isOn(\"agent\")\n\n\t\treturn (\n\t\t\t<Panel\n\t\t\t\theader={\n\t\t\t\t\t<PanelSectionHeader\n\t\t\t\t\t\ttitle={<T>Text</T>}\n\t\t\t\t\t\tonMouseDown={textMenuEnabled ? e => this.onShowTextMenu(e, menuItems) : undefined}\n\t\t\t\t\t\tclickable={textMenuEnabled}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!allAddedStylesVisible && (\n\t\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelSectionHeader>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{!onlyNodesWithHTMLContent && (\n\t\t\t\t\t<PanelRow title={Dictionary.Styles}>\n\t\t\t\t\t\t<StylePresetPopoutButtonWithPreview\n\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\tid=\"textStylePreset\"\n\t\t\t\t\t\t\tnavigationTitle=\"Text Styles\"\n\t\t\t\t\t\t\tstylePresetType=\"textStyle\"\n\t\t\t\t\t\t\ttextStylePresets={textStylePresets}\n\t\t\t\t\t\t\tonDelete={isTextWithTextStylePreset ? this.onDetachTextStylePresets : undefined}\n\t\t\t\t\t\t\tpopout={<SelectTextStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={textStylePresets} />}\n\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t<TextStylePresetsIcon presets={textStylePresets} agentExperimentEnabled={agentExperimentEnabled} />\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstrokedIconPreview={agentExperimentEnabled}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\n\t\t\t\t{!onlyNodesWithHTMLContent && onlyInEditor && inlineCodeStylePresets.size > 0 && (\n\t\t\t\t\t<PanelRow title={Dictionary.Code}>\n\t\t\t\t\t\t<StylePresetPopoutButtonWithPreview\n\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\tid=\"inlineCodeStylePreset\"\n\t\t\t\t\t\t\tnavigationTitle=\"Inline Code Styles\"\n\t\t\t\t\t\t\tstylePresetType=\"inlineCodeStyle\"\n\t\t\t\t\t\t\ttextStylePresets={inlineCodeStylePresets}\n\t\t\t\t\t\t\tonDelete={this.onRemoveInlineCode}\n\t\t\t\t\t\t\tpopout={<SelectInlineCodeStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={inlineCodeStylePresets} />}\n\t\t\t\t\t\t\tpreview={<InlineCodeStylePresetsIcon presets={inlineCodeStylePresets} />}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t)}\n\n\t\t\t\t{!onlyInEditor || isDynamicValue(textContent) ? (\n\t\t\t\t\t<PanelRow\n\t\t\t\t\t\ttitle={Dictionary.Content}\n\t\t\t\t\t\ttraitTypeKeys={textContentTraitTypeKeys}\n\t\t\t\t\t\tsupportsVariables={!fontSizeUnits.has(\"auto\")}\n\t\t\t\t\t\tsupportsComputedValues={!fontSizeUnits.has(\"auto\")}\n\t\t\t\t\t\tsupportsFetchDataValues={!fontSizeUnits.has(\"auto\")}\n\t\t\t\t\t\tvariableType={variableTypes}\n\t\t\t\t\t\tonCreateVariable={this.onCreateTextContentVariable}\n\t\t\t\t\t\tonRemoveDynamicValue={this.onRemoveTextContentValue}\n\t\t\t\t\t\tdynamicValue={isDynamicValue(textContent) ? textContent : null}\n\t\t\t\t\t\tonSelectVariable={this.onChangeDynamicValue}\n\t\t\t\t\t\tonSelectComputedValue={this.onSelectComputedValue}\n\t\t\t\t\t\tcomputedValuePopoutId={textContentComputedValuePopoutId}\n\t\t\t\t\t\tonSelectFetchDataValue={this.onSelectFetchDataValue}\n\t\t\t\t\t\tclassName={onlyInEditor ? disabled : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isDynamicValue(textContent) ? (\n\t\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\t\t\tsupportsFetchDataValues\n\t\t\t\t\t\t\t\tsupportsRelativeDates\n\t\t\t\t\t\t\t\ttitle={Dictionary.Content}\n\t\t\t\t\t\t\t\tvalue={textContent}\n\t\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\texpectedType={variableTypes}\n\t\t\t\t\t\t\t\tpopoutId={textContentComputedValuePopoutId}\n\t\t\t\t\t\t\t\tonChangeDynamicValue={this.onChangeDynamicValue}\n\t\t\t\t\t\t\t\tonRemove={this.onRemoveTextContentValue}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\tvalue={isString(textContent) ? textContent : \"\"}\n\t\t\t\t\t\t\t\tonChange={this.onTextChangeUpdateNodes}\n\t\t\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</PanelRow>\n\t\t\t\t) : null}\n\n\t\t\t\t{onlyNodesWithHTMLContent && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{richTextTags.map(tag => (\n\t\t\t\t\t\t\t<React.Fragment key={tag}>\n\t\t\t\t\t\t\t\t{assignedTextStylePresets.has(tag) && (\n\t\t\t\t\t\t\t\t\t<SelectNodeTextStylePresetRow tag={tag} nodeIds={nodeIds} selectedIds={textStylePresets} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{hasAssignedLinkStylePreset && (\n\t\t\t\t\t\t\t<SelectNodeLinkStylePresetRow nodeIds={nodeIds} selectedIds={linkStylePresets} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{hasAssignedBlockquoteStylePreset && (\n\t\t\t\t\t\t\t<SelectNodeBlockquoteStylePresetRow nodeIds={nodeIds} selectedIds={blockquoteStylePresets} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{hasAssignedInlineCodeStylePreset && (\n\t\t\t\t\t\t\t<SelectNodeInlineCodeStylePresetRow nodeIds={nodeIds} selectedIds={inlineCodeStylePresets} />\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t{hasAssignedAnchorLinkStylePreset && (\n\t\t\t\t\t\t\t<SelectNodeAnchorLinkStylePresetRow\n\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\tselectedIds={anchorLinkStylePresets}\n\t\t\t\t\t\t\t\tanchorLinkOffsetY={anchorLinkOffsetY}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && (\n\t\t\t\t\t<FontRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tpopoutIdentifier={mainFontPopoutId}\n\t\t\t\t\t\tselectedFonts={fonts}\n\t\t\t\t\t\tvariationAxes={variationAxes}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChange={this.onChangeFont}\n\t\t\t\t\t\tonChangeFontFamily={this.onChangeFontFamily}\n\t\t\t\t\t\tonHighlightFontFamily={this.onHighlightFontFamily}\n\t\t\t\t\t\tonHighlightEnd={this.onHighlightEnd}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{!onlyNodesWithHTMLContent && (\n\t\t\t\t\t<TextColorRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextColor={textColor}\n\t\t\t\t\t\tfills={fills}\n\t\t\t\t\t\tsupportsVariables\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tsupportsTextFill={onlyRichTextNodes}\n\t\t\t\t\t\tonDelete={!isUsingInlineStyles && hasTextColorOverride ? this.onDeleteTextColorOverride : undefined}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && (\n\t\t\t\t\t<FontSizeRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tfontSize={fontSize}\n\t\t\t\t\t\ttextFitScale={textFitScale}\n\t\t\t\t\t\tonChange={this.onChangeFontSize}\n\t\t\t\t\t\ttestId=\"textpanel-size-input\"\n\t\t\t\t\t\tsupportsVariables\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tunits={this.props.fontSizeUnits}\n\t\t\t\t\t\tonChangeUnit={this.onChangeFontSizeUnit}\n\t\t\t\t\t\tsupportedUnits={supportedRichTextFontSizeUnits(this.props)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && (\n\t\t\t\t\t<LetterSpacingRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tvalue={letterSpacingValue}\n\t\t\t\t\t\tunits={letterSpacingUnits}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChangeValue={this.onChangeLetterSpacingValue}\n\t\t\t\t\t\tonChangeUnit={this.onChangeLetterSpacingUnit}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && (\n\t\t\t\t\t<LineHeightRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tvalue={lineHeightValue}\n\t\t\t\t\t\tunits={lineHeightUnits}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChangeValue={this.onChangeLineHeightValue}\n\t\t\t\t\t\tonChangeUnit={this.onChangeLineHeightUnit}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{!onlyNodesWithHTMLContent && (\n\t\t\t\t\t<TextAlignmentRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextAlignment={textAlignment}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChange={this.onChangeAlignment}\n\t\t\t\t\t\tonDelete={this.onDeleteTextAlignment}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{isString(verticalAlignment) ? (\n\t\t\t\t\t<PanelRow title={\" \"}>\n\t\t\t\t\t\t<SegmentedControl style={doubleColumn} data-testid=\"textpanel-vertical-alignment\">\n\t\t\t\t\t\t\t{verticalAlignmentOptions.map((alignmentOption, idx) => {\n\t\t\t\t\t\t\t\tconst Icon = verticalAlignmentIcons[idx]\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\t\t\tkey={alignmentOption}\n\t\t\t\t\t\t\t\t\t\tidentifier={alignmentOption}\n\t\t\t\t\t\t\t\t\t\ttitle={capitalizeFirstLetter(alignmentOption)}\n\t\t\t\t\t\t\t\t\t\tselected={verticalAlignment === alignmentOption}\n\t\t\t\t\t\t\t\t\t\tonSelect={this.onChangeVerticalAlignment}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{Icon && <Icon />}\n\t\t\t\t\t\t\t\t\t</SegmentedControlItem>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t) : null}\n\n\t\t\t\t{hasTextBackgroundColor(textBackgroundColor) && (\n\t\t\t\t\t<TextBackgroundColorRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tvalue={textBackgroundColor}\n\t\t\t\t\t\tonChange={this.onChangeTextBackgroundColor}\n\t\t\t\t\t\tsupportsDelete\n\t\t\t\t\t\tsupportsVariables\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{isFoundAndNotUndefined(textBackgroundRadius) && (\n\t\t\t\t\t<TextBackgroundCornerRows\n\t\t\t\t\t\ttextBackgroundRadius={textBackgroundRadius}\n\t\t\t\t\t\tonChangeTextBackgroundRadius={this.onChangeTextBackgroundRadius}\n\t\t\t\t\t\ttextBackgroundCornerShape={textBackgroundCornerShape}\n\t\t\t\t\t\tonChangeTextBackgroundCornerShape={this.onChangeTextBackgroundCornerShape}\n\t\t\t\t\t\tsupportsDelete\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{isFoundAndNotUndefined(textBackgroundPadding) && (\n\t\t\t\t\t<TextBackgroundPaddingRow\n\t\t\t\t\t\tvalue={textBackgroundPadding}\n\t\t\t\t\t\tonChange={this.onChangeTextBackgroundPadding}\n\t\t\t\t\t\tsupportsDelete\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{!onlyNodesWithHTMLContent && isArray(shadows) && shadows.length > 0 && (\n\t\t\t\t\t<ShadowPanel\n\t\t\t\t\t\tonlyBreakpointNodes={false}\n\t\t\t\t\t\texpandedSelectionForShapeStylesIds={expandedSelectionForShapeStylesIds}\n\t\t\t\t\t\tanyNodesWithShadows={anyNodesWithShadows}\n\t\t\t\t\t\t// Texts are not shapes\n\t\t\t\t\t\tanyShapeNode={false}\n\t\t\t\t\t\tonlyShapeNodes={false}\n\t\t\t\t\t\tshadows={shadows}\n\t\t\t\t\t\tonlyNodesSupportingShadowSpread={onlyNodesSupportingShadowSpread}\n\t\t\t\t\t\tonlyNodesSupportingRealisticShadows={onlyNodesSupportingRealisticShadows}\n\t\t\t\t\t\tonlyNodesSupportingShadowInset={onlyNodesSupportingShadowInset}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{hasTextStrokeRow(textStrokeWidth, textStrokeColor) && (\n\t\t\t\t\t<TextStrokeRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextStrokeWidth={textStrokeWidth}\n\t\t\t\t\t\ttextStrokeColor={textStrokeColor}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChange={this.onChangeTextStroke}\n\t\t\t\t\t\tonDelete={this.onDeleteTextStroke}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{hasTextWrapBalanceRow(textWrapBalance) && (\n\t\t\t\t\t<TextWrapBalanceRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextWrapBalance={textWrapBalance}\n\t\t\t\t\t\tonChange={this.onChangeTextWrap}\n\t\t\t\t\t\tonDelete={this.onDeleteTextWrap}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t<VariableFontRow\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tfonts={fonts}\n\t\t\t\t\tvariationAxesValues={variationAxes}\n\t\t\t\t\tisPreset={false}\n\t\t\t\t\tonChange={this.onChangeVariationAxis}\n\t\t\t\t\tonDelete={this.onDeleteVariationAxis}\n\t\t\t\t/>\n\n\t\t\t\t{supportsOpenTypeFontFeature(fonts) && (\n\t\t\t\t\t<OpenTypeRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tfonts={fonts}\n\t\t\t\t\t\topenTypeFontFeatures={openTypeFontFeatures}\n\t\t\t\t\t\tonChange={this.toggleOpenTypeFeature}\n\t\t\t\t\t\tonDelete={this.onDeleteOpenTypeFontFeatures}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{onlyRichTextNodes &&\n\t\t\t\t\t(isUsingInlineStyles || onlyNodesWithHTMLContent) &&\n\t\t\t\t\thasParagraphSpacing(paragraphSpacing, anyNodeWithParagraphSpacing) && (\n\t\t\t\t\t\t<ParagraphSpacingRow\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\ttitle={isUsingInlineStyles ? Dictionary.Paragraph : Dictionary.Spacing}\n\t\t\t\t\t\t\tparagraphSpacing={paragraphSpacing}\n\t\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\t\tonChange={this.onChangeParagraphSpacing}\n\t\t\t\t\t\t\tonDelete={this.onDeleteParagraphSpacing}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && hasTextTransform(textTransforms) && (\n\t\t\t\t\t<TextTransformRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextTransforms={textTransforms}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChange={this.onChangeTextTransform}\n\t\t\t\t\t\tonDelete={this.onDeleteTextTransform}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{displayInlineStyleField && hasTextDecoration(textDecoration) && (\n\t\t\t\t\t<TextDecorationRow\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\ttextDecoration={textDecoration}\n\t\t\t\t\t\ttextDecorationStyle={textDecorationStyle}\n\t\t\t\t\t\ttextDecorationColor={textDecorationColor}\n\t\t\t\t\t\ttextDecorationThickness={textDecorationThickness}\n\t\t\t\t\t\ttextDecorationOffset={textDecorationOffset}\n\t\t\t\t\t\ttextDecorationSkipInk={textDecorationSkipInk}\n\t\t\t\t\t\tsupportsCopyPaste\n\t\t\t\t\t\tonChange={this.onChangeTextDecoration}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{hasTextTruncation(textTruncation) && (\n\t\t\t\t\t<TextTruncationRow nodeIds={nodeIds} textTruncation={textTruncation} supportsCopyPaste supportsVariables />\n\t\t\t\t)}\n\t\t\t</Panel>\n\t\t)\n\t}\n\n\tonDeleteTextColorOverride = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.nodeIds, isRichTextNode)\n\t\tfor (const node of nodes) {\n\t\t\tnode.setFill(undefined)\n\t\t\tnode.setTextColor(undefined, true)\n\t\t}\n\t})\n\n\tonChangeFont = this.measuredUpdateHandler(async ({ selector: fontSelector }: ReadonlyFont) => {\n\t\t// Ensure team-owned custom font assets are available in the current workspace\n\t\tthis.duplicateTeamFontAssetIfNeeded(fontSelector)\n\n\t\tawait fontStore.loadFonts([fontSelector])\n\n\t\tconst selectedFont = fontStore.getFontBySelector(fontSelector)\n\n\t\treturn engine.scheduler.processWhenReady(() => {\n\t\t\tconst nodes = this.nodes()\n\t\t\tconst nodeIds = new Set(this.props.nodeIds)\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\t// Don't change replicas if the master is going to change anyway\n\t\t\t\tif (node.originalid && nodeIds.has(node.originalid)) continue\n\n\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\tfontSelector = addDefaultVariationAxesToSelector(\n\t\t\t\t\t\tfontSelector,\n\t\t\t\t\t\tselectedFont?.variationAxes,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tselectedFont?.weight,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnode.setFont(fontSelector, true)\n\t\t\t}\n\n\t\t\tif (shouldUpdateDefaultStyle(nodes)) {\n\t\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.font = fontSelector\n\t\t\t}\n\t\t})\n\t})\n\n\tonChangeFontFamily = this.measuredUpdateHandler(async (fontFamily: ReadonlyFontFamily) => {\n\t\tconst nodeIds = new Set(this.props.nodeIds)\n\t\tconst selectors = new Set<string>()\n\t\tconst defaultFont = getClosestToRegularFont(fontFamily)\n\t\tconst nodes: AnyTextNode[] = []\n\t\tconst changes: [AnyTextNode, string][] = []\n\t\tfor (const node of this.nodes()) {\n\t\t\t// Don't change replicas if the master is going to change anyway\n\t\t\tif (node.originalid && nodeIds.has(node.originalid)) continue\n\t\t\tnodes.push(node)\n\t\t\tconst [font] = node.getFonts(true)\n\t\t\tconst similarFont = getSimilarFontForSelector(font, fontFamily) ?? defaultFont\n\t\t\tselectors.add(similarFont.selector)\n\t\t\tchanges.push([node, similarFont.selector])\n\t\t}\n\n\t\tthis.duplicateTeamFontAssetIfNeeded(defaultFont.selector)\n\n\t\tawait fontStore.loadFonts([...selectors])\n\n\t\treturn engine.scheduler.processWhenReady(() => {\n\t\t\tfor (const [node, font] of changes) {\n\t\t\t\tconst richTextNode = engine.tree.get<RichTextNode>(node.id)\n\t\t\t\tif (!richTextNode) continue\n\n\t\t\t\tconst selectedFont = fontStore.getFontBySelector(font)\n\t\t\t\tconst updatedFontSelector = addDefaultVariationAxesToSelector(\n\t\t\t\t\tfont,\n\t\t\t\t\tselectedFont?.variationAxes,\n\t\t\t\t\trichTextNode,\n\t\t\t\t\tselectedFont?.weight,\n\t\t\t\t)\n\t\t\t\trichTextNode.setFont(updatedFontSelector, true)\n\t\t\t}\n\n\t\t\tconst newDefaultFont = changes[0]?.[1]\n\t\t\tif (shouldUpdateDefaultStyle(nodes) && newDefaultFont) {\n\t\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.font = newDefaultFont\n\t\t\t}\n\t\t})\n\t})\n\n\tonChangeFontSizeUnit = engine.scheduler.wrapHandler(async (newUnit: RichTextFontSizeUnit) => {\n\t\tconst { nodeIds } = this.props\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\n\t\tswitch (newUnit) {\n\t\t\tcase \"auto\": {\n\t\t\t\tengine.beginUndoGroup()\n\t\t\t\tawait enableTextFit(engine, nodeIds)\n\t\t\t\tengine.scheduler.processWhenReady(() => engine.endUndoGroup())\n\t\t\t\trecord(\"font_size_update\", { unit: \"auto\" })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"px\":\n\t\t\tcase \"rem\": {\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tdisableTextFit(engine, node, newUnit)\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(newUnit)\n\t\t}\n\t})\n\n\tonChangeFontSize = engine.scheduler.wrapHandler(async (fontSize: number | VariableReference, rawValue?: string) => {\n\t\tconst nodes = this.nodes()\n\t\tconst unitFromValue = getRichTextFontSizeUnitFromValue(rawValue)\n\t\tconst sharedUnit = commonValue(this.props.fontSizeUnits)\n\t\tconst unit = unitFromValue ?? (isString(sharedUnit) ? sharedUnit : \"px\")\n\t\tconst isNewUnit = unit !== sharedUnit\n\n\t\tif (unitFromValue === \"auto\") {\n\t\t\tengine.beginUndoGroup()\n\t\t\tconst idsToEnable: NodeID[] = []\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (!isRichTextNode(node) || node.textFitViewBoxSize) continue\n\t\t\t\tidsToEnable.push(node.id)\n\t\t\t}\n\n\t\t\tawait enableTextFit(engine, idsToEnable)\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(this.props.nodeIds, isRichTextNode)) {\n\t\t\t\t\tnode.set({ textFitScale: isNumber(fontSize) ? fontSize / 100 : 1 })\n\t\t\t\t\tif (isNewUnit) record(\"font_size_update\", { unit: \"auto\" })\n\t\t\t\t}\n\t\t\t\tengine.endUndoGroup()\n\t\t\t})\n\n\t\t\treturn\n\t\t}\n\n\t\tfor (const node of nodes) {\n\t\t\t// Updating the value on a node that's already using text fit and not switching to another unit\n\t\t\tif (isRichTextNode(node) && isObject(node.textFitViewBoxSize) && !isValidFontSizeUnit(unitFromValue)) {\n\t\t\t\tconst textFitScale = isNumber(fontSize) ? fontSize / 100 : 1\n\t\t\t\tnode.set({ textFitScale })\n\t\t\t\tif (isNewUnit) record(\"font_size_update\", { unit: \"auto\" })\n\t\t\t\trecord(\"text_fit_scale_update\", { scale: textFitScale })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// DraftJS text nodes only support variables for the whole node.\n\t\t\tconst userSelection = isVariableReference(fontSize) ? isRichTextNode(node) : true\n\n\t\t\t// Only RichText nodes support `rem`, which means we need\n\t\t\t// to create the CSS Dimension tuple.\n\t\t\tif (isRichTextNode(node)) {\n\t\t\t\tassert(unit !== \"auto\", \"Font size unit should never be auto\")\n\n\t\t\t\t// We create the FontSize tuple if the value is a number. Otherwise,\n\t\t\t\t// we leave the variable reference as is.\n\t\t\t\tconst updatedFontSize: FontSize | VariableReference = isNumber(fontSize)\n\t\t\t\t\t? [roundedNumber(fontSize, fontSizeRoundingPerUnit[unit]), unit]\n\t\t\t\t\t: fontSize\n\t\t\t\tnode.setFontSize(updatedFontSize, userSelection)\n\t\t\t\tif (isNewUnit) record(\"font_size_update\", { unit })\n\n\t\t\t\t// Remove textFit features.\n\t\t\t\tif (node.textFitViewBoxSize) {\n\t\t\t\t\trecord(\"text_fit_disable\", {})\n\t\t\t\t\tnode.set(textFitDefaults)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// For non-RichText nodes, which only support pixel font sizes.\n\t\t\t\tnode.setFontSize(fontSize, userSelection)\n\t\t\t\tif (isNewUnit) record(\"font_size_update\", { unit: \"px\" })\n\t\t\t}\n\t\t}\n\n\t\tif (isNumber(fontSize) && shouldUpdateDefaultStyle(nodes)) {\n\t\t\tconst unitForDefault = isValidFontSizeUnit(unit) ? unit : \"px\"\n\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.fontSize = createCSSDimension(fontSize, unitForDefault)\n\t\t}\n\t})\n\n\tonChangeLetterSpacingValue = this.measuredUpdateHandler((value: number, rawValue?: string) => {\n\t\tconst nodes = this.nodes()\n\t\tconst sharedUnit = commonValue(this.props.letterSpacingUnits)\n\t\tconst unitFromValue = getLetterSpacingUnitFromValue(rawValue)\n\t\tconst unit = unitFromValue ?? (isString(sharedUnit) ? sharedUnit : \"px\")\n\t\tconst letterSpacing: LetterSpacing = [value, unit]\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.setLetterSpacing(letterSpacing, true)\n\t\t}\n\n\t\tif (shouldUpdateDefaultStyle(nodes)) {\n\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.letterSpacing = letterSpacing\n\t\t}\n\t})\n\n\tonChangeLetterSpacingUnit = this.measuredUpdateHandler((unit: LetterSpacingUnit) => {\n\t\tconst nodes = this.nodes()\n\t\tconst previousUnit = commonValue(this.props.letterSpacingUnits)\n\n\t\tfor (const node of nodes) {\n\t\t\tconst [letterSpacing] = node.getLetterSpacings(true)\n\t\t\tlet currentValue = letterSpacing ?? letterSpacingDefaultValue\n\t\t\tif (isArray(currentValue)) {\n\t\t\t\tcurrentValue = currentValue[0]\n\t\t\t}\n\t\t\t// Reset value back to 0 when switching unit\n\t\t\tnode.setLetterSpacing([previousUnit === unit ? currentValue : letterSpacingDefaultValue, unit], true)\n\t\t}\n\n\t\tif (shouldUpdateDefaultStyle(nodes)) {\n\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.letterSpacing = [letterSpacingDefaultValue, unit]\n\t\t}\n\t})\n\n\tonChangeLineHeightValue = this.measuredUpdateHandler((lineHeight: number, rawValue?: string) => {\n\t\tconst nodes = this.nodes()\n\t\tconst sharedUnit = this.props.lineHeightUnits.size === 1 ? Array.from(this.props.lineHeightUnits)[0] : undefined\n\t\tconst unitFromValue = getLineHeightUnitFromValue(rawValue)\n\t\tconst unit = unitFromValue ?? sharedUnit ?? \"em\"\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.setLineHeight([lineHeight, unit], true)\n\t\t}\n\n\t\tif (shouldUpdateDefaultStyle(nodes)) {\n\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.lineHeight = [lineHeight, unit]\n\t\t}\n\t})\n\n\tonChangeLineHeightUnit = this.measuredUpdateHandler((unit: LineHeightUnit) => {\n\t\tconst nodes = this.nodes()\n\t\tconst previousUnit = this.props.lineHeightUnits.size === 1 ? Array.from(this.props.lineHeightUnits)[0] : undefined\n\t\tconst fontSize = isNumber(this.props.fontSize) ? this.props.fontSize : undefined\n\t\tconst value = getLineHeightDefaultForUnit(unit, fontSize)\n\n\t\tfor (const node of nodes) {\n\t\t\tconst [lineHeight] = node.getLineHeights(true)\n\t\t\tconst [currentValue] = lineHeight ?? [1.2, \"em\"]\n\n\t\t\t// Reset value back to default when switching unit\n\t\t\tnode.setLineHeight(\n\t\t\t\t[previousUnit === unit ? currentValue : (value ?? getLineHeightDefaultForUnit(unit, fontSize)), unit],\n\t\t\t\ttrue,\n\t\t\t)\n\t\t}\n\n\t\tif (shouldUpdateDefaultStyle(nodes)) {\n\t\t\tengine.stores.documentSettingsStore.defaultTextStyle.lineHeight = [value, unit]\n\t\t}\n\t})\n\n\tonChangeParagraphSpacing = this.measuredUpdateHandler((value: number) => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!withParagraphSpacing(node)) continue\n\n\t\t\tnode.set({ paragraphSpacing: value }, engine.tree)\n\t\t}\n\t})\n\n\tonDeleteParagraphSpacing = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!withParagraphSpacing(node)) continue\n\n\t\t\tnode.set(paragraphSpacingDefaults, engine.tree)\n\t\t}\n\t})\n\n\tonChangeTextStroke = engine.scheduler.wrapHandler(\n\t\t(updatedStroke: { textStrokeWidth: number; textStrokeColor: string }) => {\n\t\t\tconst nodes = this.nodes()\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (!isRichTextNode(node)) continue\n\t\t\t\tif (!isUndefined(updatedStroke.textStrokeWidth)) {\n\t\t\t\t\tnode.setTextStrokeWidth(updatedStroke.textStrokeWidth, true)\n\t\t\t\t}\n\t\t\t\tif (!isUndefined(updatedStroke.textStrokeColor)) {\n\t\t\t\t\tnode.setTextStrokeColor(updatedStroke.textStrokeColor, true)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t)\n\n\tonDeleteTextStroke = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tnode.setTextStrokeWidth(textStyleDefaults.textStrokeWidth, true)\n\t\t\tnode.setTextStrokeColor(textStyleDefaults.textStrokeColor, true)\n\t\t}\n\t})\n\n\tonChangeTextBackgroundColor = engine.scheduler.wrapHandler((newValue: WithTextStyle[\"textBackgroundColor\"]) => {\n\t\tconst nodes = this.nodes()\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tnode.setTextBackgroundColor(newValue, true)\n\t\t}\n\t})\n\n\tonChangeTextBackgroundPadding = this.measuredUpdateHandler(\n\t\t(newValue: Partial<WithTextStyle[\"textBackgroundPadding\"]>) => {\n\t\t\tconst nodes = this.nodes()\n\t\t\tconst spreadablePadding = isFoundAndNotMixedAndNotUndefined(this.props.textBackgroundPadding)\n\t\t\t\t? this.props.textBackgroundPadding\n\t\t\t\t: BackgroundStyles.defaults.textBackgroundPadding\n\t\t\tconst newPadding = isUndefined(newValue) ? undefined : { ...spreadablePadding, ...newValue }\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (!isRichTextNode(node)) continue\n\t\t\t\tnode.setTextBackgroundPadding(newPadding, true)\n\t\t\t}\n\t\t},\n\t)\n\n\tonChangeTextBackgroundRadius = engine.scheduler.wrapHandler(\n\t\t(newValue: Partial<WithTextStyle[\"textBackgroundRadius\"]>) => {\n\t\t\tconst nodes = this.nodes()\n\t\t\tconst spreadableRadius = isFoundAndNotMixedAndNotUndefined(this.props.textBackgroundRadius)\n\t\t\t\t? this.props.textBackgroundRadius\n\t\t\t\t: BackgroundStyles.defaults.textBackgroundRadius\n\t\t\tconst newRadius = isUndefined(newValue) ? undefined : { ...spreadableRadius, ...newValue }\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (!isRichTextNode(node)) continue\n\t\t\t\tnode.setTextBackgroundRadius(newRadius, true)\n\t\t\t\tif (isUndefined(newValue)) {\n\t\t\t\t\tnode.setTextBackgroundCornerShape(undefined, true)\n\t\t\t\t\trecord(\"corner_shape_delete\", { nodeClass: node.__class, nodeId: node.id, isViaRadius: true })\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t)\n\n\tonChangeTextBackgroundCornerShape = engine.scheduler.wrapHandler((newValue: number | undefined) => {\n\t\tconst nodes = this.nodes()\n\t\tconst newCornerShape = isUndefined(newValue) ? undefined : { cornerShape: newValue }\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tnode.setTextBackgroundCornerShape(newCornerShape, true)\n\t\t\tif (isUndefined(newCornerShape)) {\n\t\t\t\trecord(\"corner_shape_delete\", { nodeClass: node.__class, nodeId: node.id })\n\t\t\t} else {\n\t\t\t\trecordCornerShapeUpdate(node, { value: newCornerShape.cornerShape })\n\t\t\t}\n\t\t}\n\t})\n\n\tonChangeTextWrap = engine.scheduler.wrapHandler((textWrapBalance: boolean | undefined) => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!withTextWrapBalance(node)) continue\n\n\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t// Force regenerate all text style presets that use a text balance\n\t\t\t\t// before we introduce text balance overrides.\n\t\t\t\tnode.getTextStylePresets(false).forEach(presetNodeId => {\n\t\t\t\t\tif (isUndefined(presetNodeId)) return\n\n\t\t\t\t\tconst localId = localModuleIdForStableName(ModuleType.CSS, presetNodeId)\n\t\t\t\t\tconst module = engine.stores.modulesStore.getPersistedModuleByLocalId(localId)\n\n\t\t\t\t\tif (!module || !needsUpdateToBeCompatibleWithTextStyle(module)) return\n\t\t\t\t\tengine.stores.codeGenerationStore.forceComponentUpdate(presetNodeId).catch(unhandledError)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tnode.set({ textWrapBalance })\n\t\t}\n\t})\n\n\tonDeleteTextWrap = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tnode.set({ textWrapBalance: undefined })\n\t\t}\n\t})\n\n\ttoggleOpenTypeFeature = engine.scheduler.wrapHandler((feature: OpenTypeFeatureTag, value: boolean) => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tconst [currentFeatures] = node.getOpenTypeFontFeatures(true)\n\t\t\tconst newFeatures = new Set(currentFeatures)\n\t\t\tif (value) {\n\t\t\t\tnewFeatures.add(feature)\n\t\t\t} else {\n\t\t\t\tnewFeatures.delete(feature)\n\t\t\t}\n\t\t\tnode.setOpenTypeFontFeatures(Array.from(newFeatures), true)\n\t\t}\n\t})\n\n\tonDeleteOpenTypeFontFeatures = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tif (!isRichTextNode(node)) continue\n\t\t\tnode.setOpenTypeFontFeatures(undefined, true)\n\t\t}\n\t})\n\n\tonChangeVariationAxis = this.measuredUpdateHandler(\n\t\tasync (\n\t\t\taxisTag: VariationAxisTag | VariationAxisTag[],\n\t\t\tvalue: number | number[] | undefined,\n\t\t\tavailableAxes: ReadonlyFontVariationAxes | undefined,\n\t\t) => {\n\t\t\t// If the font is not a variable font, get the variable variant selector and load it\n\t\t\tconst { fontsToLoad, shouldLoadFonts } = getFontVariantChanges({\n\t\t\t\tfontSelectors: this.props.fonts,\n\t\t\t\taxisTag,\n\t\t\t\taxisValue: value,\n\t\t\t\tavailableAxes,\n\t\t\t\tincludeItalic: true,\n\t\t\t})\n\n\t\t\tif (fontsToLoad.length > 0) {\n\t\t\t\tawait fontStore.loadFonts(fontsToLoad)\n\t\t\t}\n\n\t\t\treturn engine.scheduler.processWhenReady(() => {\n\t\t\t\tconst nodes = this.nodes()\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tif (!isRichTextNode(node)) continue\n\n\t\t\t\t\tconst [currentFontSelector] = node.getFonts(false)\n\t\t\t\t\tconst [currentFontAxesCSS] = node.getVariationAxes(false)\n\n\t\t\t\t\tif (isUndefined(currentFontSelector)) continue\n\n\t\t\t\t\tlet selector = currentFontSelector\n\n\t\t\t\t\t// When there are no existing axes, we are enabling a variable\n\t\t\t\t\t// font for the first time.\n\t\t\t\t\tif (isUndefined(currentFontAxesCSS)) {\n\t\t\t\t\t\tconst currentFont = fontStore.getFontBySelector(currentFontSelector)\n\t\t\t\t\t\tif (isUndefined(currentFont)) continue\n\n\t\t\t\t\t\tif (shouldLoadFonts && !isFontVariable(currentFont)) {\n\t\t\t\t\t\t\tconst varFontSelector = getFontVariableSelectorFromFont(currentFont)\n\t\t\t\t\t\t\tif (isUndefined(varFontSelector)) continue\n\t\t\t\t\t\t\tselector = varFontSelector\n\t\t\t\t\t\t}\n\t\t\t\t\t\trecord(\"enable_variable_font\", {\n\t\t\t\t\t\t\tsource: currentFont.family.source,\n\t\t\t\t\t\t\tfontSelector: selector,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\n\t\t\t\t\tconst axes = updateVariationAxes(axisTag, value, currentFontAxesCSS)\n\t\t\t\t\tif (!isUndefined(axes)) {\n\t\t\t\t\t\tselector = addEncodedAxesToSelector(selector, axes)\n\t\t\t\t\t}\n\t\t\t\t\tnode.setFont(selector, true)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t)\n\n\tonDeleteVariationAxis = this.measuredUpdateHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tengine.scheduler.process(() => {\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (!isRichTextNode(node)) continue\n\n\t\t\t\tconst fonts = node.getFonts(true)\n\t\t\t\tconst font = commonValue(fonts)\n\t\t\t\tif (!isFoundAndNotMixed(font) || isUndefined(font)) return\n\n\t\t\t\tconst variationAxes = node.getVariationAxes(true)\n\t\t\t\tconst axes = commonValue(variationAxes)\n\t\t\t\tif (!isFoundAndNotMixed(axes) || isUndefined(axes)) return\n\n\t\t\t\tconst currentFont = fontStore.getFontBySelector(font)\n\t\t\t\tif (!currentFont || isUndefined(axes)) return\n\n\t\t\t\t// When removing variable fonts, we want to reset the font to its\n\t\t\t\t// closest non-variable variant.\n\t\t\t\tconst nonVariableSelector = getNonVariableFontSelector(font, axes)\n\t\t\t\tnode.setFont(nonVariableSelector ?? font, true)\n\n\t\t\t\trecord(\"disable_variable_font\", { source: currentFont.family.source })\n\t\t\t}\n\t\t})\n\t})\n\n\tonChangeAlignment = engine.scheduler.wrapHandler((textAlignment: TextAlignment) => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.setTextAlignment(textAlignment, true)\n\t\t}\n\t})\n\n\tonDeleteTextAlignment = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\t\tfor (const node of nodes) {\n\t\t\tnode.setTextAlignment(undefined, true)\n\t\t}\n\t})\n\n\tonChangeVerticalAlignment = engine.scheduler.wrapHandler((textVerticalAlignment: TextVerticalAlignment) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(this.props.nodeIds, supportsVerticalAlignment)\n\t\tconst update: WithTextVerticalAlignment = { textVerticalAlignment }\n\t\tnodes.forEach(node => node.set(update))\n\t})\n\n\tonChangeTextTransform = this.measuredUpdateHandler((textTransform: string) => {\n\t\tconst nodes = this.nodes()\n\t\tconst value = isTextTransform(textTransform) ? textTransform : \"none\"\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.setTextTransform(value, true)\n\t\t}\n\t})\n\n\tonDeleteTextTransform = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = this.nodes()\n\n\t\tfor (const node of nodes) {\n\t\t\tnode.setTextTransform(textTransformDefault, true)\n\t\t}\n\t})\n\n\tonChangeTextDecoration: React.ComponentProps<typeof TextDecorationRow>[\"onChange\"] = engine.scheduler.wrapHandler(\n\t\tupdate => {\n\t\t\tconst nodes = this.nodes()\n\n\t\t\tfor (const node of nodes) {\n\t\t\t\tif (\"textDecoration\" in update) {\n\t\t\t\t\tnode.setTextDecoration(isTextDecoration(update.textDecoration) ? update.textDecoration : \"none\", true)\n\t\t\t\t}\n\n\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\tif (\"textDecorationColor\" in update) {\n\t\t\t\t\t\tnode.setTextDecorationColor(update.textDecorationColor, true)\n\t\t\t\t\t}\n\t\t\t\t\tif (\"textDecorationThickness\" in update) {\n\t\t\t\t\t\tnode.setTextDecorationThickness(update.textDecorationThickness, true)\n\t\t\t\t\t}\n\t\t\t\t\tif (\"textDecorationStyle\" in update) {\n\t\t\t\t\t\tnode.setTextDecorationStyle(update.textDecorationStyle, true)\n\t\t\t\t\t}\n\t\t\t\t\tif (\"textDecorationSkipInk\" in update) {\n\t\t\t\t\t\tnode.setTextDecorationSkipInk(update.textDecorationSkipInk, true)\n\t\t\t\t\t}\n\t\t\t\t\tif (\"textDecorationOffset\" in update) {\n\t\t\t\t\t\tnode.setTextDecorationOffset(update.textDecorationOffset, true)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t)\n\n\tonHighlightFontFamily = (fontFamily: ReadonlyFontFamily) => {\n\t\tif (!experiments.isOn(\"fontPreview\")) return\n\n\t\tconst regularFontVariant = getClosestToRegularFont(fontFamily)\n\n\t\tif (isRichTextEditTool(engine.tool)) {\n\t\t\t// When editing text, load the font and preview it via RichTextEditorTool\n\t\t\t// Track the requested selector to handle out-of-order async font loading\n\t\t\tthis.pendingFontPreviewSelector = regularFontVariant.selector\n\t\t\tvoid fontStore.loadFonts([regularFontVariant.selector]).then(() => {\n\t\t\t\t// Only apply preview if this is still the most recent request\n\t\t\t\tif (isRichTextEditTool(engine.tool) && this.pendingFontPreviewSelector === regularFontVariant.selector) {\n\t\t\t\t\tengine.tool.setFontPreview(regularFontVariant.selector)\n\t\t\t\t}\n\t\t\t})\n\t\t} else {\n\t\t\t// Otherwise preview the font on the canvas\n\t\t\tconst fontSelectorsByNodeID = new Map<NodeID, string>()\n\n\t\t\tfor (const node of this.nodes()) {\n\t\t\t\tconst [font] = node.getFonts(true)\n\t\t\t\tconst closestFontVariant = getSimilarFontForSelector(font, fontFamily) ?? regularFontVariant\n\t\t\t\tfontSelectorsByNodeID.set(node.id, closestFontVariant.selector)\n\t\t\t}\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.fontPreviewStore.enterPreview(fontSelectorsByNodeID)\n\t\t\t})\n\t\t}\n\t}\n\n\tonHighlightEnd = () => {\n\t\tif (!experiments.isOn(\"fontPreview\")) return\n\n\t\tif (isRichTextEditTool(engine.tool)) {\n\t\t\tthis.pendingFontPreviewSelector = null\n\t\t\tengine.tool.setFontPreview(null)\n\t\t} else {\n\t\t\tengine.scheduler.processWhenReady(engine.stores.fontPreviewStore.exitPreview)\n\t\t}\n\t}\n\n\t/**\n\t * Duplicates a team-owned custom font asset into the current workspace if it\u2019s not already present.\n\t */\n\tprivate duplicateTeamFontAssetIfNeeded = (selector: string) => {\n\t\tconst font = fontStore.getFontBySelector(selector)\n\t\tif (font?.owner !== \"team\") return\n\n\t\tconst assetKey = font.assetKey\n\t\tconst teamId = engine.stores.projectStore.project?.space.ownerId\n\t\tconst assetService: AssetService | undefined = engine.stores.assetStore.assetService\n\n\t\tif (assetKey && teamId && assetService) {\n\t\t\tvoid assetService.duplicateWorkspaceAssets([assetKey], teamId).catch(unhandledError)\n\t\t}\n\t}\n}\n\nconst onlyPx: RichTextFontSizeUnit[] = [\"px\"]\nconst allRichTextFontSizeUnits: RichTextFontSizeUnit[] = [...supportedFontSizeUnits, \"auto\"]\n\nfunction supportedRichTextFontSizeUnits({ onlyNodesWithTextFit, onlyRichTextNodes }: Props): RichTextFontSizeUnit[] {\n\t// Only rich text nodes support auto fit text and `rem` units. Returning `undefined` and using\n\t// in the size row would result in showing only `px`, but this makes the distinction explicit.\n\tif (!onlyRichTextNodes) return onlyPx\n\n\t// If only text-fit nodes are present, we only allow `auto` and `px`\n\treturn onlyNodesWithTextFit ? allRichTextFontSizeUnits : supportedFontSizeUnits\n}\n\nfunction getRichTextFontSizeUnitFromValue(rawValue?: string): RichTextFontSizeUnit | undefined {\n\t// If the user types % or auto, convert the layer to text-fit if possible.\n\tif (rawValue?.endsWith(\"%\") || rawValue?.toLowerCase() === \"auto\") return \"auto\"\n\n\treturn getFontSizeUnitFromValue(rawValue)\n}\n\nfunction getStyleMenuItems(props: Props) {\n\tif (props.onlyNodesWithHTMLContent) return getPresetStyleMenuItems(props)\n\n\tconst {\n\t\tnodeIds,\n\t\ttextTransforms,\n\t\ttextDecoration,\n\t\tshadows,\n\t\ttextStrokeWidth,\n\t\ttextStrokeColor,\n\t\tparagraphSpacing,\n\t\ttextWrapBalance,\n\t\tanyNodeWithParagraphSpacing,\n\t\ttextStylePresets,\n\t\ttextBackgroundColor,\n\t\ttextBackgroundRadius,\n\t\ttextBackgroundCornerShape,\n\t\ttextBackgroundPadding,\n\t\ttextTruncation,\n\t} = props\n\n\tconst isUsingInlineStyles = textStylePresets.has(undefined)\n\tconst isStylePreset = textStylePresets.size > 1 || !isUsingInlineStyles\n\n\tconst showTextTransform = hasTextTransform(textTransforms)\n\tconst showTextDecoration = hasTextDecoration(textDecoration)\n\tconst showShadows = isArray(shadows) && shadows.length > 0\n\tconst showTextStroke = hasTextStrokeRow(textStrokeWidth, textStrokeColor)\n\tconst showParagraphSpacing = !(isUndefined(paragraphSpacing) || isNotFound(paragraphSpacing))\n\tconst showTextWrapBalance = hasTextWrapBalanceRow(textWrapBalance)\n\tconst showTextTruncation = hasTextTruncation(textTruncation)\n\tconst showTextBackgroundColor = hasTextBackgroundColor(textBackgroundColor)\n\tconst showTextBackgroundRadius = isFoundAndNotUndefined(textBackgroundRadius)\n\tconst showTextBackgroundCornerShape = isFoundAndNotUndefined(textBackgroundCornerShape)\n\tconst showTextBackgroundPadding = isFoundAndNotUndefined(textBackgroundPadding)\n\n\tconst isSquircleExperimentOn = experiments.isOn(\"squircle\")\n\n\tconst menuItems: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: Dictionary.Fill,\n\t\t\tenabled: !showTextBackgroundColor,\n\t\t\tchecked: showTextBackgroundColor,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tif (!isRichTextNode(node)) continue\n\t\t\t\t\t// Pick an initial fill color based on the text color if there is a consistent text color\n\t\t\t\t\t// otherwise fallback to the default fill color\n\t\t\t\t\tconst textColors = node.getTextColors(true)\n\t\t\t\t\tconst targetColor =\n\t\t\t\t\t\tisString(textColors[0]) && textColors.length === 1\n\t\t\t\t\t\t\t? textBackgroundColorFromTextColor(textColors[0])\n\t\t\t\t\t\t\t: textBackgroundColorAddedDefault\n\t\t\t\t\tnode.setTextBackgroundColor(targetColor, true)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Radius,\n\t\t\tenabled: !showTextBackgroundRadius,\n\t\t\tchecked: showTextBackgroundRadius,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextBackgroundRadius(BackgroundStyles.defaults.textBackgroundRadius, true)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: cornerShapeTitle,\n\t\t\tvisible: isSquircleExperimentOn,\n\t\t\tenabled: showTextBackgroundRadius && !showTextBackgroundCornerShape,\n\t\t\tchecked: showTextBackgroundCornerShape,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextBackgroundCornerShape(cornerShapeDefaultsWhenAdded, true)\n\t\t\t\t\trecordCornerShapeUpdate(node, { value: cornerShapeDefaultsWhenAdded.cornerShape, isAddition: true })\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Padding,\n\t\t\tenabled: !showTextBackgroundPadding,\n\t\t\tchecked: showTextBackgroundPadding,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextBackgroundPadding(BackgroundStyles.defaults.textBackgroundPadding, true)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Shadows,\n\t\t\tenabled: !showShadows,\n\t\t\tchecked: showShadows,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withShadow)\n\t\t\t\taddShadowForNodes(\n\t\t\t\t\tengine,\n\t\t\t\t\tnodes.map(node => node.id),\n\t\t\t\t\tshadows,\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Stroke,\n\t\t\tvisible: !isStylePreset,\n\t\t\tenabled: !showTextStroke,\n\t\t\tchecked: showTextStroke,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isRichTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextStrokeWidth(textStrokeWidthAddedDefault, true)\n\t\t\t\t\tnode.setTextStrokeColor(textStrokeColorAddedDefault, true)\n\t\t\t\t}\n\t\t\t\tpopoutWindow.navigation.presentPopout(textStrokePopoutId)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Paragraph,\n\t\t\tenabled: !showParagraphSpacing,\n\t\t\tchecked: showParagraphSpacing,\n\t\t\tvisible: !anyNodeWithParagraphSpacing,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withParagraphSpacing)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.set(paragraphSpacingAddedDefaults, engine.tree)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Transform,\n\t\t\tenabled: !showTextTransform,\n\t\t\tchecked: showTextTransform,\n\t\t\tvisible: !isStylePreset,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextTransform(textTransformAddedDefault, true)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Decoration,\n\t\t\tenabled: !showTextDecoration,\n\t\t\tchecked: showTextDecoration,\n\t\t\tvisible: !isStylePreset,\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\t\t\t\tfor (const node of nodes) {\n\t\t\t\t\tnode.setTextDecoration(textDecorationAddedDefault, true)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Balance,\n\t\t\tenabled: !showTextWrapBalance,\n\t\t\tchecked: showTextWrapBalance,\n\t\t\tclick: () => addTextWrapBalanceForNodes(engine.tree, nodeIds),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Truncate,\n\t\t\tenabled: !showTextTruncation,\n\t\t\tchecked: showTextTruncation,\n\t\t\tclick: () => addTextTruncationForNodes(nodeIds),\n\t\t},\n\t]\n\n\t// Filter out all items that have set visible to false,\n\t// keep the ones that are undefined or visible is true\n\tconst allVisibleItemsAreAdded = menuItems\n\t\t.filter(item => isUndefined(item.visible) || item.visible)\n\t\t.every(item => item.checked)\n\n\treturn { menuItems, allAddedStylesVisible: allVisibleItemsAreAdded }\n}\n\nfunction getPresetStyleMenuItems({\n\tnodeIds,\n\tassignedTextStylePresets,\n\thasAssignedAnchorLinkStylePreset,\n\thasAssignedBlockquoteStylePreset,\n\thasAssignedInlineCodeStylePreset,\n\thasAssignedLinkStylePreset,\n\ttextTruncation,\n}: Props) {\n\tconst menuItems: MenuItemOptions[] = []\n\n\tfor (const tag of richTextTags) {\n\t\tmenuItems.push({\n\t\t\tlabel: getRichTextTagName(tag),\n\t\t\tvisible: !assignedTextStylePresets.has(tag),\n\t\t\tclick: addTextStylePreset(nodeIds, tag),\n\t\t})\n\t}\n\n\tmenuItems.push({\n\t\tlabel: Dictionary.Link,\n\t\tvisible: !hasAssignedLinkStylePreset,\n\t\tclick: addLinkStylePreset(nodeIds),\n\t})\n\n\tmenuItems.push({\n\t\tlabel: Dictionary.Blockquote,\n\t\tvisible: !hasAssignedBlockquoteStylePreset,\n\t\tclick: addBlockquoteStylePreset(nodeIds),\n\t})\n\n\tmenuItems.push({\n\t\tlabel: Dictionary.Code,\n\t\tvisible: !hasAssignedInlineCodeStylePreset,\n\t\tclick: addInlineCodeStylePreset(nodeIds),\n\t})\n\n\tmenuItems.push({\n\t\tlabel: Dictionary.Anchors,\n\t\tvisible: !hasAssignedAnchorLinkStylePreset,\n\t\tclick: addAnchorLinkStylePreset(nodeIds),\n\t})\n\n\tmenuItems.push({\n\t\tlabel: Dictionary.Truncate,\n\t\tvisible: !hasTextTruncation(textTruncation),\n\t\tclick: () => addTextTruncationForNodes(nodeIds),\n\t})\n\n\treturn { menuItems, allAddedStylesVisible: menuItems.every(item => !item.visible) }\n}\n\nfunction TextStylePresetsIcon({\n\tpresets,\n\tagentExperimentEnabled,\n}: {\n\tpresets: ReadonlySet<string | undefined>\n\tagentExperimentEnabled: boolean\n}) {\n\tconst singleTextStylePresetNode = useEngineState(\n\t\t() => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(presets, isTextStylePresetPrimaryNode)\n\t\t\treturn nodes.length === 1 ? nodes.at(0) : undefined\n\t\t},\n\t\t[presets],\n\t\tEngineChange.TextStylePresets,\n\t)\n\n\treturn (\n\t\t<PresetIconInverted\n\t\t\tforeground={singleTextStylePresetNode?.textColor ?? (presets.size > 1 ? palette.blue60 : undefined)}\n\t\t\ticon={singleTextStylePresetNode?.tag ?? <IconTextStylePreset compact={agentExperimentEnabled} />}\n\t\t\tcompact={agentExperimentEnabled && !singleTextStylePresetNode?.tag}\n\t\t/>\n\t)\n}\n\nfunction InlineCodeStylePresetsIcon({ presets }: { presets: ReadonlySet<string | undefined> }) {\n\tconst singleInlineCodeStylePresetNode = useEngineState(\n\t\t() => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(presets, isInlineCodeStylePresetNode)\n\t\t\treturn nodes.length === 1 ? nodes.at(0) : undefined\n\t\t},\n\t\t[presets],\n\t\tEngineChange.TextStylePresets,\n\t)\n\n\treturn <PresetIconInverted foreground={singleInlineCodeStylePresetNode?.inlineCodeTextColor} icon=\"c\" />\n}\n\ntype StylePresetPopoutButtonWithPreviewProps = Omit<\n\tReact.ComponentProps<typeof PopoutButtonWithPreview>,\n\t\"title\" | \"titleColor\" | \"innerText\"\n> & {\n\ttextStylePresets: Set<string | undefined>\n\tstylePresetType: \"textStyle\" | \"inlineCodeStyle\"\n}\n\nconst getPresetTitle = (\n\tpresetNode: TextStylePresetPrimaryNode | InlineCodeStylePresetNode | undefined,\n): string | JSX.Element => {\n\tif (!presetNode) {\n\t\treturn getTextStylePresetsTitle([])\n\t}\n\n\treturn isInlineCodeStylePresetNode(presetNode)\n\t\t? getInlineCodeStylePresetsTitle([presetNode])\n\t\t: getTextStylePresetsTitle([presetNode])\n}\n\nconst getPresetTitleColor = (\n\tpresetNode: TextStylePresetPrimaryNode | InlineCodeStylePresetNode | undefined,\n): string | undefined => {\n\treturn isDefined(presetNode) ? undefined : colors.popoutButtonTextPlaceholder\n}\n\nfunction StylePresetPopoutButtonWithPreview({\n\ttextStylePresets,\n\tstylePresetType,\n\t...rest\n}: StylePresetPopoutButtonWithPreviewProps) {\n\tconst presetData = useEngineState(\n\t\t() => {\n\t\t\tconst typeGuard =\n\t\t\t\tstylePresetType === \"inlineCodeStyle\" ? isInlineCodeStylePresetNode : isTextStylePresetPrimaryNode\n\t\t\tconst nodes = engine.tree.getNodesWithTrait<TextStylePresetPrimaryNode | InlineCodeStylePresetNode>(\n\t\t\t\ttextStylePresets,\n\t\t\t\ttypeGuard,\n\t\t\t)\n\t\t\tconst presetNode = nodes.length === 1 ? nodes.at(0) : undefined\n\n\t\t\tconst title = getPresetTitle(presetNode)\n\t\t\tconst titleColor = getPresetTitleColor(presetNode)\n\n\t\t\treturn {\n\t\t\t\ttitle,\n\t\t\t\ttitleColor,\n\t\t\t}\n\t\t},\n\t\t[textStylePresets, stylePresetType],\n\t\tEngineChange.TextStylePresets,\n\t\t{ deepEqual: true },\n\t)\n\n\treturn <PopoutButtonWithPreview title={presetData.title} titleColor={presetData.titleColor} {...rest} />\n}\n", "import { NumberInputWithTickerAndStepper, Stack } from \"@framerjs/fresco\"\nimport { dimensions, palette } from \"@framerjs/fresco/tokens\"\nimport engine from \"document/engine.ts\"\nimport { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { migrateTextNodes } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { useCallback, useId, useMemo } from \"react\"\nimport { getDefaultLinkStylePreset, insertLinkStylePreset } from \"utils/linkStylePresetUtils.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PresetIcon } from \"../../shared/PresetIcon.tsx\"\nimport {\n\tSelectLinkStyleEntityAssetPopout,\n\tselectAnchorLinkStylePreset,\n} from \"../panels/SelectLinkStyleEntityAssetPopout.tsx\"\nimport { useLinkStylePresets } from \"../panels/utils/useLinkStylePresets.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\nimport { getLinkStylePresetsTitle } from \"./SelectNodeLinkStylePresetRow.tsx\"\n\ninterface Props {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n\tanchorLinkOffsetY: Reduced<number | undefined>\n}\n\nconst selectAnchorLinkStylePresetPopoutId = \"selectAnchorLinkStylePresetPopoutId\"\nconst traitTypeKeys = [\"stylePresetAnchorLink\"] as const\n\nexport function addAnchorLinkStylePreset(nodeIds: string[]) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst preset = getDefaultLinkStylePreset(engine.tree) ?? LinkStylePresetNode.createDefault()\n\t\tinsertLinkStylePreset(engine, preset)\n\t\tselectAnchorLinkStylePreset(nodeIds, preset)\n\t\tpopoutWindow.navigation.presentPopout(selectAnchorLinkStylePresetPopoutId)\n\t})\n}\n\nexport function SelectNodeAnchorLinkStylePresetRow({ nodeIds, selectedIds, anchorLinkOffsetY }: Props) {\n\tconst presets = useLinkStylePresets()\n\n\tconst selectedPresets = useMemo(\n\t\t() =>\n\t\t\tpresets.filter(preset => {\n\t\t\t\treturn selectedIds.has(preset.id)\n\t\t\t}),\n\n\t\t[presets, selectedIds],\n\t)\n\n\tconst commonLinkColor = useMemo(() => {\n\t\tlet linkColor: string | undefined\n\n\t\tfor (const preset of selectedPresets) {\n\t\t\tlinkColor ??= preset.linkTextColor\n\n\t\t\tif (preset.linkTextColor !== linkColor) {\n\t\t\t\tlinkColor = palette.blue60\n\t\t\t}\n\t\t}\n\n\t\treturn linkColor ?? palette.blue60\n\t}, [selectedPresets])\n\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetAnchorLink: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Anchors\" traitTypeKeys={traitTypeKeys}>\n\t\t\t{selectedPresets.length > 0 ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tid={selectAnchorLinkStylePresetPopoutId}\n\t\t\t\t\tnavigationTitle=\"Anchors Style\"\n\t\t\t\t\ttitle={getLinkStylePresetsTitle(selectedPresets)}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<Popout\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\tselectedIds={selectedIds}\n\t\t\t\t\t\t\tcommonLinkColor={commonLinkColor}\n\t\t\t\t\t\t\tselectedPresets={selectedPresets}\n\t\t\t\t\t\t\tanchorLinkOffsetY={anchorLinkOffsetY}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tpreview={<PresetIcon background={commonLinkColor} icon=\"a\" />}\n\t\t\t\t\tonDelete={deselectPreset}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"preset\"\n\t\t\t\t\ticon={<PresetIcon icon=\"a\" />}\n\t\t\t\t\tonMouseDown={addAnchorLinkStylePreset(nodeIds)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\ninterface PopoutProps extends Props {\n\tselectedPresets: LinkStylePresetNode[]\n\tcommonLinkColor: string\n}\n\nfunction Popout({ nodeIds, selectedPresets, commonLinkColor, selectedIds, anchorLinkOffsetY }: PopoutProps) {\n\tconst stylePopoutId = useId()\n\n\tconst onOffsetYChange = engine.scheduler.wrapHandler((offsetY: number) => {\n\t\tconst anyTextNodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\t\tconst richTextNodes = migrateTextNodes(engine, anyTextNodes)\n\n\t\tfor (const node of richTextNodes) {\n\t\t\tnode.set({ anchorLinkOffsetY: offsetY })\n\t\t}\n\t})\n\n\tconst onOffsetYClear = engine.scheduler.wrapHandler(() => {\n\t\tonOffsetYChange(0)\n\t})\n\n\tconst handleSelect = useCallback((selectedNodeIds: string[], preset: LinkStylePresetNode) => {\n\t\tselectAnchorLinkStylePreset(selectedNodeIds, preset)\n\t}, [])\n\n\tconst value = (isFound(anchorLinkOffsetY) ? anchorLinkOffsetY : undefined) ?? 0\n\n\treturn (\n\t\t<Stack gap={0}>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpadding={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t>\n\t\t\t\t<PanelRow title=\"Style\">\n\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\tid={stylePopoutId}\n\t\t\t\t\t\tnavigationTitle=\"Anchors\"\n\t\t\t\t\t\ttitle={getLinkStylePresetsTitle(selectedPresets)}\n\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t<SelectLinkStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} onSelect={handleSelect} />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpreview={<PresetIcon background={commonLinkColor} icon=\"a\" />}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow title=\"Offset Y\">\n\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\tonChange={onOffsetYChange}\n\t\t\t\t\t\tonClear={onOffsetYClear}\n\t\t\t\t\t\tstepperStep={10}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { useMemo } from \"react\"\nimport { getDefaultBlockquoteStylePreset, insertBlockquoteStylePreset } from \"utils/blockquoteStylePresetUtils.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PresetIcon, PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport {\n\tSelectBlockquoteStyleEntityAssetPopout,\n\tselectBlockquoteStylePreset,\n} from \"../panels/SelectBlockquoteStyleEntityAssetPopout.tsx\"\nimport { useBlockquoteStylePresets } from \"../panels/utils/useBlockquoteStylePresets.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst selectBlockquoteStylePresetPopoutId = \"selectBlockquoteStylePresetPopoutId\"\nconst traitTypeKeys = [\"stylePresetBlockquote\"] as const\n\nexport function addBlockquoteStylePreset(nodeIds: string[]) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst preset = getDefaultBlockquoteStylePreset(engine.tree) ?? BlockquoteStylePresetNode.createDefault()\n\t\tinsertBlockquoteStylePreset(engine, preset)\n\t\tselectBlockquoteStylePreset(nodeIds, preset)\n\t\tpopoutWindow.navigation.presentPopout(selectBlockquoteStylePresetPopoutId)\n\t})\n}\n\nexport function SelectNodeBlockquoteStylePresetRow({ nodeIds, selectedIds }: Props) {\n\tconst presets = useBlockquoteStylePresets()\n\n\tconst selectedPresets = useMemo(\n\t\t() =>\n\t\t\tpresets.filter(preset => {\n\t\t\t\treturn selectedIds.has(preset.id)\n\t\t\t}),\n\n\t\t[presets, selectedIds],\n\t)\n\n\tconst commonBlockquoteColor = useMemo(() => {\n\t\tlet blockquoteColor: string | undefined\n\n\t\tfor (const preset of selectedPresets) {\n\t\t\tblockquoteColor ??= preset.textColor\n\n\t\t\tif (preset.textColor !== blockquoteColor) {\n\t\t\t\tblockquoteColor = palette.blue60\n\t\t\t}\n\t\t}\n\n\t\treturn blockquoteColor ?? palette.blue60\n\t}, [selectedPresets])\n\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetBlockquote: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Blockquote\" traitTypeKeys={traitTypeKeys}>\n\t\t\t{selectedPresets.length > 0 ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tid={selectBlockquoteStylePresetPopoutId}\n\t\t\t\t\tnavigationTitle=\"Blockquote Styles\"\n\t\t\t\t\ttitle={getBlockquoteStylePresetsTitle(selectedPresets)}\n\t\t\t\t\tpopout={<SelectBlockquoteStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\t\tpreview={<PresetIconInverted foreground={commonBlockquoteColor} icon=\"B\" />}\n\t\t\t\t\tonDelete={deselectPreset}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"preset\"\n\t\t\t\t\ticon={<PresetIcon icon=\"B\" />}\n\t\t\t\t\tonMouseDown={addBlockquoteStylePreset(nodeIds)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nfunction getBlockquoteStylePresetsTitle(presets: BlockquoteStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.SelectEllipsis\n\n\treturn preset.getName()\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\n\nconst emptyResult: BlockquoteStylePresetNode[] = []\n\nexport function useBlockquoteStylePresets() {\n\treturn useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\tconst listNode = PresetsListNode.get(engine.tree)\n\t\tif (!listNode) return emptyResult\n\n\t\treturn listNode.getBlockquoteStylePresets()\n\t})\n}\n", "import { palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport { withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { useMemo } from \"react\"\nimport { getDefaultInlineCodeStylePreset, insertInlineCodeStylePreset } from \"utils/inlineCodeStylePresetUtils.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PresetIcon, PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport {\n\tSelectInlineCodeStyleEntityAssetPopout,\n\tselectInlineCodeStylePreset,\n} from \"../panels/SelectInlineCodeStyleEntityAssetPopout.tsx\"\nimport { useInlineCodeStylePresets } from \"../panels/utils/useInlineCodeStylePresets.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst selectInlineCodeStylePresetPopoutId = \"selectInlineCodeStylePresetPopoutId\"\nconst traitTypeKeys = [\"stylePresetInlineCode\"] as const\n\nexport function addInlineCodeStylePreset(nodeIds: string[]) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst preset = getDefaultInlineCodeStylePreset(engine.tree) ?? new InlineCodeStylePresetNode()\n\t\tinsertInlineCodeStylePreset(engine, preset)\n\t\tselectInlineCodeStylePreset(nodeIds, preset)\n\t\tpopoutWindow.navigation.presentPopout(selectInlineCodeStylePresetPopoutId)\n\t})\n}\n\nexport function SelectNodeInlineCodeStylePresetRow({ nodeIds, selectedIds }: Props) {\n\tconst presets = useInlineCodeStylePresets()\n\n\tconst selectedPresets = useMemo(\n\t\t() =>\n\t\t\tpresets.filter(preset => {\n\t\t\t\treturn selectedIds.has(preset.id)\n\t\t\t}),\n\n\t\t[presets, selectedIds],\n\t)\n\n\tconst commonColor = useMemo(() => {\n\t\tlet color: string | undefined\n\n\t\tfor (const preset of selectedPresets) {\n\t\t\tcolor ??= preset.inlineCodeTextColor\n\n\t\t\tif (preset.inlineCodeTextColor !== color) {\n\t\t\t\tcolor = palette.blue60\n\t\t\t}\n\t\t}\n\n\t\treturn color ?? \"#000\"\n\t}, [selectedPresets])\n\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ stylePresetInlineCode: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title=\"Code\" traitTypeKeys={traitTypeKeys}>\n\t\t\t{selectedPresets.length > 0 ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tid={selectInlineCodeStylePresetPopoutId}\n\t\t\t\t\tnavigationTitle=\"Code Styles\"\n\t\t\t\t\ttitle={getInlineCodeStylePresetsTitle(selectedPresets)}\n\t\t\t\t\tpopout={<SelectInlineCodeStyleEntityAssetPopout nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\t\tpreview={<PresetIconInverted foreground={commonColor} icon=\"c\" />}\n\t\t\t\t\tonDelete={deselectPreset}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"preset\"\n\t\t\t\t\ticon={<PresetIcon icon=\"c\" />}\n\t\t\t\t\tonMouseDown={addInlineCodeStylePreset(nodeIds)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nexport function getInlineCodeStylePresetsTitle(presets: InlineCodeStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.SelectEllipsis\n\n\treturn preset.getName()\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { InlineCodeEntityTypeRootNode } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { isInlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { migrateTextNodes } from \"document/utils/migrateTextToRichTextNode.ts\"\nimport { useCallback } from \"react\"\nimport { createInlineCodeStylePreset } from \"utils/inlineCodeStylePresetUtils.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { usePresetAssetRows } from \"../../assets/utils/usePresetAssetRows.ts\"\nimport { createInlineCodeItemContextMenuItems } from \"../utils/getInlineCodeStylePresetRowProps.tsx\"\nimport { EditInlineCodeStylePresetPopout } from \"./EditInlineCodeStylePresetPopout.tsx\"\nimport {\n\ttype EditStyleEntityAssetPopoutProps,\n\tSelectStyleEntityAssetPopoutContent,\n} from \"./SelectStyleEntityAssetPopoutContent.tsx\"\n\ninterface SelectInlineCodeStyleEntityAssetPopoutProps {\n\tnodeIds: string[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst inlineCodeStyleRowMeta = { componentType: \"code\" } as const\nObject.freeze(inlineCodeStyleRowMeta)\n\nexport function SelectInlineCodeStyleEntityAssetPopout({\n\tnodeIds,\n\tselectedIds,\n}: SelectInlineCodeStyleEntityAssetPopoutProps) {\n\tconst { rows, hasAnyItems, hasUnreferencedItems, typeRootId, searchValue, setSearchValue, hasSearch } =\n\t\tusePresetAssetRows(\n\t\t\t() => PresetsListNode.getNodes(engine.tree),\n\t\t\t() => InlineCodeEntityTypeRootNode.get(engine.tree),\n\t\t\t() => inlineCodeStyleRowMeta,\n\t\t\tisInlineCodeStylePresetNode,\n\t\t)\n\n\tconst handleCreateInlineCodeStyle = useCallback(() => {\n\t\tcreateInlineCodeStylePreset(engine, {\n\t\t\tonCreate(preset) {\n\t\t\t\tselectInlineCodeStylePreset(nodeIds, preset)\n\t\t\t},\n\t\t})\n\t}, [nodeIds])\n\n\tconst handleSelect = useEngineCallback(\n\t\t(id: NodeID) => {\n\t\t\tconst preset = engine.tree.get<InlineCodeStylePresetNode>(id)\n\t\t\tif (isNull(preset)) return\n\n\t\t\tselectInlineCodeStylePreset(nodeIds, preset)\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\treturn (\n\t\t<SelectStyleEntityAssetPopoutContent\n\t\t\trows={rows}\n\t\t\thasAnyItems={hasAnyItems}\n\t\t\thasUnreferencedItems={hasUnreferencedItems}\n\t\t\ttypeRootId={typeRootId}\n\t\t\tsearchValue={searchValue}\n\t\t\tsetSearchValue={setSearchValue}\n\t\t\thasSearch={hasSearch}\n\t\t\tselectedIds={selectedIds}\n\t\t\tPopout={EditInlineCodeStyleEntityAssetPopout}\n\t\t\tcreateItemContextMenuItems={createInlineCodeItemContextMenuItems}\n\t\t\tonCreate={handleCreateInlineCodeStyle}\n\t\t\tonSelect={handleSelect}\n\t\t/>\n\t)\n}\n\nfunction EditInlineCodeStyleEntityAssetPopout({ id }: EditStyleEntityAssetPopoutProps) {\n\tconst preset = useEngineState(() => engine.tree.get<InlineCodeStylePresetNode>(id), [], EngineChange.Tree)\n\n\tif (isNull(preset)) return null\n\n\treturn <EditInlineCodeStylePresetPopout preset={preset} />\n}\n\nexport const selectInlineCodeStylePreset = engine.scheduler.wrapHandler(\n\t(nodeIds: string[], preset: InlineCodeStylePresetNode) => {\n\t\tconst anyTextNodes = engine.tree.getNodesWithTrait(nodeIds, isAnyTextNode)\n\t\tconst richTextNodes = migrateTextNodes(engine, anyTextNodes)\n\n\t\tfor (const node of richTextNodes) {\n\t\t\tnode.setInlineCodeStylePreset(preset, true)\n\t\t\tnode.setNodeInlineCodeStylePreset(preset)\n\t\t}\n\n\t\trecord(\"styles_preset_add\", {\n\t\t\ttag: \"code\",\n\t\t\tname: preset.getName(),\n\t\t\tid: preset.id,\n\t\t})\n\n\t\tengine.stores.selectionStore.set(richTextNodes)\n\t},\n)\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\n\nexport function useInlineCodeStylePresets() {\n\treturn useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\tconst listNode = PresetsListNode.get(engine.tree)\n\t\tif (!listNode) return []\n\n\t\treturn listNode.getInlineCodeStylePresets()\n\t})\n}\n", "import { TruncateWithEllipsisAndTitle } from \"@framerjs/fresco/components/TruncateWithEllipsisAndTitle\"\nimport { colors, palette } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { RichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { getRichTextTagName } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { getTextStylePresetKey, withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { useMemo } from \"react\"\nimport { getDefaultTextStylePreset, insertTextStylePreset } from \"utils/textStylePresetUtils.ts\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { PresetIcon, PresetIconInverted } from \"../../shared/PresetIcon.tsx\"\nimport { SelectTextStyleEntityAssetPopout, selectTextStylePreset } from \"../panels/SelectTextStyleEntityAssetPopout.tsx\"\nimport { getBreakpointFromActiveScreen, getBreakpointLabel } from \"../panels/breakpointUtils.tsx\"\nimport { getTextStylePresetBreakpointsFromTree } from \"../panels/utils/getTextStylePresetBreakpoints.ts\"\nimport { useTextStylePresets } from \"../panels/utils/useTextStylePresets.tsx\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props {\n\ttag: RichTextTag\n\tnodeIds: NodeID[]\n\tselectedIds: Set<string | undefined>\n}\n\nconst selectTextStylePresetPopoutId = (tag: RichTextTag) => `${selectTextStylePresetPopoutId}-${tag}`\n\nexport function addTextStylePreset(nodeIds: string[], tag: RichTextTag) {\n\treturn engine.scheduler.wrapHandler(() => {\n\t\tconst preset = getDefaultTextStylePreset(engine.tree, tag) ?? TextStylePresetNode.createDefault(tag)\n\t\tinsertTextStylePreset(engine, preset)\n\t\tselectTextStylePreset(nodeIds, preset)\n\t\tpopoutWindow.navigation.presentPopout(selectTextStylePresetPopoutId(tag))\n\t})\n}\n\nexport function SelectNodeTextStylePresetRow({ tag, nodeIds, selectedIds }: Props) {\n\tconst tagName = getRichTextTagName(tag)\n\tconst presets = useTextStylePresets(tag)\n\tconst traitTypeKeys = useMemo(() => [getTextStylePresetKey(tag)], [tag])\n\n\tconst selectedPresets = useMemo(\n\t\t() =>\n\t\t\tpresets.filter(preset => {\n\t\t\t\treturn selectedIds.has(preset.id)\n\t\t\t}),\n\t\t[presets, selectedIds],\n\t)\n\n\tconst commonTextColor = useMemo(() => {\n\t\tlet textColor: string | undefined\n\n\t\tfor (const preset of selectedPresets) {\n\t\t\ttextColor ??= preset.textColor\n\n\t\t\tif (preset.textColor !== textColor) {\n\t\t\t\ttextColor = palette.blue60\n\t\t\t}\n\t\t}\n\n\t\treturn textColor ?? palette.blue60\n\t}, [selectedPresets])\n\n\tconst deselectPreset = engine.scheduler.wrapHandler(() => {\n\t\tconst key = getTextStylePresetKey(tag)\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStylePresets)\n\t\tfor (const node of nodes) {\n\t\t\tnode.set({ [key]: undefined })\n\t\t}\n\t})\n\n\treturn (\n\t\t<PanelRow title={tagName} traitTypeKeys={traitTypeKeys}>\n\t\t\t{selectedPresets.length > 0 ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tid={selectTextStylePresetPopoutId(tag)}\n\t\t\t\t\tnavigationTitle={tagName + \" Styles\"}\n\t\t\t\t\ttitle={getTextStylePresetsTitle(selectedPresets)}\n\t\t\t\t\tpopout={<SelectTextStyleEntityAssetPopout tag={tag} nodeIds={nodeIds} selectedIds={selectedIds} />}\n\t\t\t\t\tpreview={<PresetIconInverted foreground={commonTextColor} icon={tag} />}\n\t\t\t\t\tonDelete={deselectPreset}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\ttype=\"preset\"\n\t\t\t\t\ticon={<PresetIcon icon={tag} />}\n\t\t\t\t\tonMouseDown={addTextStylePreset(nodeIds, tag)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n\nexport function getTextStylePresetsTitle(presets: TextStylePresetNode[]) {\n\tif (presets.length > 1) return Dictionary.Mixed\n\n\tconst [preset] = presets\n\tif (!preset) return Dictionary.SelectEllipsis\n\n\tconst presetName = preset.getName()\n\n\tconst breakpoints = getTextStylePresetBreakpointsFromTree(engine.tree, preset)\n\tif (breakpoints.length === 0) return presetName\n\n\tconst breakpoint = getBreakpointFromActiveScreen(engine, breakpoints)\n\tconst index = breakpoint ? breakpoints.indexOf(breakpoint) : -1\n\tconst breakpointName = getBreakpointLabel(index + 1, breakpoints.length + 1)\n\n\treturn (\n\t\t<TruncateWithEllipsisAndTitle title={`${presetName} (${breakpointName})`}>\n\t\t\t{presetName} <span style={{ color: colors.popoutButtonTextPlaceholder }}>({breakpointName})</span>\n\t\t</TruncateWithEllipsisAndTitle>\n\t)\n}\n", "import \"TextPanel.styles_1ufitfz.wyw.css\"; export const disabled = \"disabled_d14twz3y\";", "import type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttextWrapBalanceAddedDefaults,\n\twithTextWrapBalance,\n} from \"document/models/CanvasTree/traits/WithTextWrapBalance.ts\"\n\nexport function addTextWrapBalanceForNodes(tree: CanvasTree, nodeIds: NodeID[]) {\n\tfor (const node of tree.getNodesWithTrait(nodeIds, withTextWrapBalance)) {\n\t\tnode.set(textWrapBalanceAddedDefaults)\n\t}\n}\n", "import { Translatable as T, useReadOnly } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ReducedRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { perspectiveEnabledDefaults, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport React from \"react\"\nimport {\n\tcanReadClipboardWithoutPromptingUser,\n\tclipboardReadType,\n\tisClipboardSupported,\n} from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isBoolean, isNumber, isObject } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PerspectiveRow } from \"../rows/PerspectiveRow.tsx\"\nimport { BackfaceVisibilityRow } from \"../rows/TransformRows/BackfaceVisibilityRow.tsx\"\nimport { DepthRow } from \"../rows/TransformRows/DepthRow.tsx\"\nimport { OriginRow } from \"../rows/TransformRows/OriginRow.tsx\"\nimport { Rotation3DRow } from \"../rows/TransformRows/RotationRow.tsx\"\nimport { ScaleRow } from \"../rows/TransformRows/ScaleRow.tsx\"\nimport { SkewRow } from \"../rows/TransformRows/SkewRow.tsx\"\nimport {\n\tTransformStyleRow,\n\tresetPropertiesIncompatibleWithPreserve3d,\n} from \"../rows/TransformRows/TransformStyleRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"./PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"./icons/IconSectionHeaderPlus.tsx\"\n\nasync function canPaste(tree: CanvasTree, selection: NodeID[]) {\n\t// In Safari we cannot access the clipboard on right-click, that's why we assume the\n\t// happy flow here, and enable pasting even if we cannot read the clipboard.\n\tif (!(await canReadClipboardWithoutPromptingUser())) return true\n\n\tconst values = await clipboardReadType(\"application/x-framer-transforms\")\n\tif (!isObject(values)) return false\n\n\t// All nodes in the selection must support the WithTransforms trait in order to\n\t// allow pasting.\n\treturn selection.every(id => {\n\t\tconst node = tree.get(id)\n\t\treturn node ? withTransforms(node) : true\n\t})\n}\n\ninterface Props\n\textends\n\t\tOmit<ReducedTransforms, \"anyNodesWithTransforms\">,\n\t\tPick<ReducedRotation, \"rotation\" | \"onlyNodesWithRotation\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const TransformsPanel = React.memo(function TransformsPanel({\n\tnodeIds,\n\tscale,\n\trotation,\n\trotateX,\n\trotate3d,\n\trotateY,\n\tskewX,\n\tskewY,\n\ttranslateZ,\n\tperspective,\n\ttransformOriginX,\n\ttransformOriginY,\n\ttransformStylePreserve3d,\n\tbackfaceVisibility,\n\tonlyNodesWithTransformOrigin,\n\tonlyNodesWithRotation,\n}: Props) {\n\tconst readonly = useReadOnly()\n\n\tconst hasAnyRotate =\n\t\tisNumber(rotation) || isMixed(rotation) || isDynamicValue(rotation) || isMixed(rotate3d) || rotate3d === true\n\tconst hasAnyScale = isNumber(scale) || isMixed(scale)\n\tconst hasAnySkew = isNumber(skewX) || isMixed(skewX) || isNumber(skewY) || isMixed(skewY)\n\tconst hasAnyDepth = isNumber(translateZ) || isMixed(translateZ)\n\tconst hasAnyPerspective = isNumber(perspective) || isMixed(perspective) || isDynamicValue(perspective)\n\tconst hasAnyOrigin =\n\t\tisNumber(transformOriginX) || isMixed(transformOriginX) || isNumber(transformOriginY) || isMixed(transformOriginY)\n\n\tconst hasAnyTransformStylePreserve3d = isBoolean(transformStylePreserve3d) || isMixed(transformStylePreserve3d)\n\tconst hasAnyBackfaceVisibility = isBoolean(backfaceVisibility) || isMixed(backfaceVisibility)\n\n\tconst showMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (readonly || event.button === 2) return\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Scale,\n\t\t\t\t\t\tenabled: !hasAnyScale,\n\t\t\t\t\t\tchecked: hasAnyScale,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ scale: 1 })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"scale\" })\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: Dictionary.Skew,\n\t\t\t\t\t\tenabled: !hasAnySkew,\n\t\t\t\t\t\tchecked: hasAnySkew,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ skewX: 0, skewY: 0 })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"skew\" })\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: Dictionary.Rotate,\n\t\t\t\t\t\tenabled: !hasAnyRotate,\n\t\t\t\t\t\tchecked: hasAnyRotate,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withRotation)) {\n\t\t\t\t\t\t\t\tnode.set({ rotation: 0 })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"rotate\" })\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: Dictionary.Depth,\n\t\t\t\t\t\tenabled: !hasAnyDepth,\n\t\t\t\t\t\tchecked: hasAnyDepth,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ translateZ: 0 })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"depth\" })\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: Dictionary.Perspective,\n\t\t\t\t\t\tchecked: hasAnyPerspective,\n\t\t\t\t\t\tenabled: !hasAnyPerspective,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set(perspectiveEnabledDefaults)\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"perspective\" })\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: Dictionary.Origin,\n\t\t\t\t\t\tchecked: hasAnyOrigin,\n\t\t\t\t\t\tenabled: onlyNodesWithTransformOrigin && !hasAnyOrigin,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ transformOriginX: 0.5, transformOriginY: 0.5 })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"transformOrigin\" })\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: Dictionary.Backface,\n\t\t\t\t\t\tchecked: hasAnyBackfaceVisibility,\n\t\t\t\t\t\tenabled: !hasAnyBackfaceVisibility,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ backfaceVisibility: true })\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"backfaceVisibility\" })\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: Dictionary.Preserve3D,\n\t\t\t\t\t\tchecked: hasAnyTransformStylePreserve3d,\n\t\t\t\t\t\tenabled: !hasAnyTransformStylePreserve3d,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\t\t\t\t\tnode.set({ transformStylePreserve3d: true })\n\t\t\t\t\t\t\t\tresetPropertiesIncompatibleWithPreserve3d(node)\n\t\t\t\t\t\t\t\trecord(\"transforms_add\", { transform: \"transformStylePreserve3d\" })\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{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\treadonly,\n\t\t\thasAnyScale,\n\t\t\thasAnySkew,\n\t\t\thasAnyRotate,\n\t\t\thasAnyDepth,\n\t\t\thasAnyPerspective,\n\t\t\thasAnyOrigin,\n\t\t\tonlyNodesWithTransformOrigin,\n\t\t\thasAnyBackfaceVisibility,\n\t\t\thasAnyTransformStylePreserve3d,\n\t\t\tnodeIds,\n\t\t],\n\t)\n\n\tconst onContextMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (readonly || !isClipboardSupported()) return\n\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTransforms)\n\t\t\tconst singleNode = nodes[0]\n\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Copy,\n\t\t\t\t\t\tclick: async () => singleNode && Clipboard.copyTransforms(singleNode),\n\t\t\t\t\t\tenabled: singleNode && nodes.length === 1,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: Dictionary.Paste,\n\t\t\t\t\t\tclick: async () => Clipboard.pasteTransforms(engine, nodeIds),\n\t\t\t\t\t\tenabled: await canPaste(engine.tree, nodeIds),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[nodeIds, readonly],\n\t)\n\n\tconst showPlusButton = !(\n\t\thasAnyScale &&\n\t\thasAnySkew &&\n\t\thasAnyRotate &&\n\t\thasAnyDepth &&\n\t\thasAnyPerspective &&\n\t\thasAnyOrigin &&\n\t\thasAnyBackfaceVisibility &&\n\t\thasAnyTransformStylePreserve3d\n\t)\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Transforms</T>}\n\t\t\t\t\tclickable={showPlusButton && !readonly}\n\t\t\t\t\tonMouseDown={showPlusButton ? showMenu : undefined}\n\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t>\n\t\t\t\t\t{showPlusButton && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t{hasAnyScale && <ScaleRow scale={scale} nodeIds={nodeIds} />}\n\t\t\t{hasAnyRotate && (\n\t\t\t\t<Rotation3DRow\n\t\t\t\t\trotateX={rotateX}\n\t\t\t\t\trotateY={rotateY}\n\t\t\t\t\trotate3d={rotate3d}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\trotation={rotation}\n\t\t\t\t\tonlyNodesWithRotation={onlyNodesWithRotation}\n\t\t\t\t\tonlyShapeNodes={false}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{hasAnySkew && <SkewRow skewX={skewX} skewY={skewY} nodeIds={nodeIds} />}\n\t\t\t{hasAnyDepth && <DepthRow translateZ={translateZ} nodeIds={nodeIds} />}\n\t\t\t{hasAnyPerspective && <PerspectiveRow nodeIds={nodeIds} perspective={perspective} />}\n\t\t\t{onlyNodesWithTransformOrigin && hasAnyOrigin && (\n\t\t\t\t<OriginRow transformOriginX={transformOriginX} transformOriginY={transformOriginY} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t\t{hasAnyBackfaceVisibility && <BackfaceVisibilityRow backfaceVisibility={backfaceVisibility} nodeIds={nodeIds} />}\n\t\t\t{hasAnyTransformStylePreserve3d && (\n\t\t\t\t<TransformStyleRow transformStylePreserve3d={transformStylePreserve3d} nodeIds={nodeIds} />\n\t\t\t)}\n\t\t</Panel>\n\t)\n})\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithStyleAppearEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { withStyleAppearPageEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { withStyleTransformEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport {\n\tdefaultPerspective,\n\tmaxPerspective,\n\tminPerspective,\n\twithTransforms,\n} from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isArray, isNumber } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"perspective-popout\"\n\nfunction removeFallbackPerspective(node: CanvasNode) {\n\tif (withStyleAppearPageEffect(node) && node.styleAppearEffectEnabled) {\n\t\tconst update: Partial<WithStyleAppearEffect> = {}\n\t\tconst enterEffectPerspective = node.enterEffectPerspective\n\t\tif (isNumber(enterEffectPerspective) && enterEffectPerspective > 0) {\n\t\t\tupdate.enterEffectPerspective = undefined\n\t\t}\n\t\tconst styleAppearEffectPerspective = node.styleAppearEffectPerspective\n\t\tif (isNumber(styleAppearEffectPerspective) && styleAppearEffectPerspective > 0) {\n\t\t\tupdate.styleAppearEffectPerspective = undefined\n\t\t}\n\t\tconst exitEffectPerspective = node.exitEffectPerspective\n\t\tif (isNumber(exitEffectPerspective) && exitEffectPerspective > 0) {\n\t\t\tupdate.exitEffectPerspective = undefined\n\t\t}\n\n\t\tnode.set(update)\n\t}\n\n\tif (\n\t\twithStyleTransformEffect(node) &&\n\t\tnode.styleTransformEffectEnabled &&\n\t\tisArray(node.styleTransformEffectScrollTargets)\n\t) {\n\t\tlet hasUpdate = false\n\n\t\tconst targets = node.styleTransformEffectScrollTargets.map(target => {\n\t\t\tconst value = target.style.transformPerspective\n\t\t\tif (isNumber(value) && value > 0) {\n\t\t\t\thasUpdate = true\n\t\t\t\treturn { ...target, transformPerspective: undefined }\n\t\t\t}\n\t\t\treturn target\n\t\t})\n\n\t\tif (hasUpdate) node.set({ styleTransformEffectScrollTargets: targets })\n\t}\n}\n\ninterface PerspectiveRowProps extends Pick<ReducedTransforms, \"perspective\"> {\n\tnodeIds: NodeID[]\n}\n\nconst traitTypes = [TraitType.Perspective]\n\nexport const PerspectiveRow = React.memo(function PerspectiveRow({\n\tnodeIds,\n\tperspective,\n}: PerspectiveRowProps): JSX.Element | null {\n\tconst canCopyPerspective = !isMixed(perspective)\n\tconst [canPastePerspective, pastePerspective, copyPerspective] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Perspective,\n\t\tnodeIds,\n\t\tcanCopyPerspective,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tconst perspectiveValue = isNumber(value) ? value : defaultPerspective\n\t\t\t\tnode.set({ perspective: perspectiveValue })\n\t\t\t\tremoveFallbackPerspective(node)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst clearValue = useEngineCallback((): void => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ perspective: undefined })\n\t\t\tremoveFallbackPerspective(node)\n\t\t}\n\t}, [nodeIds])\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tif (!isDynamicValue(node.perspective)) continue\n\n\t\t\tconst perspectiveValue = isVariableReference(node.perspective)\n\t\t\t\t? getVariableValue(engine, node.perspective)\n\t\t\t\t: node.perspective\n\n\t\t\tnode.set({ perspective: isNumber(perspectiveValue) ? perspectiveValue : undefined })\n\t\t}\n\t}, [nodeIds])\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isNumber(perspective) ? perspective : 0,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: \"perspective\",\n\t\t\t\toptions: { min: minPerspective, max: maxPerspective, step: 1 },\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ perspective: variableRef })\n\t\t\t}\n\t\t},\n\t\t[perspective, nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(dynamicValue: DynamicValue) => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withTransforms).forEach(node => {\n\t\t\t\tnode.set({ perspective: dynamicValue })\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tif (!isNumber(perspective) && !isDynamicValue(perspective)) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Perspective\"\n\t\t\ttraitTypes={traitTypes}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(perspective) ? perspective : null}\n\t\t\tvariableType={ControlType.Number}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tonDelete={clearValue}\n\t\t\tonCopy={copyPerspective}\n\t\t\tonPaste={pastePerspective}\n\t\t\tcopyEnabled={canCopyPerspective}\n\t\t\tpasteEnabled={canPastePerspective}\n\t\t>\n\t\t\t{isDynamicValue(perspective) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Perspective\"\n\t\t\t\t\tvalue={perspective}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tdefaultValue={undefined}\n\t\t\t\t\t\tmax={maxPerspective}\n\t\t\t\t\t\tmin={minPerspective}\n\t\t\t\t\t\tonChange={updateValue}\n\t\t\t\t\t\tonClear={clearValue}\n\t\t\t\t\t\tvalue={perspective}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider onChange={updateValue} value={perspective} min={minPerspective} max={maxPerspective} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nexport const BackfaceVisibilityRow = React.memo(function BackfaceVisibilityRow({\n\tbackfaceVisibility,\n\tnodeIds,\n}: Pick<ReducedTransforms, \"backfaceVisibility\"> & { nodeIds: NodeID[] }) {\n\tconst removeBackfaceVisibility = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ backfaceVisibility: undefined })\n\t\t\trecord(\"transforms_remove\", { transform: \"backfaceVisibility\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleChange = useEngineCallback(\n\t\t(value: boolean) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ backfaceVisibility: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst copyEnabled = !isMixed(backfaceVisibility) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(\n\t\tTraitType.BackfaceVisibility,\n\t\tnodeIds,\n\t\tcopyEnabled,\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Backface\"\n\t\t\tonDelete={removeBackfaceVisibility}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\ttraitTypes={[TraitType.BackfaceVisibility]}\n\t\t>\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle=\"Visible\"\n\t\t\t\t\tselected={backfaceVisibility === true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle=\"Hidden\"\n\t\t\t\t\tselected={backfaceVisibility === false}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nexport const DepthRow = React.memo(function DepthRow({\n\ttranslateZ,\n\tnodeIds,\n}: Pick<ReducedTransforms, \"translateZ\"> & { nodeIds: NodeID[] }) {\n\tconst removeDepth = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ translateZ: undefined })\n\t\t\trecord(\"transforms_remove\", { transform: \"depth\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleChange = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ translateZ: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst depth = notFoundToUndefined(translateZ) ?? 0\n\n\tconst copyEnabled = !isMixed(depth) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.TranslateZ, nodeIds, copyEnabled)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Depth\"\n\t\t\tonDelete={removeDepth}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\ttraitTypes={[TraitType.TranslateZ]}\n\t\t>\n\t\t\t<NumberInputWithTicker onChange={handleChange} onClear={removeDepth} value={depth} step={1} />\n\t\t\t<Slider onChange={handleChange} value={depth} max={500} min={-500}></Slider>\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport type { Mixed } from \"@framerjs/shared\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { DEFAULT_ORIGIN, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nfunction toValue(origin: Reduced<number | undefined>): number | Mixed {\n\tif (isMixed(origin)) return origin\n\tif (isUndefined(origin) || isNotFound(origin)) return 50\n\treturn origin * 100\n}\n\ntype WithTransformOrigin = Pick<WithTransforms, \"transformOriginX\" | \"transformOriginY\">\n\nexport const OriginRow = React.memo(function OriginRow({\n\tnodeIds,\n\ttransformOriginX,\n\ttransformOriginY,\n}: Pick<ReducedTransforms, \"transformOriginX\" | \"transformOriginY\"> & { nodeIds: NodeID[] }) {\n\tconst handleChange = <T extends keyof WithTransformOrigin>(key: T) => {\n\t\treturn engine.scheduler.wrapHandler((value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ [key]: value / 100 })\n\t\t\t}\n\t\t})\n\t}\n\n\tconst removeOrigin = useEngineCallback(\n\t\t(axis: \"x\" | \"y\" | true) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tswitch (axis) {\n\t\t\t\t\tcase \"x\":\n\t\t\t\t\t\tnode.set({ transformOriginX: undefined })\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"y\":\n\t\t\t\t\t\tnode.set({ transformOriginY: undefined })\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase true:\n\t\t\t\t\t\tnode.set({ transformOriginX: undefined, transformOriginY: undefined })\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(axis)\n\t\t\t\t}\n\t\t\t\trecord(\"transforms_remove\", { transform: \"transformOrigin\" })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst removeOriginX = React.useCallback(() => removeOrigin(\"x\"), [removeOrigin])\n\tconst removeOriginY = React.useCallback(() => removeOrigin(\"y\"), [removeOrigin])\n\n\tconst x = toValue(transformOriginX)\n\tconst y = toValue(transformOriginY)\n\n\tconst copyEnabled = !isMixed(x) && !isMixed(y) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.TransformOrigin, nodeIds, copyEnabled)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Origin\"\n\t\t\tonDelete={() => removeOrigin(true)}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\ttraitTypes={[TraitType.TransformOrigin]}\n\t\t>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tonChange={handleChange(\"transformOriginX\")}\n\t\t\t\tonClear={removeOriginX}\n\t\t\t\tvalue={x}\n\t\t\t\tdefaultValue={DEFAULT_ORIGIN * 100}\n\t\t\t\tstep={1}\n\t\t\t\tmin={0}\n\t\t\t\tmax={100}\n\t\t\t\tunit=\"%\"\n\t\t\t\tlabel=\"X\"\n\t\t\t/>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tonChange={handleChange(\"transformOriginY\")}\n\t\t\t\tonClear={removeOriginY}\n\t\t\t\tvalue={y}\n\t\t\t\tdefaultValue={DEFAULT_ORIGIN * 100}\n\t\t\t\tstep={1}\n\t\t\t\tmin={0}\n\t\t\t\tmax={100}\n\t\t\t\tunit=\"%\"\n\t\t\t\tlabel=\"Y\"\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n})\n", "import {\n\tIconFlipHorizontal,\n\tIconFlipVertical,\n\tNumberInputWithTicker,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tSlider,\n} from \"@framerjs/fresco\"\nimport { isNumber } from \"@framerjs/fresco/src/components/utils/typeCheck\"\nimport { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport type { FlipAxis } from \"document/components/utils/dimensions.ts\"\nimport { flipShapes } from \"document/components/utils/dimensions.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { ReducedRotation, WithRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { DEFAULT_ROTATION, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { FusedNumberInputs } from \"../../inputs/FusedNumberInputs.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { ROTATE_MAX_VALUE, ROTATE_MIN_VALUE, rotate3dLabels } from \"../../utils/rotate.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nfunction useRotationUpdate<T extends keyof (WithTransforms & WithRotation)>(key: T, nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: (WithTransforms & WithRotation)[T]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ [key]: value })\n\t\t\t}\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\ninterface Props extends Pick<ReducedTransforms, \"rotate3d\" | \"rotateX\" | \"rotateY\">, ReducedRotation {\n\tnodeIds: NodeID[]\n\tonlyShapeNodes: boolean\n}\n\nexport const Rotation3DRow = React.memo(function Rotation3DRow({\n\tnodeIds,\n\trotation,\n\trotate3d,\n\trotateX,\n\trotateY,\n\tonlyNodesWithRotation,\n}: Props) {\n\tconst handleRotate = useRotationUpdate(\"rotation\", nodeIds)\n\tconst handleRotateX = useRotationUpdate(\"rotateX\", nodeIds)\n\tconst handleRotateY = useRotationUpdate(\"rotateY\", nodeIds)\n\tconst handleRotate3d = useRotationUpdate(\"rotate3d\", nodeIds)\n\n\tconst onRotation3DValueChange = useCallback(\n\t\t(index: number, value: number) => {\n\t\t\tswitch (index) {\n\t\t\t\tcase 0:\n\t\t\t\t\thandleRotateX(value)\n\t\t\t\t\tbreak\n\t\t\t\tcase 1:\n\t\t\t\t\thandleRotateY(value)\n\t\t\t\t\tbreak\n\t\t\t\tcase 2:\n\t\t\t\t\thandleRotate(value)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t},\n\t\t[handleRotate, handleRotateX, handleRotateY],\n\t)\n\n\tconst canCopyRotate = !isMixed(rotation) && !isMixed(rotateX) && !isMixed(rotateY) && !isMixed(rotate3d)\n\n\tif (isDynamicValue(rotation)) {\n\t\treturn (\n\t\t\t<RotationRowBase\n\t\t\t\twithoutDescendantIds={nodeIds}\n\t\t\t\trotation={rotation}\n\t\t\t\tonlyNodesWithRotation={onlyNodesWithRotation}\n\t\t\t\tallowRemove\n\t\t\t/>\n\t\t)\n\t}\n\n\tconst primaryRotationValue = rotate3d ? undefined : rotation\n\n\treturn (\n\t\t<>\n\t\t\t<RotationRowBase\n\t\t\t\twithoutDescendantIds={nodeIds}\n\t\t\t\trotation={primaryRotationValue}\n\t\t\t\tonlyNodesWithRotation={onlyNodesWithRotation}\n\t\t\t\tcanCopy={canCopyRotate}\n\t\t\t\tallowRemove\n\t\t\t>\n\t\t\t\t<SegmentedControl>\n\t\t\t\t\t<SegmentedControlItem identifier={false} title=\"2D\" selected={rotate3d === false} onSelect={handleRotate3d} />\n\t\t\t\t\t<SegmentedControlItem identifier={true} title=\"3D\" selected={rotate3d === true} onSelect={handleRotate3d} />\n\t\t\t\t</SegmentedControl>\n\t\t\t</RotationRowBase>\n\n\t\t\t{rotate3d !== false && (\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<FusedNumberInputs\n\t\t\t\t\t\tlabels={rotate3dLabels}\n\t\t\t\t\t\tvalues={[\n\t\t\t\t\t\t\tnotFoundToUndefined(rotateX) ?? DEFAULT_ROTATION,\n\t\t\t\t\t\t\tnotFoundToUndefined(rotateY) ?? DEFAULT_ROTATION,\n\t\t\t\t\t\t\tnotFoundToUndefined(rotation) ?? DEFAULT_ROTATION,\n\t\t\t\t\t\t]}\n\t\t\t\t\t\tdefaultValues={[DEFAULT_ROTATION, DEFAULT_ROTATION, DEFAULT_ROTATION]}\n\t\t\t\t\t\tminValue={ROTATE_MIN_VALUE}\n\t\t\t\t\t\tmaxValue={ROTATE_MAX_VALUE}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tonValueChange={onRotation3DValueChange}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\ninterface Rotation2DRowProps extends Omit<RotationRowProps, \"allowRemove\"> {\n\tonlyShapeNodes: boolean\n}\n\nexport const Rotation2DRow = React.memo(function Rotation2DRow({\n\tonlyShapeNodes,\n\twithoutDescendantIds,\n\trotation = 0,\n\t...props\n}: Rotation2DRowProps) {\n\tconst handleRotate = useRotationUpdate(\"rotation\", withoutDescendantIds)\n\n\tconst numberValue = isDynamicValue(rotation) ? 0 : rotation\n\n\tlet secondaryControl: JSX.Element\n\tif (onlyShapeNodes) {\n\t\tconst flip = engine.scheduler.wrapHandler((direction: FlipAxis) => {\n\t\t\tif (!onlyShapeNodes) return\n\t\t\tflipShapes(engine.tree, engine, withoutDescendantIds, direction)\n\t\t})\n\n\t\tsecondaryControl = (\n\t\t\t<SegmentedControl>\n\t\t\t\t<SegmentedControlItem<FlipAxis>\n\t\t\t\t\ttitle=\"Flip Horizontally\"\n\t\t\t\t\tidentifier=\"horizontal\"\n\t\t\t\t\tselected={false}\n\t\t\t\t\tonSelect={flip}\n\t\t\t\t>\n\t\t\t\t\t<IconFlipHorizontal />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem<FlipAxis> title=\"Flip Vertically\" identifier=\"vertical\" selected={false} onSelect={flip}>\n\t\t\t\t\t<IconFlipVertical />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t)\n\t} else {\n\t\tsecondaryControl = <Slider value={notFoundToUndefined(numberValue)} max={360} onChange={handleRotate} />\n\t}\n\n\treturn (\n\t\t<RotationRowBase withoutDescendantIds={withoutDescendantIds} rotation={rotation} allowRemove={false} {...props}>\n\t\t\t{secondaryControl}\n\t\t</RotationRowBase>\n\t)\n})\n\nconst popoutId = \"rotationValueTransform\"\n\nconst rotationTraitTypes = [TraitType.Rotation]\n\ninterface RotationRowProps extends Pick<ReducedRotation, \"rotation\" | \"onlyNodesWithRotation\"> {\n\twithoutDescendantIds: NodeID[]\n\tallowRemove: boolean\n\tcanCopy?: boolean\n}\n\nconst RotationRowBase = React.memo(function RotationRow({\n\tchildren,\n\tallowRemove,\n\tcanCopy = true,\n\t...props\n}: React.PropsWithChildren<RotationRowProps>) {\n\tconst { onlyNodesWithRotation, rotation, withoutDescendantIds } = props\n\tconst canCopyRotation = canCopy && onlyNodesWithRotation && !isMixed(rotation) && isClipboardSupported()\n\tconst [canPasteRotation, pasteRotation, copyRotation] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Rotation,\n\t\twithoutDescendantIds,\n\t\tcanCopyRotation,\n\t)\n\n\tconst supportsVariables = useSupportsVariable(\"rotation\")\n\n\tconst removeRotations = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(withoutDescendantIds, withRotation)) {\n\t\t\tnode.set({ rotation: undefined })\n\t\t\tif (withTransforms(node)) {\n\t\t\t\tnode.set({ rotate3d: undefined, rotateX: undefined, rotateY: undefined })\n\t\t\t\trecord(\"transforms_remove\", { transform: \"rotate\" })\n\t\t\t}\n\t\t}\n\t}, [withoutDescendantIds])\n\n\tconst onChange = useRotationUpdate(\"rotation\", withoutDescendantIds)\n\n\tconst handleRotationChange = useEngineCallback(\n\t\t(value: number) => {\n\t\t\t// when changing the number input ticker and rotation type is 3d, we should switch to 2d\n\t\t\tfor (const node of engine.tree.getNodes(withoutDescendantIds)) {\n\t\t\t\tif (!withRotation(node)) continue\n\t\t\t\tif (withTransforms(node)) node.set({ rotate3d: false })\n\t\t\t\tnode.set({ rotation: value })\n\t\t\t}\n\t\t},\n\t\t[withoutDescendantIds],\n\t)\n\n\tif (isNotFound(rotation)) return null\n\n\tconst onCreateRotationVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Number,\n\t\t\tname: \"rotation\",\n\t\t\tinitialValue: isNumber(rotation) ? rotation : 0,\n\t\t\toptions: { unit: \"\u00B0\" },\n\t\t})\n\n\t\tif (variableRef) onChange(variableRef)\n\t})\n\n\tconst onRemoveDynamicValue = () => {\n\t\tif (!isDynamicValue(rotation)) return\n\t\tif (isVariableReference(rotation)) {\n\t\t\tconst variableValue = getVariableValue(engine, rotation)\n\t\t\tconst rotationValue = isNumber(variableValue) ? variableValue : 0\n\t\t\tonChange(rotationValue)\n\t\t} else if (isComputedValue(rotation)) {\n\t\t\tonChange(0)\n\t\t} else {\n\t\t\tshouldBeNever(rotation)\n\t\t}\n\t}\n\n\tconst onSelectComputedValue = (computedValue: ComputedValue) => {\n\t\tonChange(computedValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Rotate}\n\t\t\ttraitTypes={rotationTraitTypes}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tsupportsComputedValues={supportsVariables}\n\t\t\tonCopy={copyRotation}\n\t\t\tcopyEnabled={canCopyRotation}\n\t\t\tonPaste={pasteRotation}\n\t\t\tpasteEnabled={canPasteRotation}\n\t\t\tonCreateVariable={onCreateRotationVariable}\n\t\t\tonSelectVariable={onChange}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(rotation) ? rotation : null}\n\t\t\tvariableType={ControlType.Number}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tonDelete={allowRemove ? removeRotations : undefined}\n\t\t>\n\t\t\t{isDynamicValue(rotation) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={Dictionary.Rotation}\n\t\t\t\t\tvalue={rotation}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={onChange}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={notFoundToUndefined(rotation)}\n\t\t\t\t\t\tonChange={handleRotationChange}\n\t\t\t\t\t\tunit=\"\u00B0\"\n\t\t\t\t\t\tmin={ROTATE_MIN_VALUE}\n\t\t\t\t\t\tmax={ROTATE_MAX_VALUE}\n\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\tdata-testid=\"rotationrow-input\"\n\t\t\t\t\t/>\n\t\t\t\t\t{children}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { DEFAULT_SCALE, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nexport const ScaleRow = React.memo(function ScaleRow({\n\tnodeIds,\n\tscale,\n}: Pick<ReducedTransforms, \"scale\"> & { nodeIds: NodeID[] }) {\n\tconst handleScale = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ scale: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\tconst removeScale = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ scale: undefined })\n\t\t\trecord(\"transforms_remove\", { transform: \"scale\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst value = notFoundToUndefined(scale) ?? DEFAULT_SCALE\n\n\tconst copyEnabled = !isMixed(value) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.Scale, nodeIds, copyEnabled)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Scale\"\n\t\t\tonDelete={removeScale}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\ttraitTypes={[TraitType.Scale]}\n\t\t>\n\t\t\t<NumberInputWithTickerAndStepper value={value} defaultValue={DEFAULT_SCALE} onChange={handleScale} step={0.1} />\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTicker } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { DEFAULT_SKEW, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nfunction useUpdateSkew<T extends keyof Pick<WithTransforms, \"skewX\" | \"skewY\">>(nodeIds: NodeID[], key: T) {\n\treturn useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ [key]: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, key],\n\t)\n}\n\nexport const SkewRow = React.memo(function SkewRow({\n\tnodeIds,\n\tskewX,\n\tskewY,\n}: Pick<ReducedTransforms, \"skewX\" | \"skewY\"> & { nodeIds: NodeID[] }) {\n\tconst removeSkew = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ skewX: undefined, skewY: undefined })\n\t\t\trecord(\"transforms_remove\", { transform: \"skew\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst changeSkewX = useUpdateSkew(nodeIds, \"skewX\")\n\tconst changeSkewY = useUpdateSkew(nodeIds, \"skewY\")\n\n\tconst x = notFoundToUndefined(skewX) ?? DEFAULT_SKEW\n\tconst y = notFoundToUndefined(skewY) ?? DEFAULT_SKEW\n\n\tconst copyEnabled = !isMixed(x) && !isMixed(y) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.Skew, nodeIds, copyEnabled)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Skew\"\n\t\t\tonDelete={removeSkew}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\ttraitTypes={[TraitType.Skew]}\n\t\t>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tonChange={changeSkewX}\n\t\t\t\tonClear={removeSkew}\n\t\t\t\tvalue={x}\n\t\t\t\tdefaultValue={DEFAULT_SKEW}\n\t\t\t\tstep={1}\n\t\t\t\tunit=\"\u00B0\"\n\t\t\t\tlabel=\"X\"\n\t\t\t/>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tonChange={changeSkewY}\n\t\t\t\tonClear={removeSkew}\n\t\t\t\tvalue={y}\n\t\t\t\tdefaultValue={DEFAULT_SKEW}\n\t\t\t\tstep={1}\n\t\t\t\tunit=\"\u00B0\"\n\t\t\t\tlabel=\"Y\"\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { filterDefaults, hasAnyFilters, withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { opacityDefaults, withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport { isOverflowVisuallyHidden } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport { withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { ReducedTransforms } from \"document/models/CanvasTree/traits/utils/reduceTransforms.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nexport const TransformStyleRow = React.memo(function TransformStyleRow({\n\ttransformStylePreserve3d,\n\tnodeIds,\n}: Pick<ReducedTransforms, \"transformStylePreserve3d\"> & { nodeIds: NodeID[] }) {\n\tconst removeValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\tnode.set({ transformStylePreserve3d: undefined })\n\t\t\trecord(\"transforms_remove\", { transform: \"transformStylePreserve3d\" })\n\t\t}\n\t}, [nodeIds])\n\n\tconst handleSelect = useEngineCallback(\n\t\t(value: boolean) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTransforms)) {\n\t\t\t\tnode.set({ transformStylePreserve3d: value })\n\n\t\t\t\tif (value === true) {\n\t\t\t\t\tresetPropertiesIncompatibleWithPreserve3d(node)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst copyEnabled = !isMixed(transformStylePreserve3d) && isClipboardSupported()\n\tconst [pasteEnabled, onPaste, onCopy] = useCopyAndPasteSingleProperty(\n\t\tTraitType.TransformStylePreserve3d,\n\t\tnodeIds,\n\t\tcopyEnabled,\n\t)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Preserve\"\n\t\t\tonDelete={removeValue}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\ttraitTypes={[TraitType.TransformStylePreserve3d]}\n\t\t>\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle=\"Yes\"\n\t\t\t\t\tselected={transformStylePreserve3d === true}\n\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle=\"No\"\n\t\t\t\t\tselected={transformStylePreserve3d === false}\n\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n\n// When enabling transform style preserve 3d, we need to make sure that the layer does not have any css properties that\n// would prevent it from creating a 3d context.\nexport function resetPropertiesIncompatibleWithPreserve3d(node: CanvasNode) {\n\tif (isOverflowVisuallyHidden(node)) node.set({ overflow: \"visible\" })\n\tif (withOpacity(node) && node.opacity !== 1) node.set(opacityDefaults)\n\tif (withFilters(node) && hasAnyFilters(node)) node.set(filterDefaults)\n}\n", "import { NumberInputWithTickerAndStepper } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { DEFAULT_ROOT_FONT_SIZE, withRootFontSize } from \"document/models/CanvasTree/traits/WithRootFontSize.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedRootFontSize } from \"document/models/CanvasTree/traits/utils/reduceRootFontSize.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\n\nconst traitTypes = [TraitType.RootFontSize]\nconst minBaseFontSize = 1\n\ninterface Props extends ReducedRootFontSize {\n\tnodeIds: NodeID[]\n}\n\nexport function TypographyPanel({ nodeIds, rootFontSize }: Props) {\n\tconst handleRootFontSizeChange = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withRootFontSize)\n\t\t\tfor (const node of nodes) {\n\t\t\t\tnode.set({ rootFontSize: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\treturn (\n\t\t<Panel header={<PanelSectionHeader title=\"Typography\" />}>\n\t\t\t<PanelRow title=\"Base\" traitTypes={traitTypes}>\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tlabel=\"PX\"\n\t\t\t\t\tvalue={isFound(rootFontSize) ? rootFontSize : DEFAULT_ROOT_FONT_SIZE}\n\t\t\t\t\tmin={minBaseFontSize}\n\t\t\t\t\tdefaultValue={DEFAULT_ROOT_FONT_SIZE}\n\t\t\t\t\tonChange={handleRootFontSizeChange}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Panel>\n\t)\n}\n", "import type { WithBlending } from \"@framerjs/document-migrations/src/types/V70.ts\"\nimport { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tdefaultBlendingMode,\n\tisBlendingModeValue,\n\twithBlending,\n} from \"document/models/CanvasTree/traits/WithBlending.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedBlending } from \"document/models/CanvasTree/traits/utils/reduceBlending.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { blendingModeVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { BlendingMode } from \"library/render/traits/Blending.ts\"\nimport React from \"react\"\nimport { capitalizeFirstLetter } from \"utils/capitalizeFirstLetter.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"blending-mode-popout\"\n\nconst blendingModeTraitTypes: (keyof WithBlending)[] = [\"blendingMode\"]\n\nconst blendingModeControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"blendingMode\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface Props extends Pick<ReducedBlending, \"blendingMode\"> {\n\tnodeIds: NodeID[]\n}\n\ntype Seperator = \"separator\"\nconst separator: Seperator = \"separator\"\n\nconst allBlendingModes: (BlendingMode | Seperator)[] = [\n\t\"normal\",\n\tseparator,\n\t\"darken\",\n\t\"multiply\",\n\t\"color-burn\",\n\tseparator,\n\t\"lighten\",\n\t\"screen\",\n\t\"plus-lighter\",\n\t\"color-dodge\",\n\tseparator,\n\t\"overlay\" /* WebKit extension */,\n\t\"soft-light\",\n\t\"hard-light\",\n\tseparator,\n\t\"difference\",\n\t\"exclusion\",\n\tseparator,\n\t\"hue\",\n\t\"saturation\",\n\t\"color\",\n\t\"luminosity\",\n]\n\nfunction transformBlendModesToDisplay(mode: BlendingMode) {\n\treturn mode.split(\"-\").map(capitalizeFirstLetter).join(\" \")\n}\n\nconst outputControl = getNodePropertyControlDescription(\"blendingMode\")\n\nexport const BlendModeRow = React.memo(function BlendModeRow({ nodeIds, blendingMode }: Props) {\n\tconst canCopyBlendMode = !isMixed(blendingMode)\n\tconst [canPasteBlendMode, pasteBlendMode, copyBlendMode] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Blending,\n\t\tnodeIds,\n\t\tcanCopyBlendMode,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: BlendingMode | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withBlending)\n\t\t\tnodes.forEach(node => node.set({ blendingMode: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withBlending)\n\t\t\tnodes.forEach(node => node.set({ blendingMode: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isBlendingModeValue(blendingMode) ? blendingMode : defaultBlendingMode,\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...blendingModeVariableDefinition,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[blendingMode, updateDynamicValue],\n\t)\n\n\tconst remove = useEngineCallback(() => {\n\t\tupdateValue(undefined)\n\t}, [updateValue])\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withBlending)) {\n\t\t\tif (!isDynamicValue(node.blendingMode)) continue\n\n\t\t\tconst blendingModeValue = isVariableReference(blendingMode)\n\t\t\t\t? getVariableValue(engine, blendingMode)\n\t\t\t\t: node.blendingMode\n\n\t\t\tnode.set({ blendingMode: isBlendingModeValue(blendingModeValue) ? blendingModeValue : \"normal\" })\n\t\t}\n\t}, [nodeIds, blendingMode])\n\n\tif (isNotFound(blendingMode) || isUndefined(blendingMode)) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Blending\"\n\t\t\ttraitTypeKeys={blendingModeTraitTypes}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(blendingMode) ? blendingMode : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tcontrolKey={blendingModeControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={blendingModeControlReferenceInfo.controlSourceIdentifier}\n\t\t\tonDelete={remove}\n\t\t\tonCopy={copyBlendMode}\n\t\t\tonPaste={pasteBlendMode}\n\t\t\tcopyEnabled={canCopyBlendMode}\n\t\t\tpasteEnabled={canPasteBlendMode}\n\t\t>\n\t\t\t{isDynamicValue(blendingMode) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Blending\"\n\t\t\t\t\tvalue={blendingMode}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={outputControl}\n\t\t\t\t\tcontrolReferenceInfo={blendingModeControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton mixed={isMixed(blendingMode)}>\n\t\t\t\t\t\t{allBlendingModes.map((blending, idx) => {\n\t\t\t\t\t\t\tif (blending === separator) {\n\t\t\t\t\t\t\t\treturn <PopupButtonItem key={idx} type=\"divider\" />\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={blending}\n\t\t\t\t\t\t\t\t\tidentifier={blending}\n\t\t\t\t\t\t\t\t\ttitle={transformBlendModesToDisplay}\n\t\t\t\t\t\t\t\t\tselected={blending === blendingMode}\n\t\t\t\t\t\t\t\t\tonSelect={updateValue}\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</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withDraggable } from \"document/models/CanvasTree/traits/WithDraggable.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedDraggable } from \"document/models/CanvasTree/traits/utils/reduceDraggable.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isBoolean, isUndefined } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst draggableTraitTypes = [TraitType.Draggable]\n\nconst popoutId = \"draggablePopoutId\"\n\nconst title = \"Draggable\"\n\ninterface Props extends ReducedDraggable {\n\tnodeIds: NodeID[]\n}\n\nexport const DraggableRow = React.memo(function DraggableRow({ onlyNodesWithDraggable, nodeIds, draggable }: Props) {\n\tconst canCopyDraggable = !isMixed(draggable) && isClipboardSupported()\n\tconst [canPasteDraggable, pasteDraggable, copyDraggable] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Draggable,\n\t\tnodeIds,\n\t\tcanCopyDraggable,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: boolean | DynamicValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withDraggable)\n\t\t\tnodes.forEach(node => node.set({ draggable: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateValue(value)\n\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tname: title,\n\t\t\t\tinitialValue: isBoolean(draggable) ? draggable : false,\n\t\t\t})\n\n\t\t\tif (!variableRef) return\n\n\t\t\tupdateValue(variableRef)\n\t\t},\n\t\t[draggable, updateValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(draggable)) return\n\n\t\tif (isVariableReference(draggable)) {\n\t\t\tconst variableValue = getVariableValue(engine, draggable)\n\t\t\tconst draggableValue = isBoolean(variableValue) ? variableValue : false\n\t\t\tupdateValue(draggableValue)\n\t\t} else if (isComputedValue(draggable)) {\n\t\t\tupdateValue(true)\n\t\t}\n\t}, [draggable, updateValue])\n\n\tconst removeValue = React.useCallback(() => updateValue(undefined), [updateValue])\n\n\tif (isNotFound(draggable) || isUndefined(draggable) || !onlyNodesWithDraggable) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={title}\n\t\t\ttraitTypes={draggableTraitTypes}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tvariableReferenceType={ControlType.Boolean}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tdynamicValue={isDynamicValue(draggable) ? draggable : null}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateValue}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tonDelete={removeValue}\n\t\t\tonCopy={copyDraggable}\n\t\t\tonPaste={pasteDraggable}\n\t\t\tcopyEnabled={canCopyDraggable}\n\t\t\tpasteEnabled={canPasteDraggable}\n\t\t>\n\t\t\t{isDynamicValue(draggable) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={title}\n\t\t\t\t\tvalue={draggable}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={updateValue}\n\t\t\t\t\tsupportsFetchDataValues\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={draggable === true}\n\t\t\t\t\t\tonSelect={updateValue}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={draggable === false}\n\t\t\t\t\t\tonSelect={updateValue}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { TransitionPopoutButton } from \"document/components/chrome/shared/TransitionEditor/TransitionPopout.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport type { WithDragEffect } from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport { hasDragEffect, withDragEffect } from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedDragEffect } from \"document/models/CanvasTree/traits/utils/reduceDragEffect.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectScrollTargetRows } from \"./shared/EffectScrollTargetRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\nconst onDragEffectChange = <T extends WithDragEffect, K extends keyof T>(key: K, nodeIds: string[]) => {\n\treturn engine.scheduler.wrapHandler((value: NonNullable<T[K]>) => {\n\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\tfor (const node of engine.tree.getNodes(nodeIds)) {\n\t\t\tif (!withDragEffect(node)) continue\n\t\t\tconst update: Partial<WithDragEffect> = { [key]: value }\n\t\t\tnode.set(update)\n\t\t\ttrackEffectUpdate(EffectType.Drag, update)\n\t\t}\n\t})\n}\n\nconst hideTransitionTypeControl: Transition[\"type\"][] = []\n\nfunction DragEffectPopout(props: Omit<Props, \"onlyNodesWithDragEffect\" | \"dragEffectEnabled\">) {\n\tconst {\n\t\tnodeIds,\n\t\tdragEffectFreeform,\n\t\tdragEffectMomentum,\n\t\tdragEffectSnapBack,\n\t\tdragEffectConstraintElement,\n\t\tdragEffectConstraintItem,\n\t\tdragEffectTransition,\n\t\tscopeId,\n\t\tscopeType,\n\t} = props\n\n\tconst freeformHandler = onDragEffectChange(\"dragEffectFreeform\", nodeIds)\n\tconst momentumHandler = onDragEffectChange(\"dragEffectMomentum\", nodeIds)\n\tconst snapBackHandler = onDragEffectChange(\"dragEffectSnapBack\", nodeIds)\n\tconst transitionHandler = onDragEffectChange(\"dragEffectTransition\", nodeIds)\n\tconst constraintsElementHandler = onDragEffectChange(\"dragEffectConstraintElement\", nodeIds)\n\tconst constraintsItemHandler = onDragEffectChange(\"dragEffectConstraintItem\", nodeIds)\n\n\tconst targets = isString(dragEffectConstraintElement) ? new Set([dragEffectConstraintElement]) : new Set<string>()\n\tconst showDragMomentum = dragEffectFreeform === false || dragEffectSnapBack !== true\n\tconst showDragTransition = dragEffectFreeform !== false ? dragEffectSnapBack !== false : true\n\tconst inSmartComponent = scopeType === ScopeType.SmartComponent\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title=\"Freeform\">\n\t\t\t\t<SegmentedControl style={doubleColumn} enabled={!inSmartComponent}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={dragEffectFreeform === true}\n\t\t\t\t\t\tonSelect={freeformHandler}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={dragEffectFreeform === false}\n\t\t\t\t\t\tonSelect={freeformHandler}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{dragEffectFreeform === false && !inSmartComponent ? (\n\t\t\t\t<EffectScrollTargetRows\n\t\t\t\t\ttargets={targets}\n\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tcollectionItem={dragEffectConstraintItem}\n\t\t\t\t\tonSelect={constraintsElementHandler}\n\t\t\t\t\tonSelectCollectionItem={constraintsItemHandler}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PanelRow title=\"Snap Back\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={dragEffectSnapBack === true}\n\t\t\t\t\t\t\tonSelect={snapBackHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={dragEffectSnapBack === false}\n\t\t\t\t\t\t\tonSelect={snapBackHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t{showDragMomentum && (\n\t\t\t\t<PanelRow title=\"Momentum\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\tselected={dragEffectMomentum === true}\n\t\t\t\t\t\t\tonSelect={momentumHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\tselected={dragEffectMomentum === false}\n\t\t\t\t\t\t\tonSelect={momentumHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t{showDragTransition && (\n\t\t\t\t<PanelRow title=\"Transition\">\n\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\ttitle=\"Transition\"\n\t\t\t\t\t\ttransition={dragEffectTransition}\n\t\t\t\t\t\tonChange={transitionHandler}\n\t\t\t\t\t\tshowType={hideTransitionTypeControl}\n\t\t\t\t\t\tshowDelay={false}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\ninterface Props extends ReducedDragEffect {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n}\n\nexport const dragEffectPopoutId = \"dragEffect\"\nexport const DragEffectRow = React.memo(function DragEffectRow({\n\tnodeIds,\n\tonlyNodesWithDragEffect,\n\tdragEffectEnabled,\n\t...effect\n}: Props) {\n\tconst removeDragEffect = useRemoveEffect(EffectType.Drag, nodeIds)\n\tconst onDelete = useEngineCallback(() => {\n\t\t// When we add a drag effect, we set the cursor to `grab` automatically.\n\t\t// This automatically improves the UX of the grab effect, while also\n\t\t// allowing users to further tweak the cursor. However, we don't want\n\t\t// `grab` cursors to linger around in the document if a drag effect is\n\t\t// removed, so if the cursor is still `grab` when we delete the effect,\n\t\t// we will remove the cursor setting too.\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withCursor)) {\n\t\t\tif (hasDragEffect(node) && node.cursor === \"grab\") node.set({ cursor: undefined })\n\t\t}\n\t\tremoveDragEffect()\n\t}, [removeDragEffect, nodeIds])\n\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Drag, { dragEffectEnabled: true })\n\tif (!onlyNodesWithDragEffect || dragEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Drag} title=\"Drag\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={dragEffectPopoutId}\n\t\t\t\tpopout={<DragEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Drag Effect\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { enableEffect } from \"document/components/chrome/properties/rows/EffectRows/shared/utils.ts\"\nimport { getStackLayoutPreset } from \"document/utils/layoutHelpers.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { getActionsOfType } from \"../../actions/actions.ts\"\nimport { isShowOverlayAction } from \"../../actions/overlayActions.ts\"\nimport { hasImageFill } from \"../../traits/WithFill.ts\"\nimport { hasFloatingPosition } from \"../../traits/WithFloatingPosition.ts\"\nimport { withLayout } from \"../../traits/WithLayout.ts\"\nimport { withPadding } from \"../../traits/WithPadding.ts\"\nimport { withTickerEffect } from \"../../traits/WithTickerEffect.ts\"\nimport { EffectType } from \"../../traits/utils/effects.ts\"\nimport type { CanvasNode } from \"../CanvasNode.ts\"\nimport type { ReadonlyChildList } from \"../ChildList.ts\"\n\nexport function enableTickerEffect(engine: VekterEngine, componentLoader: AnyComponentLoader, node: CanvasNode) {\n\tif (!withTickerEffect(node) || !withLayout(node)) return\n\n\tconst defaults = getStackLayoutPreset(\"horizontal\", false, engine)\n\tnode.set({\n\t\tlayout: \"stack\",\n\t\tstackWrapEnabled: false,\n\t\tstackDistribution: \"start\",\n\t\tgap: node.gap ?? defaults.gap,\n\t\tstackAlignment: isUndefined(node.stackAlignment) ? defaults.stackAlignment : node.stackAlignment,\n\t\tstackDirection: isUndefined(node.stackDirection) ? defaults.stackDirection : node.stackDirection,\n\t})\n\n\t// Ticker cannot currently work with image fill, so we disable it\n\tif (hasImageFill(node)) {\n\t\tnode.set({ fillType: \"color\", fillEnabled: false })\n\t}\n\n\tif (withPadding(node)) {\n\t\tnode.set({\n\t\t\tpadding: 0,\n\t\t\tpaddingPerSide: false,\n\t\t})\n\t}\n\n\tresetIncompatiblePropertiesOnTickerDescendants(engine, componentLoader, node.children)\n\n\tenableEffect(EffectType.Ticker, [node.id], { tickerEffectEnabled: true })\n}\n\n/**\n * Ensures that any properties on children or descendants of the ticker effect node are reset to a valid state\n * to avoid any weird results when enabling the ticker effect. The incompatible properties will also be disabled\n * in the node properties panel.\n */\nfunction resetIncompatiblePropertiesOnTickerDescendants(\n\tengine: VekterEngine,\n\tcomponentLoader: AnyComponentLoader,\n\tdescendants: ReadonlyChildList<CanvasNode> | undefined,\n) {\n\tif (!descendants) return\n\n\tfor (const descendant of descendants) {\n\t\tresetIncompatiblePropertiesOnTickerDescendant(engine, componentLoader, descendant)\n\t}\n}\n\nfunction resetIncompatiblePropertiesOnTickerDescendant(\n\tengine: VekterEngine,\n\tcomponentLoader: AnyComponentLoader,\n\tdescendant: CanvasNode,\n) {\n\t// remove any relative overlays because they won't work well inside the ticker\n\tconst actions = getActionsOfType(descendant, isShowOverlayAction, componentLoader)\n\tfor (const action of actions) {\n\t\tconst overlayId = action.controls.overlay.value\n\t\tconst overlay = engine.tree.get(overlayId)\n\n\t\tif (!overlay || !hasFloatingPosition(overlay)) continue\n\n\t\tengine.stores.overlayStore.delete(engine.stores.selectionStore, overlayId, descendant.id)\n\t}\n\n\tif (withTickerEffect(descendant) && descendant.tickerEffectEnabled) {\n\t\tdescendant.set({ tickerEffectEnabled: false })\n\t}\n\n\tif (descendant.children) {\n\t\tresetIncompatiblePropertiesOnTickerDescendants(engine, componentLoader, descendant.children)\n\t}\n}\n", "import { Translatable as T, useReadOnly } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { enableTickerEffect } from \"document/models/CanvasTree/nodes/utils/tickerEffectHelpers.ts\"\nimport { withCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { defaultEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { AllReducedEffects } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport {\n\tEffectType,\n\tcanPasteAnyCompatibleEffects,\n\tisSupportedEffectScopeType,\n} from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { Panel } from \"../../panels/Panel.tsx\"\nimport { PanelSectionHeader } from \"../../panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"../../panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../../panels/icons/IconSectionHeaderPlus.tsx\"\nimport { parallaxEffectPopoutId } from \"../ParallaxRow.tsx\"\nimport { dragEffectPopoutId } from \"./DragEffectRow.tsx\"\nimport { flowEffectPopoutId } from \"./FlowEffectRow.tsx\"\nimport { getLiteEffectPopoutId } from \"./GestureEffectRow.tsx\"\nimport { lightboxEffectPopoutId } from \"./LightboxEffectRow.tsx\"\nimport { loopEffectPopoutId } from \"./LoopEffectRow.tsx\"\nimport { strokeEffectPopoutId } from \"./StrokeEffectRow.tsx\"\nimport { styleAppearEffectPopoutId } from \"./StyleAppearEffectRow.tsx\"\nimport { styleTransformEffectPopoutId } from \"./StyleTransformEffectRow.tsx\"\nimport { textEffectPopoutId } from \"./TextEffectRow.tsx\"\nimport { tickerEffectPopoutId } from \"./TickerEffectRow.tsx\"\nimport { variantAppearEffectPopoutId } from \"./VariantAppearEffectRow.tsx\"\nimport { EffectTitleProvider } from \"./shared/useEffectTitle.tsx\"\nimport { enableEffect, enableFlowEffect } from \"./shared/utils.ts\"\n\ninterface Props extends Pick<\n\tAllReducedEffects,\n\t// Effects supported.\n\t| \"anyNodeWithTickerEffectAncestor\"\n\t| \"onlyNodesWithParallax\"\n\t| \"onlyNodesWithVariantAppearEffect\"\n\t| \"onlyNodesWithStyleAppearEffect\"\n\t| \"onlyNodesWithStyleTransformEffect\"\n\t| \"onlyNodesWithDragEffect\"\n\t| \"onlyNodesWithWhileHover\"\n\t| \"onlyNodesWithWhileTap\"\n\t| \"onlyNodesWithLoopEffect\"\n\t| \"onlyNodesWithFlowEffect\"\n\t| \"onlyNodesWithTextEffect\"\n\t| \"onlyNodesWithStrokeEffect\"\n\t| \"onlyNodesWithLightboxEffect\"\n\t| \"onlyNodesWithTickerEffect\"\n\t// Effects enabled.\n\t| \"appearEffectEnabled\"\n\t| \"dragEffectEnabled\"\n\t| \"loopEffectEnabled\"\n\t| \"flowEffectEnabled\"\n\t| \"styleAppearEffectEnabled\"\n\t| \"styleTransformEffectEnabled\"\n\t| \"whileHoverEnabled\"\n\t| \"whileTapEnabled\"\n\t| \"parallaxEnabled\"\n\t| \"styleAppearEffectTrigger\"\n\t| \"textEffectEnabled\"\n\t| \"strokeEffectEnabled\"\n\t| \"lightboxEffectEnabled\"\n\t| \"tickerEffectEnabled\"\n> {\n\tscopeType: ScopeType\n\tselection: NodeID[]\n\tonlyNodesInAnOverlay: boolean\n\tanyNodesWithImageFill: boolean\n}\n\nexport const EffectsHeader = React.memo(function EffectsHeader({\n\tscopeType,\n\tonlyNodesWithParallax,\n\tonlyNodesWithVariantAppearEffect,\n\tonlyNodesWithStyleAppearEffect,\n\tonlyNodesWithStyleTransformEffect,\n\tonlyNodesWithDragEffect,\n\tonlyNodesWithWhileHover,\n\tonlyNodesWithWhileTap,\n\tonlyNodesWithLoopEffect,\n\tonlyNodesWithFlowEffect,\n\tonlyNodesInAnOverlay,\n\tonlyNodesWithTextEffect,\n\tonlyNodesWithStrokeEffect,\n\tonlyNodesWithLightboxEffect,\n\tonlyNodesWithTickerEffect,\n\n\tanyNodesWithImageFill,\n\tanyNodeWithTickerEffectAncestor,\n\tappearEffectEnabled,\n\tparallaxEnabled,\n\tstyleAppearEffectEnabled,\n\tstyleTransformEffectEnabled,\n\tdragEffectEnabled,\n\twhileHoverEnabled,\n\twhileTapEnabled,\n\tloopEffectEnabled,\n\tflowEffectEnabled,\n\ttextEffectEnabled,\n\tstrokeEffectEnabled,\n\tlightboxEffectEnabled,\n\ttickerEffectEnabled,\n\n\tstyleAppearEffectTrigger,\n\n\tselection,\n\tchildren,\n}: React.PropsWithChildren<Props>) {\n\tconst readOnly = useReadOnly()\n\tconst hasFlowEffect = useExperimentIsOn(\"flowEffect\")\n\n\tconst pasteEffects = React.useCallback(async () => {\n\t\tawait Clipboard.pasteEffects(engine, selection)\n\t}, [selection])\n\n\tconst scopeSupportsEffects = isSupportedEffectScopeType(scopeType)\n\n\tconst showEffectsMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent, pasteItem: boolean = false) => {\n\t\t\tif (readOnly) return\n\n\t\t\t// We want to show paste in the header effect row only if we\n\t\t\t// right-click to open the menu. Otherwise, if we do a normal-click\n\t\t\t// we don't show it, we just show the usual menu with the list of\n\t\t\t// effects.\n\n\t\t\tconst effectsMenu: MenuItemOptions[] = []\n\t\t\tif (pasteItem && isClipboardSupported()) {\n\t\t\t\teffectsMenu.push({\n\t\t\t\t\tlabel: \"Paste\",\n\t\t\t\t\tclick: () => pasteEffects(),\n\t\t\t\t\tenabled: await canPasteAnyCompatibleEffects(engine.tree, selection),\n\t\t\t\t})\n\t\t\t}\n\t\t\teffectsMenu.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: \"Stroke\",\n\t\t\t\t\tvisible: onlyNodesWithStrokeEffect && strokeEffectEnabled !== true,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(strokeEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Stroke, selection, { strokeEffectEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Text\",\n\t\t\t\t\tvisible: onlyNodesWithTextEffect && textEffectEnabled !== true,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(textEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Text, selection, { textEffectEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Appear\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(styleAppearEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Appear, selection, {\n\t\t\t\t\t\t\tstyleAppearEffectTrigger: EffectTrigger.OnMount,\n\t\t\t\t\t\t\tstyleAppearEffectEnabled: true,\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t\tvisible: styleAppearEffectEnabled !== true,\n\t\t\t\t\tenabled: onlyNodesWithStyleAppearEffect,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Hover\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(getLiteEffectPopoutId(EffectType.Hover))\n\t\t\t\t\t\tenableEffect(EffectType.Hover, selection, { whileHoverEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t\tvisible: whileHoverEnabled !== true,\n\t\t\t\t\tenabled: onlyNodesWithWhileHover,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Press\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(getLiteEffectPopoutId(EffectType.Tap))\n\t\t\t\t\t\tenableEffect(EffectType.Tap, selection, { whileTapEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t\tvisible: whileTapEnabled !== true,\n\t\t\t\t\tenabled: onlyNodesWithWhileTap,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Loop\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(loopEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Loop, selection, { loopEffectEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t\tvisible: loopEffectEnabled !== true,\n\t\t\t\t\tenabled: onlyNodesWithLoopEffect,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Drag\",\n\t\t\t\t\tclick: engine.scheduler.wrapHandler(() => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(dragEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Drag, selection, { dragEffectEnabled: true })\n\t\t\t\t\t\t// When enabling a drag effect, if the node doesn't\n\t\t\t\t\t\t// already have a css cursor set, set it to \"grab\". If\n\t\t\t\t\t\t// the cursor is \"grab\" a corresponding \"grabbing\"\n\t\t\t\t\t\t// cursor will be set on a motion `whileTap` to create a\n\t\t\t\t\t\t// good UX in `collectMotionWhileTap.ts`.\n\t\t\t\t\t\tengine.tree.getNodesWithTrait(selection, withCursor).forEach(node => {\n\t\t\t\t\t\t\tif (!node.cursor) node.set({ cursor: \"grab\" })\n\t\t\t\t\t\t})\n\t\t\t\t\t}),\n\t\t\t\t\tvisible: dragEffectEnabled !== true,\n\t\t\t\t\tenabled: onlyNodesWithDragEffect,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Lightbox,\n\t\t\t\t\tvisible: onlyNodesWithLightboxEffect && lightboxEffectEnabled !== true,\n\t\t\t\t\tenabled: anyNodesWithImageFill && onlyNodesWithLightboxEffect,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(lightboxEffectPopoutId)\n\t\t\t\t\t\tenableEffect(EffectType.Lightbox, selection, { lightboxEffectEnabled: true })\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.Ticker,\n\t\t\t\t\tvisible: onlyNodesWithTickerEffect && tickerEffectEnabled !== true && !anyNodeWithTickerEffectAncestor,\n\t\t\t\t\tenabled: onlyNodesWithTickerEffect,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(tickerEffectPopoutId)\n\t\t\t\t\t\tfor (const id of selection) {\n\t\t\t\t\t\t\tconst node = engine.tree.getNode(id)\n\t\t\t\t\t\t\tif (!node) continue\n\t\t\t\t\t\t\tenableTickerEffect(engine, engine.componentLoader, node)\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: \"Scroll\",\n\t\t\t\t\tvisible:\n\t\t\t\t\t\tstyleAppearEffectEnabled !== true ||\n\t\t\t\t\t\tparallaxEnabled !== true ||\n\t\t\t\t\t\tstyleTransformEffectEnabled !== true ||\n\t\t\t\t\t\tappearEffectEnabled !== true,\n\t\t\t\t\tsubmenu: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"Scroll Animation\",\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(styleAppearEffectPopoutId)\n\t\t\t\t\t\t\t\tenableEffect(EffectType.Appear, selection, {\n\t\t\t\t\t\t\t\t\tstyleAppearEffectTrigger: EffectTrigger.OnInView,\n\t\t\t\t\t\t\t\t\tstyleAppearEffectEnabled: true,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvisible: styleAppearEffectEnabled !== true,\n\t\t\t\t\t\t\tenabled: onlyNodesWithStyleAppearEffect,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"Scroll Speed\",\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(parallaxEffectPopoutId)\n\t\t\t\t\t\t\t\tenableEffect(EffectType.Parallax, selection, { parallaxEnabled: true })\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvisible: parallaxEnabled !== true,\n\t\t\t\t\t\t\tenabled: onlyNodesWithParallax,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"Scroll Transform\",\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(styleTransformEffectPopoutId)\n\t\t\t\t\t\t\t\tenableEffect(EffectType.StyleTransform, selection, {\n\t\t\t\t\t\t\t\t\tstyleTransformEffectEnabled: true,\n\t\t\t\t\t\t\t\t\tstyleTransformEffectScrollTargets: [defaultEffect({ opacity: 0.5, scale: 0.5 }), defaultEffect()],\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tvisible: styleTransformEffectEnabled !== true,\n\t\t\t\t\t\t\tenabled: onlyNodesWithStyleTransformEffect,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: \"Scroll Variant\",\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(variantAppearEffectPopoutId)\n\t\t\t\t\t\t\t\tenableEffect(EffectType.SetVariant, selection, { appearEffectEnabled: true })\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tenabled: onlyNodesWithVariantAppearEffect,\n\t\t\t\t\t\t\tvisible: appearEffectEnabled !== true,\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\t{\n\t\t\t\t\tlabel: Dictionary.Flow,\n\t\t\t\t\tvisible: hasFlowEffect && onlyNodesWithFlowEffect && flowEffectEnabled !== true,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpopoutWindow.navigation.presentPopoutOnRegistration(flowEffectPopoutId)\n\t\t\t\t\t\tenableFlowEffect(selection)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tengine.stores.contextMenuStore.show(effectsMenu, { location: { x: event.clientX, y: event.clientY } })\n\t\t},\n\t\t[\n\t\t\tanyNodesWithImageFill,\n\t\t\tanyNodeWithTickerEffectAncestor,\n\t\t\tappearEffectEnabled,\n\t\t\tdragEffectEnabled,\n\t\t\tlightboxEffectEnabled,\n\t\t\tloopEffectEnabled,\n\t\t\tflowEffectEnabled,\n\t\t\tonlyNodesWithDragEffect,\n\t\t\tonlyNodesWithLightboxEffect,\n\t\t\tonlyNodesWithLoopEffect,\n\t\t\tonlyNodesWithFlowEffect,\n\t\t\tonlyNodesWithParallax,\n\t\t\tonlyNodesWithStrokeEffect,\n\t\t\tonlyNodesWithStyleAppearEffect,\n\t\t\tonlyNodesWithStyleTransformEffect,\n\t\t\tonlyNodesWithTextEffect,\n\t\t\tonlyNodesWithTickerEffect,\n\t\t\tonlyNodesWithVariantAppearEffect,\n\t\t\tonlyNodesWithWhileHover,\n\t\t\tonlyNodesWithWhileTap,\n\t\t\tparallaxEnabled,\n\t\t\tpasteEffects,\n\t\t\treadOnly,\n\t\t\tselection,\n\t\t\tstrokeEffectEnabled,\n\t\t\tstyleAppearEffectEnabled,\n\t\t\tstyleTransformEffectEnabled,\n\t\t\ttextEffectEnabled,\n\t\t\ttickerEffectEnabled,\n\t\t\twhileHoverEnabled,\n\t\t\twhileTapEnabled,\n\t\t\thasFlowEffect,\n\t\t],\n\t)\n\n\tconst addEffectHandler = React.useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\t// onMouseDown is being intercepted on right click too, so when that\n\t\t\t// happens we make sure to early return, as we want\n\t\t\t// contextMenuAddEffectHandler to manage the right-click logic.\n\t\t\tif (event.button === 2) return\n\t\t\tawait showEffectsMenu(event)\n\t\t},\n\t\t[showEffectsMenu],\n\t)\n\n\tconst contextMenuAddEffectHandler = React.useCallback(\n\t\tasync (event: React.MouseEvent) => {\n\t\t\tawait showEffectsMenu(event, true)\n\t\t},\n\t\t[showEffectsMenu],\n\t)\n\n\tconst canAddEffect =\n\t\tscopeSupportsEffects &&\n\t\t((onlyNodesWithVariantAppearEffect && appearEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithParallax && parallaxEnabled !== true) ||\n\t\t\t(onlyNodesWithStyleAppearEffect && styleAppearEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithStyleTransformEffect && styleTransformEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithDragEffect && dragEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithWhileHover && whileHoverEnabled !== true) ||\n\t\t\t(onlyNodesWithWhileTap && whileTapEnabled !== true) ||\n\t\t\t(onlyNodesWithLoopEffect && loopEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithFlowEffect && flowEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithStrokeEffect && strokeEffectEnabled !== true) ||\n\t\t\t(onlyNodesWithTickerEffect && tickerEffectEnabled !== true))\n\n\tconst hasStyleAppearEffectRow = onlyNodesWithStyleAppearEffect && styleAppearEffectEnabled === true\n\tconst hasParallaxEffectRow = onlyNodesWithParallax && parallaxEnabled === true\n\tconst hasTransformEffectRow = onlyNodesWithStyleTransformEffect && styleTransformEffectEnabled === true\n\n\treturn (\n\t\t<Panel\n\t\t\theader={\n\t\t\t\t<PanelSectionHeader\n\t\t\t\t\ttitle={<T>Effects</T>}\n\t\t\t\t\tonMouseDown={canAddEffect ? addEffectHandler : undefined}\n\t\t\t\t\tonContextMenu={canAddEffect ? contextMenuAddEffectHandler : undefined}\n\t\t\t\t\tclickable={canAddEffect && !readOnly}\n\t\t\t\t>\n\t\t\t\t\t{canAddEffect && (\n\t\t\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t\t\t)}\n\t\t\t\t</PanelSectionHeader>\n\t\t\t}\n\t\t>\n\t\t\t<EffectTitleProvider\n\t\t\t\thasStyleAppearEffectRow={hasStyleAppearEffectRow}\n\t\t\t\thasParallaxEffectRow={hasParallaxEffectRow}\n\t\t\t\thasTransformEffectRow={hasTransformEffectRow}\n\t\t\t\tonlyNodesInAnOverlay={onlyNodesInAnOverlay}\n\t\t\t\tcommonStyleAppearEffectTrigger={commonValue(styleAppearEffectTrigger)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</EffectTitleProvider>\n\t\t</Panel>\n\t)\n})\n", "import { NumberInputWithTickerAndStepper, SegmentedControl, SegmentedControlItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed, unhandledError } 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 type { WithParallax } from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport { parallaxEnabledDefaults, withParallax } from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedParallax } from \"document/models/CanvasTree/traits/utils/reduceParallax.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { DescriptionRow } from \"../codeComponentRows/DescriptionRow.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { EffectPreviewIcon } from \"./EffectRows/EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./EffectRows/shared/EffectRow.tsx\"\nimport { createCopyEffectHandler, useRemoveEffect } from \"./EffectRows/shared/utils.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface ParallaxProps extends ReducedParallax {\n\tnodeIds: NodeID[]\n}\n\nfunction useParallaxUpdate<T extends WithParallax, K extends keyof T>(key: K, nodeIds: string[]) {\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]>) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withParallax)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update = { [key]: value }\n\t\t\t\trecord(\"interactive_effect_parallax_update\", update)\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nconst stopPropagation = (event: React.MouseEvent<any>) => event.stopPropagation()\n\nfunction ParallaxPopout(props: Omit<ParallaxProps, \"onlyNodesWithParallax\" | \"parallaxEnabled\">) {\n\tconst { nodeIds, parallaxSpeed, parallaxAdjustPosition, parallaxOffset } = props\n\tconst speedHandler = useParallaxUpdate(\"parallaxSpeed\", nodeIds)\n\tconst adjustPositionHandler = useParallaxUpdate(\"parallaxAdjustPosition\", nodeIds)\n\tconst offsetHandler = useParallaxUpdate(\"parallaxOffset\", nodeIds)\n\tconst adjustPosition = parallaxAdjustPosition === true\n\n\t// Position: Scroll is buggy, and results in numerous support requests. This\n\t// hides it if it's not already enabled.\n\tconst canSetPosition = adjustPosition === true || isMixed(adjustPosition)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t{isFound(parallaxSpeed) && (\n\t\t\t\t<PanelRow title={Dictionary.Speed}>\n\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\tvalue={parallaxSpeed}\n\t\t\t\t\t\tdefaultValue={parallaxEnabledDefaults.parallaxSpeed}\n\t\t\t\t\t\tonChange={speedHandler}\n\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\tmin={-500}\n\t\t\t\t\t\tmax={500}\n\t\t\t\t\t\tstepperStep={10}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{canSetPosition && (\n\t\t\t\t<PanelRow title=\"Position\">\n\t\t\t\t\t<SegmentedControl\n\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\tenabled={!isMixed(parallaxAdjustPosition)}\n\t\t\t\t\t\tonMouseDown={stopPropagation} // We block propagation to block action cards from becoming focused\n\t\t\t\t\t>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle=\"Current\"\n\t\t\t\t\t\t\tselected={!adjustPosition}\n\t\t\t\t\t\t\tonSelect={adjustPositionHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle=\"Scroll\"\n\t\t\t\t\t\t\tselected={adjustPosition}\n\t\t\t\t\t\t\tonSelect={adjustPositionHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t{adjustPosition && isFound(parallaxOffset) && (\n\t\t\t\t<>\n\t\t\t\t\t<PanelRow title=\"Top\">\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tvalue={parallaxOffset}\n\t\t\t\t\t\t\tdefaultValue={parallaxEnabledDefaults.parallaxOffset}\n\t\t\t\t\t\t\tonChange={offsetHandler}\n\t\t\t\t\t\t\tstepperStep={10}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<DescriptionRow description=\"Adjust position to the top of the viewport.\" />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nexport const parallaxEffectPopoutId = \"parallaxEffect\"\nexport const ParallaxEffectRow = React.memo(function ParallaxRow({\n\tnodeIds,\n\tonlyNodesWithParallax,\n\tparallaxEnabled,\n\t...effect\n}: ParallaxProps) {\n\tconst onDelete = useRemoveEffect(EffectType.Parallax, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.SetVariant, { appearEffectEnabled: true })\n\tif (!onlyNodesWithParallax || parallaxEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Parallax} title=\"Scroll\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={parallaxEffectPopoutId}\n\t\t\t\tpopout={<ParallaxPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Scroll Speed\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle={Dictionary.Speed}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n", "import type { BoxShadow } from \"document/models/Shadow.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { getFirstCommonValue } from \"utils/commonValue.ts\"\nimport { type NotFound, type Reduced, type ReducedRecord, isNotFound } from \"./Reduced.ts\"\nimport type { ReducedEffectTransition } from \"./reduceEffectTransition.ts\"\nimport type { ReducedLoopEffect } from \"./reduceLoopEffect.ts\"\nimport type { ReducedShadow } from \"./reduceShadows.ts\"\nimport type { ReducedStyleAppearEffect } from \"./reduceStyleAppearEffect.ts\"\nimport type { ReducedTextEffect } from \"./reduceTextEffect.ts\"\nimport type { ReducedHoverEffect } from \"./reduceWhileHover.ts\"\nimport type { ReducedPressEffect } from \"./reduceWhileTap.ts\"\n\n/**\n * Any effect that allows MotionStyle to be animated should be defined as a\n * StyleEffect. Some effects may not allow all of the keys of StyleEffect to be\n * animated. In that case, the Effect should use Omit to remove the keys that\n * aren't supported.\n */\nexport interface StyleEffect {\n\tx: number | undefined\n\ty: number | undefined\n\tscale: number | undefined\n\topacity: number | undefined\n\trotate3d: boolean | undefined\n\trotate: number | undefined\n\trotateX: number | undefined\n\trotateY: number | undefined\n\tskewX: number | undefined\n\tskewY: number | undefined\n\ttransition: Transition | undefined\n\tbackgroundColor?: string | undefined\n\tboxShadow?: BoxShadow | undefined\n\tblur?: number | undefined\n\t/** @deprecated */\n\ttransformPerspective?: number | undefined\n}\n\ntype RequiredReducedStyleEffect = ReducedRecord<StyleEffect>\n\nexport interface ReducedStyleEffect\n\textends\n\t\tOmit<RequiredReducedStyleEffect, \"boxShadow\" | \"backgroundColor\" | \"blur\" | \"transformPerspective\" | \"transition\">,\n\t\tPartial<Pick<RequiredReducedStyleEffect, \"backgroundColor\" | \"blur\">> {\n\tboxShadow?: ReducedShadow | NotFound\n\tpauseOffscreen?: Reduced<boolean>\n\ttransition?: Reduced<ReducedEffectTransition | undefined>\n}\n\nexport function getReducedLoopStyleEffect(effect: Partial<ReducedLoopEffect>): ReducedStyleEffect {\n\treturn {\n\t\tx: effect.loopEffectX,\n\t\ty: effect.loopEffectY,\n\t\tscale: effect.loopEffectScale,\n\t\topacity: effect.loopEffectOpacity,\n\t\trotate3d: effect.loopEffectRotate3d,\n\t\trotate: effect.loopEffectRotate,\n\t\trotateX: effect.loopEffectRotateX,\n\t\trotateY: effect.loopEffectRotateY,\n\t\tskewX: effect.loopEffectSkewX,\n\t\tskewY: effect.loopEffectSkewY,\n\t\ttransition: effect.loopEffectTransition,\n\t\tpauseOffscreen: effect.loopEffectPauseOffscreen,\n\t}\n}\n\nexport function getReducedTextStyleEffect(effect: Partial<ReducedTextEffect>): ReducedStyleEffect {\n\treturn {\n\t\tx: effect.textEffectX,\n\t\ty: effect.textEffectY,\n\t\tscale: effect.textEffectScale,\n\t\topacity: effect.textEffectOpacity,\n\t\trotate3d: effect.textEffectRotate3d,\n\t\trotate: effect.textEffectRotate,\n\t\trotateX: effect.textEffectRotateX,\n\t\trotateY: effect.textEffectRotateY,\n\t\tskewX: effect.textEffectSkewX,\n\t\tskewY: effect.textEffectSkewY,\n\t\tblur: effect.textEffectBlur,\n\t\ttransition: effect.textEffectTransition,\n\t}\n}\n\nexport function getReducedHoverStyleEffect(effect: Partial<ReducedHoverEffect>): ReducedStyleEffect {\n\treturn {\n\t\tx: effect.whileHoverX,\n\t\ty: effect.whileHoverY,\n\t\tscale: effect.whileHoverScale,\n\t\topacity: effect.whileHoverOpacity,\n\t\trotate3d: effect.whileHoverRotate3d,\n\t\trotate: effect.whileHoverRotate,\n\t\trotateX: effect.whileHoverRotateX,\n\t\trotateY: effect.whileHoverRotateY,\n\t\tskewX: effect.whileHoverSkewX,\n\t\tskewY: effect.whileHoverSkewY,\n\t\tbackgroundColor: effect.whileHoverBackgroundColor,\n\t\tboxShadow: effect.whileHoverBoxShadow,\n\t\ttransition: effect.whileHoverTransition,\n\t}\n}\n\nexport function getReducedTapStyleEffect(effect: Partial<ReducedPressEffect>): ReducedStyleEffect {\n\treturn {\n\t\tx: effect.whileTapX,\n\t\ty: effect.whileTapY,\n\t\tscale: effect.whileTapScale,\n\t\topacity: effect.whileTapOpacity,\n\t\trotate3d: effect.whileTapRotate3d,\n\t\trotate: effect.whileTapRotate,\n\t\trotateX: effect.whileTapRotateX,\n\t\trotateY: effect.whileTapRotateY,\n\t\tskewX: effect.whileTapSkewX,\n\t\tskewY: effect.whileTapSkewY,\n\t\ttransition: effect.whileTapTransition,\n\t\tbackgroundColor: effect.whileTapBackgroundColor,\n\t\tboxShadow: effect.whileTapBoxShadow,\n\t}\n}\n\nexport function getReducedEnterStyleEffect(effect: Partial<ReducedStyleAppearEffect>): ReducedStyleEffect {\n\treturn {\n\t\tx: getFirstCommonValue(effect.enterEffectX, effect.styleAppearEffectX),\n\t\ty: getFirstCommonValue(effect.enterEffectY, effect.styleAppearEffectY),\n\t\tscale: getFirstCommonValue(effect.enterEffectScale, effect.styleAppearEffectScale),\n\t\topacity: getFirstCommonValue(effect.enterEffectOpacity, effect.styleAppearEffectOpacity),\n\t\trotate3d: getFirstCommonValue(effect.enterEffectRotate3d),\n\t\trotate: getFirstCommonValue(effect.enterEffectRotate, effect.styleAppearEffectRotate),\n\t\trotateX: getFirstCommonValue(effect.enterEffectRotateX, effect.styleAppearEffectRotateX),\n\t\trotateY: getFirstCommonValue(effect.enterEffectRotateY, effect.styleAppearEffectRotateY),\n\t\tskewX: getFirstCommonValue(effect.enterEffectSkewX),\n\t\tskewY: getFirstCommonValue(effect.enterEffectSkewY),\n\t\ttransition: isNotFound(effect.enterEffectTransition)\n\t\t\t? effect.styleAppearEffectTransition\n\t\t\t: effect.enterEffectTransition,\n\t}\n}\n\nexport function getReducedExitStyleEffect(effect: Partial<ReducedStyleAppearEffect>): ReducedStyleEffect {\n\tif (effect.styleAppearEffectLocked) return getReducedEnterStyleEffect(effect)\n\n\treturn {\n\t\tx: effect.exitEffectX,\n\t\ty: effect.exitEffectY,\n\t\tscale: effect.exitEffectScale,\n\t\topacity: effect.exitEffectOpacity,\n\t\trotate3d: effect.exitEffectRotate3d,\n\t\trotate: effect.exitEffectRotate,\n\t\trotateX: effect.exitEffectRotateX,\n\t\trotateY: effect.exitEffectRotateY,\n\t\tskewX: effect.exitEffectSkewX,\n\t\tskewY: effect.exitEffectSkewY,\n\t\ttransition: effect.exitEffectTransition,\n\t}\n}\n", "import { IconEffect, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever, isMixed, unhandledError } from \"@framerjs/shared\"\nimport { getNextFrameColor } from \"document/components/tools/utils/FramesHelper.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { type WithWhileHover, withWhileHover } from \"document/models/CanvasTree/traits/WithWhileHover.ts\"\nimport { type WithWhileTap, withWhileTap } from \"document/models/CanvasTree/traits/WithWhileTap.ts\"\nimport type { ReducedStyleEffect, StyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport {\n\tgetReducedHoverStyleEffect,\n\tgetReducedTapStyleEffect,\n} from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedHoverEffect } from \"document/models/CanvasTree/traits/utils/reduceWhileHover.ts\"\nimport type { ReducedPressEffect } from \"document/models/CanvasTree/traits/utils/reduceWhileTap.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { getUpdatedShadow, isBoxShadow } from \"document/models/Shadow.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { Color } from \"library/render/types/Color/index.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectStylePopout } from \"./shared/EffectStylePopout.tsx\"\nimport {\n\tcreateCopyEffectHandler,\n\texitEffectPreview,\n\ttrackEffectUpdate,\n\tuseExitEffectPreviewOnUnmount,\n\tuseRemoveEffect,\n} from \"./shared/utils.ts\"\n\ntype LiteEffectType = Extract<keyof typeof effectConfig, EffectType.Hover | EffectType.Tap>\n\ninterface LiteEffectProps {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\teffect: ReducedStyleEffect\n\ttype: LiteEffectType\n\tonlyFrameNodes: boolean\n\tshowBoxShadow: boolean\n\tonDelete: () => void | undefined\n}\n\ntype LiteStyleEffect = Omit<StyleEffect, \"transformPerspective\" | \"blur\">\n\nconst hoverKeys: Record<keyof LiteStyleEffect, keyof WithWhileHover> = {\n\tx: \"whileHoverX\",\n\ty: \"whileHoverY\",\n\tscale: \"whileHoverScale\",\n\topacity: \"whileHoverOpacity\",\n\trotate3d: \"whileHoverRotate3d\",\n\trotate: \"whileHoverRotate\",\n\trotateX: \"whileHoverRotateX\",\n\trotateY: \"whileHoverRotateY\",\n\tskewX: \"whileHoverSkewX\",\n\tskewY: \"whileHoverSkewY\",\n\ttransition: \"whileHoverTransition\",\n\tboxShadow: \"whileHoverBoxShadow\",\n\tbackgroundColor: \"whileHoverBackgroundColor\",\n}\n\nconst pressKeys: Record<keyof LiteStyleEffect, keyof WithWhileTap> = {\n\tx: \"whileTapX\",\n\ty: \"whileTapY\",\n\tscale: \"whileTapScale\",\n\topacity: \"whileTapOpacity\",\n\trotate3d: \"whileTapRotate3d\",\n\trotate: \"whileTapRotate\",\n\trotateX: \"whileTapRotateX\",\n\trotateY: \"whileTapRotateY\",\n\tskewX: \"whileTapSkewX\",\n\tskewY: \"whileTapSkewY\",\n\ttransition: \"whileTapTransition\",\n\tboxShadow: \"whileTapBoxShadow\",\n\tbackgroundColor: \"whileTapBackgroundColor\",\n}\n\nfunction getKeyForUpdate(\n\ttype: LiteEffectType,\n\tkey: keyof ReducedStyleEffect,\n): keyof WithWhileHover | keyof WithWhileTap {\n\tswitch (type) {\n\t\tcase EffectType.Hover:\n\t\t\treturn hoverKeys[key as keyof LiteStyleEffect]\n\t\tcase EffectType.Tap:\n\t\t\treturn pressKeys[key as keyof LiteStyleEffect]\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction getAdditiveKeyForUpdate(type: LiteEffectType): keyof WithWhileHover | keyof WithWhileTap {\n\tswitch (type) {\n\t\tcase EffectType.Hover:\n\t\t\treturn \"whileHoverRotateAdditiveDynamicValue\"\n\t\tcase EffectType.Tap:\n\t\t\treturn \"whileTapRotateAdditiveDynamicValue\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\n// This function handles the type safety of getting a value from a node that has the WithWhileHover\n// or WithWhileTap trait with a key that is the same as the key of the trait.\nfunction effectKeyOfNode(\n\tnode: CanvasNode & (WithWhileHover | WithWhileTap),\n\tkey: keyof WithWhileHover | keyof WithWhileTap,\n) {\n\tif (!(key in node)) {\n\t\treturn undefined\n\t}\n\tif (withWhileHover(node)) {\n\t\treturn node[key as keyof WithWhileHover]\n\t} else if (withWhileTap(node)) {\n\t\treturn node[key as keyof WithWhileTap]\n\t} else {\n\t\tassertNever(node)\n\t}\n}\n\nconst onEffectChange = <K extends keyof ReducedStyleEffect>(type: LiteEffectType, nodeIds: string[]) => {\n\treturn useEngineCallback(\n\t\t(key: K, value: ReducedStyleEffect[K]) => {\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\t\t\tconst { withEffect, defaults } = effectConfig[type]\n\t\t\tconst updateKey = getKeyForUpdate(type, key)\n\t\t\tif (!updateKey) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(nodeIds, withEffect)) {\n\t\t\t\t// Technically this type should be Partial<WithTransforms & (WithWhileHover |\n\t\t\t\t// WithWhileTap)> but that would complicate the setting the additive key to it,\n\t\t\t\t// resulting in a type error. Instead of adding more runtime checks, we use a\n\t\t\t\t// slightly incorrect (but still restrictive) type here.\n\t\t\t\tconst update: Partial<WithTransforms & (WithWhileHover & WithWhileTap)> = { [updateKey]: value }\n\n\t\t\t\t// If the node was migrated to add it's effect rotation to the\n\t\t\t\t// node's dynamic rotation, edits to the effect rotation remove\n\t\t\t\t// this.\n\t\t\t\tconst additiveKey = getAdditiveKeyForUpdate(type)\n\t\t\t\tif (key === \"rotate\" && additiveKey && effectKeyOfNode(node, additiveKey)) {\n\t\t\t\t\tupdate[additiveKey] = undefined\n\t\t\t\t}\n\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(type, update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds, type],\n\t)\n}\n\nfunction getEffectPreviewType(type: LiteEffectType): EffectPreviewType {\n\tswitch (type) {\n\t\tcase EffectType.Hover:\n\t\t\treturn EffectPreviewType.Hover\n\t\tcase EffectType.Tap:\n\t\t\treturn EffectPreviewType.Tap\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nfunction getEffectTitle(type: LiteEffectType): string {\n\tswitch (type) {\n\t\tcase EffectType.Hover:\n\t\t\treturn \"Hover Effect\"\n\t\tcase EffectType.Tap:\n\t\t\treturn \"Press Effect\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport function getLiteEffectPopoutId(type: LiteEffectType) {\n\tswitch (type) {\n\t\tcase EffectType.Hover:\n\t\t\treturn \"hoverEffect\"\n\t\tcase EffectType.Tap:\n\t\t\treturn \"tapEffect\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nconst setEffectTypePreview = (type: LiteEffectType) =>\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.effectStore.enterPreview({ effect: getEffectPreviewType(type) })\n\t})\n\nfunction GestureEffectRow({\n\tscopeType,\n\tnodeIds,\n\tonlyFrameNodes,\n\ttype,\n\tshowBoxShadow,\n\teffect,\n\tonDelete,\n}: LiteEffectProps) {\n\tuseExitEffectPreviewOnUnmount()\n\n\tconst onChange = onEffectChange(type, nodeIds)\n\tconst onChangeShadow = <K extends keyof BoxShadow>(key: K) =>\n\t\tengine.scheduler.wrapHandler((value: BoxShadow[K]) => {\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\t\t\tconst { withEffect, defaults } = effectConfig[type]\n\t\t\tconst updateKey = getKeyForUpdate(type, \"boxShadow\")\n\n\t\t\tif (!updateKey) return\n\t\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(nodeIds, withEffect)) {\n\t\t\t\tconst shadow = effectKeyOfNode(node, updateKey)\n\t\t\t\tif (!isBoxShadow(shadow)) continue\n\t\t\t\tconst updatedShadow = getUpdatedShadow(shadow, { [key]: value })\n\t\t\t\tconst update = { [updateKey]: updatedShadow }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(type, update)\n\t\t\t}\n\t\t})\n\n\tconst onChangeShadowType = useEngineCallback(\n\t\t(_index: number, boxShadowType: BoxShadow[\"type\"], values: Partial<BoxShadow>) => {\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\t\t\tconst { withEffect, defaults } = effectConfig[type]\n\t\t\tconst updateKey = getKeyForUpdate(type, \"boxShadow\")\n\t\t\tif (!updateKey) return\n\n\t\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(nodeIds, withEffect)) {\n\t\t\t\tconst shadow = effectKeyOfNode(node, updateKey)\n\t\t\t\tif (!isBoxShadow(shadow)) continue\n\t\t\t\tconst updatedShadow = getUpdatedShadow(shadow, { ...values, type: boxShadowType })\n\t\t\t\tconst update = { [updateKey]: updatedShadow }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(type, update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds, type],\n\t)\n\n\tconst addFill = useEngineCallback(() => {\n\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\tconst { withEffect, defaults } = effectConfig[type]\n\t\tconst updateKey = getKeyForUpdate(type, \"backgroundColor\")\n\t\tif (!updateKey) return\n\n\t\tfor (const node of engine.tree.getNodesWithTrait<CanvasNode & typeof defaults>(nodeIds, withEffect)) {\n\t\t\tconst currentFill = withFill(node) && node.fillType === \"color\" && node.fillColor\n\t\t\tconst update = {\n\t\t\t\t[updateKey]:\n\t\t\t\t\tisString(currentFill) && !Color.isP3String(currentFill)\n\t\t\t\t\t\t? Color.darken(Color(currentFill), 10).toValue()\n\t\t\t\t\t\t: getNextFrameColor(),\n\t\t\t}\n\t\t\tnode.set(update)\n\t\t\ttrackEffectUpdate(type, update)\n\t\t}\n\t}, [nodeIds, type])\n\n\tconst inSmartComponent = scopeType === ScopeType.SmartComponent\n\n\treturn (\n\t\t<PopoutButtonWithPreview\n\t\t\tid={getLiteEffectPopoutId(type)}\n\t\t\tpopout={\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t>\n\t\t\t\t\t<EffectStylePopout\n\t\t\t\t\t\t{...effect}\n\t\t\t\t\t\tshowBackgroundColor={onlyFrameNodes && !inSmartComponent}\n\t\t\t\t\t\tshowBoxShadow={showBoxShadow && !inSmartComponent}\n\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\tonChangeShadow={onChangeShadow}\n\t\t\t\t\t\tonChangeShadowType={onChangeShadowType}\n\t\t\t\t\t\tonAddFill={addFill}\n\t\t\t\t\t\tshowTransition\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t\tnavigationTitle={getEffectTitle(type)}\n\t\t\tdisplayDivider\n\t\t\ttitle=\"Effect\"\n\t\t\tonDelete={onDelete}\n\t\t\tonPresent={() => setEffectTypePreview(type)}\n\t\t\tonDismiss={exitEffectPreview}\n\t\t\tpreview={\n\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t<IconEffect />\n\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t}\n\t\t/>\n\t)\n}\n\nexport const PressEffectRow = React.memo(function PressEffectRow({\n\tnodeIds,\n\tonlyFrameNodes,\n\tscopeId,\n\tscopeType,\n\twhileTapEnabled,\n\tonlyNodesWithWhileTap,\n\t...effect\n}: {\n\tnodeIds: NodeID[]\n\tonlyFrameNodes: boolean\n\tscopeId: NodeID\n\tscopeType: ScopeType\n} & ReducedPressEffect) {\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Tap, { whileTapEnabled: true })\n\tconst onDelete = useRemoveEffect(EffectType.Tap, nodeIds)\n\n\tif (!onlyNodesWithWhileTap || whileTapEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Tap} title=\"Press\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<GestureEffectRow\n\t\t\t\ttype={EffectType.Tap}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonlyFrameNodes={onlyFrameNodes}\n\t\t\t\tshowBoxShadow={!isMixed(effect.whileTapBoxShadowCount)}\n\t\t\t\teffect={getReducedTapStyleEffect(effect)}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tscopeId={scopeId}\n\t\t\t\tscopeType={scopeType}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n\nexport const HoverEffectRow = React.memo(function HoverEffectRow({\n\tnodeIds,\n\tonlyFrameNodes,\n\tscopeId,\n\tscopeType,\n\twhileHoverEnabled,\n\tonlyNodesWithWhileHover,\n\t...effect\n}: {\n\tnodeIds: NodeID[]\n\tonlyFrameNodes: boolean\n\tscopeId: NodeID\n\tscopeType: ScopeType\n} & ReducedHoverEffect) {\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Hover, { whileHoverEnabled: true })\n\tconst onDelete = useRemoveEffect(EffectType.Hover, nodeIds)\n\n\tif (!onlyNodesWithWhileHover || whileHoverEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Hover} title=\"Hover\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<GestureEffectRow\n\t\t\t\ttype={EffectType.Hover}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonlyFrameNodes={onlyFrameNodes}\n\t\t\t\tshowBoxShadow={!isMixed(effect.whileHoverBoxShadowCount)}\n\t\t\t\teffect={getReducedHoverStyleEffect(effect)}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tscopeId={scopeId}\n\t\t\t\tscopeType={scopeType}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n", "import { NumberInputWithTicker, SegmentedControl, SegmentedControlItem, Slider, Stack } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { FillPopoutButton } from \"document/components/chrome/shared/ColorPicker/FillPopoutButton.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { type Reduced, isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedStyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { BoxShadow } from \"document/models/Shadow.ts\"\nimport { createBoxShadow } from \"document/models/Shadow.ts\"\nimport { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonBackgroundPreview } from \"../../../../shared/PopoutButtonBackgroundPreview.tsx\"\nimport { TransitionPopoutButton } from \"../../../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { FusedNumberInputs } from \"../../../inputs/FusedNumberInputs.tsx\"\nimport { buttonTitleForShadow } from \"../../../panels/ShadowPanel.tsx\"\nimport { ShadowPopout } from \"../../../panels/ShadowPopout.tsx\"\nimport { doubleColumn } from \"../../../utils/doubleColumn.ts\"\nimport { ROTATE_MAX_VALUE, ROTATE_MIN_VALUE, rotate3dLabels } from \"../../../utils/rotate.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\n\nconst rotationKeys: Partial<keyof ReducedStyleEffect>[] = [\"rotateX\", \"rotateY\", \"rotate\"]\n\nfunction PauseOffscreenRow({ value, onChange }: { value?: Reduced<boolean>; onChange: (value: boolean) => void }) {\n\treturn (\n\t\t<PanelRow title=\"Off Screen\">\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem identifier=\"play\" title=\"Play\" selected={!value} onSelect={() => onChange(false)} />\n\t\t\t\t<SegmentedControlItem identifier=\"pause\" title=\"Pause\" selected={!!value} onSelect={() => onChange(true)} />\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n\nexport function EffectStylePopout({\n\topacity,\n\tx,\n\ty,\n\tscale,\n\trotate3d,\n\trotate,\n\trotateX,\n\trotateY,\n\tskewX,\n\tskewY,\n\ttransition,\n\tbackgroundColor,\n\tblur,\n\tpauseOffscreen,\n\tboxShadow,\n\tonChange,\n\tonChangePauseOffscreen,\n\tonChangeShadow,\n\tonChangeShadowType,\n\tonAddFill,\n\tshowTransition = true,\n\tshowBackgroundColor = false,\n\tshowBoxShadow = false,\n\tshowBlur = false,\n\tshowPauseOffscreen = false,\n\tshowStagger = false,\n}: ReducedStyleEffect & {\n\tchildren?: React.ReactNode\n\tshowTransition?: boolean\n\tshowBackgroundColor?: boolean\n\tshowBoxShadow?: boolean\n\tshowBlur?: boolean\n\tshowPauseOffscreen?: boolean\n\tshowStagger?: boolean\n\tonChange: <T extends keyof ReducedStyleEffect>(key: T, value: ReducedStyleEffect[T]) => void\n\tonChangeShadow?: <K extends keyof BoxShadow>(key: K, _index: number) => (value: BoxShadow[K]) => void\n\tonChangeShadowType?: (_index: number, type: BoxShadow[\"type\"], update: Partial<BoxShadow>) => void\n\tonChangePauseOffscreen?: (value: boolean) => void\n\tonAddFill?: () => void\n}) {\n\tconst onChangeValue = <T extends keyof ReducedStyleEffect>(key: T) => {\n\t\treturn (value: ReducedStyleEffect[T]) => onChange(key, value)\n\t}\n\n\tconst onChangeRotate = (value: number) => {\n\t\tonChange(\"rotate3d\", false)\n\t\tonChange(\"rotate\", value)\n\t}\n\n\tconst onChangeRotate3DValue = useCallback(\n\t\t(index: number, value: number) => {\n\t\t\tconst rotationKey = rotationKeys[index]\n\n\t\t\tif (rotationKey) {\n\t\t\t\tonChange(rotationKey, value)\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t)\n\n\treturn (\n\t\t<Stack gap={0} padding={0}>\n\t\t\t<PanelRow title=\"Opacity\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(opacity)}\n\t\t\t\t\tdefaultValue={1}\n\t\t\t\t\tonChange={onChangeValue(\"opacity\")}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={1}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(opacity)} min={0} max={1} onChange={onChangeValue(\"opacity\")} step={0.1} />\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Scale\">\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(scale)}\n\t\t\t\t\tdefaultValue={1}\n\t\t\t\t\tonChange={onChangeValue(\"scale\")}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={10}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t/>\n\t\t\t\t<Slider value={notFoundToUndefined(scale)} min={0} max={10} onChange={onChangeValue(\"scale\")} step={0.1} />\n\t\t\t</PanelRow>\n\t\t\t{showBlur && (\n\t\t\t\t<PanelRow title=\"Blur\">\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={notFoundToUndefined(blur)}\n\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\tonChange={onChangeValue(\"blur\")}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tmax={100}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider\n\t\t\t\t\t\tvalue={notFoundToUndefined(blur)}\n\t\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tmax={100}\n\t\t\t\t\t\tonChange={onChangeValue(\"blur\")}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t<PanelRow title={Dictionary.Rotate}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={rotate3d ? undefined : notFoundToUndefined(rotate)}\n\t\t\t\t\tonChange={onChangeRotate}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tmin={ROTATE_MIN_VALUE}\n\t\t\t\t\tmax={ROTATE_MAX_VALUE}\n\t\t\t\t\tstep={1}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControl>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"2D\"\n\t\t\t\t\t\tselected={rotate3d === false}\n\t\t\t\t\t\tonSelect={onChangeValue(\"rotate3d\")}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle=\"3D\"\n\t\t\t\t\t\tselected={rotate3d === true}\n\t\t\t\t\t\tonSelect={onChangeValue(\"rotate3d\")}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{rotate3d !== false && (\n\t\t\t\t<PanelRow title=\"\">\n\t\t\t\t\t<FusedNumberInputs\n\t\t\t\t\t\tlabels={rotate3dLabels}\n\t\t\t\t\t\tvalues={[notFoundToUndefined(rotateX), notFoundToUndefined(rotateY), notFoundToUndefined(rotate)]}\n\t\t\t\t\t\tdefaultValues={[0, 0, 0]}\n\t\t\t\t\t\tminValue={ROTATE_MIN_VALUE}\n\t\t\t\t\t\tmaxValue={ROTATE_MAX_VALUE}\n\t\t\t\t\t\tstep={1}\n\t\t\t\t\t\tonValueChange={onChangeRotate3DValue}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t\t<PanelRow title={Dictionary.Skew}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(skewX) ?? 0}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tonChange={onChangeValue(\"skewX\")}\n\t\t\t\t\tlabelShort=\"X\"\n\t\t\t\t\tunit=\"\u00B0\"\n\t\t\t\t/>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(skewY) ?? 0}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tonChange={onChangeValue(\"skewY\")}\n\t\t\t\t\tlabelShort=\"Y\"\n\t\t\t\t\tunit=\"\u00B0\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Offset}>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(x)}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tonChange={onChangeValue(\"x\")}\n\t\t\t\t\tlabelShort=\"X\"\n\t\t\t\t/>\n\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\tvalue={notFoundToUndefined(y)}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tonChange={onChangeValue(\"y\")}\n\t\t\t\t\tlabelShort=\"Y\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\n\t\t\t{showBackgroundColor && (\n\t\t\t\t<PanelRow title=\"Fill\">\n\t\t\t\t\t{isString(backgroundColor) ? (\n\t\t\t\t\t\t<FillPopoutButton\n\t\t\t\t\t\t\tonClearFill={() => onChange(\"backgroundColor\", undefined)}\n\t\t\t\t\t\t\tclearFillEnabled\n\t\t\t\t\t\t\tcurrentType=\"color\"\n\t\t\t\t\t\t\tvalue={backgroundColor}\n\t\t\t\t\t\t\ttabsToShow={[\"solid\"]}\n\t\t\t\t\t\t\tonChange={onChangeValue(\"backgroundColor\")}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"fill\" onClick={onAddFill} />\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t{showBoxShadow && onChangeShadow && onChangeShadowType && (\n\t\t\t\t<PanelRow title=\"Shadow\">\n\t\t\t\t\t{boxShadow && isFound(boxShadow) ? (\n\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\tid=\"boxShadow\"\n\t\t\t\t\t\t\ttitle={buttonTitleForShadow(boxShadow)}\n\t\t\t\t\t\t\tnavigationTitle=\"Shadow\"\n\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t<ShadowPopout\n\t\t\t\t\t\t\t\t\tonlyNodesSupportingRealisticShadows\n\t\t\t\t\t\t\t\t\t// Effects don't exist on shapes\n\t\t\t\t\t\t\t\t\tanyShapeNode={false}\n\t\t\t\t\t\t\t\t\twithSpread\n\t\t\t\t\t\t\t\t\twithInset\n\t\t\t\t\t\t\t\t\tindex={0}\n\t\t\t\t\t\t\t\t\ttype={boxShadow.type}\n\t\t\t\t\t\t\t\t\tcolor={boxShadow.color}\n\t\t\t\t\t\t\t\t\tx={boxShadow.x}\n\t\t\t\t\t\t\t\t\ty={boxShadow.y}\n\t\t\t\t\t\t\t\t\tblur={boxShadow.blur}\n\t\t\t\t\t\t\t\t\tinset={boxShadow.inset}\n\t\t\t\t\t\t\t\t\tspread={boxShadow.spread}\n\t\t\t\t\t\t\t\t\tdiffusion={boxShadow.diffusion}\n\t\t\t\t\t\t\t\t\tfocus={boxShadow.focus}\n\t\t\t\t\t\t\t\t\tonChange={onChangeShadow}\n\t\t\t\t\t\t\t\t\tonChangeType={onChangeShadowType}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\tonDelete={() => onChange(\"boxShadow\", undefined)}\n\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t<PopoutButtonBackgroundPreview background={isString(boxShadow.color) ? boxShadow.color : \"white\"} />\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\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\t\t\ttype=\"shadow\"\n\t\t\t\t\t\t\tonClick={() => onChange(\"boxShadow\", createBoxShadow({ y: 2, blur: 4 }))}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t{showPauseOffscreen && onChangePauseOffscreen && (\n\t\t\t\t<PauseOffscreenRow value={pauseOffscreen} onChange={onChangePauseOffscreen} />\n\t\t\t)}\n\n\t\t\t{showTransition && (\n\t\t\t\t<PanelRow title=\"Transition\">\n\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\ttitle=\"Transition\"\n\t\t\t\t\t\ttransition={transition}\n\t\t\t\t\t\tonChange={onChangeValue(\"transition\")}\n\t\t\t\t\t\tshowStagger={showStagger}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import { NumberInputWithTickerAndStepper, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { shouldBeNever, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { FillPopoutButton } from \"document/components/chrome/shared/ColorPicker/FillPopoutButton.tsx\"\nimport { DynamicValueButton } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype WithLightboxEffect,\n\tlightboxEffectEnabledDefaults,\n\twithLightboxEffect,\n} from \"document/models/CanvasTree/traits/WithLightboxEffect.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { maxZIndex, minZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedFill } from \"document/models/CanvasTree/traits/utils/reduceFill.ts\"\nimport type { ReducedLightboxEffect } from \"document/models/CanvasTree/traits/utils/reduceLightboxEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { TransitionPopoutButton } from \"../../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { paddingPerSideSegmentIndex } from \"../../panels/PaddingRow.tsx\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { SplitInFourInputsRow } from \"../SplitInFourInputsRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\ninterface LightboxEffectProps extends ReducedLightboxEffect {\n\tnodeIds: NodeID[]\n}\n\nconst traitTypes = [TraitType.Overlay]\nconst variableTypes: VariableType[] = [ControlType.Color]\nconst trackingMetadata = { nodeType: \"frame\", nodeProperty: \"lightboxEffectBackdrop\" }\n\nconst lightboxPaddingDefaultValues = [0, 0, 0, 0] as const\nconst lightboxPaddingProperties: [\n\tkeyof WithLightboxEffect,\n\tkeyof WithLightboxEffect,\n\tkeyof WithLightboxEffect,\n\tkeyof WithLightboxEffect,\n] = [\n\t\"lightboxEffectPaddingTop\",\n\t\"lightboxEffectPaddingRight\",\n\t\"lightboxEffectPaddingBottom\",\n\t\"lightboxEffectPaddingLeft\",\n]\nconst lightboxPaddingLabels = [\"t\", \"r\", \"b\", \"l\"] as const\nconst lightboxPaddingToggleTitles = [\"Padding\", \"Padding per side\"]\n\nfunction useEffectUpdate<T extends WithLightboxEffect, K extends keyof T>(key: K, nodeIds: NodeID[]) {\n\tconst engine = useAndAssertVekterEngine()\n\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]> | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withLightboxEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithLightboxEffect> = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Lightbox, update)\n\t\t\t})\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nfunction LightboxEffectPopout(\n\tprops: Omit<LightboxEffectProps, \"onlyNodesWithLightboxEffect\" | \"lightboxEffectEnabled\">,\n) {\n\tconst {\n\t\tnodeIds,\n\t\tlightboxEffectPadding: padding,\n\t\tlightboxEffectPaddingPerSide: paddingPerSide,\n\t\tlightboxEffectPaddingTop: paddingTop,\n\t\tlightboxEffectPaddingRight: paddingRight,\n\t\tlightboxEffectPaddingBottom: paddingBottom,\n\t\tlightboxEffectPaddingLeft: paddingLeft,\n\t\tlightboxEffectMaxWidth: maxWidth,\n\t\tlightboxEffectZIndex: zIndex,\n\t\tlightboxEffectBackdrop,\n\t\tlightboxEffectTransition,\n\t} = props\n\n\tconst engine = useAndAssertVekterEngine()\n\tconst onChangeTransition = useEffectUpdate(\"lightboxEffectTransition\", nodeIds)\n\tconst onChangeMaxWidth = useEffectUpdate(\"lightboxEffectMaxWidth\", nodeIds)\n\tconst onChangeZIndex = useEffectUpdate(\"lightboxEffectZIndex\", nodeIds)\n\tconst onChangeBackground = useEffectUpdate(\"lightboxEffectBackdrop\", nodeIds)\n\n\tconst createBackdropVariable = useEngineCallback(() => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\ttype: ControlType.Color,\n\t\t\tname: \"backdrop\",\n\t\t\tinitialValue: isString(lightboxEffectBackdrop)\n\t\t\t\t? lightboxEffectBackdrop\n\t\t\t\t: lightboxEffectEnabledDefaults.lightboxEffectBackdrop,\n\t\t\tscopeId: engine.stores.scopeStore.active.id,\n\t\t})\n\n\t\tif (!variableRef) return\n\n\t\tonChangeBackground(variableRef)\n\t}, [onChangeBackground, lightboxEffectBackdrop])\n\n\tconst onRemoveDynamicBackdropValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(lightboxEffectBackdrop)) return\n\n\t\tif (isVariableReference(lightboxEffectBackdrop)) {\n\t\t\tconst variableValue = getVariableValue(engine, lightboxEffectBackdrop)\n\t\t\tconst newBackground = isString(variableValue)\n\t\t\t\t? variableValue\n\t\t\t\t: lightboxEffectEnabledDefaults.lightboxEffectBackdrop\n\t\t\tonChangeBackground(newBackground)\n\t\t} else if (isComputedValue(lightboxEffectBackdrop)) {\n\t\t\tonChangeBackground(lightboxEffectEnabledDefaults.lightboxEffectBackdrop)\n\t\t} else {\n\t\t\tshouldBeNever(lightboxEffectBackdrop)\n\t\t}\n\t}, [onChangeBackground, lightboxEffectBackdrop])\n\n\tconst onRemoveBackdrop = useEngineCallback(() => {\n\t\tonChangeBackground(undefined)\n\t}, [onChangeBackground])\n\n\tconst onAddBackdrop = useEngineCallback(() => {\n\t\tonChangeBackground(lightboxEffectEnabledDefaults.lightboxEffectBackdrop)\n\t}, [onChangeBackground])\n\n\tconst onClearMaxWidth = useEngineCallback(() => {\n\t\tonChangeMaxWidth(lightboxEffectEnabledDefaults.lightboxEffectMaxWidth)\n\t}, [onChangeMaxWidth])\n\n\tconst onClearZIndex = useEngineCallback(() => {\n\t\tonChangeZIndex(lightboxEffectEnabledDefaults.lightboxEffectZIndex)\n\t}, [onChangeZIndex])\n\n\tconst hasCommonFill = isString(lightboxEffectBackdrop)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title=\"Max Width\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tdefaultValue={lightboxEffectEnabledDefaults.lightboxEffectMaxWidth}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tonChange={onChangeMaxWidth}\n\t\t\t\t\tonClear={onClearMaxWidth}\n\t\t\t\t\tvalue={isNumber(maxWidth) ? maxWidth : lightboxEffectEnabledDefaults.lightboxEffectMaxWidth}\n\t\t\t\t\tstep={1}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<SplitInFourInputsRow\n\t\t\t\ttitle={Dictionary.Padding}\n\t\t\t\tmainValue={padding}\n\t\t\t\tmainDefaultValue={0}\n\t\t\t\tsegmentedControlIndex={paddingPerSideSegmentIndex(paddingPerSide)}\n\t\t\t\tfusedValues={[paddingTop, paddingRight, paddingBottom, paddingLeft]}\n\t\t\t\tfusedDefaultValues={lightboxPaddingDefaultValues}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tsplitInFourKey=\"lightboxEffectPaddingPerSide\"\n\t\t\t\tmainProperty=\"lightboxEffectPadding\"\n\t\t\t\tfusedProperties={lightboxPaddingProperties}\n\t\t\t\ticonType=\"border\"\n\t\t\t\tfusedLabels={lightboxPaddingLabels}\n\t\t\t\tmainTraitFilter={withLightboxEffect}\n\t\t\t\tfusedTraitFilter={withLightboxEffect}\n\t\t\t\ttoggleTitles={lightboxPaddingToggleTitles}\n\t\t\t\tminValue={0}\n\t\t\t\tstep=\"nudge\"\n\t\t\t/>\n\t\t\t<PanelRow title=\"Z Index\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tmax={maxZIndex}\n\t\t\t\t\tmin={minZIndex}\n\t\t\t\t\tonChange={onChangeZIndex}\n\t\t\t\t\tonClear={onClearZIndex}\n\t\t\t\t\tvalue={isNumber(zIndex) ? zIndex : 0}\n\t\t\t\t\tstep={1}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow\n\t\t\t\ttitle=\"Backdrop\"\n\t\t\t\tonAdd={onAddBackdrop}\n\t\t\t\taddEnabled={!hasCommonFill}\n\t\t\t\tonDelete={onRemoveBackdrop}\n\t\t\t\tdeleteEnabled={hasCommonFill}\n\t\t\t\ttraitTypes={traitTypes}\n\t\t\t\tvariableType={variableTypes}\n\t\t\t\tonCreateVariable={createBackdropVariable}\n\t\t\t\tonRemoveDynamicValue={onRemoveDynamicBackdropValue}\n\t\t\t\tdynamicValue={isDynamicValue(lightboxEffectBackdrop) ? lightboxEffectBackdrop : null}\n\t\t\t\tonSelectVariable={onChangeBackground}\n\t\t\t\tsupportsVariables\n\t\t\t>\n\t\t\t\t{hasCommonFill ? (\n\t\t\t\t\tisDynamicValue(lightboxEffectBackdrop) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\ttitle={Dictionary.Fill}\n\t\t\t\t\t\t\tvalue={lightboxEffectBackdrop}\n\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\texpectedType={variableTypes}\n\t\t\t\t\t\t\tpopoutId=\"lightboxEffectBackdropValueTransform\"\n\t\t\t\t\t\t\tonRemove={onRemoveDynamicBackdropValue}\n\t\t\t\t\t\t\tonChangeDynamicValue={onChangeBackground}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<FillPopoutButton\n\t\t\t\t\t\t\tid=\"lightboxEffectBackdrop\"\n\t\t\t\t\t\t\tvalue={isString(lightboxEffectBackdrop) ? lightboxEffectBackdrop : \"\"}\n\t\t\t\t\t\t\tcurrentType=\"color\"\n\t\t\t\t\t\t\tonChange={onChangeBackground}\n\t\t\t\t\t\t\tonClearFill={onRemoveBackdrop}\n\t\t\t\t\t\t\tclearFillEnabled\n\t\t\t\t\t\t\ttrackingMetadata={trackingMetadata}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) : (\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"fill\" onClick={onAddBackdrop} />\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\ttransition={lightboxEffectTransition}\n\t\t\t\t\tonChange={onChangeTransition}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n\nexport const lightboxEffectPopoutId = \"lightboxEffect\"\nexport const LightboxEffectRow = React.memo(function LightboxEffectRow({\n\tnodeIds,\n\tonlyNodesWithLightboxEffect,\n\tlightboxEffectEnabled,\n\tanyNodesWithImageFill,\n\t...effect\n}: LightboxEffectProps & Pick<ReducedFill, \"anyNodesWithImageFill\">) {\n\tconst onDelete = useRemoveEffect(EffectType.Lightbox, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Lightbox, { lightboxEffectEnabled: true })\n\tif (!onlyNodesWithLightboxEffect || lightboxEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow\n\t\t\ttype={EffectType.Lightbox}\n\t\t\ttitle={Dictionary.Lightbox}\n\t\t\tonDelete={onDelete}\n\t\t\tonCopy={onCopy}\n\t\t\tselection={nodeIds}\n\t\t>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={lightboxEffectPopoutId}\n\t\t\t\t// When the layer doesn't have an image fill, we won't apply the ligthbox effect.\n\t\t\t\t// Since we allow users to apply a ligthbox effect to a multi-selection, the layer\n\t\t\t\t// can have an effect even without an iamge.\n\t\t\t\tenabled={anyNodesWithImageFill}\n\t\t\t\tpopout={<LightboxEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle={Dictionary.Lightbox}\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n", "import { NumberInputWithTickerAndStepper, SegmentedControl, SegmentedControlItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { LoopEffectRepeatType, WithLoopEffect } from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport { loopEffectEnabledDefaults, withLoopEffect } from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedStyleEffect, StyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { getReducedLoopStyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedLoopEffect } from \"document/models/CanvasTree/traits/utils/reduceLoopEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectStylePopout } from \"./shared/EffectStylePopout.tsx\"\nimport { createCopyEffectHandler, exitEffectPreview, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\ntype LoopStyleEffect = Omit<StyleEffect, \"backgroundColor\" | \"transformPerspective\" | \"boxShadow\" | \"blur\">\n\nconst loopKeys: Record<keyof LoopStyleEffect, keyof WithLoopEffect> = {\n\tx: \"loopEffectX\",\n\ty: \"loopEffectY\",\n\tscale: \"loopEffectScale\",\n\topacity: \"loopEffectOpacity\",\n\trotate3d: \"loopEffectRotate3d\",\n\trotate: \"loopEffectRotate\",\n\trotateX: \"loopEffectRotateX\",\n\trotateY: \"loopEffectRotateY\",\n\tskewX: \"loopEffectSkewX\",\n\tskewY: \"loopEffectSkewY\",\n\ttransition: \"loopEffectTransition\",\n}\n\nfunction isLoopStyleEffectKey(key: keyof ReducedStyleEffect): key is keyof typeof loopKeys {\n\treturn key in loopKeys\n}\n\nfunction updateOnEffectChange<K extends keyof WithLoopEffect>(\n\tnodeIds: string[],\n\tupdateKey: K,\n\tvalue: WithLoopEffect[K],\n) {\n\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withLoopEffect)) {\n\t\tconst update = { [updateKey]: value }\n\t\tnode.set(update)\n\t\ttrackEffectUpdate(EffectType.Loop, update)\n\t}\n}\n\nfunction useOnEffectChangeWithKey<K extends keyof WithLoopEffect>(nodeIds: string[], fixedKey: K) {\n\treturn useEngineCallback(\n\t\t(value: WithLoopEffect[K]) => updateOnEffectChange(nodeIds, fixedKey, value),\n\t\t[nodeIds, fixedKey],\n\t)\n}\nfunction useOnEffectChange<K extends keyof ReducedStyleEffect>(nodeIds: string[]) {\n\treturn useEngineCallback(\n\t\t(key: K, value: ReducedStyleEffect[K]) => {\n\t\t\tif (!isLoopStyleEffectKey(key)) return\n\t\t\tconst updateKey = loopKeys[key]\n\t\t\tupdateOnEffectChange(nodeIds, updateKey, value as WithLoopEffect[typeof updateKey])\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nconst setEffectTypePreview = () =>\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.effectStore.enterPreview({ effect: EffectPreviewType.Loop })\n\t})\n\ninterface Props extends ReducedLoopEffect {\n\tnodeIds: NodeID[]\n}\n\nexport const loopEffectPopoutId = \"loopEffect\"\nexport function LoopEffectRow({ nodeIds, onlyNodesWithLoopEffect, loopEffectEnabled, ...effect }: Props) {\n\tconst onChange = useOnEffectChange(nodeIds)\n\tconst onChangeRepeatType = useOnEffectChangeWithKey(nodeIds, \"loopEffectRepeatType\")\n\tconst onChangeRepeatDelay = useOnEffectChangeWithKey(nodeIds, \"loopEffectRepeatDelay\")\n\tconst onChangePauseOffscreen = useOnEffectChangeWithKey(nodeIds, \"loopEffectPauseOffscreen\")\n\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Loop, { loopEffectEnabled: true })\n\tconst onDelete = useRemoveEffect(EffectType.Loop, nodeIds)\n\n\tif (!onlyNodesWithLoopEffect || loopEffectEnabled !== true) return null\n\n\tconst { loopEffectRepeatDelay, loopEffectRepeatType } = effect\n\tconst delay = (isNotFound(loopEffectRepeatDelay) ? 0 : loopEffectRepeatDelay) ?? 0\n\n\treturn (\n\t\t<EffectRow type={EffectType.Loop} title=\"Loop\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={loopEffectPopoutId}\n\t\t\t\tpopout={\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t>\n\t\t\t\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t\t\t<SegmentedControlItem<LoopEffectRepeatType>\n\t\t\t\t\t\t\t\t\tidentifier=\"loop\"\n\t\t\t\t\t\t\t\t\ttitle=\"Loop\"\n\t\t\t\t\t\t\t\t\tselected={loopEffectRepeatType === \"loop\"}\n\t\t\t\t\t\t\t\t\tonSelect={onChangeRepeatType}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<SegmentedControlItem<LoopEffectRepeatType>\n\t\t\t\t\t\t\t\t\tidentifier=\"mirror\"\n\t\t\t\t\t\t\t\t\ttitle=\"Mirror\"\n\t\t\t\t\t\t\t\t\tselected={loopEffectRepeatType === \"mirror\"}\n\t\t\t\t\t\t\t\t\tonSelect={onChangeRepeatType}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t\t<PanelRow title=\"Delay\">\n\t\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\t\tvalue={delay}\n\t\t\t\t\t\t\t\tdefaultValue={loopEffectEnabledDefaults.loopEffectRepeatDelay}\n\t\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\t\tonChange={onChangeRepeatDelay}\n\t\t\t\t\t\t\t\tstep={0.1}\n\t\t\t\t\t\t\t\tstepperStep={1}\n\t\t\t\t\t\t\t\tlabel=\"S\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t\t<EffectStylePopout\n\t\t\t\t\t\t\t{...getReducedLoopStyleEffect(effect)}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tshowTransition\n\t\t\t\t\t\t\tshowPauseOffscreen={true}\n\t\t\t\t\t\t\tonChangePauseOffscreen={onChangePauseOffscreen}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t}\n\t\t\t\tnavigationTitle=\"Loop Effect\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tonPresent={setEffectTypePreview}\n\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n}\n", "import {\n\tNumberInputWithTickerAndStepper,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { roundWithPrecision } from \"canvas-sandbox/layout-measuring/roundWithPrecision.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"document/components/chrome/shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { TransitionPopoutButton } from \"document/components/chrome/shared/TransitionEditor/TransitionPopout.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithStrokeEffect } from \"document/models/CanvasTree/traits/WithStrokeEffect.ts\"\nimport { withStrokeEffect } from \"document/models/CanvasTree/traits/WithStrokeEffect.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedStrokeEffect } from \"document/models/CanvasTree/traits/utils/reduceStrokeEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { doubleColumnClass } from \"../../utils/doubleColumn.styles.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\ninterface Props extends ReducedStrokeEffect {\n\tnodeIds: NodeID[]\n}\n\nexport const strokeEffectPopoutId = \"strokeEffect\"\nexport const StrokeEffectRow = React.memo(function StrokeEffectRow({\n\tnodeIds,\n\tonlyNodesWithStrokeEffect,\n\tstrokeEffectEnabled,\n\t...effect\n}: Props) {\n\tconst onDelete = useRemoveEffect(EffectType.Stroke, nodeIds)\n\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Stroke, { strokeEffectEnabled: true })\n\tif (!onlyNodesWithStrokeEffect || strokeEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.Stroke} title=\"Stroke\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={strokeEffectPopoutId}\n\t\t\t\tpopout={<StrokeEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Stroke Effect\"\n\t\t\t\tdisplayDivider={false}\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n\nfunction usePathLengthEffectUpdate<T extends keyof WithStrokeEffect>(ids: NodeID[], key: T) {\n\treturn useEngineCallback(\n\t\t(value: WithStrokeEffect[T]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(ids, withStrokeEffect)) {\n\t\t\t\tconst update: Partial<WithStrokeEffect> = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Stroke, update)\n\t\t\t}\n\t\t},\n\t\t[ids, key],\n\t)\n}\n\ntype Percentage = Pick<WithStrokeEffect, \"strokeEffectLength\" | \"strokeEffectGap\" | \"strokeEffectOffset\">\n\nfunction usePathLengthEffectPercentageUpdate<T extends keyof Percentage>(ids: NodeID[], key: T) {\n\treturn useEngineCallback(\n\t\t(value: Percentage[T]) => {\n\t\t\tconst percentage = isNumber(value) ? roundWithPrecision(value / 100, 2) : value\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(ids, withStrokeEffect)) {\n\t\t\t\tconst update: Partial<Percentage> = { [key]: percentage }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Stroke, update)\n\t\t\t}\n\t\t},\n\t\t[ids, key],\n\t)\n}\n\nconst repeatTypeOptions = [\"repeat\", \"mirror\", \"continuous\"] as const\n\nconst StrokeEffectPopout = React.memo(function StrokeEffectPopout(\n\tprops: Omit<Props, \"onlyNodesWithStrokeEffect\" | \"strokeEffectEnabled\">,\n) {\n\tconst {\n\t\tnodeIds,\n\t\tstrokeEffectLength,\n\t\tstrokeEffectGap,\n\t\tstrokeEffectOffset,\n\t\tstrokeEffectLoop,\n\t\tstrokeEffectLoopType,\n\t\tstrokeEffectTransition,\n\t} = props\n\n\tconst handleLoop = usePathLengthEffectUpdate(nodeIds, \"strokeEffectLoop\")\n\tconst handleLoopType = usePathLengthEffectUpdate(nodeIds, \"strokeEffectLoopType\")\n\n\tconst handleLength = usePathLengthEffectPercentageUpdate(nodeIds, \"strokeEffectLength\")\n\tconst handleGap = usePathLengthEffectPercentageUpdate(nodeIds, \"strokeEffectGap\")\n\tconst handleOffset = usePathLengthEffectPercentageUpdate(nodeIds, \"strokeEffectOffset\")\n\n\tconst handleTransition = usePathLengthEffectUpdate(nodeIds, \"strokeEffectTransition\")\n\n\tconst start = (isNotFound(strokeEffectLength) ? 0 : strokeEffectLength) ?? 0\n\tconst end = (isNotFound(strokeEffectGap) ? 1 : strokeEffectGap) ?? 1\n\tconst offset = (isNotFound(strokeEffectOffset) ? 0 : strokeEffectOffset) ?? 0\n\n\tconst lengthPercentage = isNumber(start) ? roundWithPrecision(start * 100, 2) : start\n\tconst gapPercentage = isNumber(end) ? roundWithPrecision(end * 100, 2) : end\n\tconst offsetPercentage = isNumber(offset) ? roundWithPrecision(offset * 100, 2) : offset\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={0}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<PanelRow title=\"Length\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={lengthPercentage}\n\t\t\t\t\tdefaultValue={100}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tonChange={handleLength}\n\t\t\t\t\tstep={1}\n\t\t\t\t\tstepperStep={1}\n\t\t\t\t\tunit=\"%\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Gap\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={gapPercentage}\n\t\t\t\t\tdefaultValue={100}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tonChange={handleGap}\n\t\t\t\t\tstep={1}\n\t\t\t\t\tstepperStep={1}\n\t\t\t\t\tunit=\"%\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Offset\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={offsetPercentage}\n\t\t\t\t\tdefaultValue={0}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tmax={100}\n\t\t\t\t\tonChange={handleOffset}\n\t\t\t\t\tstep={1}\n\t\t\t\t\tstepperStep={1}\n\t\t\t\t\tunit=\"%\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Loop\">\n\t\t\t\t<SegmentedControl className={doubleColumnClass}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle=\"Yes\"\n\t\t\t\t\t\tselected={strokeEffectLoop === true}\n\t\t\t\t\t\tonSelect={handleLoop}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle=\"No\"\n\t\t\t\t\t\tselected={strokeEffectLoop === false}\n\t\t\t\t\t\tonSelect={handleLoop}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t</PanelRow>\n\t\t\t{strokeEffectLoop !== false && (\n\t\t\t\t<PanelRow title=\"Type\">\n\t\t\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t\t\t<PopupButton>\n\t\t\t\t\t\t\t{repeatTypeOptions.map(option => (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\t\ttitle={titleCase(option)}\n\t\t\t\t\t\t\t\t\tselected={strokeEffectLoopType === option}\n\t\t\t\t\t\t\t\t\tonSelect={handleLoopType}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</PopupButton>\n\t\t\t\t\t</div>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\ttransition={strokeEffectTransition}\n\t\t\t\t\tonChange={handleTransition}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tEnterEffect,\n\tExitEffect,\n\tWithStyleAppearEffect,\n} from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport {\n\texitEffectDefaults,\n\tfloatingPositionPresets,\n\tisSupportedTrigger,\n\tstyleAppearEffectEnabledDefaults,\n\tsupportedEffectTriggers,\n\twithStyleAppearPageEffect,\n} from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { ReducedStyleEffect, StyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport {\n\tgetReducedEnterStyleEffect,\n\tgetReducedExitStyleEffect,\n} from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedStyleAppearEffect } from \"document/models/CanvasTree/traits/utils/reduceStyleAppearEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { Padlock } from \"../../inputs/Padlock.tsx\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { stopPropagation } from \"../utils/stopPropagation.ts\"\nimport { EffectPresetRow } from \"./EffectPresetRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectDirectionRow } from \"./shared/EffectDirectionRow.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectScrollTargetRows } from \"./shared/EffectScrollTargetRow.tsx\"\nimport { EffectStartRow } from \"./shared/EffectStartRow.tsx\"\nimport { EffectStylePopout } from \"./shared/EffectStylePopout.tsx\"\nimport { EffectTriggerRow } from \"./shared/EffectTriggerRow.tsx\"\nimport { EffectViewportRow } from \"./shared/EffectViewportRow.tsx\"\nimport {\n\tcreateCopyEffectHandler,\n\tenableEffect,\n\texitEffectPreview,\n\ttrackEffectUpdate,\n\tuseRemoveEffect,\n} from \"./shared/utils.ts\"\n\ninterface AppearEffectProps extends Omit<\n\tProps,\n\t| \"styleAppearEffectEnabled\"\n\t| \"onlyNodesWithStyleAppearEffect\"\n\t| \"onlyNodesInAnOverlay\"\n\t| Exclude<keyof EnterEffect, \"enterEffectEnabled\">\n\t| Exclude<keyof ExitEffect, \"exitEffectEnabled\">\n> {\n\tsupportsExitEffect: boolean\n\tenterEffect: ReducedStyleEffect\n\texitEffect: ReducedStyleEffect\n\tonlyRepeatedNodes: boolean\n}\n\nconst onAppearEffectChange = <T extends WithStyleAppearEffect, K extends keyof T>(key: K, nodeIds: string[]) => {\n\treturn engine.scheduler.wrapHandler((value: NonNullable<T[K]>) => {\n\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\tnodes.forEach(node => {\n\t\t\tconst update: Partial<WithStyleAppearEffect> = { [key]: value }\n\t\t\tnode.set(update)\n\t\t\ttrackEffectUpdate(EffectType.Appear, update)\n\t\t})\n\t})\n}\n\nconst enabledFloatingPositionEffectTriggers = new Set<EffectTrigger>([EffectTrigger.OnMount])\n\nconst useChangeEffectTrigger = (nodeIds: NodeID[]) =>\n\tuseEngineCallback(\n\t\t(value: EffectTrigger) => {\n\t\t\tif (!isSupportedTrigger(value)) return\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithStyleAppearEffect> = { styleAppearEffectTrigger: value }\n\t\t\t\tif (value === EffectTrigger.OnScrollTarget) update.styleAppearEffectThreshold = 0\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Appear, update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\nconst setEffectTypePreview = (type: EffectPreviewType) =>\n\tengine.scheduler.wrapHandler(() => engine.stores.effectStore.enterPreview({ effect: type }))\n\nconst setEnterEffectPreview = setEffectTypePreview(EffectPreviewType.Enter)\nconst setExitEffectPreview = setEffectTypePreview(EffectPreviewType.Exit)\n\nconst createEnterEffectFromExitEffect = (node: WithStyleAppearEffect) => {\n\treturn {\n\t\t...exitEffectDefaults,\n\t\tenterEffectOpacity: node.exitEffectOpacity ?? styleAppearEffectEnabledDefaults.exitEffectOpacity,\n\t\tenterEffectX: node.exitEffectX ?? styleAppearEffectEnabledDefaults.exitEffectX,\n\t\tenterEffectY: node.exitEffectY ?? styleAppearEffectEnabledDefaults.exitEffectY,\n\t\tenterEffectScale: node.exitEffectScale ?? styleAppearEffectEnabledDefaults.exitEffectScale,\n\t\tenterEffectTransition: node.exitEffectTransition ?? styleAppearEffectEnabledDefaults.exitEffectTransition,\n\t\tenterEffectRotate: node.exitEffectRotate ?? styleAppearEffectEnabledDefaults.exitEffectRotate,\n\t\tenterEffectRotateX: node.exitEffectRotateX ?? styleAppearEffectEnabledDefaults.exitEffectRotateX,\n\t\tenterEffectRotateY: node.exitEffectRotateY ?? styleAppearEffectEnabledDefaults.exitEffectRotateY,\n\t}\n}\n\nconst createExitEffectFromEnterEffect = (node: WithStyleAppearEffect) => {\n\treturn {\n\t\texitEffectOpacity:\n\t\t\tnode.enterEffectOpacity ?? node.styleAppearEffectOpacity ?? styleAppearEffectEnabledDefaults.enterEffectOpacity,\n\t\texitEffectX: node.enterEffectX ?? node.styleAppearEffectX ?? styleAppearEffectEnabledDefaults.enterEffectX,\n\t\texitEffectY: node.enterEffectY ?? node.styleAppearEffectY ?? styleAppearEffectEnabledDefaults.enterEffectY,\n\t\texitEffectScale:\n\t\t\tnode.enterEffectScale ?? node.styleAppearEffectScale ?? styleAppearEffectEnabledDefaults.enterEffectScale,\n\t\texitEffectTransition:\n\t\t\tnode.enterEffectTransition ??\n\t\t\tnode.styleAppearEffectTransition ??\n\t\t\tstyleAppearEffectEnabledDefaults.enterEffectTransition,\n\t\texitEffectRotate:\n\t\t\tnode.enterEffectRotate ?? node.styleAppearEffectRotate ?? styleAppearEffectEnabledDefaults.enterEffectRotate,\n\t\texitEffectRotateX:\n\t\t\tnode.enterEffectRotateX ?? node.styleAppearEffectRotateX ?? styleAppearEffectEnabledDefaults.enterEffectRotateX,\n\t\texitEffectRotateY:\n\t\t\tnode.enterEffectRotateY ?? node.styleAppearEffectRotateY ?? styleAppearEffectEnabledDefaults.enterEffectRotateY,\n\t}\n}\n\ntype EffectUpdateKeyMap = Record<\n\tExclude<keyof StyleEffect, \"backgroundColor\" | \"boxShadow\" | \"blur\" | \"transformPerspective\">,\n\tkeyof WithStyleAppearEffect\n>\n\ninterface EffectUpdateMap {\n\t[EffectPreviewType.Enter]: EffectUpdateKeyMap\n\t[EffectPreviewType.Exit]: EffectUpdateKeyMap\n}\n\nconst genericEffectToUpdateMap: Readonly<EffectUpdateMap> = {\n\t[EffectPreviewType.Enter]: {\n\t\topacity: \"enterEffectOpacity\",\n\t\tx: \"enterEffectX\",\n\t\ty: \"enterEffectY\",\n\t\tscale: \"enterEffectScale\",\n\t\trotate3d: \"enterEffectRotate3d\",\n\t\trotate: \"enterEffectRotate\",\n\t\trotateX: \"enterEffectRotateX\",\n\t\trotateY: \"enterEffectRotateY\",\n\t\tskewX: \"enterEffectSkewX\",\n\t\tskewY: \"enterEffectSkewY\",\n\t\ttransition: \"enterEffectTransition\",\n\t},\n\t[EffectPreviewType.Exit]: {\n\t\topacity: \"exitEffectOpacity\",\n\t\tx: \"exitEffectX\",\n\t\ty: \"exitEffectY\",\n\t\tscale: \"exitEffectScale\",\n\t\trotate3d: \"exitEffectRotate3d\",\n\t\trotate: \"exitEffectRotate\",\n\t\trotateX: \"exitEffectRotateX\",\n\t\trotateY: \"exitEffectRotateY\",\n\t\tskewX: \"exitEffectSkewX\",\n\t\tskewY: \"exitEffectSkewY\",\n\t\ttransition: \"exitEffectTransition\",\n\t},\n}\n\nfunction isGenericEffectType(type: EffectPreviewType): type is keyof EffectUpdateMap {\n\treturn type in genericEffectToUpdateMap\n}\n\nfunction isGenericEffectKey(key: string): key is keyof EffectUpdateKeyMap {\n\treturn key in genericEffectToUpdateMap[EffectPreviewType.Enter]\n}\n\nfunction getAdditiveKeyForUpdate(type: EffectPreviewType): keyof WithStyleAppearEffect | undefined {\n\tswitch (type) {\n\t\tcase EffectPreviewType.Exit:\n\t\t\treturn \"exitEffectRotateAdditiveDynamicValue\"\n\t\tcase EffectPreviewType.Enter:\n\t\t\treturn \"enterEffectRotateAdditiveDynamicValue\"\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nconst useUpdateEffectValue = (nodeIds: string[], effectType: EffectPreviewType) =>\n\tuseEngineCallback(\n\t\t<T extends keyof ReducedStyleEffect>(key: T, value: ReducedStyleEffect[T]) => {\n\t\t\tif (!isGenericEffectType(effectType)) return\n\t\t\tif (!isGenericEffectKey(key)) return\n\n\t\t\tconst updateKey = genericEffectToUpdateMap[effectType][key]\n\n\t\t\tconst { selectionOutlineTracker, effectStore } = engine.stores\n\n\t\t\tselectionOutlineTracker.forceEnableSelectionOutline()\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithStyleAppearEffect & WithTransforms> = { [updateKey]: value }\n\t\t\t\ttrackEffectUpdate(EffectType.Appear, update)\n\n\t\t\t\t// If the node was migrated to add its effect rotation to the\n\t\t\t\t// node's dynamic rotation, edits to the effect rotation remove\n\t\t\t\t// this.\n\t\t\t\tconst additiveKey = getAdditiveKeyForUpdate(effectType)\n\t\t\t\tif (key === \"rotate\" && additiveKey && node[additiveKey]) update[additiveKey] = undefined\n\n\t\t\t\tnode.set(update)\n\t\t\t})\n\n\t\t\t// If the effect preview has been disabled by activating any tool,\n\t\t\t// restore the preview.\n\t\t\tif (isNull(effectStore.activeEffect)) {\n\t\t\t\teffectStore.enterPreview({ effect: effectType })\n\t\t\t}\n\t\t},\n\t\t[nodeIds, effectType],\n\t)\n\nfunction EffectPopout(\n\tprops: ReducedStyleEffect & { nodeIds: NodeID[]; type: EffectPreviewType; showStagger: boolean },\n) {\n\tconst { type, nodeIds, showStagger, ...effect } = props\n\n\tconst onChange = useUpdateEffectValue(nodeIds, type)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<EffectStylePopout {...effect} onChange={onChange} showStagger={showStagger} />\n\t\t</Stack>\n\t)\n}\n\nfunction StyleAppearEffectPopout(props: AppearEffectProps) {\n\tconst {\n\t\tnodeIds,\n\t\tstyleAppearEffectThreshold,\n\t\tstyleAppearEffectAnimateOnce,\n\t\tstyleAppearEffectScrollTarget,\n\t\texitEffectEnabled,\n\t\tenterEffectEnabled,\n\t\tstyleAppearEffectTrigger,\n\t\tstyleAppearEffectLocked,\n\t\tstyleAppearEffectScrollTargetCollectionItem,\n\t\tstyleAppearEffectScrollDirection,\n\t\tonlyNodesWithFloatingPosition,\n\t\tsupportsExitEffect,\n\t\tenterEffect,\n\t\texitEffect,\n\t\tscopeId,\n\t\tscopeType,\n\t\tonlyRepeatedNodes,\n\t} = props\n\n\tconst commonEffectTrigger = commonValue(styleAppearEffectTrigger)\n\tconst animateOnceHandler = onAppearEffectChange(\"styleAppearEffectAnimateOnce\", nodeIds)\n\tconst onSelectThreshold = onAppearEffectChange(\"styleAppearEffectThreshold\", nodeIds)\n\tconst intersectionTargetHandler = onAppearEffectChange(\"styleAppearEffectScrollTarget\", nodeIds)\n\tconst onSelectCollectionItem = onAppearEffectChange(\"styleAppearEffectScrollTargetCollectionItem\", nodeIds)\n\tconst onSelectScrollDirection = onAppearEffectChange(\"styleAppearEffectScrollDirection\", nodeIds)\n\tconst triggerHandler = useChangeEffectTrigger(nodeIds)\n\n\tconst toggleExitEffect = engine.scheduler.wrapHandler((value: boolean) => {\n\t\tconst update: Partial<WithStyleAppearEffect> = {\n\t\t\texitEffectEnabled: value,\n\t\t\tstyleAppearEffectLocked: value === false ? false : !!props.styleAppearEffectLocked,\n\t\t}\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\tnodes.forEach(node => node.set(update))\n\t})\n\n\tconst toggleEnterEffect = engine.scheduler.wrapHandler((value: boolean) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\tnodes.forEach(node => {\n\t\t\tconst update: Partial<WithStyleAppearEffect> = {\n\t\t\t\tenterEffectEnabled: value,\n\t\t\t\tstyleAppearEffectLocked: value === false ? false : !!props.styleAppearEffectLocked,\n\t\t\t}\n\n\t\t\tif (props.styleAppearEffectLocked) {\n\t\t\t\tObject.assign(update, createExitEffectFromEnterEffect(node))\n\t\t\t}\n\n\t\t\tnode.set(update)\n\t\t})\n\t})\n\n\tconst hasOnlyEnterEffect = enterEffectEnabled === true && exitEffectEnabled !== true\n\tconst hasOnlyExitEffect = exitEffectEnabled === true && enterEffectEnabled === true\n\tconst hasBothEffects = enterEffectEnabled === true && exitEffectEnabled === true\n\n\tconst canLockEffects = (hasOnlyEnterEffect || hasOnlyExitEffect || hasBothEffects) && supportsExitEffect\n\tconst effectsLocked = hasBothEffects && styleAppearEffectLocked\n\n\tconst triggerIsStaggerable =\n\t\tcommonEffectTrigger === EffectTrigger.OnMount ||\n\t\tcommonEffectTrigger === EffectTrigger.OnInView ||\n\t\tcommonEffectTrigger === EffectTrigger.OnScrollTarget\n\n\tconst showStagger = onlyRepeatedNodes && triggerIsStaggerable\n\n\tconst toggleLock = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\t\tnodes.forEach(node => {\n\t\t\tconst update: Partial<WithStyleAppearEffect> = {\n\t\t\t\tstyleAppearEffectLocked: !effectsLocked,\n\t\t\t\tenterEffectEnabled: true,\n\t\t\t}\n\n\t\t\tif (!effectsLocked) {\n\t\t\t\tif (hasOnlyEnterEffect || hasBothEffects) {\n\t\t\t\t\tObject.assign(update, { ...exitEffectDefaults })\n\t\t\t\t} else if (hasOnlyExitEffect) {\n\t\t\t\t\tObject.assign(update, createEnterEffectFromExitEffect(node))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tObject.assign(update, createExitEffectFromEnterEffect(node))\n\t\t\t}\n\n\t\t\tnode.set(update)\n\t\t})\n\t})\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<EffectTriggerRow\n\t\t\t\tonSelectTrigger={triggerHandler}\n\t\t\t\ttriggers={styleAppearEffectTrigger}\n\t\t\t\tenabledTriggers={onlyNodesWithFloatingPosition ? enabledFloatingPositionEffectTriggers : undefined}\n\t\t\t\tsupportedTriggers={supportedEffectTriggers}\n\t\t\t/>\n\n\t\t\t{commonEffectTrigger === EffectTrigger.OnScrollDirection && (\n\t\t\t\t<EffectDirectionRow direction={styleAppearEffectScrollDirection} onSelect={onSelectScrollDirection} />\n\t\t\t)}\n\n\t\t\t{commonEffectTrigger === EffectTrigger.OnScrollTarget && (\n\t\t\t\t<EffectScrollTargetRows\n\t\t\t\t\ttargets={styleAppearEffectScrollTarget}\n\t\t\t\t\tcollectionItem={styleAppearEffectScrollTargetCollectionItem}\n\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tonSelect={intersectionTargetHandler}\n\t\t\t\t\tonSelectCollectionItem={onSelectCollectionItem}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{/* Scroll-only settings. */}\n\t\t\t{commonEffectTrigger !== EffectTrigger.OnMount && (\n\t\t\t\t<>\n\t\t\t\t\t{commonEffectTrigger === EffectTrigger.OnScrollTarget ? (\n\t\t\t\t\t\t<EffectViewportRow threshold={styleAppearEffectThreshold} onSelect={onSelectThreshold} />\n\t\t\t\t\t) : (\n\t\t\t\t\t\tcommonEffectTrigger !== EffectTrigger.OnScrollDirection && (\n\t\t\t\t\t\t\t<EffectStartRow threshold={styleAppearEffectThreshold} onSelect={onSelectThreshold} />\n\t\t\t\t\t\t)\n\t\t\t\t\t)}\n\n\t\t\t\t\t<PanelRow title=\"Replay\">\n\t\t\t\t\t\t<SegmentedControl\n\t\t\t\t\t\t\tenabled={!isMixed(styleAppearEffectAnimateOnce)}\n\t\t\t\t\t\t\tstyle={doubleColumn}\n\t\t\t\t\t\t\tonMouseDown={stopPropagation} // We block propagation to block action cards from becoming focused\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tkey=\"yes\"\n\t\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\t\tselected={styleAppearEffectAnimateOnce === false}\n\t\t\t\t\t\t\t\tonSelect={animateOnceHandler}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tkey=\"no\"\n\t\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\t\tselected={styleAppearEffectAnimateOnce === true}\n\t\t\t\t\t\t\t\tonSelect={animateOnceHandler}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</>\n\t\t\t)}\n\n\t\t\t<EffectPresetRow\n\t\t\t\tenterEffect={enterEffect}\n\t\t\t\tenterEffectEnabled={enterEffectEnabled}\n\t\t\t\texitEffectEnabled={exitEffectEnabled}\n\t\t\t\tstyleAppearEffectLocked={styleAppearEffectLocked}\n\t\t\t\tisEnterExitEffect={commonEffectTrigger !== EffectTrigger.OnScrollDirection}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tvisiblePresets={onlyNodesWithFloatingPosition ? floatingPositionPresets : undefined}\n\t\t\t/>\n\n\t\t\t<PanelRow title={commonEffectTrigger !== EffectTrigger.OnScrollDirection ? \"Enter\" : \"To\"}>\n\t\t\t\t{canLockEffects && (\n\t\t\t\t\t<Padlock locked={!!effectsLocked} onClick={toggleLock} inline={false} title={Dictionary.Effects} />\n\t\t\t\t)}\n\n\t\t\t\t{enterEffectEnabled ? (\n\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\tid=\"styleEffectEnter\"\n\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t<EffectPopout\n\t\t\t\t\t\t\t\t{...enterEffect}\n\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\ttype={EffectPreviewType.Enter}\n\t\t\t\t\t\t\t\tshowStagger={showStagger}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnavigationTitle={\n\t\t\t\t\t\t\teffectsLocked && supportsExitEffect\n\t\t\t\t\t\t\t\t? \"Enter & Exit\"\n\t\t\t\t\t\t\t\t: commonEffectTrigger !== EffectTrigger.OnScrollDirection\n\t\t\t\t\t\t\t\t\t? \"Enter Effect\"\n\t\t\t\t\t\t\t\t\t: \"Effect\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\t\tonPresent={setEnterEffectPreview}\n\t\t\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\t\t\tonDelete={() => toggleEnterEffect(false)}\n\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"effect\" onClick={() => toggleEnterEffect(true)} />\n\t\t\t\t)}\n\t\t\t</PanelRow>\n\t\t\t{supportsExitEffect && (\n\t\t\t\t<PanelRow title=\"Exit\">\n\t\t\t\t\t{exitEffectEnabled ? (\n\t\t\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\t\t\tid=\"styleEffectExit\"\n\t\t\t\t\t\t\tpopout={\n\t\t\t\t\t\t\t\t<EffectPopout\n\t\t\t\t\t\t\t\t\t{...exitEffect}\n\t\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\t\ttype={effectsLocked ? EffectPreviewType.Enter : EffectPreviewType.Exit}\n\t\t\t\t\t\t\t\t\tshowStagger={showStagger}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnavigationTitle={effectsLocked ? \"Enter & Exit\" : \"Exit Effect\"}\n\t\t\t\t\t\t\tdisplayDivider\n\t\t\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\t\t\tonPresent={effectsLocked ? setEnterEffectPreview : setExitEffectPreview}\n\t\t\t\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\t\t\t\tonDelete={() => toggleExitEffect(false)}\n\t\t\t\t\t\t\tpreview={\n\t\t\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\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\t<PopoutButtonWithPreviewSuggestion type=\"effect\" onClick={() => toggleExitEffect(true)} />\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\ninterface Props extends ReducedStyleAppearEffect {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\tonlyNodesWithFloatingPosition: boolean\n\tonlyNodesInAnOverlay: boolean\n\tonlyRepeatedNodes: boolean\n}\n\nexport const styleAppearEffectPopoutId = \"styleAppearEffect\"\nexport const StyleAppearEffectRow = React.memo(function StyleAppearEffectRow({\n\tnodeIds,\n\tonlyNodesWithStyleAppearEffect,\n\tonlyNodesInAnOverlay,\n\tstyleAppearEffectEnabled,\n\tonlyRepeatedNodes,\n\t...effect\n}: Props) {\n\tconst commonEffectTrigger = commonValue(effect.styleAppearEffectTrigger)\n\tconst navigationTitle = commonEffectTrigger === EffectTrigger.OnMount ? \"Appear Effect\" : \"Scroll Animation\"\n\tconst buttonTitle = commonEffectTrigger === EffectTrigger.OnMount ? \"Effect\" : \"Animation\"\n\tconst onDelete = useRemoveEffect(EffectType.Appear, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Appear, { styleAppearEffectEnabled: true })\n\n\tconst hasStyleAppearEffectRow = onlyNodesWithStyleAppearEffect && styleAppearEffectEnabled === true\n\tif (!onlyNodesInAnOverlay && !hasStyleAppearEffectRow) return null\n\n\tconst supportsExitEffect =\n\t\t(onlyNodesInAnOverlay || commonEffectTrigger !== EffectTrigger.OnMount) &&\n\t\tcommonEffectTrigger !== EffectTrigger.OnScrollDirection\n\n\tconst addEffect = () => {\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(styleAppearEffectPopoutId)\n\t\tenableEffect(EffectType.Appear, nodeIds, {\n\t\t\tstyleAppearEffectTrigger: EffectTrigger.OnMount,\n\t\t})\n\t}\n\n\treturn (\n\t\t<EffectRow type={EffectType.Appear} title=\"Scroll\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t{hasStyleAppearEffectRow ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={styleAppearEffectPopoutId}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<StyleAppearEffectPopout\n\t\t\t\t\t\t\t{...effect}\n\t\t\t\t\t\t\tsupportsExitEffect={supportsExitEffect}\n\t\t\t\t\t\t\tenterEffect={getReducedEnterStyleEffect(effect)}\n\t\t\t\t\t\t\texitEffect={getReducedExitStyleEffect(effect)}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\tonlyRepeatedNodes={onlyRepeatedNodes}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tnavigationTitle={navigationTitle}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\ttitle={buttonTitle}\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"effect\" onClick={addEffect} />\n\t\t\t)}\n\t\t</EffectRow>\n\t)\n})\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { WithStyleAppearEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { effectPresets, withStyleAppearPageEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedStyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { hash } from \"library/utils/string.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nconst presetKeys = Object.keys(effectPresets)\n// To optimize the work done on each react render the key/values of each preset\n// are hashed. Then when the React component that displays the active preset is\n// rendered, we hash the incoming props in the same order. If that hash exists\n// in this object, we can show that preset as the active preset. This avoids the\n// iterations that would otherwise be required to check every value of every\n// preset against the current props.\nconst hashes = {}\nfor (const key in effectPresets) {\n\tconst presetHash = hash(JSON.stringify(effectPresets[key]()))\n\thashes[presetHash] = key\n}\n\ntype PresetKey = keyof typeof effectPresets\n\nconst toEffectPresetTitleOverrides: Partial<Record<PresetKey, string>> = {\n\tfadeIn: \"Fade Out\",\n\tscaleIn: \"Scale Out\",\n\tscaleInBottom: \"Scale Out Bottom\",\n\tslideInBottom: \"Slide Out Bottom\",\n\tslideInLeft: \"Slide Out Left\",\n\tslideInRight: \"Slide Out Right\",\n\tslideInTop: \"Slide Out Top\",\n}\n\nfunction presetTitle(presetKey: PresetKey, isEnterExitEffect: boolean = true): string {\n\tconst override = !isEnterExitEffect ? toEffectPresetTitleOverrides[presetKey] : undefined\n\tif (override) return override\n\treturn titleCase(presetKey)\n}\n\ninterface Props {\n\tnodeIds: NodeID[]\n\tenterEffect: ReducedStyleEffect\n\t/**\n\t * Presets for effects that are controlled with enter/animate/exit styles\n\t * have different titles than effects that animate to some styles. This\n\t * controls how the preset titles reflect that difference. Effects that\n\t * animate to some styles will have presets like \"Fade Out\", whereas effects\n\t * that animate *from* styles will be \"Fade In\".\n\t */\n\tisEnterExitEffect?: boolean\n\tstyleAppearEffectLocked: Reduced<boolean | undefined>\n\tenterEffectEnabled: Reduced<boolean | undefined>\n\texitEffectEnabled: Reduced<boolean | undefined>\n\tvisiblePresets?: Set<PresetKey>\n}\n\nconst setEffect = engine.scheduler.wrapHandler((nodeIds: NodeID[], preset: PresetKey) => {\n\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\tconst update: Partial<WithStyleAppearEffect> = { ...effectPresets[preset](), styleAppearEffectLocked: true }\n\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleAppearPageEffect)\n\tnodes.forEach(node => node.set(update))\n})\n\n/** Exported for testing. */\nexport const createPresetHash = ({\n\tenterEffect,\n\tenterEffectEnabled,\n\texitEffectEnabled,\n\tstyleAppearEffectLocked,\n}: Omit<Props, \"nodeIds\" | \"isEnterExitEffect\">): string | null => {\n\tconst presetHash = hash(\n\t\tJSON.stringify({\n\t\t\tstyleAppearEffectLocked,\n\t\t\texitEffectEnabled,\n\t\t\tenterEffectEnabled,\n\t\t\tenterEffectX: enterEffect.x,\n\t\t\tenterEffectY: enterEffect.y,\n\t\t\tenterEffectOpacity: enterEffect.opacity,\n\t\t\tenterEffectRotate3d: enterEffect.rotate3d,\n\t\t\tenterEffectRotate: enterEffect.rotate,\n\t\t\tenterEffectRotateAdditiveDynamicValue: undefined,\n\t\t\tenterEffectRotateX: enterEffect.rotateX,\n\t\t\tenterEffectRotateY: enterEffect.rotateY,\n\t\t\tenterEffectScale: enterEffect.scale,\n\t\t\tenterEffectSkewX: enterEffect.skewX,\n\t\t\tenterEffectSkewY: enterEffect.skewY,\n\t\t\tenterEffectTransition: enterEffect.transition,\n\t\t}),\n\t)\n\n\treturn hashes[presetHash] ?? null\n}\n\nexport function EffectPresetRow({\n\tnodeIds,\n\tisEnterExitEffect,\n\tenterEffect,\n\tenterEffectEnabled,\n\texitEffectEnabled,\n\tstyleAppearEffectLocked,\n\tvisiblePresets,\n}: Props) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Object.values ensures it's exhaustive\n\tconst preset = React.useMemo<string | null>(\n\t\t() =>\n\t\t\tcreatePresetHash({\n\t\t\t\tenterEffect,\n\t\t\t\tenterEffectEnabled,\n\t\t\t\texitEffectEnabled,\n\t\t\t\tstyleAppearEffectLocked,\n\t\t\t}),\n\t\t[...Object.values(enterEffect), enterEffectEnabled, exitEffectEnabled, styleAppearEffectLocked],\n\t)\n\n\treturn (\n\t\t<PanelRow title=\"Preset\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t{presetKeys.map((option: PresetKey) => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\ttitle={presetTitle(option, isEnterExitEffect)}\n\t\t\t\t\t\t\tselected={preset === option}\n\t\t\t\t\t\t\tonSelect={() => setEffect(nodeIds, option)}\n\t\t\t\t\t\t\tvisible={visiblePresets ? visiblePresets.has(option) : true}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t\t<PopupButtonItem type=\"divider\" visible={isNull(preset)} />\n\t\t\t\t\t<PopupButtonItem title=\"Custom\" selected visible={isNull(preset)} />\n\t\t\t\t</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { doubleColumn } from \"../../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\n\nexport function EffectDirectionRow({\n\tdirection,\n\tonSelect,\n}: {\n\tdirection: Reduced<\"down\" | \"up\" | undefined>\n\tonSelect: (direction: \"down\" | \"up\") => void\n}) {\n\treturn (\n\t\t<PanelRow title=\"Direction\">\n\t\t\t<SegmentedControl enabled={!isMixed(direction)} style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem identifier=\"down\" title=\"Down\" selected={direction === \"down\"} onSelect={onSelect} />\n\t\t\t\t<SegmentedControlItem identifier=\"up\" title=\"Up\" selected={direction === \"up\"} onSelect={onSelect} />\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n", "import {\n\tIconAlignBottom,\n\tIconAlignMiddle,\n\tIconAlignTop,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { doubleColumn } from \"../../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\nimport { stopPropagation } from \"../../utils/stopPropagation.ts\"\n\nexport function EffectStartRow({\n\tthreshold,\n\tonSelect,\n}: {\n\tonSelect: (value: number) => void\n\tthreshold: Reduced<number | undefined>\n}) {\n\treturn (\n\t\t<PanelRow title=\"Start\">\n\t\t\t<SegmentedControl style={doubleColumn} onMouseDown={stopPropagation}>\n\t\t\t\t<SegmentedControlItem key=\"top\" identifier={0} title=\"Top\" selected={threshold === 0} onSelect={onSelect}>\n\t\t\t\t\t<IconAlignTop />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tkey=\"center\"\n\t\t\t\t\tidentifier={0.5}\n\t\t\t\t\ttitle=\"Center\"\n\t\t\t\t\tselected={threshold === 0.5}\n\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t>\n\t\t\t\t\t<IconAlignMiddle />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem key=\"bottom\" identifier={1} title=\"Bottom\" selected={threshold === 1} onSelect={onSelect}>\n\t\t\t\t\t<IconAlignBottom />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport { doubleColumn } from \"../../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\nimport { stopPropagation } from \"../../utils/stopPropagation.ts\"\n\ninterface Props {\n\ttriggers: Set<EffectTrigger | undefined>\n\tsupportedTriggers?: Set<EffectTrigger>\n\tenabledTriggers?: Set<EffectTrigger>\n\tonSelectTrigger: (trigger: EffectTrigger) => void\n}\n\nconst titles: Record<EffectTrigger, string> = {\n\t[EffectTrigger.OnMount]: \"On Appear\",\n\t[EffectTrigger.OnScroll]: \"On Scroll\",\n\t[EffectTrigger.OnScrollDirection]: \"On Scroll\",\n\t[EffectTrigger.OnInView]: \"Layer in View\",\n\t[EffectTrigger.OnScrollTarget]: \"Section in View\",\n}\n\nconst options: (EffectTrigger | \"divider\")[] = [\n\tEffectTrigger.OnMount,\n\tEffectTrigger.OnScroll,\n\tEffectTrigger.OnScrollDirection,\n\t\"divider\",\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnScrollTarget,\n]\n\nfunction visible(supportedTriggers: Set<EffectTrigger> | undefined, option: EffectTrigger) {\n\tif (option === EffectTrigger.OnScrollDirection) {\n\t\treturn supportedTriggers?.has(option)\n\t}\n\n\treturn supportedTriggers?.has(option) ?? true\n}\n\nexport function EffectTriggerRow({ triggers, supportedTriggers, enabledTriggers, onSelectTrigger }: Props) {\n\treturn (\n\t\t<PanelRow title=\"Trigger\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButton\n\t\t\t\t\tonMouseDown={stopPropagation} // We block propagation to block action cards from becoming focused\n\t\t\t\t>\n\t\t\t\t\t{options.map(option => {\n\t\t\t\t\t\tif (option === \"divider\") return <PopupButtonItem type=\"divider\" key={option} />\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={titles[option]}\n\t\t\t\t\t\t\t\tselected={triggers.has(option)}\n\t\t\t\t\t\t\t\tonSelect={onSelectTrigger}\n\t\t\t\t\t\t\t\tvisible={visible(supportedTriggers, option)}\n\t\t\t\t\t\t\t\tenabled={enabledTriggers ? enabledTriggers.has(option) : undefined}\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</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import {\n\tIconViewportBottom,\n\tIconViewportMiddle,\n\tIconViewportTop,\n\tSegmentedControl,\n\tSegmentedControlItem,\n} from \"@framerjs/fresco\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { doubleColumn } from \"../../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../../PanelRow.tsx\"\nimport { stopPropagation } from \"../../utils/stopPropagation.ts\"\n\nexport function EffectViewportRow({\n\tthreshold,\n\tonSelect,\n}: {\n\tthreshold: Reduced<number | undefined>\n\tonSelect: (value: number) => void\n}) {\n\treturn (\n\t\t<PanelRow title=\"Viewport\">\n\t\t\t<SegmentedControl style={doubleColumn} onMouseDown={stopPropagation}>\n\t\t\t\t<SegmentedControlItem key=\"top\" identifier={0} title=\"Top\" selected={threshold === 0} onSelect={onSelect}>\n\t\t\t\t\t<IconViewportTop />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tkey=\"center\"\n\t\t\t\t\tidentifier={0.5}\n\t\t\t\t\ttitle=\"Center\"\n\t\t\t\t\tselected={threshold === 0.5}\n\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t>\n\t\t\t\t\t<IconViewportMiddle />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem key=\"bottom\" identifier={1} title=\"Bottom\" selected={threshold === 1} onSelect={onSelect}>\n\t\t\t\t\t<IconViewportBottom />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n}\n", "import type { VariableReference } from \"@framerjs/document-migrations/src/types/V75.ts\"\nimport { Button, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tEffectStyleScrollTarget,\n\tStyleTransformEffectTrigger,\n\tWithStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport { defaultEffect, withStyleTransformEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport type { WithTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport type { ReducedStyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type {\n\tReducedEffectStyleScrollTarget,\n\tReducedStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/utils/reduceStyleTransformEffect.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isArray, isNull, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { TransitionPopoutButton } from \"../../../shared/TransitionEditor/TransitionPopout.tsx\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport * as styles from \"./VariantAppearEffectRow.styles.ts\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectScrollTargetRows } from \"./shared/EffectScrollTargetRow.tsx\"\nimport { EffectStylePopout } from \"./shared/EffectStylePopout.tsx\"\nimport { EffectTriggerRow } from \"./shared/EffectTriggerRow.tsx\"\nimport { EffectViewportRow } from \"./shared/EffectViewportRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\nconst hideTransitionTypeControl: Transition[\"type\"][] = []\ninterface TransformEffectProps extends ReducedStyleTransformEffect {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n}\n\nfunction useEffectUpdate<T extends WithStyleTransformEffect, K extends keyof T>(key: K, nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]>) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t\t})\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nconst supportedTransformEffectTriggers = new Set<EffectTrigger>([\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnScroll,\n\tEffectTrigger.OnInView,\n])\n\nfunction isSupportedTrigger(trigger: EffectTrigger): trigger is StyleTransformEffectTrigger {\n\treturn supportedTransformEffectTriggers.has(trigger)\n}\n\nfunction useEffectTriggerUpdate(nodeIds: NodeID[]) {\n\treturn useEngineCallback(\n\t\t(value: EffectTrigger) => {\n\t\t\tif (!isSupportedTrigger(value)) return\n\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithStyleTransformEffect> = { styleTransformEffectTrigger: value }\n\t\t\t\tif (value === EffectTrigger.OnScrollTarget) update.styleTransformEffectViewportThreshold = 1\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\n// This is called both after an event handler *and* when react unmounts the\n// component. Which is why we can't use engine.scheduler.wrapHandler, but use\n// engine.processWhenReady here, otherwise the engine will be updated during its\n// rendering phase which is not allowed.\nconst exitEffectPreview = () => engine.scheduler.processWhenReady(engine.stores.effectStore.exitPreview)\n\nconst setEffectPreview = engine.scheduler.wrapHandler((ids: Record<NodeID, NodeID>) => {\n\tengine.stores.effectStore.enterPreview({\n\t\teffect: EffectPreviewType.Target,\n\t\teffectIds: Object.values(ids),\n\t})\n})\n\nconst maxSections = 6\nconst maxRows = 3 + maxSections * 2\nconst maxHeight = `calc((${dimensions.css.inputHeight} + ${dimensions.css.inputSpacing}) * ${maxRows} + ${dimensions.css.panelPadding} * 2)`\n\nfunction StyleTransformEffectPopout(\n\tprops: Omit<TransformEffectProps, \"onlyNodesWithStyleTransformEffect\" | \"styleTransformEffectEnabled\">,\n) {\n\tconst {\n\t\tnodeIds,\n\t\tscopeId,\n\t\tscopeType,\n\t\tstyleTransformEffectViewportThreshold,\n\t\tstyleTransformEffectTransition,\n\t\tstyleTransformEffectTrigger,\n\t\tstyleTransformEffectScrollTargets,\n\t\tstyleTransformEffectTransitionEnabled,\n\t\tstyleTransformEffectScrollTargetCount,\n\t} = props\n\tconst onSelectViewportThreshold = useEffectUpdate(\"styleTransformEffectViewportThreshold\", nodeIds)\n\tconst onChangeTransition = useEffectUpdate(\"styleTransformEffectTransition\", nodeIds)\n\tconst onToggleSpring = useEffectUpdate(\"styleTransformEffectTransitionEnabled\", nodeIds)\n\tconst onSelectTrigger = useEffectTriggerUpdate(nodeIds)\n\n\tconst commonTrigger = commonValue(styleTransformEffectTrigger)\n\n\tconst ref = React.useRef<HTMLDivElement>(null)\n\n\t// Ensure that the effect preview is disabled if the entire popover is\n\t// unmounted without navigating away from the Effect Popout. This can happen\n\t// if the selection changes.\n\tReact.useEffect(() => exitEffectPreview, [])\n\n\tconst [fromEffect, toEffect, ...effectScrollTargets] = styleTransformEffectScrollTargets ?? []\n\tconst lastTargetCountRef = React.useRef(effectScrollTargets.length)\n\n\t// If a target is added, scroll to the bottom of the list of targets.\n\tReact.useEffect(() => {\n\t\tif (lastTargetCountRef.current < effectScrollTargets.length) ref.current?.scrollIntoView()\n\t\tlastTargetCountRef.current = effectScrollTargets.length\n\t}, [effectScrollTargets.length])\n\n\tconst onAddScrollSection = engine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\tnodes.forEach(node => {\n\t\t\tif (\n\t\t\t\tisUndefined(node.styleTransformEffectScrollTargets) ||\n\t\t\t\t(isArray(node.styleTransformEffectScrollTargets) && node.styleTransformEffectScrollTargets.length === 0)\n\t\t\t) {\n\t\t\t\tnode.set({\n\t\t\t\t\tstyleTransformEffectScrollTargets: [defaultEffect({ opacity: 0.5, scale: 0.5 }), defaultEffect()],\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Effects chain from the last effect, so copy the style for easy\n\t\t\t// sequencing.\n\t\t\tconst { style } = node.styleTransformEffectScrollTargets[node.styleTransformEffectScrollTargets.length - 1] ?? {}\n\t\t\tconst update: Partial<WithStyleTransformEffect> = {\n\t\t\t\tstyleTransformEffectScrollTargets: [...node.styleTransformEffectScrollTargets, defaultEffect(style)],\n\t\t\t}\n\t\t\tnode.set(update)\n\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t})\n\t})\n\n\tconst onDelete = engine.scheduler.wrapHandler((ids: Record<NodeID, NodeID>) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\tnodes.forEach(node => {\n\t\t\tconst update: Partial<WithStyleTransformEffect> = {\n\t\t\t\tstyleTransformEffectScrollTargets: removeTarget(node, ids[node.id]),\n\t\t\t}\n\t\t\tnode.set(update)\n\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t})\n\t})\n\n\tif (!fromEffect || !toEffect) return null\n\n\treturn (\n\t\t<div style={{ maxHeight }} className={styles.scroll}>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t>\n\t\t\t\t<EffectTriggerRow\n\t\t\t\t\tonSelectTrigger={onSelectTrigger}\n\t\t\t\t\ttriggers={styleTransformEffectTrigger}\n\t\t\t\t\tsupportedTriggers={supportedTransformEffectTriggers}\n\t\t\t\t/>\n\n\t\t\t\t{commonTrigger === EffectTrigger.OnScrollTarget && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EffectViewportRow threshold={styleTransformEffectViewportThreshold} onSelect={onSelectViewportThreshold} />\n\t\t\t\t\t\t<ScrollTargetRow {...toEffect} scopeId={scopeId} scopeType={scopeType} nodeIds={nodeIds} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\n\t\t\t\t<StyleEffectRow {...fromEffect} nodeIds={nodeIds} title=\"From\" />\n\n\t\t\t\t<StyleEffectRow {...toEffect} nodeIds={nodeIds} title=\"To\" />\n\n\t\t\t\t<PanelRow title={Dictionary.Transition}>\n\t\t\t\t\t{styleTransformEffectTransitionEnabled === true ? (\n\t\t\t\t\t\t<TransitionPopoutButton\n\t\t\t\t\t\t\ttitle={Dictionary.Transition}\n\t\t\t\t\t\t\ttransition={styleTransformEffectTransition}\n\t\t\t\t\t\t\tonChange={onChangeTransition}\n\t\t\t\t\t\t\tonDelete={() => onToggleSpring(false)}\n\t\t\t\t\t\t\tshowType={hideTransitionTypeControl}\n\t\t\t\t\t\t\tshowDelay={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"spring\" onClick={() => onToggleSpring(true)} />\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t</Stack>\n\n\t\t\t{commonTrigger === EffectTrigger.OnScrollTarget && (\n\t\t\t\t<>\n\t\t\t\t\t{isNumber(styleTransformEffectScrollTargetCount) &&\n\t\t\t\t\t\teffectScrollTargets.map((scrollTarget, index) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\t\t\t\t\tclassName={styles.dividerAbove}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Stack gap={0} paddingLeft={dimensions.css.panelPadding} paddingRight={dimensions.css.panelPadding}>\n\t\t\t\t\t\t\t\t\t\t<ScrollTargetRow\n\t\t\t\t\t\t\t\t\t\t\t{...scrollTarget}\n\t\t\t\t\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\t\t\t\t\tonRemove={onDelete}\n\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t<StyleEffectRow {...scrollTarget} index={index} nodeIds={nodeIds} title=\"To\" onDelete={onDelete} />\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t{/* This div is always at the end of the scrollable region. This allows us to scroll to the bottom without having to do any measurements. */}\n\t\t\t\t\t<div ref={ref} />\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\tpaddingTop={dimensions.css.panelPadding}\n\t\t\t\t\t\tpaddingBottom={dimensions.css.panelPadding}\n\t\t\t\t\t\tclassName={cx(styles.buttonContainer, styles.dividerAbove)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack gap={0} paddingLeft={dimensions.css.panelPadding} paddingRight={dimensions.css.panelPadding}>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\ttitle=\"Add Section\"\n\t\t\t\t\t\t\t\tenabled={!isMixed(styleTransformEffectScrollTargetCount)}\n\t\t\t\t\t\t\t\tonMouseDown={onAddScrollSection}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Stack>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nexport const styleTransformEffectPopoutId = \"styleTransformEffect\"\nexport const StyleTransformEffectRow = React.memo(function StyleTransformEffectRow({\n\tnodeIds,\n\tonlyNodesWithStyleTransformEffect,\n\tstyleTransformEffectEnabled,\n\t...effect\n}: TransformEffectProps) {\n\tconst onDelete = useRemoveEffect(EffectType.StyleTransform, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.StyleTransform, { styleTransformEffectEnabled: true })\n\tif (!onlyNodesWithStyleTransformEffect || styleTransformEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.StyleTransform} title=\"Scroll\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={styleTransformEffectPopoutId}\n\t\t\t\tpopout={<StyleTransformEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Scroll Transform\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle={Dictionary.Transform}\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n\nfunction getTarget(\n\tnode: CanvasNode & WithStyleTransformEffect,\n\teffectId?: NodeID,\n): Readonly<[number, EffectStyleScrollTarget]> {\n\tif (isUndefined(node.styleTransformEffectScrollTargets)) {\n\t\treturn [0, defaultEffect()]\n\t}\n\n\tconst idx = node.styleTransformEffectScrollTargets.findIndex(effectTarget => effectTarget.id === effectId)\n\n\tconst effect = node.styleTransformEffectScrollTargets[idx] ?? defaultEffect()\n\n\treturn [idx, effect]\n}\n\nfunction updateTarget(node: CanvasNode & WithStyleTransformEffect, effect: EffectStyleScrollTarget, idx?: number) {\n\tif (\n\t\tisUndefined(node.styleTransformEffectScrollTargets) ||\n\t\t(isArray(node.styleTransformEffectScrollTargets) && node.styleTransformEffectScrollTargets.length === 0)\n\t) {\n\t\treturn [effect]\n\t}\n\tconst update = [...node.styleTransformEffectScrollTargets]\n\tif (isUndefined(idx)) {\n\t\tupdate.push(effect)\n\t\treturn update\n\t}\n\n\tupdate.splice(idx, 1, effect)\n\n\treturn update\n}\n\nfunction removeTarget(node: CanvasNode & WithStyleTransformEffect, effectId: NodeID | undefined) {\n\tif (isUndefined(node.styleTransformEffectScrollTargets) || isUndefined(effectId)) return\n\n\treturn node.styleTransformEffectScrollTargets.filter(effect => effect.id !== effectId)\n}\n\nfunction ScrollTargetRow({\n\tnodeIds,\n\tids,\n\ttargets,\n\tcollectionItem,\n\tscopeId,\n\tscopeType,\n\tonRemove,\n}: Omit<ReducedEffectStyleScrollTarget, \"style\"> & {\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\tnodeIds: NodeID[]\n\tonRemove?: (effectIds: Record<NodeID, NodeID>) => void\n}) {\n\tconst onSelect = engine.scheduler.wrapHandler((value: NodeID | VariableReference) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\tnodes.forEach(node => {\n\t\t\tconst effectId = ids[node.id]\n\t\t\tconst [idx, effect] = getTarget(node, effectId)\n\t\t\tconst scrollTargetUpdate: EffectStyleScrollTarget = { ...effect, target: value }\n\n\t\t\tconst update: Partial<WithStyleTransformEffect> = {\n\t\t\t\tstyleTransformEffectScrollTargets: updateTarget(node, scrollTargetUpdate, idx),\n\t\t\t}\n\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t\tnode.set(update)\n\t\t})\n\t})\n\n\tconst onSelectCollectionItem = engine.scheduler.wrapHandler(\n\t\t(value: ResolvedCollectionItemSelector | VariableReference | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst effectId = ids[node.id]\n\t\t\t\tconst [idx, effect] = getTarget(node, effectId)\n\t\t\t\tconst scrollTargetUpdate: EffectStyleScrollTarget = { ...effect, collectionItem: value }\n\n\t\t\t\tconst update: Partial<WithStyleTransformEffect> = {\n\t\t\t\t\tstyleTransformEffectScrollTargets: updateTarget(node, scrollTargetUpdate, idx),\n\t\t\t\t}\n\t\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t\t\tnode.set(update)\n\t\t\t})\n\t\t},\n\t)\n\n\treturn (\n\t\t<EffectScrollTargetRows\n\t\t\ttargets={targets}\n\t\t\tscopeId={scopeId}\n\t\t\tscopeType={scopeType}\n\t\t\tcollectionItem={collectionItem}\n\t\t\tonSelect={onSelect}\n\t\t\tonSelectCollectionItem={onSelectCollectionItem}\n\t\t\tonRemove={onRemove ? () => onRemove(ids) : undefined}\n\t\t/>\n\t)\n}\n\n/**\n * Create an intermediate component that wraps the EffectStylePopout so that\n * rerenders to the popout while it is rendered cause the effect preview to be\n * updated.\n */\nfunction TransformEffectStylePopout({\n\tstyle,\n\tids,\n\tonChange,\n}: Omit<ReducedEffectStyleScrollTarget, \"targets\" | \"collectionItem\"> & {\n\tonChange: <T extends keyof ReducedStyleEffect>(key: T, value: ReducedStyleEffect[T]) => void\n}) {\n\t// If the active effect changes because the selection changes, ensure that\n\t// the preview updates.\n\tReact.useEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tsetEffectPreview(ids)\n\t\t})\n\t}, [ids])\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<EffectStylePopout {...style} onChange={onChange} transition={undefined} showTransition={false} />\n\t\t</Stack>\n\t)\n}\n\nfunction StyleEffectRow({\n\tnodeIds,\n\tids,\n\tstyle,\n\ttitle,\n\tindex,\n\tonDelete,\n}: ReducedEffectStyleScrollTarget & {\n\tnodeIds: NodeID[]\n\tindex?: number\n\ttitle: string\n\tonDelete?: (effectIds: Record<NodeID, NodeID>) => void\n}) {\n\tconst onChange = engine.scheduler.wrapHandler(\n\t\t<T extends keyof ReducedStyleEffect>(key: T, value: ReducedStyleEffect[T]) => {\n\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withStyleTransformEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst [idx, effect] = getTarget(node, ids[node.id])\n\t\t\t\tconst scrollTargetUpdate: EffectStyleScrollTarget = {\n\t\t\t\t\t...effect,\n\t\t\t\t\tstyle: { ...effect.style, [key]: value },\n\t\t\t\t}\n\t\t\t\tconst update: Partial<WithStyleTransformEffect & WithTransforms> = {\n\t\t\t\t\tstyleTransformEffectScrollTargets: updateTarget(node, scrollTargetUpdate, idx),\n\t\t\t\t}\n\t\t\t\ttrackEffectUpdate(EffectType.StyleTransform, update)\n\t\t\t\tnode.set(update)\n\t\t\t})\n\n\t\t\t// If the effect preview has been disabled by activating any tool,\n\t\t\t// restore the preview.\n\t\t\tif (isNull(engine.stores.effectStore.activeEffect)) setEffectPreview(ids)\n\t\t},\n\t)\n\n\t// Create a unique id for each style transform effect popout. This allows\n\t// you to change your selection to another node with a similar effect, and\n\t// continue editing the same effect. e.g. if you are editing the \"from\"\n\t// effect, you will maintain that selection.\n\tconst popoutButtonId = `styleEffect-${title}${index ?? \"\"}`\n\n\treturn (\n\t\t<PanelRow title={title} onDelete={onDelete ? () => onDelete(ids) : undefined}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={popoutButtonId}\n\t\t\t\tpopout={<TransformEffectStylePopout style={style} ids={ids} onChange={onChange} />}\n\t\t\t\tnavigationTitle={title}\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonPresent={() => setEffectPreview(ids)}\n\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</PanelRow>\n\t)\n}\n", "import \"VariantAppearEffectRow.styles_9n1bpn.wyw.css\"; export const dividerAbove = \"dividerAbove_dlti91u\";\nexport const scroll = \"scroll_s78c1jr\";\nexport const buttonContainer = \"buttonContainer_b1w0nluk\";", "import {\n\tNumberInputWithTickerAndStepper,\n\tPopupButton,\n\tPopupButtonItem,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport type { Mixed } from \"@framerjs/shared\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tTextEffectStyle,\n\tTextEffectTrigger,\n\tWithTextEffect,\n} from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { textEffectEnabledDefaults, withTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedStyleEffect, StyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { getReducedTextStyleEffect } from \"document/models/CanvasTree/traits/utils/StyleEffect.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport type { ReducedTextEffect } from \"document/models/CanvasTree/traits/utils/reduceTextEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { DescriptionRow } from \"../../codeComponentRows/DescriptionRow.tsx\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { TextEffectPresetRow } from \"./TextEffectPresetRow.tsx\"\nimport { TextEffectPreview } from \"./TextEffectPreview.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectScrollTargetRows } from \"./shared/EffectScrollTargetRow.tsx\"\nimport { EffectStartRow } from \"./shared/EffectStartRow.tsx\"\nimport { EffectStylePopout } from \"./shared/EffectStylePopout.tsx\"\nimport { EffectTriggerRow } from \"./shared/EffectTriggerRow.tsx\"\nimport { EffectViewportRow } from \"./shared/EffectViewportRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\ntype TextStyleEffect = Omit<StyleEffect, \"backgroundColor\" | \"transformPerspective\" | \"boxShadow\">\n\nconst textEffectKeys: Record<keyof TextStyleEffect, keyof TextEffectStyle> = {\n\tx: \"textEffectX\",\n\ty: \"textEffectY\",\n\tscale: \"textEffectScale\",\n\topacity: \"textEffectOpacity\",\n\trotate3d: \"textEffectRotate3d\",\n\trotate: \"textEffectRotate\",\n\trotateX: \"textEffectRotateX\",\n\trotateY: \"textEffectRotateY\",\n\tskewX: \"textEffectSkewX\",\n\tskewY: \"textEffectSkewY\",\n\tblur: \"textEffectBlur\",\n\ttransition: \"textEffectTransition\",\n}\n\nfunction isTextStyleEffectKey(key: keyof ReducedStyleEffect): key is keyof typeof textEffectKeys {\n\treturn key in textEffectKeys\n}\n\nconst useEffectChange = <K extends keyof ReducedStyleEffect>(nodeIds: string[]) => {\n\treturn useEngineCallback(\n\t\t(key: K, value: ReducedStyleEffect[K]) => {\n\t\t\tif (!isTextStyleEffectKey(key)) return\n\t\t\tconst nodeKey = textEffectKeys[key]\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTextEffect)) {\n\t\t\t\tconst update: Partial<WithTextEffect> = { [nodeKey]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Text, update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n}\n\nconst supportedEffectTriggers = new Set<EffectTrigger>([\n\tEffectTrigger.OnMount,\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnInView,\n])\n\nfunction ThresholdRow({\n\ttextEffectTrigger,\n\ttextEffectThreshold,\n\tnodeIds,\n}: Pick<ReducedTextEffect, \"textEffectThreshold\"> & {\n\tnodeIds: NodeID[]\n\ttextEffectTrigger: TextEffectTrigger | NotFound | Mixed | undefined\n}) {\n\tconst handleThreshold = useEngineCallback(\n\t\t(value: number) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withTextEffect)) {\n\t\t\t\tconst update: Partial<WithTextEffect> = { textEffectThreshold: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Text, update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tif (textEffectTrigger === EffectTrigger.OnMount) return null\n\tif (textEffectTrigger === EffectTrigger.OnScrollTarget) {\n\t\treturn <EffectViewportRow threshold={textEffectThreshold} onSelect={handleThreshold} />\n\t}\n\treturn <EffectStartRow threshold={textEffectThreshold} onSelect={handleThreshold} />\n}\n\nconst tokenizationOptions = [\"character\", \"word\", \"line\", \"element\"] as const\nfunction titleForTokenization(tokenization: (typeof tokenizationOptions)[number]) {\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\t\treturn \"Character\"\n\t\tcase \"word\":\n\t\t\treturn \"Word\"\n\t\tcase \"line\":\n\t\t\treturn \"Line\"\n\t\tcase \"element\":\n\t\t\treturn \"Element\"\n\t\tdefault:\n\t\t\treturn tokenization\n\t}\n}\n\nfunction useTextEffectUpdate<T extends keyof WithTextEffect>(ids: NodeID[], key: T) {\n\treturn useEngineCallback(\n\t\t(value: WithTextEffect[T]) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(ids, withTextEffect)) {\n\t\t\t\tconst update: Partial<WithTextEffect> = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Text, update)\n\t\t\t}\n\t\t},\n\t\t[ids, key],\n\t)\n}\n\nfunction isSupportedTrigger(trigger: EffectTrigger): trigger is TextEffectTrigger {\n\treturn supportedEffectTriggers.has(trigger)\n}\n\nconst TextEffectPopout = React.memo(function TextEffectPopout(\n\tprops: Omit<ReducedTextEffect, \"onlyNodesWithTextEffect\" | \"textEffectEnabled\"> & {\n\t\tnodeIds: NodeID[]\n\t\tscopeId: NodeID\n\t\tscopeType: ScopeType\n\t},\n) {\n\tconst {\n\t\ttextEffectType,\n\t\ttextEffectTrigger,\n\t\ttextEffectScrollTarget,\n\t\ttextEffectScrollTargetCollectionItem,\n\t\ttextEffectThreshold,\n\t\tscopeId,\n\t\tscopeType,\n\t\tnodeIds,\n\t\ttextEffectReplay,\n\t\ttextEffectDelay,\n\t\t...textEffect\n\t} = props\n\n\tconst { textEffectTokenization } = props\n\n\tconst handleSelectScrollTarget = useTextEffectUpdate(nodeIds, \"textEffectScrollTarget\")\n\tconst handleSelectCollectionItem = useTextEffectUpdate(nodeIds, \"textEffectScrollTargetCollectionItem\")\n\tconst handleSelectTokenization = useTextEffectUpdate(nodeIds, \"textEffectTokenization\")\n\tconst handleTrigger = useTextEffectUpdate(nodeIds, \"textEffectTrigger\")\n\tconst handleTextEffectTrigger = useEngineCallback(\n\t\t(value: EffectTrigger) => {\n\t\t\tif (!isSupportedTrigger(value)) return\n\t\t\thandleTrigger(value)\n\t\t},\n\t\t[handleTrigger],\n\t)\n\n\tconst handleReplay = useTextEffectUpdate(nodeIds, \"textEffectReplay\")\n\tconst handleDelay = useTextEffectUpdate(nodeIds, \"textEffectDelay\")\n\tconst onChange = useEffectChange(nodeIds)\n\n\tconst commonEffectTrigger = commonValue(textEffectTrigger)\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={0}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<TextEffectPreview\n\t\t\t\ttextEffectType={props.textEffectType}\n\t\t\t\ttextEffectBlur={props.textEffectBlur}\n\t\t\t\ttextEffectOpacity={props.textEffectOpacity}\n\t\t\t\ttextEffectTokenization={props.textEffectTokenization}\n\t\t\t\ttextEffectReplay={props.textEffectReplay}\n\t\t\t\ttextEffectRotate={props.textEffectRotate}\n\t\t\t\ttextEffectRotate3d={props.textEffectRotate3d}\n\t\t\t\ttextEffectRotateX={props.textEffectRotateX}\n\t\t\t\ttextEffectRotateY={props.textEffectRotateY}\n\t\t\t\ttextEffectScale={props.textEffectScale}\n\t\t\t\ttextEffectSkewX={props.textEffectSkewX}\n\t\t\t\ttextEffectSkewY={props.textEffectSkewY}\n\t\t\t\ttextEffectTransition={props.textEffectTransition}\n\t\t\t\ttextEffectX={props.textEffectX}\n\t\t\t\ttextEffectY={props.textEffectY}\n\t\t\t/>\n\t\t\t<EffectTriggerRow\n\t\t\t\tonSelectTrigger={handleTextEffectTrigger}\n\t\t\t\ttriggers={textEffectTrigger}\n\t\t\t\tsupportedTriggers={supportedEffectTriggers}\n\t\t\t/>\n\n\t\t\t{commonEffectTrigger === EffectTrigger.OnScrollTarget && (\n\t\t\t\t<EffectScrollTargetRows\n\t\t\t\t\ttargets={textEffectScrollTarget}\n\t\t\t\t\tcollectionItem={textEffectScrollTargetCollectionItem}\n\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\tonSelect={handleSelectScrollTarget}\n\t\t\t\t\tonSelectCollectionItem={handleSelectCollectionItem}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t<ThresholdRow\n\t\t\t\ttextEffectTrigger={commonEffectTrigger}\n\t\t\t\ttextEffectThreshold={textEffectThreshold}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\t\t\t{textEffectType === \"appear\" && commonEffectTrigger !== EffectTrigger.OnMount && (\n\t\t\t\t<PanelRow title=\"Replay\">\n\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle=\"Yes\"\n\t\t\t\t\t\t\tselected={textEffectReplay === true}\n\t\t\t\t\t\t\tonSelect={handleReplay}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle=\"No\"\n\t\t\t\t\t\t\tselected={textEffectReplay === false}\n\t\t\t\t\t\t\tonSelect={handleReplay}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\n\t\t\t<TextEffectPresetRow textEffect={textEffect} nodeIds={nodeIds} />\n\t\t\t<PanelRow title=\"Per\">\n\t\t\t\t<PopupButton wrapperStyle={doubleColumn}>\n\t\t\t\t\t{tokenizationOptions.map(option => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\t\ttitle={titleForTokenization(option)}\n\t\t\t\t\t\t\t\tselected={textEffectTokenization === option}\n\t\t\t\t\t\t\t\tonSelect={handleSelectTokenization}\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</PopupButton>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Enter\">\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid=\"styleEffectEnter\"\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\t\t\tpaddingTop={0}\n\t\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextEffectPreview\n\t\t\t\t\t\t\t\ttextEffectBlur={props.textEffectBlur}\n\t\t\t\t\t\t\t\ttextEffectOpacity={props.textEffectOpacity}\n\t\t\t\t\t\t\t\ttextEffectTokenization={props.textEffectTokenization}\n\t\t\t\t\t\t\t\ttextEffectReplay={props.textEffectReplay}\n\t\t\t\t\t\t\t\ttextEffectRotate={props.textEffectRotate}\n\t\t\t\t\t\t\t\ttextEffectRotate3d={props.textEffectRotate3d}\n\t\t\t\t\t\t\t\ttextEffectRotateX={props.textEffectRotateX}\n\t\t\t\t\t\t\t\ttextEffectRotateY={props.textEffectRotateY}\n\t\t\t\t\t\t\t\ttextEffectScale={props.textEffectScale}\n\t\t\t\t\t\t\t\ttextEffectSkewX={props.textEffectSkewX}\n\t\t\t\t\t\t\t\ttextEffectSkewY={props.textEffectSkewY}\n\t\t\t\t\t\t\t\ttextEffectTransition={props.textEffectTransition}\n\t\t\t\t\t\t\t\ttextEffectType={props.textEffectType}\n\t\t\t\t\t\t\t\ttextEffectX={props.textEffectX}\n\t\t\t\t\t\t\t\ttextEffectY={props.textEffectY}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EffectStylePopout {...getReducedTextStyleEffect(props)} showBlur onChange={onChange} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t}\n\t\t\t\t\tnavigationTitle=\"Effect\"\n\t\t\t\t\tdisplayDivider={false}\n\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t\t<PanelRow title=\"Delay\">\n\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\tvalue={notFoundToUndefined(textEffectDelay)}\n\t\t\t\t\tdefaultValue={textEffectEnabledDefaults.textEffectDelay}\n\t\t\t\t\tonChange={handleDelay}\n\t\t\t\t\tstep={0.1}\n\t\t\t\t\tmin={0}\n\t\t\t\t\tlabel=\"S\"\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n})\n\nexport const textEffectPopoutId = \"textEffect\"\nexport const TextEffectRow = React.memo(function TextEffectRow({\n\tnodeIds,\n\tonlyNodesWithTextEffect,\n\tanyNodesWithTextFit,\n\tanyNodesWithGradientFill,\n\tanyNodesWithRelativeDates,\n\ttextEffectEnabled,\n\t...effect\n}: ReducedTextEffect & {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\tanyNodesWithTextFit: boolean | undefined\n\tanyNodesWithGradientFill: boolean | undefined\n\tanyNodesWithRelativeDates: boolean | undefined\n}) {\n\tconst onDelete = useRemoveEffect(EffectType.Text, nodeIds)\n\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Text, { textEffectEnabled: true })\n\tif (!onlyNodesWithTextEffect || textEffectEnabled !== true) return null\n\n\tconst disabledDescription = anyNodesWithTextFit\n\t\t? \"Text Effects do not work with Fit Text\"\n\t\t: anyNodesWithGradientFill\n\t\t\t? \"Text Effects do not work with Gradients\"\n\t\t\t: anyNodesWithRelativeDates\n\t\t\t\t? \"Text Effects do not work with Relative Dates\"\n\t\t\t\t: null\n\n\treturn (\n\t\t<>\n\t\t\t<EffectRow type={EffectType.Text} title=\"Text\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={textEffectPopoutId}\n\t\t\t\t\tenabled={isNull(disabledDescription)}\n\t\t\t\t\tpopout={<TextEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\t\tnavigationTitle=\"Text Effect\"\n\t\t\t\t\tdisplayDivider={false}\n\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\tonDelete={onDelete}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</EffectRow>\n\t\t\t{disabledDescription && <DescriptionRow description={disabledDescription} />}\n\t\t</>\n\t)\n})\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { TextEffectStyle, WithTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { textEffectPresets, withTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport type { ReducedTextEffect } from \"document/models/CanvasTree/traits/utils/reduceTextEffect.ts\"\nimport { hash } from \"library/utils/string.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\n\nconst presetKeys = Object.keys(textEffectPresets)\n\nconst hashes: Record<string, string> = {}\nfor (const key in textEffectPresets) {\n\tconst presetHash = hash(JSON.stringify(textEffectPresets[key as PresetKey]()))\n\thashes[presetHash] = key\n}\n\ntype PresetKey = keyof typeof textEffectPresets\n\ninterface Props {\n\tnodeIds: NodeID[]\n\ttextEffect: Pick<ReducedTextEffect, keyof TextEffectStyle | \"textEffectTokenization\">\n}\n\nconst setEffect = engine.scheduler.wrapHandler((nodeIds: NodeID[], preset: PresetKey) => {\n\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\tconst update: Partial<WithTextEffect> = textEffectPresets[preset]()\n\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTextEffect)\n\tnodes.forEach(node => node.set(update))\n})\n\nconst createPresetHash = (textEffect: Props[\"textEffect\"]): string | null => {\n\tconst presetHash = hash(\n\t\tJSON.stringify({\n\t\t\ttextEffectTokenization: textEffect.textEffectTokenization,\n\t\t\ttextEffectOpacity: textEffect.textEffectOpacity,\n\t\t\ttextEffectX: textEffect.textEffectX,\n\t\t\ttextEffectY: textEffect.textEffectY,\n\t\t\ttextEffectScale: textEffect.textEffectScale,\n\t\t\ttextEffectRotate3d: textEffect.textEffectRotate3d,\n\t\t\ttextEffectRotate: textEffect.textEffectRotate,\n\t\t\ttextEffectRotateX: textEffect.textEffectRotateX,\n\t\t\ttextEffectRotateY: textEffect.textEffectRotateY,\n\t\t\ttextEffectSkewX: textEffect.textEffectSkewX,\n\t\t\ttextEffectSkewY: textEffect.textEffectSkewY,\n\t\t\ttextEffectBlur: textEffect.textEffectBlur,\n\t\t\ttextEffectTransition: textEffect.textEffectTransition,\n\t\t}),\n\t)\n\n\treturn hashes[presetHash] ?? null\n}\n\n/**\n * Copies the approach taken in EffectPresetRow.tsx with unique effects for\n * text.\n */\nexport function TextEffectPresetRow({ nodeIds, textEffect }: Props) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: Object.values ensures it's exhaustive\n\tconst preset = React.useMemo<string | null>(() => createPresetHash(textEffect), [...Object.values(textEffect)])\n\n\treturn (\n\t\t<PanelRow title=\"Preset\">\n\t\t\t<div style={doubleColumn}>\n\t\t\t\t<PopupButton>\n\t\t\t\t\t{presetKeys.map((option: PresetKey) => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={option}\n\t\t\t\t\t\t\tidentifier={option}\n\t\t\t\t\t\t\ttitle={titleCase(option)}\n\t\t\t\t\t\t\tselected={preset === option}\n\t\t\t\t\t\t\tonSelect={() => setEffect(nodeIds, option)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t\t<PopupButtonItem type=\"divider\" visible={isNull(preset)} />\n\t\t\t\t\t<PopupButtonItem title=\"Custom\" selected visible={isNull(preset)} />\n\t\t\t\t</PopupButton>\n\t\t\t</div>\n\t\t</PanelRow>\n\t)\n}\n", "import type { Mixed } from \"@framerjs/shared\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { WithTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { fallbackTextEffectTransition } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { NotFound, Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { getCommonEffectTransitionOrUndefined } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedTextEffect } from \"document/models/CanvasTree/traits/utils/reduceTextEffect.ts\"\nimport { toMotionTransition } from \"document/models/Transition.ts\"\nimport type { Spring, Tween } from \"framer-motion\"\nimport type { TextEffect } from \"library/render/presentation/useTextEffect.tsx\"\nimport { useTextEffect } from \"library/render/presentation/useTextEffect.tsx\"\nimport React from \"react\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport * as styles from \"./TextEffectPreview.styles.ts\"\n\nconst multiLine = [\"Hello\", \"World\"]\nconst multiWord = [\"Hello World\"]\nconst singleLine = [\"Hello\"]\n\nfunction textForTokenization(tokenization: \"character\" | \"word\" | \"line\" | \"element\") {\n\tswitch (tokenization) {\n\t\tcase \"character\":\n\t\t\treturn singleLine\n\t\tcase \"word\":\n\t\t\treturn multiWord\n\t\tcase \"line\":\n\t\tcase \"element\":\n\t\t\treturn multiLine\n\t\tdefault:\n\t\t\tassertNever(tokenization)\n\t}\n}\n\nfunction sampleTextForType(\n\ttype: Reduced<\"appear\" | undefined>,\n\ttokenization: Reduced<\"character\" | \"word\" | \"line\" | \"element\" | undefined>,\n) {\n\tif (\n\t\tisMixed(type) ||\n\t\tisMixed(tokenization) ||\n\t\tisNotFound(type) ||\n\t\tisNotFound(tokenization) ||\n\t\tisUndefined(type) ||\n\t\tisUndefined(tokenization)\n\t) {\n\t\treturn singleLine\n\t}\n\n\tswitch (type) {\n\t\tcase \"appear\":\n\t\t\treturn textForTokenization(tokenization)\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nconst previewKeys = {\n\ttextEffectBlur: true,\n\ttextEffectOpacity: true,\n\ttextEffectTokenization: true,\n\ttextEffectReplay: true,\n\ttextEffectRotate: true,\n\ttextEffectRotate3d: true,\n\ttextEffectRotateX: true,\n\ttextEffectRotateY: true,\n\ttextEffectScale: true,\n\ttextEffectSkewX: true,\n\ttextEffectSkewY: true,\n\ttextEffectTransition: true,\n\ttextEffectType: true,\n\ttextEffectX: true,\n\ttextEffectY: true,\n} satisfies Partial<Record<keyof WithTextEffect, true>>\n\ntype Props = { [K in keyof typeof previewKeys]: ReducedTextEffect[K] }\n\nfunction isValidTextEffect<T extends Partial<Props>>(\n\tprops: T,\n): props is { [K in keyof T]: Exclude<T[K], NotFound | Mixed> } {\n\tfor (const key in previewKeys) {\n\t\tif (isMixed(props[key])) return false\n\t}\n\n\treturn true\n}\n\nfunction createEffect(effect: Props): TextEffect | undefined {\n\tif (!isValidTextEffect(effect) || !isString(effect.textEffectType)) return undefined\n\n\tswitch (effect.textEffectType) {\n\t\tcase \"appear\":\n\t\t\treturn {\n\t\t\t\ttype: \"appear\",\n\t\t\t\trepeat: true,\n\t\t\t\ttrigger: EffectTrigger.OnMount,\n\t\t\t\t// When changing between \"line\" and \"element\", the preview text\n\t\t\t\t// can show incorrect kerning when we split by characters. To\n\t\t\t\t// avoid this we always use \"element\" which doesn't split the\n\t\t\t\t// characters of the preview text.\n\t\t\t\ttokenization:\n\t\t\t\t\teffect.textEffectTokenization === \"line\" ? \"element\" : (effect.textEffectTokenization ?? \"character\"),\n\t\t\t\tstartDelay: 0,\n\t\t\t\teffect: {\n\t\t\t\t\topacity: effect.textEffectOpacity,\n\t\t\t\t\tx: effect.textEffectX,\n\t\t\t\t\ty: effect.textEffectY,\n\t\t\t\t\tscale: effect.textEffectScale,\n\t\t\t\t\trotate: effect.textEffectRotate,\n\t\t\t\t\trotateX: effect.textEffectRotate3d ? effect.textEffectRotateX : 0,\n\t\t\t\t\trotateY: effect.textEffectRotate3d ? effect.textEffectRotateY : 0,\n\t\t\t\t\tskewX: effect.textEffectSkewX,\n\t\t\t\t\tskewY: effect.textEffectSkewY,\n\t\t\t\t\tfilter: effect.textEffectBlur ? `blur(${effect.textEffectBlur}px)` : undefined,\n\t\t\t\t},\n\t\t\t\ttransition: toMotionTransition(\n\t\t\t\t\tgetCommonEffectTransitionOrUndefined(effect.textEffectTransition) ?? fallbackTextEffectTransition,\n\t\t\t\t) as (Spring | Tween) & { delay: number },\n\t\t\t}\n\t\tdefault:\n\t\t\tassertNever(effect.textEffectType)\n\t}\n}\n\nexport const TextEffectPreview = React.memo(function TextEffectPreview(props: Props) {\n\tconst { textEffectType, textEffectTokenization } = props\n\tconst ref = React.useRef<HTMLDivElement>(null)\n\tconst effect = createEffect(props)\n\n\tconst textEffect = useTextEffect(effect, undefined, true)\n\tconst text = React.useMemo(() => {\n\t\tconst tokenize = textEffect.getTokenizer()\n\t\treturn sampleTextForType(textEffectType, textEffectTokenization).map(t => (\n\t\t\t<p key={t} {...tokenize?.props<HTMLParagraphElement>()} className={cx(styles.previewText, \"framer-text\")}>\n\t\t\t\t{tokenize?.text(t)}\n\t\t\t</p>\n\t\t))\n\t}, [textEffect, textEffectTokenization, textEffectType])\n\n\t// Rerun the effect on any render. Normally effects only play on mount or a\n\t// trigger. Consider intelligently debouncing this in the future. Changing\n\t// the textEffectTokenization should feel instant, but dragging a slider for\n\t// an effect style like blur could be debounced.\n\tReact.useEffect(() => textEffect.play())\n\n\treturn (\n\t\t<div onClick={() => textEffect.play()} ref={ref} className={styles.preview} role=\"presentation\">\n\t\t\t{text}\n\t\t</div>\n\t)\n})\n", "import \"TextEffectPreview.styles_1nhny6.wyw.css\"; export const preview = \"preview_po363jm\";\nexport const previewText = \"previewText_plovk01\";", "import {\n\tIconChevronDown,\n\tIconChevronLeft,\n\tIconChevronRight,\n\tIconChevronUp,\n\tNumberInputWithTickerAndStepper,\n\tSegmentedControl,\n\tSegmentedControlItem,\n\tStack,\n} from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared/src/errors.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { DynamicValueButton, type ControlReferenceInfo } from \"document/components/chrome/shared/DynamicValueButton.tsx\"\nimport { PopoutButtonPreviewIconWrapper } from \"document/components/chrome/shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype WithTickerEffect,\n\tisTickerEffectDirectionModifier,\n\ttickerEffectEnabledDefaults,\n\twithTickerEffect,\n} from \"document/models/CanvasTree/traits/WithTickerEffect.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type { ReducedLayout } from \"document/models/CanvasTree/traits/utils/reduceLayout.ts\"\nimport type { ReducedTickerEffect } from \"document/models/CanvasTree/traits/utils/reduceTickerEffect.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { tickerEffectDirectionModifierVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport type { StackDirection } from \"library/index.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback, useRef } from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { isBoolean, isNumber } from \"utils/typeChecks.ts\"\nimport type { CreateVariableOptions } from \"../../utils/createVariable.ts\"\nimport { createVariableInScope } from \"../../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { ComputedValuesSupportedProvider, PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\nconst tickerDirectionControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"tickerEffectDirectionModifier\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface TickerEffectProps\n\textends ReducedTickerEffect, Pick<ReducedLayout, \"onlyNodesWithLayout\" | \"layout\" | \"stackDirection\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const tickerEffectPopoutId = \"tickerEffect\"\nexport const TickerEffectRow = React.memo(function TickerEffectRow({\n\tnodeIds,\n\tonlyNodesWithTickerEffect,\n\ttickerEffectEnabled,\n\tonlyNodesWithLayout,\n\tlayout,\n\t...effect\n}: TickerEffectProps) {\n\tconst onDelete = useRemoveEffect(EffectType.Ticker, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.Ticker, { tickerEffectEnabled: true })\n\n\tif (!onlyNodesWithTickerEffect || tickerEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow\n\t\t\ttype={EffectType.Ticker}\n\t\t\ttitle={Dictionary.Ticker}\n\t\t\tonDelete={onDelete}\n\t\t\tonCopy={onCopy}\n\t\t\tselection={nodeIds}\n\t\t>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={tickerEffectPopoutId}\n\t\t\t\tenabled={onlyNodesWithLayout && layout === \"stack\"}\n\t\t\t\tpopout={<TickerEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle={Dictionary.Ticker}\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Effect\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n})\n\nfunction useEffectUpdate<T extends WithTickerEffect, K extends keyof T>(key: K, nodeIds: NodeID[]) {\n\tconst engine = useAndAssertVekterEngine()\n\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]> | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withTickerEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithTickerEffect> = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.Ticker, update)\n\t\t\t})\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nconst perPropertyVariableTypes = {\n\ttickerEffectVelocity: ControlType.Number,\n\ttickerEffectHoverModifier: ControlType.Number,\n\ttickerEffectDirectionModifier: ControlType.Enum,\n\ttickerEffectDraggable: ControlType.Boolean,\n} as const satisfies Partial<Record<keyof WithTickerEffect, VariableType>>\n\nconst perPropertyPopoutIds = {\n\ttickerEffectVelocity: \"tickerEffectVelocity-popout\",\n\ttickerEffectHoverModifier: \"tickerEffectHoverModifier-popout\",\n\ttickerEffectDirectionModifier: \"tickerEffectDirectionModifier-popout\",\n\ttickerEffectDraggable: \"tickerEffectDraggable-popout\",\n} as const satisfies Partial<Record<keyof WithTickerEffect, string>>\n\nfunction TickerEffectPopout(\n\tprops: Omit<\n\t\tTickerEffectProps,\n\t\t\"onlyNodesWithTickerEffect\" | \"tickerEffectEnabled\" | \"onlyNodesWithLayout\" | \"layout\"\n\t>,\n) {\n\tconst {\n\t\tnodeIds,\n\t\ttickerEffectVelocity,\n\t\ttickerEffectHoverModifier,\n\t\ttickerEffectDirectionModifier,\n\t\ttickerEffectDraggable,\n\t\tstackDirection,\n\t} = props\n\n\tconst engine = useAndAssertVekterEngine()\n\tconst onChangeVelocity = useEffectUpdate(\"tickerEffectVelocity\", nodeIds)\n\tconst onRemoveVelocity = useCallback(\n\t\t(value?: DynamicValue) => {\n\t\t\tconst resolvedValue = isVariableReference(value) ? getVariableValue(engine, value) : undefined\n\t\t\tonChangeVelocity(isNumber(resolvedValue) ? resolvedValue : undefined)\n\t\t},\n\t\t[onChangeVelocity],\n\t)\n\tconst onCreateVelocityVariable = useCreateVariable(\n\t\tengine,\n\t\t{\n\t\t\ttype: ControlType.Number,\n\t\t\tname: Dictionary.Speed,\n\t\t\tinitialValue: isNumber(tickerEffectVelocity)\n\t\t\t\t? tickerEffectVelocity\n\t\t\t\t: tickerEffectEnabledDefaults.tickerEffectVelocity,\n\t\t\toptions: { min: 0, max: 1000, step: 10, displayStepper: true, unit: \"%\" },\n\t\t},\n\t\tonChangeVelocity,\n\t)\n\tconst onSelectVelocityComputedValue = useSelectComputedValue(\"tickerEffectVelocity\", onChangeVelocity)\n\tconst onChangeHoverModifier = useEffectUpdate(\"tickerEffectHoverModifier\", nodeIds)\n\tconst onRemoveHoverModifier = useCallback(\n\t\t(value?: DynamicValue) => {\n\t\t\tconst resolvedValue = isVariableReference(value) ? getVariableValue(engine, value) : undefined\n\t\t\tonChangeHoverModifier(isNumber(resolvedValue) ? resolvedValue : undefined)\n\t\t},\n\t\t[onChangeHoverModifier],\n\t)\n\tconst onCreateHoverModifierVariable = useCreateVariable(\n\t\tengine,\n\t\t{\n\t\t\ttype: ControlType.Number,\n\t\t\tname: \"Hover\",\n\t\t\tinitialValue: isNumber(tickerEffectHoverModifier)\n\t\t\t\t? tickerEffectHoverModifier\n\t\t\t\t: tickerEffectEnabledDefaults.tickerEffectHoverModifier,\n\t\t\toptions: { min: 0, max: 100, step: 10, displayStepper: true, unit: \"%\" },\n\t\t},\n\t\tonChangeHoverModifier,\n\t)\n\tconst onSelectHoverModifierComputedValue = useSelectComputedValue(\"tickerEffectHoverModifier\", onChangeHoverModifier)\n\tconst onChangeDirectionModifier = useEffectUpdate(\"tickerEffectDirectionModifier\", nodeIds)\n\tconst onRemoveDirectionModifier = useCallback(\n\t\t(value?: DynamicValue) => {\n\t\t\tconst resolvedValue = isVariableReference(value) ? getVariableValue(engine, value) : undefined\n\t\t\tonChangeDirectionModifier(isTickerEffectDirectionModifier(resolvedValue) ? resolvedValue : undefined)\n\t\t},\n\t\t[onChangeDirectionModifier],\n\t)\n\tconst onCreateDirectionModifierVariable = useCreateVariable(\n\t\tengine,\n\t\t{\n\t\t\tinitialValue: isTickerEffectDirectionModifier(tickerEffectDirectionModifier)\n\t\t\t\t? tickerEffectDirectionModifier\n\t\t\t\t: tickerEffectEnabledDefaults.tickerEffectDirectionModifier,\n\t\t\t...tickerEffectDirectionModifierVariableDefinition,\n\t\t},\n\t\tonChangeDirectionModifier,\n\t)\n\tconst onSelectDirectionModifierComputedValue = useSelectComputedValue(\n\t\t\"tickerEffectDirectionModifier\",\n\t\tonChangeDirectionModifier,\n\t)\n\tconst onChangeDraggable = useEffectUpdate(\"tickerEffectDraggable\", nodeIds)\n\tconst onRemoveDraggable = useCallback(\n\t\t(value?: DynamicValue) => {\n\t\t\tconst resolvedValue = isVariableReference(value) ? getVariableValue(engine, value) : undefined\n\t\t\tonChangeDraggable(isBoolean(resolvedValue) ? resolvedValue : undefined)\n\t\t},\n\t\t[onChangeDraggable],\n\t)\n\tconst onCreateDraggableVariable = useCreateVariable(\n\t\tengine,\n\t\t{\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"Draggable\",\n\t\t\tinitialValue: isBoolean(tickerEffectDraggable)\n\t\t\t\t? tickerEffectDraggable\n\t\t\t\t: tickerEffectEnabledDefaults.tickerEffectDraggable,\n\t\t},\n\t\tonChangeDraggable,\n\t)\n\tconst onSelectDraggableComputedValue = useSelectComputedValue(\"tickerEffectDraggable\", onChangeDraggable)\n\n\treturn (\n\t\t<ComputedValuesSupportedProvider value={true}>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t>\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle={Dictionary.Speed}\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\tdynamicValue={isDynamicValue(tickerEffectVelocity) ? tickerEffectVelocity : null}\n\t\t\t\t\tcomputedValuePopoutId={perPropertyPopoutIds.tickerEffectVelocity}\n\t\t\t\t\tonCreateVariable={onCreateVelocityVariable}\n\t\t\t\t\tonRemoveDynamicValue={onRemoveVelocity}\n\t\t\t\t\tonSelectVariable={onChangeVelocity}\n\t\t\t\t\tvariableType={perPropertyVariableTypes.tickerEffectVelocity}\n\t\t\t\t\tonSelectComputedValue={onSelectVelocityComputedValue}\n\t\t\t\t>\n\t\t\t\t\t{isDynamicValue(tickerEffectVelocity) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\ttitle={Dictionary.Speed}\n\t\t\t\t\t\t\texpectedType={perPropertyVariableTypes.tickerEffectVelocity}\n\t\t\t\t\t\t\tvalue={tickerEffectVelocity}\n\t\t\t\t\t\t\tonChangeDynamicValue={onChangeVelocity}\n\t\t\t\t\t\t\tonRemove={onRemoveVelocity}\n\t\t\t\t\t\t\tpopoutId={perPropertyPopoutIds.tickerEffectVelocity}\n\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tdefaultValue={tickerEffectEnabledDefaults.tickerEffectVelocity}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tmax={1000}\n\t\t\t\t\t\t\tonChange={onChangeVelocity}\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tisFound(tickerEffectVelocity) ? tickerEffectVelocity : tickerEffectEnabledDefaults.tickerEffectVelocity\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={10}\n\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle=\"Hover\"\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\tdynamicValue={isDynamicValue(tickerEffectHoverModifier) ? tickerEffectHoverModifier : null}\n\t\t\t\t\tonCreateVariable={onCreateHoverModifierVariable}\n\t\t\t\t\tonSelectVariable={onChangeHoverModifier}\n\t\t\t\t\tonRemoveDynamicValue={onRemoveHoverModifier}\n\t\t\t\t\tvariableType={perPropertyVariableTypes.tickerEffectHoverModifier}\n\t\t\t\t\tcomputedValuePopoutId={perPropertyPopoutIds.tickerEffectHoverModifier}\n\t\t\t\t\tonSelectComputedValue={onSelectHoverModifierComputedValue}\n\t\t\t\t>\n\t\t\t\t\t{isDynamicValue(tickerEffectHoverModifier) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\ttitle={Dictionary.Speed}\n\t\t\t\t\t\t\texpectedType={perPropertyVariableTypes.tickerEffectHoverModifier}\n\t\t\t\t\t\t\tvalue={tickerEffectHoverModifier}\n\t\t\t\t\t\t\tonChangeDynamicValue={onChangeHoverModifier}\n\t\t\t\t\t\t\tonRemove={onRemoveHoverModifier}\n\t\t\t\t\t\t\tpopoutId={perPropertyPopoutIds.tickerEffectHoverModifier}\n\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<NumberInputWithTickerAndStepper\n\t\t\t\t\t\t\tdefaultValue={tickerEffectEnabledDefaults.tickerEffectHoverModifier}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tmax={100}\n\t\t\t\t\t\t\tonChange={onChangeHoverModifier}\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tisFound(tickerEffectHoverModifier)\n\t\t\t\t\t\t\t\t\t? tickerEffectHoverModifier\n\t\t\t\t\t\t\t\t\t: tickerEffectEnabledDefaults.tickerEffectHoverModifier\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstep={10}\n\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle=\"Direction\"\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\tdynamicValue={isDynamicValue(tickerEffectDirectionModifier) ? tickerEffectDirectionModifier : null}\n\t\t\t\t\tonCreateVariable={onCreateDirectionModifierVariable}\n\t\t\t\t\tonSelectVariable={onChangeDirectionModifier}\n\t\t\t\t\tonRemoveDynamicValue={onRemoveDirectionModifier}\n\t\t\t\t\tvariableType={perPropertyVariableTypes.tickerEffectDirectionModifier}\n\t\t\t\t\tcomputedValuePopoutId={perPropertyPopoutIds.tickerEffectDirectionModifier}\n\t\t\t\t\tonSelectComputedValue={onSelectDirectionModifierComputedValue}\n\t\t\t\t\tcontrolKey={tickerDirectionControlReferenceInfo.controlKey}\n\t\t\t\t\tcontrolSourceIdentifier={tickerDirectionControlReferenceInfo.controlSourceIdentifier}\n\t\t\t\t>\n\t\t\t\t\t<DirectionInput\n\t\t\t\t\t\tvalue={tickerEffectDirectionModifier}\n\t\t\t\t\t\tonChange={onChangeDirectionModifier}\n\t\t\t\t\t\tonRemove={onRemoveDirectionModifier}\n\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\tstackDirection={stackDirection === \"vertical\" ? \"vertical\" : \"horizontal\"}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>\n\t\t\t\t<PanelRow\n\t\t\t\t\ttitle=\"Draggable\"\n\t\t\t\t\tsupportsVariables\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\tdynamicValue={isDynamicValue(tickerEffectDraggable) ? tickerEffectDraggable : null}\n\t\t\t\t\tonCreateVariable={onCreateDraggableVariable}\n\t\t\t\t\tonSelectVariable={onChangeDraggable}\n\t\t\t\t\tonRemoveDynamicValue={onRemoveDraggable}\n\t\t\t\t\tvariableType={perPropertyVariableTypes.tickerEffectDraggable}\n\t\t\t\t\tcomputedValuePopoutId={perPropertyPopoutIds.tickerEffectDraggable}\n\t\t\t\t\tonSelectComputedValue={onSelectDraggableComputedValue}\n\t\t\t\t>\n\t\t\t\t\t{isDynamicValue(tickerEffectDraggable) ? (\n\t\t\t\t\t\t<DynamicValueButton\n\t\t\t\t\t\t\ttitle=\"Draggable\"\n\t\t\t\t\t\t\texpectedType={perPropertyVariableTypes.tickerEffectDraggable}\n\t\t\t\t\t\t\tvalue={tickerEffectDraggable}\n\t\t\t\t\t\t\tonChangeDynamicValue={onChangeDraggable}\n\t\t\t\t\t\t\tonRemove={onRemoveDraggable}\n\t\t\t\t\t\t\tpopoutId={perPropertyPopoutIds.tickerEffectDraggable}\n\t\t\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\t\t\tselected={tickerEffectDraggable === true}\n\t\t\t\t\t\t\t\tonSelect={onChangeDraggable}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\t\t\tselected={tickerEffectDraggable === false}\n\t\t\t\t\t\t\t\tonSelect={onChangeDraggable}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SegmentedControl>\n\t\t\t\t\t)}\n\t\t\t\t</PanelRow>\n\t\t\t</Stack>\n\t\t</ComputedValuesSupportedProvider>\n\t)\n}\n\nfunction useCreateVariable(\n\tengine: VekterEngine,\n\toptions: CreateVariableOptions,\n\tonChange: (variableRef: VariableReference) => void,\n) {\n\tconst optionsRef = useRef(options)\n\toptionsRef.current = options\n\n\treturn useEngineCallback(() => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\t...optionsRef.current,\n\t\t\tengine,\n\t\t\tscopeId: engine.stores.scopeStore.active.id,\n\t\t})\n\t\tif (!variableRef) return\n\n\t\tonChange(variableRef)\n\t}, [onChange, engine])\n}\n\nfunction useSelectComputedValue<T extends keyof typeof perPropertyPopoutIds>(\n\tkey: T,\n\tonChange: (value: WithTickerEffect[T]) => void,\n) {\n\treturn useCallback(\n\t\t(value: ComputedValue) => {\n\t\t\tconst computedValuePopoutId = perPropertyPopoutIds[key]\n\t\t\tonChange(value)\n\t\t\tpopoutWindow.navigation.presentPopout(computedValuePopoutId)\n\t\t},\n\t\t[key, onChange],\n\t)\n}\n\ninterface DirectionInputProps {\n\tstackDirection: StackDirection\n\tvalue: ReducedTickerEffect[\"tickerEffectDirectionModifier\"]\n\tonChange: (value: WithTickerEffect[\"tickerEffectDirectionModifier\"]) => void\n\tonRemove: () => void\n\tnodeIds: NodeID[]\n}\nfunction DirectionInput({ value, onChange, onRemove, nodeIds, stackDirection }: DirectionInputProps) {\n\tconst onSelect = useCallback(\n\t\t(newValue: Extract<WithTickerEffect[\"tickerEffectDirectionModifier\"], string>) =>\n\t\t\tonChange(newValue as WithTickerEffect[\"tickerEffectDirectionModifier\"]),\n\t\t[onChange],\n\t)\n\n\tif (isDynamicValue(value)) {\n\t\treturn (\n\t\t\t<DynamicValueButton\n\t\t\t\ttitle=\"Direction\"\n\t\t\t\texpectedType={perPropertyVariableTypes.tickerEffectDirectionModifier}\n\t\t\t\tvalue={value}\n\t\t\t\tonChangeDynamicValue={onChange}\n\t\t\t\tonRemove={onRemove}\n\t\t\t\tpopoutId={perPropertyPopoutIds.tickerEffectDirectionModifier}\n\t\t\t\tsupportsComputedValues\n\t\t\t\tsupportsFetchDataValues={false}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\toutputControl={getNodePropertyControlDescription(\"tickerEffectDirectionModifier\")}\n\t\t\t\tcontrolReferenceInfo={tickerDirectionControlReferenceInfo}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (stackDirection === \"horizontal\") {\n\t\treturn (\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem title=\"Left\" identifier=\"default\" selected={value === \"default\"} onSelect={onSelect}>\n\t\t\t\t\t<IconChevronLeft />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t\t<SegmentedControlItem title=\"Right\" identifier=\"reverse\" selected={value === \"reverse\"} onSelect={onSelect}>\n\t\t\t\t\t<IconChevronRight />\n\t\t\t\t</SegmentedControlItem>\n\t\t\t</SegmentedControl>\n\t\t)\n\t}\n\n\treturn (\n\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t<SegmentedControlItem title=\"Up\" identifier=\"default\" selected={value === \"default\"} onSelect={onSelect}>\n\t\t\t\t<IconChevronUp />\n\t\t\t</SegmentedControlItem>\n\t\t\t<SegmentedControlItem title=\"Down\" identifier=\"reverse\" selected={value === \"reverse\"} onSelect={onSelect}>\n\t\t\t\t<IconChevronDown />\n\t\t\t</SegmentedControlItem>\n\t\t</SegmentedControl>\n\t)\n}\n", "import { Button, SegmentedControl, SegmentedControlItem, Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { Mixed, assertNever, isMixed, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type {\n\tEffectVariantScrollTarget,\n\tVariantAppearEffectTrigger,\n\tWithVariantAppearEffect,\n} from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport { withVariantAppearPageEffect } from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ResolvedCollectionItemSelector } from \"document/models/CanvasTree/traits/utils/ResolvedCollectionItemSelector.ts\"\nimport { EffectType } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport type {\n\tReducedEffectVariantScrollTarget,\n\tReducedVariantAppearEffect,\n} from \"document/models/CanvasTree/traits/utils/reduceVariantAppearEffect.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isArray, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../../shared/PopoutButtonWithPreview.tsx\"\nimport { VariantSelector } from \"../../codeComponentRows/VariantSelector.tsx\"\nimport { doubleColumn } from \"../../utils/doubleColumn.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { EffectPreviewIcon } from \"./EffectPreviewIcon.tsx\"\nimport * as styles from \"./VariantAppearEffectRow.styles.ts\"\nimport { EffectDirectionRow } from \"./shared/EffectDirectionRow.tsx\"\nimport { EffectRow } from \"./shared/EffectRow.tsx\"\nimport { EffectScrollTargetRows } from \"./shared/EffectScrollTargetRow.tsx\"\nimport { EffectStartRow } from \"./shared/EffectStartRow.tsx\"\nimport { EffectTriggerRow } from \"./shared/EffectTriggerRow.tsx\"\nimport { EffectViewportRow } from \"./shared/EffectViewportRow.tsx\"\nimport type { VariantOption } from \"./shared/useSelectedNodeVariants.ts\"\nimport { useSelectedNodeVariants } from \"./shared/useSelectedNodeVariants.ts\"\nimport { createCopyEffectHandler, trackEffectUpdate, useRemoveEffect } from \"./shared/utils.ts\"\n\ninterface AppearEffectProps extends ReducedVariantAppearEffect {\n\tnodeIds: NodeID[]\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\tcodeComponentIdentifiers: Set<string>\n\tcomponentHash: string\n}\n\nfunction useAppearEffectUpdate<T extends WithVariantAppearEffect, K extends keyof T>(key: K, nodeIds: string[]) {\n\treturn useEngineCallback(\n\t\t(value: NonNullable<T[K]>) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withVariantAppearPageEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update = { [key]: value }\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.SetVariant, update)\n\t\t\t})\n\t\t},\n\t\t[key, nodeIds],\n\t)\n}\n\nconst supportedEffectTriggers = new Set<EffectTrigger>([\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnScrollDirection,\n])\n\nfunction isSupportedTrigger(trigger: EffectTrigger | undefined): trigger is VariantAppearEffectTrigger {\n\treturn !isUndefined(trigger) && supportedEffectTriggers.has(trigger)\n}\n\nconst useAppearEffectTriggerUpdate = (nodeIds: string[]) =>\n\tuseEngineCallback(\n\t\t(value: EffectTrigger) => {\n\t\t\tif (!isSupportedTrigger(value)) return\n\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withVariantAppearPageEffect)\n\t\t\tnodes.forEach(node => {\n\t\t\t\tconst update: Partial<WithVariantAppearEffect> = { appearEffectTrigger: value }\n\t\t\t\tif (value === EffectTrigger.OnScrollTarget) {\n\t\t\t\t\tupdate.appearEffectThreshold = 0\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tisUndefined(node.appearEffectScrollTargets) ||\n\t\t\t\t\t\t(isArray(node.appearEffectScrollTargets) && node.appearEffectScrollTargets.length === 0)\n\t\t\t\t\t) {\n\t\t\t\t\t\tupdate.appearEffectScrollTargets = [defaultEffect()]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnode.set(update)\n\t\t\t\ttrackEffectUpdate(EffectType.SetVariant, update)\n\t\t\t})\n\t\t},\n\t\t[nodeIds],\n\t)\n\nconst maxSections = 6\nconst maxRows = 3 + maxSections * 2\nconst maxHeight = `calc((${dimensions.css.inputHeight} + ${dimensions.css.inputSpacing}) * ${maxRows} + ${dimensions.css.panelPadding} * 2)`\n\nfunction ThresholdRow({\n\ttrigger,\n\tthreshold,\n\tonSelect,\n}: {\n\ttrigger: Reduced<VariantAppearEffectTrigger | undefined>\n\tthreshold: Reduced<number | undefined>\n\tonSelect: (value: number) => void\n}) {\n\tif (trigger === EffectTrigger.OnScrollDirection) return null\n\tif (trigger === EffectTrigger.OnScrollTarget) {\n\t\treturn <EffectViewportRow threshold={threshold} onSelect={onSelect} />\n\t}\n\n\treturn <EffectStartRow threshold={threshold} onSelect={onSelect} />\n}\n\nfunction TargetRows(props: {\n\ttrigger: Reduced<VariantAppearEffectTrigger> | undefined\n\tvariants: VariantOption[]\n\n\t// Section In View\n\tscopeType: ScopeType\n\tscopeId: NodeID\n\tnodeIds: NodeID[]\n\tscrollTargets: ReducedEffectVariantScrollTarget[]\n\tscrollTargetCount: Reduced<number>\n\n\t// On Scroll\n\tscrollDirectionTarget: Set<string | undefined>\n\tonSelectScrollDirection: (id: NodeID) => void\n\n\t// Layer In View\n\tfromVariant: Set<string | undefined>\n\ttoVariant: Set<string | undefined>\n\tonSelectFromVariant: (id: NodeID) => void\n\tonSelectToVariant: (id: NodeID) => void\n}) {\n\tconst { trigger, variants } = props\n\n\tswitch (trigger) {\n\t\tcase EffectTrigger.OnScrollTarget:\n\t\t\treturn (\n\t\t\t\t<ScrollSectionRows\n\t\t\t\t\tscopeId={props.scopeId}\n\t\t\t\t\tscopeType={props.scopeType}\n\t\t\t\t\ttopLevelVariants={variants}\n\t\t\t\t\tnodeIds={props.nodeIds}\n\t\t\t\t\tscrollTargets={props.scrollTargets}\n\t\t\t\t\tappearEffectScrollTargetCount={props.scrollTargetCount}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase EffectTrigger.OnScrollDirection:\n\t\t\treturn (\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t>\n\t\t\t\t\t<PanelRow title=\"To\">\n\t\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\t\ttopLevelVariants={variants}\n\t\t\t\t\t\t\tselection={props.scrollDirectionTarget}\n\t\t\t\t\t\t\tonSelect={props.onSelectScrollDirection}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Stack>\n\t\t\t)\n\t\tcase EffectTrigger.OnInView:\n\t\tcase NotFound:\n\t\tcase Mixed:\n\t\tcase undefined:\n\t\t\treturn (\n\t\t\t\t<Stack\n\t\t\t\t\tgap={0}\n\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t>\n\t\t\t\t\t<PanelRow title=\"From\">\n\t\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\t\ttopLevelVariants={variants}\n\t\t\t\t\t\t\tselection={props.fromVariant}\n\t\t\t\t\t\t\tonSelect={props.onSelectFromVariant}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"To\">\n\t\t\t\t\t\t<VariantSelector\n\t\t\t\t\t\t\ttopLevelVariants={variants}\n\t\t\t\t\t\t\tselection={props.toVariant}\n\t\t\t\t\t\t\tonSelect={props.onSelectToVariant}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</Stack>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(trigger)\n\t}\n}\n\nfunction AppearEffectPopout(\n\tprops: Omit<AppearEffectProps, \"onlyNodesWithVariantAppearEffect\" | \"appearEffectEnabled\">,\n) {\n\tconst {\n\t\tnodeIds,\n\t\tscopeId,\n\t\tscopeType,\n\t\tcodeComponentIdentifiers,\n\t\tcomponentHash,\n\t\tappearEffectVisibleVariantId,\n\t\tappearEffectObscuredVariantId,\n\t\tappearEffectAnimateOnce,\n\t\tappearEffectThreshold,\n\t\tappearEffectTrigger,\n\t\tappearEffectScrollTargets,\n\t\tappearEffectScrollTargetCount,\n\t\tappearEffectScrollDirectionTarget,\n\t\tappearEffectScrollDirection,\n\t} = props\n\tconst visibleVariantHandler = useAppearEffectUpdate(\"appearEffectVisibleVariantId\", nodeIds)\n\tconst obscuredVariantHandler = useAppearEffectUpdate(\"appearEffectObscuredVariantId\", nodeIds)\n\tconst scrollDirectionVariantHandler = useAppearEffectUpdate(\"appearEffectScrollDirectionTarget\", nodeIds)\n\tconst scrollDirectionHandler = useAppearEffectUpdate(\"appearEffectScrollDirection\", nodeIds)\n\tconst animateOnceHandler = useAppearEffectUpdate(\"appearEffectAnimateOnce\", nodeIds)\n\tconst onSelectThreshold = useAppearEffectUpdate(\"appearEffectThreshold\", nodeIds)\n\tconst onSelectTrigger = useAppearEffectTriggerUpdate(nodeIds)\n\tconst commonAppearEffectTrigger = commonValue(appearEffectTrigger)\n\n\tconst topLevelVariants = useSelectedNodeVariants({\n\t\tid: nodeIds[0],\n\t\tcodeComponentIdentifiers,\n\t\tcomponentHash,\n\t})\n\n\treturn (\n\t\t<div style={{ maxHeight }} className={styles.scroll}>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t>\n\t\t\t\t<EffectTriggerRow\n\t\t\t\t\tonSelectTrigger={onSelectTrigger}\n\t\t\t\t\ttriggers={appearEffectTrigger}\n\t\t\t\t\tsupportedTriggers={supportedEffectTriggers}\n\t\t\t\t/>\n\n\t\t\t\t<ThresholdRow\n\t\t\t\t\ttrigger={commonAppearEffectTrigger}\n\t\t\t\t\tthreshold={appearEffectThreshold}\n\t\t\t\t\tonSelect={onSelectThreshold}\n\t\t\t\t/>\n\n\t\t\t\t{commonAppearEffectTrigger === EffectTrigger.OnScrollDirection && (\n\t\t\t\t\t<EffectDirectionRow direction={appearEffectScrollDirection} onSelect={scrollDirectionHandler} />\n\t\t\t\t)}\n\n\t\t\t\t<PanelRow title=\"Replay\">\n\t\t\t\t\t<SegmentedControl enabled={!isMixed(appearEffectAnimateOnce)} style={doubleColumn}>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\t\ttitle=\"Yes\"\n\t\t\t\t\t\t\tselected={appearEffectAnimateOnce === false}\n\t\t\t\t\t\t\tonSelect={animateOnceHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\t\ttitle=\"No\"\n\t\t\t\t\t\t\tselected={appearEffectAnimateOnce === true}\n\t\t\t\t\t\t\tonSelect={animateOnceHandler}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SegmentedControl>\n\t\t\t\t</PanelRow>\n\t\t\t</Stack>\n\n\t\t\t<TargetRows\n\t\t\t\tscopeId={scopeId}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tvariants={topLevelVariants}\n\t\t\t\ttrigger={commonAppearEffectTrigger}\n\t\t\t\tscrollDirectionTarget={appearEffectScrollDirectionTarget}\n\t\t\t\tfromVariant={appearEffectObscuredVariantId}\n\t\t\t\ttoVariant={appearEffectVisibleVariantId}\n\t\t\t\tscrollTargets={appearEffectScrollTargets}\n\t\t\t\tscrollTargetCount={appearEffectScrollTargetCount}\n\t\t\t\tonSelectScrollDirection={scrollDirectionVariantHandler}\n\t\t\t\tonSelectFromVariant={obscuredVariantHandler}\n\t\t\t\tonSelectToVariant={visibleVariantHandler}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\nexport const variantAppearEffectPopoutId = \"variantAppearEffect\"\nexport function VariantAppearEffectRow({\n\tnodeIds,\n\tonlyNodesWithVariantAppearEffect,\n\tappearEffectEnabled,\n\t...effect\n}: AppearEffectProps) {\n\tconst onDelete = useRemoveEffect(EffectType.SetVariant, nodeIds)\n\tconst copyEffect = createCopyEffectHandler(effect, values => void Clipboard.copyEffects(values).catch(unhandledError))\n\tconst onCopy = copyEffect(EffectType.SetVariant, { appearEffectEnabled: true })\n\tif (!onlyNodesWithVariantAppearEffect || appearEffectEnabled !== true) return null\n\n\treturn (\n\t\t<EffectRow type={EffectType.SetVariant} title=\"Scroll\" onDelete={onDelete} onCopy={onCopy} selection={nodeIds}>\n\t\t\t<PopoutButtonWithPreview\n\t\t\t\tid={variantAppearEffectPopoutId}\n\t\t\t\tpopout={<AppearEffectPopout {...effect} nodeIds={nodeIds} />}\n\t\t\t\tnavigationTitle=\"Scroll Variant\"\n\t\t\t\tdisplayDivider\n\t\t\t\ttitle=\"Variant\"\n\t\t\t\tonDelete={onDelete}\n\t\t\t\tpreview={\n\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t}\n\t\t\t/>\n\t\t</EffectRow>\n\t)\n}\n\nfunction defaultEffect(): EffectVariantScrollTarget {\n\treturn { id: randomID(), target: undefined, variant: undefined }\n}\n\nfunction getTarget(node: CanvasNode & WithVariantAppearEffect, effectId?: NodeID) {\n\tif (isUndefined(node.appearEffectScrollTargets)) {\n\t\treturn [0, defaultEffect()] as const\n\t}\n\n\tconst idx = node.appearEffectScrollTargets.findIndex(effectTarget => effectTarget.id === effectId)\n\n\tconst effect = node.appearEffectScrollTargets[idx] ?? defaultEffect()\n\n\treturn [idx, effect] as const\n}\n\nfunction updateTarget(node: CanvasNode & WithVariantAppearEffect, effect: EffectVariantScrollTarget, idx?: number) {\n\tif (\n\t\tisUndefined(node.appearEffectScrollTargets) ||\n\t\t(isArray(node.appearEffectScrollTargets) && node.appearEffectScrollTargets.length === 0)\n\t) {\n\t\treturn [effect]\n\t}\n\tconst update = [...node.appearEffectScrollTargets]\n\tif (isUndefined(idx)) {\n\t\tupdate.push(effect)\n\t\treturn update\n\t}\n\n\tupdate.splice(idx, 1, effect)\n\n\treturn update\n}\n\nfunction removeTarget(node: CanvasNode & WithVariantAppearEffect, effectId: NodeID) {\n\tif (isUndefined(node.appearEffectScrollTargets)) return\n\n\treturn node.appearEffectScrollTargets.filter(effect => effect.id !== effectId)\n}\n\nfunction ScrollSectionRows({\n\tscopeId,\n\tscopeType,\n\tnodeIds,\n\tscrollTargets,\n\ttopLevelVariants,\n\tappearEffectScrollTargetCount,\n}: {\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\tnodeIds: NodeID[]\n\ttopLevelVariants: VariantOption[]\n\tscrollTargets: ReducedEffectVariantScrollTarget[]\n\tappearEffectScrollTargetCount: Reduced<number>\n}) {\n\tconst ref = React.useRef<HTMLDivElement>(null)\n\tconst lastTargetCountRef = React.useRef(scrollTargets.length)\n\n\tconst updateSection = (ids: Record<NodeID, NodeID>, key: keyof EffectVariantScrollTarget) =>\n\t\tengine.scheduler.wrapHandler((value: unknown) => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withVariantAppearPageEffect).forEach(node => {\n\t\t\t\tconst id = ids[node.id]\n\t\t\t\tconst [idx, effect] = getTarget(node, id)\n\t\t\t\tconst update: EffectVariantScrollTarget = { ...effect, [key]: value }\n\t\t\t\tnode.set({ appearEffectScrollTargets: updateTarget(node, update, idx) })\n\t\t\t})\n\t\t})\n\n\tconst addSection = engine.scheduler.wrapHandler(() => {\n\t\tengine.tree.getNodesWithTrait(nodeIds, withVariantAppearPageEffect).forEach(node => {\n\t\t\tif (\n\t\t\t\tisUndefined(node.appearEffectScrollTargets) ||\n\t\t\t\t(isArray(node.appearEffectScrollTargets) && node.appearEffectScrollTargets.length === 0)\n\t\t\t) {\n\t\t\t\tnode.set({ appearEffectScrollTargets: [defaultEffect()] })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnode.set({ appearEffectScrollTargets: [...node.appearEffectScrollTargets, defaultEffect()] })\n\t\t})\n\t})\n\n\tconst removeSection = (ids: Record<NodeID, NodeID>) =>\n\t\tengine.scheduler.wrapHandler(() => {\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withVariantAppearPageEffect).forEach(node => {\n\t\t\t\tconst id = ids[node.id]\n\t\t\t\tif (id) node.set({ appearEffectScrollTargets: removeTarget(node, id) })\n\t\t\t})\n\t\t})\n\n\t// If a target is added, scroll to the bottom of the list of targets.\n\tReact.useEffect(() => {\n\t\tif (lastTargetCountRef.current < scrollTargets.length) ref.current?.scrollIntoView()\n\t\tlastTargetCountRef.current = scrollTargets.length\n\t}, [scrollTargets.length])\n\n\tconst [initialTarget, ...remainingTargets] = scrollTargets\n\tif (!initialTarget) return null\n\n\treturn (\n\t\t<>\n\t\t\t<Stack gap={0} paddingBottom={dimensions.css.inputSpacing} paddingTop={0}>\n\t\t\t\t<ScrollSectionRow\n\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\ttargets={initialTarget.targets}\n\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\tvariants={initialTarget.variants}\n\t\t\t\t\tonSelectVariant={updateSection(initialTarget.ids, \"variant\")}\n\t\t\t\t\tonSelectTarget={updateSection(initialTarget.ids, \"target\")}\n\t\t\t\t\tonSelectCollectionItem={updateSection(initialTarget.ids, \"collectionItem\")}\n\t\t\t\t\tcollectionItem={initialTarget.collectionItem}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t\t{isNumber(appearEffectScrollTargetCount) &&\n\t\t\t\tremainingTargets.map(({ targets, variants, collectionItem, ids }, idx) => (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\tgap={0}\n\t\t\t\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\t\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\t\t\t\tclassName={styles.dividerAbove}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ScrollSectionRow\n\t\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\t\ttargets={targets}\n\t\t\t\t\t\t\tvariants={variants}\n\t\t\t\t\t\t\ttopLevelVariants={topLevelVariants}\n\t\t\t\t\t\t\tonSelectVariant={updateSection(ids, \"variant\")}\n\t\t\t\t\t\t\tonSelectTarget={updateSection(ids, \"target\")}\n\t\t\t\t\t\t\tonSelectCollectionItem={updateSection(ids, \"collectionItem\")}\n\t\t\t\t\t\t\tonRemove={removeSection(ids)}\n\t\t\t\t\t\t\tcollectionItem={collectionItem}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t))}\n\t\t\t{/* This div is always at the end of the scrollable region. This allows us to scroll to the bottom without having to do any measurements. */}\n\t\t\t<div ref={ref} />\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tpaddingTop={dimensions.css.panelPadding}\n\t\t\t\tpaddingBottom={dimensions.css.panelPadding}\n\t\t\t\tclassName={cx(styles.buttonContainer, styles.dividerAbove)}\n\t\t\t>\n\t\t\t\t<Stack gap={0} paddingLeft={dimensions.css.panelPadding} paddingRight={dimensions.css.panelPadding}>\n\t\t\t\t\t<Button title=\"Add Section\" enabled={!isMixed(appearEffectScrollTargetCount)} onMouseDown={addSection} />\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t</>\n\t)\n}\n\ninterface ScrollSectionRowProps {\n\tscopeId: NodeID\n\tscopeType: ScopeType\n\ttargets: Set<NodeID | VariableReference | undefined>\n\tvariants: Set<NodeID | undefined>\n\tcollectionItem: Reduced<VariableReference | ResolvedCollectionItemSelector | undefined>\n\ttopLevelVariants: VariantOption[]\n\tonSelectVariant: (variantId: NodeID) => void\n\tonSelectCollectionItem: (value: VariableReference | ResolvedCollectionItemSelector | undefined) => void\n\tonSelectTarget: (targetId: NodeID) => void\n\tonRemove?: () => void\n}\n\nfunction ScrollSectionRow(props: ScrollSectionRowProps) {\n\tconst {\n\t\tscopeId,\n\t\tscopeType,\n\t\ttargets,\n\t\ttopLevelVariants,\n\t\tvariants,\n\t\tcollectionItem,\n\t\tonSelectVariant,\n\t\tonSelectTarget,\n\t\tonRemove,\n\t\tonSelectCollectionItem,\n\t} = props\n\treturn (\n\t\t<Stack gap={0} paddingLeft={dimensions.css.panelPadding} paddingRight={dimensions.css.panelPadding}>\n\t\t\t<EffectScrollTargetRows\n\t\t\t\tscopeId={scopeId}\n\t\t\t\tscopeType={scopeType}\n\t\t\t\tcollectionItem={collectionItem}\n\t\t\t\ttargets={targets}\n\t\t\t\tonSelect={onSelectTarget}\n\t\t\t\tonRemove={onRemove}\n\t\t\t\tonSelectCollectionItem={onSelectCollectionItem}\n\t\t\t/>\n\t\t\t<PanelRow title=\"To\" onDelete={onRemove}>\n\t\t\t\t<VariantSelector topLevelVariants={topLevelVariants} selection={variants} onSelect={onSelectVariant} />\n\t\t\t</PanelRow>\n\t\t</Stack>\n\t)\n}\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { type VariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withFillOpacity } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport type { ReducedFillOpacity } from \"document/models/CanvasTree/traits/utils/reduceFillOpacity.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst opacityTraitTypes = [TraitType.Opacity]\n\ninterface Props extends ReducedFillOpacity {\n\tnodeIds: NodeID[]\n}\n\nexport const FillOpacityRow = React.memo(function FillOpacityRow(props: Props) {\n\tconst { fillOpacity } = props\n\n\tconst canCopyOpacity = !isMixed(fillOpacity) && isClipboardSupported()\n\tconst [canPasteOpacity, pasteOpacity, copyOpacity] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Opacity,\n\t\tprops.nodeIds,\n\t\tcanCopyOpacity,\n\t)\n\n\tconst update = useEngineCallback(\n\t\t(newOpacity: number | VariableReference | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withFillOpacity)\n\t\t\tnodes.forEach(node => node.set({ fillOpacity: newOpacity }))\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Number,\n\t\t\t\tname: \"Fill Alpha\",\n\t\t\t\tinitialValue: isNumber(fillOpacity) ? fillOpacity : 1,\n\t\t\t\toptions: { min: 0, max: 1, step: 0.01 },\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdate(variableRef)\n\t\t},\n\t\t[fillOpacity, update],\n\t)\n\n\tconst removeVariableReference = useEngineCallback(() => {\n\t\tif (!isDynamicValue(fillOpacity)) return\n\t\tif (isVariableReference(fillOpacity)) {\n\t\t\tconst variableValue = getVariableValue(engine, fillOpacity)\n\t\t\tconst opacityValue = isNumber(variableValue) ? Math.max(0, Math.min(1, variableValue)) : 1\n\t\t\tupdate(opacityValue)\n\t\t} else if (isComputedValue(fillOpacity)) {\n\t\t\tupdate(1)\n\t\t} else {\n\t\t\tshouldBeNever(fillOpacity)\n\t\t}\n\t}, [fillOpacity, update])\n\n\tconst onRemove = useEngineCallback(() => {\n\t\tupdate(undefined)\n\t}, [update])\n\n\tconst supportsVariables = useSupportsVariable(\"fillOpacity\")\n\tif (isNotFound(fillOpacity) || isUndefined(fillOpacity)) return null\n\n\tconst step = 0.01\n\tconst max = 1\n\tconst defaultValue = max\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Fill Alpha\"\n\t\t\tvariableType={ControlType.Number}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeVariableReference}\n\t\t\tdynamicValue={isVariableReference(fillOpacity) ? fillOpacity : null}\n\t\t\tonSelectVariable={update}\n\t\t\ttraitTypes={opacityTraitTypes}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tonCopy={copyOpacity}\n\t\t\tcopyEnabled={canCopyOpacity}\n\t\t\tonPaste={pasteOpacity}\n\t\t\tpasteEnabled={canPasteOpacity}\n\t\t\tonDelete={onRemove}\n\t\t>\n\t\t\t{isVariableReference(fillOpacity) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\ttitle=\"Fill Alpha\"\n\t\t\t\t\treference={fillOpacity}\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tonRemove={removeVariableReference}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={fillOpacity}\n\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\tmax={max}\n\t\t\t\t\t\tstep={step}\n\t\t\t\t\t\tdefaultValue={defaultValue}\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider value={fillOpacity} step={step} max={max} onChange={update} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { IconEffect } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\tformInputFocusedStylesCreateDefaults,\n\twithFormInputFocusedStyles,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts\"\nimport { hasFormInputFocusedStyles } from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"../../shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"../../shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport type { FormContainerInputFocusedStylePopoutProps } from \"../panels/FormInputFocusedStylePopoutContent.tsx\"\nimport { FormInputFocusedStylePopoutContent } from \"../panels/FormInputFocusedStylePopoutContent.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { exitEffectPreview, useExitEffectPreviewOnUnmount } from \"./EffectRows/shared/utils.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface Props extends FormContainerInputFocusedStylePopoutProps {}\n\nconst focusStyleTraits = [\n\tTraitType.FormInputFocusedBorder,\n\tTraitType.FormInputFocusedFill,\n\tTraitType.FormInputFocusedBoxShadow,\n]\n\nconst popoutId = \"input-focused-style\"\n\nconst setEffectTypePreview = () =>\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.effectStore.enterPreview({ effect: EffectPreviewType.Focus })\n\t})\n\nexport function FormInputFocusedStyleRow(props: Props) {\n\tconst { nodeIds } = props\n\tconst hasFocusStyles = hasFormInputFocusedStyles(props)\n\tconst popoutIsOpen = popoutWindow.navigation.isPresenting(popoutId)\n\n\tuseExitEffectPreviewOnUnmount()\n\n\tconst canCopyStyles = useCallback(() => {\n\t\tif (!isClipboardSupported()) return false\n\t\tif (!hasFocusStyles) return false\n\t\tif (\n\t\t\tisMixed(props.formInputFocusedBackgroundColor) ||\n\t\t\tisMixed(props.formInputFocusedBorderColor) ||\n\t\t\tisMixed(props.formInputFocusedBorderStyle) ||\n\t\t\tisMixed(props.formInputFocusedBorderWidth) ||\n\t\t\tisMixed(props.formInputFocusedBoxShadow)\n\t\t) {\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}, [\n\t\thasFocusStyles,\n\t\tprops.formInputFocusedBackgroundColor,\n\t\tprops.formInputFocusedBorderColor,\n\t\tprops.formInputFocusedBorderStyle,\n\t\tprops.formInputFocusedBorderWidth,\n\t\tprops.formInputFocusedBoxShadow,\n\t])\n\tconst [canPaste, paste, copy] = useCopyAndPasteSingleProperty(focusStyleTraits, props.nodeIds, canCopyStyles)\n\n\tconst removeStyles = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFocusedStyles)) {\n\t\t\tnode.set({\n\t\t\t\tformInputFocusedBackgroundColor: undefined,\n\t\t\t\tformInputFocusedBorderColor: undefined,\n\t\t\t\tformInputFocusedBorderStyle: undefined,\n\t\t\t\tformInputFocusedBorderWidth: undefined,\n\t\t\t\tformInputFocusedBoxShadow: undefined,\n\t\t\t\tformInputFocusedTransition: undefined,\n\t\t\t})\n\t\t}\n\n\t\tpopoutWindow.navigation.close()\n\t}, [nodeIds])\n\n\tconst onContextMenu = React.useCallback(\n\t\tasync (event: React.MouseEvent<HTMLDivElement>) => {\n\t\t\tif (!isClipboardSupported()) return\n\t\t\tengine.stores.contextMenuStore.show(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Copy\",\n\t\t\t\t\t\tclick: copy,\n\t\t\t\t\t\tenabled: canCopyStyles(),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Paste\",\n\t\t\t\t\t\tclick: paste,\n\t\t\t\t\t\tenabled: await canPaste(),\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\t{ location: { x: event.clientX, y: event.clientY } },\n\t\t\t)\n\t\t},\n\t\t[canCopyStyles, canPaste, copy, paste],\n\t)\n\n\tconst setFocusStyleDefaults = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFocusedStyles)) {\n\t\t\tnode.set(formInputFocusedStylesCreateDefaults)\n\t\t}\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(popoutId)\n\t}, [nodeIds])\n\n\treturn (\n\t\t<PanelRow title=\"Focus\" onContextMenu={onContextMenu}>\n\t\t\t{hasFocusStyles || popoutIsOpen ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tpopout={<FormInputFocusedStylePopoutContent {...props} />}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tnavigationTitle=\"Focus\"\n\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\tid={popoutId}\n\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\tonDelete={removeStyles}\n\t\t\t\t\tonPresent={setEffectTypePreview}\n\t\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<IconEffect />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion\n\t\t\t\t\tonContextMenu={onContextMenu}\n\t\t\t\t\ttype=\"effect\"\n\t\t\t\t\tonClick={setFocusStyleDefaults}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithFormInputFocusedStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts\"\nimport {\n\tformInputDefaultFocusedBorderColor,\n\tformInputDefaultFocusedBorderStyle,\n\tformInputDefaultFocusedBorderWidth,\n\tformInputDefaultFocussedBorderWidthWithoutUnit,\n\tformInputFocusedStylesCreateDefaults,\n\twithFormInputFocusedStyles,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts\"\nimport type { ReducedFormInputFocusedStyles } from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport {\n\tfromBorderValues,\n\tparseBorderString,\n\ttoReducedBorderValues,\n} from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport { isCompleteShadowList } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type { Transition } from \"document/models/Transition.ts\"\nimport type { BorderControlProp, BoxShadowControlProp, ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { isNull, isString } from \"utils/typeChecks.ts\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { BorderControlPropRow } from \"../codeComponentRows/BorderControlPropRow.tsx\"\nimport { BoxShadowControlPropRow } from \"../codeComponentRows/BoxShadowControlPropRow.tsx\"\nimport { ColorControlPropRow } from \"../codeComponentRows/ColorControlPropRow.tsx\"\nimport { TransitionRow, transitionPopoutId } from \"../rows/TransitionRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"./utils/useCopyAndPasteSingleProperty.ts\"\n\nexport interface FormContainerInputFocusedStylePopoutProps extends ReducedFormInputFocusedStyles {\n\tnodeIds: NodeID[]\n}\n\ntype BorderControlPropUpdate = BorderControlProp & { type: ControlType.Border }\n\nfunction getDefaultFocusTransition(): Transition {\n\treturn {\n\t\ttype: \"tween\",\n\t\tdelay: 0,\n\t\tduration: 0.3,\n\t\t// Linear easing\n\t\tease: [0.44, 0, 0.56, 1],\n\t\tstiffness: 0,\n\t\tdamping: 0,\n\t\tmass: 0,\n\t}\n}\n\nexport function FormInputFocusedStylePopoutContent({\n\tnodeIds,\n\tformInputFocusedBackgroundColor,\n\tformInputFocusedBorderColor,\n\tformInputFocusedBorderWidth,\n\tformInputFocusedBorderStyle,\n\tformInputFocusedBoxShadow,\n\tformInputFocusedTransition,\n}: FormContainerInputFocusedStylePopoutProps) {\n\tconst canCopyFill = isString(formInputFocusedBackgroundColor)\n\tconst [canPasteFill, pasteFill, copyFill] = useCopyAndPasteSingleProperty(\n\t\tTraitType.FormInputFocusedFill,\n\t\tnodeIds,\n\t\tcanCopyFill,\n\t)\n\n\tconst canCopyBorder = useCallback(() => {\n\t\tif (\n\t\t\tisMixed(formInputFocusedBorderWidth) ||\n\t\t\tisMixed(formInputFocusedBorderColor) ||\n\t\t\tisMixed(formInputFocusedBorderStyle)\n\t\t) {\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}, [formInputFocusedBorderWidth, formInputFocusedBorderColor, formInputFocusedBorderStyle])\n\n\tconst [canPasteBorder, pasteBorder, copyBorder] = useCopyAndPasteSingleProperty(\n\t\tTraitType.FormInputFocusedBorder,\n\t\tnodeIds,\n\t\tcanCopyBorder,\n\t)\n\n\tconst canCopyShadow = isCompleteShadowList(formInputFocusedBoxShadow)\n\tconst [canPasteShadow, pasteShadow, copyShadow] = useCopyAndPasteSingleProperty(\n\t\tTraitType.FormInputFocusedBoxShadow,\n\t\tnodeIds,\n\t\tcanCopyShadow,\n\t)\n\n\tconst onChange = useEngineCallback(\n\t\t(update: Partial<WithFormInputFocusedStyles>) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFocusedStyles)) {\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleBackgroundColorChange = useCallback(\n\t\t({ value }: ControlProp) => {\n\t\t\tonChange({ formInputFocusedBackgroundColor: isString(value) ? value : undefined })\n\t\t},\n\t\t[onChange],\n\t)\n\n\tconst handleBorderChange = useEngineCallback(\n\t\t(_, getUpdate: (current: BorderControlPropUpdate) => BorderControlPropUpdate) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFocusedStyles)) {\n\t\t\t\tconst borderSize = parseBorderString(node.formInputFocusedBorderWidth ?? formInputDefaultFocusedBorderWidth)\n\n\t\t\t\tconst update = getUpdate({\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\t...borderSize,\n\t\t\t\t\t\tborderColor: node.formInputFocusedBorderColor ?? formInputDefaultFocusedBorderColor,\n\t\t\t\t\t\tborderStyle: node.formInputFocusedBorderStyle ?? formInputDefaultFocusedBorderStyle,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tif (isDynamicValue(update.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isNull(update.value)) {\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tformInputFocusedBorderColor: undefined,\n\t\t\t\t\t\tformInputFocusedBorderStyle: undefined,\n\t\t\t\t\t\tformInputFocusedBorderWidth: undefined,\n\t\t\t\t\t})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnode.set(fromBorderValues(update.value))\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleBoxShadowChange = useEngineCallback(\n\t\t(_controlKey: string, getUpdate: (current: BoxShadowControlProp) => BoxShadowControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputFocusedStyles)) {\n\t\t\t\tconst update = getUpdate({\n\t\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\t\tvalue: node.formInputFocusedBoxShadow ?? [],\n\t\t\t\t})\n\n\t\t\t\tif (isDynamicValue(update.value)) continue\n\n\t\t\t\tnode.set({\n\t\t\t\t\tformInputFocusedBoxShadow: update.value,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleAddTransition = useCallback(() => {\n\t\tonChange({ formInputFocusedTransition: getDefaultFocusTransition() })\n\t\tpopoutWindow.navigation.presentPopoutOnRegistration(transitionPopoutId)\n\t}, [onChange])\n\n\tconst reducedBorderValues = toReducedBorderValues({\n\t\tcolor: formInputFocusedBorderColor,\n\t\tstyle: formInputFocusedBorderStyle,\n\t\twidth: formInputFocusedBorderWidth,\n\t})\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.popoverPadding}\n\t\t\tpaddingRight={dimensions.css.popoverPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<ColorControlPropRow\n\t\t\t\tcontrolKey=\"input-focused-background\"\n\t\t\t\tcontrol={{ title: \"Fill\", type: ControlType.Color, optional: true }}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formInputFocusedBackgroundColor ?? null,\n\t\t\t\t\ttype: ControlType.Color,\n\t\t\t\t}}\n\t\t\t\tonChange={handleBackgroundColorChange}\n\t\t\t\tonCopy={copyFill}\n\t\t\t\tonPaste={pasteFill}\n\t\t\t\tcopyEnabled={canCopyFill}\n\t\t\t\tpasteEnabled={canPasteFill}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\n\t\t\t<BorderControlPropRow\n\t\t\t\tcontrolKey=\"input-focused-border\"\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: reducedBorderValues,\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t}}\n\t\t\t\tcontrol={{\n\t\t\t\t\ttitle: \"Border\",\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t\toptional: true,\n\t\t\t\t\tdefaultValue: {\n\t\t\t\t\t\tborderColor: formInputFocusedStylesCreateDefaults.formInputFocusedBorderColor,\n\t\t\t\t\t\tborderStyle: formInputFocusedStylesCreateDefaults.formInputFocusedBorderStyle,\n\t\t\t\t\t\tborderWidth: formInputDefaultFocussedBorderWidthWithoutUnit,\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t\tonChange={handleBorderChange}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tpopoutId=\"input-focused-border\"\n\t\t\t\tsupportsVariables={false}\n\t\t\t\tonCopy={copyBorder}\n\t\t\t\tonPaste={pasteBorder}\n\t\t\t\tcopyEnabled={canCopyBorder}\n\t\t\t\tpasteEnabled={canPasteBorder}\n\t\t\t/>\n\n\t\t\t<BoxShadowControlPropRow\n\t\t\t\tcontrolKey=\"input-focused-box-shadow\"\n\t\t\t\tcontrol={{ title: \"Shadows\", type: ControlType.BoxShadow }}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formInputFocusedBoxShadow,\n\t\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\t}}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonChange={handleBoxShadowChange}\n\t\t\t\tonCopy={copyShadow}\n\t\t\t\tonPaste={pasteShadow}\n\t\t\t\tcopyEnabled={canCopyShadow}\n\t\t\t\tpasteEnabled={canPasteShadow}\n\t\t\t/>\n\n\t\t\t<TransitionRow\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonAdd={handleAddTransition}\n\t\t\t\ttransition={formInputFocusedTransition}\n\t\t\t\ttraitType={TraitType.FormInputFocusedTransition}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport {\n\tborderValueDefaults,\n\tfromBorderReactCSSProperties,\n\tfromReducedNodeBorderTrait,\n\tisBorderValues,\n} from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport type { BorderControlProp, BorderControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport type { ReducedBorderControlProp } from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { isEqual } from \"library/index.ts\"\nimport type { BorderControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNull, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { VariableReferenceButton } from \"../../shared/VariableReferenceButton.tsx\"\nimport { BorderPopoutButton } from \"../panels/BorderPopoutButton.tsx\"\nimport type { PanelRowResetReplicaOverridesOptions } from \"../rows/PanelRow.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { getVariableFromInfo } from \"../useVariableProviderInfo.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport type { ControlPropChangeHandler } from \"./ControlPropRowChangeHandler.ts\"\nimport { supportedVariableTypesByControlType } from \"./utils/supportedVariableTypesByControlType.ts\"\n\ninterface BorderControlPropRowProps extends PanelRowResetReplicaOverridesOptions {\n\tcontrolKey: string\n\tcontrol: BorderControlDescription\n\tcontrolProp: ReducedBorderControlProp\n\tonChange: ControlPropChangeHandler<ControlType.Border>\n\tonContextMenu?: (event: React.MouseEvent<HTMLElement>) => void\n\tnodeIds: NodeID[]\n\tpopoutId: string\n\tsupportsVariables: boolean | undefined\n\tonCopy?: () => void\n\tonPaste?: () => void\n\tpasteEnabled?: boolean | (() => Promise<boolean>)\n\tcopyEnabled?: boolean | (() => boolean)\n}\n\nexport const BorderControlPropRow = React.memo(function BorderControlPropRow({\n\tonChange,\n\tcontrol,\n\tcontrolKey,\n\tcontrolProp,\n\tonContextMenu,\n\tnodeIds,\n\ttraitTypeKeys,\n\tpopoutId,\n\tsupportsVariables,\n\tonCopy,\n\tonPaste,\n\tcopyEnabled,\n\tpasteEnabled,\n}: BorderControlPropRowProps) {\n\tconst isVariableSupported = Boolean(supportsVariables)\n\tconst { value } = controlProp\n\tconst { defaultValue } = control\n\tconst title = control.title || titleCase(controlKey)\n\n\tconst onResetToDefault = useCallback(() => {\n\t\t// getControlProp already handles the case of setting back to the\n\t\t// default value so we do not want to replicate the same logic here, and\n\t\t// therefore we use the mechanism of setting the value to null so\n\t\t// the other code can handle it.\n\t\t// biome-ignore lint/suspicious/noExplicitAny: @TODO add explanation\n\t\tonChange(controlKey, current => ({ ...current, value: null }), nodeIds)\n\t}, [controlKey, nodeIds, onChange])\n\n\tconst updateBorder = useCallback(\n\t\t(getUpdate: (current: BorderValues) => BorderValues) => {\n\t\t\tonChange(\n\t\t\t\tcontrolKey,\n\t\t\t\t(current: BorderControlProp) => {\n\t\t\t\t\tconst update = getUpdate(isBorderValues(current.value) ? current.value : borderValueDefaults)\n\t\t\t\t\treturn { type: ControlType.Border, value: update }\n\t\t\t\t},\n\t\t\t\tnodeIds,\n\t\t\t)\n\t\t},\n\t\t[controlKey, nodeIds, onChange],\n\t)\n\n\tconst updateValue = useCallback(\n\t\t(newValue: BorderControlPropValue) => {\n\t\t\tonChange(controlKey, () => ({ type: ControlType.Border, value: newValue }), nodeIds)\n\t\t},\n\t\t[controlKey, nodeIds, onChange],\n\t)\n\n\tconst onSelectVariable = useCallback(\n\t\t(variable: VariableReference | undefined) => {\n\t\t\tif (isUndefined(variable)) {\n\t\t\t\tonResetToDefault()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tupdateValue(variable)\n\t\t},\n\t\t[onResetToDefault, updateValue],\n\t)\n\n\tconst onRemoveDynamicValue = useCallback(() => {\n\t\tif (!isVariableReference(value)) return\n\t\tconst variable = getVariableFromInfo(value, engine.stores.treeStore.variableProviderInfo)\n\n\t\tif (variable?.type === ControlType.Border && isBorderValues(variable.initialValue)) {\n\t\t\tupdateValue(variable.initialValue)\n\t\t} else {\n\t\t\tupdateValue(borderValueDefaults)\n\t\t}\n\t}, [value, updateValue])\n\n\tconst onCreateVariable = useCallback(() => {\n\t\tconst initialValue = isBorderValues(value) ? fromReducedNodeBorderTrait(value) : undefined\n\n\t\tconst variable = createVariableInScope({\n\t\t\ttype: ControlType.Border,\n\t\t\tengine,\n\t\t\tshowEditor: true,\n\t\t\tname: Dictionary.Border,\n\t\t\tinitialValue,\n\t\t\tscopeId: engine.stores.scopeStore.activeId,\n\t\t})\n\n\t\tif (variable) onSelectVariable(variable)\n\t}, [value, onSelectVariable])\n\n\tconst addBorder = useCallback(() => {\n\t\tconst borderValue = control.defaultValue ? fromBorderReactCSSProperties(control.defaultValue) : borderValueDefaults\n\t\tonChange(controlKey, () => ({ type: ControlType.Border, value: borderValue }), nodeIds)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}, [onChange, controlKey, nodeIds, control, popoutId])\n\n\tconst deleteBorder = useCallback(() => {\n\t\tonChange(controlKey, current => ({ ...current, value: null }), nodeIds)\n\t}, [onChange, controlKey, nodeIds])\n\n\tif (!isFound(value)) return null\n\n\tconst resetToDefaultEnabled =\n\t\t!isUndefined(defaultValue) && !isEqual(value, fromBorderReactCSSProperties(defaultValue))\n\n\treturn (\n\t\t<PanelRow\n\t\t\tsupportsVariables={isVariableSupported}\n\t\t\ttitle={title}\n\t\t\tvariableType={supportedVariableTypesByControlType[ControlType.Border]}\n\t\t\tonSelectVariable={onSelectVariable}\n\t\t\tonRemoveDynamicValue={onRemoveDynamicValue}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tresetToDefaultEnabled={resetToDefaultEnabled}\n\t\t\tdynamicValue={isDynamicValue(defaultValue) ? defaultValue : null}\n\t\t\tonResetToDefault={control.defaultValue ? onResetToDefault : undefined}\n\t\t\tonContextMenu={onContextMenu}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tonCopy={onCopy}\n\t\t\tonPaste={onPaste}\n\t\t\tcopyEnabled={copyEnabled}\n\t\t\tpasteEnabled={pasteEnabled}\n\t\t>\n\t\t\t{isVariableReference(value) ? (\n\t\t\t\t<VariableReferenceButton\n\t\t\t\t\tonRemove={onRemoveDynamicValue}\n\t\t\t\t\texpectedType={supportedVariableTypesByControlType[ControlType.Border]}\n\t\t\t\t\thasError={!isVariableSupported}\n\t\t\t\t\treference={value}\n\t\t\t\t/>\n\t\t\t) : isNull(value) ? (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"border\" onClick={addBorder} />\n\t\t\t) : (\n\t\t\t\t<BorderPopoutButton\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\tonChange={updateBorder}\n\t\t\t\t\tborderStyle={value.borderStyle}\n\t\t\t\t\tborderColor={value.borderColor}\n\t\t\t\t\tborderWidth={value.borderWidth}\n\t\t\t\t\tborderPerSide={value.borderPerSide}\n\t\t\t\t\tborderTop={value.borderTop}\n\t\t\t\t\tborderBottom={value.borderBottom}\n\t\t\t\t\tborderLeft={value.borderLeft}\n\t\t\t\t\tborderRight={value.borderRight}\n\t\t\t\t\tonDelete={control.optional ? deleteBorder : undefined}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PopoutButtonPreviewIconWrapper } from \"document/components/chrome/shared/PopoutButtonPreviewIconWrapper.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\tdefaultCheckedTransition,\n\tdefaultFormInputCheckedBorderWidth,\n\tformCheckboxCheckedEffectDefaults,\n\tformCheckboxCheckedIconDefaults,\n\tformRadioCheckedEffectDefaults,\n\twithFormBooleanInputType,\n} from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport { withFormInputIcon } from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport { isFoundAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedFormBooleanInputType } from \"document/models/CanvasTree/traits/utils/reduceFormBooleanInputType.ts\"\nimport {\n\tparseBorderString,\n\ttoReducedBorderValues,\n} from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport type { ReducedFormInputIcon } from \"document/models/CanvasTree/traits/utils/reduceFormInputIcon.ts\"\nimport { isAnyShadowPropertyMixed } from \"document/models/CanvasTree/traits/utils/reduceShadows.ts\"\nimport type {\n\tBorderControlProp,\n\tBoxShadowControlProp,\n\tColorControlProp,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { EffectPreviewType } from \"document/utils/EffectPreviewType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isNull, isString } from \"utils/typeChecks.ts\"\nimport { BorderControlPropRow } from \"../../codeComponentRows/BorderControlPropRow.tsx\"\nimport { BoxShadowControlPropRow } from \"../../codeComponentRows/BoxShadowControlPropRow.tsx\"\nimport { ColorControlPropRow } from \"../../codeComponentRows/ColorControlPropRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { EffectPreviewIcon } from \"../EffectRows/EffectPreviewIcon.tsx\"\nimport { exitEffectPreview, useExitEffectPreviewOnUnmount } from \"../EffectRows/shared/utils.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { TransitionRow } from \"../TransitionRow.tsx\"\nimport { InputIconRow } from \"./InputIconRow.tsx\"\n\ntype ReducedFormBooleanCheckedStyle = Omit<\n\tReducedFormBooleanInputType,\n\t\"onlyNodesWithBooleanInputType\" | \"formBooleanInputType\" | \"formBooleanInputValue\"\n> &\n\tOmit<ReducedFormInputIcon, \"onlyNodesWithInputIconRow\">\n\ninterface Props extends ReducedFormBooleanCheckedStyle, Pick<ReducedFormBooleanInputType, \"formBooleanInputType\"> {\n\tnodeIds: NodeID[]\n}\n\nfunction hasAnyCheckedStyle(props: ReducedFormBooleanCheckedStyle) {\n\treturn (\n\t\tisFoundAndNotUndefined(props.formInputIconImage) ||\n\t\tisFoundAndNotUndefined(props.formInputIconColor) ||\n\t\tisFoundAndNotUndefined(props.formBooleanInputCheckedBorderColor) ||\n\t\tisFoundAndNotUndefined(props.formBooleanInputCheckedBorderWidth) ||\n\t\tisFoundAndNotUndefined(props.formBooleanInputCheckedBorderStyle) ||\n\t\tisFoundAndNotUndefined(props.formBooleanInputCheckedFillColor) ||\n\t\t(Array.isArray(props.formBooleanInputCheckedBoxShadow) && props.formBooleanInputCheckedBoxShadow.length > 0)\n\t)\n}\n\nfunction canCopy(props: ReducedFormBooleanCheckedStyle) {\n\tif (isMixed(props.formInputIconImage)) return false\n\tif (isMixed(props.formInputIconColor)) return false\n\tif (isMixed(props.formBooleanInputCheckedBorderColor)) return false\n\tif (isMixed(props.formBooleanInputCheckedBorderWidth)) return false\n\tif (isMixed(props.formBooleanInputCheckedBorderStyle)) return false\n\tif (isMixed(props.formBooleanInputCheckedFillColor)) return false\n\tif (isMixed(props.formBooleanInputCheckedBoxShadow)) return false\n\tif (Array.isArray(props.formBooleanInputCheckedBorderColor)) {\n\t\tif (props.formBooleanInputCheckedBorderColor.some(isAnyShadowPropertyMixed)) return false\n\t}\n\n\treturn true\n}\n\nconst popoutId = \"form-boolean-checked-style-popout\"\nconst traits = [TraitType.FormBooleanInputCheckedEffect]\n\nconst setEffectTypePreview = () =>\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.effectStore.enterPreview({ effect: EffectPreviewType.Checked })\n\t})\n\nexport const FormBooleanCheckedEffectRow = React.memo(function FormBooleanCheckedEffectRow({\n\tnodeIds,\n\tformBooleanInputType,\n\t...props\n}: Props) {\n\tconst isCheckbox = formBooleanInputType === \"checkbox\"\n\tconst popoutIsOpen = popoutWindow.navigation.isPresenting(popoutId)\n\n\tconst [canPaste, onPaste, onCopy] = useCopyAndPasteSingleProperty(\n\t\t[TraitType.FormBooleanInputCheckedEffect, TraitType.FormInputIcon],\n\t\tnodeIds,\n\t\t() => canCopy(props),\n\t)\n\n\tuseExitEffectPreviewOnUnmount()\n\n\tconst removeCheckedEffect = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\tnode.set({\n\t\t\t\tformBooleanInputCheckedBorderColor: undefined,\n\t\t\t\tformBooleanInputCheckedBorderWidth: undefined,\n\t\t\t\tformBooleanInputCheckedBorderStyle: undefined,\n\t\t\t\tformBooleanInputCheckedBoxShadow: undefined,\n\t\t\t\tformBooleanInputCheckedFillColor: undefined,\n\t\t\t})\n\t\t}\n\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputIcon)) {\n\t\t\tnode.set({ formInputIconImage: undefined, formInputIconColor: undefined })\n\t\t}\n\n\t\tpopoutWindow.navigation.close()\n\t}, [nodeIds])\n\n\tconst addCheckedEffect = useEngineCallback(() => {\n\t\tconst defaults = isCheckbox ? formCheckboxCheckedEffectDefaults : formRadioCheckedEffectDefaults()\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\tnode.set(defaults)\n\t\t}\n\n\t\tif (isCheckbox) {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputIcon)) {\n\t\t\t\tnode.set(formCheckboxCheckedIconDefaults)\n\t\t\t}\n\t\t}\n\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}, [nodeIds, isCheckbox])\n\n\tconst hasCheckedEffect = hasAnyCheckedStyle(props)\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Checked}\n\t\t\ttraitTypes={traits}\n\t\t\tonDelete={removeCheckedEffect}\n\t\t\tcopyEnabled={() => canCopy(props)}\n\t\t\tpasteEnabled={canPaste}\n\t\t\tonPaste={onPaste}\n\t\t\tonCopy={onCopy}\n\t\t>\n\t\t\t{hasCheckedEffect || popoutIsOpen ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\tid={popoutId}\n\t\t\t\t\tpopout={<CheckedStylePopout {...props} nodeIds={nodeIds} />}\n\t\t\t\t\tnavigationTitle={Dictionary.Checked}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\ttitle=\"Effect\"\n\t\t\t\t\tonDelete={removeCheckedEffect}\n\t\t\t\t\tonPresent={setEffectTypePreview}\n\t\t\t\t\tonDismiss={exitEffectPreview}\n\t\t\t\t\tpreview={\n\t\t\t\t\t\t<PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t\t\t<EffectPreviewIcon />\n\t\t\t\t\t\t</PopoutButtonPreviewIconWrapper>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"effect\" onClick={addCheckedEffect} />\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n\nconst {\n\tformBooleanInputCheckedBorderColor: defaultCheckedBorderColor,\n\tformBooleanInputCheckedBorderWidth: defaultCheckedBorderWidth,\n\tformBooleanInputCheckedBorderStyle: defaultCheckedBorderStyle,\n} = formRadioCheckedEffectDefaults()\n\nconst CheckedStylePopout = React.memo(function CheckedStylePopout({\n\tformInputIconImage,\n\tformInputIconColor,\n\tformBooleanInputCheckedFillColor,\n\tformBooleanInputCheckedBorderColor,\n\tformBooleanInputCheckedBorderWidth,\n\tformBooleanInputCheckedBorderStyle,\n\tformBooleanInputCheckedBoxShadow,\n\tformBooleanInputCheckedTransition,\n\tnodeIds,\n}: Omit<Props, \"formBooleanInputType\">) {\n\tconst handleCheckedFillChange = useEngineCallback(\n\t\t({ value }: ColorControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\t\tnode.set({ formBooleanInputCheckedFillColor: isString(value) ? value : undefined })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleBorderChange = useEngineCallback(\n\t\t(_, getUpdate: (current: BorderControlProp) => BorderControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\t\tconst { value } = getUpdate({\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\t...parseBorderString(node.formBooleanInputCheckedBorderWidth ?? defaultCheckedBorderWidth),\n\t\t\t\t\t\tborderColor: node.formBooleanInputCheckedBorderColor ?? defaultCheckedBorderColor,\n\t\t\t\t\t\tborderStyle: node.formBooleanInputCheckedBorderStyle ?? defaultCheckedBorderStyle,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tif (isDynamicValue(value)) continue\n\n\t\t\t\tif (isNull(value)) {\n\t\t\t\t\tnode.set({\n\t\t\t\t\t\tformBooleanInputCheckedBorderColor: undefined,\n\t\t\t\t\t\tformBooleanInputCheckedBorderWidth: undefined,\n\t\t\t\t\t\tformBooleanInputCheckedBorderStyle: undefined,\n\t\t\t\t\t})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tnode.set({\n\t\t\t\t\tformBooleanInputCheckedBorderColor: value.borderColor,\n\t\t\t\t\tformBooleanInputCheckedBorderWidth: value.borderPerSide\n\t\t\t\t\t\t? `${value.borderTop}px ${value.borderRight}px ${value.borderBottom}px ${value.borderLeft}px`\n\t\t\t\t\t\t: `${value.borderWidth}px`,\n\t\t\t\t\tformBooleanInputCheckedBorderStyle: value.borderStyle,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handleShadowChange = useEngineCallback(\n\t\t(_, getUpdate: (current: BoxShadowControlProp) => BoxShadowControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\t\tconst { value } = getUpdate({\n\t\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\t\tvalue: node.formBooleanInputCheckedBoxShadow ?? [],\n\t\t\t\t})\n\n\t\t\t\tif (isDynamicValue(value)) continue\n\n\t\t\t\tnode.set({\n\t\t\t\t\tformBooleanInputCheckedBoxShadow: value,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst addTransition = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormBooleanInputType)) {\n\t\t\tnode.set({\n\t\t\t\tformBooleanInputCheckedTransition: defaultCheckedTransition(),\n\t\t\t})\n\t\t}\n\t}, [nodeIds])\n\n\tconst reducedBorderValues = toReducedBorderValues({\n\t\tcolor: formBooleanInputCheckedBorderColor,\n\t\twidth: formBooleanInputCheckedBorderWidth,\n\t\tstyle: formBooleanInputCheckedBorderStyle,\n\t})\n\n\treturn (\n\t\t<Stack\n\t\t\tgap={0}\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t>\n\t\t\t<ColorControlPropRow\n\t\t\t\tcontrolKey=\"input-checked-background\"\n\t\t\t\tcontrol={{ title: \"Fill\", type: ControlType.Color, optional: true }}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formBooleanInputCheckedFillColor ?? null,\n\t\t\t\t\ttype: ControlType.Color,\n\t\t\t\t}}\n\t\t\t\tonChange={handleCheckedFillChange}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\t\t\t<BorderControlPropRow\n\t\t\t\tcontrolKey=\"input-checked-border\"\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: reducedBorderValues,\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t}}\n\t\t\t\tcontrol={{\n\t\t\t\t\ttitle: \"Border\",\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t\toptional: true,\n\t\t\t\t\tdefaultValue: {\n\t\t\t\t\t\tborderColor: defaultCheckedBorderColor,\n\t\t\t\t\t\tborderStyle: defaultCheckedBorderStyle,\n\t\t\t\t\t\tborderWidth: defaultFormInputCheckedBorderWidth,\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t\tonChange={handleBorderChange}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tpopoutId=\"input-checked-border\"\n\t\t\t\tsupportsVariables={false}\n\t\t\t/>\n\t\t\t<BoxShadowControlPropRow\n\t\t\t\tcontrolKey=\"input-checked-box-shadow\"\n\t\t\t\tcontrol={{ title: \"Shadows\", type: ControlType.BoxShadow }}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formBooleanInputCheckedBoxShadow,\n\t\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\t}}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonChange={handleShadowChange}\n\t\t\t/>\n\t\t\t<InputIconRow nodeIds={nodeIds} formInputIconImage={formInputIconImage} formInputIconColor={formInputIconColor} />\n\t\t\t<TransitionRow\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonAdd={addTransition}\n\t\t\t\ttransition={formBooleanInputCheckedTransition}\n\t\t\t\ttraitType={TraitType.FormBooleanInputCheckedEffect}\n\t\t\t/>\n\t\t</Stack>\n\t)\n})\n", "import type { AssetReference } from \"@framerjs/assets\"\nimport { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, isMixed } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { PopoutButtonBackgroundPreview } from \"document/components/chrome/shared/PopoutButtonBackgroundPreview.tsx\"\nimport { PopoutButtonWithPreview } from \"document/components/chrome/shared/PopoutButtonWithPreview.tsx\"\nimport { PopoutButtonWithPreviewSuggestion } from \"document/components/chrome/shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { popoutWindow } from \"document/components/chrome/shared/PopoutWindow.tsx\"\nimport { useResolvedImageThumbnail } from \"document/components/utils/useResolvedImageThumbnail.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isFormBooleanInputNode, isFormSelectNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\tdefaultAddedInputIconColor,\n\tdefaultTextInputIconImage,\n\twithFormInputIcon,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport {\n\tinputHasDefaultIcon,\n\twithFormTextInputType,\n} from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport type { ReducedFormInputIcon } from \"document/models/CanvasTree/traits/utils/reduceFormInputIcon.ts\"\nimport type { ColorControlProp, ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport type { ColorControlDescription, ImageControlDescription } from \"library/index.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ColorControlPropRow } from \"../../codeComponentRows/ColorControlPropRow.tsx\"\nimport { ImageControlPropRow } from \"../../codeComponentRows/ImageControlPropRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { PanelRow } from \"../PanelRow.tsx\"\nimport { useFormInputPropertyHandler } from \"./utils.ts\"\n\nconst inputIconPopoutId = \"form-input-icon-popout\"\n\ntype ReducedFormInputIconStyles = Omit<ReducedFormInputIcon, \"onlyNodesWithInputIconRow\">\n\ninterface Props extends ReducedFormInputIconStyles {\n\tnodeIds: NodeID[]\n}\n\nexport const InputIconRow = React.memo(function InputIconRow({\n\tnodeIds,\n\tformInputIconImage,\n\tformInputIconColor,\n}: Props) {\n\tconst [popoutIsOpen, setPopoutIsOpen] = React.useState(popoutWindow.navigation.isPresenting(inputIconPopoutId))\n\tconst defaultColor = React.useMemo(() => getDefaultIconColor(nodeIds), [nodeIds])\n\n\tconst hasImage = isString(formInputIconImage)\n\tconst hasColor = isString(formInputIconColor)\n\tconst hasIcon = hasImage || hasColor\n\tconst previewBackground = useIconPreviewBackground(formInputIconImage, formInputIconColor)\n\n\tconst [canPaste, onPaste, onCopy] = useCopyAndPasteSingleProperty(TraitType.FormInputIcon, nodeIds, () =>\n\t\tcanCopy({ formInputIconImage, formInputIconColor }),\n\t)\n\tconst removeIcon = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputIcon)) {\n\t\t\tnode.set({ formInputIconImage: undefined, formInputIconColor: undefined })\n\t\t}\n\n\t\t// If the user removes the icon, we want to dismiss the popout and update the row preview immediately.\n\t\t// PopoutNavigation.dismiss() will pop the current popout even if the specified id is not presented. And we\n\t\t// don't want to dismiss the checked style popout when removing the icon inside. Therefore we double check\n\t\t// popoutIsOpen.\n\t\tif (popoutIsOpen) {\n\t\t\tpopoutWindow.navigation.dismiss(inputIconPopoutId)\n\t\t}\n\t}, [nodeIds, popoutIsOpen])\n\n\tconst addIcon = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputIcon)) {\n\t\t\tconst isTextInput = withFormTextInputType(node) && node.formTextInputType === \"text\"\n\t\t\tnode.set({\n\t\t\t\tformInputIconImage: isTextInput ? defaultTextInputIconImage : undefined,\n\t\t\t\tformInputIconColor: defaultColor,\n\t\t\t})\n\t\t}\n\n\t\t// When adding an icon on a radio, we don't set a default color (because it won't work well without a mask as we\n\t\t// don't have a fallback). But we would still want to present an empty popout, thus flipping the state here so\n\t\t// that it will render.\n\t\tsetPopoutIsOpen(true)\n\t\tpopoutWindow.navigation.presentPopout(inputIconPopoutId)\n\t}, [nodeIds, defaultColor])\n\n\tconst checkIconPopoutIsOpen = React.useCallback((presenting: boolean) => {\n\t\t// We use popoutIsOpen to keep the icon popout open when the user removes both the image and color. But if the\n\t\t// user navigates back to the previous popout, which won't trigger a re-render, but we need to check if we\n\t\t// should still render the popout row preview. Ideally, we would use the popoutWindow.navigation.isPresenting()\n\t\t// to poll the latest state, but the way the PopoutNavigation component is implemented decides that the state\n\t\t// might not be up to date at the moment onPresent/onDismiss is fired. Therefore we manually update the state\n\t\t// here.\n\t\tsetPopoutIsOpen(presenting)\n\t}, [])\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Icon}\n\t\t\ttraitTypes={[TraitType.FormInputIcon]}\n\t\t\tonDelete={removeIcon}\n\t\t\tcopyEnabled={() => canCopy({ formInputIconImage, formInputIconColor })}\n\t\t\tpasteEnabled={canPaste}\n\t\t\tonPaste={onPaste}\n\t\t\tonCopy={onCopy}\n\t\t>\n\t\t\t{hasIcon || popoutIsOpen ? (\n\t\t\t\t<PopoutButtonWithPreview\n\t\t\t\t\ttitle={getPopoutButtonTitle(nodeIds)}\n\t\t\t\t\tid={inputIconPopoutId}\n\t\t\t\t\tpopout={\n\t\t\t\t\t\t<InputIconPopout\n\t\t\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\t\t\tformInputIconImage={formInputIconImage}\n\t\t\t\t\t\t\tformInputIconColor={formInputIconColor}\n\t\t\t\t\t\t\tdefaultColor={defaultColor}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tdisplayDivider\n\t\t\t\t\tnavigationTitle={Dictionary.Icon}\n\t\t\t\t\tonDelete={removeIcon}\n\t\t\t\t\tonDismiss={() => checkIconPopoutIsOpen(false)}\n\t\t\t\t\tonPresent={() => checkIconPopoutIsOpen(true)}\n\t\t\t\t\tpreview={<PopoutButtonBackgroundPreview background={previewBackground} />}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"icon\" onClick={addIcon} />\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n\nconst useIconPreviewBackground = (\n\tformInputIconImage: Props[\"formInputIconImage\"],\n\tformInputIconColor: Props[\"formInputIconColor\"],\n) => {\n\tconst hasImage = isString(formInputIconImage)\n\tconst resolvedImage = useResolvedImageThumbnail(hasImage ? formInputIconImage : undefined)\n\tif (resolvedImage) return resolvedImage\n\n\tif (isString(formInputIconColor)) {\n\t\treturn formInputIconColor\n\t}\n\n\treturn \"transparent\"\n}\n\nconst imageControlDescription: ImageControlDescription = { title: \"Image\", type: ControlType.Image }\nconst colorControlDescription: ColorControlDescription = { title: \"Color\", type: ControlType.Color, optional: true }\n\nconst InputIconPopout = React.memo(function InputIconPopout(props: Props & { defaultColor: string | undefined }) {\n\tconst { nodeIds, formInputIconImage, formInputIconColor, defaultColor } = props\n\tconst updateFormInputIconImage = useFormInputPropertyHandler(\"formInputIconImage\", nodeIds)\n\tconst updateFormInputIconColor = useFormInputPropertyHandler(\"formInputIconColor\", nodeIds)\n\n\tconst handleFormIconUpload = useEngineCallback(\n\t\t(_: string, getUpdate: (current: ImageControlProp) => ImageControlProp) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputIcon)) {\n\t\t\t\tconst { value } = getUpdate({ type: ControlType.Image, value: node.formInputIconImage })\n\t\t\t\t// Input icon cannot be dynamic at the moment.\n\t\t\t\tif (isDynamicValue(value)) continue\n\n\t\t\t\tif (!value && withFormTextInputType(node) && !inputHasDefaultIcon(node.formTextInputType)) {\n\t\t\t\t\tnode.set({ formInputIconImage: value, formInputIconColor: undefined })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnode.set({ formInputIconImage: value })\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst uploadImage = React.useCallback(\n\t\tasync (upload: Promise<AssetReference | null>) => {\n\t\t\tconst reference = await upload\n\t\t\tif (!reference) return\n\n\t\t\t// Update the nodes after the image is uploaded.\n\t\t\tupdateFormInputIconImage(reference)\n\t\t},\n\t\t[updateFormInputIconImage],\n\t)\n\n\tconst handleChangeFormInputIconColor = React.useCallback(\n\t\t({ value }: ColorControlProp) => {\n\t\t\tupdateFormInputIconColor(isString(value) ? value : undefined)\n\t\t},\n\t\t[updateFormInputIconColor],\n\t)\n\n\treturn (\n\t\t<Stack\n\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\tpaddingRight={dimensions.css.panelPadding}\n\t\t\tpaddingBottom={dimensions.css.inputSpacing}\n\t\t\tpaddingTop={dimensions.css.inputSpacing}\n\t\t\tgap={0}\n\t\t>\n\t\t\t<ImageControlPropRow\n\t\t\t\tcontrolKey=\"input-icon-image\"\n\t\t\t\tcontrol={imageControlDescription}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formInputIconImage,\n\t\t\t\t\ttype: ControlType.Image,\n\t\t\t\t}}\n\t\t\t\tonChange={handleFormIconUpload}\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t\tonUpload={uploadImage}\n\t\t\t/>\n\t\t\t<ColorControlPropRow\n\t\t\t\tcontrolKey=\"input-icon-color\"\n\t\t\t\tcontrol={colorControlDescription}\n\t\t\t\tcontrolProp={{\n\t\t\t\t\tvalue: formInputIconColor ?? null,\n\t\t\t\t\ttype: ControlType.Color,\n\t\t\t\t}}\n\t\t\t\tdefaultValue={defaultColor}\n\t\t\t\tonChange={handleChangeFormInputIconColor}\n\t\t\t\tpreviewType=\"color\"\n\t\t\t\tnodeIds={nodeIds}\n\t\t\t/>\n\t\t</Stack>\n\t)\n})\n\nfunction canCopy(props: ReducedFormInputIconStyles) {\n\tif (isMixed(props.formInputIconImage)) return false\n\tif (isMixed(props.formInputIconColor)) return false\n\n\treturn true\n}\n\nfunction getDefaultIconColor(nodeIds: NodeID[]): string | undefined {\n\tif (nodeIds.length !== 1) return defaultAddedInputIconColor\n\tconst id = nodeIds[0]\n\tassert(id, \"nodeId must be defined\")\n\tconst node = engine.tree.getNode(id)\n\tassert(node && withFormInputIcon(node), \"node must support form input icon\")\n\n\tif (isFormBooleanInputNode(node)) {\n\t\tif (node.formBooleanInputType === \"checkbox\") return \"rgba(255, 255, 255, 1)\"\n\t\treturn undefined\n\t}\n\n\treturn defaultAddedInputIconColor\n}\n\nfunction getPopoutButtonTitle(nodeIds: NodeID[]): string {\n\tif (nodeIds.length !== 1) return Dictionary.Icon\n\tconst id = nodeIds[0]\n\tassert(id, \"nodeId must be defined\")\n\tconst node = engine.tree.getNode(id)\n\tassert(node && withFormInputIcon(node), \"node must support form input icon\")\n\n\tif (isFormSelectNode(node)) return \"Caret\"\n\tif (isFormBooleanInputNode(node)) return \"Check\"\n\tif (withFormTextInputType(node)) {\n\t\tswitch (node.formTextInputType) {\n\t\t\tcase \"date\":\n\t\t\t\treturn \"Date\"\n\t\t\tcase \"time\":\n\t\t\t\treturn \"Time\"\n\t\t\tdefault:\n\t\t\t\treturn Dictionary.Icon\n\t\t}\n\t}\n\n\treturn Dictionary.Icon\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { ReducedFormInputInvalidStyles } from \"document/models/CanvasTree/traits/utils/reduceFormInputInvalidStyles.ts\"\nimport type { ReducedFormSelect } from \"document/models/CanvasTree/traits/utils/reduceFormSelect.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ColorControlPropRow } from \"../../codeComponentRows/ColorControlPropRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { useFormInputPropertyHandler } from \"./utils.ts\"\n\ninterface Props\n\textends\n\t\tPick<ReducedFormInputInvalidStyles, \"formInputInvalidTextColor\">,\n\t\tPick<ReducedFormSelect, \"onlyNodesWithSelect\"> {\n\treadOnly: boolean\n\tnodeIds: NodeID[]\n}\n\nexport function InputInvalidTextColorRow({ nodeIds, formInputInvalidTextColor, onlyNodesWithSelect }: Props) {\n\tconst canCopy = isString(formInputInvalidTextColor)\n\n\tconst [canPaste, paste, copy] = useCopyAndPasteSingleProperty(TraitType.FormInputInvalidTextColor, nodeIds, canCopy)\n\tconst updateFormInputInvalidTextColor = useFormInputPropertyHandler(\"formInputInvalidTextColor\", nodeIds)\n\n\tconst handleColorChange = useCallback(\n\t\t({ value }: ControlProp) => {\n\t\t\tassert(isString(value), \"expected a string\")\n\t\t\tupdateFormInputInvalidTextColor(value)\n\t\t},\n\t\t[updateFormInputInvalidTextColor],\n\t)\n\n\treturn (\n\t\t<ColorControlPropRow\n\t\t\tcontrolKey=\"invalid-text-color\"\n\t\t\tcontrol={{\n\t\t\t\ttitle: onlyNodesWithSelect ? Dictionary.Placeholder : Dictionary.Invalid,\n\t\t\t\ttype: ControlType.Color,\n\t\t\t}}\n\t\t\tcontrolProp={{\n\t\t\t\tvalue: formInputInvalidTextColor ?? null,\n\t\t\t\ttype: ControlType.Color,\n\t\t\t}}\n\t\t\tonChange={handleColorChange}\n\t\t\tonCopy={copy}\n\t\t\tnodeIds={nodeIds}\n\t\t\tonPaste={paste}\n\t\t\tcopyEnabled={canCopy}\n\t\t\tpasteEnabled={canPaste}\n\t\t/>\n\t)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { WithFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport { withFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport type { ReducedFormInputPlaceholder } from \"document/models/CanvasTree/traits/utils/reduceFormInputPlaceholder.ts\"\nimport type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { useCallback } from \"react\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ColorControlPropRow } from \"../../codeComponentRows/ColorControlPropRow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../../panels/utils/useCopyAndPasteSingleProperty.ts\"\n\ninterface Props extends Pick<ReducedFormInputPlaceholder, \"formInputPlaceholderColor\"> {\n\treadOnly: boolean\n\tnodeIds: NodeID[]\n}\n\nexport function InputPlaceholderColorRow({ nodeIds, formInputPlaceholderColor }: Props) {\n\tconst canCopyPlaceholderColor = isString(formInputPlaceholderColor)\n\n\tconst [canPastePlaceholderColor, pastePlaceholderColor, copyPlaceholderColor] = useCopyAndPasteSingleProperty(\n\t\tTraitType.FormPlaceholderColor,\n\t\tnodeIds,\n\t\tcanCopyPlaceholderColor,\n\t)\n\n\tconst onChangeInputPlaceholderStyles = useEngineCallback(\n\t\t(update: Partial<WithFormInputPlaceholder>) => {\n\t\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withFormInputPlaceholder)) {\n\t\t\t\tnode.set(update)\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst handlePlaceholderColorChange = useCallback(\n\t\t({ value }: ControlProp) => {\n\t\t\tassert(isString(value), \"expected a string\")\n\t\t\tonChangeInputPlaceholderStyles({ formInputPlaceholderColor: value })\n\t\t},\n\t\t[onChangeInputPlaceholderStyles],\n\t)\n\n\treturn (\n\t\t<ColorControlPropRow\n\t\t\tcontrolKey=\"placeholder-color\"\n\t\t\tcontrol={{ title: \"Placeholder\", type: ControlType.Color }}\n\t\t\tcontrolProp={{\n\t\t\t\tvalue: formInputPlaceholderColor ?? null,\n\t\t\t\ttype: ControlType.Color,\n\t\t\t}}\n\t\t\tonChange={handlePlaceholderColorChange}\n\t\t\tonCopy={copyPlaceholderColor}\n\t\t\tonPaste={pastePlaceholderColor}\n\t\t\tcopyEnabled={canCopyPlaceholderColor}\n\t\t\tnodeIds={nodeIds}\n\t\t\tpasteEnabled={canPastePlaceholderColor}\n\t\t/>\n\t)\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed, shouldBeNever } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype ImageRenderingValue,\n\ttype WithImageRendering,\n\timageRenderingValueToTitle,\n\ttoImageRenderingValue,\n\twithImageRendering,\n} from \"document/models/CanvasTree/traits/WithImageRendering.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedImageRendering } from \"document/models/CanvasTree/traits/utils/reduceImageRendering.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { imageRenderingVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"image-rendering-popout\"\n\nconst imageRenderingControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"imageRendering\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface ImageRenderingRowProps extends Omit<ReducedImageRendering, \"anyNodesWithImageRendering\"> {\n\tnodeIds: NodeID[]\n}\nconst traitTypeKeys: (keyof WithImageRendering)[] = [\"imageRendering\"]\n\nexport const ImageRenderingRow = React.memo(function ImageRenderingRow({\n\tonlyNodesWithImageRendering,\n\tnodeIds,\n\timageRendering,\n}: ImageRenderingRowProps): JSX.Element | null {\n\tconst canCopyImageRendering = !isDynamicValue(imageRendering) && !isMixed(imageRendering)\n\tconst [canPasteImageRendering, pasteImageRendering, copyImageRendering] = useCopyAndPasteSingleProperty(\n\t\tTraitType.ImageRendering,\n\t\tnodeIds,\n\t\tcanCopyImageRendering,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: ImageRenderingValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withImageRendering)\n\t\t\tnodes.forEach(node => node.set({ imageRendering: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withImageRendering)\n\t\t\tnodes.forEach(node => node.set({ imageRendering: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...imageRenderingVariableDefinition,\n\t\t\t\tinitialValue: toImageRenderingValue(imageRendering),\n\t\t\t})\n\n\t\t\tif (!variableRef) return\n\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[imageRendering, updateDynamicValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(imageRendering)) return\n\t\tif (isVariableReference(imageRendering)) {\n\t\t\tconst variableValue = getVariableValue(engine, imageRendering)\n\t\t\tconst imageRenderingValue = toImageRenderingValue(variableValue)\n\t\t\tupdateValue(imageRenderingValue)\n\t\t} else if (isComputedValue(imageRendering)) {\n\t\t\tupdateValue(\"auto\")\n\t\t} else {\n\t\t\tshouldBeNever(imageRendering)\n\t\t}\n\t}, [imageRendering, updateValue])\n\n\tconst deleteRow = useCallback(() => {\n\t\tupdateValue(undefined)\n\t}, [updateValue])\n\n\tif (isNotFound(imageRendering) || isUndefined(imageRendering) || !onlyNodesWithImageRendering) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Image}\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(imageRendering) ? imageRendering : null}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonDelete={deleteRow}\n\t\t\tonCopy={copyImageRendering}\n\t\t\tonPaste={pasteImageRendering}\n\t\t\tcopyEnabled={canCopyImageRendering}\n\t\t\tpasteEnabled={canPasteImageRendering}\n\t\t\tcontrolKey={imageRenderingControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={imageRenderingControlReferenceInfo.controlSourceIdentifier}\n\t\t>\n\t\t\t{isDynamicValue(imageRendering) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={Dictionary.Image}\n\t\t\t\t\tvalue={imageRendering}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tnodeIds={nodeIds}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"imageRendering\")}\n\t\t\t\t\tcontrolReferenceInfo={imageRenderingControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={\"auto\" as const}\n\t\t\t\t\t\ttitle={imageRenderingValueToTitle(\"auto\")}\n\t\t\t\t\t\tselected={imageRendering === \"auto\"}\n\t\t\t\t\t\tonSelect={updateValue}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={\"pixelated\" as const}\n\t\t\t\t\t\ttitle={imageRenderingValueToTitle(\"pixelated\")}\n\t\t\t\t\t\tselected={imageRendering === \"pixelated\"}\n\t\t\t\t\t\tonSelect={updateValue}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { NumberInputWithTicker, Slider } from \"@framerjs/fresco\"\nimport { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { BooleanShapeNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isBooleanShapeNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport type { ReducedOpacity } from \"document/models/CanvasTree/traits/utils/reduceOpacity.ts\"\nimport { getNodePropertyControlDescription } from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType, type NumberControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst opacityTraitTypes = [TraitType.Opacity]\n\nconst popoutId = \"opacityValueTransform\"\n\ninterface Props extends ReducedOpacity {\n\tnodeIds: NodeID[]\n}\n\nexport const OpacityRow = React.memo(function OpacityRow(props: Props) {\n\tconst { opacity, nodeIds } = props\n\n\tconst canCopyOpacity = !isMixed(opacity) && isClipboardSupported()\n\tconst [canPasteOpacity, pasteOpacity, copyOpacity] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Opacity,\n\t\tnodeIds,\n\t\tcanCopyOpacity,\n\t)\n\n\t// BooleanShapeNodes and its descendants must share the opacity value between them, so whenever\n\t// the BooleanShapeNode or one of its descendants is updated, we need to update the opacity values for\n\t// the containing BooleanShapeNode and all its children.\n\tconst update = useEngineCallback(\n\t\t(newOpacity: number | DynamicValue) => {\n\t\t\tconst nodeIdsSet = new Set<NodeID>(nodeIds)\n\t\t\tconst shapesToUpdate = new Set<NodeID>()\n\n\t\t\tengine.tree.getNodesWithTrait(nodeIds, withOpacity).forEach(node => {\n\t\t\t\tnode.set({ opacity: newOpacity })\n\n\t\t\t\t// If the current node is a BooleanShapeNode, we need to update all of its descendants\n\t\t\t\t// that are not in the nodeIds array.\n\t\t\t\tif (isBooleanShapeNode(node)) {\n\t\t\t\t\tcollectBooleanShapesToUpdate(node, nodeIdsSet, shapesToUpdate)\n\t\t\t\t}\n\n\t\t\t\t// If the current node is a descendant of a BooleanShapeNode, we need to update its parent\n\t\t\t\t// and its siblings that are not in the nodeIds array.\n\t\t\t\tconst parent = engine.tree.getNode(node.parentid)\n\t\t\t\tif (parent && isBooleanShapeNode(parent)) {\n\t\t\t\t\tshapesToUpdate.add(parent.id)\n\t\t\t\t\tcollectBooleanShapesToUpdate(parent, nodeIdsSet, shapesToUpdate)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tif (shapesToUpdate.size > 0) {\n\t\t\t\tengine.tree.getNodesWithTrait(Array.from(shapesToUpdate), withOpacity).forEach(node => {\n\t\t\t\t\tnode.set({ opacity: newOpacity })\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst createVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Number,\n\t\t\tname: \"opacity\",\n\t\t\tinitialValue: isNumber(opacity) ? opacity : 1,\n\t\t\toptions: { min: 0, max: 1, step: 0.01 },\n\t\t})\n\t\tif (!variableRef) return\n\t\tupdate(variableRef)\n\t})\n\n\tconst removeDynamicValue = engine.scheduler.wrapHandler(() => {\n\t\tif (!isDynamicValue(opacity)) return\n\t\tif (isVariableReference(opacity)) {\n\t\t\tconst variableValue = getVariableValue(engine, opacity)\n\t\t\tconst opacityValue = isNumber(variableValue) ? Math.max(0, Math.min(1, variableValue)) : 1\n\t\t\tupdate(opacityValue)\n\t\t} else if (isComputedValue(opacity)) {\n\t\t\tupdate(1)\n\t\t} else {\n\t\t\tshouldBeNever(opacity)\n\t\t}\n\t})\n\n\tconst setDynamicValueAndOpenPopout = (newOpacity: DynamicValue) => {\n\t\tupdate(newOpacity)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst supportsVariables = useSupportsVariable(\"opacity\")\n\n\tif (isNotFound(opacity)) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle={Dictionary.Opacity}\n\t\t\tvariableType={ControlType.Number}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(opacity) ? opacity : null}\n\t\t\tonSelectVariable={update}\n\t\t\ttraitTypes={opacityTraitTypes}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tonCopy={copyOpacity}\n\t\t\tcopyEnabled={canCopyOpacity}\n\t\t\tonPaste={pasteOpacity}\n\t\t\tpasteEnabled={canPasteOpacity}\n\t\t\tsupportsComputedValues={supportsVariables}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(opacity) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle={Dictionary.Opacity}\n\t\t\t\t\tvalue={opacity}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={opacityControl}\n\t\t\t\t\texpectedType={ControlType.Number}\n\t\t\t\t\tpopoutId=\"opacityValueTransform\"\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={update}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\tvalue={opacity}\n\t\t\t\t\t\tonChange={update}\n\t\t\t\t\t\tmin={opacityControl.min}\n\t\t\t\t\t\tmax={opacityControl.max}\n\t\t\t\t\t\tstep={opacityControl.step}\n\t\t\t\t\t\tdefaultValue={opacityControl.defaultValue}\n\t\t\t\t\t/>\n\t\t\t\t\t<Slider value={opacity} step={opacityControl.step} max={opacityControl.max} onChange={update} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n\nfunction collectBooleanShapesToUpdate(node: BooleanShapeNode, nodeIdsSet: Set<NodeID>, shapeSet: Set<NodeID>) {\n\tnode.children.forEach(child => {\n\t\tif (!nodeIdsSet.has(child.id)) {\n\t\t\tshapeSet.add(child.id)\n\t\t}\n\t})\n}\n\nconst opacityControl = getNodePropertyControlDescription(\"opacity\") as NumberControlDescription\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { PointerEventsValue, WithPointerEvents } from \"document/models/CanvasTree/traits/WithPointerEvents.ts\"\nimport {\n\tisPointerEventsValue,\n\tpointerEventsValues,\n\twithPointerEvents,\n} from \"document/models/CanvasTree/traits/WithPointerEvents.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedPointerEvents } from \"document/models/CanvasTree/traits/utils/reducePointerEvents.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { pointerEventsVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"pointer-events-popout\"\n\nconst pointerEventsControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"pointerEvents\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface PointerEventsRowProps extends Omit<ReducedPointerEvents, \"anyNodeWithPointerEvents\"> {\n\tnodeIds: NodeID[]\n}\nconst traitTypeKeys: (keyof WithPointerEvents)[] = [\"pointerEvents\"]\n\nexport const PointerEventsRow = React.memo(function PointerEventsRow({\n\tonlyNodesWithPointerEvents,\n\tnodeIds,\n\tpointerEvents,\n}: PointerEventsRowProps): JSX.Element | null {\n\tconst canCopyPointerEvents = !isMixed(pointerEvents)\n\tconst [canPastePointerEvents, pastePointerEvents, copyPointerEvents] = useCopyAndPasteSingleProperty(\n\t\tTraitType.PointerEvents,\n\t\tnodeIds,\n\t\tcanCopyPointerEvents,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: PointerEventsValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withPointerEvents)\n\t\t\tnodes.forEach(node => node.set({ pointerEvents: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withPointerEvents)\n\t\t\tnodes.forEach(node => node.set({ pointerEvents: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isPointerEventsValue(pointerEvents) ? pointerEvents : \"auto\",\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...pointerEventsVariableDefinition,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[pointerEvents, updateDynamicValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withPointerEvents)) {\n\t\t\tif (!isDynamicValue(node.pointerEvents)) continue\n\n\t\t\tconst resolvedValue = isVariableReference(pointerEvents) ? getVariableValue(engine, pointerEvents) : undefined\n\n\t\t\tnode.set({ pointerEvents: isPointerEventsValue(resolvedValue) ? resolvedValue : \"none\" })\n\t\t}\n\t}, [nodeIds, pointerEvents])\n\n\tif (isNotFound(pointerEvents) || isUndefined(pointerEvents) || !onlyNodesWithPointerEvents) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Pointer\"\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(pointerEvents) ? pointerEvents : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tcontrolKey={pointerEventsControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={pointerEventsControlReferenceInfo.controlSourceIdentifier}\n\t\t\tonDelete={() => updateValue(undefined)}\n\t\t\tonCopy={copyPointerEvents}\n\t\t\tonPaste={pastePointerEvents}\n\t\t\tcopyEnabled={canCopyPointerEvents}\n\t\t\tpasteEnabled={canPastePointerEvents}\n\t\t>\n\t\t\t{isDynamicValue(pointerEvents) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Pointer\"\n\t\t\t\t\tvalue={pointerEvents}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"pointerEvents\")}\n\t\t\t\t\tcontrolReferenceInfo={pointerEventsControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton mixed={isMixed(pointerEvents)}>\n\t\t\t\t\t\t{pointerEventsValues.map(value => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={value}\n\t\t\t\t\t\t\t\t\tidentifier={value}\n\t\t\t\t\t\t\t\t\ttitle={titleCase(value)}\n\t\t\t\t\t\t\t\t\tselected={value === pointerEvents}\n\t\t\t\t\t\t\t\t\tonSelect={updateValue}\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</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { PanelRow } from \"document/components/chrome/properties/rows/PanelRow.tsx\"\nimport engine from \"document/engine.ts\"\nimport type { AnyLayoutTemplateNode, CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { type WithOverflow, allOverflowKeys, withOverflow } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { WithPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport { withPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport type { WithZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport { getDefaultZIndex, isValidZIndex, withZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport {\n\tcanBePositionAbsolute,\n\tcanBePositionFixed,\n\tcanBePositionSticky,\n\tscopeTypeSupportsPositionFixed,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport type { PositionType, ReducedPositionType } from \"document/models/CanvasTree/traits/utils/reducePositionType.ts\"\nimport { updateNodeConstraintsForPosition } from \"document/models/CanvasTree/traits/utils/updateConstraintsForPosition.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\n\nconst traitTypes = [TraitType.PositionType]\ninterface Props extends Pick<ReducedPositionType, \"positionTypes\"> {\n\tnodeIds: NodeID[]\n\tonlyNodesWithPositionFixed: boolean\n\tonlyNodesInsideStackOrGrid: boolean\n\tonlyShapeNodes: boolean\n\tscopeType: ScopeType\n\ttitle?: string\n}\ntype PositionTypeUpdate = Partial<WithPositionType> & Partial<WithZIndex>\n\nconst positions: PositionType[] = [\"absolute\", \"relative\", \"fixed\", \"sticky\"]\n\nexport const PositionTypeRow = React.memo(function PositionTypeRow({\n\tnodeIds,\n\tscopeType,\n\tonlyNodesWithPositionFixed,\n\tonlyNodesInsideStackOrGrid,\n\tonlyShapeNodes,\n\tpositionTypes,\n\ttitle = \"Type\",\n}: Props) {\n\tfunction typeIsEnabled(type: PositionType) {\n\t\tswitch (type) {\n\t\t\tcase \"fixed\":\n\t\t\t\treturn onlyNodesWithPositionFixed && scopeTypeSupportsPositionFixed(scopeType)\n\t\t\tcase \"sticky\":\n\t\t\t\treturn onlyNodesInsideStackOrGrid && !onlyShapeNodes\n\t\t\tcase \"relative\":\n\t\t\t\treturn onlyNodesInsideStackOrGrid\n\t\t\tcase \"absolute\":\n\t\t\t\treturn true\n\t\t\tdefault:\n\t\t\t\treturn !onlyNodesInsideStackOrGrid\n\t\t}\n\t}\n\n\treturn (\n\t\t<PanelRow title={title} traitTypes={traitTypes}>\n\t\t\t<PopupButton wrapperClassName={doubleColumnClass}>\n\t\t\t\t{positions.map(type => (\n\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\tkey={type}\n\t\t\t\t\t\tidentifier={type}\n\t\t\t\t\t\ttitle={titleCase}\n\t\t\t\t\t\tenabled={typeIsEnabled(type)}\n\t\t\t\t\t\tvisible={true}\n\t\t\t\t\t\tselected={positionTypes.has(type)}\n\t\t\t\t\t\tonSelect={() => handleUpdatePositionType(type, nodeIds)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</PopupButton>\n\t\t</PanelRow>\n\t)\n})\n\nexport async function handleUpdatePositionType(positionType: PositionType, nodeIds: NodeID[]) {\n\tconst positionTypeUpdates = collectPositionTypeUpdates(positionType, nodeIds)\n\tconst nodesToUpdatePositionType = [...positionTypeUpdates.keys()]\n\n\t// If the new position type is \"sticky\", collect all ancestors and layout templates that need\n\t// their overflow updated from hidden to clip, so that position sticky works as expected.\n\tconst needToUpdateAncestorsOverflow = positionType === \"sticky\"\n\tconst ancestorNodesToUpdate = needToUpdateAncestorsOverflow\n\t\t? collectUniqueAncestors(nodesToUpdatePositionType)\n\t\t: new Set<CanvasNode>()\n\tconst layoutTemplatesBreakpointsToUpdate = needToUpdateAncestorsOverflow\n\t\t? await collectLayoutTemplatesBreakpoints(ancestorNodesToUpdate)\n\t\t: new Set<CanvasNode>()\n\n\t// Process all updates at once, after async collecting the layout template breakpoints, to\n\t// avoid having to use engine.undoGroups or engine.processWhenReadyAsync\n\tengine.scheduler.process(() => {\n\t\t// Update nodes position type\n\t\tpositionTypeUpdates.forEach((update, node) => {\n\t\t\tnode.set(updateWithDefaultZIndex(update, positionType, node))\n\t\t})\n\n\t\tupdateOriginalAndReplicaNodesConstraintsOnPositionTypeUpdate(nodesToUpdatePositionType, positionType)\n\n\t\t// Update overflow of collected ancestor nodes\n\t\tfor (const node of ancestorNodesToUpdate) {\n\t\t\tupdateOverflowsFromHiddenToClip(node)\n\t\t}\n\t\t// Update overflow of collected layout template breakpoints\n\t\tfor (const breakpoint of layoutTemplatesBreakpointsToUpdate) {\n\t\t\tupdateOverflowsFromHiddenToClip(breakpoint)\n\t\t}\n\t})\n}\n\nfunction collectPositionTypeUpdates(\n\ttype: PositionType,\n\tnodeIds: NodeID[],\n): Map<CanvasNode & WithPositionType, PositionTypeUpdate> {\n\tconst positionTypeUpdates = new Map<CanvasNode & WithPositionType, PositionTypeUpdate>()\n\n\t// Collect position-type updates for each selected node\n\tengine.tree.getNodesWithTrait(nodeIds, withPositionType).forEach(node => {\n\t\tconst update: PositionTypeUpdate = {}\n\n\t\tconst wasFixed = node.position === \"fixed\"\n\t\tconst wasSticky = node.position === \"sticky\"\n\n\t\tswitch (type) {\n\t\t\tcase \"fixed\":\n\t\t\t\tif (!canBePositionFixed(engine.tree, node)) return\n\t\t\t\tupdate.position = \"fixed\"\n\t\t\t\tif (!wasFixed) record(\"site_position_fixed_add\", {})\n\t\t\t\tbreak\n\t\t\tcase \"absolute\":\n\t\t\t\tupdate.position = canBePositionAbsolute(node) ? \"absolute\" : undefined\n\t\t\t\tbreak\n\t\t\tcase \"sticky\":\n\t\t\t\tif (!canBePositionSticky(node)) return\n\t\t\t\tupdate.position = \"sticky\"\n\n\t\t\t\tif (\n\t\t\t\t\tnode.positionStickyTop === undefined &&\n\t\t\t\t\tnode.positionStickyRight === undefined &&\n\t\t\t\t\tnode.positionStickyBottom === undefined &&\n\t\t\t\t\tnode.positionStickyLeft === undefined\n\t\t\t\t) {\n\t\t\t\t\tupdate.positionStickyTop = 0\n\t\t\t\t}\n\n\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\tid: `sticky_position_enabled`,\n\t\t\t\t\tpage: MetricsInteractionViews.PROPERTIES_PANEL,\n\t\t\t\t})\n\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tupdate.position = undefined\n\t\t\t\tbreak\n\t\t}\n\n\t\tif (type !== \"fixed\" && wasFixed) record(\"site_position_fixed_remove\", {})\n\t\tif (type !== \"sticky\" && wasSticky) {\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tid: `sticky_position_disabled`,\n\t\t\t\tpage: MetricsInteractionViews.PROPERTIES_PANEL,\n\t\t\t})\n\t\t}\n\t\tpositionTypeUpdates.set(node, update)\n\t})\n\n\treturn positionTypeUpdates\n}\n\nfunction updateWithDefaultZIndex(update: PositionTypeUpdate, type: PositionType, node: CanvasNode): PositionTypeUpdate {\n\tif (!withZIndex(node) || isVariant(node)) return update\n\tif (type !== \"absolute\" && type !== \"fixed\" && type !== \"sticky\") return update\n\tif (!isUndefined(node.zIndex) && isValidZIndex(node.zIndex, type === \"sticky\", hasFloatingPosition(node))) {\n\t\treturn update\n\t}\n\n\treturn {\n\t\t...update,\n\t\tzIndex: getDefaultZIndex(true, hasFloatingPosition(node)),\n\t}\n}\n\nfunction updateOriginalAndReplicaNodesConstraintsOnPositionTypeUpdate(\n\tnodes: (CanvasNode & WithPositionType)[],\n\tposition: PositionType,\n) {\n\tfor (const node of nodes) {\n\t\tconst parent = engine.tree.getParent(node.id)\n\t\tif (!parent) continue\n\t\tupdateNodeConstraintsForPosition(engine.tree, node, parent, position)\n\t}\n}\n\n/**\n * Collect all ancestors in a set to avoid duplicates. Note that we potentially also collect\n * ancestors (WebPageNode) of nodes that are currently not inside a breakpoint and not visible. This\n * could result in strictly not necessary updates to template layouts, but that's okay because\n * they will eventually be added to a breakpoint at which point the layout template should\n * ideally already have been updated. *\n *\n * @param stickyNodes - Set of nodes that were updated to sticky position\n */\nfunction collectUniqueAncestors(stickyNodes: CanvasNode[]): Set<CanvasNode> {\n\tconst ancestorNodes = new Set<CanvasNode>()\n\tfor (const node of stickyNodes) {\n\t\tfor (const ancestor of node.ancestors()) {\n\t\t\tancestorNodes.add(ancestor)\n\t\t}\n\t}\n\treturn ancestorNodes\n}\n\n/**\n * Collects related layout templates' breakpoints that need their overflow updated.\n * It includes the primary breakpoint and any overridden replica breakpoints.\n *\n * @param ancestorNodes - Set of nodes that are ancestors of the nodes that were updated to sticky position\n */\nasync function collectLayoutTemplatesBreakpoints(ancestorNodes: Set<CanvasNode>): Promise<Set<CanvasNode>> {\n\t// Collect all related layout templates\n\tconst layoutTemplateNodes: Set<AnyLayoutTemplateNode> = new Set()\n\tfor (const ancestorNode of ancestorNodes) {\n\t\t// If the ancestor is a web page node and has a layout template, add it to the set\n\t\tif (isWebPageNode(ancestorNode) && hasLayoutTemplate(ancestorNode)) {\n\t\t\tconst layoutTemplateNode = ancestorNode.getLayoutTemplateNode(engine.tree)\n\t\t\tassert(layoutTemplateNode, \"Layout template node should exist\")\n\t\t\tlayoutTemplateNodes.add(layoutTemplateNode)\n\t\t}\n\t}\n\n\t// Collect layout template breakpoints to update\n\tconst layoutTemplateBreakpointsToUpdate = new Set<CanvasNode>()\n\tawait Promise.all(\n\t\t[...layoutTemplateNodes].map(async anyLayoutTemplateNode => {\n\t\t\t// Load the layout template node if it's not already loaded\n\t\t\tconst layoutTemplateNode = anyLayoutTemplateNode.isLoaded()\n\t\t\t\t? anyLayoutTemplateNode\n\t\t\t\t: await anyLayoutTemplateNode.load()\n\t\t\tassert(layoutTemplateNode, \"Layout template should be loaded\")\n\n\t\t\t// Collect the primary breakpoint\n\t\t\tconst primaryBreakpoint = layoutTemplateNode.getPrimaryVariant()\n\t\t\tlayoutTemplateBreakpointsToUpdate.add(primaryBreakpoint)\n\n\t\t\t// Collect any overridden replica breakpoints\n\t\t\tfor (const replicaBreakpoint of layoutTemplateNode.getReplicaVariants()) {\n\t\t\t\tif (TemplateHelper.isAnyKeyOverridden(replicaBreakpoint, primaryBreakpoint.id, allOverflowKeys)) {\n\t\t\t\t\tlayoutTemplateBreakpointsToUpdate.add(replicaBreakpoint)\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n\treturn layoutTemplateBreakpointsToUpdate\n}\n\n/**\n * Updates overflow values from \"hidden\" to clip for the given node.\n *\n * All possible overflow properties need to be updated, including overflowX, because any\n * overflow[X|Y] set to auto, scroll or hidden (the ones that can be scrolled) prevent sticky from\n * working, because they create a new _block formatting context_\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flow_Layout/Block_Formatting_Contexts\n *\n * @param node - The node to update.\n */\nfunction updateOverflowsFromHiddenToClip(node: CanvasNode): void {\n\tif (!withOverflow(node)) return\n\n\tconst update: Partial<WithOverflow> = {}\n\tlet anyKeyUpdated = false\n\tfor (const key of allOverflowKeys) {\n\t\tif (node[key] === \"hidden\") {\n\t\t\tupdate[key] = \"clip\"\n\t\t\tanyKeyUpdated = true\n\t\t}\n\t}\n\tif (anyKeyUpdated) {\n\t\tnode.set(update)\n\t}\n}\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { withScrollbars } from \"document/models/CanvasTree/traits/WithScrollbars.ts\"\nimport type { ReducedScrollbars } from \"document/models/CanvasTree/traits/utils/reduceScrollbars.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { getComputedValueStartValue } from \"document/utils/getComputedValueStartValue.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport React from \"react\"\nimport { isBoolean, isUndefined } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"hide-scrollbars-popout\"\n\nconst scrollbarsTraitTypes = [TraitType.Scrollbars]\ninterface Props extends ReducedScrollbars {\n\tnodeIds: NodeID[]\n}\n\nexport const ScrollbarsRow = React.memo(function ScrollbarsRow({\n\thideScrollbars,\n\tnodeIds,\n\tonlyNodesWithScrollbars,\n}: Props) {\n\tconst canCopyScrollbars = !isMixed(hideScrollbars)\n\tconst [canPasteScrollbars, pasteScrollbars, copyScrollbars] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Scrollbars,\n\t\tnodeIds,\n\t\tcanCopyScrollbars,\n\t)\n\n\tconst update = engine.scheduler.wrapHandler((value: boolean | undefined) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withScrollbars)\n\t\tnodes.forEach(node => node.set({ hideScrollbars: value }))\n\t})\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withScrollbars)\n\t\t\tnodes.forEach(node => node.set({ hideScrollbars: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isBoolean(hideScrollbars) ? hideScrollbars : false,\n\t\t\t\tengine,\n\t\t\t\ttype: ControlType.Boolean,\n\t\t\t\tname: \"Hide Scrollbars\",\n\t\t\t\tscopeId,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[hideScrollbars, updateDynamicValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tfor (const node of engine.tree.getNodesWithTrait(nodeIds, withScrollbars)) {\n\t\t\tif (!isDynamicValue(node.hideScrollbars)) continue\n\n\t\t\tconst hideScrollbarsValue = isComputedValue(node.hideScrollbars)\n\t\t\t\t? getComputedValueStartValue(engine, node.hideScrollbars)\n\t\t\t\t: getVariableValue(engine, node.hideScrollbars)\n\n\t\t\tnode.set({ hideScrollbars: isBoolean(hideScrollbarsValue) ? hideScrollbarsValue : false })\n\t\t}\n\t}, [nodeIds])\n\n\tconst remove = () => update(undefined)\n\n\tif (isUndefined(hideScrollbars) || !onlyNodesWithScrollbars) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Scrollbars\"\n\t\t\ttraitTypes={scrollbarsTraitTypes}\n\t\t\tonCopy={copyScrollbars}\n\t\t\tonPaste={pasteScrollbars}\n\t\t\tonDelete={remove}\n\t\t\tdeleteEnabled={!isUndefined(hideScrollbars)}\n\t\t\tcopyEnabled={canCopyScrollbars}\n\t\t\tpasteEnabled={canPasteScrollbars}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tdynamicValue={isDynamicValue(hideScrollbars) ? hideScrollbars : null}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tsupportsComputedValues\n\t\t\tsupportsVariables\n\t\t\tvariableReferenceType={ControlType.Boolean}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t>\n\t\t\t{isDynamicValue(hideScrollbars) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Select\"\n\t\t\t\t\tvalue={hideScrollbars}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.Show}\n\t\t\t\t\t\tselected={hideScrollbars === false}\n\t\t\t\t\t\tonSelect={update}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Hide}\n\t\t\t\t\t\tselected={hideScrollbars === true}\n\t\t\t\t\t\tonSelect={update}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { Translatable as T } from \"@framerjs/fresco\"\nimport { assertNever, isMixed } from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type {\n\tAbsoluteSizeConstraints,\n\tConstraintUnit,\n\tWithSizeConstraints,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport {\n\tconstrainHeight,\n\tconstrainWidth,\n\tisConstraintDimension,\n\tparseConstraintValue,\n\tsupportsSizeConstraints,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { ReducedSizeProperties } from \"document/models/CanvasTree/traits/utils/reduceSize.ts\"\nimport type { ReducedSizeConstraints } from \"document/models/CanvasTree/traits/utils/reduceSizeConstraints.ts\"\nimport { getConstraintUnit } from \"document/models/CanvasTree/traits/utils/reduceSizeConstraints.ts\"\nimport {\n\tgetViewportHeight,\n\tgetViewportProviderForNode,\n} from \"document/models/CanvasTree/traits/utils/viewportHelpers.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { PopoutButtonWithPreviewSuggestion } from \"../../shared/PopoutButtonWithPreviewSuggestion.tsx\"\nimport { ConstraintInput } from \"../inputs/ConstraintInput.tsx\"\nimport { PanelSectionHeader } from \"../panels/PanelSectionHeader.tsx\"\nimport { PanelSectionHeaderButton } from \"../panels/PanelSectionHeaderButton.tsx\"\nimport { IconSectionHeaderPlus } from \"../panels/icons/IconSectionHeaderPlus.tsx\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\ninterface SizeConstraintsProps extends Omit<ReducedSizeConstraints, \"onlyNodesWithSizeConstraints\"> {\n\tnodeIds: NodeID[]\n}\n\nfunction resolveSizeForNewConstraint(\n\tcomponentLoader: ComponentLoader,\n\tnode: CanvasNode & WithSizeConstraints,\n\tkey: keyof WithSizeConstraints,\n\tnextSizeConstraints: Partial<AbsoluteSizeConstraints>,\n): void {\n\tif (!isPinnable(node)) return\n\n\tswitch (key) {\n\t\tcase \"maxWidth\":\n\t\tcase \"minWidth\":\n\t\t\tif (node.widthType === DimensionType.FixedNumber) {\n\t\t\t\tnode.set({\n\t\t\t\t\twidth: constrainWidth(node, node.width, componentLoader, {\n\t\t\t\t\t\t...engine.tree.getParentSizeInfo(node),\n\t\t\t\t\t\t...nextSizeConstraints,\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t}\n\t\t\tif (isNumber(node.left) && isNumber(node.right)) {\n\t\t\t\tnode.set({ right: null })\n\t\t\t}\n\t\t\tbreak\n\t\tcase \"maxHeight\":\n\t\tcase \"minHeight\":\n\t\t\tif (node.heightType === DimensionType.FixedNumber) {\n\t\t\t\tnode.set({\n\t\t\t\t\theight: constrainHeight(node, node.height, componentLoader, {\n\t\t\t\t\t\t...engine.tree.getParentSizeInfo(node),\n\t\t\t\t\t\t...nextSizeConstraints,\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t\tif (isNumber(node.top) && isNumber(node.bottom)) {\n\t\t\t\t\tnode.set({ bottom: null })\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(key)\n\t}\n}\n\nfunction relativeDimensionUnit(unit: ConstraintUnit): boolean {\n\tswitch (unit) {\n\t\tcase \"%\":\n\t\tcase \"vh\":\n\t\t\treturn true\n\t\tcase \"px\":\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(unit)\n\t}\n}\n\nconst onClearConstraint = (key: keyof WithSizeConstraints, nodeIds: string[]) =>\n\tengine.scheduler.wrapHandler(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, supportsSizeConstraints)\n\t\tnodes.forEach(node => node.set({ [key]: undefined }))\n\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t})\n\nconst constraintToParentSizeMap: Record<keyof WithSizeConstraints, \"width\" | \"height\"> = {\n\tmaxWidth: \"width\",\n\tmaxHeight: \"height\",\n\tminWidth: \"width\",\n\tminHeight: \"height\",\n}\n\nconst onChangeNumber = (constraint: keyof WithSizeConstraints, props: SizeConstraintsProps) =>\n\tengine.scheduler.wrapHandler((value: number, rawValue: string | undefined) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, supportsSizeConstraints)\n\t\tnodes.forEach(node => {\n\t\t\tconst currentValue = node[constraint]\n\t\t\tlet nextUnit: ConstraintUnit | null = null\n\n\t\t\tif (rawValue && isConstraintDimension(rawValue)) {\n\t\t\t\tconst [_, unit] = parseCSSDimension(rawValue)\n\t\t\t\tnextUnit = unit\n\t\t\t}\n\n\t\t\tif (currentValue) {\n\t\t\t\tconst [_, currentUnit] = parseConstraintValue(currentValue)\n\t\t\t\tif (!nextUnit) nextUnit = currentUnit\n\t\t\t}\n\n\t\t\tlet absoluteValue = value\n\t\t\tif (nextUnit === \"%\") {\n\t\t\t\tconst parent = engine.tree.getParent(node.id)\n\t\t\t\tif (!parent) return\n\n\t\t\t\tconst parentSize = engine.tree.getRect(parent)\n\t\t\t\tconst parentDimension = constraintToParentSizeMap[constraint]\n\t\t\t\tconst parentDimensionValue = parentSize[parentDimension]\n\n\t\t\t\tabsoluteValue = (value / 100) * parentDimensionValue\n\n\t\t\t\t// Round to 2 decimal places\n\t\t\t\tabsoluteValue = roundToTwoDecimalPlaces(absoluteValue)\n\t\t\t} else if (nextUnit === \"vh\") {\n\t\t\t\tconst viewportProvider = getViewportProviderForNode(engine.tree, node.id)\n\t\t\t\tif (!viewportProvider) return\n\t\t\t\tconst viewportHeight = getViewportHeight(viewportProvider, engine.tree.getRect(viewportProvider, false), false)\n\n\t\t\t\tabsoluteValue = (value / 100) * viewportHeight\n\n\t\t\t\t// Round to 2 decimal places\n\t\t\t\tabsoluteValue = roundToTwoDecimalPlaces(absoluteValue)\n\t\t\t}\n\n\t\t\tnode.set({ [constraint]: createCSSDimension(value, nextUnit ?? \"px\") })\n\t\t\tresolveSizeForNewConstraint(engine.componentLoader, node, constraint, { [constraint]: absoluteValue })\n\t\t})\n\t})\n\nconst onChangeUnit = (constraint: keyof WithSizeConstraints, props: SizeConstraintsProps) =>\n\tengine.scheduler.wrapHandler((nextUnit: ConstraintUnit) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, supportsSizeConstraints)\n\t\tnodes.forEach(node => {\n\t\t\tconst nodeValue = node[constraint]\n\t\t\tif (isUndefined(nodeValue)) return\n\n\t\t\tconst [currentValue, currentUnit] = parseConstraintValue(nodeValue)\n\n\t\t\t// If the unit hasn't changed (maybe in a multi-select situation) no need to perform an update.\n\t\t\tif (nextUnit === currentUnit) return\n\n\t\t\tlet nextValue: number = currentValue\n\t\t\t// When converting to or from percentages, we must factor in the parent\n\t\t\t// dimension. The layer must have a parent.\n\t\t\tconst parent = engine.tree.getParent(node.id)\n\t\t\tconst parentSize = parent ? engine.tree.getRect(parent) : null\n\t\t\tconst parentDimension = constraintToParentSizeMap[constraint]\n\n\t\t\tconst viewportProvider = getViewportProviderForNode(engine.tree, node.id)\n\t\t\tconst viewportHeight = viewportProvider\n\t\t\t\t? getViewportHeight(viewportProvider, engine.tree.getRect(viewportProvider, false), false)\n\t\t\t\t: null\n\n\t\t\tconst parentDimensionValue =\n\t\t\t\tviewportProvider && currentUnit === \"vh\" ? viewportHeight : parentSize?.[parentDimension]\n\n\t\t\tif (currentUnit !== \"vh\" && nextUnit === \"vh\") {\n\t\t\t\t// When changing to viewport height, change the value to 100,\n\t\t\t\t// this avoids awkward, unrealistic values.\n\t\t\t\tnextValue = 100\n\t\t\t} else if (parentDimensionValue) {\n\t\t\t\tif (currentUnit === \"px\") {\n\t\t\t\t\tnextValue = (currentValue / parentDimensionValue) * 100\n\t\t\t\t} else if (relativeDimensionUnit(currentUnit) && nextUnit === \"px\") {\n\t\t\t\t\tnextValue = (currentValue / 100) * parentDimensionValue\n\t\t\t\t} else if (viewportHeight && currentUnit === \"vh\" && nextUnit === \"%\") {\n\t\t\t\t\tnextValue = (viewportHeight * currentValue) / (parentSize?.[parentDimension] ?? 1)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.set({\n\t\t\t\t[constraint]: createCSSDimension(roundToTwoDecimalPlaces(nextValue), nextUnit),\n\t\t\t})\n\t\t})\n\t})\n\nfunction roundToTwoDecimalPlaces(value: number) {\n\treturn Math.round(value * 100) / 100\n}\n\nconst constraintKeys: readonly (keyof WithSizeConstraints)[] = [\"maxWidth\", \"minWidth\", \"maxHeight\", \"minHeight\"]\n\nfunction defaultForConstraintKey(key: keyof WithSizeConstraints, node: CanvasNode) {\n\t// Ground nodes do not support relative constraints.\n\tif (engine.tree.isGroundNode(node)) return createCSSDimension(100, \"px\")\n\n\tswitch (key) {\n\t\tcase \"maxWidth\":\n\t\tcase \"maxHeight\":\n\t\t\treturn createCSSDimension(100, \"%\")\n\t\tcase \"minWidth\":\n\t\tcase \"minHeight\":\n\t\t\treturn createCSSDimension(100, \"px\")\n\t\tdefault:\n\t\t\tassertNever(key)\n\t}\n}\n\nfunction displayAddSizeConstraintMenu(event: React.MouseEvent, props: SizeConstraintsProps) {\n\tconst template: MenuItemOptions[] = constraintKeys.map(key => {\n\t\tconst sizeConstraintValue = props[key]\n\t\treturn {\n\t\t\tlabel: titleCase(key),\n\t\t\tclick: () => {\n\t\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, supportsSizeConstraints)\n\t\t\t\tnodes.forEach(node => node.set({ [key]: defaultForConstraintKey(key, node) }))\n\t\t\t},\n\t\t\tvisible: isUndefined(sizeConstraintValue),\n\t\t}\n\t})\n\tengine.stores.contextMenuStore.show(template, { location: { x: event.clientX, y: event.clientY } })\n}\n\nexport const ConstraintsPanelHeader = React.memo(function SizePanelHeader(\n\tprops: SizeConstraintsProps & {\n\t\tonlyNodesWithSizeConstraints: boolean\n\t\treadOnly: boolean\n\t\ttitle: string\n\t},\n) {\n\tconst { onlyNodesWithSizeConstraints, readOnly, title } = props\n\n\tconst shouldDisplayMenu = onlyNodesWithSizeConstraints && constraintKeys.some(key => isUndefined(props[key]))\n\n\tconst displayMenu = (event: React.MouseEvent) => {\n\t\tif (readOnly) return\n\t\tdisplayAddSizeConstraintMenu(event, props)\n\t}\n\n\treturn (\n\t\t<PanelSectionHeader\n\t\t\ttitle={<T>{title}</T>}\n\t\t\tclickable={shouldDisplayMenu && !readOnly}\n\t\t\tonMouseDown={shouldDisplayMenu ? displayMenu : undefined}\n\t\t>\n\t\t\t{shouldDisplayMenu && (\n\t\t\t\t<PanelSectionHeaderButton>\n\t\t\t\t\t<IconSectionHeaderPlus />\n\t\t\t\t</PanelSectionHeaderButton>\n\t\t\t)}\n\t\t</PanelSectionHeader>\n\t)\n})\n\ninterface SizeConstraintsRowProps\n\textends SizeConstraintsProps, Pick<ReducedSizeProperties, \"widthTypes\" | \"heightTypes\"> {\n\tscopeType: ScopeType\n\tonlyGroundNodeDescendants: boolean\n\tanyFormInputNodes: boolean\n}\n\nconst keyToAxis = {\n\tmaxWidth: \"width\",\n\tminWidth: \"width\",\n\tmaxHeight: \"height\",\n\tminHeight: \"height\",\n} as const\n\ntype SizeConstraintTraitTypeKeys = { [K in keyof WithSizeConstraints]: [K] }\n\nconst traitTypeKeys: SizeConstraintTraitTypeKeys = {\n\tmaxHeight: [\"maxHeight\"],\n\tmaxWidth: [\"maxWidth\"],\n\tminHeight: [\"minHeight\"],\n\tminWidth: [\"minWidth\"],\n} as const\n\nexport const SizeConstraintsRow = React.memo(function SizeConstraintsPanel(props: SizeConstraintsRowProps) {\n\tconst { nodeIds, scopeType, onlyGroundNodeDescendants } = props\n\tconst rows: JSX.Element[] = []\n\n\tfor (const key of constraintKeys) {\n\t\tconst value = props[key]\n\t\tconst handleClear = onClearConstraint(key, nodeIds)\n\t\tconst unitTypes = props[getConstraintUnit(key)]\n\t\tif (isNumber(value) || isMixed(value)) {\n\t\t\trows.push(\n\t\t\t\t<PanelRow traitTypeKeys={traitTypeKeys[key]} title={titleCase(key)} onDelete={handleClear} key={key}>\n\t\t\t\t\t<ConstraintInput\n\t\t\t\t\t\taxis={keyToAxis[key]}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\tunitTypes={unitTypes}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tonlyGroundNodeDescendants={onlyGroundNodeDescendants}\n\t\t\t\t\t\tonChangeNumber={onChangeNumber(key, props)}\n\t\t\t\t\t\tonChangeUnit={onChangeUnit(key, props)}\n\t\t\t\t\t\tonClear={handleClear}\n\t\t\t\t\t/>\n\t\t\t\t</PanelRow>,\n\t\t\t)\n\t\t}\n\t}\n\n\tconst displaySuggestionButton = constraintKeys.some(key => isUndefined(props[key])) && !props.anyFormInputNodes\n\n\tconst displayMenu = (event: React.MouseEvent) => {\n\t\tdisplayAddSizeConstraintMenu(event, props)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{rows}\n\t\t\t{displaySuggestionButton && (\n\t\t\t\t<PanelRow title={rows.length > 0 ? \" \" : \"Min Max\"}>\n\t\t\t\t\t<PopoutButtonWithPreviewSuggestion type=\"sizeConstraint\" style={doubleColumn} onMouseDown={displayMenu} />\n\t\t\t\t</PanelRow>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import { NumberInputWithTicker, PopupButton, PopupButtonDisplayTitle, PopupButtonItem } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type {\n\tConstraintUnit,\n\tHeightConstraintUnit,\n\tWidthConstraintUnit,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport {\n\tsupportedHeightConstraintUnits,\n\tsupportedWidthConstraintUnits,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { Reduced } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { notFoundToUndefined } from \"document/models/CanvasTree/traits/utils/notFoundToUndefined.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport * as styles from \"./DimensionInput.styles.ts\"\n\ninterface Props {\n\taxis: \"height\" | \"width\"\n\tunitTypes: Set<HeightConstraintUnit | WidthConstraintUnit>\n\tvalue: Reduced<number>\n\tscopeType: ScopeType\n\tonlyGroundNodeDescendants: boolean\n\tonChangeNumber: (value: number, rawValue: string | undefined, reset: () => void) => void\n\tonChangeUnit: (unit: HeightConstraintUnit | WidthConstraintUnit) => void\n\tonClear: () => void\n}\n\nconst defaultUnits = new Set<WidthConstraintUnit>([\"px\"])\n\nexport function ConstraintInput({\n\taxis,\n\tunitTypes,\n\tvalue,\n\tscopeType,\n\tonlyGroundNodeDescendants,\n\tonChangeNumber,\n\tonChangeUnit,\n\tonClear,\n}: Props) {\n\tlet displayValue: Reduced<number | string> = value\n\tconst displayUnits = unitTypes.size ? unitTypes : defaultUnits\n\tconst commonUnit = commonValue(unitTypes)\n\tif (isNumber(value) && commonUnit === \"%\") {\n\t\tdisplayValue = createCSSDimension(value, \"%\")\n\t} else if (isNumber(value) && commonUnit === \"vh\") {\n\t\tdisplayValue = createCSSDimension(value, \"vh\")\n\t}\n\n\tconst axisUnitTypes = axis === \"height\" ? supportedHeightConstraintUnits : supportedWidthConstraintUnits\n\n\treturn (\n\t\t<>\n\t\t\t<NumberInputWithTicker\n\t\t\t\tvalue={notFoundToUndefined(displayValue)}\n\t\t\t\tonChange={onChangeNumber}\n\t\t\t\tonClear={onClear}\n\t\t\t\tmin={0}\n\t\t\t\tstep=\"nudge\"\n\t\t\t\tdefaultValue={undefined}\n\t\t\t\tdisplayTicker\n\t\t\t/>\n\t\t\t<PopupButtonDisplayTitle displayTitle={shortTitle(displayUnits)}>\n\t\t\t\t<PopupButton wrapperClassName={styles.popupButtonWrapperSites}>\n\t\t\t\t\t{axisUnitTypes.map(unit => (\n\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\tkey={unit}\n\t\t\t\t\t\t\tidentifier={unit}\n\t\t\t\t\t\t\ttitle={unitTitle(unit)}\n\t\t\t\t\t\t\tselected={displayUnits.has(unit)}\n\t\t\t\t\t\t\tonSelect={onChangeUnit}\n\t\t\t\t\t\t\tenabled={enabledForScope(unit, scopeType, onlyGroundNodeDescendants)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</PopupButton>\n\t\t\t</PopupButtonDisplayTitle>\n\t\t</>\n\t)\n}\n\nfunction enabledForScope(type: ConstraintUnit, scopeType: ScopeType, onlyGroundNodeDescendants: boolean) {\n\tswitch (type) {\n\t\tcase \"vh\":\n\t\t\treturn (\n\t\t\t\tscopeType === ScopeType.WebPage ||\n\t\t\t\tscopeType === ScopeType.SmartComponent ||\n\t\t\t\tscopeType === ScopeType.LayoutTemplate ||\n\t\t\t\tscopeType === ScopeType.DesignPage\n\t\t\t)\n\t\tcase \"%\":\n\t\t\treturn onlyGroundNodeDescendants\n\t\tcase \"px\":\n\t\tdefault:\n\t\t\treturn true\n\t}\n}\n\nfunction shortTitle(units: Iterable<ConstraintUnit>): string {\n\tconst commonUnit = commonValue(units)\n\tswitch (commonUnit) {\n\t\tcase \"px\":\n\t\t\treturn \"Fixed\"\n\t\tcase \"%\":\n\t\t\treturn \"Rel\"\n\t\tcase \"vh\":\n\t\t\treturn \"View\"\n\t\tdefault:\n\t\t\treturn Dictionary.Mixed\n\t}\n}\n\nfunction unitTitle(unit: ConstraintUnit): string {\n\tswitch (unit) {\n\t\tcase \"px\":\n\t\t\treturn \"Fixed\"\n\t\tcase \"%\":\n\t\t\treturn \"Relative\"\n\t\tcase \"vh\":\n\t\t\treturn \"Viewport\"\n\t}\n}\n", "import { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { tapHighlightAddedDefaults, withTapHighlight } from \"document/models/CanvasTree/traits/WithTapHighlight.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedTapHighlight } from \"document/models/CanvasTree/traits/utils/reduceTapHighlight.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useCallback } from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { ColorPickerTab } from \"../../shared/ColorPicker/ColorPickerFillTypeTabs.tsx\"\nimport { ColorPopoutButton } from \"../../shared/ColorPicker/ColorPopoutButton.tsx\"\nimport { trackingMetadata } from \"../../shared/ColorPicker/trackingMetadata.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst tapHighlightTraitTypes = [TraitType.TapHighlight]\n\nconst popoutId = \"tapHighlightValueTransform\"\nconst initialColorValue = tapHighlightAddedDefaults.tapHighlightColor\nconst supportedColorPopoutTabs: ColorPickerTab[] = [\"solid\"]\n\ninterface Props extends ReducedTapHighlight {\n\tnodeIds: NodeID[]\n}\n\nexport const TapHighlightRow = React.memo(function TapHighlightRow(props: Props) {\n\tconst { tapHighlightColor, onlyNodesWithTapHighlight } = props\n\n\tconst canCopyTapHighlight = !isMixed(tapHighlightColor) && isClipboardSupported()\n\tconst [canPasteTapHighlight, pasteTapHighlight, copyTapHighlight] = useCopyAndPasteSingleProperty(\n\t\tTraitType.TapHighlight,\n\t\tprops.nodeIds,\n\t\tcanCopyTapHighlight,\n\t)\n\n\tconst update = useEngineCallback(\n\t\t(newTapHighlight: string | DynamicValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withTapHighlight)\n\t\t\tnodes.forEach(node => node.set({ tapHighlightColor: newTapHighlight }))\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\ttype: ControlType.Color,\n\t\t\t\tname: \"tapHighlight\",\n\t\t\t\tinitialValue: isString(tapHighlightColor) ? tapHighlightColor : initialColorValue,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdate(variableRef)\n\t\t},\n\t\t[update, tapHighlightColor],\n\t)\n\n\tconst removeDynamicValue = useCallback(() => {\n\t\tif (!isDynamicValue(tapHighlightColor)) return\n\t\tif (isVariableReference(tapHighlightColor)) {\n\t\t\tconst variableValue = getVariableValue(engine, tapHighlightColor)\n\t\t\tconst resolvedValue = isString(variableValue) ? variableValue : initialColorValue\n\t\t\tupdate(resolvedValue)\n\t\t} else if (isComputedValue(tapHighlightColor)) {\n\t\t\tupdate(initialColorValue)\n\t\t} else {\n\t\t\tshouldBeNever(tapHighlightColor)\n\t\t}\n\t}, [update, tapHighlightColor])\n\n\tconst setDynamicValueAndOpenPopout = useCallback(\n\t\t(newOpacity: DynamicValue) => {\n\t\t\tupdate(newOpacity)\n\t\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t\t},\n\t\t[update],\n\t)\n\n\tconst deleteTapHighlight = useCallback(() => {\n\t\tupdate(undefined)\n\t}, [update])\n\n\tif (!onlyNodesWithTapHighlight || !isFound(tapHighlightColor) || !tapHighlightColor) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Tap Color\"\n\t\t\tvariableType={ControlType.Color}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tdynamicValue={isDynamicValue(tapHighlightColor) ? tapHighlightColor : null}\n\t\t\tonSelectVariable={update}\n\t\t\ttraitTypes={tapHighlightTraitTypes}\n\t\t\tsupportsVariables\n\t\t\tonCopy={copyTapHighlight}\n\t\t\tcopyEnabled={canCopyTapHighlight}\n\t\t\tonPaste={pasteTapHighlight}\n\t\t\tpasteEnabled={canPasteTapHighlight}\n\t\t\tsupportsComputedValues\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={setDynamicValueAndOpenPopout}\n\t\t\tonDelete={deleteTapHighlight}\n\t\t>\n\t\t\t{isDynamicValue(tapHighlightColor) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Tap Color\"\n\t\t\t\t\tvalue={tapHighlightColor}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Color}\n\t\t\t\t\tpopoutId=\"tapHighlightValueTransform\"\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tonChangeDynamicValue={update}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<ColorPopoutButton\n\t\t\t\t\tnavigationTitle=\"Tap Color\"\n\t\t\t\t\tvalue={tapHighlightColor}\n\t\t\t\t\tcurrentType=\"color\"\n\t\t\t\t\tonChange={update}\n\t\t\t\t\ttabsToShow={supportedColorPopoutTabs}\n\t\t\t\t\ttrackingMetadata={props.nodeIds ? trackingMetadata(props.nodeIds, \"tapHighlightColor\") : undefined}\n\t\t\t\t\tshowAlphaInButton\n\t\t\t\t/>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { PopupButton, PopupButtonItem } from \"@framerjs/fresco\"\nimport { isMixed, shouldBeNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { UserSelectValue, WithUserSelect } from \"document/models/CanvasTree/traits/WithUserSelect.ts\"\nimport {\n\tallUserSelectValues,\n\tisUserSelectValue,\n\twithUserSelect,\n} from \"document/models/CanvasTree/traits/WithUserSelect.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport type { ReducedUserSelect } from \"document/models/CanvasTree/traits/utils/reduceUserSelect.ts\"\nimport {\n\tgetNodePropertyControlDescription,\n\tnodePropertyDefinitionEntityIdentifier,\n} from \"document/models/CanvasTree/utils/nodePropertyControlDefinitions.ts\"\nimport { userSelectVariableDefinition } from \"document/models/CanvasTree/utils/nodePropertyControlReferenceVariableDefinitions.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { ControlReferenceInfo } from \"../../shared/DynamicValueButton.tsx\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst popoutId = \"user-select-popout\"\n\nconst userSelectControlReferenceInfo: ControlReferenceInfo = {\n\tcontrolKey: \"userSelect\",\n\tcontrolSourceIdentifier: nodePropertyDefinitionEntityIdentifier,\n}\n\ninterface UserSelectRowProps extends Omit<ReducedUserSelect, \"anyNodesWithUserSelect\"> {\n\tnodeIds: NodeID[]\n}\nconst traitTypeKeys: (keyof WithUserSelect)[] = [\"userSelect\"]\n\nexport const UserSelectRow = React.memo(function UserSelectRow({\n\tonlyNodesWithUserSelect,\n\tnodeIds,\n\tuserSelect,\n}: UserSelectRowProps): JSX.Element | null {\n\tconst canCopyUserSelect = !isDynamicValue(userSelect) && !isMixed(userSelect)\n\tconst [canPasteUserSelect, pasteUserSelect, copyUserSelect] = useCopyAndPasteSingleProperty(\n\t\tTraitType.UserSelect,\n\t\tnodeIds,\n\t\tcanCopyUserSelect,\n\t)\n\n\tconst updateValue = useEngineCallback(\n\t\t(value: UserSelectValue | undefined) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withUserSelect)\n\t\t\tnodes.forEach(node => node.set({ userSelect: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst updateDynamicValue = useEngineCallback(\n\t\t(value: DynamicValue) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(nodeIds, withUserSelect)\n\t\t\tnodes.forEach(node => node.set({ userSelect: value }))\n\t\t},\n\t\t[nodeIds],\n\t)\n\n\tconst selectDynamicValueAndOpenPopout = (value: DynamicValue) => {\n\t\tupdateDynamicValue(value)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\tconst createVariable = useEngineCallback(\n\t\t(scopeId: NodeID) => {\n\t\t\tconst variableRef = createVariableInScope({\n\t\t\t\tinitialValue: isUserSelectValue(userSelect) ? userSelect : \"auto\",\n\t\t\t\tengine,\n\t\t\t\tscopeId,\n\t\t\t\t...userSelectVariableDefinition,\n\t\t\t})\n\t\t\tif (!variableRef) return\n\t\t\tupdateDynamicValue(variableRef)\n\t\t},\n\t\t[userSelect, updateDynamicValue],\n\t)\n\n\tconst removeDynamicValue = useEngineCallback(() => {\n\t\tif (!isDynamicValue(userSelect)) return\n\t\tif (isVariableReference(userSelect)) {\n\t\t\tconst variableValue = getVariableValue(engine, userSelect)\n\t\t\tconst userSelectValue = isUserSelectValue(variableValue) ? variableValue : \"auto\"\n\t\t\tupdateValue(userSelectValue)\n\t\t} else if (isComputedValue(userSelect)) {\n\t\t\tupdateValue(\"auto\")\n\t\t} else {\n\t\t\tshouldBeNever(userSelect)\n\t\t}\n\t}, [userSelect, updateValue])\n\n\tif (isNotFound(userSelect) || isUndefined(userSelect) || !onlyNodesWithUserSelect) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Select\"\n\t\t\ttraitTypeKeys={traitTypeKeys}\n\t\t\tsupportsVariables\n\t\t\tsupportsComputedValues\n\t\t\tdynamicValue={isDynamicValue(userSelect) ? userSelect : null}\n\t\t\tvariableType={ControlType.Enum}\n\t\t\tvariableReferenceType={ControlType.Enum}\n\t\t\tonCreateVariable={createVariable}\n\t\t\tonRemoveDynamicValue={removeDynamicValue}\n\t\t\tonSelectVariable={updateDynamicValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonSelectComputedValue={selectDynamicValueAndOpenPopout}\n\t\t\tcontrolKey={userSelectControlReferenceInfo.controlKey}\n\t\t\tcontrolSourceIdentifier={userSelectControlReferenceInfo.controlSourceIdentifier}\n\t\t\tonDelete={() => updateValue(undefined)}\n\t\t\tonCopy={copyUserSelect}\n\t\t\tonPaste={pasteUserSelect}\n\t\t\tcopyEnabled={canCopyUserSelect}\n\t\t\tpasteEnabled={canPasteUserSelect}\n\t\t>\n\t\t\t{isDynamicValue(userSelect) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Select\"\n\t\t\t\t\tvalue={userSelect}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t\texpectedType={ControlType.Enum}\n\t\t\t\t\tonChangeDynamicValue={updateDynamicValue}\n\t\t\t\t\tonRemove={removeDynamicValue}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={getNodePropertyControlDescription(\"userSelect\")}\n\t\t\t\t\tcontrolReferenceInfo={userSelectControlReferenceInfo}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<div style={doubleColumn}>\n\t\t\t\t\t<PopupButton mixed={isMixed(userSelect)}>\n\t\t\t\t\t\t{allUserSelectValues.map((value: UserSelectValue) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<PopupButtonItem\n\t\t\t\t\t\t\t\t\tkey={value}\n\t\t\t\t\t\t\t\t\tidentifier={value}\n\t\t\t\t\t\t\t\t\ttitle={titleCase(value)}\n\t\t\t\t\t\t\t\t\tselected={value === userSelect}\n\t\t\t\t\t\t\t\t\tonSelect={updateValue}\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</PopupButton>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport {\n\ttype ReducedViewTransitionNone,\n\twithViewTransitionNone,\n} from \"document/models/CanvasTree/traits/WithViewTransitionNone.ts\"\nimport { isFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst viewTransitionNameTraitTypes = [TraitType.ViewTransitionNone]\n\ninterface Props extends Omit<ReducedViewTransitionNone, \"onlyNodesWithViewTransitionNone\"> {\n\tnodeIds: NodeID[]\n}\n\nexport const ViewTransitionNoneRow = React.memo(function ViewTransitionNameRow(props: Props) {\n\tconst { viewTransitionNone } = props\n\n\tconst canCopy = !isMixed(viewTransitionNone) && isClipboardSupported()\n\tconst [canPaste, paste, copy] = useCopyAndPasteSingleProperty(TraitType.ViewTransitionNone, props.nodeIds, canCopy)\n\n\tconst handleChange = useEngineCallback(\n\t\t(value: boolean) => {\n\t\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withViewTransitionNone)\n\t\t\tnodes.forEach(node => node.set({ viewTransitionNone: value }))\n\t\t},\n\t\t[props.nodeIds],\n\t)\n\n\tconst handleDelete = useEngineCallback(() => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withViewTransitionNone)\n\n\t\tnodes.forEach(node => node.set({ viewTransitionNone: undefined }))\n\t}, [props.nodeIds])\n\n\tif (!isFound(viewTransitionNone) || isUndefined(viewTransitionNone)) return null\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Page Effect\"\n\t\t\ttraitTypes={viewTransitionNameTraitTypes}\n\t\t\tonCopy={copy}\n\t\t\tcopyEnabled={canCopy}\n\t\t\tonPaste={paste}\n\t\t\tpasteEnabled={canPaste}\n\t\t\tonDelete={handleDelete}\n\t\t>\n\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={false}\n\t\t\t\t\ttitle=\"Include\"\n\t\t\t\t\tselected={viewTransitionNone === false}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t\t<SegmentedControlItem\n\t\t\t\t\tidentifier={true}\n\t\t\t\t\ttitle=\"Exclude\"\n\t\t\t\t\tselected={viewTransitionNone === true}\n\t\t\t\t\tonSelect={handleChange}\n\t\t\t\t/>\n\t\t\t</SegmentedControl>\n\t\t</PanelRow>\n\t)\n})\n", "import { SegmentedControl, SegmentedControlItem } from \"@framerjs/fresco\"\nimport { isMixed } 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 { getVariableValue } from \"document/models/CanvasTree/nodes/utils/getVariableValue.ts\"\nimport type { ComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { TraitType } from \"document/models/CanvasTree/traits/TraitType.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ReducedVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { withVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { isNotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { useSupportsVariable } from \"document/models/CanvasTree/traits/utils/reduceEnabledVariableProperties.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isClipboardSupported } from \"utils/clipboard/clipboard.ts\"\nimport { isBoolean } from \"utils/typeChecks.ts\"\nimport { DynamicValueButton } from \"../../shared/DynamicValueButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { useCopyAndPasteSingleProperty } from \"../panels/utils/useCopyAndPasteSingleProperty.ts\"\nimport { createVariableInScope } from \"../utils/createVariableInScope.ts\"\nimport { doubleColumn } from \"../utils/doubleColumn.ts\"\nimport { PanelRow } from \"./PanelRow.tsx\"\n\nconst visibilityTraitTypes = [TraitType.Visibility]\n\nconst popoutId = \"visibilityPopoutId\"\n\ninterface Props extends ReducedVisibility {\n\tnodeIds: NodeID[]\n}\n\nexport const VisibilityRow = React.memo(function VisibilityRow(props: Props) {\n\tconst canCopyVisibility = !isMixed(props.visible) && isClipboardSupported()\n\tconst [canPasteVisibility, pasteVisibility, copyVisibility] = useCopyAndPasteSingleProperty(\n\t\tTraitType.Visibility,\n\t\tprops.nodeIds,\n\t\tcanCopyVisibility,\n\t)\n\n\tconst supportsVariables = useSupportsVariable(\"visible\")\n\tif (isNotFound(props.visible)) return null\n\n\tconst onChange = engine.scheduler.wrapHandler((visible: boolean | DynamicValue) => {\n\t\tconst nodes = engine.tree.getNodesWithTrait(props.nodeIds, withVisibility)\n\t\tnodes.forEach(node => node.set({ visible }))\n\t})\n\n\tconst onCreateVariable = engine.scheduler.wrapHandler((scopeId: NodeID) => {\n\t\tconst variableRef = createVariableInScope({\n\t\t\tengine,\n\t\t\tscopeId,\n\t\t\ttype: ControlType.Boolean,\n\t\t\tname: \"visible\",\n\t\t\tinitialValue: isBoolean(props.visible) ? props.visible : true,\n\t\t})\n\t\tif (variableRef) onChange(variableRef)\n\t})\n\n\tconst onRemoveVariableReference = () => {\n\t\tif (isVariableReference(props.visible)) {\n\t\t\tconst variableValue = getVariableValue(engine, props.visible)\n\t\t\tconst visibleValue = isBoolean(variableValue) ? variableValue : true\n\t\t\tonChange(visibleValue)\n\t\t} else if (isComputedValue(props.visible)) {\n\t\t\tonChange(true)\n\t\t}\n\t}\n\n\tconst onSelectVariableReference = (variableRef: VariableReference, type: VariableType) => {\n\t\tif (type === ControlType.Boolean) {\n\t\t\tonChange(variableRef)\n\t\t}\n\t}\n\n\tconst onSelectComputedValue = (computedValue: ComputedValue) => {\n\t\tonChange(computedValue)\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t}\n\n\treturn (\n\t\t<PanelRow\n\t\t\ttitle=\"Visible\"\n\t\t\ttraitTypes={visibilityTraitTypes}\n\t\t\tsupportsVariables={supportsVariables}\n\t\t\tsupportsComputedValues={supportsVariables}\n\t\t\tvariableType={ControlType.Boolean}\n\t\t\tonCreateVariable={onCreateVariable}\n\t\t\tonRemoveDynamicValue={onRemoveVariableReference}\n\t\t\tdynamicValue={isDynamicValue(props.visible) ? props.visible : null}\n\t\t\tonSelectVariable={onSelectVariableReference}\n\t\t\tonSelectComputedValue={onSelectComputedValue}\n\t\t\tcomputedValuePopoutId={popoutId}\n\t\t\tonCopy={copyVisibility}\n\t\t\tonPaste={pasteVisibility}\n\t\t\tcopyEnabled={canCopyVisibility}\n\t\t\tpasteEnabled={canPasteVisibility}\n\t\t>\n\t\t\t{isDynamicValue(props.visible) ? (\n\t\t\t\t<DynamicValueButton\n\t\t\t\t\ttitle=\"Visible\"\n\t\t\t\t\tvalue={props.visible}\n\t\t\t\t\tpopoutId={popoutId}\n\t\t\t\t\toutputControl={undefined}\n\t\t\t\t\texpectedType={ControlType.Boolean}\n\t\t\t\t\tonRemove={onRemoveVariableReference}\n\t\t\t\t\tonChangeDynamicValue={onChange}\n\t\t\t\t\tsupportsFetchDataValues\n\t\t\t\t\tnodeIds={props.nodeIds}\n\t\t\t\t\tsupportsComputedValues\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SegmentedControl style={doubleColumn}>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={true}\n\t\t\t\t\t\ttitle={Dictionary.Yes}\n\t\t\t\t\t\tselected={props.visible === true}\n\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t/>\n\t\t\t\t\t<SegmentedControlItem\n\t\t\t\t\t\tidentifier={false}\n\t\t\t\t\t\ttitle={Dictionary.No}\n\t\t\t\t\t\tselected={props.visible === false}\n\t\t\t\t\t\tonSelect={onChange}\n\t\t\t\t\t/>\n\t\t\t\t</SegmentedControl>\n\t\t\t)}\n\t\t</PanelRow>\n\t)\n})\n", "import type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { FramePresetsPanel } from \"document/components/chrome/properties/FramePresetsPanel.tsx\"\nimport { NodeProperties } from \"document/components/chrome/properties/NodeProperties.tsx\"\nimport { isScaleTool } from \"document/components/tools/ScaleTool.ts\"\nimport { createContainer } from \"document/components/utils/createContainer.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isSlotNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { Tools } from \"document/stores/ToolStore.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { Point, Rect, Size } from \"library/index.ts\"\nimport type { EditorState } from \"prosemirror-state\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { LayoutTemplateEmptyStatePanel } from \"./LayoutTemplateEmptyStatePanel.tsx\"\nimport { OnboardingPanel } from \"./OnboardingPanel.tsx\"\nimport { PagePropertiesPanel } from \"./PagePropertiesPanel.tsx\"\nimport { ScalePanel } from \"./panels/ScalePanel.tsx\"\n\ninterface State {\n\treadonly panelType: PanelType\n\treadonly selection: NodeID[]\n\treadonly selectedNodes: CanvasNode[]\n\t/**\n\t * Used to re-render PropertiesPanel when an external module component\n\t * is inserted on the canvas and the module is loaded\n\t */\n\treadonly selectedLoadedModulesComponentsHash: string\n\treadonly componentHash: string\n\treadonly tool: Tools\n\treadonly proseMirrorState: EditorState | null\n\treadonly isViewOnly: boolean\n\treadonly displayGrids: boolean\n\treadonly scopeType: ScopeType\n\treadonly scopeId: NodeID\n\t/** The module identifier of the layout template applied on the current scope */\n\treadonly activeLayoutTemplateId: LocalModuleExportIdentifierString | undefined | null\n\t/** An integer that is same as the scope.update count. We use it to trigger a re-render of the UI when the control props are updated */\n\treadonly activeLayoutTemplateUpdate: number\n\n\treadonly allNodesShareVariableContext: boolean\n\t/** Used only to force rendering when layout measurements are updated */\n\treadonly domLayoutUpdate: number\n\treadonly alignToParent: boolean\n\t/** Used only for Onboarding panel */\n\treadonly userIsViewer: boolean\n\treadonly appTourActive: boolean\n\t/** Used only for Scale Panel/Scale Tool */\n\treadonly scaleAnchor: Point | undefined\n\treadonly scaleFactor: number | undefined\n\treadonly initialDimensions: Size | undefined\n\treadonly boundingFrame: Rect | undefined\n\treadonly isWireframerKitPage: boolean\n}\n\nenum PanelType {\n\tNode,\n\tFramePresets,\n\tScale,\n\tOnboarding,\n\tLayoutTemplateEmptyState,\n\tPageProperties,\n}\n\nclass Properties extends React.PureComponent<unknown, State> {\n\tstatic engineChangeKeys = [\n\t\tEngineChange.Tree,\n\t\tEngineChange.Tool,\n\t\tEngineChange.ActiveBundle,\n\t\tEngineChange.UserDefaultsStore,\n\t\tEngineChange.AssetMap,\n\t\tEngineChange.TreeDOMLayoutSync,\n\t\tEngineChange.VariableProviderInfo,\n\t\tengine.stores.propertiesPanelStore,\n\t\tengine.stores.loadedExternalModulesStore,\n\t\tengine.stores.debugStore,\n\t\tengine.stores.scopeStore,\n\t\tengine.stores.selectionStore,\n\t\tengine.stores.toolStore,\n\t\tengine.stores.chromeStore,\n\t\tengine.stores.projectStore,\n\t\tengine.stores.sessionStore,\n\t\tengine.stores.loadingStore,\n\t]\n\n\tstatic calculateState(): State {\n\t\tconst {\n\t\t\tscopeStore,\n\t\t\tselectionStore,\n\t\t\ttoolStore,\n\t\t\tpersistedUserDefaults,\n\t\t\tcomponentsStore,\n\t\t\ttreeStore,\n\t\t\tchromeStore,\n\t\t\tloadedExternalModulesStore,\n\t\t} = engine.stores\n\t\tconst scopeType = scopeStore.scopeType\n\t\tconst scope = scopeStore.active\n\t\tconst scopeId = scope.id\n\t\tconst selection = selectionStore.ids\n\t\tconst selectionAsNodes = selectionStore.nodes\n\t\tconst isWireframerKitPage = isWebPageNode(scope) && !!scope.kitPage\n\n\t\tlet selectedLoadedModulesComponentsHash = \"\"\n\t\tfor (const node of selectionAsNodes) {\n\t\t\tif (!isCodeComponentNode(node)) continue\n\t\t\tif (!loadedExternalModulesStore.hasModuleForIdentifier(node.codeComponentIdentifier)) continue\n\t\t\tselectedLoadedModulesComponentsHash += \"_\" + node.codeComponentIdentifier\n\t\t}\n\n\t\tconst tool = toolStore.tool\n\t\tlet panelType = PanelType.Node\n\t\tif (\n\t\t\ttool === Tools.CreateScreen ||\n\t\t\t(scopeType === ScopeType.CanvasPage && tool === Tools.CreateFrame && selection.length === 0)\n\t\t) {\n\t\t\tpanelType = PanelType.FramePresets\n\t\t} else if (selection.length > 0 && tool === Tools.Scale) {\n\t\t\tpanelType = PanelType.Scale\n\t\t} else if (selection.length === 0) {\n\t\t\tif (experiments.isOn(\"agent\")) {\n\t\t\t\tpanelType = PanelType.PageProperties\n\t\t\t} else {\n\t\t\t\t// TODO: Lift this into the right panel logic and extract the logic that determines\n\t\t\t\t// if the onboarding panel should be shown. This needs to be done before releasing agents.\n\t\t\t\tpanelType = PanelType.Onboarding\n\t\t\t}\n\t\t} else if (selectionAsNodes.some(node => isSlotNode(node))) {\n\t\t\tpanelType = PanelType.LayoutTemplateEmptyState\n\t\t}\n\n\t\tconst singleSelectedNode = selectionStore.nodes.length === 1 ? selectionStore.nodes[0] : undefined\n\t\tconst showLayoutTemplate = isWebPageNode(scope) && isBreakpointVariant(singleSelectedNode)\n\n\t\tconst scaleAnchor = isScaleTool(engine.tool) ? engine.tool.anchor : undefined\n\t\tconst scaleFactor = isScaleTool(engine.tool) ? engine.tool.absoluteScaleFactor : undefined\n\t\tconst initialDimensions = isScaleTool(engine.tool) ? engine.tool.initialDimensions : undefined\n\t\tconst boundingFrame = isScaleTool(engine.tool) ? engine.tool.getCurrentBoundingFrame() : undefined\n\n\t\treturn {\n\t\t\ttool,\n\t\t\tselection,\n\t\t\tscopeType,\n\t\t\tscopeId,\n\t\t\tactiveLayoutTemplateId: showLayoutTemplate ? scope.layoutTemplateIdentifier : undefined,\n\t\t\tactiveLayoutTemplateUpdate: showLayoutTemplate ? scope.cache.controlPropVersion : -1,\n\t\t\tpanelType,\n\t\t\tselectedNodes: selectionAsNodes,\n\t\t\tselectedLoadedModulesComponentsHash,\n\t\t\tproseMirrorState: toolStore.proseMirrorState,\n\t\t\tdisplayGrids: persistedUserDefaults.displayGrids,\n\t\t\tcomponentHash: componentsStore.activeBundleHash,\n\t\t\tisViewOnly: getIsViewOnly(engine, \"canDesign\"),\n\t\t\tallNodesShareVariableContext: treeStore.allNodesShareVariableContext,\n\t\t\tdomLayoutUpdate: treeStore.domLayoutUpdate,\n\t\t\talignToParent: persistedUserDefaults.alignToParent,\n\t\t\tuserIsViewer: chromeStore.userIsViewer,\n\t\t\tappTourActive: chromeStore.isTutorialActive,\n\t\t\tscaleAnchor,\n\t\t\tscaleFactor,\n\t\t\tinitialDimensions,\n\t\t\tboundingFrame,\n\t\t\tisWireframerKitPage,\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst {\n\t\t\tpanelType,\n\t\t\tselection,\n\t\t\tselectedLoadedModulesComponentsHash,\n\t\t\tcomponentHash,\n\t\t\ttool,\n\t\t\tproseMirrorState,\n\t\t\tisViewOnly,\n\t\t\tselectedNodes,\n\t\t\tdisplayGrids,\n\t\t\tdomLayoutUpdate,\n\t\t\tscopeType,\n\t\t\tscopeId,\n\t\t\tactiveLayoutTemplateId,\n\t\t\tactiveLayoutTemplateUpdate,\n\t\t\tallNodesShareVariableContext,\n\t\t\talignToParent,\n\t\t\tuserIsViewer,\n\t\t\tappTourActive,\n\t\t\tscaleAnchor,\n\t\t\tscaleFactor,\n\t\t\tinitialDimensions,\n\t\t\tboundingFrame,\n\t\t\tisWireframerKitPage,\n\t\t} = this.state\n\n\t\tswitch (panelType) {\n\t\t\tcase PanelType.FramePresets:\n\t\t\t\treturn <FramePresetsPanel nodes={selectedNodes} />\n\n\t\t\tcase PanelType.Scale: {\n\t\t\t\tif (\n\t\t\t\t\tisUndefined(scaleFactor) ||\n\t\t\t\t\tisUndefined(scaleAnchor) ||\n\t\t\t\t\tisUndefined(initialDimensions) ||\n\t\t\t\t\tisUndefined(boundingFrame)\n\t\t\t\t) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<ScalePanel\n\t\t\t\t\t\tanchor={scaleAnchor}\n\t\t\t\t\t\tscaleFactor={scaleFactor}\n\t\t\t\t\t\tinitialDimensions={initialDimensions}\n\t\t\t\t\t\tboundingFrame={boundingFrame}\n\t\t\t\t\t\tselectedNodeIds={selection}\n\t\t\t\t\t\talignToParent={alignToParent}\n\t\t\t\t\t\treadOnly={isViewOnly}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tcase PanelType.Onboarding:\n\t\t\t\treturn <OnboardingPanel appTourActive={appTourActive} userIsViewer={userIsViewer} />\n\n\t\t\tcase PanelType.LayoutTemplateEmptyState:\n\t\t\t\treturn <LayoutTemplateEmptyStatePanel />\n\n\t\t\tcase PanelType.PageProperties:\n\t\t\t\treturn <PagePropertiesPanel scopeId={scopeId} />\n\n\t\t\tdefault:\n\t\t\t\treturn (\n\t\t\t\t\t<NodeProperties\n\t\t\t\t\t\tselectedLoadedModulesComponentsHash={selectedLoadedModulesComponentsHash}\n\t\t\t\t\t\tnodes={selectedNodes}\n\t\t\t\t\t\tselection={selection}\n\t\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\t\treadOnly={isViewOnly}\n\t\t\t\t\t\ttool={tool}\n\t\t\t\t\t\tproseMirrorState={proseMirrorState}\n\t\t\t\t\t\tdisplayGrids={displayGrids}\n\t\t\t\t\t\tscopeType={scopeType}\n\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\tactiveLayoutTemplateId={activeLayoutTemplateId}\n\t\t\t\t\t\tactiveLayoutTemplateUpdate={activeLayoutTemplateUpdate}\n\t\t\t\t\t\tdomLayoutUpdate={domLayoutUpdate}\n\t\t\t\t\t\tallNodesShareVariableContext={allNodesShareVariableContext}\n\t\t\t\t\t\talignToParent={alignToParent}\n\t\t\t\t\t\tisWireframerKitPage={isWireframerKitPage}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t}\n\t}\n}\n\nexport const PropertiesContainer = createContainer(Properties)\n", "import { EmptyState } from \"@framerjs/fresco\"\nimport React from \"react\"\n\nexport const LayoutTemplateEmptyStatePanel = React.memo(function LayoutTemplateEmptyStatePanel() {\n\treturn (\n\t\t<EmptyState\n\t\t\tcenter\n\t\t\ttitle=\"Layout Template\"\n\t\t\tbody={\n\t\t\t\t<>\n\t\t\t\t\tThis is where your page content\n\t\t\t\t\t<br />\n\t\t\t\t\twill appear. Use Layout Templates\n\t\t\t\t\t<br />\n\t\t\t\t\tto create reusable navs, footers,\n\t\t\t\t\t<br />\n\t\t\t\t\tsidebars, banners, and more.\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t)\n})\n", "import { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEffect } from \"react\"\nimport { useLocalStorage } from \"web/lib/useLocalStorage.ts\"\nimport { NuxPanel } from \"./NuxPanel.tsx\"\nimport { OwnershipTransferPanel } from \"./OwnershipTransferPanel.tsx\"\n\nconst TRANSFER_STATE_PREFIX = \"project-transfer-state-\"\n\ninterface Props {\n\tuserIsViewer: boolean\n\tappTourActive: boolean\n}\n\nexport function OnboardingPanel({ userIsViewer, appTourActive }: Props) {\n\tconst storageKey = `${TRANSFER_STATE_PREFIX}${engine.stores.projectStore.projectId}`\n\tconst [ownershipTransferState, setTransferState] = useLocalStorage<\"pending\" | \"dismissed\" | null>(storageKey, null)\n\tconst hasCompletedOwnershipTransfer = engine.stores.chromeStore.useState(state => state.hasCompletedOwnershipTransfer)\n\tconst templatesModalEnabled = useExperimentIsOn(\"templatesModal\")\n\n\tuseEffect(() => {\n\t\tif (!hasCompletedOwnershipTransfer) return\n\t\tif (ownershipTransferState) return\n\n\t\t// Set the transfer state to pending if not already set\n\t\tsetTransferState(\"pending\")\n\t}, [hasCompletedOwnershipTransfer, ownershipTransferState, setTransferState])\n\n\t// If user is a viewer or the app tour is active, show nothing\n\tif (userIsViewer || appTourActive) {\n\t\treturn null\n\t}\n\n\t// If transfer is dismissed, show nothing\n\tif (ownershipTransferState === \"dismissed\") {\n\t\treturn null\n\t}\n\n\t// If transfer is pending, show the transfer complete panel\n\tif (ownershipTransferState === \"pending\") {\n\t\treturn <OwnershipTransferPanel onDismiss={() => setTransferState(\"dismissed\")} />\n\t}\n\n\tif (templatesModalEnabled) {\n\t\treturn null\n\t}\n\t// Otherwise show the regular NUX panel\n\treturn <NuxPanel />\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { environment } from \"@framerjs/framer-environment\"\nimport { assert, isElectron, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport React, { useCallback, useEffect, useState } from \"react\"\nimport { isAbortError } from \"web/lib/Fetcher.ts\"\nimport { Achievement, updateAchievements, updateMultipleAchievements } from \"web/lib/achievements.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { DismissButton, Panel, PanelHeader, StepItem, StepsContainer } from \"./SharedPanelComponents.tsx\"\n\ninterface Step {\n\tid: Achievement\n\tstep: string\n\ttitle: string\n\tisCompleted?: () => boolean // Steps that include this check rely on other user actions to be completed\n\taction: { handler: () => void; label: string; shouldUpdateAchievement: boolean }\n}\n\nconst steps: Step[] = [\n\t{\n\t\tid: Achievement.InsertSomething,\n\t\tstep: \"1.\",\n\t\ttitle: \"Insert something\",\n\t\taction: {\n\t\t\thandler: () => {\n\t\t\t\tengine.stores.insertSidebarStore.activeCategoryType = null\n\t\t\t\tengine.stores.chromeStore.showInsertSidebar()\n\t\t\t},\n\t\t\tlabel: Dictionary.Start,\n\t\t\tshouldUpdateAchievement: false,\n\t\t},\n\t\tisCompleted: () => {\n\t\t\tconst { scopeStore } = engine.stores\n\t\t\t// Make sure the user has inserted something before scratching step 1\n\t\t\tif (scopeStore.getWebPageNodes().length > 1) return true\n\n\t\t\tconst activeScopeNode = scopeStore.active\n\t\t\tif (!activeScopeNode || !isWebPageNode(activeScopeNode)) return true\n\t\t\tif (activeScopeNode.children.length > 1) return true\n\n\t\t\tconst primaryBreakpointNode = activeScopeNode.getPrimaryVariant()\n\t\t\tif (!primaryBreakpointNode) return true\n\n\t\t\treturn !!primaryBreakpointNode.children.length\n\t\t},\n\t},\n\t{\n\t\tid: Achievement.WatchTutorial,\n\t\tstep: \"2.\",\n\t\ttitle: \"Watch tutorials\",\n\t\taction: {\n\t\t\thandler: () => openNewTab(\"https://www.framer.com/academy/\"),\n\t\t\tlabel: Dictionary.Learn,\n\t\t\tshouldUpdateAchievement: true,\n\t\t},\n\t},\n\t{\n\t\tid: Achievement.BrowseTemplates,\n\t\tstep: \"3.\",\n\t\ttitle: \"Try a template\",\n\t\taction: {\n\t\t\thandler: () => openNewTab(\"https://www.framer.com/templates/\"),\n\t\t\tlabel: Dictionary.Browse,\n\t\t\tshouldUpdateAchievement: true,\n\t\t},\n\t},\n\t{\n\t\tid: Achievement.BrowsePlugins,\n\t\tstep: \"4.\",\n\t\ttitle: \"Try a plugin\",\n\t\taction: {\n\t\t\thandler: () => openNewTab(\"https://www.framer.com/marketplace/plugins/\"),\n\t\t\tlabel: Dictionary.Browse,\n\t\t\tshouldUpdateAchievement: true,\n\t\t},\n\t},\n\t{\n\t\tid: Achievement.GetApp,\n\t\tstep: \"5.\",\n\t\ttitle: \"Get desktop app\",\n\t\taction: {\n\t\t\thandler: () => openNewTab(\"https://www.framer.com/downloads/\"),\n\t\t\tlabel: Dictionary.Install,\n\t\t\tshouldUpdateAchievement: true,\n\t\t},\n\t\tisCompleted: () => isElectron(),\n\t},\n]\n\nexport function NuxPanel() {\n\tconst [achievements, setAchievements] = useState<Record<string, boolean> | undefined>()\n\tconst shouldHideNuxPanel = environment.isAutomation || environment.isTest\n\n\tuseEffect(() => {\n\t\tif (shouldHideNuxPanel) return\n\t\tconst abortController = new AbortController()\n\n\t\tgetUser(abortController.signal)\n\t\t\t.then(user => setAchievements(user.achievements ?? {}))\n\t\t\t.catch(error => {\n\t\t\t\tif (!isAbortError(error)) unhandledError(error)\n\t\t\t\t// The request was cancelled by an abort controller, after triggering a new request.\n\t\t\t\t// This should not log the error nor lead to an error UI, but remain loading.\n\t\t\t\t// See https://developer.mozilla.org/en-US/docs/Web/API/AbortController\n\t\t\t})\n\n\t\treturn () => abortController.abort()\n\t}, [shouldHideNuxPanel])\n\n\tif (shouldHideNuxPanel || !achievements) return null\n\n\tconst dismissed = achievements[Achievement.DismissAll] === true\n\tif (dismissed) return null\n\n\tconst allAchievementsHaveBeenCompleted = steps.every(({ id }) => achievements[id] === true)\n\tif (allAchievementsHaveBeenCompleted) return null\n\n\treturn <NuxPanelInner achievements={achievements} steps={steps} setAchievements={setAchievements} />\n}\n\ninterface InnerPanelProps {\n\tachievements: Record<string, boolean>\n\tsteps: Step[]\n\tsetAchievements: React.Dispatch<React.SetStateAction<Record<string, boolean>>>\n}\n\nconst NuxPanelInner = React.memo(function NuxPanelInner({ achievements, steps, setAchievements }: InnerPanelProps) {\n\tconst updateAchievement = useCallback(\n\t\tasync (id: Achievement) => {\n\t\t\t// Setting optimistic state\n\t\t\tsetAchievements(prev => ({ ...prev, [id]: true }))\n\n\t\t\ttry {\n\t\t\t\tawait updateAchievements(achievements, id)\n\t\t\t} catch (e) {\n\t\t\t\t// Reverting optimistic state in case of error\n\t\t\t\tsetAchievements(prev => {\n\t\t\t\t\tconst updated = { ...prev }\n\t\t\t\t\tdelete updated[id]\n\t\t\t\t\treturn updated\n\t\t\t\t})\n\t\t\t\tunhandledError(e)\n\t\t\t}\n\t\t},\n\t\t[achievements, setAchievements],\n\t)\n\n\tconst updateUserAchievements = useCallback(\n\t\tasync (newAchievements: Achievement[]) => {\n\t\t\t// Setting optimistic state for all achievements\n\t\t\tsetAchievements(prev => {\n\t\t\t\tconst updated = { ...prev }\n\t\t\t\tfor (const id of newAchievements) updated[id] = true\n\t\t\t\treturn updated\n\t\t\t})\n\n\t\t\ttry {\n\t\t\t\tawait updateMultipleAchievements(achievements, newAchievements)\n\t\t\t} catch (e) {\n\t\t\t\t// Reverting optimistic state in case of error\n\t\t\t\tsetAchievements(prev => {\n\t\t\t\t\tconst reverted = { ...prev }\n\t\t\t\t\tfor (const id of newAchievements) delete reverted[id]\n\t\t\t\t\treturn reverted\n\t\t\t\t})\n\t\t\t\tunhandledError(e)\n\t\t\t}\n\t\t},\n\t\t[achievements, setAchievements],\n\t)\n\n\tconst dismissAll = useCallback(async () => {\n\t\tawait updateAchievement(Achievement.DismissAll)\n\t}, [updateAchievement])\n\n\tuseEffect(() => {\n\t\t// Check if steps that are dependant on other user actions have been completed meanwhile\n\t\tconst stepsToUpdate: Achievement[] = []\n\t\tsteps.forEach(step => {\n\t\t\tif (!achievements[step.id] && step.isCompleted?.()) {\n\t\t\t\tstepsToUpdate.push(step.id)\n\t\t\t}\n\t\t})\n\n\t\tif (stepsToUpdate.length > 0) {\n\t\t\tvoid updateUserAchievements(stepsToUpdate)\n\t\t}\n\t}, [achievements, steps, updateUserAchievements])\n\n\tconst nextAvailableStepId = React.useMemo(() => getNextAvailableStepId(steps, achievements), [steps, achievements])\n\n\treturn (\n\t\t<Panel>\n\t\t\t<PanelHeader title=\"Welcome to Framer\" subtitle=\"Get started in 5 steps\" />\n\t\t\t<StepsContainer>\n\t\t\t\t{steps.map(step => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Step\n\t\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\t\t{...step}\n\t\t\t\t\t\t\tisDone={achievements[step.id] === true}\n\t\t\t\t\t\t\tisNextAvailableStep={step.id === nextAvailableStepId}\n\t\t\t\t\t\t\tupdateAchievement={updateAchievement}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</StepsContainer>\n\t\t\t<DismissButton onClick={dismissAll} label={Dictionary.Hide} />\n\t\t</Panel>\n\t)\n})\n\ntype StepProps = Step & {\n\tisDone: boolean\n\tisNextAvailableStep: boolean\n\tupdateAchievement: (id: Achievement) => void\n}\n\nfunction Step({ id, step, title, action, isDone, isNextAvailableStep, updateAchievement }: StepProps) {\n\tconst onClick = useCallback(async () => {\n\t\trecord(\"ui_interaction\", { page: Pages.nuxPanel, id })\n\t\taction.handler()\n\n\t\t// Steps that include this check rely on other user actions to be completed\n\t\tif (!action.shouldUpdateAchievement) return\n\n\t\tawait updateAchievement(id)\n\t}, [action, id, updateAchievement])\n\n\treturn (\n\t\t<StepItem\n\t\t\tstepNumber={step}\n\t\t\ttitle={title}\n\t\t\tisDone={isDone}\n\t\t\tisHighlighted={isNextAvailableStep}\n\t\t\taction={{ label: action.label, onClick }}\n\t\t/>\n\t)\n}\n\nfunction getNextAvailableStepId(steps: Step[], achievements: Record<string, boolean>) {\n\tlet nextAvailableStepId: string | undefined\n\n\tfor (let index = 0; index < steps.length; index++) {\n\t\tconst previousStepId = steps[index - 1]?.id\n\t\tconst currentStepId = steps[index]?.id\n\t\tassert(currentStepId, \"current step must exist\")\n\t\tconst isCurrentStepDone = achievements[currentStepId] === true\n\t\tif (isCurrentStepDone) continue\n\n\t\tif (!previousStepId) {\n\t\t\tnextAvailableStepId = currentStepId\n\t\t\tbreak\n\t\t}\n\n\t\tconst isPreviousStepDone = achievements[previousStepId] === true\n\t\tif (isPreviousStepDone) {\n\t\t\tnextAvailableStepId = currentStepId\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nextAvailableStepId\n}\n\nasync function getUser(signal?: AbortSignal) {\n\treturn apiFetcher.get(\"/web/users/me\", {}, signal)\n}\n", "import { apiFetcher } from \"./apiFetcher.ts\"\n\n// If you update any of Achievement strings, the NUX panel will show up again.\n// If that's not the behavior that you want, please update the code in NuxPanel.tsx to handle it correctly\nexport enum Achievement {\n\tWatchTutorial = \"watch-tutorial\",\n\tBrowseTemplates = \"browse-templates\",\n\tGetApp = \"get-app\",\n\tImportFromFigma = \"import-from-figma\",\n\tInstallHtmlExtension = \"install-html-extension\",\n\tDismissAll = \"dismiss-all\",\n\tInsertSomething = \"insert-something\",\n\tBrowsePlugins = \"browse-plugins\",\n}\n\nexport function updateAchievements(achievements: Record<string, boolean>, step: Achievement) {\n\treturn apiFetcher.post(`/web/users/achievements`, { ...achievements, [step]: true })\n}\n\nexport function updateMultipleAchievements(achievements: Record<string, boolean>, steps: Achievement[]) {\n\tconst newAchievements = steps.reduce(\n\t\t(acc, step) => {\n\t\t\tacc[step] = true\n\t\t\treturn acc\n\t\t},\n\t\t{} as Record<Achievement, boolean>,\n\t)\n\n\treturn apiFetcher.post(`/web/users/achievements`, {\n\t\t...achievements,\n\t\t...newAchievements,\n\t})\n}\n\nexport function resetAchievements() {\n\treturn apiFetcher.post(`/web/users/achievements`, {})\n}\n", "import \"SharedPanelStyles.styles_fe35zy.wyw.css\"; export const panel = \"panel_p10j9iyq\";\nexport const stepsWrapper = \"stepsWrapper_sjl1n2z\";\nexport const stepItem = \"stepItem_s1ox0cdu\";\nexport const button = \"button_b6apvvo\";\nexport const logo = \"logo_l1bmrb1p\";\nexport const logoWrapper = \"logoWrapper_l61qqa0\";\nexport const header = \"header_hm92zu5\";\nexport const headerTitle = \"headerTitle_h7n3yd0\";\nexport const headerSubtitle = \"headerSubtitle_h16x8se6\";\nexport const stepTitle = \"stepTitle_s14i4wzr\";\nexport const titleDisabled = \"titleDisabled_toth7lh\";\nexport const stepNumber = \"stepNumber_s14ho0p4\";\nexport const stepNumberDisabled = \"stepNumberDisabled_sm1gkvu\";\nexport const nextStep = \"nextStep_n1dscswb\";\nexport const dismissButton = \"dismissButton_doljoss\";", "import { Button, IconFramerLogo, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport type React from \"react\"\nimport * as styles from \"./SharedPanelStyles.styles.ts\"\n\ninterface PanelProps {\n\tchildren: React.ReactNode\n}\n\nexport function Panel({ children }: PanelProps) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName={styles.panel}\n\t\t\tpadding=\"0 15px\"\n\t\t\tdirection=\"column\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"flex-start\"\n\t\t\tgap={0}\n\t\t>\n\t\t\t{children}\n\t\t</Stack>\n\t)\n}\n\ninterface PanelHeaderProps {\n\ttitle: string\n\tsubtitle: string\n}\n\nexport function PanelHeader({ title, subtitle }: PanelHeaderProps) {\n\treturn (\n\t\t<Stack className={styles.header} direction=\"column\" alignItems=\"center\" justifyContent=\"center\" gap={15}>\n\t\t\t<Stack className={styles.logoWrapper} direction=\"column\" alignItems=\"center\" justifyContent=\"center\">\n\t\t\t\t<IconFramerLogo className={styles.logo} />\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"column\" gap={4} alignItems=\"center\" justifyContent=\"center\">\n\t\t\t\t<T className={styles.headerTitle}>{title}</T>\n\t\t\t\t<T className={styles.headerSubtitle}>{subtitle}</T>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\ninterface StepsContainerProps {\n\tchildren: React.ReactNode\n}\n\nexport function StepsContainer({ children }: StepsContainerProps) {\n\treturn (\n\t\t<Stack className={styles.stepsWrapper} direction=\"column\" gap={10}>\n\t\t\t{children}\n\t\t</Stack>\n\t)\n}\n\ninterface StepItemProps {\n\tstepNumber: string\n\ttitle: string\n\tisDone: boolean\n\tisHighlighted?: boolean\n\taction?: {\n\t\tlabel: string\n\t\tonClick: () => void\n\t}\n}\n\nexport function StepItem({ stepNumber, title, isDone, isHighlighted = false, action }: StepItemProps) {\n\treturn (\n\t\t<Stack\n\t\t\tclassName={cx(styles.stepItem, isHighlighted && styles.nextStep)}\n\t\t\tpadding=\"10px 10px 10px 18px\"\n\t\t\tdirection=\"row\"\n\t\t\tgap={10}\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t>\n\t\t\t<Stack gap={10} direction=\"row\" justifyContent=\"center\" alignItems=\"flex-start\">\n\t\t\t\t<T className={cx(styles.stepNumber, isDone && styles.stepNumberDisabled)}>{stepNumber}</T>\n\t\t\t\t<T className={cx(styles.stepTitle, isDone && styles.titleDisabled)}>{title}</T>\n\t\t\t</Stack>\n\t\t\t{action && (\n\t\t\t\t<Button\n\t\t\t\t\tclassName={styles.button}\n\t\t\t\t\tvariant={isHighlighted ? \"withDepthPrimary\" : \"withDepth\"}\n\t\t\t\t\tonClick={action.onClick}\n\t\t\t\t>\n\t\t\t\t\t<T>{action.label}</T>\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\ninterface DismissButtonProps {\n\tonClick: () => void\n\tlabel?: string\n}\n\nexport function DismissButton({ onClick, label = \"Dismiss\" }: DismissButtonProps) {\n\treturn (\n\t\t<Button className={styles.dismissButton} onClick={onClick}>\n\t\t\t{label}\n\t\t</Button>\n\t)\n}\n", "import { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { isPublishError } from \"document/stores/PublishStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { DismissButton, Panel, PanelHeader, StepItem, StepsContainer } from \"./SharedPanelComponents.tsx\"\n\ninterface Props {\n\tonDismiss: () => void\n}\n\nconst page = Pages.ownershipTransferPanel\n\nexport function OwnershipTransferPanel({ onDismiss }: Props) {\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\n\tuseRecordEffect(\"ui_impression\", { page })\n\n\tconst hasSitePlan = engine.stores.projectStore.useState(\n\t\t({ projectLicenseType }) => projectLicenseType !== ProjectLicenseType.FreeSite,\n\t)\n\n\tconst { hasPaidCustomDomain, isPublishedToCustomDomain } = useEngineState(\n\t\t() =>\n\t\t\tengine.stores.publishStore.customHostname &&\n\t\t\t!engine.stores.publishStore.isFreeDomain(engine.stores.publishStore.customHostname.hostname)\n\t\t\t\t? {\n\t\t\t\t\t\thasPaidCustomDomain: true,\n\t\t\t\t\t\tisPublishedToCustomDomain: Boolean(engine.stores.publishStore.customHostnameDeployment),\n\t\t\t\t\t}\n\t\t\t\t: { hasPaidCustomDomain: false, isPublishedToCustomDomain: false },\n\t\t[],\n\t\t[engine.stores.publishStore],\n\t)\n\n\tconst onUpgradeClick = useCallback(() => {\n\t\tconst project = engine.stores.projectStore.project\n\t\tupdatePurchaseOrigin(\n\t\t\tUpsellType.ownershipTransferUpsell,\n\t\t\tproject\n\t\t\t\t? {\n\t\t\t\t\t\tprojectId: project.id,\n\t\t\t\t\t\tsite: project.license.type,\n\t\t\t\t\t\tteam: project.teamLicenseType,\n\t\t\t\t\t}\n\t\t\t\t: null,\n\t\t\tnull,\n\t\t)\n\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: UpsellType.ownershipTransferUpsell,\n\t\t\tid: UpsellUIInteraction.confirmInAppUpsell,\n\t\t})\n\n\t\tvoid engine.stores.siteSettingsStore.setActiveTab({\n\t\t\ttab: SiteSettingsTabNames.plans,\n\t\t})\n\t}, [updatePurchaseOrigin])\n\n\tconst onDismissClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.dismiss })\n\t\tif (!hasSitePlan) {\n\t\t\t// Dismissing the modal dismisses the upsell\n\t\t\t// (the upgrade button shown when the user has no site plan)\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: UpsellType.ownershipTransferUpsell,\n\t\t\t\tid: UpsellUIInteraction.cancelUpsell,\n\t\t\t})\n\t\t}\n\t\tonDismiss()\n\t}, [hasSitePlan, onDismiss])\n\n\treturn (\n\t\t<Panel>\n\t\t\t<PanelHeader title=\"Welcome to Framer\" subtitle=\"Get started in 4 steps\" />\n\t\t\t<StepsContainer>\n\t\t\t\t<StepItem stepNumber=\"1.\" title=\"Complete transfer\" isDone />\n\t\t\t\t<StepItem\n\t\t\t\t\tstepNumber=\"2.\"\n\t\t\t\t\ttitle=\"Select a plan\"\n\t\t\t\t\tisDone={hasSitePlan}\n\t\t\t\t\tisHighlighted={!hasSitePlan}\n\t\t\t\t\taction={hasSitePlan ? undefined : { label: \"Upgrade\", onClick: onUpgradeClick }}\n\t\t\t\t/>\n\t\t\t\t<StepItem\n\t\t\t\t\tstepNumber=\"3.\"\n\t\t\t\t\ttitle=\"Connect a domain\"\n\t\t\t\t\tisDone={hasPaidCustomDomain}\n\t\t\t\t\tisHighlighted={hasSitePlan && !hasPaidCustomDomain}\n\t\t\t\t\taction={hasPaidCustomDomain ? undefined : { label: Dictionary.Add, onClick: onAddDomainClick }}\n\t\t\t\t/>\n\t\t\t\t<StepItem\n\t\t\t\t\tstepNumber=\"4.\"\n\t\t\t\t\ttitle=\"Publish your site\"\n\t\t\t\t\t// this is never marked as done, because we require the user to\n\t\t\t\t\t// click the publish button and dismiss the whole panel\n\t\t\t\t\tisDone={false}\n\t\t\t\t\tisHighlighted={hasSitePlan && hasPaidCustomDomain}\n\t\t\t\t\taction={{\n\t\t\t\t\t\tlabel: \"Publish\",\n\t\t\t\t\t\tonClick: async () => {\n\t\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.publishSite })\n\t\t\t\t\t\t\tconst published = await engine.stores.publishStore.publish()\n\t\t\t\t\t\t\tif (!isPublishError(published) && isPublishedToCustomDomain && hasPaidCustomDomain) onDismiss()\n\t\t\t\t\t\t},\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</StepsContainer>\n\t\t\t<DismissButton onClick={onDismissClick} />\n\t\t</Panel>\n\t)\n}\n\nfunction onAddDomainClick() {\n\trecord(\"ui_interaction\", { page, id: UIInteraction.openSiteSettingsDomains })\n\tvoid engine.stores.siteSettingsStore.setActiveTab({\n\t\ttab: SiteSettingsTabNames.domains,\n\t})\n}\n", "import type { NodeID } from \"@framerjs/document-snapshotter/src/serializer/DocumentParserInterface.ts\"\nimport { ReadOnlyContext, type ScrollOffsetRestorationCache, ScrollWithOffsetRestoration } from \"@framerjs/fresco\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withControlProps } from \"document/models/CanvasTree/traits/WithControlProps.ts\"\nimport { hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { NotFound } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport {\n\ttype ReducedRootFontSize,\n\treduceRootFontSize,\n} from \"document/models/CanvasTree/traits/utils/reduceRootFontSize.ts\"\nimport {\n\ttype ReducedControlProps,\n\tgetReducedControlProps,\n} from \"document/models/controlProps/getReducedControlProps.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useAndAssertVekterEngine } from \"document/useVekterEngine.ts\"\nimport { ImageExporter } from \"export/ImageExporter.ts\"\nimport { useMemo } from \"react\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { LayoutTemplatePropsPanel } from \"./LayoutTemplatePropsPanel.tsx\"\nimport * as styles from \"./PagePropertiesPanel.styles.ts\"\nimport { ExportPanel } from \"./panels/ExportPanel.tsx\"\nimport { TypographyPanel } from \"./panels/TypographyPanel.tsx\"\n\nconst scrollOffsetRestorationCache: ScrollOffsetRestorationCache = new Map()\n\ninterface PagePropertiesState {\n\tprimaryVariant: CanvasNode\n\trootFontSize: ReducedRootFontSize[\"rootFontSize\"] | undefined\n\tactiveLayoutTemplateId: LocalModuleExportIdentifierString | undefined\n\tcomponentHash: string\n\tisWebPage: boolean\n}\n\ninterface Props {\n\tscopeId: NodeID\n}\n\nexport function PagePropertiesPanel({ scopeId }: Props) {\n\tconst engine = useAndAssertVekterEngine()\n\tconst isViewOnly = getIsViewOnly(engine, \"canDesign\")\n\n\t// Get the scope node and check if it's a WebPage without a layout template\n\tconst state = useEngineState<PagePropertiesState | undefined>(\n\t\t() => {\n\t\t\tconst componentHash = engine.stores.componentsStore.activeBundleHash\n\n\t\t\t// Get the scope node from the tree\n\t\t\tconst scope = engine.tree.get(scopeId)\n\n\t\t\t// Only show typography for WebPageNodes without a layout template\n\t\t\tconst isWebPage = isWebPageNode(scope)\n\t\t\tconst isNodeSupported = isWebPage || isLayoutTemplateNode(scope)\n\t\t\tif (!isNodeSupported || !scope.isLoaded()) return\n\n\t\t\tconst primaryVariant = scope.getPrimaryVariant()\n\n\t\t\tlet rootFontSize: ReducedRootFontSize[\"rootFontSize\"] | undefined\n\n\t\t\t// Only show typography for WebPageNodes without a layout template\n\t\t\tif (!hasLayoutTemplate(scope)) {\n\t\t\t\t// The TypographyPanel expects a ReducedRootFontSize, so we need to reduce the root font size\n\t\t\t\t// for the primary variant node.\n\t\t\t\tconst result: ReducedRootFontSize = {\n\t\t\t\t\trootFontSize: NotFound,\n\t\t\t\t}\n\n\t\t\t\treduceRootFontSize(primaryVariant, result)\n\n\t\t\t\trootFontSize = result.rootFontSize\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tprimaryVariant,\n\t\t\t\trootFontSize,\n\t\t\t\tactiveLayoutTemplateId: hasLayoutTemplate(scope) ? scope.layoutTemplateIdentifier : undefined,\n\t\t\t\tcomponentHash,\n\t\t\t\tisWebPage,\n\t\t\t}\n\t\t},\n\t\t[scopeId],\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle],\n\t)\n\n\tconst nodeIds = useMemo<NodeID[]>(\n\t\t() => (state?.primaryVariant ? [state.primaryVariant.id] : []),\n\t\t[state?.primaryVariant],\n\t)\n\n\tconst nodes = useMemo<CanvasNode[]>(\n\t\t() => (state?.primaryVariant ? [state.primaryVariant] : []),\n\t\t[state?.primaryVariant],\n\t)\n\n\t// Compute layout template controlProps\n\tconst layoutTemplateControlProps = useMemo<ReducedControlProps | undefined>(() => {\n\t\tif (!state?.isWebPage || !state?.activeLayoutTemplateId) return\n\n\t\tconst scope = engine.tree.get(scopeId)\n\t\tif (!scope || !withControlProps(scope)) return\n\n\t\tconst component = engine.componentLoader.reactComponentForIdentifier(state.activeLayoutTemplateId)\n\t\tif (!component) return\n\n\t\treturn getReducedControlProps(component.properties, [scope.getControlProps(component.properties)])\n\t}, [scopeId, state?.isWebPage, state?.activeLayoutTemplateId])\n\n\tif (!state) return null\n\n\tconst { isWebPage, primaryVariant, activeLayoutTemplateId, rootFontSize, componentHash } = state\n\n\treturn (\n\t\t<ScrollWithOffsetRestoration\n\t\t\tclassName={styles.panel}\n\t\t\trestorationID=\"page-panel\"\n\t\t\trestorationCache={scrollOffsetRestorationCache}\n\t\t>\n\t\t\t<ReadOnlyContext.Provider value={isViewOnly}>\n\t\t\t\t{rootFontSize && <TypographyPanel nodeIds={nodeIds} rootFontSize={rootFontSize} />}\n\n\t\t\t\t{isWebPage && (\n\t\t\t\t\t<LayoutTemplatePropsPanel\n\t\t\t\t\t\tscopeId={scopeId}\n\t\t\t\t\t\tactiveLayoutTemplateId={activeLayoutTemplateId}\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tcontrolPropsIdentifier={activeLayoutTemplateId}\n\t\t\t\t\t\tcontrolProps={layoutTemplateControlProps}\n\t\t\t\t\t\tcomponentHash={componentHash}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\n\t\t\t\t{ImageExporter.isAvailable && (\n\t\t\t\t\t<ExportPanel nodes={nodes} selection={nodeIds} isViewOnly={isViewOnly} selectionHash={primaryVariant.id} />\n\t\t\t\t)}\n\t\t\t</ReadOnlyContext.Provider>\n\t\t</ScrollWithOffsetRestoration>\n\t)\n}\n", "import \"PagePropertiesPanel.styles_1qpn4gw.wyw.css\"; export const panel = \"panel_p1egi574\";", "import {\n\tButton,\n\tComboBox,\n\ttype ComboBoxListItem,\n\ttype ComboBoxProps,\n\tInputHashContext,\n\ttype NumberInputProps,\n\tNumberInputWithTicker,\n} from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { MULT_SYMBOL, isScaleTool } from \"document/components/tools/ScaleTool.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { FramePoint, type FramePointValue } from \"document/models/FramePoint.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { type Point, type Rect, type Size, roundedNumber } from \"library/index.ts\"\nimport { memo, useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { AlignmentGridInput } from \"../inputs/AlignmentGridInput.tsx\"\nimport { PanelRow } from \"../rows/PanelRow.tsx\"\nimport { doubleColumnClass } from \"../utils/doubleColumn.styles.ts\"\nimport { AlignmentHeader } from \"./AlignmentHeader.tsx\"\nimport { Panel } from \"./Panel.tsx\"\nimport { PanelSectionHeader } from \"./PanelSectionHeader.tsx\"\nimport * as styles from \"./ScalePanel.styles.ts\"\n\ninterface Props {\n\tanchor: Point\n\tscaleFactor: number\n\tinitialDimensions: Size\n\tboundingFrame: Rect\n\tselectedNodeIds: NodeID[]\n\talignToParent: boolean\n\treadOnly: boolean\n}\n\nconst originMinValue = 0\nconst originMaxValue = 100\n\n// will match up to 2 instances of x, otherwise will the match will fail. fixes regex warning about quadratic runtime with `+` matcher\nconst multRegexPattern = `[${MULT_SYMBOL}x]{1,2}$`\nconst comboBoxRegex = new RegExp(multRegexPattern, \"giu\")\n\nconst getScaleFactorValue = (scaleFactor: number) => `${scaleFactor}${MULT_SYMBOL}`\n\nconst getScaleFactorItem = (factor: number): ComboBoxListItem => {\n\treturn {\n\t\tvalue: getScaleFactorValue(factor),\n\t\ttype: \"option\",\n\t}\n}\n\nconst staticScaleFactors = [0.25, 0.5, 0.75, 1, 2, 3, 4, 5, 10]\nconst staticScaleFactorSet = new Set(staticScaleFactors)\nconst staticScaleFactorOptions = staticScaleFactors.map(getScaleFactorItem)\n\nconst getScaleFactorItems = (roundedScaleFactor: number): ComboBoxListItem[] => {\n\tconst isCustomScale = !staticScaleFactorSet.has(roundedScaleFactor)\n\n\treturn isCustomScale\n\t\t? [roundedScaleFactor, ...staticScaleFactors].sort((a, b) => a - b).map(getScaleFactorItem)\n\t\t: staticScaleFactorOptions\n}\n\nconst getFxFy = (value: number): FramePointValue => {\n\tif (value < 0.25) return 0\n\tif (value < 0.75) return 0.5\n\treturn 1\n}\n\nexport function getNewAnchor(x: number, y: number, framePoints: FramePoint[]): FramePoint {\n\tconst fx = getFxFy(x)\n\tconst fy = getFxFy(y)\n\n\t// Find the frame point that matches these fx/fy values\n\tconst anchor = framePoints.find(point => point.fx === fx && point.fy === fy)\n\tassert(anchor, \"Anchor not found\")\n\treturn anchor\n}\n\nexport function calcScaleFactorFromDimensionChange(newDimension: number, oldDimension: number): number {\n\treturn roundedNumber(newDimension, 2) / oldDimension\n}\n\nfunction handleDimensionChange(value: number, initialValue: number, event?: React.ChangeEvent | React.KeyboardEvent) {\n\tassert(isScaleTool(engine.tool), \"Tool is not a scale tool\")\n\n\t// Prevents the form from submitting\n\tif (event && \"key\" in event && event.key === \"Enter\") {\n\t\tevent.preventDefault()\n\t}\n\n\tconst newScaleFactor = calcScaleFactorFromDimensionChange(value, initialValue)\n\tengine.tool.setAbsoluteScaleFactorForNextUpdate(newScaleFactor, \"dimensionInput\")\n\n\t// Scrubbing does not have an event, so when the user does not scrub, we don't want the outline to be hidden.\n\t// However, this does not catch the clicking up/down on the ticker cases, but it does capture the arrow up/down cases.\n\tif (event) {\n\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\t}\n}\n\nexport function ScalePanel({\n\tanchor,\n\tscaleFactor,\n\tinitialDimensions,\n\tboundingFrame,\n\tselectedNodeIds,\n\talignToParent,\n\treadOnly,\n}: Props) {\n\tconst selectionHash = selectedNodeIds.join(\"\")\n\n\tconst nodes = useMemo(() => engine.tree.getNodes(selectedNodeIds), [selectedNodeIds])\n\n\tconst anchorX = anchor.x\n\tconst anchorY = anchor.y\n\n\tconst handleAnchorChange = useEngineCallback((newAnchor: Point) => {\n\t\tassert(isScaleTool(engine.tool), \"Tool is not a scale tool\")\n\t\tengine.tool.anchor = newAnchor\n\t}, [])\n\n\tconst handleWidthChange: NumberInputProps[\"onChange\"] = useEngineCallback(\n\t\t(value, _final, _reset, event) => {\n\t\t\thandleDimensionChange(value, initialDimensions.width, event)\n\t\t},\n\t\t[initialDimensions.width],\n\t)\n\n\tconst handleHeightChange: NumberInputProps[\"onChange\"] = useEngineCallback(\n\t\t(value, _final, _reset, event) => {\n\t\t\thandleDimensionChange(value, initialDimensions.height, event)\n\t\t},\n\t\t[initialDimensions.height],\n\t)\n\n\treturn (\n\t\t<InputHashContext.Provider value={selectionHash}>\n\t\t\t<ScalePanelMemoized\n\t\t\t\tscaleFactor={scaleFactor}\n\t\t\t\tnodes={nodes}\n\t\t\t\talignToParent={alignToParent}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tonAnchorChange={handleAnchorChange}\n\t\t\t\tanchorX={anchorX}\n\t\t\t\tanchorY={anchorY}\n\t\t\t\twidth={boundingFrame.width}\n\t\t\t\theight={boundingFrame.height}\n\t\t\t\tonWidthChange={handleWidthChange}\n\t\t\t\tonHeightChange={handleHeightChange}\n\t\t\t\tinitialWidth={initialDimensions.width}\n\t\t\t\tinitialHeight={initialDimensions.height}\n\t\t\t/>\n\t\t</InputHashContext.Provider>\n\t)\n}\n\nconst relativeFramePoints = FramePoint.fromFrame({ x: 0, y: 0, width: 1, height: 1 })\ninterface ScalePanelMemoizedProps {\n\tscaleFactor: number\n\tnodes: CanvasNode[]\n\talignToParent: boolean\n\treadOnly: boolean\n\tanchorX: number\n\tanchorY: number\n\tonAnchorChange: (anchor: Point) => void\n\twidth: number\n\theight: number\n\tonWidthChange: NumberInputProps[\"onChange\"]\n\tonHeightChange: NumberInputProps[\"onChange\"]\n\tinitialWidth: number\n\tinitialHeight: number\n}\nconst ScalePanelMemoized = memo(function ScalePanelMemoized({\n\tscaleFactor,\n\tnodes,\n\talignToParent,\n\treadOnly,\n\tonAnchorChange,\n\tanchorX,\n\tanchorY,\n\twidth,\n\theight,\n\tonHeightChange,\n\tonWidthChange,\n\tinitialWidth,\n\tinitialHeight,\n}: ScalePanelMemoizedProps) {\n\tconst comboBoxRef = useRef<HTMLInputElement>(null)\n\tconst roundedScaleFactor = useMemo(() => roundedNumber(scaleFactor, 2), [scaleFactor])\n\tconst comboBoxItems = useMemo(() => getScaleFactorItems(roundedScaleFactor), [roundedScaleFactor])\n\tconst checkedComboBoxItems = useMemo(() => [getScaleFactorValue(roundedScaleFactor)], [roundedScaleFactor])\n\n\tuseEffect(() => {\n\t\tcomboBoxRef.current?.focus()\n\t}, [])\n\n\tconst handleAnchorXChange = useCallback(\n\t\t(x: number) => {\n\t\t\tconst newAnchor: Point = { x: roundedNumber(x / 100, 2), y: anchorY }\n\t\t\tonAnchorChange(newAnchor)\n\t\t},\n\t\t[anchorY, onAnchorChange],\n\t)\n\n\tconst handleAnchorYChange = useCallback(\n\t\t(y: number) => {\n\t\t\tconst newAnchor: Point = { x: anchorX, y: roundedNumber(y / 100, 2) }\n\t\t\tonAnchorChange(newAnchor)\n\t\t},\n\t\t[anchorX, onAnchorChange],\n\t)\n\n\tconst anchor = getNewAnchor(anchorX, anchorY, relativeFramePoints)\n\n\tconst handleAnchorFramePointChange = useCallback(\n\t\t(framePoint: FramePoint) => {\n\t\t\tconst newOriginX = framePoint?.fx ?? 0\n\t\t\tconst newOriginY = framePoint?.fy ?? 0\n\n\t\t\tconst newAnchor: Point = { x: newOriginX, y: newOriginY }\n\t\t\tonAnchorChange(newAnchor)\n\t\t},\n\t\t[onAnchorChange],\n\t)\n\n\tconst handleComboBoxChange: ComboBoxProps[\"onChange\"] = useEngineCallback(\n\t\t(newValue, _final, reset, event) => {\n\t\t\tif (!isScaleTool(engine.tool)) return\n\n\t\t\tconst keyboardEvent = event && \"key\" in event ? event : undefined\n\n\t\t\t// Skips form lifecycle in order to control when to close when `enter` is pressed.\n\t\t\t// Not needed at this moment for `mouseDown` or `blur` events. Because `constantChange` prop is false\n\t\t\t// by default, there are no change events.\n\t\t\tif (keyboardEvent) {\n\t\t\t\tkeyboardEvent.preventDefault()\n\t\t\t}\n\n\t\t\tconst stringWithoutX = newValue.replace(comboBoxRegex, \"\")\n\t\t\tconst newScaleFactor = roundedNumber(Number(stringWithoutX), 2)\n\n\t\t\tif (isNumber(newScaleFactor)) {\n\t\t\t\tengine.tool.setAbsoluteScaleFactorForNextUpdate(newScaleFactor, \"scaleInput\")\n\t\t\t\tengine.stores.selectionOutlineTracker.forceEnableSelectionOutline()\n\n\t\t\t\tif (keyboardEvent?.key === \"Enter\") {\n\t\t\t\t\t// Since the scale value is the same as before, we need to manually exit the tool instead of relying\n\t\t\t\t\t// on the flag on the bottom of the method. Otherwise, it will require an extra `enter` press. This\n\t\t\t\t\t// can happen by clicking on the dropdown, or setting a scale factor and blurring away.\n\t\t\t\t\t// TODO: Find rounding bug that can occur when input scale factor !== `scaleFactor` with many decimals.\n\t\t\t\t\tif (newScaleFactor === scaleFactor) {\n\t\t\t\t\t\tengine.exitTool()\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// This occurs when a user types in a new value or selects one from the dropdown and confirms with `enter`.\n\t\t\t\t\t\t// We can't rely on the order of state updates for the the above case, so we need to tell the `ScaleTool`.\n\t\t\t\t\t\t// If the user blurs or clicks on an option, then we will keep the tool & panel open.\n\t\t\t\t\t\tengine.tool.exitAfterUpdate = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treset()\n\t\t\t}\n\t\t},\n\t\t[scaleFactor],\n\t)\n\n\treturn (\n\t\t<div className={styles.panelContainer}>\n\t\t\t<form\n\t\t\t\tonSubmit={(event: React.FormEvent) => {\n\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\tengine.exitTool()\n\t\t\t\t\t})\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AlignmentHeader nodes={nodes} alignToParent={alignToParent} enabled={!readOnly} />\n\t\t\t\t<Panel header={<PanelSectionHeader title=\"Scale\" />}>\n\t\t\t\t\t<PanelRow title=\"Scale\">\n\t\t\t\t\t\t<div className={doubleColumnClass}>\n\t\t\t\t\t\t\t<ComboBox\n\t\t\t\t\t\t\t\trightChevron\n\t\t\t\t\t\t\t\tsearchItemValue\n\t\t\t\t\t\t\t\tclassName={styles.tabularNums}\n\t\t\t\t\t\t\t\tmenuClassName={styles.tabularNums}\n\t\t\t\t\t\t\t\tref={comboBoxRef}\n\t\t\t\t\t\t\t\tvalue={getScaleFactorValue(roundedScaleFactor)}\n\t\t\t\t\t\t\t\tcheckedItems={checkedComboBoxItems}\n\t\t\t\t\t\t\t\tonChange={handleComboBoxChange}\n\t\t\t\t\t\t\t\titems={comboBoxItems}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Origin\">\n\t\t\t\t\t\t<AlignmentGridInput\n\t\t\t\t\t\t\toptions={relativeFramePoints}\n\t\t\t\t\t\t\tvalue={anchor}\n\t\t\t\t\t\t\tonChange={handleAnchorFramePointChange}\n\t\t\t\t\t\t\toptionLabel={(_, index) => `Set anchor ${index}`}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className={styles.originContainer}>\n\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\tlabel=\"X\"\n\t\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t\t\tvalue={roundedNumber(anchorX * 100, 0)}\n\t\t\t\t\t\t\t\tmin={originMinValue}\n\t\t\t\t\t\t\t\tmax={originMaxValue}\n\t\t\t\t\t\t\t\tonChange={handleAnchorXChange}\n\t\t\t\t\t\t\t\tdefaultValue={50}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\t\tlabel=\"Y\"\n\t\t\t\t\t\t\t\tunit=\"%\"\n\t\t\t\t\t\t\t\tvalue={roundedNumber(anchorY * 100, 0)}\n\t\t\t\t\t\t\t\tmin={originMinValue}\n\t\t\t\t\t\t\t\tmax={originMaxValue}\n\t\t\t\t\t\t\t\tonChange={handleAnchorYChange}\n\t\t\t\t\t\t\t\tdefaultValue={50}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<PanelRow title=\"Size\">\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tlabel=\"W\"\n\t\t\t\t\t\t\tvalue={roundedNumber(width, 2)}\n\t\t\t\t\t\t\tprecision={2}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tonChange={onWidthChange}\n\t\t\t\t\t\t\tdefaultValue={initialWidth}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberInputWithTicker\n\t\t\t\t\t\t\tlabel=\"H\"\n\t\t\t\t\t\t\tvalue={roundedNumber(height, 2)}\n\t\t\t\t\t\t\tprecision={2}\n\t\t\t\t\t\t\tmin={0}\n\t\t\t\t\t\t\tonChange={onHeightChange}\n\t\t\t\t\t\t\tdefaultValue={initialHeight}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t\t<Button className={styles.applyButton} type=\"submit\">\n\t\t\t\t\t\tApply\n\t\t\t\t\t</Button>\n\t\t\t\t</Panel>\n\t\t\t</form>\n\t\t</div>\n\t)\n})\n", "import \"ScalePanel.styles_1shxpiq.wyw.css\"; export const panelContainer = \"panelContainer_p1k7u04k\";\nexport const originContainer = \"originContainer_o13ve4sj\";\nexport const tabularNums = \"tabularNums_t1qe8nvw\";\nexport const applyButton = \"applyButton_a7iailk\";", "\nimport React from \"react\"\n\nexport const EvaluationsPanel = React.lazy(() =>\n\timport(\"../evaluations/EvaluationsPanel.tsx\").then(module => ({ default: module.EvaluationsPanel })),\n)\n\t\t\t\t", "import \"rightPanel.styles_75rjna.wyw.css\"; export const rightPanel = \"rightPanel_r180bx0w\";\nexport const evaluationPanel = \"evaluationPanel_eaap7jt\";\nexport const disabledPanel = \"disabledPanel_drskjee\";\nexport const projectBarOffset = \"projectBarOffset_p1yy99cw\";\nexport const panelContentStack = \"panelContentStack_pfbd4j9\";\nexport const panelContentWrapper = \"panelContentWrapper_p1v1jqb9\";\nexport const evaluationsFallback = \"evaluationsFallback_e7ht2dg\";\nexport const header = \"header_h9098rh\";\nexport const divider = \"divider_dra7yev\";", "import { CanvasPanelTab } from \"document/utils/ActiveEditorType.ts\"\n\nexport function getCanvasPanelFallbackTab({\n\tactiveTab,\n\tcanViewPrimaryTab,\n\tsupportsPropertiesPanel,\n\tisViewOnly,\n\tpermissionsReady,\n}: {\n\tactiveTab: CanvasPanelTab\n\tcanViewPrimaryTab: boolean\n\tsupportsPropertiesPanel: boolean\n\tisViewOnly: boolean\n\tpermissionsReady: boolean\n}): CanvasPanelTab | undefined {\n\tif (activeTab === CanvasPanelTab.Chat && !canViewPrimaryTab && permissionsReady) {\n\t\treturn CanvasPanelTab.Properties\n\t}\n\n\tif (activeTab === CanvasPanelTab.Properties && !supportsPropertiesPanel && !isViewOnly) {\n\t\treturn CanvasPanelTab.Chat\n\t}\n\n\treturn undefined\n}\n", "import { preventDefaultAndStopPropagation } from \"@framerjs/app-shared\"\nimport type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey, type ItemToSlug } from \"@framerjs/framer-runtime/crossorigin\"\nimport {\n\tBadge,\n\tButton,\n\tCenterChild,\n\tIconChevronRight,\n\tIconComponentSmall,\n\tIconInputDropdown,\n\tIconLayerStackWithData,\n\tIconLayoutTemplate,\n\tIconPage,\n\tIconVectorSet,\n\tScroll,\n\tSpacer,\n\tSpinner,\n\tStack,\n\tTranslatable as T,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { colors, dimensions } from \"@framerjs/fresco/tokens\"\nimport type { LocalModuleId } from \"@framerjs/shared\"\nimport { assert, assertNever, isExternalModuleIdentifier } from \"@framerjs/shared\"\nimport { getDependenciesFileName, isDependenciesFileId } from \"@framerjs/shared/src/moduleNames.ts\"\nimport { cx } from \"@linaria/core\"\nimport { EducationKey, EducationTooltip } from \"app/EducationTooltip.tsx\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { filename } from \"code-editor/utils.ts\"\nimport { getDefaultWebPageTitle } from \"code-generation/components/generateMetadataModule.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { AutoSizeEditableText } from \"document/components/AutoSizeEditableText.tsx\"\nimport type { AutoSizeEditableTextHandle } from \"document/components/AutoSizeEditableText.tsx\"\nimport { PlayButton } from \"document/components/canvas-hud/PlayButton.tsx\"\nimport { getAvailableCollections } from \"document/components/utils/getAvailableCollections.ts\"\nimport { switchCollectionItemOnCanvas } from \"document/components/utils/switchCollectionItemOnCanvas.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Library } from \"document/library/libraryApi.ts\"\nimport type {\n\tCanvasNode,\n\tNodeID,\n\tScopeNode,\n\tShallowScopeNode,\n\tShallowSmartComponentNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { ShallowLayoutTemplateNode } from \"document/models/CanvasTree/nodes/LayoutTemplateNode.ts\"\nimport type { ShallowVectorSetNode } from \"document/models/CanvasTree/nodes/VectorSetNode.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisVectorSetNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { togglePreviewVisible } from \"document/preview/togglePreviewVisible.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { getNameFromPath } from \"document/utils/assetPath.ts\"\nimport { menuGutter } from \"menu/Menu.styles.ts\"\nimport type { PersistedModule } from \"modules/ModulesStorage.ts\"\nimport React, { useLayoutEffect, useRef } from \"react\"\nimport { breadcrumbCollectionId } from \"utils/breadcrumbCollectionId.ts\"\nimport { copyImportURL } from \"utils/clipboard/helpers/copyModuleImports.ts\"\nimport { editInCMS, getCollectionName } from \"utils/collectionUtils.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { swapDataSourceForWebPage } from \"utils/swapDataSource.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { useItemToSlug } from \"utils/useItemToSlug.ts\"\nimport { useItemToTitle } from \"utils/useItemToTitle.ts\"\nimport { useSelectedCollectionItemForWebPage } from \"utils/useSelectedCollectionItemForWebPage.ts\"\nimport { defaultIdentifierForLocalVectorSet } from \"utils/vectorSets.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../QuickActions/types.ts\"\nimport { IconAgentCMS } from \"../agentPanel/components/IconAgentCMS.tsx\"\nimport { IconAgentComponent } from \"../agentPanel/components/IconAgentComponent.tsx\"\nimport { IconAgentPage } from \"../agentPanel/components/IconAgentPage.tsx\"\nimport { IconAgentVectorSet } from \"../agentPanel/components/IconAgentVectorSet.tsx\"\nimport { useShouldShowCodeAgentPanel } from \"../agentPanel/useShouldShowCodeAgentPanel.ts\"\nimport { IconAgentBreakpointLayoutTemplate } from \"../layers/AgentLayerIcons.tsx\"\nimport { useActiveLocalizationLocale } from \"../localization/useActiveLocalizationLocale.ts\"\nimport * as styles from \"./BreadcrumbBar.styles.ts\"\nimport { subLabelText } from \"./SubLabel.styles.ts\"\nimport { VersionHistoryControls } from \"./VersionHistoryControls/VersionHistoryControls.tsx\"\nimport { getModuleContextMenuItems, getProjectComponentMenuItems } from \"./utils/getComponentContextMenuItems.ts\"\nimport { renameComponent } from \"./utils/renameComponent.ts\"\n\nfunction getPersistedModuleForScopeNode(node: ScopeNode): PersistedModule | undefined {\n\tif (isSmartComponentNode(node) || isLayoutTemplateNode(node)) {\n\t\treturn engine.stores.modulesStore.getPersistedModuleByLocalIdentifier(node.instanceIdentifier)\n\t}\n}\n\nfunction useCollectionDataFromIsolatedCanvasNodes(nodes: readonly ShallowScopeNode[], isCodeEditorOpen: boolean) {\n\tconst node = nodes[0]\n\tconst activeLocale = useActiveLocalizationLocale()\n\tconst dataIdentifier = isWebPageNode(node) ? node.dataIdentifier : undefined\n\tconst data = useDataForIdentifier(dataIdentifier)\n\tconst itemToSlug = useItemToSlug(dataIdentifier, activeLocale?.id)\n\tconst itemToTitle = useItemToTitle(dataIdentifier, activeLocale?.id)\n\tconst selectedCollectionItem = useSelectedCollectionItemForWebPage(node?.id, activeLocale?.id)\n\tif (isCodeEditorOpen) return null\n\tif (!isWebPageNode(node)) return null\n\tif (!data || !itemToSlug) return null\n\treturn { data, itemToSlug, itemToTitle, ...selectedCollectionItem }\n}\n\nconst defaultName = \"No Name\"\n\nfunction getTitle(node: CanvasNode, homePageNodeId: NodeID | undefined): string {\n\tif (homePageNodeId === node.id) return Dictionary.Home\n\n\tif (isCollectionNode(node)) {\n\t\treturn getCollectionName(node, defaultName)\n\t}\n\n\tif (isWebPageNode(node) && !hasCollectionDataSource(node)) {\n\t\treturn getDefaultWebPageTitle(engine.tree, engine.componentLoader, node)\n\t}\n\n\tconst name = node.resolveValue(\"name\")\n\tif (isSmartComponentNode(node)) {\n\t\treturn getNameFromPath(name ?? defaultName)\n\t}\n\n\treturn name || defaultName\n}\n\nfunction getCollectionTitle({ name, identifier }: DataDefinition): string {\n\tconst suffix = isExternalModuleIdentifier(identifier) ? \" (External)\" : \"\"\n\treturn name + suffix\n}\n\nfunction getBreadcrumbTypeForNode(node: CanvasNode): BreadcrumbItemType {\n\tif (isLayoutTemplateNode(node)) return BreadcrumbItemType.LayoutTemplate\n\tif (isSmartComponentNode(node)) return BreadcrumbItemType.SmartComponent\n\tif (isWebPageNode(node)) return BreadcrumbItemType.WebPage\n\tif (isVectorSetNode(node)) return BreadcrumbItemType.VectorSet\n\treturn BreadcrumbItemType.Page\n}\n\nconst showMenuUnderBreadcrumbBar = (\n\tevent: React.MouseEvent,\n\titems: MenuItemOptions[],\n\tmenuAnchorOffset: {\n\t\tpanelPadding: number\n\t\tsitesPanelHeaderHeight: number\n\t\tmenuOffsetFromAnchor: number\n\t\tuseTriggerAnchor: boolean\n\t},\n\tlocation?: { x: number; y: number },\n) => {\n\tlet { clientX: x, clientY: y } = event\n\tif (location) {\n\t\tx = location.x\n\t\ty = location.y\n\t} else if (event.currentTarget instanceof HTMLElement) {\n\t\tconst menuLocation = getMenuLocationFromElement(event.currentTarget, menuAnchorOffset)\n\t\tx = menuLocation.x\n\t\ty = menuLocation.y\n\t}\n\tengine.stores.contextMenuStore.show(items, { location: { x, y } })\n}\n\nfunction getMenuLocationFromElement(\n\telement: Element,\n\tmenuAnchorOffset: {\n\t\tpanelPadding: number\n\t\tsitesPanelHeaderHeight: number\n\t\tmenuOffsetFromAnchor: number\n\t\tuseTriggerAnchor: boolean\n\t},\n): { x: number; y: number } {\n\tconst bounds = element.getBoundingClientRect()\n\tconst lineBaselineY = bounds.top - menuAnchorOffset.panelPadding + menuAnchorOffset.sitesPanelHeaderHeight\n\tconst anchorY = menuAnchorOffset.useTriggerAnchor ? bounds.bottom : lineBaselineY\n\n\treturn {\n\t\tx: bounds.left + dimensions.values.contextMenuOffsetX,\n\t\ty: anchorY + menuAnchorOffset.menuOffsetFromAnchor - menuGutter,\n\t}\n}\n\nfunction useMenuAnchorOffset() {\n\tconst panelPadding = useDimensionValue(\"panelPadding\")\n\tconst sitesPanelHeaderHeight = useDimensionValue(\"sitesPanelHeaderHeight\")\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst menuOffsetFromAnchor = dimensions.values.inputSpacing\n\tconst useTriggerAnchor = !isAgentExperimentOn\n\treturn { panelPadding, sitesPanelHeaderHeight, menuOffsetFromAnchor, useTriggerAnchor }\n}\n\nconst togglePreview = () => togglePreviewVisible(engine, { source: \"breadcrumb_bar\" })\n\nexport const BreadcrumbBar = React.memo(function BreadcrumbBar() {\n\tconst {\n\t\tloadingStore,\n\t\toverlayStore,\n\t\tcodeEditorStore,\n\t\tchromeStore,\n\t\tmodulesStore,\n\t\tlibraryStore,\n\t\tscopeStore,\n\t\tpersistedUserDefaults,\n\t} = engine.stores\n\tconst { currentCodeFileId, currentCodeFileEdited, currentCodeFileSyncing, versionHistoryActive } =\n\t\tcodeEditorStore.useState()\n\tconst { mainView, chromeIsVisible, codeEditorPreviewVisible, codeEditorPreviewWidth } = chromeStore.useState()\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst isCodeEditorOpen = mainView === ActiveMainView.CodeEditor\n\tconst showCodeAgentPanel = useShouldShowCodeAgentPanel()\n\tconst {\n\t\thasMinimalEditableData,\n\t\tinSmartComponentOverlayEditMode,\n\t\tisolatedCanvasNodes,\n\t\tpersistedModuleForComponent,\n\t\thomePageNodeId,\n\t\tonIsolatedCanvas,\n\t\tactiveScopeIsWebPage,\n\t\tteamLibrary,\n\t\tlibraryUpdate,\n\t\tmoduleUpdate,\n\t} = useDeprecatedEngineState(\n\t\t// We are subscribing to the tree store to get rename updates\n\t\t[\n\t\t\tloadingStore,\n\t\t\toverlayStore,\n\t\t\tscopeStore,\n\t\t\tlibraryStore,\n\t\t\tmodulesStore,\n\t\t\tEngineChange.TreeStore,\n\t\t\tEngineChange.ActiveBundle,\n\t\t],\n\t\t() => {\n\t\t\tconst activeScope = scopeStore.active\n\n\t\t\treturn {\n\t\t\t\thasMinimalEditableData: loadingStore.hasMinimalEditableData,\n\t\t\t\tonIsolatedCanvas: scopeStore.onIsolatedCanvas,\n\t\t\t\tinSmartComponentOverlayEditMode: isSmartComponentNode(scopeStore.active) && overlayStore.editModeActive,\n\t\t\t\tisolatedCanvasNodes: scopeStore.isolatedCanvasNodes(),\n\t\t\t\tactiveScopeIsWebPage: isWebPageNode(activeScope),\n\t\t\t\tpersistedModuleForComponent: getPersistedModuleForScopeNode(activeScope),\n\t\t\t\tteamLibrary: libraryStore.teamLibrary,\n\t\t\t\tlibraryUpdate: libraryStore.update,\n\t\t\t\tmoduleUpdate: modulesStore.revision,\n\t\t\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\t\t}\n\t\t},\n\t)\n\n\t// Prevent smart components lingering in the breadcrumb bar when opening a code file.\n\tconst isolatedCanvasNodesForBreadcrumbs = isCodeEditorOpen\n\t\t? [scopeStore.getScopeNode(scopeStore.getMostRecentPage().id)]\n\t\t: isolatedCanvasNodes\n\n\tconst displayRulers = useDeprecatedEngineState(\n\t\tEngineChange.UserDefaultsStore,\n\t\t() => persistedUserDefaults.displayRulers,\n\t)\n\n\tif (!hasMinimalEditableData) return null\n\n\treturn (\n\t\t<BreadcrumbBarInner\n\t\t\tinSmartComponentOverlayEditMode={inSmartComponentOverlayEditMode}\n\t\t\tcurrentCodeFileId={currentCodeFileId}\n\t\t\tisolatedCanvasNodes={isolatedCanvasNodesForBreadcrumbs}\n\t\t\tisCodeEditorOpen={isCodeEditorOpen}\n\t\t\tdisplayRulers={displayRulers}\n\t\t\tpersistedModuleForComponent={persistedModuleForComponent}\n\t\t\tcurrentCodeFileEdited={currentCodeFileEdited}\n\t\t\tcurrentCodeFileSyncing={currentCodeFileSyncing}\n\t\t\tversionHistoryActive={versionHistoryActive}\n\t\t\tchromeIsVisible={chromeIsVisible}\n\t\t\tcodeEditorPreviewVisible={codeEditorPreviewVisible}\n\t\t\tcodeEditorPreviewWidth={codeEditorPreviewWidth}\n\t\t\tshowCodeAgentPanel={showCodeAgentPanel}\n\t\t\tisViewOnly={isViewOnly}\n\t\t\thomePageNodeId={homePageNodeId}\n\t\t\tonIsolatedCanvas={onIsolatedCanvas}\n\t\t\tactiveScopeIsWebPage={activeScopeIsWebPage}\n\t\t\tteamLibrary={teamLibrary}\n\t\t\tlibraryUpdate={libraryUpdate}\n\t\t\tmoduleUpdate={moduleUpdate}\n\t\t/>\n\t)\n})\n\ninterface BreadcrumbBarInnerProps {\n\tisCodeEditorOpen: boolean\n\tinSmartComponentOverlayEditMode: boolean\n\tcurrentCodeFileId: LocalModuleId | null | undefined\n\tdisplayRulers: boolean\n\tisolatedCanvasNodes: readonly ShallowScopeNode[]\n\tpersistedModuleForComponent: PersistedModule | undefined\n\tcurrentCodeFileEdited: boolean\n\tcurrentCodeFileSyncing: boolean\n\tversionHistoryActive: boolean\n\tchromeIsVisible: boolean\n\tcodeEditorPreviewVisible: boolean\n\tcodeEditorPreviewWidth: number\n\tshowCodeAgentPanel: boolean\n\tisViewOnly: boolean\n\thomePageNodeId: string | undefined\n\tonIsolatedCanvas: boolean\n\tactiveScopeIsWebPage: boolean\n\tteamLibrary: Library | undefined\n\tlibraryUpdate: number\n\tmoduleUpdate: number\n}\n\nconst BreadcrumbBarInner = React.memo(function BreadcrumbBarInner(props: BreadcrumbBarInnerProps) {\n\tconst {\n\t\tcurrentCodeFileId,\n\t\tinSmartComponentOverlayEditMode,\n\t\tisolatedCanvasNodes,\n\t\tpersistedModuleForComponent,\n\t\tisCodeEditorOpen,\n\t\tchromeIsVisible,\n\t\tcodeEditorPreviewVisible,\n\t\tcodeEditorPreviewWidth,\n\t\tshowCodeAgentPanel,\n\t\tisViewOnly,\n\t\thomePageNodeId,\n\t\tonIsolatedCanvas,\n\t\tactiveScopeIsWebPage,\n\t\tteamLibrary,\n\t\tdisplayRulers,\n\t\tversionHistoryActive,\n\t\tcurrentCodeFileEdited,\n\t\tcurrentCodeFileSyncing,\n\t} = props\n\tconst scrollRef = useRef<HTMLDivElement | null>(null)\n\tconst menuAnchorOffset = useMenuAnchorOffset()\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst activeCodeFile = isCodeEditorOpen && currentCodeFileId\n\n\tuseLayoutEffect(() => {\n\t\tconst _sizeDependency1 = isolatedCanvasNodes.length\n\t\tconst _sizeDependency2 = activeCodeFile\n\n\t\tconst scrollElement = scrollRef.current\n\t\tif (!scrollElement) return\n\t\tscrollElement.scrollLeft = scrollElement.scrollWidth - scrollElement.offsetWidth\n\t}, [isolatedCanvasNodes.length, activeCodeFile])\n\n\tlet persistedModule: PersistedModule | undefined\n\tif (isCodeEditorOpen) {\n\t\t// we check for codeModules since currentCodeFileId is not always a localModuleId even though its typed as such. Old code files imitate this type for consistency atm.\n\t\tif (currentCodeFileId) {\n\t\t\tpersistedModule = engine.stores.modulesStore.getPersistedModuleByLocalId(currentCodeFileId)\n\t\t} else {\n\t\t\t// legacy code or no currentFile\n\t\t\tpersistedModule = undefined\n\t\t}\n\t} else {\n\t\tpersistedModule = persistedModuleForComponent\n\t}\n\n\tconst collectionData = useCollectionDataFromIsolatedCanvasNodes(isolatedCanvasNodes, isCodeEditorOpen)\n\n\tconst selectCollectionItemId = useEngineCallback((collectionItemId: NodeID) => {\n\t\tswitchCollectionItemOnCanvas(engine.stores, collectionItemId)\n\t}, [])\n\n\tconst showCollectionOptions = (event: React.MouseEvent) => {\n\t\tassert(collectionData, \"Collection data is missing\")\n\t\tconst { data } = collectionData\n\n\t\tconst isExternal = isExternalModuleIdentifier(data.identifier)\n\n\t\tconst menuItems: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: getCollectionTitle(data),\n\t\t\t\tvisible: isExternal,\n\t\t\t\tchecked: true,\n\t\t\t\tenabled: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: `Edit in ${Dictionary.Cms}`,\n\t\t\t\tvisible: Boolean(!isExternal && getCollectionForIdentifier(engine.tree, data.identifier)),\n\t\t\t\tclick: () => editInCMS(engine, data.identifier, collectionData.selectedItemId),\n\t\t\t},\n\t\t]\n\n\t\tconst availableCollections = getAvailableCollections(engine).filter(dataDefinition => {\n\t\t\t// Only allow switching to collection items that have a slug\n\t\t\tconst framerSlug = dataDefinition.annotations?.[AnnotationKey.FramerSlug]\n\t\t\treturn isString(framerSlug)\n\t\t})\n\n\t\tconst hasNonSelectedCollectionAvailable = availableCollections.some(\n\t\t\tdataDefinition => dataDefinition.identifier !== data.identifier,\n\t\t)\n\n\t\tif (hasNonSelectedCollectionAvailable) {\n\t\t\tmenuItems.push(\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Swap Collection\u2026\",\n\t\t\t\t\tsubmenu: availableCollections.map(\n\t\t\t\t\t\t(dataDefinition): MenuItemOptions => ({\n\t\t\t\t\t\t\tlabel: dataDefinition.name,\n\t\t\t\t\t\t\tchecked: dataDefinition.identifier === data.identifier,\n\t\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\t\tif (dataDefinition.identifier === data.identifier) return\n\n\t\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\t\t\t\t\ttitle: \"Swap Collection\",\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\t\"Changing the collection for this page will try to automatically match assigned CMS variables. After swapping, further adjustments may be needed.\",\n\t\t\t\t\t\t\t\t\tconfirmLabel: \"Swap\",\n\t\t\t\t\t\t\t\t\tsource: \"breadcrumb_bar\",\n\t\t\t\t\t\t\t\t\tonConfirm: () => {\n\t\t\t\t\t\t\t\t\t\tconst outdatedWebPage = isolatedCanvasNodes[0]\n\t\t\t\t\t\t\t\t\t\tif (!outdatedWebPage) return\n\t\t\t\t\t\t\t\t\t\tswapDataSourceForWebPage({\n\t\t\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\t\t\twebPageNodeId: outdatedWebPage.id,\n\t\t\t\t\t\t\t\t\t\t\ttoDataSource: { dataIdentifier: dataDefinition.identifier },\n\t\t\t\t\t\t\t\t\t\t})\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\n\t\tshowMenuUnderBreadcrumbBar(\n\t\t\tevent,\n\t\t\tmenuItems,\n\t\t\tmenuAnchorOffset,\n\t\t\tgetMenuLocationFromElement(event.currentTarget, menuAnchorOffset),\n\t\t)\n\t}\n\n\tconst showComponentContextMenu = async (\n\t\tevent: React.MouseEvent,\n\t\tcomponentNode: ShallowSmartComponentNode | ShallowLayoutTemplateNode | ShallowVectorSetNode,\n\t\trename?: () => void,\n\t\titemRef?: React.MutableRefObject<HTMLDivElement | null>,\n\t) => {\n\t\tpreventDefaultAndStopPropagation(event)\n\n\t\tconst items: MenuItemOptions[] = []\n\n\t\tconst name = componentNode.resolveValue(\"name\")\n\t\tconst projectComponentItems = getProjectComponentMenuItems({\n\t\t\tcomponentIdentifier: componentNode.instanceIdentifier,\n\t\t\tisViewOnly,\n\t\t\tlocalComponentNameByIdentifier: {\n\t\t\t\t[componentNode.instanceIdentifier]: name,\n\t\t\t},\n\t\t})\n\n\t\tif (projectComponentItems.length > 0) {\n\t\t\titems.push(...projectComponentItems)\n\t\t}\n\n\t\tif (isSmartComponentNode(componentNode)) {\n\t\t\tconst moduleItems = getModuleContextMenuItems({\n\t\t\t\tcomponentIdentifier: componentNode.instanceIdentifier,\n\t\t\t\tteamLibrary,\n\t\t\t\tisViewOnly,\n\t\t\t\tsource: \"breadcrumb_bar\",\n\t\t\t})\n\n\t\t\tif (moduleItems.length > 0) {\n\t\t\t\titems.push({ type: \"separator\" })\n\t\t\t\titems.push(...moduleItems)\n\t\t\t}\n\t\t}\n\n\t\tif (isVectorSetNode(componentNode)) {\n\t\t\tconst defaultItem = defaultIdentifierForLocalVectorSet(componentNode.id, engine.stores.modulesStore)\n\t\t\tif (defaultItem) {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: Dictionary.CopyUrl,\n\t\t\t\t\tclick: () => copyImportURL(engine, defaultItem, false),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tif (items.length === 0) return\n\n\t\tconst renameItem = items.find(item => item.label === \"Rename\" && !item.click)\n\t\tif (renameItem) renameItem.click = rename\n\n\t\tconst element = itemRef?.current\n\t\tlet location: { x: number; y: number } | undefined = undefined\n\t\tif (element) {\n\t\t\tlocation = getMenuLocationFromElement(element, menuAnchorOffset)\n\t\t}\n\t\tshowMenuUnderBreadcrumbBar(event, items, menuAnchorOffset, location)\n\t}\n\n\tconst breadcrumbBarIsVisible = Boolean(onIsolatedCanvas || isCodeEditorOpen || collectionData)\n\tif (!breadcrumbBarIsVisible || !chromeIsVisible) return null\n\n\tlet codeFileTitle: string = Dictionary.Unknown\n\tif (isCodeEditorOpen && currentCodeFileId) {\n\t\tif (persistedModule) {\n\t\t\tcodeFileTitle = filename(persistedModule.name)\n\t\t} else if (isDependenciesFileId(currentCodeFileId)) {\n\t\t\tcodeFileTitle = filename(getDependenciesFileName(currentCodeFileId))\n\t\t}\n\t}\n\n\tconst codeEditorPreviewDisplayed = codeEditorPreviewVisible && codeEditorPreviewWidth > 0\n\tconst wrapperClassName = cx(\n\t\tstyles.barWrapper,\n\t\tisCodeEditorOpen && styles.withCodeEditor,\n\t\tdisplayRulers && !isCodeEditorOpen && styles.rulersVisible,\n\t\tcodeEditorPreviewDisplayed && !showCodeAgentPanel && styles.withCodeEditorPreview,\n\t\t!codeEditorPreviewDisplayed && showCodeAgentPanel && styles.withCodeEditorAgent,\n\t\tcodeEditorPreviewDisplayed && showCodeAgentPanel && styles.withCodeEditorPreviewAndAgent,\n\t)\n\n\tif (inSmartComponentOverlayEditMode && !isCodeEditorOpen) {\n\t\treturn (\n\t\t\t<div className={wrapperClassName}>\n\t\t\t\t<div className={styles.barPaddingStyles}>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={styles.contentWrapper}\n\t\t\t\t\t\tgap={0} /* no trailing margin because of the actions stack and the spacer */\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button variant=\"withDepthPrimary\" onClick={togglePreview} className={styles.previewButton}>\n\t\t\t\t\t\t\t<Stack direction=\"row\" gap={8} alignItems=\"center\" justifyContent=\"center\">\n\t\t\t\t\t\t\t\t<PlayButton\n\t\t\t\t\t\t\t\t\tcolor={colors.breadcrumbOverlayPlayButton}\n\t\t\t\t\t\t\t\t\tsquared\n\t\t\t\t\t\t\t\t\tsmall={false}\n\t\t\t\t\t\t\t\t\tclassName={styles.previewIcon}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<T>Editing Overlay</T>\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.breadcrumbSpacing} className={styles.actions}>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName={styles.exitButton}\n\t\t\t\t\t\t\t\tonClick={() => engine.stores.overlayStore.exitEditMode(engine.stores.selectionStore)}\n\t\t\t\t\t\t\t\tvariant=\"withDepthPrimary\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<T>Exit</T>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div className={wrapperClassName}>\n\t\t\t<Scroll className={styles.bar} direction=\"horizontal\" ref={scrollRef}>\n\t\t\t\t{/* wrapping for the padding, paddings can't be on the scroll because safari won't render the right padding */}\n\t\t\t\t<div className={styles.barPaddingStyles}>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={styles.contentWrapper}\n\t\t\t\t\t\tgap={0} /* no trailing margin because of the actions stack and the spacer */\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\tjustifyContent=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t{...(collectionData ? { role: \"navigation\" as const, \"aria-label\": Dictionary.Cms } : undefined)}\n\t\t\t\t\t\t\tclassName={styles.breadcrumbWrapper}\n\t\t\t\t\t\t\tgap={dimensions.css.breadcrumbSpacing}\n\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\tjustifyContent=\"flex-start\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{collectionData && (\n\t\t\t\t\t\t\t\t<BreadcrumbItem\n\t\t\t\t\t\t\t\t\tid={collectionData.data.identifier}\n\t\t\t\t\t\t\t\t\ttitle={getCollectionTitle(collectionData.data)}\n\t\t\t\t\t\t\t\t\ttype={BreadcrumbItemType.Collection}\n\t\t\t\t\t\t\t\t\tonMouseDown={showCollectionOptions}\n\t\t\t\t\t\t\t\t\tisLastItem={false}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{isolatedCanvasNodes.map((node, idx) => {\n\t\t\t\t\t\t\t\tconst isLast = !activeCodeFile && idx === isolatedCanvasNodes.length - 1\n\n\t\t\t\t\t\t\t\tif (isWebPageNode(node) && collectionData) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<CollectionItemPicker\n\t\t\t\t\t\t\t\t\t\t\tkey={node.id}\n\t\t\t\t\t\t\t\t\t\t\twebPageNodeId={node.id}\n\t\t\t\t\t\t\t\t\t\t\tselectedItemSlug={collectionData.selectedItemSlug}\n\t\t\t\t\t\t\t\t\t\t\tselectedItemId={collectionData.selectedItemId}\n\t\t\t\t\t\t\t\t\t\t\titemToSlug={collectionData.itemToSlug}\n\t\t\t\t\t\t\t\t\t\t\titemToTitle={collectionData.itemToTitle}\n\t\t\t\t\t\t\t\t\t\t\tonSelectCollectionItemId={selectCollectionItemId}\n\t\t\t\t\t\t\t\t\t\t\tisLastItem={isLast}\n\t\t\t\t\t\t\t\t\t\t/>\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\treturn (\n\t\t\t\t\t\t\t\t\t<BreadcrumbItem\n\t\t\t\t\t\t\t\t\t\tkey={node.id}\n\t\t\t\t\t\t\t\t\t\tid={node.id}\n\t\t\t\t\t\t\t\t\t\ttitle={getTitle(node, homePageNodeId)}\n\t\t\t\t\t\t\t\t\t\ttype={getBreadcrumbTypeForNode(node)}\n\t\t\t\t\t\t\t\t\t\tisLastItem={isLast && !isCodeEditorOpen}\n\t\t\t\t\t\t\t\t\t\thomePageNodeId={homePageNodeId}\n\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\tisLast && (isSmartComponentNode(node) || isLayoutTemplateNode(node) || isVectorSetNode(node))\n\t\t\t\t\t\t\t\t\t\t\t\t? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tevent: React.MouseEvent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trename?: () => void,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\titemRef?: React.MutableRefObject<HTMLDivElement | null>,\n\t\t\t\t\t\t\t\t\t\t\t\t\t) => showComponentContextMenu(event, node, rename, itemRef)\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t}\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\t{activeCodeFile && (\n\t\t\t\t\t\t\t\t<BreadcrumbItem\n\t\t\t\t\t\t\t\t\tid={currentCodeFileId}\n\t\t\t\t\t\t\t\t\ttitle={codeFileTitle}\n\t\t\t\t\t\t\t\t\ttype={BreadcrumbItemType.CodeFile}\n\t\t\t\t\t\t\t\t\tcurrentCodeFileEdited={currentCodeFileEdited}\n\t\t\t\t\t\t\t\t\tcurrentCodeFileSyncing={currentCodeFileSyncing}\n\t\t\t\t\t\t\t\t\tisLastItem\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<Spacer flex />\n\t\t\t\t\t\t<Stack direction=\"row\" gap={dimensions.css.breadcrumbSpacing} className={styles.actions}>\n\t\t\t\t\t\t\t{versionHistoryActive && currentCodeFileId && <VersionHistoryControls fileId={currentCodeFileId} />}\n\t\t\t\t\t\t\t{!isAgentExperimentOn && collectionData && activeScopeIsWebPage && (\n\t\t\t\t\t\t\t\t<EducationTooltip tooltipId={EducationKey.DetailPage} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\t\t\t</Scroll>\n\t\t</div>\n\t)\n})\n\nenum BreadcrumbItemType {\n\tPage,\n\tWebPage,\n\tSmartComponent,\n\tCodeFile,\n\tCollection,\n\tLayoutTemplate,\n\tVectorSet,\n}\n\nfunction getIconForBreadcrumbItem(type: BreadcrumbItemType, useAgentIcons: boolean) {\n\tswitch (type) {\n\t\tcase BreadcrumbItemType.SmartComponent:\n\t\t\treturn useAgentIcons ? <IconAgentComponent /> : <IconComponentSmall />\n\t\tcase BreadcrumbItemType.Collection:\n\t\t\treturn useAgentIcons ? <IconAgentCMS /> : <IconLayerStackWithData />\n\t\tcase BreadcrumbItemType.LayoutTemplate:\n\t\t\treturn useAgentIcons ? <IconAgentBreakpointLayoutTemplate /> : <IconLayoutTemplate />\n\t\tcase BreadcrumbItemType.WebPage:\n\t\tcase BreadcrumbItemType.CodeFile:\n\t\tcase BreadcrumbItemType.Page:\n\t\t\treturn useAgentIcons ? <IconAgentPage /> : <IconPage />\n\t\tcase BreadcrumbItemType.VectorSet:\n\t\t\treturn useAgentIcons ? <IconAgentVectorSet /> : <IconVectorSet />\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\ninterface BreadcrumbItemProps {\n\tid: NodeID\n\ttitle: string\n\ttype: BreadcrumbItemType\n\tisLastItem: boolean\n\tcurrentCodeFileEdited?: boolean\n\tcurrentCodeFileSyncing?: boolean\n\thomePageNodeId?: NodeID\n\tonClick?: (\n\t\tevent: React.MouseEvent,\n\t\trename?: () => void,\n\t\titemRef?: React.MutableRefObject<HTMLDivElement | null>,\n\t) => void\n\tonMouseDown?: (event: React.MouseEvent) => void\n}\n\nconst BreadcrumbItem = React.memo(function BreadcrumbItem({\n\tid,\n\ttitle: externalTitle,\n\ttype,\n\tisLastItem,\n\tonMouseDown,\n\tonClick,\n\tcurrentCodeFileEdited = false,\n\tcurrentCodeFileSyncing = false,\n\thomePageNodeId,\n}: BreadcrumbItemProps) {\n\tconst [lastItemTitle, setLastItemTitle] = React.useState(externalTitle)\n\tconst itemRef = React.useRef<HTMLDivElement | null>(null)\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst { codeEditorStore, loadingStore, scopeStore } = engine.stores\n\n\tReact.useEffect(() => {\n\t\t// * Is this still needed? Seems like `externalTitle` and `lastItemTitle` are going to be linked anyway\n\t\tif (isLastItem) setLastItemTitle(externalTitle)\n\t}, [externalTitle, isLastItem])\n\n\tconst closeCodeEditorIfNeeded = () => {\n\t\tif (type !== BreadcrumbItemType.CodeFile && codeEditorStore.currentCodeFileId) {\n\t\t\tcodeEditorStore.closeEditor()\n\t\t}\n\t}\n\n\tconst selectItem = engine.scheduler.wrapHandler(() => {\n\t\tif (!loadingStore.hasMinimalEditableData) return\n\t\tcloseCodeEditorIfNeeded()\n\t\tscopeStore.select(id, { keepHistory: true })\n\t})\n\n\tconst handleMouseDown = engine.scheduler.wrapHandler((event: React.MouseEvent) => {\n\t\tassert(onMouseDown)\n\n\t\tif (!loadingStore.hasMinimalEditableData) return\n\t\tcloseCodeEditorIfNeeded()\n\t\tonMouseDown(event)\n\t})\n\n\tconst handleClick = (event: React.MouseEvent) => {\n\t\tevent.preventDefault()\n\n\t\tif (onClick) {\n\t\t\tonClick(event, startEditing, itemRef)\n\t\t\treturn\n\t\t}\n\n\t\tif (!isLastItem) {\n\t\t\tselectItem()\n\t\t}\n\t}\n\n\tconst [isEditing, setIsEditing] = React.useState(false)\n\tconst editableRef = React.useRef<AutoSizeEditableTextHandle | null>(null)\n\n\tconst title = isLastItem ? lastItemTitle : externalTitle\n\n\tconst onChangeName = engine.scheduler.wrapHandler((value: string, final: boolean) => {\n\t\tif (!final || !value) return\n\t\trenameComponent(engine, value, id)\n\t\tsetIsEditing(false)\n\t\tconst node = engine.tree.get(id)\n\t\tconst title = node ? getTitle(node, homePageNodeId) : value\n\t\tsetLastItemTitle(title)\n\t})\n\n\tconst canEditName =\n\t\tisLastItem &&\n\t\t(type === BreadcrumbItemType.SmartComponent ||\n\t\t\ttype === BreadcrumbItemType.LayoutTemplate ||\n\t\t\ttype === BreadcrumbItemType.VectorSet) &&\n\t\t!isViewOnly\n\n\tconst startEditing = () => {\n\t\tif (!canEditName) return\n\t\tsetIsEditing(true)\n\t\teditableRef.current?.startEditing()\n\t}\n\n\tconst clickable = Boolean(onMouseDown ?? onClick ?? !isLastItem)\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tgap={8}\n\t\t\t\talignItems=\"center\"\n\t\t\t\tid={breadcrumbCollectionId}\n\t\t\t\trole={clickable ? \"button\" : undefined}\n\t\t\t\tclassName={cx(styles.breadcrumb, isLastItem && styles.withTint, !clickable && styles.breadcrumbDisabled)}\n\t\t\t\tonMouseDown={!isEditing && onMouseDown ? handleMouseDown : undefined}\n\t\t\t\tonClick={onMouseDown || isEditing ? undefined : handleClick}\n\t\t\t\tref={itemRef}\n\t\t\t>\n\t\t\t\t{type !== BreadcrumbItemType.Page && (\n\t\t\t\t\t<div className={styles.preventShrinking} aria-hidden=\"true\">\n\t\t\t\t\t\t{getIconForBreadcrumbItem(type, isAgentExperimentOn)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{isLastItem ? (\n\t\t\t\t\t<AutoSizeEditableText\n\t\t\t\t\t\tref={editableRef}\n\t\t\t\t\t\tonEndEditing={() => setIsEditing(false)}\n\t\t\t\t\t\treadOnly={!canEditName}\n\t\t\t\t\t\tdisableEditOnDoubleClick\n\t\t\t\t\t\tvalue={title}\n\t\t\t\t\t\tonChange={value => onChangeName(value, true)}\n\t\t\t\t\t\tpostFix={currentCodeFileEdited ? <span className={styles.codeFileEditedLabel}>Edited</span> : null}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={8}>\n\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.breadcrumbTitle)}>{title}</div>\n\t\t\t\t\t\t{currentCodeFileEdited && <span className={styles.codeFileEditedLabel}>Edited</span>}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t\t{currentCodeFileSyncing && <Spinner className={styles.spinner} inline />}\n\t\t\t</Stack>\n\t\t\t{!isLastItem && (\n\t\t\t\t<div className={styles.preventShrinking} aria-hidden=\"true\">\n\t\t\t\t\t<IconChevronRight />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n\ninterface CollectionItemPickerProps {\n\twebPageNodeId: NodeID\n\tselectedItemSlug: string | undefined\n\tselectedItemId: NodeID | undefined\n\titemToSlug: ItemToSlug\n\titemToTitle: ItemToSlug | undefined\n\tonSelectCollectionItemId(collectionItemId: NodeID): void\n\tisLastItem: boolean\n}\n\nfunction getNonEmptyString(value: string | undefined): string | undefined {\n\tif (!value) return undefined\n\tconst trimmed = value.trim()\n\treturn trimmed.length > 0 ? trimmed : undefined\n}\n\nconst CollectionItemPicker = React.memo(function CollectionItemPicker({\n\twebPageNodeId,\n\tselectedItemSlug,\n\tselectedItemId,\n\titemToSlug,\n\titemToTitle,\n\tonSelectCollectionItemId,\n\tisLastItem,\n}: CollectionItemPickerProps) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst menuAnchorOffset = useMenuAnchorOffset()\n\tconst displayTitle =\n\t\tgetNonEmptyString(selectedItemId ? itemToTitle?.[selectedItemId] : undefined) ??\n\t\tselectedItemSlug ??\n\t\t\"No Collection Items\"\n\tconst title = displayTitle\n\n\tconst selectItem = engine.scheduler.wrapHandler(() => {\n\t\tengine.stores.scopeStore.select(webPageNodeId, { keepHistory: true })\n\t})\n\n\tconst isDraft = useEngineState(\n\t\t() => {\n\t\t\tconst node = engine.tree.get(selectedItemId)\n\t\t\tif (!node) return false\n\t\t\treturn isCollectionItemNode(node) && node.isDraft\n\t\t},\n\t\t[selectedItemId],\n\t\t[EngineChange.Tree],\n\t)\n\n\tfunction showCollectionItems(event: React.MouseEvent<HTMLDivElement>) {\n\t\tconst slugByIdOptions = Object.entries(itemToSlug)\n\n\t\t// Our context menu isn't virtualized so we don't want to show it if there are many items.\n\t\tconst maxContextMenuItems = 1000\n\t\tif (slugByIdOptions.length > maxContextMenuItems) {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\tinitialCategory: { type: QuickActionsCategoryType.CollectionPageItem },\n\t\t\t\tsource: \"breadcrumb_bar\",\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tconst menuItems: MenuItemOptions[] = slugByIdOptions.map(([collectionItemId, slug]) => {\n\t\t\tconst itemIsDraft = engine.tree.getNodeWithTrait(collectionItemId, isCollectionItemNode)?.isDraft ?? false\n\t\t\tconst itemTitle = getNonEmptyString(itemToTitle?.[collectionItemId]) ?? slug\n\t\t\tconst draftBadgeClassName = isAgentExperimentOn && itemIsDraft ? styles.menuInlineDraftBadge : undefined\n\t\t\treturn {\n\t\t\t\tlabel: itemTitle,\n\t\t\t\tchecked: selectedItemId === collectionItemId,\n\t\t\t\taliases: [slug],\n\t\t\t\tbadge: itemIsDraft ? Dictionary.Draft : undefined,\n\t\t\t\tbadgeClassName: draftBadgeClassName,\n\t\t\t\tclick() {\n\t\t\t\t\tonSelectCollectionItemId(collectionItemId)\n\t\t\t\t},\n\t\t\t}\n\t\t})\n\t\tengine.stores.contextMenuStore.show(menuItems, {\n\t\t\tlocation: getMenuLocationFromElement(event.currentTarget, menuAnchorOffset),\n\t\t\tsearchable: true,\n\t\t})\n\t}\n\n\tconst disabled = isLastItem && !selectedItemId\n\tconst displayMenu = isLastItem && !disabled\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tgap={8}\n\t\t\t\talignItems=\"center\"\n\t\t\t\trole={!disabled ? \"button\" : undefined}\n\t\t\t\tclassName={cx(styles.breadcrumb, isLastItem && styles.withTint, disabled && styles.breadcrumbDisabled)}\n\t\t\t\tonMouseDown={isLastItem ? showCollectionItems : undefined}\n\t\t\t\tonClick={isLastItem ? undefined : selectItem}\n\t\t\t>\n\t\t\t\t<CenterChild aria-hidden=\"true\">{isAgentExperimentOn ? <IconAgentPage /> : <IconPage />}</CenterChild>\n\t\t\t\t<Stack direction=\"row\" gap={8} alignItems=\"center\">\n\t\t\t\t\t{isAgentExperimentOn ? (\n\t\t\t\t\t\t<Stack direction=\"row\" gap={5} alignItems=\"center\">\n\t\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.breadcrumbTitle)}>{title}</div>\n\t\t\t\t\t\t\t{isDraft && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<span className={styles.breadcrumbSubLabelSeparator}>\u00B7</span>\n\t\t\t\t\t\t\t\t\t<span className={subLabelText}>\n\t\t\t\t\t\t\t\t\t\t<span className={styles.breadcrumbSubLabelText}>{Dictionary.Draft}</span>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.breadcrumbTitle)}>{title}</div>\n\t\t\t\t\t\t\t{isDraft && (\n\t\t\t\t\t\t\t\t<Badge variant=\"primary\" style={{ color: colors.breadcrumbDraftBadgeText }}>\n\t\t\t\t\t\t\t\t\t{Dictionary.Draft}\n\t\t\t\t\t\t\t\t</Badge>\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{displayMenu && (\n\t\t\t\t\t\t<div className={styles.preventShrinking} aria-hidden=\"true\">\n\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t\t{!isLastItem && (\n\t\t\t\t<div className={styles.preventShrinking} aria-hidden=\"true\">\n\t\t\t\t\t<IconChevronRight />\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n})\n", "import type { User } from \"@framerjs/app-shared\"\nimport type { ModulesAPI } from \"@framerjs/framer-services\"\nimport { Avatar, Badge, CopyButton, Stack, Stepper, Text, Tooltip } from \"@framerjs/fresco\"\nimport type { GlobalModuleId } from \"@framerjs/shared\"\nimport { ModuleType, asLocalId, isDependenciesFileId, unhandledError } from \"@framerjs/shared\"\nimport { formatDistanceToNow, parseISO } from \"date-fns\"\nimport engine from \"document/engine.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { copyText } from \"utils/clipboard/copyText.ts\"\nimport { fetchSaves, getModuleContent } from \"utils/moduleVersions.ts\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport * as styles from \"./VersionHistoryControls.styles.ts\"\n\ninterface ControlsProps {\n\tfileId: string\n}\n\ninterface InnerControlsProps {\n\tglobalModuleId: GlobalModuleId\n\tfilename?: string | null\n\toldContents: string | null\n\tsetNewDiffFileContents: (fileContents: string) => void\n}\n\nfunction VersionHistoryControlsInner(props: InnerControlsProps) {\n\tconst { globalModuleId, filename, oldContents, setNewDiffFileContents } = props\n\tconst saves = useSaves(globalModuleId)\n\tconst { selectedSave, selectedSaveIndex, setSelectedSaveIndex } = useSelectedSave(saves)\n\tconst [user, setUser] = useState<User | null>(null)\n\tconst publish = selectedSave?.published\n\tconst latestPublish = publish ? publish[publish.length - 1] : null\n\n\tconst setNewFileContents = useCallback(() => {\n\t\tconst newFileContents = filename ?? selectedSave.files.source\n\t\tgetModuleContent(selectedSave.baseURL, newFileContents)\n\t\t\t.then(file => {\n\t\t\t\tsetNewDiffFileContents(file)\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t}, [selectedSave, setNewDiffFileContents, filename])\n\n\tconst handleInputChange = (value: number) => {\n\t\tsetSelectedSaveIndex(value)\n\t}\n\n\tuseEffect(() => {\n\t\tif (!selectedSave) return\n\t\tlet active = true\n\t\tapiFetcher\n\t\t\t.get(`/web/users/${selectedSave.userId}`)\n\t\t\t.then(fetchedUser => {\n\t\t\t\tif (!active) return\n\t\t\t\tsetUser(fetchedUser)\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [selectedSave])\n\n\tuseEffect(() => {\n\t\tif (!selectedSave) return\n\t\tsetNewFileContents()\n\t}, [selectedSave, setNewFileContents])\n\n\tconst saveTimestamp = useMemo(() => {\n\t\tif (!selectedSave?.savedAt) return \"\"\n\t\tconst [first, ...rest] = formatDistanceToNow(parseISO(selectedSave.savedAt), { addSuffix: true })\n\t\treturn [first.toLocaleUpperCase(), ...rest].join(\"\")\n\t}, [selectedSave])\n\n\tconst handleCopyDiffFileContents = useCallback(() => {\n\t\tif (oldContents) copyText(oldContents).catch(unhandledError)\n\t}, [oldContents])\n\n\treturn (\n\t\t<Stack direction=\"row\" alignItems=\"center\">\n\t\t\t{latestPublish && user && <Badge className={styles.badge}>v{latestPublish.version}</Badge>}\n\t\t\t{user && (\n\t\t\t\t<Tooltip\n\t\t\t\t\ttooltip={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Text className={styles.name} size={12}>\n\t\t\t\t\t\t\t\t{user.name}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text className={styles.label} size={9}>\n\t\t\t\t\t\t\t\t{saveTimestamp}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Avatar avatarCustomStyles={styles.avatar} src={user.avatar} text={user.initials} inactive />\n\t\t\t\t</Tooltip>\n\t\t\t)}\n\t\t\t<CopyButton title=\"Copy Contents\" enabled={!!oldContents} onClick={handleCopyDiffFileContents} />\n\t\t\t<Stepper\n\t\t\t\tvalue={selectedSaveIndex}\n\t\t\t\tonChange={handleInputChange}\n\t\t\t\tstep={1}\n\t\t\t\tclassName={styles.stepper}\n\t\t\t\tmax={saves.length >= 1 ? saves.length - 1 : 0}\n\t\t\t\tmin={1}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\nexport function VersionHistoryControls(props: ControlsProps) {\n\tconst { fileId } = props\n\n\tconst { codeEditorStore, modulesStore } = engine.stores\n\n\tconst oldContents = codeEditorStore.useState(state => state.versionHistoryDiffFile)\n\tconst setNewDiffFileContents = useEngineCallback((fileContents: string) => {\n\t\tcodeEditorStore.versionHistoryDiffFile = fileContents\n\t}, [])\n\n\t// Dependencies use a file id like \"config/dependencies/dependencies.json\"\n\t// while other modules should match the actual local module id 1:1.\n\tconst persistedModule = isDependenciesFileId(fileId)\n\t\t? modulesStore.getPersistedDependenciesModule()\n\t\t: modulesStore.getPersistedModuleByLocalId(asLocalId(fileId))\n\n\tif (!persistedModule) return null\n\tif (persistedModule.type !== ModuleType.Config && persistedModule.type !== ModuleType.Code) return null\n\n\t// We don't pass a filename for non-dependencies modules because filenames\n\t// may change between versions.\n\tconst filename = isDependenciesFileId(fileId) ? fileId.split(\"/\")[2] : null\n\n\treturn (\n\t\t<VersionHistoryControlsInner\n\t\t\tglobalModuleId={persistedModule.id}\n\t\t\tfilename={filename}\n\t\t\toldContents={oldContents}\n\t\t\tsetNewDiffFileContents={setNewDiffFileContents}\n\t\t/>\n\t)\n}\n\nfunction useSaves(moduleId: GlobalModuleId) {\n\tconst [saves, setSaves] = useState<ModulesAPI.Save[]>([])\n\n\tuseEffect(() => {\n\t\tif (!moduleId) return\n\n\t\tlet active = true\n\t\tfetchSaves(moduleId)\n\t\t\t.then(data => {\n\t\t\t\tif (!active || !data) return\n\t\t\t\t// If there's only one save, return it, otherwise remove the current save\n\t\t\t\t// and reverse the order of the saves (for chronological order).\n\t\t\t\tsetSaves(data.length > 1 ? data.slice(1).reverse() : data)\n\t\t\t})\n\t\t\t.catch(() => {})\n\t\treturn () => {\n\t\t\tactive = false\n\t\t}\n\t}, [moduleId])\n\n\treturn saves\n}\n\nfunction useSelectedSave(saves: ModulesAPI.Save[]) {\n\tconst [index, setIndex] = useState(-1)\n\tconst selectedSaveIndex = index >= 0 && index < saves.length ? index : saves.length - 1\n\tconst selectedSave = saves[selectedSaveIndex]\n\treturn {\n\t\tselectedSave,\n\t\tselectedSaveIndex,\n\t\tsetSelectedSaveIndex: setIndex,\n\t}\n}\n", "import \"VersionHistoryControls.styles_1r27rue.wyw.css\"; export const stepper = \"stepper_s10swzla\";\nexport const avatar = \"avatar_a1t8kc9t\";\nexport const name = \"name_nxqie0o\";\nexport const label = \"label_l1ph2xhu\";\nexport const badge = \"badge_b1bfs5mf\";", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID, SmartComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { EntityReferenceNode } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport { COMPONENTS_ENTITY_TYPE_ROOT_ID } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { LayoutTemplateNode } from \"document/models/CanvasTree/nodes/LayoutTemplateNode.ts\"\nimport { createEntityFolderNodesFromPath } from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { createReferenceForNodeIfNeeded } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport {\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n\tisVectorSetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { splitPathToSegments } from \"document/utils/assetPath.ts\"\n\nexport function renameComponent(engine: VekterEngine, title: string, id: NodeID) {\n\tconst componentNode = engine.tree.get<SmartComponentNode | LayoutTemplateNode>(id)\n\n\t// VECTOR @TODO - We should support renaming vector sets and layout templates to create folders.\n\tif (isLayoutTemplateNode(componentNode) || isVectorSetNode(componentNode)) {\n\t\tcomponentNode.set({ name: title })\n\t\treturn\n\t}\n\n\tif (!isSmartComponentNode(componentNode)) return\n\n\tconst reference = EntityReferenceNode.get(engine.tree, id)\n\tconst segments = splitPathToSegments(title)\n\tif (segments.length === 0) return\n\tconst name = segments.pop()\n\tif (reference) {\n\t\t// If we have a reference we may just need to move it into new folders\n\t\t// if additional segments were added to the title.\n\t\tassert(reference.parentid, \"Reference must be in a folder.\")\n\t\tconst newFolderId = createEntityFolderNodesFromPath(engine.tree, segments, reference.parentid)\n\t\t// Move into newly created folder if changed.\n\t\tif (reference.parentid !== newFolderId) engine.tree.moveNode(reference, newFolderId)\n\t} else {\n\t\t// If we don't have an existing reference, we will create folders\n\t\t// and a reference to this node inside the folder.\n\t\tconst newParentId = createEntityFolderNodesFromPath(engine.tree, title, COMPONENTS_ENTITY_TYPE_ROOT_ID)\n\t\tcreateReferenceForNodeIfNeeded(engine.tree, newParentId, componentNode.id)\n\t}\n\n\t// We always only update the name to the \"tip\", never including any path/segments.\n\tcomponentNode.set({ name })\n}\n", "import { triggerErrorToastEvent } from \"@framerjs/framer-events\"\nimport { Button, Stack } from \"@framerjs/fresco\"\nimport { CopyButton } from \"@framerjs/fresco/src/components/CopyButton\"\nimport { colors, fonts } from \"@framerjs/fresco/tokens\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { saveCrdtAsLocalJsonFile } from \"document/components/chrome/debugbar/crdt/saveBlobAsLocalFile.ts\"\nimport { useIsCrdt } from \"document/crdt/useIsCrdt.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CrashData } from \"document/stores/DocumentSettingsStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport React from \"react\"\nimport { SENTRY_PROJECT_ID } from \"sentry/config.ts\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport * as styles from \"./Crash.styles.ts\"\n\nconst reload = () => {\n\ttry {\n\t\twindow.top!.location.reload()\n\t} catch (e) {\n\t\twindow.location.reload()\n\t}\n}\n\nconst hide = engine.scheduler.wrapHandler(() => {\n\tengine.stores.documentSettingsStore.crashData = null\n\tengine.stores.canvasStore.zoomToFitAll()\n})\n\nconst formatCrashData = (crashData: CrashData, asCode?: boolean) => {\n\tlet formatted = `\nProject ID: ${engine.stores.projectStore.projectId}\nError Ref: ${crashData.errorRef}\nSentry: ${crashData.sentryErrorId}\nURL: ${window.location.href}`\n\n\tif (crashData.tags.extraExperiments) {\n\t\tformatted += `\\nExtra Experiments: ${crashData.tags.extraExperiments}`\n\t}\n\tif (crashData.stack) {\n\t\tformatted += `\\n${crashData.stack.replaceAll(window.location.origin, \"\")}`\n\t}\n\n\tformatted = formatted.trim()\n\n\tif (asCode) {\n\t\tconst fences = \"```\"\n\n\t\treturn `${fences}\\n${formatted}\\n${fences}`\n\t}\n\n\treturn formatted\n}\n\nfunction DebugInfo({ crashData }: { crashData: CrashData }) {\n\tconst onCopy = () => {\n\t\ttry {\n\t\t\tconst { sentryErrorId } = crashData\n\t\t\tlet infoForSlack = formatCrashData(crashData, true)\n\n\t\t\tif (sentryErrorId) {\n\t\t\t\tconst query = new URLSearchParams({\n\t\t\t\t\tquery: `id:${sentryErrorId}`,\n\t\t\t\t\treferrer: \"issue-list\",\n\t\t\t\t\tproject: SENTRY_PROJECT_ID,\n\t\t\t\t})\n\t\t\t\tconst sentryUrl = `https://framer.sentry.io/issues/?${query.toString()}`\n\n\t\t\t\tinfoForSlack = infoForSlack.replace(sentryErrorId, sentryUrl)\n\t\t\t}\n\n\t\t\tcopyText(infoForSlack).catch(unhandledError)\n\t\t} catch (e) {\n\t\t\tunhandledError(e)\n\t\t}\n\t}\n\n\tconst isCrdtOn = useIsCrdt()\n\n\treturn (\n\t\t<>\n\t\t\t<pre style={debugInfoPre}>{formatCrashData(crashData)}</pre>\n\t\t\t<Stack direction=\"row\" gap={4}>\n\t\t\t\t<div style={{ flex: 1 }}>\n\t\t\t\t\t<CopyButton title=\"Copy error info for developers\" onClick={onCopy} variant=\"default\" fullWidth={true} />\n\t\t\t\t</div>\n\t\t\t\t{isCrdtOn && <Button onClick={saveCrdtAsLocalJsonFile}>Save CRDT store to file</Button>}\n\t\t\t</Stack>\n\t\t</>\n\t)\n}\n\nexport const Crash = React.memo(function Crash() {\n\tconst crashData = useDeprecatedEngineState(\n\t\tEngineChange.DocumentSettings,\n\t\t() => engine.stores.documentSettingsStore.crashData,\n\t)\n\tconst isEmployee = engine.stores.chromeStore.useState(state => state.userIsEmployee)\n\n\tconst connectionLost = engine.remoteDocument && engine.remoteDocument.waitingForSync()\n\n\tconst crashMessage = crashData?.message\n\n\tReact.useEffect(() => {\n\t\tif (crashMessage) {\n\t\t\ttriggerErrorToastEvent({ errorType: connectionLost ? \"connection_lost\" : \"crash\", message: crashMessage })\n\t\t}\n\t}, [crashMessage, connectionLost])\n\n\tif (!crashMessage) {\n\t\treturn null\n\t}\n\n\tlet msg = \"Framer crashed, apologies for the interruption :(\"\n\tlet action = hide\n\tlet actionMessage = \"Dismiss\"\n\n\tif (connectionLost || engine.scheduler.hadFatalError) {\n\t\tif (connectionLost) {\n\t\t\tmsg = \"Server connection lost:\"\n\t\t}\n\t\taction = reload\n\t\tactionMessage = \"Reload\"\n\t}\n\n\treturn (\n\t\t<div style={style} className={styles.hint}>\n\t\t\t<div style={spacer} />\n\t\t\t<div style={contentContainer}>\n\t\t\t\t<div style={text}>{`${msg} \"${crashMessage}\"`}</div>\n\t\t\t\t{isEmployee && (\n\t\t\t\t\t<div style={text}>\n\t\t\t\t\t\t<DebugInfo crashData={crashData} />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t<div style={spacerWithMargin} />\n\t\t\t<div style={closeLink} onClick={action}>\n\t\t\t\t{actionMessage}\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n\nconst style: React.CSSProperties = {\n\tposition: \"fixed\",\n\tleft: 0,\n\tright: 0,\n\tbottom: \"var(--framerInternalUI-chromeMarginBottom)\",\n\tbackgroundColor: colors.error,\n\tdisplay: \"flex\",\n\talignItems: \"center\",\n\tjustifyContent: \"center\",\n\tflexDirection: \"row\",\n\ttextAlign: \"left\",\n\tfontWeight: 300 /* TODO: Audit (change to fonts.weight.base or add token) */,\n\tfontSize: \"12px\",\n\tlineHeight: 1.6,\n\tcursor: \"default\",\n\tWebkitFontSmoothing: \"subpixel-antialiased\",\n\tcolor: colors.errorText,\n\tpadding: \"15px\",\n\toverflow: \"hidden\",\n}\n\nconst spacer: React.CSSProperties = {\n\tflexGrow: 10,\n}\n\nconst spacerWithMargin: React.CSSProperties = {\n\t...spacer,\n\tminWidth: 20,\n}\n\nconst text: React.CSSProperties = {\n\tpadding: \"0 6 0\",\n}\n\nconst contentContainer: React.CSSProperties = {\n\tminWidth: 0,\n\toverflow: \"hidden\",\n}\n\nconst closeLink: React.CSSProperties = {\n\tcursor: \"pointer\",\n\tpointerEvents: \"auto\",\n\tcolor: \"rgba(255,255,255,.5)\",\n\tflexShrink: 0,\n}\n\nconst debugInfoPre: React.CSSProperties = {\n\tpadding: \"0 6 0\",\n\tmaxHeight: \"20vmax\",\n\toverflow: \"auto\",\n\tfontFamily: fonts.family.monospace,\n\tfontSize: fonts.size.label,\n\tuserSelect: \"text\",\n}\n", "import \"Crash.styles_1nxiz8w.wyw.css\"; export const hint = \"hint_h11g1fmj\";", "import type { MouseTrackerEvent } from \"@framerjs/fresco\"\nimport { Button, IconClose, Stack } from \"@framerjs/fresco\"\nimport { ZIndex, dimensions } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { clamp } from \"framer-motion\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport React, { useCallback, useEffect, useRef } from \"react\"\nimport type { FreedomOfMovement } from \"../preview/WindowResize.tsx\"\nimport { HandleCoordinate, WindowResize } from \"../preview/WindowResize.tsx\"\nimport { FloatingWindow, FloatingWindowDraggableArea } from \"../shared/FloatingWindow.tsx\"\nimport { OptimizationIssuesLog } from \"./OptimizationIssuesLog/index.tsx\"\nimport * as styles from \"./OptimizationIssuesLogWindow.styles.ts\"\n\nfunction getMaxWidth(constraintsRect: DOMRect, contentStartRect: DOMRect, fx: HandleCoordinate): number {\n\tconst startWidth = contentStartRect.width\n\tswitch (fx) {\n\t\tcase HandleCoordinate.Mid:\n\t\t\treturn startWidth\n\t\tcase HandleCoordinate.Start:\n\t\t\treturn startWidth + Math.max(0, contentStartRect.left - constraintsRect.left)\n\t\tcase HandleCoordinate.End:\n\t\t\treturn startWidth + Math.max(0, constraintsRect.right - contentStartRect.right)\n\t\tdefault:\n\t\t\tassertNever(fx)\n\t}\n}\n\nfunction getMaxHeight(constraintsRect: DOMRect, contentStartRect: DOMRect, fy: HandleCoordinate): number {\n\tconst startHeight = contentStartRect.height\n\tswitch (fy) {\n\t\tcase HandleCoordinate.Mid:\n\t\t\treturn startHeight\n\t\tcase HandleCoordinate.Start:\n\t\t\treturn startHeight + Math.max(0, contentStartRect.top - constraintsRect.top)\n\t\tcase HandleCoordinate.End:\n\t\t\treturn startHeight + Math.max(0, constraintsRect.bottom - contentStartRect.bottom)\n\t\tdefault:\n\t\t\tassertNever(fy)\n\t}\n}\n\nfunction getResizeRect(\n\tcontentStartRect: DOMRect,\n\tconstraintsRect: DOMRect,\n\tnewWidth: number,\n\tnewHeight: number,\n\tfx: HandleCoordinate,\n\tfy: HandleCoordinate,\n): { top: number; right: number; bottom: number; left: number; width: number; height: number } {\n\tconst deltaWidth = newWidth - contentStartRect.width\n\tconst deltaHeight = newHeight - contentStartRect.height\n\n\tconst startTop = contentStartRect.top - constraintsRect.top\n\tconst startRight = constraintsRect.right - contentStartRect.right\n\tconst startBottom = constraintsRect.bottom - contentStartRect.bottom\n\tconst startLeft = contentStartRect.left - constraintsRect.left\n\n\tconst top = fy === HandleCoordinate.Start ? startTop - deltaHeight : startTop\n\tconst right = fx === HandleCoordinate.End ? startRight - deltaWidth : startRight\n\tconst bottom = fy === HandleCoordinate.End ? startBottom - deltaHeight : startBottom\n\tconst left = fx === HandleCoordinate.Start ? startLeft - deltaWidth : startLeft\n\n\treturn { top, right, bottom, left, width: newWidth, height: newHeight }\n}\n\nconst minWidth = 520\nconst minHeight = 340\n\nconst noFreedomOfMovement: FreedomOfMovement = {\n\ttopMaxReached: true,\n\ttopMinReached: true,\n\trightMaxReached: true,\n\trightMinReached: true,\n\tbottomMaxReached: true,\n\tbottomMinReached: true,\n\tleftMaxReached: true,\n\tleftMinReached: true,\n}\n\nconst resizeWidthVariable = \"--resize-width\"\nconst resizeHeightVariable = \"--resize-height\"\n\nexport const OptimizationIssuesLogWindow = React.memo(function OptimizationIssuesLogWindow() {\n\tconst { publishStore, chromeStore } = engine.stores\n\tconst canBeDisplayed = chromeStore.useState(\n\t\tstate => state.mainView === ActiveMainView.SiteSettings || state.mainView === ActiveMainView.Canvas,\n\t)\n\n\tconst deployment = publishStore.useState(state => state.optimizationIssuesWindowDeployment)\n\tconst deploymentIssues = publishStore.useState(state => state.optimizationIssuesWindowDeploymentIssues)\n\tconst onDismiss = engine.scheduler.wrapHandler(() => publishStore.closeOptimizationIssuesWindow())\n\n\tconst [size, setSize] = React.useState({ width: minWidth, height: minHeight })\n\tconst [freedomOfMovement, setFreedomOfMovement] = React.useState(noFreedomOfMovement)\n\n\tconst widthStyle = `var(${resizeWidthVariable}, ${size.width}px)`\n\tconst heightStyle = `var(${resizeHeightVariable}, ${size.height}px)`\n\n\tconst floatingWindowRef = React.useRef<FloatingWindow | null>(null)\n\tconst dragStartRectRef = useRef<DOMRect | null>(null)\n\tconst resizableContentRef = useRef<HTMLDivElement | null>(null)\n\tconst resizeConstraintsRef = useRef<HTMLElement | null>(null)\n\n\tconst updateFreedomOfMovement = useCallback(() => {\n\t\tconst constraintsRect = resizeConstraintsRef.current?.getBoundingClientRect()\n\t\tconst contentElement = resizableContentRef.current\n\n\t\tif (!constraintsRect || !contentElement || !canBeDisplayed) {\n\t\t\tsetFreedomOfMovement(current => (isEqual(current, noFreedomOfMovement) ? current : noFreedomOfMovement))\n\t\t\treturn\n\t\t}\n\n\t\tconst contentRect = contentElement.getBoundingClientRect()\n\n\t\tconst minWidthReached = contentRect.width <= minWidth\n\t\tconst minHeightReached = contentRect.height <= minHeight\n\n\t\tconst newFreedomOfMovement: FreedomOfMovement = {\n\t\t\ttopMaxReached: contentRect.top <= constraintsRect.top,\n\t\t\ttopMinReached: minHeightReached,\n\t\t\trightMaxReached: contentRect.right >= constraintsRect.right,\n\t\t\trightMinReached: minWidthReached,\n\t\t\tbottomMaxReached: contentRect.bottom >= constraintsRect.bottom,\n\t\t\tbottomMinReached: minHeightReached,\n\t\t\tleftMaxReached: contentRect.left <= constraintsRect.left,\n\t\t\tleftMinReached: minWidthReached,\n\t\t}\n\n\t\tsetFreedomOfMovement(current => (isEqual(current, newFreedomOfMovement) ? current : newFreedomOfMovement))\n\t}, [canBeDisplayed])\n\n\tconst handleDragStart = useCallback(() => {\n\t\tconst contentElement = resizableContentRef.current\n\t\tdragStartRectRef.current = contentElement?.getBoundingClientRect() ?? null\n\t}, [])\n\n\tconst handleDragEnd = useCallback(() => {\n\t\tdragStartRectRef.current = null\n\t}, [])\n\n\tconst handleDrag = useCallback(\n\t\t(event: MouseTrackerEvent, fx: HandleCoordinate, fy: HandleCoordinate) => {\n\t\t\tconst dragStartRect = dragStartRectRef.current\n\t\t\tconst contentElement = resizableContentRef.current\n\t\t\tconst constraintsRect = resizeConstraintsRef.current?.getBoundingClientRect()\n\n\t\t\tif (!dragStartRect || !contentElement || !constraintsRect) return\n\n\t\t\tconst maxWidth = getMaxWidth(constraintsRect, dragStartRect, fx)\n\t\t\tconst maxHeight = getMaxHeight(constraintsRect, dragStartRect, fy)\n\n\t\t\tconst offsetX = event.offset.x * ((fx - 0.5) * 2)\n\t\t\tconst offsetY = event.offset.y * ((fy - 0.5) * 2)\n\n\t\t\tconst newWidth = clamp(minWidth, maxWidth, dragStartRect.width + offsetX)\n\t\t\tconst newHeight = clamp(minHeight, maxHeight, dragStartRect.height + offsetY)\n\n\t\t\tconst resizedRect = getResizeRect(dragStartRect, constraintsRect, newWidth, newHeight, fx, fy)\n\n\t\t\tcontentElement.style.setProperty(resizeWidthVariable, `${resizedRect.width}px`)\n\t\t\tcontentElement.style.setProperty(resizeHeightVariable, `${resizedRect.height}px`)\n\n\t\t\tfloatingWindowRef.current?.setResizeRect(resizedRect)\n\t\t\tsetSize({ width: newWidth, height: newHeight })\n\t\t\tupdateFreedomOfMovement()\n\t\t},\n\t\t[updateFreedomOfMovement],\n\t)\n\n\t// Recalculate freedom of movement when visibility changes\n\tuseEffect(updateFreedomOfMovement, [deployment, canBeDisplayed, updateFreedomOfMovement])\n\n\tif (!deployment || !deploymentIssues || !canBeDisplayed) return null\n\n\treturn (\n\t\t<FloatingWindow\n\t\t\tref={floatingWindowRef}\n\t\t\tzIndex={ZIndex.globalFloatingWindow}\n\t\t\tinitialTopOffset=\"50%\"\n\t\t\tinitialLeftOffset=\"50%\"\n\t\t\tconstraintBy=\"app\"\n\t\t\tcontainerRef={resizeConstraintsRef}\n\t\t\tonDragEnd={updateFreedomOfMovement}\n\t\t\trestorationKey=\"optimization-issues-log-window\"\n\t\t>\n\t\t\t<WindowResize\n\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\tonDrag={handleDrag}\n\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\tfreedomOfMovement={freedomOfMovement}\n\t\t\t/>\n\t\t\t<div className={styles.window} ref={resizableContentRef} style={{ width: widthStyle, height: heightStyle }}>\n\t\t\t\t<FloatingWindowDraggableArea>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\tclassName={styles.header}\n\t\t\t\t\t\tgap={dimensions.css.inputSpacing}\n\t\t\t\t\t\tpaddingRight={4}\n\t\t\t\t\t\tpaddingLeft={dimensions.css.panelPadding}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span>Optimization Issues</span>\n\t\t\t\t\t\t<Button variant=\"clean\" title={Dictionary.Close} className={styles.closeIcon} onClick={onDismiss}>\n\t\t\t\t\t\t\t<IconClose />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t</FloatingWindowDraggableArea>\n\n\t\t\t\t<div className={styles.logContainer}>\n\t\t\t\t\t<OptimizationIssuesLog deployment={deployment} deploymentIssues={deploymentIssues} fill />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</FloatingWindow>\n\t)\n})\n", "import type { Deployment } from \"@framerjs/app-shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { GetDeploymentIssuesResponse } from \"document/stores/PublishStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useMemo } from \"react\"\nimport Markdown, { defaultUrlTransform } from \"react-markdown\"\nimport remarkBreaks from \"remark-breaks\"\nimport { getDeploymentMessages } from \"../generateDeploymentError.ts\"\nimport { Link } from \"./Link.tsx\"\nimport * as styles from \"./index.styles.ts\"\n\ninterface Props {\n\tdeployment: Deployment\n\tdeploymentIssues: GetDeploymentIssuesResponse | undefined\n\tfill?: boolean\n}\n\nexport function OptimizationIssuesLog({ deployment, deploymentIssues, fill }: Props) {\n\tconst homePageId = useEngineState(\n\t\t() => engine.tree.root.homePageNodeId,\n\t\t[engine.stores.treeStore],\n\t\t[EngineChange.TreeStore],\n\t)\n\n\tconst messages = useMemo(() => getDeploymentMessages(deployment, deploymentIssues), [deployment, deploymentIssues])\n\n\t// Nothing to show\n\tif (messages.length === 0) return null\n\n\treturn (\n\t\t<div className={cx(styles.optimizationLogContainer, fill ? styles.fill : styles.resizeable)}>\n\t\t\t{messages.map(it => (\n\t\t\t\t<div key={it.nodeId ?? \"site-wide issues\"}>\n\t\t\t\t\t{it.nodeId && (\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\thref={`framerssg:node?id=${it.nodeId}`}\n\t\t\t\t\t\t\tclassName={styles.optimizationLogPageTitle}\n\t\t\t\t\t\t\tparseLayerName={false}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{it.nodeId === homePageId ? `/ (${Dictionary.Home})` : getPagePath(it.nodeId)}\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<Markdown\n\t\t\t\t\t\tclassName={styles.optimizationLogMarkdown}\n\t\t\t\t\t\tunwrapDisallowed\n\t\t\t\t\t\tremarkPlugins={[remarkBreaks]}\n\t\t\t\t\t\turlTransform={url => (url.startsWith(\"framerssg:\") ? url : defaultUrlTransform(url))}\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\ta: Link,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{it.message}\n\t\t\t\t\t</Markdown>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nfunction getPagePath(nodeId: string) {\n\tconst node = engine.tree.get(nodeId)\n\tconst pagePath = node && isWebPageNode(node) && getWebPagePath(engine.tree, node)\n\treturn pagePath || nodeId\n}\n", "// Register `Raw` in tree:\n/// <reference types=\"mdast-util-to-hast\" />\n\n/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Nodes} Nodes\n * @typedef {import('hast').Parents} Parents\n * @typedef {import('hast').Root} Root\n * @typedef {import('hast-util-to-jsx-runtime').Components} JsxRuntimeComponents\n * @typedef {import('remark-rehype').Options} RemarkRehypeOptions\n * @typedef {import('unist-util-visit').BuildVisitor<Root>} Visitor\n * @typedef {import('unified').PluggableList} PluggableList\n */\n\n/**\n * @callback AllowElement\n *   Filter elements.\n * @param {Readonly<Element>} element\n *   Element to check.\n * @param {number} index\n *   Index of `element` in `parent`.\n * @param {Readonly<Parents> | undefined} parent\n *   Parent of `element`.\n * @returns {boolean | null | undefined}\n *   Whether to allow `element` (default: `false`).\n *\n * @typedef {Partial<JsxRuntimeComponents>} Components\n *   Map tag names to components.\n *\n * @typedef Deprecation\n *   Deprecation.\n * @property {string} from\n *   Old field.\n * @property {string} id\n *   ID in readme.\n * @property {keyof Options} [to]\n *   New field.\n *\n * @typedef Options\n *   Configuration.\n * @property {AllowElement | null | undefined} [allowElement]\n *   Filter elements (optional);\n *   `allowedElements` / `disallowedElements` is used first.\n * @property {ReadonlyArray<string> | null | undefined} [allowedElements]\n *   Tag names to allow (default: all tag names);\n *   cannot combine w/ `disallowedElements`.\n * @property {string | null | undefined} [children]\n *   Markdown.\n * @property {string | null | undefined} [className]\n *   Wrap in a `div` with this class name.\n * @property {Components | null | undefined} [components]\n *   Map tag names to components.\n * @property {ReadonlyArray<string> | null | undefined} [disallowedElements]\n *   Tag names to disallow (default: `[]`);\n *   cannot combine w/ `allowedElements`.\n * @property {PluggableList | null | undefined} [rehypePlugins]\n *   List of rehype plugins to use.\n * @property {PluggableList | null | undefined} [remarkPlugins]\n *   List of remark plugins to use.\n * @property {Readonly<RemarkRehypeOptions> | null | undefined} [remarkRehypeOptions]\n *   Options to pass through to `remark-rehype`.\n * @property {boolean | null | undefined} [skipHtml=false]\n *   Ignore HTML in markdown completely (default: `false`).\n * @property {boolean | null | undefined} [unwrapDisallowed=false]\n *   Extract (unwrap) what\u2019s in disallowed elements (default: `false`);\n *   normally when say `strong` is not allowed, it and it\u2019s children are dropped,\n *   with `unwrapDisallowed` the element itself is replaced by its children.\n * @property {UrlTransform | null | undefined} [urlTransform]\n *   Change URLs (default: `defaultUrlTransform`)\n *\n * @callback UrlTransform\n *   Transform all URLs.\n * @param {string} url\n *   URL.\n * @param {string} key\n *   Property name (example: `'href'`).\n * @param {Readonly<Element>} node\n *   Node.\n * @returns {string | null | undefined}\n *   Transformed URL (optional).\n */\n\nimport {unreachable} from 'devlop'\nimport {toJsxRuntime} from 'hast-util-to-jsx-runtime'\nimport {urlAttributes} from 'html-url-attributes'\n// @ts-expect-error: untyped.\nimport {Fragment, jsx, jsxs} from 'react/jsx-runtime'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport {unified} from 'unified'\nimport {visit} from 'unist-util-visit'\nimport {VFile} from 'vfile'\n\nconst changelog =\n  'https://github.com/remarkjs/react-markdown/blob/main/changelog.md'\n\n/** @type {PluggableList} */\nconst emptyPlugins = []\n/** @type {Readonly<RemarkRehypeOptions>} */\nconst emptyRemarkRehypeOptions = {allowDangerousHtml: true}\nconst safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i\n\n// Mutable because we `delete` any time it\u2019s used and a message is sent.\n/** @type {ReadonlyArray<Readonly<Deprecation>>} */\nconst deprecations = [\n  {from: 'astPlugins', id: 'remove-buggy-html-in-markdown-parser'},\n  {from: 'allowDangerousHtml', id: 'remove-buggy-html-in-markdown-parser'},\n  {\n    from: 'allowNode',\n    id: 'replace-allownode-allowedtypes-and-disallowedtypes',\n    to: 'allowElement'\n  },\n  {\n    from: 'allowedTypes',\n    id: 'replace-allownode-allowedtypes-and-disallowedtypes',\n    to: 'allowedElements'\n  },\n  {\n    from: 'disallowedTypes',\n    id: 'replace-allownode-allowedtypes-and-disallowedtypes',\n    to: 'disallowedElements'\n  },\n  {from: 'escapeHtml', id: 'remove-buggy-html-in-markdown-parser'},\n  {from: 'includeElementIndex', id: '#remove-includeelementindex'},\n  {\n    from: 'includeNodeIndex',\n    id: 'change-includenodeindex-to-includeelementindex'\n  },\n  {from: 'linkTarget', id: 'remove-linktarget'},\n  {from: 'plugins', id: 'change-plugins-to-remarkplugins', to: 'remarkPlugins'},\n  {from: 'rawSourcePos', id: '#remove-rawsourcepos'},\n  {from: 'renderers', id: 'change-renderers-to-components', to: 'components'},\n  {from: 'source', id: 'change-source-to-children', to: 'children'},\n  {from: 'sourcePos', id: '#remove-sourcepos'},\n  {from: 'transformImageUri', id: '#add-urltransform', to: 'urlTransform'},\n  {from: 'transformLinkUri', id: '#add-urltransform', to: 'urlTransform'}\n]\n\n/**\n * Component to render markdown.\n *\n * @param {Readonly<Options>} options\n *   Props.\n * @returns {JSX.Element}\n *   React element.\n */\nexport function Markdown(options) {\n  const allowedElements = options.allowedElements\n  const allowElement = options.allowElement\n  const children = options.children || ''\n  const className = options.className\n  const components = options.components\n  const disallowedElements = options.disallowedElements\n  const rehypePlugins = options.rehypePlugins || emptyPlugins\n  const remarkPlugins = options.remarkPlugins || emptyPlugins\n  const remarkRehypeOptions = options.remarkRehypeOptions\n    ? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}\n    : emptyRemarkRehypeOptions\n  const skipHtml = options.skipHtml\n  const unwrapDisallowed = options.unwrapDisallowed\n  const urlTransform = options.urlTransform || defaultUrlTransform\n\n  const processor = unified()\n    .use(remarkParse)\n    .use(remarkPlugins)\n    .use(remarkRehype, remarkRehypeOptions)\n    .use(rehypePlugins)\n\n  const file = new VFile()\n\n  if (typeof children === 'string') {\n    file.value = children\n  } else {\n    unreachable(\n      'Unexpected value `' +\n        children +\n        '` for `children` prop, expected `string`'\n    )\n  }\n\n  if (allowedElements && disallowedElements) {\n    unreachable(\n      'Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other'\n    )\n  }\n\n  for (const deprecation of deprecations) {\n    if (Object.hasOwn(options, deprecation.from)) {\n      unreachable(\n        'Unexpected `' +\n          deprecation.from +\n          '` prop, ' +\n          (deprecation.to\n            ? 'use `' + deprecation.to + '` instead'\n            : 'remove it') +\n          ' (see <' +\n          changelog +\n          '#' +\n          deprecation.id +\n          '> for more info)'\n      )\n    }\n  }\n\n  const mdastTree = processor.parse(file)\n  /** @type {Nodes} */\n  let hastTree = processor.runSync(mdastTree, file)\n\n  // Wrap in `div` if there\u2019s a class name.\n  if (className) {\n    hastTree = {\n      type: 'element',\n      tagName: 'div',\n      properties: {className},\n      // Assume no doctypes.\n      children: /** @type {Array<ElementContent>} */ (\n        hastTree.type === 'root' ? hastTree.children : [hastTree]\n      )\n    }\n  }\n\n  visit(hastTree, transform)\n\n  return toJsxRuntime(hastTree, {\n    Fragment,\n    components,\n    ignoreInvalidStyle: true,\n    jsx,\n    jsxs,\n    passKeys: true,\n    passNode: true\n  })\n\n  /** @type {Visitor} */\n  function transform(node, index, parent) {\n    if (node.type === 'raw' && parent && typeof index === 'number') {\n      if (skipHtml) {\n        parent.children.splice(index, 1)\n      } else {\n        parent.children[index] = {type: 'text', value: node.value}\n      }\n\n      return index\n    }\n\n    if (node.type === 'element') {\n      /** @type {string} */\n      let key\n\n      for (key in urlAttributes) {\n        if (\n          Object.hasOwn(urlAttributes, key) &&\n          Object.hasOwn(node.properties, key)\n        ) {\n          const value = node.properties[key]\n          const test = urlAttributes[key]\n          if (test === null || test.includes(node.tagName)) {\n            node.properties[key] = urlTransform(String(value || ''), key, node)\n          }\n        }\n      }\n    }\n\n    if (node.type === 'element') {\n      let remove = allowedElements\n        ? !allowedElements.includes(node.tagName)\n        : disallowedElements\n        ? disallowedElements.includes(node.tagName)\n        : false\n\n      if (!remove && allowElement && typeof index === 'number') {\n        remove = !allowElement(node, index, parent)\n      }\n\n      if (remove && parent && typeof index === 'number') {\n        if (unwrapDisallowed && node.children) {\n          parent.children.splice(index, 1, ...node.children)\n        } else {\n          parent.children.splice(index, 1)\n        }\n\n        return index\n      }\n    }\n  }\n}\n\n/**\n * Make a URL safe.\n *\n * @satisfies {UrlTransform}\n * @param {string} value\n *   URL.\n * @returns {string}\n *   Safe URL.\n */\nexport function defaultUrlTransform(value) {\n  // Same as:\n  // <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>\n  // But without the `encode` part.\n  const colon = value.indexOf(':')\n  const questionMark = value.indexOf('?')\n  const numberSign = value.indexOf('#')\n  const slash = value.indexOf('/')\n\n  if (\n    // If there is no protocol, it\u2019s relative.\n    colon < 0 ||\n    // If the first colon is after a `?`, `#`, or `/`, it\u2019s not a protocol.\n    (slash > -1 && colon > slash) ||\n    (questionMark > -1 && colon > questionMark) ||\n    (numberSign > -1 && colon > numberSign) ||\n    // It is a protocol, it should be allowed.\n    safeProtocol.test(value.slice(0, colon))\n  ) {\n    return value\n  }\n\n  return ''\n}\n", "export default function ansiRegex({onlyFirst = false} = {}) {\n\tconst pattern = [\n\t    '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n\t\t'(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~]))'\n\t].join('|');\n\n\treturn new RegExp(pattern, onlyFirst ? undefined : 'g');\n}\n", "import ansiRegex from 'ansi-regex';\n\nconst regex = ansiRegex();\n\nexport default function stripAnsi(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof string}\\``);\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn string.replace(regex, '');\n}\n", "import { type Deployment, SearchIndexStatus, hasOptimizationIssue } from \"@framerjs/app-shared\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { RenderingIssue } from \"@framerjs/shared/src/ssg/renderingIssues.ts\"\nimport { sortInRouteSegmentOrder } from \"document/components/utils/sortInRouteSegmentOrder.ts\"\nimport engine from \"document/engine.ts\"\nimport type { GetDeploymentIssuesResponse } from \"document/stores/PublishStore.ts\"\nimport stripAnsiCodes from \"strip-ansi\"\n\nfunction isQueryDataError(message: string) {\n\treturn (\n\t\tmessage.includes(\".map is not a function\") ||\n\t\tmessage.includes(\".filter is not a function\") ||\n\t\t/No data in \"[^\"]+\" matches path variables: /u.test(message)\n\t)\n}\n\nconst queryDataMessage =\n\t\"If you are using the CMS, try making any change to this page and publish again. If the message persists, contact us via https://www.framer.com/contact/\"\n\ninterface DeploymentMessage {\n\tnodeId: string | null\n\tmessage: string\n}\n\nexport function getDeploymentMessages(\n\tdeployment: Deployment,\n\tdeploymentIssues: GetDeploymentIssuesResponse | undefined,\n): DeploymentMessage[] {\n\tif (hasOptimizationIssue(deployment.status) && !deploymentIssues?.issues.length) {\n\t\treturn [{ nodeId: null, message: getFallbackMessage(deployment) }]\n\t}\n\n\tconst issues = deploymentIssues?.issues ?? []\n\tconst groupedMessages = new Map<string | null, string[]>()\n\tconst hasBundlingIssue = issues.some(issue => issue.type === \"bundling\")\n\n\tfor (const { routeId, severity, type, data, message } of issues) {\n\t\t// If bundling failed, then as it stands right now, individual pages will also always fail with the \"unknown\"\n\t\t// error during on-demand generation. Until we find a better way to handle this, let's hide these errors in the\n\t\t// UI in this particular situation, as they're only confusing.\n\t\tif (hasBundlingIssue && type === \"unknown\" && severity === \"error\" && routeId !== null) {\n\t\t\tcontinue\n\t\t}\n\n\t\tlet msg: string\n\t\tif (message) {\n\t\t\tmsg = message\n\t\t} else if (type && data) {\n\t\t\tconst issue = { type, ...data } as RenderingIssue\n\t\t\tmsg = formatAsMarkdownListItem(`**[${severity}]** ` + formatDeploymentIssue(deployment, issue))\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isQueryDataError(msg)) {\n\t\t\tmsg = `${queryDataMessage}\\n\\n${msg}`\n\t\t}\n\n\t\tlet group = groupedMessages.get(routeId)\n\t\tif (!group) {\n\t\t\tgroup = []\n\t\t\tgroupedMessages.set(routeId, group)\n\t\t}\n\t\tgroup.push(msg)\n\t}\n\n\tconst logs: DeploymentMessage[] = []\n\tfor (const [routeId, messages] of groupedMessages) {\n\t\tlogs.push({\n\t\t\tnodeId: routeId,\n\t\t\tmessage: messages.join(\"\\n\\n\"),\n\t\t})\n\t}\n\n\tif (deployment.searchIndexStatus === SearchIndexStatus.Failed) {\n\t\tlogs.push({\n\t\t\tnodeId: null,\n\t\t\tmessage: getFallbackMessage(deployment, \"The search index failed to update.\"),\n\t\t})\n\t}\n\n\tconst webPages = sortInRouteSegmentOrder(engine.tree, engine.stores.scopeStore.getWebPageNodes())\n\tconst indexByNodeId: Record<string, number> = {}\n\tfor (let i = 0; i < webPages.length; i++) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: loop\n\t\tindexByNodeId[webPages[i]!.id] = i\n\t}\n\n\tlogs.sort((a, b) => {\n\t\t// Site-wide issues go first.\n\t\tif (a.nodeId === null) {\n\t\t\treturn -1\n\t\t} else if (b.nodeId === null) {\n\t\t\treturn 1\n\t\t}\n\t\t// Unknown routes go last.\n\t\tconst aIndex = indexByNodeId[a.nodeId]\n\t\tif (aIndex === undefined) {\n\t\t\treturn 1\n\t\t}\n\t\tconst bIndex = indexByNodeId[b.nodeId]\n\t\tif (bIndex === undefined) {\n\t\t\treturn -1\n\t\t}\n\t\t// Otherwise, we sort in the order the routes appear in the Pages sidebar.\n\t\treturn aIndex - bIndex\n\t})\n\n\tif (deploymentIssues?.hasMoreIssues) {\n\t\tlogs.push({\n\t\t\tnodeId: null,\n\t\t\tmessage: \"(More issues not shown. Fix the issues above first, then re-publish.)\",\n\t\t})\n\t}\n\n\treturn logs\n}\n\nfunction getFallbackMessage(deployment: Deployment, prefix = \"We were unable to generate an error report.\") {\n\treturn `${prefix} Please try to publish again or contact support at [https://www.framer.com/contact/](https://www.framer.com/contact/) if this message persists. Make sure to include the following information:\\n\\n* Project ID: \\`${deployment.projectId}\\`\\n* Deployment ID: \\`${deployment.id}\\``\n}\n\nfunction formatAsMarkdownListItem(message: string): string {\n\tconst messageLines = message.split(\"\\n\")\n\n\tif (messageLines.length === 1) {\n\t\treturn `* ${messageLines[0]}`\n\t} else {\n\t\treturn `* ${messageLines[0]}\\n${messageLines\n\t\t\t.slice(1)\n\t\t\t.map(line => `  ${line}`)\n\t\t\t.join(\"\\n\")}`\n\t}\n}\n\nfunction formatDeploymentIssue(deployment: Deployment, issue: RenderingIssue): string {\n\tswitch (issue.type) {\n\t\tcase \"userCode\": {\n\t\t\treturn `One of your code files crashed while rendering on the server, likely because it\u2019s reading something from window or document. [Learn more](https://www.framer.com/help/articles/how-to-fix-cannot-set-properties-of-undefined-optimization-error/)\n\n\\`\\`\\`\n${issue.stack ?? issue.message}\n\\`\\`\\``\n\t\t}\n\t\tcase \"nestedLink\": {\n\t\t\tlet message: string\n\t\t\tif (issue.outerLink.furthestExternalComponent) {\n\t\t\t\t// If the parent is an external component, there's no way to navigate into any of the inner layers\n\t\t\t\tmessage = `Nested link detected in external component ${createSSGNodeLink(\n\t\t\t\t\tissue.outerLink.furthestExternalComponent.scopeId,\n\t\t\t\t\tissue.outerLink.furthestExternalComponent.nodeId,\n\t\t\t\t)}.`\n\t\t\t} else if (issue.innerLink.furthestExternalComponent) {\n\t\t\t\t// In this case, at least the parent link node is inside the project, so we can add it in the message.\n\t\t\t\tmessage = `Nested link detected in component ${createSSGNodeLink(\n\t\t\t\t\tissue.innerLink.furthestExternalComponent.scopeId,\n\t\t\t\t\tissue.innerLink.furthestExternalComponent.nodeId,\n\t\t\t\t)} due to parent layer ${createSSGNodeLink(issue.outerLink.scopeId, issue.outerLink.nodeId)}.`\n\t\t\t} else {\n\t\t\t\t// Both the inner and the outer link nodes are inside the project, so we can add link to both.\n\t\t\t\tmessage = `Nested link detected on layer ${createSSGNodeLink(\n\t\t\t\t\tissue.innerLink.scopeId,\n\t\t\t\t\tissue.innerLink.nodeId,\n\t\t\t\t)} due to parent layer ${createSSGNodeLink(issue.outerLink.scopeId, issue.outerLink.nodeId)}.`\n\t\t\t}\n\n\t\t\treturn `${message} [Learn more](https://framer.com/r/nested-links)`\n\t\t}\n\t\tcase \"noPagePath\": {\n\t\t\treturn \"One of the CMS items used on this page has an empty slug, which means it won\u2019t be directly reachable via a URL. To fix this, find the item with the empty slug and give it a non-empty value.\"\n\t\t}\n\t\tcase \"htmlValidation\": {\n\t\t\treturn issue.message\n\t\t}\n\t\tcase \"styles\": {\n\t\t\tlet message = issue.message\n\t\t\tif (issue.context) {\n\t\t\t\tconst lines = issue.context.split(\"\\n\")\n\t\t\t\tlines.splice(issue.line, 0, \"^\".padStart(issue.column))\n\t\t\t\tmessage += `\\n\\n${lines.join(\"\\n\")}`\n\t\t\t}\n\t\t\treturn `Caught the following error while optimizing CSS. This means the affected pages might be slower to load. To fix, try [updating your components](https://www.framer.com/r/css-errors). If the issue persists, please [reach out](https://www.framer.com/contact/).\n\n\\`\\`\\`\n${message}\n\\`\\`\\``\n\t\t}\n\t\tcase \"bundling\": {\n\t\t\t// Rolldown comes with ANSI escape codes in the error message, so we strip them.\n\t\t\t// - There\u2019s no way to disable them at the Rolldown level.\n\t\t\t// - And we don\u2019t do this at the SSG level either because it\u2019s a lil neat to have SSG\u2019s\n\t\t\t//   console output colored.\n\t\t\treturn `Bundling failed. Please try again, and if the issue persists, [reach out](https://www.framer.com/contact/).\n\n\\`\\`\\`\n${stripAnsiCodes(issue.message)}\n\\`\\`\\``\n\t\t}\n\t\tcase \"unsupportedResponse\": {\n\t\t\treturn \"These pages failed to optimize due to an issue with your CMS collection. Please make any update to the CMS collection, and try again.\"\n\t\t}\n\t\tcase \"rewriteSitemapRule\": {\n\t\t\treturn issue.message\n\t\t}\n\t\tcase \"unknown\": {\n\t\t\treturn getFallbackMessage(deployment)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(issue)\n\t}\n}\n\nfunction createSSGNodeLink(scopeId: string | undefined, nodeId: string) {\n\tconst params = scopeId ? `scopeId=${scopeId}&id=${nodeId}` : `id=${nodeId}`\n\n\treturn `[${nodeId}](framerssg:node?${params})`\n}\n", "import { Button } from \"@framerjs/fresco\"\nimport { assert, getLogger } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport { showCanvasNode } from \"document/components/utils/showCanvasNode.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport { isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { useCallback } from \"react\"\nimport * as styles from \"./index.styles.ts\"\n\nconst log = getLogger(\"SSG Link\")\n\ninterface LinkProps {\n\tparseLayerName?: boolean\n\thref: string\n\tclassName?: string\n\tchildren?: React.ReactNode\n}\n\nexport function Link({ parseLayerName = true, href, className, children }: LinkProps) {\n\tconst link = parseSSGLink(href)\n\n\tif (!link) {\n\t\treturn (\n\t\t\t<a href={href} target=\"_blank\" className={cx(styles.optimizationLogLink, className)}>\n\t\t\t\t{children}\n\t\t\t</a>\n\t\t)\n\t}\n\n\tif (isNodeSSGLink(link)) {\n\t\treturn (\n\t\t\t<NodeLink link={link} className={className} parseLayerName={parseLayerName}>\n\t\t\t\t{children}\n\t\t\t</NodeLink>\n\t\t)\n\t}\n\n\tlog.warn(\"invalid framer ssg link: unknown path: \", href)\n}\n\nfunction NodeLink({\n\tchildren,\n\tlink,\n\tclassName,\n\tparseLayerName,\n}: {\n\tchildren?: React.ReactNode\n\tlink: NodeSSGLink\n\tclassName?: string\n\tparseLayerName?: boolean\n}) {\n\tusePreloadedScope(link.scopeId ?? link.id)\n\n\tconst node = useEngineState(\n\t\t() => {\n\t\t\tconst scope = engine.tree.get(link.scopeId)\n\t\t\tconst scopeOrNode = engine.tree.get(link.id)\n\t\t\tconst isScopeLoaded = isScopeNode(scope) && scope.isLoaded()\n\t\t\tconst isNodeALoadedScope = isScopeNode(scopeOrNode) && scopeOrNode.isLoaded()\n\t\t\tif (isScopeLoaded || isNodeALoadedScope) {\n\t\t\t\treturn scopeOrNode\n\t\t\t}\n\t\t},\n\t\t[link.scopeId, link.id],\n\t\t[EngineChange.TreeStore],\n\t)\n\n\tconst handleClick = useCallback(async () => {\n\t\tconst scope = engine.tree.get(link.scopeId)\n\t\tif (isScopeNode(scope)) {\n\t\t\tawait engine.tree.loadScopes([scope])\n\t\t}\n\n\t\tassert(node, \"This callback must only be called when the node exists\")\n\t\tengine.stores.siteSettingsStore.close()\n\t\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Layers\n\t\tshowCanvasNode(engine, node)\n\t}, [node, link.scopeId])\n\n\t// This might happen when a node was removed after the deployment\n\tif (!node) {\n\t\treturn (\n\t\t\t<Button variant=\"link\" className={className} enabled={false}>\n\t\t\t\tUnknown layer\n\t\t\t</Button>\n\t\t)\n\t}\n\n\tconst text = parseLayerName ? node.resolveValue(\"name\") || getDefaultName(engine.componentLoader, node) : children\n\n\treturn (\n\t\t<Button variant=\"link\" onClick={handleClick} className={className}>\n\t\t\t{text}\n\t\t</Button>\n\t)\n}\n\ninterface NodeSSGLink {\n\ttype: \"node\"\n\tid: string\n\t/**\n\t * scopeID will be defined on all modern pages \u2013 but would be undefined on pages codegenerated before ~Feb 2025,\n\t * before we fixed https://github.com/framer/company/issues/31023\n\t */\n\tscopeId: string | null\n}\n\ntype SSGLink = NodeSSGLink\n\nconst SSG_PROTOCOL = \"framerssg:\"\n\nfunction parseSSGLink(href: string): SSGLink | undefined {\n\ttry {\n\t\tconst url = new URL(href)\n\n\t\tif (url.protocol !== SSG_PROTOCOL) return\n\n\t\tif (url.pathname === \"node\") {\n\t\t\tconst id = url.searchParams.get(\"id\")\n\t\t\tif (!id) {\n\t\t\t\tlog.warn(\"invalid framer ssg link: missing node id\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst scopeId = url.searchParams.get(\"scopeId\")\n\n\t\t\treturn { type: \"node\", id, scopeId }\n\t\t}\n\n\t\tlog.warn(\"invalid framer ssg link: unknown path: \", href)\n\t} catch (error) {\n\t\tlog.error(\"fail to parse link: \", href, error)\n\t}\n}\n\nfunction isNodeSSGLink(link: SSGLink): link is NodeSSGLink {\n\treturn link.type === \"node\"\n}\n", "import \"index.styles_lieuq7.wyw.css\"; export const optimizationLogContainer = \"optimizationLogContainer_o1lvmns3\";\nexport const resizeable = \"resizeable_r16ee9ef\";\nexport const fill = \"fill_finijnb\";\nexport const optimizationLogPageTitle = \"optimizationLogPageTitle_oh8gept\";\nexport const optimizationLogMarkdown = \"optimizationLogMarkdown_o1fe779h\";\nexport const optimizationLogLink = \"optimizationLogLink_o1t10rde\";", "import \"OptimizationIssuesLogWindow.styles_m0usm4.wyw.css\"; import { popoverInset } from \"@framerjs/fresco\";\nimport { cx } from \"@linaria/core\";\nexport const window = cx(popoverInset, \"window_w1upi55r\");\nexport const header = \"header_h4gjkmu\";\nexport const closeIcon = \"closeIcon_cm4pbof\";\nexport const logContainer = \"logContainer_lunw1b8\";", "import { dragSessionActive } from \"@framerjs/fresco/layout-transitions\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport type { SiteSettingsTab } from \"document/stores/SiteSettingsStore.ts\"\nimport { SiteSettingsTabNames, siteSettingsImpressionTrackingPages } from \"document/stores/SiteSettingsStore.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { ActiveContentPanelPageProvider } from \"../contentPanel/ActiveContentPanelPageProvider.tsx\"\nimport { CustomCode } from \"./CustomCode/CustomCode.tsx\"\nimport { Domains } from \"./Domains/Domains.tsx\"\nimport { Forms } from \"./Forms/FormsSettings.tsx\"\nimport { PageSettings } from \"./Page/PageSettings.tsx\"\nimport { Plans } from \"./Plans/index.tsx\"\nimport { ProjectSettings } from \"./Project/ProjectSettings.tsx\"\nimport { Redirects } from \"./Redirects/Redirects.tsx\"\nimport * as styles from \"./SiteSettings.styles.ts\"\nimport { SiteSettingsSidebar } from \"./SiteSettingsSidebar.tsx\"\nimport { Usage } from \"./Usage/Usage.tsx\"\nimport { Versions } from \"./Versions.tsx\"\n\ninterface SiteSettingsContentProps {\n\tactive: SiteSettingsTab\n\thasUnsavedChanges: boolean\n}\n\nfunction SiteSettingsContent({ active, hasUnsavedChanges }: SiteSettingsContentProps) {\n\tReact.useEffect(() => {\n\t\tif (!hasUnsavedChanges) return\n\t\tconst handleBeforeUnload = (event: BeforeUnloadEvent) => {\n\t\t\tevent.preventDefault()\n\t\t\t// Chrome requires returnValue to be set. This text is not\n\t\t\t// actually presented in the modal, instead browser will show\n\t\t\t// some generic copy.\n\t\t\tevent.returnValue = \"Changes that you have not saved will be discarded.\"\n\t\t}\n\t\twindow.addEventListener(\"beforeunload\", handleBeforeUnload)\n\t\treturn () => window.removeEventListener(\"beforeunload\", handleBeforeUnload)\n\t}, [hasUnsavedChanges])\n\n\tReact.useEffect(() => {\n\t\tfunction isDismissShortcut(event: KeyboardEvent): boolean {\n\t\t\treturn event.key === \"Escape\" || (event.code === \"KeyS\" && event.altKey)\n\t\t}\n\t\t// We are capturing the event because else its too late to know if the escape was pressed\n\t\t// while a modal is open.\n\t\tlet dismissAllowed = false\n\t\tconst onKeyDownCapture = (event: KeyboardEvent) => {\n\t\t\tif (isDismissShortcut(event)) {\n\t\t\t\tconst noDragActive = !dragSessionActive()\n\t\t\t\tconst noModalVisible = !engine.stores.modalStore.isVisible()\n\t\t\t\tconst noInputFocused = !(event.target instanceof HTMLInputElement)\n\t\t\t\tconst noTextAreasFocused = !(event.target instanceof HTMLTextAreaElement)\n\t\t\t\tconst noContextMenuOpen = !engine.stores.contextMenuStore.menu\n\t\t\t\tdismissAllowed = noDragActive && noModalVisible && noInputFocused && noTextAreasFocused && noContextMenuOpen\n\t\t\t}\n\t\t}\n\t\t// We also listen to the actual key down because maybe something has canceled the default\n\t\t// behavior (e.g. context menu is dismissed).\n\t\tconst onKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (isDismissShortcut(event) && dismissAllowed) {\n\t\t\t\tengine.stores.siteSettingsStore.close()\n\t\t\t}\n\t\t}\n\t\twindow.addEventListener(\"keydown\", onKeyDownCapture, { capture: true })\n\t\twindow.addEventListener(\"keydown\", onKeyDown)\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\"keydown\", onKeyDownCapture, { capture: true })\n\t\t\twindow.removeEventListener(\"keydown\", onKeyDown)\n\t\t}\n\t}, [])\n\n\tReact.useEffect(() => {\n\t\tif (engine.isRemountingUI()) return\n\t\tconst page = siteSettingsImpressionTrackingPages[active.tab]\n\t\tif (!page) return\n\t\trecord(\"ui_impression\", { page })\n\t}, [active])\n\n\tswitch (active.tab) {\n\t\tcase SiteSettingsTabNames.project:\n\t\t\treturn <ProjectSettings />\n\t\tcase SiteSettingsTabNames.domains:\n\t\t\treturn <Domains />\n\t\tcase SiteSettingsTabNames.redirects:\n\t\t\treturn <Redirects />\n\t\tcase SiteSettingsTabNames.forms:\n\t\t\treturn <Forms />\n\t\tcase SiteSettingsTabNames.versions:\n\t\t\treturn <Versions id={active.id} showDeploymentIssues={active.showDeploymentIssues} />\n\t\tcase SiteSettingsTabNames.plans:\n\t\t\treturn <Plans upsellFeature={active.upsellFeature} />\n\t\tcase SiteSettingsTabNames.usage:\n\t\t\treturn <Usage />\n\t\tcase SiteSettingsTabNames.customCode:\n\t\t\treturn <CustomCode />\n\t\tcase SiteSettingsTabNames.page:\n\t\t\t// We are setting the key, because we don't want to share any state between pages\n\t\t\treturn <PageSettings key={active.id} id={active.id} />\n\t\tdefault:\n\t\t\tassertNever(active)\n\t}\n}\n\nexport const SiteSettings = React.memo(function SiteSettings() {\n\tconst mainView = engine.stores.chromeStore.useState(state => state.mainView)\n\tconst { active, hasUnsavedChanges } = engine.stores.siteSettingsStore.useState()\n\tconst { project } = engine.stores.projectStore.useState()\n\n\tif (mainView !== ActiveMainView.SiteSettings) return null\n\tif (!active || !project) return null\n\tconst shouldRenderPanelBackgroundColor =\n\t\tactive.tab === SiteSettingsTabNames.project ||\n\t\tactive.tab === SiteSettingsTabNames.page ||\n\t\tactive.tab === SiteSettingsTabNames.plans ||\n\t\tactive.tab === SiteSettingsTabNames.usage ||\n\t\tactive.tab === SiteSettingsTabNames.customCode ||\n\t\tactive.tab === SiteSettingsTabNames.domains ||\n\t\tactive.tab === SiteSettingsTabNames.forms ||\n\t\tactive.tab === SiteSettingsTabNames.versions\n\n\treturn (\n\t\t<div className={cx(styles.wrapper, shouldRenderPanelBackgroundColor ? styles.panelBackgroundColor : undefined)}>\n\t\t\t<ActiveContentPanelPageProvider>\n\t\t\t\t<SiteSettingsSidebar active={active} />\n\t\t\t</ActiveContentPanelPageProvider>\n\t\t\t<div className={styles.scrollContainer}>\n\t\t\t\t<SiteSettingsContent active={active} hasUnsavedChanges={hasUnsavedChanges} />\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n", "import {\n\tBadge,\n\tButton,\n\tCenterChild,\n\tComboBox,\n\tContextMenuButton,\n\tEmptyState,\n\tIconInputSearch,\n\tIconReorderHandle,\n\tLink,\n\tSortableVirtualList,\n\tSpinner,\n\tStack,\n\tTranslatable as T,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport type { ComboBoxListItem } from \"@framerjs/fresco\"\nimport { Events } from \"@framerjs/fresco/layout-transitions\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, emptyArray } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { FALLBACK_PATH, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { usePreloadedScope } from \"document/components/utils/usePreloadedScope.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CustomCodeNode, NodeID, ShallowWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tCUSTOM_CODE_SCOPE_ID,\n\tCustomCodeScopeNode,\n} from \"document/models/CanvasTree/nodes/custom-code/CustomCodeScopeNode.ts\"\nimport { isCustomCodeNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { PluginIcon } from \"plugins/PluginIcon.tsx\"\nimport pluginFallbackIconSrc from \"plugins/icons/FallbackPlugin.png\"\nimport type { PluginManifestId } from \"plugins/plugins.ts\"\nimport { getPluginIcon } from \"plugins/plugins.ts\"\nimport { memo, useCallback, useEffect, useMemo, useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport * as styles from \"./CustomCode.styles.ts\"\nimport { CustomCodeIcon } from \"./CustomCodeIcon.tsx\"\nimport {\n\tgetCustomCodeName,\n\tgetCustomCodePages,\n\tgetCustomCodePlacementLabel,\n\tgetCustomCodeTypeLabel,\n} from \"./utils/labels.ts\"\n\nconst addCustomCode = (initialPageId?: NodeID) => {\n\tengine.stores.modalStore.set({\n\t\tsource: \"custom_code_settings\",\n\t\ttype: ModalType.EditCustomCode,\n\t\tcustomCodeId: null,\n\t\tinitialPageId,\n\t})\n}\n\nexport function CustomCode() {\n\tusePreloadedScope(CUSTOM_CODE_SCOPE_ID)\n\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst pluginManifestById = engine.stores.pluginStore.useState(state => state.manifestById)\n\n\tconst customCodeNodes = useEngineState(\n\t\t() => {\n\t\t\tconst scopeNode = CustomCodeScopeNode.get(engine.tree)\n\t\t\tif (!scopeNode) return emptyArray<CustomCodeNode>()\n\t\t\tif (!scopeNode.isLoaded()) return undefined\n\t\t\treturn scopeNode.loaded.children.toArray()\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.scopeStore],\n\t)\n\n\tconst initialPageId = engine.stores.siteSettingsStore.useState(state => {\n\t\tconst active = state.active\n\t\tif (!active || active.tab !== SiteSettingsTabNames.customCode) return \"\"\n\t\treturn active.pageId ?? \"\"\n\t})\n\n\tconst [filter, setFilter] = useState<string>(initialPageId)\n\n\tconst routeMap = useWebPageRouteMap()\n\tconst handleAdd = () => addCustomCode(routeMap.has(filter) ? filter : undefined)\n\n\tconst filteredCustomCodeNodes = useMemo(() => {\n\t\tif (!customCodeNodes) return emptyArray<CustomCodeNode>()\n\t\tif (!filter || !routeMap.has(filter)) return customCodeNodes\n\t\treturn customCodeNodes.filter(node => !node.pageIds?.length || node.pageIds.includes(filter))\n\t}, [customCodeNodes, filter, routeMap])\n\n\tconst sortingEnabled = !isViewOnly && !routeMap.has(filter)\n\n\tconst getPluginIconFromPluginId = useCallback(\n\t\t(pluginId: PluginManifestId) => {\n\t\t\tconst manifest = pluginManifestById.get(pluginId)\n\t\t\tif (!manifest) return pluginFallbackIconSrc\n\n\t\t\treturn getPluginIcon(manifest)\n\t\t},\n\t\t[pluginManifestById],\n\t)\n\n\t// This will make sure that the custom code node managed by a plugin will always use the updated plugin name\n\tconst getCustomCodeName = useCallback(\n\t\t(pluginId: PluginManifestId | undefined, customCodeName: string | null) => {\n\t\t\tif (!pluginId) return customCodeName\n\n\t\t\tconst manifest = pluginManifestById.get(pluginId)\n\t\t\treturn manifest?.name ?? customCodeName\n\t\t},\n\t\t[pluginManifestById],\n\t)\n\n\tconst openLearnMore = () => {\n\t\twindow.open(\"https://www.framer.com/help/articles/how-to-add-custom-code/\", \"_blank\")\n\t}\n\n\tif (customCodeNodes === undefined) {\n\t\treturn <Spinner />\n\t}\n\n\tif (customCodeNodes.length === 0) {\n\t\treturn (\n\t\t\t<div className={styles.emptyStateWrapper}>\n\t\t\t\t<EmptyState\n\t\t\t\t\tcenter\n\t\t\t\t\tfullWidthButton={false}\n\t\t\t\t\tstackedButtons={false}\n\t\t\t\t\tsecondaryButton={\n\t\t\t\t\t\t<Button onClick={openLearnMore} bold className={styles.emptyStateButton}>\n\t\t\t\t\t\t\t{Dictionary.LearnMore}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t\tbutton={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={handleAdd}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tclassName={styles.emptyStateButton}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tAdd Script\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t\tmaxBodyWidth={204}\n\t\t\t\t\ticon={<EmptyStateIcon />}\n\t\t\t\t\ticonLarge\n\t\t\t\t\ttitle={Dictionary.CustomCode}\n\t\t\t\t\tbody={\n\t\t\t\t\t\t<div className={styles.emptyStateBodyText}>\n\t\t\t\t\t\t\tAdd a custom script that runs on selected pages of your website.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={15} className={siteSettingStyles.wideContainer}>\n\t\t\t<Stack gap={15}>\n\t\t\t\t<div className={siteSettingStyles.sectionTitle}>\n\t\t\t\t\t<T>Code</T>\n\t\t\t\t</div>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n\t\t\t\t\t<p className={cx(siteSettingStyles.settingDescriptionSecondary, styles.descriptionColumn)}>\n\t\t\t\t\t\t<T>Custom code can be added to all or a selection of pages across the published website.</T>{\" \"}\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tvariant=\"linkLined\"\n\t\t\t\t\t\t\thref=\"https://www.framer.com/help/articles/how-to-add-custom-code/\"\n\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>Learn more</T>\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</p>\n\t\t\t\t</Stack>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"space-between\">\n\t\t\t\t\t<CustomCodePageFilter filter={filter} onFilterChange={setFilter} routeMap={routeMap} />\n\t\t\t\t\t<Button onClick={handleAdd} enabled={!isViewOnly} bold>\n\t\t\t\t\t\t<T>Add</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t<Stack gap={0} className={styles.scriptsTable}>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" className={styles.tableHeader}>\n\t\t\t\t\t<div className={styles.tableNameColumn}>Name</div>\n\t\t\t\t\t<div className={styles.tablePlacementColumn}>Placement</div>\n\t\t\t\t\t<div className={styles.tableTypeColumn}>Type</div>\n\t\t\t\t\t<div className={styles.tablePageColumn}>Page</div>\n\t\t\t\t</Stack>\n\n\t\t\t\t<SortableVirtualList\n\t\t\t\t\tsortingEnabled={sortingEnabled}\n\t\t\t\t\titems={filteredCustomCodeNodes}\n\t\t\t\t\theightForItem={styles.ROW_HEIGHT}\n\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\tmoveItem={moveCustomCode}\n\t\t\t\t>\n\t\t\t\t\t{({ item }) => (\n\t\t\t\t\t\t<CustomCodeRow\n\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\tcustomCode={item}\n\t\t\t\t\t\t\tgetPluginIconByPluginId={getPluginIconFromPluginId}\n\t\t\t\t\t\t\tgetName={getCustomCodeName}\n\t\t\t\t\t\t\trouteMap={routeMap}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</SortableVirtualList>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\ninterface CustomCodePageFilterProps {\n\tfilter: string\n\tonFilterChange: (filter: string) => void\n\trouteMap: Map<NodeID, string>\n}\n\nfunction CustomCodePageFilter({ filter, onFilterChange, routeMap }: CustomCodePageFilterProps) {\n\tconst items = useMemo<ComboBoxListItem[]>(\n\t\t() => Array.from(routeMap, ([id, title]) => ({ type: \"option\" as const, value: id, title })),\n\t\t[routeMap],\n\t)\n\n\tconst displayValue = routeMap.get(filter) ?? filter\n\n\tconst handleChange = (value: string, final: boolean, reset: () => void) => {\n\t\tif (!value || routeMap.has(value)) return onFilterChange(value)\n\t\tif (final) reset()\n\t}\n\n\treturn (\n\t\t<ComboBox\n\t\t\titems={items}\n\t\t\tvalue={displayValue}\n\t\t\tonChange={handleChange}\n\t\t\tconstantChange\n\t\t\tplaceholder={Dictionary.FilterEllipsis}\n\t\t\tleftSlot={\n\t\t\t\t<CenterChild className={styles.searchBarIconLeft}>\n\t\t\t\t\t<IconInputSearch />\n\t\t\t\t</CenterChild>\n\t\t\t}\n\t\t\twrapperClassName={styles.pageFilterInputWrapper}\n\t\t\tmenuWidth=\"input-width\"\n\t\t\tmenuMinWidth={0}\n\t\t/>\n\t)\n}\n\nfunction EmptyStateIcon() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"30\" height=\"30\" fill=\"none\">\n\t\t\t<path\n\t\t\t\td=\"M 0 8 C 0 3.582 3.582 0 8 0 L 22 0 C 26.418 0 30 3.582 30 8 L 30 22 C 30 26.418 26.418 30 22 30 L 8 30 C 3.582 30 0 26.418 0 22 Z\"\n\t\t\t\tfill=\"rgba(0, 153, 255, 0.1)\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 12 11 L 8 15 L 12 19\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"rgb(0, 153, 255)\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 4 0 L 0 4 L 4 8\"\n\t\t\t\ttransform=\"translate(18 11) rotate(180 2 4)\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"rgb(0, 153, 255)\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\ninterface CustomCodeRowProps {\n\tisViewOnly: boolean\n\tcustomCode: CustomCodeNode\n\tgetPluginIconByPluginId: (pluginId: PluginManifestId) => string\n\tgetName: (pluginId: PluginManifestId | undefined, name: string | null) => string | null\n\trouteMap: Map<NodeID, string>\n}\n\nconst CustomCodeRow = memo(function CustomCodeRow({\n\tisViewOnly,\n\tcustomCode,\n\tgetPluginIconByPluginId,\n\tgetName,\n\trouteMap,\n}: CustomCodeRowProps) {\n\tconst [isMenuOpen, setIsMenuOpen] = useState(false)\n\tconst [isReordering, reorderHandler] = useReorderHandle(!isViewOnly)\n\n\tconst routePaths = useMemo(() => getCustomCodePages(customCode, routeMap), [customCode, routeMap])\n\n\tconst handleEdit = useCallback(() => {\n\t\tengine.stores.modalStore.set({\n\t\t\tsource: \"custom_code_settings\",\n\t\t\ttype: ModalType.EditCustomCode,\n\t\t\tcustomCodeId: customCode.id,\n\t\t})\n\t}, [customCode.id])\n\n\tconst handleViewCode = useCallback(() => {\n\t\tengine.stores.modalStore.set({\n\t\t\tsource: \"custom_code_settings\",\n\t\t\ttype: ModalType.ViewCustomCode,\n\t\t\tcustomCodeId: customCode.id,\n\t\t})\n\t}, [customCode.id])\n\n\tconst handleDelete = useCallback(() => {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.ConfirmDeleteCustomCode,\n\t\t\tvariant: \"destructive\",\n\t\t\ttitle: \"Delete Script\",\n\t\t\tdescription: \"Are you sure you want to delete this script? This action cannot be undone.\",\n\t\t\tconfirmLabel: Dictionary.Delete,\n\t\t\tonConfirm: () => deleteCustomCode(customCode.id),\n\t\t\tsource: \"context_menu\",\n\t\t})\n\t}, [customCode.id])\n\n\tconst menuOptions = useMemo<MenuItemOptions[]>(() => {\n\t\tconst view = { label: `${Dictionary.View} ${Dictionary.Code}`, click: handleViewCode }\n\t\tconst edit = { label: `${Dictionary.Edit} ${Dictionary.Code}`, click: handleEdit }\n\n\t\tif (isViewOnly) {\n\t\t\treturn [view]\n\t\t}\n\n\t\tconst toggleLabel = customCode.disabled ? \"Enable\" : \"Disable\"\n\n\t\treturn [\n\t\t\tcustomCode.managedByPlugin ? view : edit,\n\n\t\t\t{ label: toggleLabel, click: () => toggleCustomCodeDisabled(customCode.id) },\n\t\t\t{ label: Dictionary.Delete, click: handleDelete },\n\t\t]\n\t}, [customCode, handleViewCode, handleEdit, handleDelete, isViewOnly])\n\n\tconst showMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tsetIsMenuOpen(true)\n\n\t\t\tconst buttonBounds = event.currentTarget.getBoundingClientRect()\n\t\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\t\tsearchable: false,\n\t\t\t\tlocation: { x: buttonBounds.right + dimensions.values.contextMenuOffsetX, y: buttonBounds.bottom },\n\t\t\t\tonDone: () => setIsMenuOpen(false),\n\t\t\t})\n\t\t},\n\t\t[menuOptions],\n\t)\n\n\tconst showContextMenu = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\t\tsearchable: false,\n\t\t\t\tlocation: { x: event.clientX, y: event.clientY },\n\t\t\t})\n\t\t},\n\t\t[menuOptions],\n\t)\n\n\tconst handleOpenCustomCode = useCallback(() => {\n\t\tif (customCode.managedByPlugin || isViewOnly) {\n\t\t\treturn handleViewCode()\n\t\t}\n\n\t\treturn handleEdit()\n\t}, [isViewOnly, handleViewCode, handleEdit, customCode.managedByPlugin])\n\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tclassName={cx(isMenuOpen && styles.tableRowWithOpenMenu, styles.tableRow)}\n\t\t\tonContextMenu={showContextMenu}\n\t\t\tonClick={handleOpenCustomCode}\n\t\t>\n\t\t\t<Stack\n\t\t\t\tclassName={styles.tableNameColumn}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tgap={10}\n\t\t\t\ttitle={customCode.resolveValue(\"name\") || \"\"}\n\t\t\t>\n\t\t\t\t<IconReorderHandle\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.tableReorderHandleIcon,\n\t\t\t\t\t\t!isViewOnly && styles.reorderHandleGrabbable,\n\t\t\t\t\t\t!isViewOnly && isReordering && styles.reorderHandleGrabbing,\n\t\t\t\t\t)}\n\t\t\t\t\t// We unset the grabbing state via a global mouseup listener, see the effect above.\n\t\t\t\t\tonMouseDown={reorderHandler}\n\t\t\t\t/>\n\n\t\t\t\t{customCode.managedByPlugin ? (\n\t\t\t\t\t<CenterChild className={styles.iconWrapper}>\n\t\t\t\t\t\t<PluginIcon src={getPluginIconByPluginId(customCode.managedByPlugin)} size=\"small\" />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t) : (\n\t\t\t\t\t<CustomCodeIcon />\n\t\t\t\t)}\n\n\t\t\t\t<span className={truncateWithEllipsis}>\n\t\t\t\t\t{getName(customCode.managedByPlugin, getCustomCodeName(customCode))}\n\t\t\t\t</span>\n\t\t\t\t{customCode.disabled && <Badge variant=\"neutral\">Disabled</Badge>}\n\t\t\t</Stack>\n\t\t\t<div className={styles.tablePlacementColumn}>{getCustomCodePlacementLabel(customCode.placement)}</div>\n\t\t\t<div className={styles.tableTypeColumn}>{getCustomCodeTypeLabel(customCode)}</div>\n\t\t\t<div className={cx(styles.tablePageColumn, truncateWithEllipsis)} title={routePaths}>\n\t\t\t\t{routePaths}\n\t\t\t</div>\n\t\t\t<ContextMenuButton onClick={showMenu} className={styles.rowMenu} />\n\t\t</Stack>\n\t)\n})\n\nfunction useWebPageRouteMap() {\n\tconst { homePageNodeId, routeMap } = useEngineState(\n\t\t() => {\n\t\t\tconst routeSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\t\t\treturn {\n\t\t\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\t\t\trouteMap: routeSegmentRootNode.getWebPageIdToRawPathMap(engine.tree),\n\t\t\t}\n\t\t},\n\t\t[],\n\t\t[EngineChange.Tree],\n\t)\n\n\treturn useMemo(() => {\n\t\tconst result = new Map<NodeID, string>()\n\n\t\trouteMap.forEach((_path, pageId) => {\n\t\t\tconst webPage = engine.tree.get<ShallowWebPageNode>(pageId)\n\t\t\tif (!webPage) return\n\n\t\t\tconst isHomePage = pageId === homePageNodeId\n\t\t\tconst title = isHomePage ? Dictionary.Home : getWebPagePath(engine.tree, webPage) || FALLBACK_PATH\n\n\t\t\tresult.set(pageId, title)\n\n\t\t\tconst abVariants = webPage.getAbTestingChildren(engine.tree)\n\t\t\tif (!abVariants) return\n\n\t\t\tfor (const abVariant of abVariants) {\n\t\t\t\tconst name = abVariant.resolveValue(\"name\")\n\t\t\t\tconst variantTitle = `${title} \u00B7 ${name || Dictionary.Variant}`\n\n\t\t\t\tresult.set(abVariant.id, variantTitle)\n\t\t\t}\n\t\t})\n\n\t\treturn result\n\t}, [homePageNodeId, routeMap])\n}\n\nfunction useReorderHandle(canReorder: boolean) {\n\tconst [isReordering, setIsReordering] = useState(false)\n\n\tconst reorderHandler = useCallback(\n\t\t(event: React.MouseEvent<SVGSVGElement>) => {\n\t\t\tif (!canReorder || !Events.isLeftMouseButton(event)) return\n\t\t\tsetIsReordering(true)\n\t\t},\n\t\t[canReorder],\n\t)\n\tuseEffect(() => {\n\t\tconst listener = () => {\n\t\t\t// We set this in an onMouseDown on IconReorderHandle, and unset it\n\t\t\t// via a global listener, because when you finish dragging,\n\t\t\t// depending on the drag preview configuration, the mouseup might no\n\t\t\t// longer fire on the original IconReorderHandle.\n\t\t\tsetIsReordering(false)\n\t\t}\n\t\tdocument.addEventListener(\"mouseup\", listener)\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseup\", listener)\n\t\t}\n\t}, [])\n\n\treturn [isReordering, reorderHandler] as const\n}\n\nconst toggleCustomCodeDisabled = engine.scheduler.wrapHandler((id: NodeID) => {\n\tconst node = engine.tree.getNodeWithTrait(id, isCustomCodeNode)\n\tif (node) {\n\t\tnode.set({ disabled: !node.disabled })\n\t}\n})\n\nconst deleteCustomCode = engine.scheduler.wrapHandler((id: NodeID) => {\n\tconst node = engine.tree.getNodeWithTrait(id, isCustomCodeNode)\n\tif (node) {\n\t\tengine.deleteNode(id)\n\t}\n})\n\nconst moveCustomCode = engine.scheduler.wrapHandler((from: number, to: number) => {\n\tconst scope = CustomCodeScopeNode.ensure(engine.tree)\n\tassert(scope.isLoaded(), \"CustomCodeScopeNode should be loaded\")\n\n\tconst node = from >= 0 ? scope.children.at(from) : undefined\n\tassert(node, `Expected a node at index \"${from}\" to exist`)\n\tengine.tree.moveNode(node, scope.id, to)\n})\n", "import \"CustomCode.styles_15nmv6q.wyw.css\"; export const ROW_HEIGHT = 40;\nexport const emptyStateWrapper = \"emptyStateWrapper_eru9mij\";\nexport const emptyStateBodyText = \"emptyStateBodyText_e155yggh\";\nexport const emptyStateButton = \"emptyStateButton_e4dx791\";\nexport const descriptionColumn = \"descriptionColumn_d1uwav2t\";\nexport const scriptsTable = \"scriptsTable_s1v0w2pb\";\nexport const rowMenu = \"rowMenu_r13ww9mp\";\nexport const tableRowWithOpenMenu = \"tableRowWithOpenMenu_t1jo2iip\";\nexport const tableReorderHandleIcon = \"tableReorderHandleIcon_terf8g7\";\nexport const reorderHandleGrabbable = \"reorderHandleGrabbable_r1tr3o05\";\nexport const reorderHandleGrabbing = \"reorderHandleGrabbing_rwo0eo6\";\nexport const tableRow = \"tableRow_t1vuqid6\";\nexport const tableHeader = \"tableHeader_tthhwc2\";\nexport const tableNameColumn = \"tableNameColumn_t1gl0urb\";\nexport const tablePlacementColumn = \"tablePlacementColumn_t1dhrqj9\";\nexport const tableTypeColumn = \"tableTypeColumn_t1bx07hk\";\nexport const tablePageColumn = \"tablePageColumn_t17wonfy\";\nexport const pageFilterInputWrapper = \"pageFilterInputWrapper_p17ptf5j\";\nexport const searchBarIconLeft = \"searchBarIconLeft_stybow6\";\nexport const iconWrapper = \"iconWrapper_i1r2m2v\";", "import { domainsDashboardPath, openNewTab } from \"@framerjs/app-shared\"\nimport { Button, Link, Spinner, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useCallback, useEffect, useMemo, useRef } from \"react\"\nimport { advancedHostingLearnMoreURL } from \"utils/staticURLs.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { OptimizationIssuesLog } from \"../OptimizationIssuesLog/index.tsx\"\nimport * as settingsStyles from \"../SiteSettings.styles.ts\"\nimport { StatusIndicator } from \"../StatusIndicator.tsx\"\nimport { useIsFirstPublish } from \"../useIsFirstPublish.ts\"\nimport { CanonicalURL } from \"./CanonicalURL/CanonicalURL.tsx\"\nimport { CustomDomain } from \"./CustomDomain/CustomDomain.tsx\"\nimport * as styles from \"./Domains.styles.ts\"\nimport * as unpublishedStyles from \"./UnpublishedState/UnpublishedState.styles.ts\"\nimport { UnpublishedState } from \"./UnpublishedState/UnpublishedState.tsx\"\nimport { VersionMetadata } from \"./VersionMetadata.tsx\"\nimport { labelForStatus } from \"./labelForStatus.tsx\"\n\nexport function Domains() {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\n\tconst {\n\t\tdefaultHostname,\n\t\tcustomHostname,\n\t\tdefaultHostnameDeployment,\n\t\tdefaultHostnameDeploymentIssues,\n\t\tcustomHostnameDeployment,\n\t\tcustomHostnameDeploymentIssues,\n\t\tfreeDomains,\n\t\tpublishStatus,\n\t\tcustomHostnameValidationResult,\n\t} = engine.stores.publishStore.useState()\n\n\tconst isInitial = useRef(true)\n\n\t// Fetch latest hostnames and versions on mount.\n\tuseEffect(() => {\n\t\tif (!isInitial.current) return\n\t\tisInitial.current = false\n\n\t\tengine.stores.publishStore.loadHostnames().catch(unhandledError)\n\t\tengine.stores.publishStore.loadVersions().catch(unhandledError)\n\t}, [])\n\n\tconst baseDomainIndicator =\n\t\tdefaultHostnameDeployment && publishStatus !== PublishStatus.Unpublished ? (\n\t\t\t<StatusIndicator status={defaultHostnameDeployment.status} hasWarnings={defaultHostnameDeployment.hasWarnings} />\n\t\t) : null\n\n\tconst handleVersionClick = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsDomains, id: UIInteraction.openSiteSettingsVersions })\n\t\tengine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.versions }).catch(unhandledError)\n\t}, [])\n\n\tconst onDemandSSGEnabled = useExperimentIsOn(\"onDemandSSG\")\n\n\tconst statusLabel = useMemo(() => {\n\t\treturn labelForStatus(defaultHostnameDeployment?.status, defaultHostnameDeployment?.hasWarnings, onDemandSSGEnabled)\n\t}, [defaultHostnameDeployment?.hasWarnings, defaultHostnameDeployment?.status, onDemandSSGEnabled])\n\n\tconst { isFirstPublish, isCheckingFirstPublish } = useIsFirstPublish()\n\tif (isCheckingFirstPublish) {\n\t\treturn (\n\t\t\t<div className={unpublishedStyles.container}>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tif (isFirstPublish) return <UnpublishedState />\n\n\treturn (\n\t\t<Stack gap={30} className={settingsStyles.wideContainer}>\n\t\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t\t<Stack className={settingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t<T>Base</T>\n\t\t\t\t</Stack>\n\n\t\t\t\t<div>\n\t\t\t\t\t<Stack direction=\"row\" className={styles.domainProperty}>\n\t\t\t\t\t\t<T className={styles.domainPropertyTitle}>URL</T>\n\t\t\t\t\t\t<div className={styles.domainPropertyContent}>\n\t\t\t\t\t\t\t{defaultHostname ? (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\tclassName={cx(styles.domainLink, styles.link)}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\t\t\t\tpage: Pages.siteSettingsDomains,\n\t\t\t\t\t\t\t\t\t\t\tid: UIInteraction.openPublishedLink,\n\t\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\t\topenNewTab(`https://${defaultHostname.hostname}`)\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\t\thttps://{defaultHostname.hostname}\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span className={settingsStyles.placeholder}>example.framer.app</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\t\t\t\t<Stack gap={0}>\n\t\t\t\t\t<Stack direction=\"row\" className={styles.domainProperty}>\n\t\t\t\t\t\t<T className={styles.domainPropertyTitle}>Status</T>\n\t\t\t\t\t\t{baseDomainIndicator}\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{statusLabel !== undefined && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cx(styles.domainPropertyOffsetDescription, styles.domainPropertyContent)}\n\t\t\t\t\t\t\tstyle={{ paddingTop: \"5px\", paddingBottom: \"15px\" }}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{statusLabel}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{defaultHostnameDeployment && (\n\t\t\t\t\t\t<div className={styles.domainPropertyOffsetDescription}>\n\t\t\t\t\t\t\t<OptimizationIssuesLog\n\t\t\t\t\t\t\t\tdeployment={defaultHostnameDeployment}\n\t\t\t\t\t\t\t\tdeploymentIssues={defaultHostnameDeploymentIssues}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t\t<Stack direction=\"row\" className={styles.domainProperty}>\n\t\t\t\t\t<T className={styles.domainPropertyTitle}>Version</T>\n\t\t\t\t\t<div className={styles.domainPropertyContent}>\n\t\t\t\t\t\t{defaultHostnameDeployment ? (\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t{/* Default hostname always points to latest deployment */}\n\t\t\t\t\t\t\t\t<Button variant=\"link\" className={styles.link} onClick={handleVersionClick}>\n\t\t\t\t\t\t\t\t\t<T>Latest</T>\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{\" \u00B7 \"}\n\t\t\t\t\t\t\t\t<VersionMetadata\n\t\t\t\t\t\t\t\t\ttimestamp={defaultHostnameDeployment.createdAt}\n\t\t\t\t\t\t\t\t\tdeployedBy={defaultHostnameDeployment.deployedBy.name}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className={settingsStyles.placeholder}>Not available</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t<Separator height={1} />\n\n\t\t\t<CustomDomain\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tdefaultHostname={defaultHostname}\n\t\t\t\tcustomHostname={customHostname}\n\t\t\t\tcustomHostnameDeployment={customHostnameDeployment}\n\t\t\t\tcustomHostnameDeploymentIssues={customHostnameDeploymentIssues}\n\t\t\t\tfreeDomains={freeDomains}\n\t\t\t\tonVersionClick={handleVersionClick}\n\t\t\t\tpublishStatus={publishStatus}\n\t\t\t\tcustomHostnameValidationResult={customHostnameValidationResult}\n\t\t\t/>\n\n\t\t\t<Separator height={1} />\n\n\t\t\t<CanonicalURL isViewOnly={isViewOnly} />\n\n\t\t\t<Separator height={1} />\n\n\t\t\t<AdvancedHosting />\n\t\t</Stack>\n\t)\n}\n\nfunction AdvancedHosting() {\n\tconst projectId = engine.stores.projectStore.useState(state => state.project?.id)\n\n\tconst handleSetUp = useCallback(() => {\n\t\tif (!projectId) return\n\t\twindow.open(`${domainsDashboardPath}/${projectId}`, \"_self\")\n\t}, [projectId])\n\n\treturn (\n\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t<Stack className={settingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<T>Advanced Hosting</T>\n\t\t\t</Stack>\n\n\t\t\t<p className={cx(settingsStyles.settingDescriptionSecondary, styles.advancedHostingDescription)}>\n\t\t\t\t<T>\n\t\t\t\t\tHost multiple sites or projects under the same domain, or customize your security headers through Advanced\n\t\t\t\t\tHosting.\n\t\t\t\t</T>{\" \"}\n\t\t\t\t<Link variant=\"linkLined\" href={advancedHostingLearnMoreURL} rel=\"noopener noreferrer\">\n\t\t\t\t\tLearn more\n\t\t\t\t</Link>\n\t\t\t</p>\n\n\t\t\t<div>\n\t\t\t\t<Button onClick={handleSetUp} enabled={Boolean(projectId)}>\n\t\t\t\t\tSet Up\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n", "import {\n\tButton,\n\tCenterChild,\n\tComboBox,\n\ttype ComboBoxListItem,\n\tInputWrapper,\n\tLink,\n\tRadioButton,\n\tStack,\n\tTranslatable as T,\n\tTextInput,\n\tUpgradeBadge,\n} from \"@framerjs/fresco\"\nimport { breakpoints } from \"@framerjs/fresco/tokens\"\nimport { assert, getLogger } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport * as React from \"react\"\nimport { reverseProxyArticleURL } from \"utils/staticURLs.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { getProxiedProjectsByProjectId } from \"web/pages/projects/components/Domains/Rewrites/ProxiedProject.ts\"\nimport type { ValidationResult } from \"web/pages/projects/components/Domains/validation/ValidationResult.ts\"\nimport { validatePathOrURL } from \"web/pages/projects/components/Domains/validation/validatePathOrURL.ts\"\nimport { validateCustomCanonicalURL } from \"../../../../../utils/validateCustomCanonicalURL.ts\"\nimport { upsellCustomProxy } from \"../../../shared/UpsellModal/utils/customProxyUpsellModals.ts\"\nimport { updatePartialWebMetadata } from \"../../Project/updateWebMetadata.ts\"\nimport * as settingsStyles from \"../../SiteSettings.styles.ts\"\nimport { DomainCheckmarkIcon } from \"../DomainCheckmarkIcon.tsx\"\nimport * as domainsStyles from \"../Domains.styles.ts\"\nimport * as styles from \"./CanonicalURL.styles.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n}\n\nenum CanonicalUrlType {\n\tdefault = \"default\",\n\tcustom = \"custom\",\n\trewrite = \"rewrite\",\n}\n\nconst logger = getLogger(\"CanonicalURL\")\n\nexport const CanonicalURL = React.memo(function CanonicalURL({ isViewOnly }: Props) {\n\tconst webMetadata = useDeprecatedEngineState(EngineChange.Tree, () => engine.tree.root.webMetadata)\n\tconst [allowedRewriteCanonicalHostnames, setAllowedRewriteCanonicalHostnames] = React.useState<string[]>([])\n\tconst [errors, setErrors] = React.useState<Partial<Record<CanonicalUrlType, string>>>({})\n\n\tconst canUseCustomCanonicalUrl = engine.stores.projectStore.useState(({ project }) => {\n\t\tif (!project) {\n\t\t\t// If the project is still loading, default to off.\n\t\t\treturn \"off\"\n\t\t}\n\t\treturn project.settings.featureFlags.canUseCustomCanonicalUrl\n\t})\n\n\tconst canUseRewriteCanonicalUrl = engine.stores.projectStore.useState(({ project }) => {\n\t\tif (!project) {\n\t\t\t// If the project is still loading, default to off.\n\t\t\treturn \"off\"\n\t\t}\n\t\treturn project.settings.featureFlags.canUseRewriteCanonicalUrl\n\t})\n\n\tconst isSmallScreen = useMediaQuery(`(max-width: ${breakpoints.tabletBig}px)`)\n\n\tReact.useEffect(() => {\n\t\tif (isViewOnly) return\n\n\t\tgetProxiedProjectsByProjectId(engine.stores.projectStore.projectId)\n\t\t\t.then((proxiedProjects: { projectId: string; hostname: string }[]) => {\n\t\t\t\tsetAllowedRewriteCanonicalHostnames(proxiedProjects.map(project => project.hostname))\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\t// Although this might prevent customers from setting the canonical URL\n\t\t\t\t// the vast majority of customers don't use rewrite canonical URL, so we'll just log the error\n\t\t\t\t// to avoid showing an error toast to a customer that doesn't care about it.\n\t\t\t\tlogger.reportError(\"Error getting proxied projects\", { cause: error })\n\t\t\t})\n\t}, [isViewOnly])\n\n\tconst shouldShowCustomCanonicalUpsell = React.useMemo(\n\t\t() => canUseCustomCanonicalUrl === \"upsell\" || canUseCustomCanonicalUrl === \"off\",\n\t\t[canUseCustomCanonicalUrl],\n\t)\n\n\tconst showRewriteCanonical = React.useMemo(() => {\n\t\treturn canUseRewriteCanonicalUrl === \"on\" && allowedRewriteCanonicalHostnames.length > 0\n\t}, [canUseRewriteCanonicalUrl, allowedRewriteCanonicalHostnames])\n\n\tconst onUpsell = React.useCallback(() => upsellCustomProxy(\"settings\"), [])\n\n\tconst handleSelectDefault = React.useCallback(() => {\n\t\tsetErrors({})\n\t\tupdatePartialWebMetadata({ canonicalURL: CanonicalUrlType.default })\n\t}, [])\n\n\tconst handleSelectCustom = React.useCallback(() => {\n\t\tif (shouldShowCustomCanonicalUpsell) return onUpsell()\n\n\t\tsetErrors({})\n\t\tupdatePartialWebMetadata({ canonicalURL: CanonicalUrlType.custom })\n\t}, [shouldShowCustomCanonicalUpsell, onUpsell])\n\n\tconst handleSelectRewrite = React.useCallback(() => {\n\t\tsetErrors({})\n\t\tupdatePartialWebMetadata({ canonicalURL: CanonicalUrlType.rewrite })\n\t}, [])\n\n\tconst defaultCanonicalURL = engine.stores.publishStore.useState(state => state.defaultCanonicalURL)\n\tconst hasDefaultCanonicalURL = Boolean(defaultCanonicalURL)\n\n\tconst enabled = !isViewOnly && hasDefaultCanonicalURL\n\n\tif (shouldShowCustomCanonicalUpsell && !showRewriteCanonical) {\n\t\treturn (\n\t\t\t<Stack gap={15}>\n\t\t\t\t<Stack className={settingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t<T>Canonical URL</T>\n\t\t\t\t\t<UpgradeBadge onClick={onUpsell} />\n\t\t\t\t</Stack>\n\n\t\t\t\t<Description upsell />\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={20} className={styles.canonicalURLContainer}>\n\t\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t\t<Stack className={settingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t<T>Canonical</T>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Description />\n\t\t\t</Stack>\n\n\t\t\t<Stack gap={15} role=\"radiogroup\" aria-label=\"Canonical URL type\">\n\t\t\t\t<RadioButton\n\t\t\t\t\tidentifier={CanonicalUrlType.default}\n\t\t\t\t\ttitle={Dictionary.Default}\n\t\t\t\t\tdescription={defaultCanonicalURL || \"Publish your website to see the canonical URL\"}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tselected={!webMetadata?.canonicalURL || webMetadata?.canonicalURL === CanonicalUrlType.default}\n\t\t\t\t\tonSelect={handleSelectDefault}\n\t\t\t\t\taria-label=\"Default canonical URL\"\n\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t\tclassName={styles.radioButton}\n\t\t\t\t/>\n\t\t\t\t{showRewriteCanonical && (\n\t\t\t\t\t<Stack gap={15} direction={isSmallScreen ? \"column\" : \"row\"} justifyContent=\"space-between\">\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tidentifier={CanonicalUrlType.rewrite}\n\t\t\t\t\t\t\ttitle=\"Multi Site\"\n\t\t\t\t\t\t\tdescription=\"Set the canonical URL for this site when used as a rewrite target\"\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\tselected={webMetadata?.canonicalURL === CanonicalUrlType.rewrite}\n\t\t\t\t\t\t\tonSelect={handleSelectRewrite}\n\t\t\t\t\t\t\taria-label=\"Multi Site canonical URL\"\n\t\t\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t\t\t\tclassName={styles.radioButton}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{webMetadata?.canonicalURL === CanonicalUrlType.rewrite && (\n\t\t\t\t\t\t\t<RewriteHostnameAndPathForm\n\t\t\t\t\t\t\t\tallowedHostnames={allowedRewriteCanonicalHostnames}\n\t\t\t\t\t\t\t\tenabled={enabled && webMetadata?.canonicalURL === CanonicalUrlType.rewrite}\n\t\t\t\t\t\t\t\tpersistedHostname={webMetadata?.rewriteCanonicalHostname}\n\t\t\t\t\t\t\t\tpersistedPath={webMetadata?.rewriteCanonicalPath}\n\t\t\t\t\t\t\t\terror={errors[CanonicalUrlType.rewrite]}\n\t\t\t\t\t\t\t\tsetError={error => setErrors({ [CanonicalUrlType.rewrite]: error })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t\t{!shouldShowCustomCanonicalUpsell && (\n\t\t\t\t\t<Stack gap={15} direction={isSmallScreen ? \"column\" : \"row\"} justifyContent=\"space-between\">\n\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\tidentifier={CanonicalUrlType.custom}\n\t\t\t\t\t\t\ttitle=\"Advanced\"\n\t\t\t\t\t\t\tdescription=\"Provide a custom URL to host the site behind a proxy\"\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\tselected={webMetadata?.canonicalURL === CanonicalUrlType.custom}\n\t\t\t\t\t\t\tonSelect={handleSelectCustom}\n\t\t\t\t\t\t\taria-label=\"Advanced custom canonical URL\"\n\t\t\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t\t\t\tclassName={styles.radioButton}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t{webMetadata?.canonicalURL === CanonicalUrlType.custom && (\n\t\t\t\t\t\t\t<CustomURLForm\n\t\t\t\t\t\t\t\tenabled={enabled && webMetadata?.canonicalURL === CanonicalUrlType.custom}\n\t\t\t\t\t\t\t\tpersistedURL={webMetadata?.customCanonicalURL}\n\t\t\t\t\t\t\t\terror={errors[CanonicalUrlType.custom]}\n\t\t\t\t\t\t\t\tsetError={error => setErrors({ [CanonicalUrlType.custom]: error })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n\nfunction Description({ upsell }: { upsell?: boolean }) {\n\treturn (\n\t\t<div className={cx(styles.description, settingsStyles.settingDescriptionSecondary)}>\n\t\t\t<T>\n\t\t\t\tSet up a Canonical URL when using a Reverse Proxy for your site to specify the URL for search engines to index\n\t\t\t\tand avoid serving duplicate content.\n\t\t\t</T>{\" \"}\n\t\t\t{upsell && (\n\t\t\t\t<>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tThe use of a reverse proxy is only allowed on Enterprise plans or if you{\"\\u2019\"}ve purchased an{\" \"}\n\t\t\t\t\t\t{Dictionary.AddOn}.\n\t\t\t\t\t</T>{\" \"}\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<Link variant=\"linkLined\" href={reverseProxyArticleURL} rel=\"noopener noreferrer\">\n\t\t\t\tLearn more\n\t\t\t</Link>\n\t\t</div>\n\t)\n}\n\nconst CustomURLForm = React.memo(function CustomURLForm({\n\tenabled,\n\tpersistedURL,\n\terror,\n\tsetError,\n}: {\n\tenabled: boolean\n\tpersistedURL?: string\n\terror?: string\n\tsetError: (error: string | undefined) => void\n}) {\n\tconst draftURL = engine.stores.siteSettingsStore.useState(state => state.customCanonicalURLChanges)\n\tconst hasChanges = draftURL !== undefined\n\tconst url = (draftURL !== undefined ? draftURL : persistedURL) || \"\"\n\n\tconst handleSubmit = (event: React.FormEvent) => {\n\t\tevent.preventDefault()\n\n\t\tconst validationResult = validateCustomCanonicalURL(url)\n\t\tif (validationResult.result === \"error\") {\n\t\t\tsetError(validationResult.message)\n\t\t\treturn\n\t\t}\n\t\tsetError(\"\")\n\t\tpersistCustomURLDraft()\n\t}\n\n\treturn (\n\t\t<form onSubmit={handleSubmit} className={styles.form}>\n\t\t\t<Stack className={styles.formContent}>\n\t\t\t\t<Stack direction=\"row\">\n\t\t\t\t\t<InputWrapper hasError={Boolean(error)} className={styles.urlInputWrapper}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\tonChange={setCustomURLDraft}\n\t\t\t\t\t\t\tplaceholder=\"www.site.com\"\n\t\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tenabled={enabled && hasChanges}\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tclassName={domainsStyles.iconButton}\n\t\t\t\t\t\taria-label=\"Submit canonical URL\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t<DomainCheckmarkIcon />\n\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t\t{error && <T className={styles.errorMessage}>{error}</T>}\n\t\t\t</Stack>\n\t\t</form>\n\t)\n})\n\nconst RewriteHostnameAndPathForm = React.memo(function RewriteHostnameAndPathForm({\n\tallowedHostnames,\n\tenabled,\n\tpersistedHostname,\n\tpersistedPath,\n\terror,\n\tsetError,\n}: {\n\tallowedHostnames: string[]\n\tenabled: boolean\n\tpersistedHostname: string | undefined\n\tpersistedPath: string | undefined\n\terror?: string\n\tsetError: (error: string) => void\n}) {\n\tconst draftPath = engine.stores.siteSettingsStore.useState(state => state.rewriteCanonicalPathChanges)\n\tconst hasPathChanges = draftPath !== undefined\n\tconst path = draftPath ?? persistedPath ?? \"\"\n\n\tconst draftHostname = engine.stores.siteSettingsStore.useState(state => state.rewriteCanonicalHostnameChanges)\n\tconst hasHostnameChanges = draftHostname !== undefined\n\tconst hostname = draftHostname ?? persistedHostname ?? \"\"\n\n\tconst hasChanges = hasHostnameChanges || hasPathChanges\n\n\tconst hostnameOptions: ComboBoxListItem[] = allowedHostnames.map(hostname => ({\n\t\ttype: \"option\",\n\t\tvalue: hostname,\n\t\ttitle: hostname,\n\t\tonClick: () => {\n\t\t\tsetRewriteCanonicalHostnameDraft(hostname)\n\t\t},\n\t}))\n\n\tconst getCheckedItems = React.useCallback(() => {\n\t\tif (hasHostnameChanges) return [draftHostname]\n\t\tif (persistedHostname) return [persistedHostname]\n\t\treturn undefined\n\t}, [hasHostnameChanges, draftHostname, persistedHostname])\n\n\tconst handleRewriteCanonicalURLFormSubmit = (event: React.FormEvent) => {\n\t\tevent.preventDefault()\n\n\t\tconst pathValidationResult = validateRewriteCanonicalPath(path)\n\t\tif (pathValidationResult.result === \"error\") {\n\t\t\tsetError(pathValidationResult.message)\n\t\t\treturn\n\t\t}\n\n\t\tconst hostnameValidationResult = validateRewriteCanonicalHostname(hostname, allowedHostnames)\n\t\tif (hostnameValidationResult.result === \"error\") {\n\t\t\tsetError(hostnameValidationResult.message)\n\t\t\treturn\n\t\t}\n\n\t\tsetError(\"\")\n\t\tpersistRewriteCanonicalURLDraft(allowedHostnames)\n\t}\n\n\treturn (\n\t\t<form onSubmit={handleRewriteCanonicalURLFormSubmit} className={styles.form}>\n\t\t\t<Stack className={styles.formContent}>\n\t\t\t\t<Stack direction=\"row\">\n\t\t\t\t\t<ComboBox\n\t\t\t\t\t\tid=\"rewrite-hostname\"\n\t\t\t\t\t\tvalue={persistedHostname ?? \"\"}\n\t\t\t\t\t\trightChevron\n\t\t\t\t\t\titems={hostnameOptions}\n\t\t\t\t\t\tonChange={setRewriteCanonicalHostnameDraft}\n\t\t\t\t\t\tcheckedItems={getCheckedItems()}\n\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\tplaceholder=\"Select a hostname...\"\n\t\t\t\t\t\thasError={Boolean(error)}\n\t\t\t\t\t\twrapperClassName={styles.urlInputWrapper}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<InputWrapper hasError={Boolean(error)} className={styles.fullWidth}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\tenabled={enabled}\n\t\t\t\t\t\t\tonChange={setRewriteCanonicalPathDraft}\n\t\t\t\t\t\t\tplaceholder=\"Enter a path, e.g. /blog\"\n\t\t\t\t\t\t\tvalue={path}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputWrapper>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\tenabled={enabled && hasChanges}\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tclassName={domainsStyles.iconButton}\n\t\t\t\t\t\taria-label=\"Submit rewrite canonical URL\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t<DomainCheckmarkIcon />\n\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t\t{error && <T className={styles.errorMessage}>{error}</T>}\n\t\t\t</Stack>\n\t\t</form>\n\t)\n})\n\nconst validateRewriteCanonicalHostname = (hostname: string, allowedHostnames: string[]): ValidationResult => {\n\tif (!hostname) return { result: \"error\", message: \"Please enter a valid hostname\" }\n\n\t// Make sure the hostname is allowed (since ComboBox allows text editing, so the user can enter any value)\n\tif (!allowedHostnames.includes(hostname)) {\n\t\treturn { result: \"error\", message: \"Hostname not allowed\" }\n\t}\n\n\treturn { result: \"ok\", normalizedValue: hostname }\n}\n\nconst validateRewriteCanonicalPath = (path: string): ValidationResult => {\n\tif (!path) return { result: \"error\", message: \"Please enter a valid path\" }\n\n\treturn validatePathOrURL(path, \"path\", { blockInvalidCharacters: \"all\" })\n}\n\nfunction setCustomURLDraft(draftValue: string) {\n\tconst persistedValue = engine.tree.root.webMetadata?.customCanonicalURL || \"\"\n\tengine.stores.siteSettingsStore.customCanonicalURLChanges = draftValue === persistedValue ? undefined : draftValue\n}\n\nfunction persistCustomURLDraft() {\n\tconst draftValue = engine.stores.siteSettingsStore.customCanonicalURLChanges\n\tif (!draftValue) {\n\t\treturn\n\t}\n\n\tconst validationResult = validateCustomCanonicalURL(draftValue)\n\tif (validationResult.result !== \"ok\") {\n\t\treturn\n\t}\n\n\tupdatePartialWebMetadata({ customCanonicalURL: validationResult.normalizedValue })\n\n\tif (document.activeElement && document.activeElement instanceof HTMLInputElement) {\n\t\tdocument.activeElement.blur()\n\t}\n\t// Blurring will trigger one last onChange event on the input, so clearing\n\t// the draft must happen after the blur!\n\tengine.stores.siteSettingsStore.clearCanonicalURLChanges()\n}\n\nfunction setRewriteCanonicalHostnameDraft(draftValue: string) {\n\tconst persistedValue = engine.tree.root.webMetadata?.rewriteCanonicalHostname || \"\"\n\tengine.stores.siteSettingsStore.rewriteCanonicalHostnameChanges =\n\t\tdraftValue === persistedValue ? undefined : draftValue\n}\n\nfunction setRewriteCanonicalPathDraft(draftValue: string) {\n\tconst persistedValue = engine.tree.root.webMetadata?.rewriteCanonicalPath || \"\"\n\tengine.stores.siteSettingsStore.rewriteCanonicalPathChanges = draftValue === persistedValue ? undefined : draftValue\n}\n\nfunction persistRewriteCanonicalURLDraft(allowedHostnames: string[]) {\n\tconst draftPathValue = engine.stores.siteSettingsStore.rewriteCanonicalPathChanges\n\tconst draftHostnameValue = engine.stores.siteSettingsStore.rewriteCanonicalHostnameChanges\n\tif (!draftPathValue && !draftHostnameValue) {\n\t\treturn\n\t}\n\n\tconst newPathValue = draftPathValue || engine.tree.root.webMetadata?.rewriteCanonicalPath\n\tconst newHostnameValue = draftHostnameValue || engine.tree.root.webMetadata?.rewriteCanonicalHostname\n\n\tassert(newPathValue, \"Path value is required\")\n\tassert(newHostnameValue, \"Hostname value is required\")\n\n\tconst pathValidationResult = validatePathOrURL(newPathValue, \"path\", { blockInvalidCharacters: \"all\" })\n\tif (pathValidationResult.result !== \"ok\") {\n\t\treturn\n\t}\n\n\tconst hostnameValidationResult = validateRewriteCanonicalHostname(newHostnameValue, allowedHostnames)\n\tif (hostnameValidationResult.result !== \"ok\") {\n\t\treturn\n\t}\n\n\tupdatePartialWebMetadata({\n\t\trewriteCanonicalPath: pathValidationResult.normalizedValue,\n\t\trewriteCanonicalHostname: hostnameValidationResult.normalizedValue,\n\t})\n\n\tif (document.activeElement && document.activeElement instanceof HTMLInputElement) {\n\t\tdocument.activeElement.blur()\n\t}\n\t// Blurring will trigger one last onChange event on the input, so clearing\n\t// the draft must happen after the blur!\n\tengine.stores.siteSettingsStore.clearRewriteCanonicalPathChanges()\n\tengine.stores.siteSettingsStore.clearRewriteCanonicalHostnameChanges()\n}\n", "import { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nexport const getProxiedProjectsByProjectId = async (\n\tprojectId: string,\n): Promise<{ projectId: string; hostname: string }[]> => {\n\tconst response = await apiFetcher.get(`/web/projects/${projectId}/proxied-projects`)\n\treturn response as { projectId: string; hostname: string }[]\n}\n", "import { AddOnLicenseType } from \"@framerjs/app-shared\"\nimport type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\n\nfunction showAcquireModal(source: ModalOpenSource) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.AcquireAddonModal,\n\t\taddonInfo: {\n\t\t\taddonLicenseType: AddOnLicenseType.CustomProxySetup,\n\t\t},\n\t\tsource,\n\t})\n}\n\nfunction showCustomProxyUpsellModal(source: ModalOpenSource) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\ttitle: \"Reverse Proxy\",\n\t\tdescription: `Purchase an ${Dictionary.AddOn} to enable the use of a Reverse Proxy for hosting multiple sites or landing pages on your domain.`,\n\t\tsource,\n\t\tconfirmLabel: \"Buy\",\n\t\tcancelLabel: Dictionary.MaybeLater,\n\t\t// Prevent Confirmation Modal from closing the next modal\n\t\t// that has just been opened\n\t\tavoidDismissOnConfirm: true,\n\t\tonConfirm: () => showAcquireModal(source),\n\t})\n}\n\nfunction showPlanUpsellModal(source: ModalOpenSource) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tupsellFeature: UpsellFeature.canUseCustomCanonicalUrl,\n\t\ttitle: \"Reverse Proxy\",\n\t\tdescription: `Your current plan does not allow the use of a Reverse Proxy. Upgrade your site and purchase the Advanced Hosting ${Dictionary.AddOn} to enable hosting multiple sites or landing pages on your domain.`,\n\t\tsource,\n\t})\n}\n\nexport function upsellCustomProxy(source: ModalOpenSource) {\n\tconst canUseCustomCanonicalUrl = engine.stores.projectStore.featureFlags?.canUseCustomCanonicalUrl || \"off\"\n\n\tif (canUseCustomCanonicalUrl === \"off\") {\n\t\treturn showPlanUpsellModal(source)\n\t} else if (canUseCustomCanonicalUrl === \"upsell\") {\n\t\treturn showCustomProxyUpsellModal(source)\n\t}\n\n\treturn null\n}\n", "import engine from \"document/engine.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\n\nexport const updateWebMetadata = engine.scheduler.wrapHandler((newMetadata: WebMetadata) => {\n\tengine.tree.root.set({ webMetadata: newMetadata }, engine.tree)\n})\n\nexport const updatePartialWebMetadata = engine.scheduler.wrapHandler((partialMetadata: Partial<WebMetadata>) => {\n\tconst currentMetadata = engine.tree.root.webMetadata\n\tengine.tree.root.set({ webMetadata: { ...currentMetadata, ...partialMetadata } })\n})\n", "export function DomainCheckmarkIcon() {\n\treturn (\n\t\t<svg\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"8\"\n\t\t\theight=\"5.333\"\n\t\t\tfill=\"none\"\n\t\t\toverflow=\"visible\"\n\t\t\taria-hidden=\"true\"\n\t\t\tfocusable=\"false\"\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M 0 2.667 L 2.313 4.98 C 2.508 5.175 2.825 5.175 3.02 4.98 L 8 0\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstroke=\"currentColor\"\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 \"Domains.styles_12v637c.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nexport const domainPropertyStackGap = 10;\nexport const customDomainUrlToStatusGap = 15;\nexport const link = \"link_ln3cx77\";\nexport const domainProperty = \"domainProperty_d3f65yu\";\nexport const domainPropertyTitle = \"domainPropertyTitle_dvggf55\";\nexport const iconButton = \"iconButton_iy8a7ea\";\nexport const domainPropertyContent = \"domainPropertyContent_dimyswu\";\nexport const domainPropertyContentFullColumn = \"domainPropertyContentFullColumn_d1vb8wb2\";\nexport const domainPropertyDescription = \"domainPropertyDescription_d1ypu9e2\";\nexport const domainPropertyDnsDescription = \"domainPropertyDnsDescription_d1bcfvoo\";\nexport const domainPropertyOffsetDescription = \"domainPropertyOffsetDescription_d197insq\";\nexport const domainPropertyContentDNSTable = \"domainPropertyContentDNSTable_dbejkn\";\nexport const domainLink = \"domainLink_d1v34clm\";\nexport const domainStatus = domainLink;\nexport const domainStatusActions = \"domainStatusActions_dpmlijg\";\nexport const refreshDNSButton = \"refreshDNSButton_r1orpcse\";\nexport const refreshDNSButtonLoading = \"refreshDNSButtonLoading_r1oo7kkm\";\nexport const domainConnectButton = \"domainConnectButton_dv34ooe\";\nexport const domainPropertyTopAligned = \"domainPropertyTopAligned_d7andkx\";\nexport const marginLeftAuto = \"marginLeftAuto_momv6dd\";\nexport const customDomainRadioButton = \"customDomainRadioButton_cx410vg\";\nexport const customDomainInputWrapperMarginLeft = dimensions.values.radioButtonSize + dimensions.values.inputPaddingHorizontal + 4;\nexport const customDomainInputWrapper = \"customDomainInputWrapper_ch88qqy\";\nexport const customDomainInputError = \"customDomainInputError_cm1x5hp\";\nexport const customDomainForm = \"customDomainForm_cip53u7\";\nexport const customDomainInputRow = \"customDomainInputRow_coghbuc\";\nexport const customDomainFormHidden = \"customDomainFormHidden_ce4g75a\";\nexport const inlineLink = \"inlineLink_i6jwgqd\";\nexport const freeDomainsSelectorOpenedIcon = \"freeDomainsSelectorOpenedIcon_f1lxh8nl\";\nexport const freeDomainsSelector = \"freeDomainsSelector_f9vxjlo\";\nexport const freeDomainsSelectorLabel = \"freeDomainsSelectorLabel_fidkwll\";\nexport const freeDomainsSelectorEnabled = \"freeDomainsSelectorEnabled_f10ropue\";\nexport const title = \"title_t1rknts5\";\nexport const advancedHostingDescription = \"advancedHostingDescription_aovzsan\";\nexport const optimizationErrorContainer = \"optimizationErrorContainer_o1ykjrcd\";", "import \"CanonicalURL.styles_zpht5o.wyw.css\"; export const canonicalURLContainer = \"canonicalURLContainer_c14t2o2k\";\nexport const errorMessage = \"errorMessage_e1t59sk9\";\nexport const rewriteCanonicalURLFormWrapper = \"rewriteCanonicalURLFormWrapper_r1lchvq2\";\nexport const urlInputWrapper = \"urlInputWrapper_uw5ushi\";\nexport const fullWidth = \"fullWidth_fspqxga\";\nexport const description = \"description_d4z3k3i\";\nexport const radioButton = \"radioButton_r1v59h0l\";\nexport const form = \"form_f14z9e9\";\nexport const formContent = \"formContent_fjp8pgy\";\nexport const upgradeBadge = \"upgradeBadge_u15ena68\";", "import type React from \"react\"\nimport { useCallback, useRef, useState } from \"react\"\n\nimport { ApiError, HostnameVariant, ProjectLicensePeriod, ProjectLicenseType } from \"@framerjs/app-shared\"\nimport {\n\tButton,\n\tCenterChild,\n\tIconInputDropdown,\n\tInputWrapper,\n\tInputWrapperError,\n\tLink,\n\tNewBadge,\n\tRadioButton,\n\tSpinner,\n\tStack,\n\tT,\n\tTextInput,\n\tUpgradeBadge,\n} from \"@framerjs/fresco\"\nimport { breakpoints } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\n\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { DomainHostnameErrorType, Option, validateDomainName } from \"document/utils/domainValidation.ts\"\n\nimport { takenDomainArticleURL } from \"utils/staticURLs.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\n\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\n\nimport { showCustomDomainUpsellModal } from \"../../../../shared/UpsellModal/utils/customDomainUpsellModal.ts\"\nimport { showDomainToBuyUpsellModal } from \"../../../../shared/UpsellModal/utils/domainToBuyUpsellModal.ts\"\n\nimport * as settingsStyles from \"../../../SiteSettings.styles.ts\"\nimport { DomainCheckmarkIcon } from \"../../DomainCheckmarkIcon.tsx\"\nimport * as styles from \"../../Domains.styles.ts\"\nimport { RedeemDomainVoucherStatus, redeemDomainVoucher } from \"./redeemDomainVoucher.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\thasDefaultHostname: boolean\n\tfreeDomains: string[]\n}\n\nenum ErrorReasons {\n\t/**\n\t * Means another project is already using the custom domain.\n\t */\n\tCustomDomainAlreadyExists = \"custom_domain_already_exists\",\n\n\t/**\n\t * Means the project already has a custom domain. We currently only allow one custom domain per\n\t * project (excluding the redirect domain).\n\t */\n\tCustomDomainLimitExceeded = \"custom_domain_limit_exceeded\",\n\n\t/**\n\t * Means the free subdomain is blocked (i.e. reserved) by us.\n\t */\n\tFreeSubdomainNotAvailable = \"free_subdomain_not_available\",\n}\n\nfunction normalizeDomainHostname(value: string): string {\n\treturn value\n\t\t.trim()\n\t\t.replace(/^https?:\\/\\//u, \"\")\n\t\t.replace(/\\/$/u, \"\")\n}\n\nconst page = Pages.siteSettingsCustomDomain\n\nexport function AddCustomDomain({ isViewOnly, hasDefaultHostname, freeDomains }: Props) {\n\tconst projectId = engine.stores.projectStore.useState(state => state.project?.id)\n\tconst domainVoucher = engine.stores.projectStore.useState(state => state.project?.license.domainVoucher)\n\tconst licenseType = engine.stores.projectStore.useState(state => state.project?.license.type)\n\tconst licensePeriod = engine.stores.projectStore.useState(state => state.project?.license.period)\n\tconst freeDomainsEnabled = useExperimentIsOn(\"freeDomains\")\n\tconst showDomainToBuyOption =\n\t\tfreeDomainsEnabled &&\n\t\tlicenseType !== ProjectLicenseType.EnterpriseSite &&\n\t\t((!domainVoucher && (licenseType === ProjectLicenseType.FreeSite || licensePeriod !== ProjectLicensePeriod.Year)) ||\n\t\t\t(domainVoucher && !domainVoucher.redeemed))\n\t// User is eligible if they have a voucher that hasn't been redeemed\n\tconst isEligibleForDomainToBuy = Boolean(domainVoucher && !domainVoucher.redeemed)\n\n\tconst [option, setOption] = useState<Option>(\n\t\tshowDomainToBuyOption && isEligibleForDomainToBuy ? Option.DomainToBuy : Option.FreeDomain,\n\t)\n\tconst hasSwitchedOption = useRef(false)\n\n\tconst [freeDomainHostname, setFreeDomainHostname] = useState(\"\")\n\tconst [freeDomain, setFreeDomain] = useState(freeDomains[0])\n\tconst [isFreeDomainSelectorOpen, setIsFreeDomainSelectorOpen] = useState(false)\n\n\tconst [domainToBuyHostname, setDomainToBuyHostname] = useState(\"\")\n\n\tconst [ownDomainHostname, setOwnDomainHostname] = useState(\"\")\n\n\tconst [isValidating, setIsValidating] = useState<Option | false>(false)\n\tconst [error, setError] = useState<Partial<Record<Option, JSX.Element | string>> | undefined>()\n\n\tconst formEnabled = hasDefaultHostname && !isViewOnly\n\tconst formElementsEnabled = formEnabled && !isValidating\n\n\tconst upsellDomainToBuy = formEnabled && !isEligibleForDomainToBuy\n\n\tconst canPublishToCustomDomainIsUpsell = engine.stores.projectStore.useState(\n\t\tstate => state.project?.settings.featureFlags.canPublishToCustomDomain === \"upsell\",\n\t)\n\tconst upsellCustomDomain = formEnabled && canPublishToCustomDomainIsUpsell\n\n\tconst isSmallScreen = useMediaQuery(`(max-width: ${breakpoints.tabletBig}px)`)\n\n\tconst onUpsellCustomDomain = useCallback(() => showCustomDomainUpsellModal(engine, \"settings\"), [])\n\tconst onUpsellDomainToBuy = useCallback(() => showDomainToBuyUpsellModal(engine, \"settings\"), [])\n\n\tconst resetForm = useCallback(() => {\n\t\tsetFreeDomain(freeDomains[0])\n\t\tsetFreeDomainHostname(\"\")\n\t\tsetDomainToBuyHostname(\"\")\n\t\tsetOwnDomainHostname(\"\")\n\t}, [freeDomains])\n\n\tconst handleSelectFreeDomainOption = useCallback(() => {\n\t\tif (isValidating) return\n\t\tsetError(undefined)\n\t\tsetOption(Option.FreeDomain)\n\t\thasSwitchedOption.current = true\n\t\tresetForm()\n\t}, [isValidating, resetForm])\n\n\tconst handleSelectDomainToBuyOption = useCallback(() => {\n\t\tif (upsellDomainToBuy) {\n\t\t\tonUpsellDomainToBuy()\n\t\t\treturn\n\t\t}\n\t\tif (isValidating) return\n\t\tsetError(undefined)\n\t\tsetOption(Option.DomainToBuy)\n\t\thasSwitchedOption.current = true\n\t\tresetForm()\n\t}, [isValidating, resetForm, upsellDomainToBuy, onUpsellDomainToBuy])\n\n\tconst handleSelectOwnDomainOption = useCallback(async () => {\n\t\tif (upsellCustomDomain) {\n\t\t\tonUpsellCustomDomain()\n\t\t\treturn\n\t\t}\n\t\tif (isValidating) return\n\t\tsetError(undefined)\n\t\tsetOption(Option.OwnDomain)\n\t\thasSwitchedOption.current = true\n\t\tresetForm()\n\t}, [isValidating, resetForm, upsellCustomDomain, onUpsellCustomDomain])\n\n\tconst handleFreeDomainHostnameChange = useCallback((value: string, final: boolean) => {\n\t\tif (final) {\n\t\t\tvalue = normalizeDomainHostname(value)\n\t\t}\n\t\tsetFreeDomainHostname(value)\n\t\tsetError(undefined)\n\t}, [])\n\n\tconst handleBuyDomainHostnameChange = useCallback((value: string, final: boolean) => {\n\t\tif (final) {\n\t\t\tvalue = normalizeDomainHostname(value)\n\t\t}\n\t\tsetDomainToBuyHostname(value)\n\t\tsetError(undefined)\n\t}, [])\n\n\tconst handleOwnDomainHostnameChange = useCallback((value: string, final: boolean) => {\n\t\tif (final) {\n\t\t\tvalue = normalizeDomainHostname(value)\n\t\t}\n\t\tsetOwnDomainHostname(value)\n\t\tsetError(undefined)\n\t}, [])\n\n\tconst addDomain = useCallback(\n\t\tasync (option: Option, domain: string) => {\n\t\t\ttry {\n\t\t\t\tconst variant = option === Option.FreeDomain ? HostnameVariant.Free : undefined\n\t\t\t\tsetIsValidating(option)\n\t\t\t\tawait engine.stores.publishStore.addCustomDomain(domain, variant)\n\t\t\t\t// Reset the form if the user were to remove the newly added domain again\n\t\t\t\t// without navigating away from this section.\n\t\t\t\tresetForm()\n\t\t\t} catch (error) {\n\t\t\t\tlet errorMessage: JSX.Element | string = \"Please enter a valid domain\"\n\n\t\t\t\tif (error instanceof ApiError && error.status === 409) {\n\t\t\t\t\tconst { reason } = error.data\n\t\t\t\t\tswitch (reason) {\n\t\t\t\t\t\tcase ErrorReasons.CustomDomainLimitExceeded: {\n\t\t\t\t\t\t\terrorMessage = \"Project already has a custom domain\"\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\terrorMessage = (\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\tAlready connected to another project.{\" \"}\n\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\tvariant=\"linkLined\"\n\t\t\t\t\t\t\t\t\t\thref={takenDomainArticleURL}\n\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\tclassName={styles.inlineLink}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\tLearn more\n\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsetError({ [option]: errorMessage })\n\t\t\t} finally {\n\t\t\t\tsetIsValidating(false)\n\t\t\t}\n\t\t},\n\t\t[resetForm],\n\t)\n\n\tconst setDomainError = (validationError: DomainHostnameErrorType, domainOption: Option) => {\n\t\tswitch (validationError) {\n\t\t\tcase DomainHostnameErrorType.Empty:\n\t\t\t\treturn\n\t\t\tcase DomainHostnameErrorType.InvalidPhrase: {\n\t\t\t\treturn setError({ [domainOption]: \"Please enter a different phrase\" })\n\t\t\t}\n\t\t\tcase DomainHostnameErrorType.InvalidCharacter: {\n\t\t\t\tconst domainErrors = {\n\t\t\t\t\t[Option.FreeDomain]: \"Only lower case characters and digits allowed\",\n\t\t\t\t\t[Option.DomainToBuy]: \"Please enter a valid domain\",\n\t\t\t\t\t[Option.OwnDomain]: \"Please enter a valid domain\",\n\t\t\t\t}\n\t\t\t\treturn setError({ [domainOption]: domainErrors[domainOption] })\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(validationError)\n\t\t}\n\t}\n\n\tconst handleSubmitFreeDomain = useCallback(\n\t\tasync (event: React.FormEvent) => {\n\t\t\tevent.preventDefault()\n\n\t\t\t// Form should not be able to be submitted if the option is not selected.\n\t\t\tif (option !== Option.FreeDomain) return\n\n\t\t\tconst input = normalizeDomainHostname(freeDomainHostname)\n\t\t\tconst validationError = validateDomainName(input, true)\n\n\t\t\tif (validationError === null) {\n\t\t\t\tawait addDomain(option, `${input}.${freeDomain}`)\n\t\t\t} else {\n\t\t\t\tsetDomainError(validationError, Option.FreeDomain)\n\t\t\t}\n\t\t},\n\t\t[option, freeDomainHostname, freeDomain, addDomain],\n\t)\n\n\tconst handleSubmitDomainToBuy = useCallback(\n\t\t(event: React.FormEvent) => {\n\t\t\tevent.preventDefault()\n\n\t\t\tif (option !== Option.DomainToBuy) return\n\n\t\t\tconst input = normalizeDomainHostname(domainToBuyHostname)\n\t\t\tconst validationError = validateDomainName(input, false)\n\t\t\tif (validationError === null) {\n\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.openBuyDomain })\n\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\ttitle: \"Claim a Domain\",\n\t\t\t\t\thasBackdrop: true,\n\t\t\t\t\tdescription: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<T>You\u2019ll be redirected to </T>\n\t\t\t\t\t\t\t<Link href=\"https://www.hover.com/\" target=\"_blank\">\n\t\t\t\t\t\t\t\tHover\n\t\t\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t\tto get your discounted domain. Once you claim a domain, you forfeit any rights to a refund on your\n\t\t\t\t\t\t\t\tsubscription payment.\n\t\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\tconfirmLabel: \"Continue\",\n\t\t\t\t\tcancelLabel: \"Cancel\",\n\t\t\t\t\tsource: \"settings\",\n\t\t\t\t\tonConfirm: async () => {\n\t\t\t\t\t\tif (!projectId || !domainVoucher) return\n\n\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.confirmBuyDomain })\n\n\t\t\t\t\t\tconst response = await redeemDomainVoucher(projectId, domainVoucher.id)\n\n\t\t\t\t\t\tswitch (response.status) {\n\t\t\t\t\t\t\tcase RedeemDomainVoucherStatus.Success: {\n\t\t\t\t\t\t\t\tconst successUrl = new URL(window.location.href)\n\t\t\t\t\t\t\t\tsuccessUrl.searchParams.set(\"domain\", input)\n\n\t\t\t\t\t\t\t\tconst redemptionUrl = new URL(response.redemptionURL)\n\t\t\t\t\t\t\t\tredemptionUrl.searchParams.set(\"success\", successUrl.toString())\n\t\t\t\t\t\t\t\tredemptionUrl.searchParams.set(\"q\", input)\n\n\t\t\t\t\t\t\t\twindow.location.href = redemptionUrl.toString()\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase RedeemDomainVoucherStatus.UnhandledError:\n\t\t\t\t\t\t\t\ttoast({\n\t\t\t\t\t\t\t\t\ttype: \"add\",\n\t\t\t\t\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\t\t\t\t\tprimaryText: \"Something went wrong.\",\n\t\t\t\t\t\t\t\t\tsecondaryText: \"Please retry.\",\n\t\t\t\t\t\t\t\t\ticon: \"error\",\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tassertNever(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tsetDomainError(validationError, Option.DomainToBuy)\n\t\t\t}\n\t\t},\n\t\t[domainToBuyHostname, option, projectId, domainVoucher],\n\t)\n\n\tconst handleSubmitOwnDomain = useCallback(\n\t\tasync (event: React.FormEvent) => {\n\t\t\tevent.preventDefault()\n\n\t\t\t// Form should not be able to be submitted if the option is not selected.\n\t\t\tif (option !== Option.OwnDomain) return\n\n\t\t\tconst input = normalizeDomainHostname(ownDomainHostname)\n\n\t\t\tconst validationError = validateDomainName(input, false)\n\n\t\t\tif (validationError === null) {\n\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.confirmAddDomain })\n\n\t\t\t\tawait addDomain(option, input)\n\t\t\t} else {\n\t\t\t\tsetDomainError(validationError, Option.OwnDomain)\n\t\t\t}\n\t\t},\n\t\t[ownDomainHostname, option, addDomain],\n\t)\n\n\tconst displayFreeDomainOptions = useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tif (!hasDefaultHostname || isViewOnly || option !== Option.FreeDomain || isValidating === Option.FreeDomain) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\t\t\tsetIsFreeDomainSelectorOpen(true)\n\n\t\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\n\t\t\tconst items: MenuItemOptions[] = freeDomains.map(domain => {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: `.${domain}`,\n\t\t\t\t\tchecked: domain === freeDomain,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tsetFreeDomain(domain)\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tengine.stores.contextMenuStore.show(items, {\n\t\t\t\tlocation: { x: bounds.right, y: bounds.bottom + 5 },\n\t\t\t\tplacement: \"bottom-end\",\n\t\t\t})\n\n\t\t\tsetIsFreeDomainSelectorOpen(false)\n\t\t},\n\t\t[hasDefaultHostname, isViewOnly, option, isValidating, freeDomains, freeDomain],\n\t)\n\n\treturn (\n\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t<Stack gap={20} direction={isSmallScreen ? \"column\" : \"row\"} justifyContent=\"space-between\">\n\t\t\t\t<RadioButton\n\t\t\t\t\tidentifier=\"free-domain\"\n\t\t\t\t\ttitle=\"Get a free Framer subdomain\"\n\t\t\t\t\tdescription=\"Instantly connect a customized domain for free\"\n\t\t\t\t\tclassName={styles.customDomainRadioButton}\n\t\t\t\t\tenabled={formEnabled}\n\t\t\t\t\tselected={option === Option.FreeDomain}\n\t\t\t\t\tonSelect={handleSelectFreeDomainOption}\n\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t/>\n\t\t\t\t{option === Option.FreeDomain && (\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={handleSubmitFreeDomain}\n\t\t\t\t\t\taria-label=\"Add free Framer subdomain\"\n\t\t\t\t\t\tclassName={styles.customDomainForm}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className={styles.customDomainInputWrapper}>\n\t\t\t\t\t\t\t<div className={styles.customDomainInputRow}>\n\t\t\t\t\t\t\t\t<InputWrapper large hasError={!!error?.[Option.FreeDomain]}>\n\t\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t\taria-label=\"Free subdomain name\"\n\t\t\t\t\t\t\t\t\t\taria-describedby={error?.[Option.FreeDomain] ? \"free-domain-error\" : undefined}\n\t\t\t\t\t\t\t\t\t\tplaceholder=\"mywebsite\"\n\t\t\t\t\t\t\t\t\t\tvalue={freeDomainHostname}\n\t\t\t\t\t\t\t\t\t\tonChange={handleFreeDomainHostnameChange}\n\t\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled}\n\t\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\t\tautoFocus={hasSwitchedOption.current}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\t\t\t\tgap={8}\n\t\t\t\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.freeDomainsSelector, formElementsEnabled && styles.freeDomainsSelectorEnabled)}\n\t\t\t\t\t\t\t\t\t\tonMouseDown={displayFreeDomainOptions}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span className={styles.freeDomainsSelectorLabel}>.{freeDomain}</span>\n\t\t\t\t\t\t\t\t\t\t<div className={cx(isFreeDomainSelectorOpen && styles.freeDomainsSelectorOpenedIcon)}>\n\t\t\t\t\t\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled && freeDomainHostname !== \"\"}\n\t\t\t\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\t\t\t\taria-label=\"Submit free domain\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t\t\t\t{isValidating === Option.FreeDomain ? <Spinner inline /> : <DomainCheckmarkIcon />}\n\t\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<InputWrapperError\n\t\t\t\t\t\t\t\tid=\"free-domain-error\"\n\t\t\t\t\t\t\t\trole=\"alert\"\n\t\t\t\t\t\t\t\tvisible={!!error?.[Option.FreeDomain]}\n\t\t\t\t\t\t\t\tclassName={styles.customDomainInputError}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{error?.[Option.FreeDomain]}\n\t\t\t\t\t\t\t</InputWrapperError>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t)}\n\t\t\t</Stack>\n\n\t\t\t{showDomainToBuyOption && (\n\t\t\t\t<Stack gap={20} direction={isSmallScreen ? \"column\" : \"row\"} justifyContent=\"space-between\">\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tidentifier=\"buy-domain\"\n\t\t\t\t\t\ttitle=\"Claim a free custom domain\"\n\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\tupsellDomainToBuy\n\t\t\t\t\t\t\t\t? \"Get a free domain for a year when you upgrade to a yearly plan\"\n\t\t\t\t\t\t\t\t: \"Get the first year for free for selected domains\"\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclassName={styles.customDomainRadioButton}\n\t\t\t\t\t\tenabled={formEnabled}\n\t\t\t\t\t\tselected={option === Option.DomainToBuy}\n\t\t\t\t\t\tonSelect={handleSelectDomainToBuyOption}\n\t\t\t\t\t\tbadge={upsellDomainToBuy ? <UpgradeBadge onClick={onUpsellDomainToBuy} /> : <NewBadge />}\n\t\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t\t/>\n\t\t\t\t\t{option === Option.DomainToBuy && (\n\t\t\t\t\t\t<form\n\t\t\t\t\t\t\tonSubmit={handleSubmitDomainToBuy}\n\t\t\t\t\t\t\taria-label=\"Buy a new domain. First year free\"\n\t\t\t\t\t\t\tclassName={styles.customDomainForm}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className={styles.customDomainInputWrapper}>\n\t\t\t\t\t\t\t\t<div className={styles.customDomainInputRow}>\n\t\t\t\t\t\t\t\t\t<InputWrapper large hasError={!!error?.[Option.DomainToBuy]}>\n\t\t\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t\t\taria-label=\"Domain to buy\"\n\t\t\t\t\t\t\t\t\t\t\taria-describedby={error?.[Option.DomainToBuy] ? \"domain-to-buy-error\" : undefined}\n\t\t\t\t\t\t\t\t\t\t\tplaceholder=\"mywebsite.com\"\n\t\t\t\t\t\t\t\t\t\t\tvalue={domainToBuyHostname}\n\t\t\t\t\t\t\t\t\t\t\tonChange={handleBuyDomainHostnameChange}\n\t\t\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled}\n\t\t\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\t\t\tautoFocus={hasSwitchedOption.current}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled && domainToBuyHostname !== \"\"}\n\t\t\t\t\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\t\t\t\t\taria-label=\"Submit domain to buy\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t\t\t\t\t<DomainCheckmarkIcon />\n\t\t\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<InputWrapperError\n\t\t\t\t\t\t\t\t\tid=\"domain-to-buy-error\"\n\t\t\t\t\t\t\t\t\trole=\"alert\"\n\t\t\t\t\t\t\t\t\tvisible={!!error?.[Option.DomainToBuy]}\n\t\t\t\t\t\t\t\t\tclassName={styles.customDomainInputError}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{error?.[Option.DomainToBuy]}\n\t\t\t\t\t\t\t\t</InputWrapperError>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t)}\n\n\t\t\t<Stack gap={20} direction={isSmallScreen ? \"column\" : \"row\"} justifyContent=\"space-between\">\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" justifyContent=\"flex-start\">\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tidentifier=\"own-domain\"\n\t\t\t\t\t\ttitle=\"Connect an existing domain\"\n\t\t\t\t\t\tdescription=\"Connect a domain purchased through a web hosting service\"\n\t\t\t\t\t\tclassName={styles.customDomainRadioButton}\n\t\t\t\t\t\tenabled={formEnabled}\n\t\t\t\t\t\tselected={option === Option.OwnDomain}\n\t\t\t\t\t\tonSelect={handleSelectOwnDomainOption}\n\t\t\t\t\t\tbadge={upsellCustomDomain ? <UpgradeBadge onClick={onUpsellCustomDomain} /> : undefined}\n\t\t\t\t\t\tdescriptionGap={3}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t\t{option === Option.OwnDomain && (\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={handleSubmitOwnDomain}\n\t\t\t\t\t\taria-label=\"Connect a domain you own\"\n\t\t\t\t\t\tclassName={styles.customDomainForm}\n\t\t\t\t\t>\n\t\t\t\t\t\t<div className={styles.customDomainInputWrapper}>\n\t\t\t\t\t\t\t<div className={styles.customDomainInputRow}>\n\t\t\t\t\t\t\t\t<InputWrapper large hasError={!!error?.[Option.OwnDomain]}>\n\t\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t\taria-label=\"Your own domain\"\n\t\t\t\t\t\t\t\t\t\taria-describedby={error?.[Option.OwnDomain] ? \"own-domain-error\" : undefined}\n\t\t\t\t\t\t\t\t\t\tplaceholder=\"www.site.com\"\n\t\t\t\t\t\t\t\t\t\tvalue={ownDomainHostname}\n\t\t\t\t\t\t\t\t\t\tonChange={handleOwnDomainHostnameChange}\n\t\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled}\n\t\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\t\tautoFocus={hasSwitchedOption.current}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\tenabled={formElementsEnabled && ownDomainHostname !== \"\"}\n\t\t\t\t\t\t\t\t\tclassName={styles.iconButton}\n\t\t\t\t\t\t\t\t\taria-label=\"Submit domain\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t\t\t\t\t{isValidating === Option.OwnDomain ? <Spinner inline /> : <DomainCheckmarkIcon />}\n\t\t\t\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<InputWrapperError\n\t\t\t\t\t\t\t\tid=\"own-domain-error\"\n\t\t\t\t\t\t\t\trole=\"alert\"\n\t\t\t\t\t\t\t\tvisible={!!error?.[Option.OwnDomain]}\n\t\t\t\t\t\t\t\tclassName={styles.customDomainInputError}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{error?.[Option.OwnDomain]}\n\t\t\t\t\t\t\t</InputWrapperError>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</form>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\n\nexport const showCustomDomainUpsellModal = (engine: VekterEngine, source: ModalOpenSource) => {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tupsellFeature: UpsellFeature.canPublishToCustomDomain,\n\t\ttitle: \"Custom Domain\",\n\t\tdescription:\n\t\t\t\"Purchase a plan to connect a custom domain to your site, increase its limits, and gain access to powerful features.\",\n\t\tsource,\n\t})\n}\n", "import type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\n\nexport const showDomainToBuyUpsellModal = (engine: VekterEngine, source: ModalOpenSource) => {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tupsellFeature: UpsellFeature.domainToBuyUpsell,\n\t\ttitle: \"Claim a Domain\",\n\t\tdescription:\n\t\t\t\"Buy a yearly plan to claim a discounted domain for your site, increase its limits, and gain access to powerful features.\",\n\t\tsource,\n\t})\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\n\nconst log = getLogger(\"redeemDomainVoucher\")\n\nexport enum RedeemDomainVoucherStatus {\n\tSuccess,\n\tUnhandledError,\n}\n\ninterface RedeemDomainVoucherApiResponse {\n\tredemptionURL: string\n}\n\ntype RedeemDomainVoucherResponse =\n\t| { status: RedeemDomainVoucherStatus.Success; redemptionURL: string }\n\t| { status: RedeemDomainVoucherStatus.UnhandledError }\n\nexport async function redeemDomainVoucher(projectId: string, voucherId: string): Promise<RedeemDomainVoucherResponse> {\n\ttry {\n\t\tconst response: RedeemDomainVoucherApiResponse = await apiFetcher.get(\n\t\t\t`/web/projects/${projectId}/domain-vouchers/${voucherId}`,\n\t\t)\n\t\treturn { status: RedeemDomainVoucherStatus.Success, redemptionURL: response.redemptionURL }\n\t} catch (error) {\n\t\tlog.reportError(error)\n\t\treturn { status: RedeemDomainVoucherStatus.UnhandledError }\n\t}\n}\n", "import type { CustomHostname, DefaultHostname, Deployment } from \"@framerjs/app-shared\"\nimport { HostnameStatus, domainsDashboardPath, openNewTab } from \"@framerjs/app-shared\"\nimport {\n\tButton,\n\tContextMenuButton,\n\tLink,\n\tSpinner,\n\tStack,\n\tTranslatable as T,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { getActiveWebPageURL } from \"document/components/utils/getActiveWebPageURL.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport type {\n\tDomainConnectDiscoveryResult,\n\tGetDeploymentIssuesResponse,\n\tValidatedCustomHostname,\n} from \"document/stores/PublishStore.ts\"\nimport React from \"react\"\nimport { dnsRecordsArticleURL, newIpAddressesArticleURL } from \"utils/staticURLs.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { ConfirmRemoveCustomDomainModal } from \"../../../ConfirmRemoveCustomDomainModal.tsx\"\nimport { OptimizationIssuesLog } from \"../../../OptimizationIssuesLog/index.tsx\"\nimport * as settingsStyles from \"../../../SiteSettings.styles.ts\"\nimport { StatusIndicator } from \"../../../StatusIndicator.tsx\"\nimport * as styles from \"../../Domains.styles.ts\"\nimport { VersionMetadata } from \"../../VersionMetadata.tsx\"\nimport { labelForStatus } from \"../../labelForStatus.tsx\"\nimport {\n\ttoastDomainConnected,\n\ttoastDomainStatusConnected,\n\ttoastDomainStatusError,\n\ttoastDomainStatusInvalid,\n\ttoastValidateDomainError,\n} from \"../customDomainToasts.ts\"\nimport { ConflictsTable } from \"./ConflictsTable.tsx\"\nimport { DNSTable } from \"./DNSTable.tsx\"\n\ninterface Props {\n\tisViewOnly: boolean\n\tdefaultHostname?: DefaultHostname\n\tcustomHostname: CustomHostname\n\tcustomHostnameDeployment?: Deployment\n\tcustomHostnameDeploymentIssues: GetDeploymentIssuesResponse | undefined\n\tonVersionClick: () => void\n\tpublishStatus: PublishStatus\n\tcustomHostnameValidationResult: ValidatedCustomHostname[]\n}\n\nconst log = getLogger(\"app:site-settings\")\nexport function CustomDomainDetails({\n\tisViewOnly,\n\tdefaultHostname,\n\tcustomHostname,\n\tcustomHostnameDeployment,\n\tcustomHostnameDeploymentIssues,\n\tonVersionClick,\n\tpublishStatus,\n\tcustomHostnameValidationResult,\n}: Props) {\n\tconst [isRemoveModalOpen, setIsRemoveModalOpen] = React.useState(false)\n\t// Refreshing DNS and Status does the same thing under the hood,\n\t// re-validates the DNS, but the conditions surrounding the two are slightly\n\t// different:\n\t//\n\t// - \"Refreshing DNS\" is triggered via the refresh button next to the \"your\n\t//   DNS records must be set up like this: <DNS table>\" status, and is meant\n\t//   mostly for the initial DNS setup. The refresh button will be spinning\n\t//   while re-validation is in progress. If re-validation is successful, the\n\t//   toast will also warn that it might take up to 48h for the DNS to fully\n\t//   propagate, and require an explicit dismissal to make sure the user has\n\t//   seen/acknowledged that.\n\t//\n\t// - \"Refreshing status\" is triggered via a context menu, and is meant for\n\t//   re-validating a domain that's already been connected successfully. The\n\t//   spinner will show up in the Status section. The toasts are also\n\t//   slightly different.\n\tconst [isRefreshingDNS, setIsRefreshingDNS] = React.useState(false)\n\tconst [isRefreshingStatus, setIsRefreshingStatus] = React.useState(false)\n\tconst hasDeprecatedAddresses = customHostnameValidationResult.some(hostname => hostname.hasDeprecatedAddresses)\n\n\tconst { publishStore } = engine.stores\n\n\tconst handleRefreshDNS = React.useCallback(async () => {\n\t\ttry {\n\t\t\tsetIsRefreshingDNS(true)\n\t\t\tawait publishStore.validateCustomDomain()\n\n\t\t\t// We don't want to show the toast when user has deprecated addresses\n\t\t\t// because we already suggest a different action to the user,\n\t\t\t// which is to change its DNS settings\n\t\t\tif (publishStore.customHostnameValidationResult.some(hostname => hostname.hasDeprecatedAddresses)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (publishStore.customHostname?.status === HostnameStatus.Active) {\n\t\t\t\ttoastDomainConnected()\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlog.error(\"Failed to validate domain\", error)\n\t\t\ttoastValidateDomainError()\n\t\t} finally {\n\t\t\tsetIsRefreshingDNS(false)\n\t\t}\n\t}, [publishStore])\n\n\tconst handleRefreshStatus = React.useCallback(async () => {\n\t\ttry {\n\t\t\tsetIsRefreshingStatus(true)\n\t\t\tawait publishStore.validateCustomDomain()\n\t\t\tif (publishStore.customHostname?.status === HostnameStatus.Active) {\n\t\t\t\ttoastDomainStatusConnected()\n\t\t\t} else {\n\t\t\t\ttoastDomainStatusInvalid()\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlog.error(\"Failed to validate domain\", error)\n\t\t\ttoastDomainStatusError()\n\t\t} finally {\n\t\t\tsetIsRefreshingStatus(false)\n\t\t}\n\t}, [publishStore])\n\n\tReact.useEffect(() => {\n\t\t// Also re-validate on mount. This won't trigger any toasts or spinners.\n\t\tvoid publishStore.validateCustomDomain()\n\t}, [publishStore])\n\n\tconst showInvalidDNSStatus = customHostname.status === HostnameStatus.InvalidDNS\n\n\t// Show the DNS table if there is deprecated addresses or if any of the hostnames are invalid.\n\tconst showDNSTable =\n\t\thasDeprecatedAddresses ||\n\t\tcustomHostnameValidationResult.some(hostname => hostname.status === HostnameStatus.InvalidDNS)\n\n\tconst showDNSStatus = showInvalidDNSStatus || showDNSTable\n\n\tconst domainConnect =\n\t\tcustomHostnameValidationResult.find(hostname => hostname.domainConnect)?.domainConnect ?? undefined\n\tconst onDemandSSGEnabled = useExperimentIsOn(\"onDemandSSG\")\n\n\tconst statusIndicator = React.useMemo(() => {\n\t\tif (publishStatus === PublishStatus.Unpublished || !defaultHostname) {\n\t\t\treturn null\n\t\t}\n\n\t\tif (customHostname.status === HostnameStatus.InvalidDNS) {\n\t\t\treturn <StatusIndicator status={customHostname.status} />\n\t\t}\n\n\t\tif (customHostnameDeployment) {\n\t\t\treturn (\n\t\t\t\t<StatusIndicator status={customHostnameDeployment.status} hasWarnings={customHostnameDeployment.hasWarnings} />\n\t\t\t)\n\t\t}\n\n\t\treturn null\n\t}, [defaultHostname, customHostname, customHostnameDeployment, publishStatus])\n\n\tconst statusLabel = labelForStatus(\n\t\tcustomHostnameDeployment?.status,\n\t\tcustomHostnameDeployment?.hasWarnings,\n\t\tonDemandSSGEnabled,\n\t)\n\n\tconst showOptimizationIssuesLog =\n\t\t!isRefreshingStatus &&\n\t\t!(hasDeprecatedAddresses && customHostname.status === HostnameStatus.Active) &&\n\t\tcustomHostname.status !== HostnameStatus.InvalidDNS\n\n\tconst displayCustomDomainURLContextMenu = React.useCallback(\n\t\t(event: React.MouseEvent<HTMLElement>) => {\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\tconst page = Pages.siteSettingsCustomDomainLinkContextMenu\n\t\t\trecord(\"ui_impression\", { page })\n\n\t\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\n\t\t\tconst projectId = engine.stores.projectStore.projectId\n\n\t\t\tconst items: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Remove Domain\",\n\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.removeDomain })\n\t\t\t\t\t\tsetIsRemoveModalOpen(true)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t]\n\n\t\t\t// Only show this option if domain is active/connected. Otherwise,\n\t\t\t// we're gonna be showing the Invalid DNS status, which comes with\n\t\t\t// its own refresh button.\n\t\t\tif (!publishStore.isFreeDomain(customHostname.hostname) && !showInvalidDNSStatus) {\n\t\t\t\titems.push({\n\t\t\t\t\tlabel: \"Refresh Status\",\n\t\t\t\t\tclick: handleRefreshStatus,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\titems.push({\n\t\t\t\tlabel: \"Advanced Hosting\",\n\t\t\t\tclick: () => {\n\t\t\t\t\twindow.open(`${domainsDashboardPath}/${projectId}`, \"_self\")\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tengine.stores.contextMenuStore.show(items, {\n\t\t\t\tlocation: { x: bounds.right, y: bounds.bottom },\n\t\t\t\tplacement: \"bottom-end\",\n\t\t\t})\n\t\t},\n\t\t[isViewOnly, customHostname, showInvalidDNSStatus, handleRefreshStatus, publishStore],\n\t)\n\n\tconst customHostnameDisplayUrl = `https://${customHostname.hostname}`\n\tconst customHostnameFullUrl = getActiveWebPageURL(engine.componentLoader, engine.stores, customHostname.hostname)\n\n\treturn (\n\t\t<>\n\t\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t\t<Stack gap={styles.customDomainUrlToStatusGap}>\n\t\t\t\t\t<Stack gap={5}>\n\t\t\t\t\t\t<Stack className={styles.domainProperty} gap={styles.domainPropertyStackGap} direction=\"row\">\n\t\t\t\t\t\t\t<T className={styles.domainPropertyTitle}>URL</T>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\tclassName={cx(styles.domainLink, styles.link, truncateWithEllipsis)}\n\t\t\t\t\t\t\t\ttitle={customHostnameDisplayUrl}\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\t\t\tpage: Pages.siteSettingsDomains,\n\t\t\t\t\t\t\t\t\t\tid: UIInteraction.openCustomLink,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\topenNewTab(customHostnameFullUrl)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{customHostnameDisplayUrl}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t<ContextMenuButton className={styles.domainStatusActions} onClick={displayCustomDomainURLContextMenu} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<div className={cx(styles.domainPropertyDescription, styles.domainPropertyOffsetDescription)}>\n\t\t\t\t\t\t\tConnect a new custom domain by removing the above\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t<Stack direction=\"row\" className={styles.domainProperty}>\n\t\t\t\t\t\t\t<T className={styles.domainPropertyTitle}>Status</T>\n\t\t\t\t\t\t\t{isRefreshingStatus ? <Spinner inline /> : statusIndicator}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t{showOptimizationIssuesLog && !isRefreshingStatus && statusLabel && (\n\t\t\t\t\t\t\t<div className={cx(styles.domainPropertyOffsetDescription, styles.domainPropertyContent)}>\n\t\t\t\t\t\t\t\t{statusLabel}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{showOptimizationIssuesLog && customHostnameDeployment && (\n\t\t\t\t\t\t\t<div className={styles.domainPropertyOffsetDescription}>\n\t\t\t\t\t\t\t\t<OptimizationIssuesLog\n\t\t\t\t\t\t\t\t\tdeployment={customHostnameDeployment}\n\t\t\t\t\t\t\t\t\tdeploymentIssues={customHostnameDeploymentIssues}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\n\t\t\t\t{showDNSStatus && (\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tclassName={cx(styles.domainProperty, domainConnect && styles.domainPropertyTopAligned)}\n\t\t\t\t\t\t\tgap={styles.domainPropertyStackGap}\n\t\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T className={styles.domainPropertyTitle}>DNS Status</T>\n\t\t\t\t\t\t\t<div className={styles.domainPropertyContent}>\n\t\t\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t\t\t{domainConnect\n\t\t\t\t\t\t\t\t\t\t? \"Set up your DNS records with the following values, or use Auto Connect to connect them automatically.\"\n\t\t\t\t\t\t\t\t\t\t: \"Set up your DNS records with the following values.\"}\n\t\t\t\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\tvariant=\"linkLined\"\n\t\t\t\t\t\t\t\t\thref={hasDeprecatedAddresses ? newIpAddressesArticleURL : dnsRecordsArticleURL}\n\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\tclassName={styles.inlineLink}\n\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\t\t\t\tpage: Pages.siteSettingsDomains,\n\t\t\t\t\t\t\t\t\t\t\tid: UIInteraction.setUpDNSRecords,\n\t\t\t\t\t\t\t\t\t\t})\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\t\t<T>Learn more</T>\n\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<RefreshDNSButton\n\t\t\t\t\t\t\t\tisRefreshing={isRefreshingDNS}\n\t\t\t\t\t\t\t\tisRefreshEnabled={!isViewOnly && !isRefreshingDNS && !isRefreshingStatus}\n\t\t\t\t\t\t\t\tonRefresh={handleRefreshDNS}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{domainConnect && <DomainConnect domainConnect={domainConnect} onWindowClose={handleRefreshDNS} />}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t{showDNSTable && (\n\t\t\t\t\t\t\t<Stack gap={20} className={cx(styles.domainPropertyContent, styles.domainPropertyContentDNSTable)}>\n\t\t\t\t\t\t\t\t<DNSTable hostnames={customHostnameValidationResult} />\n\t\t\t\t\t\t\t\t<div className={cx(styles.domainPropertyDescription, styles.domainPropertyDnsDescription)}>\n\t\t\t\t\t\t\t\t\tBoth A records are required, the CNAME record is required for subdomains. DNS changes can take a few\n\t\t\t\t\t\t\t\t\thours to take effect.\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{/* The separator wasn't appearing here without a div around it. */}\n\t\t\t\t\t\t\t\t<div style={{ width: \"auto\" }}>\n\t\t\t\t\t\t\t\t\t<Separator height={1} />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<ConflictsTable hostnames={customHostnameValidationResult} />\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t)}\n\t\t\t\t<Stack direction=\"row\" className={styles.domainProperty}>\n\t\t\t\t\t<T className={styles.domainPropertyTitle}>Version</T>\n\t\t\t\t\t<div className={styles.domainPropertyContent}>\n\t\t\t\t\t\t{customHostname.status === HostnameStatus.Active &&\n\t\t\t\t\t\tcustomHostnameDeployment &&\n\t\t\t\t\t\tpublishStatus !== PublishStatus.Unpublished ? (\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<Button variant=\"link\" className={styles.link} onClick={onVersionClick}>\n\t\t\t\t\t\t\t\t\t{customHostname.deploymentId === defaultHostname?.deploymentId ? (\n\t\t\t\t\t\t\t\t\t\t<T>Latest</T>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tcustomHostname.deploymentId\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t{\" \u00B7 \"}\n\t\t\t\t\t\t\t\t<VersionMetadata\n\t\t\t\t\t\t\t\t\ttimestamp={customHostnameDeployment.createdAt}\n\t\t\t\t\t\t\t\t\tdeployedBy={customHostnameDeployment.deployedBy.name}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span className={settingsStyles.placeholder}>Not available</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t{isRemoveModalOpen && (\n\t\t\t\t<ConfirmRemoveCustomDomainModal\n\t\t\t\t\tonConfirm={() => publishStore.removeCustomDomain(customHostname.hostname)}\n\t\t\t\t\tonClose={() => setIsRemoveModalOpen(false)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\nfunction RefreshDNSButton({\n\tisRefreshing,\n\tisRefreshEnabled,\n\tonRefresh,\n}: {\n\tisRefreshing: boolean\n\tisRefreshEnabled: boolean\n\tonRefresh: () => void\n}) {\n\treturn (\n\t\t<Button\n\t\t\tclassName={cx(styles.refreshDNSButton, isRefreshing && styles.refreshDNSButtonLoading)}\n\t\t\tbold\n\t\t\tenabled={isRefreshEnabled}\n\t\t\tonClick={() => {\n\t\t\t\tonRefresh()\n\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\tpage: Pages.siteSettingsCustomDomainStatusContextMenu,\n\t\t\t\t\tid: UIInteraction.refreshDNSRecords,\n\t\t\t\t})\n\t\t\t}}\n\t\t>\n\t\t\tRefresh\n\t\t</Button>\n\t)\n}\n\nfunction DomainConnect({\n\tdomainConnect,\n\tonWindowClose,\n}: {\n\tdomainConnect: DomainConnectDiscoveryResult\n\tonWindowClose: () => void\n}) {\n\tconst onCloseTimerRef = React.useRef<number>()\n\n\tconst onClick = () => {\n\t\tconst domainConnectWindow = window.open(\n\t\t\tdomainConnect.applyURL,\n\t\t\t\"_blank\",\n\t\t\t`width=${domainConnect.width || 750},height=${domainConnect.height || 750}`,\n\t\t)\n\n\t\tif (!domainConnectWindow || domainConnectWindow.closed) {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"info\",\n\t\t\t\tprimaryText: \"Allow pop-ups in your browser\",\n\t\t\t\tsecondaryText: \"to Auto Connect.\",\n\t\t\t\tkey: \"domain-connect-popup-blocked\",\n\t\t\t\ticon: \"notifications\",\n\t\t\t\tduration: Infinity,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// https://stackoverflow.com/questions/15769514/window-onclose-function\n\t\tonCloseTimerRef.current = window.setInterval(() => {\n\t\t\tif (domainConnectWindow.closed) {\n\t\t\t\tclearInterval(onCloseTimerRef.current)\n\t\t\t\tonWindowClose()\n\t\t\t}\n\t\t}, 1000)\n\t}\n\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tclearInterval(onCloseTimerRef.current)\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<Button variant=\"primary\" bold onClick={onClick} className={styles.domainConnectButton}>\n\t\t\tAuto Connect\n\t\t</Button>\n\t)\n}\n", "import { triggerUiImpressionEvent, triggerUiInteractionEvent } from \"@framerjs/framer-events\"\nimport { ConfirmationModal } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { Pages, UIInteraction } from \"web/lib/tracker.ts\"\n\ninterface Props {\n\tonConfirm: () => Promise<void>\n\tonClose: () => void\n}\n\nconst page = Pages.removeCustomDomainModal\n\nexport function ConfirmRemoveCustomDomainModal({ onConfirm, onClose }: Props) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst [isRemoving, setIsRemoving] = useState(false)\n\n\tconst handleRemoveDomain = useCallback(async () => {\n\t\tsetIsRemoving(true)\n\t\ttriggerUiInteractionEvent({ page, id: UIInteraction.confirmRemoveDomain })\n\t\ttry {\n\t\t\tawait onConfirm()\n\t\t\tonClose()\n\t\t} catch (error) {\n\t\t\tsetIsRemoving(false)\n\t\t\tunhandledError(error)\n\t\t}\n\t}, [onConfirm, onClose])\n\n\tuseEffect(() => {\n\t\ttriggerUiImpressionEvent({ page })\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tif (isRemoving) return\n\t\ttriggerUiInteractionEvent({ page, id: UIInteraction.cancelRemoveDomain })\n\t\tonClose()\n\t}, [isRemoving, onClose])\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Remove Domain\"\n\t\t\tvariant=\"destructive\"\n\t\t\tdescription=\"Are you sure you want to remove this domain? Visitors will no longer be able to access your site using this domain.\"\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={handleClose}\n\t\t\tconfirmLabel=\"Remove\"\n\t\t\tconfirmButtonLoading={isRemoving}\n\t\t\tconfirmButtonEnabled={!isRemoving}\n\t\t\tcancelButtonEnabled={!isRemoving}\n\t\t\tonConfirm={handleRemoveDomain}\n\t\t\tonDismiss={handleClose}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { RelativeTime } from \"../RelativeTime.tsx\"\n\ninterface Props {\n\ttimestamp: string\n\tdeployedBy: string\n}\n\nexport function VersionMetadata({ timestamp, deployedBy }: Props) {\n\treturn (\n\t\t<>\n\t\t\t<T>Updated</T> <RelativeTime timestamp={timestamp} /> <T>by</T> {deployedBy}\n\t\t</>\n\t)\n}\n", "import { DeploymentStatus } from \"@framerjs/app-shared\"\nimport { Link, Translatable as T } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type React from \"react\"\nimport {\n\toptimizationIssuesArticleURL,\n\toptimizationSupportArticleURL,\n\tpublishingAcademyLessonURL,\n} from \"utils/staticURLs.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./Domains.styles.ts\"\n\nexport function labelForStatus(\n\tdeploymentStatus: DeploymentStatus | undefined,\n\thasWarnings: boolean | undefined,\n\tonDemandSSGEnabled: boolean,\n): React.ReactNode {\n\tswitch (deploymentStatus) {\n\t\tcase undefined:\n\t\t\treturn (\n\t\t\t\t<span>\n\t\t\t\t\t<T>Press Publish to</T>{\" \"}\n\t\t\t\t\t<Link\n\t\t\t\t\t\tvariant=\"linkLined\"\n\t\t\t\t\t\thref={publishingAcademyLessonURL}\n\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\tpage: Pages.siteSettingsDomains,\n\t\t\t\t\t\t\t\tid: UIInteraction.statusLearnMore,\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\t<T>publish your website</T>\n\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t<T>to a base domain</T>\n\t\t\t\t</span>\n\t\t\t)\n\t\tcase DeploymentStatus.Pending:\n\t\tcase DeploymentStatus.SpaFailed:\n\t\t\tbreak\n\t\tcase DeploymentStatus.SpaReady:\n\t\t\treturn (\n\t\t\t\t<T className={styles.domainStatus}>\n\t\t\t\t\tWebsite is published and being {onDemandSSGEnabled ? \"pre-\" : \"\"}optimized\n\t\t\t\t</T>\n\t\t\t)\n\t\tcase DeploymentStatus.SsgReady:\n\t\tcase DeploymentStatus.SsgReadyWithWarnings:\n\t\t\tif (!hasWarnings) return // we just show the label if all good\n\t\t\treturn <T className={styles.domainStatus}>Fixing warnings is recommended</T>\n\t\tcase DeploymentStatus.SsgPipelineFailed:\n\t\tcase DeploymentStatus.SsgReadyWithErrors:\n\t\t\treturn (\n\t\t\t\t<span className={styles.domainStatus}>\n\t\t\t\t\t<T>Website is published with optimization issues. This will make</T>{\" \"}\n\t\t\t\t\t<Link variant=\"linkLined\" href={optimizationIssuesArticleURL} rel=\"noopener noreferrer\">\n\t\t\t\t\t\tSEO and loading speed\n\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t<T>worse. See</T>{\" \"}\n\t\t\t\t\t<Link\n\t\t\t\t\t\tvariant=\"linkLined\"\n\t\t\t\t\t\thref={optimizationSupportArticleURL}\n\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\tpage: Pages.siteSettingsDomains,\n\t\t\t\t\t\t\t\tid: UIInteraction.statusLearnMore,\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\t<T>tips</T>\n\t\t\t\t\t</Link>{\" \"}\n\t\t\t\t\t<T>on resolving the issues</T>\n\t\t\t\t</span>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(deploymentStatus)\n\t}\n}\n", "import { HostnameStatus } from \"@framerjs/app-shared\"\nimport { Badge, Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { DnsRecordsType, type ValidatedCustomHostname } from \"document/stores/PublishStore.ts\"\nimport { useMemo } from \"react\"\nimport * as domainsStyles from \"../../Domains.styles.ts\"\nimport * as styles from \"./ConflictTable.styles.ts\"\nimport * as dnsTableStyles from \"./DNSTable.styles.ts\"\n\ninterface Props {\n\thostnames: ValidatedCustomHostname[]\n}\n\ninterface DNSConflict {\n\tname: string\n\ttype: DnsRecordsType\n\tvalue: string\n}\n\nfunction hostnamesToConflicts(hostnames: ValidatedCustomHostname[]): DNSConflict[] {\n\tconst addedConflicts = new Set<string>()\n\tconst conflicts: DNSConflict[] = []\n\tfor (const hostname of hostnames) {\n\t\tif (!hostname.hasDeprecatedAddresses && hostname.status !== HostnameStatus.InvalidDNS) continue\n\n\t\tconst { prefix, redirect, conflictRecords, caaConflicts } = hostname\n\n\t\tconst allConflicts: DNSConflict[] = []\n\n\t\tfor (const conflict of caaConflicts) {\n\t\t\tconst name = conflict.isInRoot ? \"@\" : conflict.name\n\t\t\tconst key = `${name}-${DnsRecordsType.CAA}-${conflict.value}`\n\t\t\tif (!addedConflicts.has(key)) {\n\t\t\t\taddedConflicts.add(key)\n\t\t\t\tallConflicts.push({ name, type: DnsRecordsType.CAA, value: conflict.value })\n\t\t\t}\n\t\t}\n\n\t\tfor (const conflict of conflictRecords) {\n\t\t\tconst name = prefix || \"@\"\n\t\t\tconst key = `${name}-${conflict.type}-${conflict.value}`\n\t\t\tif (!addedConflicts.has(key)) {\n\t\t\t\taddedConflicts.add(key)\n\t\t\t\tallConflicts.push({ name, type: conflict.type, value: conflict.value })\n\t\t\t}\n\t\t}\n\n\t\t// Redirect hostnames go at the end.\n\t\tif (redirect) {\n\t\t\tconflicts.push(...allConflicts)\n\t\t} else {\n\t\t\tconflicts.unshift(...allConflicts)\n\t\t}\n\t}\n\treturn conflicts\n}\n\nexport function ConflictsTable({ hostnames }: Props) {\n\tconst conflicts: DNSConflict[] = useMemo(() => hostnamesToConflicts(hostnames), [hostnames])\n\treturn (\n\t\tconflicts.length > 0 && (\n\t\t\t<Stack style={{ width: \"100%\" }} gap={20}>\n\t\t\t\t<div className={dnsTableStyles.tableWrapper}>\n\t\t\t\t\t<table className={dnsTableStyles.table}>\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr className={styles.conflictsHeadingRow}>\n\t\t\t\t\t\t\t\t<th className={styles.tableHeading}>Name</th>\n\t\t\t\t\t\t\t\t<th className={styles.tableHeading}>Type</th>\n\t\t\t\t\t\t\t\t<th className={styles.tableHeading}>Value</th>\n\t\t\t\t\t\t\t\t<th className={styles.tableHeading}>Status</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t{conflicts.map(conflict => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<tr key={`${conflict.name}-${conflict.type}-${conflict.value}`}>\n\t\t\t\t\t\t\t\t\t\t<td>{conflict.name}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{conflict.type}</td>\n\t\t\t\t\t\t\t\t\t\t<td>{conflict.value}</td>\n\t\t\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t\t\t<Badge variant=\"error\" className={cx(dnsTableStyles.dnsTableStatusBadge, styles.conflictLabel)}>\n\t\t\t\t\t\t\t\t\t\t\t\tCONFLICT\n\t\t\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t\t\t<div className={domainsStyles.domainPropertyDescription}>\n\t\t\t\t\tRemove conflicting records to complete your domain setup.\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t)\n\t)\n}\n", "import \"ConflictTable.styles_1e1zsmg.wyw.css\"; export const conflictsHeadingRow = \"conflictsHeadingRow_cxipfve\";\nexport const tableHeading = \"tableHeading_tj4n4cc\";\nexport const conflictLabel = \"conflictLabel_c1pjc29b\";", "import \"DNSTable.styles_be0swn.wyw.css\"; export const tableWrapperBorderWidth = 1;\nexport const tableWrapper = \"tableWrapper_t1eq25md\";\nexport const tableWrapperWithScrollbar = \"tableWrapperWithScrollbar_tlmmac9\";\nexport const table = \"table_tzg2xf3\";\nexport const tableHeadingRow = \"tableHeadingRow_tmojdlm\";\nexport const tableHeading = \"tableHeading_t182o7me\";\nexport const copyHoverArea = \"copyHoverArea_cptzqwd\";\nexport const copyButton = \"copyButton_cy55dff\";\nexport const dnsTableStatusBadge = \"dnsTableStatusBadge_djkdtgl\";\nexport const connectedLabel = \"connectedLabel_c1sobqe9\";", "import { Badge, CopyButton } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport type { ValidatedCustomHostname } from \"document/stores/PublishStore.ts\"\nimport React, { useMemo } from \"react\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport * as styles from \"./DNSTable.styles.ts\"\n\ninterface Props {\n\thostnames: ValidatedCustomHostname[]\n}\n\ninterface DNSRecord {\n\tname: string\n\ttype: \"A\" | \"CNAME\"\n\tvalue: string\n\tstatus: \"CONNECTED\" | \"NOT ADDED\"\n}\n\nfunction hostnamesToRecords(hostnames: ValidatedCustomHostname[]): DNSRecord[] {\n\tconst records: DNSRecord[] = []\n\tfor (const hostname of hostnames) {\n\t\tconst { prefix, redirect, isApex, requiredRecords } = hostname\n\t\tconst hostnameRecords = requiredRecords.map((addr): DNSRecord => {\n\t\t\treturn {\n\t\t\t\tname: prefix || \"@\",\n\t\t\t\ttype: isApex ? \"A\" : \"CNAME\",\n\t\t\t\tvalue: addr.value,\n\t\t\t\tstatus: addr.isValid ? \"CONNECTED\" : \"NOT ADDED\",\n\t\t\t}\n\t\t})\n\n\t\t// Redirect hostnames go at the end.\n\t\tif (redirect) {\n\t\t\trecords.push(...hostnameRecords)\n\t\t} else {\n\t\t\trecords.unshift(...hostnameRecords)\n\t\t}\n\t}\n\treturn records\n}\n\nexport function DNSTable({ hostnames }: Props) {\n\tconst records: DNSRecord[] = useMemo(() => hostnamesToRecords(hostnames), [hostnames])\n\n\tconst tableWrapperRef = React.useRef<HTMLDivElement>(null)\n\tReact.useLayoutEffect(() => {\n\t\tconst tableWrapper = tableWrapperRef.current\n\t\tif (!tableWrapper) return\n\n\t\tconst table = tableWrapper.firstElementChild\n\t\tif (!(table instanceof HTMLElement)) return\n\n\t\tconst actualWrapperHeight = tableWrapper.offsetHeight\n\t\tconst maxExpectedWrapperHeightWithoutScrollbar = table.offsetHeight + 2 * styles.tableWrapperBorderWidth\n\t\tconst hasScrollbar = actualWrapperHeight > maxExpectedWrapperHeightWithoutScrollbar\n\t\ttableWrapper.classList.toggle(styles.tableWrapperWithScrollbar, hasScrollbar)\n\t}, [records])\n\n\t// Freeze the Value column's width so that it doesn't change when the user\n\t// hovers over one of its cells, which changes the text to Copy.\n\tconst valueColumnRef = React.useRef<HTMLTableCellElement>(null)\n\tReact.useLayoutEffect(() => {\n\t\tif (!valueColumnRef.current) return\n\t\tconst { width } = valueColumnRef.current.getBoundingClientRect()\n\t\tvalueColumnRef.current.style.width = width + \"px\"\n\t}, [records])\n\n\tif (records.length === 0) return null\n\n\treturn (\n\t\t<div className={styles.tableWrapper} ref={tableWrapperRef}>\n\t\t\t<table className={styles.table}>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr className={styles.tableHeadingRow}>\n\t\t\t\t\t\t<th className={styles.tableHeading}>Name</th>\n\t\t\t\t\t\t<th className={styles.tableHeading}>Type</th>\n\t\t\t\t\t\t<th className={styles.tableHeading} ref={valueColumnRef}>\n\t\t\t\t\t\t\tValue\n\t\t\t\t\t\t</th>\n\t\t\t\t\t\t<th className={styles.tableHeading}>Status</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{records.map(({ name, type, value, status }) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<tr key={`${name}-${type}-${value}`}>\n\t\t\t\t\t\t\t\t<td>{name}</td>\n\t\t\t\t\t\t\t\t<td>{type}</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<CopyOnHover text={value} />\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<Badge\n\t\t\t\t\t\t\t\t\t\tvariant={status === \"NOT ADDED\" ? \"neutral\" : undefined}\n\t\t\t\t\t\t\t\t\t\tclassName={cx(styles.dnsTableStatusBadge, status === \"CONNECTED\" && styles.connectedLabel)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{status}\n\t\t\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t</div>\n\t)\n}\n\nfunction CopyOnHover({ text }: { text: string }) {\n\tconst [isHover, setHover] = React.useState(false)\n\tconst [isHoverStateLocked, setHoverStateLocked] = React.useState(false)\n\n\tconst onCopy = () => {\n\t\tcopyText(text).catch(unhandledError)\n\t\tsetHoverStateLocked(true)\n\t}\n\n\tconst onCopiedStateEnd = () => {\n\t\tsetHoverStateLocked(false)\n\t}\n\n\treturn (\n\t\t<div onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)} className={styles.copyHoverArea}>\n\t\t\t{isHover || isHoverStateLocked ? (\n\t\t\t\t<CopyButton\n\t\t\t\t\ttitle=\"Copy\"\n\t\t\t\t\tonClick={onCopy}\n\t\t\t\t\tonCopiedStateEnd={onCopiedStateEnd}\n\t\t\t\t\tclassName={styles.copyButton}\n\t\t\t\t\tfullWidth\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\ttext\n\t\t\t)}\n\t\t</div>\n\t)\n}\n", "import type { CustomHostname, DefaultHostname, Deployment } from \"@framerjs/app-shared\"\nimport { Stack, T } from \"@framerjs/fresco\"\nimport type { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport type { GetDeploymentIssuesResponse, ValidatedCustomHostname } from \"document/stores/PublishStore.ts\"\nimport * as settingsStyles from \"../../SiteSettings.styles.ts\"\nimport { AddCustomDomain } from \"./AddCustomDomain/AddCustomDomain.tsx\"\nimport { CustomDomainDetails } from \"./CustomDomainDetails/CustomDomainDetails.tsx\"\n\ninterface Props {\n\tisViewOnly: boolean\n\tdefaultHostname?: DefaultHostname\n\tcustomHostname?: CustomHostname\n\tcustomHostnameDeployment?: Deployment\n\tcustomHostnameDeploymentIssues: GetDeploymentIssuesResponse | undefined\n\tfreeDomains: string[]\n\tonVersionClick: () => void\n\tpublishStatus: PublishStatus\n\tcustomHostnameValidationResult: ValidatedCustomHostname[]\n}\n\nexport function CustomDomain({\n\tisViewOnly,\n\tdefaultHostname,\n\tcustomHostname,\n\tcustomHostnameDeployment,\n\tcustomHostnameDeploymentIssues,\n\tfreeDomains,\n\tonVersionClick,\n\tpublishStatus,\n\tcustomHostnameValidationResult,\n}: Props) {\n\treturn (\n\t\t<Stack gap={settingsStyles.sectionTitleGap}>\n\t\t\t<Stack className={settingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<T>Custom</T>\n\t\t\t</Stack>\n\n\t\t\t{customHostname ? (\n\t\t\t\t<CustomDomainDetails\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tdefaultHostname={defaultHostname}\n\t\t\t\t\tcustomHostname={customHostname}\n\t\t\t\t\tcustomHostnameDeployment={customHostnameDeployment}\n\t\t\t\t\tcustomHostnameDeploymentIssues={customHostnameDeploymentIssues}\n\t\t\t\t\tonVersionClick={onVersionClick}\n\t\t\t\t\tpublishStatus={publishStatus}\n\t\t\t\t\tcustomHostnameValidationResult={customHostnameValidationResult}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<AddCustomDomain isViewOnly={isViewOnly} hasDefaultHostname={!!defaultHostname} freeDomains={freeDomains} />\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"UnpublishedState.styles_1smc5xx.wyw.css\"; export const container = \"container_c1q8hls0\";\nexport const iconContainer = \"iconContainer_i158qxui\";\nexport const icon = \"icon_i1rqbsdz\";\nexport const title = \"title_t7lcuk7\";\nexport const subtitle = \"subtitle_s1qj8yp\";\nexport const buttonsContainer = \"buttonsContainer_b1bu189j\";\nexport const button = \"button_b15o8spg\";", "import { Button, Link, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback } from \"react\"\nimport { publishingAcademyLessonURL } from \"utils/staticURLs.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { getPublishBlockingUpsell } from \"../../../shared/UpsellModal/getUpsell.tsx\"\nimport * as styles from \"./UnpublishedState.styles.ts\"\n\nconst JoinIcon = () => {\n\treturn (\n\t\t<svg viewBox=\"0 0 12 12\" className={styles.icon} role=\"presentation\">\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"M 6 0 C 9.314 0 12 2.686 12 6 C 12 9.314 9.314 12 6 12 C 2.686 12 0 9.314 0 6 C 0 2.686 2.686 0 6 0 Z M 7.82 7.47 C 8.46 6.92 8.9 7 9.07 6.28 C 9.24 5.56 8.59 5.19 8.77 4.88 C 8.97 4.56 9.27 4.64 9.81 5.01 C 10.36 5.39 10.17 6.03 10.95 6.38 L 11 6.38 C 11.163 4.363 10.087 2.449 8.28 1.54 C 8.119 1.802 7.846 1.976 7.54 2.01 C 6.34 2.21 5.62 1.74 4.98 2.01 C 4.34 2.28 4.48 2.97 4.98 3.11 C 5.48 3.24 7.9 2.64 7.9 3.75 C 7.9 4.86 6.33 4.13 5.26 3.92 C 4.19 3.72 3.43 4.08 3.26 4.74 C 3.11 5.4 3.84 6.34 4.63 6.56 C 5.41 6.78 5.37 9.38 6.4 9.38 C 7.44 9.38 7.19 8.01 7.83 7.47 Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function UnpublishedState() {\n\tconst publishLimitUpsell = useEngineState(\n\t\t() =>\n\t\t\tgetPublishBlockingUpsell({\n\t\t\t\tprojectStore: engine.stores.projectStore,\n\t\t\t\ttree: engine.tree,\n\t\t\t\tpublishStore: engine.stores.publishStore,\n\t\t\t}),\n\t\t[],\n\t\t[engine.stores.projectStore, engine.stores.publishStore, EngineChange.Tree],\n\t)\n\tconst isViewOnlyPublish = useIsViewOnly(\"canPublish\")\n\tconst shouldHidePublishButton = isViewOnlyPublish || publishLimitUpsell\n\n\tconst { publishStatus } = engine.stores.publishStore.useState(state => ({\n\t\tpublishStatus: state.publishStatus,\n\t}))\n\n\tconst handlePublish = useCallback(async () => {\n\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsDomains, id: UIInteraction.publishSite })\n\t\tvoid engine.stores.publishStore.publish()\n\t}, [])\n\n\tconst handleLearnMore = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsDomains, id: UIInteraction.learnMore })\n\t}, [])\n\n\tconst isBeingPublished = publishStatus === PublishStatus.Publishing\n\n\treturn (\n\t\t<Stack direction=\"column\" alignItems=\"center\" gap={15} className={styles.container}>\n\t\t\t<div className={styles.iconContainer}>\n\t\t\t\t<JoinIcon />\n\t\t\t</div>\n\n\t\t\t<Stack direction=\"column\" alignItems=\"center\">\n\t\t\t\t<h2 className={styles.title}>\n\t\t\t\t\t<T>Domains</T>\n\t\t\t\t</h2>\n\t\t\t\t<p className={styles.subtitle}>\n\t\t\t\t\t<T>Publish your site, then add a custom domain.</T>\n\t\t\t\t</p>\n\t\t\t</Stack>\n\n\t\t\t<Stack direction=\"row\" className={styles.buttonsContainer}>\n\t\t\t\t<Link\n\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\thref={publishingAcademyLessonURL}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\tonClick={handleLearnMore}\n\t\t\t\t\tclassName={styles.button}\n\t\t\t\t>\n\t\t\t\t\t<T>{Dictionary.LearnMore}</T>\n\t\t\t\t</Link>\n\t\t\t\t{!shouldHidePublishButton && (\n\t\t\t\t\t<Button variant=\"primary\" onClick={handlePublish} enabled={!isBeingPublished} className={styles.button}>\n\t\t\t\t\t\t<T>{isBeingPublished ? \"Publishing...\" : \"Publish\"}</T>\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { Button, Spinner, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { useGoogleAuth } from \"document/components/utils/useGoogleAuth.ts\"\nimport React from \"react\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport * as styles from \"./GoogleAccountConnection.styles.ts\"\n\nexport const GoogleAccountConnection = React.memo(function GoogleAccountConnection() {\n\treturn (\n\t\t<Stack gap={siteSettingsStyles.sectionTitleGap}>\n\t\t\t<Stack className={siteSettingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<T>Google Account</T>\n\t\t\t</Stack>\n\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n\t\t\t\t<span id=\"google-account-description\" className={siteSettingsStyles.settingDescriptionSecondary}>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tConnecting this project to your Google account allows you to send Form data to a Google Sheet. You can\n\t\t\t\t\t\tdisconnect this account to reconnect to a different one.\n\t\t\t\t\t</T>\n\t\t\t\t</span>\n\t\t\t\t<ConnectGoogleAccountButton />\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n\nconst ConnectGoogleAccountButton = React.memo(function ConnectGoogleAccountButton() {\n\tconst { googleAccountEmail, connect, disconnect, loading } = useGoogleAuth()\n\tconst connected = !!googleAccountEmail\n\n\tconst buttonLabel = loading ? \"Loading\" : connected ? \"Disconnect Google Account\" : \"Connect Google Account\"\n\n\tconst renderButtonContent = () => {\n\t\tif (loading) return <Spinner />\n\t\tif (connected) return <T>Disconnect</T>\n\t\treturn <T>Connect</T>\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\tbold\n\t\t\tenabled={!loading}\n\t\t\tclassName={styles.actionButton}\n\t\t\tonClick={connected ? disconnect : connect}\n\t\t\taria-label={buttonLabel}\n\t\t\taria-describedby=\"google-account-description\"\n\t\t>\n\t\t\t{renderButtonContent()}\n\t\t</Button>\n\t)\n})\n", "import \"GoogleAccountConnection.styles_1mue3nc.wyw.css\"; export const actionButton = \"actionButton_a4kejvg\";", "import { UpsellType } from \"@framerjs/events\"\nimport { Badge, Stack, Toggle, Translatable as T } from \"@framerjs/fresco\"\nimport { useFeatureIsOn } from \"app/features.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { initialWebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport React from \"react\"\nimport { Pages, UIInteraction, UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { UpsellFeature } from \"../Plans/Stripe/utils/upsell.ts\"\nimport { updatePartialWebMetadata } from \"../Project/updateWebMetadata.ts\"\nimport * as settingInputStyles from \"../SettingInput.styles.ts\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\n\nconst page = Pages.siteSettingsForms\n\nexport const UtmTracking = React.memo(function UtmTracking() {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst canUseUTMTracking = useFeatureIsOn(\"canUseUTMTracking\")\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\tconst { project } = engine.stores.projectStore.useState()\n\n\tconst enableFormsUTMTracking = useDeprecatedEngineState(\n\t\t[EngineChange.Tree],\n\t\t() => engine.tree.root.webMetadata?.enableFormsUTMTracking ?? initialWebMetadata.enableFormsUTMTracking,\n\t)\n\n\tconst handleUpgradeClick = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: UpsellType.useUTMTrackingUpsell,\n\t\t\tid: UpsellUIInteraction.navigateToPlans,\n\t\t})\n\n\t\tif (project) {\n\t\t\tupdatePurchaseOrigin(\n\t\t\t\tUpsellType.useUTMTrackingUpsell,\n\t\t\t\t{ projectId: project.id, site: project.license.type, team: project.teamLicenseType },\n\t\t\t\tnull,\n\t\t\t)\n\t\t}\n\t\tvoid engine.stores.siteSettingsStore.setActiveTab({\n\t\t\ttab: SiteSettingsTabNames.plans,\n\t\t\tupsellFeature: UpsellFeature.canUseUTMTracking,\n\t\t})\n\t}\n\n\tconst onEnableUtmChecked = (value: boolean) => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.saveSiteFormsUtmTracking })\n\t\tupdatePartialWebMetadata({ enableFormsUTMTracking: value })\n\t}\n\treturn (\n\t\t<Stack gap={siteSettingsStyles.sectionTitleGap}>\n\t\t\t<Stack className={siteSettingsStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<T>Form Settings</T>\n\t\t\t</Stack>\n\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t>\n\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t<Stack direction=\"row\" gap={10} alignItems=\"center\">\n\t\t\t\t\t\t<label htmlFor=\"campaign-tracking\" className={siteSettingsStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Campaign Tracking</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t{!canUseUTMTracking && (\n\t\t\t\t\t\t\t<Badge onClick={handleUpgradeClick} data-testid=\"upgrade-badge\">\n\t\t\t\t\t\t\t\tUpgrade\n\t\t\t\t\t\t\t</Badge>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<span id=\"campaign-tracking-description\" className={siteSettingsStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t<T>Include UTM tags and Google Ads Click IDs in form submissions.</T>\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t\t<Toggle\n\t\t\t\t\tid=\"campaign-tracking\"\n\t\t\t\t\tsmall\n\t\t\t\t\tenabled={!isViewOnly && canUseUTMTracking}\n\t\t\t\t\tvalue={enableFormsUTMTracking}\n\t\t\t\t\tonChange={onEnableUtmChecked}\n\t\t\t\t\taria-describedby=\"campaign-tracking-description\"\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import { Stack } from \"@framerjs/fresco\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport { GoogleAccountConnection } from \"./GoogleAccountConnection.tsx\"\nimport { UtmTracking } from \"./UtmTracking.tsx\"\n\nexport function Forms() {\n\treturn (\n\t\t<Stack gap={30} className={siteSettingsStyles.wideContainer}>\n\t\t\t<UtmTracking />\n\t\t\t<Separator height={1} />\n\t\t\t<GoogleAccountConnection />\n\t\t</Stack>\n\t)\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { Stack, T } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport engine from \"document/engine.ts\"\nimport type { AnyWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isResponsiveImage } from \"document/models/CanvasTree/traits/ResponsiveImage.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport type {\n\tImageControlDescription,\n\tResponsiveImageControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport React, { useEffect } from \"react\"\nimport { getFirstObjectKey } from \"utils/getFirstObjectKey.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { useItemToSlug } from \"utils/useItemToSlug.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport { SocialImageSection } from \"./SocialImageSection.tsx\"\n\ninterface Props {\n\tpage: AnyWebPageNode\n\tisViewOnly: boolean\n}\n\nexport const SocialImageSectionForCMSPage = React.memo(function SocialImageSectionForCMSPage({\n\tpage,\n\tisViewOnly,\n}: Props) {\n\tconst optionalSelectedCollectionItemId = useEngineState(\n\t\t() => engine.stores.scopeStore.getSelectedCollectionItemForWebPage(page),\n\t\t[page],\n\t\t[engine.stores.scopeStore],\n\t)\n\n\tconst socialImage = page.webMetadata?.socialImage\n\tconst data = useDataForIdentifier(page.dataIdentifier)\n\tconst itemToSlug = useItemToSlug(page.dataIdentifier) ?? {}\n\tconst collectionItemId = optionalSelectedCollectionItemId ?? getFirstObjectKey(itemToSlug)\n\n\tconst { imageKeyAndControlPairs, selectedImageControlKey } = React.useMemo(() => {\n\t\tif (!data) {\n\t\t\treturn { imageKeyAndControlPairs: null, selectedImageControlKey: undefined }\n\t\t}\n\n\t\tconst pairs: [string, ImageControlDescription | ResponsiveImageControlDescription][] = []\n\t\tlet selected: string | undefined = undefined\n\n\t\tfor (const [key, control] of Object.entries(data.properties)) {\n\t\t\tif (control && (control.type === ControlType.Image || control.type === ControlType.ResponsiveImage)) {\n\t\t\t\tpairs.push([key, control])\n\n\t\t\t\tif (isVariableReference(socialImage) && key === socialImage.id && selected === undefined) {\n\t\t\t\t\tselected = key\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn { imageKeyAndControlPairs: pairs, selectedImageControlKey: selected }\n\t}, [data, socialImage])\n\n\tconst sandboxImage = useSandboxImage(data, collectionItemId, selectedImageControlKey)\n\tconst imageResource = isVariableReference(socialImage) ? sandboxImage : socialImage\n\n\tconst handleUpdateSocialImage = React.useCallback(\n\t\t(newSocialImage: string | VariableReference | undefined) => {\n\t\t\tupdatePageMetadata(page.id, { socialImage: newSocialImage })\n\n\t\t\trecord(\"page_settings_change\", {\n\t\t\t\ttitle: false,\n\t\t\t\tpath: false,\n\t\t\t\tdescription: false,\n\t\t\t\tkeywords: false,\n\t\t\t\tsocialImage: true,\n\t\t\t\tnoIndex: false,\n\t\t\t\tnoIndexSite: false,\n\t\t\t})\n\t\t},\n\t\t[page.id],\n\t)\n\n\treturn (\n\t\t<Stack gap={30}>\n\t\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t\t<Stack className={siteSettingStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t<T>Page Images</T>\n\t\t\t\t</Stack>\n\n\t\t\t\t<SocialImageSection\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tsocialImage={imageResource}\n\t\t\t\t\tonUpdateSocialImage={handleUpdateSocialImage}\n\t\t\t\t\tselectedImageControlKey={selectedImageControlKey}\n\t\t\t\t\timageKeyAndControlPairs={imageKeyAndControlPairs}\n\t\t\t\t/>\n\t\t\t</Stack>\n\n\t\t\t<Separator height={1} />\n\t\t</Stack>\n\t)\n})\n\nfunction useSandboxImage(\n\tdata: DataDefinition | null | undefined,\n\tcollectionItemId: string | undefined,\n\tselectedImageControlKey: string | undefined,\n): string | undefined {\n\tconst [sandboxImage, setSandboxImage] = React.useState<{ [controlKey: string]: string | undefined }>({})\n\n\tuseEffect(() => {\n\t\tif (!data || !collectionItemId || !selectedImageControlKey) return\n\t\tconst dataIdentifier = data.identifier\n\n\t\tlet isLastEffect = true\n\t\tvoid engine.canvasSandbox?.sandbox.utils\n\t\t\t.queryCollection({\n\t\t\t\tdataIdentifier,\n\t\t\t\tfields: [selectedImageControlKey],\n\t\t\t\tcollectionItemId,\n\t\t\t})\n\t\t\t.then(queryResult => {\n\t\t\t\tif (!isLastEffect) return\n\t\t\t\tconst firstItem = queryResult[0]\n\t\t\t\tif (!firstItem) return\n\t\t\t\tconst imageValue = firstItem[selectedImageControlKey]\n\t\t\t\tif (isString(imageValue)) {\n\t\t\t\t\tsetSandboxImage({ [selectedImageControlKey]: imageValue })\n\t\t\t\t} else if (isResponsiveImage(imageValue)) {\n\t\t\t\t\tsetSandboxImage({ [selectedImageControlKey]: imageValue.src })\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(unhandledError)\n\n\t\treturn () => {\n\t\t\tisLastEffect = false\n\t\t}\n\t}, [selectedImageControlKey, data, collectionItemId])\n\n\tif (!selectedImageControlKey) return\n\treturn sandboxImage[selectedImageControlKey]\n}\n\nconst updatePageMetadata = engine.scheduler.wrapHandler((pageId: NodeID, update: Partial<WebMetadata>) => {\n\tconst page = engine.tree.get<AnyWebPageNode>(pageId)\n\tif (!page) return\n\tconst newMetadata: WebMetadata = { ...page.webMetadata, ...update }\n\tpage.set({ webMetadata: newMetadata })\n})\n", "export function getFirstObjectKey<T extends Record<string, unknown>>(object: T): keyof T | undefined {\n\tfor (const key in object) {\n\t\treturn key\n\t}\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tinstantiateExistingVariableReference,\n\tisVariableReference,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport type {\n\tImageControlDescription,\n\tResponsiveImageControlDescription,\n} from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { ImagePreview } from \"./ImagePreview.tsx\"\nimport { ImageUploadInput, ImageUploadInputForCMSPage } from \"./ImageUploadInput.tsx\"\nimport * as styles from \"./SocialImageSection.styles.ts\"\nimport { useChangeSiteImage } from \"./useChangeSiteImage.tsx\"\n\nconst label = \"Social Preview\"\nconst description = \"1200 x 630 pixels\"\n\ninterface Props {\n\tenabled?: boolean\n\tsocialImage: string | undefined\n\timageKeyAndControlPairs?: [string, ImageControlDescription | ResponsiveImageControlDescription][] | null\n\tselectedImageControlKey?: string | undefined\n\tonUpdateSocialImage: (newSocialImage: string | VariableReference | undefined) => void\n}\n\nexport const SocialImageSection = React.memo(function SocialImageSection({\n\tenabled,\n\tsocialImage,\n\timageKeyAndControlPairs,\n\tselectedImageControlKey,\n\tonUpdateSocialImage,\n}: Props) {\n\t// Force re-render when assets change\n\tuseDeprecatedEngineState(\n\t\t[EngineChange.CanvasStore, EngineChange.AssetMap],\n\t\t() => engine.stores.assetStore.assetMap.hash,\n\t)\n\n\tassert(!isVariableReference(socialImage), \"Social image variables aren't supported on the root node\")\n\n\tconst { onUpload, chooseImages, onClear, pasteElementRef } = useChangeSiteImage(enabled, onUpdateSocialImage)\n\n\tconst onUploadImagePage = (event: React.MouseEvent) => {\n\t\tassert(imageKeyAndControlPairs, \"Can only display options menu when there are variables\")\n\t\tconst options: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Upload Image\u2026\",\n\t\t\t\tclick: chooseImages,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: \"separator\",\n\t\t\t},\n\t\t]\n\n\t\tif (imageKeyAndControlPairs.length === 0) {\n\t\t\toptions.push({ label: \"No Variables\", enabled: false })\n\t\t} else {\n\t\t\toptions.push({\n\t\t\t\tlabel: \"CMS Variables\",\n\t\t\t\tsubmenu: imageKeyAndControlPairs.map(\n\t\t\t\t\t([key, control]): MenuItemOptions => ({\n\t\t\t\t\t\tlabel: control.title || Dictionary.Unknown,\n\t\t\t\t\t\tchecked: selectedImageControlKey === key,\n\t\t\t\t\t\tclick: () => onUpdateSocialImage(instantiateExistingVariableReference(key, undefined)),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\n\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\tengine.stores.contextMenuStore.show(options, {\n\t\t\tlocation: { x: bounds.left + dimensions.values.contextMenuOffsetX, y: bounds.bottom },\n\t\t})\n\t}\n\n\tconst hasAssociatedCMSField = !!selectedImageControlKey\n\tconst cmsFieldTitle = getCmsFieldTitle(imageKeyAndControlPairs, selectedImageControlKey)\n\n\tconst emptyText = hasAssociatedCMSField ? `No image in the \u201C${cmsFieldTitle}\u201D field for this CMS item.` : undefined\n\n\treturn (\n\t\t<Stack gap={15} direction=\"row\" wrap=\"wrap\" alignItems=\"flex-start\">\n\t\t\t{imageKeyAndControlPairs ? (\n\t\t\t\t<ImageUploadInputForCMSPage\n\t\t\t\t\tlabel={label}\n\t\t\t\t\tdescription={description}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tonUpload={onUploadImagePage}\n\t\t\t\t\tcmsFieldTitle={hasAssociatedCMSField ? cmsFieldTitle : undefined}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<ImageUploadInput label={label} description={description} enabled={enabled} onUpload={onUpload} />\n\t\t\t)}\n\n\t\t\t<ImagePreview\n\t\t\t\tclassName={styles.socialPreview}\n\t\t\t\tref={pasteElementRef}\n\t\t\t\tsize=\"large\"\n\t\t\t\tname=\"social-preview\"\n\t\t\t\tsrc={socialImage}\n\t\t\t\tcanClear={!isUndefined(socialImage)}\n\t\t\t\temptyText={emptyText}\n\t\t\t\t// Don't allow quick over-riding of CMS images, too easy to be done accidentally\n\t\t\t\tonUpload={hasAssociatedCMSField ? undefined : chooseImages}\n\t\t\t\tonClear={onClear}\n\t\t\t/>\n\t\t</Stack>\n\t)\n})\n\nfunction getCmsFieldTitle(\n\timageKeyAndControlPairs: Props[\"imageKeyAndControlPairs\"],\n\tselectedImageControlKey: string | undefined,\n): string | undefined {\n\tif (!imageKeyAndControlPairs || !selectedImageControlKey) return undefined\n\n\tconst imageKeyAndControlPair = imageKeyAndControlPairs.find(([key]) => key === selectedImageControlKey)\n\treturn imageKeyAndControlPair?.[1].title ?? Dictionary.Unknown\n}\n", "import { FileDropZone, Translatable as T } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport type { PropsWithChildren } from \"react\"\nimport React from \"react\"\nimport { ClearImageButton } from \"../../shared/ClearImageButton.tsx\"\nimport * as styles from \"./ImagePreview.styles.ts\"\n\ninterface Props {\n\tclassName?: string\n\tname: string\n\tsize: \"small\" | \"large\"\n\tsrc: string | undefined\n\tcanClear?: boolean\n\temptyText?: string\n\tonUpload: ((images?: FileList) => Promise<void>) | undefined\n\tonClear?: () => void\n}\n\nexport const ImagePreview = React.memo(\n\tReact.forwardRef<HTMLDivElement, PropsWithChildren<Props>>(function ImagePreview(\n\t\t{ className, name, size, src, onUpload, canClear, onClear, emptyText, children },\n\t\tforwardedRef,\n\t) {\n\t\tconst fallbackRef = React.useRef<HTMLDivElement>(null)\n\t\tconst ref = forwardedRef ?? fallbackRef\n\n\t\tconst [dragOver, setDragOver] = React.useState(false)\n\n\t\tconst onDragEnter = React.useCallback(() => {\n\t\t\tsetDragOver(true)\n\t\t}, [])\n\n\t\tconst onDragLeave = React.useCallback(() => {\n\t\t\tsetDragOver(false)\n\t\t}, [])\n\n\t\tconst onDrop = React.useCallback(\n\t\t\tasync (event: DragEvent) => {\n\t\t\t\tif (!event.dataTransfer || !onUpload) return\n\t\t\t\tawait onUpload(event.dataTransfer.files)\n\t\t\t},\n\t\t\t[onUpload],\n\t\t)\n\n\t\tconst onClick = React.useCallback(async () => {\n\t\t\tif (!onUpload) return\n\n\t\t\tawait onUpload()\n\t\t\tif (!(\"current\" in ref && ref.current)) return\n\t\t\tref?.current?.blur()\n\t\t}, [onUpload, ref])\n\n\t\tconst handleClear = React.useCallback(\n\t\t\t(event: React.MouseEvent) => {\n\t\t\t\tif (!onClear) return\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\t\t\t\tonClear()\n\t\t\t},\n\t\t\t[onClear],\n\t\t)\n\n\t\treturn (\n\t\t\t<div className={cx(styles.container, className)}>\n\t\t\t\t<FileDropZone key={`${name}-preview`} onDrop={onDrop} onDragEnter={onDragEnter} onDragLeave={onDragLeave}>\n\t\t\t\t\t<div\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex\n\t\t\t\t\t\ttabIndex={onUpload ? 0 : undefined}\n\t\t\t\t\t\tonClick={onUpload ? onClick : undefined}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.previewContainer,\n\t\t\t\t\t\t\tsize === \"small\" && styles.smallPreviewContainer,\n\t\t\t\t\t\t\tsize === \"large\" && styles.largePreviewContainer,\n\t\t\t\t\t\t\t!!onUpload && dragOver && styles.dragOverBorder,\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{src ? (\n\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\tsrc={resolveImage(src)}\n\t\t\t\t\t\t\t\talt={`${name} preview`}\n\t\t\t\t\t\t\t\tclassName={styles.preview}\n\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<EmptyPreview emptyText={emptyText} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</FileDropZone>\n\n\t\t\t\t{canClear && <ClearImageButton onClick={handleClear} />}\n\t\t\t</div>\n\t\t)\n\t}),\n)\n\nfunction EmptyPreview({ emptyText }: { emptyText?: string }) {\n\tif (emptyText) {\n\t\treturn <div className={styles.emptyPreviewText}>{emptyText}</div>\n\t}\n\n\treturn <T className={styles.emptyPreviewText}>Drop image</T>\n}\n", "import \"ImagePreview.styles_1bl28kt.wyw.css\"; export const container = \"container_ciy350p\";\nexport const previewContainer = \"previewContainer_ppocwvb\";\nexport const emptyPreviewText = \"emptyPreviewText_e34igct\";\nexport const smallPreviewContainer = \"smallPreviewContainer_sb2paom\";\nexport const largePreviewContainer = \"largePreviewContainer_l1qevubf\";\nexport const dragOverBorder = \"dragOverBorder_d5h3vj9\";\nexport const preview = \"preview_pgvso9k\";", "import {\n\tButton,\n\tCenterChild,\n\tIconInputDropdown,\n\tIconLayerCollectionItem,\n\tStack,\n\tTranslatable as T,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport type { HTMLButtonMouseEvent } from \"@framerjs/fresco/src/components/types.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { PropsWithChildren } from \"react\"\nimport React from \"react\"\nimport { IconAgentLayerCollectionItem } from \"../../layers/IconAgentLayerCollectionItem.tsx\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport * as styles from \"./ImageUploadInput.styles.ts\"\n\ninterface LayoutProps {\n\tlabel: string\n\tdescription?: string\n\tdirection?: \"row\" | \"column\"\n}\n\ninterface Props extends LayoutProps {\n\tenabled?: boolean\n\tonUpload: ((event: HTMLButtonMouseEvent) => void) | undefined\n}\n\nfunction Layout({ label, description, direction = \"column\", children }: PropsWithChildren<LayoutProps>) {\n\tconst isRow = direction === \"row\"\n\treturn (\n\t\t<Stack\n\t\t\tdirection={direction}\n\t\t\tgap={10}\n\t\t\talignItems={isRow ? \"center\" : undefined}\n\t\t\tjustifyContent={isRow ? \"space-between\" : undefined}\n\t\t\tclassName={styles.container}\n\t\t>\n\t\t\t<Stack gap={5}>\n\t\t\t\t<T className={siteSettingStyles.settingTitle}>{label}</T>\n\t\t\t\t{description && <T className={siteSettingStyles.settingDescription}>{description}</T>}\n\t\t\t</Stack>\n\t\t\t{children}\n\t\t</Stack>\n\t)\n}\n\nconst UploadButton = React.memo(function UploadButton({\n\tenabled = true,\n\tonUpload,\n\tlabel,\n}: {\n\tenabled?: boolean\n\tonUpload: ((event: HTMLButtonMouseEvent) => void) | undefined\n\tlabel?: string\n}) {\n\treturn (\n\t\t<Button\n\t\t\tenabled={enabled}\n\t\t\tonClick={onUpload}\n\t\t\tclassName={styles.uploadButton}\n\t\t\taria-label={label ? `Upload ${label}` : undefined}\n\t\t>\n\t\t\t<T>Upload</T>\n\t\t</Button>\n\t)\n})\n\nexport const ImageUploadRow = Layout\n\nexport const ImageUploadInput = Object.assign(\n\tReact.memo(function ImageUploadInput({ enabled = true, onUpload, label, ...rest }: Props) {\n\t\treturn (\n\t\t\t<Layout label={label} {...rest}>\n\t\t\t\t<UploadButton enabled={enabled} onUpload={onUpload} label={label} />\n\t\t\t</Layout>\n\t\t)\n\t}),\n\t{\n\t\tLayout,\n\t\tUploadButton,\n\t},\n)\n\ninterface CMSPageProps extends Props {\n\tcmsFieldTitle: string | undefined\n}\n\nexport const ImageUploadInputForCMSPage = React.memo(function ImageUploadInputForCMSPage({\n\tenabled = true,\n\tonUpload,\n\tlabel,\n\tcmsFieldTitle,\n\t...rest\n}: CMSPageProps) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\treturn (\n\t\t<Layout label={label} {...rest}>\n\t\t\t<Button\n\t\t\t\tenabled={enabled}\n\t\t\t\tonClick={onUpload}\n\t\t\t\tclassName={styles.uploadButton}\n\t\t\t\taria-label={label ? `Choose ${label} image` : undefined}\n\t\t\t>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={6}>\n\t\t\t\t\t{!!cmsFieldTitle && (\n\t\t\t\t\t\t<CenterChild className={styles.cmsIcon}>\n\t\t\t\t\t\t\t{agentExperimentEnabled ? <IconAgentLayerCollectionItem /> : <IconLayerCollectionItem />}\n\t\t\t\t\t\t</CenterChild>\n\t\t\t\t\t)}\n\t\t\t\t\t<span className={truncateWithEllipsis}>{cmsFieldTitle || <T>Choose Image</T>}</span>\n\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t</Stack>\n\t\t\t</Button>\n\t\t</Layout>\n\t)\n})\n", "import \"ImageUploadInput.styles_kqop08.wyw.css\"; export const container = \"container_c19pf78e\";\nexport const uploadButton = \"uploadButton_u1u39o93\";\nexport const cmsIcon = \"cmsIcon_c104xexs\";", "import \"SocialImageSection.styles_fq6duw.wyw.css\"; export const socialPreview = \"socialPreview_s17i03cn\";", "import { unhandledError } from \"@framerjs/shared\"\nimport { createAssetReferenceForUploadImageResult } from \"document/utils/createAssetReferenceFromImageUpload.ts\"\nimport type { AllowedFileTypes } from \"library/render/types/PropertyControls.ts\"\nimport React from \"react\"\nimport { chooseFileService } from \"web/pages/project/lib/ChooseFileService.ts\"\nimport type { ImageUploadResult } from \"web/pages/project/lib/UploadService.ts\"\nimport { usePasteHandler } from \"web/pages/project/lib/useWindowEventListeners.ts\"\n\ntype UploadImageHandler = (image: string | undefined) => void\n\nexport function useChangeSiteImage(\n\tenabled: boolean | undefined,\n\tonUpload: UploadImageHandler,\n\tallowedFileTypes?: AllowedFileTypes,\n): {\n\tonUpload: () => Promise<void>\n\tchooseImages: (images?: FileList) => Promise<void>\n\tonClear: () => void\n\tpasteElementRef: React.RefObject<HTMLDivElement>\n} {\n\tconst pasteElementRef = React.useRef<HTMLDivElement>(null)\n\n\tconst chooseImages = React.useCallback(\n\t\tasync (images?: FileList) => {\n\t\t\tif (!enabled) return\n\t\t\ttry {\n\t\t\t\tconst uploadedImages: ImageUploadResult[] = images\n\t\t\t\t\t? await chooseFileService.addImages(images)\n\t\t\t\t\t: await chooseFileService.pickAndUploadImage({ allowedFileTypes })\n\n\t\t\t\tif (uploadedImages.length === 0) return\n\n\t\t\t\tconst uploadedImage = uploadedImages[0]\n\t\t\t\tif (!uploadedImage) return\n\t\t\t\tconst assetReference = createAssetReferenceForUploadImageResult(uploadedImage)\n\t\t\t\tonUpload(assetReference)\n\t\t\t} catch (error) {\n\t\t\t\tunhandledError(`Fail to upload image: ${error}`)\n\t\t\t}\n\t\t},\n\t\t[allowedFileTypes, enabled, onUpload],\n\t)\n\n\tconst onUploadImage = React.useCallback(async () => {\n\t\tawait chooseImages()\n\t}, [chooseImages])\n\n\tconst onClear = React.useCallback(() => {\n\t\tonUpload(undefined)\n\t}, [onUpload])\n\n\tconst pasteHandler = React.useCallback(\n\t\tasync (event: ClipboardEvent) => {\n\t\t\tconst pasteElement = pasteElementRef.current\n\t\t\tif (!pasteElement || document.activeElement !== pasteElement) return\n\t\t\tevent.preventDefault()\n\t\t\tconst clipboardData = event.clipboardData\n\t\t\tif (!clipboardData) return\n\n\t\t\tawait chooseImages(event.clipboardData.files)\n\t\t},\n\t\t[chooseImages],\n\t)\n\n\tusePasteHandler(pasteHandler)\n\n\treturn {\n\t\tonUpload: onUploadImage,\n\t\tchooseImages,\n\t\tonClear,\n\t\tpasteElementRef,\n\t}\n}\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { getPathForDisplay } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { convertIdPathVariablesToReadable } from \"./convertIdPathVariablesToReadable.ts\"\nimport { FALLBACK_PATH } from \"./getWebPagePath.ts\"\nimport { useDataForIdentifier } from \"./useDataForIdentifier.ts\"\n\n/**\n * Converts path variable IDs to human-readable titles.\n * Parentheses are automatically unescaped for display.\n */\nexport function useConvertIdPathVariablesToReadable(\n\tidentifier: ModuleExportIdentifierString | undefined,\n\tpath: string | undefined,\n\ttype?: \"title\" | \"value\",\n): string {\n\tconst data = useDataForIdentifier(identifier)\n\tif (!path) return FALLBACK_PATH\n\tif (!data) return getPathForDisplay(path)\n\treturn getPathForDisplay(convertIdPathVariablesToReadable(data, path, type))\n}\n", "import type { CustomHostname } from \"@framerjs/app-shared\"\nimport { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, Stack, T } from \"@framerjs/fresco\"\nimport { breakpoints } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getFallbackWebPageTitle } from \"code-generation/components/generateMetadataModule.ts\"\nimport { getRawWebPagePath, getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { useConvertIdPathVariablesToReadable } from \"document/components/utils/useConvertIdPathVariablesToReadable.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport engine from \"document/engine.ts\"\nimport type { AnyWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { getMetadataWarningMessages } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React, { useCallback, useRef } from \"react\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { InlineDocumentation } from \"../../shared/InlineDocumentation.tsx\"\nimport { ClickableVariables } from \"../ClickableVariables.tsx\"\nimport { SearchResultPreview } from \"../SearchResultPreview.tsx\"\nimport * as settingInputStyles from \"../SettingInput.styles.ts\"\nimport { SettingInput, type SettingInputRef } from \"../SettingInput.tsx\"\nimport { SettingTextArea, type SettingTextAreaRef } from \"../SettingTextArea.tsx\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport { descriptionPlaceholder, hostnamePlaceholder, siteTitlePlaceholder } from \"../metadataPlaceholders.ts\"\nimport { wrapInTemplateVariable } from \"../templateVariables.ts\"\nimport { useAvailableFields } from \"../useAvailableFields.ts\"\nimport { useMetadataUpdateHandler } from \"../useMetadataUpdateHandler.ts\"\nimport { getInitialPageMetadata, savePageMetadata } from \"../utils/handleSaveSettings.ts\"\nimport { PageMetadataSearchSection } from \"./PageMetadataSearchSection.tsx\"\n\ninterface Props {\n\tisHomePage: boolean\n\tisViewOnly: boolean\n\tpage: AnyWebPageNode\n\trootWebMetadata: WebMetadata | undefined\n\tcustomHostname: CustomHostname | undefined\n}\n\nconst handleSave = () => savePageMetadata(engine)\n\nexport const PageMetadata = ({ isHomePage, isViewOnly, page, rootWebMetadata, customHostname }: Props) => {\n\t/**\n\t * This order should match the `title` in the webMetadata object for the html template.\n\t * // page settings > site settings > node fallback\n\t * see generateHTML: https://github.com/framer/FramerStudio/blob/306ba902790afde49bf2bf244d45f21d75216058/src/app/vekter/src/export/exportToHTML.ts#L222\n\t */\n\tconst fallbackTitle = getFallbackWebPageTitle(engine.tree, engine.componentLoader, page, rootWebMetadata)\n\tconst fallbackDescription = rootWebMetadata?.description ?? descriptionPlaceholder\n\n\tconst collectionData = useDataForIdentifier(page.dataIdentifier)\n\n\tconst { siteSettingsStore } = engine.stores\n\n\tconst { hasMetadataChanges, metadataChanges, pagePath } = siteSettingsStore.useState()\n\n\tconst initialValues = React.useMemo(() => {\n\t\treturn getInitialPageMetadata(page.webMetadata, collectionData, engine.componentLoader)\n\t}, [page.webMetadata, collectionData])\n\n\t// This is different from the fallback values, the fallback should be a\n\t// placeholder rather than the edited value.\n\tconst currentPageTitle = metadataChanges.title ?? initialValues.title\n\tconst currentPageDescription = metadataChanges.description ?? initialValues.description\n\tconst currentNoIndex: boolean | DynamicValue = metadataChanges.noIndex ?? initialValues.noIndex\n\t// fallback to the initialValue of noIndex because that was the previous\n\t// functionality which is still applicable if the site settings haven't\n\t// changed in the meantime.\n\tconst currentNoIndexSite: boolean | DynamicValue =\n\t\tmetadataChanges.noIndexSite ?? initialValues.noIndexSite ?? initialValues.noIndex\n\n\tconst handleUpdateTitle = useMetadataUpdateHandler(engine, \"title\", initialValues)\n\tconst handleUpdateDescription = useMetadataUpdateHandler(engine, \"description\", initialValues)\n\tconst handleNoIndex = useMetadataUpdateHandler(engine, \"noIndex\", initialValues)\n\tconst handleNoIndexSite = useMetadataUpdateHandler(engine, \"noIndexSite\", initialValues)\n\n\tconst readablePathVariable = useConvertIdPathVariablesToReadable(\n\t\tpage.dataIdentifier,\n\t\tgetRawWebPagePath(engine.tree, page),\n\t)\n\tconst readablePath = collectionData ? readablePathVariable : getWebPagePath(engine.tree, page)\n\tconst initialPagePath = isHomePage ? \"/\" : readablePath\n\tconst currentPagePath = pagePath ?? initialPagePath\n\tconst isAbVariant = Boolean(page.abTestingParentId)\n\n\tfunction handleUpdatePath(newPath: string) {\n\t\tsiteSettingsStore.pagePath = newPath === initialPagePath ? null : newPath\n\t}\n\n\tconst { hasWarnings, warningMessages } = getMetadataWarningMessages(\n\t\tengine.componentLoader,\n\t\t{\n\t\t\ttitle: currentPageTitle,\n\t\t\tdescription: currentPageDescription,\n\t\t\tpagePath: currentPagePath,\n\t\t},\n\t\tcollectionData,\n\t)\n\n\tconst availablePlainTextFields = useAvailableFields(engine.componentLoader, collectionData, \"pageSettings\")\n\n\tconst selectedCollectionItemId = useEngineState(\n\t\t() => engine.stores.scopeStore.getSelectedCollectionItemForWebPage(page),\n\t\t[page],\n\t\t[engine.stores.scopeStore],\n\t)\n\n\tconst titleInputRef = useRef<SettingInputRef>(null)\n\tconst descriptionTextAreaRef = useRef<SettingTextAreaRef>(null)\n\n\tconst lastFocusedFieldRef = useRef<\"title\" | \"description\">(\"title\")\n\n\tconst handleTitleFocus = useCallback(() => {\n\t\tlastFocusedFieldRef.current = \"title\"\n\t}, [])\n\n\tconst handleDescriptionFocus = useCallback(() => {\n\t\tlastFocusedFieldRef.current = \"description\"\n\t}, [])\n\n\tconst handleVariableClick = useCallback((variable: string) => {\n\t\tconst field = lastFocusedFieldRef.current\n\t\tconst ref = field === \"title\" ? titleInputRef.current : descriptionTextAreaRef.current\n\n\t\tif (ref) {\n\t\t\tref.replaceTextAtSelection(wrapInTemplateVariable(variable))\n\t\t}\n\t}, [])\n\n\tconst isSmallScreen = useMediaQuery(`(max-width: ${breakpoints.tabletMedium}px)`)\n\n\treturn (\n\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t<Stack\n\t\t\t\tclassName={siteSettingStyles.sectionTitle}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t>\n\t\t\t\t<T>{isHomePage ? \"Home Page Settings\" : Dictionary.PageSettings}</T>\n\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t<Button enabled={!isViewOnly && hasMetadataChanges && !hasWarnings} onClick={handleSave} bold>\n\t\t\t\t\t\t<T>Save</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</HandleClickOnClick>\n\t\t\t</Stack>\n\n\t\t\t<Stack gap={15}>\n\t\t\t\t<Stack gap={30} paddingBottom={15}>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tdirection={isSmallScreen ? \"column\" : \"row\"}\n\t\t\t\t\t\tgap={isSmallScreen ? siteSettingStyles.columnGapSmallScreen : siteSettingStyles.columnGap}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SettingInput\n\t\t\t\t\t\t\tref={titleInputRef}\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tname=\"page-title\"\n\t\t\t\t\t\t\tlabel={Dictionary.Title}\n\t\t\t\t\t\t\tdefaultValue={currentPageTitle}\n\t\t\t\t\t\t\tplaceholder={fallbackTitle}\n\t\t\t\t\t\t\tonChange={handleUpdateTitle}\n\t\t\t\t\t\t\tonFocus={handleTitleFocus}\n\t\t\t\t\t\t\twarning={warningMessages.title}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<SettingInput\n\t\t\t\t\t\t\tenabled={!isViewOnly && !isHomePage && !isAbVariant}\n\t\t\t\t\t\t\tname=\"page-path\"\n\t\t\t\t\t\t\tlabel=\"URL\"\n\t\t\t\t\t\t\tdefaultValue={currentPagePath}\n\t\t\t\t\t\t\tonChange={handleUpdatePath}\n\t\t\t\t\t\t\twarning={warningMessages.pagePath}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tdirection={isSmallScreen ? \"column\" : \"row\"}\n\t\t\t\t\t\t\tgap={isSmallScreen ? siteSettingStyles.columnGapSmallScreen : siteSettingStyles.columnGap}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Stack className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t\t\t<SettingTextArea\n\t\t\t\t\t\t\t\t\tref={descriptionTextAreaRef}\n\t\t\t\t\t\t\t\t\tname=\"page-description\"\n\t\t\t\t\t\t\t\t\tlabel=\"Description\"\n\t\t\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\t\t\tplaceholder={fallbackDescription}\n\t\t\t\t\t\t\t\t\tonChange={handleUpdateDescription}\n\t\t\t\t\t\t\t\t\tonFocus={handleDescriptionFocus}\n\t\t\t\t\t\t\t\t\tdefaultValue={currentPageDescription}\n\t\t\t\t\t\t\t\t\twarning={warningMessages.description}\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t{collectionData && isSmallScreen && (\n\t\t\t\t\t\t\t\t\t<CmsFieldsDescription fields={availablePlainTextFields} onVariableClick={handleVariableClick} />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t\t<SettingInput name=\"page-preview\" label=\"Preview\">\n\t\t\t\t\t\t\t\t<SearchResultPreview\n\t\t\t\t\t\t\t\t\ttitle={currentPageTitle || fallbackTitle || siteTitlePlaceholder}\n\t\t\t\t\t\t\t\t\tdescription={currentPageDescription || fallbackDescription || descriptionPlaceholder}\n\t\t\t\t\t\t\t\t\thostname={customHostname?.hostname || hostnamePlaceholder}\n\t\t\t\t\t\t\t\t\thref={customHostname ? `https://${customHostname.hostname}${currentPagePath}` : undefined}\n\t\t\t\t\t\t\t\t\tfavicon={rootWebMetadata?.favicon}\n\t\t\t\t\t\t\t\t\tfaviconDark={rootWebMetadata?.faviconDark}\n\t\t\t\t\t\t\t\t\tcollectionData={collectionData}\n\t\t\t\t\t\t\t\t\tselectedCollectionItemId={selectedCollectionItemId}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</SettingInput>\n\t\t\t\t\t\t</Stack>\n\n\t\t\t\t\t\t{collectionData && !isSmallScreen && (\n\t\t\t\t\t\t\t<CmsFieldsDescription fields={availablePlainTextFields} onVariableClick={handleVariableClick} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<PageMetadataSearchSection\n\t\t\t\t\tpage={page}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tnoIndex={currentNoIndex}\n\t\t\t\t\tnoIndexSite={currentNoIndexSite}\n\t\t\t\t\tonChangeNoIndex={handleNoIndex}\n\t\t\t\t\tonChangeNoIndexSite={handleNoIndexSite}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nfunction CmsFieldsDescription({\n\tfields,\n\tonVariableClick,\n}: {\n\tfields: string[]\n\tonVariableClick: (variable: string) => void\n}) {\n\treturn (\n\t\t<InlineDocumentation>\n\t\t\tPlain text values from the CMS can be used for the title & description.\n\t\t\t{fields.length > 0 && (\n\t\t\t\t<>\n\t\t\t\t\t{\" \"}\n\t\t\t\t\tAvailable variables: <ClickableVariables variables={fields} onVariableClick={onVariableClick} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</InlineDocumentation>\n\t)\n}\n", "import \"SearchResultPreview.styles_191x9cs.wyw.css\"; export const wrapper = \"wrapper_w1rcgk0h\";\nexport const title = \"title_t4jmx8y\";\nexport const titleLink = \"titleLink_tu9hgn0\";\nexport const description = \"description_dcm3sjx\";\nexport const domain = \"domain_d1rodue\";\nexport const favicon = \"favicon_f10bew8k\";", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { Stack } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport engine from \"document/engine.ts\"\nimport { useDarkMode } from \"web/lib/useDarkMode.ts\"\nimport * as styles from \"./SearchResultPreview.styles.ts\"\nimport { convertTemplateVariableToCollectionItemValues } from \"./templateVariables.ts\"\n\ninterface Props {\n\ttitle: string\n\tdescription: string\n\thostname: string\n\thref?: string\n\tfavicon?: string\n\tfaviconDark?: string\n\tcollectionData: DataDefinition | null\n\tselectedCollectionItemId: string | undefined\n}\n\nexport function SearchResultPreview({\n\ttitle,\n\tdescription,\n\thostname,\n\thref,\n\tfavicon,\n\tfaviconDark,\n\tcollectionData,\n\tselectedCollectionItemId,\n}: Props) {\n\tconst { isDarkMode } = useDarkMode()\n\tconst resolvedFavicon = isDarkMode ? faviconDark || favicon : favicon || faviconDark\n\n\tconst titleContent = convertTemplateVariableToCollectionItemValues(\n\t\tengine,\n\t\t\"name\",\n\t\ttitle,\n\t\tcollectionData,\n\t\tselectedCollectionItemId,\n\t)\n\n\treturn (\n\t\t<Stack className={styles.wrapper} gap={5}>\n\t\t\t<Stack className={styles.domain} direction=\"row\" gap={5} alignItems=\"center\">\n\t\t\t\t{resolvedFavicon && (\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={resolveImage(resolvedFavicon)}\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\tclassName={styles.favicon}\n\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<div>{hostname}</div>\n\t\t\t</Stack>\n\t\t\t<Stack gap={5}>\n\t\t\t\t{href ? (\n\t\t\t\t\t<a href={href} target=\"_blank\" rel=\"noopener noreferrer\" className={cx(styles.title, styles.titleLink)}>\n\t\t\t\t\t\t{titleContent}\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<div className={styles.title}>{titleContent}</div>\n\t\t\t\t)}\n\t\t\t\t<div className={styles.description}>\n\t\t\t\t\t{convertTemplateVariableToCollectionItemValues(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\"name\",\n\t\t\t\t\t\tdescription,\n\t\t\t\t\t\tcollectionData,\n\t\t\t\t\t\tselectedCollectionItemId,\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { TextArea } from \"@framerjs/fresco\"\nimport { isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport { cx } from \"@linaria/core\"\nimport { forwardRef } from \"react\"\nimport { SettingInput } from \"./SettingInput.tsx\"\nimport * as styles from \"./SettingTextArea.styles.ts\"\nimport {\n\ttype ReplaceTextAtSelectionImperativeHandle,\n\tuseReplaceTextAtSelectionImperativeHandle,\n} from \"./useReplaceTextAtSelectionImperativeHandle.ts\"\n\ninterface Props {\n\t/* Unique prop/name that will be used as the input id and the form value key */\n\tname: string\n\t/* Displayed label for the input */\n\tlabel: string\n\t/* Enabled by default */\n\tenabled: boolean\n\tdefaultValue?: string\n\tplaceholder?: string\n\tmaxLength?: number\n\tonChange: (value: string) => void\n\twarning?: string\n\tdescription?: JSX.Element | null\n\tvariant?: \"legacy\" | \"redesign\"\n\tonFocus?: () => void\n\t\"aria-describedby\"?: string\n}\n\nexport type SettingTextAreaRef = ReplaceTextAtSelectionImperativeHandle\n\nexport const SettingTextArea = forwardRef<SettingTextAreaRef, Props>(function SettingTextArea(\n\t{\n\t\tname,\n\t\tlabel,\n\t\tenabled = true,\n\t\tdefaultValue = \"\",\n\t\tplaceholder,\n\t\tmaxLength,\n\t\tonChange,\n\t\twarning,\n\t\tdescription,\n\t\tvariant,\n\t\tonFocus,\n\t\t\"aria-describedby\": ariaDescribedBy,\n\t},\n\tref,\n) {\n\tconst textAreaRef = useReplaceTextAtSelectionImperativeHandle<HTMLTextAreaElement>(ref)\n\n\treturn (\n\t\t<SettingInput name={name} label={label} warning={warning} description={description} variant={variant}>\n\t\t\t<TextArea\n\t\t\t\tref={textAreaRef}\n\t\t\t\tid={name}\n\t\t\t\tclassName={cx(styles.textArea, !isSafari() && styles.textAreaPadding)}\n\t\t\t\tenabled={enabled}\n\t\t\t\tmaxLength={maxLength}\n\t\t\t\tonChange={onChange}\n\t\t\t\tonFocus={onFocus}\n\t\t\t\taria-describedby={ariaDescribedBy}\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tvalue={defaultValue}\n\t\t\t/>\n\t\t</SettingInput>\n\t)\n})\n", "import \"SettingTextArea.styles_rzghrm.wyw.css\"; export const textArea = \"textArea_tnrt8ks\";\nexport const textAreaPadding = \"textAreaPadding_t5ido1y\";", "import type { ComponentLoader, DataDefinition } from \"@framerjs/framer-runtime\"\nimport { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { createRouteSegment } from \"document/components/chrome/Pages/utils/createRouteSegment.ts\"\nimport { getRouteSegmentNodeByWebPageId } from \"document/components/chrome/Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { doesPathExist, updateRouteSegmentPath } from \"document/components/chrome/Pages/utils/updateRouteSegmentPath.ts\"\nimport { showPageExistsToast } from \"document/components/chrome/shared/showPageExistsToast.ts\"\nimport {\n\tconvertTemplateVariableIdsToNames,\n\tconvertTemplateVariableNamesToIds,\n} from \"document/components/chrome/siteSettings/templateVariables.ts\"\nimport type { AnyWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { initialWebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { isNonNull, isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\n\nexport function saveMetadataChanges(engine: VekterEngine): void {\n\tif (engine.stores.siteSettingsStore.active?.tab === SiteSettingsTabNames.page) {\n\t\tsavePageMetadata(engine)\n\t} else {\n\t\tsaveSiteMetadata(engine)\n\t}\n}\n\nexport function saveSiteMetadata(engine: VekterEngine): void {\n\tif (getIsViewOnly(engine, \"canEditSiteSettings\")) return\n\n\tconst metadataUpdate = engine.stores.siteSettingsStore.getMetadataUpdate()\n\tassert(metadataUpdate.metadata, \"Site metadata should have changed to be able to save\")\n\n\tconst rootWebMetadata = engine.stores.treeStore.tree.root.webMetadata\n\tconst newMetadata = { ...rootWebMetadata, ...metadataUpdate.metadata }\n\n\t/**\n\t * If the title is an empty string (deleted), unset the site title to\n\t * undefined, so that pages will pick up their node name as a fallback\n\t * instead of using an empty string.\n\t */\n\tif (newMetadata.title === \"\") newMetadata.title = undefined\n\tif (newMetadata.description === \"\") newMetadata.description = undefined\n\n\tconst updateWebMetadata = engine.scheduler.wrapHandler((newMetadata: WebMetadata) => {\n\t\tengine.tree.root.set({ webMetadata: newMetadata }, engine.tree)\n\t})\n\tupdateWebMetadata(newMetadata)\n\n\trecord(\"site_settings_change\", {\n\t\ttitle: isNonNull(engine.stores.siteSettingsStore.metadataChanges.title),\n\t\tdescription: isNonNull(engine.stores.siteSettingsStore.metadataChanges.description),\n\t\treducedMotion: isNonNull(engine.stores.siteSettingsStore.metadataChanges.reducedMotion),\n\t\tlanguage: isNonNull(engine.stores.siteSettingsStore.metadataChanges.language),\n\t\tfavicon: false,\n\t\tsocialImage: false,\n\t\tappleTouchIcon: false,\n\t})\n\n\tengine.stores.siteSettingsStore.clearMetadataChanges()\n}\n\nexport function savePageMetadata(engine: VekterEngine): void {\n\tif (getIsViewOnly(engine, \"canEditSiteSettings\")) return\n\n\tassert(\n\t\tengine.stores.siteSettingsStore.active?.tab === SiteSettingsTabNames.page,\n\t\t\"Should not call savePageMetaData when a page is not selected\",\n\t)\n\n\tconst updateWebMetadata = engine.scheduler.wrapHandler((page: AnyWebPageNode, newMetadata: WebMetadata) => {\n\t\tengine.tree.current(page)?.set({ webMetadata: newMetadata })\n\t})\n\n\tconst pageId = engine.stores.siteSettingsStore.active.id\n\tconst page = engine.stores.treeStore.tree.getNodeWithTrait(pageId, isWebPageNode)\n\n\tif (!page) return\n\n\tengine.scheduler.wrapHandler(() => {\n\t\tconst metadataUpdate = engine.stores.siteSettingsStore.getMetadataUpdate()\n\t\tconst metadataChanges = engine.stores.siteSettingsStore.metadataChanges\n\n\t\tconst collectionData = engine.componentLoader.dataForIdentifier(page.dataIdentifier)\n\t\tconst initialValues = getInitialPageMetadata(page.webMetadata, collectionData, engine.componentLoader)\n\t\tconst currentNoIndexSite = metadataChanges.noIndexSite ?? initialValues.noIndexSite ?? initialValues.noIndex\n\n\t\tif (metadataUpdate.metadata) {\n\t\t\tconst newMetadata = { ...page.webMetadata, ...metadataUpdate.metadata }\n\t\t\t/**\n\t\t\t * If the title is an empty string (deleted), unset the page title to\n\t\t\t * undefined, so that it will pick up the site title or the node name\n\t\t\t * as a fallback.\n\t\t\t */\n\t\t\tif (isString(newMetadata.title)) {\n\t\t\t\tnewMetadata.title = convertVariableNamesToIdsAndEmptyStringToUndefined(\n\t\t\t\t\tnewMetadata.title,\n\t\t\t\t\tcollectionData,\n\t\t\t\t\tengine.componentLoader,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (isString(newMetadata.description)) {\n\t\t\t\tnewMetadata.description = convertVariableNamesToIdsAndEmptyStringToUndefined(\n\t\t\t\t\tnewMetadata.description,\n\t\t\t\t\tcollectionData,\n\t\t\t\t\tengine.componentLoader,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (newMetadata.noIndex === false) newMetadata.noIndex = undefined\n\t\t\t// backfill noIndexSite if we dont currently have a value for the\n\t\t\t// siteIndexing stored and it is still tracking noIndex flag (which\n\t\t\t// use to govern both settings).\n\t\t\tif (\n\t\t\t\tpage.webMetadata === undefined ||\n\t\t\t\t(initialValues.noIndexSite === undefined && newMetadata.noIndexSite === undefined)\n\t\t\t) {\n\t\t\t\tnewMetadata.noIndexSite = currentNoIndexSite\n\t\t\t}\n\t\t\tupdateWebMetadata(page, newMetadata)\n\t\t}\n\n\t\tconst newPagePath = metadataUpdate.pagePath\n\t\tif (newPagePath) {\n\t\t\tif (doesPathExist(engine.tree, newPagePath, page.id)) {\n\t\t\t\treturn showPageExistsToast(Boolean(page.dataIdentifier))\n\t\t\t}\n\n\t\t\tconst routeSegmentNode = getRouteSegmentNodeByWebPageId(engine.tree, page.id)\n\t\t\tlet segmentId: NodeID\n\t\t\tif (routeSegmentNode) {\n\t\t\t\tsegmentId = routeSegmentNode.id\n\t\t\t} else {\n\t\t\t\t// engine.stores.siteSettingsStore.situation can occur when the web page loses its corresponding route segment node (e.g. multiplayer actions)\n\t\t\t\t// To recover from engine.stores.siteSettingsStore.state, we create a new route segment node.\n\t\t\t\tsegmentId = createRouteSegment(engine.tree, engine.componentLoader, page, page.dataIdentifier, newPagePath).id\n\t\t\t}\n\n\t\t\tupdateRouteSegmentPath(segmentId, newPagePath, engine.tree, engine.componentLoader)\n\t\t}\n\n\t\trecord(\"page_settings_change\", {\n\t\t\ttitle: isNonNull(engine.stores.siteSettingsStore.metadataChanges.title),\n\t\t\tpath: isNonNull(engine.stores.siteSettingsStore.pagePath),\n\t\t\tdescription: isNonNull(engine.stores.siteSettingsStore.metadataChanges.description),\n\t\t\tnoIndex: isNonNull(engine.stores.siteSettingsStore.metadataChanges.noIndex),\n\t\t\tnoIndexSite: isNonNull(engine.stores.siteSettingsStore.metadataChanges.noIndexSite),\n\t\t\tkeywords: false,\n\t\t\tsocialImage: false,\n\t\t})\n\n\t\tengine.stores.siteSettingsStore.clearMetadataChanges()\n\t})()\n}\n\nexport function getInitialPageMetadata(\n\twebMetadata: WebMetadata | undefined,\n\tcollectionData: DataDefinition | null,\n\tcomponentLoader: ComponentLoader,\n): Required<Pick<WebMetadata, \"title\" | \"description\" | \"noIndex\">> & Pick<WebMetadata, \"noIndexSite\"> {\n\tif (!webMetadata) {\n\t\treturn {\n\t\t\ttitle: initialWebMetadata.title,\n\t\t\tdescription: initialWebMetadata.description,\n\t\t\tnoIndex: false,\n\t\t\tnoIndexSite: false,\n\t\t}\n\t}\n\treturn {\n\t\ttitle: webMetadata.title\n\t\t\t? convertTemplateVariableIdsToNames(webMetadata.title, collectionData, componentLoader)\n\t\t\t: initialWebMetadata.title,\n\t\tdescription: webMetadata.description\n\t\t\t? convertTemplateVariableIdsToNames(webMetadata.description, collectionData, componentLoader)\n\t\t\t: initialWebMetadata.description,\n\t\tnoIndex: webMetadata.noIndex ?? false,\n\t\t// Use undefined as if its not set, so that the checkbox mirrors\n\t\t// `noIndex` in those cases. This is so that initial implementation\n\t\t// doesn't break when adding the new noIndexSite field.\n\t\tnoIndexSite: webMetadata.noIndexSite,\n\t}\n}\n\nfunction convertVariableNamesToIdsAndEmptyStringToUndefined(\n\tvalue: string,\n\tcollectionData: DataDefinition | null,\n\tcomponentLoader: ComponentLoader,\n): string | undefined {\n\tif (value.length === 0) return undefined\n\treturn convertTemplateVariableNamesToIds(value, collectionData, componentLoader)\n}\n", "import type { DataDefinition } from \"@framerjs/framer-runtime\"\nimport { Button, CenterChild, IconInputDropdown, Stack, T, Toggle, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { dimensions } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { useDataForIdentifier } from \"document/components/utils/useDataForIdentifier.ts\"\nimport engine from \"document/engine.ts\"\nimport type { AnyWebPageNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tcreateComputedValue,\n\tisComputedValue,\n\tisComputedValueFromVariableReference,\n} from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { createVariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type { VariableID } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { createNegateTransform } from \"document/models/CanvasTree/traits/utils/valueTransformUtils.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { memo, useMemo } from \"react\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport * as inputStyles from \"../SettingInput.styles.ts\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport * as styles from \"./PageMetadataSearchSection.styles.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\tpage: AnyWebPageNode\n\tnoIndex: boolean | DynamicValue\n\tnoIndexSite: boolean | DynamicValue\n\tonChangeNoIndex: (noIndex: boolean | DynamicValue) => void\n\tonChangeNoIndexSite: (noIndexSite: boolean | DynamicValue) => void\n}\n\nexport const PageMetadataSearchSection = memo<Props>(function PageMetadataSearchSection({\n\tpage,\n\tisViewOnly,\n\tnoIndex,\n\tnoIndexSite,\n\tonChangeNoIndex,\n\tonChangeNoIndexSite,\n}) {\n\tconst hasCollectionData = hasCollectionDataSource(page)\n\n\tconst collectionData = useDataForIdentifier(page.dataIdentifier)\n\tconst availableBooleanFields = useMemo(() => getAvailableBooleanFields(collectionData), [collectionData])\n\n\tif (hasCollectionData) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={inputStyles.toggleRow}>\n\t\t\t\t\t<Stack gap={5} className={inputStyles.wrapper}>\n\t\t\t\t\t\t<span className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Search Engines</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Tell search engines to index and show items in their search results.</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<BooleanPicker\n\t\t\t\t\t\taria-label=\"Search Engines\"\n\t\t\t\t\t\tvalue={noIndex}\n\t\t\t\t\t\twebPageId={page.id}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tonChange={onChangeNoIndex}\n\t\t\t\t\t\tavailableBooleanFields={availableBooleanFields}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={inputStyles.toggleRow}>\n\t\t\t\t\t<Stack gap={5} className={inputStyles.wrapper}>\n\t\t\t\t\t\t<span className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Site Search</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Show this item in your site search results.</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<BooleanPicker\n\t\t\t\t\t\taria-label=\"Site Search\"\n\t\t\t\t\t\tvalue={noIndexSite}\n\t\t\t\t\t\twebPageId={page.id}\n\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\tonChange={onChangeNoIndexSite}\n\t\t\t\t\t\tavailableBooleanFields={availableBooleanFields}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\t\t\t</>\n\t\t)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={inputStyles.toggleRow}>\n\t\t\t\t<Stack gap={5} className={inputStyles.wrapper}>\n\t\t\t\t\t<label htmlFor=\"show-in-search-engines\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t<T>Search Engines</T>\n\t\t\t\t\t</label>\n\t\t\t\t\t<span id=\"show-in-search-engines-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t<T>Tell search engines to index and show this page in their search results.</T>\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t\t<Toggle\n\t\t\t\t\tid=\"show-in-search-engines\"\n\t\t\t\t\tsmall\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tvalue={noIndex !== true}\n\t\t\t\t\tonChange={checked => onChangeNoIndex(!checked)}\n\t\t\t\t\taria-describedby=\"show-in-search-engines-description\"\n\t\t\t\t/>\n\t\t\t</Stack>\n\n\t\t\t<Separator height={1} />\n\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={inputStyles.toggleRow}>\n\t\t\t\t<Stack gap={5} className={inputStyles.wrapper}>\n\t\t\t\t\t<label htmlFor=\"show-in-site-search\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t<T>Site Search</T>\n\t\t\t\t\t</label>\n\t\t\t\t\t<span id=\"show-in-site-search-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t<T>Show this page in your site search results.</T>\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t\t<Toggle\n\t\t\t\t\tid=\"show-in-site-search\"\n\t\t\t\t\tsmall\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tvalue={noIndexSite !== true}\n\t\t\t\t\tonChange={checked => onChangeNoIndexSite(!checked)}\n\t\t\t\t\taria-describedby=\"show-in-site-search-description\"\n\t\t\t\t/>\n\t\t\t</Stack>\n\n\t\t\t<Separator height={1} />\n\t\t</>\n\t)\n})\n\nfunction getBooleanOptionTitle(booleanField: BooleanField, isNegated: boolean): string {\n\t// It's confusing that the negated option doesn't get the \"Not\" prefix. But that's because the\n\t// value is assigned to noIndex or noIndexSite while the UI uses the non negated term of search\n\t// enabled.\n\treturn isNegated ? `If ${booleanField.name}` : `If Not ${booleanField.name}`\n}\n\nfunction BooleanPicker({\n\twebPageId,\n\tvalue,\n\tonChange,\n\tisViewOnly,\n\tavailableBooleanFields,\n\t\"aria-label\": ariaLabel,\n}: {\n\twebPageId: NodeID\n\tvalue: boolean | DynamicValue\n\tisViewOnly: boolean\n\tonChange: (value: boolean | DynamicValue) => void\n\tavailableBooleanFields: readonly BooleanField[]\n\t\"aria-label\"?: string\n}) {\n\tconst selectedBooleanField = getSelectedBooleanField(value, availableBooleanFields)\n\tconst selectedBooleanFieldNotFound = isDynamicValue(value) && !selectedBooleanField\n\tconst isNegated = selectedVariableIsNegated(value)\n\n\tconst menuOptions = useMemo<MenuItemOptions[]>(() => {\n\t\tconst options: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Always\",\n\t\t\t\tchecked: value === false,\n\t\t\t\tclick: () => onChange(false),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Never\",\n\t\t\t\tchecked: value === true || selectedBooleanFieldNotFound,\n\t\t\t\tclick: () => onChange(true),\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t]\n\n\t\tif (availableBooleanFields.length === 0) {\n\t\t\toptions.push({ label: \"No Variables\", enabled: false })\n\t\t} else {\n\t\t\toptions.push({\n\t\t\t\tlabel: \"CMS Variables\",\n\t\t\t\tsubmenu: availableBooleanFields.flatMap(booleanField => [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: getBooleanOptionTitle(booleanField, true),\n\t\t\t\t\t\tchecked: booleanField === selectedBooleanField && isNegated,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tconst variableReference = createVariableReference(booleanField.id, webPageId)\n\t\t\t\t\t\t\tconst computedValue = createComputedValue(ControlType.Boolean, variableReference, [\n\t\t\t\t\t\t\t\tcreateNegateTransform(),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tonChange(computedValue)\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: getBooleanOptionTitle(booleanField, false),\n\t\t\t\t\t\tchecked: booleanField === selectedBooleanField && !isNegated,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tconst variableReference = createVariableReference(booleanField.id, webPageId)\n\t\t\t\t\t\t\tonChange(variableReference)\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\treturn options\n\t}, [\n\t\tvalue,\n\t\tselectedBooleanField,\n\t\tselectedBooleanFieldNotFound,\n\t\tisNegated,\n\t\tavailableBooleanFields,\n\t\twebPageId,\n\t\tonChange,\n\t])\n\n\tconst showMenu = (event: React.MouseEvent) => {\n\t\tconst bounds = event.currentTarget.getBoundingClientRect()\n\t\tengine.stores.contextMenuStore.show(menuOptions, {\n\t\t\tlocation: { x: bounds.left + dimensions.values.contextMenuOffsetX, y: bounds.bottom },\n\t\t})\n\t}\n\n\tconst selectedOptionLabel = useMemo<string>(() => {\n\t\tconst firstCheckedOption = findFirstCheckedOption(menuOptions)\n\t\tassert(firstCheckedOption, \"The menu should contain exactly one checked option\")\n\t\tassert(firstCheckedOption.label, \"The selected option should have a label\")\n\t\treturn firstCheckedOption.label\n\t}, [menuOptions])\n\n\treturn (\n\t\t<Button\n\t\t\tenabled={!isViewOnly}\n\t\t\tonClick={showMenu}\n\t\t\tclassName={styles.button}\n\t\t\taria-label={ariaLabel}\n\t\t\taria-haspopup=\"menu\"\n\t\t>\n\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" gap={6}>\n\t\t\t\t<span className={truncateWithEllipsis}>{selectedOptionLabel}</span>\n\t\t\t\t<CenterChild>\n\t\t\t\t\t<IconInputDropdown />\n\t\t\t\t</CenterChild>\n\t\t\t</Stack>\n\t\t</Button>\n\t)\n}\n\ninterface BooleanField {\n\tid: VariableID\n\tname: string\n}\n\nfunction getAvailableBooleanFields(collectionData: DataDefinition | null): readonly BooleanField[] {\n\tconst availableBooleanFields: BooleanField[] = []\n\tif (!collectionData) return availableBooleanFields\n\n\tfor (const controlKey in collectionData.properties) {\n\t\tconst control = collectionData.properties[controlKey]\n\t\tif (control?.type !== ControlType.Boolean) continue\n\n\t\tavailableBooleanFields.push({\n\t\t\tid: controlKey,\n\t\t\tname: control.title ?? controlKey,\n\t\t})\n\t}\n\n\treturn availableBooleanFields\n}\n\nfunction findFirstCheckedOption(options: MenuItemOptions[]): MenuItemOptions | undefined {\n\tfor (const option of options) {\n\t\tif (option.checked) {\n\t\t\treturn option\n\t\t}\n\t\tif (Array.isArray(option.submenu)) {\n\t\t\tconst selectedOption = findFirstCheckedOption(option.submenu)\n\t\t\tif (selectedOption) return selectedOption\n\t\t}\n\t}\n}\n\nfunction getSelectedBooleanField(\n\tvalue: boolean | DynamicValue | undefined,\n\tavailableBooleanFields: readonly BooleanField[],\n): BooleanField | undefined {\n\tif (!isDynamicValue(value)) return undefined\n\n\tlet variableReference: VariableReference\n\n\tif (isVariableReference(value)) {\n\t\tvariableReference = value\n\t} else if (isComputedValue(value)) {\n\t\tassert(isComputedValueFromVariableReference(value), \"Fetch is not supported for no index\")\n\t\tvariableReference = value.startValue\n\t} else {\n\t\tassertNever(value)\n\t}\n\n\treturn availableBooleanFields.find(field => field.id === variableReference.id)\n}\n\nfunction selectedVariableIsNegated(value: boolean | DynamicValue | undefined): boolean {\n\tif (!isComputedValue(value)) return false\n\n\tlet result = false\n\n\tfor (const transform of value.transforms) {\n\t\tif (transform.name === \"negate\") {\n\t\t\tresult = !result\n\t\t}\n\t}\n\n\treturn result\n}\n", "import \"PageMetadataSearchSection.styles_1rioo2b.wyw.css\"; export const button = \"button_b1alri9j\";", "import { Stack } from \"@framerjs/fresco\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { SocialImageSectionForCMSPage } from \"../SiteImages/SocialImageSectionForCMSPage.tsx\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport { PageMetadata } from \"./PageMetadata.tsx\"\n\ninterface Props {\n\tid: NodeID\n}\n\nexport function PageSettings({ id }: Props) {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst customHostname = engine.stores.publishStore.useState(state => state.customHostname)\n\n\tconst { rootWebMetadata } = useDeprecatedEngineState(EngineChange.Tree, () => ({\n\t\trootWebMetadata: engine.tree.root.webMetadata,\n\t}))\n\n\tconst { homePageNodeId, webPages } = useDeprecatedEngineState([EngineChange.TreeStore, EngineChange.Tree], () => ({\n\t\thomePageNodeId: engine.tree.root.homePageNodeId,\n\t\twebPages: engine.stores.scopeStore.getWebPageNodes(),\n\t}))\n\n\tconst selectedWebPage = webPages.find(webPage => webPage.id === id)?.loaded\n\tconst homePage = webPages.find(page => page.id === homePageNodeId)\n\n\tif (!selectedWebPage) return null\n\n\tconst isHomePage = homePage?.id === selectedWebPage.id\n\n\treturn (\n\t\t<Stack gap={30} className={siteSettingsStyles.wideContainer}>\n\t\t\t<PageMetadata\n\t\t\t\tisHomePage={isHomePage}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tpage={selectedWebPage}\n\t\t\t\trootWebMetadata={rootWebMetadata}\n\t\t\t\tcustomHostname={customHostname}\n\t\t\t/>\n\t\t\t<SocialImageSectionForCMSPage isViewOnly={isViewOnly} page={selectedWebPage} />\n\t\t</Stack>\n\t)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { SitePlansStatus } from \"document/stores/PaymentsStore.ts\"\nimport { useMemo } from \"react\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages } from \"web/lib/tracker.ts\"\nimport { Loading } from \"../../shared/Loading.tsx\"\nimport { Plans as Enterprise } from \"./Enterprise/Plans.tsx\"\nimport { Plans as Stripe } from \"./Stripe/Plans.tsx\"\nimport { PlainErrorBody, PlansError, StandardErrorBody } from \"./Stripe/components/PlansError.tsx\"\nimport { RedirectFromStripeSuccess } from \"./Stripe/components/RedirectFromStripeSuccess.tsx\"\nimport { useResourceCounts } from \"./Stripe/utils/resourceCounts.ts\"\nimport type { UpsellFeature } from \"./Stripe/utils/upsell.ts\"\nimport { determineUpsell } from \"./Stripe/utils/upsell.ts\"\nimport { removeAddOnQueryParams, removePlanQueryParams } from \"./usePlanQueryParam.ts\"\nimport { useSitePlans } from \"./useSitePlans.ts\"\n\ninterface Props {\n\tupsellFeature?: UpsellFeature\n}\n\nexport function Plans({ upsellFeature }: Props) {\n\tconst [sitePlansState, refreshSitePlans] = useSitePlans()\n\tconst resourceCounts = useResourceCounts()\n\n\tuseRecordEffect(\"ui_impression\", { page: Pages.siteSettingsPlans })\n\n\tconst upsell = useMemo(() => determineUpsell(upsellFeature ?? null, resourceCounts), [upsellFeature, resourceCounts])\n\n\tswitch (sitePlansState.status) {\n\t\tcase SitePlansStatus.Loading:\n\t\t\treturn <Loading />\n\t\tcase SitePlansStatus.EnterprisePlan:\n\t\t\treturn <Enterprise />\n\t\tcase SitePlansStatus.DraftProjectError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorDraftProject}\n\t\t\t\t\tbody={<PlainErrorBody message=\"Please move your project to a workspace before upgrading a plan.\" />}\n\t\t\t\t\tbackToPlans={refreshSitePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase SitePlansStatus.UnauthorizedError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorUserUnauthorized}\n\t\t\t\t\ttitle=\"Unauthorized\"\n\t\t\t\t\tbody={<PlainErrorBody message=\"Only workspace editors can access plans.\" />}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase SitePlansStatus.FailedToFetchSubscriptionsError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorLoadingProvider}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error fetching your subscriptions.\" />}\n\t\t\t\t\tbackToPlans={refreshSitePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase SitePlansStatus.Stripe:\n\t\t\treturn <Stripe {...sitePlansState} upsellFeature={upsell} refreshSitePlans={refreshSitePlans} />\n\t\tcase SitePlansStatus.RedirectedFromStripe:\n\t\t\treturn (\n\t\t\t\t<RedirectFromStripeSuccess\n\t\t\t\t\tcurrentSitePlanType={sitePlansState.currentProjectLicenseType}\n\t\t\t\t\tcurrentTeamPlanType={sitePlansState.currentTeamLicenseType}\n\t\t\t\t\tcurrency={sitePlansState.currentTeamSubscription?.currency}\n\t\t\t\t\tcurrentSiteBillingPeriod={sitePlansState.billingPeriod}\n\t\t\t\t\tonReset={() => {\n\t\t\t\t\t\tremovePlanQueryParams()\n\t\t\t\t\t\tremoveAddOnQueryParams()\n\t\t\t\t\t\tvoid refreshSitePlans()\n\t\t\t\t\t}}\n\t\t\t\t\tteamCurrentEditors={sitePlansState.teamCurrentEditors}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase SitePlansStatus.RedirectedFromStripePollingError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorStripePollingError}\n\t\t\t\t\tbody={<StandardErrorBody message=\"Plan activation is taking longer than expected.\" />}\n\t\t\t\t\ttryAgain={refreshSitePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(sitePlansState, \"Unexpected site plans state\")\n\t}\n}\n", "import \"Plans.styles_1nkcu3i.wyw.css\"; export const container = \"container_c2m7vr9\";\nexport const settingsSection = \"settingsSection_s15dt2c7\";\nexport const title = \"title_t1dn6suy\";\nexport const paragraph = \"paragraph_p1ykxcbe\";\nexport const enterpriseIconWrapper = \"enterpriseIconWrapper_e15qu4vn\";\nexport const transparent = \"transparent_t1nxnto8\";", "import { IconEnterprise, Link, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as siteSettingStyles from \"../../SiteSettings.styles.ts\"\nimport * as styles from \"./Plans.styles.ts\"\n\nexport function Plans() {\n\tuseRecordEffect(\"ui_impression\", { page: Pages.siteSettingsPlansEnterprise })\n\n\treturn (\n\t\t<Stack className={cx(styles.settingsSection, styles.transparent)} justifyContent=\"center\" alignItems=\"center\">\n\t\t\t<Stack\n\t\t\t\tgap={15}\n\t\t\t\tjustifyContent=\"center\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tstyle={{ alignSelf: \"center\" }}\n\t\t\t\tclassName={styles.container}\n\t\t\t>\n\t\t\t\t<Stack justifyContent=\"center\" alignItems=\"center\" className={styles.enterpriseIconWrapper}>\n\t\t\t\t\t<IconEnterprise />\n\t\t\t\t</Stack>\n\t\t\t\t<h1 className={siteSettingStyles.sectionTitle}>\n\t\t\t\t\t<T>Enterprise</T>\n\t\t\t\t</h1>\n\t\t\t\t<p className={styles.paragraph}>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tYour workspace is on an Enterprise plan, please reach out to your account manager for any billing-related\n\t\t\t\t\t\tqueries. To view your invoices, please\n\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t<Link\n\t\t\t\t\t\thref=\"https://billing.stripe.com/p/login/6oE6oR5Y8bdLagE6oo\"\n\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\tpage: Pages.siteSettingsPlansEnterprise,\n\t\t\t\t\t\t\t\tid: UIInteraction.openWebsiteStripeBillingLogin,\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\tlogin here.\n\t\t\t\t\t</Link>\n\t\t\t\t</p>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import type { ProjectSettingsResourceLimits } from \"@framerjs/app-config\"\nimport type { PaidProjectLicenseType } from \"@framerjs/app-shared\"\nimport {\n\tAddOnLicenseType,\n\tProjectLicensePeriod,\n\tProjectLicenseType,\n\tTeamLicenseType,\n\tdashboardPath,\n\tgetAddOnLicenseTypeName,\n\tgetProjectLicenseName,\n\tisBusinessLicenseType,\n\tisLicenseType2025,\n\tisPaidLicenseType,\n\tisPersonalLicenseType,\n\tisSiteLicenseGreater,\n\topenNewTab,\n} from \"@framerjs/app-shared\"\nimport { Button, Link, Stack, T, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { assert, assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { format } from \"date-fns\"\nimport { useIsBillingV3 } from \"document/components/chrome/siteSettings/Plans/Stripe/hooks/useIsBillingV3.ts\"\nimport engine from \"document/engine.ts\"\nimport { StripePlansStatus } from \"document/stores/PaymentsStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React from \"react\"\nimport { pricingURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useTrackVantaraEventCallback, useTrackVantaraEventEffect } from \"web/lib/vantara/app.ts\"\nimport type { PollResponse } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { Tab } from \"web/pages/projects/components/settings/team/types.ts\"\nimport { Loading } from \"../../../shared/Loading.tsx\"\nimport * as siteSettingStyles from \"../../SiteSettings.styles.ts\"\nimport {\n\tgetAddOnLicenseTypeParam,\n\tremoveAddOnQueryParams,\n\tremovePlanQueryParams,\n\tshouldOpenAddOnCancellationModal,\n\tshouldOpenPlanCancellationModal,\n} from \"../usePlanQueryParam.ts\"\nimport * as styles from \"./Plans.styles.ts\"\nimport { confirmCancelAddOn } from \"./addOns/confirmCancelAddOn.ts\"\nimport { getAddOnViewUrl } from \"./addOns/getAddOnViewUrl.ts\"\nimport type { LicenseSettings, PaidLicenseSettings, PlanPrice } from \"./api/licenseSettings.ts\"\nimport { isPaidLicenseSettings } from \"./api/licenseSettings.ts\"\nimport type { CurrentAddOn, CurrentSiteSubscription, PollUpdateProps } from \"./api/subscriptions.ts\"\nimport { SubscriptionStatus, getBillingPortalUrl } from \"./api/subscriptions.ts\"\nimport type { CurrentTeamSubscription } from \"./api/teamSubscription.ts\"\nimport { LegacyPlanContainer, ReactivatePastDuePlanContainer } from \"./components/CurrentPlanAction.tsx\"\nimport { CurrentPlanDescription } from \"./components/CurrentPlanDescription.tsx\"\nimport { DomainVoucherBadge } from \"./components/DomainVoucherBadge.tsx\"\nimport { PlanFeatures } from \"./components/PlanFeatures.tsx\"\nimport {\n\tAnnualOnly,\n\tDisplayPrice,\n\tEnterpriseCard,\n\tOverLimitsButton,\n\tPeriodToggle,\n\tPlanBadge,\n\tPlanButton,\n\tPlansCard,\n} from \"./components/PlansCard.tsx\"\nimport { PlansCardAddOns } from \"./components/PlansCardAddOns.tsx\"\nimport { PlainErrorBody, PlansError, RefreshErrorBody, StandardErrorBody } from \"./components/PlansError.tsx\"\nimport { CheckoutSuccessOperation, PlansSuccess } from \"./components/PlansSuccess.tsx\"\nimport { Preview } from \"./components/Preview.tsx\"\nimport { useShouldShowDomainVoucherBadge } from \"./hooks/useShouldShowDomainVoucherBadge.ts\"\nimport { useStripePlans } from \"./useStripePlans.ts\"\nimport { canToggleBillingPeriod } from \"./utils/canToggleBillingPeriod.ts\"\nimport { formatDisplayPrice } from \"./utils/formatDisplayPrice.ts\"\nimport { showReactivatePlanToast } from \"./utils/reactivatePlanToast.ts\"\nimport type { ResourceCounts } from \"./utils/resourceCounts.ts\"\nimport { useResourceCounts } from \"./utils/resourceCounts.ts\"\nimport { getResourceLimits } from \"./utils/resourceLimits.ts\"\nimport { UpsellFeature, getRecommendedLicenseType } from \"./utils/upsell.ts\"\nimport { FeatureFlagKey, getFeatureFlagTooltipText, validateFeatureFlags } from \"./utils/validateFeatureFlags.ts\"\nimport {\n\tResourceLimitKey,\n\tgetResourceLimitsTooltipText,\n\tvalidateResourceLimits,\n} from \"./utils/validateResourceLimits.ts\"\n\nexport interface Props {\n\tupsellFeature: UpsellFeature | null\n\tprojectId: string\n\tteamId: string\n\tcurrentTeamSubscription: CurrentTeamSubscription | null\n\tcurrentSiteSubscription: CurrentSiteSubscription | null\n\tteamCurrentEditors: number\n\tteamHasPastDueSubscriptions: boolean\n\tcurrentProjectLicenseType: Exclude<ProjectLicenseType, ProjectLicenseType.EnterpriseSite>\n\tcurrentTeamLicenseType: Exclude<TeamLicenseType, TeamLicenseType.EnterprisePlan>\n\tcurrentAddOns: CurrentAddOn[]\n\trefreshSitePlans: () => Promise<void>\n\trefreshSubscriptions: () => Promise<void>\n\tpollSubscriptionsUpdate: (newProps: PollUpdateProps) => Promise<void>\n\tpollProjectLicenseUpdate: (licenseType: ProjectLicenseType) => Promise<PollResponse>\n}\n\nexport function Plans(props: Props) {\n\tconst {\n\t\tupsellFeature,\n\t\trefreshSitePlans,\n\t\trefreshSubscriptions,\n\t\tpollSubscriptionsUpdate,\n\t\tpollProjectLicenseUpdate,\n\t\tcurrentProjectLicenseType,\n\t\tcurrentSiteSubscription,\n\t\tcurrentTeamSubscription,\n\t\tcurrentTeamLicenseType,\n\t\tteamHasPastDueSubscriptions,\n\t\tprojectId,\n\t\tteamId,\n\t\tteamCurrentEditors,\n\t\tcurrentAddOns,\n\t} = props\n\tconst isBillingV3 = useIsBillingV3()\n\tconst { state, previewPlan, reactivatePlan, cancelPreview, purchasePlan, refreshStripePlans } = useStripePlans({\n\t\tprojectId,\n\t\tteamId,\n\t\tcurrentProjectLicenseType,\n\t\tcurrentTeamSubscription,\n\t\tcurrentSiteSubscription,\n\t\tpollSubscriptionsUpdate,\n\t\tpollProjectLicenseUpdate,\n\t\trefreshSitePlans,\n\t\tisBillingV3,\n\t})\n\n\tswitch (state.status) {\n\t\tcase StripePlansStatus.Loading:\n\t\t\treturn <Loading />\n\t\tcase StripePlansStatus.Plans:\n\t\tcase StripePlansStatus.LoadingPreview:\n\t\tcase StripePlansStatus.Reactivating:\n\t\t\treturn (\n\t\t\t\t<PlansInner\n\t\t\t\t\tupsellFeature={upsellFeature}\n\t\t\t\t\tprojectId={projectId}\n\t\t\t\t\tteamId={teamId}\n\t\t\t\t\tlicensesSettings={state.licensesSettings}\n\t\t\t\t\tcurrentProjectLicenseType={currentProjectLicenseType}\n\t\t\t\t\tcurrentSiteSubscription={currentSiteSubscription}\n\t\t\t\t\tcurrentAddOns={currentAddOns}\n\t\t\t\t\tcurrentTeamLicenseType={currentTeamLicenseType}\n\t\t\t\t\tteamHasPastDueSubscriptions={teamHasPastDueSubscriptions}\n\t\t\t\t\tpreviewingProjectLicenseType={\n\t\t\t\t\t\tstate.status === StripePlansStatus.LoadingPreview || state.status === StripePlansStatus.Reactivating\n\t\t\t\t\t\t\t? state.selectedProjectLicenseType\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tpreviewPlan={previewPlan}\n\t\t\t\t\treactivatePlan={reactivatePlan}\n\t\t\t\t\trefreshSubscriptions={refreshSubscriptions}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.Preview:\n\t\tcase StripePlansStatus.ConfirmingPurchase:\n\t\tcase StripePlansStatus.UpdatingPreview:\n\t\t\treturn (\n\t\t\t\t<Preview\n\t\t\t\t\tcheckoutPreview={state.checkoutPreview}\n\t\t\t\t\tcurrentProjectLicenseType={currentProjectLicenseType}\n\t\t\t\t\tcurrentProjectPeriod={currentSiteSubscription?.period}\n\t\t\t\t\tcurrentAddOns={currentAddOns}\n\t\t\t\t\tcancelPreview={cancelPreview}\n\t\t\t\t\tpurchasePlan={purchasePlan}\n\t\t\t\t\tpreviewPlan={previewPlan}\n\t\t\t\t\tselectedPlan={state.selectedPlan}\n\t\t\t\t\tstatus={state.status}\n\t\t\t\t\tselectedAddons={state.selectedAddons}\n\t\t\t\t\tpromotionCode={state.promotionCode}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.FailedToFetchPricesError: {\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorLoadingPlans}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error fetching prices.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\t}\n\t\tcase StripePlansStatus.CheckoutSessionError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorCheckoutSession}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error generating your checkout.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.DuplicateCheckoutError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorDuplicateCheckout}\n\t\t\t\t\tbody={<RefreshErrorBody message=\"There was an error generating your checkout.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.CheckoutPreviewError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorPreviewOrder}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error generating your order.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.ReactivatePlanError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorReactivatePlan}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error reactivating your plan.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.UpdateSubscriptionError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorSubmitOrder}\n\t\t\t\t\tbody={<StandardErrorBody message=\"There was an error processing your order.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.UnauthorizedError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorUserUnauthorized}\n\t\t\t\t\ttitle=\"Unauthorized\"\n\t\t\t\t\tbody={<PlainErrorBody message=\"Only workspace editors can access plans.\" />}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.PaymentDeclinedError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorPaymentDeclined}\n\t\t\t\t\ttitle=\"Payment Declined\"\n\t\t\t\t\tbody={<PlainErrorBody message={state.message} />}\n\t\t\t\t\ttryAgain={state.tryAgain}\n\t\t\t\t\tupdatePaymentMethod={() => openNewTab(getBillingPortalUrl(teamId))}\n\t\t\t\t\tupdatePaymentMethodTitle={\n\t\t\t\t\t\tstate.reason === \"customer_tax_location_invalid\" ? \"Update Billing Address\" : \"Update Payment Method\"\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.OverEditorLimitError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorOverEditorLimit}\n\t\t\t\t\ttitle=\"Editor Limit Reached\"\n\t\t\t\t\tbody={\n\t\t\t\t\t\t<PlainErrorBody\n\t\t\t\t\t\t\tmessage={`You have ${state.currentEditorCount.toString()} editors in your workspace, which is over the limit of the plan you are trying to downgrade to. Remove some editors to downgrade your plan.`}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t\tmanageEditors={() => {\n\t\t\t\t\t\topenNewTab(`${dashboardPath}?team=${teamId}&open-settings=1&settings-tab=${Tab.Members}`)\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.OverProjectEditorLimitError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorOverProjectEditorLimit}\n\t\t\t\t\ttitle=\"Editor Limit Reached\"\n\t\t\t\t\tbody={\n\t\t\t\t\t\t<PlainErrorBody\n\t\t\t\t\t\t\tmessage={`This project has ${state.currentEditorCount.toString()} editors, which exceeds the limit on the plan you are selecting. Remove editors from this project or choose a different plan.`}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.CantMoveAddOnError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorCantMoveAddOn}\n\t\t\t\t\ttitle={`${Dictionary.AddOn} Not Available`}\n\t\t\t\t\tbody={\n\t\t\t\t\t\t<PlainErrorBody\n\t\t\t\t\t\t\tmessage={`You are currently using the ${getAddOnLicenseTypeName(state.addonLicenseType)} add-on, which is not available on lower plans. Please cancel the add-on before downgrading your plan.`}\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.InvalidPromotionCodeError:\n\t\t\treturn (\n\t\t\t\t<PlansError\n\t\t\t\t\tpage={Pages.siteSettingsPlansErrorSubmitOrder}\n\t\t\t\t\tbody={<StandardErrorBody message=\"The promotion code is invalid or has expired.\" />}\n\t\t\t\t\tbackToPlans={refreshStripePlans}\n\t\t\t\t/>\n\t\t\t)\n\t\tcase StripePlansStatus.Success:\n\t\t\treturn (\n\t\t\t\t<PlansSuccess\n\t\t\t\t\toperation={CheckoutSuccessOperation.SitePlanUpgrade}\n\t\t\t\t\tcurrentSitePlanType={currentProjectLicenseType}\n\t\t\t\t\tpreviousSitePlanType={state.previousProjectLicenseType}\n\t\t\t\t\tpreviousProjectPeriod={state.previousProjectPeriod}\n\t\t\t\t\tlicensesSettings={state.licensesSettings}\n\t\t\t\t\tcurrentTeamPlanType={currentTeamLicenseType}\n\t\t\t\t\tcurrentSiteBillingPeriod={state.selectedProjectPeriod || null}\n\t\t\t\t\tonReset={() => {\n\t\t\t\t\t\tremovePlanQueryParams()\n\t\t\t\t\t\tremoveAddOnQueryParams()\n\t\t\t\t\t\t// Ensure we remove any pending upsell\n\t\t\t\t\t\tvoid engine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.plans })\n\t\t\t\t\t\tvoid refreshStripePlans()\n\t\t\t\t\t}}\n\t\t\t\t\tteamCurrentEditors={teamCurrentEditors}\n\t\t\t\t/>\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(state, \"Expect all states to be handled\")\n\t}\n}\n\ninterface PlansInnerProps {\n\tupsellFeature: UpsellFeature | null\n\tprojectId: string\n\tteamId: string\n\tlicensesSettings: LicenseSettings[]\n\tcurrentSiteSubscription: CurrentSiteSubscription | null\n\tcurrentAddOns: CurrentAddOn[]\n\tcurrentProjectLicenseType: Exclude<ProjectLicenseType, ProjectLicenseType.EnterpriseSite>\n\tcurrentTeamLicenseType: TeamLicenseType\n\tteamHasPastDueSubscriptions: boolean\n\t/** Used to show a spinner in a selected plan button */\n\tpreviewingProjectLicenseType?: PaidProjectLicenseType\n\t/** Sends the user to Stripe in the case of first purchase, or to the preview page */\n\tpreviewPlan: (\n\t\tselectedPlan: PaidLicenseSettings,\n\t\tperiod: ProjectLicensePeriod,\n\t\taddOns: AddOnLicenseType[],\n\t) => Promise<void>\n\t/** Reactivates a cancelled subscription, returns true if reactivated successfully */\n\treactivatePlan: (selectedProjectLicenseType: PaidProjectLicenseType, planPrice: PlanPrice) => Promise<boolean>\n\t/** Refreshes the subscriptions without changing the plans state */\n\trefreshSubscriptions: () => Promise<void>\n}\n\nfunction PlansInner(props: PlansInnerProps) {\n\tconst {\n\t\tupsellFeature,\n\t\tlicensesSettings,\n\t\tcurrentProjectLicenseType,\n\t\tcurrentSiteSubscription,\n\t\tcurrentAddOns,\n\t\tcurrentTeamLicenseType,\n\t\tteamHasPastDueSubscriptions,\n\t\tteamId,\n\t\tpreviewPlan,\n\t\tprojectId,\n\t\treactivatePlan,\n\t\tpreviewingProjectLicenseType,\n\t\trefreshSubscriptions,\n\t} = props\n\tconst [period, setPeriod] = React.useState(() => getDefaultBillingPeriod(currentSiteSubscription))\n\tconst resourceCounts = useResourceCounts()\n\tconst currentResourceLimits = engine.stores.projectStore.useState(({ project }) => getResourceLimits(project))\n\tconst currentSettingsFeatureFlags = engine.stores.projectStore.useState(\n\t\t({ project }) => project?.settings.featureFlags,\n\t)\n\tconst isBillingV3 = useIsBillingV3()\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst shouldShowDomainVoucherBadge = useShouldShowDomainVoucherBadge({\n\t\tcurrentProjectLicenseType,\n\t\tcurrentSubscriptionPeriod: currentSiteSubscription?.period,\n\t})\n\n\tconst trackingPageId =\n\t\tcurrentSiteSubscription === null ? Pages.siteSettingsPlansFirstPurchaseView : Pages.siteSettingsPlansUpgradeView\n\n\tconst currentPlanPrice = React.useMemo(() => {\n\t\tconst currentPlan = licensesSettings.find(license => isCurrentPlan(license, currentProjectLicenseType))\n\t\tif (!currentPlan || !isPaidLicenseSettings(currentPlan)) return null\n\t\tif (!currentSiteSubscription?.period) return null\n\t\treturn currentPlan.prices[currentSiteSubscription.period]\n\t}, [licensesSettings, currentProjectLicenseType, currentSiteSubscription?.period])\n\n\tconst recommendedProjectLicenseType = React.useMemo(() => {\n\t\tif (upsellFeature && currentResourceLimits) {\n\t\t\treturn getRecommendedLicenseType(\n\t\t\t\tupsellFeature,\n\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\tlicensesSettings,\n\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\tcurrentResourceLimits,\n\t\t\t\tresourceCounts,\n\t\t\t\tisBillingV3,\n\t\t\t)\n\t\t}\n\n\t\treturn null\n\t}, [\n\t\tcurrentProjectLicenseType,\n\t\tcurrentResourceLimits,\n\t\tcurrentTeamLicenseType,\n\t\tlicensesSettings,\n\t\tresourceCounts,\n\t\tisBillingV3,\n\t\tupsellFeature,\n\t])\n\n\tuseRecordEffect(\"ui_impression\", { page: trackingPageId }, [trackingPageId])\n\n\tuseTrackVantaraEventEffect(\n\t\t\"plans_page_viewed\",\n\t\t{\n\t\t\tcurrentPlan: currentProjectLicenseType,\n\t\t\tisFirstPurchase: currentSiteSubscription === null,\n\t\t},\n\t\t[currentProjectLicenseType, currentSiteSubscription],\n\t)\n\n\tconst trackVantaraEvent = useTrackVantaraEventCallback()\n\n\tconst plans = React.useMemo(\n\t\t() => licensesSettings.filter(({ licenseType }) => isLicenseType2025(licenseType)),\n\t\t[licensesSettings],\n\t)\n\n\tconst shownAddOns = React.useMemo(\n\t\t() =>\n\t\t\t// We reduce the add-ons to only show distinct add-ons per license type.\n\t\t\t// This is done, because advanced analytics tiers return as multiple items.\n\t\t\tcurrentAddOns.reduce((acc, addOn) => {\n\t\t\t\tif (!acc.some(a => a.licenseType === addOn.licenseType)) {\n\t\t\t\t\tacc.push(addOn)\n\t\t\t\t}\n\t\t\t\treturn acc\n\t\t\t}, [] as CurrentAddOn[]),\n\t\t[currentAddOns],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (!shouldOpenPlanCancellationModal()) return\n\t\tif (\n\t\t\tcurrentProjectLicenseType !== ProjectLicenseType.FreeSite &&\n\t\t\tcurrentSiteSubscription &&\n\t\t\tcurrentSiteSubscription.status !== SubscriptionStatus.Cancelled &&\n\t\t\tcurrentSiteSubscription.status !== SubscriptionStatus.CancelledAndRefunded &&\n\t\t\tcurrentPlanPrice\n\t\t) {\n\t\t\t// Show the cancellation modal if the plan is not already cancelled\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.PlanCancellation,\n\t\t\t\t\tprojectId,\n\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\tnextBillDate: currentSiteSubscription.nextBillDate,\n\t\t\t\t\trefreshSubscriptions,\n\t\t\t\t\tsource: \"automatic\",\n\t\t\t\t\tprice: currentPlanPrice.amount,\n\t\t\t\t\tcurrency: currentPlanPrice.currency,\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t\tremovePlanQueryParams()\n\t}, [currentPlanPrice, projectId, currentProjectLicenseType, currentSiteSubscription, refreshSubscriptions])\n\n\tconst withLimits = React.useCallback(\n\t\t(\n\t\t\tplan: LicenseSettings,\n\t\t\tbutton: JSX.Element,\n\t\t\tignoreExceptions: ResourceLimitKey[] = [],\n\t\t\tignoreFeatureFlagExceptions: FeatureFlagKey[] = [],\n\t\t): JSX.Element => {\n\t\t\tconst resourceLimitKey = validateResourceLimits(\n\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\tresourceCounts,\n\t\t\t\tplan.resourceLimits,\n\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\tcurrentResourceLimits,\n\t\t\t\tisBillingV3,\n\t\t\t)\n\n\t\t\tconst currentPlanFeatureFlags = licensesSettings.find(\n\t\t\t\tlicense => license.licenseType === currentProjectLicenseType,\n\t\t\t)\n\t\t\tconst featureFlagKey =\n\t\t\t\tcurrentSettingsFeatureFlags &&\n\t\t\t\tcurrentPlanFeatureFlags &&\n\t\t\t\tvalidateFeatureFlags(currentSettingsFeatureFlags, currentPlanFeatureFlags?.featureFlags, plan.featureFlags)\n\n\t\t\tif (!resourceLimitKey && featureFlagKey && ignoreFeatureFlagExceptions.includes(featureFlagKey)) {\n\t\t\t\treturn button\n\t\t\t}\n\t\t\tif (!featureFlagKey && resourceLimitKey && ignoreExceptions.includes(resourceLimitKey)) {\n\t\t\t\treturn button\n\t\t\t}\n\n\t\t\tconst resourceLimitTooltipText = resourceLimitKey && getResourceLimitsTooltipText(resourceLimitKey)\n\t\t\tconst featureFlagTooltipText = featureFlagKey && getFeatureFlagTooltipText(featureFlagKey)\n\n\t\t\tconst tooltipText = resourceLimitTooltipText || featureFlagTooltipText\n\n\t\t\treturn tooltipText ? (\n\t\t\t\t<OverLimitsButton data-testid={`over-limits-${plan.licenseType}`} tooltipText={tooltipText} />\n\t\t\t) : (\n\t\t\t\tbutton\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tcurrentProjectLicenseType,\n\t\t\tcurrentResourceLimits,\n\t\t\tcurrentSettingsFeatureFlags,\n\t\t\tcurrentTeamLicenseType,\n\t\t\tlicensesSettings,\n\t\t\tresourceCounts,\n\t\t\tisBillingV3,\n\t\t],\n\t)\n\n\tconst buttonsFor = React.useCallback(\n\t\t(plan: LicenseSettings, actualPeriod: ProjectLicensePeriod) => {\n\t\t\tassert(\n\t\t\t\tisPaidLicenseSettings(plan) && isLicenseType2025(plan.licenseType),\n\t\t\t\t`${getProjectLicenseName(plan.licenseType)} plan is not displayed on the plans page`,\n\t\t\t)\n\n\t\t\tconst getAddOnsFromUpsell = (): AddOnLicenseType[] => {\n\t\t\t\tswitch (upsellFeature) {\n\t\t\t\t\tcase UpsellFeature.abTests:\n\t\t\t\t\tcase UpsellFeature.canUseFunnels:\n\t\t\t\t\tcase UpsellFeature.canUseTriggers:\n\t\t\t\t\tcase UpsellFeature.trackingEventsLimit:\n\t\t\t\t\t\treturn [AddOnLicenseType.AdvancedAnalytics]\n\t\t\t\t\tcase UpsellFeature.canUseCustomCanonicalUrl:\n\t\t\t\t\t\treturn [AddOnLicenseType.CustomProxySetup]\n\t\t\t\t\tcase UpsellFeature.aiCredits:\n\t\t\t\t\tcase UpsellFeature.bandwidthInGB:\n\t\t\t\t\tcase UpsellFeature.canInviteEditors:\n\t\t\t\t\tcase UpsellFeature.canInviteProjectEditors:\n\t\t\t\t\tcase UpsellFeature.canPublishToCustomDomain:\n\t\t\t\t\tcase UpsellFeature.canUseBatchAITranslation:\n\t\t\t\t\tcase UpsellFeature.canUseCustomLocaleRegions:\n\t\t\t\t\tcase UpsellFeature.canUseEditorPermissions:\n\t\t\t\t\tcase UpsellFeature.canUsePasswordProtection:\n\t\t\t\t\tcase UpsellFeature.canUseRedirects:\n\t\t\t\t\tcase UpsellFeature.canUseStagingEnvironment:\n\t\t\t\t\tcase UpsellFeature.canUseUTMTracking:\n\t\t\t\t\tcase UpsellFeature.canUseWellKnown:\n\t\t\t\t\tcase UpsellFeature.cmsCollections:\n\t\t\t\t\tcase UpsellFeature.cmsItems:\n\t\t\t\t\tcase UpsellFeature.customDomainRecoverUpsell:\n\t\t\t\t\tcase UpsellFeature.domainToBuyUpsell:\n\t\t\t\t\tcase UpsellFeature.fileUploadLimitInMB:\n\t\t\t\t\tcase UpsellFeature.localeAddon:\n\t\t\t\t\tcase UpsellFeature.pages:\n\t\t\t\t\tcase UpsellFeature.translatableWords:\n\t\t\t\t\tcase UpsellFeature.analyticsRangeInDays:\n\t\t\t\t\tcase null:\n\t\t\t\t\t\treturn []\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(upsellFeature)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst selectedPlanPrice = plan.prices[actualPeriod]\n\t\t\tconst onPreviewPlan = () => void previewPlan(plan, actualPeriod, getAddOnsFromUpsell())\n\n\t\t\tconst isPreviewingThisPlan = previewingProjectLicenseType === plan.licenseType\n\t\t\tconst buttonsAreEnabled =\n\t\t\t\t!previewingProjectLicenseType && // disable buttons when loading\n\t\t\t\t!teamHasPastDueSubscriptions // disable buttons when the team has a past due subscription\n\n\t\t\t// For V2 billing, editors are managed at the team level so we skip the per-site check\n\t\t\t// when the team is on a paid plan. For V3 billing, editors are per-project so the check applies.\n\t\t\tconst ignoreResourceLimit: ResourceLimitKey[] =\n\t\t\t\tcurrentTeamLicenseType !== TeamLicenseType.FreePlan && !isBillingV3\n\t\t\t\t\t? [ResourceLimitKey.Editors, ResourceLimitKey.AbTests]\n\t\t\t\t\t: [ResourceLimitKey.AbTests]\n\n\t\t\tconst isSubscriptionActive = currentSiteSubscription?.status !== SubscriptionStatus.Cancelled\n\n\t\t\tif (currentProjectLicenseType === ProjectLicenseType.FreeSite) {\n\t\t\t\treturn withLimits(\n\t\t\t\t\tplan,\n\t\t\t\t\t<PlanButton\n\t\t\t\t\t\tdata-testid={`subscribe-button-${plan.licenseType}`}\n\t\t\t\t\t\thighlight={isHighlightedPlan(\n\t\t\t\t\t\t\tplan,\n\t\t\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\t\t\trecommendedProjectLicenseType,\n\t\t\t\t\t\t\tresourceCounts,\n\t\t\t\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\t\t\t\tcurrentResourceLimits,\n\t\t\t\t\t\t\tisSubscriptionActive,\n\t\t\t\t\t\t\tisBillingV3,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tonClick={isPreviewingThisPlan || (buttonsAreEnabled && onPreviewPlan)}\n\t\t\t\t\t>\n\t\t\t\t\t\tSubscribe\n\t\t\t\t\t</PlanButton>,\n\t\t\t\t\tignoreResourceLimit,\n\t\t\t\t\t[FeatureFlagKey.AdvancedAnalytics],\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcurrentProjectLicenseType === plan.licenseType &&\n\t\t\t\tcurrentSiteSubscription?.status === SubscriptionStatus.Cancelled &&\n\t\t\t\tactualPeriod === currentSiteSubscription.period\n\t\t\t) {\n\t\t\t\tconst onReactivatePlan = () => {\n\t\t\t\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsPlans, id: UIInteraction.reactivateSitePlan })\n\n\t\t\t\t\tvoid reactivatePlan(plan.licenseType, selectedPlanPrice).then(\n\t\t\t\t\t\tsuccess => success && showReactivatePlanToast(plan.licenseType, currentSiteSubscription.nextBillDate),\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<PlanButton\n\t\t\t\t\t\tdata-testid={`reactivate-button-${plan.licenseType}`}\n\t\t\t\t\t\thighlight\n\t\t\t\t\t\tonClick={isPreviewingThisPlan || (buttonsAreEnabled && onReactivatePlan)}\n\t\t\t\t\t>\n\t\t\t\t\t\tReactivate\n\t\t\t\t\t</PlanButton>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (currentProjectLicenseType === plan.licenseType && actualPeriod === currentSiteSubscription?.period) {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-testid={`cancel-button-${plan.licenseType}`}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\tpage: Pages.siteSettingsPlans,\n\t\t\t\t\t\t\t\tid: UIInteraction.cancelSitePlan,\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.PlanCancellation,\n\t\t\t\t\t\t\t\tprojectId,\n\t\t\t\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\t\t\t\tnextBillDate: currentSiteSubscription.nextBillDate,\n\t\t\t\t\t\t\t\trefreshSubscriptions,\n\t\t\t\t\t\t\t\tsource: \"settings\",\n\t\t\t\t\t\t\t\tprice: selectedPlanPrice.amount,\n\t\t\t\t\t\t\t\tcurrency: selectedPlanPrice.currency,\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\tCancel\n\t\t\t\t\t</Button>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tisSiteLicenseGreater(currentProjectLicenseType, plan.licenseType) ||\n\t\t\t\t(currentProjectLicenseType === plan.licenseType &&\n\t\t\t\t\tcurrentSiteSubscription?.period === ProjectLicensePeriod.Year)\n\t\t\t) {\n\t\t\t\tconst action = isLegacyProjectPlan ? \"Switch to\" : \"Downgrade to\"\n\t\t\t\tconst ignoreDowngradeResourceLimit = isBillingV3 ? [] : [ResourceLimitKey.Editors]\n\t\t\t\treturn withLimits(\n\t\t\t\t\tplan,\n\t\t\t\t\t<PlanButton\n\t\t\t\t\t\tdata-testid={`downgrade-button-${plan.licenseType}`}\n\t\t\t\t\t\thighlight={false}\n\t\t\t\t\t\tonClick={isPreviewingThisPlan || (isSubscriptionActive && buttonsAreEnabled && onPreviewPlan)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{action}{\" \"}\n\t\t\t\t\t\t{currentProjectLicenseType === plan.licenseType ? \"Monthly\" : getProjectLicenseName(plan.licenseType)}\n\t\t\t\t\t</PlanButton>,\n\t\t\t\t\tignoreDowngradeResourceLimit,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst highlightButton = isHighlightedPlan(\n\t\t\t\tplan,\n\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\trecommendedProjectLicenseType,\n\t\t\t\tresourceCounts,\n\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\tcurrentResourceLimits,\n\t\t\t\tisSubscriptionActive,\n\t\t\t\tisBillingV3,\n\t\t\t)\n\t\t\tconst action = isLegacyProjectPlan ? \"Switch to\" : \"Upgrade to\"\n\t\t\treturn withLimits(\n\t\t\t\tplan,\n\t\t\t\t<PlanButton\n\t\t\t\t\tdata-testid={`upgrade-button-${plan.licenseType}`}\n\t\t\t\t\thighlight={highlightButton}\n\t\t\t\t\tonClick={isPreviewingThisPlan || (isSubscriptionActive && buttonsAreEnabled && onPreviewPlan)}\n\t\t\t\t>\n\t\t\t\t\t{action} {currentProjectLicenseType === plan.licenseType ? \"Yearly\" : getProjectLicenseName(plan.licenseType)}\n\t\t\t\t</PlanButton>,\n\t\t\t\tignoreResourceLimit,\n\t\t\t\t[FeatureFlagKey.AdvancedAnalytics],\n\t\t\t)\n\t\t},\n\t\t[\n\t\t\tcurrentProjectLicenseType,\n\t\t\tcurrentResourceLimits,\n\t\t\tcurrentSiteSubscription,\n\t\t\tcurrentTeamLicenseType,\n\t\t\tpreviewPlan,\n\t\t\tpreviewingProjectLicenseType,\n\t\t\tprojectId,\n\t\t\treactivatePlan,\n\t\t\trecommendedProjectLicenseType,\n\t\t\trefreshSubscriptions,\n\t\t\tresourceCounts,\n\t\t\tteamHasPastDueSubscriptions,\n\t\t\tisBillingV3,\n\t\t\tupsellFeature,\n\t\t\twithLimits,\n\t\t],\n\t)\n\n\tconst onCancelAddOn = React.useCallback(\n\t\t(addOn: CurrentAddOn) => {\n\t\t\tif (!remoteDispatch) return\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: Pages.siteSettingsPlans,\n\t\t\t\tid: UIInteraction.cancelAddOn,\n\t\t\t})\n\t\t\tconfirmCancelAddOn(addOn, refreshSubscriptions, remoteDispatch)\n\t\t},\n\t\t[refreshSubscriptions, remoteDispatch],\n\t)\n\n\tconst onViewAddOn = React.useCallback(\n\t\t({ licenseType }: { licenseType: AddOnLicenseType }) => {\n\t\t\trecord(\"ui_interaction\", { page: trackingPageId, id: UIInteraction.openAddOn })\n\t\t\topenNewTab(getAddOnViewUrl(licenseType, projectId))\n\t\t},\n\t\t[trackingPageId, projectId],\n\t)\n\n\tReact.useEffect(() => {\n\t\tif (!shouldOpenAddOnCancellationModal()) return\n\t\tconst addOnLicenseType = getAddOnLicenseTypeParam()\n\t\tif (!addOnLicenseType) return\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tconst addOnPlan = shownAddOns.find(addOn => addOn.licenseType === addOnLicenseType)\n\t\t\tif (!addOnPlan) return\n\t\t\tonCancelAddOn(addOnPlan)\n\t\t})\n\n\t\tremoveAddOnQueryParams()\n\t}, [shownAddOns, onCancelAddOn])\n\n\tconst isLegacyProjectPlan =\n\t\tisPaidLicenseType(currentProjectLicenseType) && !isLicenseType2025(currentProjectLicenseType)\n\n\tconst showLegacyPlanContainer = isLegacyProjectPlan && currentSiteSubscription && currentPlanPrice\n\n\tlet headerAction: React.ReactNode = null\n\tif (teamHasPastDueSubscriptions) {\n\t\theaderAction = <ReactivatePastDuePlanContainer teamId={teamId} />\n\t} else if (showLegacyPlanContainer) {\n\t\theaderAction = (\n\t\t\t<LegacyPlanContainer\n\t\t\t\tprojectId={projectId}\n\t\t\t\tcurrentSiteSubscription={currentSiteSubscription}\n\t\t\t\trefreshSubscriptions={refreshSubscriptions}\n\t\t\t\treactivatePlan={reactivatePlan}\n\t\t\t\tplanPrice={currentPlanPrice}\n\t\t\t\tcurrentProjectLicenseType={currentProjectLicenseType}\n\t\t\t\tpreviewingProjectLicenseType={previewingProjectLicenseType}\n\t\t\t/>\n\t\t)\n\t} else if (shouldShowDomainVoucherBadge) {\n\t\theaderAction = <DomainVoucherBadge period={period} setPeriod={setPeriod} />\n\t}\n\n\treturn (\n\t\t<Stack className={siteSettingStyles.wideContainer} gap={15} direction=\"column\" shrink={0}>\n\t\t\t<Stack direction=\"row\" gap={30} alignItems=\"space-between\">\n\t\t\t\t<Stack direction=\"column\" gap={15} className={styles.planDescriptionContainer}>\n\t\t\t\t\t<div className={siteSettingStyles.sectionTitle}>\n\t\t\t\t\t\t<T>Plans</T>\n\t\t\t\t\t</div>\n\t\t\t\t\t<CurrentPlanDescription\n\t\t\t\t\t\tpage={trackingPageId}\n\t\t\t\t\t\tteamId={teamId}\n\t\t\t\t\t\tcurrentSiteSubscription={currentSiteSubscription}\n\t\t\t\t\t\tcurrentProjectLicenseType={currentProjectLicenseType}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t\t{headerAction}\n\t\t\t</Stack>\n\t\t\t<Stack direction=\"column\" gap={15}>\n\t\t\t\t<div className={styles.plansGrid}>\n\t\t\t\t\t{plans.map(plan => {\n\t\t\t\t\t\tassert(isLicenseType2025(plan.licenseType), \"Only 2025 plans are shown on the plans page\")\n\n\t\t\t\t\t\tconst isSubscriptionActive = currentSiteSubscription?.status !== SubscriptionStatus.Cancelled\n\t\t\t\t\t\tconst isCurrent = isCurrentPlan(plan, currentProjectLicenseType)\n\n\t\t\t\t\t\tconst shouldHighlight = isHighlightedPlan(\n\t\t\t\t\t\t\tplan,\n\t\t\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\t\t\trecommendedProjectLicenseType,\n\t\t\t\t\t\t\tresourceCounts,\n\t\t\t\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\t\t\t\tcurrentResourceLimits,\n\t\t\t\t\t\t\tisSubscriptionActive,\n\t\t\t\t\t\t\tisBillingV3,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tconst showPeriodToggle =\n\t\t\t\t\t\t\tcanToggleBillingPeriod(plan.licenseType, currentProjectLicenseType, currentSiteSubscription?.period) &&\n\t\t\t\t\t\t\tisSubscriptionActive\n\n\t\t\t\t\t\tconst actualPeriod = showPeriodToggle\n\t\t\t\t\t\t\t? period\n\t\t\t\t\t\t\t: currentSiteSubscription?.status === SubscriptionStatus.Cancelled\n\t\t\t\t\t\t\t\t? // If subscription is cancelled, we should default to its period\n\t\t\t\t\t\t\t\t\tcurrentSiteSubscription.period\n\t\t\t\t\t\t\t\t: // Otherwise, if period can't be toggled we must enforce the yearly period\n\t\t\t\t\t\t\t\t\tProjectLicensePeriod.Year\n\n\t\t\t\t\t\tconst displayPrice = formatDisplayPrice(plan, actualPeriod)\n\n\t\t\t\t\t\tlet badgeText = getBadgeText(\n\t\t\t\t\t\t\tplan,\n\t\t\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\t\t\trecommendedProjectLicenseType,\n\t\t\t\t\t\t\tresourceCounts,\n\t\t\t\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\t\t\t\tcurrentResourceLimits,\n\t\t\t\t\t\t\tisBillingV3,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\tlet periodToggle = showPeriodToggle ? (\n\t\t\t\t\t\t\t<PeriodToggle\n\t\t\t\t\t\t\t\tdata-testid={`period-toggle-${plan.licenseType}`}\n\t\t\t\t\t\t\t\tperiod={period}\n\t\t\t\t\t\t\t\tsetPeriod={toggledPeriod => {\n\t\t\t\t\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\t\t\t\t\tpage: trackingPageId,\n\t\t\t\t\t\t\t\t\t\tid:\n\t\t\t\t\t\t\t\t\t\t\ttoggledPeriod === ProjectLicensePeriod.Month\n\t\t\t\t\t\t\t\t\t\t\t\t? UIInteraction.toogleBillingPeriodToMonthly\n\t\t\t\t\t\t\t\t\t\t\t\t: UIInteraction.toogleBillingPeriodToYearly,\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\tsetPeriod(toggledPeriod)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcurrentProjectLicenseType === ProjectLicenseType.FreeSite &&\n\t\t\t\t\t\t\tplan.licenseType === ProjectLicenseType.ScaleSite2025\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tperiodToggle = <AnnualOnly />\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (isCurrent && !isSubscriptionActive) {\n\t\t\t\t\t\t\tperiodToggle = (\n\t\t\t\t\t\t\t\t<div className={cx(styles.planExpiration, truncateWithEllipsis)}>\n\t\t\t\t\t\t\t\t\t<T>Expires {format(new Date(currentSiteSubscription.nextBillDate), \"MMM do, yyyy\")}</T>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tbadgeText = undefined\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<PlansCard\n\t\t\t\t\t\t\t\tdata-testid={`plan-card-${plan.licenseType}`}\n\t\t\t\t\t\t\t\tkey={plan.licenseType}\n\t\t\t\t\t\t\t\tlicenseName={getProjectLicenseName(plan.licenseType)}\n\t\t\t\t\t\t\t\tdisplayPrice={<DisplayPrice {...displayPrice} />}\n\t\t\t\t\t\t\t\tbadge={badgeText && <PlanBadge data-testid={`badge-${plan.licenseType}`}>{badgeText}</PlanBadge>}\n\t\t\t\t\t\t\t\thighlight={shouldHighlight}\n\t\t\t\t\t\t\t\tperiodToggle={periodToggle}\n\t\t\t\t\t\t\t\tfeatures={<PlanFeatures licenseType={plan.licenseType} />}\n\t\t\t\t\t\t\t\taddOns={\n\t\t\t\t\t\t\t\t\tisCurrent && shownAddOns.length > 0 ? (\n\t\t\t\t\t\t\t\t\t\t<PlansCardAddOns\n\t\t\t\t\t\t\t\t\t\t\taddOns={shownAddOns}\n\t\t\t\t\t\t\t\t\t\t\tonCancelAddOn={onCancelAddOn}\n\t\t\t\t\t\t\t\t\t\t\tonViewAddOn={onViewAddOn}\n\t\t\t\t\t\t\t\t\t\t\thideCancelOption={!isSubscriptionActive}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbuttons={buttonsFor(plan, actualPeriod)}\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</div>\n\t\t\t\t<EnterpriseCard />\n\t\t\t</Stack>\n\t\t\t<Link\n\t\t\t\tvariant=\"linkLined\"\n\t\t\t\thref={pricingURL}\n\t\t\t\tclassName={styles.compareLink}\n\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\tonClick={() => trackVantaraEvent(\"compare_all_plans_clicked\")}\n\t\t\t>\n\t\t\t\t<T>Compare all plans and features</T>\n\t\t\t</Link>\n\t\t</Stack>\n\t)\n}\n\n/** Get the default billing period. We should use the current site subscription\n * period if it exists, otherwise default to yearly.\n */\nfunction getDefaultBillingPeriod(currentSiteSubscription: CurrentSiteSubscription | null) {\n\treturn currentSiteSubscription?.period ?? ProjectLicensePeriod.Year\n}\n\nfunction isCurrentPlan(plan: LicenseSettings, currentProjectLicenseType: ProjectLicenseType) {\n\treturn plan.licenseType === currentProjectLicenseType\n}\n\n/** Returns true if we need to highlight the plan card and a primary button inside the plan card. */\nfunction isHighlightedPlan(\n\tplan: LicenseSettings,\n\tcurrentProjectLicenseType: ProjectLicenseType,\n\trecommendedProjectLicenseType: ProjectLicenseType | null,\n\tresourceCounts: ResourceCounts,\n\tcurrentTeamLicenseType: TeamLicenseType,\n\tcurrentResourceLimits: ProjectSettingsResourceLimits | null,\n\tisSubscriptionActive: boolean,\n\tisBillingV3: boolean,\n) {\n\t// Highlight the plan to reactivate\n\tif (!isSubscriptionActive) {\n\t\treturn isCurrentPlan(plan, currentProjectLicenseType)\n\t}\n\n\tconst badgeText = getBadgeText(\n\t\tplan,\n\t\tcurrentProjectLicenseType,\n\t\trecommendedProjectLicenseType,\n\t\tresourceCounts,\n\t\tcurrentTeamLicenseType,\n\t\tcurrentResourceLimits,\n\t\tisBillingV3,\n\t)\n\n\t// If there is a recommended or popular plan, we highlight it\n\tif (recommendedProjectLicenseType) {\n\t\treturn badgeText === \"Recommended\"\n\t}\n\n\tif (isBusinessLicenseType(currentProjectLicenseType)) {\n\t\treturn plan.licenseType === ProjectLicenseType.ScaleSite2025\n\t}\n\tif (isPersonalLicenseType(currentProjectLicenseType)) {\n\t\treturn plan.licenseType === ProjectLicenseType.ProSite2025\n\t}\n\n\treturn badgeText === \"Popular\"\n}\n\n/** Returns a type of the badge to show on the plan card. */\nfunction getBadgeText(\n\tplan: LicenseSettings,\n\tcurrentProjectLicenseType: ProjectLicenseType,\n\trecommendedProjectLicenseType: ProjectLicenseType | null,\n\tresourceCounts: ResourceCounts,\n\tcurrentTeamLicenseType: TeamLicenseType,\n\tcurrentResourceLimits: ProjectSettingsResourceLimits | null,\n\tisBillingV3: boolean,\n): \"Current\" | \"Popular\" | \"Recommended\" | undefined {\n\tif (isCurrentPlan(plan, currentProjectLicenseType)) {\n\t\treturn \"Current\"\n\t}\n\n\tconst isOverLimits = validateResourceLimits(\n\t\tcurrentProjectLicenseType,\n\t\tresourceCounts,\n\t\tplan.resourceLimits,\n\t\tcurrentTeamLicenseType,\n\t\tcurrentResourceLimits,\n\t\tisBillingV3,\n\t)\n\tif (isOverLimits) return\n\n\tif (recommendedProjectLicenseType) {\n\t\t// Only show a badge for the recommended plan if there is any\n\t\treturn plan.licenseType === recommendedProjectLicenseType ? \"Recommended\" : undefined\n\t}\n\n\tif (\n\t\tcurrentProjectLicenseType === ProjectLicenseType.FreeSite &&\n\t\tplan.licenseType === ProjectLicenseType.ProSite2025\n\t) {\n\t\treturn \"Popular\"\n\t}\n}\n", "import type { PaidProjectLicenseType } from \"@framerjs/app-shared\"\nimport { isPaidLicenseType, isValidProjectLicense } from \"@framerjs/app-shared\"\n\nexport enum QueryParam {\n\tPlanAction = \"plan-action\",\n\tAddOnAction = \"add-on-action\",\n\tCheckoutItem = \"checkout-item\",\n\tAddOnLicenseType = \"add-on-license-type\",\n}\n\nenum QueryValue {\n\tCancel = \"cancel\",\n}\n\nexport function shouldOpenPlanCancellationModal(): boolean {\n\treturn new URLSearchParams(window.location.search).get(QueryParam.PlanAction) === QueryValue.Cancel\n}\n\nexport function shouldOpenAddOnCancellationModal(): boolean {\n\treturn new URLSearchParams(window.location.search).get(QueryParam.AddOnAction) === QueryValue.Cancel\n}\n\nexport function getAddOnLicenseTypeParam(): string | undefined {\n\treturn new URLSearchParams(window.location.search).get(QueryParam.AddOnLicenseType) as string | undefined\n}\n\nexport function getCheckoutItemParam(): PaidProjectLicenseType | undefined {\n\tconst licenseType = new URLSearchParams(window.location.search).get(QueryParam.CheckoutItem)\n\tif (isValidProjectLicense(licenseType) && isPaidLicenseType(licenseType)) {\n\t\treturn licenseType\n\t}\n}\n\nexport function removeCheckoutParams() {\n\tconst pageURL = new URL(window.location.href)\n\tif (pageURL.searchParams.has(QueryParam.CheckoutItem)) pageURL.searchParams.delete(QueryParam.CheckoutItem)\n\twindow.history.replaceState(window.history.state, \"\", pageURL.href)\n}\n\nexport function removePlanQueryParams() {\n\tconst pageURL = new URL(window.location.href)\n\tif (pageURL.searchParams.has(QueryParam.PlanAction)) pageURL.searchParams.delete(QueryParam.PlanAction)\n\twindow.history.replaceState(window.history.state, \"\", pageURL.href)\n}\n\nexport function removeAddOnQueryParams() {\n\tconst pageURL = new URL(window.location.href)\n\tif (pageURL.searchParams.has(QueryParam.AddOnAction)) pageURL.searchParams.delete(QueryParam.AddOnAction)\n\tif (pageURL.searchParams.has(QueryParam.AddOnLicenseType)) pageURL.searchParams.delete(QueryParam.AddOnLicenseType)\n\twindow.history.replaceState(window.history.state, \"\", pageURL.href)\n}\n", "import \"Plans.styles_7lr4i8.wyw.css\"; export const planDescriptionContainer = \"planDescriptionContainer_pin1u1i\";\nexport const plansGrid = \"plansGrid_p1o889pv\";\nexport const planExpiration = \"planExpiration_pew3kq1\";\nexport const compareLink = \"compareLink_cqqkjr3\";", "import type { ProjectSettingsResourceLimits } from \"@framerjs/app-config\"\nimport type { ProjectSettings } from \"@framerjs/app-shared\"\nimport { AddOnLicenseType, getAddOnLicenseTypeName } from \"@framerjs/app-shared\"\nimport { assertNever, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { PollStatus } from \"web/pages/project/lib/api/pollProject.ts\"\nimport type { RemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { updatePartialWebMetadata } from \"../../../Project/updateWebMetadata.ts\"\nimport { shouldUseBillingV3 } from \"../api/billingV3.ts\"\nimport type { CurrentAddOn } from \"../api/subscriptions.ts\"\nimport { putAddOnSubscription } from \"./api/putAddOnSubscription.ts\"\n\nconst log = getLogger(\"confirmCancelAddOn\")\n\nexport function confirmCancelAddOn(\n\t{ plan, licenseType }: CurrentAddOn,\n\trefreshSubscriptions: () => Promise<void>,\n\tremoteDispatch: RemoteDispatch,\n) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\thasBackdrop: true,\n\t\ttitle: `Cancel ${getAddOnLicenseTypeName(licenseType)} ${Dictionary.AddOn}`,\n\t\tdescription: getDescription(licenseType),\n\t\tonConfirm: async () => {\n\t\t\tconst projectId = engine.stores.projectStore.projectId\n\t\t\tconst previousResourceLimits = engine.stores.projectStore.project?.settings?.resourceLimits ?? null\n\t\t\tif (licenseType === AddOnLicenseType.CustomProxySetup) {\n\t\t\t\tupdatePartialWebMetadata({ canonicalURL: \"default\" })\n\t\t\t}\n\t\t\tconst project = engine.stores.projectStore.project\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\tawait putAddOnSubscription(projectId, { plan, quantity: 0 }, isBillingV3)\n\t\t\tconst pollResult = await remoteDispatch.pollProject({\n\t\t\t\tintervalMillis: 3000,\n\t\t\t\tattempts: 10,\n\t\t\t\tstopCondition: ({ settings }) => pollUntilDisabled(licenseType, settings, previousResourceLimits),\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 when cancelling add-on\", 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\n\t\t\tawait refreshSubscriptions()\n\t\t},\n\t\tconfirmLabel: Dictionary.Confirm,\n\t\tvariant: \"destructive\",\n\t\tsource: \"settings\",\n\t})\n}\nfunction getDescription(licenseType: AddOnLicenseType): string {\n\tswitch (licenseType) {\n\t\tcase AddOnLicenseType.Locale:\n\t\t\treturn \"By canceling your subscription you will lose access to additional locales, and you will be credited for unused time.\"\n\t\tcase AddOnLicenseType.AdvancedAnalytics:\n\t\t\treturn `By canceling your subscription you will lose access to ${getAddOnLicenseTypeName(AddOnLicenseType.AdvancedAnalytics)}, and you'll be credited for any unused time.`\n\t\tcase AddOnLicenseType.CustomProxySetup:\n\t\t\treturn \"By canceling your subscription, your Canonical URL will be removed, and you\u2019ll be credited for any unused time.\"\n\t\tcase AddOnLicenseType.Bandwidth:\n\t\t\treturn \"By canceling your subscription you will lose access to additional bandwidth, and you\u2019ll be credited for unused time.\"\n\t\tcase AddOnLicenseType.Pages:\n\t\t\treturn \"By canceling your subscription you will lose access to have additional pages, and you\u2019ll be credited for unused time.\"\n\t\tcase AddOnLicenseType.CmsCollections:\n\t\t\treturn \"By canceling your subscription you will lose access to additional collections, and you\u2019ll be credited for unused time.\"\n\t\tcase AddOnLicenseType.CmsItems:\n\t\t\treturn \"By canceling your subscription you will lose access to additional CMS items, and you will be credited for unused time.\"\n\t\tdefault:\n\t\t\tassertNever(licenseType)\n\t}\n}\n\nfunction pollUntilDisabled(\n\tlicenseType: AddOnLicenseType,\n\t{ featureFlags, resourceLimits }: ProjectSettings,\n\tpreviousResourceLimits: ProjectSettingsResourceLimits | null,\n): boolean {\n\tswitch (licenseType) {\n\t\tcase AddOnLicenseType.Locale:\n\t\t\treturn resourceLimits.locales === 0\n\t\tcase AddOnLicenseType.AdvancedAnalytics:\n\t\t\treturn featureFlags.canUseAdvancedAnalytics !== \"on\"\n\t\tcase AddOnLicenseType.CustomProxySetup:\n\t\t\treturn featureFlags.canUseCustomCanonicalUrl !== \"on\"\n\t\tcase AddOnLicenseType.Bandwidth: {\n\t\t\tconst currentLimit = resourceLimits.bandwidthInGB\n\t\t\t// Unlimited bandwidth users shouldn't be purchasing bandwidth add-ons\n\t\t\tif (currentLimit === null) return true\n\t\t\tconst previousLimit = previousResourceLimits?.bandwidthInGB\n\t\t\tif (!previousLimit) return true\n\t\t\treturn currentLimit < previousLimit\n\t\t}\n\t\tcase AddOnLicenseType.Pages: {\n\t\t\tconst currentLimit = resourceLimits.pages\n\t\t\t// Unlimited pages users shouldn't be purchasing pages add-ons\n\t\t\tif (currentLimit === null) return true\n\t\t\tconst previousLimit = previousResourceLimits?.pages\n\t\t\tif (!previousLimit) return true\n\t\t\treturn currentLimit < previousLimit\n\t\t}\n\t\tcase AddOnLicenseType.CmsCollections: {\n\t\t\tconst currentLimit = resourceLimits.cmsCollections\n\t\t\t// Unlimited CMS collections users shouldn't be purchasing CMS collections add-ons\n\t\t\tif (currentLimit === null) return true\n\t\t\tconst previousLimit = previousResourceLimits?.cmsCollections\n\t\t\tif (!previousLimit) return true\n\t\t\treturn currentLimit < previousLimit\n\t\t}\n\t\tcase AddOnLicenseType.CmsItems: {\n\t\t\tconst currentLimit = resourceLimits.cmsItems\n\t\t\t// Unlimited CMS items users shouldn't be purchasing CMS items add-ons\n\t\t\tif (currentLimit === null) return true\n\t\t\tconst previousLimit = previousResourceLimits?.cmsItems\n\t\t\tif (!previousLimit) return true\n\t\t\treturn currentLimit < previousLimit\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(licenseType)\n\t}\n}\n", "import type { PaidProjectLicenseType } from \"@framerjs/app-shared\"\nimport { getProjectLicenseName, openNewTab } from \"@framerjs/app-shared\"\nimport { Link, Stack, T } from \"@framerjs/fresco\"\nimport { format } from \"date-fns\"\nimport engine from \"document/engine.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback } from \"react\"\nimport { contactSupportURL, legacyPlansURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport type { PlanPrice } from \"../api/licenseSettings.ts\"\nimport type { CurrentSiteSubscription } from \"../api/subscriptions.ts\"\nimport { SubscriptionStatus, getBillingPortalUrl } from \"../api/subscriptions.ts\"\nimport { showReactivatePlanToast } from \"../utils/reactivatePlanToast.ts\"\nimport * as styles from \"./CurrentPlanAction.styles.ts\"\nimport { PlanButton } from \"./PlansCard.tsx\"\n\ninterface LegacyPlanContainerProps {\n\tprojectId: string\n\tcurrentSiteSubscription: CurrentSiteSubscription\n\trefreshSubscriptions: () => Promise<void>\n\treactivatePlan: (selectedProjectLicenseType: PaidProjectLicenseType, planPrice: PlanPrice) => Promise<boolean>\n\tplanPrice: PlanPrice\n\tcurrentProjectLicenseType: PaidProjectLicenseType\n\tpreviewingProjectLicenseType?: PaidProjectLicenseType\n}\n\nexport function LegacyPlanContainer({\n\tprojectId,\n\tcurrentSiteSubscription,\n\trefreshSubscriptions,\n\treactivatePlan,\n\tplanPrice,\n\tcurrentProjectLicenseType,\n\tpreviewingProjectLicenseType,\n}: LegacyPlanContainerProps) {\n\tconst page = Pages.siteSettingsPlansLegacyProjectPlanView\n\n\tuseRecordEffect(\"ui_impression\", { page })\n\n\tconst planName = getProjectLicenseName(currentProjectLicenseType)\n\n\tconst handleCancelSubscription = useCallback(() => {\n\t\tif (currentSiteSubscription) {\n\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.cancelSitePlan })\n\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.PlanCancellation,\n\t\t\t\tprojectId,\n\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\tnextBillDate: currentSiteSubscription.nextBillDate,\n\t\t\t\trefreshSubscriptions,\n\t\t\t\tsource: \"settings\",\n\t\t\t\tprice: planPrice.amount,\n\t\t\t\tcurrency: planPrice.currency,\n\t\t\t})\n\t\t}\n\t}, [page, currentSiteSubscription, projectId, currentProjectLicenseType, planPrice, refreshSubscriptions])\n\n\tconst handleReactivateSubscription = useCallback(() => {\n\t\tif (currentSiteSubscription?.period) {\n\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.reactivateSitePlan })\n\n\t\t\tvoid reactivatePlan(currentProjectLicenseType, planPrice).then(\n\t\t\t\tsuccess => success && showReactivatePlanToast(currentProjectLicenseType, currentSiteSubscription.nextBillDate),\n\t\t\t)\n\t\t}\n\t}, [page, currentSiteSubscription, currentProjectLicenseType, planPrice, reactivatePlan])\n\n\tif (currentSiteSubscription?.status === SubscriptionStatus.Cancelled && currentSiteSubscription.nextBillDate) {\n\t\tconst expirationDate = format(currentSiteSubscription.nextBillDate, \"MMM do, yyyy\")\n\t\tconst isReactivating = previewingProjectLicenseType === currentProjectLicenseType\n\n\t\treturn (\n\t\t\t<Stack direction=\"column\" className={styles.currentPlanAction} data-testid=\"legacy-plan-container\">\n\t\t\t\t<span>\n\t\t\t\t\tYour site is currently on a canceled{\" \"}\n\t\t\t\t\t<Link variant=\"linkLined\" href={legacyPlansURL} rel=\"noopener noreferrer\">\n\t\t\t\t\t\tlegacy {planName} plan\n\t\t\t\t\t</Link>\n\t\t\t\t\t{\". \"}\n\t\t\t\t\tIt will expire on {expirationDate}.\n\t\t\t\t</span>\n\n\t\t\t\t<PlanButton\n\t\t\t\t\tonClick={isReactivating || handleReactivateSubscription}\n\t\t\t\t\thighlight={false}\n\t\t\t\t\tdata-testid=\"reactivate-legacy-plan-button\"\n\t\t\t\t>\n\t\t\t\t\t<T>Reactivate</T>\n\t\t\t\t</PlanButton>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack direction=\"column\" className={styles.currentPlanAction} data-testid=\"legacy-plan-container\">\n\t\t\t<span>\n\t\t\t\tYour site is currently on a{\" \"}\n\t\t\t\t<Link variant=\"linkLined\" href={legacyPlansURL} rel=\"noopener noreferrer\">\n\t\t\t\t\tlegacy {planName} plan\n\t\t\t\t</Link>\n\t\t\t\t{\".\"}\n\t\t\t</span>\n\n\t\t\t<PlanButton onClick={handleCancelSubscription} highlight={false} data-testid=\"cancel-legacy-plan-button\">\n\t\t\t\t<T>Cancel Subscription</T>\n\t\t\t</PlanButton>\n\t\t</Stack>\n\t)\n}\n\nexport function ReactivatePastDuePlanContainer({ teamId }: { teamId: string }) {\n\tconst page = Pages.siteSettingsPlansReactivatePastDuePlanView\n\n\tuseRecordEffect(\"ui_impression\", { page })\n\n\tconst handleReactivatePastDuePlan = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.updateBilling })\n\t\topenNewTab(getBillingPortalUrl(teamId))\n\t}, [teamId, page])\n\n\treturn (\n\t\t<Stack direction=\"column\" className={styles.currentPlanAction} data-testid=\"reactivate-past-due-plan-container\">\n\t\t\t<span>\n\t\t\t\tOne or more of your subscriptions is past due. Please update your billing details to reactivate the subscription\n\t\t\t\tor{\" \"}\n\t\t\t\t<Link variant=\"linkLined\" href={contactSupportURL} rel=\"noopener noreferrer\">\n\t\t\t\t\tcontact support\n\t\t\t\t</Link>{\" \"}\n\t\t\t\tif you need help.\n\t\t\t</span>\n\n\t\t\t<PlanButton onClick={handleReactivatePastDuePlan} highlight={false} data-testid=\"reactivate-past-due-plan-button\">\n\t\t\t\t<T>Update Billing Details</T>\n\t\t\t</PlanButton>\n\t\t</Stack>\n\t)\n}\n", "import { type ProjectLicenseType, getProjectLicenseName } from \"@framerjs/app-shared\"\nimport { format } from \"date-fns\"\nimport { toast } from \"web/lib/toaster.ts\"\n\nexport function showReactivatePlanToast(projectLicenseType: ProjectLicenseType, nextSiteBillDate: Date): void {\n\tconst sitePlanTitle = getProjectLicenseName(projectLicenseType)\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"success\",\n\t\ttext: `Your ${sitePlanTitle} subscription has been reactivated and will automatically renew on ${format(\n\t\t\tnextSiteBillDate,\n\t\t\t\"MMM do, yyyy\",\n\t\t)}`,\n\t\tduration: 5000,\n\t})\n}\n", "import \"CurrentPlanAction.styles_z6xubp.wyw.css\"; export const currentPlanAction = \"currentPlanAction_c1c5we09\";", "import { ProjectLicensePeriod, openNewTab } from \"@framerjs/app-shared\"\nimport {\n\tButton,\n\tFixedPositionTooltip,\n\tBadge as FrescoBadge,\n\tIconInfo,\n\tSpinner,\n\tStack,\n\ttruncateWithEllipsis,\n\tuseTooltip,\n} from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { tabularNumbers } from \"app/styles/typography.styles.ts\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { enterpriseLearnMoreURL } from \"utils/staticURLs.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./PlansCard.styles.ts\"\n\nexport function EnterpriseCard() {\n\treturn (\n\t\t<Stack\n\t\t\tclassName={cx(styles.planCard, styles.enterpriseCard)}\n\t\t\tpadding={15}\n\t\t\tgap={15}\n\t\t\tdirection=\"row\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\talignItems=\"center\"\n\t\t>\n\t\t\t<div className={styles.description}>\n\t\t\t\t<span className={styles.licenseName}>Enterprise</span> \u2014 Custom limits, enterprise-grade security, SSO, SLAs,\n\t\t\t\tdedicated support, and more\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\tclassName={styles.enterpriseButton}\n\t\t\t\tonClick={() => {\n\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\tpage: Pages.siteSettingsPlans,\n\t\t\t\t\t\tid: UIInteraction.learnMore,\n\t\t\t\t\t})\n\t\t\t\t\topenNewTab(enterpriseLearnMoreURL)\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\tRequest Trial\n\t\t\t</Button>\n\t\t</Stack>\n\t)\n}\n\nexport function PlansCard({\n\tlicenseName,\n\tbadge,\n\tperiodToggle,\n\tdisplayPrice,\n\thighlight,\n\tfeatures,\n\taddOns,\n\tbuttons,\n\t\"data-testid\": dataTestId,\n}: {\n\tlicenseName: string\n\t/** Text to show on the badge next to the title, if passed. */\n\tbadge?: React.ReactNode\n\tperiodToggle: React.ReactNode\n\tdisplayPrice: React.ReactNode\n\thighlight: boolean\n\tfeatures: React.ReactNode\n\taddOns: React.ReactNode\n\tbuttons: React.ReactNode\n\t\"data-testid\"?: string\n}) {\n\treturn (\n\t\t<Stack\n\t\t\tdata-testid={dataTestId}\n\t\t\tclassName={cx(styles.planCard, highlight && \"highlight\")}\n\t\t\tpadding={15}\n\t\t\tgap={15}\n\t\t\tdirection=\"column\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t>\n\t\t\t<Stack gap={15} direction=\"column\">\n\t\t\t\t<Stack gap={10} direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n\t\t\t\t\t<Stack gap={10} direction=\"row\">\n\t\t\t\t\t\t<div className={styles.licenseName}>{licenseName}</div>\n\t\t\t\t\t\t{badge}\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{periodToggle}\n\t\t\t\t</Stack>\n\t\t\t\t<div className={styles.separator} />\n\t\t\t\t{displayPrice}\n\t\t\t\t<div className={styles.separator} />\n\t\t\t\t<Stack gap={10} direction=\"column\">\n\t\t\t\t\t{features}\n\t\t\t\t</Stack>\n\t\t\t\t{addOns && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={styles.separator} />\n\t\t\t\t\t\t<Stack gap={10} direction=\"column\">\n\t\t\t\t\t\t\t<div className={styles.description}>Active add-ons:</div>\n\t\t\t\t\t\t\t{addOns}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t\t<Stack gap={15} direction=\"column\" style={{ flexGrow: 0 }}>\n\t\t\t\t{buttons}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nexport function PlanBadge({\n\tchildren,\n\t\"data-testid\": dataTestId,\n}: {\n\tchildren: \"Popular\" | \"Recommended\" | \"Current\"\n\t\"data-testid\": string\n}) {\n\treturn (\n\t\t<FrescoBadge data-testid={dataTestId} className={styles.badge}>\n\t\t\t{children}\n\t\t</FrescoBadge>\n\t)\n}\n\nexport function DisplayPrice({ price, period }: { price: string; period: string }) {\n\treturn (\n\t\t<Stack gap={5} direction=\"column\">\n\t\t\t<div className={cx(styles.displayPrice, tabularNumbers)}>{price}</div>\n\t\t\t<div className={cx(styles.description, truncateWithEllipsis)}>{period}</div>\n\t\t</Stack>\n\t)\n}\n\nexport function AnnualOnly() {\n\treturn <div className={styles.toggleText}>Annual Only</div>\n}\n\nexport function PeriodToggle({\n\tperiod,\n\tsetPeriod,\n\t\"data-testid\": dataTestId,\n}: {\n\tperiod: ProjectLicensePeriod\n\tsetPeriod: (period: ProjectLicensePeriod) => void\n\t\"data-testid\": string\n}) {\n\tconst id = useId()\n\tconst onChangeHandler = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tconst target = event.target as HTMLInputElement\n\t\t\tsetPeriod(target.checked ? ProjectLicensePeriod.Year : ProjectLicensePeriod.Month)\n\t\t},\n\t\t[setPeriod],\n\t)\n\tconst checked = period === ProjectLicensePeriod.Year\n\n\treturn (\n\t\t<Stack gap={5} direction=\"row\" alignItems=\"center\">\n\t\t\t<label className={styles.toggleText} htmlFor={id}>\n\t\t\t\tAnnual\n\t\t\t</label>\n\t\t\t<div draggable={false} className={cx(styles.toggleWrapper, checked && styles.toggleChecked)}>\n\t\t\t\t<input\n\t\t\t\t\tid={id}\n\t\t\t\t\tonChange={onChangeHandler}\n\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\tchecked={checked}\n\t\t\t\t\tclassName={styles.toggleInput}\n\t\t\t\t\tdata-testid={dataTestId}\n\t\t\t\t/>\n\t\t\t\t<div className={styles.toggleTack} />\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n\n//\n// BUTTONS\n//\n\nexport function OverLimitsButton({\n\ttooltipText,\n\t\"data-testid\": dataTestId,\n}: {\n\ttooltipText: string\n\t\"data-testid\": string\n}) {\n\tconst triggerRef = useRef<HTMLDivElement>(null)\n\tconst { triggerProps, tooltipProps } = useTooltip({\n\t\tclassName: styles.planActionTooltip,\n\t\tdirection: \"right\",\n\t\ttriggerRef,\n\t})\n\treturn (\n\t\t<div data-testid={dataTestId} ref={triggerRef} {...triggerProps}>\n\t\t\t<Button enabled={false} className={styles.planButton}>\n\t\t\t\t<IconInfo /> Over limits\n\t\t\t</Button>\n\t\t\t<FixedPositionTooltip {...tooltipProps}>{tooltipText}</FixedPositionTooltip>\n\t\t</div>\n\t)\n}\n\nexport function PlanButton({\n\thighlight,\n\tonClick,\n\tchildren,\n\t\"data-testid\": dataTestId,\n}: {\n\thighlight: boolean\n\t/** Pass a callback, false to disable the button, true to show a spinner */\n\tonClick: (() => void) | false | true\n\tchildren: React.ReactNode\n\t\"data-testid\": string\n}) {\n\tconst variant = highlight ? \"primary\" : undefined\n\treturn onClick === true ? (\n\t\t<Button enabled={false} className={styles.planButton} variant={variant} data-testid={dataTestId}>\n\t\t\t<Spinner />\n\t\t</Button>\n\t) : (\n\t\t<Button\n\t\t\tenabled={Boolean(onClick)}\n\t\t\tclassName={styles.planButton}\n\t\t\tonClick={onClick || undefined}\n\t\t\tvariant={variant}\n\t\t\tdata-testid={dataTestId}\n\t\t>\n\t\t\t{children}\n\t\t</Button>\n\t)\n}\n", "import \"PlansCard.styles_ptahnd.wyw.css\"; export const planCard = \"planCard_pddes9z\";\nexport const separator = \"separator_s35zag8\";\nexport const licenseName = \"licenseName_l197pr9c\";\nexport const displayPrice = \"displayPrice_d25qzvq\";\nexport const description = \"description_d6eyrl\";\nexport const enterpriseCard = \"enterpriseCard_elkd4da\";\nexport const toggleText = \"toggleText_try0qp3\";\nexport const toggleWrapper = \"toggleWrapper_t73uhps\";\nexport const toggleTack = \"toggleTack_t12sdp1j\";\nexport const toggleChecked = \"toggleChecked_t1drerjh\";\nexport const toggleInput = \"toggleInput_tli7q67\";\nexport const badge = \"badge_b18oex8y\";\nexport const planActionTooltip = \"planActionTooltip_p1dn3ldo\";\nexport const planButton = \"planButton_p1ik4k6n\";\nexport const enterpriseButton = \"enterpriseButton_e10fqsb2\";", "import { ProjectLicensePeriod, ProjectLicenseType, dashboardPath } from \"@framerjs/app-shared\"\nimport { Link, Translatable as T } from \"@framerjs/fresco\"\nimport { format } from \"date-fns\"\nimport { useCallback } from \"react\"\nimport { pricingURL } from \"utils/staticURLs.ts\"\nimport type { Pages } from \"web/lib/tracker.ts\"\nimport { UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { Tab } from \"web/pages/projects/components/settings/team/types.ts\"\nimport type { CurrentSiteSubscription } from \"../api/subscriptions.ts\"\nimport { SubscriptionStatus } from \"../api/subscriptions.ts\"\nimport * as styles from \"./CurrentPlanDescription.styles.ts\"\n\nexport function CurrentPlanDescription(props: {\n\tpage: Pages\n\tteamId: string\n\tcurrentSiteSubscription: CurrentSiteSubscription | null\n\tcurrentProjectLicenseType: ProjectLicenseType\n}) {\n\tconst { currentSiteSubscription, currentProjectLicenseType, teamId, page } = props\n\n\tconst onOpenBillingPortal = useCallback(\n\t\t() => record(\"ui_interaction\", { page, id: UIInteraction.openBillingPortal }),\n\t\t[page],\n\t)\n\n\tif (currentProjectLicenseType === ProjectLicenseType.FreeSite || !currentSiteSubscription) {\n\t\treturn (\n\t\t\t<div className={styles.description}>\n\t\t\t\t<T>You are currently on a free site plan. Select any</T>\n\t\t\t\t<br />\n\t\t\t\t<T>of the plans that fits your needs.</T>{\" \"}\n\t\t\t\t<Link variant=\"linkLined\" href={pricingURL} rel=\"noopener noreferrer\">\n\t\t\t\t\tLearn more\n\t\t\t\t</Link>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tconst monthlyOrYearly = currentSiteSubscription.period === ProjectLicensePeriod.Year ? \"yearly\" : \"monthly\"\n\tconst nextBillDate = format(currentSiteSubscription.nextBillDate, \"MMM do, yyyy\")\n\treturn (\n\t\t<div className={styles.description}>\n\t\t\t<T>\n\t\t\t\t{currentSiteSubscription.status === SubscriptionStatus.Cancelled\n\t\t\t\t\t? `This site plan has been cancelled and will expire on ${nextBillDate}.`\n\t\t\t\t\t: `This site is charged on a ${monthlyOrYearly} basis and renews on ${nextBillDate}.`}\n\t\t\t</T>{\" \"}\n\t\t\t<T>To view all your plans and invoices, check your billing overview </T>\n\t\t\t<Link\n\t\t\t\tvariant=\"linkLined\"\n\t\t\t\thref={`${dashboardPath}?team=${teamId}&open-settings=1&settings-tab=${Tab.Plans}`}\n\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\tonClick={onOpenBillingPortal}\n\t\t\t>\n\t\t\t\there\n\t\t\t</Link>\n\t\t</div>\n\t)\n}\n", "import \"CurrentPlanDescription.styles_u5wfo.wyw.css\"; export const description = \"description_d1a5x1z2\";", "import \"DomainVoucherBadge.styles_z5pzep.wyw.css\"; export const container = \"container_c2izond\";\nexport const iconContainer = \"iconContainer_i6qjqi8\";\nexport const icon = \"icon_i1tvh4at\";\nexport const text = \"text_t1ping7v\";\nexport const button = \"button_b1c6pboh\";", "import { ProjectLicensePeriod } from \"@framerjs/app-shared\"\nimport { Button, IconGift, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./DomainVoucherBadge.styles.ts\"\n\ninterface DomainVoucherBadgeProps {\n\tperiod: ProjectLicensePeriod\n\tsetPeriod: (period: ProjectLicensePeriod) => void\n}\n\nexport function DomainVoucherBadge({ period, setPeriod }: DomainVoucherBadgeProps) {\n\tconst isAnnual = period === ProjectLicensePeriod.Year\n\n\tconst handleSwitchToAnnual = () => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.domainVoucherBadge,\n\t\t\tid: UIInteraction.toogleBillingPeriodToYearly,\n\t\t})\n\t\tsetPeriod(ProjectLicensePeriod.Year)\n\t}\n\n\treturn (\n\t\t<Stack direction=\"row\" alignItems=\"center\" gap={15} className={styles.container}>\n\t\t\t<div className={styles.iconContainer}>\n\t\t\t\t<IconGift className={styles.icon} />\n\t\t\t</div>\n\t\t\t<span className={styles.text}>\n\t\t\t\t<T>Select an annual plan and get a free domain for your first year.</T>\n\t\t\t</span>\n\t\t\t{!isAnnual && (\n\t\t\t\t<Button className={styles.button} onClick={handleSwitchToAnnual}>\n\t\t\t\t\t<T>Switch to Annual</T>\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"PlanFeatures.styles_1se9gvi.wyw.css\"; export const feature = \"feature_f1a74ilb\";\nexport const featureText = \"featureText_f1cyku6d\";\nexport const description = \"description_d1tui567\";", "import { ProjectLicenseType, getProjectLicenseName } from \"@framerjs/app-shared\"\nimport { Stack, T, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./PlanFeatures.styles.ts\"\n\nexport function PlanFeatures({\n\tlicenseType,\n}: {\n\tlicenseType: ProjectLicenseType.BasicSite2025 | ProjectLicenseType.ProSite2025 | ProjectLicenseType.ScaleSite2025\n}) {\n\tswitch (licenseType) {\n\t\tcase ProjectLicenseType.BasicSite2025:\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 5 8 L 4 9 C 2.067 10.933 2.067 14.067 4 16 L 4 16 C 5.933 17.933 9.067 17.933 11 16 L 12 15 M 15 12 L 16 11 C 17.933 9.067 17.933 5.933 16 4 L 16 4 C 14.067 2.067 10.933 2.067 9 4 L 8 5 M 8.5 11.5 L 11.5 8.5\"\n\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Connect your own domain\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 14.167 3.267 C 15.226 3.055 16.055 2.226 16.267 1.167 L 16.267 1.167 C 16.318 0.912 16.682 0.912 16.733 1.167 L 16.733 1.167 C 16.945 2.226 17.774 3.055 18.833 3.267 L 18.833 3.267 C 19.088 3.318 19.088 3.682 18.833 3.733 L 18.833 3.733 C 17.774 3.945 16.945 4.774 16.733 5.833 L 16.733 5.833 C 16.682 6.088 16.318 6.088 16.267 5.833 L 16.267 5.833 C 16.055 4.774 15.226 3.945 14.167 3.733 L 14.167 3.733 C 13.912 3.682 13.912 3.318 14.167 3.267 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 4.552 9.69 C 6.135 9.373 7.373 8.135 7.69 6.552 L 8.389 3.056 C 8.522 2.388 9.478 2.388 9.611 3.056 L 10.31 6.552 C 10.627 8.135 11.865 9.373 13.448 9.69 L 16.944 10.389 C 17.612 10.522 17.612 11.478 16.944 11.611 L 13.448 12.31 C 11.865 12.627 10.627 13.865 10.31 15.448 L 9.611 18.944 C 9.478 19.612 8.522 19.612 8.389 18.944 L 7.69 15.448 C 7.373 13.865 6.135 12.627 4.552 12.31 L 1.056 11.611 C 0.388 11.478 0.388 10.522 1.056 10.389 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"AI-powered design tools\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 11 1.079 C 11 0.591 10.372 0.392 10.091 0.792 L 2.054 12.212 C 1.821 12.544 2.058 13 2.463 13 L 8.5 13 C 8.776 13 9 13.224 9 13.5 L 9 18.921 C 9 19.409 9.628 19.608 9.909 19.208 L 17.946 7.788 C 18.179 7.456 17.942 7 17.537 7 L 11.5 7 C 11.224 7 11 6.776 11 6.5 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Fast and secure hosting\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 14.8 14.8 L 18 18 M 9.2 2 C 13.176 2 16.4 5.224 16.4 9.2 C 16.4 13.176 13.176 16.4 9.2 16.4 C 5.224 16.4 2 13.176 2 9.2 C 2 5.224 5.224 2 9.2 2 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\t\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Built-in SEO\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)\n\t\tcase ProjectLicenseType.ProSite2025:\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.featureText, styles.description)}>\n\t\t\t\t\t\tEverything from {getProjectLicenseName(ProjectLicenseType.BasicSite2025)}, plus:\n\t\t\t\t\t</div>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 10 3 C 12.546 3 14.775 4.36 16 6.392 L 16 4 C 16 3.448 16.448 3 17 3 C 17.552 3 18 3.448 18 4 L 18 10 L 12 10 C 11.448 10 11 9.552 11 9 C 11 8.448 11.448 8 12 8 L 14.584 8 C 13.812 6.234 12.05 5 10 5 C 7.239 5 5 7.239 5 10 C 5 12.761 7.239 15 10 15 C 11.5 15 12.846 14.339 13.763 13.293 L 13.779 13.307 C 13.961 13.118 14.217 13 14.5 13 C 15.052 13 15.5 13.448 15.5 14 C 15.5 14.334 15.336 14.63 15.084 14.812 C 13.808 16.159 12.002 17 10 17 C 6.134 17 3 13.866 3 10 C 3 6.134 6.134 3 10 3 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Staging and instant rollback\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 10 2 C 12.209 2 14 3.791 14 6 C 14 8.209 12.209 10 10 10 C 7.791 10 6 8.209 6 6 C 6 3.791 7.791 2 10 2 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 5.5 10 C 7.709 10 9.5 11.791 9.5 14 C 9.5 16.209 7.709 18 5.5 18 C 3.291 18 1.5 16.209 1.5 14 C 1.5 11.791 3.291 10 5.5 10 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 14.5 10 C 16.709 10 18.5 11.791 18.5 14 C 18.5 16.209 16.709 18 14.5 18 C 12.291 18 10.5 16.209 10.5 14 C 10.5 11.791 12.291 10 14.5 10 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Roles and permissions\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 10 1 C 14.418 1 18 2.567 18 4.5 C 18 6.433 14.418 8 10 8 C 5.582 8 2 6.433 2 4.5 C 2 2.567 5.582 1 10 1 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 18 14.5 C 18 16.433 14.418 18 10 18 C 5.582 18 2 16.433 2 14.5 L 2 11.5 C 2 13.433 5.582 15 10 15 C 14.418 15 18 13.433 18 11.5 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t\topacity=\"0.5\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 18 9.5 C 18 11.433 14.418 13 10 13 C 5.582 13 2 11.433 2 9.5 L 2 6.5 C 2 8.433 5.582 10 10 10 C 14.418 10 18 8.433 18 6.5 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Relational CMS\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 0 7 C 0 6.448 0.448 6 1 6 L 10 6 L 6.25 2.25 C 5.836 1.836 5.836 1.164 6.25 0.75 L 6.25 0.75 C 6.664 0.336 7.336 0.336 7.75 0.75 L 13.646 6.646 C 13.842 6.842 13.842 7.158 13.646 7.354 L 7.75 13.25 C 7.336 13.664 6.664 13.664 6.25 13.25 L 6.25 13.25 C 5.836 12.836 5.836 12.164 6.25 11.75 L 10 8 L 1 8 C 0.448 8 0 7.552 0 7 Z\"\n\t\t\t\t\t\t\t\t\ttransform=\"translate(3 3) rotate(-45 7 7)\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Site redirects\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 10 1 C 14.971 1 19 5.029 19 10 C 19 14.971 14.971 19 10 19 C 5.029 19 1 14.971 1 10 C 1 5.029 5.029 1 10 1 Z M 17.498 10.182 C 16.343 10.584 15.163 10.891 13.97 11.102 C 13.839 13.525 13.279 15.651 12.467 17.085 C 15.343 16.083 17.422 13.38 17.498 10.182 Z M 2.502 10.182 C 2.578 13.38 4.657 16.083 7.533 17.085 C 6.721 15.651 6.161 13.525 6.03 11.102 C 4.837 10.891 3.657 10.584 2.502 10.182 Z M 2.609 8.719 C 3.722 9.1 4.857 9.393 6.004 9.598 C 6.057 6.886 6.643 4.486 7.533 2.915 C 4.993 3.799 3.075 6.011 2.609 8.719 Z M 17.391 8.719 C 16.925 6.011 15.007 3.799 12.467 2.915 C 13.357 4.486 13.943 6.886 13.996 9.598 C 15.143 9.393 16.278 9.1 17.391 8.719 Z M 10 17.5 C 11.231 17.5 12.254 14.831 12.462 11.317 C 10.825 11.495 9.175 11.495 7.538 11.317 C 7.746 14.831 8.769 17.5 10 17.5 Z M 10 2.5 C 8.64 2.5 7.534 5.757 7.501 9.813 C 9.162 9.996 10.838 9.996 12.499 9.813 C 12.466 5.757 11.36 2.5 10 2.5 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Multiple locales\"\n\t\t\t\t\t\taddOn\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M7 1C10.3137 1 13 3.68629 13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1ZM6.49219 3.5C6.28787 3.50008 6.15988 3.58944 6.09277 3.78418L4.02832 9.64258C3.94203 9.88548 4.05753 10.0459 4.31641 10.0459H4.84961C5.05414 10.0459 5.1851 9.95273 5.24902 9.75781L5.69336 8.43164H8.1543L8.60156 9.75781C8.66544 9.95265 8.79664 10.0458 9.00098 10.0459H9.53516C9.79398 10.0459 9.90855 9.88545 9.82227 9.64258L7.75488 3.78418C7.68775 3.58941 7.55988 3.50002 7.35547 3.5H6.49219ZM6.94922 4.84277L7.83496 7.47949H6.0127L6.89844 4.84277H6.94922Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"A/B testing\"\n\t\t\t\t\t\taddOn\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)\n\t\tcase ProjectLicenseType.ScaleSite2025:\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<div className={cx(truncateWithEllipsis, styles.featureText, styles.description)}>\n\t\t\t\t\t\tEverything from {getProjectLicenseName(ProjectLicenseType.ProSite2025)}, plus:\n\t\t\t\t\t</div>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 10 1 C 13.866 1 17 4.134 17 8 C 17 8 17 8 17 8 L 17 8 C 17 8.003 17 8.006 17 8.009 C 17 8.204 16.992 8.397 16.976 8.589 C 16.581 13.434 11.518 19 10 19 C 8.482 19 3.419 13.434 3.024 8.589 C 3.008 8.395 3 8.198 3 8 C 3 4.134 6.134 1 10 1 Z M 6 8 C 6 10.209 7.791 12 10 12 C 12.209 12 14 10.209 14 8 C 14 5.791 12.209 4 10 4 C 7.791 4 6 5.791 6 8 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Custom locale regions\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path fill=\"currentColor\" d=\"M13.5 3.5a2.5 2.5 0 1 1 5 0v13a2.5 2.5 0 1 1-5 0Z\" />\n\t\t\t\t\t\t\t\t<g opacity=\".5\">\n\t\t\t\t\t\t\t\t\t<path fill=\"currentColor\" d=\"M7.5 7.5a2.5 2.5 0 1 1 5 0v9a2.5 2.5 0 1 1-5 0Z\" />\n\t\t\t\t\t\t\t\t\t<path fill=\"currentColor\" d=\"M1.5 11.5a2.5 2.5 0 1 1 5 0v5a2.5 2.5 0 1 1-5 0Z\" />\n\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Events and funnels\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 1 11 C 1 6.029 5.029 2 10 2 L 10 2 C 14.971 2 19 6.029 19 11 L 19 14 C 19 16.209 17.209 18 15 18 L 15 18 C 14.448 18 14 17.552 14 17 L 14 13 C 14 11.895 14.895 11 16 11 L 17.317 11 C 17.418 11 17.5 10.918 17.5 10.817 L 17.5 10.817 C 17.5 6.776 14.224 3.5 10.183 3.5 L 9.817 3.5 C 5.776 3.5 2.5 6.776 2.5 10.817 L 2.5 10.817 C 2.5 10.918 2.582 11 2.683 11 L 4 11 C 5.105 11 6 11.895 6 13 L 6 17 C 6 17.552 5.552 18 5 18 L 5 18 C 2.791 18 1 16.209 1 14 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Priority support\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 9.305 0.673 C 9.692 0.298 10.308 0.298 10.695 0.673 L 12.121 2.052 C 12.342 2.266 12.651 2.366 12.956 2.323 L 14.92 2.045 C 15.454 1.97 15.952 2.331 16.045 2.863 L 16.388 4.816 C 16.441 5.12 16.631 5.382 16.904 5.527 L 18.656 6.456 C 19.132 6.709 19.323 7.294 19.086 7.779 L 18.215 9.561 C 18.079 9.838 18.079 10.162 18.215 10.439 L 19.086 12.221 C 19.323 12.706 19.132 13.291 18.656 13.544 L 16.904 14.473 C 16.631 14.618 16.441 14.88 16.388 15.184 L 16.045 17.137 C 15.952 17.669 15.454 18.03 14.92 17.955 L 12.956 17.677 C 12.651 17.634 12.342 17.734 12.121 17.948 L 10.695 19.327 C 10.308 19.702 9.692 19.702 9.305 19.327 L 7.879 17.948 C 7.658 17.734 7.349 17.634 7.044 17.677 L 5.08 17.955 C 4.546 18.03 4.048 17.669 3.955 17.137 L 3.612 15.184 C 3.559 14.88 3.369 14.618 3.096 14.473 L 1.344 13.544 C 0.868 13.291 0.677 12.706 0.914 12.221 L 1.785 10.439 C 1.921 10.162 1.921 9.838 1.785 9.561 L 0.914 7.779 C 0.677 7.294 0.868 6.709 1.344 6.456 L 3.096 5.527 C 3.369 5.382 3.559 5.12 3.612 4.816 L 3.955 2.863 C 4.048 2.331 4.546 1.97 5.08 2.045 L 7.044 2.323 C 7.349 2.366 7.658 2.266 7.879 2.052 Z M 5.707 9.293 C 5.317 9.683 5.317 10.317 5.707 10.707 L 8.646 13.646 C 8.842 13.842 9.158 13.842 9.354 13.646 L 14.793 8.207 C 15.183 7.817 15.183 7.183 14.793 6.793 L 14.707 6.707 C 14.317 6.317 13.683 6.317 13.293 6.707 L 9 11 L 7.207 9.207 C 6.817 8.817 6.183 8.817 5.793 9.207 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Premium CDN\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path fill=\"currentColor\" d=\"M5 3.5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z\" />\n\t\t\t\t\t\t\t\t<path fill=\"transparent\" stroke=\"currentColor\" d=\"M5.5 6.5H17\" />\n\t\t\t\t\t\t\t\t<g opacity=\".5\">\n\t\t\t\t\t\t\t\t\t<path fill=\"currentColor\" d=\"M15 10.5a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z\" />\n\t\t\t\t\t\t\t\t\t<path fill=\"transparent\" stroke=\"currentColor\" d=\"M14.5 13.5H3\" />\n\t\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Flexible limits\"\n\t\t\t\t\t/>\n\t\t\t\t\t<Feature\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M 13 16 C 16.59 16 19.5 13.09 19.5 9.5 L 19.5 9.5 C 19.5 5.91 16.59 3 13 3 L 13 3 C 9.41 3 6.5 5.91 6.5 9.5 L 6.5 9.667 C 6.5 9.999 6.052 10.105 5.904 9.807 L 5.224 8.447 C 5.087 8.173 4.806 8 4.5 8 L 4.5 8 L 4.056 8 C 2.092 8 0.5 9.592 0.5 11.556 L 0.5 11.556 C 0.5 14.01 2.49 16 4.944 16 Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttext=\"Advanced hosting\"\n\t\t\t\t\t\taddOn\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)\n\t}\n}\n\nfunction Feature({ icon, text, addOn }: { icon: JSX.Element; text: string; addOn?: true }) {\n\treturn (\n\t\t<Stack className={styles.feature} gap={10} direction=\"row\" alignItems=\"center\">\n\t\t\t{icon}\n\t\t\t<div className={cx(truncateWithEllipsis, styles.featureText)}>\n\t\t\t\t<T>{text}</T>\n\t\t\t\t{addOn && (\n\t\t\t\t\t<span className={styles.description}>\n\t\t\t\t\t\t<T> (add-on)</T>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n", "import type { AddOnLicenseType } from \"@framerjs/app-shared\"\nimport { getAddOnLicenseTypeName } from \"@framerjs/app-shared\"\nimport { Button, IconPopupMenu, Stack, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport React from \"react\"\nimport { AddOnActions, useAddOnContextMenu } from \"../addOns/useAddOnContextMenu.ts\"\nimport type { CurrentAddOn } from \"../api/subscriptions.ts\"\nimport * as styles from \"./PlansCardAddOns.styles.ts\"\n\nexport function PlansCardAddOns({\n\taddOns,\n\tonCancelAddOn,\n\tonViewAddOn,\n\thideCancelOption,\n}: {\n\taddOns: CurrentAddOn[]\n\tonCancelAddOn: (addOn: CurrentAddOn) => void\n\tonViewAddOn: (props: { licenseType: AddOnLicenseType }) => void\n\thideCancelOption: boolean\n}) {\n\treturn (\n\t\t<>\n\t\t\t{addOns.map(addOn => (\n\t\t\t\t<PlansCardAddOnItem\n\t\t\t\t\tdata-testid={`current-add-on-${addOn.licenseType}`}\n\t\t\t\t\tkey={addOn.plan}\n\t\t\t\t\tonCancelAddOn={() => onCancelAddOn(addOn)}\n\t\t\t\t\tonViewAddOn={() => onViewAddOn({ licenseType: addOn.licenseType })}\n\t\t\t\t\thideCancelOption={hideCancelOption}\n\t\t\t\t>\n\t\t\t\t\t{getAddOnLicenseTypeName(addOn.licenseType)}\n\t\t\t\t</PlansCardAddOnItem>\n\t\t\t))}\n\t\t</>\n\t)\n}\n\ninterface PlansCardAddOnItemProps {\n\tchildren: React.ReactNode\n\tonCancelAddOn: () => void\n\tonViewAddOn: () => void\n\thideCancelOption: boolean\n\t\"data-testid\"?: string\n}\n\nfunction PlansCardAddOnItem({\n\tchildren,\n\tonCancelAddOn,\n\tonViewAddOn,\n\thideCancelOption,\n\t\"data-testid\": dataTestId,\n}: PlansCardAddOnItemProps) {\n\tconst [isHovered, setIsHovered] = React.useState(false)\n\tconst [isMenuOpen, setIsMenuOpen] = React.useState(false)\n\tconst buttonRef = React.useRef<HTMLButtonElement>(null)\n\tconst showAddOnContextMenu = useAddOnContextMenu({ hideCancelOption })\n\n\tconst showMenuButton = isHovered || isMenuOpen\n\n\tasync function onAddOnOptionsMenuClick() {\n\t\tif (buttonRef.current === null) return\n\t\tconst rect = buttonRef.current.getBoundingClientRect()\n\n\t\tsetIsMenuOpen(true)\n\t\tconst addOnAction = await showAddOnContextMenu({\n\t\t\tlocation: { x: rect.left, y: rect.bottom + 5 },\n\t\t})\n\t\tsetIsMenuOpen(false)\n\n\t\tif (!addOnAction) return\n\n\t\tswitch (addOnAction) {\n\t\t\tcase AddOnActions.View:\n\t\t\t\tonViewAddOn()\n\t\t\t\tbreak\n\t\t\tcase AddOnActions.CancelAddOn:\n\t\t\t\tonCancelAddOn()\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(addOnAction)\n\t\t}\n\t}\n\n\treturn (\n\t\t<Stack\n\t\t\tclassName={styles.addOn}\n\t\t\tgap={10}\n\t\t\tdirection=\"row\"\n\t\t\talignItems=\"center\"\n\t\t\tjustifyContent=\"space-between\"\n\t\t\tonMouseEnter={() => setIsHovered(true)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\tdata-testid={dataTestId}\n\t\t>\n\t\t\t<Stack gap={10} direction=\"row\" alignItems=\"center\" className={styles.addOnText}>\n\t\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 20 20\" aria-hidden=\"true\">\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 10 1 C 14.971 1 19 5.029 19 10 C 19 14.971 14.971 19 10 19 C 5.029 19 1 14.971 1 10 C 1 5.029 5.029 1 10 1 Z M 5 10 C 5 10.552 5.448 11 6 11 L 9 11 L 9 14 C 9 14.552 9.448 15 10 15 C 10.552 15 11 14.552 11 14 L 11 11 L 14 11 C 14.552 11 15 10.552 15 10 C 15 9.448 14.552 9 14 9 L 11 9 L 11 6 C 11 5.448 10.552 5 10 5 C 9.448 5 9 5.448 9 6 L 9 9 L 6 9 C 5.448 9 5 9.448 5 10 Z\"\n\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t\t<div className={cx(truncateWithEllipsis, styles.addOnText)}>{children}</div>\n\t\t\t</Stack>\n\t\t\t{showMenuButton && (\n\t\t\t\t<Button variant=\"clean\" ref={buttonRef} onClick={onAddOnOptionsMenuClick} className={styles.menuButton}>\n\t\t\t\t\t<IconPopupMenu />\n\t\t\t\t</Button>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"PlansCardAddOns.styles_1tl5x0m.wyw.css\"; export const addOn = \"addOn_a1c46jrt\";\nexport const addOnText = \"addOnText_ajm8u09\";\nexport const menuButton = \"menuButton_m2f3z8p\";\nexport const addOnIcon = \"addOnIcon_a99u3if\";", "import { Button, Link, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type React from \"react\"\nimport { contactSupportURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { type Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { PlansInfo } from \"./PlansInfo.tsx\"\n\ninterface Props {\n\tpage: Pages\n\ttitle?: string\n\tupdatePaymentMethodTitle?: string\n\tbody: React.ReactNode\n\tupdatePaymentMethod?: () => void\n\tbackToPlans?: () => Promise<void>\n\tmanageEditors?: () => void\n\ttryAgain?: () => void\n}\n\nexport function PlansError(props: Props) {\n\tconst {\n\t\ttitle = \"Something went wrong\",\n\t\tupdatePaymentMethodTitle = \"Update Payment Method\",\n\t\tpage,\n\t\tbody,\n\t\tupdatePaymentMethod,\n\t\tbackToPlans,\n\t\tmanageEditors,\n\t\ttryAgain,\n\t} = props\n\n\tuseRecordEffect(\"ui_impression\", { page }, [page])\n\n\treturn (\n\t\t<PlansInfo\n\t\t\ticon=\"error\"\n\t\t\ttitle={title}\n\t\t\tbody={body}\n\t\t\tbutton={\n\t\t\t\t<Stack direction=\"row\" gap={10}>\n\t\t\t\t\t{tryAgain && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.tryAgain })\n\t\t\t\t\t\t\t\ttryAgain()\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>{Dictionary.TryAgain}</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{updatePaymentMethod && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.updateBilling })\n\t\t\t\t\t\t\t\tupdatePaymentMethod()\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>{updatePaymentMethodTitle}</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{manageEditors && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.manageEditors })\n\t\t\t\t\t\t\t\tmanageEditors()\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>Manage Editors</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t\t{backToPlans && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\trecord(\"ui_interaction\", { page, id: UIInteraction.backToPlans })\n\t\t\t\t\t\t\t\tvoid backToPlans()\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>Back to Plans</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t/>\n\t)\n}\n\nexport function PlainErrorBody({ message }: { message: string }) {\n\treturn <T>{message}</T>\n}\n\nexport function StandardErrorBody({ message }: { message: string }) {\n\treturn (\n\t\t<>\n\t\t\t<T>{message} Please check your Internet connection and try again. If the problem persists, </T>\n\t\t\t<Link href={contactSupportURL}>\n\t\t\t\t<T>contact support</T>\n\t\t\t</Link>\n\t\t\t.\n\t\t</>\n\t)\n}\n\nexport function RefreshErrorBody({ message }: { message: string }) {\n\treturn (\n\t\t<>\n\t\t\t<T>{message} Please refresh this page and try again. If the problem persists, </T>\n\t\t\t<Link href={contactSupportURL}>\n\t\t\t\t<T>contact support</T>\n\t\t\t</Link>\n\t\t\t.\n\t\t</>\n\t)\n}\n", "import type { ProjectLicensePeriod, ProjectLicenseType, TeamLicenseType } from \"@framerjs/app-shared\"\nimport { ProjectLicensePeriod as LicensePeriod, getProjectLicenseName } from \"@framerjs/app-shared\"\nimport { Button, Spinner, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { assertNever, unhandledError } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport type React from \"react\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useTrackPurchaseSuccess } from \"web/lib/useTrackPurchaseSuccess.tsx\"\nimport { useTrackVantaraEventEffect } from \"web/lib/vantara/app.ts\"\nimport type { LicenseSettings } from \"../api/licenseSettings.ts\"\nimport * as styles from \"./PlansInfo.styles.ts\"\nimport { PlansInfo } from \"./PlansInfo.tsx\"\n\nexport enum CheckoutSuccessOperation {\n\tPlanPurchase,\n\tSitePlanUpgrade,\n}\n\ninterface Props {\n\tcurrentTeamPlanType: TeamLicenseType\n\tcurrentSitePlanType: ProjectLicenseType\n\tpreviousSitePlanType: ProjectLicenseType\n\tpreviousProjectPeriod?: ProjectLicensePeriod\n\tcurrentSiteBillingPeriod: ProjectLicensePeriod | null\n\tlicensesSettings: LicenseSettings[] | null\n\toperation: CheckoutSuccessOperation\n\tteamCurrentEditors: number\n\tonReset: () => void\n}\n\nexport function PlansSuccess(props: Props) {\n\tconst {\n\t\tcurrentTeamPlanType,\n\t\tcurrentSitePlanType,\n\t\tpreviousSitePlanType,\n\t\tpreviousProjectPeriod,\n\t\tcurrentSiteBillingPeriod,\n\t\tlicensesSettings,\n\t\toperation,\n\t\tteamCurrentEditors,\n\t\tonReset,\n\t} = props\n\n\tuseTrackPurchaseSuccess({\n\t\t// the first editor is always free, but it is possible to have\n\t\t// `teamCurrentEditors === 0` if a Framer employee is the only editor\n\t\tpaidEditors: Math.max(0, teamCurrentEditors - 1),\n\t\tsitePlan: currentSitePlanType,\n\t\tteamPlan: currentTeamPlanType,\n\t\tbillingPeriod: currentSiteBillingPeriod ?? undefined,\n\t\tpreviousSitePlanType,\n\t\tlicensesSettings: licensesSettings ?? [],\n\t\tpreviousProjectPeriod,\n\t})\n\n\tuseTrackVantaraEventEffect(\n\t\t\"upgrade_success_viewed\",\n\t\t{\n\t\t\tpreviousPlan: previousSitePlanType,\n\t\t\tcurrentPlan: currentSitePlanType,\n\t\t\toperation: operation === CheckoutSuccessOperation.PlanPurchase ? \"purchase\" : \"upgrade\",\n\t\t},\n\t\t[previousSitePlanType, currentSitePlanType, operation],\n\t)\n\n\tconst { publishStore } = engine.stores\n\n\tconst canPublish = publishStore.canPublish()\n\tconst publishStatus = publishStore.useState(state => state.publishStatus)\n\tconst customHostname = publishStore.useState(state => state.customHostname)\n\n\tconst domainVoucher = engine.stores.projectStore.useState(state => state.project?.license.domainVoucher)\n\tconst isFreeDomainsEnabled = useExperimentIsOn(\"freeDomains\")\n\tconst isPreviousProjectPeriodMonthlyOrFree = previousProjectPeriod !== LicensePeriod.Year\n\tconst hasJustUpgradedToYearly =\n\t\tcurrentSiteBillingPeriod === LicensePeriod.Year && isPreviousProjectPeriodMonthlyOrFree\n\tconst hasNonFreeCustomDomain = customHostname && !publishStore.isFreeDomain(customHostname.hostname)\n\n\tconst shouldShowFreeDomainInfo = Boolean(\n\t\tisFreeDomainsEnabled &&\n\t\thasJustUpgradedToYearly &&\n\t\tdomainVoucher &&\n\t\t!domainVoucher.redeemed &&\n\t\t!hasNonFreeCustomDomain &&\n\t\toperation === CheckoutSuccessOperation.SitePlanUpgrade,\n\t)\n\n\tconst onRepublish = async () => {\n\t\tif (publishStatus === PublishStatus.Publishing) return\n\t\tawait publishStore.publish()\n\t\tonReset()\n\t}\n\n\tconst onAddDomain = () => {\n\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsPlansSuccess, id: UIInteraction.openSiteSettingsDomains })\n\t\tengine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.domains }).catch(unhandledError)\n\t}\n\n\tconst currentSitePlanTitle = getProjectLicenseName(currentSitePlanType)\n\n\tconst showRepublishButton =\n\t\toperation === CheckoutSuccessOperation.PlanPurchase && canPublish && publishStatus !== PublishStatus.Unpublished\n\n\treturn (\n\t\t<PlansInfo\n\t\t\tclassName={styles.plansInfoTransparent}\n\t\t\ticon=\"success\"\n\t\t\ttitle={getSuccessTitle({ currentSitePlanTitle, operation })}\n\t\t\tbody={getSuccessBody({\n\t\t\t\tcurrentSitePlanTitle,\n\t\t\t\toperation,\n\t\t\t\tpublishStatus,\n\t\t\t\tshouldShowFreeDomainInfo,\n\t\t\t})}\n\t\t\tbutton={\n\t\t\t\t<Stack direction=\"row\" gap={10}>\n\t\t\t\t\t<Button onClick={onReset} enabled={publishStatus !== PublishStatus.Publishing} className={styles.infoButtons}>\n\t\t\t\t\t\t<T>{shouldShowFreeDomainInfo ? \"Dismiss\" : \"Back to Plans\"}</T>\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t{showRepublishButton && (\n\t\t\t\t\t\t<Button onClick={onRepublish} variant=\"primary\" className={styles.infoButtons}>\n\t\t\t\t\t\t\t{publishStatus === PublishStatus.Publishing ? <Spinner /> : <T>Republish</T>}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{shouldShowFreeDomainInfo && (\n\t\t\t\t\t\t<Button onClick={onAddDomain} variant=\"primary\" className={styles.infoButtons}>\n\t\t\t\t\t\t\t<T>Add Domain</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t/>\n\t)\n}\n\nfunction getSuccessTitle({\n\tcurrentSitePlanTitle,\n\toperation,\n}: {\n\tcurrentSitePlanTitle: string\n\toperation: CheckoutSuccessOperation\n}): string {\n\tswitch (operation) {\n\t\tcase CheckoutSuccessOperation.SitePlanUpgrade:\n\t\t\treturn `Updated to ${currentSitePlanTitle}`\n\t\tcase CheckoutSuccessOperation.PlanPurchase:\n\t\t\treturn \"Thank you.\"\n\t\tdefault:\n\t\t\tassertNever(operation)\n\t}\n}\n\nfunction getSuccessBody({\n\tcurrentSitePlanTitle,\n\toperation,\n\tpublishStatus,\n\tshouldShowFreeDomainInfo,\n}: {\n\tcurrentSitePlanTitle: string\n\toperation: CheckoutSuccessOperation\n\tpublishStatus: PublishStatus\n\tshouldShowFreeDomainInfo: boolean\n}): React.ReactNode {\n\tconst invoiceNote = \"The invoice has been sent to your inbox.\"\n\n\tif (operation === CheckoutSuccessOperation.SitePlanUpgrade) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<T>Your site subscription has been updated to a {currentSitePlanTitle} plan.</T>\n\t\t\t\t<T>{invoiceNote}</T>\n\t\t\t\t{shouldShowFreeDomainInfo && <T>You are now eligible to claim a free domain.</T>}\n\t\t\t</>\n\t\t)\n\t}\n\n\tif (operation === CheckoutSuccessOperation.PlanPurchase) {\n\t\treturn (\n\t\t\t<T>\n\t\t\t\tYour site has been upgraded to a {currentSitePlanTitle} plan. {invoiceNote}\n\t\t\t\t{publishStatus !== PublishStatus.Unpublished\n\t\t\t\t\t? \" To remove the Made in Framer badge from your website, simply republish.\"\n\t\t\t\t\t: \"\"}\n\t\t\t</T>\n\t\t)\n\t}\n\n\tassertNever(operation)\n}\n", "import type { ProjectLicenseResourceLimits } from \"@framerjs/app-config\"\nimport type { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport {\n\tAddOnLicenseType,\n\tProjectLicensePeriod,\n\tTeamLicenseType,\n\tdashboardPath,\n\tgetAddOnLicenseTypeName,\n\tgetProjectLicenseName,\n\tgetTeamLicenseName,\n\tisBusinessLicenseType,\n\tisSiteLicenseGreater,\n\tisValidAddOnLicense,\n} from \"@framerjs/app-shared\"\nimport { type UpsellableAddonLicenseType, isUpsellableAddonLicenseType } from \"@framerjs/app-shared/src/AddOnPlan.ts\"\nimport {\n\tBadge,\n\tButton,\n\tCheckBox,\n\tIconInputClose,\n\tInputWrapper,\n\tLink,\n\tSpinner,\n\tStack,\n\tTextInput,\n\tTranslatable as T,\n\ttabularNumbers,\n} from \"@framerjs/fresco\"\nimport { assertNever, emptyArray } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { format } from \"date-fns\"\nimport { formatNumberCommaSeparatorNotation } from \"document/components/chrome/analytics/utils/formatUtils.ts\"\nimport engine from \"document/engine.ts\"\nimport { StripePlansStatus, type PromotionCodeState } from \"document/stores/PaymentsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport pluralize from \"pluralize\"\nimport { type FormEvent, Fragment, useCallback, useMemo, useState } from \"react\"\nimport { convertBillingURL } from \"utils/staticURLs.ts\"\nimport { useRecordEffect } from \"utils/useRecordEffect.ts\"\nimport { getBusinessPricingURL, getPricingURL } from \"web/lib/getPricingURL.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { formatPrice } from \"../../utils/formatPrice.ts\"\nimport type { CheckoutPreview } from \"../api/checkoutPreview.ts\"\nimport type {\n\tLicenseSettings,\n\tPaidLicenseSettings,\n\tPlanPrice,\n\tPlanPriceBase,\n\tPlanPrices,\n} from \"../api/licenseSettings.ts\"\nimport type { CurrentAddOn } from \"../api/subscriptions.ts\"\nimport { useIsBillingV3 } from \"../hooks/useIsBillingV3.ts\"\nimport { canToggleBillingPeriodInsidePreview } from \"../utils/canToggleBillingPeriod.ts\"\nimport * as styles from \"./Preview.styles.ts\"\n\nconst TRACKING_PAGE_ID = Pages.siteSettingsPlansConfirmation\n\ninterface AddOnPrice extends PlanPriceBase {\n\tlicenseType: UpsellableAddonLicenseType\n}\n\nfunction getPreviewPromotionCode(promotionCode: PromotionCodeState | undefined): string | undefined {\n\tif (!promotionCode) return undefined\n\tif (promotionCode.status === \"applied\") return promotionCode.code\n\t/* When the state is error due to noDiscount, it is still an applied code, but we treat it as errored on frontend */\n\tif (promotionCode.reason === \"noDiscount\") return promotionCode.code\n\treturn undefined\n}\n\nfunction AddOnSelectionItem({\n\tdisabled,\n\tchecked,\n\taddOn,\n\ttitle,\n\tdescription,\n\tamount,\n\tonClick,\n\tcurrency,\n}: {\n\tdisabled?: boolean\n\tchecked: boolean\n\taddOn: UpsellableAddonLicenseType\n\ttitle: string\n\tdescription: string | JSX.Element\n\tamount: string\n\tonClick: () => void\n\tcurrency: string\n}) {\n\treturn (\n\t\t<Stack direction=\"row\" className={styles.itemContainer} alignItems=\"flex-start\" gap={11}>\n\t\t\t<Stack paddingTop={2}>\n\t\t\t\t<CheckBox id={`add-on-${addOn}`} value={disabled ? true : checked} onChange={onClick} enabled={!disabled} />\n\t\t\t</Stack>\n\t\t\t<Stack gap={5} style={{ flexGrow: 1 }}>\n\t\t\t\t<label htmlFor={`add-on-${addOn}`}>\n\t\t\t\t\t<T>{title}</T>\n\t\t\t\t</label>\n\t\t\t\t<div className={styles.previewDescription}>{description}</div>\n\t\t\t</Stack>\n\t\t\t<T className={tabularNumbers}>{formatPrice(Number(amount), currency)}</T>\n\t\t</Stack>\n\t)\n}\n\nfunction AddOnSelection({\n\tavailableAddOns,\n\tonSelectionChange,\n\tselectedAddons,\n\tcurrency,\n\tisYearly,\n}: {\n\tavailableAddOns: AddOnPrice[]\n\tselectedAddons: readonly AddOnLicenseType[]\n\tonSelectionChange: (addonPrices: AddOnLicenseType[]) => void\n\tcurrency: string\n\tisYearly: boolean\n}) {\n\tconst selection = selectedAddons\n\n\tconst handleChange = useCallback(\n\t\t(addonLicenseType: AddOnLicenseType) => {\n\t\t\tconst check = selection.some(addOn => addOn === addonLicenseType)\n\t\t\tconst newSelection = check\n\t\t\t\t? selection.filter(addOn => addOn !== addonLicenseType)\n\t\t\t\t: [...selection, addonLicenseType]\n\t\t\tonSelectionChange(newSelection)\n\t\t},\n\t\t[onSelectionChange, selection],\n\t)\n\tconst getDescription = (addOn: AddOnPrice) => {\n\t\tconst pricePerUnit = isYearly ? Number.parseFloat(addOn.amount) / 12 : Number.parseFloat(addOn.amount)\n\t\tconst calculatedPrice = formatPrice(pricePerUnit, currency, true)\n\t\tconst upsellableAddonLicenseType: UpsellableAddonLicenseType = addOn.licenseType\n\t\tswitch (upsellableAddonLicenseType) {\n\t\t\tcase AddOnLicenseType.CustomProxySetup:\n\t\t\t\treturn `${calculatedPrice} per month. Enables the use of a Reverse Proxy for hosting multiple sites or landing pages on your domain`\n\t\t\tcase AddOnLicenseType.AdvancedAnalytics: {\n\t\t\t\tconst billedYearly = isYearly ? \", billed yearly\" : \"\"\n\t\t\t\tconst usage = engine.stores.projectStore.usageData?.advancedAnalytics?.previousMonth ?? 0\n\t\t\t\tconst usageSuffix =\n\t\t\t\t\tusage > 0 ? `, and last month you had ${formatNumberCommaSeparatorNotation(usage)} events` : \"\"\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\tOptimize your site with A/B tests, funnels, triggers, and more for {calculatedPrice} per month\n\t\t\t\t\t\t{billedYearly}. Billing is per 500,000 events{usageSuffix}. <Link href={convertBillingURL}>Learn more</Link>\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tassertNever(upsellableAddonLicenseType)\n\t\t}\n\t}\n\n\tconst getTitle = useCallback((licenseType: UpsellableAddonLicenseType) => {\n\t\tconst name = getAddOnLicenseTypeName(licenseType)\n\t\tif (licenseType === AddOnLicenseType.AdvancedAnalytics) {\n\t\t\treturn `${name} ${Dictionary.AddOn}`\n\t\t}\n\t\treturn name\n\t}, [])\n\n\tconst renderAddons = () => {\n\t\treturn availableAddOns.map(addOn => (\n\t\t\t<AddOnSelectionItem\n\t\t\t\tkey={addOn.licenseType}\n\t\t\t\taddOn={addOn.licenseType}\n\t\t\t\tchecked={selection.some(addon => addon === addOn.licenseType)}\n\t\t\t\tonClick={() => handleChange(addOn.licenseType)}\n\t\t\t\ttitle={getTitle(addOn.licenseType)}\n\t\t\t\tdescription={getDescription(addOn)}\n\t\t\t\tamount={addOn.amount}\n\t\t\t\tcurrency={currency}\n\t\t\t/>\n\t\t))\n\t}\n\n\treturn (\n\t\t<Stack gap={30}>\n\t\t\t<Stack gap={30} className={styles.container}>\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<div className={cx(styles.sectionTitle)}>\n\t\t\t\t\t\t<T>{Dictionary.AddOns}</T>\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t{renderAddons()}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nexport function EditorLineItem({\n\tlicenseType,\n\tquantity,\n\tunitAmount,\n\tisYearly,\n\ttotalAmount,\n\tcurrency,\n\thideWorkspaceSettingsLink = false,\n}: {\n\tlicenseType: TeamLicenseType\n\tquantity: number\n\tunitAmount: string\n\tisYearly: boolean\n\ttotalAmount: number\n\tcurrency: string\n\thideWorkspaceSettingsLink?: boolean\n}) {\n\tconst editorLabel = licenseType === TeamLicenseType.TeamBasicPlan ? \"Personal\" : getTeamLicenseName(licenseType)\n\tconst calculatedPrice = formatPrice(\n\t\tisYearly ? Number.parseFloat(unitAmount) / 12 : Number.parseFloat(unitAmount),\n\t\tcurrency,\n\t\ttrue,\n\t)\n\tconst title = `${quantity} \u2715 ${editorLabel} ${pluralize(\"Editor\", quantity)}`\n\tconst billedYearlyText = isYearly ? \", billed yearly\" : \"\"\n\tconst isFirstFreeEditor = totalAmount === 0\n\n\tconst sentenceHead = `${calculatedPrice} per month`\n\tconst sentenceTail = isYearly ? \", billed yearly\" : \"\"\n\n\tconst description = isFirstFreeEditor ? (\n\t\t`First editor is always free, editors added later will be charged ${sentenceHead}${sentenceTail}`\n\t) : (\n\t\t<>\n\t\t\t{`${calculatedPrice} / editor per month${billedYearlyText}. The workspace owner is\nalways free.`}\n\t\t\t{!hideWorkspaceSettingsLink ? (\n\t\t\t\t<>\n\t\t\t\t\t{` Add and remove editors in your `}\n\t\t\t\t\t<a\n\t\t\t\t\t\thref={`${dashboardPath}?team=${engine?.stores.projectStore?.project?.space?.id}&open-settings=1`}\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t\t\tclassName={styles.link}\n\t\t\t\t\t\tonClick={() => null}\n\t\t\t\t\t>\n\t\t\t\t\t\tWorkspace Settings\n\t\t\t\t\t</a>\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t</>\n\t)\n\n\treturn (\n\t\t<ItemContainer>\n\t\t\t<ItemRow title={title} description={description} price={formatPrice(totalAmount, currency)} />\n\t\t</ItemContainer>\n\t)\n}\n\nexport function AddOnLineItem({\n\tquantity,\n\tunitAmount,\n\tisYearly,\n\ttotalAmount,\n\tcurrency,\n\tlicenseType,\n\tunitsPerQuantity,\n}: {\n\tquantity: number\n\tunitAmount: string\n\tisYearly: boolean\n\ttotalAmount: number\n\tcurrency: string\n\tlicenseType: AddOnLicenseType\n\tunitsPerQuantity?: number\n}) {\n\tconst addOnName = getAddOnLicenseTypeName(licenseType)\n\tconst { siteSettingsStore, chromeStore } = engine.stores\n\tconst titles = {\n\t\t[AddOnLicenseType.Locale]: `${quantity} \u2715 ${pluralize(Dictionary.Locale, quantity)}`,\n\t\t[AddOnLicenseType.AdvancedAnalytics]: `${addOnName} ${Dictionary.AddOn}`,\n\t\t[AddOnLicenseType.CustomProxySetup]: `${addOnName} ${Dictionary.AddOn}`,\n\t\t[AddOnLicenseType.Bandwidth]: `${quantity} \u2A09 Additional ${unitsPerQuantity ?? NaN}GB bandwidth`,\n\t\t[AddOnLicenseType.Pages]: `${quantity} \u2A09 Additional ${unitsPerQuantity} Pages`,\n\t\t[AddOnLicenseType.CmsCollections]: `${quantity} \u2A09 Additional ${unitsPerQuantity} CMS Collections`,\n\t\t[AddOnLicenseType.CmsItems]: `${quantity} \u2A09 Additional ${unitsPerQuantity} CMS Items`,\n\t}\n\n\tconst pricePerUnit = isYearly ? Number.parseFloat(unitAmount) / 12 : Number.parseFloat(unitAmount)\n\tconst calculatedPrice = formatPrice(pricePerUnit, currency, true)\n\tconst billedYearly = isYearly ? \", billed yearly\" : \"\"\n\tconst analyticsUsage = engine.stores.projectStore.usageData?.advancedAnalytics?.previousMonth ?? 0\n\tconst analyticsUsageSuffix =\n\t\tanalyticsUsage > 0 ? `, and last month you had ${formatNumberCommaSeparatorNotation(analyticsUsage)} events` : \"\"\n\tconst descriptions = {\n\t\tmonthly: {\n\t\t\t[AddOnLicenseType.Locale]: (\n\t\t\t\t<>\n\t\t\t\t\t{`${calculatedPrice} / locale per month. You can add or remove locales any time by opening the `}\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\" \"\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t\t\tclassName={styles.link}\n\t\t\t\t\t\tonClick={e => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tsiteSettingsStore.toggle()\n\t\t\t\t\t\t\tchromeStore.setLocalizationsVisible(true)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tLocalization page\n\t\t\t\t\t</a>\n\t\t\t\t</>\n\t\t\t),\n\t\t\t[AddOnLicenseType.AdvancedAnalytics]: `Optimize your site with A/B tests, funnels, triggers, and more for ${calculatedPrice} per month. Billing is per 500,000 events${analyticsUsageSuffix}.`,\n\t\t\t[AddOnLicenseType.CustomProxySetup]: `${calculatedPrice} per month. Enables the use of a Reverse Proxy for hosting multiple websites or landing pages on your domain `,\n\t\t\t[AddOnLicenseType.Bandwidth]: `${calculatedPrice} per month for ${unitsPerQuantity ?? NaN}GB additional bandwidth. Handle more traffic and larger file transfers.`,\n\t\t\t[AddOnLicenseType.Pages]: `${calculatedPrice} per month for additional pages.`,\n\t\t\t[AddOnLicenseType.CmsCollections]: `${calculatedPrice} per month for additional CMS collections.`,\n\t\t\t[AddOnLicenseType.CmsItems]: `${calculatedPrice} per month for additional CMS items.`,\n\t\t},\n\t\tyearly: {\n\t\t\t[AddOnLicenseType.Locale]: (\n\t\t\t\t<>\n\t\t\t\t\t{`${calculatedPrice} / locale per month, billed yearly. You can add or remove locales any time by opening the `}\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\" \"\n\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\trel=\"noreferrer\"\n\t\t\t\t\t\tclassName={styles.link}\n\t\t\t\t\t\tonClick={e => {\n\t\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\t\tsiteSettingsStore.toggle()\n\t\t\t\t\t\t\tchromeStore.setLocalizationsVisible(true)\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\tLocalization page\n\t\t\t\t\t</a>\n\t\t\t\t</>\n\t\t\t),\n\t\t\t[AddOnLicenseType.AdvancedAnalytics]: `Optimize your site with A/B tests, funnels, triggers, and more for ${calculatedPrice} per month${billedYearly}. Billing is per 500,000 events${analyticsUsageSuffix}.`,\n\t\t\t[AddOnLicenseType.CustomProxySetup]: `${calculatedPrice} per month, billed yearly. Enables the use of a Reverse Proxy for hosting multiple websites or landing pages on your domain`,\n\t\t\t[AddOnLicenseType.Bandwidth]: `${calculatedPrice} per month, billed yearly, for ${unitsPerQuantity ?? NaN}GB additional bandwidth. Handle more traffic and larger file transfers.`,\n\t\t\t[AddOnLicenseType.Pages]: `${calculatedPrice} per month, billed yearly, for additional pages.`,\n\t\t\t[AddOnLicenseType.CmsCollections]: `${calculatedPrice} per month, billed yearly, for additional CMS collections.`,\n\t\t\t[AddOnLicenseType.CmsItems]: `${calculatedPrice} per month, billed yearly, for additional CMS items.`,\n\t\t},\n\t}\n\n\treturn (\n\t\t<ItemContainer>\n\t\t\t<ItemRow\n\t\t\t\ttitle={titles[licenseType]}\n\t\t\t\tdescription={descriptions[isYearly ? \"yearly\" : \"monthly\"][licenseType]}\n\t\t\t\tprice={formatPrice(totalAmount, currency)}\n\t\t\t/>\n\t\t</ItemContainer>\n\t)\n}\n\ninterface SiteLineItemCommonProps {\n\tlicenseType: ProjectLicenseType\n\tunitAmount: string\n\tisYearly: boolean\n\ttotalAmount: number\n\tcurrency: string\n}\n\ntype SiteLineItemProps =\n\t| ({\n\t\t\tisPlanWithPeriodControls: true\n\t\t\tresourceLimits: ProjectLicenseResourceLimits\n\t  } & SiteLineItemCommonProps)\n\t| ({\n\t\t\tisPlanWithPeriodControls: false\n\t  } & SiteLineItemCommonProps)\n\nexport function SiteLineItem(props: SiteLineItemProps) {\n\tconst { licenseType, unitAmount, isYearly, totalAmount, currency } = props\n\n\tconst title = `${getProjectLicenseName(licenseType)} Site`\n\tconst calculatedPrice = formatPrice(\n\t\tisYearly ? Number.parseFloat(unitAmount) / 12 : Number.parseFloat(unitAmount),\n\t\tcurrency,\n\t\ttrue,\n\t)\n\tconst sentenceHead = `${calculatedPrice} per month`\n\tconst sentenceTail = isYearly ? \", billed yearly\" : \"\"\n\tconst description = `${sentenceHead}${sentenceTail}`\n\n\tif (props.isPlanWithPeriodControls) {\n\t\tconst { maxEditors, bandwidthInGB, cmsCollections } = props.resourceLimits\n\t\tconst href = isBusinessLicenseType(licenseType) ? getBusinessPricingURL() : getPricingURL()\n\t\tconst descriptionWithResources = (\n\t\t\t<>\n\t\t\t\t{isYearly ? description + \". \" : null}\n\t\t\t\t{`Max ${maxEditors} ${pluralize(\"editor\", maxEditors ?? 0)}, ${bandwidthInGB} GB bandwidth, ${cmsCollections} CMS ${pluralize(\"collection\", cmsCollections ?? 0)},`}{\" \"}\n\t\t\t\t<a target=\"_blank\" rel=\"noreferrer\" className={styles.link} href={href}>\n\t\t\t\t\tand more\n\t\t\t\t</a>\n\t\t\t</>\n\t\t)\n\t\treturn (\n\t\t\t<ItemContainer>\n\t\t\t\t<ItemRow title={title} description={descriptionWithResources} price={formatPrice(totalAmount, currency)} />\n\t\t\t</ItemContainer>\n\t\t)\n\t}\n\n\treturn (\n\t\t<ItemContainer>\n\t\t\t<ItemRow title={title} description={description} price={formatPrice(totalAmount, currency)} />\n\t\t</ItemContainer>\n\t)\n}\n\nfunction ItemContainer({ children }: { children: React.ReactNode }) {\n\treturn (\n\t\t<Fragment>\n\t\t\t<hr className={styles.divider} />\n\t\t\t<Stack className={styles.itemContainer}>{children}</Stack>\n\t\t</Fragment>\n\t)\n}\n\nexport function ItemRow({\n\ttitle,\n\tdescription,\n\tprice,\n\tpriceUnit,\n\tbold,\n\thighlight,\n}: {\n\ttitle: string | JSX.Element\n\tdescription?: string | JSX.Element\n\tprice: string\n\tpriceUnit?: string\n\tbold?: boolean\n\thighlight?: boolean\n}) {\n\treturn (\n\t\t<Stack direction=\"row\" justifyContent=\"space-between\">\n\t\t\t<Stack gap={5}>\n\t\t\t\t<Stack direction=\"row\" gap={5}>\n\t\t\t\t\t{title && typeof title === \"string\" ? (\n\t\t\t\t\t\t<T className={cx(bold && styles.bold)}>{title}</T>\n\t\t\t\t\t) : (\n\t\t\t\t\t\ttitle && <span className={cx(bold && styles.bold)}>{title}</span>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t\t{description && typeof description === \"string\" ? (\n\t\t\t\t\t<T className={styles.previewDescription}>{description}</T>\n\t\t\t\t) : (\n\t\t\t\t\tdescription && <span className={styles.previewDescription}>{description}</span>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t\t<div className={cx(bold && styles.boldPrice, tabularNumbers, highlight && styles.highlight)}>\n\t\t\t\t{price} <span className={cx(styles.previewPrice)}>{priceUnit && <T>/ {priceUnit}</T>}</span>\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n\nexport function Preview({\n\tcheckoutPreview,\n\tcurrentProjectLicenseType,\n\tcurrentProjectPeriod,\n\tcancelPreview,\n\tpurchasePlan,\n\tpreviewPlan,\n\tselectedPlan,\n\tstatus,\n\tselectedAddons,\n\tcurrentAddOns,\n\tpromotionCode,\n}: {\n\tselectedPlan: PaidLicenseSettings\n\tcheckoutPreview: CheckoutPreview\n\tcurrentProjectLicenseType: ProjectLicenseType\n\tcurrentProjectPeriod?: ProjectLicensePeriod\n\tcancelPreview: () => void\n\tpurchasePlan: (selectedProjectLicenseType: ProjectLicenseType, planPrice: PlanPrice) => Promise<void>\n\tpreviewPlan: (\n\t\tselectedPlan: LicenseSettings,\n\t\tperiod: ProjectLicensePeriod,\n\t\taddOns: readonly AddOnLicenseType[],\n\t\tpromotionCode?: string,\n\t) => Promise<void>\n\tstatus: StripePlansStatus.Preview | StripePlansStatus.UpdatingPreview | StripePlansStatus.ConfirmingPurchase\n\tcurrentAddOns: CurrentAddOn[]\n\tselectedAddons?: AddOnLicenseType[]\n\tpromotionCode?: PromotionCodeState\n}) {\n\tconst {\n\t\titems,\n\t\tsubtotal,\n\t\ttax,\n\t\tappliedCredit,\n\t\ttotalWithCredit,\n\t\tcreditedAmount,\n\t\tcurrency,\n\t\tproration,\n\t\tnextBillDate,\n\t\tperiod,\n\t\tdiscount,\n\t} = checkoutPreview\n\tconst [promotionCodeInput, setPromotionCodeInput] = useState(\"\")\n\tconst isCouponsExperimentOn = useExperimentIsOn(\"coupons\")\n\tconst isBillingV3 = useIsBillingV3()\n\tconst subscriptionRenew = format(nextBillDate, \"MMMM d, yyyy\")\n\tconst isYearly = period === ProjectLicensePeriod.Year\n\tconst isUpdating = status === StripePlansStatus.UpdatingPreview\n\tconst isConfirmingPurchase = status === StripePlansStatus.ConfirmingPurchase\n\tconst isConfirmingOrUpdating = isUpdating || isConfirmingPurchase\n\tconst isDowngrade = isSiteLicenseGreater(currentProjectLicenseType, selectedPlan.licenseType)\n\n\tconst handlePlanPurchase = useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: TRACKING_PAGE_ID,\n\t\t\tid: isDowngrade ? UIInteraction.downgradeSitePlan : UIInteraction.upgradeSitePlan,\n\t\t})\n\t\tvoid purchasePlan(selectedPlan.licenseType, selectedPlan.prices[period])\n\t}, [selectedPlan, purchasePlan, isDowngrade, period])\n\n\tconst selectedAddonsOrEmpty = selectedAddons ?? emptyArray()\n\tconst appliedPromotionCode = promotionCode?.status === \"applied\" ? promotionCode.code : undefined\n\tconst promotionCodeError = promotionCode?.status === \"error\"\n\tconst activePromotionCode = isCouponsExperimentOn ? getPreviewPromotionCode(promotionCode) : undefined\n\tconst trimmedPromotionCode = promotionCodeInput.trim()\n\tconst hasExistingDiscount = discount !== 0\n\n\tconst applyPromotionCode = () => {\n\t\trecord(\"ui_interaction\", { page: TRACKING_PAGE_ID, id: UIInteraction.applyPromotionCodeConfirm })\n\t\tvoid previewPlan(selectedPlan, period, selectedAddonsOrEmpty, trimmedPromotionCode)\n\t}\n\n\tconst handleApplyPromotionCode = (event: FormEvent) => {\n\t\tevent.preventDefault()\n\t\tif (!trimmedPromotionCode || isConfirmingOrUpdating) return\n\n\t\tif (hasExistingDiscount) {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\tsource: \"settings\",\n\t\t\t\ttitle: \"Existing Discount\",\n\t\t\t\tdescription: \"A discount is already applied to this project. A new discount will replace it.\",\n\t\t\t\tconfirmLabel: \"Continue\",\n\t\t\t\tcancelLabel: Dictionary.Cancel,\n\t\t\t\tonConfirm: applyPromotionCode,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tapplyPromotionCode()\n\t}\n\n\tconst handleRemovePromotionCode = () => {\n\t\tif (isConfirmingOrUpdating) return\n\t\tsetPromotionCodeInput(\"\")\n\t\tvoid previewPlan(selectedPlan, period, selectedAddonsOrEmpty)\n\t}\n\n\tuseRecordEffect(\"ui_impression\", { page: TRACKING_PAGE_ID })\n\n\tconst upgradeOrDowngrade = isDowngrade ? \"Downgrade\" : \"Upgrade\"\n\tconst shouldShowPlanPeriodSegment = canToggleBillingPeriodInsidePreview(\n\t\tselectedPlan.licenseType,\n\t\tcurrentProjectLicenseType,\n\t\tcurrentProjectPeriod,\n\t)\n\n\tconst upsellableAddonPrices = useMemo(() => {\n\t\tconst acc: AddOnPrice[] = []\n\t\tfor (const licenseType in selectedPlan.prices[period].addOns) {\n\t\t\tif (!isValidAddOnLicense(licenseType) || !isUpsellableAddonLicenseType(licenseType)) continue\n\n\t\t\tconst addon = selectedPlan.prices[period].addOns[licenseType]\n\t\t\tif (!addon || currentAddOns.some(addOn => addOn.licenseType === licenseType)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Check if the add-on is user-selectable using selected plan's limits (not current project's)\n\t\t\tif (isAddonUserSelectable(licenseType, selectedPlan)) {\n\t\t\t\tacc.push({ licenseType, ...addon })\n\t\t\t}\n\t\t}\n\t\treturn acc\n\t}, [selectedPlan, period, currentAddOns])\n\n\tconst addOnLineItems = useMemo(\n\t\t() =>\n\t\t\titems.addons?.filter(addOn => {\n\t\t\t\t// Show current add-ons the user already has\n\t\t\t\tconst hasCurrentAddOn = currentAddOns.some(currentAddOn => currentAddOn.licenseType === addOn.licenseType)\n\n\t\t\t\t// Show automatic add-ons (not user-selectable)\n\t\t\t\tconst isAutomatic = !isAddonUserSelectable(addOn.licenseType, selectedPlan)\n\n\t\t\t\treturn hasCurrentAddOn || isAutomatic\n\t\t\t}),\n\t\t[items.addons, currentAddOns, selectedPlan],\n\t)\n\n\treturn (\n\t\t<Stack gap={30}>\n\t\t\t<Stack gap={30} className={styles.container}>\n\t\t\t\t<Stack gap={10} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t<div className={styles.previewTitle}>\n\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t{upgradeOrDowngrade} to {getProjectLicenseName(selectedPlan.licenseType)}\n\t\t\t\t\t\t</T>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Button variant=\"default\" enabled={!isConfirmingOrUpdating} onClick={cancelPreview}>\n\t\t\t\t\t\tCancel\n\t\t\t\t\t</Button>\n\t\t\t\t</Stack>\n\t\t\t\t{shouldShowPlanPeriodSegment && (\n\t\t\t\t\t<PlanPeriodSegment\n\t\t\t\t\t\tselectedPeriod={period}\n\t\t\t\t\t\tselectedPlan={selectedPlan}\n\t\t\t\t\t\tpreviewPlan={(selected: ProjectLicensePeriod) => {\n\t\t\t\t\t\t\tif (isConfirmingPurchase) return\n\t\t\t\t\t\t\tvoid previewPlan(selectedPlan, selected, selectedAddonsOrEmpty, activePromotionCode)\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{items.plan && (\n\t\t\t\t\t<SiteLineItem\n\t\t\t\t\t\tlicenseType={items.plan.licenseType}\n\t\t\t\t\t\tunitAmount={items.plan.unitAmount}\n\t\t\t\t\t\tisYearly={isYearly}\n\t\t\t\t\t\ttotalAmount={items.plan.totalAmount}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tisPlanWithPeriodControls={shouldShowPlanPeriodSegment}\n\t\t\t\t\t\tresourceLimits={selectedPlan.resourceLimits}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{items.editor && (\n\t\t\t\t\t<EditorLineItem\n\t\t\t\t\t\tlicenseType={items.editor.licenseType}\n\t\t\t\t\t\tquantity={items.editor.quantity}\n\t\t\t\t\t\tunitAmount={items.editor.unitAmount}\n\t\t\t\t\t\tisYearly={isYearly}\n\t\t\t\t\t\ttotalAmount={items.editor.totalAmount}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t{addOnLineItems?.map(addOn => (\n\t\t\t\t\t<AddOnLineItem\n\t\t\t\t\t\tkey={addOn.licenseType}\n\t\t\t\t\t\tquantity={addOn.quantity}\n\t\t\t\t\t\tunitAmount={addOn.unitAmount}\n\t\t\t\t\t\tisYearly={isYearly}\n\t\t\t\t\t\ttotalAmount={addOn.totalAmount}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tlicenseType={addOn.licenseType}\n\t\t\t\t\t\tunitsPerQuantity={addOn.unitsPerQuantity}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</Stack>\n\t\t\t{upsellableAddonPrices.length > 0 && (\n\t\t\t\t<AddOnSelection\n\t\t\t\t\tavailableAddOns={upsellableAddonPrices}\n\t\t\t\t\tselectedAddons={selectedAddonsOrEmpty}\n\t\t\t\t\tonSelectionChange={(selected: AddOnLicenseType[]) => {\n\t\t\t\t\t\tif (isConfirmingPurchase) return\n\t\t\t\t\t\tvoid previewPlan(selectedPlan, period, selected, activePromotionCode)\n\t\t\t\t\t}}\n\t\t\t\t\tcurrency={currency}\n\t\t\t\t\tisYearly={isYearly}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t<Stack gap={30} className={styles.container}>\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<div className={cx(styles.sectionTitle)}>\n\t\t\t\t\t\t<T>Summary</T>\n\t\t\t\t\t</div>\n\t\t\t\t\t<Stack gap={5} className={cx(styles.sectionSubtitle)}>\n\t\t\t\t\t\t<T>{`Your plan will renew on ${subscriptionRenew}`}</T>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t{isBillingV3 && isCouponsExperimentOn && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Stack gap={10} className={styles.itemContainer}>\n\t\t\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n\t\t\t\t\t\t\t\t<T>Promotion Code</T>\n\t\t\t\t\t\t\t\t{appliedPromotionCode ? (\n\t\t\t\t\t\t\t\t\t<Stack direction=\"row\" gap={15} alignItems=\"center\">\n\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={styles.promotionCodePill}\n\t\t\t\t\t\t\t\t\t\t\tonClick={handleRemovePromotionCode}\n\t\t\t\t\t\t\t\t\t\t\tdisabled={isConfirmingOrUpdating}\n\t\t\t\t\t\t\t\t\t\t\taria-label={`Remove promotion code ${appliedPromotionCode}`}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<span>{appliedPromotionCode}</span>\n\t\t\t\t\t\t\t\t\t\t\t<IconInputClose className={styles.promotionCodeCloseIcon} />\n\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t<span className={cx(styles.boldPrice, tabularNumbers)}>\n\t\t\t\t\t\t\t\t\t\t\t{isUpdating ? \"\u2014\" : `-${formatPrice(discount, currency)}`}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<form onSubmit={handleApplyPromotionCode} aria-label=\"Apply promotion code\">\n\t\t\t\t\t\t\t\t\t\t<Stack direction=\"row\" gap={10} alignItems=\"center\">\n\t\t\t\t\t\t\t\t\t\t\t<InputWrapper large hasError={promotionCodeError} className={styles.promotionCodeInputWrapper}>\n\t\t\t\t\t\t\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Promotion Code\"\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-invalid={promotionCodeError}\n\t\t\t\t\t\t\t\t\t\t\t\t\taria-errormessage={promotionCodeError ? \"promotion-code-error\" : undefined}\n\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder=\"Code\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue={promotionCodeInput}\n\t\t\t\t\t\t\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t\t\t\t\t\t\t\tenabled={!isConfirmingOrUpdating}\n\t\t\t\t\t\t\t\t\t\t\t\t\tonChange={setPromotionCodeInput}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{isUpdating && <Spinner inline className={styles.promotionCodeStatus} aria-hidden=\"true\" />}\n\t\t\t\t\t\t\t\t\t\t\t\t{promotionCodeError && !isUpdating && (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span id=\"promotion-code-error\" className={styles.promotionCodeStatus} role=\"alert\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tInvalid\n\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\t\t\tvariant=\"default\"\n\t\t\t\t\t\t\t\t\t\t\t\tsmall\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\t\t\tenabled={Boolean(trimmedPromotionCode) && !isConfirmingOrUpdating}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\tApply\n\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{proration !== 0 && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Stack gap={15} className={styles.itemContainer}>\n\t\t\t\t\t\t\t<ItemRow\n\t\t\t\t\t\t\t\ttitle=\"Proration\"\n\t\t\t\t\t\t\t\tdescription=\"We deduct what you already paid for within the current plan, plus the unused period between the start of this billing cycle and now\"\n\t\t\t\t\t\t\t\tprice={isUpdating ? \"\u2014\" : formatPrice(proration, currency)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{discount !== 0 && !appliedPromotionCode && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Stack gap={15} className={styles.itemContainer}>\n\t\t\t\t\t\t\t<ItemRow title=\"Discount\" price={isUpdating ? \"\u2014\" : `-${formatPrice(discount, currency)}`} />\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{tax != null && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Stack gap={15} className={styles.itemContainer}>\n\t\t\t\t\t\t\t<ItemRow title=\"Subtotal\" price={isUpdating ? \"\u2014\" : formatPrice(subtotal, currency)} />\n\t\t\t\t\t\t\t<ItemRow title=\"VAT\" price={isUpdating ? \"\u2014\" : formatPrice(tax, currency)} />\n\t\t\t\t\t\t\t{appliedCredit < 0 && (\n\t\t\t\t\t\t\t\t<ItemRow title=\"Applied Credit\" price={isUpdating ? \"\u2014\" : formatPrice(appliedCredit, currency)} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<hr className={styles.divider} />\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t<div className={styles.itemContainer}>\n\t\t\t\t\t{creditedAmount > 0 ? (\n\t\t\t\t\t\t<ItemRow\n\t\t\t\t\t\t\ttitle=\"Credit\"\n\t\t\t\t\t\t\tdescription=\"You\u2019ll be credited for the unused time from your previous plan\"\n\t\t\t\t\t\t\tprice={isUpdating ? \"\u2014\" : formatPrice(creditedAmount, currency)}\n\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\thighlight\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ItemRow title=\"Pay now\" price={isUpdating ? \"\u2014\" : formatPrice(totalWithCredit, currency)} bold highlight />\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<Button variant=\"withDepthPrimary\" onClick={handlePlanPurchase} enabled={!isConfirmingOrUpdating} bold>\n\t\t\t\t\t{isConfirmingOrUpdating ? <Spinner /> : totalWithCredit > 0 ? \"Confirm & Pay\" : Dictionary.Confirm}\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\nfunction PlanPeriodSegmentBox({\n\ttext,\n\tprice,\n\tonClick,\n\tselected,\n\tsavings,\n}: {\n\ttext: string\n\tprice: string\n\tonClick: () => void\n\tselected: boolean\n\tsavings?: number\n}) {\n\treturn (\n\t\t<Stack\n\t\t\tgap={2}\n\t\t\tdirection=\"row\"\n\t\t\tclassName={cx(styles.periodSegmentBox, selected && styles.periodSegmentBoxSelected)}\n\t\t\tonClick={onClick}\n\t\t\t// biome-ignore lint/a11y/useSemanticElements: <explanation>\n\t\t\trole=\"button\"\n\t\t\ttabIndex={0}\n\t\t\tjustifyContent=\"space-between\"\n\t\t\talignItems=\"center\"\n\t\t>\n\t\t\t<Stack gap={0} direction=\"column\" shrink={1}>\n\t\t\t\t<span className={styles.periodSegmentBoxText}>\n\t\t\t\t\t<T>{text}</T>\n\t\t\t\t</span>\n\t\t\t\t<span className={cx(styles.periodSegmentBoxPrice, tabularNumbers)}>{price}</span>\n\t\t\t</Stack>\n\t\t\t{savings && savings > 0 ? <Badge className={styles.periodSegmentBoxSaveBadge}>SAVE {savings}%</Badge> : null}\n\t\t</Stack>\n\t)\n}\n\nfunction PlanPeriodSegment({\n\tselectedPlan,\n\tselectedPeriod,\n\tpreviewPlan,\n}: {\n\tselectedPlan: PaidLicenseSettings\n\tselectedPeriod: ProjectLicensePeriod\n\tpreviewPlan: (period: ProjectLicensePeriod) => void\n}) {\n\tfunction calculateTabPricePerPeriodAndLicenseType(period: ProjectLicensePeriod, prices: PlanPrices) {\n\t\tconst totalPrice = parseFloat(prices[period].amount)\n\t\treturn {\n\t\t\tprice: period === ProjectLicensePeriod.Year ? totalPrice / 12 : totalPrice,\n\t\t\tcurrency: prices[period].currency,\n\t\t}\n\t}\n\n\tfunction calculateSavingsPercentage(month: number, year: number): number | null {\n\t\tif (month === 0) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst savings = month - year\n\t\treturn (savings / month) * 100\n\t}\n\n\tfunction getBillingPriceLabel({ price, currency }: { price: number; currency: string }) {\n\t\treturn `${formatPrice(price, currency, true)} per month`\n\t}\n\n\tconst tabPriceMonth = calculateTabPricePerPeriodAndLicenseType(ProjectLicensePeriod.Month, selectedPlan.prices)\n\tconst tabPriceYear = calculateTabPricePerPeriodAndLicenseType(ProjectLicensePeriod.Year, selectedPlan.prices)\n\n\tconst savingsPercentage = Math.ceil(calculateSavingsPercentage(tabPriceMonth.price, tabPriceYear.price) ?? 0)\n\n\treturn (\n\t\t<Stack gap={15} direction=\"row\" alignItems=\"flex-start\">\n\t\t\t<PlanPeriodSegmentBox\n\t\t\t\ttext=\"Monthly Billing\"\n\t\t\t\tprice={getBillingPriceLabel(tabPriceMonth)}\n\t\t\t\tselected={selectedPeriod === ProjectLicensePeriod.Month}\n\t\t\t\tonClick={() => {\n\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\tpage: TRACKING_PAGE_ID,\n\t\t\t\t\t\tid: UIInteraction.toogleBillingPeriodToMonthly,\n\t\t\t\t\t})\n\t\t\t\t\tpreviewPlan(ProjectLicensePeriod.Month)\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<PlanPeriodSegmentBox\n\t\t\t\ttext=\"Yearly Billing\"\n\t\t\t\tprice={getBillingPriceLabel(tabPriceYear)}\n\t\t\t\tonClick={() => {\n\t\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\t\tpage: TRACKING_PAGE_ID,\n\t\t\t\t\t\tid: UIInteraction.toogleBillingPeriodToYearly,\n\t\t\t\t\t})\n\t\t\t\t\tpreviewPlan(ProjectLicensePeriod.Year)\n\t\t\t\t}}\n\t\t\t\tselected={selectedPeriod === ProjectLicensePeriod.Year}\n\t\t\t\tsavings={savingsPercentage}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n\nexport function isAddonUserSelectable(\n\tlicenseType: AddOnLicenseType,\n\t{ featureFlags, resourceLimits }: PaidLicenseSettings,\n): boolean {\n\tswitch (licenseType) {\n\t\tcase AddOnLicenseType.AdvancedAnalytics: {\n\t\t\tconst currentLimit = resourceLimits.trackingEventsLimit\n\t\t\tconst maxLimit = resourceLimits.maxTrackingEventsLimit\n\n\t\t\t// Can upsell if selected plan's limit is less than max limit\n\t\t\t// null means unlimited, so no upsell needed\n\t\t\tif (currentLimit === null) return false\n\t\t\treturn maxLimit === null || currentLimit < maxLimit\n\t\t}\n\t\tcase AddOnLicenseType.CustomProxySetup:\n\t\t\treturn featureFlags?.canUseCustomCanonicalUrl === \"upsell\"\n\t\tcase AddOnLicenseType.Bandwidth:\n\t\tcase AddOnLicenseType.Pages:\n\t\tcase AddOnLicenseType.CmsCollections:\n\t\tcase AddOnLicenseType.CmsItems:\n\t\tcase AddOnLicenseType.Locale:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(licenseType)\n\t}\n}\n", "import {\n\tProjectLicensePeriod,\n\tProjectLicenseType,\n\tisBusinessLicenseType,\n\tisPersonalLicenseType,\n} from \"@framerjs/app-shared\"\n\n/** Returns true if we need to show the billing period toggle on the plan card.\n * The toggle is mostly shown for Basic and Pro plans, because the Scale is always yearly.\n * The only exception is when upgrading from a legacy project plan on a Basic/Pro workspace to Scale.\n * We can only toggle billing period for an existing plan for monthly -> yearly upgrades.\n */\nexport function canToggleBillingPeriod(\n\ttargetProjectLicensePlan: ProjectLicenseType,\n\tcurrentProjectLicenseType: ProjectLicenseType,\n\tcurrentPeriod: ProjectLicensePeriod | undefined,\n) {\n\t// Logic when upgrading to Scale plan\n\tif (targetProjectLicensePlan === ProjectLicenseType.ScaleSite2025) {\n\t\t// It is possible to go from a paid plan to Scale monthly, but only\n\t\t// when on a legacy personal plan or new Basic or Pro plan or\n\t\t// when on a legacy Business plan or the Scale plan when it is monthly\n\t\tif (\n\t\t\tisPersonalLicenseType(currentProjectLicenseType) ||\n\t\t\tcurrentProjectLicenseType === ProjectLicenseType.BasicSite2025 ||\n\t\t\tcurrentProjectLicenseType === ProjectLicenseType.ProSite2025 ||\n\t\t\t(isBusinessLicenseType(currentProjectLicenseType) && currentPeriod === ProjectLicensePeriod.Month) ||\n\t\t\t(currentProjectLicenseType === ProjectLicenseType.ScaleSite2025 && currentPeriod === ProjectLicensePeriod.Month)\n\t\t) {\n\t\t\treturn true\n\t\t}\n\n\t\t// Otherwise, the Scale plan is always yearly\n\t\treturn false\n\t}\n\n\t// Downgrading from Yearly to Monthly is not allowed for all paid plans\n\t// no need to check for the Free plan, because currentPeriod is `undefined` then\n\tif (currentPeriod === ProjectLicensePeriod.Year) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n\n/** Returns true if we need to show the billing period toggle inside the plan preview. */\nexport function canToggleBillingPeriodInsidePreview(\n\ttargetProjectLicensePlan: ProjectLicenseType,\n\tcurrentProjectLicenseType: ProjectLicenseType,\n\tcurrentPeriod: ProjectLicensePeriod | undefined,\n) {\n\t// If it is the same plan, we only need to preview the other billing period\n\tconst isSamePlan = currentProjectLicenseType === targetProjectLicensePlan\n\treturn !isSamePlan && canToggleBillingPeriod(targetProjectLicensePlan, currentProjectLicenseType, currentPeriod)\n}\n", "import \"Preview.styles_180ah8f.wyw.css\"; export const container = \"container_c127oo6c\";\nexport const divider = \"divider_d1fnpegy\";\nexport const previewTitle = \"previewTitle_p17gmc3l\";\nexport const previewDescription = \"previewDescription_pvohtsm\";\nexport const previewPrice = \"previewPrice_pnhaoc5\";\nexport const highlight = \"highlight_hnsjprx\";\nexport const itemContainer = \"itemContainer_is1adf4\";\nexport const sectionTitle = \"sectionTitle_s1kj6wk0\";\nexport const sectionSubtitle = \"sectionSubtitle_swxpzgc\";\nexport const link = \"link_l1pfmnnw\";\nexport const bold = \"bold_b1jb26ck\";\nexport const boldPrice = \"boldPrice_b16hrxmv\";\nexport const promotionCodeInputWrapper = \"promotionCodeInputWrapper_pujgvry\";\nexport const promotionCodeStatus = \"promotionCodeStatus_pvmndcb\";\nexport const promotionCodePill = \"promotionCodePill_p4n2hs6\";\nexport const promotionCodeCloseIcon = \"promotionCodeCloseIcon_p982br9\";\nexport const periodSegmentBox = \"periodSegmentBox_p1skf4gv\";\nexport const periodSegmentBoxSelected = \"periodSegmentBoxSelected_p1i4pfs2\";\nexport const periodSegmentBoxText = \"periodSegmentBoxText_ph1z6xv\";\nexport const periodSegmentBoxPrice = \"periodSegmentBoxPrice_p5jm23f\";\nexport const periodSegmentBoxSaveBadge = \"periodSegmentBoxSaveBadge_p1m9zk7q\";", "import { ProjectLicensePeriod, type ProjectLicenseType, isPaidLicenseType } from \"@framerjs/app-shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\n\ninterface UseShouldShowDomainVoucherBadgeParams {\n\tcurrentProjectLicenseType: Exclude<ProjectLicenseType, ProjectLicenseType.EnterpriseSite>\n\tcurrentSubscriptionPeriod: ProjectLicensePeriod | null | undefined\n}\n\nexport function useShouldShowDomainVoucherBadge({\n\tcurrentProjectLicenseType,\n\tcurrentSubscriptionPeriod,\n}: UseShouldShowDomainVoucherBadgeParams): boolean {\n\tconst freeDomainsEnabled = useExperimentIsOn(\"freeDomains\")\n\tconst customHostname = engine.stores.publishStore.useState(state => state.customHostname)\n\n\tif (!freeDomainsEnabled) {\n\t\treturn false\n\t}\n\n\tconst isYearlySelfServePlan =\n\t\tisPaidLicenseType(currentProjectLicenseType) && currentSubscriptionPeriod === ProjectLicensePeriod.Year\n\n\tif (isYearlySelfServePlan) {\n\t\treturn false\n\t}\n\n\t// Only hide if there's a non-free custom domain (e.g., user's own domain, not framer.website)\n\tconst hasNonFreeCustomDomain = customHostname && !engine.stores.publishStore.isFreeDomain(customHostname.hostname)\n\n\tif (hasNonFreeCustomDomain) {\n\t\treturn false\n\t}\n\n\treturn true\n}\n", "import type { PaidProjectLicenseType, ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { ProjectLicensePeriod } from \"@framerjs/app-shared\"\nimport type { AddOnLicenseType } from \"@framerjs/app-shared/src/AddOnPlan.ts\"\nimport { assertNever, emptyArray, getLogger, unhandledError } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { PromotionCodeState, StripePlans } from \"document/stores/PaymentsStore.ts\"\nimport { StripePlansStatus } from \"document/stores/PaymentsStore.ts\"\nimport { useCallback, useEffect, useRef } from \"react\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport type { PollResponse } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { PollStatus } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { getBandwidthAddonQuantity } from \"./addOns/bandwidthAddonUtils.ts\"\nimport type { CheckoutPreview } from \"./api/checkoutPreview.ts\"\nimport { CheckoutPreviewStatus, postCheckoutPreviews } from \"./api/checkoutPreview.ts\"\nimport { CheckoutSessionStatus, postCheckoutSession } from \"./api/checkoutSession.ts\"\nimport { PaymentErrorStatus, type PaymentError } from \"./api/errors/paymentError.ts\"\nimport type { AddOnPrices, LicenseSettings, PaidLicenseSettings, PlanPrice } from \"./api/licenseSettings.ts\"\nimport { LicensesSettingsStatus, getLicensesSettings } from \"./api/licenseSettings.ts\"\nimport { PutProjectSubscriptionStatus, putProjectSubscription } from \"./api/projectSubscription.ts\"\nimport type { CurrentSiteSubscription, PollUpdateProps } from \"./api/subscriptions.ts\"\nimport { SubscriptionStatus } from \"./api/subscriptions.ts\"\nimport type { CurrentTeamSubscription } from \"./api/teamSubscription.ts\"\nimport { canToggleBillingPeriodInsidePreview } from \"./utils/canToggleBillingPeriod.ts\"\nimport type { ResourceCounts } from \"./utils/resourceCounts.ts\"\nimport { useResourceCounts } from \"./utils/resourceCounts.ts\"\n\nconst log = getLogger(\"useStripePlans\")\n\nfunction paymentErrorToState(\n\terror: PaymentError,\n\tfallback: StripePlansStatus.UpdateSubscriptionError | StripePlansStatus.ReactivatePlanError,\n\tpreviousState: StripePlans,\n): StripePlans {\n\tswitch (error.status) {\n\t\tcase PaymentErrorStatus.PaymentDeclined:\n\t\t\treturn {\n\t\t\t\tstatus: StripePlansStatus.PaymentDeclinedError,\n\t\t\t\tmessage: error.message,\n\t\t\t\treason: error.reason,\n\t\t\t\ttryAgain: () => setState(previousState),\n\t\t\t}\n\t\tcase PaymentErrorStatus.Unauthorized:\n\t\t\treturn { status: StripePlansStatus.UnauthorizedError }\n\t\tcase PaymentErrorStatus.ActionRequiredError:\n\t\tcase PaymentErrorStatus.TaxLocationInvalid:\n\t\tcase PaymentErrorStatus.UnhandledError:\n\t\t\treturn { status: fallback }\n\t\tdefault:\n\t\t\tassertNever(error)\n\t}\n}\n\nexport interface StripePlansProps {\n\tprojectId: string\n\tteamId: string\n\tcurrentProjectLicenseType: ProjectLicenseType\n\tcurrentTeamSubscription: CurrentTeamSubscription | null\n\tcurrentSiteSubscription: CurrentSiteSubscription | null\n\tpollSubscriptionsUpdate: (newProps: PollUpdateProps) => Promise<void>\n\tpollProjectLicenseUpdate: (licenseType: ProjectLicenseType) => Promise<PollResponse>\n\trefreshSitePlans: () => Promise<void>\n\tisBillingV3: boolean\n}\n\ninterface StripePlansResult {\n\tstate: StripePlans\n\t/** Sends the user to Stripe in the case of first purchase, or to the preview page */\n\tpreviewPlan: (\n\t\tselectedPlan: LicenseSettings,\n\t\tselectedPeriod: ProjectLicensePeriod,\n\t\tselectedAddons: AddOnLicenseType[],\n\t\tpromotionCode?: string,\n\t) => Promise<void>\n\t/** Reactivates a cancelled plan, returns true if reactivated successfully */\n\treactivatePlan: (selectedProjectLicenseType: PaidProjectLicenseType, planPrice: PlanPrice) => Promise<boolean>\n\tpurchasePlan: (selectedProjectLicenseType: PaidProjectLicenseType, planPrice: PlanPrice) => Promise<void>\n\tcancelPreview: () => void\n\t/** Resets and refreshes the parent sitePlans state together with the Stripe Plans state */\n\trefreshStripePlans: () => Promise<void>\n}\n\n/**\n * This function is used to build the payload for the addons field request that needs it\n */\nfunction buildAddonRequestPayload({\n\tresourceCounts,\n\taddOns,\n\tselectedAddons,\n}: {\n\tresourceCounts: ResourceCounts\n\taddOns: AddOnPrices\n\tselectedAddons: readonly AddOnLicenseType[]\n}): { plan: string; quantity: number }[] {\n\tconst addOnsPayload: { plan: string; quantity: number }[] = []\n\n\t// Currently either Advanced Analytics or Custom Proxy Setup can be selected\n\t// by user, see `isAddonUserSelectable` in Preview.tsx\n\tfor (const addOnLicenseType of selectedAddons) {\n\t\tconst addOn = addOns[addOnLicenseType]\n\t\tif (!addOn) continue\n\t\taddOnsPayload.push({ plan: addOn.planId, quantity: 1 })\n\t}\n\n\tif (addOns.locale) {\n\t\taddOnsPayload.push({ plan: addOns.locale.planId, quantity: resourceCounts.locales })\n\t}\n\n\tif (addOns.bandwidth) {\n\t\tconst { currentMonth, previousMonth, twoMonthsAgo } = resourceCounts.bandwidthInGB\n\t\tconst currentLimit = engine.stores.projectStore.project?.settings.resourceLimits.bandwidthInGB ?? 0\n\n\t\t// Previous months are publish blocking, that's why we prioritize the values there\n\t\tif (experiments.isOn(\"publishBandwidthBlock\") && previousMonth > currentLimit && twoMonthsAgo > currentLimit) {\n\t\t\taddOnsPayload.push({\n\t\t\t\tplan: addOns.bandwidth.planId,\n\t\t\t\tquantity: getBandwidthAddonQuantity(Math.min(previousMonth, twoMonthsAgo)),\n\t\t\t})\n\t\t} else {\n\t\t\taddOnsPayload.push({\n\t\t\t\tplan: addOns.bandwidth.planId,\n\t\t\t\tquantity: getBandwidthAddonQuantity(currentMonth),\n\t\t\t})\n\t\t}\n\t}\n\n\tif (addOns.cmsCollections) {\n\t\taddOnsPayload.push({ plan: addOns.cmsCollections.planId, quantity: resourceCounts.cmsCollections })\n\t}\n\n\tif (addOns.cmsItems) {\n\t\taddOnsPayload.push({ plan: addOns.cmsItems.planId, quantity: resourceCounts.cmsItems })\n\t}\n\n\tif (addOns.pages) {\n\t\taddOnsPayload.push({ plan: addOns.pages.planId, quantity: resourceCounts.pages })\n\t}\n\n\treturn addOnsPayload.filter(({ quantity }) => quantity > 0)\n}\n\nfunction setState(state: StripePlans | ((prevState: StripePlans) => StripePlans)) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst { paymentsStore } = engine.stores\n\t\tif (typeof state === \"function\") {\n\t\t\tpaymentsStore.stripePlans = state(paymentsStore.stripePlans)\n\t\t} else {\n\t\t\tpaymentsStore.stripePlans = state\n\t\t}\n\t})\n}\n\ninterface PricingRequestCache {\n\t[cacheKey: string]: CheckoutPreview\n}\n\nfunction generateCacheKey(planId: string, addons: AddOnLicenseType[], promotionCode?: string) {\n\treturn `${planId}-${[...addons].sort().join(\"-\")}-${promotionCode ?? \"\"}`\n}\n\nfunction getPromotionCodeState(\n\tpromotionCode: string | undefined,\n\tcheckoutPreview: CheckoutPreview,\n): PromotionCodeState | undefined {\n\tif (!promotionCode) return undefined\n\tif (checkoutPreview.discount > 0) return { status: \"applied\", code: promotionCode }\n\treturn { status: \"error\", reason: \"noDiscount\", code: promotionCode }\n}\n\nexport function useStripePlans(props: StripePlansProps): StripePlansResult {\n\tconst {\n\t\tprojectId,\n\t\tteamId,\n\t\tcurrentProjectLicenseType,\n\t\tcurrentTeamSubscription,\n\t\tcurrentSiteSubscription,\n\t\tpollSubscriptionsUpdate,\n\t\tpollProjectLicenseUpdate,\n\t\trefreshSitePlans,\n\t\tisBillingV3,\n\t} = props\n\tconst state = engine.stores.paymentsStore.useState(({ stripePlans }) => stripePlans)\n\tconst resourceCounts = useResourceCounts()\n\tconst pricingRequestCacheRef = useRef<PricingRequestCache>({})\n\tconst abortControllerRef = useRef<AbortController | null>(null)\n\n\tconst refreshStripePlans = useCallback(async () => {\n\t\tsetState({ status: StripePlansStatus.Loading })\n\t\treturn refreshSitePlans()\n\t}, [refreshSitePlans])\n\n\t// Load the prices, features and resource limits for the plans view\n\tuseEffect(() => {\n\t\tconst abortController = new AbortController()\n\t\tvoid (async () => {\n\t\t\t// Don't refetch when the app is remounting\n\t\t\tif (engine.isRemountingUI()) return\n\n\t\t\tconst licensesSettingsResponse = await getLicensesSettings(\n\t\t\t\tcurrentTeamSubscription?.currency,\n\t\t\t\tabortController.signal,\n\t\t\t\tisBillingV3,\n\t\t\t)\n\t\t\tswitch (licensesSettingsResponse.status) {\n\t\t\t\tcase LicensesSettingsStatus.AbortError:\n\t\t\t\t\treturn\n\t\t\t\tcase LicensesSettingsStatus.UnhandledError:\n\t\t\t\t\treturn setState({ status: StripePlansStatus.FailedToFetchPricesError })\n\t\t\t\tcase LicensesSettingsStatus.Success:\n\t\t\t\t\treturn setState({\n\t\t\t\t\t\tstatus: StripePlansStatus.Plans,\n\t\t\t\t\t\tlicensesSettings: licensesSettingsResponse.licensesSettings,\n\t\t\t\t\t\tinitialLicenseTypeForPlansToggle: null,\n\t\t\t\t\t})\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(licensesSettingsResponse)\n\t\t\t}\n\t\t})()\n\t\treturn () => abortController.abort()\n\t}, [currentTeamSubscription?.currency, isBillingV3])\n\n\t// Reset cache when the state we are is not any preview state\n\tuseEffect(() => {\n\t\tconst nonResetStatuses = [\n\t\t\tStripePlansStatus.Preview,\n\t\t\tStripePlansStatus.UpdatingPreview,\n\t\t\tStripePlansStatus.ConfirmingPurchase,\n\t\t]\n\t\tif (!nonResetStatuses.includes(state.status)) {\n\t\t\tpricingRequestCacheRef.current = {}\n\t\t}\n\t}, [state.status])\n\n\tconst previewPlan = useCallback(\n\t\tasync (\n\t\t\tselectedPlan: PaidLicenseSettings,\n\t\t\tselectedPeriod: ProjectLicensePeriod,\n\t\t\tselectedAddons: AddOnLicenseType[],\n\t\t\tpromotionCode?: string,\n\t\t) => {\n\t\t\tif (abortControllerRef.current) {\n\t\t\t\tabortControllerRef.current.abort()\n\t\t\t}\n\t\t\tabortControllerRef.current = new AbortController()\n\t\t\tconst signal = abortControllerRef.current.signal\n\n\t\t\tif (\n\t\t\t\tstate.status !== StripePlansStatus.Plans &&\n\t\t\t\tstate.status !== StripePlansStatus.Preview &&\n\t\t\t\tstate.status !== StripePlansStatus.UpdatingPreview\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tasync function checkoutInStripe() {\n\t\t\t\tconst { planId, addOns } = selectedPlan.prices[selectedPeriod]\n\t\t\t\tconst addOnsPayload = buildAddonRequestPayload({\n\t\t\t\t\tresourceCounts,\n\t\t\t\t\taddOns,\n\t\t\t\t\t// We cannot select add-ons for the first purchase,\n\t\t\t\t\t// because the UI for selecting is in Preview, but\n\t\t\t\t\t// in this case the user is redirected to Stripe\n\t\t\t\t\tselectedAddons: emptyArray(),\n\t\t\t\t})\n\t\t\t\tconst result = await postCheckoutSession({\n\t\t\t\t\tplanId,\n\t\t\t\t\tprojectId,\n\t\t\t\t\tteamId,\n\t\t\t\t\tprojectLicenseType: selectedPlan.licenseType,\n\t\t\t\t\taddOns: addOnsPayload,\n\t\t\t\t\tisBillingV3,\n\t\t\t\t})\n\t\t\t\tswitch (result.status) {\n\t\t\t\t\tcase CheckoutSessionStatus.Success:\n\t\t\t\t\t\t// track this similar to the preview page\n\t\t\t\t\t\trecord(\"ui_impression\", { page: Pages.siteSettingsPlansConfirmation })\n\t\t\t\t\t\trecord(\"ui_impression\", { page: Pages.siteSettingsPlansCheckoutWithRedirect })\n\t\t\t\t\t\twindow.open(result.checkoutUrl, \"_self\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase CheckoutSessionStatus.DuplicateCheckoutError:\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.DuplicateCheckoutError })\n\t\t\t\t\tcase CheckoutSessionStatus.UnhandledError:\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.CheckoutSessionError })\n\t\t\t\t\tcase CheckoutSessionStatus.UnauthorizedError:\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.UnauthorizedError })\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(result)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst selectedCacheKey = generateCacheKey(\n\t\t\t\tselectedPlan.prices[selectedPeriod].planId,\n\t\t\t\tselectedAddons,\n\t\t\t\tpromotionCode,\n\t\t\t)\n\t\t\tconst cachedCheckoutPreview = pricingRequestCacheRef.current[selectedCacheKey]\n\t\t\tif (cachedCheckoutPreview) {\n\t\t\t\treturn setState({\n\t\t\t\t\tstatus: StripePlansStatus.Preview,\n\t\t\t\t\tcheckoutPreview: cachedCheckoutPreview,\n\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\tselectedPlan,\n\t\t\t\t\tpreviousProjectLicenseType: currentProjectLicenseType,\n\t\t\t\t\tpreviousProjectPeriod: currentSiteSubscription?.period,\n\t\t\t\t\tselectedProjectPeriod: selectedPeriod,\n\t\t\t\t\tselectedAddons,\n\t\t\t\t\tpromotionCode: getPromotionCodeState(promotionCode, cachedCheckoutPreview),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst isFirstPurchaseWithRedirectToStripe = currentTeamSubscription === null\n\t\t\tif (isFirstPurchaseWithRedirectToStripe) {\n\t\t\t\treturn checkoutInStripe()\n\t\t\t}\n\n\t\t\tif (state.status !== StripePlansStatus.Preview && state.status !== StripePlansStatus.UpdatingPreview) {\n\t\t\t\tsetState({\n\t\t\t\t\tstatus: StripePlansStatus.LoadingPreview,\n\t\t\t\t\tselectedProjectLicenseType: selectedPlan.licenseType,\n\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\tinitialLicenseTypeForPlansToggle: null,\n\t\t\t\t\tselectedAddons,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\t// We need to set the state to updating to disable the buy button\n\t\t\t\t// while we're fetching the checkout preview prices when we add/remove addons\n\t\t\t\tsetState({\n\t\t\t\t\tstatus: StripePlansStatus.UpdatingPreview,\n\t\t\t\t\tcheckoutPreview: state.checkoutPreview,\n\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\tselectedPlan,\n\t\t\t\t\tpreviousProjectLicenseType: currentProjectLicenseType,\n\t\t\t\t\tpreviousProjectPeriod: currentSiteSubscription?.period,\n\t\t\t\t\tselectedProjectPeriod: selectedPeriod,\n\t\t\t\t\tselectedAddons,\n\t\t\t\t\tpromotionCode:\n\t\t\t\t\t\tstate.status === StripePlansStatus.Preview || state.status === StripePlansStatus.UpdatingPreview\n\t\t\t\t\t\t\t? state.promotionCode\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tconst shouldRequestAllPeriods = canToggleBillingPeriodInsidePreview(\n\t\t\t\tselectedPlan.licenseType,\n\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\tcurrentSiteSubscription?.period,\n\t\t\t)\n\n\t\t\tconst planPrices = shouldRequestAllPeriods\n\t\t\t\t? [ProjectLicensePeriod.Month, ProjectLicensePeriod.Year]\n\t\t\t\t: [selectedPeriod]\n\n\t\t\tconst postCheckoutPreviewRequestArguments = planPrices.map((period: ProjectLicensePeriod) => {\n\t\t\t\tconst { planId, addOns } = selectedPlan.prices[period]\n\t\t\t\tconst addOnsPayload = buildAddonRequestPayload({ resourceCounts, addOns, selectedAddons })\n\t\t\t\treturn {\n\t\t\t\t\tprojectId,\n\t\t\t\t\tplanId,\n\t\t\t\t\tperiod,\n\t\t\t\t\taddOns: addOnsPayload,\n\t\t\t\t\tisBillingV3,\n\t\t\t\t\tpromotionCode,\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst postPreviewRequest = async () => {\n\t\t\t\tconst response = await postCheckoutPreviews(postCheckoutPreviewRequestArguments, signal)\n\t\t\t\tif (signal.aborted) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tabortControllerRef.current = null\n\t\t\t\tswitch (response.status) {\n\t\t\t\t\tcase CheckoutPreviewStatus.OverEditorLimitError:\n\t\t\t\t\t\treturn setState({\n\t\t\t\t\t\t\tstatus: StripePlansStatus.OverEditorLimitError,\n\t\t\t\t\t\t\tnewLimit: response.newLimit,\n\t\t\t\t\t\t\tcurrentEditorCount: response.currentEditorCount,\n\t\t\t\t\t\t})\n\t\t\t\t\tcase CheckoutPreviewStatus.OverProjectEditorLimitError:\n\t\t\t\t\t\treturn setState({\n\t\t\t\t\t\t\tstatus: StripePlansStatus.OverProjectEditorLimitError,\n\t\t\t\t\t\t\tnewLimit: response.newLimit,\n\t\t\t\t\t\t\tcurrentEditorCount: response.currentEditorCount,\n\t\t\t\t\t\t})\n\t\t\t\t\tcase CheckoutPreviewStatus.CantMoveAddOnError:\n\t\t\t\t\t\treturn setState({\n\t\t\t\t\t\t\tstatus: StripePlansStatus.CantMoveAddOnError,\n\t\t\t\t\t\t\taddonLicenseType: response.addOnLicenseType,\n\t\t\t\t\t\t})\n\t\t\t\t\tcase CheckoutPreviewStatus.StripeSubscriptionMissingError: {\n\t\t\t\t\t\treturn checkoutInStripe()\n\t\t\t\t\t}\n\t\t\t\t\tcase CheckoutPreviewStatus.UnhandledError:\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.CheckoutPreviewError })\n\t\t\t\t\tcase CheckoutPreviewStatus.InvalidPromotionCode:\n\t\t\t\t\t\tif (state.status === StripePlansStatus.Preview || state.status === StripePlansStatus.UpdatingPreview) {\n\t\t\t\t\t\t\treturn setState({\n\t\t\t\t\t\t\t\tstatus: StripePlansStatus.Preview,\n\t\t\t\t\t\t\t\tcheckoutPreview: state.checkoutPreview,\n\t\t\t\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\t\t\t\tselectedPlan: state.selectedPlan,\n\t\t\t\t\t\t\t\tpreviousProjectLicenseType: state.previousProjectLicenseType,\n\t\t\t\t\t\t\t\tpreviousProjectPeriod: state.previousProjectPeriod,\n\t\t\t\t\t\t\t\tselectedProjectPeriod: state.selectedProjectPeriod,\n\t\t\t\t\t\t\t\tselectedAddons: state.selectedAddons,\n\t\t\t\t\t\t\t\tpromotionCode: { status: \"error\", reason: \"invalid\" },\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.CheckoutPreviewError })\n\t\t\t\t\tcase CheckoutPreviewStatus.Success: {\n\t\t\t\t\t\tif (response.month) {\n\t\t\t\t\t\t\tconst cacheKey = generateCacheKey(response.month.planId, selectedAddons, promotionCode)\n\t\t\t\t\t\t\tpricingRequestCacheRef.current[cacheKey] = response.month\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (response.year) {\n\t\t\t\t\t\t\tconst cacheKey = generateCacheKey(response.year.planId, selectedAddons, promotionCode)\n\t\t\t\t\t\t\tpricingRequestCacheRef.current[cacheKey] = response.year\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (response[selectedPeriod]) {\n\t\t\t\t\t\t\treturn setState({\n\t\t\t\t\t\t\t\tstatus: StripePlansStatus.Preview,\n\t\t\t\t\t\t\t\tcheckoutPreview: response[selectedPeriod],\n\t\t\t\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\t\t\t\tselectedPlan,\n\t\t\t\t\t\t\t\tpreviousProjectLicenseType: currentProjectLicenseType,\n\t\t\t\t\t\t\t\tpreviousProjectPeriod: currentSiteSubscription?.period,\n\t\t\t\t\t\t\t\tselectedProjectPeriod: selectedPeriod,\n\t\t\t\t\t\t\t\tselectedAddons,\n\t\t\t\t\t\t\t\tpromotionCode: getPromotionCodeState(promotionCode, response[selectedPeriod]),\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.CheckoutPreviewError })\n\t\t\t\t\t}\n\t\t\t\t\tcase CheckoutPreviewStatus.UnauthorizedError:\n\t\t\t\t\t\treturn setState({ status: StripePlansStatus.UnauthorizedError })\n\t\t\t\t\tcase CheckoutPreviewStatus.Aborted:\n\t\t\t\t\t\treturn\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(response)\n\t\t\t\t}\n\t\t\t}\n\t\t\tpostPreviewRequest().catch(unhandledError)\n\t\t},\n\t\t[\n\t\t\tcurrentProjectLicenseType,\n\t\t\tcurrentSiteSubscription,\n\t\t\tcurrentTeamSubscription,\n\t\t\tprojectId,\n\t\t\tresourceCounts,\n\t\t\tstate,\n\t\t\tteamId,\n\t\t\tisBillingV3,\n\t\t],\n\t)\n\n\tconst purchasePlan = useCallback(\n\t\tasync (selectedProjectLicenseType: PaidProjectLicenseType, { planId, addOns }: PlanPrice): Promise<void> => {\n\t\t\tif (state.status !== StripePlansStatus.Preview) return\n\t\t\tsetState({ ...state, status: StripePlansStatus.ConfirmingPurchase })\n\n\t\t\tconst addOnsPayload = buildAddonRequestPayload({\n\t\t\t\tresourceCounts,\n\t\t\t\taddOns,\n\t\t\t\tselectedAddons: state.selectedAddons ?? emptyArray(),\n\t\t\t})\n\t\t\tconst result = await putProjectSubscription({\n\t\t\t\tprojectId,\n\t\t\t\tplanId,\n\t\t\t\taddOns: addOnsPayload,\n\t\t\t\tisBillingV3,\n\t\t\t\tpromotionCode: state.promotionCode?.status === \"applied\" ? state.promotionCode.code : undefined,\n\t\t\t})\n\n\t\t\tpricingRequestCacheRef.current = {}\n\n\t\t\tswitch (result.status) {\n\t\t\t\tcase PutProjectSubscriptionStatus.PaymentError:\n\t\t\t\t\treturn setState(paymentErrorToState(result.error, StripePlansStatus.UpdateSubscriptionError, state))\n\t\t\t\tcase PutProjectSubscriptionStatus.OverEditorLimitError:\n\t\t\t\t\treturn setState({\n\t\t\t\t\t\tstatus: StripePlansStatus.OverEditorLimitError,\n\t\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t\t})\n\t\t\t\tcase PutProjectSubscriptionStatus.OverProjectEditorLimitError:\n\t\t\t\t\treturn setState({\n\t\t\t\t\t\tstatus: StripePlansStatus.OverProjectEditorLimitError,\n\t\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t\t})\n\t\t\t\tcase PutProjectSubscriptionStatus.InvalidPromotionCode:\n\t\t\t\t\treturn setState({ status: StripePlansStatus.InvalidPromotionCodeError })\n\t\t\t\tcase PutProjectSubscriptionStatus.Success: {\n\t\t\t\t\tconst pollResult = await pollProjectLicenseUpdate(selectedProjectLicenseType)\n\t\t\t\t\tswitch (pollResult.status) {\n\t\t\t\t\t\tcase PollStatus.TimeoutError:\n\t\t\t\t\t\tcase PollStatus.UnhandledError:\n\t\t\t\t\t\t\tlog.error(\"Failed to poll project license update when upgrading plan\", pollResult)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase PollStatus.Success:\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tassertNever(pollResult)\n\t\t\t\t\t}\n\t\t\t\t\treturn setState({\n\t\t\t\t\t\tstatus: StripePlansStatus.Success,\n\t\t\t\t\t\tselectedProjectLicenseType,\n\t\t\t\t\t\tpreviousProjectLicenseType: state.previousProjectLicenseType,\n\t\t\t\t\t\tpreviousProjectPeriod: state.previousProjectPeriod,\n\t\t\t\t\t\tselectedProjectPeriod: state.selectedProjectPeriod,\n\t\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(result)\n\t\t\t}\n\t\t},\n\t\t[projectId, pollProjectLicenseUpdate, state, resourceCounts, isBillingV3],\n\t)\n\n\tconst reactivatePlan = useCallback(\n\t\tasync (selectedProjectLicenseType: PaidProjectLicenseType, { planId }: PlanPrice): Promise<boolean> => {\n\t\t\t// Can only reactivate a plan if the user is on the plans page\n\t\t\tif (state.status !== StripePlansStatus.Plans) return false\n\n\t\t\tsetState({\n\t\t\t\tstatus: StripePlansStatus.Reactivating,\n\t\t\t\tselectedProjectLicenseType,\n\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\tinitialLicenseTypeForPlansToggle: null,\n\t\t\t})\n\n\t\t\t// During reactivation, the licenses are the source of truth for the addOn quantities\n\t\t\tconst result = await putProjectSubscription({ projectId, planId, addOns: [], isBillingV3 })\n\t\t\tswitch (result.status) {\n\t\t\t\tcase PutProjectSubscriptionStatus.PaymentError:\n\t\t\t\t\tsetState(paymentErrorToState(result.error, StripePlansStatus.ReactivatePlanError, state))\n\t\t\t\t\treturn false\n\t\t\t\tcase PutProjectSubscriptionStatus.OverEditorLimitError:\n\t\t\t\t\tsetState({\n\t\t\t\t\t\tstatus: StripePlansStatus.OverEditorLimitError,\n\t\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t\t})\n\t\t\t\t\treturn false\n\t\t\t\tcase PutProjectSubscriptionStatus.OverProjectEditorLimitError:\n\t\t\t\t\tsetState({\n\t\t\t\t\t\tstatus: StripePlansStatus.OverProjectEditorLimitError,\n\t\t\t\t\t\tnewLimit: result.newLimit,\n\t\t\t\t\t\tcurrentEditorCount: result.currentEditorCount,\n\t\t\t\t\t})\n\t\t\t\t\treturn false\n\t\t\t\tcase PutProjectSubscriptionStatus.InvalidPromotionCode:\n\t\t\t\t\tsetState({ status: StripePlansStatus.InvalidPromotionCodeError })\n\t\t\t\t\treturn false\n\t\t\t\tcase PutProjectSubscriptionStatus.Success: {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait pollSubscriptionsUpdate({ site: { status: SubscriptionStatus.Active } })\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t/* ignore polling error */\n\t\t\t\t\t\tlog.error(\"Failed to poll subscriptions update when reactivating plan\")\n\t\t\t\t\t}\n\t\t\t\t\t// We need to re-fetch project info to update add-on info\n\t\t\t\t\t// pollProjectLicenseUpdate will fetch project only once because the license type is the same\n\t\t\t\t\t// so it\u2019s not really a polling but rather a single fetch\n\t\t\t\t\tconst pollResult = await pollProjectLicenseUpdate(selectedProjectLicenseType)\n\t\t\t\t\tswitch (pollResult.status) {\n\t\t\t\t\t\tcase PollStatus.TimeoutError:\n\t\t\t\t\t\tcase PollStatus.UnhandledError:\n\t\t\t\t\t\t\tlog.error(\"Failed to poll project license update when reactivating plan\", pollResult)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase PollStatus.Success:\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tassertNever(pollResult)\n\t\t\t\t\t}\n\t\t\t\t\tsetState({\n\t\t\t\t\t\tstatus: StripePlansStatus.Plans,\n\t\t\t\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\t\t\t\tinitialLicenseTypeForPlansToggle: null,\n\t\t\t\t\t})\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(result)\n\t\t\t}\n\t\t},\n\t\t[state, projectId, pollSubscriptionsUpdate, pollProjectLicenseUpdate, isBillingV3],\n\t)\n\n\tconst cancelPreview = useCallback(() => {\n\t\tif (state.status !== StripePlansStatus.Preview) return\n\n\t\tsetState({\n\t\t\tstatus: StripePlansStatus.Plans,\n\t\t\tlicensesSettings: state.licensesSettings,\n\t\t\tinitialLicenseTypeForPlansToggle: state.selectedPlan.licenseType,\n\t\t})\n\t}, [state])\n\n\treturn {\n\t\tstate,\n\t\tpreviewPlan,\n\t\tcancelPreview,\n\t\treactivatePlan,\n\t\tpurchasePlan,\n\t\trefreshStripePlans,\n\t}\n}\n", "import type { ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { ApiError, HTTP_ERROR_CODES } from \"@framerjs/app-shared\"\nimport { getLogger } from \"@framerjs/shared\"\nimport { apiFetcher } from \"web/lib/apiFetcher.ts\"\nimport { QueryParam } from \"../../usePlanQueryParam.ts\"\n\nconst log = getLogger(\"checkoutSession\")\n\nexport enum CheckoutSessionStatus {\n\tSuccess,\n\tUnauthorizedError,\n\tUnhandledError,\n\tDuplicateCheckoutError,\n}\n\ntype CheckoutSessionResponse =\n\t| {\n\t\t\tstatus: CheckoutSessionStatus.Success\n\t\t\tcheckoutUrl: string\n\t  }\n\t| {\n\t\t\tstatus:\n\t\t\t\t| CheckoutSessionStatus.UnauthorizedError\n\t\t\t\t| CheckoutSessionStatus.UnhandledError\n\t\t\t\t| CheckoutSessionStatus.DuplicateCheckoutError\n\t  }\n\ninterface PostCheckoutSessionRequest {\n\tprojectLicenseType: ProjectLicenseType\n\tteamId: string\n\tplanId: string\n\tprojectId: string\n\taddOns: { plan: string; quantity: number }[]\n\tisBillingV3: boolean\n}\n\nfunction buildCheckoutSessionBody(request: PostCheckoutSessionRequest, successUrl: string): unknown {\n\tconst { teamId, planId, projectId, addOns, isBillingV3 } = request\n\n\tif (isBillingV3) {\n\t\treturn {\n\t\t\tsuccessUrl,\n\t\t\tteamId,\n\t\t\tprojectId,\n\t\t\tplan: planId,\n\t\t\t...(addOns?.length ? { addOns } : {}),\n\t\t}\n\t}\n\n\tconst lineItems = [{ plan: planId }, ...(addOns || [])]\n\treturn {\n\t\tteamId,\n\t\tlineItems: lineItems.map(item => ({ ...item, resourceIds: [projectId] })),\n\t\tsuccessUrl,\n\t}\n}\n\nexport async function postCheckoutSession(request: PostCheckoutSessionRequest): Promise<CheckoutSessionResponse> {\n\tconst { projectLicenseType, isBillingV3 } = request\n\tconst successQuery = new URLSearchParams({\n\t\tview: \"settings:plans\",\n\t\t[QueryParam.CheckoutItem]: projectLicenseType,\n\t})\n\tconst successUrl = `${window.location.origin}${window.location.pathname}?${successQuery.toString()}`\n\n\ttry {\n\t\tconst body = buildCheckoutSessionBody(request, successUrl)\n\t\tconst url = isBillingV3 ? `/web/v3/checkout/session` : `/web/v2/checkout/session`\n\t\tconst res: { checkoutUrl: string } = await apiFetcher.post(url, body)\n\t\treturn { status: CheckoutSessionStatus.Success, checkoutUrl: res.checkoutUrl }\n\t} catch (error) {\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Forbidden) {\n\t\t\treturn { status: CheckoutSessionStatus.UnauthorizedError }\n\t\t}\n\t\tif (error instanceof ApiError && error.status === HTTP_ERROR_CODES.Conflict) {\n\t\t\treturn { status: CheckoutSessionStatus.DuplicateCheckoutError }\n\t\t}\n\t\tlog.reportError(error)\n\t\treturn { status: CheckoutSessionStatus.UnhandledError }\n\t}\n}\n", "import { ProjectLicenseType, TeamLicenseType, dashboardRecentPath, openNewTab } from \"@framerjs/app-shared\"\nimport { ACLEntryKind, canEditContent } from \"@framerjs/app-shared/src/ACLEntry.ts\"\nimport { UpsellType } from \"@framerjs/events\"\nimport type { ModalOpenSource } from \"@framerjs/framer-events\"\nimport { Link } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { shouldUseBillingV3 } from \"document/components/chrome/siteSettings/Plans/Stripe/api/billingV3.ts\"\nimport { UpsellFeature } from \"document/components/chrome/siteSettings/Plans/Stripe/utils/upsell.ts\"\nimport type { ProjectStore } from \"document/stores/ProjectStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { countAndNoun } from \"utils/countAndNoun.ts\"\nimport { enterpriseUpsellURL } from \"utils/staticURLs.ts\"\nimport { getProjectPlansURL } from \"web/lib/Project.ts\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { Tab } from \"web/pages/projects/components/settings/team/types.ts\"\nimport { MAX_EDITORS_ON_SELF_SERVE } from \"../../../siteSettings/Usage/constants.ts\"\n\nexport function getProjectEditorCount(projectStore: ProjectStore): number {\n\tconst project = projectStore.project\n\tif (!project) return 0\n\tconst isBillingV3 = shouldUseBillingV3({\n\t\tbillingV3ExperimentOn: experiments.isOn(\"billingV3\"),\n\t\tteamLicenseType: project.teamLicenseType,\n\t\tteamLicenseVersion: project.teamLicenseVersion,\n\t})\n\treturn isBillingV3\n\t\t? projectStore.acl.filter(\n\t\t\t\tacl => acl.kind === ACLEntryKind.User && !acl.user.isFramerEmployee && canEditContent(acl.role),\n\t\t\t).length\n\t\t: project.teamCurrentEditors\n}\n\n// The two helpers below are shared between the workspace-level and\n// project-level flows. The caller supplies the `UpsellType` so the resulting\n// tracking events can be sliced by origin.\ntype EditorLimitUpsellType = UpsellType.enterpriseEditorLimitUpsell | UpsellType.projectEditorLimitEnterpriseUpsell\n\nfunction openEnterpriseEditorLimitConfirmation(\n\tengine: VekterEngine,\n\tsource: ModalOpenSource,\n\tupsellType: EditorLimitUpsellType,\n) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\tsource,\n\t\ttitle: \"Add More Editors\",\n\t\tdescription: \"This invite exceeds your editor limit. Contact us to increase the number of editors on your plan.\",\n\t\tconfirmLabel: Dictionary.ContactUs,\n\t\tcancelLabel: Dictionary.Dismiss,\n\t\tonConfirm: () => {\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: upsellType,\n\t\t\t\tid: UpsellUIInteraction.contactUs,\n\t\t\t})\n\t\t\topenNewTab(enterpriseUpsellURL)\n\t\t},\n\t})\n}\n\nfunction openEnterpriseEditorLimitUpsell(\n\tengine: VekterEngine,\n\tsource: ModalOpenSource,\n\tupsellType: EditorLimitUpsellType,\n) {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellEnterprise,\n\t\tsource,\n\t\tdescription:\n\t\t\t\"Sign up for an Enterprise plan to add more editors and unlock powerful features that help scale your site.\",\n\t\tupsell: upsellType,\n\t\tupsellFeatures: [\n\t\t\t\"Advanced Permissions\",\n\t\t\t\"Custom Limits\",\n\t\t\t\"Custom Hosting\",\n\t\t\t\"Custom Proxy Support\",\n\t\t\t\"Enterprise Security\",\n\t\t\t\"Dedicated Support\",\n\t\t],\n\t})\n}\n\nexport interface ProjectEditorLimitUpsellParams {\n\tprojectId: string\n\tlicenseType: ProjectLicenseType\n\teditorLimit: number\n}\n\nexport function upsellEditorLimit(engine: VekterEngine, source: ModalOpenSource) {\n\tconst project = engine.stores.projectStore.project\n\tassert(project, \"Project should exist when upselling editor limit\")\n\n\tif (project.license.type === ProjectLicenseType.EnterpriseSite) {\n\t\treturn openEnterpriseEditorLimitConfirmation(engine, source, UpsellType.enterpriseEditorLimitUpsell)\n\t}\n\n\t// The assumption here is that if the team is on a business plan,\n\t// then it has the highest editor limit available (=== 10).\n\t// The only way to increase it is to go to Enterprise.\n\tif (project.teamLicenseType === TeamLicenseType.TeamBusinessPlan) {\n\t\treturn openEnterpriseEditorLimitUpsell(engine, source, UpsellType.enterpriseEditorLimitUpsell)\n\t}\n\n\tconst maxEditors = project.settings.resourceLimits.maxEditors\n\tassert(typeof maxEditors === \"number\", \"Expect the editor limit to be a number\")\n\tconst editors = maxEditors === 1 ? \"1 editor\" : maxEditors.toLocaleString() + \" editors\"\n\tconst settingsURL = `${dashboardRecentPath}?teamId=${project.space.ownerId}&open-settings=1&settings-tab=${Tab.Members}`\n\tconst description = (\n\t\t<div>\n\t\t\tYou\u2019ve reached the limit of {editors} in your workspace. Upgrade your site to invite more editors, or{\" \"}\n\t\t\t<Link variant=\"linkLined\" href={settingsURL}>\n\t\t\t\tremove an existing editor\n\t\t\t</Link>{\" \"}\n\t\t\tfrom your workspace.\n\t\t</div>\n\t)\n\n\treturn engine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tsource,\n\t\ttitle: \"Editor Limit\",\n\t\tupsellFeature: UpsellFeature.canInviteEditors,\n\t\tdescription,\n\t})\n}\n\nexport function upsellProjectEditorLimit(\n\tengine: VekterEngine,\n\tsource: ModalOpenSource,\n\tparams: ProjectEditorLimitUpsellParams,\n): void {\n\tconst project = engine.stores.projectStore.project\n\tassert(project, \"Project should exist when upselling editor limit\")\n\n\tif (params.licenseType === ProjectLicenseType.EnterpriseSite) {\n\t\topenEnterpriseEditorLimitConfirmation(engine, source, UpsellType.projectEditorLimitEnterpriseUpsell)\n\t\treturn\n\t}\n\n\t// Editor limits have no add-on: if the plan is already at the self-serve\n\t// ceiling there is no higher self-serve plan to upsell to, so point at\n\t// Enterprise.\n\tif (params.editorLimit >= MAX_EDITORS_ON_SELF_SERVE) {\n\t\topenEnterpriseEditorLimitUpsell(engine, source, UpsellType.projectEditorLimitEnterpriseUpsell)\n\t\treturn\n\t}\n\n\tconst editorsPhrase = countAndNoun(params.editorLimit, \"editor\", \"editors\")\n\tconst plansURL = getProjectPlansURL({\n\t\tid: project.id,\n\t\ttitle: project.title,\n\t\tcanvasFeatures: project.canvasFeatures ?? {},\n\t}).toString()\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.UpsellFeature,\n\t\tsource,\n\t\ttitle: \"Editor Limit\",\n\t\tupsellFeature: UpsellFeature.canInviteProjectEditors,\n\t\tdescription: (\n\t\t\t<div>\n\t\t\t\tYou\u2019ve reached the limit of {editorsPhrase} on this project. Upgrade this project\u2019s plan to invite more editors,\n\t\t\t\tor{\" \"}\n\t\t\t\t<Link variant=\"linkLined\" href={plansURL}>\n\t\t\t\t\tview your plan\n\t\t\t\t</Link>\n\t\t\t\t.\n\t\t\t</div>\n\t\t),\n\t})\n}\n", "import { EngineChange } from \"document/EngineChanges.ts\"\nimport { countPagesWithVariants } from \"document/components/chrome/shared/UpsellModal/utils/countPagesWithVariants.ts\"\nimport { getProjectEditorCount } from \"document/components/chrome/shared/UpsellModal/utils/editorLimitUpsellModal.tsx\"\nimport { getLocalesCount } from \"document/components/chrome/shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { getWebPageNodeCountWithout404 } from \"document/components/chrome/shared/UpsellModal/utils/publishMultiPageSiteUpsell.ts\"\nimport { BYTES_PER_UNIT } from \"document/components/chrome/siteSettings/Usage/constants.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { getCollectionCount, getTotalCollectionItemCount } from \"utils/collectionUtils.ts\"\n\n/** Current resource counts for the project. */\n\nexport enum ResourceCountKeys {\n\tlocales = \"locales\",\n\tpages = \"pages\",\n\tcmsCollections = \"cmsCollections\",\n\tcmsItems = \"cmsItems\",\n\teditors = \"editors\",\n\tabTests = \"abTests\",\n\tbandwidthInGB = \"bandwidthInGB\",\n}\nexport interface ResourceCounts {\n\t[ResourceCountKeys.locales]: number\n\t[ResourceCountKeys.pages]: number\n\t[ResourceCountKeys.cmsCollections]: number\n\t[ResourceCountKeys.editors]: number\n\t[ResourceCountKeys.abTests]: number\n\t[ResourceCountKeys.bandwidthInGB]: {\n\t\tcurrentMonth: number\n\t\tpreviousMonth: number\n\t\ttwoMonthsAgo: number\n\t}\n\t[ResourceCountKeys.cmsItems]: number\n}\n\nexport function useResourceCounts(): ResourceCounts {\n\treturn useEngineState(\n\t\t() => ({\n\t\t\t[ResourceCountKeys.locales]: getLocalesCount(engine.tree, true),\n\t\t\t[ResourceCountKeys.cmsCollections]: getCollectionCount(engine.tree),\n\t\t\t[ResourceCountKeys.pages]: getWebPageNodeCountWithout404(engine.tree),\n\t\t\t[ResourceCountKeys.editors]: getProjectEditorCount(engine.stores.projectStore),\n\t\t\t[ResourceCountKeys.abTests]: countPagesWithVariants(engine.tree) ?? 0,\n\t\t\t[ResourceCountKeys.bandwidthInGB]: (() => {\n\t\t\t\tconst bandwidth = engine.stores.projectStore.usageData?.bandwidth\n\t\t\t\tif (!bandwidth) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpreviousMonth: 0,\n\t\t\t\t\t\ttwoMonthsAgo: 0,\n\t\t\t\t\t\tcurrentMonth: 0,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst previousMonth = bandwidth.previousMonth / BYTES_PER_UNIT.GB\n\t\t\t\tconst twoMonthsAgo = bandwidth.twoMonthsAgo / BYTES_PER_UNIT.GB\n\t\t\t\tconst currentMonth = bandwidth.currentMonth / BYTES_PER_UNIT.GB\n\n\t\t\t\treturn {\n\t\t\t\t\tpreviousMonth,\n\t\t\t\t\ttwoMonthsAgo,\n\t\t\t\t\tcurrentMonth,\n\t\t\t\t}\n\t\t\t})(),\n\t\t\t[ResourceCountKeys.cmsItems]: getTotalCollectionItemCount(engine.tree),\n\t\t}),\n\t\t[],\n\t\t[EngineChange.Tree, engine.stores.projectStore],\n\t\t{ deepEqual: true },\n\t)\n}\n", "import { ProjectLicensePeriod, ProjectLicenseType } from \"@framerjs/app-shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { formatPrice } from \"../../utils/formatPrice.ts\"\nimport type { LicenseSettings } from \"../api/licenseSettings.ts\"\n\ninterface FormattedPrice {\n\tprice: string\n\tperiod: string\n}\n\nexport function formatDisplayPrice(plan: LicenseSettings, selectedPeriod: ProjectLicensePeriod): FormattedPrice {\n\tswitch (plan.licenseType) {\n\t\tcase ProjectLicenseType.FreeSite:\n\t\t\treturn {\n\t\t\t\tprice: \"Free\",\n\t\t\t\tperiod: \"Free\",\n\t\t\t}\n\t\tcase ProjectLicenseType.MiniSite:\n\t\tcase ProjectLicenseType.BasicSite:\n\t\tcase ProjectLicenseType.ProSite:\n\t\tcase ProjectLicenseType.LaunchSite:\n\t\tcase ProjectLicenseType.ScaleSite:\n\t\tcase ProjectLicenseType.BasicSite2025:\n\t\tcase ProjectLicenseType.ProSite2025:\n\t\tcase ProjectLicenseType.ScaleSite2025:\n\t\t\treturn selectedPeriod === ProjectLicensePeriod.Month\n\t\t\t\t? {\n\t\t\t\t\t\tprice: formatPrice(parseFloat(plan.prices.month.amount), plan.prices[selectedPeriod].currency, true),\n\t\t\t\t\t\tperiod: \"Per month, billed monthly\",\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\tprice: formatPrice(parseFloat(plan.prices.year.amount) / 12, plan.prices[selectedPeriod].currency, true),\n\t\t\t\t\t\tperiod: \"Per month, billed yearly\",\n\t\t\t\t\t}\n\t\tcase ProjectLicenseType.EnterpriseSite:\n\t\t\treturn {\n\t\t\t\tprice: Dictionary.Custom,\n\t\t\t\tperiod: \"Yearly billing only\",\n\t\t\t}\n\t}\n}\n", "import type { ProjectSettingsResourceLimits } from \"@framerjs/app-config\"\nimport type { Project } from \"@framerjs/app-shared\"\n\nexport function getResourceLimits(project: Project | undefined): ProjectSettingsResourceLimits | null {\n\treturn project?.settings?.resourceLimits ?? null\n}\n", "import type { ProjectLicenseFeatureFlags, ProjectSettingsFeatureFlags } from \"@framerjs/app-config\"\n\nexport enum FeatureFlagKey {\n\tCustomProxySetup = \"customProxySetup\",\n\tAdvancedAnalytics = \"advancedAnalytics\",\n}\n\nexport function validateFeatureFlags(\n\tcurrentSettingsFeatureFlags: ProjectSettingsFeatureFlags,\n\tcurrentPlanDefaultFeatureFlags: ProjectLicenseFeatureFlags,\n\tlicenseFeatureFlags: ProjectLicenseFeatureFlags,\n): FeatureFlagKey | undefined {\n\tconst isUsingLegacyCustomProxy =\n\t\tcurrentSettingsFeatureFlags.canUseCustomCanonicalUrl === \"on\" &&\n\t\tcurrentPlanDefaultFeatureFlags.canUseCustomCanonicalUrl === \"off\"\n\tif (isUsingLegacyCustomProxy) {\n\t\treturn\n\t}\n\n\tif (\n\t\tcurrentSettingsFeatureFlags.canUseCustomCanonicalUrl === \"on\" &&\n\t\tlicenseFeatureFlags.canUseCustomCanonicalUrl === \"off\"\n\t) {\n\t\treturn FeatureFlagKey.CustomProxySetup\n\t}\n\n\tif (\n\t\tcurrentSettingsFeatureFlags.canUseAdvancedAnalytics === \"on\" &&\n\t\tlicenseFeatureFlags.canUseAdvancedAnalytics === \"off\"\n\t) {\n\t\treturn FeatureFlagKey.AdvancedAnalytics\n\t}\n}\n\nconst tooltipTexts: Record<FeatureFlagKey, string> = {\n\t[FeatureFlagKey.CustomProxySetup]: \"You are currently using Advanced Hosting.\",\n\t[FeatureFlagKey.AdvancedAnalytics]: \"You are currently using Advanced Analytics.\",\n}\n\nexport function getFeatureFlagTooltipText(featureFlagKey: FeatureFlagKey): string {\n\treturn tooltipTexts[featureFlagKey]\n}\n", "import { type ProjectLicensePeriod, ProjectLicenseType, type TeamLicenseType } from \"@framerjs/app-shared\"\nimport { useEffect, useState } from \"react\"\nimport type { LicenseSettings } from \"../api/licenseSettings.ts\"\nimport { LicensesSettingsStatus, getLicensesSettings } from \"../api/licenseSettings.ts\"\nimport { useIsBillingV3 } from \"../hooks/useIsBillingV3.ts\"\nimport { CheckoutSuccessOperation, PlansSuccess } from \"./PlansSuccess.tsx\"\n\nexport function RedirectFromStripeSuccess(props: {\n\tcurrentSitePlanType: ProjectLicenseType\n\tcurrentTeamPlanType: TeamLicenseType\n\tcurrency?: string\n\tcurrentSiteBillingPeriod: ProjectLicensePeriod | null\n\tteamCurrentEditors: number\n\tonReset: () => void\n}) {\n\tconst isBillingV3 = useIsBillingV3()\n\tconst [licensesSettings, setLicensesSettings] = useState<LicenseSettings[] | null | undefined>(undefined)\n\n\tuseEffect(() => {\n\t\tconst abortController = new AbortController()\n\t\tvoid (async () => {\n\t\t\ttry {\n\t\t\t\tconst licensesSettingsResponse = await getLicensesSettings(props.currency, abortController.signal, isBillingV3)\n\t\t\t\tif (licensesSettingsResponse.status === LicensesSettingsStatus.Success) {\n\t\t\t\t\tsetLicensesSettings(licensesSettingsResponse.licensesSettings)\n\t\t\t\t}\n\t\t\t} catch (_) {\n\t\t\t\tsetLicensesSettings(null)\n\t\t\t}\n\t\t})()\n\t}, [])\n\treturn licensesSettings !== undefined ? (\n\t\t<PlansSuccess\n\t\t\t{...props}\n\t\t\toperation={CheckoutSuccessOperation.PlanPurchase}\n\t\t\tlicensesSettings={licensesSettings}\n\t\t\tpreviousSitePlanType={ProjectLicenseType.FreeSite}\n\t\t/>\n\t) : null\n}\n", "import { ApiError, ProjectLicenseType, TeamLicenseType } from \"@framerjs/app-shared\"\nimport { assert, assertNever, getLogger } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { SitePlans } from \"document/stores/PaymentsStore.ts\"\nimport { SitePlansStatus } from \"document/stores/PaymentsStore.ts\"\nimport type { ProjectStore } from \"document/stores/ProjectStore.ts\"\nimport { useCallback, useEffect } from \"react\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport type { PollResponse } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { PollStatus } from \"web/pages/project/lib/api/pollProject.ts\"\nimport { useRemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport type { PollUpdateProps, SiteSubscriptionResponse } from \"./Stripe/api/subscriptions.ts\"\nimport { getSiteSubscription, pollSiteSubscription } from \"./Stripe/api/subscriptions.ts\"\nimport type { TeamSubscriptionData } from \"./Stripe/api/teamSubscription.ts\"\nimport { GetTeamSubscriptionStatus, getTeamSubscription, pollTeamSubscription } from \"./Stripe/api/teamSubscription.ts\"\nimport { getCheckoutItemParam, removeCheckoutParams } from \"./usePlanQueryParam.ts\"\n\nconst log = getLogger(\"useSitePlans\")\n\nfunction setState(state: SitePlans | ((prevState: SitePlans) => SitePlans)) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst { paymentsStore } = engine.stores\n\t\tif (typeof state === \"function\") {\n\t\t\tpaymentsStore.sitePlans = state(paymentsStore.sitePlans)\n\t\t} else {\n\t\t\tpaymentsStore.sitePlans = state\n\t\t}\n\t})\n}\n\n/**\n * Used to decide which payment provider to use and which plans page to show.\n */\nexport function useSitePlans(): [SitePlans, () => Promise<void>] {\n\tconst { paymentsStore, projectStore } = engine.stores\n\tconst state = paymentsStore.useState(({ sitePlans }) => sitePlans)\n\tconst remoteDispatch = useRemoteDispatch()\n\tconst projectInfo = projectStore.useState(getProjectInfo)\n\n\t// Reset the state and reload the subscriptions\n\tconst refreshSitePlans = useCallback(async () => {\n\t\tsetState({ status: SitePlansStatus.Loading })\n\n\t\tif (projectInfo.isLegacyDraftProject) {\n\t\t\treturn setState({ status: SitePlansStatus.DraftProjectError })\n\t\t}\n\n\t\tif (projectInfo.isEnterprisePlan) {\n\t\t\t// Show the new Enterprise Plans page\n\t\t\treturn setState({ status: SitePlansStatus.EnterprisePlan })\n\t\t}\n\n\t\tconst { projectId, teamId, currentTeamLicenseType, teamCurrentEditors } = projectInfo\n\t\tlet { currentProjectLicenseType } = projectInfo\n\n\t\tassert(\n\t\t\tcurrentProjectLicenseType !== ProjectLicenseType.EnterpriseSite &&\n\t\t\t\tcurrentTeamLicenseType !== TeamLicenseType.EnterprisePlan,\n\t\t\t\"Unexpected Enterprise plan\",\n\t\t)\n\n\t\t// This async action can be used to await the specified \"PollUpdateProps\" to get\n\t\t// applied in the current site and/or team subscription(s) within the same state\n\t\tasync function pollSubscriptionsUpdate({ site, team }: PollUpdateProps) {\n\t\t\tawait Promise.allSettled([\n\t\t\t\tsite && pollSiteSubscription(projectId, r => setState(setSiteSubscriptionResponse(r)), site),\n\t\t\t\t// This is only needed for backwards compatibility with the legacy Stripe flow\n\t\t\t\t// becase in the Stripe flow we don't sell team plans\n\t\t\t\tteam && pollTeamSubscription(teamId, r => setState(setTeamSubscriptionResponse(r)), team),\n\t\t\t])\n\t\t}\n\n\t\t// When polling for project license update we should also sync the license type in the state\n\t\tasync function pollProjectLicenseUpdate(projectLicenseType: ProjectLicenseType): Promise<PollResponse> {\n\t\t\tif (!remoteDispatch) return { status: PollStatus.UnhandledError }\n\t\t\tconst result = await remoteDispatch.pollProject({\n\t\t\t\tintervalMillis: 3000,\n\t\t\t\tattempts: 10,\n\t\t\t\tstopCondition: project => project.license.type === projectLicenseType,\n\t\t\t})\n\t\t\tif (result.status === PollStatus.Success) {\n\t\t\t\tsetState(\n\t\t\t\t\tsetLicenseTypesResponse({\n\t\t\t\t\t\tprojectLicenseType: result.project.license.type,\n\t\t\t\t\t\tteamLicenseType: result.project.teamLicenseType,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\n\t\t// Force refresh subscriptions without changing the checkout state\n\t\tasync function refreshSubscriptions() {\n\t\t\ttry {\n\t\t\t\tconst [team, site] = await Promise.all([getTeamSubscription(teamId), getSiteSubscription(projectId)])\n\t\t\t\tif (team.status === GetTeamSubscriptionStatus.Unauthorized) {\n\t\t\t\t\treturn setState({ status: SitePlansStatus.UnauthorizedError })\n\t\t\t\t}\n\t\t\t\tif (team.status !== GetTeamSubscriptionStatus.Success) {\n\t\t\t\t\treturn setState({ status: SitePlansStatus.FailedToFetchSubscriptionsError })\n\t\t\t\t}\n\t\t\t\tsetState(setTeamSubscriptionResponse(team))\n\t\t\t\tsetState(setSiteSubscriptionResponse(site))\n\t\t\t} catch (err: unknown) {\n\t\t\t\tif (err instanceof ApiError && err.status === 403) {\n\t\t\t\t\treturn setState({ status: SitePlansStatus.UnauthorizedError })\n\t\t\t\t}\n\t\t\t\treturn setState({ status: SitePlansStatus.FailedToFetchSubscriptionsError })\n\t\t\t}\n\t\t}\n\n\t\t// When loading the Plans settings directly after a redirection from\n\t\t// Stripe's checkout page, it should poll all purchased plans defined\n\t\t// in \"checkoutItems\" to make the upgrade immediately visible to user\n\t\t// from the success page, without need of refresh\n\t\tconst checkoutLicense = getCheckoutItemParam()\n\t\tif (checkoutLicense) {\n\t\t\tremoveCheckoutParams()\n\t\t\tconst pollResult = await pollProjectLicenseUpdate(checkoutLicense)\n\t\t\tswitch (pollResult.status) {\n\t\t\t\tcase PollStatus.Success:\n\t\t\t\t\tcurrentProjectLicenseType = checkoutLicense\n\t\t\t\t\tbreak\n\t\t\t\tcase PollStatus.UnhandledError:\n\t\t\t\tcase PollStatus.TimeoutError:\n\t\t\t\t\tlog.error(\"Failed to poll project license update when returning from Stripe checkout\", pollResult)\n\t\t\t\t\treturn setState({ status: SitePlansStatus.RedirectedFromStripePollingError })\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(pollResult)\n\t\t\t}\n\t\t}\n\n\t\ttry {\n\t\t\tconst [team, { currentSubscription: currentSiteSubscription, currentAddOns }] = await Promise.all([\n\t\t\t\tgetTeamSubscription(teamId),\n\t\t\t\tgetSiteSubscription(projectId),\n\t\t\t])\n\t\t\tif (team.status === GetTeamSubscriptionStatus.Unauthorized) {\n\t\t\t\treturn setState({ status: SitePlansStatus.UnauthorizedError })\n\t\t\t}\n\t\t\tif (team.status !== GetTeamSubscriptionStatus.Success) {\n\t\t\t\treturn setState({ status: SitePlansStatus.FailedToFetchSubscriptionsError })\n\t\t\t}\n\t\t\tconst { currentSubscription: currentTeamSubscription, teamHasPastDueSubscriptions } = team\n\n\t\t\tif (checkoutLicense && currentProjectLicenseType !== ProjectLicenseType.FreeSite) {\n\t\t\t\trecord(\"ui_impression\", { page: Pages.siteSettingsPlansSuccessFromRedirect })\n\t\t\t\treturn setState({\n\t\t\t\t\tstatus: SitePlansStatus.RedirectedFromStripe,\n\t\t\t\t\tcurrentProjectLicenseType,\n\t\t\t\t\tcurrentTeamLicenseType,\n\t\t\t\t\tbillingPeriod: currentSiteSubscription?.period || null,\n\t\t\t\t\tteamCurrentEditors,\n\t\t\t\t\tcurrentTeamSubscription,\n\t\t\t\t\tcurrentAddOns,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// It can happen that currentTeamSubscription will be `null` and the project/team licenses still having\n\t\t\t// subscribed plans:\n\t\t\t// This can be caused by the \"grace period\" after the cancellation of the last site plan in team, so\n\t\t\t// we need to artificially set the team license to free to allow user to run a fresh checkout flow.\n\t\t\tconst forceFreshCheckoutFlow = currentTeamSubscription === null\n\n\t\t\treturn setState({\n\t\t\t\tstatus: SitePlansStatus.Stripe,\n\t\t\t\tprojectId,\n\t\t\t\tteamId,\n\t\t\t\tcurrentTeamSubscription,\n\t\t\t\tcurrentSiteSubscription,\n\t\t\t\tcurrentProjectLicenseType: forceFreshCheckoutFlow ? ProjectLicenseType.FreeSite : currentProjectLicenseType,\n\t\t\t\tcurrentTeamLicenseType: forceFreshCheckoutFlow ? TeamLicenseType.FreePlan : currentTeamLicenseType,\n\t\t\t\tpollSubscriptionsUpdate,\n\t\t\t\tpollProjectLicenseUpdate,\n\t\t\t\trefreshSubscriptions,\n\t\t\t\tteamCurrentEditors,\n\t\t\t\tteamHasPastDueSubscriptions,\n\t\t\t\tcurrentAddOns,\n\t\t\t})\n\t\t} catch (err: unknown) {\n\t\t\tif (err instanceof ApiError && err.status === 403) {\n\t\t\t\treturn setState({ status: SitePlansStatus.UnauthorizedError })\n\t\t\t}\n\t\t\treturn setState({ status: SitePlansStatus.FailedToFetchSubscriptionsError })\n\t\t}\n\t}, [projectInfo, remoteDispatch])\n\n\t// Load site plans for the first time\n\t// We don't want to run this effect on every render,\n\t// because `refreshSitePlans` has too many dependencies\n\t// and it is easy for one of them to invalidate `refreshSitePlans`\n\t// We still want to refresh the plans when the experiment is toggled\n\t// biome-ignore lint/correctness/useExhaustiveDependencies:\n\tuseEffect(() => {\n\t\t// Don't refresh when the app is remounting\n\t\tif (engine.isRemountingUI()) return\n\n\t\tvoid refreshSitePlans()\n\t}, [])\n\n\treturn [state, refreshSitePlans]\n}\n\ntype ProjectInfo =\n\t| { isLegacyDraftProject: true }\n\t| {\n\t\t\tisLegacyDraftProject: false\n\t\t\tprojectId: string\n\t\t\tteamId: string\n\t\t\tcurrentProjectLicenseType: ProjectLicenseType\n\t\t\tcurrentTeamLicenseType: TeamLicenseType\n\t\t\tisEnterprisePlan: boolean\n\t\t\tteamCurrentEditors: number\n\t\t\tteamLicenseVersion: number | null\n\t  }\n\nfunction getProjectInfo({ project }: ProjectStore): ProjectInfo {\n\tassert(project, \"Project should exist\")\n\tif (project.space.scope === \"user\") return { isLegacyDraftProject: true }\n\treturn {\n\t\tisLegacyDraftProject: false,\n\t\tprojectId: project.id,\n\t\tteamId: project.space.ownerId,\n\t\tisEnterprisePlan:\n\t\t\tproject.license.type === ProjectLicenseType.EnterpriseSite ||\n\t\t\tproject.teamLicenseType === TeamLicenseType.EnterprisePlan,\n\t\tcurrentProjectLicenseType: project.license.type,\n\t\tcurrentTeamLicenseType: project.teamLicenseType,\n\t\tteamCurrentEditors: project.teamCurrentEditors,\n\t\tteamLicenseVersion: project.teamLicenseVersion,\n\t}\n}\n\n/** Update the siteSubscriptionResponse within the state */\nconst setSiteSubscriptionResponse =\n\t({ currentSubscription: currentSiteSubscription, currentAddOns }: SiteSubscriptionResponse) =>\n\t(sitePlans: SitePlans): SitePlans => {\n\t\tswitch (sitePlans.status) {\n\t\t\tcase SitePlansStatus.Stripe:\n\t\t\t\treturn { ...sitePlans, currentSiteSubscription, currentAddOns }\n\t\t\tdefault:\n\t\t\t\treturn sitePlans\n\t\t}\n\t}\n\n/** Update the teamSubscriptionResponse within the state */\nconst setTeamSubscriptionResponse =\n\t({ currentSubscription: currentTeamSubscription }: TeamSubscriptionData) =>\n\t(sitePlans: SitePlans): SitePlans => {\n\t\tswitch (sitePlans.status) {\n\t\t\tcase SitePlansStatus.Stripe:\n\t\t\t\treturn { ...sitePlans, currentTeamSubscription }\n\t\t\tdefault:\n\t\t\t\treturn sitePlans\n\t\t}\n\t}\n\n/** Update the license types within the state */\nconst setLicenseTypesResponse =\n\t({\n\t\tprojectLicenseType,\n\t\tteamLicenseType,\n\t}: {\n\t\tprojectLicenseType?: ProjectLicenseType\n\t\tteamLicenseType?: TeamLicenseType\n\t}) =>\n\t(sitePlans: SitePlans): SitePlans => {\n\t\tif (sitePlans.status !== SitePlansStatus.Stripe) return sitePlans\n\t\tconst currentTeamLicenseType =\n\t\t\tteamLicenseType && teamLicenseType !== TeamLicenseType.EnterprisePlan\n\t\t\t\t? teamLicenseType\n\t\t\t\t: sitePlans.currentTeamLicenseType\n\t\tconst currentProjectLicenseType =\n\t\t\tprojectLicenseType && projectLicenseType !== ProjectLicenseType.EnterpriseSite\n\t\t\t\t? projectLicenseType\n\t\t\t\t: sitePlans.currentProjectLicenseType\n\t\treturn {\n\t\t\t...sitePlans,\n\t\t\tcurrentTeamLicenseType,\n\t\t\tcurrentProjectLicenseType,\n\t\t}\n\t}\n", "import { ConfirmationModal, InputWrapper, Modal, TextInput } from \"@framerjs/fresco\"\nimport { isCommandKeyPressed, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useModalThemeOnActiveView } from \"document/components/chrome/utils/useModalTheme.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport * as styles from \"./APIKeyModals.styles.ts\"\n\ninterface CreateAPIKeyModalProps {\n\tonCancel: () => void\n\tonConfirm: (name: string) => Promise<void>\n}\n\nexport function CreateAPIKeyModal({ onCancel, onConfirm }: CreateAPIKeyModalProps) {\n\tconst [name, setName] = useState(\"\")\n\tconst [isCreating, setIsCreating] = useState(false)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"darker\")\n\n\tasync function handleCreate() {\n\t\tif (!name.trim()) return\n\t\tsetIsCreating(true)\n\t\ttry {\n\t\t\tawait onConfirm(name.trim())\n\t\t} finally {\n\t\t\tsetIsCreating(false)\n\t\t}\n\t}\n\n\tfunction handleKeyDown(event: React.KeyboardEvent) {\n\t\tif (event.key === \"Enter\" && name.trim().length > 0 && !isCreating) {\n\t\t\tevent.preventDefault()\n\t\t\tvoid handleCreate().catch(unhandledError)\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal.Root onDismiss={onCancel} onConfirm={handleCreate} hasBackdrop {...modalThemeProps}>\n\t\t\t<Modal.Header>Create API Key</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<InputWrapper large>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tvalue={name}\n\t\t\t\t\t\tonChange={setName}\n\t\t\t\t\t\tplaceholder=\"E.g. Production API Key\"\n\t\t\t\t\t\tenabled={!isCreating}\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t</InputWrapper>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer>\n\t\t\t\t<Modal.CancelButton enabled={!isCreating}>{Dictionary.Cancel}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton enabled={!isCreating && name.trim().length > 0}>{Dictionary.Create}</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\ninterface CopyAPIKeyModalProps {\n\ttoken: string\n\tonDone: () => void\n}\n\nexport function CopyAPIKeyModal({ token, onDone }: CopyAPIKeyModalProps) {\n\tconst [copied, setCopied] = useState(false)\n\tconst tokenRef = useRef<HTMLDivElement>(null)\n\n\tconst modalThemeProps = useModalThemeOnActiveView(\"default\")\n\n\tuseEffect(() => {\n\t\tif (tokenRef.current) {\n\t\t\tconst selection = window.getSelection()\n\t\t\tconst range = document.createRange()\n\t\t\trange.selectNodeContents(tokenRef.current)\n\t\t\tselection?.removeAllRanges()\n\t\t\tselection?.addRange(range)\n\t\t}\n\t}, [])\n\n\tconst handleCopy = useCallback(async () => {\n\t\ttry {\n\t\t\tawait copyText(token)\n\t\t\tsetCopied(true)\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\ticon: \"success\",\n\t\t\t\tkey: \"api-key-copy\",\n\t\t\t\tprimaryText: \"Copied API key\",\n\t\t\t\tsecondaryText: \"to clipboard.\",\n\t\t\t})\n\t\t} catch {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\ticon: \"error\",\n\t\t\t\tkey: \"api-key-copy\",\n\t\t\t\tprimaryText: \"Failed to copy\",\n\t\t\t\tsecondaryText: \"API key.\",\n\t\t\t})\n\t\t}\n\t}, [token])\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (isCommandKeyPressed(event) && event.key === \"c\") {\n\t\t\t\tvoid handleCopy()\n\t\t\t}\n\t\t}\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown)\n\t\treturn () => document.removeEventListener(\"keydown\", handleKeyDown)\n\t}, [handleCopy])\n\n\treturn (\n\t\t<Modal.Root visible onDismiss={onDone} className={styles.modal} hasBackdrop {...modalThemeProps}>\n\t\t\t<Modal.Header>Copy API Key</Modal.Header>\n\n\t\t\t<Modal.Content>\n\t\t\t\t<div ref={tokenRef} className={styles.tokenBox}>\n\t\t\t\t\t{token}\n\t\t\t\t</div>\n\n\t\t\t\t<Modal.Text>{`Copy and save this token in a secure place. You won\\u2019t be able to view it later.`}</Modal.Text>\n\t\t\t</Modal.Content>\n\n\t\t\t<Modal.Footer separator>\n\t\t\t\t<Modal.CancelButton>{Dictionary.Done}</Modal.CancelButton>\n\t\t\t\t<Modal.ActionButton onClick={handleCopy} autoFocus>\n\t\t\t\t\t{copied ? `\u2713 ${Dictionary.Copied}` : \"Copy Token\"}\n\t\t\t\t</Modal.ActionButton>\n\t\t\t</Modal.Footer>\n\t\t</Modal.Root>\n\t)\n}\n\ninterface RevokeAPIKeyModalProps {\n\tonCancel: () => void\n\tonConfirm: () => Promise<void>\n}\n\nexport function RevokeAPIKeyModal({ onCancel, onConfirm }: RevokeAPIKeyModalProps) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst [isRevoking, setIsRevoking] = useState(false)\n\n\tasync function handleRevoke() {\n\t\tsetIsRevoking(true)\n\t\ttry {\n\t\t\tawait onConfirm()\n\t\t} finally {\n\t\t\tsetIsRevoking(false)\n\t\t}\n\t}\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Revoke API Key\"\n\t\t\tvariant=\"destructive\"\n\t\t\tdescription=\"Are you sure you want to revoke this key? This action cannot be undone.\"\n\t\t\tcancelLabel={Dictionary.Cancel}\n\t\t\tonCancel={onCancel}\n\t\t\tconfirmLabel=\"Revoke\"\n\t\t\tconfirmButtonLoading={isRevoking}\n\t\t\tconfirmButtonEnabled={!isRevoking}\n\t\t\tcancelButtonEnabled={!isRevoking}\n\t\t\tonConfirm={handleRevoke}\n\t\t\tonDismiss={onCancel}\n\t\t\thasBackdrop\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import \"APIKeyModals.styles_2idnxg.wyw.css\"; export const modal = \"modal_m1dkahrz\";\nexport const title = \"title_t63jlix\";\nexport const label = \"label_lp8hgh\";\nexport const buttons = \"buttons_b11yxleq\";\nexport const tokenBox = \"tokenBox_tqn8ylo\";\nexport const description = \"description_dlwprqx\";", "import \"APIKeys.styles_1ql8um5.wyw.css\"; export const table = \"table_t1a8bdh6\";\nexport const headerRow = \"headerRow_h1kmysji\";\nexport const headerCellName = \"headerCellName_h60g12b\";\nexport const headerCellCreated = \"headerCellCreated_h1lzgwwp\";\nexport const headerCellDate = \"headerCellDate_h144w1d6\";\nexport const headerCell = \"headerCell_h185fsww\";\nexport const headerCellAction = \"headerCellAction_h1yy3blf\";\nexport const trashButton = \"trashButton_t1sbw9a5\";\nexport const name = \"name_n45lyb5\";\nexport const text = \"text_t1604zsr\";\nexport const dateText = \"dateText_dceot1a\";\nexport const row = \"row_rvsa4t1\";\nexport const cellName = \"cellName_c3mltul\";\nexport const cellDate = \"cellDate_ca5fdp9\";\nexport const cell = \"cell_cv57ll6\";\nexport const cellCreated = \"cellCreated_c109gm8o\";\nexport const cellCreatedContent = \"cellCreatedContent_c1jnpxtx\";\nexport const cellAction = \"cellAction_c13mvxha\";", "import { Button, IconDashboardArchive, Translatable as T } from \"@framerjs/fresco\"\nimport { format } from \"date-fns\"\nimport { formatFullDate } from \"web/lib/Project.ts\"\nimport { RelativeTime } from \"../../RelativeTime.tsx\"\nimport * as styles from \"./APIKeys.styles.ts\"\nimport type { APIKey } from \"./types.ts\"\n\ninterface Props {\n\tapiKey: APIKey\n\tonRevoke: () => void\n\tdisabled?: boolean\n}\n\nfunction formatDate(isoString: string): string {\n\treturn format(new Date(isoString), \"dd/MM/yyyy\")\n}\n\nexport function APIKeyRow({ apiKey, onRevoke, disabled }: Props) {\n\tconst createdText = `${formatFullDate(apiKey.createdAt)} by ${apiKey.createdBy.name}`\n\treturn (\n\t\t<tr className={styles.row}>\n\t\t\t<td className={styles.cellName}>\n\t\t\t\t<span className={styles.name} title={apiKey.name}>\n\t\t\t\t\t{apiKey.name}\n\t\t\t\t</span>\n\t\t\t</td>\n\t\t\t<td className={styles.cellCreated}>\n\t\t\t\t<div className={styles.cellCreatedContent}>\n\t\t\t\t\t<span className={styles.text} title={createdText}>\n\t\t\t\t\t\t<RelativeTime timestamp={apiKey.createdAt} /> <T>by</T> {apiKey.createdBy.name}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t\t<td className={styles.cellDate}>\n\t\t\t\t<span className={styles.dateText}>{apiKey.lastUsed ? formatDate(apiKey.lastUsed) : <T>Never</T>}</span>\n\t\t\t</td>\n\t\t\t<td className={styles.cell}>\n\t\t\t\t<span className={styles.dateText}>{formatDate(apiKey.expiresAt)}</span>\n\t\t\t</td>\n\t\t\t<td className={styles.cellAction}>\n\t\t\t\t<Button title=\"Revoke\" enabled={!disabled} variant=\"clean\" className={styles.trashButton} onClick={onRevoke}>\n\t\t\t\t\t<IconDashboardArchive />\n\t\t\t\t</Button>\n\t\t\t</td>\n\t\t</tr>\n\t)\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { APIKeyRow } from \"./APIKeyRow.tsx\"\nimport * as styles from \"./APIKeys.styles.ts\"\nimport type { APIKey } from \"./types.ts\"\n\ninterface Props {\n\tapiKeys: APIKey[]\n\tonRevoke: (key: { id: string; name: string }) => void\n\tdisabled?: boolean\n}\n\nexport function APIKeyTable({ apiKeys, onRevoke, disabled }: Props) {\n\treturn (\n\t\t<table className={styles.table}>\n\t\t\t<thead>\n\t\t\t\t<tr className={styles.headerRow}>\n\t\t\t\t\t<th className={styles.headerCellName}>\n\t\t\t\t\t\t<T>Name</T>\n\t\t\t\t\t</th>\n\t\t\t\t\t<th className={styles.headerCellCreated}>\n\t\t\t\t\t\t<T>{Dictionary.CreatedAt}</T>\n\t\t\t\t\t</th>\n\t\t\t\t\t<th className={styles.headerCellDate}>\n\t\t\t\t\t\t<T>Last Used</T>\n\t\t\t\t\t</th>\n\t\t\t\t\t<th className={styles.headerCell}>\n\t\t\t\t\t\t<T>Expires</T>\n\t\t\t\t\t</th>\n\t\t\t\t\t<th className={styles.headerCellAction} />\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t{apiKeys.map(apiKey => (\n\t\t\t\t\t<APIKeyRow\n\t\t\t\t\t\tkey={apiKey.id}\n\t\t\t\t\t\tapiKey={apiKey}\n\t\t\t\t\t\tonRevoke={() => onRevoke({ id: apiKey.id, name: apiKey.name })}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</tbody>\n\t\t</table>\n\t)\n}\n", "import { BetaBadge, Button, Link, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { serverApiUrl } from \"utils/staticURLs.ts\"\nimport * as siteSettingStyles from \"../../SiteSettings.styles.ts\"\nimport { CopyAPIKeyModal, CreateAPIKeyModal, RevokeAPIKeyModal } from \"./APIKeyModals.tsx\"\nimport { APIKeyTable } from \"./APIKeyTable.tsx\"\nimport { useAPIKeys } from \"./useAPIKeys.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n}\n\nexport function APIKeys({ isViewOnly }: Props) {\n\tconst projectId = engine.stores.projectStore.useState(state => state.project?.id)\n\tconst {\n\t\tapiKeys,\n\t\tloading,\n\t\tshowCreateModal,\n\t\tsetShowCreateModal,\n\t\tnewlyCreatedToken,\n\t\tsetNewlyCreatedToken,\n\t\tkeyToRevoke,\n\t\tsetKeyToRevoke,\n\t\thandleCreate,\n\t\thandleRevoke,\n\t} = useAPIKeys(projectId)\n\n\tif (!projectId) return null\n\n\treturn (\n\t\t<>\n\t\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={8}>\n\t\t\t\t\t<span className={siteSettingStyles.sectionTitle}>\n\t\t\t\t\t\t<T>API Keys</T>\n\t\t\t\t\t</span>\n\t\t\t\t\t<BetaBadge />\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack gap={15}>\n\t\t\t\t\t<Stack direction=\"row\" justifyContent=\"space-between\" alignItems=\"flex-start\" gap={15}>\n\t\t\t\t\t\t<span className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t\tAPI keys let you securely connect external tools or scripts to a specific Framer project. Create\n\t\t\t\t\t\t\t\tproject-scoped API keys to authenticate with the{\" \"}\n\t\t\t\t\t\t\t</T>\n\t\t\t\t\t\t\t<Link variant=\"linkLined\" href={serverApiUrl} rel=\"noopener noreferrer\">\n\t\t\t\t\t\t\t\t<T>Server API</T>\n\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t.\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tonClick={() => setShowCreateModal(true)}\n\t\t\t\t\t\t\tbold\n\t\t\t\t\t\t\tclassName={siteSettingStyles.noShrink}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<T>Add</T>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{!loading && apiKeys.length > 0 && (\n\t\t\t\t\t\t<APIKeyTable apiKeys={apiKeys} onRevoke={setKeyToRevoke} disabled={isViewOnly} />\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t{showCreateModal && <CreateAPIKeyModal onCancel={() => setShowCreateModal(false)} onConfirm={handleCreate} />}\n\n\t\t\t{newlyCreatedToken && <CopyAPIKeyModal token={newlyCreatedToken} onDone={() => setNewlyCreatedToken(null)} />}\n\n\t\t\t{keyToRevoke && <RevokeAPIKeyModal onCancel={() => setKeyToRevoke(null)} onConfirm={handleRevoke} />}\n\t\t</>\n\t)\n}\n", "import { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, Link, Stack, TextInput, Translatable as T } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { initialWebMetadata, validateTrackingId } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport React from \"react\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { WithWarningTintAndMessage } from \"../../shared/WithWarningTintAndMessage.tsx\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport { useMetadataUpdateHandler } from \"../useMetadataUpdateHandler.ts\"\nimport { updateWebMetadata } from \"./updateWebMetadata.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\twebMetadata: WebMetadata | undefined\n}\n\nconst page = Pages.siteSettingsGoogleAnalytics\n\nexport function GoogleAnalytics({ isViewOnly, webMetadata }: Props) {\n\tconst initialValues = React.useMemo<WebMetadata>(() => {\n\t\treturn {\n\t\t\tgoogleAnalyticsTrackingId: webMetadata?.googleAnalyticsTrackingId ?? initialWebMetadata.googleAnalyticsTrackingId,\n\t\t}\n\t}, [webMetadata])\n\n\tconst { siteSettingsStore } = engine.stores\n\n\tconst { hasMetadataChanges, metadataChanges } = siteSettingsStore.useState()\n\n\tconst currentTrackingId = metadataChanges.googleAnalyticsTrackingId ?? initialValues.googleAnalyticsTrackingId\n\n\tconst handleUpdateTrackingId = useMetadataUpdateHandler(engine, \"googleAnalyticsTrackingId\", initialValues)\n\n\tconst handleSave = React.useCallback(() => {\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.saveSiteGoogleAnalytics })\n\t\tconst metadataUpdate = siteSettingsStore.getMetadataUpdate()\n\t\tconst newMetadata = { ...webMetadata, ...metadataUpdate.metadata }\n\t\tif (newMetadata.googleAnalyticsTrackingId === \"\") newMetadata.googleAnalyticsTrackingId = undefined\n\t\tupdateWebMetadata(newMetadata)\n\t\tsiteSettingsStore.clearMetadataChanges()\n\t}, [webMetadata, siteSettingsStore])\n\n\tconst { hasWarning, warningMessage } = validateTrackingId(currentTrackingId)\n\n\treturn (\n\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t<Stack\n\t\t\t\tclassName={siteSettingStyles.sectionTitle}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t>\n\t\t\t\t<T>Google Analytics</T>\n\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t<Button enabled={!isViewOnly && hasMetadataChanges && !hasWarning} onClick={handleSave} bold>\n\t\t\t\t\t\t<T>Save</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</HandleClickOnClick>\n\t\t\t</Stack>\n\n\t\t\t<Stack gap={10} className={siteSettingStyles.limitedWidth}>\n\t\t\t\t<span className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tDirectly integrate Google Analytics into your Framer site. Please note that as a site owner you are\n\t\t\t\t\t\tresponsible for making sure that your site is handling data in a way that is in line with privacy laws such\n\t\t\t\t\t\tas the GDPR.\n\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t<Link variant=\"linkLined\" href=\"https://www.framer.com/r/google-analytics\" rel=\"noopener noreferrer\">\n\t\t\t\t\t\t<T>{Dictionary.LearnMore}</T>\n\t\t\t\t\t</Link>\n\t\t\t\t</span>\n\n\t\t\t\t<WithWarningTintAndMessage warningMessage={warningMessage}>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tid=\"googleAnalyticsTrackingId\"\n\t\t\t\t\t\tname=\"googleAnalyticsTrackingId\"\n\t\t\t\t\t\taria-label=\"Google Analytics tracking ID\"\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tvalue={currentTrackingId ?? \"\"}\n\t\t\t\t\t\tplaceholder=\"G-XXXXXXXXXX\"\n\t\t\t\t\t\tonChange={handleUpdateTrackingId}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tchangeOnBlur={false}\n\t\t\t\t\t/>\n\t\t\t\t</WithWarningTintAndMessage>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { assert } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport React from \"react\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { AppleTouchIconSection } from \"../SiteImages/AppleTouchIconSection.tsx\"\nimport { FaviconSection } from \"../SiteImages/FaviconSection.tsx\"\nimport { SocialImageSection } from \"../SiteImages/SocialImageSection.tsx\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\twebMetadata: WebMetadata | undefined\n}\n\nconst updateRootMetadata = engine.scheduler.wrapHandler((update: Partial<WebMetadata>) => {\n\tconst currentMetadata = engine.tree.root.webMetadata\n\tconst newMetadata: WebMetadata = { ...currentMetadata, ...update }\n\tengine.tree.root.set({ webMetadata: newMetadata })\n})\n\nexport function Images({ isViewOnly, webMetadata }: Props) {\n\tconst socialImage = webMetadata?.socialImage\n\tassert(!isVariableReference(socialImage), \"Social image variables aren't supported on the root node\")\n\tconst handleUpdateSocialImage = React.useCallback((newSocialImage: string | VariableReference | undefined) => {\n\t\tassert(!isVariableReference(newSocialImage), \"Social image variables aren't supported on the root node\")\n\n\t\tupdateRootMetadata({ socialImage: newSocialImage })\n\n\t\trecord(\"site_settings_change\", {\n\t\t\ttitle: false,\n\t\t\tdescription: false,\n\t\t\treducedMotion: false,\n\t\t\tlanguage: false,\n\t\t\tfavicon: false,\n\t\t\tsocialImage: true,\n\t\t\tappleTouchIcon: false,\n\t\t})\n\t}, [])\n\n\treturn (\n\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t<Stack className={siteSettingStyles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t<T>Site Images</T>\n\t\t\t</Stack>\n\n\t\t\t<Stack gap={30}>\n\t\t\t\t<FaviconSection enabled={!isViewOnly} webMetadata={webMetadata} updateRootMetadata={updateRootMetadata} />\n\t\t\t\t<Separator height={1} />\n\t\t\t\t<SocialImageSection\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tsocialImage={socialImage}\n\t\t\t\t\tonUpdateSocialImage={handleUpdateSocialImage}\n\t\t\t\t/>\n\t\t\t\t<Separator height={1} />\n\t\t\t\t<AppleTouchIconSection\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tappleTouchIcon={webMetadata?.appleTouchIcon}\n\t\t\t\t\tupdateRootMetadata={updateRootMetadata}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { appleTouchIconDefault } from \"export/exportToHTML.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport * as styles from \"./AppleTouchIconSection.styles.ts\"\nimport { ImagePreview } from \"./ImagePreview.tsx\"\nimport { ImageUploadInput } from \"./ImageUploadInput.tsx\"\nimport appleTouchIconPreview from \"./assets/apple-touch-icon-preview.png\"\nimport { useChangeSiteImage } from \"./useChangeSiteImage.tsx\"\n\nconst iconSize = styles.appleTouchIconSize\n\ninterface Props {\n\tenabled?: boolean\n\tappleTouchIcon: string | undefined\n\tupdateRootMetadata: (update: Partial<WebMetadata>) => void\n}\n\nexport const AppleTouchIconSection = React.memo(({ enabled, appleTouchIcon, updateRootMetadata }: Props) => {\n\tconst handleUpdateFavicon = React.useCallback(\n\t\t(newAppleTouchIcon: string | undefined) => {\n\t\t\tupdateRootMetadata({ appleTouchIcon: newAppleTouchIcon })\n\n\t\t\trecord(\"site_settings_change\", {\n\t\t\t\ttitle: false,\n\t\t\t\tdescription: false,\n\t\t\t\treducedMotion: false,\n\t\t\t\tlanguage: false,\n\t\t\t\tfavicon: false,\n\t\t\t\tsocialImage: false,\n\t\t\t\tappleTouchIcon: true,\n\t\t\t})\n\t\t},\n\t\t[updateRootMetadata],\n\t)\n\n\tconst allowedFileTypes = [\"png\"]\n\tconst { onUpload, onClear, pasteElementRef } = useChangeSiteImage(enabled, handleUpdateFavicon, allowedFileTypes)\n\n\tconst appleTouchIconWithFallback = appleTouchIcon ?? appleTouchIconDefault\n\n\treturn (\n\t\t<Stack gap={15} direction=\"row\" wrap=\"wrap\" alignItems=\"flex-start\">\n\t\t\t<ImageUploadInput label=\"Apple Touch Icon\" description=\"180 x 180 pixels\" enabled={enabled} onUpload={onUpload} />\n\n\t\t\t<ImagePreview\n\t\t\t\tref={pasteElementRef}\n\t\t\t\tsize=\"large\"\n\t\t\t\tname=\"apple-touch-icon\"\n\t\t\t\tsrc={appleTouchIconPreview}\n\t\t\t\tcanClear={!isUndefined(appleTouchIcon)}\n\t\t\t\tonUpload={onUpload}\n\t\t\t\tonClear={onClear}\n\t\t\t>\n\t\t\t\t<div className={styles.appleTouchIconContainer}>\n\t\t\t\t\t<svg\n\t\t\t\t\t\twidth={iconSize}\n\t\t\t\t\t\theight={iconSize}\n\t\t\t\t\t\tviewBox={`0 0 ${iconSize} ${iconSize}`}\n\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\taria-label=\"Apple Touch Icon preview\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<defs>\n\t\t\t\t\t\t\t<clipPath id=\"shape\">\n\t\t\t\t\t\t\t\t<path d=\"M42.6938 0C48.7115 0 50.8937 0.626573 53.0937 1.80315C55.2937 2.97972 57.0203 4.70629 58.1969 6.90629C59.3734 9.10629 60 11.2885 60 17.3062V42.6938C60 48.7115 59.3734 50.8937 58.1969 53.0937C57.0203 55.2937 55.2937 57.0203 53.0937 58.1969C50.8937 59.3734 48.7115 60 42.6938 60H17.3062C11.2885 60 9.10629 59.3734 6.90629 58.1969C4.70629 57.0203 2.97972 55.2937 1.80315 53.0937C0.626573 50.8937 0 48.7115 0 42.6938V17.3062C0 11.2885 0.626573 9.10629 1.80315 6.90629C2.97972 4.70629 4.70629 2.97972 6.90629 1.80315C9.10629 0.626573 11.2885 0 17.3062 0H42.6938Z\" />\n\t\t\t\t\t\t\t</clipPath>\n\t\t\t\t\t\t</defs>\n\n\t\t\t\t\t\t<image\n\t\t\t\t\t\t\twidth={iconSize}\n\t\t\t\t\t\t\theight={iconSize}\n\t\t\t\t\t\t\tclipPath=\"url(#shape)\"\n\t\t\t\t\t\t\txlinkHref={resolveImage(appleTouchIconWithFallback)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</svg>\n\t\t\t\t</div>\n\t\t\t</ImagePreview>\n\t\t</Stack>\n\t)\n})\n", "import \"AppleTouchIconSection.styles_zddwsr.wyw.css\"; export const appleTouchIconSize = 60;\nexport const appleTouchIconContainer = \"appleTouchIconContainer_a1gn3jjg\";", "import { Stack } from \"@framerjs/fresco\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { darkFaviconDefault, lightFaviconDefault } from \"export/exportToHTML.ts\"\nimport React from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport { ImageUploadRow } from \"./ImageUploadInput.tsx\"\nimport { UploadFavicon, faviconDescription } from \"./UploadFavicon.tsx\"\n\ninterface Props {\n\tenabled?: boolean\n\twebMetadata: WebMetadata | undefined\n\tupdateRootMetadata: (update: Partial<WebMetadata>) => void\n}\n\nexport const FaviconSection = React.memo(({ enabled, webMetadata, updateRootMetadata }: Props) => {\n\t// Force re-render when assets change\n\tuseDeprecatedEngineState([EngineChange.AssetMap], () => engine.stores.assetStore.assetMap.hash)\n\n\tconst favicon = {\n\t\tlight: webMetadata?.favicon,\n\t\tdark: webMetadata?.faviconDark,\n\t}\n\n\tconst faviconWithFallbackLight = favicon.light ?? favicon.dark ?? lightFaviconDefault\n\tconst faviconWithFallbackDark = favicon.dark ?? favicon.light ?? darkFaviconDefault\n\n\treturn (\n\t\t<Stack gap={15} direction=\"row\" wrap=\"wrap\" alignItems=\"flex-start\">\n\t\t\t<ImageUploadRow label=\"Favicon\" description={faviconDescription} />\n\n\t\t\t<Stack gap={15} direction=\"row\" wrap=\"wrap\" className={siteSettingsStyles.fullWidth}>\n\t\t\t\t<UploadFavicon\n\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\tfavicon={faviconWithFallbackLight}\n\t\t\t\t\tupdateRootMetadata={updateRootMetadata}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tcanClear={!isUndefined(favicon.light)}\n\t\t\t\t/>\n\n\t\t\t\t<UploadFavicon\n\t\t\t\t\ttheme=\"dark\"\n\t\t\t\t\tfavicon={faviconWithFallbackDark}\n\t\t\t\t\tupdateRootMetadata={updateRootMetadata}\n\t\t\t\t\tenabled={enabled}\n\t\t\t\t\tcanClear={!isUndefined(favicon.dark)}\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n})\n", "import { Stack } from \"@framerjs/fresco\"\nimport type { Theme } from \"@framerjs/fresco/src/components/types.ts\"\nimport { resolveImage } from \"document/components/utils/resolveImage.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { ImagePreview } from \"./ImagePreview.tsx\"\nimport { ImageUploadInput } from \"./ImageUploadInput.tsx\"\nimport * as styles from \"./UploadFavicon.styles.ts\"\nimport previewDark from \"./assets/favicon-preview-dark.png\"\nimport previewLight from \"./assets/favicon-preview-light.png\"\nimport { useChangeSiteImage } from \"./useChangeSiteImage.tsx\"\n\nexport const faviconDescription = \"64 x 64 pixels\"\n\ninterface Props {\n\ttheme: Theme\n\tfavicon: string\n\tupdateRootMetadata: (update: Partial<WebMetadata>) => void\n\tenabled?: boolean\n\tcanClear?: boolean\n}\n\nexport const UploadFavicon = React.memo(({ favicon, theme, updateRootMetadata, canClear, enabled = true }: Props) => {\n\tconst handleUpdateFavicon = React.useCallback(\n\t\t(newFavicon: string | undefined) => {\n\t\t\tconst faviconKey = theme === \"light\" ? \"favicon\" : \"faviconDark\"\n\t\t\tupdateRootMetadata({ [faviconKey]: newFavicon })\n\n\t\t\trecord(\"site_settings_change\", {\n\t\t\t\ttitle: false,\n\t\t\t\tdescription: false,\n\t\t\t\treducedMotion: false,\n\t\t\t\tlanguage: false,\n\t\t\t\tfavicon: true,\n\t\t\t\tsocialImage: false,\n\t\t\t\tappleTouchIcon: false,\n\t\t\t})\n\t\t},\n\t\t[theme, updateRootMetadata],\n\t)\n\n\tconst { onUpload, chooseImages, onClear, pasteElementRef } = useChangeSiteImage(enabled, handleUpdateFavicon)\n\n\treturn (\n\t\t<Stack gap={10}>\n\t\t\t<ImagePreview\n\t\t\t\tref={pasteElementRef}\n\t\t\t\tsize=\"small\"\n\t\t\t\tname={`favicon-${theme}`}\n\t\t\t\tsrc={themedPreview[theme]}\n\t\t\t\tcanClear={canClear}\n\t\t\t\tonUpload={chooseImages}\n\t\t\t\tonClear={onClear}\n\t\t\t>\n\t\t\t\t<div className={styles.faviconContainer}>\n\t\t\t\t\t<img\n\t\t\t\t\t\tsrc={resolveImage(favicon)}\n\t\t\t\t\t\talt={`Favicon ${theme}`}\n\t\t\t\t\t\tclassName={styles.favicon}\n\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\tdecoding=\"async\"\n\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ImagePreview>\n\n\t\t\t<ImageUploadInput.Layout label={themedLabel[theme]} direction=\"row\">\n\t\t\t\t<ImageUploadInput.UploadButton enabled={enabled} onUpload={onUpload} label={themedLabel[theme]} />\n\t\t\t</ImageUploadInput.Layout>\n\t\t</Stack>\n\t)\n})\n\nconst themedLabel = {\n\tlight: \"Light\",\n\tdark: \"Dark\",\n}\n\nconst themedPreview = {\n\tlight: previewLight,\n\tdark: previewDark,\n}\n", "import \"UploadFavicon.styles_lwoi1u.wyw.css\"; export const faviconContainer = \"faviconContainer_f1xwwe6p\";\nexport const favicon = \"favicon_f1r9500p\";", "import type { CustomHostname } from \"@framerjs/app-shared\"\nimport { openNewTab } from \"@framerjs/app-shared\"\nimport { HandleClickOnClick } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport { Button, Stack, T, Toggle, a11yStyles } from \"@framerjs/fresco\"\nimport { breakpoints } from \"@framerjs/fresco/tokens\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { getMetadataWarningMessages, initialWebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport type { PasswordPolicy } from \"document/stores/Password.ts\"\nimport type { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport pluralize from \"pluralize\"\nimport React from \"react\"\nimport { getNameForLocaleCode } from \"utils/getNameForLocaleCode.ts\"\nimport { pageMetadataArticleURL } from \"utils/staticURLs.ts\"\nimport { isNonNull } from \"utils/typeChecks.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { LocaleSelector } from \"../../shared/LocaleSelector.tsx\"\nimport type { LocaleCode } from \"../../shared/locales.ts\"\nimport { isLocaleCode } from \"../../shared/locales.ts\"\nimport { SearchResultPreview } from \"../SearchResultPreview.tsx\"\nimport * as settingInputStyles from \"../SettingInput.styles.ts\"\nimport { SettingInput } from \"../SettingInput.tsx\"\nimport { SettingTextArea } from \"../SettingTextArea.tsx\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport { descriptionPlaceholder, hostnamePlaceholder, siteTitlePlaceholder } from \"../metadataPlaceholders.ts\"\nimport { useMetadataUpdateHandler } from \"../useMetadataUpdateHandler.ts\"\nimport { saveSiteMetadata } from \"../utils/handleSaveSettings.ts\"\nimport { DangerZone } from \"./DangerZone.tsx\"\nimport { Password } from \"./Password.tsx\"\nimport * as styles from \"./Project.styles.ts\"\nimport { updatePartialWebMetadata } from \"./updateWebMetadata.ts\"\nimport { useMetadataModifiedPerRouteInfo } from \"./useMetadataPerRouteInfo.ts\"\n\nfunction toLocaleCode(value: string | undefined): LocaleCode | undefined {\n\treturn isLocaleCode(value) ? value : undefined\n}\n\ninterface Props {\n\tisViewOnly: boolean\n\twebMetadata: WebMetadata | undefined\n\tcustomHostname: CustomHostname | undefined\n\tpublishStatus: PublishStatus\n\tpasswordValue: string | undefined\n\tpasswordPolicy: PasswordPolicy\n}\n\nconst handleSave = () => saveSiteMetadata(engine)\n\nfunction showMetadataInfoToast({ primaryText, secondaryText }: MetaDataDescription) {\n\ttoast({\n\t\ttype: \"add\",\n\t\tkey: \"site-metadata-info\",\n\t\tvariant: \"info\",\n\t\tduration: 5000,\n\t\tshowCloseButton: \"never\",\n\t\tprimaryText,\n\t\tsecondaryText,\n\t\taction: {\n\t\t\ttitle: Dictionary.LearnMore,\n\t\t\tonClick: () => openNewTab(pageMetadataArticleURL),\n\t\t},\n\t})\n}\n\nexport function Site({ isViewOnly, webMetadata, customHostname, publishStatus, passwordValue, passwordPolicy }: Props) {\n\tconst initialValues = React.useMemo<WebMetadata>(() => {\n\t\treturn {\n\t\t\ttitle: webMetadata?.title ?? initialWebMetadata.title,\n\t\t\tdescription: webMetadata?.description ?? initialWebMetadata.description,\n\t\t\treducedMotion: webMetadata?.reducedMotion ?? initialWebMetadata.reducedMotion,\n\t\t\tlanguage: webMetadata?.language,\n\t\t\tlanguageTitle: webMetadata?.languageTitle,\n\t\t\tadaptLayoutToTextDirection:\n\t\t\t\twebMetadata?.adaptLayoutToTextDirection ?? initialWebMetadata.adaptLayoutToTextDirection,\n\t\t\tpreserveQueryParams: webMetadata?.preserveQueryParams,\n\t\t}\n\t}, [webMetadata])\n\n\tconst { siteSettingsStore } = engine.stores\n\n\tconst { hasMetadataChanges, metadataChanges } = siteSettingsStore.useState()\n\n\tconst currentTitle = metadataChanges.title ?? initialValues.title\n\tconst currentDescription = metadataChanges.description ?? initialValues.description\n\tconst currentReducedMotion = metadataChanges.reducedMotion ?? initialValues.reducedMotion\n\tconst currentLanguage = toLocaleCode(\n\t\tisNonNull(metadataChanges.language) ? metadataChanges.language : initialValues.language,\n\t)\n\tconst currentLanguageTitle = metadataChanges.languageTitle ?? initialValues.languageTitle\n\tconst currentAdaptLayoutToTextDirection =\n\t\tmetadataChanges.adaptLayoutToTextDirection ?? initialValues.adaptLayoutToTextDirection\n\tconst currentPreserveQueryParams = metadataChanges.preserveQueryParams ?? initialValues.preserveQueryParams\n\tconst currentAutomaticLocale = webMetadata?.automaticLocale ?? initialWebMetadata.automaticLocale\n\n\tconst handleUpdateTitle = useMetadataUpdateHandler(engine, \"title\", initialValues)\n\tconst handleUpdateLanguageTitle = useMetadataUpdateHandler(engine, \"languageTitle\", initialValues)\n\tconst handleUpdateAdaptLayoutToTextDirection = useMetadataUpdateHandler(\n\t\tengine,\n\t\t\"adaptLayoutToTextDirection\",\n\t\tinitialValues,\n\t)\n\tconst handleUpdateDescription = useMetadataUpdateHandler(engine, \"description\", initialValues)\n\tconst handleUpdateReducedMotion = useMetadataUpdateHandler(engine, \"reducedMotion\", initialValues)\n\tconst handleUpdateLanguage = useMetadataUpdateHandler(engine, \"language\", initialValues)\n\tconst handleUpdatePreserveQueryParams = useMetadataUpdateHandler(engine, \"preserveQueryParams\", initialValues)\n\n\tconst handleUpdateAutomaticLocale = React.useCallback(() => {\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage: Pages.siteSettingsAutomaticLocale,\n\t\t\tid: !currentAutomaticLocale ? UIInteraction.enableAutomaticLocale : UIInteraction.disableAutomaticLocale,\n\t\t})\n\t\tupdatePartialWebMetadata({ automaticLocale: !currentAutomaticLocale })\n\t}, [currentAutomaticLocale])\n\n\tconst hasLocales = useDeprecatedEngineState(EngineChange.Tree, () => {\n\t\tconst locales = engine.tree.root.locales\n\t\treturn Boolean(locales && locales.length > 0)\n\t})\n\n\tconst { hasWarnings, warningMessages } = getMetadataWarningMessages(engine.componentLoader, {\n\t\ttitle: currentTitle,\n\t\tdescription: currentDescription,\n\t})\n\n\tconst isSmallScreen = useMediaQuery(`(max-width: ${breakpoints.tabletMedium}px)`)\n\n\tconst titleDescription = useMetaDataDescription(\"title\")\n\tconst siteDescriptionDescription = useMetaDataDescription(\"description\")\n\n\tconst handleTitleFocus = React.useCallback(() => {\n\t\tif (titleDescription) showMetadataInfoToast(titleDescription)\n\t}, [titleDescription])\n\n\tconst handleDescriptionFocus = React.useCallback(() => {\n\t\tif (siteDescriptionDescription) showMetadataInfoToast(siteDescriptionDescription)\n\t}, [siteDescriptionDescription])\n\n\tconst titleDescriptionText = titleDescription\n\t\t? `${titleDescription.primaryText} ${titleDescription.secondaryText}`\n\t\t: undefined\n\tconst siteDescriptionDescriptionText = siteDescriptionDescription\n\t\t? `${siteDescriptionDescription.primaryText} ${siteDescriptionDescription.secondaryText}`\n\t\t: undefined\n\n\tconst siteTitleInput = (\n\t\t<SettingInput\n\t\t\tname=\"title\"\n\t\t\tlabel={Dictionary.Title}\n\t\t\tenabled={!isViewOnly}\n\t\t\tonChange={handleUpdateTitle}\n\t\t\tplaceholder={siteTitlePlaceholder}\n\t\t\tdefaultValue={currentTitle}\n\t\t\twarning={warningMessages.title}\n\t\t\tonFocus={handleTitleFocus}\n\t\t\taria-describedby={titleDescriptionText ? \"site-title-description\" : undefined}\n\t\t/>\n\t)\n\n\tconst localeSelector = (\n\t\t<SettingInput name=\"language\" label=\"Language\">\n\t\t\t<LocaleSelector\n\t\t\t\tid=\"language\"\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t\tvalue={currentLanguage ?? \"\"}\n\t\t\t\tonChange={handleUpdateLanguage}\n\t\t\t\tclearingEnabled={!hasLocales}\n\t\t\t\twithFlag={false}\n\t\t\t/>\n\t\t</SettingInput>\n\t)\n\n\tconst languageTitle = (\n\t\t<SettingInput\n\t\t\tname=\"languageTitle\"\n\t\t\tlabel=\"Language Name\"\n\t\t\tdefaultValue={currentLanguageTitle}\n\t\t\tonChange={handleUpdateLanguageTitle}\n\t\t\tenabled={!isViewOnly && Boolean(currentLanguage || currentLanguageTitle)}\n\t\t\tplaceholder={currentLanguage ? (getNameForLocaleCode(currentLanguage) ?? undefined) : undefined}\n\t\t/>\n\t)\n\n\treturn (\n\t\t<Stack gap={siteSettingStyles.sectionTitleGap}>\n\t\t\t<Stack\n\t\t\t\tclassName={siteSettingStyles.sectionTitle}\n\t\t\t\tdirection=\"row\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t>\n\t\t\t\t<T>Site Settings</T>\n\t\t\t\t<HandleClickOnClick>\n\t\t\t\t\t<Button enabled={!isViewOnly && hasMetadataChanges && !hasWarnings} onClick={handleSave} bold>\n\t\t\t\t\t\t<T>Save</T>\n\t\t\t\t\t</Button>\n\t\t\t\t</HandleClickOnClick>\n\t\t\t</Stack>\n\n\t\t\t{/* Site Settings stack */}\n\t\t\t<Stack gap={15}>\n\t\t\t\t{/* Title, Description, Locale etc. */}\n\t\t\t\t<Stack gap={30} paddingBottom={15}>\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={styles.section}\n\t\t\t\t\t\tdirection={isSmallScreen ? \"column\" : \"row\"}\n\t\t\t\t\t\tgap={isSmallScreen ? siteSettingStyles.columnGapSmallScreen : siteSettingStyles.columnGap}\n\t\t\t\t\t>\n\t\t\t\t\t\t{siteTitleInput}\n\t\t\t\t\t\t{titleDescriptionText && (\n\t\t\t\t\t\t\t<span id=\"site-title-description\" className={a11yStyles.screenReaderOnly}>\n\t\t\t\t\t\t\t\t{titleDescriptionText}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{!hasLocales && localeSelector}\n\t\t\t\t\t</Stack>\n\n\t\t\t\t\t{hasLocales && (\n\t\t\t\t\t\t<Stack\n\t\t\t\t\t\t\tclassName={styles.section}\n\t\t\t\t\t\t\tdirection={isSmallScreen ? \"column\" : \"row\"}\n\t\t\t\t\t\t\tgap={isSmallScreen ? siteSettingStyles.columnGapSmallScreen : siteSettingStyles.columnGap}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{localeSelector}\n\t\t\t\t\t\t\t{languageTitle}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName={styles.section}\n\t\t\t\t\t\tdirection={isSmallScreen ? \"column\" : \"row\"}\n\t\t\t\t\t\tgap={isSmallScreen ? siteSettingStyles.columnGapSmallScreen : siteSettingStyles.columnGap}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SettingTextArea\n\t\t\t\t\t\t\tname=\"description\"\n\t\t\t\t\t\t\tlabel=\"Description\"\n\t\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\t\tonChange={handleUpdateDescription}\n\t\t\t\t\t\t\tplaceholder={descriptionPlaceholder}\n\t\t\t\t\t\t\tdefaultValue={currentDescription}\n\t\t\t\t\t\t\twarning={warningMessages.description}\n\t\t\t\t\t\t\tonFocus={handleDescriptionFocus}\n\t\t\t\t\t\t\taria-describedby={siteDescriptionDescriptionText ? \"site-description-description\" : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{siteDescriptionDescriptionText && (\n\t\t\t\t\t\t\t<span id=\"site-description-description\" className={a11yStyles.screenReaderOnly}>\n\t\t\t\t\t\t\t\t{siteDescriptionDescriptionText}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<SettingInput name=\"preview\" label=\"Preview\">\n\t\t\t\t\t\t\t<SearchResultPreview\n\t\t\t\t\t\t\t\ttitle={currentTitle || siteTitlePlaceholder}\n\t\t\t\t\t\t\t\tdescription={currentDescription || descriptionPlaceholder}\n\t\t\t\t\t\t\t\thostname={customHostname?.hostname || hostnamePlaceholder}\n\t\t\t\t\t\t\t\thref={customHostname ? `https://${customHostname.hostname}` : undefined}\n\t\t\t\t\t\t\t\tfavicon={webMetadata?.favicon}\n\t\t\t\t\t\t\t\tfaviconDark={webMetadata?.faviconDark}\n\t\t\t\t\t\t\t\tcollectionData={null}\n\t\t\t\t\t\t\t\tselectedCollectionItemId={undefined}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SettingInput>\n\t\t\t\t\t</Stack>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t\t>\n\t\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t<label htmlFor=\"reduced-motion\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Accessibility</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<span id=\"reduced-motion-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Disable movement animations and custom cursors if the user prefers reduced motion.</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\tid=\"reduced-motion\"\n\t\t\t\t\t\tsmall\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tvalue={Boolean(currentReducedMotion)}\n\t\t\t\t\t\tonChange={checked => handleUpdateReducedMotion(checked)}\n\t\t\t\t\t\taria-describedby=\"reduced-motion-description\"\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t\t>\n\t\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t<label htmlFor=\"preserve-query-params\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Navigation</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<span id=\"preserve-query-params-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Preserve URL parameters when navigating between pages.</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\tid=\"preserve-query-params\"\n\t\t\t\t\t\tsmall\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tvalue={Boolean(currentPreserveQueryParams)}\n\t\t\t\t\t\tonChange={checked => handleUpdatePreserveQueryParams(checked)}\n\t\t\t\t\t\taria-describedby=\"preserve-query-params-description\"\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t\t>\n\t\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t<label htmlFor=\"layout-direction\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>{Dictionary.LayoutDirection}</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<span id=\"layout-direction-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Reverse layout direction for right-to-left languages (e.g. Arabic, Hebrew).</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\tid=\"layout-direction\"\n\t\t\t\t\t\tsmall\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tvalue={Boolean(currentAdaptLayoutToTextDirection)}\n\t\t\t\t\t\tonChange={checked => handleUpdateAdaptLayoutToTextDirection(checked)}\n\t\t\t\t\t\taria-describedby=\"layout-direction-description\"\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\t\talignItems=\"center\"\n\t\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t\t>\n\t\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t<label htmlFor=\"automatic-locale\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Automatic Locale</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<span id=\"automatic-locale-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t\t<T>Auto-redirect site visitors to their preferred locale based on their browser language settings.</T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<T>If a matching locale exists. Only active on optimized sites and on the custom domain if it is set.</T>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<Toggle\n\t\t\t\t\t\tid=\"automatic-locale\"\n\t\t\t\t\t\tsmall\n\t\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\t\tvalue={currentAutomaticLocale}\n\t\t\t\t\t\tonChange={handleUpdateAutomaticLocale}\n\t\t\t\t\t\taria-describedby=\"automatic-locale-description\"\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<Password\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tpasswordValue={passwordValue}\n\t\t\t\t\tpasswordPolicy={passwordPolicy}\n\t\t\t\t\tpublishStatus={publishStatus}\n\t\t\t\t/>\n\n\t\t\t\t<Separator height={1} />\n\n\t\t\t\t<DangerZone isViewOnly={isViewOnly} publishStatus={publishStatus} />\n\n\t\t\t\t<Separator height={1} />\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n\ninterface MetaDataDescription {\n\tprimaryText: string\n\tsecondaryText: string\n}\n\nfunction useMetaDataDescription(metaAttributeKey: \"title\" | \"description\"): MetaDataDescription | null {\n\tconst metadataModifiedPerRouteInfo = useMetadataModifiedPerRouteInfo()\n\tconst info = metadataModifiedPerRouteInfo?.[metaAttributeKey]\n\tconst firstModifiedPageName = info?.firstModifiedPageName\n\tconst extraPagesCount = info?.extraPagesCount ?? 0\n\n\treturn React.useMemo(() => {\n\t\tif (!firstModifiedPageName) return null\n\n\t\tconst pageCount = extraPagesCount + 1\n\t\treturn {\n\t\t\tprimaryText: `${pageCount} ${pluralize(\"page\", pageCount)}`,\n\t\t\tsecondaryText: `${pageCount === 1 ? \"has\" : \"have\"} a custom ${metaAttributeKey}`,\n\t\t}\n\t}, [firstModifiedPageName, extraPagesCount, metaAttributeKey])\n}\n", "import { Button, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport React from \"react\"\nimport * as settingInputStyles from \"../SettingInput.styles.ts\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport ConfirmUnpublishProjectModal from \"./ConfirmUnpublishProjectModal.tsx\"\nimport * as styles from \"./DangerZone.styles.ts\"\n\ninterface Props {\n\tpublishStatus: PublishStatus\n\tisViewOnly: boolean\n}\n\nexport function DangerZone({ publishStatus, isViewOnly }: Props) {\n\tconst [showUnpublishConfirmationModal, setShowUnpublishConfirmationModal] = React.useState(false)\n\n\tconst handleUnpublish = engine.scheduler.wrapHandler(async () => {\n\t\ttry {\n\t\t\tawait engine.stores.publishStore.unpublish()\n\t\t} finally {\n\t\t\tsetShowUnpublishConfirmationModal(false)\n\t\t}\n\t})\n\n\tconst handlePendingProjectUnpublish = engine.scheduler.wrapHandler(() => {\n\t\tsetShowUnpublishConfirmationModal(true)\n\t})\n\n\tfunction handleDismissUnpublishProjectModal() {\n\t\tsetShowUnpublishConfirmationModal(false)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Stack\n\t\t\t\tgap={0}\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t>\n\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t<T className={siteSettingStyles.settingTitle}>Danger Zone</T>\n\t\t\t\t\t<T id=\"danger-zone-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\tUnpublish your website from all domains.\n\t\t\t\t\t</T>\n\t\t\t\t</Stack>\n\t\t\t\t<Button\n\t\t\t\t\tenabled={publishStatus === PublishStatus.Published && !isViewOnly}\n\t\t\t\t\tvariant=\"destructiveSecondary\"\n\t\t\t\t\tonClick={handlePendingProjectUnpublish}\n\t\t\t\t\tclassName={styles.unpublishButton}\n\t\t\t\t\taria-describedby=\"danger-zone-description\"\n\t\t\t\t>\n\t\t\t\t\tUnpublish\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t\t{showUnpublishConfirmationModal && (\n\t\t\t\t<ConfirmUnpublishProjectModal\n\t\t\t\t\tonConfirm={handleUnpublish}\n\t\t\t\t\tonCancel={handleDismissUnpublishProjectModal}\n\t\t\t\t\tonDismiss={handleDismissUnpublishProjectModal}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n", "import { triggerUiImpressionEvent, triggerUiInteractionEvent } from \"@framerjs/framer-events\"\nimport { ConfirmationModal } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport React from \"react\"\nimport { Pages, UIInteraction } from \"web/lib/tracker.ts\"\n\ninterface Props {\n\tonCancel: () => void\n\tonConfirm: () => Promise<void>\n\tonDismiss: () => void\n}\n\nconst page = Pages.unpublishConfirmationModal\n\n// Default export is necessary for lazy loading\n// biome-ignore lint/style/noDefaultExport: needed here\nexport default function ConfirmUnpublishProjectModal({ onCancel, onConfirm, onDismiss }: Props) {\n\tconst [isUnpublishing, setIsUnpublishing] = React.useState(false)\n\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\n\tconst handleUnpublish = React.useCallback(async () => {\n\t\tsetIsUnpublishing(true)\n\t\ttriggerUiInteractionEvent({ page, id: UIInteraction.confirmUnpublish })\n\t\ttry {\n\t\t\tawait onConfirm()\n\t\t} catch (error) {\n\t\t\tsetIsUnpublishing(false)\n\t\t\tunhandledError(error)\n\t\t}\n\t}, [onConfirm])\n\n\tReact.useEffect(() => {\n\t\ttriggerUiImpressionEvent({ page })\n\t}, [])\n\n\tconst handleCancel = React.useCallback(() => {\n\t\tif (isUnpublishing) return\n\t\ttriggerUiInteractionEvent({ page, id: UIInteraction.cancelUnpublish })\n\t\tonCancel()\n\t}, [isUnpublishing, onCancel])\n\n\tconst handleDismiss = React.useCallback(() => {\n\t\tif (isUnpublishing) return\n\t\ttriggerUiInteractionEvent({ page, id: UIInteraction.cancelUnpublish })\n\t\tonDismiss()\n\t}, [isUnpublishing, onDismiss])\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Unpublish\"\n\t\t\tvariant=\"destructive\"\n\t\t\tdescription=\"Are you sure you want to unpublish this project? Visitors will no longer be able to access the URL.\"\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={handleCancel}\n\t\t\tconfirmLabel=\"Unpublish\"\n\t\t\tconfirmButtonLoading={isUnpublishing}\n\t\t\tconfirmButtonEnabled={!isUnpublishing}\n\t\t\tcancelButtonEnabled={!isUnpublishing}\n\t\t\tonConfirm={handleUnpublish}\n\t\t\tonDismiss={handleDismiss}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n", "import \"DangerZone.styles_npsc7n.wyw.css\"; export const unpublishButton = \"unpublishButton_u172o94z\";", "import {\n\tInputWrapper,\n\tInputWrapperError,\n\tStack,\n\tTranslatable as T,\n\tTextInput,\n\tToggle,\n\tUpgradeBadge,\n} from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { PasswordPolicy } from \"document/stores/Password.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { useCallback, useEffect, useState } from \"react\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useCurrentAndPrevious } from \"../../floatingToolbar/useCurrentAndPrevious.ts\"\nimport { showPasswordUpsellModal } from \"../../shared/UpsellModal/utils/siteSettingsUpsellModals.tsx\"\nimport * as settingInputStyles from \"../SettingInput.styles.ts\"\nimport * as siteSettingStyles from \"../SiteSettings.styles.ts\"\nimport * as styles from \"./Project.styles.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\tpasswordValue: string | undefined\n\tpasswordPolicy: PasswordPolicy\n\tpublishStatus: PublishStatus\n}\n\nconst page = Pages.siteSettingsPassword\n\nexport function Password({ isViewOnly, passwordValue, passwordPolicy, publishStatus }: Props) {\n\tconst [password, setPassword] = useState(passwordValue || \"\")\n\tconst [previousPublishStatus, currentPublishStatus] = useCurrentAndPrevious(publishStatus)\n\tconst [isEditing, setIsEditing] = useState(false)\n\tconst [hasError, setHasError] = useState(false)\n\tconst upsellPasswordProtection = engine.stores.projectStore.useState(\n\t\tstate => state.project?.settings.featureFlags.canUsePasswordProtection === \"upsell\",\n\t)\n\tconst formEnabled = !isViewOnly && publishStatus !== PublishStatus.Unpublished\n\tconst canSave = formEnabled && passwordPolicy === PasswordPolicy.Site\n\tconst passwordProtectionEnabled = passwordPolicy === PasswordPolicy.Site\n\tconst allowToggleOverPaywall = passwordProtectionEnabled && upsellPasswordProtection\n\n\tconst onUpsell = () => showPasswordUpsellModal(engine, \"settings\")\n\n\tfunction confirmDisableToggleOverPaywall() {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\tvariant: \"destructive\",\n\t\t\ttitle: `Remove Password`,\n\t\t\tdescription: \"Are you sure you want to remove this password? You will need to upgrade to re-enable it.\",\n\t\t\tconfirmLabel: \"Remove\",\n\t\t\tonConfirm: () => handlePasswordProtectionChange(false, true),\n\t\t\tsource: \"settings\",\n\t\t})\n\t}\n\n\tasync function handlePasswordProtectionChange(enabled: boolean, skipUpsell?: boolean) {\n\t\tsetIsEditing(false)\n\n\t\tif (upsellPasswordProtection && !skipUpsell) {\n\t\t\tif (allowToggleOverPaywall) {\n\t\t\t\tconfirmDisableToggleOverPaywall()\n\t\t\t} else {\n\t\t\t\tonUpsell()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tawait engine.stores.publishStore.updateProjectSettings({\n\t\t\tpasswordSettings: {\n\t\t\t\tpasswordPolicy: enabled ? PasswordPolicy.Site : PasswordPolicy.Off,\n\t\t\t\tpasswordValue: enabled ? passwordValue : undefined,\n\t\t\t},\n\t\t})\n\t\trecord(\"ui_interaction\", {\n\t\t\tpage,\n\t\t\tid: enabled ? UIInteraction.enableSitePasswordProtection : UIInteraction.disableSitePasswordProtection,\n\t\t})\n\t}\n\n\tuseEffect(() => {\n\t\tif (\n\t\t\tpasswordValue ||\n\t\t\t// On the off chance the site gets unpublished while setting a password,\n\t\t\t// reset it to the previous value.\n\t\t\t(previousPublishStatus === PublishStatus.Published && currentPublishStatus === PublishStatus.Unpublished)\n\t\t) {\n\t\t\tsetPassword(passwordValue || \"\")\n\t\t}\n\t}, [passwordValue, previousPublishStatus, currentPublishStatus])\n\n\tfunction handlePasswordChange(value: string) {\n\t\tsetPassword(value)\n\t\tsetHasError(false)\n\t}\n\n\tconst handlePasswordSave = useCallback(async () => {\n\t\tif (password.length < 8) {\n\t\t\tsetHasError(true)\n\t\t\treturn\n\t\t}\n\n\t\tconst key = \"password-save\"\n\n\t\trecord(\"ui_interaction\", { page, id: UIInteraction.saveSitePassword })\n\t\ttry {\n\t\t\tawait engine.stores.publishStore.updateProjectSettings({\n\t\t\t\tpasswordSettings: {\n\t\t\t\t\tpasswordPolicy,\n\t\t\t\t\tpasswordValue: password,\n\t\t\t\t},\n\t\t\t})\n\t\t\tsetIsEditing(false)\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\ticon: \"success\",\n\t\t\t\tkey,\n\t\t\t\tprimaryText: \"Successfully updated\",\n\t\t\t\tsecondaryText: \"password.\",\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tunhandledError(error)\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\ticon: \"error\",\n\t\t\t\tkey,\n\t\t\t\tprimaryText: \"Failed to update\",\n\t\t\t\tsecondaryText: \"password.\",\n\t\t\t})\n\t\t}\n\t}, [password, passwordPolicy])\n\n\tfunction enableEditing() {\n\t\tif (upsellPasswordProtection) {\n\t\t\tonUpsell()\n\t\t\treturn\n\t\t}\n\t\tsetIsEditing(true)\n\t}\n\n\treturn (\n\t\t<Stack gap={5}>\n\t\t\t<Stack\n\t\t\t\tdirection=\"row\"\n\t\t\t\tjustifyContent=\"space-between\"\n\t\t\t\talignItems=\"center\"\n\t\t\t\tclassName={settingInputStyles.toggleRow}\n\t\t\t>\n\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t<Stack gap={5} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t\t<label htmlFor=\"password-policy\" className={siteSettingStyles.settingTitle}>\n\t\t\t\t\t\t\t<T>Password Protect</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t{upsellPasswordProtection && <UpgradeBadge onClick={onUpsell} />}\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<span id=\"password-policy-description\" className={siteSettingStyles.settingDescriptionSecondary}>\n\t\t\t\t\t\t<T>Protect your site with a password. Changes will take effect immediately.</T>\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t\t<Toggle\n\t\t\t\t\tid=\"password-policy\"\n\t\t\t\t\tsmall\n\t\t\t\t\tenabled={!isViewOnly}\n\t\t\t\t\tvalue={passwordProtectionEnabled}\n\t\t\t\t\tonChange={handlePasswordProtectionChange}\n\t\t\t\t\taria-describedby=\"password-policy-description\"\n\t\t\t\t/>\n\t\t\t</Stack>\n\n\t\t\t{passwordProtectionEnabled && (\n\t\t\t\t<Stack gap={6} direction=\"column\" className={styles.passwordRow}>\n\t\t\t\t\t<InputWrapper large hasError={hasError} className={styles.passwordInputWrapper}>\n\t\t\t\t\t\t<TextInput\n\t\t\t\t\t\t\tid=\"password\"\n\t\t\t\t\t\t\taria-label=\"Site password\"\n\t\t\t\t\t\t\tenabled={formEnabled && passwordPolicy === PasswordPolicy.Site && isEditing}\n\t\t\t\t\t\t\tvalue={password}\n\t\t\t\t\t\t\tonChange={handlePasswordChange}\n\t\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tdisabled={isEditing ? !canSave || password.length === 0 : !canSave}\n\t\t\t\t\t\t\tclassName={styles.passwordInlineButton}\n\t\t\t\t\t\t\tonClick={isEditing ? handlePasswordSave : enableEditing}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className={siteSettingStyles.settingTitle}>{isEditing ? <T>Save</T> : <T>Edit</T>}</span>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</InputWrapper>\n\t\t\t\t\t<InputWrapperError visible={hasError}>Minimum 8 characters</InputWrapperError>\n\t\t\t\t</Stack>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import { useCallback, useEffect, useRef, useState } from \"react\"\n\n/** Ensure that current and previous are set on one render pass to prevent flickering. */\nexport function useCurrentAndPrevious<T>(value: T) {\n\tconst ref = useRef<T>()\n\tconst [currentAndPrevious, setCurrentAndPrevious] = useState<[T, T | undefined]>([value, undefined])\n\n\tuseEffect(() => {\n\t\tsetCurrentAndPrevious([value, ref.current])\n\t\tref.current = value\n\t}, [value])\n\n\tconst setPrevious = useCallback(\n\t\t(previous: T | undefined) => {\n\t\t\tconst [current] = currentAndPrevious\n\t\t\tsetCurrentAndPrevious([current, previous])\n\t\t},\n\t\t[currentAndPrevious],\n\t)\n\n\treturn [currentAndPrevious[0], currentAndPrevious[1], setPrevious] as const\n}\n", "import \"Project.styles_lq2y07.wyw.css\"; export const section = \"section_s16fpw0d\";\nexport const passwordRow = \"passwordRow_p1ior4t1\";\nexport const passwordInputWrapper = \"passwordInputWrapper_p1vxpdam\";\nexport const passwordInlineButton = \"passwordInlineButton_p1nyn2ww\";", "import { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { pathToName } from \"document/components/utils/pathToName.ts\"\nimport engine from \"document/engine.ts\"\nimport type { AnyWebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { useMemo } from \"react\"\n\n/**\n * This function is used to count the number of pages that have a title or description metadata modified in the metadata of the site.\n * It does gives us as well the first page that has a title or description modified. And, if the Home page has a title or description\n * modifies it always counts as the first modified page. The number of pages modified will be always (numberOfPages - 1) because firstModifiedPageName does not count\n * @param routes\n * @returns {Record<string, {firstModifiedPageName: string, extraPagesCount: number}>}\n */\nfunction getMetadataModifiedPerRouteInfo(webPageNodes: AnyWebPageNode[]) {\n\tconst result = webPageNodes.reduce(\n\t\t(countObject, route) => {\n\t\t\tconst webPageWithPath = getWebPagePath(engine.tree, route)\n\t\t\t// Always use segment as the name, because contextually is more clear as user see slugs in the sidebar\n\t\t\tconst name = pathToName(webPageWithPath ?? \"\")\n\t\t\tconst { title, description } = countObject\n\t\t\tconst { webMetadata } = route\n\t\t\tconst currentTitleCount = title.extraPagesCount\n\t\t\tconst currentDescriptionCount = description.extraPagesCount\n\t\t\tconst shouldPlusOneTitleCount = Boolean(title.firstModifiedPageName && webMetadata?.title)\n\t\t\tconst shouldAddTitleName =\n\t\t\t\twebMetadata?.title && (!title?.firstModifiedPageName || route.id === engine.tree.root.homePageNodeId)\n\t\t\tconst shouldPlusOneDescriptionCount = Boolean(description.firstModifiedPageName && webMetadata?.description)\n\t\t\tconst shouldAddDescriptionName =\n\t\t\t\twebMetadata?.description && (!description.firstModifiedPageName || route.id === engine.tree.root.homePageNodeId)\n\n\t\t\treturn {\n\t\t\t\t// biome-ignore lint/performance/noAccumulatingSpread: existing code, plus the object is small and small objects are not a performance bottleneck\n\t\t\t\t...countObject,\n\t\t\t\ttitle: {\n\t\t\t\t\tfirstModifiedPageName: shouldAddTitleName ? name : title.firstModifiedPageName,\n\t\t\t\t\textraPagesCount: shouldPlusOneTitleCount ? currentTitleCount + 1 : currentTitleCount,\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\tfirstModifiedPageName: shouldAddDescriptionName ? name : description.firstModifiedPageName,\n\t\t\t\t\textraPagesCount: shouldPlusOneDescriptionCount ? currentDescriptionCount + 1 : currentDescriptionCount,\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\ttitle: {\n\t\t\t\tfirstModifiedPageName: null,\n\t\t\t\textraPagesCount: 0,\n\t\t\t},\n\t\t\tdescription: {\n\t\t\t\tfirstModifiedPageName: null,\n\t\t\t\textraPagesCount: 0,\n\t\t\t},\n\t\t},\n\t)\n\n\treturn result\n}\n\nexport function useMetadataModifiedPerRouteInfo() {\n\tconst webPageNodes = engine.stores.scopeStore.getWebPageNodes()\n\treturn useMemo(() => getMetadataModifiedPerRouteInfo(webPageNodes), [webPageNodes])\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport { APIKeys } from \"./APIKeys/APIKeys.tsx\"\nimport { GoogleAnalytics } from \"./GoogleAnalytics.tsx\"\nimport { Images } from \"./Images.tsx\"\nimport { Site } from \"./Site.tsx\"\n\nexport function ProjectSettings() {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst isApiKeysEnabled = useExperimentIsOn(\"apiKeys\")\n\n\tconst { customHostname, passwordPolicy, passwordValue, publishStatus } = engine.stores.publishStore.useState(\n\t\tstate => ({\n\t\t\tcustomHostname: state.customHostname,\n\t\t\tpasswordPolicy: state.passwordPolicy,\n\t\t\tpasswordValue: state.passwordValue,\n\t\t\tpublishStatus: state.publishStatus,\n\t\t}),\n\t)\n\n\tconst { webMetadata: rootWebMetadata } = useEngineState(() => engine.tree.root, [], [EngineChange.Tree])\n\n\treturn (\n\t\t<Stack gap={30} className={siteSettingsStyles.wideContainer}>\n\t\t\t<Site\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\twebMetadata={rootWebMetadata}\n\t\t\t\tcustomHostname={customHostname}\n\t\t\t\tpublishStatus={publishStatus}\n\t\t\t\tpasswordValue={passwordValue}\n\t\t\t\tpasswordPolicy={passwordPolicy}\n\t\t\t/>\n\t\t\t<Images isViewOnly={isViewOnly} webMetadata={rootWebMetadata} />\n\t\t\t<Separator height={1} />\n\t\t\t<GoogleAnalytics isViewOnly={isViewOnly} webMetadata={rootWebMetadata} />\n\t\t\t<Separator height={1} />\n\t\t\t{isApiKeysEnabled && <APIKeys isViewOnly={isViewOnly} />}\n\t\t</Stack>\n\t)\n}\n", "import { Stack } from \"@framerjs/fresco\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getReadableWebPageLinkPaths } from \"document/components/utils/getReadableWebPageLinkPaths.ts\"\nimport engine from \"document/engine.ts\"\nimport type { RedirectRouteNode } from \"document/models/CanvasTree/nodes/RedirectRouteNode.ts\"\nimport type { WebPageLinkWithLocaleInfo } from \"document/models/CanvasTree/nodes/utils/redirectRouteNode.ts\"\nimport { getWebPageLinksWithLocaleInfo } from \"document/models/CanvasTree/nodes/utils/redirectRouteNode.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useLoadRoutesNode } from \"../../utils/useLoadScope.ts\"\nimport { CreateRedirect } from \"./CreateRedirect.tsx\"\nimport { RedirectsList } from \"./RedirectsList.tsx\"\n\nfunction useWebPageLinksWithLocaleInfo(\n\tredirects: readonly RedirectRouteNode[],\n\tlocales: readonly Locale[] | undefined,\n): WebPageLinkWithLocaleInfo {\n\treturn useMemo(() => getWebPageLinksWithLocaleInfo(redirects, locales), [redirects, locales])\n}\n\nconst emptyRedirects: RedirectRouteNode[] = []\n\nexport function Redirects() {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst upsell = engine.stores.projectStore.project?.settings.featureFlags.canUseRedirects !== \"on\"\n\n\tconst tree = useDeprecatedEngineState(EngineChange.Tree, () => engine.tree)\n\n\tconst { loadedRoutesNode, isLoadingRoutesNode } = useLoadRoutesNode()\n\tconst redirects = useMemo(() => loadedRoutesNode?.getRedirects() || emptyRedirects, [loadedRoutesNode])\n\n\tconst { linksWithLocale, linkWithLocaleByRedirect } = useWebPageLinksWithLocaleInfo(redirects, tree.root.locales)\n\n\tconst readableWebPageLinkPaths = getReadableWebPageLinkPaths(tree, linksWithLocale)\n\n\tconst getReadableWebPageLinkPathForRedirect = useCallback(\n\t\t(redirect: RedirectRouteNode) => {\n\t\t\tconst linkWithLocale = linkWithLocaleByRedirect.get(redirect)\n\t\t\tif (!linkWithLocale) return null\n\t\t\treturn readableWebPageLinkPaths.get(linkWithLocale) ?? null\n\t\t},\n\t\t[linkWithLocaleByRedirect, readableWebPageLinkPaths],\n\t)\n\n\treturn (\n\t\t<Stack gap={30} paddingBottom={60}>\n\t\t\t<CreateRedirect isViewOnly={isViewOnly} redirects={redirects} upsell={upsell} />\n\n\t\t\t<RedirectsList\n\t\t\t\tupsell={upsell}\n\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\tredirects={redirects}\n\t\t\t\tisLoading={isLoadingRoutesNode}\n\t\t\t\tgetReadableWebPageLinkPathForRedirect={getReadableWebPageLinkPathForRedirect}\n\t\t\t/>\n\t\t</Stack>\n\t)\n}\n", "import { IconArrowRight, Link, Stack, Translatable as T, UpgradeBadge } from \"@framerjs/fresco\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { ensureRedirectLimits } from \"document/components/chrome/siteSettings/Redirects/ensureRedirectLimits.ts\"\nimport engine from \"document/engine.ts\"\nimport type { RedirectRouteNode } from \"document/models/CanvasTree/nodes/RedirectRouteNode.ts\"\nimport { addRedirect } from \"document/models/CanvasTree/nodes/utils/routesNode.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport React from \"react\"\nimport { redirectsSupportArticleURL } from \"utils/staticURLs.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { showRedirectsUpsellModal } from \"../../shared/UpsellModal/utils/siteSettingsUpsellModals.tsx\"\nimport { handleLimitError } from \"../../shared/utils/limitError.ts\"\nimport { SettingSection } from \"../SettingSection.tsx\"\nimport * as styles from \"./CreateRedirect.styles.ts\"\nimport { useRedirectForm } from \"./useRedirectForm.tsx\"\n\nconst addRedirectHandler = engine.scheduler.wrapHandler(\n\t(path: string, to: string | LinkToWebPage, allPaths: string[]) => {\n\t\thandleLimitError(() => {\n\t\t\tconst redirectNode = addRedirect(engine.stores.treeStore, path, to, () => ensureRedirectLimits(engine, \"add\"))\n\t\t\tif (!redirectNode) return\n\n\t\t\tconst blockedPages = getPagesPreventedFromVisiting(redirectNode, allPaths)\n\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tkey: \"add-redirect\",\n\t\t\t\tvariant: \"success\",\n\t\t\t\tprimaryText: \"Successfully added\",\n\t\t\t\tsecondaryText: \"custom redirect.\",\n\t\t\t})\n\n\t\t\tif (blockedPages.length > 1) {\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"warning\",\n\t\t\t\t\tkey: \"prevent-pages-visit\",\n\t\t\t\t\ttext: `The ${redirectNode.path} redirect prevents ${blockedPages.length} pages from being visited.`,\n\t\t\t\t\tduration: 10000,\n\t\t\t\t\ticon: \"warning\",\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n)\n\ninterface Props {\n\tisViewOnly: boolean\n\tredirects: readonly RedirectRouteNode[]\n\tupsell: boolean\n}\n\nexport function CreateRedirect({ isViewOnly, redirects, upsell }: Props) {\n\tconst { fromInput, fromErrorMessage, toInput, toErrorMessage, saveButton } = useRedirectForm({\n\t\tisViewOnly,\n\t\tonSave: addRedirectHandler,\n\t\tredirects,\n\t\tupsell,\n\t})\n\n\tconst onUpsell = React.useCallback(() => showRedirectsUpsellModal(engine, \"settings\"), [])\n\n\treturn (\n\t\t<SettingSection\n\t\t\ttitle=\"Create Redirect\"\n\t\t\ttitleBadge={upsell ? <UpgradeBadge onClick={onUpsell} /> : undefined}\n\t\t\tdescription={\n\t\t\t\t<div>\n\t\t\t\t\t<T>Redirect existing URLs to new ones to maintain search engine ranking.</T>{\" \"}\n\t\t\t\t\t<Link href={redirectsSupportArticleURL}>{Dictionary.LearnMore}</Link>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\taction={null}\n\t\t\tdivider\n\t\t>\n\t\t\t<div className={styles.grid}>\n\t\t\t\t<T className={styles.fromLabel}>Old URL</T>\n\t\t\t\t<div className={styles.fromInput}>\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t{fromInput}\n\t\t\t\t\t\t{fromErrorMessage}\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.arrow}>\n\t\t\t\t\t<IconArrowRight />\n\t\t\t\t</div>\n\n\t\t\t\t<T className={styles.toLabel}>New URL</T>\n\t\t\t\t<div className={styles.toInput}>\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t{toInput}\n\t\t\t\t\t\t{toErrorMessage}\n\t\t\t\t\t</Stack>\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.saveButton}>{saveButton}</div>\n\t\t\t</div>\n\t\t</SettingSection>\n\t)\n}\n\n// get all pages that get prevented from being visited by the redirect\nexport function getPagesPreventedFromVisiting(redirect: RedirectRouteNode, allPaths: string[]) {\n\tif (!redirect.path) return []\n\tconst regex = constructPathRegex(redirect.path)\n\tconst blockedPages: string[] = []\n\n\tfor (const path of allPaths) {\n\t\tif (!path.match(regex)) continue\n\t\tblockedPages.push(path)\n\t}\n\treturn blockedPages\n}\n\n// Turn `/blog/:date/:slug` into a regexp: `^\\/blog\\/([^\\/]+)\\/([^\\/]+)$`\nexport function constructPathRegex(path: string) {\n\tconst safePattern = path.replaceAll(/[.*+?^${}()|[/\\]\\\\]/gu, \"\\\\$&\") // escape all special characters\n\tlet regExpString = `^${safePattern}$`\n\tregExpString = regExpString.replaceAll(/:\\w+/gu, \"([^\\\\/]+)\") // replace all :slugs with a capture group\n\tregExpString = regExpString.replaceAll(/\\\\\\*/gu, \"(.*)\") // replace all wildcards with a capture group\n\treturn new RegExp(regExpString)\n}\n", "import \"CreateRedirect.styles_mp79gs.wyw.css\"; export const grid = \"grid_g16nf2po\";\nexport const fromLabel = \"fromLabel_f1xpm9ad\";\nexport const toLabel = \"toLabel_txz06wq\";\nexport const fromInput = \"fromInput_f18lslca\";\nexport const toInput = \"toInput_tecpx8e\";\nexport const arrow = \"arrow_auyqgt3\";\nexport const saveButton = \"saveButton_s1kro44r\";", "import { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { ComboBoxListItem, ComboBoxListItemOption } from \"@framerjs/fresco\"\nimport { Button, ComboBox, ContextMenuButton, IconCancel, IconCheckmark, Translatable as T } from \"@framerjs/fresco\"\nimport { isComboBoxListItemSection } from \"@framerjs/fresco/src/components/utils/useComboBox\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { getWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport engine from \"document/engine.ts\"\nimport type { RedirectRouteNode } from \"document/models/CanvasTree/nodes/RedirectRouteNode.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { getLink, isLinkToURL, isLinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { newRedirect } from \"document/stores/SiteSettingsStore.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport React from \"react\"\nimport { getItemToSlug } from \"utils/collectionSlugUtils.ts\"\nimport {\n\tescapeParenthesesInPath,\n\tgetPathForDisplay,\n\tvalidateRouteNodePath,\n\tvalidateRouteNodePathUniqueness,\n} from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { LinkInput } from \"../../shared/LinkInput.tsx\"\nimport { showRedirectsUpsellModal } from \"../../shared/UpsellModal/utils/siteSettingsUpsellModals.tsx\"\nimport { getNonDefaultLocaleIdForPath } from \"./getNonDefaultLocaleForPath.ts\"\nimport * as styles from \"./useRedirectForm.styles.ts\"\nimport { validateRedirectTo } from \"./validateRedirects.ts\"\n\ninterface Props {\n\tisViewOnly: boolean\n\tonCancel?: () => void\n\tonSave: (from: string, to: string | LinkToWebPage, allPaths: string[]) => void\n\t/**\n\t * Redirect being edited.\n\t *\n\t * Leave unset if the form is for adding a new redirect.\n\t */\n\tredirect?: RedirectRouteNode\n\tredirects: readonly RedirectRouteNode[]\n\tupsell: boolean\n}\n\nexport function useRedirectForm({ isViewOnly, onCancel, onSave, redirect, redirects, upsell }: Props) {\n\tconst draftKey = redirect?.id || newRedirect\n\tconst { siteSettingsStore } = engine.stores\n\tconst draft = siteSettingsStore.useState(state => state.redirectsChanges[draftKey])\n\n\tconst from = draft?.from ?? redirect?.path ?? \"\"\n\tconst to = draft?.to ?? redirect?.to ?? \"\"\n\n\t// From locale id will be undefined if the from path doesn't match a locale slug, which is\n\t// important because in that case we want to show all options, including the ones hidden in the\n\t// default locale.\n\tconst fromLocaleId = useDeprecatedEngineState(\n\t\tEngineChange.Tree,\n\t\t() => getNonDefaultLocaleIdForPath(from, engine.tree.root.locales),\n\t\t[from],\n\t)\n\tconst tree = useEngineState(() => engine.tree, [], EngineChange.Tree)\n\n\tconst fromValidationResult = validateRouteNodePath(\"redirect\", from)\n\tconst fromUniquenessValidationResult = validateRouteNodePathUniqueness(\"redirect\", from, redirects, redirect?.id)\n\tconst toValidationResult = validateRedirectTo(\n\t\ttree,\n\t\tto,\n\t\tfromValidationResult.result === \"ok\" ? fromValidationResult.normalizedValue : undefined,\n\t)\n\n\tconst urlSuggestions = React.useMemo(() => {\n\t\tconst pagesItems: ComboBoxListItemOption[] = []\n\t\tconst cmsItems: ComboBoxListItemOption[] = []\n\n\t\tconst webPageNodes = engine.stores.scopeStore.getWebPageNodes()\n\n\t\tfor (const webPageNode of webPageNodes) {\n\t\t\tif (webPageNode.abTestingParentId) continue // skip A/B testing variants\n\t\t\tif (!webPageNode.dataIdentifier) {\n\t\t\t\tconst path = getWebPagePath(tree, webPageNode)\n\t\t\t\tif (!path) continue\n\t\t\t\tpagesItems.push({ type: \"option\", value: path })\n\t\t\t} else {\n\t\t\t\tconst dataDefinition = engine.componentLoader.dataForIdentifier(webPageNode.dataIdentifier)\n\t\t\t\tconst slugKey = dataDefinition?.annotations?.[AnnotationKey.FramerSlug]\n\t\t\t\tif (!slugKey) continue\n\n\t\t\t\tconst itemToSlug = getItemToSlug(tree, engine.componentLoader, webPageNode.dataIdentifier)\n\t\t\t\tif (!itemToSlug) continue\n\n\t\t\t\tfor (const [id, slug] of Object.entries(itemToSlug)) {\n\t\t\t\t\tconst pathVariables = { id, [slugKey]: slug }\n\t\t\t\t\tconst path = getWebPagePath(tree, webPageNode, defaultLocaleId, pathVariables)\n\n\t\t\t\t\tif (!path) continue\n\n\t\t\t\t\tcmsItems.push({ type: \"option\", value: path })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst items: ComboBoxListItem[] = []\n\t\tif (pagesItems.length > 0) {\n\t\t\titems.push({ type: \"section\", value: Dictionary.Pages, items: pagesItems })\n\t\t}\n\t\tif (cmsItems.length > 0) {\n\t\t\titems.push({ type: \"section\", value: Dictionary.Cms, items: cmsItems })\n\t\t}\n\t\treturn items\n\n\t\t// If we wanted to keep the suggestions up-to-date with changes in the\n\t\t// project, we'd practically have to re-render on any tree and component\n\t\t// loader change. Instead, I think it's perfectly acceptable for the\n\t\t// suggestions to be a snapshot from when the user opened the Redirects.\n\t}, [])\n\n\tconst handleSave = React.useCallback(() => {\n\t\tif (upsell) return\n\n\t\t// The redirect may have changed from the last render (think e.g. we're\n\t\t// saving in response to an ENTER press, which means maybe we haven't\n\t\t// re-rendered yet), so we need to grab fresh values from the store and\n\t\t// re-validate them.\n\t\tconst latestDraft = siteSettingsStore.redirectsChanges[draftKey]\n\n\t\tconst latestFrom = latestDraft?.from ?? redirect?.path ?? \"\"\n\t\tconst latestTo = latestDraft?.to ?? redirect?.to ?? \"\"\n\n\t\tconst fromValidation = validateRouteNodePath(\"redirect\", latestFrom)\n\t\tif (fromValidation.result !== \"ok\") return\n\t\tconst fromUniquenessValidation = validateRouteNodePathUniqueness(\"redirect\", latestFrom, redirects, redirect?.id)\n\t\tif (fromUniquenessValidation.result !== \"ok\") return\n\n\t\tconst toValidation = validateRedirectTo(tree, latestTo, fromValidation.normalizedValue)\n\t\tif (toValidation.result !== \"ok\") return\n\n\t\tconst allPaths = urlSuggestions\n\t\t\t.filter(isComboBoxListItemSection)\n\t\t\t.flatMap(section => section.items.map(item => item.value))\n\t\tonSave(fromValidation.normalizedValue, toValidation.normalizedValue, allPaths)\n\t\tsiteSettingsStore.clearRedirectDraft(draftKey)\n\t}, [draftKey, onSave, redirect, redirects, upsell, urlSuggestions])\n\n\tconst handleCancel = React.useCallback(() => {\n\t\tonCancel?.()\n\t\tsiteSettingsStore.clearRedirectDraft(draftKey)\n\t}, [draftKey, onCancel])\n\n\tconst onFromChange = React.useCallback(\n\t\t(value: string) => {\n\t\t\tconst escapedValue = escapeParenthesesInPath(value)\n\t\t\tconst persistedFrom = redirect?.path || \"\"\n\t\t\tif (escapedValue === persistedFrom) {\n\t\t\t\tsiteSettingsStore.clearRedirectDraftProp(draftKey, \"from\")\n\t\t\t} else {\n\t\t\t\tsiteSettingsStore.updateRedirectDraft(draftKey, { from: escapedValue })\n\t\t\t}\n\t\t},\n\t\t[draftKey, redirect?.path],\n\t)\n\tconst onToChange = React.useCallback(\n\t\t(value: string | LinkToWebPage) => {\n\t\t\tconst persistedTo = redirect?.to || \"\"\n\t\t\tif (value === persistedTo) {\n\t\t\t\tsiteSettingsStore.clearRedirectDraftProp(draftKey, \"to\")\n\t\t\t} else {\n\t\t\t\tsiteSettingsStore.updateRedirectDraft(draftKey, { to: value })\n\t\t\t}\n\t\t},\n\t\t[draftKey, redirect?.to],\n\t)\n\n\tconst upsellIfNeeded = React.useCallback(\n\t\t(event: React.SyntheticEvent) => {\n\t\t\tif (!upsell) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\tshowRedirectsUpsellModal(engine, \"settings\")\n\t\t},\n\t\t[upsell],\n\t)\n\n\tconst toLink = getLink(to)\n\n\tconst displayFrom = getPathForDisplay(from)\n\n\treturn {\n\t\tfromInput: (\n\t\t\t<ComboBox\n\t\t\t\tconstantChange\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t\thasError={fromValidationResult.result === \"error\" || fromUniquenessValidationResult.result === \"error\"}\n\t\t\t\titems={urlSuggestions}\n\t\t\t\tonChange={onFromChange}\n\t\t\t\tonMouseDown={upsellIfNeeded}\n\t\t\t\tplaceholder={redirect?.path ? getPathForDisplay(redirect.path) : \"/url, /url/* \u2026\"}\n\t\t\t\treadOnly={upsell}\n\t\t\t\ttabIndex={upsell ? -1 : undefined}\n\t\t\t\tvalue={displayFrom}\n\t\t\t\twrapperClassName={styles.grow}\n\t\t\t/>\n\t\t),\n\t\tfromErrorMessage:\n\t\t\tfromValidationResult.result === \"error\" ? (\n\t\t\t\t<T className={styles.errorMessage}>{fromValidationResult.message}</T>\n\t\t\t) : fromUniquenessValidationResult.result === \"error\" ? (\n\t\t\t\t<T className={styles.errorMessage}>{fromUniquenessValidationResult.message}</T>\n\t\t\t) : undefined,\n\t\ttoInput: (\n\t\t\t<LinkInput\n\t\t\t\ttree={tree}\n\t\t\t\tlink={toLink}\n\t\t\t\tsupportsPageLinks\n\t\t\t\tautoFocus={false}\n\t\t\t\tlocaleId={fromLocaleId}\n\t\t\t\tenabled={!isViewOnly}\n\t\t\t\treadOnly={upsell}\n\t\t\t\thasError={toValidationResult.result === \"error\"}\n\t\t\t\ttabIndex={upsell ? -1 : undefined}\n\t\t\t\tonMouseDown={upsellIfNeeded}\n\t\t\t\tvariableInfo={null}\n\t\t\t\tclassName={styles.grow}\n\t\t\t\thomePageName=\"/\"\n\t\t\t\tonChange={link => {\n\t\t\t\t\tif (isLinkToWebPage(link)) {\n\t\t\t\t\t\tonToChange(link)\n\t\t\t\t\t} else if (isLinkToURL(link)) {\n\t\t\t\t\t\tonToChange(link.url)\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t/>\n\t\t),\n\t\ttoErrorMessage:\n\t\t\ttoValidationResult.result === \"error\" ? (\n\t\t\t\t<T className={styles.errorMessage}>{toValidationResult.message}</T>\n\t\t\t) : undefined,\n\t\tsaveButton: (\n\t\t\t<Button\n\t\t\t\tclassName={styles.button}\n\t\t\t\tonClick={handleSave}\n\t\t\t\tenabled={\n\t\t\t\t\t!isViewOnly &&\n\t\t\t\t\t!upsell &&\n\t\t\t\t\tfromValidationResult.result === \"ok\" &&\n\t\t\t\t\tfromUniquenessValidationResult.result === \"ok\" &&\n\t\t\t\t\ttoValidationResult.result === \"ok\"\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<IconCheckmark animate={false} />\n\t\t\t</Button>\n\t\t),\n\t\tcancelButton: (\n\t\t\t<ContextMenuButton className={styles.button} onClick={handleCancel}>\n\t\t\t\t<IconCancel />\n\t\t\t</ContextMenuButton>\n\t\t),\n\t\thasExplicitLocale: Boolean(fromLocaleId),\n\t}\n}\n", "import \"useRedirectForm.styles_j5195y.wyw.css\"; export const grow = \"grow_g69mwc1\";\nexport const errorMessage = \"errorMessage_e1lxsxz3\";\nexport const button = \"button_btmmzh4\";", "import {\n\tContextMenuButton,\n\tEmptyState,\n\tIconArrowRight,\n\tIconReorderHandle,\n\tSpinner,\n\tStack,\n\tTranslatable as T,\n\tTextInput,\n\tUpgradeBadge,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { Sortable } from \"@framerjs/fresco/layout-transitions\"\nimport { assert } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport { handleLimitError } from \"document/components/chrome/shared/utils/limitError.ts\"\nimport { ensureRedirectLimits } from \"document/components/chrome/siteSettings/Redirects/ensureRedirectLimits.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { RedirectRouteNode } from \"document/models/CanvasTree/nodes/RedirectRouteNode.ts\"\nimport { getRedirectToPath } from \"document/models/CanvasTree/nodes/utils/redirectRouteNode.ts\"\nimport { deleteRedirects, moveRedirect, updateRedirect } from \"document/models/CanvasTree/nodes/utils/routesNode.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport React, { useState } from \"react\"\nimport { getId } from \"utils/getId.ts\"\nimport { getPathForDisplay } from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport { showRedirectsUpsellModal } from \"../../shared/UpsellModal/utils/siteSettingsUpsellModals.tsx\"\nimport { SettingSection } from \"../SettingSection.tsx\"\nimport * as styles from \"./RedirectsList.styles.ts\"\nimport { useRedirectForm } from \"./useRedirectForm.tsx\"\n\nconst deleteRedirectHandler = (redirectId: NodeID) => {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\ttitle: \"Remove Redirect\",\n\t\tdescription:\n\t\t\t\"Are you sure you want to remove this redirect? This will go into effect with the next update or publish.\",\n\t\tconfirmLabel: \"Remove\",\n\t\tonConfirm: engine.scheduler.wrapHandler(() => {\n\t\t\tdeleteRedirects(engine.stores.treeStore, [redirectId])\n\t\t}),\n\t\tvariant: \"destructive\",\n\t\tsource: \"settings\",\n\t})\n}\n\nconst moveRedirectHandler = engine.scheduler.wrapHandler((oldIndex: number, newIndex: number) => {\n\thandleLimitError(() => {\n\t\tmoveRedirect(engine.stores.treeStore, newIndex, oldIndex, () => ensureRedirectLimits(engine, \"edit\"))\n\t})\n})\n\nconst updateRedirectHandler = engine.scheduler.wrapHandler(\n\t(redirectId: NodeID, from: string, to: string | LinkToWebPage) => {\n\t\thandleLimitError(() => {\n\t\t\tconst redirect = engine.tree.get<RedirectRouteNode>(redirectId)\n\t\t\tassert(redirect, \"updateRedirect: expected RedirectRouteNode to exist\")\n\t\t\tupdateRedirect(redirect, { path: from, to }, () => ensureRedirectLimits(engine, \"edit\"))\n\t\t})\n\t},\n)\n\ninterface Props {\n\tisViewOnly: boolean\n\tredirects: readonly RedirectRouteNode[]\n\tgetReadableWebPageLinkPathForRedirect: (redirect: RedirectRouteNode) => string | null\n\tupsell: boolean\n\tisLoading: boolean\n}\n\nexport function RedirectsList({\n\tisViewOnly,\n\tredirects,\n\tgetReadableWebPageLinkPathForRedirect,\n\tupsell,\n\tisLoading,\n}: Props) {\n\tconst noExistingRedirects = redirects.length === 0\n\tconst shouldHaveMinHeight = isLoading || noExistingRedirects\n\n\t// Once the min height has been enabled it should never be disabled, to prevent the container\n\t// from massively shrinking its height when adding a redirect to an empty state.\n\tconst [hasMinHeight, setHasMinHeight] = useState(shouldHaveMinHeight)\n\tif (!hasMinHeight && shouldHaveMinHeight) {\n\t\tsetHasMinHeight(true)\n\t}\n\n\tconst hasLocales = useDeprecatedEngineState(EngineChange.Tree, () =>\n\t\tBoolean(engine.tree.root.locales && engine.tree.root.locales.length > 0),\n\t)\n\n\tconst searchTerm = engine.stores.siteSettingsStore.useState(state => state.redirectsSearchTerm)\n\tconst setSearchTerm = useEngineCallback((term: string) => {\n\t\tengine.stores.siteSettingsStore.redirectsSearchTerm = term\n\t}, [])\n\n\t// Deferring the search term prioritizes the rendering of the input field\n\t// over the list of redirects, which makes the UI feel more responsive.\n\tconst deferredSearchTerm = React.useDeferredValue(searchTerm)\n\tconst searchTermIsEmpty = deferredSearchTerm === \"\"\n\n\tconst filteredRedirects = React.useMemo(() => {\n\t\tif (deferredSearchTerm === \"\") return redirects\n\t\treturn redirects.filter(\n\t\t\tredirect =>\n\t\t\t\t(redirect.path && getPathForDisplay(redirect.path).includes(deferredSearchTerm)) ||\n\t\t\t\tgetRedirectToPath(redirect, getReadableWebPageLinkPathForRedirect)?.includes(deferredSearchTerm),\n\t\t)\n\t}, [deferredSearchTerm, redirects, getReadableWebPageLinkPathForRedirect])\n\n\tconst noMatches = filteredRedirects.length === 0\n\n\tconst upsellIfNeeded = React.useCallback(\n\t\t(event: React.SyntheticEvent) => {\n\t\t\tif (!upsell) return\n\n\t\t\tevent.preventDefault()\n\t\t\tevent.stopPropagation()\n\n\t\t\tshowRedirectsUpsellModal(engine, \"settings\")\n\t\t},\n\t\t[upsell],\n\t)\n\n\treturn (\n\t\t<SettingSection\n\t\t\ttitle=\"Redirects\"\n\t\t\ttitleBadge={upsell ? <UpgradeBadge onClick={() => showRedirectsUpsellModal(engine, \"settings\")} /> : undefined}\n\t\t\tdescription={\n\t\t\t\t<Stack direction=\"column\" gap={20}>\n\t\t\t\t\t<T>Any changes made to this list will go live on publish. Reorder the items to define the priority.</T>\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tkey=\"search-input\"\n\t\t\t\t\t\tdata-testid=\"redirects-search-input\"\n\t\t\t\t\t\tonMouseDown={upsellIfNeeded}\n\t\t\t\t\t\tonChange={setSearchTerm}\n\t\t\t\t\t\tvalue={searchTerm}\n\t\t\t\t\t\tenabled={!upsell}\n\t\t\t\t\t\tconstantChange\n\t\t\t\t\t\tstopUpDownKeyPropagation={false}\n\t\t\t\t\t\tplaceholder=\"Filter\u2026\"\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t}\n\t\t\taction={null}\n\t\t\tdivider\n\t\t>\n\t\t\t<div className={cx(styles.container, hasMinHeight && styles.containerEmptyStateMinHeight)}>\n\t\t\t\t{isLoading ? (\n\t\t\t\t\t<Spinner />\n\t\t\t\t) : noExistingRedirects ? (\n\t\t\t\t\t<EmptyState\n\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\tnoExistingRedirects ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\tCreate a redirect to maintain\n\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\tsearch engine ranking for existing URLs\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>No redirects match your search</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcenter\n\t\t\t\t\t\tmaxBodyWidth={300}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{noMatches && !searchTermIsEmpty && (\n\t\t\t\t\t\t\t<EmptyState\n\t\t\t\t\t\t\t\tbody={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<T>No redirects match </T>\n\t\t\t\t\t\t\t\t\t\t<b>{searchTerm}</b>\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\tcenter\n\t\t\t\t\t\t\t\tmaxBodyWidth={300}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Sortable\n\t\t\t\t\t\t\tclassName={styles.list}\n\t\t\t\t\t\t\tdisableCustomDragPreview\n\t\t\t\t\t\t\tenabled={!isViewOnly && !upsell && filteredRedirects.length > 1 && searchTermIsEmpty}\n\t\t\t\t\t\t\titems={filteredRedirects}\n\t\t\t\t\t\t\tkeyForItem={getId}\n\t\t\t\t\t\t\tmoveItem={moveRedirectHandler}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{({ item: redirect, isDragEnabled }) => (\n\t\t\t\t\t\t\t\t<RedirectRow\n\t\t\t\t\t\t\t\t\tupsell={upsell}\n\t\t\t\t\t\t\t\t\thasLocales={hasLocales}\n\t\t\t\t\t\t\t\t\tisDragEnabled={isDragEnabled}\n\t\t\t\t\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\t\t\t\t\tredirect={redirect}\n\t\t\t\t\t\t\t\t\tredirects={redirects}\n\t\t\t\t\t\t\t\t\tgetReadableWebPageLinkPathForRedirect={getReadableWebPageLinkPathForRedirect}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Sortable>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</SettingSection>\n\t)\n}\n\nfunction RedirectRow({\n\tisDragEnabled,\n\tisViewOnly,\n\thasLocales,\n\tredirect,\n\tredirects,\n\tgetReadableWebPageLinkPathForRedirect,\n\tupsell,\n}: {\n\tisDragEnabled: boolean\n\tisViewOnly: boolean\n\thasLocales: boolean\n\tredirect: RedirectRouteNode\n\tredirects: readonly RedirectRouteNode[]\n\tgetReadableWebPageLinkPathForRedirect: (redirect: RedirectRouteNode) => string | null\n\tupsell: boolean\n}) {\n\tconst [isEditing, setEditing] = React.useState(false)\n\tconst onSave = React.useCallback(\n\t\t(from: string, to: string | LinkToWebPage) => {\n\t\t\tsetEditing(false)\n\t\t\tupdateRedirectHandler(redirect.id, from, to)\n\t\t},\n\t\t[redirect.id],\n\t)\n\tconst onCancel = React.useCallback(() => {\n\t\tsetEditing(false)\n\t}, [])\n\tconst { fromInput, fromErrorMessage, toInput, toErrorMessage, saveButton, cancelButton, hasExplicitLocale } =\n\t\tuseRedirectForm({\n\t\t\tisViewOnly,\n\t\t\tonCancel,\n\t\t\tonSave,\n\t\t\tredirect,\n\t\t\tredirects,\n\t\t\tupsell,\n\t\t})\n\n\tconst buttonRef = React.useRef<HTMLButtonElement>(null)\n\n\tconst onContextClick = () => {\n\t\tif (!buttonRef.current) return\n\n\t\tconst bounds = buttonRef.current.getBoundingClientRect()\n\n\t\tconst items: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: \"Expand to All Locales\",\n\t\t\t\tchecked: hasExplicitLocale ? false : redirect.shouldExpandToAllLocales(),\n\t\t\t\tvisible: hasLocales,\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (upsell) {\n\t\t\t\t\t\treturn showRedirectsUpsellModal(engine, \"settings\")\n\t\t\t\t\t}\n\t\t\t\t\tconst node = engine.tree.current(redirect)\n\t\t\t\t\tif (!node) return\n\t\t\t\t\tupdateRedirect(node, { expandToAllLocales: !node.shouldExpandToAllLocales() }, () =>\n\t\t\t\t\t\tensureRedirectLimits(engine, \"edit\"),\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\tenabled: !isViewOnly && !hasExplicitLocale,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: \"separator\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Edit\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (upsell) {\n\t\t\t\t\t\treturn showRedirectsUpsellModal(engine, \"settings\")\n\t\t\t\t\t}\n\t\t\t\t\tsetEditing(true)\n\t\t\t\t},\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Remove\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tdeleteRedirectHandler(redirect.id)\n\t\t\t\t},\n\t\t\t\tenabled: !isViewOnly,\n\t\t\t},\n\t\t]\n\n\t\tengine.stores.contextMenuStore.show(items, {\n\t\t\tlocation: {\n\t\t\t\tx: bounds.left,\n\t\t\t\ty: bounds.bottom + 5,\n\t\t\t},\n\t\t})\n\t}\n\n\tconst [isGrabbingReorderHandle, setGrabbingReorderHandle] = React.useState(false)\n\tReact.useEffect(() => {\n\t\tconst listener = () => {\n\t\t\t// We set this in an onMouseDown on IconReorderHandle, and unset it\n\t\t\t// via a global listener, because when you finish dragging,\n\t\t\t// depending on the drag preview configuration, the mouseup might no\n\t\t\t// longer fire on the original IconReorderHandle.\n\t\t\tsetGrabbingReorderHandle(false)\n\t\t}\n\t\tdocument.addEventListener(\"mouseup\", listener)\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mouseup\", listener)\n\t\t}\n\t}, [])\n\n\tconst fromRef = React.useRef<HTMLDivElement>(null)\n\tconst [isFromOverflowing, setFromOverflowing] = React.useState(false)\n\tReact.useLayoutEffect(() => {\n\t\tif (!fromRef.current) return\n\t\tconst isOverflowing = fromRef.current.scrollWidth > fromRef.current.offsetWidth\n\t\tsetFromOverflowing(isOverflowing)\n\t}, [redirect.path])\n\n\tconst toRef = React.useRef<HTMLDivElement>(null)\n\tconst [isToOverflowing, setToOverflowing] = React.useState(false)\n\tReact.useLayoutEffect(() => {\n\t\tif (!toRef.current) return\n\t\tconst isOverflowing = toRef.current.scrollWidth > toRef.current.offsetWidth\n\t\tsetToOverflowing(isOverflowing)\n\t}, [redirect.to])\n\n\tconst redirectToPath = getRedirectToPath(redirect, getReadableWebPageLinkPathForRedirect) ?? Dictionary.Missing\n\n\tconst unescapedFromPath = redirect.path ? getPathForDisplay(redirect.path) : \"\"\n\n\treturn (\n\t\t<Stack className={styles.row} direction=\"row\" data-testid={redirect.id}>\n\t\t\t<div className={styles.fixedHeight}>\n\t\t\t\t<IconReorderHandle\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.reorderHandle,\n\t\t\t\t\t\tisDragEnabled && styles.reorderHandleGrabbable,\n\t\t\t\t\t\tisDragEnabled && isGrabbingReorderHandle && styles.reorderHandleGrabbing,\n\t\t\t\t\t)}\n\t\t\t\t\t// We unset the grabbing state via a global mouseup listener, see the effect above.\n\t\t\t\t\tonMouseDown={() => setGrabbingReorderHandle(true)}\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t<div className={cx(styles.equalWidth, !isEditing && styles.fixedHeight)}>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t{fromInput}\n\t\t\t\t\t\t{fromErrorMessage}\n\t\t\t\t\t</Stack>\n\t\t\t\t) : (\n\t\t\t\t\t<div className={truncateWithEllipsis} ref={fromRef} title={isFromOverflowing ? unescapedFromPath : undefined}>\n\t\t\t\t\t\t{unescapedFromPath}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t<div className={styles.fixedHeight}>\n\t\t\t\t<IconArrowRight className={styles.arrow} />\n\t\t\t</div>\n\n\t\t\t<div className={cx(styles.equalWidth, !isEditing && styles.fixedHeight)}>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<Stack>\n\t\t\t\t\t\t<Stack direction=\"row\">\n\t\t\t\t\t\t\t{toInput}\n\t\t\t\t\t\t\t{saveButton}\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t{toErrorMessage}\n\t\t\t\t\t</Stack>\n\t\t\t\t) : (\n\t\t\t\t\t<div className={truncateWithEllipsis} ref={toRef} title={isToOverflowing ? redirectToPath : undefined}>\n\t\t\t\t\t\t{redirectToPath}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\n\t\t\t{isEditing ? (\n\t\t\t\tcancelButton\n\t\t\t) : (\n\t\t\t\t<ContextMenuButton\n\t\t\t\t\tonMouseDown={onContextClick}\n\t\t\t\t\tref={buttonRef}\n\t\t\t\t\t// Make sure React will create a completely new element for\n\t\t\t\t\t// the menu button, otherwise it ends up reusing the same\n\t\t\t\t\t// DOM element as the cancel button, and when the user\n\t\t\t\t\t// clicks the cancel button, the menu button renders in the\n\t\t\t\t\t// focused state.\n\t\t\t\t\tkey=\"menu\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"RedirectsList.styles_1pxr7a6.wyw.css\"; export const container = \"container_cuz5rbg\";\nexport const containerEmptyStateMinHeight = \"containerEmptyStateMinHeight_clbyxl4\";\nexport const list = \"list_l1jkfa2n\";\nexport const row = \"row_r1epov8z\";\nexport const fixedHeight = \"fixedHeight_fv9zml3\";\nexport const equalWidth = \"equalWidth_ebvmcj7\";\nexport const reorderHandle = \"reorderHandle_rdgggd1\";\nexport const reorderHandleGrabbable = \"reorderHandleGrabbable_r159ax8a\";\nexport const reorderHandleGrabbing = \"reorderHandleGrabbing_r198035c\";\nexport const arrow = \"arrow_a6no774\";", "import { Scroll, Stack } from \"@framerjs/fresco\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport { isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { defaultLocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport type { SiteSettingsTab } from \"document/stores/SiteSettingsStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback, useMemo } from \"react\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useRouteSegmentChildrenRows } from \"../Pages/useRouteSegmentChildrenRows.ts\"\nimport { useRouteSegmentList } from \"../Pages/useRouteSegmentList.tsx\"\nimport { getRouteSegmentNodeByWebPageId } from \"../Pages/utils/getRouteSegmentNodeByWebPageId.ts\"\nimport { ContentPanelHeader } from \"../contentPanel/ContentPanelHeader.tsx\"\nimport { CollapsibleRowDivider } from \"../shared/CollapsibleRow.tsx\"\nimport * as styles from \"./SiteSettings.styles.ts\"\nimport { SiteSettingsPanelRow } from \"./SiteSettingsPanelRow.tsx\"\nimport { SiteSettingsRouteSegmentRow } from \"./SiteSettingsRouteSegmentRow.tsx\"\nimport { SiteSettingsVariantRow } from \"./SiteSettingsVariantRow.tsx\"\nimport {\n\tSiteSettingsAgentIconCode,\n\tSiteSettingsAgentIconDomains,\n\tSiteSettingsAgentIconForms,\n\tSiteSettingsAgentIconGeneral,\n\tSiteSettingsAgentIconPlans,\n\tSiteSettingsAgentIconRedirects,\n\tSiteSettingsAgentIconUsage,\n\tSiteSettingsAgentIconVersions,\n\tSiteSettingsIconCode,\n\tSiteSettingsIconDomains,\n\tSiteSettingsIconForms,\n\tSiteSettingsIconGeneral,\n\tSiteSettingsIconPlans,\n\tSiteSettingsIconRedirects,\n\tSiteSettingsIconUsage,\n\tSiteSettingsIconVersions,\n} from \"./sidebarIcons/SiteSettingsSidebarIcons.tsx\"\n\ninterface Props {\n\tactive: SiteSettingsTab\n}\n\nexport function SiteSettingsSidebar({ active }: Props) {\n\tconst isViewOnly = useIsViewOnly(\"canEditSiteSettings\")\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\n\tconst { homePageId, isHomePageAbTesting } = useEngineState(\n\t\t() => {\n\t\t\tconst homePageId = engine.tree.root.homePageNodeId\n\t\t\tconst homePageNode = engine.tree.getNodeWithTrait(homePageId, isWebPageNode)\n\t\t\tconst isHomePageAbTesting = homePageNode ? homePageNode.hasAbTestingChildren(engine.tree) : false\n\t\t\treturn { homePageId, isHomePageAbTesting }\n\t\t},\n\t\t[],\n\t\t[EngineChange.TreeStore],\n\t)\n\n\tconst homePageConfig = useMemo(\n\t\t() => ({\n\t\t\tshowHomePage: !!homePageId,\n\t\t\thomePageId: homePageId || \"\",\n\t\t\tisHomePageAbTesting,\n\t\t}),\n\t\t[homePageId, isHomePageAbTesting],\n\t)\n\n\tconst activePageId = active.tab === SiteSettingsTabNames.page ? active.id : undefined\n\tconst activeRouteSegmentIds = useEngineState(\n\t\t() => {\n\t\t\tif (isUndefined(activePageId)) return\n\n\t\t\tconst segment = getRouteSegmentNodeByWebPageId(engine.tree, activePageId)\n\t\t\tif (!segment) return\n\n\t\t\treturn new Set(engine.tree.getAncestors(segment.id))\n\t\t},\n\t\t[activePageId],\n\t\t[EngineChange.Tree],\n\t\t// Compare resulting state with deep equals, so we only re-render if the\n\t\t// `activeRouteSegmentIds` set has actually changed.\n\t\t{ deepEqual: true },\n\t)\n\n\tconst sharedProps = useMemo(\n\t\t() => ({\n\t\t\tisViewOnly,\n\t\t\tactiveRouteSegmentIds,\n\t\t}),\n\t\t[isViewOnly, activeRouteSegmentIds],\n\t)\n\n\tconst routes = useRouteSegmentChildrenRows(ROUTE_SEGMENT_ROOT_NODE_ID, undefined, defaultLocaleId)\n\tconst { routeSegmentList, handleSegmentClick } = useRouteSegmentList(\n\t\thomePageConfig,\n\t\tsharedProps,\n\t\tfalse, // filtering is not supported in settings\n\t\tactivePageId,\n\t\tdefaultLocaleId,\n\t\tundefined, // filtering is not supported in settings\n\t\troutes,\n\t)\n\n\t// Handle segment click to update site settings tab\n\tconst handleRowClick = useCallback(\n\t\t({ webPageId, segmentId }: { webPageId?: NodeID; segmentId?: NodeID }) => {\n\t\t\t// First call the original handler to maintain selection state\n\t\t\thandleSegmentClick({ webPageId, segmentId })\n\n\t\t\t// Then update the site settings tab if we have a webPageId\n\t\t\tif (webPageId) {\n\t\t\t\tengine.stores.siteSettingsStore\n\t\t\t\t\t.setActiveTab({\n\t\t\t\t\t\ttab: SiteSettingsTabNames.page,\n\t\t\t\t\t\tid: webPageId,\n\t\t\t\t\t})\n\t\t\t\t\t.catch(console.error)\n\t\t\t}\n\t\t},\n\t\t[handleSegmentClick],\n\t)\n\n\treturn (\n\t\t<div className={styles.sidebar}>\n\t\t\t<Scroll direction=\"vertical\">\n\t\t\t\t<ContentPanelHeader\n\t\t\t\t\ttitle={Dictionary.SiteSettings}\n\t\t\t\t\tisFirstSection\n\t\t\t\t\ttoggleExpanded={noop}\n\t\t\t\t\tenabled={false}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t/>\n\t\t\t\t<Stack gap={0} className={styles.rowsContainer}>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"General\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconGeneral : SiteSettingsIconGeneral}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.project }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Domains\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconDomains : SiteSettingsIconDomains}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.domains }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Redirects\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconRedirects : SiteSettingsIconRedirects}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.redirects }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Versions\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconVersions : SiteSettingsIconVersions}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.versions }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Usage\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconUsage : SiteSettingsIconUsage}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.usage, usageType: \"bandwidth\" }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Forms\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconForms : SiteSettingsIconForms}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.forms }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Plans\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconPlans : SiteSettingsIconPlans}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.plans }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t\t<SiteSettingsPanelRow\n\t\t\t\t\t\ttitle=\"Code\"\n\t\t\t\t\t\tIcon={agentExperimentEnabled ? SiteSettingsAgentIconCode : SiteSettingsIconCode}\n\t\t\t\t\t\ttab={{ tab: SiteSettingsTabNames.customCode }}\n\t\t\t\t\t\tselectedTab={active}\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t\t<ContentPanelHeader\n\t\t\t\t\ttitle={Dictionary.PageSettings}\n\t\t\t\t\ttoggleExpanded={noop}\n\t\t\t\t\tenabled={false}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t/>\n\n\t\t\t\t<div className={styles.rowsContainer}>\n\t\t\t\t\t{routeSegmentList.map(row => {\n\t\t\t\t\t\tswitch (row.type) {\n\t\t\t\t\t\t\tcase \"home\":\n\t\t\t\t\t\t\tcase \"webPage\":\n\t\t\t\t\t\t\tcase \"folder\":\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<SiteSettingsRouteSegmentRow\n\t\t\t\t\t\t\t\t\t\tkey={`${row.type}-${row.segmentId || row.webPageId}`}\n\t\t\t\t\t\t\t\t\t\t{...row}\n\t\t\t\t\t\t\t\t\t\tonClick={handleRowClick}\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\tcase \"variant\": {\n\t\t\t\t\t\t\t\tconst { type: _type, ...variantRow } = row\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<SiteSettingsVariantRow key={`${row.webPageId}-variant`} {...variantRow} onClick={handleRowClick} />\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcase \"divider\":\n\t\t\t\t\t\t\t\treturn <CollapsibleRowDivider key={`${row.segmentId}-divider`} depth={row.depth} />\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn assertNever(row)\n\t\t\t\t\t\t}\n\t\t\t\t\t})}\n\t\t\t\t</div>\n\t\t\t</Scroll>\n\t\t</div>\n\t)\n}\n", "import type { SiteSettingsTab } from \"document/stores/SiteSettingsStore.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\n\nexport function settingsTabIsEqual(a: SiteSettingsTab | undefined, b: SiteSettingsTab | undefined): boolean {\n\tif (isUndefined(a) || isUndefined(b)) return false\n\tif (a.tab === \"page\") return b.tab === \"page\" && a.id === b.id\n\treturn a.tab === b.tab\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { SiteSettingsTab } from \"document/stores/SiteSettingsStore.ts\"\nimport type React from \"react\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { settingsTabIsEqual } from \"./settingsTabIsEqual.ts\"\n\ninterface Props {\n\ttitle: string\n\tIcon: React.FunctionComponent | React.ReactNode\n\ttab: SiteSettingsTab\n\tselectedTab: SiteSettingsTab\n\tisDisabled?: boolean\n}\n\nexport const SiteSettingsPanelRow = ({ title, Icon, tab, selectedTab, isDisabled }: Props) => {\n\tconst isSelected = settingsTabIsEqual(tab, selectedTab)\n\n\tconst updateTab = () => {\n\t\tif (isSelected || isDisabled) return\n\t\tengine.stores.siteSettingsStore.setActiveTab(tab).catch(unhandledError)\n\t}\n\n\treturn (\n\t\t<CollapsibleRow\n\t\t\tid={tab.tab}\n\t\t\ttitle={title}\n\t\t\tIcon={Icon}\n\t\t\tisSelected={isSelected}\n\t\t\tonSelect={updateTab}\n\t\t\tisEditable={false}\n\t\t\twithCollapse\n\t\t\tdepth={0}\n\t\t\tisCollapsible={false}\n\t\t/>\n\t)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport { ROUTE_SEGMENT_ROOT_NODE_ID } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.ts\"\nimport React from \"react\"\nimport { scrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport type { Props as RouteSegmentRowProps } from \"../Pages/RouteSegmentRow.tsx\"\nimport { formatCollectionItemCount } from \"../Pages/utils/formatCollectionItemCount.ts\"\nimport { getRouteSegmentIcon } from \"../Pages/utils/getRouteSegmentIcon.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { buildSubLabel } from \"../shared/utils/buildSubLabel.ts\"\n\n// Exclude drag-and-drop related props that aren't needed in settings\ntype Props = Omit<RouteSegmentRowProps, \"getDraggableRouteSegmentNodes\" | \"getSelectedRows\">\n\nexport const SiteSettingsRouteSegmentRow = React.memo<Props>(function SiteSettingsRouteSegmentRow(props) {\n\tconst {\n\t\ttype,\n\t\tdepth,\n\t\tsegmentId,\n\t\tsegment,\n\t\tcollectionId,\n\t\tcollectionName,\n\t\tcollectionItemCount,\n\t\twebPageId,\n\t\tisDraft,\n\t\tisAbTesting,\n\t\tisSelected,\n\t\tisCollapsible,\n\t\tisExpanded,\n\t\tonClick,\n\t} = props\n\n\t// If we open site settings and pre-select a row that's off-screen (think:\n\t// a site with a lot of pages, and we open settings for a page that's low on\n\t// the list), we want to scroll that row into view.\n\tconst ref = React.useCallback(\n\t\t(div: HTMLDivElement | null) => {\n\t\t\tif (isSelected && div) {\n\t\t\t\tscrollIntoView(div, { scrollMode: \"if-needed\", block: \"center\" })\n\t\t\t}\n\t\t},\n\t\t[isSelected],\n\t)\n\n\tconst isHomePage = type === \"home\"\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst isFolder = type === \"folder\"\n\tconst isCollection = Boolean(collectionId)\n\n\tconst title = isHomePage ? Dictionary.Home : (collectionName ?? (segment ? `/${segment}` : \"\"))\n\n\tconst handleSelect = () => {\n\t\tonClick({ webPageId, segmentId })\n\t}\n\n\tconst toggleCollapse = () => {\n\t\t// when no segmentId is defined, it means we are at the root level (Home Page)\n\t\tconst expansionId = segmentId ?? ROUTE_SEGMENT_ROOT_NODE_ID\n\t\tengine.stores.chromeStore.toggleRouteSegmentRow(expansionId)\n\t}\n\n\tconst Icon = getRouteSegmentIcon({\n\t\tisHomePage,\n\t\tisFolder,\n\t\tisCollection,\n\t\tagentExperimentEnabled: isAgentExperimentOn,\n\t})\n\n\tconst countLabel = formatCollectionItemCount(collectionItemCount)\n\tconst subLabel = isAgentExperimentOn ? buildSubLabel([isDraft ? Dictionary.Draft : undefined, countLabel]) : undefined\n\tconst inlineLabel = !isAgentExperimentOn && countLabel ? `\u2219 ${countLabel}` : undefined\n\n\t// Determine badge to display\n\tconst badge =\n\t\tisAgentExperimentOn || !isDraft ? (isAbTesting && !isExpanded && !isSelected ? \"A/B\" : undefined) : Dictionary.Draft\n\n\treturn (\n\t\t<CollapsibleRow\n\t\t\tref={ref}\n\t\t\tid=\"\" // We don't need an id for this row\n\t\t\ttitle={title}\n\t\t\tIcon={Icon}\n\t\t\tbadge={badge}\n\t\t\tinlineLabel={inlineLabel}\n\t\t\tsubLabel={subLabel}\n\t\t\tisSelected={isSelected}\n\t\t\tonSelect={handleSelect}\n\t\t\tisEditable={false}\n\t\t\t// Collapse\n\t\t\twithCollapse\n\t\t\tdepth={depth}\n\t\t\tisCollapsible={isCollapsible}\n\t\t\tisCollapsed={!isExpanded}\n\t\t\ttoggleCollapse={toggleCollapse}\n\t\t/>\n\t)\n})\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport React from \"react\"\nimport { scrollIntoView } from \"utils/scroll-into-view-if-needed/index.ts\"\nimport type { Props as RouteSegmentVariantRowProps } from \"../Pages/RouteSegmentVariantRow.tsx\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\n\n// Exclude drag-and-drop related props that aren't needed in settings\ntype Props = Omit<RouteSegmentVariantRowProps, \"getDraggableRouteSegmentNodes\" | \"getSelectedRows\">\n\nexport const SiteSettingsVariantRow = React.memo<Props>(function SiteSettingsVariantRow({\n\twebPageId,\n\twebPageName,\n\tdepth,\n\tisControl,\n\tisSelected,\n\tIcon,\n\tonClick,\n}) {\n\t// If we open site settings and pre-select a row that's off-screen, we want to scroll that row into view.\n\tconst ref = React.useCallback(\n\t\t(div: HTMLDivElement | null) => {\n\t\t\tif (isSelected && div) {\n\t\t\t\tscrollIntoView(div, { scrollMode: \"if-needed\", block: \"center\" })\n\t\t\t}\n\t\t},\n\t\t[isSelected],\n\t)\n\n\tconst handleSelect = () => {\n\t\tonClick({ webPageId })\n\t}\n\n\treturn (\n\t\t<CollapsibleRow\n\t\t\tref={ref}\n\t\t\tid=\"\" // We don't need an id for this row\n\t\t\ttitle={isControl ? \"Control\" : (webPageName ?? Dictionary.Variant)}\n\t\t\tIcon={Icon}\n\t\t\tisSelected={isSelected}\n\t\t\tonSelect={handleSelect}\n\t\t\tisEditable={false}\n\t\t\twithCollapse\n\t\t\tdepth={depth}\n\t\t\tisCollapsible={false}\n\t\t\ttoggleCollapse={() => {}}\n\t\t/>\n\t)\n})\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentClock(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\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=\"M.75 6a5.25 5.25 0 0 1 10.5 0A5.25 5.25 0 0 1 .75 6Z\"\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\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M5.75 6.25v-2.5m0 2.5h1.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\nimport { IconAgentClock } from \"../../agentPanel/components/IconAgentClock.tsx\"\n\nexport { IconAgentCode as SiteSettingsAgentIconCode } from \"../../agentPanel/components/IconAgentCode.tsx\"\nexport { IconAgentGlobe as SiteSettingsAgentIconDomains } from \"../../agentPanel/components/IconAgentGlobe.tsx\"\nexport { IconAgentLayerForm as SiteSettingsAgentIconForms } from \"../../layers/AgentLayerIcons.tsx\"\n\nconst svgProps: SVGProps<SVGSVGElement> = {\n\txmlns: \"http://www.w3.org/2000/svg\",\n\twidth: 12,\n\theight: 12,\n\tfill: \"none\",\n\trole: \"presentation\",\n\t\"aria-hidden\": true,\n}\n\n/** Inline markup matches `sidebarIcons/*.svg`; strokes/fills use `currentColor` for sidebar theming. */\nexport function SiteSettingsIconGeneral() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 0.5 4.382 C 0.5 3.533 0.937 2.742 1.658 2.286 L 4.658 0.388 C 5.477 -0.129 6.523 -0.129 7.342 0.388 L 10.342 2.286 C 11.063 2.742 11.5 3.532 11.5 4.382 L 11.5 7.618 C 11.5 8.467 11.063 9.258 10.342 9.714 L 7.342 11.612 C 6.523 12.129 5.477 12.129 4.658 11.612 L 1.658 9.714 C 0.937 9.258 0.5 8.468 0.5 7.618 Z M 3.5 6 C 3.5 7.372 4.619 8.485 6 8.485 C 7.381 8.485 8.5 7.372 8.5 6 C 8.5 4.628 7.381 3.515 6 3.515 C 4.619 3.515 3.5 4.628 3.5 6 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsAgentIconGeneral() {\n\treturn (\n\t\t<svg {...svgProps}>\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=\"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\nexport function SiteSettingsIconDomains() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 6 0 C 9.314 0 12 2.686 12 6 C 12 9.314 9.314 12 6 12 C 2.686 12 0 9.314 0 6 C 0 2.686 2.686 0 6 0 Z\"\n\t\t\t\t\t\tid=\"siteSettingsDomainsA\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"siteSettingsDomainsClipA\">\n\t\t\t\t\t\t<use href=\"#siteSettingsDomainsA\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\thref=\"#siteSettingsDomainsA\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tclipPath=\"url(#siteSettingsDomainsClipA)\"\n\t\t\t\t\tstrokeWidth={3.5}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t\t<path d=\"M 1 6 L 11 6\" fill=\"transparent\" stroke=\"currentColor\" />\n\t\t\t<g>\n\t\t\t\t<defs>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M 6 1 C 7.381 1 8.5 3.239 8.5 6 C 8.5 8.761 7.381 11 6 11 C 4.619 11 3.5 8.761 3.5 6 C 3.5 3.239 4.619 1 6 1 Z\"\n\t\t\t\t\t\tid=\"siteSettingsDomainsB\"\n\t\t\t\t\t/>\n\t\t\t\t\t<clipPath id=\"siteSettingsDomainsClipB\">\n\t\t\t\t\t\t<use href=\"#siteSettingsDomainsB\" />\n\t\t\t\t\t</clipPath>\n\t\t\t\t</defs>\n\t\t\t\t<use\n\t\t\t\t\thref=\"#siteSettingsDomainsB\"\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\tclipPath=\"url(#siteSettingsDomainsClipB)\"\n\t\t\t\t\tstrokeWidth={3}\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsIconRedirects() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 3 2 L 9 2 C 9.552 2 10 2.448 10 3 L 10 9\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth={2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 2.5 9.5 L 9 3\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth={2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeMiterlimit={10}\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsAgentIconRedirects() {\n\treturn (\n\t\t<svg {...svgProps}>\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=\"m5 7 2-2M4.75 2.279A3.515 3.515 0 0 1 9.721 7.25M7.25 9.721A3.515 3.515 0 0 1 2.279 4.75\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsIconVersions() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 6 0 C 9.314 0 12 2.686 12 6 C 12 9.314 9.314 12 6 12 C 2.686 12 0 9.314 0 6 C 0 2.686 2.686 0 6 0 Z M 6.725 3 C 6.725 2.768 6.633 2.545 6.469 2.381 C 6.305 2.217 6.082 2.125 5.85 2.125 C 5.618 2.125 5.395 2.217 5.231 2.381 C 5.067 2.545 4.975 2.768 4.975 3 L 4.975 6 C 4.975 7.25 5.6 7.875 6.85 7.875 L 8.5 7.875 C 8.983 7.875 9.375 7.483 9.375 7 C 9.375 6.517 8.983 6.125 8.5 6.125 L 6.85 6.125 C 6.767 6.125 6.725 6.083 6.725 6 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsAgentIconVersions() {\n\treturn <IconAgentClock aria-hidden />\n}\n\nexport function SiteSettingsIconUsage() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 6 12 C 2.686 12 0 9.314 0 6 C 0 2.686 2.686 0 6 0 C 9.314 0 12 2.686 12 6 C 12 9.314 9.314 12 6 12 Z M 4.987 5.044 C 4.223 5.536 4.107 6.607 4.75 7.25 C 5.393 7.893 6.464 7.777 6.956 7.013 L 9 3.833 C 9.35 3.288 8.712 2.65 8.167 3 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsAgentIconUsage() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M.75 6h1.083a1 1 0 0 0 .923-.615l1.575-3.78c.193-.463.872-.385.955.11l1.428 8.57c.083.495.762.573.955.11l1.575-3.78A1 1 0 0 1 10.167 6h1.083\"\n\t\t\t\tfill=\"transparent\"\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\nexport function SiteSettingsIconForms() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 0.5 4 C 0.5 2.343 1.843 1 3.5 1 L 8.5 1 C 10.157 1 11.5 2.343 11.5 4 L 11.5 8 C 11.5 9.657 10.157 11 8.5 11 L 3.5 11 C 1.843 11 0.5 9.657 0.5 8 Z M 3 8 C 3 8.552 3.448 9 4 9 C 4.552 9 5 8.552 5 8 L 5 4 C 5 3.448 4.552 3 4 3 C 3.448 3 3 3.448 3 4 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsAgentIconPlans() {\n\treturn (\n\t\t<svg {...svgProps}>\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=\"M1.25 4.25a2 2 0 0 1 2-2h5.5a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5.5a2 2 0 0 1-2-2Z\"\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=\"M1.25 4.25a2 2 0 0 1 2-2h5.5a2 2 0 0 1 2 2V5.5h-9.5Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsIconPlans() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 0 6 C 0 5.724 0.224 5.5 0.5 5.5 L 11.5 5.5 C 11.776 5.5 12 5.724 12 6 L 12 8 C 12 9.657 10.657 11 9 11 L 3 11 C 1.343 11 0 9.657 0 8 Z M 2.571 1 L 9.429 1 C 10.849 1 12 2.151 12 3.571 C 12 3.808 11.808 4 11.571 4 L 0.429 4 C 0.192 4 0 3.808 0 3.571 C 0 2.151 1.151 1 2.571 1 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function SiteSettingsIconCode() {\n\treturn (\n\t\t<svg {...svgProps}>\n\t\t\t<path\n\t\t\t\td=\"M 4 2.5 L 1.277 5.303 C 0.9 5.691 0.9 6.309 1.277 6.697 L 4 9.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth={2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M 8 2.5 L 10.723 5.303 C 11.1 5.691 11.1 6.309 10.723 6.697 L 8 9.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth={2}\n\t\t\t\tstroke=\"currentColor\"\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 { Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useCallback } from \"react\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport * as siteSettingsStyles from \"../SiteSettings.styles.ts\"\nimport { AgentsUsage } from \"./AgentsUsage/AgentsUsage.tsx\"\nimport { BandwidthUsage } from \"./BandwidthUsage/BandwidthUsage.tsx\"\nimport { MonthSelector } from \"./MonthSelector.tsx\"\nimport * as styles from \"./Usage.styles.ts\"\nimport { UsageFilterLabels } from \"./UsageFilterLabels.tsx\"\nimport { UsageTypeSelector } from \"./UsageTypeSelector.tsx\"\nimport { useUsagePageState } from \"./useUsagePageState.ts\"\n\nexport function Usage() {\n\tconst { selectedUsageType, setSelectedUsageType, month, year, setMonthAndYear, filters, removeFilter } =\n\t\tuseUsagePageState()\n\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\n\tconst handleMonthAndYearChange = useCallback(\n\t\t(newMonth: number, newYear: number) => {\n\t\t\tif (month === newMonth && year === newYear) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: Pages.siteSettingsUsage,\n\t\t\t\tid: UIInteraction.changeTimePeriod,\n\t\t\t})\n\t\t\tsetMonthAndYear(newMonth, newYear)\n\t\t},\n\t\t[month, year, setMonthAndYear],\n\t)\n\n\treturn (\n\t\t<Stack gap={15} className={siteSettingsStyles.wideContainer}>\n\t\t\t<Stack gap={15}>\n\t\t\t\t<div className={styles.titleWrapper}>\n\t\t\t\t\t<div className={siteSettingsStyles.sectionTitle}>\n\t\t\t\t\t\t<T>Usage</T>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{!agentExperimentIsOn && <UsageFilterLabels filters={filters} removeFilter={removeFilter} />}\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.descriptionWrapper}>\n\t\t\t\t\t<div className={styles.description}>\n\t\t\t\t\t\t<T>Usage is calculated on a monthly basis, and you&rsquo;ll be notified when you go over your limit.</T>\n\t\t\t\t\t</div>\n\t\t\t\t\t<MonthSelector month={month} year={year} onMonthAndYearChange={handleMonthAndYearChange} />\n\t\t\t\t</div>\n\t\t\t</Stack>\n\n\t\t\t{agentExperimentIsOn && (\n\t\t\t\t<Stack gap={10}>\n\t\t\t\t\t<Separator height={1} />\n\n\t\t\t\t\t<div className={styles.navigationWrapper}>\n\t\t\t\t\t\t<UsageTypeSelector activeType={selectedUsageType} onSelect={setSelectedUsageType} />\n\t\t\t\t\t\t<UsageFilterLabels isFullWidth filters={filters} removeFilter={removeFilter} />\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<Separator height={1} />\n\t\t\t\t</Stack>\n\t\t\t)}\n\n\t\t\t{!agentExperimentIsOn && <Separator height={1} />}\n\n\t\t\t<div className={styles.statsSection}>\n\t\t\t\t{selectedUsageType === \"bandwidth\" && <BandwidthUsage />}\n\t\t\t\t{agentExperimentIsOn && selectedUsageType === \"agents\" && <AgentsUsage />}\n\t\t\t</div>\n\t\t</Stack>\n\t)\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport {\n\tisAiMonthlyCreditLimitReached,\n\tshowBuyAiCreditsModal,\n} from \"document/components/chrome/shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback, useEffect } from \"react\"\nimport { addUsageFilter } from \"../utils/addUsageFilter.ts\"\nimport { AgentsUsageContent } from \"./components/AgentsUsageContent.tsx\"\nimport { useAgentsUsageData } from \"./useAgentsUsageData.ts\"\n\nexport function AgentsUsageFull() {\n\tconst currentProjectId = engine.stores.projectStore.useState(state => state.projectId)\n\tconst { agentsUsageDataLoading, agentsUsageData, month, year, filters } = engine.stores.usageStore.useState(\n\t\tstate => ({\n\t\t\tagentsUsageDataLoading: state.agentsUsageDataLoading,\n\t\t\tagentsUsageData: state.agentsUsageData,\n\t\t\tmonth: state.month,\n\t\t\tyear: state.year,\n\t\t\tfilters: state.filters,\n\t\t}),\n\t)\n\n\tconst creditLimit = engine.stores.projectStore.useState(state => state.resourceLimits?.aiCredits) ?? null\n\n\tuseEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tvoid engine.stores.usageStore.fetchAgentsData().catch(unhandledError)\n\t\t}, \"nonUserEvent\")\n\t}, [month, year, filters])\n\n\tconst contentState = useAgentsUsageData({\n\t\tisLoading: agentsUsageDataLoading,\n\t\tusageData: agentsUsageData,\n\t\tmonth,\n\t\tyear,\n\t\tcreditLimit,\n\t})\n\n\tconst handleBuyCreditsClick = useCallback(() => {\n\t\tshowBuyAiCreditsModal(engine, \"agents_usage\")\n\t}, [])\n\n\tconst isMonthlyLimitReached = useEngineState(\n\t\t() => isAiMonthlyCreditLimitReached(engine),\n\t\t[],\n\t\t[engine.stores.projectStore, engine.stores.sessionStore],\n\t)\n\n\treturn (\n\t\t<AgentsUsageContent\n\t\t\tcontentState={contentState}\n\t\t\tcurrentProjectId={currentProjectId}\n\t\t\tisMonthlyLimitReached={isMonthlyLimitReached}\n\t\t\tonClickBuyCredits={handleBuyCreditsClick}\n\t\t\tonClickTopField={addUsageFilter}\n\t\t/>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport type { UsageFilterOption } from \"../types.ts\"\n\nexport function addUsageFilter(key: UsageFilterOption, value: string, valueLabel: string) {\n\trecord(\"ui_interaction\", {\n\t\tpage: Pages.siteSettingsUsage,\n\t\tid: UIInteraction.addFilter,\n\t})\n\n\tengine.stores.usageStore.addFilter(key, value, valueLabel)\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport { UpsellType } from \"@framerjs/events\"\nimport { useNavigateToAiCreditsPlans } from \"document/components/chrome/shared/UpsellModal/utils/useNavigateToAiCreditsPlans.ts\"\nimport engine from \"document/engine.ts\"\nimport { startTransition, useCallback } from \"react\"\nimport { aiFreeCreditsURL } from \"utils/staticURLs.ts\"\nimport { Pages, UIInteraction, UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { AgentsUsageLimitedContent } from \"./components/AgentsUsageLimitedContent.tsx\"\n\nexport function AgentsUsageLimited() {\n\tconst { dailyUsage, monthlyUsage, dailyLimit, monthlyLimit } = engine.stores.projectStore.useState(state => ({\n\t\tdailyUsage: state.usageData?.aiCredits?.currentDay ?? 0,\n\t\tmonthlyUsage: state.usageData?.aiCredits?.currentMonth ?? 0,\n\t\tdailyLimit: state.resourceLimits?.aiCreditsDaily ?? null,\n\t\tmonthlyLimit: state.resourceLimits?.aiCredits ?? null,\n\t}))\n\n\tconst navigateToPlans = useNavigateToAiCreditsPlans()\n\n\tconst onLearnMore = useCallback(() => {\n\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsUsage, id: UIInteraction.learnMore })\n\t\topenNewTab(aiFreeCreditsURL)\n\t}, [])\n\n\tconst onNavigateToPlans = useCallback(() => {\n\t\tstartTransition(() => {\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: UpsellType.aiCreditsUpsell,\n\t\t\t\tid: UpsellUIInteraction.navigateToPlans,\n\t\t\t})\n\t\t\tnavigateToPlans()\n\t\t})\n\t}, [navigateToPlans])\n\n\treturn (\n\t\t<AgentsUsageLimitedContent\n\t\t\tdailyUsage={dailyUsage}\n\t\t\tmonthlyUsage={monthlyUsage}\n\t\t\tdailyLimit={dailyLimit}\n\t\t\tmonthlyLimit={monthlyLimit}\n\t\t\tonLearnMore={onLearnMore}\n\t\t\tonNavigateToPlans={onNavigateToPlans}\n\t\t/>\n\t)\n}\n", "import { Translatable as T } from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport * as styles from \"../Usage.styles.ts\"\nimport { AgentsUsageFull } from \"./AgentsUsageFull.tsx\"\nimport { AgentsUsageLimited } from \"./AgentsUsageLimited.tsx\"\n\nexport function AgentsUsage() {\n\tconst agentsUsageView = engine.stores.usageStore.useState(state => state.agentsUsageView)\n\n\tswitch (agentsUsageView) {\n\t\tcase \"none\":\n\t\t\treturn (\n\t\t\t\t<p className={cx(styles.statusMessage, styles.permissionMessage)}>\n\t\t\t\t\t<T>\n\t\t\t\t\t\tYou don&rsquo;t have enough permissions to view agent usage. Contact your administrator if you are running\n\t\t\t\t\t\tinto limits.\n\t\t\t\t\t</T>\n\t\t\t\t</p>\n\t\t\t)\n\t\tcase \"limited\":\n\t\t\treturn <AgentsUsageLimited />\n\t\tcase \"full\":\n\t\t\treturn <AgentsUsageFull />\n\t\tdefault:\n\t\t\tassertNever(agentsUsageView)\n\t}\n}\n", "import { Link, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport React from \"react\"\nimport { bandwidthTrackingReverseProxyArticleURL } from \"utils/staticURLs.ts\"\nimport { ErrorBoundary } from \"web/components/ErrorBoundary.tsx\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { ErrorArea } from \"web/lib/tracker.ts\"\nimport * as styles from \"../Usage.styles.ts\"\nimport { addUsageFilter } from \"../utils/addUsageFilter.ts\"\nimport { formatBytes } from \"../utils/formatters.ts\"\nimport { BandwidthUsageSummaryRow } from \"./BandwidthUsageSummaryRow.tsx\"\nimport { TopAssets } from \"./TopAssets.tsx\"\nimport { TopCategories } from \"./TopCategories.tsx\"\nimport { useBandwidthUsageData } from \"./useBandwidthUsageData.ts\"\n\nconst UsageChart = React.lazy(() => import(\"../UsageChart.tsx\").then(m => ({ default: m.UsageChart })))\n\nexport function BandwidthUsage() {\n\tconst contentState = useBandwidthUsageData()\n\n\tif (contentState.status === \"loading\") {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BandwidthUsageSummaryRow summary={null} isLoading={true} />\n\n\t\t\t\t<div className={styles.loadingState}>\n\t\t\t\t\t<div className={styles.loadingPlaceholder} />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t)\n\t}\n\n\tif (contentState.status === \"error\") {\n\t\treturn (\n\t\t\t<p className={styles.errorMessage}>\n\t\t\t\t<T>Error: {contentState.message}</T>\n\t\t\t</p>\n\t\t)\n\t}\n\n\tconst { usage, summary, topAssets, topCategories, month, year, hasSharedHostnames } = contentState\n\tconst hasData = usage.length > 0 && summary && summary.totalUsage > 0\n\n\tif (!hasData) {\n\t\treturn (\n\t\t\t<Stack gap={15}>\n\t\t\t\t<BandwidthUsageSummaryRow summary={summary} isLoading={contentState.isUpdating} />\n\n\t\t\t\t<div className={styles.noDataMessageWrapper}>\n\t\t\t\t\t<div className={styles.noDataMessage}>\n\t\t\t\t\t\t<T>No data for the selected month</T>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Stack>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Stack gap={15}>\n\t\t\t<BandwidthUsageSummaryRow summary={summary} isLoading={contentState.isUpdating} />\n\n\t\t\t<Stack gap={30}>\n\t\t\t\t<ErrorBoundary\n\t\t\t\t\ttitle=\"Chart Loading Error\"\n\t\t\t\t\tdescription=\"Unable to load the bandwidth chart. Please refresh the page.\"\n\t\t\t\t\tlocation={ErrorArea.vekter}\n\t\t\t\t>\n\t\t\t\t\t<React.Suspense\n\t\t\t\t\t\tfallback={\n\t\t\t\t\t\t\t<div className={styles.loadingState}>\n\t\t\t\t\t\t\t\t<div className={styles.loadingPlaceholder} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<UsageChart\n\t\t\t\t\t\t\tusage={usage}\n\t\t\t\t\t\t\tisLoading={contentState.isUpdating}\n\t\t\t\t\t\t\tmonth={month}\n\t\t\t\t\t\t\tyear={year}\n\t\t\t\t\t\t\tplanLimit={summary?.planLimit ?? undefined}\n\t\t\t\t\t\t\tshowProjectedLine={contentState.showProjectedLine}\n\t\t\t\t\t\t\tvalueFormatter={formatBytes}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</React.Suspense>\n\t\t\t\t</ErrorBoundary>\n\n\t\t\t\t<Stack direction=\"row\" gap={30} alignItems=\"flex-start\">\n\t\t\t\t\t<TopAssets topAssets={topAssets} onAddFilter={addUsageFilter} isLoading={contentState.isUpdating} />\n\t\t\t\t\t<div className={styles.verticalDivider} />\n\t\t\t\t\t<TopCategories topCategories={topCategories} isLoading={contentState.isUpdating} />\n\t\t\t\t</Stack>\n\n\t\t\t\t{hasSharedHostnames && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Separator height={1} />\n\t\t\t\t\t\t<div className={styles.multiProjectDomain}>\n\t\t\t\t\t\t\t<T>Bandwidth usage is measured per domain. Since your main domain consumes bandwidth</T>\n\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t<T>across multiple projects, the usage is split among those projects.</T>\n\t\t\t\t\t\t\t<Link href={bandwidthTrackingReverseProxyArticleURL}>\n\t\t\t\t\t\t\t\t<T>&nbsp;Learn more here</T>\n\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import { UpsellType } from \"@framerjs/events\"\nimport { Button, Stack, Translatable as T } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport React, { startTransition } from \"react\"\nimport { UpsellUIInteraction, record } from \"web/lib/tracker.ts\"\nimport { usePurchaseOriginLocalStorage } from \"web/lib/usePurchaseOriginLocalStorage.ts\"\nimport { getUpsellCtaLabel, handleUpsellAction } from \"../../../projectbar/PublishLimitsTooltip.tsx\"\nimport type { BandwidthLimitUpsellResult } from \"../../../shared/UpsellModal/utils/bandwidthUpsellModals.tsx\"\nimport { UpsellAction, UpsellFeature } from \"../../Plans/Stripe/utils/upsell.ts\"\nimport * as styles from \"./BandwidthUsageUpgradeBanner.styles.ts\"\ninterface BandwidthUsageUpgradeBannerProps {\n\tbandwidthUpsell: BandwidthLimitUpsellResult\n}\n\nexport function BandwidthUsageUpgradeBanner({ bandwidthUpsell }: BandwidthUsageUpgradeBannerProps) {\n\tconst { updatePurchaseOrigin } = usePurchaseOriginLocalStorage()\n\tconst projectData = engine.stores.projectStore.useState()\n\n\tconst upsellPage: UpsellType =\n\t\tbandwidthUpsell.action === UpsellAction.Contact || bandwidthUpsell.action === UpsellAction.UpgradeToEnterprise\n\t\t\t? UpsellType.bandwidthEnterpriseUpsell\n\t\t\t: UpsellType.bandwidthUpsell\n\n\tReact.useEffect(() => {\n\t\trecord(\"ui_impression\", { page: upsellPage })\n\t}, [upsellPage])\n\n\tconst handleAction = () => {\n\t\tstartTransition(() => {\n\t\t\trecord(\"ui_interaction\", {\n\t\t\t\tpage: upsellPage,\n\t\t\t\tid: UpsellUIInteraction.navigateToPlans,\n\t\t\t})\n\n\t\t\tconst handleUpgrade = () => {\n\t\t\t\t// Set up purchase origin tracking\n\t\t\t\tconst licenseTypes = projectData.project\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tprojectId: projectData.project.id,\n\t\t\t\t\t\t\tsite: projectData.project.license.type,\n\t\t\t\t\t\t\tteam: projectData.project.teamLicenseType,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null\n\n\t\t\t\tif (licenseTypes) {\n\t\t\t\t\tconst licenseUpsellPage: UpsellType =\n\t\t\t\t\t\tbandwidthUpsell.action === UpsellAction.Contact ||\n\t\t\t\t\t\tbandwidthUpsell.action === UpsellAction.UpgradeToEnterprise\n\t\t\t\t\t\t\t? UpsellType.bandwidthEnterpriseUpsell\n\t\t\t\t\t\t\t: UpsellType.bandwidthUpsell\n\t\t\t\t\tupdatePurchaseOrigin(licenseUpsellPage, licenseTypes, null)\n\t\t\t\t}\n\n\t\t\t\tengine.stores.siteSettingsStore\n\t\t\t\t\t.setActiveTab({\n\t\t\t\t\t\ttab: SiteSettingsTabNames.plans,\n\t\t\t\t\t\tupsellFeature: UpsellFeature.bandwidthInGB,\n\t\t\t\t\t})\n\t\t\t\t\t.catch(unhandledError)\n\t\t\t}\n\n\t\t\thandleUpsellAction(engine, bandwidthUpsell, handleUpgrade)\n\t\t})\n\t}\n\n\treturn (\n\t\t<Stack gap={15} alignItems=\"center\" justifyContent=\"center\" direction=\"column\" className={styles.banner}>\n\t\t\t<div className={styles.title}>\n\t\t\t\t<T>You\u2019ve exceeded the limit</T>\n\t\t\t</div>\n\t\t\t<Stack className={styles.buttonWrapper}>\n\t\t\t\t<Button variant=\"primary\" onClick={handleAction}>\n\t\t\t\t\t<T>{getUpsellCtaLabel(bandwidthUpsell)}</T>\n\t\t\t\t</Button>\n\t\t\t</Stack>\n\t\t</Stack>\n\t)\n}\n", "import \"BandwidthUsageUpgradeBanner.styles_191uld0.wyw.css\"; export const banner = \"banner_bwgjqgg\";\nexport const title = \"title_tvlrm19\";\nexport const description = \"description_d1q9htpq\";\nexport const buttonWrapper = \"buttonWrapper_b17kknvq\";", "import { Stack } from \"@framerjs/fresco\"\nimport {\n\tBandwidthEvaluationMode,\n\tgetBandwidthLimitUpsell,\n} from \"document/components/chrome/shared/UpsellModal/utils/bandwidthUpsellModals.tsx\"\nimport engine from \"document/engine.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { UsageMetric, type UsageMetricProps } from \"../UsageMetric.tsx\"\nimport { BYTES_PER_UNIT } from \"../constants.ts\"\nimport type { UsageSummary } from \"../types.ts\"\nimport { formatBytes } from \"../utils/formatters.ts\"\nimport { BandwidthUsageUpgradeBanner } from \"./BandwidthUsageUpgradeBanner.tsx\"\n\ninterface BandwidthUsageMetricProps extends UsageMetricProps {\n\tvalue: number\n\tincludeDecimals?: boolean\n}\n\nfunction BandwidthUsageMetric({ title, value, isLoading = false, includeDecimals = true }: BandwidthUsageMetricProps) {\n\treturn (\n\t\t<UsageMetric\n\t\t\ttitle={title}\n\t\t\tisLoading={isLoading}\n\t\t\tvalue={value > 0 ? formatBytes(value, { includeDecimals }) : undefined}\n\t\t/>\n\t)\n}\n\nexport function BandwidthUsageSummaryRow({\n\tsummary,\n\tisLoading = false,\n}: {\n\tsummary: UsageSummary | null\n\tisLoading?: boolean\n}) {\n\tconst bandwidthUpsell = getBandwidthLimitUpsell({\n\t\tprojectStore: engine.stores.projectStore,\n\t\tevaluationMode: BandwidthEvaluationMode.CurrentMonthOnly,\n\t})\n\n\treturn (\n\t\t<Stack gap={30} justifyContent=\"space-between\">\n\t\t\t<Stack gap={10} alignItems=\"center\" direction=\"row\" justifyContent=\"space-between\">\n\t\t\t\t<BandwidthUsageMetric title=\"Total Bandwidth\" value={summary?.totalUsage ?? 0} isLoading={isLoading} />\n\t\t\t\t<BandwidthUsageMetric\n\t\t\t\t\ttitle=\"Plan Limit\"\n\t\t\t\t\tvalue={summary?.planLimit ?? 0}\n\t\t\t\t\tisLoading={isLoading}\n\t\t\t\t\tincludeDecimals={Number(summary?.planLimit) > BYTES_PER_UNIT.TB}\n\t\t\t\t/>\n\t\t\t\t<BandwidthUsageMetric title=\"Over Limit\" value={summary?.overage ?? 0} isLoading={isLoading} />\n\n\t\t\t\t{bandwidthUpsell && <BandwidthUsageUpgradeBanner bandwidthUpsell={bandwidthUpsell} />}\n\t\t\t</Stack>\n\n\t\t\t<Separator height={1} />\n\t\t</Stack>\n\t)\n}\n", "import React from \"react\"\nimport { getAssetName } from \"utils/getAssetName.ts\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../../../analytics/components/AnalyticsTable.tsx\"\nimport type { AnalyticsTableData } from \"../../../analytics/types.ts\"\nimport * as styles from \"../Usage.styles.ts\"\nimport type { BandwidthUsageTopAssets, UsageFilterOption } from \"../types.ts\"\nimport { formatBytes } from \"../utils/formatters.ts\"\nimport { IconFont, IconImage, IconJavaScript, IconOther, IconVideo } from \"./BandwidthCategoryIcons.tsx\"\n\nfunction getAssetIcon(assetPath: string): React.ReactElement {\n\tconst extension = assetPath.toLowerCase().split(\".\").pop()\n\n\tswitch (extension) {\n\t\tcase \"mp4\":\n\t\tcase \"webm\":\n\t\tcase \"avi\":\n\t\tcase \"mov\":\n\t\tcase \"mkv\":\n\t\t\treturn <IconVideo />\n\t\tcase \"jpg\":\n\t\tcase \"jpeg\":\n\t\tcase \"png\":\n\t\tcase \"gif\":\n\t\tcase \"svg\":\n\t\tcase \"webp\":\n\t\tcase \"ico\":\n\t\t\treturn <IconImage />\n\t\tcase \"js\":\n\t\tcase \"ts\":\n\t\tcase \"jsx\":\n\t\tcase \"tsx\":\n\t\tcase \"mjs\":\n\t\t\treturn <IconJavaScript />\n\t\tcase \"woff\":\n\t\tcase \"woff2\":\n\t\tcase \"ttf\":\n\t\tcase \"otf\":\n\t\tcase \"eot\":\n\t\t\treturn <IconFont />\n\t\tdefault:\n\t\t\treturn <IconOther />\n\t}\n}\n\nfunction normalizeTopAssetsData(topAssets: BandwidthUsageTopAssets): AnalyticsTableData[] {\n\tconst totalBytes = topAssets.reduce((sum, asset) => sum + asset.totalBytes, 0)\n\n\treturn topAssets.map(\n\t\t({ assetPath, totalBytes: assetBytes, assetUrl }): AnalyticsTableData => ({\n\t\t\tname: getAssetName(assetPath),\n\t\t\tfilterValue: assetPath,\n\t\t\tcount: assetBytes,\n\t\t\tpercentage: totalBytes > 0 ? (assetBytes / totalBytes) * 100 : 0,\n\t\t\ticon: getAssetIcon(assetPath),\n\t\t\thref: assetUrl,\n\t\t\ttooltip: \"\",\n\t\t}),\n\t)\n}\n\nexport function TopAssets({\n\ttopAssets,\n\tisLoading,\n\tonAddFilter,\n}: {\n\ttopAssets: BandwidthUsageTopAssets\n\tisLoading: boolean\n\tonAddFilter: (key: UsageFilterOption, value: string, valueLabel: string) => void\n}) {\n\tconst normalizedData = React.useMemo(() => normalizeTopAssetsData(topAssets), [topAssets])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle=\"Assets\"\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter=\"assetPath\"\n\t\t\tonClickRow={onAddFilter}\n\t\t\tkind={AnalyticsTableKind.Usage}\n\t\t\taction={<span className={styles.analyticsTableAction}>Total</span>}\n\t\t\tcountFormatter={formatBytes}\n\t\t/>\n\t)\n}\n", "/**\n * Extracts the filename from a path string.\n * Handles special cases like \"Site Modules\" that should be returned as-is.\n */\nexport function getAssetName(assetPath: string): string {\n\tif (assetPath === \"Site Modules\") {\n\t\treturn assetPath\n\t}\n\n\tif (assetPath === \"/\") return \"/\"\n\n\tconst segments = assetPath.split(\"/\")\n\tconst filename = segments[segments.length - 1]\n\n\t// If the path ends with a trailing slash (e.g. \"folder/\") then return the path itself\n\treturn filename || assetPath\n}\n", "export function IconVideo() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>Video</title>\n\t\t\t<path\n\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.614 2.891 4.419 2.885 4.259 2.973 C 4.099 3.061 4 3.229 4 3.411 L 4 8.589 C 4 8.771 4.099 8.939 4.259 9.027 C 4.419 9.115 4.614 9.109 4.768 9.011 L 8.837 6.422 C 8.981 6.33 9.069 6.171 9.069 6 C 9.069 5.829 8.981 5.67 8.837 5.578 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function IconImage() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>Image</title>\n\t\t\t<path\n\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 7.98 9 C 8.169 9 8.343 8.893 8.427 8.724 C 8.512 8.554 8.494 8.352 8.38 8.2 L 5.88 5 C 5.785 4.882 5.642 4.813 5.49 4.813 C 5.338 4.813 5.195 4.882 5.1 5 L 2.63 8.2 C 2.516 8.352 2.498 8.554 2.583 8.724 C 2.667 8.893 2.841 9 3.03 9 Z M 7.5 3.25 C 7.5 3.94 8.06 4.5 8.75 4.5 C 9.44 4.5 10 3.94 10 3.25 C 10 2.56 9.44 2 8.75 2 C 8.06 2 7.5 2.56 7.5 3.25 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function IconJavaScript() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>JavaScript</title>\n\t\t\t<path\n\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 3 4.25 C 3 4.664 3.336 5 3.75 5 L 8.25 5 C 8.664 5 9 4.664 9 4.25 C 9 3.836 8.664 3.5 8.25 3.5 L 3.75 3.5 C 3.336 3.5 3 3.836 3 4.25 Z M 3 7.75 C 3 8.164 3.336 8.5 3.75 8.5 L 6.25 8.5 C 6.664 8.5 7 8.164 7 7.75 C 7 7.336 6.664 7 6.25 7 L 3.75 7 C 3.336 7 3 7.336 3 7.75 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function IconFont() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>Font</title>\n\t\t\t<path\n\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 2.5 4 C 2.5 4.552 2.948 5 3.5 5 L 5 5 L 5 8.5 C 5 9.052 5.448 9.5 6 9.5 C 6.552 9.5 7 9.052 7 8.5 L 7 5 L 8.5 5 C 9.052 5 9.5 4.552 9.5 4 C 9.5 3.448 9.052 3 8.5 3 L 3.5 3 C 2.948 3 2.5 3.448 2.5 4 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function IconOther() {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"12\" fill=\"none\" overflow=\"visible\">\n\t\t\t<title>Other</title>\n\t\t\t<path\n\t\t\t\td=\"M 0 2.5 C 0 1.119 1.119 0 2.5 0 L 4 0 C 4.552 0 5 0.448 5 1 L 5 3 C 5 4.105 5.895 5 7 5 L 9 5 C 9.552 5 10 5.448 10 6 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 6.427 0.427 C 6.269 0.269 6 0.381 6 0.604 L 6 3 C 6 3.552 6.448 4 7 4 L 9.396 4 C 9.619 4 9.731 3.731 9.573 3.573 Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { noop } from \"@framerjs/shared/src/noop.ts\"\nimport React from \"react\"\nimport { whatAreSiteModulesArticleURL } from \"utils/staticURLs.ts\"\nimport { AnalyticsTable, AnalyticsTableKind } from \"../../../analytics/components/AnalyticsTable.tsx\"\nimport type { AnalyticsTableData } from \"../../../analytics/types.ts\"\nimport * as styles from \"../Usage.styles.ts\"\nimport type { BandwidthUsageTopCategories } from \"../types.ts\"\nimport { formatBytes } from \"../utils/formatters.ts\"\nimport { IconFont, IconImage, IconJavaScript, IconOther, IconVideo } from \"./BandwidthCategoryIcons.tsx\"\n\n// Special value returned by the backend for aggregated site resources\nconst SITE_MODULES = \"Site Modules\"\n\nfunction categorizeName(category: string): string {\n\tswitch (category) {\n\t\tcase \"videos\":\n\t\t\treturn \"Videos\"\n\t\tcase \"images\":\n\t\t\treturn \"Images\"\n\t\tcase \"javascript\":\n\t\t\treturn \"JavaScript\"\n\t\tcase \"other\":\n\t\t\treturn \"Other\"\n\t\tcase \"fonts\":\n\t\t\treturn \"Fonts\"\n\t\tcase SITE_MODULES:\n\t\t\treturn SITE_MODULES\n\t\tdefault:\n\t\t\treturn category.charAt(0).toUpperCase() + category.slice(1)\n\t}\n}\n\nfunction getCategoryIcon(category: string): React.ReactElement {\n\tswitch (category) {\n\t\tcase \"videos\":\n\t\t\treturn <IconVideo />\n\t\tcase \"images\":\n\t\t\treturn <IconImage />\n\t\tcase \"javascript\":\n\t\t\treturn <IconJavaScript />\n\t\tcase \"fonts\":\n\t\t\treturn <IconFont />\n\t\tcase \"other\":\n\t\tcase SITE_MODULES:\n\t\t\treturn <IconOther />\n\t\tdefault:\n\t\t\treturn <IconOther />\n\t}\n}\n\nfunction normalizeTopCategoriesData(topCategories: BandwidthUsageTopCategories): AnalyticsTableData[] {\n\tconst totalBytes = topCategories.reduce((sum, category) => sum + category.totalBytes, 0)\n\n\treturn topCategories.map(\n\t\t({ category, totalBytes: categoryBytes }): AnalyticsTableData => ({\n\t\t\tname: categorizeName(category),\n\t\t\tfilterValue: category,\n\t\t\tcount: categoryBytes,\n\t\t\tpercentage: totalBytes > 0 ? (categoryBytes / totalBytes) * 100 : 0,\n\t\t\ticon: getCategoryIcon(category),\n\t\t\thref: category === SITE_MODULES ? whatAreSiteModulesArticleURL : undefined,\n\t\t}),\n\t)\n}\n\nexport function TopCategories({\n\ttopCategories,\n\tisLoading = false,\n}: {\n\ttopCategories: BandwidthUsageTopCategories\n\tisLoading?: boolean\n}) {\n\tconst normalizedData = React.useMemo(() => normalizeTopCategoriesData(topCategories), [topCategories])\n\n\treturn (\n\t\t<AnalyticsTable\n\t\t\ttitle=\"Categories\"\n\t\t\tdata={normalizedData}\n\t\t\tisLoading={isLoading}\n\t\t\tsectionFilter=\"assetPath\"\n\t\t\tonClickRow={noop}\n\t\t\tkind={AnalyticsTableKind.Usage}\n\t\t\taction={<span className={styles.analyticsTableAction}>Total</span>}\n\t\t\tdisabled\n\t\t\tcountFormatter={formatBytes}\n\t\t/>\n\t)\n}\n", "import { emptyArray, unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { useEffect, useMemo } from \"react\"\n\nimport { BYTES_PER_UNIT, MAX_TOP_ASSETS } from \"../constants.ts\"\nimport type {\n\tBandwidthContentState,\n\tUsageDailyTotal,\n\tBandwidthUsageState,\n\tUsageSummary,\n\tBandwidthUsageTopAsset,\n\tBandwidthUsageTopAssets,\n\tUsageTopCategory,\n} from \"../types.ts\"\n\nexport function calculateBandwidthSummary(totalBytes: number, bandwidthLimitInGB: number | null): UsageSummary {\n\tconst totalUsage = totalBytes\n\tconst planLimit = bandwidthLimitInGB ? bandwidthLimitInGB * BYTES_PER_UNIT.GB : null\n\tconst overage = planLimit ? Math.max(0, totalUsage - planLimit) : 0\n\n\treturn { totalUsage, planLimit, overage }\n}\n\nexport function calculateTopAssets(response: BandwidthUsageState): BandwidthUsageTopAssets {\n\tconst assets = response.individualAssets.map(asset => ({\n\t\tassetPath: asset.assetPath,\n\t\ttotalBytes: asset.totalBytes,\n\t\tassetUrl: asset.assetUrl,\n\t}))\n\n\treturn assets.sort((a, b) => b.totalBytes - a.totalBytes).slice(0, MAX_TOP_ASSETS)\n}\n\nexport function useBandwidthUsageData() {\n\tconst {\n\t\tbandwidthLoading,\n\t\tbandwidthData: bandwidthResponse,\n\t\tmonth,\n\t\tyear,\n\t\tfilters,\n\t} = engine.stores.usageStore.useState(state => ({\n\t\tbandwidthLoading: state.bandwidthDataLoading,\n\t\tbandwidthData: state.bandwidthData,\n\t\tmonth: state.month,\n\t\tyear: state.year,\n\t\tfilters: state.filters,\n\t}))\n\n\tconst bandwidthLimitInGB = engine.stores.projectStore.useState(state => state.resourceLimits?.bandwidthInGB)\n\n\tuseEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tvoid engine.stores.usageStore.fetchBandwidthData().catch(unhandledError)\n\t\t}, \"nonUserEvent\")\n\t}, [month, year, filters])\n\n\tconst contentState = useMemo((): BandwidthContentState => {\n\t\tconst isLoading = bandwidthLoading\n\t\tconst response = bandwidthResponse\n\t\tif (isLoading && !response) {\n\t\t\treturn { status: \"loading\" }\n\t\t}\n\n\t\tconst responseMonth = response?.month ?? month\n\t\tconst responseYear = response?.year ?? year\n\n\t\tlet summary: UsageSummary | null = null\n\t\tconst monthPrefix = `${responseYear}-${String(responseMonth + 1).padStart(2, \"0\")}-`\n\t\tconst monthlyTotalBytes =\n\t\t\tresponse?.dailyTotals\n\t\t\t\t?.filter(daily => daily.date.startsWith(monthPrefix))\n\t\t\t\t.reduce((sum, daily) => sum + daily.totalBytes, 0) ?? 0\n\n\t\tconst usage = response?.dailyTotals.map(daily => ({ date: daily.date, usage: daily.totalBytes }))\n\n\t\tif (monthlyTotalBytes > 0 || bandwidthLimitInGB !== null) {\n\t\t\tsummary = calculateBandwidthSummary(monthlyTotalBytes, bandwidthLimitInGB ?? null)\n\t\t}\n\n\t\treturn {\n\t\t\tstatus: \"success\",\n\t\t\tusage: usage || emptyArray<UsageDailyTotal>(),\n\t\t\tsummary,\n\t\t\ttopAssets: response ? calculateTopAssets(response) : emptyArray<BandwidthUsageTopAsset>(),\n\t\t\ttopCategories: response?.assetCategories || emptyArray<UsageTopCategory>(),\n\t\t\tmonth: responseMonth,\n\t\t\tyear: responseYear,\n\t\t\thasSharedHostnames: Boolean(response?.hasSharedHostnames),\n\t\t\tshowProjectedLine: response?.showProjectedLine ?? true,\n\t\t\tisUpdating: isLoading,\n\t\t}\n\t}, [bandwidthLoading, bandwidthResponse, month, year, bandwidthLimitInGB])\n\n\treturn contentState\n}\n", "import { Tabs, TabsItem } from \"@framerjs/fresco\"\nimport type { UsageType } from \"./types.ts\"\n\nconst usageTypeOptions: { type: UsageType; label: string }[] = [\n\t{ type: \"bandwidth\", label: \"Bandwidth\" },\n\t{ type: \"agents\", label: \"Agents\" },\n]\n\ninterface UsageTypeSelectorProps {\n\tactiveType: UsageType\n\tonSelect: (type: UsageType) => void\n}\n\nexport function UsageTypeSelector({ activeType, onSelect }: UsageTypeSelectorProps) {\n\treturn (\n\t\t<Tabs value={activeType} onChange={onSelect}>\n\t\t\t{usageTypeOptions.map(({ type, label }) => (\n\t\t\t\t<TabsItem key={type} value={type}>\n\t\t\t\t\t{label}\n\t\t\t\t</TabsItem>\n\t\t\t))}\n\t\t</Tabs>\n\t)\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useCallback, useEffect } from \"react\"\nimport type { UsageFilterOption, UsageType } from \"./types.ts\"\n\nexport function useUsagePageState() {\n\tconst selectedUsageType = engine.stores.siteSettingsStore.useState(state => {\n\t\tif (state.active?.tab !== SiteSettingsTabNames.usage) {\n\t\t\treturn \"bandwidth\"\n\t\t}\n\n\t\treturn state.active.usageType\n\t})\n\tconst { month, year, filters } = engine.stores.usageStore.useState(state => ({\n\t\tmonth: state.month,\n\t\tyear: state.year,\n\t\tfilters: state.filters,\n\t}))\n\n\tuseEffect(() => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.usageStore.setDefaultFilters(selectedUsageType)\n\t\t}, \"nonUserEvent\")\n\t}, [selectedUsageType])\n\n\tconst setMonthAndYear = useCallback((newMonth: number, newYear: number) => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.usageStore.setMonthAndYear(newMonth, newYear)\n\t\t}, \"nonUserEvent\")\n\t}, [])\n\n\tconst setSelectedUsageType = useCallback((type: UsageType) => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tvoid engine.stores.siteSettingsStore\n\t\t\t\t.setActiveTab({ tab: SiteSettingsTabNames.usage, usageType: type })\n\t\t\t\t.catch(unhandledError)\n\t\t}, \"nonUserEvent\")\n\t}, [])\n\n\tconst removeFilter = useCallback((key: UsageFilterOption) => {\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.stores.usageStore.removeFilter(key)\n\t\t}, \"nonUserEvent\")\n\t}, [])\n\n\treturn { selectedUsageType, setSelectedUsageType, month, year, setMonthAndYear, filters, removeFilter }\n}\n", "import type { CustomHostname, VersionDeployment } from \"@framerjs/app-shared\"\nimport { DeploymentStrategy } from \"@framerjs/app-shared\"\nimport { ProtectedStagingValue } from \"@framerjs/app-shared/src/Deployments.ts\"\nimport { Button, Link, Stack, Toggle, Translatable as T, UpgradeBadge } from \"@framerjs/fresco\"\nimport { unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport { useFeatureIsOn } from \"app/features.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport { PublishStatus } from \"document/stores/PublishStatus.ts\"\nimport type { DeploymentSettings } from \"document/stores/PublishStore.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { stagingAcademyLessonURL } from \"utils/staticURLs.ts\"\nimport { Separator } from \"web/components/Separator.tsx\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { useInterval } from \"web/lib/useInterval.ts\"\nimport { useProjectPermissions } from \"web/pages/project/permissions/useProjectPermissions.ts\"\nimport { showStagingUpsellModal } from \"../shared/UpsellModal/utils/siteSettingsUpsellModals.tsx\"\nimport { Infobox } from \"./Infobox.tsx\"\nimport { PublishToCustomDomainModal } from \"./PublishToCustomDomainModal.tsx\"\nimport * as settingInputStyles from \"./SettingInput.styles.ts\"\nimport * as styles from \"./SiteSettings.styles.ts\"\nimport { VersionsView, VersionsViewEmpty, VersionsViewSkeleton } from \"./VersionsView.tsx\"\n\nconst resetVersions = () => {\n\tengine.scheduler.processWhenReady(() => {\n\t\tengine.stores.publishStore.resetVersions()\n\t})\n}\n\nconst openDomainsTab = () => void engine.stores.siteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.domains })\n\nexport function Versions({ id, showDeploymentIssues }: { id?: string; showDeploymentIssues?: boolean }) {\n\tconst isReady = engine.stores.loadingStore.useState(state => state.isReady)\n\tconst permissions = useProjectPermissions()\n\n\tconst {\n\t\tdefaultHostname,\n\t\tcustomHostname,\n\t\tdeploymentStrategy,\n\t\tdeploymentSettings,\n\t\tversions,\n\t\tdidLoadInitialVersionDeployments,\n\t\tcanLoadMoreVersionDeployments,\n\t\tpublishStatus,\n\t} = engine.stores.publishStore.useState()\n\n\tconst [pendingCustomDomainDeployment, setPendingCustomDomainDeployment] = useState<VersionDeployment>()\n\tconst [isLoadingMore, setIsLoadingMore] = useState(false)\n\tconst [, setForceUpdateCount] = useState(0)\n\tconst forceRerender = useCallback(() => setForceUpdateCount(count => count + 1), [])\n\n\t// Force a re-render every minute, so the timestamps are updated in \"real time\".\n\tuseInterval(forceRerender, 60 * 1000)\n\n\tconst hasVersions = versions.length > 0\n\n\t// Enable/Disable Staging\n\tconst enableDeploymentStrategyControls =\n\t\t// deploymentStrategy is undefined while we're still loading deployment settings\n\t\ttypeof deploymentStrategy !== \"undefined\" &&\n\t\tisReady &&\n\t\tpermissions.canEditSiteSettings &&\n\t\tpermissions.canPublish &&\n\t\tpublishStatus !== PublishStatus.Unpublished\n\n\t// When Staging is enabled, allow user to hit the \"Deploy\" button to publish a specific version to production\n\tconst showDeployedToIndicators =\n\t\tdeploymentStrategy === DeploymentStrategy.Manual &&\n\t\t!!defaultHostname &&\n\t\t!!customHostname &&\n\t\tpublishStatus !== PublishStatus.Unpublished\n\n\tconst handlePublishToCustomDomain = engine.scheduler.wrapHandler(async () => {\n\t\tif (!pendingCustomDomainDeployment) return\n\t\tawait engine.stores.publishStore.updateCustomDomain(pendingCustomDomainDeployment)\n\t})\n\n\tasync function handleChangeDeploymentSettings(settings: DeploymentSettings) {\n\t\tawait engine.stores.publishStore.updateProjectSettings({ deploymentSettings: settings })\n\t}\n\n\tconst minRecordsForScrollingPagination = 10\n\n\tconst branchId = useEngineState(() => engine.stores.treeStore.branchId, [], EngineChange.Tree)\n\tconst lastLoadedBranchRef = useRef<string | null>(branchId)\n\n\tuseEffect(() => {\n\t\tconst branchChanged = lastLoadedBranchRef.current !== branchId\n\t\tif (branchChanged) {\n\t\t\tlastLoadedBranchRef.current = branchId\n\t\t}\n\n\t\tif (branchChanged || !didLoadInitialVersionDeployments) {\n\t\t\tvoid engine.stores.publishStore.loadVersions()\n\t\t\treturn\n\t\t}\n\n\t\t// DynamoDB can read up to a limit of 1MB data when querying. For some projects\n\t\t// this means a full 'page' of records is not returned, so we want to fetch more\n\t\t// until the UI is paginatable by scrolling.\n\t\tif (versions.length < minRecordsForScrollingPagination && canLoadMoreVersionDeployments) {\n\t\t\tvoid engine.stores.publishStore.loadVersions()\n\t\t}\n\t}, [branchId, didLoadInitialVersionDeployments, canLoadMoreVersionDeployments, versions])\n\n\tconst isLoadingInitial =\n\t\t!didLoadInitialVersionDeployments ||\n\t\t(versions.length < minRecordsForScrollingPagination && canLoadMoreVersionDeployments)\n\n\tconst paginateVersions = useCallback(() => {\n\t\tif (isLoadingMore) return\n\t\tif (\n\t\t\tengine.stores.publishStore.didLoadInitialVersionDeployments &&\n\t\t\t!engine.stores.publishStore.canLoadMoreVersionDeployments\n\t\t) {\n\t\t\treturn\n\t\t}\n\n\t\tsetIsLoadingMore(true)\n\t\tvoid engine.stores.publishStore\n\t\t\t.loadVersions()\n\t\t\t.catch(unhandledError)\n\t\t\t.finally(() => {\n\t\t\t\tsetIsLoadingMore(false)\n\t\t\t})\n\t}, [isLoadingMore])\n\n\t// Reset versions explicitly when this component unmounts. This way, we ensure the latest\n\t// versions to be returned from the API when this component remounts.\n\tuseEffect(() => resetVersions, [])\n\n\treturn (\n\t\t<>\n\t\t\t<Stack gap={30} className={styles.wideContainer}>\n\t\t\t\t<Stack gap={15}>\n\t\t\t\t\t<StagingSettingSection\n\t\t\t\t\t\tcustomHostname={customHostname}\n\t\t\t\t\t\tdeploymentSettings={deploymentSettings}\n\t\t\t\t\t\tenableDeploymentStrategyControls={enableDeploymentStrategyControls}\n\t\t\t\t\t\thandleChangeDeploymentSettings={handleChangeDeploymentSettings}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<Separator height={1} />\n\t\t\t\t</Stack>\n\n\t\t\t\t<Stack gap={styles.sectionTitleGap} className={styles.versionsSection}>\n\t\t\t\t\t<Stack className={styles.sectionTitle} direction=\"row\" alignItems=\"center\">\n\t\t\t\t\t\t<T>Versions</T>\n\t\t\t\t\t</Stack>\n\t\t\t\t\t{!permissions.canPublish && (\n\t\t\t\t\t\t<Infobox>\n\t\t\t\t\t\t\t<T>You do not have permission to publish to the live site</T>\n\t\t\t\t\t\t</Infobox>\n\t\t\t\t\t)}\n\t\t\t\t\t<div className={styles.versionsProperties}>\n\t\t\t\t\t\t{isLoadingInitial && <VersionsViewSkeleton />}\n\n\t\t\t\t\t\t{!isLoadingInitial && !hasVersions && <VersionsViewEmpty />}\n\n\t\t\t\t\t\t{!isLoadingInitial && hasVersions && (\n\t\t\t\t\t\t\t<VersionsView\n\t\t\t\t\t\t\t\tversions={versions}\n\t\t\t\t\t\t\t\tonPaginateVersions={paginateVersions}\n\t\t\t\t\t\t\t\tisPaginatingVersions={isLoadingMore}\n\t\t\t\t\t\t\t\tcustomHostname={customHostname}\n\t\t\t\t\t\t\t\tdefaultHostname={defaultHostname}\n\t\t\t\t\t\t\t\tcanDeployToCustomDomain={isReady && permissions.canPublish && showDeployedToIndicators}\n\t\t\t\t\t\t\t\tonDeployToCustomDomain={(version: VersionDeployment) => setPendingCustomDomainDeployment(version)}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\tshowDeploymentIssues={showDeploymentIssues}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\n\t\t\t{pendingCustomDomainDeployment && customHostname && (\n\t\t\t\t<PublishToCustomDomainModal\n\t\t\t\t\tonClose={() => setPendingCustomDomainDeployment(undefined)}\n\t\t\t\t\tonConfirm={handlePublishToCustomDomain}\n\t\t\t\t\tversion={pendingCustomDomainDeployment}\n\t\t\t\t\thostname={customHostname.hostname}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\ninterface StagingSettingSectionProps {\n\tdeploymentSettings?: DeploymentSettings\n\tcustomHostname?: CustomHostname\n\tenableDeploymentStrategyControls: boolean\n\thandleChangeDeploymentSettings: (deploymentSettings: DeploymentSettings) => Promise<void>\n}\n\nfunction StagingSettingSection({\n\tdeploymentSettings,\n\tcustomHostname,\n\tenableDeploymentStrategyControls,\n\thandleChangeDeploymentSettings,\n}: StagingSettingSectionProps) {\n\tconst canUseStagingEnvironment = useFeatureIsOn(\"canUseStagingEnvironment\")\n\tconst upsellStagingEnvironment = !canUseStagingEnvironment\n\n\treturn (\n\t\t<Stack gap={styles.sectionTitleGap}>\n\t\t\t<div className={styles.sectionTitle}>\n\t\t\t\t<T>Preview</T>\n\t\t\t</div>\n\t\t\t{customHostname ? (\n\t\t\t\t<PreviewDeploymentControls\n\t\t\t\t\tcontrolsEnabled={enableDeploymentStrategyControls}\n\t\t\t\t\tcanUseStagingEnvironment={canUseStagingEnvironment}\n\t\t\t\t\tupsellStagingEnvironment={upsellStagingEnvironment}\n\t\t\t\t\tdeploymentSettings={deploymentSettings}\n\t\t\t\t\tonChangeDeploymentSettings={handleChangeDeploymentSettings}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<ConnectCustomDomain />\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n\nfunction ConnectCustomDomain() {\n\treturn (\n\t\t<Stack gap={10} direction=\"row\" justifyContent=\"space-between\" alignItems=\"center\" className={styles.preference}>\n\t\t\t<T>Connect a Custom Domain to enable this setting.</T>\n\t\t\t<Button onClick={openDomainsTab} className={styles.connectDomainButton}>\n\t\t\t\tConnect Domain\n\t\t\t</Button>\n\t\t</Stack>\n\t)\n}\n\nfunction PreviewDeploymentControls({\n\tcontrolsEnabled,\n\tcanUseStagingEnvironment,\n\tupsellStagingEnvironment,\n\tdeploymentSettings,\n\tonChangeDeploymentSettings,\n}: {\n\tcontrolsEnabled: boolean\n\tcanUseStagingEnvironment: boolean\n\tupsellStagingEnvironment: boolean\n\t/** Can be `undefined` if the project is still loading. */\n\tdeploymentSettings: DeploymentSettings | undefined\n\tonChangeDeploymentSettings: (deploymentSettings: DeploymentSettings) => Promise<void>\n}) {\n\tconst protectedStagingIsOn = useExperimentIsOn(\"protectedStaging\")\n\n\tconst stagingEnabled = deploymentSettings?.deploymentStrategy === DeploymentStrategy.Manual\n\n\tconst handleStagingToggle = useCallback(\n\t\t(checked: boolean) => {\n\t\t\tif (!canUseStagingEnvironment && checked) {\n\t\t\t\tshowStagingUpsellModal(engine, \"settings\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsVersions, id: UIInteraction.changeDeploymentStrategy })\n\t\t\tif (checked) {\n\t\t\t\tlet protectedStaging: ProtectedStagingValue | undefined = undefined\n\t\t\t\tif (protectedStagingIsOn) {\n\t\t\t\t\tprotectedStaging = ProtectedStagingValue.On\n\t\t\t\t}\n\t\t\t\tvoid onChangeDeploymentSettings({\n\t\t\t\t\tdeploymentStrategy: DeploymentStrategy.Manual,\n\t\t\t\t\tprotectedStaging,\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tvoid onChangeDeploymentSettings({\n\t\t\t\t\tdeploymentStrategy: DeploymentStrategy.AlwaysLatest,\n\t\t\t\t\tprotectedStaging: protectedStagingIsOn ? ProtectedStagingValue.Off : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[canUseStagingEnvironment, onChangeDeploymentSettings, protectedStagingIsOn],\n\t)\n\n\tconst handleProtectedToggle = useCallback(\n\t\t(checked: boolean) => {\n\t\t\tif (!deploymentSettings) return\n\t\t\tif (!stagingEnabled) return\n\t\t\trecord(\"ui_interaction\", { page: Pages.siteSettingsVersions, id: UIInteraction.changeProtectedStaging })\n\t\t\tvoid onChangeDeploymentSettings({\n\t\t\t\tdeploymentStrategy: DeploymentStrategy.Manual,\n\t\t\t\tprotectedStaging: checked ? ProtectedStagingValue.On : ProtectedStagingValue.Off,\n\t\t\t})\n\t\t},\n\t\t[deploymentSettings, onChangeDeploymentSettings, stagingEnabled],\n\t)\n\n\treturn (\n\t\t<Stack gap={0}>\n\t\t\t<div className={cx(settingInputStyles.toggleRow, styles.previewStagingToggleRow)}>\n\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t<Stack direction=\"row\" alignItems=\"center\" gap={8}>\n\t\t\t\t\t\t<label htmlFor=\"preview-staging-toggle\" className={styles.previewSettingLabel}>\n\t\t\t\t\t\t\t<T>Staging</T>\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t{upsellStagingEnvironment && <UpgradeBadge onClick={() => showStagingUpsellModal(engine, \"settings\")} />}\n\t\t\t\t\t</Stack>\n\t\t\t\t\t<span\n\t\t\t\t\t\tid=\"preview-staging-description\"\n\t\t\t\t\t\tclassName={cx(styles.settingDescriptionSecondary, styles.previewStagingDescription)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\tPreview your changes on your staging URL and manually select a version to deploy to your custom Domain.\n\t\t\t\t\t\t</T>{\" \"}\n\t\t\t\t\t\t<Link variant=\"linkLined\" href={stagingAcademyLessonURL} rel=\"noopener noreferrer\">\n\t\t\t\t\t\t\t<T>Learn more</T>\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</span>\n\t\t\t\t</Stack>\n\t\t\t\t<Toggle\n\t\t\t\t\tid=\"preview-staging-toggle\"\n\t\t\t\t\tsmall\n\t\t\t\t\tenabled={controlsEnabled}\n\t\t\t\t\tvalue={stagingEnabled}\n\t\t\t\t\tonChange={handleStagingToggle}\n\t\t\t\t\taria-describedby=\"preview-staging-description\"\n\t\t\t\t/>\n\t\t\t</div>\n\n\t\t\t{protectedStagingIsOn && (\n\t\t\t\t<>\n\t\t\t\t\t<div className={styles.previewStagingDividerSpacing}>\n\t\t\t\t\t\t<Separator height={1} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tsettingInputStyles.toggleRow,\n\t\t\t\t\t\t\tstyles.previewStagingToggleRow,\n\t\t\t\t\t\t\t!stagingEnabled && styles.previewProtectedStagingRowMuted,\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Stack gap={5} className={settingInputStyles.wrapper}>\n\t\t\t\t\t\t\t<label htmlFor=\"protected-staging-toggle\" className={styles.previewSettingLabel}>\n\t\t\t\t\t\t\t\t<T>Protected Staging</T>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tid=\"protected-staging-description\"\n\t\t\t\t\t\t\t\tclassName={cx(styles.settingDescriptionSecondary, styles.previewStagingDescription)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<T>\n\t\t\t\t\t\t\t\t\tWhen enabled, only users with a Framer account and at least viewer permissions will be able to view\n\t\t\t\t\t\t\t\t\tthe staging URL.\n\t\t\t\t\t\t\t\t</T>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t<Toggle\n\t\t\t\t\t\t\tid=\"protected-staging-toggle\"\n\t\t\t\t\t\t\tsmall\n\t\t\t\t\t\t\tenabled={controlsEnabled && stagingEnabled}\n\t\t\t\t\t\t\tvalue={deploymentSettings?.protectedStaging === ProtectedStagingValue.On}\n\t\t\t\t\t\t\tonChange={handleProtectedToggle}\n\t\t\t\t\t\t\taria-describedby=\"protected-staging-description\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stack>\n\t)\n}\n", "import \"Infobox.styles_1vy73dh.wyw.css\"; export const wrapper = \"wrapper_wyswljn\";\nexport const icon = \"icon_i1yw06um\";", "import { IconInfo, Stack } from \"@framerjs/fresco\"\nimport type React from \"react\"\nimport * as styles from \"./Infobox.styles.ts\"\n\ninterface Props {\n\tchildren?: React.ReactNode\n}\n\nexport function Infobox({ children }: Props) {\n\treturn (\n\t\t<Stack className={styles.wrapper} direction=\"row\" gap={10} alignItems=\"center\">\n\t\t\t<IconInfo className={styles.icon} />\n\t\t\t<div>{children}</div>\n\t\t</Stack>\n\t)\n}\n", "import type { VersionDeployment } from \"@framerjs/app-shared\"\nimport { DeploymentStatus } from \"@framerjs/app-shared\"\nimport { ConfirmationModal } from \"@framerjs/fresco\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type React from \"react\"\nimport { useState } from \"react\"\n\ninterface Props {\n\tversion: VersionDeployment\n\thostname: string\n\tonClose: () => void\n\tonConfirm: () => Promise<void>\n\tzIndex?: number\n}\n\nexport function PublishToCustomDomainModal({ version, hostname, onClose, onConfirm, zIndex }: Props) {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst [isPublishing, setIsPublishing] = useState(false)\n\n\tasync function handleConfirm() {\n\t\tsetIsPublishing(true)\n\t\tawait onConfirm()\n\t\tonClose()\n\t}\n\n\tconst warning = getWarning(version)\n\tconst description = getDescription(version.id, hostname, warning)\n\n\treturn (\n\t\t<ConfirmationModal\n\t\t\ttitle=\"Publish Version to Custom Domain\"\n\t\t\tdescription={description}\n\t\t\tcancelLabel=\"Cancel\"\n\t\t\tonCancel={onClose}\n\t\t\tvariant={warning !== undefined ? \"destructive\" : undefined}\n\t\t\tconfirmLabel=\"Confirm\"\n\t\t\tconfirmButtonLoading={isPublishing}\n\t\t\tconfirmButtonEnabled={!isPublishing}\n\t\t\tcancelButtonEnabled={!isPublishing}\n\t\t\tonConfirm={handleConfirm}\n\t\t\tonDismiss={onClose}\n\t\t\tzIndex={zIndex}\n\t\t\tlegacy={!isAgentExperimentOn}\n\t\t/>\n\t)\n}\n\nfunction getWarning(version: VersionDeployment) {\n\tif (version.status === DeploymentStatus.SpaReady) {\n\t\treturn `This version is still being optimized. Unoptimized pages can impact website's performance and SEO.`\n\t} else if (\n\t\tversion.status === DeploymentStatus.SsgPipelineFailed ||\n\t\tversion.status === DeploymentStatus.SsgReadyWithErrors\n\t) {\n\t\treturn `This version has optimization issues. Unoptimized pages can impact website's performance and SEO.`\n\t}\n}\n\nfunction getDescription(versionId: string, hostname: string, warning: React.ReactNode | undefined) {\n\tconst question = `Are you sure you want to publish version ${versionId} to ${hostname}?`\n\n\tif (!warning) {\n\t\treturn question\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{question}\n\t\t\t<br />\n\t\t\t<br />\n\t\t\t{warning}\n\t\t</>\n\t)\n}\n", "import type { CustomHostname, DefaultHostname, VersionDeployment } from \"@framerjs/app-shared\"\nimport { hasOptimizationIssue } from \"@framerjs/app-shared\"\nimport {\n\tBadge,\n\ttype BadgeProps,\n\tButton,\n\tCopyButton,\n\tIconCrossCircle,\n\tLink,\n\tScroll,\n\tSpinner,\n\tTranslatable as T,\n\ttruncateWithEllipsis,\n} from \"@framerjs/fresco\"\nimport { palette } from \"@framerjs/fresco/tokens\"\nimport { assert, assertNever, debounce, getLogger, unhandledError } from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIs } from \"app/experiments.ts\"\nimport { format, parseISO } from \"date-fns\"\nimport engine from \"document/engine.ts\"\nimport { motion } from \"framer-motion\"\nimport { ChangeRow } from \"history/ChangeRow.tsx\"\nimport type React from \"react\"\nimport { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { Pages, UIInteraction, record } from \"web/lib/tracker.ts\"\nimport { parseChanges } from \"web/pages/project/components/PublishPopover/utils/changeSummary.ts\"\nimport { RelativeTime } from \"./RelativeTime.tsx\"\nimport { StatusIndicatorEnum, deriveIndicatorStatus, getStatusIndicatorLabel } from \"./StatusIndicator.tsx\"\nimport * as styles from \"./VersionsView.styles.ts\"\nimport { openOptimizationSupportArticle } from \"./openSupportArticle.ts\"\n\nconst log = getLogger(\"VersionsView\")\n\nconst crossfadeAnimation = {\n\tinitial: { opacity: 0 },\n\tanimate: { opacity: 1 },\n\ttransition: { duration: 0.3 },\n}\n\ninterface VersionsViewProps {\n\tversions: VersionDeployment[]\n\tonPaginateVersions: () => void\n\tisPaginatingVersions: boolean\n\tcustomHostname: CustomHostname | undefined\n\tdefaultHostname: DefaultHostname | undefined\n\tcanDeployToCustomDomain: boolean\n\tonDeployToCustomDomain: (version: VersionDeployment) => void\n\tid?: string\n\tshowDeploymentIssues?: boolean\n}\n\nfunction parseSummary(changeSummary: VersionDeployment[\"changeSummary\"]) {\n\tif (!changeSummary) return\n\ttry {\n\t\treturn parseChanges(changeSummary)\n\t} catch (e) {\n\t\tlog.error(e)\n\t}\n}\n\nexport function VersionsView(props: VersionsViewProps) {\n\tconst [selectedId, setSelectedId] = useState<VersionDeployment[\"id\"]>(() => {\n\t\tconst initial = props.id && props.versions.find(version => version.id === props.id)\n\t\tif (initial) return initial.id\n\n\t\tconst latest = props.versions[0]\n\t\tassert(latest, \"mounted without any versions\")\n\t\treturn latest.id\n\t})\n\n\tconst selected = props.versions.find(version => version.id === selectedId)\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intended to happen once, on mount\n\tuseEffect(() => {\n\t\tif (selected && props.showDeploymentIssues) {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tengine.stores.publishStore.openOptimizationIssuesWindow(selected)\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tconst [scrolledToTop, setScrolledToTop] = useState(true)\n\n\tconst debouncedPaginate = useCallback(debounce(props.onPaginateVersions, 200), [])\n\n\tconst isOnMainBranch = engine.stores.treeStore.isOnMainBranch()\n\n\tfunction handleScroll(event: React.UIEvent<HTMLDivElement, UIEvent>) {\n\t\tconst { scrollTop, scrollHeight, clientHeight } = event.currentTarget\n\n\t\t// required to conditionally show top mask on list\n\t\tsetScrolledToTop(scrollTop === 0)\n\n\t\t// pagination logic\n\t\tconst thresholdPx = 100 // arbitrary\n\t\tconst isNearBottom = scrollTop + clientHeight >= scrollHeight - thresholdPx\n\n\t\tif (isNearBottom) {\n\t\t\tdebouncedPaginate()\n\t\t}\n\t}\n\n\tfunction isDeployedToDefault(deploymentId: VersionDeployment[\"id\"]) {\n\t\tif (!props.defaultHostname) return false\n\t\treturn props.defaultHostname.deploymentId === deploymentId\n\t}\n\n\tfunction isDeployedToCustom(deploymentId: VersionDeployment[\"id\"]) {\n\t\tif (!props.customHostname) return false\n\t\treturn props.customHostname.deploymentId === deploymentId\n\t}\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Scroll className={cx(styles.versionsList, !scrolledToTop && styles.scrolling)} onScroll={handleScroll}>\n\t\t\t\t{props.versions.map(version => (\n\t\t\t\t\t<VersionItem\n\t\t\t\t\t\tkey={version.id}\n\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\tsetSelectedId={setSelectedId}\n\t\t\t\t\t\tisSelected={selectedId === version.id}\n\t\t\t\t\t\tisDeployedToCustom={isDeployedToCustom(version.id)}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\n\t\t\t\t{props.isPaginatingVersions && (\n\t\t\t\t\t<div className={styles.versionListSpinner}>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Scroll>\n\n\t\t\t{selected && (\n\t\t\t\t<VersionDetails\n\t\t\t\t\tversion={selected}\n\t\t\t\t\tisDeployedToDefault={isDeployedToDefault(selected.id)}\n\t\t\t\t\tcanDeployToCustomDomain={isOnMainBranch && props.canDeployToCustomDomain && !isDeployedToCustom(selectedId)}\n\t\t\t\t\tonDeployToCustomDomain={props.onDeployToCustomDomain}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\nexport function VersionsViewSkeleton() {\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Scroll className={styles.versionsList}>\n\t\t\t\t<div className={cx(styles.versionItem, styles.selected)} />\n\t\t\t</Scroll>\n\n\t\t\t<div className={styles.versionDetails}>\n\t\t\t\t<div className={styles.versionActionsContainer}>\n\t\t\t\t\t<Button enabled={false} />\n\t\t\t\t\t<Button enabled={false} variant=\"primary\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nexport function VersionsViewEmpty() {\n\treturn (\n\t\t<div className={cx(styles.container, styles.versionsListEmpty)}>\n\t\t\t<T>Publish your project to generate a version</T>\n\t\t</div>\n\t)\n}\n\ninterface VersionItemProps {\n\tversion: VersionDeployment\n\tisSelected: boolean\n\tisDeployedToCustom: boolean\n\tsetSelectedId: React.Dispatch<React.SetStateAction<VersionDeployment[\"id\"]>>\n}\n\nfunction VersionItem({ version, isSelected, setSelectedId, isDeployedToCustom }: VersionItemProps) {\n\tconst changeSummaryRaw = version.changeSummary\n\tconst changeSummary = useMemo(() => parseSummary(changeSummaryRaw), [changeSummaryRaw])\n\n\tconst animationProps = !isSelected\n\t\t? crossfadeAnimation\n\t\t: {\n\t\t\t\tinitial: false,\n\t\t\t\tanimate: false,\n\t\t\t}\n\n\tconst isPatchingEnabled = !useExperimentIs(\"patching\", \"off\")\n\tconst showPatchIndicator = isPatchingEnabled && version.treeState?.patchedSnapshotId !== undefined\n\n\treturn (\n\t\t<motion.div\n\t\t\t{...animationProps}\n\t\t\tonClick={() => setSelectedId(version.id)}\n\t\t\tclassName={cx(styles.versionItem, isSelected && styles.selected)}\n\t\t>\n\t\t\t<div className={styles.versionItemHeader}>\n\t\t\t\t<p className={cx(truncateWithEllipsis, styles.versionItemTitle)}>\n\t\t\t\t\t<RelativeTime timestamp={version.createdAt} />\n\t\t\t\t\t&nbsp;\u00B7&nbsp;\n\t\t\t\t\t{version.deployedBy.name}\n\t\t\t\t</p>\n\n\t\t\t\t<span className={styles.versionItemBadgeContainer}>\n\t\t\t\t\t<StatusHint version={version} />\n\t\t\t\t\t{isDeployedToCustom && <Badge variant={isSelected ? \"primary\" : undefined}>Live</Badge>}\n\t\t\t\t</span>\n\t\t\t</div>\n\n\t\t\t{(changeSummary || showPatchIndicator) && (\n\t\t\t\t<p className={styles.versionItemChangesText}>\n\t\t\t\t\t{changeSummary && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{changeSummary.totalChanges} Change\n\t\t\t\t\t\t\t{changeSummary.totalChanges !== 1 && \"s\"}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t\t{showPatchIndicator && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{changeSummary && \" \u00B7 \"}\n\t\t\t\t\t\t\tPartial publish\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t</motion.div>\n\t)\n}\n\ninterface VersionDetailsProps {\n\tversion: VersionDeployment\n\tisDeployedToDefault: boolean\n\tcanDeployToCustomDomain: boolean\n\tonDeployToCustomDomain: (version: VersionDeployment) => void\n}\n\nfunction VersionDetails({\n\tversion,\n\tisDeployedToDefault,\n\tcanDeployToCustomDomain,\n\tonDeployToCustomDomain,\n}: VersionDetailsProps) {\n\tconst changeSummaryRaw = version?.changeSummary\n\tconst changeSummary = useMemo(() => parseSummary(changeSummaryRaw), [changeSummaryRaw])\n\tconst statusIndicator = deriveIndicatorStatus(version.status, version.hasWarnings)\n\n\tconst versionLabel = isDeployedToDefault ? \"Latest\" : version.id\n\tconst createdAtLabel = format(parseISO(version.createdAt), \"MM/dd/yy \u00B7 h:mm a\")\n\n\treturn (\n\t\t<div className={styles.versionDetails}>\n\t\t\t<motion.div {...crossfadeAnimation} className={styles.versionDetailsGrid}>\n\t\t\t\t<div className={styles.versionDetailsSection}>\n\t\t\t\t\t<p className={styles.sectionTitle}>\n\t\t\t\t\t\t<T>Version</T>\n\t\t\t\t\t</p>\n\t\t\t\t\t<CopyButton\n\t\t\t\t\t\tkey={version.id}\n\t\t\t\t\t\tclassName={cx(styles.sectionValueCopyable, styles.sectionValue)}\n\t\t\t\t\t\ttitle={versionLabel}\n\t\t\t\t\t\tonClick={() => copyText(versionLabel).catch(unhandledError)}\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.versionDetailsSection}>\n\t\t\t\t\t<p className={styles.sectionTitle}>Status</p>\n\t\t\t\t\t<StatusBadge version={version} />\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.versionDetailsSection}>\n\t\t\t\t\t<p className={styles.sectionTitle}>\n\t\t\t\t\t\t<T>Published by</T>\n\t\t\t\t\t</p>\n\t\t\t\t\t<CopyButton\n\t\t\t\t\t\tkey={version.id}\n\t\t\t\t\t\tclassName={cx(styles.sectionValueCopyable, styles.sectionValue, truncateWithEllipsis)}\n\t\t\t\t\t\ttitle={version.deployedBy.name}\n\t\t\t\t\t\tonClick={() => copyText(version.deployedBy.name).catch(unhandledError)}\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<div className={styles.versionDetailsSection}>\n\t\t\t\t\t<p className={styles.sectionTitle}>\n\t\t\t\t\t\t<T>Published at</T>\n\t\t\t\t\t</p>\n\t\t\t\t\t<CopyButton\n\t\t\t\t\t\tkey={version.id}\n\t\t\t\t\t\tclassName={cx(styles.sectionValueCopyable, styles.sectionValue)}\n\t\t\t\t\t\ttitle={createdAtLabel}\n\t\t\t\t\t\tonClick={() => copyText(createdAtLabel).catch(unhandledError)}\n\t\t\t\t\t\tvariant=\"clean\"\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</motion.div>\n\n\t\t\t{!!changeSummary && (\n\t\t\t\t<motion.div {...crossfadeAnimation} className={styles.versionChangesSection}>\n\t\t\t\t\t<p className={styles.sectionTitle}>\n\t\t\t\t\t\t<T>Changes</T>\n\t\t\t\t\t</p>\n\t\t\t\t\t{changeSummary.totalChanges === 0 ? (\n\t\t\t\t\t\t<p className={styles.sectionValue}>\n\t\t\t\t\t\t\t<T>None</T>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Scroll className={styles.changesScrollContainer}>\n\t\t\t\t\t\t\t{changeSummary.changes.map((change, idx) => (\n\t\t\t\t\t\t\t\t<ChangeRow key={idx} change={change} />\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t{changeSummary.totalChanges > changeSummary.changes.length && (\n\t\t\t\t\t\t\t\t<p className={cx(truncateWithEllipsis, styles.changesRemainder)}>\n\t\t\t\t\t\t\t\t\t...and {changeSummary.totalChanges - changeSummary.changes.length} other changes\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Scroll>\n\t\t\t\t\t)}\n\t\t\t\t</motion.div>\n\t\t\t)}\n\n\t\t\t<div className={cx(styles.versionActionsContainer, !canDeployToCustomDomain && styles.singleColumn)}>\n\t\t\t\t<Link\n\t\t\t\t\tonClick={handleOpenLink}\n\t\t\t\t\thref={`https://${version.versionHostname}`}\n\t\t\t\t\ttitle={`Open ${isDeployedToDefault ? \"latest\" : \"version\"}`}\n\t\t\t\t>\n\t\t\t\t\t<Button>View</Button>\n\t\t\t\t</Link>\n\n\t\t\t\t{canDeployToCustomDomain && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tonClick={() => onDeployToCustomDomain(version)}\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tenabled={statusIndicator !== StatusIndicatorEnum.Optimizing}\n\t\t\t\t\t>\n\t\t\t\t\t\tDeploy\n\t\t\t\t\t</Button>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\nfunction StatusHint({ version }: { version: VersionDeployment }) {\n\tconst statusIndicator = deriveIndicatorStatus(version.status, version.hasWarnings)\n\tswitch (statusIndicator) {\n\t\tcase StatusIndicatorEnum.Error:\n\t\tcase StatusIndicatorEnum.Warning:\n\t\t\treturn (\n\t\t\t\t<div className={styles.versionItemStatusIcon}>\n\t\t\t\t\t<IconCrossCircle fill={statusIndicator === StatusIndicatorEnum.Error ? palette.red106 : palette.yellow120} />\n\t\t\t\t</div>\n\t\t\t)\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nfunction getVariantForStatus(statusIndicator: StatusIndicatorEnum): BadgeProps[\"variant\"] {\n\tswitch (statusIndicator) {\n\t\tcase StatusIndicatorEnum.Optimized:\n\t\t\treturn undefined\n\t\tcase StatusIndicatorEnum.Error:\n\t\t\treturn \"error\"\n\t\tcase StatusIndicatorEnum.Warning:\n\t\t\treturn \"warning\"\n\t\tcase StatusIndicatorEnum.Pending:\n\t\tcase StatusIndicatorEnum.Optimizing:\n\t\t\treturn \"neutral\"\n\t\tdefault:\n\t\t\tassertNever(statusIndicator)\n\t}\n}\n\nfunction getActionForStatus(\n\tversion: VersionDeployment,\n\tstatusIndicator: StatusIndicatorEnum,\n\thasOptimizationIssues: boolean,\n): ((event: React.MouseEvent<HTMLElement>) => void) | undefined {\n\tswitch (statusIndicator) {\n\t\tcase StatusIndicatorEnum.Error:\n\t\t\treturn event => displayErrorSupportMenu(event, version, hasOptimizationIssues)\n\t\tcase StatusIndicatorEnum.Warning:\n\t\t\treturn event => displayErrorSupportMenu(event, version, hasOptimizationIssues)\n\t\tcase StatusIndicatorEnum.Optimized:\n\t\tcase StatusIndicatorEnum.Pending:\n\t\tcase StatusIndicatorEnum.Optimizing:\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(statusIndicator)\n\t}\n}\n\nfunction StatusBadge({ version }: { version: VersionDeployment }) {\n\tconst statusIndicator = deriveIndicatorStatus(version.status, version.hasWarnings)\n\tconst hasOptimizationIssues = hasOptimizationIssue(version.status) || version.hasWarnings\n\n\tconst action = getActionForStatus(version, statusIndicator, hasOptimizationIssues)\n\n\tconst label = getStatusIndicatorLabel(statusIndicator, true)\n\n\treturn (\n\t\t<Badge\n\t\t\tonMouseDown={action}\n\t\t\tclassName={cx(styles.statusSectionValue, action && styles.statusInteractive)}\n\t\t\tvariant={getVariantForStatus(statusIndicator)}\n\t\t>\n\t\t\t{label}\n\t\t</Badge>\n\t)\n}\n\nfunction handleOpenLink() {\n\trecord(\"ui_interaction\", { page: Pages.siteSettingsVersions, id: UIInteraction.openVersionLink })\n}\n\nfunction displayErrorSupportMenu(\n\tevent: React.MouseEvent<HTMLElement>,\n\tdeployment: VersionDeployment,\n\thasErrors: boolean,\n) {\n\tevent.stopPropagation()\n\n\tconst bounds = event.currentTarget.getBoundingClientRect()\n\n\tconst items = [\n\t\t{\n\t\t\tlabel: \"View Optimization Issues\",\n\t\t\tclick: () => {\n\t\t\t\tengine.stores.publishStore.openOptimizationIssuesWindow(deployment)\n\t\t\t},\n\t\t\tenabled: hasErrors,\n\t\t\tvisible: hasErrors,\n\t\t},\n\t\t{\n\t\t\tlabel: \"Go to Support Article\",\n\t\t\tclick: () => {\n\t\t\t\topenOptimizationSupportArticle()\n\t\t\t\trecord(\"ui_interaction\", {\n\t\t\t\t\tpage: Pages.siteSettingsVersions,\n\t\t\t\t\tid: UIInteraction.statusLearnMore,\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t]\n\n\tengine.stores.contextMenuStore.show(items, { location: { x: bounds.left, y: bounds.bottom + 5 } })\n}\n", "import \"VersionsView.styles_fh4qc3.wyw.css\"; export const versionsListEmpty = \"versionsListEmpty_v1ub08l0\";\nexport const container = \"container_c10tr1h1\";\nexport const scrolling = \"scrolling_sywxc3y\";\nexport const versionsList = \"versionsList_v1xcr6jn\";\nexport const versionListSpinner = \"versionListSpinner_v786rl8\";\nexport const selected = \"selected_s55lcqa\";\nexport const versionItemTitle = \"versionItemTitle_vsbl509\";\nexport const versionItem = \"versionItem_v1f87kjx\";\nexport const versionItemHeader = \"versionItemHeader_v1vrsnp5\";\nexport const versionItemBadgeContainer = \"versionItemBadgeContainer_v1xrg5c5\";\nexport const versionItemStatusIcon = \"versionItemStatusIcon_v1th2agr\";\nexport const versionItemChangesText = \"versionItemChangesText_vqsa8dj\";\nexport const versionDetails = \"versionDetails_vez7n3a\";\nexport const versionDetailsGrid = \"versionDetailsGrid_v9kuket\";\nexport const versionDetailsSection = \"versionDetailsSection_vvda9ft\";\nexport const sectionTitle = \"sectionTitle_sbu3342\";\nexport const sectionValue = \"sectionValue_s1dk3tcg\";\nexport const sectionValueCopyable = \"sectionValueCopyable_s9ye7i5\";\nexport const statusSectionValue = \"statusSectionValue_s1azl7le\";\nexport const statusInteractive = \"statusInteractive_s1dylir1\";\nexport const versionChangesSection = \"versionChangesSection_v12nlaxe\";\nexport const changesScrollContainer = \"changesScrollContainer_czy8241\";\nexport const changesRemainder = \"changesRemainder_cl0moi3\";\nexport const singleColumn = \"singleColumn_s1q43e4r\";\nexport const versionActionsContainer = \"versionActionsContainer_v1rncoli\";", "import engine from \"document/engine.ts\"\nimport React, { Suspense } from \"react\"\n\nconst BetaChannelStatusBar = React.lazy(() =>\n\timport(\"./BetaChannelStatusBar.tsx\").then(module => ({ default: module.BetaChannelStatusBar })),\n)\nconst BetaStatusBar = React.lazy(() =>\n\timport(\"./BetaStatusBar.tsx\").then(module => ({ default: module.BetaStatusBar })),\n)\nconst EmployeeStatusBar = React.lazy(() =>\n\timport(\"./EmployeeStatusBar.tsx\").then(module => ({ default: module.EmployeeStatusBar })),\n)\n\nexport const StatusBar = React.memo(function StatusBar() {\n\tconst isVisible = engine.stores.chromeStore.useState(state => state.chromeIsVisible && state.statusBarIsVisible)\n\tconst statusBarType = engine.stores.chromeStore.statusBarType\n\n\tif (!isVisible) return null\n\n\t// The status bar looks different depending on whether the viewer is an\n\t// employee, paying user, or beta user, but this never dynamically changes\n\tswitch (statusBarType) {\n\t\tcase \"employee\":\n\t\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t\t<EmployeeStatusBar />\n\t\t\t\t</Suspense>\n\t\t\t)\n\t\tcase \"beta\":\n\t\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t\t<BetaStatusBar />\n\t\t\t\t</Suspense>\n\t\t\t)\n\t\tcase \"betaChannel\":\n\t\t\treturn (\n\t\t\t\t<Suspense>\n\t\t\t\t\t<BetaChannelStatusBar />\n\t\t\t\t</Suspense>\n\t\t\t)\n\t\tdefault:\n\t\t\treturn null\n\t}\n})\n", "import { dimensions } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport engine from \"document/engine.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport React from \"react\"\nimport { Toaster as InnerToaster } from \"web/lib/toaster.ts\"\nimport * as styles from \"./Toast.styles.ts\"\n\nexport const Toaster = React.memo(function Toaster() {\n\tconst { mainView, displayMinimalUI } = engine.stores.chromeStore.useState()\n\tconst fullsizePreviewDisplayed = mainView === ActiveMainView.Preview\n\tconst isInCanvas = mainView === ActiveMainView.Canvas\n\tconst { position, alignment, padding } = getToasterPositionAndAlignment()\n\treturn (\n\t\t<InnerToaster\n\t\t\tclassName={cx(\n\t\t\t\tstyles.toaster,\n\t\t\t\tstyles.disablePointerEventsWhileDragging,\n\t\t\t\tisInCanvas && styles.canvasBelowHud,\n\t\t\t\tfullsizePreviewDisplayed && styles.hidden,\n\t\t\t\t!isInCanvas && styles.bottomWithoutFloatingToolbar,\n\t\t\t\tdisplayMinimalUI && styles.mobileToast,\n\t\t\t)}\n\t\t\tposition={position}\n\t\t\talignment={alignment}\n\t\t\tpadding={padding}\n\t\t/>\n\t)\n})\n\nfunction getToasterPositionAndAlignment(): {\n\tposition: \"top\" | \"bottom\"\n\talignment: \"left\" | \"center\" | \"right\"\n\tpadding: number\n} {\n\treturn { position: \"bottom\", alignment: \"center\", padding: dimensions.values.floatingToolbarPadding }\n}\n", "import \"Toast.styles_jhpjun.wyw.css\"; export const toaster = \"toaster_t1g0rfed\";\nexport const canvasBelowHud = \"canvasBelowHud_c1o14vpl\";\nexport const mobileToast = \"mobileToast_m1vwn7l1\";\nexport const bottomWithoutFloatingToolbar = \"bottomWithoutFloatingToolbar_bw8gump\";\nexport const hidden = \"hidden_hjjujhd\";\nexport const disablePointerEventsWhileDragging = \"disablePointerEventsWhileDragging_dl45tov\";", "import { Button, ErrorState, IconErrorStateWarning, Spinner, Translatable as T } from \"@framerjs/fresco\"\nimport React from \"react\"\nimport * as styles from \"./CodeEditor.styles.ts\"\nimport { hideLoadingErrorToast, showLoadingErrorToast } from \"./loadingErrorToast.ts\"\n\nlet CodeEditorManager: React.LazyExoticComponent<typeof import(\"./entry.tsx\").default>\ninvalidateCodeEditorManager()\n\n// By default, React.lazy doesn\u2019t support retries. If you render a lazy component,\n// and its loading fails, there\u2019s no way to re-invoke the loading function and re-download\n// the component \u2013 even if you unmount and remount it.\n//\n// So, to implement retrying, we regenerate the component completely\n// every time we want to retry loading.\nfunction invalidateCodeEditorManager() {\n\tCodeEditorManager = React.lazy(() => import(\"./entry.tsx\"))\n}\n\ninterface Props {\n\tvisible: boolean\n\tisViewOnly: boolean\n\tshowCodeAgentPanel: boolean\n}\n\nexport class CodeEditor extends React.Component<Props> {\n\toverride state = {\n\t\tfailedToLoad: false,\n\t}\n\n\toverride componentWillUnmount() {\n\t\t// Reset the error when CodeEditor gets hidden \u2013\n\t\t// so that if another part of Framer succeeds in loading async deps,\n\t\t// we would be able to render them immediately\n\t\tthis.resetError()\n\t}\n\n\tstatic getDerivedStateFromError() {\n\t\tshowLoadingErrorToast()\n\t\treturn { failedToLoad: true }\n\t}\n\n\tresetError = () => {\n\t\thideLoadingErrorToast()\n\n\t\tinvalidateCodeEditorManager()\n\t\tthis.setState({ failedToLoad: false })\n\t}\n\n\toverride render() {\n\t\tconst { visible, isViewOnly, showCodeAgentPanel } = this.props\n\t\tif (!visible) return null\n\n\t\tif (this.state.failedToLoad) {\n\t\t\treturn (\n\t\t\t\t<div className={styles.container}>\n\t\t\t\t\t<ErrorState\n\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<T>Failed to load the code editor.</T>\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t<T>Please try again.</T>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinline\n\t\t\t\t\t\ticon={IconErrorStateWarning}\n\t\t\t\t\t\tbutton={<Button variant=\"primary\" title=\"Reload\" onClick={this.resetError} />}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\n\t\treturn (\n\t\t\t<React.Suspense\n\t\t\t\tfallback={\n\t\t\t\t\t<div className={styles.container}>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<CodeEditorManager\n\t\t\t\t\tclassName={styles.codeEditor}\n\t\t\t\t\tisViewOnly={isViewOnly}\n\t\t\t\t\tshowCodeAgentPanel={showCodeAgentPanel}\n\t\t\t\t/>\n\t\t\t</React.Suspense>\n\t\t)\n\t}\n}\n", "import \"CodeEditor.styles_1q5126y.wyw.css\"; export const codeEditor = \"codeEditor_c1xh2vuu\";\nexport const container = \"container_c1el50re\";", "import { MetricsInteractionViews, MetricsViewContext } from \"app/metrics.ts\"\nimport { CodeEditor } from \"code-editor/CodeEditor.tsx\"\nimport engine from \"document/engine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { useIsViewOnly } from \"web/pages/project/permissions/useIsViewOnly.ts\"\nimport { useShouldShowCodeAgentPanel } from \"../agentPanel/useShouldShowCodeAgentPanel.ts\"\n\nexport const CodeEditorContainer = () => {\n\tconst isViewOnly = useIsViewOnly(\"canDesign\")\n\tconst showCodeAgentPanel = useShouldShowCodeAgentPanel()\n\tconst { codeEditorStore, chromeStore } = engine.stores\n\tconst currentCodeFileId = useEngineState(() => codeEditorStore.currentCodeFileId, [], codeEditorStore)\n\tconst mainView = useEngineState(() => chromeStore.mainView, [], chromeStore)\n\tconst visible = mainView === ActiveMainView.CodeEditor\n\n\tif (!currentCodeFileId) return null\n\n\treturn (\n\t\t<MetricsViewContext.Provider value={MetricsInteractionViews.CODE_PANEL}>\n\t\t\t<CodeEditor visible={visible} isViewOnly={isViewOnly} showCodeAgentPanel={showCodeAgentPanel} />\n\t\t</MetricsViewContext.Provider>\n\t)\n}\n", "import type { EditorApp, SnapshotViewport } from \"@framerjs/framer-services\"\nimport { assert, delay, getLogger } from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { serializeEditorInput } from \"@framerjs/shared/src/ssg/editor.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isFrameNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { loadDocumentJSON } from \"document/serialization/index.ts\"\nimport { generateHTML } from \"export/exportToHTML.ts\"\nimport { Base64 } from \"js-base64\"\nimport { collectBoundingBox, getRectContainingBoundingBox, isValidBoundingBox } from \"utils/collectBoundingBox.ts\"\n\nconst log = getLogger(\"EditorApp\")\n\nexport class EditorAppImpl implements EditorApp.Interface {\n\tconstructor(\n\t\tprivate engine: VekterEngine,\n\t\tprivate snapshotViewport: SnapshotViewport.Interface,\n\t) {}\n\n\tasync loadBlankProject() {\n\t\t// We don't currently support reloading a document\n\t\tassert(!this.engine.stores.loadingStore.documentLoaded, \"EditorApp.loadBlankProject documentLoaded\")\n\n\t\tconst documentLoadedPromise = new Promise<void>(resolve => {\n\t\t\tconst checkDocumentLoaded = () => {\n\t\t\t\tif (this.engine.stores.loadingStore.documentLoaded) {\n\t\t\t\t\tresolve()\n\t\t\t\t\tthis.engine.scheduler.changes.removeObserver(observer)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst observer = this.engine.scheduler.changes.observe(this.engine.stores.loadingStore, checkDocumentLoaded)\n\t\t})\n\n\t\tthis.engine.loadWasCalled = true\n\t\tthis.engine.didLoad()\n\n\t\tawait this.waitUntilRendered()\n\n\t\treturn documentLoadedPromise\n\t}\n\n\tasync loadProject({ document }: { document: string }) {\n\t\t// We don't currently support reloading a document\n\t\tassert(!this.engine.stores.loadingStore.documentLoaded, \"EditorApp.loadProject documentLoaded\")\n\n\t\tconst projectLoadedPromise = new Promise<void>(resolve => {\n\t\t\t// FIXME: `canvasSandboxResourcesLoadingState.failure` is never\n\t\t\t// written today \u2014 `DeferredRendering.trackResourceLoading`\n\t\t\t// swallows fetch rejections (`load().then(afterLoading).catch(afterLoading)`),\n\t\t\t// so a failed image/module fetch decrements the counter the same\n\t\t\t// as success and the state flips to `loaded`, not `failed`. Once\n\t\t\t// a writer for the failure state is added, this observer needs\n\t\t\t// to also reject on `.failure`, not just resolve on `.isLoaded`.\n\t\t\tconst { loadingStore } = this.engine.stores\n\t\t\tconst checkProjectLoaded = () => {\n\t\t\t\tlog.debug(\n\t\t\t\t\t\"loadProject progress\",\n\t\t\t\t\tloadingStore.documentLoaded,\n\t\t\t\t\tloadingStore.assetMapLoaded,\n\t\t\t\t\tloadingStore.canvasSandboxResourcesLoadingState,\n\t\t\t\t\tloadingStore.webFontsLoaded,\n\t\t\t\t)\n\t\t\t\tif (\n\t\t\t\t\tloadingStore.documentLoaded &&\n\t\t\t\t\t// FIXME: assetMapLoaded are currently true before we\n\t\t\t\t\t// even start loading the project, which means they don't actually contribute\n\t\t\t\t\t// to determining the loading progress.\n\t\t\t\t\tloadingStore.assetMapLoaded &&\n\t\t\t\t\tloadingStore.canvasSandboxResourcesLoadingState.isLoaded &&\n\t\t\t\t\tloadingStore.webFontsLoaded\n\t\t\t\t) {\n\t\t\t\t\tresolve()\n\t\t\t\t\tthis.engine.scheduler.changes.removeObserver(observer)\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst observer = this.engine.scheduler.changes.observe(loadingStore, checkProjectLoaded)\n\t\t})\n\n\t\tconst tree = loadDocumentJSON(JSON.parse(document), this.engine.componentLoader)\n\t\tthis.engine.load(tree)\n\n\t\tconst scriptsLoadedPromise = new Promise<void>(resolve => {\n\t\t\tconst observer = this.engine.scheduler.changes.observe(EngineChange.ActiveBundle, () => {\n\t\t\t\tlog.debug(\"modules loaded loaded\")\n\t\t\t\tthis.engine.scheduler.changes.removeObserver(observer)\n\t\t\t\tresolve()\n\t\t\t})\n\t\t})\n\n\t\t// 1. Wait for the canvas to render the placeholders.\n\t\t// 2. Wait for the placeholders to settle.\n\t\tconst modulesLoadedPromise = this.waitUntilRendered()\n\t\t\t.then(() => {\n\t\t\t\tlog.debug(\"waiting for placeholders to settle\")\n\t\t\t\treturn this.engine.canvasSandbox?.sandbox.renderer.waitUntilPlaceholdersSettled()\n\t\t\t})\n\t\t\t.then(() => {\n\t\t\t\tlog.debug(\"modules loaded\")\n\t\t\t})\n\n\t\tawait Promise.all([projectLoadedPromise, scriptsLoadedPromise, modulesLoadedPromise])\n\t}\n\n\tprivate chunks: string[] = []\n\n\tasync loadProjectChunk({ value, done }: { value: string; done?: boolean }) {\n\t\tthis.chunks.push(value)\n\n\t\tif (done) {\n\t\t\t// This will temporarily allocate memory equal to about twice the\n\t\t\t// combined size of the document + index and vendors bundles, there's\n\t\t\t// room for optimization here if needed.\n\t\t\tconst [document] = this.chunks.join(\"\").split(\"\\0\", 3)\n\t\t\tthis.chunks = []\n\t\t\treturn this.loadProject({ document })\n\t\t}\n\t}\n\n\tasync prepareNodeSnapshot({\n\t\tnodeId,\n\t\tzoom,\n\t\tpadding,\n\t\tclipContentOutsideNodeRect,\n\t}: {\n\t\tnodeId: string\n\t\tzoom: number\n\t\tpadding: number\n\t\tclipContentOutsideNodeRect: boolean\n\t}) {\n\t\tthis.engine.stores.chromeStore.chromeIsVisible = false\n\n\t\tconst node = this.engine.tree.getNode(nodeId)\n\t\tif (!node) {\n\t\t\tthrow new Error(`Node ${nodeId} doesn't exist`)\n\t\t}\n\n\t\tthis.engine.stores.scopeStore.selectByNode(nodeId)\n\n\t\t// If the node is auto-sized and hasn't been in the viewport, it won't\n\t\t// have been measured yet, so we need to scroll it into the viewport and\n\t\t// wait for a full render cycle (sandbox rendered and measured, and the\n\t\t// engine received and processed the measurement).\n\t\tif (isFrameNode(node) && node.usesDOMRectCached() && node.getDOMRect() === null) {\n\t\t\tthis.engine.scheduler.process(() => {\n\t\t\t\tthis.engine.stores.canvasStore.zoomToCenter(node.rect(null), { snapToZoomSteps: true })\n\t\t\t})\n\t\t\tawait this.waitForSandbox()\n\t\t\tawait this.waitUntilRendered()\n\t\t}\n\n\t\tlet bounds = node.rect(null)\n\n\t\tif (!clipContentOutsideNodeRect) {\n\t\t\tconst boundingBox = { minX: Infinity, maxX: -Infinity, minY: Infinity, maxY: -Infinity }\n\t\t\tcollectBoundingBox({ node, box: boundingBox, ignoreInvisible: true })\n\t\t\tif (isValidBoundingBox(boundingBox)) {\n\t\t\t\tbounds = getRectContainingBoundingBox(boundingBox)\n\t\t\t}\n\t\t}\n\n\t\tconst viewportSize = {\n\t\t\twidth: (bounds.width + padding) * zoom,\n\t\t\theight: (bounds.height + padding) * zoom,\n\t\t}\n\t\tawait requestViewportSize(this.snapshotViewport, viewportSize)\n\n\t\tthis.engine.scheduler.process(() => {\n\t\t\tthis.engine.stores.canvasStore.zoomToCenter(bounds, { zoom, snapToZoomSteps: true })\n\t\t})\n\n\t\treturn this.waitUntilRendered()\n\t}\n\n\tasync prepareScopeSnapshot({ scopeId, size }: { scopeId: string; size: { width: number; height: number } }) {\n\t\tthis.engine.stores.chromeStore.chromeIsVisible = false\n\n\t\tif (scopeId) {\n\t\t\tthis.engine.stores.scopeStore.select(scopeId, { keepHistory: false })\n\t\t}\n\n\t\tconst scope = scopeId\n\t\t\t? this.engine.stores.scopeStore.getScopeNode(scopeId)\n\t\t\t: this.engine.stores.scopeStore.getScopeNodes()[0]\n\t\t// TODO Check and handle shallow/fully loaded scope state\n\t\tassert(scope?.isLoaded(), \"Scope should be fully loaded\")\n\t\tconst scopeRect = scope.getBoundingFrame(this.engine.stores.treeStore.tree)\n\t\tif (scopeRect.width === 0 && scopeRect.height === 0) {\n\t\t\t// There's nothing on the canvas, which is a legit case. Let's\n\t\t\t// fall back to a shot of an empty canvas, but this might need\n\t\t\t// a rethink.\n\t\t\tscopeRect.width = 200\n\t\t\tscopeRect.height = 200\n\t\t}\n\n\t\tlet snapshotSize: { width: number; height: number } | undefined\n\t\tlet zoom: number | undefined\n\t\tif (size) {\n\t\t\t// We're gonna zoom to fit this size.\n\t\t\tsnapshotSize = size\n\t\t} else {\n\t\t\t// We're gonna snapshot the whole scope at 100%.\n\t\t\tsnapshotSize = scopeRect\n\t\t\tzoom = 1\n\t\t}\n\n\t\tawait requestViewportSize(this.snapshotViewport, snapshotSize)\n\n\t\tthis.engine.scheduler.process(() => {\n\t\t\tthis.engine.stores.canvasStore.zoomToCenter(scopeRect, { zoom, snapToZoomSteps: true })\n\t\t})\n\n\t\treturn this.waitUntilRendered()\n\t}\n\n\tasync exportToHTML() {\n\t\tconst { html, ssgRoutes, locales } = await generateHTML({\n\t\t\tcomponentLoader: this.engine.componentLoader,\n\t\t\tmodulesStore: this.engine.stores.modulesStore,\n\t\t\tcodeGenerationStore: this.engine.stores.codeGenerationStore,\n\t\t\tdebugStore: this.engine.stores.debugStore,\n\t\t\ttreeStore: this.engine.stores.treeStore,\n\t\t\tpublishStore: this.engine.stores.publishStore,\n\t\t\tprojectStore: this.engine.stores.projectStore,\n\t\t\tassetStore: this.engine.stores.assetStore,\n\t\t\tscheduler: this.engine.scheduler,\n\t\t})\n\t\tconst ssgEditorInput = serializeEditorInput({\n\t\t\tadaptLayoutToTextDirection: false,\n\t\t\tautomaticLocale: false,\n\t\t\tdebugFlags: undefined,\n\t\t\texperiments: {\n\t\t\t\t...experiments.serialize(),\n\t\t\t\t// SSG tests currently require eager optimization.\n\t\t\t\tonDemandSSG: \"off\",\n\t\t\t},\n\t\t\tlocales: [...locales],\n\t\t\troutes: ssgRoutes,\n\t\t\trewrites: [],\n\t\t})\n\t\treturn {\n\t\t\thtml,\n\t\t\tssgEditorInputBase64: Base64.fromUint8Array(new Uint8Array(await ssgEditorInput.arrayBuffer())),\n\t\t}\n\t}\n\n\tasync waitForRenderCycle() {\n\t\tawait new Promise(resolve => this.engine.scheduler.runBeforeNextFrame(resolve))\n\t}\n\n\tasync waitUntilRendered() {\n\t\tawait waitUntilRendered(this.engine)\n\t}\n\n\tasync waitForSandbox() {\n\t\tawait this.engine.canvasSandbox?.renderUpdates?.(noop)\n\t}\n}\n\nasync function waitUntilRendered(engine: VekterEngine): Promise<void> {\n\t// The sandbox might need to run postponed tasks, like scroll and page component rendering.\n\tawait delay(50)\n\tawait delay(50)\n\tawait new Promise(resolve => engine.scheduler.runWhenIdle(resolve))\n}\n\n/**\n * Requests the given viewport size from the SnapshotViewport, and waits until\n * the we actually received the resize event.\n */\nasync function requestViewportSize(\n\tsnapshotViewport: SnapshotViewport.Interface,\n\tsize: { width: number; height: number },\n) {\n\treturn new Promise<void>((resolve, reject) => {\n\t\tconst roundedSize = {\n\t\t\twidth: Math.round(size.width),\n\t\t\theight: Math.round(size.height),\n\t\t}\n\n\t\tif (window.innerWidth === roundedSize.width && window.innerHeight === roundedSize.height) {\n\t\t\tresolve()\n\t\t\treturn\n\t\t}\n\n\t\twindow.addEventListener(\"resize\", () => resolve(), { once: true })\n\t\tsnapshotViewport.setViewportSize(roundedSize).catch(reject)\n\t})\n}\n", "import type { MenuAction, MenuActionState, MenuDispatchResult, MenuValidationResult } from \"@framerjs/framer-services\"\nimport {\n\tEditorApp,\n\tElectronProject,\n\tElectronProjectV2,\n\tMenuActionTarget,\n\tSnapshotViewport,\n\tchannelToParentFrame,\n\tlocalChannel,\n} from \"@framerjs/framer-services\"\nimport { isElectron } from \"@framerjs/shared\"\nimport type { AppAction } from \"app/AppActions.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { dispatchAction, validateAction } from \"document/components/actions/ActionResponder.tsx\"\nimport { channelToElectron } from \"utils/serviceChannels.ts\"\nimport { EditorAppImpl } from \"./EditorAppImpl.ts\"\n\nexport async function setupServices(engine: VekterEngine) {\n\t// Note: the viewport service only exists in some cases, but won't produce\n\t// errors until you try to use it (prepareNodeSnapshot, prepareScopeSnapshot).\n\t//\n\t// And if you do want to use prepareNodeSnapshot/prepareScopeSnapshot, you're\n\t// expected to provide the SnapshotViewport service.\n\tconst snapshotViewport = SnapshotViewport.on(channelToParentFrame).expect()\n\n\tEditorApp.on(channelToParentFrame).register(new EditorAppImpl(engine, snapshotViewport))\n\n\tconst menuActionTarget: MenuActionTarget.Interface = {\n\t\tvalidate: async ({ action: actionOrWildcard }: MenuAction): Promise<MenuValidationResult> => {\n\t\t\t// Convert the returned dictionaries to an array\n\t\t\t// FIXME: improve the service type system (and possibly tweak the action dispatcher) so we can support this directly\n\t\t\tconst validateActionResult = validateAction(actionOrWildcard)\n\t\t\tconst validatedActions = new Set(\n\t\t\t\tObject.keys(validateActionResult.options).concat(Object.keys(validateActionResult.states)),\n\t\t\t)\n\n\t\t\tconst actionStates: MenuActionState[] = []\n\t\t\tvalidatedActions.forEach(action => {\n\t\t\t\tconst state = validateActionResult.states[action]\n\t\t\t\tactionStates.push({\n\t\t\t\t\taction,\n\t\t\t\t\tenabled: state === true,\n\t\t\t\t\tdeferToNative: state === \"native\",\n\t\t\t\t\t...validateActionResult.options[action],\n\t\t\t\t})\n\t\t\t})\n\t\t\treturn { states: actionStates }\n\t\t},\n\t\tdispatch: async ({ action }: MenuAction): Promise<MenuDispatchResult> => {\n\t\t\treturn { success: dispatchAction(action as AppAction) }\n\t\t},\n\t}\n\n\tMenuActionTarget.on(localChannel).register(menuActionTarget)\n\n\tif (isElectron()) {\n\t\t// Allow Electron to dispatch menu actions as well\n\t\tMenuActionTarget.on(channelToElectron).register(menuActionTarget)\n\n\t\tconst { scopeStore, pluginStore, chromeStore } = engine.stores\n\n\t\tconst electronProject: ElectronProject.Interface = {\n\t\t\tasync selectNode(payload: ElectronProject.SelectNodePayload): Promise<void> {\n\t\t\t\tscopeStore.selectByNode(payload.nodeId)\n\t\t\t},\n\t\t}\n\t\tconst electronProjectV2: ElectronProjectV2.Interface = {\n\t\t\t...electronProject,\n\t\t\tasync openPlugin(payload: ElectronProjectV2.OpenPluginPayload): Promise<void> {\n\t\t\t\tchromeStore.reset()\n\t\t\t\tawait pluginStore.preparePluginToOpen(engine, payload.pluginId, payload.version ?? null)\n\t\t\t\tpluginStore.openPreparedPlugin(engine)\n\t\t\t},\n\t\t}\n\t\tElectronProject.on(channelToElectron).register(electronProject)\n\t\tElectronProjectV2.on(channelToElectron).register(electronProjectV2)\n\t}\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAED,IAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,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AC/D,qBAAiB,gBAAQA,QAAO,IAAI;AACpC,SAAK,YAAY;AAAA,EAClB;AACD;",
  "names": ["isObject", "floor", "toInteger", "min", "toInteger", "TO_STRING", "global", "global", "uid", "Symbol", "name", "classof", "anObject", "LAST_INDEX", "re1", "re2", "isObject", "document", "isObject", "anObject", "toPrimitive", "dP", "defineProperty", "dP", "createDesc", "global", "hide", "has", "$toString", "TO_STRING", "isFunction", "aFunction", "global", "hide", "redefine", "ctx", "PROTOTYPE", "$export", "name", "exports", "regexpExec", "redefine", "hide", "fails", "wks", "regexpExec", "toInteger", "max", "min", "toIObject", "toLength", "fails", "createDesc", "toIObject", "toPrimitive", "has", "gOPD", "getOwnPropertyDescriptor", "isObject", "anObject", "proto", "test", "isObject", "shared", "uid", "has", "toIObject", "$keys", "getOwnPropertyNames", "isObject", "isRegExp", "global", "dP", "DESCRIPTORS", "anObject", "aFunction", "punycode", "floor", "error", "codePoint", "flag", "input", "isArray", "aFunction", "toObject", "toLength", "memo", "self", "$keys", "dP", "anObject", "getKeys", "defineProperties", "Properties", "document", "anObject", "PROTOTYPE", "create", "Properties", "has", "create", "setToStringTag", "has", "toObject", "ObjectProto", "$export", "redefine", "hide", "Iterators", "setToStringTag", "ITERATOR", "Base", "proto", "entries", "$native", "step", "Iterators", "toIObject", "$export", "fails", "text", "options", "codepoints", "assetType", "removeVS16s", "gOPN", "anObject", "ownKeys", "$defineProperty", "createDesc", "isObject", "isArray", "speciesConstructor", "ctx", "toObject", "toLength", "$create", "create", "self", "META", "isObject", "has", "create", "meta", "global", "wksExt", "defineProperty", "name", "$Symbol", "getKeys", "isEnum", "toIObject", "gOPN", "getOwnPropertyNames", "anObject", "entries", "Iterators", "ITERATOR", "classof", "ITERATOR", "Iterators", "ITERATOR", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "meta", "EditorAppHelper", "EditorApp", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "ElectronProjectHelper", "ElectronProject", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "ElectronProjectV2Helper", "ElectronProjectV2", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "ElectronWebRenderingHelper", "ElectronWebRendering", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "ElectronWebRenderingV2Helper", "ElectronWebRenderingV2", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "SnapshotViewportHelper", "SnapshotViewport", "options", "onewayMethodTemplate", "voidMethodTemplate", "valueMethodTemplate", "streamMethodTemplate", "MenuActionTargetHelper", "MenuActionTarget", "options", "React", "import_react", "import_react", "sites_getting_started_default", "import_react", "import_react", "import_jsx_runtime", "title", "React", "steps", "step", "nextStep", "import_react", "import_jsx_runtime", "log", "React", "import_jsx_runtime", "log", "steps", "title", "React", "step", "isNumber", "import_jsx_runtime", "steps", "title", "React", "step", "import_react", "import_react_dom", "error", "import_react", "overlay", "import_react", "overlay", "newHistoryState", "page", "item", "stack", "isBoolean", "React", "HistoryNavigation", "options", "link", "import_react", "link", "action", "import_react", "import_jsx_runtime", "React", "LinkOptionRows", "readOnly", "link", "isBoolean", "isString", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "title", "import_jsx_runtime", "link", "readOnly", "React", "LinkPanelHeader", "isBoolean", "isString", "updateRichTextNodeLink", "LinkPanel", "action", "text", "isViewOnly", "name", "item", "import_react", "import_jsx_runtime", "React", "style", "devicePixelRatio", "step", "container", "import_react", "grid", "import_jsx_runtime", "React", "GridOverlayElement", "grid", "margin", "style", "marginLeft", "import_react", "import_react", "import_jsx_runtime", "React", "highlight", "isNumber", "rulerWidth", "import_react", "import_jsx_runtime", "React", "ctx", "step", "item", "textColor", "highlight", "import_jsx_runtime", "React", "positions", "canvasRect", "highlightedGuide", "isNumber", "guide", "enabled", "groundNode", "container", "import_react", "import_jsx_runtime", "React", "center", "cursor", "style", "import_react", "hidden", "action", "text", "comment", "import_react", "comment", "hasSendError", "import_react", "import_react", "lineBreak", "text", "import_react", "import_react", "actions", "import_jsx_runtime", "visible", "active", "isViewOnly", "actions", "commentText", "import_react", "import_react", "container", "import_react", "import_react", "React", "import_jsx_runtime", "author", "showOverlay", "popover", "avatarRadius", "badge", "import_jsx_runtime", "onSelect", "onDismiss", "anchor", "popover", "onMouseDown", "avatarRadius", "badge", "import_jsx_runtime", "disabled", "comment", "isString", "assert", "name", "from", "container", "anchor", "import_jsx_runtime", "placeholder", "import_jsx_runtime", "comment", "isEditing", "onContextMenu", "author", "date", "text", "commentText", "divider", "import_jsx_runtime", "React", "InlineFeedbackThread", "comments", "mentionableUsers", "commentMetadata", "comment", "onContextMenu", "text", "divider", "import_jsx_runtime", "anchor", "hidden", "import_react", "import_react", "container", "import_jsx_runtime", "isFlipped", "avatar", "React", "animate", "container", "import_jsx_runtime", "log", "React", "backdrop", "text", "comment", "currentUser", "padding", "avatar", "author", "isActive", "anchor", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "Arrow", "active", "background", "import_react", "import_jsx_runtime", "React", "selected", "outletHeight", "style", "background", "import_react", "import_react", "import_react_dom", "import_react", "import_react", "popover", "import_jsx_runtime", "onDismiss", "animate", "React", "popover", "stopPropagation", "import_react", "import_react", "import_jsx_runtime", "action", "keyInput", "React", "label", "import_react", "import_jsx_runtime", "React", "action", "import_react", "import_jsx_runtime", "control", "onContextMenu", "sortable", "popoutId", "traitTypes", "traitTypeKeys", "title", "createVariable", "name", "import_react", "import_jsx_runtime", "enabled", "onSelect", "React", "action", "import_react", "import_jsx_runtime", "action", "React", "delay", "import_jsx_runtime", "action", "import_jsx_runtime", "action", "import_react", "menu", "scopeType", "actions", "action", "import_jsx_runtime", "action", "scopeType", "import_react", "import_jsx_runtime", "React", "title", "group", "enabled", "import_jsx_runtime", "action", "reference", "noop", "import_jsx_runtime", "action", "import_jsx_runtime", "action", "scopeType", "onChangeTrigger", "React", "error", "controlProps", "formEventKeys", "import_react", "container", "import_jsx_runtime", "React", "scopeType", "isViewOnly", "eventKey", "linkSource", "container", "import_jsx_runtime", "scopeType", "onDismiss", "React", "LinkPopoverInner", "action", "container", "import_jsx_runtime", "Link", "React", "import_jsx_runtime", "import_jsx_runtime", "active", "background", "import_jsx_runtime", "highlight", "background", "isViewOnly", "selected", "outlet", "import_jsx_runtime", "React", "background", "highlight", "isViewOnly", "import_react", "import_react", "import_react", "icon", "titleWrapper", "import_jsx_runtime", "React", "AutoSizeEditableText", "readOnly", "isEditing", "internalValue", "button", "wrapper", "import_jsx_runtime", "wrapper", "button", "icon", "wrapper", "label", "import_react", "import_jsx_runtime", "React", "button", "wrapper", "label", "icon", "pluralize", "previewButton", "import_jsx_runtime", "enabled", "previewButton", "import_react", "container", "grid", "import_jsx_runtime", "row", "React", "ScreenTitleAgentAnimation", "dotSize", "gridSize", "container", "grid", "import_jsx_runtime", "hash", "React", "isViewOnly", "showPlayButton", "dimension", "fontSize", "gap", "padding", "style", "titleWrapper", "icon", "import_jsx_runtime", "React", "highlight", "isViewOnly", "breakpoints", "Screens", "import_react", "import_react", "import_jsx_runtime", "React", "CanvasFramePreset", "framePreset", "onMouseDown", "import_jsx_runtime", "groundNode", "framePreset", "import_react", "import_jsx_runtime", "React", "onContextMenu", "style", "import_jsx_runtime", "hidden", "style", "import_jsx_runtime", "hidden", "ResizeHandle", "mouseDownHandler", "mouseMoveHandler", "import_react", "import_jsx_runtime", "React", "hidden", "progress", "min", "max", "style", "baseStyle", "import_react", "groundNode", "wrapper", "import_react", "import_jsx_runtime", "cursor", "onMouseDown", "style", "React", "import_jsx_runtime", "mouseMoveHandler", "padding", "handle", "handles", "cursor", "wrapper", "import_jsx_runtime", "hidden", "style", "mouseDownHandler", "mouseMoveHandler", "import_jsx_runtime", "hidden", "threshold", "parent", "handle", "import_react", "stack", "gap", "isNumber", "import_jsx_runtime", "mouseMoveHandler", "React", "stack", "gap", "isNumber", "padding", "handle", "handles", "cursor", "wrapper", "import_jsx_runtime", "hidden", "isViewOnly", "isScaleTool", "React", "import_react", "import_pluralize", "import_react", "import_jsx_runtime", "CMSBadge", "disabled", "isUserComponent", "action", "collectionItem", "collection", "import_jsx_runtime", "options", "import_react", "plusButton", "import_jsx_runtime", "center", "React", "plusButton", "import_jsx_runtime", "center", "container", "import_react", "import_jsx_runtime", "center", "form", "input", "label", "import_react", "import_jsx_runtime", "InsertionIndicator", "React", "style", "import_jsx_runtime", "label", "borderWidth", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "parent", "pin", "isNumber", "centerPoint", "import_react", "import_jsx_runtime", "center", "parent", "control", "text", "transform", "import_jsx_runtime", "hidden", "import_jsx_runtime", "import_react", "import_react", "container", "handle", "import_jsx_runtime", "selected", "container", "style", "cursor", "editing", "onMouseDown", "isNumber", "maxHeight", "handle", "import_react", "import_react", "import_react", "import_jsx_runtime", "enabled", "import_react", "import_jsx_runtime", "enabled", "isNumber", "import_react", "import_jsx_runtime", "enabled", "container", "import_react", "import_jsx_runtime", "enabled", "import_jsx_runtime", "React", "title", "onDismiss", "enabled", "mask", "isString", "container", "isNumber", "background", "import_react", "canCopy", "item", "import_jsx_runtime", "log", "React", "MasksRow", "mask", "from", "getValue", "isString", "import_jsx_runtime", "import_jsx_runtime", "active", "import_jsx_runtime", "title", "gap", "placeholder", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "import_react", "fadeIn", "import_jsx_runtime", "React", "label", "fadeIn", "import_react", "fadeIn", "import_jsx_runtime", "style", "fadeIn", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "React", "import_jsx_runtime", "React", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_react", "import_react", "import_jsx_runtime", "style", "line", "transform", "isFlipped", "import_jsx_runtime", "parent", "React", "highlightedGuide", "isString", "canvasRect", "guide", "highlight", "outerBox", "innerBox", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "isViewOnly", "import_react", "handle", "import_jsx_runtime", "minSize", "iconStyle", "style", "handle", "import_jsx_runtime", "React", "InsertionIndicator", "exportWithSnapping", "import_react", "import_jsx_runtime", "React", "import_react", "React", "exportWithSnapping", "import_react", "import_jsx_runtime", "React", "import_react", "mouseMove", "center", "centerPoint", "mouseDidMove", "isNumber", "isNumber", "mouseMove", "line", "threshold", "step", "options", "mouseDidMove", "snap", "mask", "import_react", "handle", "placeholder", "import_jsx_runtime", "React", "size", "rotation", "center", "handle", "selected", "placeholder", "cursor", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "React", "highlight", "mouseDown", "exportWithSnapping", "Link", "visible", "node", "parent", "isScaleTool", "hidden", "isViewOnly", "InsertionIndicator", "overlay", "selected", "import_jsx_runtime", "Tools", "React", "import_react", "import_react", "container", "import_jsx_runtime", "onMouseDown", "title", "tooltip", "canvasRect", "mouseDownHandler", "container", "import_jsx_runtime", "React", "isViewOnly", "item", "title", "tooltip", "titles", "variants", "import_jsx_runtime", "React", "isViewOnly", "highlight", "handle", "hidden", "isScaleTool", "breakpoints", "import_jsx_runtime", "React", "container", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "CanvasLoadingShield", "enabled", "import_react", "import_react", "import_jsx_runtime", "BorderSweepOverlay", "withFill", "side", "BeamStrip", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "cursors", "cursor", "style", "import_react", "import_jsx_runtime", "VekterCollectionRichTextVariableEditor", "import_react", "import_jsx_runtime", "VekterRichTextEditor", "import_react", "import_jsx_runtime", "VekterStringVariableEditor", "import_jsx_runtime", "React", "cursor", "isScaleTool", "container", "import_react", "import_jsx_runtime", "Tooltip", "React", "tooltip", "style", "container", "import_react", "import_jsx_runtime", "React", "onDragStart", "enabled", "style", "import_react", "import_react_dom", "import_react", "import_jsx_runtime", "Plugin", "React", "import_jsx_runtime", "IconChevronDown", "import_react", "iconWrapper", "title", "import_jsx_runtime", "name", "dismiss", "subtitle", "icon", "iconWrapper", "title", "IconChevronDown", "window", "modal", "import_jsx_runtime", "isString", "isNumber", "min", "max", "React", "InnerPluginUI", "visible", "maxContentHeight", "minHeight", "minWidth", "maxHeight", "name", "icon", "text", "modal", "Plugin", "window", "import_react", "import_jsx_runtime", "themeOverride", "import_react", "import_jsx_runtime", "title", "content", "log", "import_jsx_runtime", "import_react", "import_jsx_runtime", "isViewOnly", "name", "defaultName", "import_react", "import_jsx_runtime", "environment", "error", "import_react", "container", "iconWrapper", "title", "import_jsx_runtime", "icon", "label", "selected", "iconWrapper", "title", "import_react", "import_jsx_runtime", "onSelect", "mode", "container", "modal", "import_jsx_runtime", "onSelect", "modal", "import_react", "import_react", "import_react", "button", "import_jsx_runtime", "button", "modal", "header", "sidebar", "disabled", "import_jsx_runtime", "text", "activeCategory", "templateTitle", "category", "scrollContainer", "modal", "header", "sidebar", "disabled", "import_react", "import_jsx_runtime", "log", "error", "import_react", "import_jsx_runtime", "dismiss", "shortcutKey", "description", "import_react", "import_jsx_runtime", "comboBoxItems", "title", "import_react", "step", "filter", "action", "variants", "import_react", "variants", "name", "import_jsx_runtime", "log", "name", "list", "item", "import_react", "modal", "scroll", "header", "list", "title", "actions", "divider", "item", "label", "disabled", "import_jsx_runtime", "title", "list", "divider", "item", "label", "disabled", "acceleratorLabel", "ShortcutGroups", "import_jsx_runtime", "modal", "React", "scroll", "header", "actions", "title", "group", "action", "import_react", "import_jsx_runtime", "name", "React", "isString", "import_react", "import_jsx_runtime", "title", "description", "active", "import_jsx_runtime", "import_jsx_runtime", "dismiss", "import_react", "import_jsx_runtime", "dismiss", "import_react", "import_jsx_runtime", "import_react", "modal", "container", "title", "header", "content", "sidebar", "noShrink", "import_jsx_runtime", "modalTitle", "sidebarContent", "sidebarHeader", "modal", "container", "header", "noShrink", "title", "content", "sidebar", "import_jsx_runtime", "enabled", "readOnly", "row", "selectedRow", "import_jsx_runtime", "item", "selected", "row", "selectedRow", "GlossaryTermDetails", "description", "placeholder", "onSelect", "enabled", "import_react", "content", "modal", "import_jsx_runtime", "React", "modal", "content", "import_react", "modalText", "label", "import_jsx_runtime", "title", "description", "progress", "onDismiss", "label", "import_jsx_runtime", "dismiss", "React", "waitOneSecondFromStart", "waitBrieflyWhenDone", "description", "modalText", "import_react", "description", "log", "addOn", "preview", "error", "log", "import_react", "log", "error", "log", "log", "addOn", "error", "log", "addOn", "setState", "quantity", "period", "addOn", "import_jsx_runtime", "log", "onDismiss", "description", "preview", "item", "error", "page", "import_react", "import_jsx_runtime", "name", "React", "import_react", "import_jsx_runtime", "React", "modalText", "import_react", "import_jsx_runtime", "dismiss", "React", "defaultName", "isNumber", "import_react", "import_jsx_runtime", "isString", "schema", "name", "isString", "React", "pageTitle", "import_react", "import_jsx_runtime", "error", "page", "import_react", "import_jsx_runtime", "description", "name", "React", "import_react", "import_jsx_runtime", "name", "width", "React", "title", "description", "defaultName", "defaultWidth", "isNumber", "import_react", "import_jsx_runtime", "content", "import_react", "import_jsx_runtime", "description", "content", "import_react", "import_jsx_runtime", "description", "content", "import_react", "import_jsx_runtime", "setState", "active", "error", "content", "item", "from", "import_react", "import_jsx_runtime", "name", "React", "container", "import_jsx_runtime", "container", "import_react", "import_jsx_runtime", "error", "import_react", "import_jsx_runtime", "progress", "React", "import_react", "import_jsx_runtime", "title", "description", "React", "progress", "total", "text", "label", "import_react", "import_react", "content", "list", "row", "selectedRow", "rowTitle", "label", "import_jsx_runtime", "text", "isString", "validFallback", "readOnly", "languageCode", "regionCode", "rawSlug", "name", "from", "isViewOnly", "React", "dismiss", "item", "item2", "moveItem", "list", "content", "selected", "interactionsBlocked", "onContextMenu", "row", "selectedRow", "rowTitle", "label", "icon", "enabled", "import_react", "modal", "divider", "import_jsx_runtime", "error", "isViewOnly", "title", "divider", "modal", "active", "name", "import_jsx_runtime", "from", "error", "import_react", "import_jsx_runtime", "import_react", "emptyResult", "import_jsx_runtime", "React", "dismiss", "preset", "import_react", "description", "import_jsx_runtime", "options", "React", "description", "title", "link", "isLinkToWebPage", "import_react", "import_jsx_runtime", "log", "React", "error", "import_pluralize", "import_react", "import_react", "fullWidth", "import_jsx_runtime", "page", "React", "fullWidth", "import_react", "log", "error", "log", "setState", "React", "preview", "import_jsx_runtime", "error", "preview", "PriceBreakdown", "onDismiss", "content", "pluralize", "name", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "description", "import_react", "title", "button", "import_jsx_runtime", "React", "progress", "running", "title", "button", "text", "import_react", "import_jsx_runtime", "description", "import_react", "import_jsx_runtime", "import_pluralize", "import_react", "list", "rowMargin", "rowMargin", "list", "import_jsx_runtime", "count", "pluralize", "usageDescription", "onDismiss", "name", "page", "title", "Icon", "import_react", "container", "link", "icon", "import_jsx_runtime", "icon", "container", "link", "import_react", "import_jsx_runtime", "onUpdate", "container", "import_react", "import_pluralize", "import_react", "import_react", "import_jsx_runtime", "isNumber", "control", "React", "isString", "item", "sortable", "scroll", "import_jsx_runtime", "control", "pluralize", "isString", "isNumber", "isBoolean", "item", "React", "ArrayItemControlRow", "onContextMenu", "ControlPropRow", "scopeType", "addItem", "moveItem", "scroll", "sortable", "traitTypeKeys", "title", "from", "import_react", "import_react", "onUpdate", "import_jsx_runtime", "onUpdate", "scopeType", "control", "optionKey", "isNumber", "import_jsx_runtime", "scopeType", "onUpdate", "import_jsx_runtime", "onUpdate", "import_jsx_runtime", "onUpdate", "import_react", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "ShadowPopout", "isString", "isBoolean", "isNumber", "sortable", "shadows", "isNumber", "shadow", "import_jsx_runtime", "React", "ShadowPanel", "shadows", "shadow", "removeItem", "moveItem", "from", "addItem", "sortable", "isString", "isNumber", "sortable", "import_jsx_runtime", "control", "popoutId", "onContextMenu", "traitTypes", "traitTypeKeys", "React", "removeItem", "moveItem", "from", "addItem", "shadowCount", "shadow", "createVariable", "name", "sortable", "isString", "import_jsx_runtime", "onUpdate", "control", "React", "import_jsx_runtime", "scopeType", "onUpdate", "import_jsx_runtime", "onUpdate", "import_jsx_runtime", "scopeType", "onUpdate", "control", "isString", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "cursor", "grid", "cell", "icon", "selected", "container", "import_jsx_runtime", "popoutId", "cursor", "title", "container", "getTitle", "React", "WebCursorPopout", "grid", "cell", "selected", "icon", "isString", "import_react", "import_jsx_runtime", "React", "cursor", "canPasteCursor", "cursors", "copyCursor", "pasteCursor", "import_jsx_runtime", "onUpdate", "import_jsx_runtime", "onUpdate", "scopeType", "displayTime", "isString", "import_react", "list", "dragHandle", "import_jsx_runtime", "import_jsx_runtime", "onUpdate", "scopeType", "React", "input", "name", "moveItem", "from", "addItem", "list", "item", "dragHandle", "inputWrapper", "import_jsx_runtime", "onUpdate", "allowedFileTypes", "inputWrapper", "import_jsx_runtime", "columnGap", "import_jsx_runtime", "onUpdate", "import_react", "import_jsx_runtime", "scopeType", "onUpdate", "isString", "import_jsx_runtime", "onUpdate", "import_react", "import_jsx_runtime", "control", "onContextMenu", "traitTypeKeys", "title", "createVariable", "name", "import_jsx_runtime", "onUpdate", "scopeType", "import_jsx_runtime", "scopeType", "onUpdate", "import_react", "import_jsx_runtime", "controlType", "control", "onContextMenu", "sortable", "traitTypeKeys", "readOnly", "popoutId", "isNumber", "step", "title", "createVariable", "name", "import_jsx_runtime", "scopeType", "onUpdate", "optionKey", "isNumber", "options", "step", "displayStepper", "unit", "min", "max", "import_jsx_runtime", "onUpdate", "import_jsx_runtime", "isNumber", "import_jsx_runtime", "scopeType", "onUpdate", "isString", "updatePlaceholder", "placeholder", "maxLength", "schema", "import_jsx_runtime", "onUpdate", "associatedStringVariable", "options", "import_react", "import_jsx_runtime", "scopeType", "onUpdate", "readOnly", "updatePlaceholder", "placeholder", "displayTextArea", "maxLength", "fallbackValue", "associatedStringVariable", "React", "options", "import_react", "import_jsx_runtime", "canCopy", "canPaste", "import_jsx_runtime", "onUpdate", "import_react", "import_jsx_runtime", "onUpdate", "identifier", "name", "import_jsx_runtime", "scopeType", "onUpdate", "React", "VariableDetail", "readOnly", "name", "onSave", "isNumber", "description", "container", "rowHeight", "row", "selectedRow", "rowTitle", "iconWrapper", "dragHandle", "dragHandleSelected", "divider", "import_react", "import_jsx_runtime", "selected", "readOnly", "onSelect", "row", "selectedRow", "divider", "iconWrapper", "rowTitle", "dragHandle", "dragHandleSelected", "import_react", "import_react", "variable", "name", "import_jsx_runtime", "rowMargin", "groundNode", "rowHeight", "scopeType", "list", "EmptyDetail", "name", "fallbackName", "title", "gap", "import_react", "import_jsx_runtime", "waitBrieflyWhenDone", "React", "finishedCount", "waitBrieflyWhenDone", "dismiss", "title", "progress", "import_react", "import_jsx_runtime", "name", "React", "import_react", "error", "item", "newVectorSet", "import_jsx_runtime", "initialState", "waitBrieflyWhenDone", "labelsFromState", "setState", "React", "progress", "dismiss", "title", "import_react", "import_jsx_runtime", "enabled", "placeholder", "maxNumberOfCharacters", "minHeight", "warning", "import_jsx_runtime", "React", "CodeEditorMinimal", "isViewOnly", "placeholder", "maxNumberOfCharacters", "minHeight", "import_react", "import_react", "button", "import_jsx_runtime", "ClickableVariable", "button", "import_react", "wrapper", "label", "description", "warningMessage", "import_react", "text", "input", "import_jsx_runtime", "SettingInput", "name", "label", "enabled", "placeholder", "description", "warning", "wrapper", "isString", "warningMessage", "container", "link", "import_react", "inputWrapper", "input", "import_jsx_runtime", "options", "item", "internalValue", "enabled", "inputWrapper", "input", "title", "name", "import_react", "enabled", "error", "page", "name", "import_jsx_runtime", "error", "customCode", "code", "name", "page", "title", "codeLabel", "link", "container", "import_react", "import_jsx_runtime", "modal", "codeEditorContainer", "header", "iconWrapper", "headerIcon", "closeIcon", "title", "titleText", "subtitle", "import_jsx_runtime", "icon", "name", "customCode", "code", "modal", "codeEditorContainer", "subtitle", "header", "iconWrapper", "title", "titleText", "closeIcon", "headerIcon", "import_react", "import_jsx_runtime", "import_jsx_runtime", "title", "description", "import_jsx_runtime", "title", "description", "import_react", "import_react", "log", "error", "log", "link", "import_jsx_runtime", "features", "icon", "feature", "import_jsx_runtime", "log", "React", "onDismiss", "project", "log", "text", "link", "hostname", "import_jsx_runtime", "import_jsx_runtime", "React", "Modals", "stack", "modal", "import_react", "import_react", "import_react", "container", "import_react", "subscribe", "isViewOnly", "import_jsx_runtime", "cell", "isViewOnly", "enabled", "header", "import_jsx_runtime", "overlay", "import_react", "import_jsx_runtime", "setPanelWidth", "getPanelWidth", "React", "CodeEditorAgentPanel", "enabled", "import_react", "import_react", "options", "leftPanel", "import_react", "import_jsx_runtime", "onContextMenu", "React", "leftPanel", "categoryContent", "inputWrapper", "input", "toolbar", "import_react", "import_react", "text", "typingSpeed", "icon", "import_jsx_runtime", "WireframerIcon", "icon", "title", "getIcon", "import_react", "assistantMessage", "import_jsx_runtime", "animate", "typingSpeed", "assistantMessage", "import_react", "import_react", "import_jsx_runtime", "StepStatusIcon", "status", "import_jsx_runtime", "StepsList", "steps", "step", "StepRow", "status", "description", "isActive", "import_react", "import_jsx_runtime", "fill", "import_jsx_runtime", "getIcon", "assertNever", "import_jsx_runtime", "typingSpeed", "AssistantMessage", "suggestions", "steps", "title", "import_react", "button", "title", "chevron", "list", "row", "import_jsx_runtime", "KitPicker", "selected", "button", "title", "chevron", "list", "row", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "UserMessage", "import_react", "import_jsx_runtime", "leftPanel", "visible", "WireframerIcon", "list", "categoryContent", "timestamp", "content", "inputWrapper", "input", "toolbar", "import_react", "wrapper", "scrollContainer", "rowsContainer", "import_react", "import_jsx_runtime", "React", "UnpublishedState", "import_react", "import_pluralize", "title", "import_jsx_runtime", "title", "link", "isLinkToWebPage", "getNewScrollTargetId", "headerWrapper", "statusMessage", "import_react", "import_jsx_runtime", "import_jsx_runtime", "status", "isActive", "button", "variants", "name", "pluralize", "headerWrapper", "statusMessage", "import_react", "variantCircle", "import_jsx_runtime", "VariantTableRow", "name", "distributionPercentage", "page", "defaultLocaleId", "variantCircle", "AbTestTable", "React", "import_react", "emptyStateTitle", "import_jsx_runtime", "isViewOnly", "React", "title", "description", "secondaryText", "emptyStateTitle", "import_react", "loadingPlaceholder", "import_jsx_runtime", "title", "loadingPlaceholder", "tabularNumbers", "import_jsx_runtime", "React", "FunnelStepDetails", "step", "maxHeight", "tabularNumbers", "FunnelDropOffBars", "divider", "import_jsx_runtime", "React", "AbTestOverview", "activeVariant", "container", "import_react", "import_react", "delay", "import_react", "import_jsx_runtime", "min", "max", "import_react", "dateRangePresets", "import_jsx_runtime", "items", "label", "days", "dateRangePresets", "import_react", "import_react", "import_jsx_runtime", "React", "enabled", "sectionOptions", "selected", "menu", "label", "import_jsx_runtime", "React", "AnalyticsDevicesSection", "import_react", "import_react", "import_jsx_runtime", "disabled", "import_react", "import_jsx_runtime", "import_jsx_runtime", "IconGlobe", "name", "normalizeData", "React", "AnalyticsGeographySection", "sectionOptions", "isViewOnly", "import_react", "import_react", "import_jsx_runtime", "disabled", "import_react", "import_jsx_runtime", "import_jsx_runtime", "sectionOptions", "row", "React", "AnalyticsPagesSection", "isViewOnly", "import_react", "import_jsx_runtime", "domain", "sectionOptions", "React", "IconGlobe", "AnalyticsSourcesSection", "import_react", "import_jsx_runtime", "options", "import_jsx_runtime", "sectionOptions", "normalizeData", "React", "AnalyticsTrackingIdsSection", "filter", "import_jsx_runtime", "React", "AnalyticsOverview", "filter", "container", "collectionItem", "isString", "defaultLocaleId", "import_react", "import_jsx_runtime", "React", "setPreset", "setFromDay", "setToDay", "FunnelOverview", "container", "import_jsx_runtime", "active", "React", "page", "Analytics", "wrapper", "scrollContainer", "import_react", "import_react", "headerWrapper", "import_jsx_runtime", "title", "isViewOnly", "enabled", "icon", "headerWrapper", "import_react", "import_jsx_runtime", "import_jsx_runtime", "active", "isViewOnly", "action", "title", "icon", "createContextMenuItems", "rowsContainer", "row", "rowTitle", "options", "import_jsx_runtime", "title", "Icon", "import_react", "header", "label", "import_jsx_runtime", "AnalyticsSidebarUsage", "header", "label", "import_jsx_runtime", "AnalyticsSidebar", "active", "isViewOnly", "name", "step", "rowsContainer", "import_react", "import_jsx_runtime", "dismiss", "blockingBackdrop", "toolbar", "closeIcon", "header", "title", "enabled", "style", "import_react", "isDraft", "isString", "import_react", "container", "tooltip", "hidden", "sectionFilterButton", "import_pluralize", "import_react", "container", "backButton", "panel", "button", "description", "link", "divider", "error", "import_jsx_runtime", "feature", "label", "React", "pluralize", "title", "description", "button", "import_jsx_runtime", "React", "PublishToolbarItem", "button", "hidden", "tooltip", "import_jsx_runtime", "scroll", "import_jsx_runtime", "collectionItem", "React", "PreviewButton", "enabled", "isViewOnly", "import_jsx_runtime", "import_react", "import_react", "list", "emptyStateContainer", "emptyRow", "disabled", "divider", "import_jsx_runtime", "readOnly", "onUpdate", "import_jsx_runtime", "title", "isEditFieldsUseableInScreen", "assert", "stack", "groundNode", "import_jsx_runtime", "description", "title", "warningMessage", "isViewOnly", "import_jsx_runtime", "React", "CollectionItemStatusRow", "isDraft", "import_react", "import_react", "import_react", "container", "table", "cell", "emptyStateContainer", "import_react", "import_jsx_runtime", "style", "imagePreviewThumbnail", "date", "import_jsx_runtime", "control", "ariaLabel", "isString", "background", "title", "style", "imagePreviewThumbnail", "icon", "item", "import_jsx_runtime", "control", "columns", "container", "table", "cell", "emptyStateContainer", "item", "ArrayItemRow", "showContextMenu", "isString", "isNumber", "import_jsx_runtime", "React", "LargeArrayInputRow", "control", "assert", "warning", "warningMessage", "isNumber", "addItem", "getArrayControlPropValue", "removeItem", "item", "moveItem", "import_react", "import_jsx_runtime", "React", "LargeBooleanInputRow", "control", "import_react", "wrapper", "import_react", "import_react", "import_jsx_runtime", "React", "ComboBoxCellPills", "label", "import_jsx_runtime", "React", "ReferenceCellPills", "import_jsx_runtime", "readOnly", "wrapper", "control", "createCollectionItem", "isViewOnly", "import_jsx_runtime", "control", "isString", "import_jsx_runtime", "control", "errorMessage", "import_react", "import_jsx_runtime", "React", "LargeColorInputRow", "control", "import_react", "import_jsx_runtime", "React", "LargeDateInputRow", "control", "errorMessage", "import_react", "import_jsx_runtime", "React", "LargeEnumInputRow", "control", "import_react", "import_jsx_runtime", "React", "LargeFileInputRow", "control", "errorMessage", "import_jsx_runtime", "control", "errorMessage", "import_react", "import_jsx_runtime", "control", "React", "CollectionItemPageLinkingRows", "clearLink", "isLinkToWebPage", "link", "sectionTitle", "import_jsx_runtime", "control", "errorMessage", "inputWrapper", "closeButton", "import_jsx_runtime", "control", "errorMessage", "inputWrapper", "closeButton", "import_react", "import_jsx_runtime", "React", "LargeNumberInputRow", "control", "import_react", "import_jsx_runtime", "getCurrentValue", "control", "isString", "React", "LargeRichTextInputRow", "onUnsavedChange", "errorMessage", "schema", "import_react", "import_jsx_runtime", "control", "popoutId", "import_jsx_runtime", "React", "control", "onUnsavedChange", "import_jsx_runtime", "divider", "import_react", "collectionItem", "link", "isLinkToWebPage", "import_jsx_runtime", "React", "getCurrentValue", "isString", "collectionItem", "control", "link", "isLinkToWebPage", "import_react", "import_jsx_runtime", "React", "LargeStringInputRow", "control", "isString", "errorMessage", "warning", "placeholder", "getPlaceholder", "import_react", "header", "title", "titleWrapper", "import_jsx_runtime", "collectionItem", "header", "titleWrapper", "title", "RelativeTime", "timestamp", "import_jsx_runtime", "import_react", "collectionItem", "React", "control", "import_jsx_runtime", "isViewOnly", "collectionItem", "item", "React", "popoutButton", "getControlProp", "control", "scroll", "visible", "title", "subTitle", "update", "import_react", "container", "button", "parent", "import_jsx_runtime", "isViewOnly", "button", "import_react", "iconBackground", "button", "import_jsx_runtime", "iconBackground", "useHasNewCollectionItemOverlayOpen", "canEditContent", "button", "columns", "row", "cell", "selectionScrollPaddingY", "selectionScrollPaddingX", "isString", "item", "date", "text", "boundaryCharacter", "cell", "row", "collectionItem", "control", "getFileDisplayValue", "title", "isNumber", "cell", "collectionItem", "control", "collectionItem", "date", "item", "isNumber", "control", "cell", "columns", "clamp", "anchor", "cell", "rowCount", "ctx", "row", "control", "isString", "columns", "rowCount", "item", "isLinkToWebPage", "cell", "text", "options", "lookup", "cache", "line", "isNumber", "date", "collectionItem", "parent", "defaultLocaleId", "entries", "error", "controlType", "defaultWidth", "columns", "control", "defaultColumnWidth", "rowHeaderWidth", "fillerColumnMinWidth", "minWidth", "import_react", "columns", "tableRowHeight", "tableRowHeight", "rowHeaderWidth", "tableRowHeight", "rowHeaderWidth", "import_react", "timestamp", "rowHeaderWidth", "defaultColumnWidth", "options", "timestamp", "step", "columns", "rowHeaderWidth", "defaultColumnWidth", "tableRowHeight", "import_react", "isNumber", "rowHeaderWidth", "fillerColumnMinWidth", "defaultColumnWidth", "minWidth", "import_react", "cell", "columns", "cell", "tableContainer", "rowCount", "import_react", "tableRowHeight", "rowCount", "import_react", "tableRowHeight", "React", "timestamp", "step", "rowCount", "tableRowHeight", "import_react", "cell", "options", "tableRowHeight", "rowHeaderWidth", "defaultColumnWidth", "maxColumnWidth", "rowCount", "import_react", "import_react", "import_react", "observer", "import_react", "import_jsx_runtime", "import_react", "control", "isString", "title", "import_jsx_runtime", "item", "cell", "onDismiss", "enabled", "React", "input", "action", "stopPropagation", "ariaLabel", "dismiss", "isNumber", "isString", "link", "placeholder", "popoverWidth", "popoverOffset", "step", "comboBoxItems", "import_jsx_runtime", "ariaLabel", "onMouseDown", "onContextMenu", "import_react", "import_jsx_runtime", "item", "title", "isEnabled", "React", "VirtualCollectionItemTableBooleanBodyCell", "onContextMenu", "ariaLabel", "import_react", "import_react", "cell", "React", "isBoolean", "import_jsx_runtime", "title", "item", "ariaLabel", "onContextMenu", "cell", "isString", "React", "VirtualCollectionItemTableComboBoxBodyCell", "import_react", "import_jsx_runtime", "item", "isString", "ariaLabel", "onContextMenu", "cell", "title", "React", "VirtualCollectionItemTablePopoutBodyCell", "import_jsx_runtime", "React", "VirtualCollectionItemTableBodyCell", "item", "onContextMenu", "VirtualCollectionItemTableDefinedBodyCell", "cell", "content", "ariaLabel", "import_jsx_runtime", "title", "isActive", "onMouseDown", "onContextMenu", "import_react", "isString", "controlType", "import_react", "getValue", "item", "control", "columns", "name", "import_jsx_runtime", "title", "showContextMenu", "popoutId", "import_react", "import_jsx_runtime", "React", "VirtualCollectionItemTableRowHeaderCell", "rowTitle", "onContextMenu", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "IconPlugins", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "NewIconReload", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "React", "ReloadIcon", "NewReloadIcon", "IconPlugins", "import_jsx_runtime", "import_react", "import_jsx_runtime", "popoverOffset", "anchor", "setLocalSortingRules", "from", "container", "searchBar", "import_jsx_runtime", "filter", "input", "container", "searchBar", "item", "selected", "enabled", "title", "label", "onMouseDown", "import_react", "import_react", "import_react", "rowCount", "action", "import_react", "tableRowHeight", "rowHeaderWidth", "React", "timestamp", "step", "cell", "import_react", "cell", "anchor", "React", "buttons", "import_react", "action", "anchor", "React", "import_react", "item", "item", "isString", "collectionItem", "isString", "item", "collectionItem", "isDraft", "isViewOnly", "options", "cell", "item", "from", "import_react", "import_jsx_runtime", "VirtualCollectionItemTableInner", "columns", "rowCount", "cell", "from", "action", "tableContainer", "item", "rowTitle", "container", "rowHeaderWidth", "fillerColumnMinWidth", "import_jsx_runtime", "useCollectionNode", "container", "import_react", "import_react", "import_react", "import_react", "import_react", "import_jsx_runtime", "assert", "import_react", "import_react", "import_jsx_runtime", "isViewOnly", "calculateInsertionIndex", "page", "isEmptyWebPage", "options", "import_jsx_runtime", "DraggablePageRow", "name", "isEnabled", "isViewOnly", "icon", "row", "import_react", "from", "import_jsx_runtime", "isViewOnly", "React", "row", "WithRefDraggablePageRow", "import_react", "import_jsx_runtime", "isViewOnly", "React", "row", "WithRefDraggablePageRow", "withRefDraggablePageRow", "import_react", "import_jsx_runtime", "KitPages", "isViewOnly", "row", "WithRefDraggablePageRow", "withRefDraggablePageRow", "import_react", "import_react", "rowContainer", "draggableRowContainer", "draggedOver", "dropTargetContainer", "dropTarget", "row", "createFolderFromSelection", "row", "row", "getBulkDeleteData", "isViewOnly", "createFolderFromSelection", "row", "import_react", "import_jsx_runtime", "import_jsx_runtime", "insertionIndicatorOffset", "isViewOnly", "isVariant", "id", "canMoveSegment", "updateDragoverSegmentIfNeeded", "dropTargetContainer", "dropTarget", "getDragPreviewRows", "parent", "title", "description", "isDraft", "badge", "enabled", "visible", "import_pluralize", "item", "isLinkToWebPage", "link", "isLinkToWebPage", "inlineLink", "import_jsx_runtime", "pluralize", "item", "error", "description", "isViewOnly", "import_jsx_runtime", "RouteSegmentRow", "isViewOnly", "isDraft", "getMenuOptions", "Icon", "rowContainer", "draggableRowContainer", "getDragPreviewRows", "badge", "draggedOver", "warningMessage", "import_react", "import_jsx_runtime", "isViewOnly", "Icon", "title", "handleTitleChange", "name", "getMenuOptions", "rowContainer", "getDragPreviewRows", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "getSelectedPageIdFromActivePage", "row", "routeSegmentList", "isViewOnly", "import_jsx_runtime", "isViewOnly", "activePageId", "canvasLocaleId", "routerLocales", "row", "leadingSlashRegex", "filter", "import_react", "inputWrapper", "import_jsx_runtime", "comboBoxItems", "enabled", "inputWrapper", "name", "label", "scroll", "import_jsx_runtime", "stopPropagation", "createFolder", "page", "isViewOnly", "React", "HeaderActionItem", "title", "mouseDownHandler", "label", "ContentPanelPagesTab", "filter", "kitPageRows", "designPageRows", "canvasPageRows", "name", "scroll", "import_jsx_runtime", "useCollectionNode", "name", "item", "list", "emptyStateContainer", "emptyStateVariables", "title", "React", "CollectionFieldRow", "getMenuOptions", "popoutId", "disabled", "from", "parent", "emptyRow", "rowHeight", "divider", "header", "divider", "leftIcon", "import_react", "row", "iconWrapper", "import_jsx_runtime", "Icon", "tooltip", "onMouseDown", "isViewOnly", "indentation", "row", "iconWrapper", "scroll", "sortable", "rowsContainer", "header", "pluginIconWrapper", "canPaste", "import_jsx_runtime", "React", "CollectionPanel", "leftPanel", "isViewOnly", "name", "row", "createContextMenuItems", "scroll", "header", "rowsContainer", "sortable", "showManagedCollectionPlugins", "pluginIconWrapper", "from", "canPaste", "options", "import_react", "panel", "searchWrapper", "scroll", "import_jsx_runtime", "marketplacePluginsUrl", "panel", "searchWrapper", "scroll", "section", "import_jsx_runtime", "import_jsx_runtime", "CollectionLeftPanel", "leftPanel", "header", "divider", "popoverWithin", "leftIcon", "assertNever", "canPaste", "isViewOnly", "import_react", "import_react", "import_react", "noResults", "scroll", "wrapper", "import_react", "log", "isViewOnly", "name", "import_react", "import_jsx_runtime", "React", "ImportMap", "icon", "import_react", "import_jsx_runtime", "log", "ShaderModules", "isViewOnly", "icon", "ShaderAssetItemRow", "name", "handleTitleChange", "error", "getMenuOptions", "content", "isViewOnly", "options", "import_jsx_runtime", "React", "EntityCodeFilesAssetSection", "isViewOnly", "state", "item", "createContextMenu", "row", "options", "node", "import_react", "insertShaderNode", "options", "isViewOnly", "name", "import_react", "import_react", "badge", "import_jsx_runtime", "ExternalAssetItemRow", "title", "isViewOnly", "getMenuOptions", "onUpdate", "onDragStart", "Icon", "onSelect", "id", "import_jsx_runtime", "fallbackName", "ExternalComponents", "isViewOnly", "getMenuOptions", "title", "ExternalComponentAssetFolderRow", "item", "icon", "badge", "ExternalShaderSubFolder", "import_jsx_runtime", "React", "EntityComponentsAssetSection", "isViewOnly", "state", "ctx", "createContextMenu", "useCreateContextMenu", "row", "options", "contextMenu", "import_react", "import_jsx_runtime", "React", "EntityLayoutTemplatesAssetSection", "isViewOnly", "state", "createContextMenu", "useCreateContextMenu", "row", "options", "contextMenu", "import_react", "import_react", "icons", "isString", "control", "import_jsx_runtime", "control", "import_react", "import_jsx_runtime", "import_jsx_runtime", "options", "isViewOnly", "options", "isViewOnly", "import_react", "import_jsx_runtime", "isString", "import_jsx_runtime", "options", "isViewOnly", "getComponentType", "name", "import_jsx_runtime", "name", "getComponentType", "React", "EntityStylesAssetSection", "isViewOnly", "row", "options", "import_react", "import_jsx_runtime", "DEFAULT_FOLDER_ID", "DEFAULT_FOLDER_NAME", "React", "EntityVectorSetsAssetSection", "isViewOnly", "state", "createContextMenu", "useCreateContextMenu", "row", "emptyCollapsedSet", "ExternalVectorSets", "onUpdate", "onDragStart", "ExternalVectorAssetFolderRow", "title", "icon", "badge", "item", "options", "contextMenu", "import_jsx_runtime", "React", "Assets", "isViewOnly", "row", "from", "wrapper", "scroll", "noResults", "header", "import_jsx_runtime", "onSelect", "React", "header", "import_jsx_runtime", "React", "ContentPanel", "leftPanel", "import_react", "import_jsx_runtime", "title", "import_react", "import_jsx_runtime", "React", "InsertSidebarItem", "item", "isViewOnly", "error", "category", "meta", "onDragStart", "exitMode", "floating", "itemTitle", "withDropTargetHover", "isNumber", "localModuleIdentifier", "isLayoutSection", "parent", "center", "externalModuleIdentifier", "minWidth", "minHeight", "import_jsx_runtime", "sectionTitle", "item", "import_react", "import_react", "import_jsx_runtime", "InsertSidebarSection", "section", "import_react", "visible", "isNumber", "import_jsx_runtime", "visible", "error", "title", "section", "meta", "isNumber", "getClipboardData", "import_react", "React", "control", "text", "import_jsx_runtime", "InsertSidebar", "React", "leftPanel", "categories", "visible", "activeCategory", "category", "debounce", "emptyState", "SectionCategory", "selected", "onSelect", "mouseMoveHandler", "import_react", "progress", "progress", "label", "import_jsx_runtime", "isViewOnly", "progress", "label", "defaultLocaleId", "import_react", "import_jsx_runtime", "marketplacePluginsUrl", "useSelectedManifestId", "divider", "scroll", "import_react", "borderTop", "header", "label", "warningTint", "import_jsx_runtime", "React", "LocalizationFooterUpsell", "borderTop", "header", "label", "warningTint", "import_jsx_runtime", "React", "LocalizationSidebar", "CollectionPanelTabs", "scroll", "divider", "getMenuOptions", "from", "sortable", "import_react", "container", "header", "headerButton", "collapseIndicator", "noShrink", "group", "row", "rowButton", "bottomSeparator", "imagePreviewThumbnail", "fullWidth", "actionButton", "actionButtonActive", "import_react", "button", "import_jsx_runtime", "group", "status", "button", "title", "action", "import_react", "import_react", "React", "text", "isViewOnly", "React", "isString", "managedByPlugin", "generatedByAI", "options", "import_jsx_runtime", "popoverOffset", "active", "enabled", "actionButton", "actionButtonActive", "managedByPlugin", "placeholder", "React", "label", "rowButton", "fullWidth", "popoverAttachmentEdge", "LocalizationSourceRow", "row", "bottomSeparator", "imagePreviewThumbnail", "item", "status", "activeStatus", "icon", "group", "getBatchTranslatableKeyPaths", "name", "readOnly", "assert", "collectionItem", "collapseIndicator", "noShrink", "scroll", "container", "header", "headerButton", "LocalizationTable", "import_react", "arrow", "import_jsx_runtime", "enabled", "arrow", "overlay", "scroll", "toolbarButton", "grow", "textArea", "import_jsx_runtime", "textArea", "import_jsx_runtime", "dismiss", "insertButtonPopoverOptions", "blurActiveInput", "Overlay", "singleColumn", "scroll", "item", "managedByPlugin", "React", "schema", "overlay", "showLocaleOptions", "grow", "toolbarButton", "import_react", "React", "container", "fullHeight", "import_react", "toolbarButton", "import_react", "button", "import_jsx_runtime", "React", "buildMenu", "content", "button", "name", "import_jsx_runtime", "React", "toolbarButton", "import_react", "window", "isFunction", "import_jsx_runtime", "getMaxWidth", "isNumber", "toolbar", "visible", "React", "window", "import_jsx_runtime", "log", "container", "fullHeight", "import_jsx_runtime", "React", "CodeEditorPreview", "import_react", "import_react", "import_jsx_runtime", "PreviewContainer", "hidden", "import_react", "import_jsx_runtime", "handleWidth", "wrapper", "background", "content", "previewContainer", "handleWidth", "import_jsx_runtime", "visible", "React", "maxHeight", "debounce", "onDragStart", "wrapper", "background", "content", "LoadingIndicator", "import_jsx_runtime", "log", "OverCanvasPreview", "style", "visible", "import_react", "import_pluralize", "import_react", "content", "avatarRadius", "avatarText", "plusIcon", "import_react", "import_react", "onDismiss", "hide", "popover", "import_jsx_runtime", "entries", "React", "content", "plusIcon", "pluralize", "avatarRadius", "avatarText", "import_react", "import_jsx_runtime", "LocalizationToolbarItem", "enabled", "import_react", "import_react", "import_jsx_runtime", "React", "ModeToggle", "max", "breakpoints", "import_react", "import_jsx_runtime", "enabled", "maxHeight", "breakpoints", "React", "name", "import_jsx_runtime", "React", "ReloadIcon", "import_react", "import_react", "import_react", "import_react", "inputWrapper", "import_jsx_runtime", "isEditing", "React", "inputWrapper", "container", "title", "contentContainer", "import_react", "enabled", "React", "uploadedImages", "error", "import_react", "React", "import_react", "isViewOnly", "import_jsx_runtime", "handleTitleChange", "versionBadge", "container", "title", "contentContainer", "import_react", "popover", "import_react", "import_jsx_runtime", "anchor", "popoverOffset", "popover", "title", "rowTitle", "hostname", "popover", "import_jsx_runtime", "React", "ProjectBarTitleLayout", "import_jsx_runtime", "React", "KitProjectBarTitle", "import_react", "hostname", "branchName", "import_react", "iconWrapper", "import_jsx_runtime", "isViewOnly", "label", "React", "iconWrapper", "import_react", "import_jsx_runtime", "isViewOnly", "title", "React", "import_jsx_runtime", "import_react", "import_jsx_runtime", "import_react", "scroll", "divider", "searchBar", "footerButton", "contextMenuButton", "avatarContainer", "import_jsx_runtime", "assert", "scroll", "searchBar", "divider", "footerButton", "isActive", "contextMenu", "button", "avatarContainer", "contextMenuButton", "title", "isEditing", "input", "stopPropagation", "max", "visit", "container", "button", "import_jsx_runtime", "React", "ProjectBarBranch", "container", "button", "import_jsx_runtime", "React", "hostname", "popover", "rowTitle", "RegularProjectBarTitle", "title", "handleOpenLink", "container", "import_jsx_runtime", "React", "ProjectBarTitle", "title", "menuButton", "backButton", "chevron", "import_react", "menu", "import_jsx_runtime", "item", "isNumber", "action", "menu", "enabled", "dismiss", "animate", "filteredItems", "actionManager", "import_jsx_runtime", "IconFramerLogo", "import_jsx_runtime", "title", "onMouseDown", "menuButton", "IconFramerLogo", "chevron", "import_react", "import_react", "import_jsx_runtime", "React", "ReloadIcon", "import_jsx_runtime", "bar", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "shapeTools", "React", "Toolbar", "leftPanel", "overlay", "isViewOnly", "bar", "import_jsx_runtime", "import_jsx_runtime", "title", "backButton", "sectionFilterButton", "error", "canEditContent", "enabled", "displayInvitePopover", "container", "hidden", "PreviewButton", "togglePreview", "previewAccelerator", "previewButton", "import_jsx_runtime", "React", "ProjectBar", "ProjectBarInner", "import_react", "import_jsx_runtime", "title", "import_react", "container", "header", "import_react", "commentText", "import_jsx_runtime", "onSelect", "author", "replyCount", "commentText", "import_jsx_runtime", "log", "container", "header", "import_react", "title", "subtitle", "container", "import_jsx_runtime", "container", "icons", "import_jsx_runtime", "log", "getLogger", "onSelect", "selected", "animate", "title", "subtitle", "panel", "scroll", "divider", "emptyState", "spinner", "import_jsx_runtime", "React", "loadingState", "threshold", "name", "panel", "divider", "scroll", "spinner", "emptyState", "import_react", "import_react", "import_jsx_runtime", "enabled", "import_react", "panelContainer", "sortable", "import_react", "container", "popoutWrapper", "import_react", "divider", "import_react", "controlHitboxSize", "controlKnobSideOffset", "import_react", "controlKnobSize", "import_react", "controlHitboxSize", "controlKnobSideOffset", "import_jsx_runtime", "onDragStart", "import_jsx_runtime", "ariaLabel", "description", "onDragStart", "divider", "import_jsx_runtime", "AnalyticsFunnelSidebarOptionsPanel", "isViewOnly", "popoutWrapper", "container", "import_react", "import_jsx_runtime", "isViewOnly", "comboBoxItems", "filter", "options", "item", "import_jsx_runtime", "isViewOnly", "item", "import_react", "import_react", "import_react", "action", "import_react", "import_jsx_runtime", "CustomTrackingIdInput", "placeholder", "disabled", "import_jsx_runtime", "CustomEventStepForm", "action", "container", "import_react", "import_react", "import_jsx_runtime", "RoutePathComboBox", "placeholder", "disabled", "title", "comboBoxItems", "import_jsx_runtime", "PageviewStepForm", "comboBoxItems", "action", "item", "title", "import_react", "link", "import_react", "deleteIcon", "import_jsx_runtime", "TrackingIdComboBox", "placeholder", "disabled", "deleteIcon", "comboBoxItems", "import_jsx_runtime", "TrackingIdStepForm", "comboBoxItems", "action", "item", "import_jsx_runtime", "onSelect", "disabled", "import_jsx_runtime", "FunnelStepPopout", "name", "step", "action", "container", "import_jsx_runtime", "AnalyticsFunnelSidebar", "active", "isViewOnly", "from", "categories", "menu", "label", "filter", "panelContainer", "sortable", "step", "icon", "import_react", "import_react", "import_react", "container", "panelHeader", "iconContainer", "import_react", "import_react", "comment", "import_react", "container", "button", "content", "title", "status", "import_jsx_runtime", "FeedbackItem", "author", "date", "status", "onSelect", "onContextMenu", "container", "button", "content", "title", "min", "global", "global", "RegExp", "regex", "name", "anObject", "toLength", "advanceStringIndex", "regExpExec", "name", "isRegExp", "anObject", "advanceStringIndex", "toLength", "separator", "$export", "toObject", "fails", "anObject", "$flags", "define", "TO_STRING", "$toString", "test", "$export", "$export", "getKeys", "global", "hide", "proto", "import_es6_array", "toObject", "$export", "$export", "$export", "$export", "$export", "global", "DESCRIPTORS", "$export", "redefine", "wks", "isArray", "anObject", "isObject", "toObject", "toIObject", "$keys", "gOPD", "dP", "gOPN", "Symbol", "name", "getOwnPropertySymbols", "import_es6_array", "$export", "toObject", "toLength", "createProperty", "step", "text", "import_jsx_runtime", "text", "hasOnlyEmoji", "comment", "isUnread", "isEdited", "hasSendError", "onContextMenu", "status", "container", "scroll", "menuButton", "import_react", "scrollContainer", "import_jsx_runtime", "comments", "ImmutableMap", "scrollContainer", "container", "menuButton", "scroll", "onContextMenu", "comment", "text", "import_react", "comment", "hasOnlyEmoji", "container", "import_jsx_runtime", "comments", "onSelect", "onContextMenu", "comment", "replies", "hasOnlyEmoji", "status", "container", "replyCount", "import_jsx_runtime", "currentUser", "handleTabChange", "container", "panelHeader", "tabContent", "selected", "item", "content", "iconContainer", "container", "import_jsx_runtime", "container", "import_jsx_runtime", "_a", "React", "currentUser", "isActive", "import_react", "panelContainer", "scroll", "footer", "import_react", "import_jsx_runtime", "React", "IconSectionHeaderMinus", "import_jsx_runtime", "LocalizedValuePanel", "handleUpdate", "panelContainer", "isViewOnly", "item", "scroll", "footer", "control", "name", "React", "isString", "import_react", "header", "title", "import_jsx_runtime", "title", "style", "header", "import_jsx_runtime", "title", "style", "React", "import_jsx_runtime", "style", "framePreset", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "log", "service", "options", "options", "window", "error", "options", "options", "log", "error", "options", "name", "isString", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "LayoutTemplateSelector", "enabled", "onSelect", "name", "import_react", "import_react", "import_jsx_runtime", "variants", "control", "title", "isString", "subtitle", "import_jsx_runtime", "title", "subtitle", "import_react", "import_react", "import_jsx_runtime", "React", "OverlayTriggerRow", "emptyResult", "overlay", "import_jsx_runtime", "readOnly", "assert", "comboBoxItems", "rule", "import_react", "import_jsx_runtime", "title", "placeholder", "readOnly", "React", "import_jsx_runtime", "readOnly", "import_react", "import_jsx_runtime", "title", "readOnly", "React", "import_jsx_runtime", "date", "readOnly", "title", "label", "import_jsx_runtime", "scopeType", "readOnly", "showContextMenu", "import_jsx_runtime", "readOnly", "addInteraction", "showContextMenu", "getShowContextMenu", "onUpdate", "import_react", "import_jsx_runtime", "React", "TriggerActionsPanel", "scopeType", "readOnly", "node", "popoutId", "group", "variants", "action", "title", "showContextMenu", "isString", "import_react", "React", "import_jsx_runtime", "React", "CodeComponentControlPropsPanel", "scopeType", "readOnly", "control", "variants", "node", "isString", "popoutId", "import_jsx_runtime", "React", "LayoutTemplatePropsPanel", "enabled", "hasLayoutTemplate", "onMouseDown", "name", "import_react", "import_react", "wrapper", "container", "import_jsx_runtime", "IconAlignBottom", "import_jsx_runtime", "IconAlignCenter", "import_jsx_runtime", "IconAlignLeft", "import_jsx_runtime", "IconAlignMiddle", "import_jsx_runtime", "IconAlignRight", "import_jsx_runtime", "IconAlignTop", "import_jsx_runtime", "IconDistributeHorizontal", "import_jsx_runtime", "IconDistributeVertical", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "buttons", "IconAlignLeft", "IconAlignCenter", "IconAlignRight", "IconAlignTop", "IconAlignMiddle", "IconAlignBottom", "IconDistributeHorizontal", "IconDistributeVertical", "React", "wrapper", "container", "enabled", "getTooltip", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "isNumber", "import_react", "import_jsx_runtime", "React", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "React", "control2", "import_jsx_runtime", "React", "import_react", "import_react", "evalMath", "import_react", "import_jsx_runtime", "traits", "React", "import_jsx_runtime", "React", "StrokePanel", "readOnly", "isString", "isNumber", "Icon", "evalMath", "filter", "import_react", "import_react", "import_jsx_runtime", "updateSelectionColor", "import_jsx_runtime", "React", "updateSelectionColor", "isNumber", "parent", "import_jsx_runtime", "scopeType", "shadows", "isNumber", "isBoolean", "isString", "assert", "React", "StyleHeader", "import_jsx_runtime", "React", "readOnly", "scopeType", "container", "import_react", "import_react", "import_react", "import_jsx_runtime", "traitTypeKeys", "ariaLabel", "createVariable", "isString", "React", "import_react", "import_jsx_runtime", "traitTypeKeys", "React", "DataNosnippetRow", "import_react", "import_jsx_runtime", "traitTypeKeys", "React", "import_react", "import_jsx_runtime", "traitTypeKeys", "htmlTextTags", "isString", "import_react", "import_jsx_runtime", "traitTypeKeys", "React", "createVariable", "isNumber", "import_jsx_runtime", "title", "description", "import_jsx_runtime", "React", "AccessibilityPanel", "readOnly", "ariaLabel", "title", "description", "htmlTextTags", "isLink", "import_react", "import_jsx_runtime", "React", "enabled", "import_react", "import_react", "import_jsx_runtime", "getTitle", "enabled", "title", "React", "Padlock", "disabled", "import_react", "import_jsx_runtime", "popoutId", "React", "ZIndexRow", "createVariable", "isNumber", "min", "max", "import_react", "import_jsx_runtime", "backdrop", "React", "import_jsx_runtime", "traitTypes", "React", "BackdropPanel", "createVariable", "isString", "isBoolean", "import_react", "import_react", "import_react", "container", "import_jsx_runtime", "mask", "progress", "assertNever", "container", "import_jsx_runtime", "title", "min", "max", "onChangeUnit", "import_jsx_runtime", "mask", "MaskPopout", "MaskPopoutButton", "title", "popoutId", "import_jsx_runtime", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "titles", "title", "import_react", "React", "import_jsx_runtime", "React", "EffectRow", "title", "import_jsx_runtime", "React", "FlowEffectRow", "import_react", "import_jsx_runtime", "item", "onSelect", "section", "options", "import_jsx_runtime", "item", "onSelect", "import_jsx_runtime", "name", "mask", "MaskPopoutButton", "title", "page", "React", "BreakpointEffectsPanel", "readOnly", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "name", "style", "indentation", "divider", "fallbackName", "uniqueVariableName", "import_jsx_runtime", "button", "import_react", "import_react", "link", "import_jsx_runtime", "name", "React", "value", "item", "content", "isNumber", "isBoolean", "clickable", "link", "import_jsx_runtime", "actions", "control", "controlType", "item", "isString", "isNumber", "isBoolean", "action", "getSlotItemDisplayProperty", "import_react", "import_jsx_runtime", "React", "name", "style", "svg", "indentation", "regex", "line", "tokens", "import_jsx_runtime", "isViewOnly", "React", "name", "list", "text", "content", "contentWrapper", "emptyState", "button", "fullWidth", "actions", "action", "label", "import_jsx_runtime", "React", "isViewOnly", "container", "import_react", "import_jsx_runtime", "React", "CodeOverridesPanel", "readOnly", "scopeType", "menu", "label", "control", "from", "overrideTitles", "item", "name", "import_react", "isString", "import_react", "import_react", "import_jsx_runtime", "React", "FloatingAlignmentRow", "Icon", "import_react", "import_jsx_runtime", "IconPosition", "React", "import_react", "cursors", "canCopy", "React", "import_jsx_runtime", "React", "cursor", "selected", "isString", "scopeType", "traitTypes", "CustomCursorRow", "canPasteCursor", "pasteCursor", "copyCursor", "createVariable", "import_react", "import_jsx_runtime", "useCustomCursorCallback", "isString", "CustomCursorPopout", "React", "CursorPopout", "title", "CustomCursorRow", "canPasteCursor", "pasteCursor", "copyCursor", "scopeType", "cursor", "import_jsx_runtime", "React", "CursorPanel", "cursor", "scopeType", "readonly", "onContextMenu", "import_react", "import_jsx_runtime", "React", "CustomizationsPanel", "parent", "description", "import_react", "import_jsx_runtime", "React", "selected", "canvasRect", "parent", "import_react", "import_jsx_runtime", "React", "DataLoaderVariantsPanel", "readonly", "import_react", "control", "import_react", "import_jsx_runtime", "enabled", "import_pluralize", "getPreset", "controlType", "options", "placeholder", "icon", "placeAboveNodeIndex", "groundNode", "label", "filter", "transform", "createVariable", "import_react", "import_jsx_runtime", "rowTitle", "React", "CollectionFiltersRow", "filter", "isString", "popoutButtonTitle", "control", "title", "icon", "openVariablesModal", "dynamicFilterPresets", "name", "inputTypes", "transform", "import_react", "setState", "token", "import_react", "import_jsx_runtime", "traitTypeKeys", "addItem", "moveItem", "from", "removeItem", "item", "control", "getMenuOptions", "isString", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "React", "RepeaterPaginationRow", "isNumber", "title", "icon", "import_jsx_runtime", "React", "DataRepeaterPanel", "readOnly", "isString", "import_react", "import_react", "import_jsx_runtime", "getComponentType", "import_jsx_runtime", "popoutId", "traitTypeKeys", "name", "style", "import_jsx_runtime", "import_jsx_runtime", "traitTypeKeys", "popoutId", "import_jsx_runtime", "traitTypeKeys", "popoutId", "import_jsx_runtime", "React", "import_react", "import_react", "import_jsx_runtime", "emptyState", "import_jsx_runtime", "action", "scopeType", "onChangeTrigger", "error", "emptyState", "replaceHandler", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "action", "import_jsx_runtime", "scopeType", "React", "EventActionPopoutButton", "title", "item", "action", "link", "isLinkToWebPage", "isString", "import_jsx_runtime", "scopeType", "readOnly", "React", "actions", "action", "title", "eventKey", "import_react", "input", "disabled", "import_jsx_runtime", "React", "placeHolder", "enabled", "input", "isString", "disabled", "import_react", "import_jsx_runtime", "React", "options", "row", "isViewOnly", "isString", "row", "enabled", "list", "options", "import_react", "import_react", "import_jsx_runtime", "title", "enabled", "import_react", "import_jsx_runtime", "React", "ExportIncludesBackgroundRow", "isViewOnly", "import_jsx_runtime", "React", "row", "isViewOnly", "name", "import_react", "import_jsx_runtime", "React", "FilterRow", "isNumber", "filter", "max", "import_react", "import_jsx_runtime", "React", "FloatingPositionPanel", "import_react", "import_react", "button", "spinner", "import_jsx_runtime", "button", "spinner", "import_react", "warningWrapper", "clearButton", "import_jsx_runtime", "threshold", "debounce", "import_react", "import_react", "isBoolean", "authLink", "import_react", "import_react", "grow", "import_jsx_runtime", "name", "grow", "import_jsx_runtime", "import_jsx_runtime", "currentUser", "error", "clearButton", "warningWrapper", "isString", "import_jsx_runtime", "iconBackground", "import_jsx_runtime", "link", "antispam", "import_react", "import_jsx_runtime", "import_jsx_runtime", "label", "placeholder", "import_react", "import_jsx_runtime", "popoutId", "isBoolean", "import_react", "import_jsx_runtime", "traitTypeMap", "popoutId", "isNumber", "title", "React", "import_jsx_runtime", "popoutId", "createVariable", "import_jsx_runtime", "popoutId", "createVariable", "import_jsx_runtime", "popoutId", "createVariable", "import_jsx_runtime", "popoutId", "isString", "createVariable", "import_jsx_runtime", "popoutId", "isString", "updatePlaceholder", "createVariable", "import_react", "import_jsx_runtime", "popoutId", "createVariable", "import_react", "import_jsx_runtime", "popoutId", "isString", "createVariable", "import_react", "import_react", "import_jsx_runtime", "React", "SelectOptionPopout", "title", "disabled", "OptionTypeRow", "onSelect", "type", "OptionValueRow", "value", "OptionTitleRow", "OptionEnabledRow", "OptionSelectedRow", "selected", "import_jsx_runtime", "options", "from", "sortable", "import_react", "import_jsx_runtime", "popoutId", "traitTypes", "createVariable", "title", "import_react", "import_jsx_runtime", "popoutId", "React", "isString", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "scopeType", "import_react", "import_react", "import_jsx_runtime", "controlType", "control", "onContextMenu", "sortable", "traitTypeKeys", "popoutId", "title", "isString", "createVariable", "name", "import_react", "import_react", "import_react", "import_jsx_runtime", "title", "popoutId", "control", "React", "FontPopout", "fonts", "value", "isNumber", "variationAxes", "import_jsx_runtime", "control", "popoutId", "title", "import_jsx_runtime", "control", "popoutId", "canCopy", "isString", "isNumber", "canPaste", "import_jsx_runtime", "isString", "isNumber", "import_react", "import_jsx_runtime", "React", "FormVariantsPanel", "readonly", "import_react", "grid", "import_jsx_runtime", "options", "disabled", "grid", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "GridItemSpanRows", "isNumber", "import_react", "textArea", "import_jsx_runtime", "React", "KitsCustomizationsPanel", "parent", "category", "textArea", "import_react", "import_jsx_runtime", "popoutId", "referenceInfo", "React", "OverflowRow", "onSelect", "enabled", "options", "OverflowPanel", "import_react", "import_pluralize", "import_react", "import_react", "import_jsx_runtime", "grid", "token", "iconWrapper", "titleWrapper", "closeWrapper", "disabled", "import_jsx_runtime", "React", "OverlayGridPopoutButton", "enabled", "onContextMenu", "grid", "disabled", "token", "iconWrapper", "titleWrapper", "closeWrapper", "isNumber", "isString", "pluralize", "import_jsx_runtime", "React", "enabled", "isNumber", "isString", "import_react", "import_jsx_runtime", "actions", "action", "React", "OverlaysPanel", "readOnly", "scopeType", "node", "menu", "enabled", "parent", "overlay", "import_react", "import_jsx_runtime", "React", "titles", "title", "onSelect", "placeholder", "import_react", "import_jsx_runtime", "React", "import_react", "import_jsx_runtime", "React", "isString", "titles", "name", "content", "readOnly", "getPlaceholder", "import_react", "import_jsx_runtime", "traitTypes", "popoutId", "React", "OverscrollBehaviorPanel", "canCopy", "canPaste", "createVariable", "container", "import_jsx_runtime", "layer", "container", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "pin", "React", "mouseLeave", "enabled", "pinCenter", "readOnly", "import_react", "parent", "pin", "import_jsx_runtime", "isNumber", "assertNever", "React", "parent", "traitTypes", "import_jsx_runtime", "React", "debounce", "pin", "pins", "preview", "import_react", "import_jsx_runtime", "traits", "React", "positionStickyTop", "positionStickyRight", "positionStickyBottom", "positionStickyLeft", "isNumber", "readOnly", "import_react", "import_react", "import_jsx_runtime", "React", "max", "min", "import_react", "import_jsx_runtime", "React", "framePreset", "import_jsx_runtime", "React", "PresetAndOrientationPanel", "import_react", "isString", "import_jsx_runtime", "React", "RepeatPanel", "enabled", "isString", "import_react", "import_jsx_runtime", "React", "ResizeToFitContentPanel", "enabled", "secondaryText", "hash", "input", "import_jsx_runtime", "traitTypes", "isNumber", "readonly", "readOnly", "enabled", "name", "isString", "secondaryText", "hash", "input", "import_react", "import_react", "import_jsx_runtime", "onContextMenu", "React", "popoutId", "action", "initialState", "isString", "assertNever", "seeAllButtonClass", "import_jsx_runtime", "React", "SelectionPropertiesPanel", "colors", "seeAllButtonClass", "onContextMenu", "initialState", "currentToken", "token", "import_react", "import_jsx_runtime", "control", "section", "React", "ShaderControlPropsPanel", "scopeType", "hideTransitionTypeControl", "enabled", "button", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "getTooltip", "enabled", "title", "icon", "isActive", "button", "import_jsx_runtime", "dimension", "onChangeNumber", "validRawValues", "isNumber", "options", "dimensions", "isString", "dimension", "rect", "update", "isString", "isNumber", "parent", "input", "import_react", "import_jsx_runtime", "dimension", "traitTypes", "traitTypeKeys", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "React", "traitTypes", "import_react", "import_jsx_runtime", "isNumber", "gap", "columnGap", "isString", "import_jsx_runtime", "gap", "columnGap", "isNumber", "grid", "rect", "Icon", "import_jsx_runtime", "alignmentTraitKeys", "gap", "columnGap", "AlignmentRow", "padding", "isString", "Icon", "import_jsx_runtime", "stackTraitTypes", "React", "StackAndGridLayoutPanel", "padding", "gap", "columnGap", "readOnly", "import_react", "import_jsx_runtime", "isNumber", "import_react", "import_react", "import_jsx_runtime", "traitTypeKeys", "Popout", "import_react", "emptyResult", "import_jsx_runtime", "traitTypeKeys", "import_react", "import_react", "import_jsx_runtime", "import_jsx_runtime", "traitTypeKeys", "import_react", "import_jsx_runtime", "traitTypeKeys", "textColor", "breakpoints", "disabled", "import_jsx_runtime", "variableTypes", "React", "isString", "name", "groundNode", "text", "isNumber", "updatedFontSize", "feature", "fonts", "readOnly", "textColor", "shadows", "fill", "disabled", "Icon", "item", "title", "import_react", "import_react", "import_jsx_runtime", "popoutId", "isNumber", "traitTypes", "React", "PerspectiveRow", "createVariable", "import_react", "import_jsx_runtime", "React", "BackfaceVisibilityRow", "import_react", "import_jsx_runtime", "React", "DepthRow", "import_react", "import_jsx_runtime", "React", "OriginRow", "import_react", "import_jsx_runtime", "React", "Rotation3DRow", "Rotation2DRow", "popoutId", "canCopy", "isNumber", "import_react", "import_jsx_runtime", "React", "ScaleRow", "value", "import_react", "import_jsx_runtime", "React", "SkewRow", "import_react", "import_jsx_runtime", "React", "TransformStyleRow", "import_jsx_runtime", "canPaste", "React", "TransformsPanel", "readonly", "isNumber", "isBoolean", "onContextMenu", "import_jsx_runtime", "traitTypes", "import_react", "import_jsx_runtime", "popoutId", "separator", "React", "BlendModeRow", "createVariable", "import_react", "import_jsx_runtime", "popoutId", "title", "React", "DraggableRow", "createVariable", "isBoolean", "import_react", "import_jsx_runtime", "hideTransitionTypeControl", "scopeType", "isString", "React", "DragEffectRow", "actions", "action", "overlay", "import_react", "import_react", "import_jsx_runtime", "stopPropagation", "React", "import_react", "import_react", "import_jsx_runtime", "rotationKeys", "isString", "import_jsx_runtime", "scopeType", "shadow", "isString", "React", "PressEffectRow", "HoverEffectRow", "import_react", "import_jsx_runtime", "traitTypes", "variableTypes", "trackingMetadata", "padding", "isString", "isNumber", "React", "LightboxEffectRow", "import_jsx_runtime", "setEffectTypePreview", "delay", "import_react", "import_jsx_runtime", "React", "StrokeEffectRow", "isNumber", "StrokeEffectPopout", "import_react", "import_react", "import_jsx_runtime", "presetKeys", "hashes", "React", "import_jsx_runtime", "onSelect", "import_jsx_runtime", "threshold", "onSelect", "import_jsx_runtime", "import_jsx_runtime", "threshold", "onSelect", "import_jsx_runtime", "setEffectTypePreview", "getAdditiveKeyForUpdate", "scopeType", "React", "StyleAppearEffectRow", "import_react", "dividerAbove", "scroll", "buttonContainer", "import_jsx_runtime", "hideTransitionTypeControl", "useEffectUpdate", "isSupportedTrigger", "exitEffectPreview", "scopeType", "React", "style", "scroll", "isNumber", "dividerAbove", "buttonContainer", "StyleTransformEffectRow", "collectionItem", "onSelect", "title", "import_react", "import_react", "import_jsx_runtime", "presetKeys", "hashes", "setEffect", "createPresetHash", "React", "import_react", "import_jsx_runtime", "isString", "React", "TextEffectPreview", "text", "import_jsx_runtime", "supportedEffectTriggers", "isSupportedTrigger", "React", "TextEffectPopout", "scopeType", "TextEffectRow", "import_react", "import_jsx_runtime", "React", "TickerEffectRow", "useEffectUpdate", "isNumber", "isBoolean", "options", "onSelect", "import_react", "import_jsx_runtime", "supportedEffectTriggers", "isSupportedTrigger", "defaultEffect", "maxSections", "maxRows", "maxHeight", "ThresholdRow", "threshold", "onSelect", "variants", "scopeType", "scroll", "getTarget", "updateTarget", "removeTarget", "React", "isNumber", "collectionItem", "dividerAbove", "buttonContainer", "import_jsx_runtime", "React", "EffectsHeader", "scopeType", "readOnly", "import_react", "import_jsx_runtime", "React", "FillOpacityRow", "createVariable", "isNumber", "step", "max", "import_react", "import_react", "import_react", "import_jsx_runtime", "React", "BorderControlPropRow", "control", "onContextMenu", "traitTypeKeys", "popoutId", "title", "import_jsx_runtime", "isString", "import_jsx_runtime", "popoutId", "setEffectTypePreview", "canPaste", "onContextMenu", "React", "import_react", "import_react", "import_jsx_runtime", "React", "InputIconRow", "isString", "canPaste", "InputIconPopout", "uploadImage", "import_jsx_runtime", "canCopy", "popoutId", "traits", "setEffectTypePreview", "React", "FormBooleanCheckedEffectRow", "canPaste", "CheckedStylePopout", "isString", "import_react", "import_jsx_runtime", "canCopy", "isString", "canPaste", "import_react", "import_jsx_runtime", "isString", "import_react", "import_jsx_runtime", "popoutId", "traitTypeKeys", "React", "ImageRenderingRow", "createVariable", "import_react", "import_jsx_runtime", "opacityTraitTypes", "popoutId", "React", "OpacityRow", "parent", "createVariable", "isNumber", "import_react", "import_jsx_runtime", "popoutId", "traitTypeKeys", "React", "PointerEventsRow", "createVariable", "import_react", "import_jsx_runtime", "traitTypes", "React", "PositionTypeRow", "scopeType", "title", "parent", "import_react", "import_jsx_runtime", "popoutId", "React", "ScrollbarsRow", "createVariable", "isBoolean", "import_react", "import_jsx_runtime", "scopeType", "onChangeNumber", "onChangeUnit", "isNumber", "shortTitle", "units", "import_jsx_runtime", "isNumber", "parent", "React", "SizePanelHeader", "readOnly", "title", "traitTypeKeys", "scopeType", "import_react", "import_jsx_runtime", "popoutId", "React", "TapHighlightRow", "createVariable", "isString", "import_react", "import_jsx_runtime", "popoutId", "traitTypeKeys", "React", "UserSelectRow", "createVariable", "import_react", "import_jsx_runtime", "React", "canCopy", "canPaste", "import_react", "import_jsx_runtime", "popoutId", "React", "VisibilityRow", "visible", "isBoolean", "import_jsx_runtime", "scrollOffsetRestorationCache", "React", "readOnly", "scopeType", "title", "isString", "container", "import_react", "import_react", "import_jsx_runtime", "React", "LayoutTemplateEmptyStatePanel", "import_react", "import_react", "step", "steps", "panel", "stepItem", "button", "header", "import_jsx_runtime", "Panel", "panel", "PanelHeader", "title", "subtitle", "header", "stepNumber", "action", "stepItem", "button", "label", "import_jsx_runtime", "steps", "error", "React", "NuxPanelInner", "step", "Panel", "PanelHeader", "Step", "title", "action", "import_react", "import_jsx_runtime", "page", "onDismiss", "Panel", "PanelHeader", "import_jsx_runtime", "import_react", "panel", "import_jsx_runtime", "scrollOffsetRestorationCache", "isViewOnly", "componentHash", "isWebPage", "primaryVariant", "rootFontSize", "panel", "import_react", "panelContainer", "import_jsx_runtime", "anchor", "readOnly", "ScalePanelMemoized", "comboBoxItems", "isNumber", "panelContainer", "import_jsx_runtime", "React", "scopeType", "isViewOnly", "import_react", "React", "header", "divider", "isViewOnly", "import_jsx_runtime", "onContextMenu", "React", "RightPanel", "rightPanel", "onSelect", "isViewOnly", "header", "divider", "import_react", "import_react", "label", "badge", "import_jsx_runtime", "filename", "active", "badge", "label", "title", "name", "import_jsx_runtime", "getTitle", "name", "React", "BreadcrumbBar", "isViewOnly", "BreadcrumbBarInner", "isString", "item", "React", "BreadcrumbItem", "onMouseDown", "isViewOnly", "isEditing", "title", "getTitle", "clickable", "CollectionItemPicker", "isDraft", "itemTitle", "disabled", "import_react", "import_jsx_runtime", "hide", "React", "Crash", "action", "style", "contentContainer", "text", "import_react", "import_react", "import_jsx_runtime", "options", "transform", "parent", "test", "group", "line", "import_react", "import_jsx_runtime", "log", "Link", "link", "text", "error", "import_jsx_runtime", "fill", "Link", "window", "header", "closeIcon", "import_jsx_runtime", "getMaxWidth", "getMaxHeight", "getResizeRect", "minHeight", "noFreedomOfMovement", "resizeWidthVariable", "resizeHeightVariable", "React", "OptimizationIssuesLogWindow", "onDismiss", "maxHeight", "window", "header", "closeIcon", "import_react", "import_react", "emptyStateWrapper", "iconWrapper", "import_jsx_runtime", "isViewOnly", "active", "filter", "getCustomCodeName", "emptyStateWrapper", "item", "title", "CustomCodeRow", "showContextMenu", "iconWrapper", "name", "from", "import_react", "React", "import_jsx_runtime", "link", "iconButton", "inlineLink", "errorMessage", "fullWidth", "description", "form", "import_jsx_runtime", "logger", "CanonicalURL", "isViewOnly", "error", "enabled", "description", "CustomURLForm", "form", "iconButton", "errorMessage", "RewriteHostnameAndPathForm", "hostname", "fullWidth", "import_react", "log", "error", "log", "import_jsx_runtime", "page", "isViewOnly", "error", "option", "domain", "errorMessage", "inlineLink", "input", "iconButton", "import_react", "import_react", "import_jsx_runtime", "page", "error", "import_jsx_runtime", "timestamp", "import_jsx_runtime", "import_react", "table", "tableHeading", "import_jsx_runtime", "hostname", "name", "table", "import_react", "import_jsx_runtime", "hostname", "React", "tableWrapper", "table", "tableHeading", "name", "status", "text", "import_jsx_runtime", "log", "isViewOnly", "React", "hostname", "error", "page", "link", "inlineLink", "import_jsx_runtime", "isViewOnly", "container", "iconContainer", "icon", "title", "subtitle", "button", "import_react", "import_jsx_runtime", "icon", "UnpublishedState", "container", "iconContainer", "title", "subtitle", "button", "import_jsx_runtime", "isViewOnly", "container", "UnpublishedState", "link", "import_react", "actionButton", "import_jsx_runtime", "React", "GoogleAccountConnection", "ConnectGoogleAccountButton", "actionButton", "import_react", "import_jsx_runtime", "page", "React", "UtmTracking", "isViewOnly", "wrapper", "import_jsx_runtime", "import_react", "import_react", "import_react", "container", "preview", "import_jsx_runtime", "React", "ImagePreview", "name", "container", "preview", "import_react", "container", "import_jsx_runtime", "Layout", "label", "description", "container", "React", "UploadButton", "enabled", "ImageUploadInput", "ImageUploadInputForCMSPage", "import_react", "enabled", "React", "uploadedImages", "error", "import_jsx_runtime", "label", "description", "React", "SocialImageSection", "enabled", "options", "control", "import_jsx_runtime", "React", "SocialImageSectionForCMSPage", "page", "isViewOnly", "selected", "control", "isString", "import_react", "wrapper", "title", "description", "import_jsx_runtime", "title", "description", "hostname", "favicon", "wrapper", "import_react", "textArea", "import_jsx_runtime", "SettingTextArea", "name", "label", "enabled", "placeholder", "warning", "description", "textArea", "updateWebMetadata", "newMetadata", "page", "isString", "import_react", "button", "import_jsx_runtime", "PageMetadataSearchSection", "page", "isViewOnly", "wrapper", "ariaLabel", "options", "button", "control", "transform", "import_jsx_runtime", "isViewOnly", "page", "React", "wrapper", "import_jsx_runtime", "isViewOnly", "page", "import_react", "container", "import_jsx_runtime", "container", "import_react", "log", "import_react", "import_react", "separator", "description", "badge", "import_jsx_runtime", "description", "licenseName", "badge", "displayPrice", "highlight", "features", "buttons", "separator", "tabularNumbers", "import_jsx_runtime", "page", "import_react", "description", "import_jsx_runtime", "page", "description", "container", "iconContainer", "icon", "text", "button", "import_jsx_runtime", "container", "iconContainer", "icon", "text", "button", "description", "import_jsx_runtime", "description", "icon", "text", "addOn", "import_react", "menuButton", "import_jsx_runtime", "addOn", "React", "menuButton", "import_jsx_runtime", "title", "page", "body", "import_jsx_runtime", "import_pluralize", "import_react", "container", "divider", "sectionTitle", "link", "import_jsx_runtime", "disabled", "addOn", "title", "description", "getDescription", "getTitle", "name", "container", "sectionTitle", "divider", "pluralize", "link", "titles", "bold", "highlight", "status", "selected", "text", "import_react", "log", "item", "body", "error", "log", "import_jsx_runtime", "editors", "description", "log", "error", "addOn", "import_jsx_runtime", "Plans", "React", "addOn", "button", "action", "displayPrice", "import_react", "import_jsx_runtime", "import_react", "log", "setState", "import_jsx_runtime", "Plans", "import_react", "modal", "import_jsx_runtime", "name", "token", "modal", "table", "headerRow", "name", "text", "row", "cell", "import_jsx_runtime", "formatDate", "disabled", "row", "name", "text", "cell", "import_jsx_runtime", "disabled", "table", "headerRow", "import_jsx_runtime", "isViewOnly", "import_react", "import_jsx_runtime", "page", "isViewOnly", "React", "handleSave", "warningMessage", "import_react", "import_react", "import_jsx_runtime", "iconSize", "React", "enabled", "updateRootMetadata", "import_react", "import_react", "favicon", "import_jsx_runtime", "React", "favicon", "updateRootMetadata", "enabled", "import_jsx_runtime", "React", "enabled", "updateRootMetadata", "favicon", "import_jsx_runtime", "isViewOnly", "React", "import_pluralize", "import_react", "import_react", "import_react", "import_jsx_runtime", "page", "onDismiss", "React", "error", "import_jsx_runtime", "isViewOnly", "React", "wrapper", "import_react", "import_react", "import_jsx_runtime", "page", "isViewOnly", "isEditing", "enabled", "error", "wrapper", "import_react", "name", "title", "description", "import_jsx_runtime", "handleSave", "secondaryText", "isViewOnly", "React", "wrapper", "pluralize", "import_jsx_runtime", "isViewOnly", "import_react", "import_react", "grid", "arrow", "saveButton", "import_react", "grow", "errorMessage", "button", "import_jsx_runtime", "isViewOnly", "onSave", "from", "React", "defaultLocaleId", "handleSave", "section", "item", "grow", "errorMessage", "link", "isLinkToWebPage", "button", "import_jsx_runtime", "isViewOnly", "fromInput", "toInput", "saveButton", "React", "grid", "arrow", "regex", "import_react", "container", "list", "row", "reorderHandleGrabbable", "reorderHandleGrabbing", "arrow", "import_jsx_runtime", "from", "isViewOnly", "React", "container", "list", "isEditing", "onSave", "fromInput", "toInput", "saveButton", "row", "reorderHandleGrabbable", "reorderHandleGrabbing", "arrow", "import_jsx_runtime", "isViewOnly", "import_react", "import_jsx_runtime", "title", "Icon", "import_react", "import_jsx_runtime", "React", "SiteSettingsRouteSegmentRow", "isDraft", "title", "Icon", "badge", "import_react", "import_jsx_runtime", "React", "SiteSettingsVariantRow", "Icon", "import_jsx_runtime", "import_jsx_runtime", "import_jsx_runtime", "active", "isViewOnly", "homePageId", "isHomePageAbTesting", "defaultLocaleId", "row", "import_react", "import_react", "import_jsx_runtime", "import_react", "import_jsx_runtime", "import_jsx_runtime", "assertNever", "import_react", "import_react", "banner", "title", "buttonWrapper", "import_jsx_runtime", "React", "banner", "title", "buttonWrapper", "import_jsx_runtime", "title", "import_react", "filename", "import_jsx_runtime", "IconVideo", "IconImage", "import_jsx_runtime", "IconVideo", "IconImage", "React", "import_react", "import_jsx_runtime", "category", "IconVideo", "IconImage", "React", "import_react", "import_jsx_runtime", "React", "import_jsx_runtime", "onSelect", "label", "import_react", "import_jsx_runtime", "titleWrapper", "description", "import_react", "wrapper", "icon", "import_jsx_runtime", "wrapper", "icon", "import_react", "import_jsx_runtime", "hostname", "warning", "description", "getDescription", "import_react", "container", "selected", "sectionTitle", "import_jsx_runtime", "log", "crossfadeAnimation", "selected", "container", "sectionTitle", "action", "label", "import_jsx_runtime", "wrapper", "import_jsx_runtime", "active", "React", "page", "Plans", "SiteSettings", "import_react", "import_jsx_runtime", "React", "StatusBar", "import_react", "hidden", "import_jsx_runtime", "Toaster", "React", "padding", "hidden", "import_jsx_runtime", "React", "action", "InsertSidebar", "container", "Toaster", "import_react", "container", "import_jsx_runtime", "invalidateCodeEditorManager", "React", "visible", "isViewOnly", "container", "import_jsx_runtime", "isViewOnly", "visible", "import_jsx_runtime", "React", "log", "observer", "document", "padding", "action", "import_jsx_runtime", "Document", "React", "error"]
}
